Skip to main content

Module runs

Module runs 

Expand description

One instruction that changed more than one application, recorded as one thing a person can undo.

“Crop the photo and put it in the report” changes two documents, and neither app’s history can undo the other’s. groups names a run within one document; this is the record above it.

It lives in the coordinator’s collaborative document (often the room document, or the primary document for a headless agent). That coordinator cannot materialise every app’s document, so a record holds no content, only references. Undoing is revert_run against each app’s own document, performed by the app that owns it.

The key is derived from the work and the records sit at the root: two coordinators recording the same run land on one map key automerge resolves identically everywhere, whereas a container would itself be a thing two writers race to create — losing that race discards every record inside it.

Structs§

AgentRun
One instruction that spanned one or more applications.
RunStep
One application’s share of a run.

Constants§

MAX_LABEL_LEN
Longest label stored. A run’s label is the instruction as the person phrased it, and past this it stops fitting anywhere it is rendered.
RUNS_KEY
Prefix of the root keys holding this document’s cross-application runs. Namespaced like GROUPS_KEY so it cannot collide with an app’s own schema.

Functions§

forget_run
Remove a run record. The changes it referenced stay untouched in their own documents; only the grouping goes.
is_run_marker
True when every patch lands inside a run record — the change did nothing but record bookkeeping, already on screen as a band, so a “1 field” row under it would be noise. An empty patch set is not a marker.
read_runs
Read every recorded run out of doc, oldest key first. A record that does not parse is skipped rather than guessed at: an undo affordance pointing at the wrong changes is worse than no affordance.
record_run
Record a run. Returns the document key, which is also AgentRun::id. The transaction is left open — the caller commits, so the record lands stamped and attributed like any other edit. A run with no steps is not recorded: nothing changed, so there is nothing to offer undo on.
record_run_with_details
Record a run with the task evidence needed for a later review.
run_starting_at
The run whose first step starts at start, if one is recorded.