/** * Durable resume-at anchor map (E18) — SINGLE-FILE DUAL-DIALECT ([ref] A12 收编). The service-owned * eventId→entryId translation: the shell holds the live E2 `eventId` (core never persists it); core's * `TaskSpec.resumeAt` takes a persisted `SessionTreeEntry.id`. Keyed (session_id, event_id) so `resolve` * is a PK point-lookup. `owner` is the single-DB-fleet null-safe defense-in-depth guard, the data-layer * twin of the route's session-owner gate. GC'd with the session (E21 delete). The historical * `TiDBResumeAnchorStore` / `PgResumeAnchorStore` class names survive as thin ctor subclasses so every * consumer (store-backend.ts, the resume-anchor integration suite) is untouched. * * ── Dialect deltas, kept EXPLICIT (no genuinely-divergent algorithm in this pair — every method is * SQL-text-only) ────────────────────────────────────────────────────────────────────────────────── * - `?` placeholders vs `$n` * - `ON DUPLICATE KEY UPDATE … VALUES(col)` vs `ON CONFLICT (session_id, event_id) DO UPDATE SET … * EXCLUDED.col` * - null-safe owner compare: `<=>` vs `IS NOT DISTINCT FROM` * - affectedRows vs rowCount (via SqlDriver) */ import type { Pool as MySqlPool } from "mysql2/promise"; import type { Pool as PgPool } from "pg"; import { type SqlDriver } from "./sql-driver.js"; /** Dual-dialect durable resume-at anchor map. See the file header for the dialect-delta ledger. */ export declare class SqlResumeAnchorStore { protected readonly db: SqlDriver; constructor(db: SqlDriver); /** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */ private q; /** Record/overwrite the anchor for one settled message boundary (idempotent upsert on the (session_id,event_id) PK). */ put(sessionId: string, eventId: string, entryId: string, owner: string | null): Promise; /** Resolve a shell-supplied eventId → the persisted SessionTreeEntry.id; undefined = unknown anchor. */ resolve(sessionId: string, eventId: string, owner: string | null): Promise; /** 2c session-sync: ALL anchors for a session (every eventId→entryId + its owner), UNFILTERED — a cross-backend * session EXPORT bundles the whole anchor map so the importer can RE-KEY owner to the target principal (§9). The * route already proved session ownership (the export gate), so no per-row owner filter here. owner carried verbatim. */ listBySession(sessionId: string): Promise>; /** E21 — purge ALL anchors for a session, scoped by session_id ALONE (the route proved ownership; a per-row owner * guard would orphan rows whose per-run principal diverged from the session owner). Idempotent (affected count). */ deleteBySession(sessionId: string): Promise; } /** MySQL-protocol (TiDB) binding — historical class name + ctor shape preserved. */ export declare class TiDBResumeAnchorStore extends SqlResumeAnchorStore { constructor(pool: MySqlPool); } /** PostgreSQL binding — historical class name + ctor shape preserved. */ export declare class PgResumeAnchorStore extends SqlResumeAnchorStore { constructor(pool: PgPool); } //# sourceMappingURL=resume-anchor-store-sql.d.ts.map