import type { HumanInputQuestion } from "@opengeni/sdk"; import type { HumanInputAnswerDraft } from "./human-input-model.js"; /** * Unsent answers to a structured human-input request, so navigating away from * a session (Settings, another session) and back keeps what was typed. * * Same browser-side shadow as the composer's pending-send record: a module * map for in-app navigation, mirrored best effort to tab-scoped * sessionStorage for reloads. Keyed by workspace, session and request; one * entry holds that request's per-question drafts. Secret questions are never * stored (their values live only in uncontrolled inputs). Entries are bounded * in count, size and age, and are forgotten on submit or skip, on expiry, and * once the authoritative pending list no longer contains the request. */ export type HumanInputDraftScope = { workspaceId: string; sessionId: string; requestId: string; }; /** Most unsent request drafts kept per tab; the oldest are dropped first. */ export declare const HUMAN_INPUT_DRAFT_MAX_ENTRIES = 20; /** Unsent drafts older than this are discarded. */ export declare const HUMAN_INPUT_DRAFT_MAX_AGE_MS: number; export declare function humanInputDraftKey(scope: HumanInputDraftScope): string; /** * The saved unsent answers for a request, or null. An expired request or a * stale entry is forgotten instead of restored. */ export declare function readHumanInputDraft(scope: HumanInputDraftScope, request: { questions: readonly HumanInputQuestion[]; expiresAt?: string | null | undefined; }, now?: number): Record | null; /** * Save the non-secret drafts for a request. An all-empty draft forgets the * entry, so clearing every field leaves nothing behind. */ export declare function writeHumanInputDraft(scope: HumanInputDraftScope, questions: readonly HumanInputQuestion[], drafts: Record, now?: number): void; /** Forget a request's draft (submitted, skipped, expired or resolved elsewhere). */ export declare function forgetHumanInputDraft(scope: HumanInputDraftScope): void; /** Forget every draft in a session the person can no longer see. */ export declare function forgetSessionHumanInputDrafts(workspaceId: string, sessionId: string): void; /** * Forget every unsent answer in this tab. Hosts call it when the signed-in * person changes (sign-out, account switch) so the next person never sees * another person's unsent text. */ export declare function forgetAllHumanInputDrafts(): void; /** * Record who is signed in to this tab. When a different person than the one * the drafts belong to signs in, every unsent answer is forgotten first; the * same person (a reload, a re-authentication, an interrupted account switch) * keeps them. The owner is persisted only while the tab holds drafts, so a tab * without unsent answers stores nothing. */ export declare function claimHumanInputDraftOwner(ownerId: string): void; /** * Forget every draft in a session whose request is no longer pending, given * an authoritative pending list. Drafts saved at or after `readStartedAt` * are kept: that read may predate the request they belong to. */ export declare function pruneHumanInputDrafts(workspaceId: string, sessionId: string, pendingRequestIds: Iterable, readStartedAt: number): void; /** Test seam: forget the in-memory map (simulates a reload). */ export declare function resetHumanInputDraftMemoryForTests(): void;