Skip to main content

Module run

Module run 

Source
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§

AgentEventTapGuard
Keeps one PreparedRun agent-event tap registered.
Bounds
Limits on what a run, or one turn of it, may spend.
CancellationToken
The signal a caller trips to stop a turn.
CollectingSink
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.
EventFanIn
Mints the tagged sinks that feed one merged stream.
FnSink
Calls a closure per event.
LoadedSkill
A skill available to the run, without its body.
MergedEvents
The host’s end of a fan-in: every tagged sink’s events, in arrival order.
ModelInfo
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
NullSink
Discards every event, for a host that only wants the final message.
OutputAttemptReport
A validated typed attempt alongside the ordinary run report.
OutputFailure
A typed turn that produced no value — and everything it reported anyway.
OutputReport
A typed turn’s answer, alongside everything a plain turn reports.
OutputReservation
One generated output tool reserved for a validated run.
OutputSpec
The shape a turn must answer in.
PreparedRun
A session and the prompt to send it. Nothing has been sent yet.
ReasoningOptions
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
RoundAdjustment
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
RoundContext
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
RoundToolResult
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.
TaggedEvent
An event and the run it came from.
TaggedSink
One run’s end of a fan-in: an EventSink that labels each event with its tag and hands it to the shared consumer.
TurnOptions
Limits and stop signals for a single turn.

Enums§

AgentEvent
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.
ContentBlock
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.
OutputAttempt
What a validated typed attempt produced.
OutputDecision
A host’s decision over one schema-shaped candidate before termination.
PromptPart
One piece of what a turn is asked.
ReasoningChange
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
ReasoningSummary
How much provider-generated reasoning summary to request.
RoundBoundary
The per-turn steering seam, whole: the trait a host implements and every type its signatures make that host name.
RoundDecision
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.
RunFailureCategory
Recoverability classification for a retained RunFailure. Classifies a RuntimeError by its recoverability.

Traits§

EventSink
A destination for run events.
RoundStrategy
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.