export type OracleJobStatus = "queued" | "preparing" | "submitted" | "waiting" | "complete" | "failed" | "cancelled"; export type OracleJobPhase = | "queued" | "submitted" | "cloning_runtime" | "launching_browser" | "verifying_auth" | "configuring_model" | "uploading_archive" | "awaiting_response" | "extracting_response" | "downloading_artifacts" | "complete" | "complete_with_artifact_errors" | "failed" | "cancelled"; export interface OracleJobLifecycleEvent { at: string; source: string; kind: "created" | "phase" | "cleanup" | "notification" | "wakeup"; status: OracleJobStatus; phase: OracleJobPhase; message: string; } export interface OracleLifecycleTrackedJobLike { status: OracleJobStatus; phase: OracleJobPhase; phaseAt: string; createdAt: string; queuedAt?: string; submittedAt?: string; completedAt?: string; heartbeatAt?: string; cancelRequestedAt?: string; cancelReason?: string; lifecycleEvents?: OracleJobLifecycleEvent[]; cleanupPending?: boolean; cleanupWarnings?: string[]; lastCleanupAt?: string; notifyClaimedAt?: string; notifyClaimedBy?: string; notifiedAt?: string; notificationEntryId?: string; notificationSessionKey?: string; notificationSessionFile?: string; wakeupAttemptCount?: number; wakeupLastRequestedAt?: string; wakeupSettledAt?: string; wakeupSettledSource?: string; wakeupSettledSessionFile?: string; wakeupSettledSessionKey?: string; wakeupSettledBeforeFirstAttempt?: boolean; wakeupObservedAt?: string; wakeupObservedSource?: string; wakeupObservedSessionFile?: string; wakeupObservedSessionKey?: string; error?: string; artifactFailureCount?: number; responsePath?: string; responseFormat?: "text/plain"; } export interface OraclePhaseTransitionOptions { at?: string; source?: string; message?: string; patch?: Partial; clearNotificationClaim?: boolean; } export interface OracleWakeupSettlementOptions { source: string; at?: string; sessionFile?: string; sessionKey?: string; allowBeforeFirstAttempt?: boolean; } export interface OracleNotificationTargetOptions { at?: string; source?: string; notificationSessionKey: string; notificationSessionFile?: string; } export interface OracleMarkNotifiedOptions { at?: string; source?: string; notificationEntryId?: string; notificationSessionKey?: string; notificationSessionFile?: string; } export const ACTIVE_ORACLE_JOB_STATUSES: readonly OracleJobStatus[]; export const OPEN_ORACLE_JOB_STATUSES: readonly OracleJobStatus[]; export const TERMINAL_ORACLE_JOB_STATUSES: readonly OracleJobStatus[]; export const MAX_ORACLE_JOB_LIFECYCLE_EVENTS: number; export declare function getOracleJobStatusForPhase(phase: OracleJobPhase): OracleJobStatus; export declare function assertValidOracleJobState(job: TJob): TJob; export declare function appendOracleJobLifecycleEvent( job: TJob, event: Omit & { status?: OracleJobStatus; phase?: OracleJobPhase }, ): TJob; export declare function getLatestOracleJobLifecycleEvent(job: Pick): OracleJobLifecycleEvent | undefined; export declare function getLatestOracleTerminalLifecycleEvent(job: Pick): OracleJobLifecycleEvent | undefined; export declare function markOracleJobCreated(job: TJob, options?: { at?: string; source?: string; message?: string }): TJob; export declare function transitionOracleJobPhase( job: TJob, phase: OracleJobPhase, options?: OraclePhaseTransitionOptions, ): TJob; export declare function applyOracleJobCleanupWarnings( job: TJob, warnings: string[], options?: { at?: string; source?: string; message?: string }, ): TJob; export declare function clearOracleJobCleanupState( job: TJob, options?: { at?: string; source?: string; message?: string }, ): TJob; export declare function claimOracleJobNotification(job: TJob, claimedBy: string, at?: string): TJob; export declare function recordOracleJobNotificationTarget(job: TJob, options: OracleNotificationTargetOptions): TJob; export declare function markOracleJobNotified(job: TJob, options?: OracleMarkNotifiedOptions): TJob; export declare function releaseOracleJobNotificationClaim(job: TJob): TJob; export declare function noteOracleJobWakeupRequested(job: TJob, options?: { at?: string; source?: string }): TJob; export declare function markOracleJobWakeupSettled( job: TJob, options: OracleWakeupSettlementOptions, ): TJob;