apomesh-orchestrator-bin
apomesh-orchestrator-bin is the assembly point: the daemon binary
where everything the platform wires together happens. The
apomesh-orchestrator library is
wire-clean — it depends on no concrete strategy or vertical — and this
binary is the one place that bridges them, constructing the
SessionStrategyRegistry with both GenericStrategy (the goal-agnostic
default) and DeepResearchStrategy (from the deep-research vertical) at
boot. It is deliberately thin: assembly, not logic. Every behaviour it
serves is delegated to the substrate and the orchestrator library; the
binary chooses backends, injects dependencies, and starts the listeners.
Touch it when you change how the daemon boots — a new store, a new
registry, a new shipped seed, or the listener wiring.
Position in the workspace
Section titled “Position in the workspace”- Layer: orchestrator (the wiring seam where layers meet). See Control & execution planes.
- Depends on: apomesh-orchestrator
(the daemon library it assembles),
apomesh-substrate (with the
mcpfeature — the primitives it constructs), apomesh-protocol (the gRPC service it serves), and apomesh-rest-api (the REST listener). Plusapomesh-config,apomesh-auth-providers, the Postgres and Redis state-store adapters, andapomesh-vertical-deep-research(the assembly point is where a vertical registers).apomesh-smartchatandapomesh-vertical-coding-assistantare feature-gated (smartchatis default-on;coding-assistantis opt-in). - Consumed by: nothing — it is a leaf binary, the workspace’s assembly point.
What it owns
Section titled “What it owns”The boot sequence, as one straight-line narrative in main:
- Config — load the daemon TOML from
APOMESH_CONFIG, elseConfig::default; validation runs at load, so a malformed config fails the daemon at boot rather than at first use. Per-tenant entries install into aTenantRegistry. - Stores — select the
StateStorebackend from[statestore](InMemory/Sqlitefor single-binary dev,Postgres/Hybridfor durable deployments). The Postgres pool, captured once, is shared by every durable store below. A resolved embedding provider provisions the semantic-memory vector column to its own dimension. - Registries — build the one per-tenant
CredentialStore(sealed at rest on Postgres/Hybrid via a single sharedSecretSealer), the LLM config / provider-profile stores, the store-backed provider router, the agent catalog, the runtime-token store, and the published-agent, strategy-config, and published-skill registries — each Postgres-backed when the state store is durable, in-memory otherwise. - Seeds — seed the substrate-shipped strategy configs, published
skills, and published Deep Research agent shapes into the dev tenant, and
re-apply the shipped agent-catalog manifests. The shipped-seed posture is
idempotent: a re-seed on restart against a durable registry hits
VersionExists(the “already present” signal, skipped, not fatal); the catalog usesON CONFLICT DO UPDATE; every other failure aborts boot. - Daemon — assemble the
OrchestratorDaemonvia its builder, threading in the registry of coordinators (GenericStrategy,EvaluatorOptimizer, the parallel-sample and debate skeletons,DeepResearchStrategy), auth backends, every store, the provider router, the MCP primitives, and the extension-handler registry. - Rehydrate —
rehydrate_sessionsscans the event log for sessions left non-terminal by a previous process and resumes each from its last checkpoint, before the daemon accepts traffic (best-effort; never blocks boot). - Serve — start the gRPC listener (
ApomeshDaemonServer, with the shared TLS material, concurrency limits, and the optional SmartChat sibling service) and the REST listener together undertokio::try_join!, which fails fast — the daemon never serves only one wire.
Public surface
Section titled “Public surface”A binary has no library surface; its contract is the invocation and the config it reads.
- Binary:
apomesh-orchestrator(the[[bin]]name), fromsrc/main.rs. - Flags / env (via clap):
--listen/APOMESH_ORCHESTRATOR_LISTEN(gRPC, default127.0.0.1:50051),--rest-listen/APOMESH_REST_LISTEN(REST + OpenAPI, default127.0.0.1:50052), and--config/APOMESH_CONFIG(the daemon TOML). - Boot env surface — provider config (
APOMESH_PROVIDER_CONFIG/APOMESH_PROVIDER_CONFIG_DIR), the secure-by-default secret-forwarding policy (APOMESH_SECRET_FORWARDING_HOP), and the workspace/sandbox knobs (APOMESH_WORKSPACE_ROOT,APOMESH_SHELL_SANDBOX). For the full, authoritative surface see the local stack anddeploy/local/README.md.
The daemon runs as the orchestrator service in the local stack — the
supported way to run it for evaluation:
cd deploy/localdocker compose up -d # orchestrator on 50051 (gRPC) + 50052 (REST)To run it directly against a local config during development:
# Default build (includes the smartchat feature).APOMESH_CONFIG=deploy/local/config.dev.toml \ cargo run -p apomesh-orchestrator-bin
# Substrate-only build, or with the coding-assistant vertical wired in.cargo run -p apomesh-orchestrator-bin --no-default-featurescargo run -p apomesh-orchestrator-bin --features coding-assistantRelated
Section titled “Related”- Operate: The local stack — the compose stack that
builds the
apomesh-orchestrator:devimage and runs this daemon. - Concepts: Control & execution planes — the decide/route/execute split this binary assembles.
- Reference: apomesh-orchestrator (the library it wires), apomesh-rest-api (the REST listener), apomesh-protocol (the gRPC service).