Expand description
One prompt against one workspace: the smallest complete thing basis does.
This is the P1 acceptance surface from docs/ARCHITECTURE.md §6 —
arbitrary prompts on arbitrary repos, in-process and as a subprocess. The
binary is a thin shell over run; a Rust host calls it directly.
Nothing here knows what the prompt is for. The mission arrives as data: the prompt itself, the workspace’s own context files, and configuration.
run answers the whole question — build a runtime, resolve a model, send
the prompt — for the case where one prompt is the whole job. Everything in
this module is a wrapper around Workspace: it opens
one, mints a single run from it, and drops it when the run ends. A host
sending more than one prompt at a repository should open the workspace
itself and keep it, which is what the split of ADR-0010 is for.
A host that already owns a mentra runtime skips to [prepare_with_session]
and keeps its own.
Re-exports§
pub use crate::error::RunError;
Structs§
- Agent
Event TapGuard - Keeps one
PreparedRunagent-event tap registered. - Bounds
- Limits on what a run, or one turn of it, may spend.
- Cancellation
Token - The signal a caller trips to stop a turn.
- Collecting
Sink - Keeps every event in memory. The natural sink for tests, and for a host that wants the whole run before deciding what to do with it.
- Compacted
- What a summarizing pass did.
- Event
FanIn - Mints the tagged sinks that feed one merged stream.
- FnSink
- Calls a closure per event.
- Loaded
Skill - A skill available to the run, without its body.
- Merged
Events - The host’s end of a fan-in: every tagged sink’s events, in arrival order.
- Model
Info - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Null
Sink - Discards every event, for a host that only wants the final message.
- Output
Attempt Report - A validated typed attempt alongside the ordinary run report.
- Output
Failure - A typed turn that produced no value — and everything it reported anyway.
- Output
Report - A typed turn’s answer, alongside everything a plain turn reports.
- Output
Reservation - One generated output tool reserved for a validated run.
- Output
Spec - The shape a turn must answer in.
- Prepared
Run - A session and the prompt to send it. Nothing has been sent yet.
- Reasoning
Options - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Round
Adjustment - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Round
Context - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Round
Tool Result - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- RunContext
- What a run is about, once the runtime questions are settled.
- RunReport
- What a completed run produced, alongside the sink it wrote to.
- RunUsage
- What a run reported spending, summed over the rounds it took.
- Tagged
Event - An event and the run it came from.
- Tagged
Sink - One run’s end of a fan-in: an
EventSinkthat labels each event with its tag and hands it to the shared consumer. - Turn
Options - Limits and stop signals for a single turn.
Enums§
- Agent
Event - Mentra’s complete provider-neutral agent event, forwarded unchanged by
PreparedRun::register_agent_event_tap. - Bound
- A bound that ended a run before its work did.
- Content
Block - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Effort
- How hard the model should think before answering.
- Output
Attempt - What a validated typed attempt produced.
- Output
Decision - A host’s decision over one schema-shaped candidate before termination.
- Prompt
Part - One piece of what a turn is asked.
- Reasoning
Change - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Reasoning
Summary - How much provider-generated reasoning summary to request.
- Round
Boundary - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- Round
Decision - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
- RunFailure
- Mentra’s original typed terminal failure retained by
RunReport. Errors produced while configuring, running, or recovering Mentra agents. - RunFailure
Category - Recoverability classification for a retained
RunFailure. Classifies aRuntimeErrorby its recoverability.
Traits§
- Event
Sink - A destination for run events.
- Round
Strategy - The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
Functions§
- run
- Runs one prompt to completion, streaming events into
sink. - run_
with_ approver - Runs one prompt, putting every consequential call to
approver.