Skip to main content

Module handlers

Module handlers 

Source
Expand description

Request routing for the agent API.

Each handler is a synchronous function that returns Result<serde_json::Value, ApiError>. The dispatcher wraps the result in an HTTP response — successes as 200 with the JSON body, structured errors as 4xx/5xx with a JSON envelope.

Structs§

ApiMergeSession
Server-side wrapper around MergeSession carrying the branch names that started the merge. The lex-vcs session itself only tracks OpId heads; commit needs the dst branch name to advance the right head, and the src branch name is kept for round-trip auditability (“which branch did we merge from?”).
State

Enums§

Visibility
Whether a package is reachable without authentication.

Functions§

handle
handle_with_auth
Auth-gated entry point. Calls auth(path, headers) before routing; returns 401 JSON when it returns false. Keeps auth logic out of the product-agnostic core.
route_public
Unauthenticated, read-only access to public packages in state’s store. path is the portion of the URL after /v1/public/<tenant> (with a leading /); lex-hub resolves <tenant> → store and calls this. Visibility gating, GET-only enforcement, and segment validation all live here so the whole public surface is auditable in one place.