Skip to main content

Crate harness

Crate harness 

Source
Expand description

Compose’s neutral agent-harness core.

The library you depend on to drive — or build — an agent harness, independent of any specific backend. It provides:

The built-in per-CLI adapters live here as modules (bob / claude / codex), re-exported as Bob / Claude / Codex. The Registry is open: a third party adds their own provider by implementing Harness in their crate and registering it — no fork.

Wire shapes derive Serialize so every transport emits identical JSON — keep their field names stable; the TypeScript front-end consumes them verbatim.

Re-exports§

pub use events::normalize_process_event;
pub use events::run_events_from_parsed;
pub use events::ByteRange;
pub use events::ParsedLine;
pub use events::RunEvent;
pub use events::SessionInfo;
pub use events::SuggestedEdit;
pub use events::ToolCallEnd;
pub use events::ToolCallStart;
pub use events::UsageInfo;
pub use raw::parse_raw_line;
pub use harness::run_login_command;
pub use harness::BoxError;
pub use harness::CredentialSpec;
pub use harness::Harness;
pub use harness::HarnessCapabilities;
pub use harness::HarnessError;
pub use harness::HarnessInfo;
pub use harness::HarnessModel;
pub use harness::HarnessReadiness;
pub use harness::InstallCallback;
pub use harness::ReasoningEffort;
pub use harness::RunCallback;
pub use harness::RunControl;
pub use harness::RunHandle;
pub use harness::RunMode;
pub use harness::RunRequest;
pub use harness::RunTuning;
pub use bob::normalize_bob_event;
pub use bob::BobHarness as Bob;
pub use bob::BOB_HARNESS_ID;
pub use claude::ClaudeHarness as Claude;
pub use claude::CLAUDE_HARNESS_ID;
pub use codex::CodexHarness as Codex;
pub use codex::CODEX_HARNESS_ID;
pub use registry::default_registry;
pub use registry::harness_by_id;
pub use registry::harness_catalog;
pub use registry::Registry;
pub use registry::DEFAULT_HARNESS_ID;

Modules§

bob
bob CLI as a Harness.
claude
Claude Code (claude) as a Harness.
codex
OpenAI Codex (codex) as a Harness.
events
Normalized run events — the one shape the UI consumes regardless of which harness produced them.
harness
The neutral harness contract: the Harness trait, the run-control handle, the neutral request/metadata types, and the shared interactive-login helper.
raw
The untyped raw passthrough tier, harness-agnostic (any JSONL CLI). The raw passthrough tier — a harness’s stdout line decoded as untyped JSON, for consumers that want to interpret a harness’s output themselves instead of the neutral crate::RunEvent vocabulary.
registry
The harness registry — an open builder so consumers compose their own set of harnesses (the built-ins and/or their own custom impl Harness), plus convenience constructors over the built-in adapters for hosts that just want “all of them”.

Structs§

ProcessHandle
Handle to an in-flight streaming run. Caller stores it (e.g. in a runId-keyed map) so a later cancel() can find it.

Enums§

BobError
Why a bob-rs operation (install, keychain I/O, spawn) failed.
InstallEvent
ProcessEvent
Raw events emitted to the caller’s callback during a streaming run. JSON-tagged so axum SSE and Tauri Channel render identical payloads on the wire. Harness-neutral: a process-backed adapter parses the Stdout lines into a normalized event vocabulary (e.g. agent-harness’s RunEvent).
StreamError
Why spawn_streaming or ProcessHandle::cancel failed.

Functions§

augmented_node_path
A PATH that resolves Node-based CLIs (bob, claude, codex) even from a process launched by Finder/Launchpad, which inherits only the minimal launchd PATH (/usr/bin:/bin:/usr/sbin:/sbin) rather than the user’s shell PATH.
spawn_streaming
Spawn an arbitrary streaming child process — the generic engine behind every process-backed harness (bob, Claude Code, Codex).