Skip to main content

Crate locode_engine

Crate locode_engine 

Source
Expand description

locode-engine — the sample→dispatch→append loop and the Session driving API (ADR-0005, ADR-0004, ADR-0014).

A Session drives one run to a terminal locode_protocol::Status against any locode_provider::Provider, dispatching tool calls through a locode_tools::Registry, emitting stream-json events to an EventSink, and returning one locode_protocol::Report. Proven end-to-end against MockProvider with zero network.

Structs§

AllowAll
The default approver: allows everything, instantly — headless consumers (locode-exec, evals) are byte-for-byte unchanged in behavior.
ApprovalRequest
The pre-dispatch view of one tool call — what the studied UIs render their permission prompts from (request args, not host-resolved detail).
CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
EngineConfig
Everything the loop needs that isn’t the provider, registry, preamble, or sink.
FnSink
Forwards each event to a closure — e.g. a JSONL stdout writer for stream-json, or a Vec-pushing closure in tests.
NullSink
Drops every event — for the json/text output modes that only want the report.
Session
One driven agent session. Owns the conversation history across runs: a second Session::run on the same session continues the same conversation (ADR-0016) — the exact call shape an interactive frontend needs for follow-up turns.

Enums§

Decision
The approval vocabulary — deliberately minimal (ADR-0017 Option V1): stickiness and richer choices live in approver implementations.

Traits§

Approver
Decides whether one tool call may run. Consulted by the engine per call, serially, before dispatch; the await suspends only this call.
EventSink
A sink for the loop’s Events. &mut self so a writer sink can buffer/flush; object-safe so locode-exec can pick one at runtime by --output-format.