import type { CallbackAttemptOutcome } from "./callback-transport.js"; /** Additive fields keep existing v1 backend records readable. Management and observation are separate. */ export interface BackendRecoveryFields { closed_at?: string; close_reason?: string; unwatched_at?: string; renewed_at?: string; renewal_count?: number; recovered_at?: string; } export interface BackendRetryFields { /** Highest cumulative attempt explicitly authorized by a manual retry. */ retry_budget_until?: number; retry_requested_at?: string; } export interface BackendRecoveryNotification extends BackendRetryFields { id: string; status: string; attempts: number; retry_at?: string; outcome?: CallbackAttemptOutcome; } export interface BackendRecoveryTask extends BackendRecoveryFields { id: string; kind: "send" | "watch"; status: string; controller_session: string; deadline_at: string; notifications: BackendRecoveryNotification[]; } export declare class BackendRecoveryError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function assertBackendRecoveryOwner(task: BackendRecoveryTask, input: { controllerSession: string; }): void; export declare function backendObservationStopped(task: BackendRecoveryFields & { status: string; }): boolean; export declare function assertBackendRecoveryFields(task: BackendRecoveryTask): void; export declare function assertBackendRecoveryUpdate(previous: BackendRecoveryTask, next: BackendRecoveryTask): void; export declare function backendRenewalDeadline(task: BackendRecoveryTask, now: Date, timeoutMs?: number): string; export declare function suppressBackendNotifications(task: BackendRecoveryTask, code: string): void; export declare function closeBackendManagement(task: BackendRecoveryTask, input: { controllerSession: string; reason?: string; }, now: Date): void; export declare function stopBackendObservation(task: BackendRecoveryTask, now: Date): void; export declare function isBackendCallbackRetryable(task: BackendRecoveryTask, note: BackendRecoveryNotification): boolean; export declare function prepareBackendCallbackRetry(task: BackendRecoveryTask, input: { controllerSession: string; notificationId?: string; }, now: Date): string; export declare function backendCallbackMaxAttempts(note: BackendRetryFields, defaultMax: number): number; export declare function backendTaskRecoveryProjection(task: BackendRecoveryTask): { task_kind: "send" | "watch"; turn_id?: string | undefined; management_state: string; observation_state: string; deadline_at: string; renewal_count: number; closed_at: string | undefined; close_reason: string | undefined; unwatched_at: string | undefined; renewed_at: string | undefined; recovered_at: string | undefined; callback_in_flight: boolean; retryable_callback_ids: string[]; recovery_actions: { recover?: { tool: string; input: { watch_id: string; }; } | undefined; renew?: { tool: string; input: { watch_id: string; }; } | undefined; unwatch?: { tool: string; input: { watch_id: string; }; } | undefined; close?: { tool: string; input: { turn_id: string; }; } | undefined; retry_callback?: { tool: string; input: { watch_id: string; notification_id: string; }; } | undefined; }; };