import type { JsonObject } from "../shared/types.js"; import type { WorkItem, WorkItemEvent, WorkItemStatus } from "./store.js"; /** * ICI-570 — live change signal for Todo writes that happen IN-PROCESS, outside * the HTTP routes: the cron mint, and (ICI-749) every guarded status write, * whoever commits it. This module gives the gateway one registration point so * those lanes reach the web dashboard too. The non-status route lanes still emit * their own richer `company:changed` events at the persistence boundary. Null * (the default, and the state in tests/CLI runs without a server) makes every * notify a no-op. */ export interface TodoLiveEvent { entity: "todo"; action: string; id: string; version: number; value?: JsonObject; /** The session that invoked the write, when one did. The client refetches its * transcript as loss recovery for a dropped activity block. */ sessionId?: string; } /** Run `commit` — a `db.transaction(…)` handle — releasing the signals raised * under it only if it returns. A throw rolls the transaction back, so the * signals are dropped with the writes that raised them. */ export declare function holdLiveSignalsUntilCommit(commit: () => T): T; type TodoLiveEmitter = (event: TodoLiveEvent) => void; export declare function setTodoLiveEmitter(next: TodoLiveEmitter | null): void; export declare function notifyTodoChanged(item: WorkItem, action: string, sessionId?: string): void; /** The second listener on the same write: a committed status change, handed to * the Workflow `todo-status` trigger bridge. Same null-default, same * never-throw contract as the live emitter above. */ export interface TodoStatusChangeEvent extends WorkItemEvent { fromStatus: WorkItemStatus; toStatus: WorkItemStatus; item: WorkItem; } export type TodoStatusChangeListener = (event: TodoStatusChangeEvent) => void | Promise; /** A Todo's labels changed. The `todo-status` trigger's label filter reads the * Todo when its event DRAINS rather than when the Todo moved, so a label that * lands after the move has to re-open that drain — nothing else looks again. */ export type TodoLabelsChangeListener = (workItemId: string) => void | Promise; export declare function setTodoStatusChangeListener(listener: TodoStatusChangeListener | null): void; export declare function setTodoLabelsChangeListener(listener: TodoLabelsChangeListener | null): void; export declare function notifyTodoStatusChange(event: WorkItemEvent | undefined, item: WorkItem): void; export declare function notifyTodoLabelsChanged(workItemId: string): void; export {}; //# sourceMappingURL=live-events.d.ts.map