/** * Chief 6+1 stage event emitter (v1.1). * * Per v1.1 PRD §5.2. Chief's TRIAGE → DECOMPOSE → DISPATCH → AWAIT → * SYNTHESIZE → DECIDE → RETROSPECT state machine emits one event per * stage transition to `/memory/chief-stage-events.jsonl`. The full * runner-side stage machine is wired into chief-runner in a follow-up; * this module is the storage layer + helpers any caller can use today * (e.g. retrospective skill replaying yesterday's cycles). * * Append-only, one event per line. Mirrors the existing * agent-costs.jsonl convention. */ export declare const CHIEF_STAGES: readonly ["TRIAGE", "DECOMPOSE", "DISPATCH", "AWAIT", "SYNTHESIZE", "DECIDE", "RETROSPECT"]; export type ChiefStage = (typeof CHIEF_STAGES)[number]; export interface ChiefStageEvent { /** ISO 8601. */ ts: string; /** Stable correlation id for the user-turn this stage belongs to. */ turn_id: string; /** Which of the 6+1 stages fired. */ stage: ChiefStage; /** Optional task / workflow / goal id this stage belongs to. */ task_id?: string; /** Free-form short tag for the action that happened (e.g. "classified=workflow"). */ detail?: string; /** Names of sub-agents dispatched (DISPATCH stage). */ dispatched?: string[]; /** Names of skills invoked (any stage). */ skills_used?: string[]; } export interface ChiefStageEventsOpts { /** Org root — e.g. `//`. */ orgRoot: string; } /** * Emit a stage event. Idempotent in the sense that re-emitting the same * stage in the same turn is allowed (it's appended again) — Chief may * loop through stages multiple times per user turn, especially the * AWAIT ↔ DISPATCH cycle when open_questions[] resolve. */ export declare function emit(opts: ChiefStageEventsOpts, event: Omit & { ts?: string; }): ChiefStageEvent; /** * Read events, optionally filtered by turn_id, stage, or since-timestamp. * Returns events in append order (oldest first). Malformed lines skipped. */ export declare function readEvents(opts: ChiefStageEventsOpts, filter?: { turn_id?: string; stage?: ChiefStage; sinceIso?: string; }): ChiefStageEvent[]; /** * Helper: return the most recent stage in a given turn, or null if the * turn has no events. Used by chief-runner crash recovery to figure out * where to resume. */ export declare function latestStageForTurn(opts: ChiefStageEventsOpts, turnId: string): ChiefStage | null;