Expand description
Warble back-end for the Claude Code CLI target.
Consumes a compiled Warble IR (JSON) and emits a Claude Code agent runtime (agent files under
.claude/agents/, settings, and RUN.md) — the static-file target, which needs no SDK, so it
lives natively in Rust alongside the compiler and is driven by the warble CLI. Also hosts the
deterministic reference renderer (render) and the capability-manifest projection (manifest).
Dispatch is keyed on IR enums (realization_kind, trigger.kind, effect.outcome.kind),
never on a component’s id/verb. Enum arms not yet realized fail loudly (a “wall-hit”).
This crate is not a standalone tool — you install warble-cli (the warble binary), which
links this crate in directly, and warble dispatch --target claude-code (or
claude-code:headless / claude-code:interactive, the default) selects it at dispatch time.
Modules§
- conditional
- Deterministic realization of a
conditionalstep’s closed-vocabularywhenguard — mirrorsdispatcher/claude-agent-sdk/src/conditional.tsfield-for-field (see that module’s doc for the full R1 repair-fold-into-loop / R2 guarded-skip design). - ir
- Typed view of the Warble IR (
warble_ir_version: 0.7) that this back-end consumes. - slots
- Slot resolution — turning IR 0.7’s declared slots into the text a model actually receives.
Structs§
- Capability
Manifest - Context
Injection - Normalized, runtime-neutral context payload supplied to the dispatcher by its host.
- Context
Injection Report - Public report identity written beside every dispatched agent and copied into eval reports. It intentionally contains fingerprints/counts rather than private knowledge text.
- Dispatch
Error - A dispatch/render/resolve failure with a human-facing message. Every unsupported IR arm and every failed capability resolution surfaces as one of these (loud-fail) rather than emitting a silently-wrong agent.
- Envelope
- A parsed Warble render envelope (blocks + optional summary + optional verify facet).
- Model
Config - An ordered tier→binding map. Declaration order is priority: earlier tiers are “stronger” — used to
pick the single model when a multi-tier component collapses to one agent. Alongside the authoring
tiers (
strong/cheap/custom, which components declare on steps) it carries the reservedORCHESTRATOR_TIERused by the split driver. - Native
Binding - Native
McpDescriptor - Exact server-derived connection material for the allowlisted native-session MCP server.
- Native
Session Scope - A server-derived launch scope. This is deliberately a small producer input rather than session state: GenBI creates and authorizes it, Warble verifies its shape/canonical cwd and carries its opaque binding identity into the launch artifact, and the future runtime owns comparing it to its live binding generation/revision before spawning.
- Provider
Fragment - A single provider fragment: a partial target definition. Field names are snake_case to match the fragment YAML verbatim.
- Render
Options - Document rendering options.
- Resolved
Capability - Tier
Binding - A tier’s full runtime binding: which
providerserves it, at whatendpoint(for OpenAI-compatible providers), running whichmodel. The shorthand YAML formtier: <model>is a{ provider: anthropic, endpoint: none, model: <model> }binding — so existing configs are unchanged, and the file target (which only readsmodel) behaves exactly as before.
Enums§
- Context
Injection Mode - Which normalized semantic context is embedded into emitted agent prompts.
- Hybrid
Realization - How the file target realizes a hybrid binding’s LOCAL step (
llm:per_step_provider, seecapability-model.md§7.2):BashScriptemits a Bash-run local-inference script (needsbashin the allowlist);McpServeremits a.mcp.jsonregisteringwarble mcp-serveso the driver calls alocal_inferMCP tool (a separate permission gate — nobashwidening). DefaultBashScript. - Native
Purpose - The only product purposes that may opt into the native Sessions launch contract.
- Render
Flavor - Render flavor (
ir-schema.md§v0.3 §4).programmatic(default): the agent stays read-only and emits a{blocks}envelope; a downstream renderer produces HTML deterministically.prompt: the plain-file fallback — the agent is granted scoped write and writesdashboard.htmlitself. - Target
Id - The two claude-code targets: engine × mode.
Constants§
- ANTHROPIC_
PROVIDER - Well-known provider name: rides the Claude runtime (the default when
provider:is absent). - BINDING_
SPEC_ VERSION - The binding spec version this module implements — see
binding-spec.md, the authoritative, versioned source both back-ends conform to (kept in lockstep to avoid the IR’s own version-drift history). - DEFAULT_
CONTEXT_ INJECTION - DEFAULT_
RENDER_ FLAVOR - DEFAULT_
TARGET - claude-code target’s default mode when the caller doesn’t specify one.
- OPENAI_
COMPAT_ PROVIDER - Well-known provider name: an OpenAI-compatible endpoint (e.g. ollama’s
/v1); requiresendpoint.
Functions§
- build_
manifest - Project a resolved IR into its runtime-agnostic capability manifest.
- compose_
for_ conformance - Compose against an empty tool map and report only the capability keys — the shape the shared
conformance fixture asserts. Exposed for that suite rather than for the emit path, which needs
the whole composed target and reaches
compose_targetdirectly. - emit_
claude_ code - emit_
claude_ code_ with_ context - As
emit_claude_code_with_realization, with an explicit host-normalized context payload. This is the CLI host seam for--context-injection; the dispatcher performs no project I/O. - emit_
claude_ code_ with_ models - Emit Claude Code agent runtime files for a resolved IR into
out_dir. Errors on any unsupported enum value rather than emitting a silently-wrong file. Runs the capability resolution pass first; on abort it errors and writes nothing.modelsresolves each step’s tier to a concrete model. A hybrid binding uses the defaultHybridRealization::BashScript; callemit_claude_code_with_realizationto choose. - emit_
claude_ code_ with_ native_ purpose - As
emit_claude_code_with_providers, opting into the v2 native Sessions contract.purposeis a closed, server-selected allowlist; it selects neither a caller cwd nor prompt. - emit_
claude_ code_ with_ providers - As
emit_claude_code_with_context, composing the base target with caller-supplied provider fragments. This is how a domain capability — one naming an external service rather than the runtime’s own structure — reaches this back-end without being hardcoded in it. - emit_
claude_ code_ with_ realization - As
emit_claude_code_with_models, choosing how a hybrid binding’s LOCAL step is realized on the file target (bash-script script vs an MCP server). Only affects the hybrid path. - emit_
codex_ interactive - is_
known_ target - known_
target_ names - parse_
envelope - Extract a Warble render envelope from raw agent output. The agent is asked to emit only the JSON envelope, but models routinely wrap it in ```json fences or surround it with a sentence. This is deliberately forgiving:
- parse_
provider_ fragments - Parse one fragment file’s contents. Pure — file I/O stays in the CLI.
- render_
envelope_ to_ html - Render a full envelope to a single self-contained HTML document. Pure and deterministic: no clock, no randomness, stable ordering — the same envelope always produces identical bytes.
- resolve_
capabilities - Resolve every capability required by
nodeagainstprofile. Returns the report on success; errors (loud-fail) naming the capability + target if any required capability resolves tofail. - resolve_
node_ capabilities - Resolve one node’s required capabilities against
target_id, erroring on anyfailoutcome (no silent degradation). Callers must not emit files when this errors. - setup_
recovery_ input_ schema - The public, transport-independent input schema for the
genbi_sessionreport_setup_recoveryMCP tool. The host validates monotonicity against its last accepted report; the schema deliberately carries neither identity nor any diagnostic text. - setup_
recovery_ instructions - The generated Setup-agent instruction for the v3
genbi_sessiondiscovery contract. This is deliberately prose plus closed examples rather than a second tool configuration. - validate_
setup_ recovery_ report - Validate the producer-owned closed vocabulary without accepting or echoing a raw report. Hosts additionally own per-session authorization and monotonic sequence fencing.
Type Aliases§
- Provider
- Which provider serves a tier’s model — an open string, opaque to warble (mirrors how the IR
treats
tier; seebinding-spec.md). Two well-known values get behavior baked intoTierBindingparsing below (ANTHROPIC_PROVIDER, the default;OPENAI_COMPAT_PROVIDER, which requiresendpoint), but warble does not validate this field against a fixed provider list — any other string is a valid, warble-unrecognized provider that passes through unchanged. Rejecting a genuinely unsupported provider is the consuming harness/back-end’s job (its per-provider adapter registry), never warble’s — warble stays opaque pass-through. - Resolution
Report