Expand description
Portable durable Code Mode runtime for incurs tools.
This crate owns connector discovery, model-facing type generation, approval policy, deterministic replay, snippets, and lifecycle state. Sandbox execution and durable persistence are supplied through traits so the same runtime can run through local or remote executors.
Structs§
- Artifact
Ref - Durable reference to a JSON artifact stored outside execution state.
- Capability
Snapshot - Immutable connector metadata captured when an execution begins.
- Code
Mode - Generic Code Mode lifecycle over interchangeable execution and storage adapters.
- Code
Mode RunOptions - Transport context inherited by one Code Mode execution pass.
- Code
Mode Runtime - Portable deterministic replay and approval state machine.
- Connector
Description - Model-visible description of a connector.
- Connector
Example - One model-facing connector usage example.
- Connector
Tool - Metadata for one connector method.
- Default
Tool Policy Resolver - Conservative default policy resolver.
- Describe
Output - Documentation for one connector, method, or snippet.
- Dispatch
Response - Wire-safe result of one connector dispatch.
- Dispatch
Session - One replay pass’s sequenced bridge between a sandbox and Rust connectors.
- Execute
Result - Result returned by a Code Mode program executor.
- Execution
Host - Execution-scoped bridge from a local engine into durable dispatch.
- Execution
State - Durable state for one sandbox program.
- Incur
Connector - Adapts an incurs command graph into one Code Mode connector.
- LogEntry
- One entry in the deterministic replay spine.
- McpConnector
- Exposes a remote MCP connection as a Code Mode connector.
- McpTool
- MCP tool metadata used by the transport-neutral MCP adapter.
- Memory
Artifact Store - In-memory artifact store for local use and tests.
- Memory
Store - In-memory runtime store for native use and deterministic tests.
- Open
ApiConnector - Derives typed Code Mode tools from an OpenAPI document.
- Open
ApiRequest - Authenticated request derived from an OpenAPI operation.
- Pending
Action - A pending connector action shown to an approval UI.
- Program
Source Options - Adapter-specific settings for the shared Code Mode JavaScript harness.
- Search
Output - Bounded ranked search response.
- Search
Result - One ranked connector method or snippet match.
- Snippet
- A saved, addressable sandbox program.
- Step
Response - Wire-safe decision for a local
codemode.stepcallback. - System
Clock - Native system clock used by default.
- Tool
Annotations - Runtime annotations for one connector method.
- Tool
Context - Stable execution context passed to connector calls and compensation.
- Tool
Policy - Resolved approval and deterministic replay policy for one method.
Enums§
- Code
Value - A value that preserves JavaScript-only primitives across JSON and RPC.
- Dispatch
Request - Host request emitted by an executing Code Mode program.
- Execution
Event - Ordered event retained with one execution.
- Execution
Status - Durable execution status.
- LogEntry
State - Durable state of one logged call.
- Replay
Policy - Replay behavior for a connector call.
- Runtime
Error - Runtime state and persistence failures.
- Tool
Decision - Runtime decision for the next deterministic call.
- Tool
Origin - Trust boundary used while resolving tool policy.
Constants§
- DEFAULT_
MAX_ EVENTS - Maximum number of ordered lifecycle events retained per execution.
- DEFAULT_
MAX_ EXECUTIONS - Default number of terminal executions retained by a runtime.
- DEFAULT_
PAUSED_ TTL_ MS - Default age after which a paused or abandoned running execution expires.
- MAX_
DURABLE_ VALUE_ BYTES - Maximum serialized bytes for one durable value.
Traits§
- Artifact
Store - Storage contract for oversized replay and final values.
- Clock
- Supplies monotonic-enough Unix millisecond timestamps to Code Mode.
- Code
Executor - Executes model-generated JavaScript for one replay pass.
- Code
Mode Service - Send-safe lifecycle boundary used by transports and native actor handles.
- Connector
- A transport-neutral source of sandbox-callable tools.
- McpClient
- Minimal MCP client contract required by Code Mode.
- Open
ApiClient - Host operations required by the OpenAPI connector.
- Runtime
Store - Persistent operations required by the portable runtime.
- Tool
Policy Resolver - Resolves approval and replay behavior from tool metadata.
Functions§
- build_
program_ source - Builds the shared body used by local and remote Code Mode executors.
- decode_
value - Decodes a JSON-safe tagged representation into a Code Mode value.
- describe
- Describes one connector, method, or saved snippet.
- encode_
value - Encodes a Code Mode value into a JSON-safe tagged representation.
- generate_
types - Generates the TypeScript declarations shown to the model for a connector.
- json_
schema_ to_ type - Converts a JSON Schema value into a model-facing TypeScript type.
- normalize_
code - Normalizes model-generated JavaScript into an async zero-argument function.
- sanitize_
identifier - Makes an arbitrary tool name safe for use as a JavaScript identifier.
- sanitize_
namespace - Validates and normalizes a namespace from a CLI or connector name.
- search
- Searches connector methods and saved snippets with weighted token matching.