/** * The units of an interactive run, as the engine plans them (crew#935, X-MIG M9). * * `interactive-chat`, `interactive-draft` and `interactive-edit` are wicked-core built-in presets * (wicked-core#860). Crew no longer registers a def for them, so it cannot count phases from a * def: the run carries the PA's `pa-scope` step first, the engine's floor additions (`critique`, * and at higher bands more), and no crew deliverable-floor unit (the engine's floor rides the last * creator step). The narration reads the run's own plan instead, from its `unitPlanned` frames. * * A `unitPlanned` frame names one NEW unit at its ord. A re-plan (after the PA rates the run, the * floor adds steps) announces only the units it adds and moves the later ones down, so each new * unit is inserted at its ord in the ordered list and the units after it shift by one, as the * engine shifts them. The step id is the description's leading token (the engine writes * ` — ||| `). * * A plan edited at a plan-approval gate can also DROP or reorder pending units, which no frame * announces; so when the run resumes the fold is re-read from the run's own unit list * ({@link resyncRunUnits}). */ import type { CoreAdapter } from '../core/adapter.js'; import type { CoreEvent } from '../core/types.js'; /** One planned unit, as narration needs it. */ export interface PlannedUnit { /** The plan step id (`pa-scope`, `draft`, `critique`, …). */ id: string; /** `creator` | `evaluator` | `neutral`. */ role: string; /** A deterministic tool unit (no seat, no council). */ tool: boolean; } /** The {@link PlannedUnit} and its ord a `unitPlanned` frame announces, or `null` for any other frame. */ export declare function plannedUnitOf(event: CoreEvent): { ord: number; unit: PlannedUnit; } | null; /** A step id as a narration line reads it: the PA's rating step says what it does. */ export declare function describeStep(id: string): string; /** The run's planned units in ord order (ord n = index n − 1). */ export declare class RunUnits { /** A hole is a unit the fold has not seen announced (it keeps the later ords honest). */ private readonly units; /** Fold one engine frame; `true` when it was a `unitPlanned` frame. */ observe(event: CoreEvent): boolean; /** Replace the whole list with the run's units as the engine holds them (ord order). */ replace(units: readonly PlannedUnit[]): void; /** The unit at `ord`, or `undefined` before the engine planned it. */ at(ord: number): PlannedUnit | undefined; /** The step id at `ord` (`phase ` before it is planned). */ idAt(ord: number): string; /** A deterministic tool unit: it has no seat, so its council and routing frames are not narrated. */ isTool(ord: number): boolean; /** The unit narrated as writing the document: the LAST agent creator (the engine joins the * launch's declared deliverables to the plan's last creator step at launch). A label only — a plan * revised mid-run can add a later creator, so no line claims a file check from it (codex r7). */ isWriter(ord: number): boolean; /** An evaluator unit (the engine's `critique`, a review). */ isEvaluator(ord: number): boolean; /** `"/"`, or `""` before any unit is planned. */ position(ord: number): string; } /** One unit of the run as `SessionView.units[]` carries it (the fields the fold reads). */ export interface RunUnitRow { id: string; ord: number; role?: string | null | undefined; tool_cmd?: string[] | null | undefined; } /** The run's units as {@link PlannedUnit}s in ord order; the step id is the unit id after `:`. */ export declare function plannedUnitsOfRun(runId: string, rows: readonly RunUnitRow[]): PlannedUnit[]; /** * Re-read `units` from the run's own unit list (after a gate the plan may have been edited at). * Narration only: an engine that cannot answer leaves the fold as it was, and nothing throws. */ export declare function resyncRunUnits(adapter: CoreAdapter, runId: string, units: RunUnits): Promise; /** The thread line for a run paused for a person (`awaitingHuman`): what it waits on and where to answer. */ export declare function awaitingHumanLine(event: CoreEvent, runId: string, units: RunUnits): string; /** * Holds a run's engine frames while its fold is re-read ({@link resyncRunUnits}), then replays them * in order: a dispatch that follows `resumed` must be narrated against the REFRESHED units, not the * list a gate edit just changed (codex r2 on crew#938). Frames of other runs pass straight through. */ export declare class ResyncGate { private readonly fold; private readonly held; constructor(fold: (event: CoreEvent) => void); /** Deliver one engine frame: folded now, or queued behind its run's pending re-read. */ deliver(event: CoreEvent): void; /** Queue `runId`'s frames until `refresh` settles, then replay them through the fold. */ hold(runId: string, refresh: Promise): void; } //# sourceMappingURL=run-units.d.ts.map