Expand description
Legacy harness substrate — Rust port of packages/cli/src/harnesses/types.ts
and friends.
The CLI no longer exposes a command that launches agent processes, but these adapters remain as unit-tested reference code for launcher integrations built on the SDK pending-stamp primitives. Every adapter contributes the same five-step shape:
plan— compute the spawn plan (binary + args + env). Per-harness transports inject session ids or hook arguments here.before_spawn— fire any pre-spawn side effect: stamp now if the session id is known up front (claude path), or drop a pending-stamp manifest the post-spawn ingest pass will resolve (codex / opencode).start_watcher(optional) — return aWatchControllerthat drains a session-store directory while the child runs. Adapters that ingest a single pre-known session file (claude) returnNonehere; adapters that share the pending-stamp shape (codex, opencode) wire the watch loop throughpending_stamp::adapter.after_exit— run a final ingest pass after the child exits and return anIngestReportfor the launcher to report.- The launcher itself owns step zero — collecting
cwd, passthrough args, and any user-provided enrichment tags into aPlanCtx— and step six — joining the watcher and reporting summary stats.
§Trait shape vs the TS sibling
HarnessAdapter is a Send + Sync trait object so the registry can
hand out &'static dyn HarnessAdapter references. async fn in trait
is mediated by async_trait::async_trait to keep adapter impls
ergonomic; the desugared Pin<Box<dyn Future + Send>> is easy for
launcher code to spawn and join at the top level.
Re-exports§
pub use registry::list_harness_names;pub use registry::lookup;
Modules§
- claude
- Claude harness adapter — Rust port of
packages/cli/src/harnesses/claude.ts. - codex
- Codex
HarnessAdapter— Rust port ofpackages/cli/src/harnesses/codex.ts. - opencode
- OpenCode
HarnessAdapter— Rust port ofpackages/cli/src/harnesses/opencode.ts. - pending_
stamp pending_stamp::adapterfactory — Rust port ofpackages/cli/src/harnesses/pending-stamp.ts’screatePendingStampAdapter.- registry
- Lazy harness registry — Rust port of
packages/cli/src/harnesses/registry.ts.
Structs§
- PlanCtx
- Driver-side context handed to every adapter call. Mirrors the TS
HarnessRunContextshape one-to-one (cwd,passthrough,tags,spawnStartTs) plus the Rust port’s typed ledger-home override. - Spawn
Plan - Spawn plan returned by
HarnessAdapter::plan. Launcher code owns the actual process construction; this struct is the per-adapter contribution to it. - Watcher
Controller - Wrapper around the SDK’s
WatchController. Today this is just a newtype so callers don’t have to importrelayburn_sdkdirectly to construct or stop a watcher; tomorrow it gives us a stable boundary to attach harness-side observability (e.g. aname, a per-adapter metric counter) without leaking through to the SDK.
Traits§
- Harness
Adapter HarnessAdapter— five-method contract every harness implements. The TS sibling lives atpackages/cli/src/harnesses/types.tsand the shape mirrors it; see the module docs for what each step does.