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.3) that this back-end consumes.
Structs§
- Capability
Manifest - 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. - 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§
- 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. - 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_
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.
- emit_
claude_ code - 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_ 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. - 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:
- 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.
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