import type { Task, Message, TaskState, Artifact } from "./types.js"; export declare const MAX_A2A_IDEMPOTENCY_KEY_CHARS = 128; export declare const A2A_PERSONAL_OWNER_SCOPE = "__personal__"; export interface A2AApprovalRecord { id: string; taskId: string; ownerEmail: string; orgId: string | null; tool: string; input: unknown; approvalKey: string; callId: string; status: "pending" | "processing" | "completed" | "failed"; result: string | null; expiresAt: number; } export declare function createA2AApproval(input: { taskId: string; ownerEmail: string; orgId?: string | null; tool: string; toolInput: unknown; approvalKey: string; callId: string; ttlMs?: number; }): Promise; export declare function getA2AApprovalForOwner(id: string, ownerEmail: string, orgId?: string | null): Promise; export declare function claimA2AApproval(id: string, ownerEmail: string, orgId?: string | null): Promise; export declare function settleA2AApproval(id: string, status: "completed" | "failed", resultText: string): Promise; export declare function pauseProcessingA2ATask(id: string, message: Message): Promise; export declare function createTask(message: Message, contextId?: string, metadata?: Record, ownerEmail?: string | null, ownerScope?: string | null): Promise; export declare function createOrReuseTask(message: Message, contextId: string | undefined, metadata: Record | undefined, ownerEmail: string | null, ownerScope: string | null, idempotencyKey: string | undefined): Promise<{ task: Task; reused: boolean; }>; export interface A2ATaskOwnership { ownerEmail: string | null; ownerScope: string | null; } /** * Fetch the verified owner email recorded against a task at creation time. * Returns null when the task has no owner (legacy rows or unauthenticated * deployments) or when the task is missing. * * Used by `handleGet` / `handleCancel` to reject IDOR access — the JWT- * verified caller's email must match `owner_email` to read or cancel. */ export declare function getTaskOwner(id: string): Promise; export declare function getTaskOwnership(id: string): Promise; /** * Atomically claim a task for processing. Only succeeds when the task is in * state 'submitted' or 'working' — flipping it to 'processing' so concurrent * processors can't pick it up twice. Returns the task if claimed, null if it * was already claimed/completed/missing. * * Used by the cross-platform async processor (`_process-task` route) to avoid * duplicate handler runs when retries fire. */ export declare function claimA2ATaskForProcessing(id: string): Promise; export declare function getA2ATaskDispatchState(id: string): Promise<{ id: string; statusState: string; metadata: Record | undefined; updatedAt: number; createdAt: number; } | null>; export declare function touchQueuedA2ATaskDispatch(id: string): Promise; export declare function touchProcessingA2ATask(id: string): Promise; export declare function resetStuckA2ATaskForRetry(id: string, processingCutoff: number): Promise; /** * Fail a processing task once it is stuck. Two independent conditions can * trigger this, either of which alone is sufficient: * - `updated_at <= processingCutoff`: no heartbeat/progress touch in a * while — the processor likely died. * - `created_at <= createdAtCutoff` — a hard wall on total run time. A * hung await inside a still-alive process keeps `updated_at` fresh via * the liveness heartbeat forever, so staleness alone never trips; age * since creation is the only bound that catches it. */ export declare function failStuckA2ATask(id: string, processingCutoff: number, reason: string, createdAtCutoff?: number): Promise; /** * Fail a queued (submitted/working) task whose age since creation exceeds * `createdAtCutoff` — the dispatch-retry loop kept throttling/refiring * without ever reaching `processing`. Mirrors `failStuckA2ATask` but is * gated on the queued state set and on `created_at` (queued tasks have no * heartbeat, so staleness of `updated_at` isn't a meaningful signal here). */ export declare function failStuckQueuedA2ATask(id: string, createdAtCutoff: number, reason: string): Promise; export declare function getTask(id: string): Promise; export declare function updateTask(id: string, update: { state?: TaskState; message?: Message; artifacts?: Artifact[]; }): Promise; /** * Persist the terminal result produced by the async processor, but only while * that processor still owns a task in `processing`. A tasks/get request may * fail an over-lifetime processor while its handler is still running; the * handler cannot be canceled reliably, so this compare-and-set is what keeps * its eventual completion (or error) from overwriting the timeout result. */ export declare function settleProcessingA2ATask(id: string, update: { state: "completed" | "failed"; message?: Message; artifacts?: Artifact[]; }): Promise; export declare function updateTaskStatusMessage(id: string, message: Message): Promise; export declare function listTasks(contextId?: string): Promise; //# sourceMappingURL=task-store.d.ts.map