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
Harnesstrait + the neutral request/metadata types (RunRequest/RunTuning/HarnessInfo/ …), - the normalized
RunEventvocabulary every adapter parses into (normalize_process_event+ParsedLine), - the generic streaming subprocess engine (
spawn_streaming+ProcessEvent+ProcessHandle) + the install/login event shape (InstallEvent), and - the shared interactive-login helper (
run_login_command).
The built-in per-CLI adapters live here as modules (claude
/ codex), re-exported as 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::PlanEntry;pub use events::PlanEntryPriority;pub use events::PlanEntryStatus;pub use events::Question;pub use events::QuestionOption;pub use events::RunEvent;pub use events::SessionInfo;pub use events::SuggestedEdit;pub use events::ToolCallEnd;pub use events::ToolCallStart;pub use events::ToolKind;pub use events::ToolLocation;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::InstalledModel;pub use harness::InstallHint;pub use harness::ModelManagement;pub use harness::PullProgress;pub use harness::PullProgressAggregator;pub use harness::PullProgressCallback;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 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§
- claude
- Claude Code (
claude) as aHarness. - codex
- OpenAI Codex (
codex) as aHarness. - events
- Normalized run events — the one shape the UI consumes regardless of which harness produced them.
- harness
- The neutral harness contract: the
Harnesstrait, the run-control handle, the neutral request/metadata types, and the shared interactive-login helper. - models_
dev - models.dev catalog lookup for
Harness::list_models. - raw
- 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::RunEventvocabulary. - 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§
- Process
Handle - 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§
- Install
Event - Process
Event - 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
Stdoutlines into a normalized event vocabulary (e.g.agent-harness’sRunEvent). - Stream
Error - Why
spawn_streamingorProcessHandle::cancelfailed.
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. - hidden_
command - Compose a PATH for the spawned process that always includes the
directory containing the program — where
node,npm, and friends usually live in an nvm install. The user’s existing PATH stays as a fallback after our prepended directory. ACommandthat never opens a console window on Windows. - spawn_
streaming - Spawn an arbitrary streaming child process — the generic engine behind every process-backed harness (bob, Claude Code, Codex).