import type { ContextOperationRequest } from '../context.ts'; import type { OperationOutcome } from '../types.ts'; import type { EngineInternals } from './internals.ts'; import type { CapturedRejectionReason } from './strategy-helpers.ts'; export type OperationWithCallerStack = { callerStack?: string; }; export type OperationRouterCallbacks = { processActivityOperation: (workflowId: string, operation: Extract) => Promise; processSleepOperation: (workflowId: string, operation: Extract) => Promise; processWaitSignalOperation: (workflowId: string, operation: Extract) => Promise; processWaitUpdateOperation: (workflowId: string, operation: Extract) => Promise; processWaitConditionOperation: (workflowId: string, operation: Extract) => Promise; processGetVersionOperation: (workflowId: string, operation: Extract) => Promise; processParallelOperation: (workflowId: string, operation: Extract) => Promise; processRaceOperation: (workflowId: string, operation: Extract) => Promise; processMemoOperation: (workflowId: string, operation: Extract) => Promise; processChildWorkflowOperation: (workflowId: string, operation: Extract) => Promise; processOffloadOperation: (workflowId: string, operation: Extract) => Promise; processLoadOperation: (workflowId: string, operation: Extract) => Promise; processArchiveOperation: (workflowId: string, operation: Extract) => Promise; processStateReadOperation: (workflowId: string, operation: Extract) => Promise; processStateCommitOperation: (workflowId: string, operation: Extract) => Promise; processRunAllOperation: (workflowId: string, operation: Extract) => Promise; processSpeculateOperation: (workflowId: string, operation: Extract) => Promise; processStreamOperation: (workflowId: string, operation: Extract) => Promise; processWaitReviewOperation: (workflowId: string, operation: Extract) => Promise; finalizePendingTimelineEntry: (workflowId: string, status: 'completed' | 'failed', value: unknown) => void; feedOperationResult: (workflowId: string, result: OperationOutcome, originalReason?: CapturedRejectionReason) => void; }; /** * Translate an operation request from a strategy into a {@link ContextOperationRequest}. * * The inline strategy already produces `ContextOperationRequest` (with `type`). * The worker protocol produces `OperationRequest` (with `kind`). This function * normalizes both shapes so `processOperation` can switch on `type`. */ export declare function translateOperationRequest(_internals: EngineInternals, operationRequest: unknown): ContextOperationRequest; export declare function processOperation(internals: EngineInternals, workflowId: string, operation: ContextOperationRequest, callbacks: OperationRouterCallbacks): Promise; export declare function completeOperation(_internals: EngineInternals, workflowId: string, value: unknown, callbacks: Pick): void; export declare function failOperation(_internals: EngineInternals, workflowId: string, operation: OperationWithCallerStack, error: unknown, callbacks: Pick): void; export declare function runOperationWithResult(internals: EngineInternals, workflowId: string, operation: OperationWithCallerStack, execute: () => Promise, callbacks: OperationRouterCallbacks): Promise; export declare function runOperationWithoutResult(internals: EngineInternals, workflowId: string, operation: OperationWithCallerStack, execute: () => Promise, callbacks: OperationRouterCallbacks): Promise;