import type { ActionEntry } from "../agent/production-agent.js"; import { type CurrentTurnRunEvent } from "../agent/run-store.js"; import type { AgentChatEvent } from "../agent/types.js"; import type { LocaleCode } from "../localization/shared.js"; import type { Resource } from "../resources/store.js"; import { type JobFrontmatter } from "./frontmatter.js"; import { type AutomationRun } from "./run-history.js"; export interface AutomationResume { historyId: string; threadId: string; turnId: string; previousRunId: string; hardDeadlineAt: number; } export declare class AutomationRecoveryStorageError extends Error { readonly errorCode = "automation_recovery_storage_unavailable"; constructor(cause: unknown); } export declare class AutomationRecoveryProjectionDeferredError extends Error { readonly errorCode = "automation_recovery_projection_deferred"; constructor(runId: string); } export declare function withAutomationRecoveryStorage(operation: () => Promise): Promise; export declare function readAutomationRecoveryEvents(threadId: string, turnId: string): Promise; export declare function readAutomationRunDeliveryNote(runId: string): Promise; export type AutomationRecovery = { state: "active"; } | { state: "resume"; resume: AutomationResume; } | { state: "unrecoverable"; status: "error"; error: string; errorCode: string; deliveryNote: string; } | { state: "settle"; status: "success" | "error" | "skipped"; history: AutomationRun; error?: string; errorCode?: string; deliveryNote?: string; }; export declare function deliveryNoteForEvents(events: readonly AgentChatEvent[] | null, locale?: LocaleCode): string; export declare function automationDeliveryNote(message: string, events: readonly AgentChatEvent[]): string; export declare function inspectAutomationRecovery(resource: Resource, meta: JobFrontmatter, now: Date, appId?: string, getActions?: () => Record | Promise>): Promise;