/** * @holoscript/core - Step Executor * * Executes individual choreography steps with retry logic. * Part of HoloScript v3.1 Agentic Choreography. */ import { EventEmitter } from 'events'; import type { AgentManifest } from '@holoscript/framework/agents'; import type { ChoreographyStep, StepContext, StepResult, RetryConfig } from './ChoreographyTypes'; /** * Agent action handler signature */ export type ActionHandler = (agent: AgentManifest, action: string, inputs: Record, context: StepContext) => Promise>; /** * Step executor configuration */ export interface StepExecutorConfig { /** Default timeout (ms) */ defaultTimeout: number; /** Default retry configuration */ defaultRetry: RetryConfig; /** Whether to emit verbose events */ verbose: boolean; } /** * Default executor configuration */ export declare const DEFAULT_EXECUTOR_CONFIG: StepExecutorConfig; /** * Step executor events */ export interface StepExecutorEvents { 'step:starting': (step: ChoreographyStep) => void; 'step:inputs:resolved': (step: ChoreographyStep, inputs: Record) => void; 'step:executing': (step: ChoreographyStep, agent: AgentManifest) => void; 'step:completed': (step: ChoreographyStep, result: StepResult) => void; 'step:failed': (step: ChoreographyStep, error: Error) => void; 'step:retrying': (step: ChoreographyStep, attempt: number, delay: number) => void; 'step:timeout': (step: ChoreographyStep, timeout: number) => void; 'step:skipped': (step: ChoreographyStep, reason: string) => void; } /** * Executes individual choreography steps */ export declare class StepExecutor extends EventEmitter { private config; private actionHandler; private runningSteps; constructor(config?: Partial); /** * Register the action handler for executing agent actions */ setActionHandler(handler: ActionHandler): void; /** * Execute a single step */ execute(step: ChoreographyStep, context: StepContext): Promise; /** * Cancel a running step */ cancel(stepId: string): boolean; /** * Check if any steps are running */ isRunning(stepId?: string): boolean; /** * Check if step should be skipped */ private shouldSkip; /** * Evaluate a string condition */ private evaluateCondition; /** * Parse a string value */ private parseValue; /** * Resolve input references */ private resolveInputs; /** * Execute with timeout */ private executeWithTimeout; /** * Calculate retry delay */ private calculateDelay; /** * Sleep helper */ private sleep; } /** * Get default executor */ export declare function getDefaultExecutor(): StepExecutor; /** * Reset default executor (for testing) */ export declare function resetDefaultExecutor(): void; //# sourceMappingURL=StepExecutor.d.ts.map