/** * The working document's binding and trail (program DES-POWER-MODE §8.3, §9; spike 3). * * ONE file, `/daemon-working-docs.json`, under the `daemon-` prefix the state-home fence already * classifies (as `daemon-editors.json`). Per run: the wicked-interactive document it is bound to (project + doc * name), the trail of versions crew wrote (who, through which surface, which sections, when) and the steering * notes made from them (what was sent, when it was queued and which step picked it up). * * The versions themselves are interactive's (write-once, parent-linked, `author` in each batch). This file holds * only what interactive cannot know: the run, the attribution crew decided, and the steering. */ import type { SectionId, SteerKind } from './sections.js'; export declare const WORKING_DOCS_FILENAME = "daemon-working-docs.json"; /** The sidecar crew writes into the document's own directory: it is what makes every seam read the doc as kind * `phase-report` (`interactive/chat-events.ts readDocHead`), whatever interactive's manifest says. */ export declare const WORKING_DOC_SIDECAR = "crew-working-doc.json"; export declare const WORKING_DOC_KIND = "phase-report"; /** Who a version is by. A person's edit is `human` (the operator), a plugin's own generated lines `plugin`, the * document crew seeds `system`. */ export type DocAuthor = { kind: 'human'; id: string; } | { kind: 'plugin'; id: string; } | { kind: 'system'; id: 'crew'; }; export interface TrailEntry { version: number; parent: number | null; author: DocAuthor; /** The surface the edit was made in (`plugin:wicked-phase-report@0.13.1`), when a plugin hosted it. */ surface: string | null; sections: SectionId[]; at: number; /** The steering note this version made, if any. */ steerId: string | null; } export interface SteerRecord { id: string; version: number; sections: SectionId[]; kind: Exclude; /** Exactly what was sent to the run. */ note: string; at: number; by: string; /** Set once the engine accepted it (queued for the next step, or written into a live worker). */ queuedAt: number | null; /** The step whose prompt carried it (`workerMessageInjected`). */ pickedUp: { ord: number | null; step: string | null; at: number; } | null; /** Why it was not sent (the run had ended; the engine refused). */ error: string | null; /** A standing steer: the constraint alone, re-sent before every later step. */ standingNote?: string; /** A standing steer: superseded by a later edit of the same section, it is no longer re-sent. */ supersededBy?: string | null; /** A standing steer: how many later steps it was re-sent to. */ renewals?: number; } export interface WorkingDocRecord { runId: string; projectId: string; docId: string; createdAt: number; trail: TrailEntry[]; steers: SteerRecord[]; /** An edit whose outcome was not known (no version in time): attributed once the head shows it, never to another. */ pending?: { expectHead: number; author: DocAuthor; surface: string | null; values: Partial>; at: number; actor: { id: string; kind: string; }; } | null; } export declare class WorkingDocStore { private readonly path; private data; constructor(opts?: { stateHome?: string; log?: (m: string) => void; }); get(runId: string): WorkingDocRecord | undefined; all(): WorkingDocRecord[]; put(rec: WorkingDocRecord): void; /** Mutate one run's record and persist. */ update(runId: string, f: (rec: WorkingDocRecord) => void): WorkingDocRecord | undefined; private save; } /** Mark a doc directory as a run's working document (kind `phase-report`). */ export declare function writeSidecar(docDir: string, runId: string): void; /** Whether a doc directory is a run's working document. */ export declare function isWorkingDocDir(docDir: string): boolean; //# sourceMappingURL=store.d.ts.map