/** * Agent Spec Execution Service * * Connects FlowDrop to Agent Spec runtimes (WayFlow/PyAgentSpec) for * workflow execution, status tracking, and result retrieval. * * Follows the same singleton pattern as NodeExecutionService. */ import type { NodeExecutionInfo } from '../types/index.js'; import type { StandardWorkflow } from '../adapters/WorkflowAdapter.js'; import type { AgentSpecEndpointConfig } from '../config/agentSpecEndpoints.js'; /** Result returned when starting an execution */ export interface AgentSpecExecutionHandle { /** Unique execution ID from the runtime */ executionId: string; /** Stop polling and clean up */ stop: () => void; } /** * Service for executing FlowDrop workflows on Agent Spec runtimes. * * @example * ```typescript * const service = AgentSpecExecutionService.getInstance(); * service.configure(myRuntimeConfig); * * // Check runtime availability * const healthy = await service.checkHealth(); * * // Execute a workflow * const handle = await service.executeWorkflow(workflow, inputs, { * onNodeUpdate: (nodeId, info) => updateNodeVisual(nodeId, info), * onComplete: (results) => showResults(results), * onError: (error) => showError(error) * }); * * // Cancel if needed * await service.cancelExecution(handle.executionId); * ``` */ export declare class AgentSpecExecutionService { private static instance; private config; private adapter; private activeExecutions; private constructor(); static getInstance(): AgentSpecExecutionService; /** * Configure the runtime connection. */ configure(config: AgentSpecEndpointConfig): void; /** * Check if the service has been configured with a runtime. */ isConfigured(): boolean; /** * Check runtime health. */ checkHealth(): Promise; /** * Execute a FlowDrop workflow on the Agent Spec runtime. * * 1. Converts StandardWorkflow → AgentSpecFlow using the adapter * 2. POSTs the flow JSON to the runtime * 3. Starts polling for execution status * 4. Maps runtime node statuses to FlowDrop's NodeExecutionInfo */ executeWorkflow(workflow: StandardWorkflow, inputs?: Record, callbacks?: { onNodeUpdate?: (nodeId: string, info: NodeExecutionInfo) => void; onComplete?: (results: Record) => void; onError?: (error: Error) => void; }, pollingIntervalMs?: number): Promise; /** * Get current execution status. */ getExecutionStatus(executionId: string): Promise | null>; /** * Cancel a running execution. */ cancelExecution(executionId: string): Promise; /** * Get execution results. */ getResults(executionId: string): Promise | null>; /** * Validate a workflow against the runtime. */ validateOnRuntime(workflow: StandardWorkflow): Promise<{ valid: boolean; errors?: string[]; }>; /** * Clean up all active executions. */ destroy(): void; private ensureConfigured; /** Get the config, throwing if not configured */ private getConfig; private startPolling; private stopPolling; private mapRuntimeStatusToNodeInfo; private mapSingleNodeStatus; private mapToFlowDropStatus; } /** Singleton instance */ export declare const agentSpecExecutionService: AgentSpecExecutionService;