import type { Database as DatabaseType } from "better-sqlite3"; /** ICI-733: how a Todo is RUN, as opposed to what it says. Which skills its * working session preloads, and which engine/model the NEXT attempt uses — * the recovery lever that moves a rate-limited Todo to another engine without * re-describing the work. * * Additive, never columns on `work_items`: the exact-shape verifier refuses any * drift in an existing table, so a new table is the only extension a deployed * database can survive. * * `skills` is a JSON array of skill names read through a fail-closed parser, * like `work_item_approval_choices.options`. A row exists only once something * has been set, so absence means "no dispatch preferences" and needs no * sentinel value. */ export declare const WORK_ITEM_DISPATCH_TABLE_DDL = "\nCREATE TABLE IF NOT EXISTS work_item_dispatch (\n work_item_id TEXT PRIMARY KEY REFERENCES work_items(id),\n skills TEXT,\n engine TEXT,\n model TEXT,\n updated_at TEXT NOT NULL\n)"; export declare const WORK_ITEM_DISPATCH_DDL = "\n\nCREATE TABLE IF NOT EXISTS work_item_dispatch (\n work_item_id TEXT PRIMARY KEY REFERENCES work_items(id),\n skills TEXT,\n engine TEXT,\n model TEXT,\n updated_at TEXT NOT NULL\n);\n"; /** ICI-733: one row per caller-supplied create key, so a cron or connector that * retries a create gets the Todo it already made instead of a duplicate. * `(source, source_ref)` already dedupes machine mints, but it is server-minted * and the trigger paths do not set it usefully — hence an explicit key. * * `fingerprint` is what makes a replay honest: the same key carrying a * materially different create is a caller bug, and answering it with the first * Todo would silently drop the second. Mirrors `work_item_edit_receipts`. */ export declare const WORK_ITEM_CREATE_RECEIPTS_TABLE_DDL = "\nCREATE TABLE IF NOT EXISTS work_item_create_receipts (\n key_digest TEXT PRIMARY KEY CHECK (length(key_digest) = 64),\n work_item_id TEXT NOT NULL REFERENCES work_items(id),\n fingerprint TEXT NOT NULL,\n created_at TEXT NOT NULL\n)"; export declare const WORK_ITEM_CREATE_RECEIPTS_DDL = "\n\nCREATE TABLE IF NOT EXISTS work_item_create_receipts (\n key_digest TEXT PRIMARY KEY CHECK (length(key_digest) = 64),\n work_item_id TEXT NOT NULL REFERENCES work_items(id),\n fingerprint TEXT NOT NULL,\n created_at TEXT NOT NULL\n);\n"; /** * Data-level re-proof of the dispatch rows at boot (the DDL pins the shape, this * pins the rows): every row belongs to a live Todo, a stored skills list still * parses as an array of non-empty strings, and an engine/model that is present * is not a blank string. Returns false rather than throwing so the caller keeps * the single curated refusal message. */ export declare function workItemDispatchRowsAreSound(db: DatabaseType, hasWorkItem: (id: string) => boolean): boolean; /** * Data-level re-proof of the create receipts: every receipt points at a Todo * that still exists, so a replay can never resolve to nothing. */ export declare function workItemCreateReceiptRowsAreSound(db: DatabaseType, hasWorkItem: (id: string) => boolean): boolean; /** The stored skills list, or null when the blob is unreadable — one parser for * the boot verifier and the read path, so neither can accept what the other * rejects. */ export declare function parseSkillsJson(raw: string): string[] | null; //# sourceMappingURL=dispatch-schema.d.ts.map