import type { Clock, KernelPaths, JournalRecord } from "./types.js"; export interface WakeDelivery { readonly event_id: string; readonly claim_operation_id: string; readonly downstream_operation_id: string; readonly claimed: boolean; readonly effect_present: boolean; readonly consumed: boolean; readonly replayed: boolean; } export interface PendingWake { readonly event_id: string; readonly claim_operation_id: string; readonly downstream_operation_id: string; readonly claim_sequence: number; } export declare const WAKE_ACK_RETRY_MS = 30000; export interface WakeSendReceipt { readonly event_id: string; readonly claim_operation_id: string; readonly downstream_operation_id: string; readonly conductor_session_id: string; readonly conductor_generation: number; readonly delivery_attempt: number; readonly recorded_at: string; readonly sequence: number; } export declare function claimWake(paths: KernelPaths, clock: Clock, runId: string, eventId: string, downstreamOperationId: string): WakeDelivery; /** Caller already holds the kernel lock. */ export declare function claimWakeUnlocked(paths: KernelPaths, clock: Clock, runId: string, eventId: string, downstreamOperationId: string): WakeDelivery; /** * Apply the wake's downstream semantic command if not yet durable, then consume. * * `applySemantic` must journal an idempotent effect under `downstreamOperationId` * (e.g. appendJournal with that operation_id). It is invoked only when that record * is absent. Consume is written only after the effect exists. * * Crash between effect and consume: retry finds the effect, skips apply, journals consume. */ export declare function processWakeSemantic(paths: KernelPaths, clock: Clock, input: { readonly runId: string; readonly eventId: string; readonly downstreamOperationId: string; /** * Idempotent semantic apply. Must create/find the journal record for * downstreamOperationId. Must not perform non-journaled external side effects * that cannot be skipped on retry. */ readonly applySemantic: (downstreamOperationId: string) => void; }): WakeDelivery; /** * Consume a wake only after the downstream durable effect exists. * Does not invoke callbacks — use processWakeSemantic to apply+consume. */ export declare function consumeWake(paths: KernelPaths, clock: Clock, runId: string, eventId: string, downstreamOperationId: string): WakeDelivery; /** Caller already holds the kernel lock. */ export declare function consumeWakeUnlocked(paths: KernelPaths, clock: Clock, runId: string, eventId: string, downstreamOperationId: string): WakeDelivery; export declare function listWakeClaims(paths: KernelPaths, runId: string): JournalRecord[]; /** Oldest durable claim without a matching exact consume record. */ export declare function peekOldestPendingWake(paths: KernelPaths, runId: string): PendingWake | null; /** Count durable exact claims without matching consume records. */ export declare function countPendingWakes(paths: KernelPaths, runId: string): number; export declare function latestWakeSend(paths: KernelPaths, runId: string, eventId: string): WakeSendReceipt | null; /** Caller holds the kernel lock and has already performed the physical send. */ export declare function recordWakeSentUnlocked(input: { readonly paths: KernelPaths; readonly clock: Clock; readonly runId: string; readonly eventId: string; readonly conductorSessionId: string; readonly conductorGeneration: number; }): WakeSendReceipt;