UNPKG

arvo-event-handler

Version:

A complete set of orthogonal event handler and orchestration primitives for Arvo based applications, featuring declarative state machines (XState), imperative resumables for agentic workflows, contract-based routing, OpenTelemetry observability, and in-me

39 lines (38 loc) 1.63 kB
/** * Enumeration of possible orchestration execution statuses. * * Determines whether an orchestration is executing normally or has encountered * a terminal failure requiring error event emission. */ export declare const OrchestrationExecutionStatus: { /** Orchestration is executing normally */ readonly NORMAL: "normal"; /** Orchestration has failed and entered terminal error state */ readonly FAILURE: "failure"; /** Orchestration is marked as done */ readonly DONE: "done"; }; /** * Discriminated union representing persisted orchestration state. * * The execution status discriminates between normal execution state (containing * full orchestration data) and failure state (containing minimal error context). * * **Normal state**: Contains complete orchestration data including machine state, * event history, and all custom fields from type parameter T. * * **Failure state**: Contains only essential error information (error object, subject) * with partial custom fields. Once in failure state, the orchestration ignores * subsequent events and does not execute further. * * @template T - Custom state fields specific to the orchestration type */ export type OrchestrationExecutionMemoryRecord<T extends Record<string, unknown>> = (T & { __type: 'OrchestrationExecutionMemoryRecord'; executionStatus: typeof OrchestrationExecutionStatus.NORMAL | typeof OrchestrationExecutionStatus.DONE; }) | (Partial<T> & { __type: 'OrchestrationExecutionMemoryRecord'; executionStatus: typeof OrchestrationExecutionStatus.FAILURE; error: Error; subject: string; });