import type { ClaimedPushQueueItem, MemoryHistoryAppendRow, MemoryHistoryRow, MemoryHistoryStore, MemorySyncStore, PushQueueItem } from "./memory-sync-store-pg.js"; import type { MemorySyncCursor } from "@sema-agent/core"; import type { Pool } from "mysql2/promise"; /** Table names (single source) — SAME names as PG_MEMORY_SYNC_TABLES (the two dialects never share * one database). */ export declare const TIDB_MEMORY_SYNC_TABLES: { readonly syncCursor: "agent_memory_engine_sync_cursor"; readonly pushQueue: "agent_memory_engine_push_queue"; readonly history: "agent_memory_engine_history"; }; /** Idempotent DDL for the sync plane (TiDB dialect). Call once at startup. * Key budget: utf8mb4 = 4 bytes/char, index cap 3072 bytes ⇒ PK(scope,peer) = 380 chars = 1520 B ✓. */ export declare function ensureTiDBMemorySyncSchema(pool: Pool): Promise; /** Options for {@link TiDBMemorySyncStore} — signature parity with the PG twin. */ export interface TiDBMemorySyncStoreOptions { /** How long a `claimDue` claim holds a row invisible before a crashed worker's claim self-heals. * Must exceed the consumer's worst-case push round-trip. Default 60s. */ claimLeaseMs?: number; } export declare class TiDBMemorySyncStore implements MemorySyncStore { private readonly pool; private readonly claimLeaseMs; constructor(pool: Pool, opts?: TiDBMemorySyncStoreOptions); getCursor(scope: string, peer: string): Promise; putCursor(cursor: MemorySyncCursor): Promise; enqueue(item: PushQueueItem): Promise; claimDue(nowMs: number, limit: number): Promise; complete(id: string): Promise; fail(id: string, error: string, nextAttemptAtMs: number): Promise; } /** Idempotent DDL for the history table (TiDB dialect). Key budget: PK(id,rev) = CHAR(36)+ * VARCHAR(128) = 164 chars ≤ 3072-byte utf8mb4 index cap ✓; KEY(scope) = 190 chars ✓. */ export declare function ensureTiDBMemoryHistorySchema(pool: Pool): Promise; export declare class TiDBMemoryHistoryStore implements MemoryHistoryStore { private readonly pool; constructor(pool: Pool); appendHistory(rows: readonly MemoryHistoryAppendRow[]): Promise; historyOf(id: string): Promise; countByScope(scope: string): Promise; } //# sourceMappingURL=memory-sync-store-tidb.d.ts.map