/**
 * Workflow executor for MCP-side compilation and execution.
 * Copies source to a temp file, compiles all workflows in-place, then dynamically imports and executes.
 */
import type { FwMockConfig } from '../built-in-nodes/mock-types.js';
import type { AgentChannel } from './agent-channel.js';
/** A single trace event captured during workflow execution. */
export interface ExecutionTraceEvent {
    /** The event type (e.g. "NODE_STARTED", "NODE_COMPLETED"). */
    type: string;
    /** Unix timestamp in milliseconds when the event was recorded. */
    timestamp: number;
    /** Additional event data. */
    data?: Record<string, unknown>;
}
/** Per-node timing from a trace summary. */
export interface NodeTiming {
    /** The node instance ID. */
    nodeId: string;
    /** Duration from RUNNING to terminal status, in milliseconds. */
    durationMs: number;
}
/** Summary of workflow execution derived from trace events. */
export interface TraceSummary {
    /** Number of unique nodes that emitted STATUS_CHANGED events. */
    totalNodes: number;
    /** Nodes that reached SUCCEEDED status. */
    succeeded: number;
    /** Nodes that reached FAILED status. */
    failed: number;
    /** Nodes that reached CANCELLED status. */
    cancelled: number;
    /** Per-node timings (RUNNING → terminal status). */
    nodeTimings: NodeTiming[];
    /** Wall-clock duration from first to last trace event, in milliseconds. */
    totalDurationMs: number;
}
/** Result returned after executing a workflow from a file. */
export interface ExecuteWorkflowResult {
    /** The return value of the executed workflow function. */
    result: unknown;
    /** The name of the exported function that was executed. */
    functionName: string;
    /** Wall-clock execution time in milliseconds. */
    executionTime: number;
    /** Execution trace events, included when `includeTrace` is enabled. */
    trace?: ExecutionTraceEvent[];
    /** Summary of trace events, included when `includeTrace` is enabled. */
    summary?: TraceSummary;
}
/**
 * Compiles and executes a workflow from a TypeScript source file.
 * Copies the source to a temp file, compiles all workflows in-place (preserving sibling
 * functions for workflow composition), injects a trace-capturing debugger, and dynamically
 * imports and runs the target workflow function.
 * @param filePath - Path to the workflow `.ts` source file.
 * @param params - Parameters to pass to the workflow function.
 * @param options - Execution options.
 * @param options.workflowName - Name of a specific exported workflow function to execute.
 *   If omitted, the first exported function is used.
 * @param options.production - Enable production mode (no debug events). Defaults to `!includeTrace`.
 * @param options.includeTrace - Whether to capture and return execution trace events. Defaults to `true`.
 * @returns The workflow result, function name, execution time, and optional trace.
 * @throws If no exported workflow function is found in the compiled module.
 */
export declare function executeWorkflowFromFile(filePath: string, params?: Record<string, unknown>, options?: {
    workflowName?: string;
    production?: boolean;
    includeTrace?: boolean;
    mocks?: FwMockConfig;
    agentChannel?: AgentChannel;
    onEvent?: (event: ExecutionTraceEvent) => void;
}): Promise<ExecuteWorkflowResult>;
/** Compute a concise summary from raw trace events. */
export declare function computeTraceSummary(trace: ExecutionTraceEvent[]): TraceSummary;
//# sourceMappingURL=workflow-executor.d.ts.map