footprint-explainable-ui 0.3.0
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.
- package/README.md +288 -0
- package/dist/flowchart.cjs +1512 -0
- package/dist/flowchart.cjs.map +1 -0
- package/dist/flowchart.d.cts +199 -0
- package/dist/flowchart.d.ts +199 -0
- package/dist/flowchart.js +1486 -0
- package/dist/flowchart.js.map +1 -0
- package/dist/index.cjs +1946 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +270 -0
- package/dist/index.d.ts +270 -0
- package/dist/index.js +1901 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/** Snapshot of a single pipeline stage — the core data shape for all components. */
|
|
4
|
+
interface StageSnapshot {
|
|
5
|
+
/** Internal stage identifier */
|
|
6
|
+
stageName: string;
|
|
7
|
+
/** Human-readable label */
|
|
8
|
+
stageLabel: string;
|
|
9
|
+
/** Accumulated memory state after this stage ran */
|
|
10
|
+
memory: Record<string, unknown>;
|
|
11
|
+
/** Narrative text describing what happened */
|
|
12
|
+
narrative: string;
|
|
13
|
+
/** When this stage started (ms from pipeline start) */
|
|
14
|
+
startMs: number;
|
|
15
|
+
/** How long this stage took (ms) */
|
|
16
|
+
durationMs: number;
|
|
17
|
+
/** Execution status */
|
|
18
|
+
status?: "pending" | "active" | "done" | "error";
|
|
19
|
+
}
|
|
20
|
+
/** Component size variants */
|
|
21
|
+
type Size = "compact" | "default" | "detailed";
|
|
22
|
+
/** Common props shared by all visualization components */
|
|
23
|
+
interface BaseComponentProps {
|
|
24
|
+
/** Size variant */
|
|
25
|
+
size?: Size;
|
|
26
|
+
/** Strip all built-in styles — bring your own */
|
|
27
|
+
unstyled?: boolean;
|
|
28
|
+
/** Additional CSS class name */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Inline style overrides */
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Default theme tokens — consumers override via CSS variables or ThemeProvider. */
|
|
35
|
+
interface ThemeTokens {
|
|
36
|
+
colors?: {
|
|
37
|
+
primary?: string;
|
|
38
|
+
success?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
warning?: string;
|
|
41
|
+
bgPrimary?: string;
|
|
42
|
+
bgSecondary?: string;
|
|
43
|
+
bgTertiary?: string;
|
|
44
|
+
textPrimary?: string;
|
|
45
|
+
textSecondary?: string;
|
|
46
|
+
textMuted?: string;
|
|
47
|
+
border?: string;
|
|
48
|
+
};
|
|
49
|
+
radius?: string;
|
|
50
|
+
fontFamily?: {
|
|
51
|
+
sans?: string;
|
|
52
|
+
mono?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Maps ThemeTokens to CSS custom property assignments. */
|
|
56
|
+
declare function tokensToCSSVars(tokens: ThemeTokens): Record<string, string>;
|
|
57
|
+
/** Default dark theme values (used as CSS variable fallbacks). */
|
|
58
|
+
declare const defaultTokens: Required<{
|
|
59
|
+
[K in keyof ThemeTokens]-?: Required<ThemeTokens[K]>;
|
|
60
|
+
}>;
|
|
61
|
+
|
|
62
|
+
declare function useFootprintTheme(): ThemeTokens;
|
|
63
|
+
interface FootprintThemeProps {
|
|
64
|
+
tokens?: ThemeTokens;
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Optional theme provider — wraps children with CSS custom properties.
|
|
69
|
+
* Consumers can also just set --fp-* CSS variables directly.
|
|
70
|
+
*/
|
|
71
|
+
declare function FootprintTheme({ tokens, children }: FootprintThemeProps): react_jsx_runtime.JSX.Element;
|
|
72
|
+
|
|
73
|
+
/** Cool dark theme (the library default) */
|
|
74
|
+
declare const coolDark: ThemeTokens;
|
|
75
|
+
/** Warm dark theme — charcoal-purple palette */
|
|
76
|
+
declare const warmDark: ThemeTokens;
|
|
77
|
+
/** Warm light theme — cream/peach palette */
|
|
78
|
+
declare const warmLight: ThemeTokens;
|
|
79
|
+
/** All built-in theme presets */
|
|
80
|
+
declare const themePresets: {
|
|
81
|
+
readonly coolDark: ThemeTokens;
|
|
82
|
+
readonly warmDark: ThemeTokens;
|
|
83
|
+
readonly warmLight: ThemeTokens;
|
|
84
|
+
};
|
|
85
|
+
type ThemePresetName = keyof typeof themePresets;
|
|
86
|
+
|
|
87
|
+
interface MemoryInspectorProps extends BaseComponentProps {
|
|
88
|
+
/** Single memory object or snapshots (will accumulate up to selectedIndex) */
|
|
89
|
+
data?: Record<string, unknown>;
|
|
90
|
+
/** When using snapshots mode, pass these instead of data */
|
|
91
|
+
snapshots?: StageSnapshot[];
|
|
92
|
+
/** Index to accumulate up to (for time-travel) */
|
|
93
|
+
selectedIndex?: number;
|
|
94
|
+
/** Show data types alongside values */
|
|
95
|
+
showTypes?: boolean;
|
|
96
|
+
/** Highlight keys that are new at this step */
|
|
97
|
+
highlightNew?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Displays pipeline memory state as formatted JSON.
|
|
101
|
+
* Supports both static (data prop) and time-travel (snapshots + selectedIndex) modes.
|
|
102
|
+
*/
|
|
103
|
+
declare function MemoryInspector({ data, snapshots, selectedIndex, showTypes, highlightNew, size, unstyled, className, style, }: MemoryInspectorProps): react_jsx_runtime.JSX.Element;
|
|
104
|
+
|
|
105
|
+
interface NarrativeLogProps extends BaseComponentProps {
|
|
106
|
+
/** Snapshots to display narratives from */
|
|
107
|
+
snapshots: StageSnapshot[];
|
|
108
|
+
/** Show narratives up to this index (for time-travel sync) */
|
|
109
|
+
selectedIndex?: number;
|
|
110
|
+
/** Show a single narrative string (simple mode) */
|
|
111
|
+
narrative?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Timeline-style execution log showing what happened at each stage.
|
|
115
|
+
* Supports both full snapshots mode and single-narrative mode.
|
|
116
|
+
*/
|
|
117
|
+
declare function NarrativeLog({ snapshots, selectedIndex, narrative, size, unstyled, className, style, }: NarrativeLogProps): react_jsx_runtime.JSX.Element;
|
|
118
|
+
|
|
119
|
+
interface NarrativeTraceProps extends BaseComponentProps {
|
|
120
|
+
/** All narrative lines (full trace) */
|
|
121
|
+
narrative: string[];
|
|
122
|
+
/** Number of lines currently revealed (for progressive reveal). Defaults to all. */
|
|
123
|
+
revealedCount?: number;
|
|
124
|
+
/** Start with all groups collapsed */
|
|
125
|
+
defaultCollapsed?: boolean;
|
|
126
|
+
/** Called when user clicks a stage header */
|
|
127
|
+
onStageClick?: (headerIndex: number) => void;
|
|
128
|
+
}
|
|
129
|
+
declare function NarrativeTrace({ narrative, revealedCount, defaultCollapsed, onStageClick, size, unstyled, className, style, }: NarrativeTraceProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
|
|
131
|
+
interface GanttTimelineProps extends BaseComponentProps {
|
|
132
|
+
/** Stage snapshots with timing info */
|
|
133
|
+
snapshots: StageSnapshot[];
|
|
134
|
+
/** Currently selected stage index */
|
|
135
|
+
selectedIndex?: number;
|
|
136
|
+
/** Callback when a stage bar is clicked */
|
|
137
|
+
onSelect?: (index: number) => void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Horizontal Gantt-style timeline showing stage durations and overlap.
|
|
141
|
+
* Great for performance analysis of pipeline execution.
|
|
142
|
+
*/
|
|
143
|
+
declare function GanttTimeline({ snapshots, selectedIndex, onSelect, size, unstyled, className, style, }: GanttTimelineProps): react_jsx_runtime.JSX.Element;
|
|
144
|
+
|
|
145
|
+
interface SnapshotPanelProps extends BaseComponentProps {
|
|
146
|
+
/** Stage snapshots from pipeline execution */
|
|
147
|
+
snapshots: StageSnapshot[];
|
|
148
|
+
/** Show the Gantt timeline */
|
|
149
|
+
showGantt?: boolean;
|
|
150
|
+
/** Show the time-travel scrubber */
|
|
151
|
+
showScrubber?: boolean;
|
|
152
|
+
/** Title override */
|
|
153
|
+
title?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* All-in-one panel: time-travel scrubber + memory inspector + narrative log + gantt.
|
|
157
|
+
* Drop this into any page to make a pipeline run inspectable.
|
|
158
|
+
*/
|
|
159
|
+
declare function SnapshotPanel({ snapshots, showGantt, showScrubber, title, size, unstyled, className, style, }: SnapshotPanelProps): react_jsx_runtime.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface DiffEntry {
|
|
162
|
+
key: string;
|
|
163
|
+
type: "added" | "removed" | "changed" | "unchanged";
|
|
164
|
+
oldValue?: unknown;
|
|
165
|
+
newValue?: unknown;
|
|
166
|
+
}
|
|
167
|
+
interface ScopeDiffProps extends BaseComponentProps {
|
|
168
|
+
/** Memory state before the current stage */
|
|
169
|
+
previous: Record<string, unknown> | null;
|
|
170
|
+
/** Memory state after the current stage */
|
|
171
|
+
current: Record<string, unknown>;
|
|
172
|
+
/** Hide unchanged keys (default: false) */
|
|
173
|
+
hideUnchanged?: boolean;
|
|
174
|
+
}
|
|
175
|
+
declare function ScopeDiff({ previous, current, hideUnchanged, size, unstyled, className, style, }: ScopeDiffProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
|
|
177
|
+
interface ResultPanelProps extends BaseComponentProps {
|
|
178
|
+
/** Final pipeline output / shared state */
|
|
179
|
+
data: Record<string, unknown> | null;
|
|
180
|
+
/** Optional console log lines */
|
|
181
|
+
logs?: string[];
|
|
182
|
+
/** Hide console section (default: false) */
|
|
183
|
+
hideConsole?: boolean;
|
|
184
|
+
}
|
|
185
|
+
declare function ResultPanel({ data, logs, hideConsole, size, unstyled, className, style, }: ResultPanelProps): react_jsx_runtime.JSX.Element;
|
|
186
|
+
|
|
187
|
+
interface TimeTravelControlsProps extends BaseComponentProps {
|
|
188
|
+
/** Stage snapshots */
|
|
189
|
+
snapshots: StageSnapshot[];
|
|
190
|
+
/** Currently selected stage index */
|
|
191
|
+
selectedIndex: number;
|
|
192
|
+
/** Callback when selected index changes */
|
|
193
|
+
onIndexChange: (index: number) => void;
|
|
194
|
+
/** Enable auto-play with Gantt-proportional timing */
|
|
195
|
+
autoPlayable?: boolean;
|
|
196
|
+
}
|
|
197
|
+
declare function TimeTravelControls({ snapshots, selectedIndex, onIndexChange, autoPlayable, size, unstyled, className, style, }: TimeTravelControlsProps): react_jsx_runtime.JSX.Element;
|
|
198
|
+
|
|
199
|
+
type ShellTab = "result" | "explainable" | "ai-compatible";
|
|
200
|
+
interface ExplainableShellProps extends BaseComponentProps {
|
|
201
|
+
/** Stage snapshots for time-travel visualization */
|
|
202
|
+
snapshots: StageSnapshot[];
|
|
203
|
+
/** Final pipeline result data */
|
|
204
|
+
resultData?: Record<string, unknown> | null;
|
|
205
|
+
/** Console log lines */
|
|
206
|
+
logs?: string[];
|
|
207
|
+
/** Combined narrative lines */
|
|
208
|
+
narrative?: string[];
|
|
209
|
+
/** Which tabs to show (default: all three) */
|
|
210
|
+
tabs?: ShellTab[];
|
|
211
|
+
/** Initially active tab */
|
|
212
|
+
defaultTab?: ShellTab;
|
|
213
|
+
/** Hide console in result tab */
|
|
214
|
+
hideConsole?: boolean;
|
|
215
|
+
/** Custom content to render in each tab slot */
|
|
216
|
+
renderFlowchart?: (props: {
|
|
217
|
+
snapshots: StageSnapshot[];
|
|
218
|
+
selectedIndex: number;
|
|
219
|
+
onNodeClick?: (index: number) => void;
|
|
220
|
+
}) => React.ReactNode;
|
|
221
|
+
}
|
|
222
|
+
declare function ExplainableShell({ snapshots, resultData, logs, narrative, tabs, defaultTab, hideConsole, renderFlowchart, size, unstyled, className, style, }: ExplainableShellProps): react_jsx_runtime.JSX.Element;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Shape of FootPrint's RuntimeSnapshot (from FlowChartExecutor.getSnapshot()).
|
|
226
|
+
* We define it here instead of importing to avoid a hard dependency on footprintjs.
|
|
227
|
+
*/
|
|
228
|
+
interface RuntimeStageSnapshot {
|
|
229
|
+
id: string;
|
|
230
|
+
name?: string;
|
|
231
|
+
isDecider?: boolean;
|
|
232
|
+
isFork?: boolean;
|
|
233
|
+
logs: Record<string, unknown>;
|
|
234
|
+
errors: Record<string, unknown>;
|
|
235
|
+
metrics: Record<string, unknown>;
|
|
236
|
+
evals: Record<string, unknown>;
|
|
237
|
+
flowMessages?: unknown[];
|
|
238
|
+
next?: RuntimeStageSnapshot;
|
|
239
|
+
children?: RuntimeStageSnapshot[];
|
|
240
|
+
}
|
|
241
|
+
interface RuntimeSnapshot {
|
|
242
|
+
sharedState: Record<string, unknown>;
|
|
243
|
+
executionTree: RuntimeStageSnapshot;
|
|
244
|
+
commitLog: unknown[];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Converts a FootPrint RuntimeSnapshot into a flat array of StageSnapshots
|
|
248
|
+
* suitable for visualization components.
|
|
249
|
+
*
|
|
250
|
+
* Usage:
|
|
251
|
+
* ```ts
|
|
252
|
+
* const executor = new FlowChartExecutor(chart);
|
|
253
|
+
* await executor.run();
|
|
254
|
+
* const snapshots = toVisualizationSnapshots(executor.getSnapshot());
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
declare function toVisualizationSnapshots(runtime: RuntimeSnapshot): StageSnapshot[];
|
|
258
|
+
/**
|
|
259
|
+
* Creates StageSnapshots from simple arrays (when you don't have a RuntimeSnapshot).
|
|
260
|
+
* Useful for testing or custom data sources.
|
|
261
|
+
*/
|
|
262
|
+
declare function createSnapshots(stages: Array<{
|
|
263
|
+
name: string;
|
|
264
|
+
label?: string;
|
|
265
|
+
memory?: Record<string, unknown>;
|
|
266
|
+
narrative?: string;
|
|
267
|
+
durationMs?: number;
|
|
268
|
+
}>): StageSnapshot[];
|
|
269
|
+
|
|
270
|
+
export { type BaseComponentProps, type DiffEntry, ExplainableShell, type ExplainableShellProps, FootprintTheme, GanttTimeline, type GanttTimelineProps, MemoryInspector, type MemoryInspectorProps, NarrativeLog, type NarrativeLogProps, NarrativeTrace, type NarrativeTraceProps, ResultPanel, type ResultPanelProps, ScopeDiff, type ScopeDiffProps, type ShellTab, type Size, SnapshotPanel, type SnapshotPanelProps, type StageSnapshot, type ThemePresetName, type ThemeTokens, TimeTravelControls, type TimeTravelControlsProps, coolDark, createSnapshots, defaultTokens, themePresets, toVisualizationSnapshots, tokensToCSSVars, useFootprintTheme, warmDark, warmLight };
|