import type { ConnectorCapability, JsonValue } from '../browser/project-change.js'; import type { PreparedFlow } from './project-semantics.js'; export type SchedulerEvent = { readonly flowId: string; readonly parentJobId?: string; readonly parentRunId?: string; readonly runId: string; readonly type: 'run.started'; } | { readonly parentJobId?: string; readonly parentRunId?: string; readonly progress: number; readonly runId: string; readonly type: 'run.progress'; } | { readonly inputs: Readonly>; readonly jobId: string; readonly nodeId: string; readonly nodeKind: 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value'; readonly nodeTitle?: string; readonly runId: string; readonly type: 'node.started'; } | { readonly handle: string; readonly jobId: string; readonly nodeId: string; readonly runId: string; readonly type: 'node.output'; readonly value: JsonValue; } | { readonly jobId: string; readonly nodeId: string; readonly runId: string; readonly type: 'node.completed'; } | { readonly code: string; readonly jobId: string; readonly message: string; readonly nodeId: string; readonly runId: string; readonly type: 'node.failed'; } | { readonly result: FlowRunResult | SubflowRunResult; readonly runId: string; readonly type: 'run.completed'; } | { readonly message: string; readonly runId: string; readonly type: 'run.failed'; }; export interface FlowRunResult { readonly kind: 'node-results'; readonly nodes: readonly { readonly jobs: readonly { readonly jobId: string; readonly outputs: Readonly>; }[]; readonly nodeId: string; }[]; } export interface SubflowRunResult { readonly kind: 'function-outputs'; readonly outputs: Readonly>; readonly target: 'subflow'; } interface TaskInvocationBase { readonly input: Readonly>; readonly invocationId: string; readonly jobId: string; readonly nodeId: string; readonly runId: string; readonly signal: AbortSignal; } export type TaskInvocation = TaskInvocationBase & ({ readonly capabilities: readonly ConnectorCapability[]; readonly moduleId: string; } | { readonly taskId: string; }); export interface TriggerSeed { readonly nodeId: string; readonly payload: JsonValue; } export interface SchedulerFailure { readonly code: string; readonly message: string; } export interface FlowRunOptions { readonly createId: () => string; readonly emit?: (event: SchedulerEvent) => void | Promise; readonly inputs?: Readonly>>>; readonly invokeTask: (invocation: TaskInvocation) => Promise; readonly projectFailure?: (error: unknown) => SchedulerFailure; readonly runId: string; readonly signal?: AbortSignal; readonly trigger?: TriggerSeed; } export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Promise; export {};