Skip to main content

Crate supercode

Crate supercode 

Source
Expand description

§supercode

A lightweight, fully-customizable AI coding-agent SDK in Rust.

supercode is a native agent loop — it talks directly to any model through OpenRouter (or any other OpenAI-compatible endpoint), drives a configurable set of tools, and is designed to be a superset of what tools like Claude Code and Codex can do: every prompt, every tool description, and every tool’s on/off state is yours to control.

§Quick start

use supercode::{Agent, Config};

// Reads OPENROUTER_API_KEY from the environment by default.
let config = Config::builder()
    .model("anthropic/claude-opus-4-8")
    .system_prompt("You are a terse, expert pair programmer.")
    .build();

let mut agent = Agent::new(config)?;
let reply = agent.send("List the files in the current directory.").await?;
println!("{reply}");

§Design

  • Config — the single knob box: model, endpoint, credentials, sampling, the system prompt, and per-tool overrides (enable/disable + custom descriptions).
  • Provider — the model transport. OpenAiProvider speaks the OpenAI chat-completions wire format and defaults to OpenRouter, so it reaches Claude, GPT, Gemini, Llama, and anything else OpenRouter exposes.
  • Tool / ToolRegistry — the capability surface. Built-ins cover file read/write/edit, directory listing, glob, content search, and shell execution. Register your own to extend it.
  • Agent — the loop that ties it together: it streams a turn, runs any tool calls the model requests, feeds results back, and repeats until the model produces a final answer.

Re-exports§

pub use acp_frontend::AcpFrontendCheckpoint;
pub use acp_frontend::AcpFrontendConnectOptions;
pub use acp_frontend::AcpFrontendRuntime;
pub use catalog::DiscoveryQuery;
pub use catalog::HarnessCatalog;
pub use catalog::HarnessHomes;
pub use catalog::HarnessId;
pub use catalog::SessionDescriptor;
pub use catalog::SessionLocator;
pub use catalog::StorageLocator;
pub use claude_peer::message_claude_peer;
pub use claude_peer::read_registry as read_claude_peer_registry;
pub use claude_peer::ClaudePeerDelivery;
pub use claude_peer::ClaudePeerEndpoint;
pub use claude_peer::ClaudePeerRefusal;
pub use claude_peer::ClaudePeerRefusalError;
pub use claude_peer::ClaudePeerSession;
pub use claude_peer::ClaudePeerStatus;
pub use claude_peer::CourierRunner;
pub use claude_peer::ProcessCourierRunner;
pub use claude_runtime_scheduler::ClaudeCronScheduleState;
pub use claude_runtime_scheduler::ClaudeRuntimeDeliveryState;
pub use claude_runtime_scheduler::ClaudeRuntimeSchedulerState;
pub use claude_runtime_scheduler::ClaudeRuntimeTrigger;
pub use claude_runtime_scheduler::ClaudeRuntimeTriggerKind;
pub use claude_runtime_scheduler::ClaudeWakeupScheduleState;
pub use claude_runtime_state::ClaudeBackgroundChild;
pub use claude_runtime_state::ClaudeBackgroundState;
pub use claude_runtime_state::ClaudeCronJob;
pub use claude_runtime_state::ClaudeQueueState;
pub use claude_runtime_state::ClaudeRuntimeExecutionState;
pub use claude_runtime_state::ClaudeRuntimeManifest;
pub use claude_runtime_state::ClaudeRuntimePosture;
pub use claude_runtime_state::ClaudeRuntimeResidue;
pub use claude_runtime_state::ClaudeWakeup;
pub use claude_runtime_state::CLAUDE_RUNTIME_MANIFEST_VERSION;
pub use configfile::HarnessConfig;
pub use live_runtime::discover_live_runtime;
pub use live_runtime::find_live_runtime;
pub use live_runtime::forget_live_runtime;
pub use live_runtime::list_live_runtimes;
pub use live_runtime::register_live_runtime;
pub use live_runtime::register_live_runtime_with_metadata;
pub use live_runtime::resolve_live_runtime;
pub use live_runtime::LiveRuntimeEndpoint;
pub use live_runtime::LiveRuntimeMetadata;
pub use live_runtime::LiveRuntimeReceiptError;
pub use live_runtime::LiveRuntimeRecord;
pub use live_runtime::LiveRuntimeRegistration;
pub use live_runtime::LiveRuntimeSource;
pub use live_runtime::LiveRuntimeSupervisor;
pub use live_runtime::ResolvedLiveRuntime;
pub use modules::ModuleActivation;
pub use modules::ModuleId;
pub use fidelity::core_messages;
pub use fidelity::measure_fidelity;
pub use fidelity::messages_equal;
pub use fidelity::messages_equal_multimodal;
pub use fidelity::replay_eligible;
pub use fidelity::Fidelity;
pub use fidelity::FidelityMetric;
pub use fidelity::FidelityResidue;
pub use frontend::HttpFrontendRuntime;
pub use frontend::FrontendActions;
pub use frontend::FrontendApprovalDecision;
pub use frontend::FrontendAttachSnapshot;
pub use frontend::FrontendAttachment;
pub use frontend::FrontendCommandDescriptor;
pub use frontend::FrontendConnectionState;
pub use frontend::FrontendDisplayCapabilities;
pub use frontend::FrontendElicitationAction;
pub use frontend::FrontendEvent;
pub use frontend::FrontendOperationDescriptor;
pub use frontend::FrontendOperationInvocation;
pub use frontend::FrontendOperationKind;
pub use frontend::FrontendOperationResult;
pub use frontend::FrontendRequest;
pub use frontend::FrontendRequestKind;
pub use frontend::FrontendResponse;
pub use frontend::FrontendRuntime;
pub use frontend::FrontendRuntimeDescriptor;
pub use frontend::FrontendRuntimeError;
pub use frontend::FrontendRuntimeMetadata;
pub use frontend::FrontendTurnState;
pub use frontend::FRONTEND_REPLAY_CAPACITY;
pub use frontend::FRONTEND_RUNTIME_SCHEMA_VERSION;
pub use harness_service::HarnessSessionService;
pub use harness_service::HARNESS_SERVICE_VERSION;
pub use harness_service::RUNTIME_EVENT_METHOD;
pub use harness_service::SESSION_EVENT_METHOD;
pub use runtime::SupercodeHttpRuntimeBackend;
pub use runtime::AcpRuntimeBackend;
pub use runtime::ClaudeCodeRuntimeBackend;
pub use runtime::CodexRuntimeBackend;
pub use runtime::HarnessEvent;
pub use runtime::OpenCodeRuntimeBackend;
pub use runtime::PiRuntimeBackend;
pub use runtime::RuntimeAttachRequest;
pub use runtime::RuntimeBackend;
pub use runtime::RuntimeCapabilities;
pub use runtime::RuntimeConnection;
pub use runtime::RuntimeEndpoint;
pub use runtime::RuntimeHandle;
pub use runtime::RuntimeInput;
pub use runtime::RuntimeLaunch;
pub use runtime::RuntimeStartRequest;
pub use runtime_lease::CoordinatedRuntime;
pub use runtime_lease::CoordinatedRuntimeClient;
pub use runtime_lease::RuntimeAuthorization;
pub use runtime_lease::RuntimeClientId;
pub use runtime_lease::RuntimeControllerLease;
pub use runtime_lease::RuntimeLeaseCoordinator;
pub use runtime_lease::RuntimeLeaseError;
pub use runtime_lease::RuntimeLeaseSnapshot;
pub use runtime_lease::RuntimeObserverLease;
pub use runtime_lease::RuntimePermission;
pub use runtime_lease::DEFAULT_RUNTIME_LEASE_TTL_MS;
pub use runtime_registry::LocalRuntimeRegistry;
pub use runtime_registry::RuntimeRegistryEntry;
pub use runtime_registry::RuntimeRegistryEvent;
pub use runtime_registry::RuntimeRegistryOwner;
pub use runtime_registry::RuntimeRegistryQuery;
pub use runtime_registry::RuntimeRegistryState;
pub use runtime_registry::RuntimeRegistryWatch;
pub use sandbox::landlock_available;
pub use sandbox::netns_available;
pub use sandbox::SandboxEnvPolicy;
pub use sandbox::SandboxEscalation;
pub use sdk::create_agent;
pub use sdk::discover_sessions;
pub use sdk::load_session;
pub use sdk::load_session_path;
pub use sdk::resume_agent;
pub use sdk::submit_agent;
pub use sdk::submit_agent_with_images;
pub use sdk::RuntimeSubmitError;
pub use sdk::SdkAgent;
pub use sdk::SdkCapabilities;
pub use sdk::SdkError;
pub use sdk::SdkErrorCode;
pub use sdk::SdkEvent;
pub use sdk::SdkOperation;
pub use sdk::SdkPromptSource;
pub use sdk::SdkRequest;
pub use sdk::SdkRuntime;
pub use sdk::SdkRuntimeEvent;
pub use sdk::SdkService;
pub use sdk::SDK_SCHEMA_VERSION;
pub use server::RpcEngine;
pub use session::Session;
pub use session::SessionFormat;
pub use session::SessionMeta;
pub use session::SessionSource;
pub use store::SessionInfo;
pub use store::SessionStore;
pub use support::harness_support;
pub use support::harness_support_registry;
pub use support::HarnessSupportDescriptor;
pub use support::ImplementationKind;
pub use support::NativeSupport;
pub use support::RuntimeSupport;
pub use support::SupportRegistryReport;
pub use support::SUPPORT_REGISTRY_SCHEMA;
pub use tools::shell_sandbox_unenforceable;
pub use tools::SandboxPolicy;
pub use tools::SchemaTier;
pub use tools::Tool;
pub use tools::ToolContext;
pub use tools::ToolRegistry;
pub use tools::WriteObserver;
pub use watch::SessionFollower;
pub use watch::SessionSnapshotReason;
pub use watch::SessionWatchEvent;

Modules§

acp_frontend
First-class ACP client implementation of the canonical SDK runtime.
acp_server
Inbound Agent Client Protocol adapter for the SDK-owned Supercode runtime.
audit
Corpus coverage audit.
background
P5-6 (COMPOSABLE-HARNESS-DESIGN.md §2 module 4 tools.background: “D1 background exec + monitor/event feed; D10 bg-manager; D3 self-paced/ scheduled loops”; §2.1 “tools.background → permissions.approvals (auto-policy) [C6 as dep]”; §2.2 C6): the pure, agent-independent data shapes and bounded-buffer arithmetic crate::agent::Agent’s background_exec/background_status/background_list/background_kill intrinsics build on — kept separate from agent.rs so the bounded- capture truncation logic and job-id shape are unit-testable without a full Agent/mock-Provider/real-subprocess harness, the same “pure config → set, testable without the loop” precedent crate::subagents documents for itself (P5-3).
catalog
Discovery and durable addressing for sessions written by external harnesses.
checkpoint
§2 module 20 checkpoint (COMPOSABLE-HARNESS-DESIGN.md line 470): file checkpointing / shadow-git; D4-adjacent revert; D3 turn-diff tracking. Line 1504: “restores FILES, not context — pairs with, never replaces, the reduction sidecar.”
claude_compat
Claude Code project compatibility helpers.
claude_peer
Live Claude Code peer sessions: registry discovery and message delivery.
claude_runtime_scheduler
Deterministic execution cursor for imported Claude cron and wakeup state.
claude_runtime_state
Lossless, non-executing reconstruction of Claude Code runtime state.
configfile
§3 “The Single Config File” (docs/composable-harness/COMPOSABLE-HARNESS-DESIGN.md) — P1 of the composable-harness migration (design §5.2, phase P1).
fidelity
Behavioral translation-fidelity measurement.
formatters
§2 module 29 formatters (COMPOSABLE-HARNESS-DESIGN.md line 479): “D10/oc§10 format-on-write” — reuses the EXACT crate::tools::WriteObserver seam P5-9 built for checkpoint (D-5: “write-path interception seam shared with checkpoint”), rather than a second interception point.
frontend
Protocol-neutral frontend contract for one SDK-owned Supercode runtime.
git_metadata
P4e (COMPOSABLE-HARNESS-DESIGN.md §1.6/§3.1 core.session.git_metadata, catalog:331 “Git integration (metadata, diff, PR)”): a persisted, TYPED record of the git branch/sha/dirty state a session was RUNNING under, captured ONCE at session start (closes the loop catalog:331 flags — supercode already preserves a foreign session’s own git-shaped fields byte-for-byte on IMPORT via Session::raw’s verbatim capture; this is the WRITE half: supercode’s OWN sessions get the same provenance). Deliberately flat/typed (not a formatted string), the exact same rationale as crate::usage_log::UsageRecord/ crate::model_change::ModelChangeRecord (§1.13): a translatable, lossless session-data channel, not a lossy notice — so it survives a save/load round trip byte-for-byte, and a future reader (a translator, doctor/inspect stats) can consume it without re-parsing prose.
harness_service
Versioned, language-neutral service over persisted harness sessions.
human_export
P4e (COMPOSABLE-HARNESS-DESIGN.md §1.6/§3.1 core.session.export_format, catalog:283 “transcript export for humans”): a READ-ONLY rendering of a crate::Session’s conversation into text a human reads directly (terminal/file/clipboard) or opens in a browser — CC’s /export+/copy, CX’s Ctrl+O copy-last. This is core, not gated by the session.share module (§1.6: “export-to-human is universal while share links … are the OC+PI-only part session.share actually narrows to”).
live_runtime
Trusted local receipts for attachable Supercode runtimes.
lsp
§2 module 28 lsp (COMPOSABLE-HARNESS-DESIGN.md line 478): “D1 LSP diagnostics in edit path + query tool” — this module ships the WEAKEST FORM that satisfies D1: server LIFECYCLE for a HANDFUL of user-configured language servers, and diagnostics surfaced in the edit/write TOOL RESULT via the shared D-5 write-path seam (crate::tools::WriteObserver, P5-9/P5-11).
mcp
P5-2 (COMPOSABLE-HARNESS-DESIGN.md §2 module 15 mcp.client, D7 rows 1-8): full Model Context Protocol client support — stdio (P5-1 baseline, GROWN not rewritten), remote HTTP/SSE transports, resources + templates, prompts-as-commands, server instructions, and elicitation — plus the handle_request / serve_stdio harness-as-MCP-server direction (module 16).
mcp_oauth
P5-2 (COMPOSABLE-HARNESS-DESIGN.md §2 module 15 D7 row 2 “OAuth”; §2.1 dep “model.oauth → trust-grade token storage” — the same security class applies here): OAuth PROTOCOL support for authenticated remote MCP servers.
model_catalog
§2 module 26 model.catalog (docs/composable-harness/ COMPOSABLE-HARNESS-DESIGN.md §3.1 [capabilities.model_catalog]) — P4 of the composable-harness migration (design §5.2 phase P4: “aliases + fallback chains (userconfig.rs:386-411) promoted into core” + the small_model knob).
model_change
P4c (COMPOSABLE-HARNESS-DESIGN.md §5.2 “P4” core NEW-significant item, §1.10/§3.1 core.model_switch.allow_switch, D9 row): a persisted, TYPED record of a mid-session model switch — pi’s model_change precedent (design §1.10: “persisted change records … pi’s model_change is the cleanest precedent”). Deliberately flat/typed (not a formatted string), mirroring crate::usage_log::UsageRecord’s exact rationale: a translatable, lossless session-data channel (§1.13), not a lossy notice — so it survives a save/load round trip byte-for-byte in the fields that matter, and a future reader (a translator emitting this same session under another harness’s format, a doctor/inspect stats command) can consume it without re-parsing prose.
modules
§2 “The Bolt-on Capability Taxonomy” (docs/composable-harness/ COMPOSABLE-HARNESS-DESIGN.md) — P3 of the composable-harness migration (design §5.2, phase P3: “A ModuleId enum (the 35 names) + resolved activation set on Config”).
permissions
P5-1 (COMPOSABLE-HARNESS-DESIGN.md §2 modules 10-11, §2.1 D-3, §2.2 C5, §5.3 risk 1): the permissions engine — command canonicalization + rule algebra + approval policy/cache + oc/cx import translators.
plugins
P5-12 (COMPOSABLE-HARNESS-DESIGN.md §2 module 18 plugins, D7 “in-process extension API, packaging/marketplaces, custom tools from files, provider injection, extension UI, plugin/package installation”; §2.1 D-10: “config-borne code execution without a trust gate is an injection hole”).
presets
§4 “Presets” (docs/composable-harness/COMPOSABLE-HARNESS-DESIGN.md) — P2 of the composable-harness migration (design §5.2, phase P2).
pricing_ref
Reference pricing constants used only to translate measured byte/token savings into a dollar figure in test logs and docs (D15). These are stated constants for one Opus-class API list price (July 2026) — not a live lookup, and not used anywhere on the request path.
reduce
The reduction layer’s vocabulary (SPEC.md A4): addresses, sidecar pointers, reduction kinds/records, the reduction log, the stub sentinel, and the sc. metadata discipline. Everything downstream (project, invert, the CLI) is built on these types; nothing here mutates a session or a sidecar — this module only describes the shapes.
runtime
Primitive live-runtime contracts and the Codex app-server reference adapter.
runtime_lease
Transport-neutral observer and controller leases for live SDK runtimes.
runtime_registry
Authenticated inventory and attachment for live and persisted sessions.
sandbox
P5-10 (COMPOSABLE-HARNESS-DESIGN.md §2 module 12 permissions.sandbox, ~row 462): the OS-level enforcement BACKSTOP permissions.rules’ rule-layer floor and the file-tool crate::tools::SandboxPolicy both defer to for full coverage (crate::permissions module doc: “complete OS-level write confinement of arbitrary bash… is capabilities. permissions.sandbox’s job (P5 module 10, a later unit), not this one’s” — this IS that unit).
schema
Typed schemas for the on-disk session formats.
sdk
Versioned public SDK contract shared by every Supercode surface.
server
§2 module 31 server (COMPOSABLE-HARNESS-DESIGN.md, D7 “full programmatic RPC/HTTP server”, D8 “remote attach”, D10 “daemon”; §1.9 Obligation 9’s out-of-process half — the in-process SDK already meets the core commitment via crate::EventSink).
session
Natively load — and continue — real Claude Code and Codex sessions.
session_title
P4b (COMPOSABLE-HARNESS-DESIGN.md §5.2 “P4”, §1.6/§3.1 core.session.auto_title, catalog:150, D-9): auto-title / session summary — a small-model side-call that titles a session, mirroring crate::reduce::summarize’s plumbing exactly: an injectable trait (real implementations call out to a model; this crate’s own tests only ever inject deterministic fakes — no real network/model call anywhere in this crate, same posture as crate::reduce::summarize::SpanSummarizer), a fixed versioned prompt, and a “never blocks, never fails the caller” contract.
session_tree
P5-5 (design §2 module 21 session.tree: “D5 in-place tree, rewind-anywhere, branch summaries, entry labels”; §2.1 D-6 session.tree → core.session(tree-addressable transcript); §2.2 C7; §5.2 P5 row 5: “loaders are already tree-aware (C7 resolution); adds in-place rewind/branch/label on the native store”).
sidecar
The supercode-native v2 wire record for a conversation turn appended after import.
store
A directory-backed store for supercode’s own sessions — naming, titles, listing, archiving, and deletion. The analog of claude --name / the Codex resume/archive/delete session lifecycle.
subagents
P5-3 (COMPOSABLE-HARNESS-DESIGN.md §2 module 9 subagents: “D1 spawn tool; D3 sub-agents/named-defs/background+resume/teams; D5 subagent transcripts”; §2.1 D-1 “subagents → core.session(lineage), core.tools; background-mode → permissions.approvals”; §2.2 C6): the data shapes and pure-function resource-bound checks the spawn/join/background machinery in crate::agent::Agent builds on. Kept separate from agent.rs so the depth/concurrency-cap arithmetic and the lineage record shape are unit-testable without a full Agent/mock-Provider harness — the same “pure config → set, testable without the loop” precedent P3’s crate::modules module documents for itself.
support
Canonical implementation inventory for external coding harnesses.
tokens
The shared token estimator (SPEC.md C9). The repo has no tokenizer — only provider-reported Usage (provider.rs:153-164) and the turn/output counters agent.rs already tracks. Every other UX figure (the banner, /status, /tokens, show-reductions, notices) derives from one documented heuristic here, and is always printed with a ~ prefix so it reads as an estimate, never a measurement. Acceptance criteria never assert against these numbers directly — ACs assert exact byte counts (SessionInfo::full_bytes/view_bytes, C9/D15) and only derive a token/dollar figure from them for the test log.
tools
Tools the agent can call.
tui
P5-4 (COMPOSABLE-HARNESS-DESIGN.md §2 module 30 tui; §1.9 recorded deviation; §2.1 tools.question/permissions.approvals(ask-UI) → tui|server): the full-screen interactive TUI, AND — because §2.1 names it as the interactive surface three EARLIER phases explicitly deferred here — the home for the three handlers that close those deferred chains:
usage_log
P4b (COMPOSABLE-HARNESS-DESIGN.md §5.2 “P4”, §1.6/§3.1, catalog §4a “Turn/step usage records surfaced per turn”): persisted per-turn token/usage records. crate::AgentEvent::Usage already streams this data live (UX-23); this module makes it DURABLE session data — a typed, serde-round-trippable record, not a lossy display-only channel (§1.13’s lossless/sidecar discipline: this is typed session data, exactly like crate::reduce::ReductionLog, not a text notice).
watch
Passive, change-triggered following of local coding-harness sessions.

Structs§

Agent
A stateful agent: configuration, a model transport, a tool set, and the running conversation. Drive it with Agent::send.
ChatMessage
A single message in a conversation.
ChatRequest
A single completion request.
Config
Everything that shapes an crate::Agent: the model and endpoint, the credentials, sampling parameters, the system prompt, and per-tool overrides.
ConfigBuilder
Fluent builder for Config.
ConfigFile
A config file: a set of named profiles (the analog of Codex -p/--profile). This is the SDK/embedder config surface; the supercode CLI uses a separate TOML config (userconfig::FileConfig in the cli crate) and does not expose this file or a --profile flag.
ConfigProfile
The serializable subset of a Config that can live in a config file. (Callbacks/handlers are code-only and are not represented here.)
ContextInjectionBlock
P4e (§1.4/§3.1 core.context_injections): one named ambient context block – see Config::context_injection_blocks.
FunctionCall
The function payload of a ToolCall.
GeneratedFrontendClient
Generated typed Rust client over any facade transport.
OpenAiProvider
An OpenAI-compatible HTTP provider. Defaults to OpenRouter via crate::Config.
PromptTokensDetails
The cache portion of Usage::prompt_tokens_details (B7): how many of Usage::prompt_tokens were served from cache, as OpenRouter/Anthropic report it (usage.prompt_tokens_details.cached_tokens).
ToolCall
A request from the model to invoke a tool.
ToolOverride
Per-tool customization: enable/disable a tool and/or override the description the model sees for it.
ToolOverrideProfile
A single tool’s file-settable overrides — the ConfigProfile mirror of ToolOverride (COMPOSABLE-HARNESS-DESIGN.md §3.1 [core.tools.<name>], §3.2 mapping row core.tools.enabled + [core.tools.<n>].*).
ToolSchema
A tool advertised to the model: name, description, and JSON-Schema parameters.
Usage
Token accounting returned with a completion.

Enums§

AgentEvent
Streaming events emitted by an crate::Agent as a turn unfolds.
ApprovalPolicy
When the agent must seek approval before running a tool — the analog of Codex’s -a untrusted|on-request|never and Claude’s permission modes.
CachePlan
Prompt-caching plan applied at the request-build site (B7, SPEC.md D9).
Error
Errors that can arise while configuring or running an crate::Agent.
FrontendFacadeMethod
One method in the versioned language-neutral frontend facade.
Role
Who authored a ChatMessage.
SteeringMode
How queued steering/follow-up messages are drained (S1.7, pi3 steeringMode/followUpMode).
ToolAdvertising
How tools are advertised to the model (B6, D16).

Constants§

DEFAULT_SYSTEM_PROMPT
A default, deliberately small system prompt. Override it freely.
UNKNOWN_MODEL_CONTEXT_FLOOR
Conservative fallback context limit (tokens), used by the PARITY-18 preflight guard when model_context_limit doesn’t recognize the resolved model slug (a custom --base-url, a new/unlisted OpenRouter model, etc.). “Unknown” must never be treated as “unlimited” — this floor is the smallest limit in [KNOWN_MODEL_CONTEXT_LIMITS], so an unrecognized model is never assumed to have MORE headroom than any known one.

Traits§

FrontendFacadeTransport
Transport seam consumed by the generated Rust facade client.
Provider
The transport abstraction. Implement this to back the agent with something other than an OpenAI-compatible HTTP endpoint (a local model, a mock, etc.).

Functions§

format_reply
Format an agent’s final reply for output. json wraps it as {"result": "..."}; otherwise the reply is returned as-is. The stream-json form is the live AgentEvent stream via an EventSink.
model_context_limit
Look up a model’s context-window size by its full OpenRouter slug. None means “not in the reference table” (see UNKNOWN_MODEL_CONTEXT_FLOOR for how callers should treat that), not “unbounded.”

Type Aliases§

EventSink
A sink for AgentEvents.
Result
Result alias used throughout the crate.
StopGateHook
A stop-gate hook: receives the would-be-final assistant message; returns Some(reason) to veto termination and continue the loop (the reason is injected as a new user message), or None to allow the stop. See Config::stop_gate.