Expand description
locode-protocol — shared, provider-neutral types with no I/O.
Two concerns live here:
- the conversation model (4-role, Anthropic-shaped content blocks — ADR-0013),
which the loop accumulates and hands to a
Provider; and - the report envelope (ADR-0009), the single JSON artifact
locode-execprints.
Types are Rust-native and serialize with serde for our own persistence/reporting;
conversion to a specific provider wire (Anthropic, OpenAI) lives in each Provider
impl, not here.
Structs§
- Conversation
- A full conversation: one uniform stream of role-tagged messages (ADR-0013).
- Message
- One message: a role plus an ordered list of content blocks.
- Report
- The single JSON document
locode-execprints to stdout (ADR-0009). - Tool
Call Record - A report-side record of one tool call (distinct from the in-conversation
ContentBlock::ToolUse): the structuredoutputview, not the model-facing text. - Tool
Spec - A provider-neutral tool spec: name + description + args JSON Schema.
- Usage
- Token accounting parsed from the provider’s terminal usage event.
Enums§
- Content
Block - A typed piece of message content, modeled on Anthropic’s content blocks.
- Event
- One event in the
stream-jsontrajectory (one JSON object per line). - Grammar
Syntax - The grammar language of a
ToolInputFormat::Freeformtool. - Image
Source - The source of an image block.
- Reasoning
Format - The encoding/replay contract of a
ContentBlock::Reasoningblock. - Result
Chunk - A single chunk of a tool result (a restricted set of block kinds).
- Role
- The author of a message (ADR-0013).
- Status
- The terminal state of a run. Serializes to the exact strings in ADR-0009.
- Tool
Input Format - 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
customtools — codex’sapply_patch). Exactly one of the two — an enum, not optional fields, so invalid states are unrepresentable.
Functions§
- reconstruct_
conversation - Reconstruct the full
Conversationfrom astream-jsonevent trajectory.