Expand description
the server lib: axum Router + handler set. Split out as a library so it can
be used from both main.rs (CLI) and integration tests.
§Endpoints
GET /v1/healthzPOST /v1/sessions/DELETE /v1/sessions(= operator attach / detach, Bearer sid)POST /v1/tasks(= unified Flow-form entry, Operator inject supported;operator_sidexplicitly pins the task to a registered Operator session, S2)POST /v1/operators/GET /v1/operators/:sid/DELETE /v1/operators/:sid/GET /v1/operators/:sid/ws(WS upgrade) — REST-like Operator login flow, Bearer-mandatory; the sole WS Operator session route. Seeoperator_ws::loginmodule doc.
The Enhance issue axis (/issues) lives in the issues module; callers merge
build_issues_router to integrate it into the same server.
§The 3 faces of the Operator role (= registered directly on the engine SoT)
The engine stateless-executor refactor removed the three
AppState registries (former HookRegistry / BridgeRegistry / OperatorRegistry);
all registration now goes directly to the engine SoT via
engine.register_spawn_hook / register_senior_bridge / register_operator.
WSOperatorSession (in the operator_ws module) registers all three traits
simultaneously under a single sid — one WS connection covers all 3 faces of
the Operator role, the canonical pattern.
§build_* family
build_router— minimal entry (=default_registry())build_router_with— caller provides aSpawnerRegistryand optionalBlueprintStore
The engine should be started with default_layer_registry (= Engine::new_with_layers);
otherwise Blueprint.spawner_hints is ignored.
Re-exports§
pub use blueprints::build_blueprints_router;pub use blueprints::build_blueprints_router_with_refs;pub use enhance_log::build_enhance_log_router;pub use enhance_settings::build_enhance_settings_router;pub use issues::build_issues_router;pub use issues::GetIssueResponse;pub use issues::PostIssueRequest;pub use issues::PostIssueResponse;pub use operator_ws::operators_create;pub use operator_ws::operators_delete;pub use operator_ws::operators_info;pub use operator_ws::operators_ws_connect;pub use operator_ws::ClientMsg;pub use operator_ws::OperatorSessionEntry;pub use operator_ws::ServerMsg;pub use operator_ws::WSOperatorSession;pub use worker::worker_prompt;pub use worker::worker_result;pub use worker::PromptQuery;pub use worker::WorkerResultReq;
Modules§
- blueprints
- HTTP surface for inspecting/registering Blueprint state (
/v1/blueprints/*). HTTP surface for inspecting Blueprint state (= for debug / animation verification)./v1/blueprints/:id/headreturns the head Blueprint JSON;/v1/blueprints/:id/historyreturns the commit-version list. Callers pass a sharedStoreviaArcand mount the router. - config
- Server config file support (
~/.mse/config.toml, CLI > file > default merge). Server config file support (~/.mse/config.tomlby default). - data
/v1/data/*endpoints (v9 Big Response handling, Store-owner direct path). HTTP/v1/data/*endpoints (v9 Data path, for Big Response handling).- doctor
GET /v1/doctor— read-only startup config / Store snapshot.GET /v1/doctor— server-side infra info snapshot.- enhance_
log - HTTP surface for the
/v1/enhance/logaxis. HTTP surface for the/v1/enhance/logaxis. - enhance_
settings EnhanceSettingHTTP CRUD (/v1/enhance-settings*).EnhanceSettingHTTP CRUD (= K-V store entry +BPStorecommit orchestration).- issues
- HTTP surface for the Enhance issue axis (
/v1/issues*). HTTP surface for the Enhance issue axis (current design). - operator_
ws - WebSocket Operator Callback IF (
/v1/operators*). - worker
/v1/worker/*endpoints (SubAgent self-fetch path). HTTP/v1/worker/*endpoints (SubAgent self-fetch path).
Structs§
- ApiError
- Uniform error response type for the handlers in this module. Converts to
a JSON
{"error": message}body with the given status viaIntoResponse. - AppState
- Shared axum handler state for the whole router. Cloned per-request (all
fields are
Arc/cheap-clone), constructed once inbuild_router_with_ws_factory. - Session
Store - In-memory
sid → CapTokenmap backing/v1/sessionsattach/detach.
Functions§
- build_
router - Minimal entry point: builds a router with
default_registryand noBlueprintStore(Inline-only mode) orws_operator_factory. - build_
router_ with - Build form where the caller supplies a registry and an optional
BlueprintStore. The Operator callback path (= external HTTP / WS callers acting as an Operator) must be pre-registered viaengine.register_*(= the engine is the SoT). See theoperator_wsmodule doc andOperatorInfo(engine-sidectx.rs) for details. - build_
router_ with_ ws_ factory - 4-argument variant of
build_router_with. Passingws_operator_factory = Some(arc)causes each WS connect to auto-register a newWSOperatorSessionunder its sid name with the factory (= akind=operatorAgentDef withoperator_ref: <sid>can then bind to the WS client backend). Callers are expected to also install the sameArcinto theSpawnerRegistryviareg.register::<OperatorSpawnerFactory>(arc.clone()). - build_
router_ with_ ws_ factory_ and_ output - 5-argument variant of
build_router_with_ws_factory. Passingoutput_store = Some(arc)swaps the defaultInMemoryOutputStorefor a caller-supplied backend (aSqliteOutputStore, for instance).Nonepreserves the historical behaviour (fresh in-memory store per call). - default_
layer_ registry - Default
LayerRegistryfor the server. Hint keys: - default_
registry - Default registry = Subprocess + RustFn (baseline
identityworker pre-baked) + empty Operator factory. - default_
registry_ with_ enhance_ flow - Opt-in registry that merges
default_registrywith the enhance flow (Lua factory + AgentBlock factory).