import type { Storage as WeftStorage } from '../storage/interface.ts'; /** Build a cleanup reporter that preserves the workflow identifier for downstream error handling. */ export declare function createCleanupErrorReporter(onCleanupError: (source: string, error: unknown, workflowId: string) => void, workflowId: string): (source: string, error: unknown, _ignoredWorkflowId: string) => void; /** Create a finalizer callback that evicts only the stale handle entry that was actually finalized. */ export declare function createHandleCacheFinalizer(handleCache: Map, 'deref'>; }>): (workflowId: string) => void; /** Create the periodic update-response cleanup callback used by the engine interval. */ export declare function createExpiredResponseCleanupTick(updateCoordinator: { cleanupExpiredResponses(): Promise; }, onCleanupError: (source: string, error: unknown) => void): () => void; /** Delete partially written stream chunks and surface any cleanup failure through the callback. */ export declare function cleanupPartialStreamChunks(storage: WeftStorage, workflowId: string, key: string, writtenKeys: string[], onCleanupError: (source: string, error: unknown, workflowId: string) => void): Promise; /** * Settled outcome for a single `ctx.runAll` branch. Returned by * `executeRunAllBranchesSettled` so callers can record partial-failure * state in the parent operation's cache entry before propagating the * first rejection. */ export type RunAllBranchOutcome = { status: 'fulfilled'; name: string; value: unknown; } | { status: 'rejected'; name: string; reason: unknown; }; /** * Result of `executeRunAllBranchesSettled`. `firstError` carries the * original rejection reason captured by settlement timing (matching * native `Promise.all` behavior — whichever branch rejects first at * runtime, not whichever appears first in branch insertion order). * `hasFirstError` distinguishes "no rejection" from "rejected with * `undefined`" (a workflow that threw `undefined` explicitly). */ export type RunAllSettledResult = { outcomes: RunAllBranchOutcome[]; hasFirstError: boolean; firstError: unknown; }; export type RunAllBranch = readonly [fn: Function] | readonly [fn: Function, input: unknown]; /** * Execute every `ctx.runAll()` branch and return per-branch settled * outcomes plus the first rejection captured by settlement timing. * Never rejects: callers inspect the result and decide how to surface * failure. Used by the top-level run-all dispatch path so fulfilled * branches can be persisted before any rejection propagates. * * The first-rejection-by-settlement-timing contract is shared with * `dispatchBranchesAllSettled` via the `FirstRejectionCapture` helper * to keep both fan-out paths consistent. */ export declare function executeRunAllBranchesSettled(branches: Record, callActivity: (fn: Function, input: unknown) => unknown): Promise; /** Execute the `ctx.runAll()` branches and return a name-keyed result record. */ export declare function executeRunAllBranches(branches: Record, callActivity: (fn: Function, input: unknown) => unknown): Promise>;