Skip to main content

Crate locode_tools

Crate locode_tools 

Source
Expand description

locode-tools — the tool framework: the typed Tool contract, the Registry, and the single Registry::dispatch door (host-agnostic; ADR-0003/0004/0008).

Tools are authored against concrete Args/Output types, with the wire JSON Schema derived from Args. The registry erases them to Box<dyn DynTool> at its boundary and routes every call — by the pack-assigned wire name — through one dispatch function, which returns both the history tool_result and the report record. No concrete tools, filesystem, or shell live here (those are the grok pack over locode-host).

Structs§

Dispatched
The outcome of one Registry::dispatch: both the history and report views, plus a fatal signal.
Registry
A set of tools keyed by their model-facing wire names, plus the one dispatch door every call funnels through (ADR-0008).
ToolCtx
The context handed to a tool for one call.
ToolRunResult
The two faces of a successful tool call, produced by erasure.
ToolSpec
A provider-neutral tool spec: name + description + args JSON Schema.

Enums§

GrammarSyntax
The grammar language of a ToolInputFormat::Freeform tool.
ToolError
How a tool call failed, split into exactly two recovery paths (ADR-0004).
ToolInputFormat
How a tool’s input is specified: a JSON-schema function tool, or a freeform tool whose raw-text input is constrained by a server-side grammar (OpenAI Responses custom tools — codex’s apply_patch). Exactly one of the two — an enum, not optional fields, so invalid states are unrepresentable.
ToolKind
A canonical classification tag for a tool, used only to align comparable tools across harness packs for A/B analysis (ADR-0003) — it is not the wire name (that is assigned per-pack at registration) and not the Rust type name.

Constants§

MODEL_OUTPUT_BUDGET
Default model-facing byte budget. Matches Grok’s shell output cap.

Traits§

DynTool
The object-safe, type-erased tool the registry stores.
Tool
A tool authored against concrete types; the wire schema is derived from Tool::Args, never hand-written (ADR-0003).
ToolOutput
The model-facing rendering of a tool’s output.

Functions§

truncate_for_model
Bound text to roughly budget bytes for model consumption, keeping the head and tail and eliding the middle (middle-truncation, Codex-style) with a byte-count marker in the seam.