/** * RunContext -- d3-style chainable run configuration. * * Returned by chart.recorder() and chart.redact(). * Accumulates recorders and redaction policy, then creates * a FlowChartExecutor internally when .run() is called. * * The chart is immutable. RunContext is ephemeral per-run config. */ import type { FlowChart } from '../builder/types.js'; import type { FlowRecorder } from '../engine/narrative/types.js'; import type { RunOptions } from '../engine/types.js'; import type { CombinedRecorder } from '../recorder/CombinedRecorder.js'; import type { RedactionPolicy, ScopeRecorder } from '../scope/types.js'; /** Result from RunContext.run() — owns state and output. */ export interface RunResult { /** Raw scope state after execution. */ state: Record; /** Mapped output via contract mapper (if declared). */ output: unknown; /** Full execution tree for debugging. */ executionTree: unknown; /** Commit log for time-travel. */ commitLog: unknown[]; } export declare class RunContext { private readonly chart; private readonly recorders; private redactionPolicy?; constructor(chart: FlowChart); /** * Attach a recorder. Routed through the executor's combined-attach logic at * run time, so scope, flow, AND emit channels are all detected uniformly — a * recorder that implements only `onEmit` (or any mix) lands on the right * channel(s) exactly once. Chainable. */ recorder(r: ScopeRecorder | FlowRecorder | CombinedRecorder): RunContext; /** Set redaction policy for this run. Chainable. */ redact(policy: RedactionPolicy): RunContext; /** Execute the chart with accumulated config. Returns RunResult. */ run(options?: RunOptions): Promise; }