import { type Json, type Principal, type ThreadId } from "@vendoai/core"; import type { Db } from "../db-postgres.js"; import type { VendoStore } from "../store.js"; import type { ThreadRow } from "./types.js"; /** One answer to one `ask_user` question (design §4). `answer` is opaque to the * store — whatever the card collected. Any `subject` inside it is IGNORED: * ownership comes from the authenticated principal, never from the payload. */ export interface AskUserAnswer { threadId: ThreadId; /** The question this answers. Also the message id, which is what makes * recording idempotent — a double-submitted card cannot double-answer. */ questionId: string; answer: Json; } /** 02-store §3 — the surface, whichever backend serves it. */ export interface ThreadStore { put(principal: Principal, thread: { id: ThreadId; messages: Json[]; }): Promise; get(principal: Principal, id: ThreadId): Promise; list(principal: Principal): Promise>; delete(principal: Principal, id: ThreadId): Promise; /** Record an `ask_user` answer into the answerer's OWN thread. */ recordAnswer(principal: Principal, answer: AskUserAnswer): Promise; } /** 02-store §3 */ export declare function threadStore(store: VendoStore): ThreadStore; export type { ThreadRow } from "./types.js"; /** The ONE write path for a thread's harness continuity, shared by * `ops.harness.set` and the batched turn commit so the two cannot drift. * * `subject` is in the WHERE, not just the payload: the slot belongs to the * thread's OWNER, so a call naming someone else's thread matches no row and is * refused rather than silently landing on it. A missing row and a foreign row * are deliberately the same answer — neither is a conversation this caller may * bookmark, and telling them apart would confirm the thread exists. * * `updated_at` and `revision` are untouched on purpose: resuming a session is * not a message and not an edit, so it must not reshuffle a thread list or * lose a concurrent caller's compare-and-swap. */ export declare function setHarnessState(db: Db, threadId: string, subject: string, state: Json): Promise; //# sourceMappingURL=threads.d.ts.map