footprint-explainable-ui 0.6.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _xyflow_react from '@xyflow/react';
3
- import { Node, Edge } from '@xyflow/react';
3
+ import { Node, Edge, NodeTypes } from '@xyflow/react';
4
4
  import * as react from 'react';
5
5
 
6
6
  /** Snapshot of a single pipeline stage — the core data shape for all components. */
@@ -62,16 +62,21 @@ declare function FlowchartView({ nodes: rawNodes, edges: rawEdges, snapshots, se
62
62
  * Converts a SerializedPipelineStructure (from builder.toSpec()) into
63
63
  * ReactFlow nodes and edges with auto-layout.
64
64
  *
65
- * Supports two modes:
66
- * 1. Build-time only (no executionState) — all nodes gray
67
- * 2. With execution overlay — executed nodes colored, active node highlighted,
68
- * unvisited nodes stay gray
65
+ * Two-phase approach for performance:
66
+ * 1. `specToLayout(spec)`tree walk + positioning (expensive, cached on spec)
67
+ * 2. `applyOverlay(layout, overlay)`color nodes/edges (cheap, runs per slider tick)
68
+ *
69
+ * `specToReactFlow(spec, overlay)` combines both for convenience.
69
70
  */
70
71
 
71
72
  interface SpecNode {
72
73
  name: string;
73
74
  id?: string;
74
75
  type?: "stage" | "decider" | "fork" | "streaming";
76
+ /** Semantic icon hint — rendered by StageNode. Common values:
77
+ * "llm", "tool", "rag", "search", "parse", "start", "end", "loop",
78
+ * "agent", "swarm", "guard", "stream", "memory" */
79
+ icon?: string;
75
80
  description?: string;
76
81
  children?: SpecNode[];
77
82
  next?: SpecNode;
@@ -83,6 +88,8 @@ interface SpecNode {
83
88
  subflowId?: string;
84
89
  subflowName?: string;
85
90
  subflowStructure?: SpecNode;
91
+ /** True when this subflow uses lazy resolution (deferred until execution). */
92
+ isLazy?: boolean;
86
93
  }
87
94
  interface ExecutionOverlay {
88
95
  /** Names of stages that have completed (before the active one) */
@@ -105,6 +112,48 @@ interface FlowchartColors {
105
112
  labelLoop: string;
106
113
  pathGlow: string;
107
114
  }
115
+ /** A positioned node with all static info, before overlay is applied. */
116
+ interface LayoutNode {
117
+ id: string;
118
+ x: number;
119
+ y: number;
120
+ label: string;
121
+ isDecider: boolean;
122
+ isFork: boolean;
123
+ description?: string;
124
+ icon?: string;
125
+ subflowId?: string;
126
+ isSubflow: boolean;
127
+ isLazy?: boolean;
128
+ }
129
+ /** A positioned edge with source/target info. */
130
+ interface LayoutEdge {
131
+ id: string;
132
+ source: string;
133
+ target: string;
134
+ label?: string;
135
+ isLoop: boolean;
136
+ }
137
+ /** Static layout output — positions + structure, no execution state. */
138
+ interface SpecLayout {
139
+ nodes: LayoutNode[];
140
+ edges: LayoutEdge[];
141
+ /** Maps stage ID → node id for resolving loopTarget references. */
142
+ idToName: Map<string, string>;
143
+ }
144
+ /**
145
+ * Phase 1: Compute static layout from spec. Cached on spec reference — only
146
+ * recomputes when the pipeline structure changes, not on every slider tick.
147
+ */
148
+ declare function specToLayout(spec: SpecNode): SpecLayout;
149
+ /**
150
+ * Phase 2: Apply execution overlay to static layout.
151
+ * Produces ReactFlow nodes/edges with correct colors, step numbers, and glow.
152
+ */
153
+ declare function applyOverlay(layout: SpecLayout, overlay?: ExecutionOverlay, colors?: Partial<FlowchartColors>): {
154
+ nodes: Node[];
155
+ edges: Edge[];
156
+ };
108
157
  /**
109
158
  * Convert a pipeline spec to ReactFlow graph.
110
159
  * Pass `overlay` to color nodes/edges by execution state.
@@ -115,7 +164,7 @@ declare function specToReactFlow(spec: SpecNode, overlay?: ExecutionOverlay, col
115
164
  };
116
165
 
117
166
  interface TracedFlowchartViewProps extends BaseComponentProps {
118
- /** Pipeline spec from builder.toSpec() */
167
+ /** Pipeline spec from builder.toSpec() — for the current level */
119
168
  spec: SpecNode;
120
169
  /** Visualization snapshots (enables trace overlay when provided) */
121
170
  snapshots?: StageSnapshot[];
@@ -123,14 +172,10 @@ interface TracedFlowchartViewProps extends BaseComponentProps {
123
172
  snapshotIndex?: number;
124
173
  /** Callback when a node is clicked (receives snapshot index, or node id if no snapshots) */
125
174
  onNodeClick?: (indexOrId: number | string) => void;
126
- /** Callback when subflow navigation changes (true = entered subflow) */
127
- onSubflowChange?: (isInSubflow: boolean, subflowNodeName: string | null) => void;
128
- /** Show subflow directory sidebar when subflows exist (default: true) */
129
- showTree?: boolean;
130
- /** Width of the tree sidebar in pixels (default: 200) */
131
- treeWidth?: number;
132
- }
133
- declare function TracedFlowchartView({ spec, snapshots, snapshotIndex, onNodeClick, onSubflowChange, showTree, treeWidth, unstyled, className, style, }: TracedFlowchartViewProps): react_jsx_runtime.JSX.Element;
175
+ /** Override default node types */
176
+ nodeTypes?: NodeTypes;
177
+ }
178
+ declare function TracedFlowchartView({ spec, snapshots, snapshotIndex, onNodeClick, nodeTypes: customNodeTypes, unstyled, className, style, }: TracedFlowchartViewProps): react_jsx_runtime.JSX.Element;
134
179
 
135
180
  interface BreadcrumbEntry {
136
181
  /** Display name for this level */
@@ -205,12 +250,20 @@ interface StageNodeData {
205
250
  done?: boolean;
206
251
  error?: boolean;
207
252
  linked?: boolean;
253
+ /** Semantic icon hint (e.g., "llm", "tool", "rag", "start", "parse", "agent", "guard") */
254
+ icon?: string;
208
255
  /** Step numbers in execution order (shown as badges — multiple when revisited via loops) */
209
256
  stepNumbers?: number[];
210
257
  /** Node was not executed (dim it) */
211
258
  dimmed?: boolean;
212
259
  /** Node is a subflow root (show nested indicator) */
213
260
  isSubflow?: boolean;
261
+ /** Node uses lazy resolution (dashed border + cloud icon when unresolved) */
262
+ isLazy?: boolean;
263
+ /** Node is a decider (renders as diamond shape per flowchart convention) */
264
+ isDecider?: boolean;
265
+ /** Node is a fork (parallel fan-out) */
266
+ isFork?: boolean;
214
267
  /** Human-readable description of what this stage does */
215
268
  description?: string;
216
269
  /** Subflow identifier — set when this node belongs to a subflow */
@@ -250,4 +303,4 @@ interface TimeTravelDebuggerProps extends BaseComponentProps {
250
303
  */
251
304
  declare function TimeTravelDebugger({ snapshots, nodes, edges, showGantt, layout, title, size, unstyled, className, style, }: TimeTravelDebuggerProps): react_jsx_runtime.JSX.Element;
252
305
 
253
- export { type BreadcrumbEntry, type ExecutionOverlay, type FlowchartColors, FlowchartView, type FlowchartViewProps, type SpecNode, StageNode, type StageNodeData, SubflowBreadcrumb, type SubflowBreadcrumbProps, type SubflowNavigation, SubflowTree, type SubflowTreeEntry, type SubflowTreeProps, TimeTravelDebugger, type TimeTravelDebuggerProps, TracedFlowchartView, type TracedFlowchartViewProps, specToReactFlow, useSubflowNavigation };
306
+ export { type BreadcrumbEntry, type ExecutionOverlay, type FlowchartColors, FlowchartView, type FlowchartViewProps, type LayoutEdge, type LayoutNode, type SpecLayout, type SpecNode, StageNode, type StageNodeData, SubflowBreadcrumb, type SubflowBreadcrumbProps, type SubflowNavigation, SubflowTree, type SubflowTreeEntry, type SubflowTreeProps, TimeTravelDebugger, type TimeTravelDebuggerProps, TracedFlowchartView, type TracedFlowchartViewProps, applyOverlay, specToLayout, specToReactFlow, useSubflowNavigation };
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _xyflow_react from '@xyflow/react';
3
- import { Node, Edge } from '@xyflow/react';
3
+ import { Node, Edge, NodeTypes } from '@xyflow/react';
4
4
  import * as react from 'react';
5
5
 
6
6
  /** Snapshot of a single pipeline stage — the core data shape for all components. */
@@ -62,16 +62,21 @@ declare function FlowchartView({ nodes: rawNodes, edges: rawEdges, snapshots, se
62
62
  * Converts a SerializedPipelineStructure (from builder.toSpec()) into
63
63
  * ReactFlow nodes and edges with auto-layout.
64
64
  *
65
- * Supports two modes:
66
- * 1. Build-time only (no executionState) — all nodes gray
67
- * 2. With execution overlay — executed nodes colored, active node highlighted,
68
- * unvisited nodes stay gray
65
+ * Two-phase approach for performance:
66
+ * 1. `specToLayout(spec)`tree walk + positioning (expensive, cached on spec)
67
+ * 2. `applyOverlay(layout, overlay)`color nodes/edges (cheap, runs per slider tick)
68
+ *
69
+ * `specToReactFlow(spec, overlay)` combines both for convenience.
69
70
  */
70
71
 
71
72
  interface SpecNode {
72
73
  name: string;
73
74
  id?: string;
74
75
  type?: "stage" | "decider" | "fork" | "streaming";
76
+ /** Semantic icon hint — rendered by StageNode. Common values:
77
+ * "llm", "tool", "rag", "search", "parse", "start", "end", "loop",
78
+ * "agent", "swarm", "guard", "stream", "memory" */
79
+ icon?: string;
75
80
  description?: string;
76
81
  children?: SpecNode[];
77
82
  next?: SpecNode;
@@ -83,6 +88,8 @@ interface SpecNode {
83
88
  subflowId?: string;
84
89
  subflowName?: string;
85
90
  subflowStructure?: SpecNode;
91
+ /** True when this subflow uses lazy resolution (deferred until execution). */
92
+ isLazy?: boolean;
86
93
  }
87
94
  interface ExecutionOverlay {
88
95
  /** Names of stages that have completed (before the active one) */
@@ -105,6 +112,48 @@ interface FlowchartColors {
105
112
  labelLoop: string;
106
113
  pathGlow: string;
107
114
  }
115
+ /** A positioned node with all static info, before overlay is applied. */
116
+ interface LayoutNode {
117
+ id: string;
118
+ x: number;
119
+ y: number;
120
+ label: string;
121
+ isDecider: boolean;
122
+ isFork: boolean;
123
+ description?: string;
124
+ icon?: string;
125
+ subflowId?: string;
126
+ isSubflow: boolean;
127
+ isLazy?: boolean;
128
+ }
129
+ /** A positioned edge with source/target info. */
130
+ interface LayoutEdge {
131
+ id: string;
132
+ source: string;
133
+ target: string;
134
+ label?: string;
135
+ isLoop: boolean;
136
+ }
137
+ /** Static layout output — positions + structure, no execution state. */
138
+ interface SpecLayout {
139
+ nodes: LayoutNode[];
140
+ edges: LayoutEdge[];
141
+ /** Maps stage ID → node id for resolving loopTarget references. */
142
+ idToName: Map<string, string>;
143
+ }
144
+ /**
145
+ * Phase 1: Compute static layout from spec. Cached on spec reference — only
146
+ * recomputes when the pipeline structure changes, not on every slider tick.
147
+ */
148
+ declare function specToLayout(spec: SpecNode): SpecLayout;
149
+ /**
150
+ * Phase 2: Apply execution overlay to static layout.
151
+ * Produces ReactFlow nodes/edges with correct colors, step numbers, and glow.
152
+ */
153
+ declare function applyOverlay(layout: SpecLayout, overlay?: ExecutionOverlay, colors?: Partial<FlowchartColors>): {
154
+ nodes: Node[];
155
+ edges: Edge[];
156
+ };
108
157
  /**
109
158
  * Convert a pipeline spec to ReactFlow graph.
110
159
  * Pass `overlay` to color nodes/edges by execution state.
@@ -115,7 +164,7 @@ declare function specToReactFlow(spec: SpecNode, overlay?: ExecutionOverlay, col
115
164
  };
116
165
 
117
166
  interface TracedFlowchartViewProps extends BaseComponentProps {
118
- /** Pipeline spec from builder.toSpec() */
167
+ /** Pipeline spec from builder.toSpec() — for the current level */
119
168
  spec: SpecNode;
120
169
  /** Visualization snapshots (enables trace overlay when provided) */
121
170
  snapshots?: StageSnapshot[];
@@ -123,14 +172,10 @@ interface TracedFlowchartViewProps extends BaseComponentProps {
123
172
  snapshotIndex?: number;
124
173
  /** Callback when a node is clicked (receives snapshot index, or node id if no snapshots) */
125
174
  onNodeClick?: (indexOrId: number | string) => void;
126
- /** Callback when subflow navigation changes (true = entered subflow) */
127
- onSubflowChange?: (isInSubflow: boolean, subflowNodeName: string | null) => void;
128
- /** Show subflow directory sidebar when subflows exist (default: true) */
129
- showTree?: boolean;
130
- /** Width of the tree sidebar in pixels (default: 200) */
131
- treeWidth?: number;
132
- }
133
- declare function TracedFlowchartView({ spec, snapshots, snapshotIndex, onNodeClick, onSubflowChange, showTree, treeWidth, unstyled, className, style, }: TracedFlowchartViewProps): react_jsx_runtime.JSX.Element;
175
+ /** Override default node types */
176
+ nodeTypes?: NodeTypes;
177
+ }
178
+ declare function TracedFlowchartView({ spec, snapshots, snapshotIndex, onNodeClick, nodeTypes: customNodeTypes, unstyled, className, style, }: TracedFlowchartViewProps): react_jsx_runtime.JSX.Element;
134
179
 
135
180
  interface BreadcrumbEntry {
136
181
  /** Display name for this level */
@@ -205,12 +250,20 @@ interface StageNodeData {
205
250
  done?: boolean;
206
251
  error?: boolean;
207
252
  linked?: boolean;
253
+ /** Semantic icon hint (e.g., "llm", "tool", "rag", "start", "parse", "agent", "guard") */
254
+ icon?: string;
208
255
  /** Step numbers in execution order (shown as badges — multiple when revisited via loops) */
209
256
  stepNumbers?: number[];
210
257
  /** Node was not executed (dim it) */
211
258
  dimmed?: boolean;
212
259
  /** Node is a subflow root (show nested indicator) */
213
260
  isSubflow?: boolean;
261
+ /** Node uses lazy resolution (dashed border + cloud icon when unresolved) */
262
+ isLazy?: boolean;
263
+ /** Node is a decider (renders as diamond shape per flowchart convention) */
264
+ isDecider?: boolean;
265
+ /** Node is a fork (parallel fan-out) */
266
+ isFork?: boolean;
214
267
  /** Human-readable description of what this stage does */
215
268
  description?: string;
216
269
  /** Subflow identifier — set when this node belongs to a subflow */
@@ -250,4 +303,4 @@ interface TimeTravelDebuggerProps extends BaseComponentProps {
250
303
  */
251
304
  declare function TimeTravelDebugger({ snapshots, nodes, edges, showGantt, layout, title, size, unstyled, className, style, }: TimeTravelDebuggerProps): react_jsx_runtime.JSX.Element;
252
305
 
253
- export { type BreadcrumbEntry, type ExecutionOverlay, type FlowchartColors, FlowchartView, type FlowchartViewProps, type SpecNode, StageNode, type StageNodeData, SubflowBreadcrumb, type SubflowBreadcrumbProps, type SubflowNavigation, SubflowTree, type SubflowTreeEntry, type SubflowTreeProps, TimeTravelDebugger, type TimeTravelDebuggerProps, TracedFlowchartView, type TracedFlowchartViewProps, specToReactFlow, useSubflowNavigation };
306
+ export { type BreadcrumbEntry, type ExecutionOverlay, type FlowchartColors, FlowchartView, type FlowchartViewProps, type LayoutEdge, type LayoutNode, type SpecLayout, type SpecNode, StageNode, type StageNodeData, SubflowBreadcrumb, type SubflowBreadcrumbProps, type SubflowNavigation, SubflowTree, type SubflowTreeEntry, type SubflowTreeProps, TimeTravelDebugger, type TimeTravelDebuggerProps, TracedFlowchartView, type TracedFlowchartViewProps, applyOverlay, specToLayout, specToReactFlow, useSubflowNavigation };