import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";

//#region src/data-access/runtime/toolApprovalDecisions.d.ts
interface ToolApprovalScope {
  tenantId: string;
  projectId: string;
  conversationId: string;
}
/**
 * Persist an approval/denial so the instance running the suspended agent can
 * pick it up. Used when the approval request lands on a different instance than
 * the one holding the in-memory pending approval. Upserts so a retry/re-submit
 * overwrites rather than conflicts.
 */
declare const recordToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
  toolCallId: string;
  approved: boolean;
  reason?: string;
}) => Promise<void>;
/**
 * Atomically read-and-delete a pending decision for a tool call. Returns null
 * when none is present. The delete-on-read (DELETE ... RETURNING) guarantees a
 * single waiter consumes any given decision exactly once.
 */
declare const consumeToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
  toolCallId: string;
}) => Promise<{
  approved: boolean;
  reason: string | null;
} | null>;
/**
 * Delete decisions older than the timeout window. Batched to bound statement
 * size, mirroring cleanupExpiredStreamChunks.
 */
declare const cleanupExpiredToolApprovalDecisions: (db: AgentsRunDatabaseClient) => (olderThanMinutes?: number, batchSize?: number) => Promise<void>;
//#endregion
export { cleanupExpiredToolApprovalDecisions, consumeToolApprovalDecision, recordToolApprovalDecision };