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
30 lines (29 loc) • 1.28 kB
TypeScript
import type { ArvoEventHandlerOpenTelemetryOptions } from '../types';
import type { IMachineExectionEngine } from './interface';
import type { ExecuteMachineInput, ExecuteMachineOutput } from './types';
/**
* Handles state machine execution, event processing, and lifecycle management.
*/
export declare class MachineExecutionEngine implements IMachineExectionEngine {
/**
* Executes a state machine and manages its lifecycle.
*
* @description
* Handles machine initialization/resumption, event processing, and state transitions.
* Manages event queues and volatile context during execution.
*
* @param params Configuration parameters:
* - machine: State machine definition
* - state: Optional existing state to resume from
* - event: Event triggering the execution
* @param opentelemetry Telemetry configuration for tracing
*
* @returns Object containing:
* - state: Final machine state
* - events: Generated events
* - finalOutput: Machine output or null
*
* @throws Error on invalid initialization events or execution failures
*/
execute({ machine, state, event }: ExecuteMachineInput, opentelemetry?: ArvoEventHandlerOpenTelemetryOptions): ExecuteMachineOutput;
}