Expand description
AppState: the shared handle every request works through, plus the
AgentFactory seam that turns a submitted definition into a live agent.
The state owns exactly one thing that matters for durability: an
Arc<dyn EventStore>. Everything a request needs, it builds fresh from
that handle. A Runtime is cheap (a store handle plus two function
pointers), so the server constructs one per request rather than sharing
mutable run state; there is no per-run state living in the process that a
restart would lose. That is the whole kill-safety story restated: the
process holds handles, the store holds truth.
§Why agent building is a seam, not baked in
Turning a definition into an Agent means parsing the agent-definition
format and spawning its MCP servers. That logic already exists in the CLI
(salvor-cli owns the TOML schema), and putting a copy here would give the
definition format two homes. Instead the server takes an AgentFactory:
a caller-supplied function from a submitted AgentDefinition to a
BuiltAgent. The salvor serve command passes the CLI’s own builder, so
there is one definition parser in the workspace; tests pass a factory that
builds an agent with an in-process tool and a mock model, which is how the
control plane is exercised over real HTTP with nothing on the network.
Structs§
- Agent
Definition - A submitted agent definition: the raw bytes plus the format they are in.
- AppState
- The shared, cheaply cloned handle every route works through.
- Built
Agent - A live agent plus the MCP server sessions its tools hold.
- Client
RunLease - The per-run lease state for a client-driven run.
- Registered
Agent - One registered agent definition.
Enums§
- DefFormat
- The format a submitted agent definition is written in.
- Lease
Release - What asking to drop a client-driven run’s lease came to (see
release_client_run).
Constants§
- DEFAULT_
WAKE_ INTERVAL - How often the wake sweeper looks for due timers, unless
AppState::with_wake_intervalsays otherwise.
Type Aliases§
- Agent
Factory - Builds a live agent from a submitted definition.
- Build
Future - The future an
AgentFactoryreturns.