import type { Pool as MysqlPool } from "mysql2/promise"; import type { Pool as PgPool } from "pg"; export interface ApprovalExemptionRow { toolName: string; grantedBy: string | null; createdAt: number; } export interface ApprovalExemptionStore { /** Record the exemption (idempotent upsert; a re-grant refreshes grantedBy, createdAt keeps the FIRST grant). */ grant(sessionId: string, toolName: string, grantedBy: string | null): Promise; /** The ask-gate probe. Callers MUST fail-closed on a rejected promise (ask anyway). */ has(sessionId: string, toolName: string): Promise; /** All exemptions for a session (the GET /v1/approvals UI surface). */ list(sessionId: string): Promise; /** Revoke one exemption; false = nothing to revoke (idempotent). */ revoke(sessionId: string, toolName: string): Promise; /** E21 — purge ALL exemptions for a session (session delete wiring). Idempotent (affected count). */ deleteBySession(sessionId: string): Promise; } export declare class TiDBApprovalExemptionStore implements ApprovalExemptionStore { private readonly pool; constructor(pool: MysqlPool); grant(sessionId: string, toolName: string, grantedBy: string | null): Promise; has(sessionId: string, toolName: string): Promise; list(sessionId: string): Promise; revoke(sessionId: string, toolName: string): Promise; deleteBySession(sessionId: string): Promise; } export declare class PgApprovalExemptionStore implements ApprovalExemptionStore { private readonly pool; constructor(pool: PgPool); grant(sessionId: string, toolName: string, grantedBy: string | null): Promise; has(sessionId: string, toolName: string): Promise; list(sessionId: string): Promise; revoke(sessionId: string, toolName: string): Promise; deleteBySession(sessionId: string): Promise; } export declare class MemoryApprovalExemptionStore implements ApprovalExemptionStore { private readonly bySession; grant(sessionId: string, toolName: string, grantedBy: string | null): Promise; has(sessionId: string, toolName: string): Promise; list(sessionId: string): Promise; revoke(sessionId: string, toolName: string): Promise; deleteBySession(sessionId: string): Promise; } export declare class FileApprovalExemptionStore implements ApprovalExemptionStore { private readonly dir; private readonly bySession; private readonly logs; constructor(root: string); private pathFor; /** Replay every session log (torn-tail-safe; last-wins with revoke tombstones). Index keyed by the SANITIZED id. */ private hydrate; private logFor; grant(sessionId: string, toolName: string, grantedBy: string | null): Promise; has(sessionId: string, toolName: string): Promise; list(sessionId: string): Promise; revoke(sessionId: string, toolName: string): Promise; deleteBySession(sessionId: string): Promise; /** Release every open append-log fd (LocalBackend.close → graceful-restart re-open). */ dispose(): void; } //# sourceMappingURL=approval-exemption-store.d.ts.map