import type { StoreEntry } from "../types.js"; /** SQLite URI form. node:sqlite DatabaseSync opens the path with `{ readOnly: true }` instead. */ export declare function sqliteRoUri(filePath: string): string; /** Host WINDOW_ENTRY_FILTER_SQL. */ export declare const WINDOW_ENTRY_FILTER_SQL = "json_extract(entry, '$.kind') != 'tool-call'\n AND COALESCE(json_extract(entry, '$.branched'), 0) != 1"; /** Host BRANCHED_ENTRY_FILTER_SQL. */ export declare const BRANCHED_ENTRY_FILTER_SQL = "COALESCE(json_extract(entry, '$.branched'), 0) = 1"; /** Host MAIN_TRANSCRIPT_MESSAGE_FILTER_SQL. */ export declare const MAIN_TRANSCRIPT_MESSAGE_FILTER_SQL = "\n COALESCE(json_extract(entry, '$.branched'), 0) != 1\n AND (\n json_extract(entry, '$.kind') IN ('send-message', 'user-attachment')\n OR (\n json_extract(entry, '$.kind') = 'message'\n AND (\n json_extract(entry, '$.role') = 'user'\n OR json_extract(entry, '$.fromAgent') IS NOT NULL\n OR json_extract(entry, '$.toAgent') IS NOT NULL\n )\n )\n )"; /** * Host store.db SCHEMA. Conversation blobs moved to conversation-blobs.db; * the blobs table stays declared so a pre-worker box remains readable. */ export declare const STORE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS kv (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n) STRICT;\nCREATE TABLE IF NOT EXISTS blobs (\n id TEXT PRIMARY KEY,\n data BLOB NOT NULL\n) STRICT;\nCREATE TABLE IF NOT EXISTS transcript_entries (\n seq INTEGER PRIMARY KEY,\n id TEXT NOT NULL UNIQUE,\n entry TEXT NOT NULL\n) STRICT;\nCREATE INDEX IF NOT EXISTS idx_transcript_window\n ON transcript_entries(seq, entry)\n WHERE json_extract(entry, '$.kind') != 'tool-call'\n AND COALESCE(json_extract(entry, '$.branched'), 0) != 1;\nCREATE INDEX IF NOT EXISTS idx_transcript_branched\n ON transcript_entries(seq, entry)\n WHERE COALESCE(json_extract(entry, '$.branched'), 0) = 1;\n"; /** Host CONVERSATION_BLOB_SCHEMA. */ export declare const CONVERSATION_BLOB_SCHEMA = "\nCREATE TABLE IF NOT EXISTS blobs (\n id TEXT PRIMARY KEY,\n data BLOB NOT NULL\n) STRICT;\n"; /** Host kv key names from agent-db. */ export declare const STORE_KV_KEYS: { readonly metadata: "metadata"; readonly sandProfile: "sandProfile"; readonly unreadState: "unreadState"; readonly awaitingUserResponse: "awaitingUserResponse"; readonly latestRequestId: "latestRequestId"; readonly requestIds: "requestIds"; readonly episodePending: "episodePending"; readonly memoryPromptSnapshot: "memoryPromptSnapshot"; readonly agentProfilePromptSnapshot: "agentProfilePromptSnapshot"; readonly origin: "origin"; readonly introductionPending: "introductionPending"; readonly automationSpendGuardState: "automationSpendGuardState"; readonly automationSpendGuardNudgedAt: "automationSpendGuardNudgedAt"; readonly conversationPartners: "conversationPartners"; readonly hiddenEntryRepairVersion: "hiddenEntryRepairVersion"; readonly staleRootCleanupVersion: "staleRootCleanupVersion"; readonly purpose: "purpose"; readonly legacyStoreBlobRetirementVersion: "legacyStoreBlobRetirementVersion"; }; export declare const STORE_ENTRY_KINDS: readonly ["send-message", "message", "user-attachment", "tool-call", "notice", "event", "feedback"]; export declare const SQLITE_DB_SIDECAR_SUFFIXES: readonly ["-wal", "-shm", "-journal"]; export declare class AgentStore { #private; readonly agentId: string; readonly storePath: string; readonly blobsPath: string; constructor(agentId: string, sandRoot?: string); getKv(key: string): string | null; listKvKeys(): string[]; getKvJson(key: string): T | null; listEntries(options?: { limit?: number; kinds?: string[]; }): StoreEntry[]; getEntry(id: string): StoreEntry | null; countEntries(): number; /** * conversation-blobs.db blobs(id, data), then legacy store.db blobs. * Do not dump. */ getBlob(id: string): Uint8Array | null; close(): void; } export declare function openAgentStore(agentId: string, sandRoot?: string): AgentStore; //# sourceMappingURL=store.d.ts.map