Skip to main content

Module event

Module event 

Source
Expand description

basis’s event stream: one schema, many surfaces.

Mentra’s SessionEvent broadcast is the source of truth for what happens during a run. This module normalizes it into a wire contract basis owns, so that basis spawn --json (with basis run retained as an alias), the ACP mapping (P2), and anything downstream all read the same shape — and so a change inside mentra does not silently become a change in basis’s output.

§Wire format

Newline-delimited JSON, one EventLine per line. The first line is always Event::RunStarted, which carries EVENT_SCHEMA_VERSION; a consumer reads the version before anything else and can refuse a stream it does not understand. The last line is always Event::RunFinished.

{"seq":0,"type":"run_started","schema":1,"basis":"0.1.0","workspace":"/repo",...}
{"seq":1,"type":"assistant_delta","text":"Looking at "}
{"seq":2,"type":"run_finished","status":"ok"}

Structs§

ContextFile
A context file that was in effect for the run.
EventLine
One line of the stream: a sequence number and the event itself, flattened so a line is a single flat JSON object.
JsonlWriter
Writes Events as JSONL, assigning sequence numbers.
SkillSummary
A skill the run can load by name. Bodies stay out of the stream — they are what load_skill is for, and keeping them out is what makes skills cheap.
TemplateSummary
A prompt template a client can offer as a command.

Enums§

Event
Everything that can appear on the stream.
Mutability
Whether a tool call can change anything outside the process.
NoticeSeverity
Severity of an out-of-band notice.
PermissionOutcome
How a permission request was resolved.
RuleScope
How far a remembered permission decision reaches.
RunOutcome
How a run ended.
TaskKind
What kind of concurrent work a task event describes.
TaskStatus
Where a task is in its lifecycle.

Constants§

EVENT_SCHEMA_VERSION
Version of the JSONL wire format. Bumped when a change would break a consumer that reads the current shape.