Skip to main content

Crate supercode_interchange

Crate supercode_interchange 

Source
Expand description

Provider-neutral canonical data for coding-agent session interchange.

This crate is the dependency base for Supercode’s translators, optional reversible reducer, and optional native runtime. During the compatibility migration it first owns canonical messages and their deterministic token estimates; session containers and native codecs move here next without changing their public shapes.

Re-exports§

pub use catalog::CodexHistoryTopicIndex;
pub use catalog::DiscoveryPage;
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::SessionPreviewCandidate;
pub use catalog::StorageLocator;
pub use ontology::core_messages;
pub use ontology::measure_fidelity;
pub use ontology::messages_equal;
pub use ontology::messages_equal_multimodal;
pub use ontology::replay_eligible;
pub use ontology::replay_excluded;
pub use ontology::ArtifactFidelity;
pub use ontology::Binding;
pub use ontology::EndReason;
pub use ontology::Fidelity;
pub use ontology::FidelityMetric;
pub use ontology::FidelityResidue;
pub use ontology::OrchestrationCodec;
pub use ontology::Residue;
pub use ontology::SecretRef;
pub use ontology::Vault;
pub use session::CrossSurface;
pub use session::OrchestrationNouns;
pub use session::Recurrence;
pub use session::Session;
pub use session::SessionFormat;
pub use session::SessionMeta;
pub use session::SessionSource;
pub use session::SurfaceKey;
pub use session::Trigger;
pub use session::WorkspaceKind;
pub use session::WorkspaceRef;
pub use watch::SessionFollower;
pub use watch::SessionSnapshotReason;
pub use watch::SessionWatchEvent;

Modules§

catalog
Discovery and durable addressing for sessions written by external harnesses.
ontology
The supercode ontology (docs/ONTOLOGY.md): the one model under the session spine and the orchestration. Lower layers never import upper ones — this module depends on nothing above it except the session layer’s crate::session::OrchestrationNouns wire block, which a Binding projects onto.
orchestration
The orchestration piece of the ontology (docs/ONTOLOGY.md §2.7, docs/ORCHESTRATOR-IR.md §2): a harness’s operational home as ONE typed value. These are the records the orchestrator loads, steps and saves; a Hermes or OpenClaw home compiles into them and decompiles back (the codecs are ONT-3’s). The wire form is the orchestrator IR’s canonical JSON: the runtime half is never persisted and is not here.
session
Natively load — and continue — real Claude Code and Codex sessions.
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.
watch
Passive, change-triggered following of local coding-harness sessions.
workflow
The workflow layer: what a harness’s board owes and where each piece stands — Board, Task, Lane, Dependency, Attempt, Handoff, Review (docs/ONTOLOGY.md §2.8). It sits above orchestration: a task names the profile that works it, and an attempt is one session’s run at it. Lower layers never import this one.

Structs§

ChatMessage
A single message in a conversation.
FunctionCall
The function payload of a ToolCall.
ToolCall
A request from the model to invoke a tool.

Enums§

Error
An error at a native session-format boundary.
InterchangeError
An error at a native session-format boundary.
Role
Who authored a ChatMessage.
ToolOutcome
The structural outcome known for a tool-result message.

Constants§

TOOL_ERROR_METADATA_KEY
Canonical metadata key marking a tool result as a structured error.
TOOL_OUTCOME_UNKNOWN_METADATA_KEY
Canonical metadata key marking a tool result whose outcome is unknown.

Functions§

estimate_tokens
Deterministic token estimate: ceil(utf8_bytes / 4).
estimate_view_tokens
Estimate the serialized wire size of canonical messages.
format_commas
Render n with comma thousands separators.
is_tool_error
Whether a message carries the canonical structured-error marker.
mark_tool_error
Stamp a tool-result message as a structured error.
mark_tool_outcome_unknown
Stamp a tool-result message as having no structurally known outcome.
tool_outcome
Return the canonical structural outcome for a tool-result message.

Type Aliases§

Result
Result type for interchange operations.