/** * ComposableRunner — interface for runners that expose their internal flowChart. * * Any runner implementing this interface can be mounted as a subflow * in a parent flowChart via `addSubFlowChart(id, runner.toFlowChart())`. * This enables UI drill-down: the parent's snapshot contains the child's * full execution tree, addressable by subflow ID. * * Usage: * class MyAgent implements ComposableRunner { * toFlowChart() { return this.chart; } * async run(input) { ... } * } * * // Mount in parent * flowChart('Seed', seedFn, 'seed') * .addSubFlowChart('my-agent', agent.toFlowChart(), 'MyAgent') * .build(); */ import type { FlowChart } from '../builder/types.js'; import type { RunOptions } from '../engine/types.js'; /** * A runner that can expose its internal flowChart for subflow composition. * * @typeParam TIn — the input type accepted by `run()` * @typeParam TOut — the output type returned by `run()` */ export interface ComposableRunner { /** Expose the internal flowChart for subflow mounting (enables UI drill-down). */ toFlowChart(): FlowChart; /** Execute the runner. */ run(input: TIn, options?: RunOptions): Promise; }