/** One node. `kind` is passed through verbatim from the source (plan|design|note|agent). */ export interface PlanItem { /** Namespaced id, `:` (crib) or `agent:`. */ id: string; kind: string; name: string; status: string | null; /** must-precede refs (this item depends on these), by node id. */ deps: string[]; tainted?: boolean; meta?: Record; } /** A full-replace snapshot for one `ns` (channel `plan:snapshot`). */ export interface PlanSnapshot { ns: string; seq: number; project?: string; items: PlanItem[]; } /** A part-by-part patch for one `ns` (channel `plan:update`). */ export interface PlanUpdate { ns: string; seq: number; upsert: PlanItem[]; remove: string[]; } /** Accumulated plan state: per-ns item maps + last-seen seq for out-of-order guarding. */ export interface PlanState { byNs: Map>; lastSeq: Map; } export declare function newPlanState(): PlanState; /** Parse a `plan:snapshot` payload. Returns null when unusable. Accepts `source` as a * legacy alias for `ns`. */ export declare function parseSnapshot(data: unknown): PlanSnapshot | null; /** Parse a `plan:update` payload. Returns null when unusable or a no-op. */ export declare function parseUpdate(data: unknown): PlanUpdate | null; /** Apply a snapshot in place. Returns true when the state changed (drops stale seq). */ export declare function applySnapshot(state: PlanState, snap: PlanSnapshot): boolean; /** Apply a part-by-part update in place. Returns true when the state changed. */ export declare function applyUpdate(state: PlanState, up: PlanUpdate): boolean; /** Flatten accumulated state to a single item list (ns-then-insertion order). */ export declare function planItemsOf(state: PlanState): PlanItem[];