@pipelex/mthds-ui 0.59.0 → 0.60.1
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/dist/{chunk-S4UMMHLE.js → chunk-43NAVRQK.js} +17 -2
- package/dist/chunk-43NAVRQK.js.map +1 -0
- package/dist/{chunk-6KWNAU4F.js → chunk-BQZ3BPJM.js} +13 -1
- package/dist/chunk-BQZ3BPJM.js.map +1 -0
- package/dist/{chunk-XMTXWXFO.js → chunk-KKT6OVO6.js} +3 -3
- package/dist/{chunk-5N3MP5TD.js → chunk-PWKNMKFA.js} +106 -35
- package/dist/chunk-PWKNMKFA.js.map +1 -0
- package/dist/{chunk-ZRSFFUHA.js → chunk-S36KN6CG.js} +3 -3
- package/dist/chunk-UVEGKTBU.js +600 -0
- package/dist/chunk-UVEGKTBU.js.map +1 -0
- package/dist/{chunk-7QUQJW6Q.js → chunk-YQJNKQWO.js} +91 -285
- package/dist/chunk-YQJNKQWO.js.map +1 -0
- package/dist/form/react/index.d.ts +1 -1
- package/dist/form/react/index.js +2 -2
- package/dist/graph/index.d.ts +48 -21
- package/dist/graph/index.js +61 -21
- package/dist/graph/react/detail/DetailPanel.css +49 -0
- package/dist/graph/react/graph-core.css +20 -0
- package/dist/graph/react/index.d.ts +2 -2
- package/dist/graph/react/index.js +92 -29
- package/dist/graph/react/index.js.map +1 -1
- package/dist/graph/react/styles/simple/SimpleDetailPanel.css +20 -0
- package/dist/graph/react/styles/simple/SimpleStyle.css +13 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +61 -21
- package/dist/methodWords-DIEg1PVT.d.ts +180 -0
- package/dist/{registryJoin-CMfBspIs.d.ts → registryJoin-Cj1mIkqe.d.ts} +18 -10
- package/dist/standalone/graph-standalone.html +232 -130
- package/dist/standalone/graph-viewer.css +102 -0
- package/dist/standalone/graph-viewer.js +130 -130
- package/dist/static-graph/index.d.ts +1 -1
- package/dist/static-graph/index.js +57 -14
- package/dist/static-graph/index.js.map +1 -1
- package/dist/timeline/index.d.ts +42 -7
- package/dist/timeline/index.js +8 -3
- package/dist/timeline/react/RunTimeline.css +18 -0
- package/dist/timeline/react/index.d.ts +3 -2
- package/dist/timeline/react/index.js +20 -11
- package/dist/timeline/react/index.js.map +1 -1
- package/dist/timeline/react/styles/simple/SimpleProgress.css +25 -0
- package/dist/{types-CnDJyLYo.d.ts → types-BygAt1Si.d.ts} +51 -1
- package/package.json +2 -2
- package/dist/chunk-5N3MP5TD.js.map +0 -1
- package/dist/chunk-6KWNAU4F.js.map +0 -1
- package/dist/chunk-7QUQJW6Q.js.map +0 -1
- package/dist/chunk-P6IGZVWE.js +0 -155
- package/dist/chunk-P6IGZVWE.js.map +0 -1
- package/dist/chunk-S4UMMHLE.js.map +0 -1
- /package/dist/{chunk-XMTXWXFO.js.map → chunk-KKT6OVO6.js.map} +0 -0
- /package/dist/{chunk-ZRSFFUHA.js.map → chunk-S36KN6CG.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
GRAPH_THEME,
|
|
6
6
|
GRAPH_THEME_MODE,
|
|
7
7
|
TOOLBAR_POSITION
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BQZ3BPJM.js";
|
|
9
9
|
import {
|
|
10
10
|
__spreadProps,
|
|
11
11
|
__spreadValues
|
|
@@ -159,6 +159,20 @@ var LIGHT_PALETTE_COLORS = __spreadProps(__spreadValues({}, FONT_TOKENS), {
|
|
|
159
159
|
"--color-text-muted": "#475569",
|
|
160
160
|
"--color-controller-text": "#475569"
|
|
161
161
|
});
|
|
162
|
+
var OUTCOME_TONE_COLORS = {
|
|
163
|
+
[GRAPH_THEME.DARK]: {
|
|
164
|
+
"--positive": "hsl(142 69% 58%)",
|
|
165
|
+
"--caution": "hsl(43 96% 56%)",
|
|
166
|
+
"--negative": "hsl(0 91% 71%)",
|
|
167
|
+
"--neutral": "hsl(240 5% 64.9%)"
|
|
168
|
+
},
|
|
169
|
+
[GRAPH_THEME.LIGHT]: {
|
|
170
|
+
"--positive": "hsl(142 72% 29%)",
|
|
171
|
+
"--caution": "hsl(26 90% 37%)",
|
|
172
|
+
"--negative": "hsl(0 74% 42%)",
|
|
173
|
+
"--neutral": "hsl(240 5.2% 33.9%)"
|
|
174
|
+
}
|
|
175
|
+
};
|
|
162
176
|
function getPaletteForTheme(theme) {
|
|
163
177
|
return theme === GRAPH_THEME.LIGHT ? LIGHT_PALETTE_COLORS : DARK_PALETTE_COLORS;
|
|
164
178
|
}
|
|
@@ -191,8 +205,9 @@ function getPaletteColors() {
|
|
|
191
205
|
export {
|
|
192
206
|
DARK_PALETTE_COLORS,
|
|
193
207
|
LIGHT_PALETTE_COLORS,
|
|
208
|
+
OUTCOME_TONE_COLORS,
|
|
194
209
|
getPaletteForTheme,
|
|
195
210
|
DEFAULT_GRAPH_CONFIG,
|
|
196
211
|
getPaletteColors
|
|
197
212
|
};
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
213
|
+
//# sourceMappingURL=chunk-43NAVRQK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/graphConfig.ts"],"sourcesContent":["import type { GraphConfig, GraphStyleId, GraphTheme, ToolbarPosition } from \"./types\";\nimport {\n EDGE_TYPE,\n FOLD_MODE,\n GRAPH_STYLE,\n GRAPH_THEME,\n GRAPH_THEME_MODE,\n TOOLBAR_POSITION,\n} from \"./types\";\n\n/**\n * Semantic design tokens consumed by every component CSS file.\n *\n * Component CSS **must never** hardcode raw hex/rgba values. Reference these\n * tokens via `var(--token-name)`. A new theme is just a new set of values.\n * A new component picks up theming for free as long as it only uses tokens.\n *\n * Categories:\n * surface-* → backgrounds (page, panels, pills, glass overlays)\n * border-* → borders, dividers\n * text-* → foreground text\n * shadow-* → drop shadows\n * focus-ring → focus outline\n * color-* → domain-semantic colors (pipe accents, edges, status); kept\n * separate because they're meaningful in both themes (a pipe is\n * still red), only the *value* shifts for contrast.\n *\n * The tone roles (`--positive`, `--caution`, `--negative`, `--neutral`) are\n * NOT in these palettes, which are set inline and so beat every stylesheet:\n * they are the form kernel's tokens too, which a host sets from its own\n * stylesheet, so their defaults live in CSS at zero specificity instead\n * (`OUTCOME_TONE_COLORS`).\n */\nconst FONT_TOKENS: Record<string, string> = {\n \"--font-sans\": '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',\n \"--font-mono\": '\"JetBrains Mono\", \"Monaco\", \"Menlo\", monospace',\n};\n\nexport const DARK_PALETTE_COLORS: Record<string, string> = {\n ...FONT_TOKENS,\n\n // Surfaces\n \"--surface-page\": \"#0a0a0a\",\n \"--surface-panel\": \"#111118\",\n \"--surface-overlay\": \"rgba(17, 17, 24, 0.8)\",\n \"--surface-overlay-hover\": \"rgba(30, 30, 40, 0.9)\",\n \"--surface-overlay-disabled\": \"rgba(17, 17, 24, 0.6)\",\n \"--surface-elevated\": \"rgba(255, 255, 255, 0.06)\",\n \"--surface-elevated-hover\": \"rgba(255, 255, 255, 0.1)\",\n \"--surface-sunken\": \"rgba(255, 255, 255, 0.03)\",\n \"--surface-pill\": \"rgba(255, 255, 255, 0.06)\",\n \"--surface-pill-border\": \"rgba(255, 255, 255, 0.08)\",\n\n // Borders\n \"--border-subtle\": \"rgba(255, 255, 255, 0.06)\",\n \"--border-default\": \"rgba(255, 255, 255, 0.1)\",\n \"--border-strong\": \"rgba(255, 255, 255, 0.18)\",\n \"--border-dashed\": \"rgba(255, 255, 255, 0.15)\",\n\n // Text\n \"--text-primary\": \"#f8fafc\",\n \"--text-default\": \"#e2e8f0\",\n \"--text-secondary\": \"#cbd5e1\",\n \"--text-muted\": \"#94a3b8\",\n \"--text-dim\": \"#64748b\",\n \"--text-on-accent\": \"#0e0e0e\",\n\n // Effects\n \"--shadow-sm\": \"0 2px 8px rgba(0, 0, 0, 0.4)\",\n \"--shadow-md\": \"0 4px 16px rgba(0, 0, 0, 0.6)\",\n \"--shadow-lg\": \"0 8px 24px rgba(0, 0, 0, 0.5)\",\n \"--focus-ring\": \"rgba(59, 130, 246, 0.6)\",\n\n // Domain-semantic colors (graph nodes/edges)\n \"--color-pipe\": \"#ff6b6b\",\n \"--color-pipe-bg\": \"rgba(224,108,117,0.18)\",\n \"--color-pipe-text\": \"#ffffff\",\n \"--color-stuff\": \"#4ECDC4\",\n \"--color-stuff-bg\": \"rgba(78,205,196,0.12)\",\n \"--color-stuff-border\": \"#9ddcfd\",\n \"--color-stuff-text\": \"#98FB98\",\n \"--color-stuff-text-dim\": \"#9ddcfd\",\n \"--color-edge\": \"#FFFACD\",\n \"--color-batch-item\": \"#bd93f9\",\n \"--color-batch-aggregate\": \"#50fa7b\",\n \"--color-parallel-combine\": \"#d6a4ff\",\n \"--color-success\": \"#50FA7B\",\n \"--color-success-bg\": \"rgba(80,250,123,0.15)\",\n \"--color-error\": \"#FF5555\",\n \"--color-error-bg\": \"rgba(255,85,85,0.15)\",\n \"--color-error-border\": \"rgba(255,85,85,0.2)\",\n \"--color-accent\": \"#8BE9FD\",\n \"--color-accent-strong\": \"#3b82f6\",\n \"--color-warning\": \"#FFB86C\",\n\n // Controller-group palette (tinted borders/backgrounds per controller type)\n \"--ctrl-sequence-border\": \"rgba(148, 163, 184, 0.25)\",\n \"--ctrl-sequence-bg\": \"rgba(148, 163, 184, 0.03)\",\n \"--ctrl-sequence-text\": \"#94a3b8\",\n \"--ctrl-parallel-border\": \"rgba(139, 233, 253, 0.35)\",\n \"--ctrl-parallel-bg\": \"rgba(139, 233, 253, 0.03)\",\n \"--ctrl-parallel-text\": \"#8be9fd\",\n \"--ctrl-condition-border\": \"rgba(251, 191, 36, 0.35)\",\n \"--ctrl-condition-bg\": \"rgba(251, 191, 36, 0.03)\",\n \"--ctrl-condition-text\": \"#fbbf24\",\n \"--ctrl-batch-border\": \"rgba(167, 139, 250, 0.35)\",\n \"--ctrl-batch-bg\": \"rgba(167, 139, 250, 0.03)\",\n \"--ctrl-batch-text\": \"#a78bfa\",\n \"--ctrl-folded-bg\": \"rgba(148, 163, 184, 0.25)\",\n \"--ctrl-folded-border\": \"rgba(148, 163, 184, 0.4)\",\n\n // Legacy aliases — kept so existing inline styles in graph builders keep\n // working until they're migrated. New code should use the semantic tokens.\n \"--color-bg\": \"#0a0a0a\",\n \"--color-bg-dots\": \"rgba(255, 255, 255, 0.35)\",\n \"--color-text-muted\": \"#94a3b8\",\n \"--color-controller-text\": \"#94a3b8\",\n};\n\nexport const LIGHT_PALETTE_COLORS: Record<string, string> = {\n ...FONT_TOKENS,\n\n // Surfaces — chart stays a soft off-white, panels slightly cooler\n \"--surface-page\": \"#f8fafc\",\n \"--surface-panel\": \"#ffffff\",\n \"--surface-overlay\": \"rgba(255, 255, 255, 0.92)\",\n \"--surface-overlay-hover\": \"rgba(241, 245, 249, 0.96)\",\n \"--surface-overlay-disabled\": \"rgba(255, 255, 255, 0.7)\",\n \"--surface-elevated\": \"rgba(15, 23, 42, 0.05)\",\n \"--surface-elevated-hover\": \"rgba(15, 23, 42, 0.09)\",\n \"--surface-sunken\": \"rgba(15, 23, 42, 0.03)\",\n \"--surface-pill\": \"rgba(15, 23, 42, 0.05)\",\n \"--surface-pill-border\": \"rgba(15, 23, 42, 0.1)\",\n\n // Borders\n \"--border-subtle\": \"rgba(15, 23, 42, 0.08)\",\n \"--border-default\": \"rgba(15, 23, 42, 0.12)\",\n \"--border-strong\": \"rgba(15, 23, 42, 0.22)\",\n \"--border-dashed\": \"rgba(15, 23, 42, 0.18)\",\n\n // Text\n \"--text-primary\": \"#020617\",\n \"--text-default\": \"#0f172a\",\n \"--text-secondary\": \"#1e293b\",\n \"--text-muted\": \"#475569\",\n \"--text-dim\": \"#64748b\",\n \"--text-on-accent\": \"#ffffff\",\n\n // Effects\n \"--shadow-sm\": \"0 2px 8px rgba(15, 23, 42, 0.08)\",\n \"--shadow-md\": \"0 4px 16px rgba(15, 23, 42, 0.14)\",\n \"--shadow-lg\": \"0 8px 24px rgba(15, 23, 42, 0.15)\",\n \"--focus-ring\": \"rgba(2, 132, 199, 0.5)\",\n\n // Domain-semantic colors — darker for contrast on light backgrounds\n \"--color-pipe\": \"#dc2626\",\n \"--color-pipe-bg\": \"rgba(220, 38, 38, 0.1)\",\n \"--color-pipe-text\": \"#ffffff\",\n \"--color-stuff\": \"#0891b2\",\n \"--color-stuff-bg\": \"rgba(8, 145, 178, 0.08)\",\n \"--color-stuff-border\": \"#0e7490\",\n \"--color-stuff-text\": \"#0f172a\",\n \"--color-stuff-text-dim\": \"#475569\",\n \"--color-edge\": \"#64748b\",\n \"--color-batch-item\": \"#7c3aed\",\n \"--color-batch-aggregate\": \"#15803d\",\n \"--color-parallel-combine\": \"#6d28d9\",\n \"--color-success\": \"#15803d\",\n \"--color-success-bg\": \"rgba(21, 128, 61, 0.12)\",\n \"--color-error\": \"#dc2626\",\n \"--color-error-bg\": \"rgba(220, 38, 38, 0.1)\",\n \"--color-error-border\": \"rgba(220, 38, 38, 0.25)\",\n \"--color-accent\": \"#0284c7\",\n \"--color-accent-strong\": \"#0284c7\",\n \"--color-warning\": \"#d97706\",\n\n // Controller-group palette\n \"--ctrl-sequence-border\": \"rgba(71, 85, 105, 0.3)\",\n \"--ctrl-sequence-bg\": \"rgba(71, 85, 105, 0.04)\",\n \"--ctrl-sequence-text\": \"#475569\",\n \"--ctrl-parallel-border\": \"rgba(8, 145, 178, 0.4)\",\n \"--ctrl-parallel-bg\": \"rgba(8, 145, 178, 0.05)\",\n \"--ctrl-parallel-text\": \"#0e7490\",\n \"--ctrl-condition-border\": \"rgba(217, 119, 6, 0.4)\",\n \"--ctrl-condition-bg\": \"rgba(217, 119, 6, 0.05)\",\n \"--ctrl-condition-text\": \"#b45309\",\n \"--ctrl-batch-border\": \"rgba(124, 58, 237, 0.4)\",\n \"--ctrl-batch-bg\": \"rgba(124, 58, 237, 0.05)\",\n \"--ctrl-batch-text\": \"#6d28d9\",\n \"--ctrl-folded-bg\": \"rgba(71, 85, 105, 0.18)\",\n \"--ctrl-folded-border\": \"rgba(71, 85, 105, 0.35)\",\n\n // Legacy aliases\n \"--color-bg\": \"#f8fafc\",\n \"--color-bg-dots\": \"rgba(15, 23, 42, 0.18)\",\n \"--color-text-muted\": \"#475569\",\n \"--color-controller-text\": \"#475569\",\n};\n\n/**\n * The tone roles' default values per theme: how a condition's outcome reads\n * to a person (MTHDS \"tone\"), never a brand colour. Named and valued as the\n * form kernel's status tokens in its `theme.css`, so one value a host sets\n * serves the form, the graph and the timeline: the 400 shades on the dark\n * page, the 700 shades and zinc-600 on the light one.\n *\n * These are documentation and the tests' reference, not applied from here.\n * The defaults are declared in CSS at zero specificity on the graph's and the\n * timeline's containers (`:where(...)` in `graph-core.css` and\n * `RunTimeline.css`), so a host's stylesheet rule on a container wins over\n * them, and `paletteColors` still wins over both, being inline.\n */\nexport const OUTCOME_TONE_COLORS: Readonly<Record<GraphTheme, Readonly<Record<string, string>>>> = {\n [GRAPH_THEME.DARK]: {\n \"--positive\": \"hsl(142 69% 58%)\",\n \"--caution\": \"hsl(43 96% 56%)\",\n \"--negative\": \"hsl(0 91% 71%)\",\n \"--neutral\": \"hsl(240 5% 64.9%)\",\n },\n [GRAPH_THEME.LIGHT]: {\n \"--positive\": \"hsl(142 72% 29%)\",\n \"--caution\": \"hsl(26 90% 37%)\",\n \"--negative\": \"hsl(0 74% 42%)\",\n \"--neutral\": \"hsl(240 5.2% 33.9%)\",\n },\n};\n\nexport function getPaletteForTheme(theme: GraphTheme): Record<string, string> {\n return theme === GRAPH_THEME.LIGHT ? LIGHT_PALETTE_COLORS : DARK_PALETTE_COLORS;\n}\n\n// `toolbarPosition` and `graphStyle` are narrowed to required: the default\n// always sets them, so `resolveToolbarPosition` and `resolveGraphStyle` can\n// terminate their fallback chains here without a redundant literal floor.\nexport const DEFAULT_GRAPH_CONFIG: GraphConfig & {\n toolbarPosition: ToolbarPosition;\n graphStyle: GraphStyleId;\n} = {\n direction: \"LR\",\n showControllers: false,\n foldMode: FOLD_MODE.EXPANDED,\n // `system` follows the host environment (OS/browser, or editor theme) out of\n // the box — the least-surprising default for an embedded component. Hosts\n // that want a fixed appearance pass `theme: \"dark\"` / `\"light\"` explicitly.\n theme: GRAPH_THEME_MODE.SYSTEM,\n // Backward-compatible default: the toolbar stays pinned top-right unless the\n // host overrides it via `config.toolbarPosition` or the `toolbarPosition` prop.\n toolbarPosition: TOOLBAR_POSITION.TOP_RIGHT,\n // Today's drawing stays the default, so no existing host sees a change.\n graphStyle: GRAPH_STYLE.DETAILED,\n nodesep: 50,\n ranksep: 100,\n edgeType: EDGE_TYPE.DEFAULT,\n initialZoom: null,\n panToTop: true,\n // `paletteColors` intentionally omitted from the default. The viewer derives\n // the palette from the active `theme`. Consumers only set `paletteColors` to\n // override specific tokens (sparse merge on top of the theme palette).\n};\n\nexport function getPaletteColors(): Record<string, string> {\n return DARK_PALETTE_COLORS;\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,IAAM,cAAsC;AAAA,EAC1C,eAAe;AAAA,EACf,eAAe;AACjB;AAEO,IAAM,sBAA8C,iCACtD,cADsD;AAAA;AAAA,EAIzD,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA,EAC9B,sBAAsB;AAAA,EACtB,4BAA4B;AAAA,EAC5B,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,yBAAyB;AAAA;AAAA,EAGzB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA;AAAA,EAGnB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,oBAAoB;AAAA;AAAA,EAGpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAAA;AAAA,EAGhB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA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AA,EACX,iBAAiB;AAAA,EACjB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA,EAIpB,OAAO,iBAAiB;AAAA;AAAA;AAAA,EAGxB,iBAAiB,iBAAiB;AAAA;AAAA,EAElC,YAAY,YAAY;AAAA,EACxB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU,UAAU;AAAA,EACpB,aAAa;AAAA,EACb,UAAU;AAAA;AAAA;AAAA;AAIZ;AAEO,SAAS,mBAA2C;AACzD,SAAO;AACT;","names":[]}
|
|
@@ -63,6 +63,16 @@ function isFailingPipeNode(node) {
|
|
|
63
63
|
function isBindingStepSpec(step) {
|
|
64
64
|
return "from_path" in step;
|
|
65
65
|
}
|
|
66
|
+
var OUTCOME_TONE = {
|
|
67
|
+
POSITIVE: "positive",
|
|
68
|
+
CAUTION: "caution",
|
|
69
|
+
NEGATIVE: "negative",
|
|
70
|
+
NEUTRAL: "neutral"
|
|
71
|
+
};
|
|
72
|
+
var OUTCOME_TONES = new Set(Object.values(OUTCOME_TONE));
|
|
73
|
+
function isOutcomeTone(value) {
|
|
74
|
+
return typeof value === "string" && OUTCOME_TONES.has(value);
|
|
75
|
+
}
|
|
66
76
|
function graphSpecMode(spec) {
|
|
67
77
|
var _a;
|
|
68
78
|
return (_a = spec == null ? void 0 : spec.meta) == null ? void 0 : _a.mode;
|
|
@@ -205,6 +215,8 @@ export {
|
|
|
205
215
|
problemFailingPipe,
|
|
206
216
|
isFailingPipeNode,
|
|
207
217
|
isBindingStepSpec,
|
|
218
|
+
OUTCOME_TONE,
|
|
219
|
+
isOutcomeTone,
|
|
208
220
|
graphSpecMode,
|
|
209
221
|
isStaticGraphSpec,
|
|
210
222
|
isDryGraphSpec,
|
|
@@ -226,4 +238,4 @@ export {
|
|
|
226
238
|
nodeWidth,
|
|
227
239
|
nodeHeight
|
|
228
240
|
};
|
|
229
|
-
//# sourceMappingURL=chunk-
|
|
241
|
+
//# sourceMappingURL=chunk-BQZ3BPJM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/types.ts"],"sourcesContent":["// The MTHDS Protocol's problem document, as the standard's own client generates\n// it from the core error registry. A type import only: nothing of `mthds` runs\n// in this module, so the React-free entries stay free of its code.\nimport type { Problem } from \"mthds/errors\";\n\n// ─── Pipe type taxonomy ─────────────────────────────────────────────────────\n// Operators perform work; controllers orchestrate other pipes.\n\nexport type PipeOperatorType =\n | \"PipeLLM\"\n | \"PipeExtract\"\n | \"PipeCompose\"\n | \"PipeImgGen\"\n | \"PipeSearch\"\n | \"PipeFunc\"\n | \"PipeStructure\" // turns Text into a structured concept via an LLM\n | \"PipeJudge\" // asks a judging model one closed question, answered as a verdict native\n | \"PipeDocGen\" // lays its inputs out as a stored document file, calling no AI model\n | \"PipeSignature\"; // contract-only stub — emitted under `--allow-signatures`\n\nexport type PipeControllerType = \"PipeSequence\" | \"PipeParallel\" | \"PipeCondition\" | \"PipeBatch\";\n\nexport type PipeType = PipeOperatorType | PipeControllerType;\n\n// Presence map over the full `PipeType` union — typed as `Record<PipeType, true>`\n// so adding a pipe class to the union without listing it here is a compile\n// error. `KNOWN_PIPE_TYPES` derives its keys from this map, keeping the runtime\n// check the validator performs in sync with the type.\nconst PIPE_TYPE_PRESENCE: Record<PipeType, true> = {\n PipeLLM: true,\n PipeExtract: true,\n PipeCompose: true,\n PipeImgGen: true,\n PipeSearch: true,\n PipeFunc: true,\n PipeStructure: true,\n PipeJudge: true,\n PipeDocGen: true,\n PipeSignature: true,\n PipeSequence: true,\n PipeParallel: true,\n PipeCondition: true,\n PipeBatch: true,\n};\n\n/** Every pipe class name pipelex emits as `pipe_type`. Used by validateGraphSpec. */\nexport const KNOWN_PIPE_TYPES: ReadonlySet<string> = new Set(Object.keys(PIPE_TYPE_PRESENCE));\n\n/**\n * The `pipe_type` of a binding node. A PipeSequence's binding step\n * (`{ from = \"invoice.total\", result = \"total_amount\" }`) runs no pipe, so the\n * class it carries is not a pipe class: pipelex writes `BindingStep` beside the\n * `binding` node kind, and the node's `pipe_code` is the step's `from` path.\n */\nexport const BINDING_STEP_TYPE = \"BindingStep\" as const;\n\nexport type BindingStepType = typeof BINDING_STEP_TYPE;\n\n/** What a GraphSpec node's `pipe_type` names: a pipe class, or the binding step that runs none. */\nexport type NodePipeType = PipeType | BindingStepType;\n\nexport type PipeStatus = \"succeeded\" | \"failed\" | \"running\" | \"scheduled\" | \"skipped\" | \"canceled\";\n\n// ─── GraphSpec mode contract ────────────────────────────────────────────────\n\nexport const GRAPH_SPEC_MODE = {\n DRY: \"dry\",\n LIVE: \"live\",\n STATIC: \"static\",\n} as const;\n\nexport type GraphSpecMode = (typeof GRAPH_SPEC_MODE)[keyof typeof GRAPH_SPEC_MODE];\n\nexport interface GraphSpecMeta {\n format: \"mthds\";\n /**\n * Missing mode is a legacy runtime graph. Static UI behavior must key only on\n * `mode === \"static\"` and never infer it from absent runtime fields.\n */\n mode?: GraphSpecMode;\n [key: string]: unknown;\n}\n\n// ─── Node type constants ────────────────────────────────────────────────────\n// Used by graphBuilders and consumed by ReactFlow custom node registration.\n\nexport const NODE_TYPE_PIPE_CARD = \"pipeCard\" as const;\nexport const NODE_TYPE_STUFF = \"default\" as const;\nexport const NODE_TYPE_CONTROLLER = \"controllerGroup\" as const;\n\n// The simple style's node types: a step, a method input or final output, a\n// decision, and a \"for each\" frame. See `SimpleNodePayload`.\nexport const NODE_TYPE_SIMPLE_STEP = \"simpleStep\" as const;\nexport const NODE_TYPE_SIMPLE_TERMINAL = \"simpleTerminal\" as const;\nexport const NODE_TYPE_SIMPLE_DECISION = \"simpleDecision\" as const;\nexport const NODE_TYPE_SIMPLE_FRAME = \"simpleFrame\" as const;\n\n/**\n * The edge type that draws an edge along the route the layout computed for it\n * (`GraphEdge.route`), around the nodes in its way, rather than as a free curve\n * between its two ends. Used by the styles that lay out with `routeEdges`.\n */\nexport const EDGE_TYPE_ROUTED = \"routed\" as const;\n\n// ─── Stuff node ID helpers ──────────────────────────────────────────────────\n// Stuff (data) nodes use a \"stuff_<digest>\" convention throughout the graph.\n\nexport const STUFF_ID_PREFIX = \"stuff_\";\n\nexport function stuffNodeId(digest: string): string {\n return STUFF_ID_PREFIX + digest;\n}\n\nexport function isStuffNodeId(id: string): boolean {\n return id.startsWith(STUFF_ID_PREFIX);\n}\n\nexport function stuffDigestFromId(id: string): string {\n return id.slice(STUFF_ID_PREFIX.length);\n}\n\n// ─── Stuff multiplicity ─────────────────────────────────────────────────────\n// How many values a stuff holds, in the encoding the pipe registry already uses\n// for `StuffSpecInfo.multiplicity`: `true` for a variable-length list (`Code[]`),\n// an integer for a fixed count (`Code[N]`), `null`/`false`/absent for a single\n// value. A count of exactly one is single throughout the MTHDS standard —\n// `Code[1]` is a way of writing `Code`, never a one-item list — so it reads as\n// single here too.\n\nexport type StuffMultiplicity = number | boolean | null;\n\n/** Whether a multiplicity declares a list: variable-length, or a fixed count of at least two. */\nexport function isPluralMultiplicity(multiplicity: StuffMultiplicity | undefined): boolean {\n return multiplicity === true || (Number.isInteger(multiplicity) && (multiplicity as number) > 1);\n}\n\n/** The authored marker for a multiplicity — `\"[]\"`, `\"[N]\"`, or `\"\"` for a single value. */\nexport function multiplicitySuffix(multiplicity: StuffMultiplicity | undefined): string {\n if (!isPluralMultiplicity(multiplicity)) return \"\";\n return multiplicity === true ? \"[]\" : `[${multiplicity as number}]`;\n}\n\n// ─── GraphSpec types (from pipelex-agent --view output) ─────────────────────\n\nexport interface GraphSpecNodeIoItem {\n name: string;\n digest?: string;\n /** The bare concept code or ref, never carrying a multiplicity marker — that is `multiplicity`. */\n concept?: string;\n /**\n * How many values the stuff holds (see `StuffMultiplicity`). Emitted only on a\n * plural stuff; absent means single. The static builder writes it, and a\n * runtime graph carries it once its producer emits it, so a renderer must read\n * absence as single rather than as unknown.\n */\n multiplicity?: StuffMultiplicity;\n content_type?: string;\n preview?: string;\n size?: number;\n data?: unknown;\n data_text?: string;\n data_html?: string;\n extra?: Record<string, unknown>;\n}\n\nexport interface GraphSpecNodeIo {\n inputs: GraphSpecNodeIoItem[];\n outputs: GraphSpecNodeIoItem[];\n}\n\nexport type NodeKind =\n | \"pipe_call\"\n | \"controller\"\n | \"operator\"\n | \"input\"\n | \"output\"\n | \"artifact\"\n | \"error\"\n // A PipeSequence binding step: it runs no pipe, and produces the stuff it binds from a path in working memory.\n | \"binding\";\n\nexport interface GraphSpecNodeTiming {\n started_at: string;\n ended_at: string;\n duration: number;\n}\n\n/**\n * Inference usage attributed to one graph node — the mirror of pipelex's\n * `NodeUsageSpec`. Read the invariants before rendering any of these numbers;\n * getting them wrong means showing a wrong dollar figure, which is worse than\n * showing none.\n *\n * 1. `node.usage === undefined` is ALL-OR-NOTHING across a spec: it means the\n * run reported no usage at all (collection off, or zero inference calls).\n * As soon as one call was reported, EVERY node carries a usage object —\n * zeroed for controllers, PipeFunc, PipeCompose, skipped and lifted pipes.\n * So it never means \"this particular node was not measured\".\n * 2. `cost === null` ⟺ `rated_inference_calls === 0`. \"Made no call\" and \"made\n * only unrated calls\" both land here; `inference_calls` tells them apart.\n * Never render `null` as `$0.00` — a dry run is entirely unrated.\n * 3. `inference_calls > rated_inference_calls > 0` means `cost` is a LOWER\n * BOUND, not a total. It must be marked (a leading \"≥\").\n * 4. `total_tokens` is input_joined + output. Do NOT sum\n * `nb_tokens_by_category`: `input_cached` is a subset of `input`, not\n * additive, so summing double-counts.\n *\n * The `subtree_*` half covers the node plus every descendant, rolled up by\n * pipelex so no consumer re-derives it. Controllers have only a subtree.\n */\n/**\n * What one inference model actually did for a node — the graph's only record of\n * the model that RAN.\n *\n * Everything else in a GraphSpec that names a model records what was *asked for*:\n * `execution_data.resolved_model` is the handle the pipe resolved to (often still\n * an alias like `@default-premium`, since aliases resolve at inference time), and\n * the blueprint holds the authored choice (`$writing-factual`). Only this survives\n * alias resolution, deck defaults, and any fallback or retry.\n *\n * `cost` follows the same rule as the node's: `null` iff no call to this model was\n * priced.\n */\nexport interface GraphSpecModelUsage {\n inference_model_name: string;\n inference_model_id: string;\n /**\n * Kind of inference: `\"llm\"`, `\"judgment\"`, `\"img_gen\"`, `\"extract\"`, `\"search\"`.\n * Open set. pipelex counts a model per model type and name, so one name can appear\n * twice in a `by_model` list, once per type it ran as.\n *\n * The discriminator to check before displaying token counts: `\"llm\"` and\n * `\"judgment\"` report the tokens they were billed for, while the rest are billed\n * PER REQUEST, and pipelex encodes that price by putting `1_000_000` in each token\n * category (rates are per-million), so those \"tokens\" are a scaled request counter\n * rather than a measurement. `hasRealTokenCounts` in `usageFormat.ts` holds the list.\n */\n model_type: string;\n inference_calls: number;\n rated_inference_calls: number;\n cost: number | null;\n}\n\nexport interface GraphSpecNodeUsage {\n inference_calls: number;\n rated_inference_calls: number;\n nb_tokens_by_category: Record<string, number>;\n total_tokens: number;\n cost: number | null;\n /** Components of `cost`; `input` is the joined input cost (non-cached + cached). */\n cost_input: number | null;\n cost_output: number | null;\n /**\n * The models that actually ran, most-used first. A list because one node\n * routinely uses more than one — a PipeLLM's text pass and its object pass\n * resolve separately — so `by_model[0]` is the dominant model, not \"the\" model.\n */\n by_model: GraphSpecModelUsage[];\n subtree_inference_calls: number;\n subtree_rated_inference_calls: number;\n subtree_nb_tokens_by_category: Record<string, number>;\n subtree_total_tokens: number;\n subtree_cost: number | null;\n subtree_cost_input: number | null;\n subtree_cost_output: number | null;\n /** Every model this node's whole branch used. */\n subtree_by_model: GraphSpecModelUsage[];\n}\n\n/**\n * Run-level usage for a whole spec — the mirror of pipelex's `GraphUsageSpec`.\n *\n * `total` covers every call the run reported, attributed or not. `unattributed`\n * is the part that named no live node; on a healthy run it is zeroed, and a\n * non-zero one is worth surfacing rather than hiding. Neither has a subtree\n * distinct from itself, so their `subtree_*` fields repeat their own.\n */\nexport interface GraphSpecUsage {\n total: GraphSpecNodeUsage;\n unattributed: GraphSpecNodeUsage;\n}\n\nexport interface GraphSpecNode {\n id: string;\n kind: NodeKind;\n pipe_code?: string;\n pipe_type: NodePipeType;\n description?: string;\n /**\n * The pipe's `activity`: the present-tense words a person watching the run\n * reads for this step (\"Reading the NDA\"), shown in place of its description\n * (MTHDS, \"What a Run Shows\"). Absent when the pipe states none;\n * `validateGraphSpec` drops a `null` one.\n */\n activity?: string;\n domain_code?: string;\n status: PipeStatus;\n timing?: GraphSpecNodeTiming;\n io: GraphSpecNodeIo;\n /**\n * Why a failed node failed: the MTHDS Protocol's problem document, the one\n * error shape every conforming runtime emits. The viewer reads its core\n * members only — `title`, `detail`, `code`, `next_step` and `location` — so\n * a problem from any runtime renders, and the members a runtime adds of its\n * own are kept as received and never read. `validateGraphSpec` refuses a\n * present one that lacks a required core member, and drops a `null` one.\n */\n error?: Problem;\n tags?: Record<string, string>;\n metrics?: Record<string, number>;\n usage?: GraphSpecNodeUsage;\n execution_data?: Record<string, unknown>;\n}\n\n/**\n * A pipe-call node: a controller or an operator. Narrowed from `GraphSpecNode`\n * for code paths that only ever render pipe-call nodes, where `pipe_code` is\n * guaranteed (validateGraphSpec enforces this).\n */\nexport type PipeCallNode = GraphSpecNode & {\n kind: \"controller\" | \"operator\";\n pipe_code: string;\n pipe_type: PipeType;\n};\n\n/**\n * A binding node: a PipeSequence's binding step, which runs no pipe. Its\n * `pipe_code` is the step's `from` path (`invoice.total`), its one input the\n * root the path starts from, and its one output the stuff it binds, under the\n * step's `result`. A binding that bound nothing, because the path held nothing,\n * has no output; one whose root was absent has no input; a failed one may have\n * neither. The graph draws it all the same. It is never a controller: nothing\n * is contained in it.\n */\nexport type BindingNode = GraphSpecNode & {\n kind: \"binding\";\n pipe_code: string;\n pipe_type: BindingStepType;\n};\n\n/** A node the graph draws as a card: a pipe-call node or a binding node. */\nexport type CardNode = PipeCallNode | BindingNode;\n\n/** Whether a node is a binding step's node. */\nexport function isBindingNode(node: Pick<GraphSpecNode, \"kind\">): boolean {\n return node.kind === \"binding\";\n}\n\n/**\n * The pipe a problem says failed: the code its `location` names, when it names\n * one. A problem that locates no pipe leaves the failure unplaced, and nothing\n * guesses where it happened.\n */\nexport function problemFailingPipe(problem: Problem): string | undefined {\n const pipe = problem.location?.pipe;\n return typeof pipe === \"string\" && pipe.length > 0 ? pipe : undefined;\n}\n\n/**\n * Whether a node is the pipe its run failed in: it failed, and its own problem's\n * `location` names its own pipe. A controller fails when a pipe beneath it does,\n * and the problem it carries locates the failure beneath it, so of all the\n * failed nodes of a run only the pipe at fault is marked. The test is per node,\n * so of a batch's runs of one pipe, only the run that failed is.\n *\n * A binding node is never the failing pipe, because a binding step is no pipe:\n * its problem locates the sequence holding it. Its `pipe_code` is its `from`\n * path, which can spell that sequence's code, so the test refuses it by its\n * kind rather than trusting the names to differ.\n */\nexport function isFailingPipeNode(\n node: Pick<GraphSpecNode, \"kind\" | \"status\" | \"pipe_code\" | \"error\">,\n): boolean {\n if (isBindingNode(node) || node.status !== \"failed\" || !node.error) return false;\n const pipe = problemFailingPipe(node.error);\n return pipe !== undefined && pipe === node.pipe_code;\n}\n\nexport type GraphSpecEdgeKind =\n | \"contains\"\n | \"data\"\n | \"control\"\n | \"selected_outcome\"\n | \"batch_item\"\n | \"batch_aggregate\"\n | \"parallel_combine\";\n\nexport interface GraphSpecEdge {\n id: string;\n source: string;\n target: string;\n kind: GraphSpecEdgeKind;\n label?: string;\n source_stuff_digest?: string;\n target_stuff_digest?: string;\n meta?: Record<string, unknown>;\n}\n\n// ─── Concept and Pipe registry types ───────────────────────────────────────\n// Serialized from Python Concept and PipeAbstract instances via model_dump().\n//\n// Every field pipelex writes as `T | null` is declared `field?: T | null` here,\n// optional as well as nullable. Unlike `usage`, the registries cross the boundary\n// unvalidated, and a host that drops `null` values from the JSON it relays (ChatGPT\n// does, on the way to an MCP App view) delivers such a field with the key absent.\n// The optional marker is what makes the compiler refuse a strict `!== null` test\n// followed by a dereference.\n\n/**\n * A concept as the registry serializes it. A field that can be `null` is also\n * declared optional, because a host that drops `null` values delivers it absent:\n * test it with `!= null`, optional chaining or truthiness.\n */\nexport interface ConceptInfo {\n code: string;\n domain_code: string;\n description: string;\n structure_class_name: string;\n refines?: string | null;\n json_schema?: Record<string, unknown>;\n}\n\n/**\n * Presence of a value in a declared slot, mirroring the runtime's\n * `PresenceMarker`: `plain` (always present), `optional` (the `?` suffix — the\n * slot may legitimately hold no value), `force` (the `!` suffix — a use-site\n * assertion that the value must be present). The runtime defaults the field to\n * `plain`, so an absent `presence` reads as plain.\n */\nexport type PresenceMarker = \"plain\" | \"optional\" | \"force\";\n\nexport interface StuffSpecInfo {\n concept: ConceptInfo;\n multiplicity?: StuffMultiplicity;\n presence?: PresenceMarker;\n}\n\n// ─── Template blueprint (shared by LLM prompts, Search, Compose, ImgGen) ───\n\nexport interface TemplateBlueprint {\n template: string;\n templating_style?: string | null;\n category: string;\n extra_context?: Record<string, unknown> | null;\n}\n\n// ─── Sub-pipe (used by Sequence, Parallel, Batch) ──────────────────────\n\nexport interface SubPipeSpec {\n pipe_code: string;\n output_name?: string | null;\n output_multiplicity?: string | number | boolean | null;\n batch_params?: { input_list_stuff_name: string; input_item_stuff_name: string } | null;\n}\n\n/**\n * A PipeSequence binding step, as the runtime holds it and the registry\n * serializes it: the value at `from_path` stored under `output_name`. A step\n * whose `batch_over` is a dotted path is held as such a binding, under a\n * private `_bound_…` name and with `is_dotted_batch_over` set, followed by the\n * same pipe step batching over that name.\n */\nexport interface BindingStepSpec {\n from_path: string;\n output_name: string;\n is_dotted_batch_over?: boolean;\n}\n\n/** One step of a PipeSequence: a pipe step, or a binding step. */\nexport type SequenceStepSpec = SubPipeSpec | BindingStepSpec;\n\n/** Whether a sequence step is a binding step, which carries a `from_path` and runs no pipe. */\nexport function isBindingStepSpec(step: SequenceStepSpec): step is BindingStepSpec {\n return \"from_path\" in step;\n}\n\n// ─── The words a method gives people for a code ───────────────────────────\n\n/**\n * How an outcome or a choice option reads to a person (MTHDS, \"Choice\n * Options\"): never a colour. Each renderer maps a tone to its own style role,\n * here the `--positive`, `--caution`, `--negative` and `--neutral` tokens.\n */\nexport const OUTCOME_TONE = {\n POSITIVE: \"positive\",\n CAUTION: \"caution\",\n NEGATIVE: \"negative\",\n NEUTRAL: \"neutral\",\n} as const;\n\nexport type OutcomeTone = (typeof OUTCOME_TONE)[keyof typeof OUTCOME_TONE];\n\nconst OUTCOME_TONES: ReadonlySet<string> = new Set<string>(Object.values(OUTCOME_TONE));\n\n/** Whether a value is one of the four tones; anything else, a newer runtime's word included, reads as no tone. */\nexport function isOutcomeTone(value: unknown): value is OutcomeTone {\n return typeof value === \"string\" && OUTCOME_TONES.has(value);\n}\n\n/**\n * The words an outcome table carries beside its pipe, as the runtime\n * serializes them: its name for people, what taking it means, and how it\n * reads. Each is presentation only and may be absent or null. `tone` is kept a\n * string because the registry crosses the boundary unvalidated: narrow it with\n * `isOutcomeTone`.\n */\nexport interface OutcomeWords {\n label?: string | null;\n description?: string | null;\n tone?: string | null;\n}\n\n// ─── PipeAbstract base (common to all pipe types) ──────────────────────\n\nexport interface PipeBlueprintBase {\n type: PipeType;\n pipe_category: \"PipeOperator\" | \"PipeController\";\n code: string;\n domain_code: string;\n description: string;\n /** The pipe's `activity`, the words a run view shows for it in place of its description; absent or null when it has none. */\n activity?: string | null;\n inputs: Record<string, StuffSpecInfo>;\n output: StuffSpecInfo;\n}\n\n// ─── Operator blueprints ───────────────────────────────────────────────\n\nexport interface PipeLLMBlueprint extends PipeBlueprintBase {\n type: \"PipeLLM\";\n llm_prompt_spec: {\n system_prompt_blueprint?: TemplateBlueprint | null;\n prompt_blueprint?: TemplateBlueprint | null;\n user_image_references?: unknown[] | null;\n user_document_references?: unknown[] | null;\n system_image_references?: unknown[] | null;\n system_document_references?: unknown[] | null;\n };\n llm_choices?: { for_text?: string | null; for_object?: string | null } | null;\n structuring_method?: string | null;\n output_multiplicity?: string | number | null;\n}\n\nexport interface PipeImgGenBlueprint extends PipeBlueprintBase {\n type: \"PipeImgGen\";\n img_gen_prompt_blueprint: {\n prompt_blueprint?: TemplateBlueprint | null;\n negative_prompt_blueprint?: TemplateBlueprint | null;\n image_references?: unknown[] | null;\n };\n img_gen_choice?: string | null;\n aspect_ratio?: string | null;\n is_raw?: boolean | null;\n seed?: number | string | null;\n background?: string | null;\n output_format?: string | null;\n output_multiplicity: number;\n}\n\n/**\n * A single field in a PipeCompose construct blueprint. Mirrors the\n * `ConstructFieldBlueprint` Pydantic model in pipelex. Exactly one of\n * `fixed_value` / `from_path` / `template` / `nested` is populated, matching\n * the `method` discriminator.\n *\n * - `fixed` → `fixed_value` holds a literal (string, number, bool, list)\n * - `from_var` → `from_path` holds a dotted path into working memory,\n * optionally with a `list_to_dict_keyed_by` modifier\n * - `template` → `template` holds a Jinja2 template string (per-field)\n * - `nested` → `nested` holds a recursive construct blueprint for building\n * nested structured content\n */\nexport interface PipeComposeConstructField {\n method: \"from_var\" | \"fixed\" | \"template\" | \"nested\";\n fixed_value?: unknown;\n from_path?: string | null;\n template?: string | null;\n nested?: PipeComposeConstructBlueprint | null;\n list_to_dict_keyed_by?: string | null;\n}\n\n/**\n * A PipeCompose construct blueprint, parsed from `[pipe.X.construct]` in MTHDS.\n * Mirrors the `ConstructBlueprint` Pydantic model in pipelex.\n */\nexport interface PipeComposeConstructBlueprint {\n fields: Record<string, PipeComposeConstructField>;\n}\n\n/**\n * Per-field record of how each field was built at runtime, emitted by\n * `PipeCompose._run_construct_mode` in pipelex via `execution_data.fields`.\n *\n * - `method` → which composition method was used (mirrors `ConstructFieldMethod`)\n * - `rendered` → present only for `template` fields, holds the Jinja2 output\n *\n * Nested fields record only their method; their sub-fields are not surfaced.\n */\nexport interface FieldResolution {\n method: \"from_var\" | \"fixed\" | \"template\" | \"nested\";\n rendered?: string;\n}\n\nexport interface PipeComposeBlueprint extends PipeBlueprintBase {\n type: \"PipeCompose\";\n /** Legacy monolithic template. Null when construct_blueprint is used instead. */\n template?: string | null;\n templating_style?: string | null;\n category: string;\n extra_context?: Record<string, unknown> | null;\n /** Field-level construct form (e.g. `[pipe.X.construct]` in MTHDS). */\n construct_blueprint?: PipeComposeConstructBlueprint | null;\n}\n\nexport interface PipeExtractBlueprint extends PipeBlueprintBase {\n type: \"PipeExtract\";\n extract_choice?: string | null;\n should_caption_images: boolean;\n max_page_images?: number | null;\n should_include_page_views: boolean;\n page_views_dpi?: number | null;\n render_js?: boolean | null;\n include_raw_html?: boolean | null;\n image_stuff_name?: string | null;\n document_stuff_name?: string | null;\n}\n\nexport interface PipeSearchBlueprint extends PipeBlueprintBase {\n type: \"PipeSearch\";\n search_choice?: string | null;\n prompt_blueprint: TemplateBlueprint;\n include_images_override?: boolean | null;\n max_results_override?: number | null;\n from_date?: string | null;\n to_date?: string | null;\n include_domains?: string[] | null;\n exclude_domains?: string[] | null;\n is_structured_output: boolean;\n}\n\nexport interface PipeFuncBlueprint extends PipeBlueprintBase {\n type: \"PipeFunc\";\n}\n\n/**\n * A PipeStructure: an LLM-backed operator that turns a single Text-compatible\n * input into a structured concept. Serialized from the runtime `PipeStructure`,\n * so the registry entry carries the runtime fields below alongside the base.\n */\nexport interface PipeStructureBlueprint extends PipeBlueprintBase {\n type: \"PipeStructure\";\n /**\n * LLM used to structure the text. A string model handle, an inline LLM\n * setting object, or null (→ resolved from the model deck's `for_object`\n * default at run time).\n */\n llm_choice?: string | Record<string, unknown> | null;\n /** The single Text-compatible input variable the structuring reads. */\n text_input_name: string;\n /** `true` → let the LLM decide the count, a number → fixed count, null → single object. */\n output_multiplicity?: boolean | number | null;\n}\n\n/**\n * The question a PipeJudge asks, as the runtime serializes it. Its `kind`\n * decides the verdict native the judge answers with: `yes_no` → `YesNo`,\n * `choice` → `Choice`, `rating` → `Rating`. `instructions` is the authored\n * question, still a template.\n */\nexport interface JudgmentQuestionSpec {\n kind: \"yes_no\" | \"choice\" | \"rating\";\n instructions: string;\n yes_criterion?: string | null;\n no_criterion?: string | null;\n options?: Record<string, string | null> | null;\n levels?: string[] | null;\n}\n\n/**\n * A PipeJudge: asks a judging model one closed question about its inputs and\n * stores the verdict native it answers with. Serialized from the runtime\n * `PipeJudge`.\n */\nexport interface PipeJudgeBlueprint extends PipeBlueprintBase {\n type: \"PipeJudge\";\n /** The judging model, a handle or an inline setting, or null for the deck's default. */\n judgment_choice?: string | Record<string, unknown> | null;\n judgment_question: JudgmentQuestionSpec;\n /** The probability a yes/no verdict must reach to read as yes, when the pipe declares one. */\n threshold?: number | null;\n}\n\n/**\n * A PipeDocGen: lays its inputs out as a stored document file, in the declared\n * format, and calls no AI model. Serialized from the runtime `PipeDocGen`.\n */\nexport interface PipeDocGenBlueprint extends PipeBlueprintBase {\n type: \"PipeDocGen\";\n /**\n * `pdf`, `xlsx`, `docx` or `pptx`. Kept a string: the viewer displays the token\n * and never branches on it, so one from a newer runtime shows as it is.\n */\n doc_gen_format: string;\n /** The engine the step names, or null for the deck's default. */\n doc_gen_choice?: string | Record<string, unknown> | null;\n /** The HTML template of a pdf step, inline or read from its template file. */\n template?: string | null;\n /** The template file as the method names it. */\n template_file?: string | null;\n /** The input whose file the step fills as its template, a workbook the run is given. */\n template_input?: string | null;\n /** How the step fills its workbook's Tables: `replace`, `append` or `update`. */\n table_fill?: string | null;\n /** The file name the document is stored under, a template. */\n filename?: string | null;\n}\n\n/**\n * A contract-only pipe: declares inputs + output but has no implementation.\n * Emitted under `--allow-signatures` so an in-progress bundle still validates\n * (dry-run mocks the declared output) before every referenced pipe is built.\n */\nexport interface PipeSignatureBlueprint extends Omit<PipeBlueprintBase, \"pipe_category\"> {\n type: \"PipeSignature\";\n /**\n * Signatures sit outside the executable taxonomy, so pipelex serializes\n * `pipe_category: null` (present, not omitted) — unlike operator/controller\n * blueprints which carry \"PipeOperator\" / \"PipeController\". Optional all the\n * same, since a host that drops `null` values delivers it absent.\n */\n pipe_category?: null;\n /** Intended downstream pipe type once implemented — an optional hint. */\n signature_for?: PipeType | null;\n}\n\n// ─── Controller blueprints ─────────────────────────────────────────────\n\nexport interface PipeSequenceBlueprint extends PipeBlueprintBase {\n type: \"PipeSequence\";\n /** Pipe steps and binding steps, in order — a dotted `batch_over` held as a binding then a batch. */\n sequential_sub_pipes: SequenceStepSpec[];\n}\n\nexport interface PipeParallelBlueprint extends PipeBlueprintBase {\n type: \"PipeParallel\";\n parallel_sub_pipes: SubPipeSpec[];\n add_each_output: boolean;\n /**\n * Removed from the language in pipelex 0.41 (a parallel always combines now),\n * so 0.41 registry dumps omit the key entirely. Optional rather than deleted\n * because the static builder still honors it as a legacy authoring key when\n * naming the combined stuff, which L-260929-1e09e0 removes.\n */\n combined_output?: string | null;\n}\n\nexport interface PipeConditionBlueprint extends PipeBlueprintBase {\n type: \"PipeCondition\";\n expression: string;\n /** Expression result → pipe reference (or `fail` / `continue`), whichever form each outcome was written in. */\n outcome_map: Record<string, string>;\n default_outcome: string;\n /**\n * The words an outcome table gives people, keyed like `outcome_map` (MTHDS,\n * \"Outcome Labels\"): only an outcome written as a table has an entry. Read\n * them with `outcomeWordsOf`.\n */\n outcome_words?: Record<string, OutcomeWords> | null;\n /** The words of `default_outcome`, when it is written as a table. */\n default_outcome_words?: OutcomeWords | null;\n add_alias_from_expression_to?: string | null;\n}\n\nexport interface PipeBatchBlueprint extends PipeBlueprintBase {\n type: \"PipeBatch\";\n branch_pipe_code: string;\n batch_params: { input_list_stuff_name: string; input_item_stuff_name: string };\n}\n\n/**\n * A pipe as the registry serializes it, discriminated on `type`. A field that can\n * be `null` is also declared optional, because a host that drops `null` values\n * delivers it absent: test it with `!= null`, optional chaining or truthiness.\n */\nexport type PipeBlueprintUnion =\n | PipeLLMBlueprint\n | PipeImgGenBlueprint\n | PipeComposeBlueprint\n | PipeExtractBlueprint\n | PipeSearchBlueprint\n | PipeFuncBlueprint\n | PipeStructureBlueprint\n | PipeJudgeBlueprint\n | PipeDocGenBlueprint\n | PipeSignatureBlueprint\n | PipeSequenceBlueprint\n | PipeParallelBlueprint\n | PipeConditionBlueprint\n | PipeBatchBlueprint;\n\n// ─── GraphSpec top-level ───────────────────────────────────────────────────\n\nexport interface GraphSpec {\n graph_id?: string;\n created_at?: string;\n pipeline_ref?: { domain?: string; main_pipe?: string; entrypoint?: string };\n nodes: GraphSpecNode[];\n edges: GraphSpecEdge[];\n usage?: GraphSpecUsage;\n meta?: GraphSpecMeta;\n pipe_registry?: Record<string, PipeBlueprintUnion>;\n concept_registry?: Record<string, ConceptInfo>;\n}\n\nexport function graphSpecMode(\n spec: Pick<GraphSpec, \"meta\"> | null | undefined,\n): GraphSpecMode | undefined {\n return spec?.meta?.mode;\n}\n\nexport function isStaticGraphSpec(spec: Pick<GraphSpec, \"meta\"> | null | undefined): boolean {\n return graphSpecMode(spec) === GRAPH_SPEC_MODE.STATIC;\n}\n\nexport function isDryGraphSpec(spec: Pick<GraphSpec, \"meta\"> | null | undefined): boolean {\n return graphSpecMode(spec) === GRAPH_SPEC_MODE.DRY;\n}\n\n// ─── Dataflow analysis result ───────────────────────────────────────────────\n\n/** One stuff as the dataflow analysis registers it, from the first io item naming its digest. */\nexport interface StuffRegistryEntry {\n name: string;\n concept?: string;\n multiplicity?: StuffMultiplicity;\n contentType?: string;\n}\n\nexport interface DataflowAnalysis {\n readonly stuffRegistry: Readonly<Record<string, StuffRegistryEntry>>;\n /**\n * Every operator that writes each stuff. Usually one; a condition's output has one per\n * outcome, because every outcome writes the condition's one slot and only one of them runs.\n */\n readonly stuffProducers: Readonly<Record<string, readonly string[]>>;\n readonly stuffConsumers: Readonly<Record<string, readonly string[]>>;\n readonly controllerNodeIds: ReadonlySet<string>;\n readonly childNodeIds: ReadonlySet<string>;\n readonly containmentTree: Readonly<Record<string, readonly string[]>>;\n}\n\n// ─── Graph configuration ────────────────────────────────────────────────────\n\nexport const GRAPH_DIRECTION = {\n TB: \"TB\",\n BT: \"BT\",\n LR: \"LR\",\n RL: \"RL\",\n} as const;\n\nexport type GraphDirection = (typeof GRAPH_DIRECTION)[keyof typeof GRAPH_DIRECTION];\n\nexport const EDGE_TYPE = {\n /** Bezier curve — ReactFlow v12 renamed this type from \"bezier\" to \"default\". */\n DEFAULT: \"default\",\n STEP: \"step\",\n STRAIGHT: \"straight\",\n SMOOTH_STEP: \"smoothstep\",\n} as const;\n\nexport type EdgeType = (typeof EDGE_TYPE)[keyof typeof EDGE_TYPE];\n\nexport const FOLD_MODE = {\n /** Every pipe controller folded into a single pipe card. */\n FOLDED: \"folded\",\n /** Every pipe controller expanded as a group wrapper. */\n EXPANDED: \"expanded\",\n /** Renderer decides — reserved for future heuristics; currently behaves like EXPANDED. */\n AUTO: \"auto\",\n} as const;\n\nexport type FoldMode = (typeof FOLD_MODE)[keyof typeof FOLD_MODE];\n\n/**\n * The *resolved* binary theme — the value that actually drives the palette and\n * the container class. `getPaletteForTheme` takes this. `system` is never a\n * resolved theme; it resolves to one of these via the environment.\n */\nexport const GRAPH_THEME = {\n DARK: \"dark\",\n LIGHT: \"light\",\n} as const;\n\nexport type GraphTheme = (typeof GRAPH_THEME)[keyof typeof GRAPH_THEME];\n\n/**\n * The user's theme *selection* — what the toolbar cycles, what gets persisted\n * and reported. `system` follows the host environment (browser `prefers-color-scheme`\n * or an injected `systemTheme`) and resolves to a binary `GraphTheme` at render\n * time. The `dark`/`light` overlap with `GraphTheme` is intentional: a resolved\n * theme is also a valid mode.\n */\nexport const GRAPH_THEME_MODE = {\n DARK: \"dark\",\n LIGHT: \"light\",\n SYSTEM: \"system\",\n} as const;\n\nexport type GraphThemeMode = (typeof GRAPH_THEME_MODE)[keyof typeof GRAPH_THEME_MODE];\n\n/**\n * Anchor for the built-in floating toolbar. The values match ReactFlow's\n * `PanelPosition` union exactly, so they pass straight to `<Panel position=…>`\n * (the React layer asserts that subset relationship at compile time). Orientation\n * is *derived* from the position, never configured independently — see\n * `toolbarOrientation`: only the two edge-center anchors are vertical, everything\n * else (corners + top/bottom-center) is a horizontal bar.\n *\n * `types.ts` stays React-free, so `PanelPosition` is intentionally NOT imported\n * here — the compatibility assertion lives in `GraphToolbar.tsx`.\n */\nexport const TOOLBAR_POSITION = {\n TOP_LEFT: \"top-left\",\n TOP_CENTER: \"top-center\",\n TOP_RIGHT: \"top-right\",\n BOTTOM_LEFT: \"bottom-left\",\n BOTTOM_CENTER: \"bottom-center\",\n BOTTOM_RIGHT: \"bottom-right\",\n CENTER_LEFT: \"center-left\",\n CENTER_RIGHT: \"center-right\",\n} as const;\n\nexport type ToolbarPosition = (typeof TOOLBAR_POSITION)[keyof typeof TOOLBAR_POSITION];\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * Derive the bar orientation from its anchor. \"Corners are horizontal, edges\n * decide the rest\": only `center-left` / `center-right` produce a vertical bar;\n * every other position (the four corners plus `top-center` / `bottom-center`) is\n * horizontal. Pure + React-free so it is unit-testable without rendering.\n */\nexport function toolbarOrientation(position: ToolbarPosition): ToolbarOrientation {\n return position === TOOLBAR_POSITION.CENTER_LEFT || position === TOOLBAR_POSITION.CENTER_RIGHT\n ? \"vertical\"\n : \"horizontal\";\n}\n\nexport type ToolbarSide = \"left\" | \"center\" | \"right\";\n\n// ─── Graph style ─────────────────────────────────────────────────────────────\n\n/**\n * How a graph is drawn: which nodes exist, what they say, what shapes they take\n * and how they are spaced. Orthogonal to the theme, the direction and the spec's\n * mode. `detailed` is the author's drawing (every pipe as a card with its slots,\n * every value as a node) and the default; `simple` is a flowchart of the\n * method's steps in the words its author declared, for a reader who designs or\n * reviews the method without reading its code. The registry of what each style\n * is called and supports is `GRAPH_STYLES` in `styles/graphStyles.ts`.\n */\nexport const GRAPH_STYLE = {\n DETAILED: \"detailed\",\n SIMPLE: \"simple\",\n} as const;\n\nexport type GraphStyleId = (typeof GRAPH_STYLE)[keyof typeof GRAPH_STYLE];\n\n/**\n * Derive which edge the anchor hugs. The built-in `DetailPanel` overlays the\n * right edge, so only right-side anchors (`*-right`) need to dodge it — the\n * toolbar reads this to decide whether to shift left while the panel is open.\n * Pure + React-free so it is unit-testable without rendering, and exhaustively\n * switched so adding a `TOOLBAR_POSITION` value without a side fails to compile\n * — exactly like {@link toolbarOrientation}.\n */\nexport function toolbarSide(position: ToolbarPosition): ToolbarSide {\n switch (position) {\n case TOOLBAR_POSITION.TOP_LEFT:\n case TOOLBAR_POSITION.CENTER_LEFT:\n case TOOLBAR_POSITION.BOTTOM_LEFT:\n return \"left\";\n case TOOLBAR_POSITION.TOP_RIGHT:\n case TOOLBAR_POSITION.CENTER_RIGHT:\n case TOOLBAR_POSITION.BOTTOM_RIGHT:\n return \"right\";\n case TOOLBAR_POSITION.TOP_CENTER:\n case TOOLBAR_POSITION.BOTTOM_CENTER:\n return \"center\";\n default: {\n const _exhaustive: never = position;\n return _exhaustive;\n }\n }\n}\n\n// ─── Validation status (toolbar widget) ──────────────────────────────────────\n\n/**\n * State of the toolbar's validation widget. The widget itself is opt-in: it\n * renders only when the host passes a `validationState` to `GraphViewer` —\n * `undefined` (the default) keeps it hidden entirely. The states describe the\n * host's validation lifecycle, not the static analyzer's: `validating` while a\n * verdict is being produced, `valid`/`invalid` once one exists, and `error`\n * when no verdict could be produced at all (validator unavailable, timeout…).\n * `unvalidated` is for a host with no validator at all, such as a page drawing\n * a method from its source: no verdict exists or is coming, and the issues are\n * what reading the source turned up.\n */\nexport const VALIDATION_STATE = {\n VALIDATING: \"validating\",\n VALID: \"valid\",\n INVALID: \"invalid\",\n ERROR: \"error\",\n UNVALIDATED: \"unvalidated\",\n} as const;\n\nexport type ValidationState = (typeof VALIDATION_STATE)[keyof typeof VALIDATION_STATE];\n\n/**\n * One issue row in the validation panel. Mostly presentation: the host decides\n * which issues to show for each state (its validator's errors, the static\n * analyzer's diagnostics, or a mix) and handles navigation on row click. The\n * only fields the viewer interprets are the optional targeting fields\n * (`pipeRef` / `nodeId`), which drive node decorations on the graph.\n */\nexport interface ValidationIssue {\n severity: \"error\" | \"warning\";\n message: string;\n /** Short locator chip, e.g. `pipe.analyze_candidate` or a TOML path. */\n context?: string;\n /** Owning-file basename, when the issue lives in a specific file. */\n file?: string;\n /** Human-readable suggested fix, when the validator derived one. */\n suggestedFix?: string;\n /** Which analyzer produced the issue: the host's validator or the static parser. */\n origin?: \"validator\" | \"static\";\n /**\n * Fully-qualified pipe ref (`domain_code.pipe_code`, see `makePipeRef`) this\n * issue targets — decorates every rendered node invoking that pipe (a pipe\n * can be invoked from several places in the graph). Always qualified, never a\n * bare code: two domains may declare the same pipe code, and a bare match\n * would ring every same-code node. An emitter that cannot qualify must leave\n * the issue untargeted (panel-only) rather than decorate by guess.\n */\n pipeRef?: string;\n /**\n * Precise invocation this issue targets — a GraphSpec node id (e.g.\n * `demo.main_flow/step_2`). Takes precedence over `pipeRef` when both are\n * set. Issues with neither targeting field stay panel-only.\n */\n nodeId?: string;\n}\n\n/**\n * Aggregated validation decoration for one rendered node — derived from the\n * targeted `ValidationIssue`s by `buildValidationDecorations` (worst severity\n * wins, folded controllers roll up their hidden descendants' issues). Rendered\n * as a severity ring + count badge on the node, with `lines` as the tooltip.\n */\nexport interface NodeValidationSummary {\n /** Worst severity among the node's issues (`error` wins over `warning`). */\n severity: \"error\" | \"warning\";\n /** Number of issue hits on the node (a multi-instance pipe counts per invocation). */\n count: number;\n /** Tooltip lines: each issue's message, followed by a `Fix: …` line when present. */\n lines: string[];\n}\n\nexport interface GraphConfig {\n direction?: GraphDirection;\n showControllers?: boolean;\n foldMode?: FoldMode;\n /**\n * Theme *mode*: `dark | light | system`. `system` follows the host environment.\n * Defaults to `system` (see `DEFAULT_GRAPH_CONFIG`). Pass `dark`/`light` to pin\n * a fixed appearance.\n */\n theme?: GraphThemeMode;\n /**\n * Anchor for the built-in floating toolbar (default `top-right`). Orientation\n * is derived from the position — see {@link toolbarOrientation}. The\n * `toolbarPosition` *prop* on `GraphViewer` takes precedence over this; both\n * are reactive and persistence is the host's responsibility.\n */\n toolbarPosition?: ToolbarPosition;\n /**\n * The style the graph is drawn in (default `detailed`). The `graphStyle` prop\n * on `GraphViewer` takes precedence over this; both are reactive, and a value\n * that names no registered style falls back to the default rather than\n * throwing, since it may come from an untyped source such as an editor\n * setting. Persistence is the host's responsibility.\n */\n graphStyle?: GraphStyleId;\n /** Space between sibling nodes, for the styles that keep the host's spacing (`detailed`). */\n nodesep?: number;\n /** Space between ranks, for the styles that keep the host's spacing (`detailed`). */\n ranksep?: number;\n edgeType?: EdgeType;\n initialZoom?: number | null;\n panToTop?: boolean;\n paletteColors?: Record<string, string>;\n}\n\n// ─── Label descriptors ──────────────────────────────────────────────────────\n// Plain objects, no React dependency. GraphViewer maps these to React elements.\n\nexport type LabelDescriptor =\n | { kind: \"pipe\"; label: string; isFailed: boolean }\n | { kind: \"stuff\"; label: string; concept: string };\n\n// ─── Fold toggle options ────────────────────────────────────────────────────\n// Passed by UI click handlers so the orchestrator can decide whether the\n// toggle should propagate to \"cousin\" controllers (other instances of the\n// same pipe) or affect only the clicked one.\n\nexport interface FoldToggleOptions {\n /**\n * When `true`, the toggle applies only to the clicked controller — its\n * cousins (other controller nodes sharing the same `pipe_code`) are left\n * untouched. Wired to the alt/option modifier key in the click handlers.\n */\n soloMode?: boolean;\n}\n\n// ─── Pipe card payload ──────────────────────────────────────────────────────\n// Built by graphBuilders, consumed by PipeCardNode in the React layer.\n\nexport interface PipeCardPayload {\n /** The pipe code, or the `from` path of a binding step's card. */\n pipeCode: string;\n pipeType: NodePipeType;\n description?: string;\n status: PipeStatus;\n graphMode?: GraphSpecMode;\n inputs: { name: string; concept: string }[];\n outputs: { name: string; concept: string }[];\n /** Authored/static annotations and runtime tags carried by the GraphSpec node. */\n tags?: Record<string, string>;\n /**\n * The document format a `PipeDocGen` step declares (`pdf`, `xlsx`, `docx`,\n * `pptx`), read from its blueprint; absent for any other step, and when the\n * graph carries no registry to read it from.\n */\n docGenFormat?: string;\n /**\n * Set when the card's node is the pipe its run failed in (`isFailingPipeNode`):\n * the card wears the failing-pipe ring. Absent on every other card, a failed\n * controller above the failing pipe included.\n */\n failingPipe?: true;\n /** Layout direction, injected by the layout engine: narrow and tall in LR, wide and short in TB. */\n direction?: \"LR\" | \"TB\";\n /** When set, the card renders an unfold button that invokes this callback. */\n onExpand?: (options?: FoldToggleOptions) => void;\n /** Validation decoration (severity ring + count badge), stamped by GraphViewer. */\n validation?: NodeValidationSummary;\n /** Badge click handler (opens the validation panel), stamped alongside `validation`. */\n onValidationBadgeClick?: () => void;\n}\n\n// ─── Simple style payload ───────────────────────────────────────────────────\n// Built by the simple style's projection (`styles/simpleStyle.ts`), consumed by\n// its node components in the React layer.\n\n/**\n * What a step of the simple style is, in a reader's terms rather than a pipe\n * class's: each category has a plain word and an icon. `steps`, `parallel`,\n * `decision` and `repeat` name a folded controller, drawn as one step, and\n * `pick` a binding step, drawn only when it failed.\n */\nexport const STEP_CATEGORY = {\n AI: \"ai\",\n EXTRACT: \"extract\",\n IMAGE: \"image\",\n SEARCH: \"search\",\n CODE: \"code\",\n TEMPLATE: \"template\",\n DOCUMENT: \"document\",\n JUDGE: \"judge\",\n PLANNED: \"planned\",\n STEPS: \"steps\",\n PARALLEL: \"parallel\",\n DECISION: \"decision\",\n REPEAT: \"repeat\",\n PICK: \"pick\",\n} as const;\n\nexport type StepCategory = (typeof STEP_CATEGORY)[keyof typeof STEP_CATEGORY];\n\n/**\n * How a step's title is set: the box width and the type the layout sized the\n * step for, which the drawing must use for the two to agree.\n */\nexport interface SimpleTitleFit {\n boxWidth: number;\n fontPx: number;\n lineHeightPx: number;\n /** The lines the title may take; a title needing more is cut with an ellipsis. */\n maxLines: number;\n}\n\n/** What one node of the simple style says, discriminated on `kind`. All text is plain, never an identifier. */\nexport type SimpleNodePayload =\n | {\n kind: \"step\";\n /** The pipe's authored description, or its humanized code when it has none. */\n title: string;\n /** The size the title is set at: one rung of `SIMPLE_STEP_TITLE_FITS`. */\n titleFit: SimpleTitleFit;\n category: StepCategory;\n status: PipeStatus;\n graphMode?: GraphSpecMode;\n /** \"For each page\" when the step runs once per item of a list. */\n forEach?: string;\n /** For a folded controller: how many steps it holds. */\n innerStepCount?: number;\n /** For a folded controller: unfolds it. */\n onExpand?: (options?: FoldToggleOptions) => void;\n }\n | {\n kind: \"input\" | \"output\";\n title: string;\n /** The concept's plain name, when it says something the title does not. */\n subtitle?: string;\n /** Whether the value is a list, drawn as a stack. */\n isList: boolean;\n }\n | {\n kind: \"decision\";\n title: string;\n status: PipeStatus;\n graphMode?: GraphSpecMode;\n }\n | {\n kind: \"frame\";\n /** \"For each record\". */\n title: string;\n status: PipeStatus;\n graphMode?: GraphSpecMode;\n /** Folds the frame into one step. */\n onFold?: (options?: FoldToggleOptions) => void;\n };\n\n// ─── Graph node data ────────────────────────────────────────────────────────\n// Extends Record<string, unknown> for ReactFlow's Node<T> generic parameter.\n\nexport type StuffRole = \"input\" | \"output\" | \"combined\";\n\nexport interface GraphNodeData extends Record<string, unknown> {\n labelDescriptor?: LabelDescriptor;\n label?: unknown;\n nodeData?: GraphSpecNode;\n isPipe: boolean;\n isStuff: boolean;\n isController?: boolean;\n labelText: string;\n pipeCode?: string;\n pipeType?: NodePipeType;\n graphMode?: GraphSpecMode;\n pipeCardData?: PipeCardPayload;\n /**\n * For a controller group: set when the controller is itself the pipe its run\n * failed in (`isFailingPipeNode`), so the group wears the failing-pipe ring. A\n * card carries the same fact on its `pipeCardData`.\n */\n failingPipe?: true;\n /** For stuff nodes: \"input\" (no producer), \"output\" (no consumer), or undefined (intermediate). */\n stuffRole?: StuffRole;\n /** For stuff nodes: the digest used to build the node ID. */\n stuffDigest?: string;\n /** Validation decoration (severity ring + count badge), stamped by GraphViewer. */\n validation?: NodeValidationSummary;\n /** Badge click handler (opens the validation panel), stamped alongside `validation`. */\n onValidationBadgeClick?: () => void;\n /** What a node of the simple style says (see `SimpleNodePayload`); absent in the detailed style. */\n simple?: SimpleNodePayload;\n /**\n * A size the node's producer fixed for layout, used instead of the estimate\n * `estimateNodeDimensions` makes from the node's content. The simple style\n * fixes the size of each of its nodes, because it knows its own text metrics.\n */\n layoutSize?: { width: number; height: number };\n}\n\n// ─── Graph node / edge / data ───────────────────────────────────────────────\n\nexport interface GraphNode {\n id: string;\n type: string;\n data: GraphNodeData;\n position: { x: number; y: number };\n style?: Record<string, string | number>;\n sourcePosition?: \"top\" | \"bottom\" | \"left\" | \"right\";\n targetPosition?: \"top\" | \"bottom\" | \"left\" | \"right\";\n parentId?: string;\n extent?: \"parent\";\n selected?: boolean;\n}\n\nexport interface GraphEdge {\n id: string;\n source: string;\n target: string;\n type: string;\n animated?: boolean;\n label?: string;\n labelStyle?: Record<string, string | number>;\n labelBgStyle?: Record<string, string | number>;\n labelBgPadding?: [number, number];\n labelBgBorderRadius?: number;\n style?: Record<string, string | number>;\n markerEnd?: { type: string; color: string };\n _batchEdge?: boolean;\n _crossGroup?: boolean;\n /**\n * The size the edge's label is drawn at, background included, for a layout\n * that reserves room for labels (`LayoutConfig.routeEdges`). Like a node's\n * `layoutSize`, it is fixed by the style that knows its own text metrics.\n */\n labelSize?: { width: number; height: number };\n /** The route the layout computed for the edge, when it was asked to (`LayoutConfig.routeEdges`). */\n route?: EdgeRoute;\n /**\n * For a style that draws values as arrows rather than nodes, the simple\n * style: the digests of the values this arrow carries, in the order they\n * were routed. An arrow joins two nodes once, so it may carry several; a\n * decision's arrow to a branch that reads nothing from before the decision\n * carries none.\n */\n carries?: string[];\n /**\n * For the simple style, on a decision's arrow: the outcomes it is taken on,\n * each a key of the condition's outcome map or `null` for its default\n * outcome. It identifies the branch, where `label` only says it.\n */\n outcomes?: (string | null)[];\n}\n\n/** A point in flow coordinates. */\nexport interface GraphPoint {\n x: number;\n y: number;\n}\n\n/**\n * An edge's route as the layout computed it, in absolute flow coordinates:\n * from the source's port to the target's, through every bend, and the box the\n * layout placed its label in.\n */\nexport interface EdgeRoute {\n points: GraphPoint[];\n /** The label's box: its top-left corner and its size. Absent for an edge without a label. */\n label?: { x: number; y: number; width: number; height: number };\n}\n\nexport interface GraphData {\n nodes: GraphNode[];\n edges: GraphEdge[];\n}\n\n// ─── Layout ─────────────────────────────────────────────────────────────────\n\nexport interface LayoutConfig {\n nodesep?: number;\n ranksep?: number;\n /**\n * Route every edge around the nodes in its way, reserve room for the labels\n * of the edges that carry a `labelSize`, and return each route on its edge\n * (`GraphEdge.route`). Off by default: the detailed style draws its edges as\n * free curves between their ends.\n */\n routeEdges?: boolean;\n /**\n * The room a group keeps around its children (a controller group, or a\n * style's frame), before the deeper groups' scaling. Defaults to\n * `CONTROLLER_PADDING_X`, `CONTROLLER_PADDING_TOP` and `CONTROLLER_PADDING_BOTTOM`.\n */\n groupPadding?: { x: number; top: number; bottom: number };\n}\n\n// Controller padding constants (shared between layout and controller modules)\nexport const CONTROLLER_PADDING_X = 40;\nexport const CONTROLLER_PADDING_TOP = 48;\nexport const CONTROLLER_PADDING_BOTTOM = 20;\n\n// Default marker type string (avoids ReactFlow dependency in pure modules)\nexport const ARROW_CLOSED_MARKER = \"arrowclosed\";\n\n// ─── Node dimension helpers ─────────────────────────────────────────────────\n// Extract dimensions from style. Used by buildControllerNodes.\n// NOT used by getLayoutedElements, which estimates dimensions before styles exist.\n\nexport function nodeWidth(n: GraphNode): number {\n const raw = n.style?.width;\n if (raw == null) return 200;\n const w = typeof raw === \"number\" ? raw : parseFloat(raw);\n return isNaN(w) || w <= 0 ? 200 : w;\n}\n\nexport function nodeHeight(n: GraphNode): number {\n const raw = n.style?.height;\n if (raw != null) {\n const h = typeof raw === \"number\" ? raw : parseFloat(raw);\n if (!isNaN(h) && h > 0) return h;\n }\n return n.data?.isStuff ? 60 : 70;\n}\n"],"mappings":";AA4BA,IAAM,qBAA6C;AAAA,EACjD,SAAS;AAAA,EACT,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AACb;AAGO,IAAM,mBAAwC,IAAI,IAAI,OAAO,KAAK,kBAAkB,CAAC;AAQrF,IAAM,oBAAoB;AAW1B,IAAM,kBAAkB;AAAA,EAC7B,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ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
|
5
5
|
GRAPH_STYLE
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BQZ3BPJM.js";
|
|
7
7
|
|
|
8
8
|
// src/graph/styles/graphStyles.ts
|
|
9
9
|
var GRAPH_STYLES = {
|
|
@@ -52,4 +52,4 @@ export {
|
|
|
52
52
|
resolveGraphStyle,
|
|
53
53
|
resolveStyleMenu
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-KKT6OVO6.js.map
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
WORDING_SOURCE,
|
|
3
|
+
activityTitle,
|
|
4
|
+
branchOutcomeWords,
|
|
5
|
+
conditionBranches,
|
|
2
6
|
humanizeInSentence,
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
isPlumbingStep,
|
|
8
|
+
outcomeTone,
|
|
9
|
+
outcomeWordsOf,
|
|
10
|
+
registryConceptLookup,
|
|
11
|
+
stepWording
|
|
12
|
+
} from "./chunk-UVEGKTBU.js";
|
|
5
13
|
import {
|
|
6
14
|
isBindingStepSpec
|
|
7
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BQZ3BPJM.js";
|
|
8
16
|
import {
|
|
9
17
|
__spreadProps,
|
|
10
18
|
__spreadValues
|
|
@@ -662,8 +670,23 @@ function joinedSequence(registry, node) {
|
|
|
662
670
|
return sequence && sequenceMatches(sequence, node) ? sequence : null;
|
|
663
671
|
}
|
|
664
672
|
function titleOf(registry, pipeRef, pipeCode = pipeRef) {
|
|
665
|
-
|
|
666
|
-
|
|
673
|
+
return stepWording(pipeOf(registry, pipeRef), pipeCode);
|
|
674
|
+
}
|
|
675
|
+
var CONCEPT_LOOKUPS = /* @__PURE__ */ new WeakMap();
|
|
676
|
+
function conceptLookupOf(registry) {
|
|
677
|
+
if (!registry) return void 0;
|
|
678
|
+
let lookup = CONCEPT_LOOKUPS.get(registry);
|
|
679
|
+
if (!lookup) {
|
|
680
|
+
lookup = registryConceptLookup(registry);
|
|
681
|
+
CONCEPT_LOOKUPS.set(registry, lookup);
|
|
682
|
+
}
|
|
683
|
+
return lookup;
|
|
684
|
+
}
|
|
685
|
+
function isPlumbingPipe(registry, pipeType, pipe) {
|
|
686
|
+
return isPlumbingStep(pipeType, pipe, conceptLookupOf(registry));
|
|
687
|
+
}
|
|
688
|
+
function isPlumbingRef(registry, pipeRef, pipeType) {
|
|
689
|
+
return isPlumbingPipe(registry, pipeType, pipeOf(registry, pipeRef));
|
|
667
690
|
}
|
|
668
691
|
function joinBatch(registry, node, parentSequence) {
|
|
669
692
|
var _a, _b;
|
|
@@ -688,7 +711,8 @@ function joinBatch(registry, node, parentSequence) {
|
|
|
688
711
|
});
|
|
689
712
|
branchRef = (_b = item == null ? void 0 : item.invocation.pipe_ref) != null ? _b : null;
|
|
690
713
|
}
|
|
691
|
-
const
|
|
714
|
+
const own = activityTitle(batch);
|
|
715
|
+
const title = own ? { title: own, source: WORDING_SOURCE.ACTIVITY } : branchRef ? titleOf(registry, branchRef) : stepWording(null, invocation.pipe_code);
|
|
692
716
|
return { branchRef, title, itemName: itemName ? humanizeInSentence(itemName) : null };
|
|
693
717
|
}
|
|
694
718
|
|
|
@@ -755,7 +779,7 @@ function isActiveState(state) {
|
|
|
755
779
|
function isBatchNode(node) {
|
|
756
780
|
return node.invocation.pipe_type === "PipeBatch" || node.invocation.batch !== void 0 || node.children.some(isItemNode);
|
|
757
781
|
}
|
|
758
|
-
function kindOfNode(node) {
|
|
782
|
+
function kindOfNode(ctx, node) {
|
|
759
783
|
if (isBatchNode(node)) return SIMPLE_LINE_KIND.FOR_EACH;
|
|
760
784
|
switch (node.invocation.pipe_type) {
|
|
761
785
|
case "PipeSequence":
|
|
@@ -765,7 +789,7 @@ function kindOfNode(node) {
|
|
|
765
789
|
case "PipeCondition":
|
|
766
790
|
return SIMPLE_LINE_KIND.DECISION;
|
|
767
791
|
default:
|
|
768
|
-
return node.
|
|
792
|
+
return shownChildren(ctx, node).length > 0 ? SIMPLE_LINE_KIND.GROUP : SIMPLE_LINE_KIND.STEP;
|
|
769
793
|
}
|
|
770
794
|
}
|
|
771
795
|
function kindOfPipe(pipe, batching) {
|
|
@@ -841,13 +865,43 @@ function healthOf(state, own, hidden, showProblem, items = { retrying: 0, stuck:
|
|
|
841
865
|
};
|
|
842
866
|
return hasHealth(health) ? health : null;
|
|
843
867
|
}
|
|
868
|
+
function hidesAsPlumbing(ctx, invocation) {
|
|
869
|
+
if (ctx.showPlumbing) return false;
|
|
870
|
+
if (!isPlumbingRef(ctx.registry, invocation.pipe_ref, invocation.pipe_type)) return false;
|
|
871
|
+
return !(invocation.status === INVOCATION_STATUS.FAILED || isRetrying(invocation) || invocation.degradation !== void 0);
|
|
872
|
+
}
|
|
873
|
+
function isPlumbingUpcoming(ctx, step) {
|
|
874
|
+
if (ctx.showPlumbing || step.spec.batch_params) return false;
|
|
875
|
+
const pipe = pipeOf(ctx.registry, step.pipeRef);
|
|
876
|
+
return pipe !== null && isPlumbingPipe(ctx.registry, pipe.type, pipe);
|
|
877
|
+
}
|
|
878
|
+
function shownChildren(ctx, node) {
|
|
879
|
+
return node.children.filter((child) => !hidesAsPlumbing(ctx, child.invocation));
|
|
880
|
+
}
|
|
881
|
+
function outcomeOf2(ctx, conditionRef, key, resolved) {
|
|
882
|
+
var _a, _b;
|
|
883
|
+
const condition = conditionRef ? pipeOf(ctx.registry, conditionRef) : null;
|
|
884
|
+
const branch = !resolved && (condition == null ? void 0 : condition.type) === "PipeCondition" ? conditionBranches(condition).find(({ outcomes }) => outcomes[0] === key) : void 0;
|
|
885
|
+
if (branch && branch.outcomes.length > 1) {
|
|
886
|
+
const { description, tone } = branchOutcomeWords(condition, branch.outcomes);
|
|
887
|
+
return { key, resolved, label: branch.label, description, tone };
|
|
888
|
+
}
|
|
889
|
+
const words = outcomeWordsOf(condition, key);
|
|
890
|
+
return {
|
|
891
|
+
key,
|
|
892
|
+
resolved,
|
|
893
|
+
label: (_a = words == null ? void 0 : words.label) != null ? _a : null,
|
|
894
|
+
description: (_b = words == null ? void 0 : words.description) != null ? _b : null,
|
|
895
|
+
tone: outcomeTone(words)
|
|
896
|
+
};
|
|
897
|
+
}
|
|
844
898
|
function blankLine(key, kind, state, title) {
|
|
845
899
|
return {
|
|
846
900
|
key,
|
|
847
901
|
kind,
|
|
848
902
|
state,
|
|
849
903
|
title: title.title,
|
|
850
|
-
|
|
904
|
+
titleSource: title.source,
|
|
851
905
|
forEachItem: null,
|
|
852
906
|
outcome: null,
|
|
853
907
|
counts: null,
|
|
@@ -875,23 +929,25 @@ function upcomingLine(ctx, sequencePath, step) {
|
|
|
875
929
|
if (batching && itemName) line.forEachItem = humanizeInSentence(itemName);
|
|
876
930
|
return line;
|
|
877
931
|
}
|
|
878
|
-
function branchOutcome(node, parent) {
|
|
932
|
+
function branchOutcome(ctx, node, parent) {
|
|
879
933
|
if (!isOutcomeNode(node)) return null;
|
|
880
934
|
if ((parent == null ? void 0 : parent.invocation.condition) && parent.children.filter(isOutcomeNode).length === 1) {
|
|
881
935
|
return null;
|
|
882
936
|
}
|
|
883
937
|
const segment = node.segment;
|
|
884
|
-
return
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
938
|
+
return outcomeOf2(
|
|
939
|
+
ctx,
|
|
940
|
+
parent == null ? void 0 : parent.invocation.pipe_ref,
|
|
941
|
+
(segment == null ? void 0 : segment.kind) === PATH_SEGMENT_KIND.OUTCOME ? segment.key : null,
|
|
942
|
+
false
|
|
943
|
+
);
|
|
888
944
|
}
|
|
889
|
-
function deepestBeneath(node, state) {
|
|
945
|
+
function deepestBeneath(ctx, node, state) {
|
|
890
946
|
let found = null;
|
|
891
947
|
let foundDepth = -1;
|
|
892
948
|
const visit = (current) => {
|
|
893
949
|
for (const child of current.children) {
|
|
894
|
-
if (stateOf(child.invocation) === state) {
|
|
950
|
+
if (stateOf(child.invocation) === state && !hidesAsPlumbing(ctx, child.invocation)) {
|
|
895
951
|
const depth = invocationPathDepth(child.invocation.path);
|
|
896
952
|
if (depth > foundDepth) {
|
|
897
953
|
found = child;
|
|
@@ -907,7 +963,7 @@ function deepestBeneath(node, state) {
|
|
|
907
963
|
function nowLine(ctx, node) {
|
|
908
964
|
var _a;
|
|
909
965
|
const [first, second] = stateOf(node.invocation) === SIMPLE_LINE_STATE.FAILED ? [SIMPLE_LINE_STATE.FAILED, SIMPLE_LINE_STATE.RUNNING] : [SIMPLE_LINE_STATE.RUNNING, SIMPLE_LINE_STATE.FAILED];
|
|
910
|
-
const target = (_a = deepestBeneath(node, first)) != null ? _a : deepestBeneath(node, second);
|
|
966
|
+
const target = (_a = deepestBeneath(ctx, node, first)) != null ? _a : deepestBeneath(ctx, node, second);
|
|
911
967
|
if (!target) return null;
|
|
912
968
|
const invocation = target.invocation;
|
|
913
969
|
const state = stateOf(invocation);
|
|
@@ -964,7 +1020,7 @@ function branchStepLines(ctx, batchNode, branchRef, batchState) {
|
|
|
964
1020
|
}
|
|
965
1021
|
}
|
|
966
1022
|
}
|
|
967
|
-
const groups = nested ? [items] : [...bySegment.values()].sort((a, b) => compareSiblings(a[0], b[0]));
|
|
1023
|
+
const groups = (nested ? [items] : [...bySegment.values()].sort((a, b) => compareSiblings(a[0], b[0]))).filter((group) => !group.every((node) => hidesAsPlumbing(ctx, node.invocation)));
|
|
968
1024
|
const lines = groups.map((group) => {
|
|
969
1025
|
var _a2, _b2;
|
|
970
1026
|
const first = group[0].invocation;
|
|
@@ -1017,6 +1073,7 @@ function branchStepLines(ctx, batchNode, branchRef, batchState) {
|
|
|
1017
1073
|
for (const child of item.children) reached = Math.max(reached, (_e = stepNumberOf(child)) != null ? _e : 0);
|
|
1018
1074
|
}
|
|
1019
1075
|
for (const step of stepsAfter(branch, reached)) {
|
|
1076
|
+
if (isPlumbingUpcoming(ctx, step)) continue;
|
|
1020
1077
|
const line = upcomingLine(ctx, `${batchNode.invocation.path}/*`, step);
|
|
1021
1078
|
line.kind = SIMPLE_LINE_KIND.BRANCH_STEP;
|
|
1022
1079
|
line.tally = emptyTally();
|
|
@@ -1083,21 +1140,35 @@ function unreachedSteps(ctx, node, state) {
|
|
|
1083
1140
|
var _a;
|
|
1084
1141
|
return (_a = stepNumberOf(child)) != null ? _a : 0;
|
|
1085
1142
|
}));
|
|
1086
|
-
|
|
1143
|
+
const steps = stepsAfter(sequence, reached).filter((step) => !isPlumbingUpcoming(ctx, step));
|
|
1144
|
+
return { sequence, steps, ended };
|
|
1087
1145
|
}
|
|
1088
1146
|
function childLines(ctx, node, depth, state, unreached = unreachedSteps(ctx, node, state)) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1147
|
+
let lines = shownChildren(ctx, node).map(
|
|
1148
|
+
(child) => lineOf(ctx, child, node, depth, unreached.sequence)
|
|
1149
|
+
);
|
|
1091
1150
|
for (const step of unreached.steps) {
|
|
1092
1151
|
const line = upcomingLine(ctx, node.invocation.path, step);
|
|
1093
1152
|
if (unreached.ended) line.state = SIMPLE_LINE_STATE.NOT_RUN;
|
|
1094
1153
|
lines.push(line);
|
|
1095
1154
|
}
|
|
1096
|
-
if (node.invocation.pipe_type === "PipeParallel" &&
|
|
1155
|
+
if (node.invocation.pipe_type === "PipeParallel" && shownBranchCount(ctx, node) > ctx.wideParallelThreshold) {
|
|
1097
1156
|
lines = foldFinished(node, lines);
|
|
1098
1157
|
}
|
|
1099
1158
|
return lines;
|
|
1100
1159
|
}
|
|
1160
|
+
function shownBranchCount(ctx, node) {
|
|
1161
|
+
const shown = shownChildren(ctx, node).length;
|
|
1162
|
+
const reported = node.invocation.branch_count;
|
|
1163
|
+
if (reported === void 0) return shown;
|
|
1164
|
+
const parallel = pipeOf(ctx.registry, node.invocation.pipe_ref);
|
|
1165
|
+
const declaredPlumbing = ctx.showPlumbing || (parallel == null ? void 0 : parallel.type) !== "PipeParallel" || !Array.isArray(parallel.parallel_sub_pipes) ? 0 : parallel.parallel_sub_pipes.filter((sub) => {
|
|
1166
|
+
const pipe = pipeOf(ctx.registry, qualifyPipeCode(sub.pipe_code, parallel.domain_code));
|
|
1167
|
+
return pipe !== null && isPlumbingPipe(ctx.registry, pipe.type, pipe);
|
|
1168
|
+
}).length;
|
|
1169
|
+
const hidden = Math.max(node.children.length - shown, declaredPlumbing);
|
|
1170
|
+
return Math.max(shown, reported - hidden);
|
|
1171
|
+
}
|
|
1101
1172
|
function foldFinished(node, lines) {
|
|
1102
1173
|
const finished = lines.filter((line) => line.state === SIMPLE_LINE_STATE.DONE && !line.expanded);
|
|
1103
1174
|
if (finished.length < 2) return lines;
|
|
@@ -1105,10 +1176,7 @@ function foldFinished(node, lines) {
|
|
|
1105
1176
|
`${node.invocation.path}#finished`,
|
|
1106
1177
|
SIMPLE_LINE_KIND.FINISHED,
|
|
1107
1178
|
SIMPLE_LINE_STATE.DONE,
|
|
1108
|
-
{
|
|
1109
|
-
title: "",
|
|
1110
|
-
fromDescription: false
|
|
1111
|
-
}
|
|
1179
|
+
{ title: "", source: WORDING_SOURCE.CODE }
|
|
1112
1180
|
);
|
|
1113
1181
|
folded.foldedCount = finished.length;
|
|
1114
1182
|
const kept = [];
|
|
@@ -1121,10 +1189,10 @@ function foldFinished(node, lines) {
|
|
|
1121
1189
|
}
|
|
1122
1190
|
function lineOf(ctx, node, parent, depth, parentSequence) {
|
|
1123
1191
|
var _a, _b, _c, _d;
|
|
1124
|
-
const kind = kindOfNode(node);
|
|
1192
|
+
const kind = kindOfNode(ctx, node);
|
|
1125
1193
|
if (kind === SIMPLE_LINE_KIND.FOR_EACH) {
|
|
1126
1194
|
const line2 = forEachLine(ctx, node, depth, parentSequence);
|
|
1127
|
-
line2.outcome = branchOutcome(node, parent);
|
|
1195
|
+
line2.outcome = branchOutcome(ctx, node, parent);
|
|
1128
1196
|
return line2;
|
|
1129
1197
|
}
|
|
1130
1198
|
const invocation = node.invocation;
|
|
@@ -1136,7 +1204,7 @@ function lineOf(ctx, node, parent, depth, parentSequence) {
|
|
|
1136
1204
|
titleOf(ctx.registry, invocation.pipe_ref, invocation.pipe_code)
|
|
1137
1205
|
);
|
|
1138
1206
|
line.invocation = invocation;
|
|
1139
|
-
line.outcome = kind === SIMPLE_LINE_KIND.DECISION && invocation.condition ?
|
|
1207
|
+
line.outcome = kind === SIMPLE_LINE_KIND.DECISION && invocation.condition ? outcomeOf2(ctx, invocation.pipe_ref, invocation.condition.selected_outcome, true) : branchOutcome(ctx, node, parent);
|
|
1140
1208
|
if (kind === SIMPLE_LINE_KIND.STEP) {
|
|
1141
1209
|
line.health = healthOf(state, invocation, gatherBeneath(node), true);
|
|
1142
1210
|
return line;
|
|
@@ -1157,7 +1225,7 @@ function lineOf(ctx, node, parent, depth, parentSequence) {
|
|
|
1157
1225
|
return line;
|
|
1158
1226
|
}
|
|
1159
1227
|
const unreached = unreachedSteps(ctx, node, state);
|
|
1160
|
-
line.expandable = node.
|
|
1228
|
+
line.expandable = shownChildren(ctx, node).length > 0 || unreached.steps.length > 0;
|
|
1161
1229
|
line.expanded = line.expandable && ((_d = ctx.expanded[line.key]) != null ? _d : isActiveState(state));
|
|
1162
1230
|
if (line.expanded) {
|
|
1163
1231
|
const children = childLines(ctx, node, depth + 1, state, unreached);
|
|
@@ -1171,7 +1239,7 @@ function lineOf(ctx, node, parent, depth, parentSequence) {
|
|
|
1171
1239
|
function previewLines(ctx, entryPipeRef) {
|
|
1172
1240
|
const sequence = sequenceOf(ctx.registry, entryPipeRef);
|
|
1173
1241
|
if (sequence) {
|
|
1174
|
-
return stepsAfter(sequence, 0).map((step) => upcomingLine(ctx, entryPipeRef, step));
|
|
1242
|
+
return stepsAfter(sequence, 0).filter((step) => !isPlumbingUpcoming(ctx, step)).map((step) => upcomingLine(ctx, entryPipeRef, step));
|
|
1175
1243
|
}
|
|
1176
1244
|
const pipe = pipeOf(ctx.registry, entryPipeRef);
|
|
1177
1245
|
if (!pipe) return [];
|
|
@@ -1237,11 +1305,12 @@ function runNoteOf(snapshot, lines) {
|
|
|
1237
1305
|
return { reason: SIMPLE_RUN_NOTE_REASON.OTHER, degradation };
|
|
1238
1306
|
}
|
|
1239
1307
|
function buildSimpleProgress(snapshot, options = {}) {
|
|
1240
|
-
var _a, _b, _c;
|
|
1308
|
+
var _a, _b, _c, _d;
|
|
1241
1309
|
const ctx = {
|
|
1242
1310
|
registry: options.pipeRegistry,
|
|
1243
1311
|
expanded: (_a = options.expanded) != null ? _a : {},
|
|
1244
|
-
wideParallelThreshold: (_b = options.wideParallelThreshold) != null ? _b : DEFAULT_WIDE_PARALLEL_THRESHOLD
|
|
1312
|
+
wideParallelThreshold: (_b = options.wideParallelThreshold) != null ? _b : DEFAULT_WIDE_PARALLEL_THRESHOLD,
|
|
1313
|
+
showPlumbing: (_c = options.showPlumbing) != null ? _c : false
|
|
1245
1314
|
};
|
|
1246
1315
|
const roots = buildInvocationTree(snapshot);
|
|
1247
1316
|
let lines;
|
|
@@ -1251,7 +1320,7 @@ function buildSimpleProgress(snapshot, options = {}) {
|
|
|
1251
1320
|
} else if (roots.length === 1 && roots[0].invocation.pipe_type === "PipeSequence") {
|
|
1252
1321
|
const root = roots[0].invocation;
|
|
1253
1322
|
lines = childLines(ctx, roots[0], 0, stateOf(root));
|
|
1254
|
-
if (isRetrying(root)) retryAttempt = (
|
|
1323
|
+
if (isRetrying(root)) retryAttempt = (_d = root.attempts) != null ? _d : null;
|
|
1255
1324
|
} else {
|
|
1256
1325
|
lines = roots.map((root) => lineOf(ctx, root, null, 0, null));
|
|
1257
1326
|
}
|
|
@@ -1337,6 +1406,8 @@ export {
|
|
|
1337
1406
|
sequenceMatches,
|
|
1338
1407
|
joinedSequence,
|
|
1339
1408
|
titleOf,
|
|
1409
|
+
isPlumbingPipe,
|
|
1410
|
+
isPlumbingRef,
|
|
1340
1411
|
joinBatch,
|
|
1341
1412
|
SIMPLE_LINE_KIND,
|
|
1342
1413
|
SIMPLE_LINE_STATE,
|
|
@@ -1346,4 +1417,4 @@ export {
|
|
|
1346
1417
|
buildSimpleProgress,
|
|
1347
1418
|
simpleProgressChanges
|
|
1348
1419
|
};
|
|
1349
|
-
//# sourceMappingURL=chunk-
|
|
1420
|
+
//# sourceMappingURL=chunk-PWKNMKFA.js.map
|