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?”).
BlobLimits
Limits on one store’s blob space (#1007). See State::blob_limits.
State

Enums§

Visibility
Whether a package is reachable without authentication.

Constants§

CAPS
Capabilities this server advertises on /v1/health (#1007). A client states the ones it speaks in the X-Lex-Caps request header (comma-separated).
CAP_FILES_V1
The server stores and serves SetFiles ops and their blobs (#1007).
CAP_INTENT_ORIGIN_V1
The server stores and serves Intent.origin (#892) — the external-VCS provenance of an imported intent. A server without it deserializes an origin-bearing intent, silently drops the unknown field and re-stores an intent whose bytes no longer match its id, so lex op push refuses to send one to a hub that doesn’t advertise this.
REVIEW_KIND
Serde tag of AttestationKind::Review — the value an embedder passes to State::with_reserved_kinds to keep verdicts server-stamped (#1066). Pair it with lex_store::REVIEW_PRODUCER_RESERVATION.
TYPE_CHECK_KIND
Serde tag of AttestationKind::TypeCheck (#1066). Reserving it should wait for signature-checked gates; exported so the name is not retyped.
UNSATISFIABLE_PAIR_HINT
The actionable next step for a refused unsatisfiable pair (#992). Shared with the lex op push client, which prints it verbatim.

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.