@pipelex/mthds-ui 0.43.0 → 0.45.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.
Files changed (36) hide show
  1. package/dist/{chunk-ENRYQOCO.js → chunk-CZGIDVT7.js} +2 -2
  2. package/dist/{chunk-7JZBXBZS.js → chunk-DNYJEPHT.js} +3 -3
  3. package/dist/{chunk-6S5TQPTO.js → chunk-DUBNSW66.js} +2 -2
  4. package/dist/{chunk-HPARBH6K.js → chunk-SCKRIESM.js} +453 -40
  5. package/dist/chunk-SCKRIESM.js.map +1 -0
  6. package/dist/{chunk-N2F62MW7.js → chunk-UAYO53EO.js} +5 -5
  7. package/dist/chunk-UAYO53EO.js.map +1 -0
  8. package/dist/{chunk-4KLE62AN.js → chunk-X7GHQ3SD.js} +1 -1
  9. package/dist/{chunk-4KLE62AN.js.map → chunk-X7GHQ3SD.js.map} +1 -1
  10. package/dist/form/react/index.d.ts +1 -1
  11. package/dist/form/react/index.js +2 -2
  12. package/dist/graph/index.d.ts +226 -4
  13. package/dist/graph/index.js +8 -4
  14. package/dist/graph/react/index.d.ts +7 -3
  15. package/dist/graph/react/index.js +1687 -984
  16. package/dist/graph/react/index.js.map +1 -1
  17. package/dist/graph/react/styles/simple/SimpleDetailPanel.css +492 -0
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +8 -4
  20. package/dist/{registryJoin-C6Wfkik-.d.ts → registryJoin-C7paykZ2.d.ts} +1 -1
  21. package/dist/standalone/graph-standalone.html +621 -128
  22. package/dist/standalone/graph-viewer.css +494 -1
  23. package/dist/standalone/graph-viewer.js +127 -127
  24. package/dist/static-graph/index.d.ts +1 -1
  25. package/dist/static-graph/index.js +1 -1
  26. package/dist/timeline/index.d.ts +3 -3
  27. package/dist/timeline/index.js +2 -2
  28. package/dist/timeline/react/index.d.ts +2 -2
  29. package/dist/timeline/react/index.js +5 -5
  30. package/dist/{types-DLAnYNoi.d.ts → types-DgYaVX6K.d.ts} +8 -0
  31. package/package.json +3 -2
  32. package/dist/chunk-HPARBH6K.js.map +0 -1
  33. package/dist/chunk-N2F62MW7.js.map +0 -1
  34. /package/dist/{chunk-ENRYQOCO.js.map → chunk-CZGIDVT7.js.map} +0 -0
  35. /package/dist/{chunk-7JZBXBZS.js.map → chunk-DNYJEPHT.js.map} +0 -0
  36. /package/dist/{chunk-6S5TQPTO.js.map → chunk-DUBNSW66.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-4KLE62AN.js";
8
+ } from "./chunk-X7GHQ3SD.js";
9
9
  import {
10
10
  __spreadProps,
11
11
  __spreadValues
@@ -195,4 +195,4 @@ export {
195
195
  DEFAULT_GRAPH_CONFIG,
196
196
  getPaletteColors
197
197
  };
198
- //# sourceMappingURL=chunk-ENRYQOCO.js.map
198
+ //# sourceMappingURL=chunk-CZGIDVT7.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  GRAPH_STYLES
3
- } from "./chunk-N2F62MW7.js";
3
+ } from "./chunk-UAYO53EO.js";
4
4
  import {
5
5
  GRAPH_STYLE,
6
6
  GRAPH_THEME
7
- } from "./chunk-4KLE62AN.js";
7
+ } from "./chunk-X7GHQ3SD.js";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues
@@ -255,4 +255,4 @@ export {
255
255
  GRAPH_STYLE_MENU_ENTRIES,
256
256
  StyleMenu
257
257
  };
258
- //# sourceMappingURL=chunk-7JZBXBZS.js.map
258
+ //# sourceMappingURL=chunk-DNYJEPHT.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-P6IGZVWE.js";
5
5
  import {
6
6
  isBindingStepSpec
7
- } from "./chunk-4KLE62AN.js";
7
+ } from "./chunk-X7GHQ3SD.js";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues
@@ -1346,4 +1346,4 @@ export {
1346
1346
  buildSimpleProgress,
1347
1347
  simpleProgressChanges
1348
1348
  };
1349
- //# sourceMappingURL=chunk-6S5TQPTO.js.map
1349
+ //# sourceMappingURL=chunk-DUBNSW66.js.map
@@ -30,15 +30,17 @@ import {
30
30
  STEP_CATEGORY,
31
31
  graphSpecMode,
32
32
  isBindingNode,
33
+ isDryGraphSpec,
33
34
  isFailingPipeNode,
34
35
  isPluralMultiplicity,
36
+ isStaticGraphSpec,
35
37
  isStuffNodeId,
36
38
  multiplicitySuffix,
37
39
  nodeHeight,
38
40
  nodeWidth,
39
41
  stuffDigestFromId,
40
42
  stuffNodeId
41
- } from "./chunk-4KLE62AN.js";
43
+ } from "./chunk-X7GHQ3SD.js";
42
44
  import {
43
45
  __objRest,
44
46
  __spreadProps,
@@ -1077,25 +1079,56 @@ function pipeRefOf(node) {
1077
1079
  return makePipeRef(node.domain_code, node.pipe_code);
1078
1080
  }
1079
1081
  function findStuffByDigest(spec, digest) {
1080
- var _a, _b, _c, _d;
1082
+ var _a, _b;
1081
1083
  const consumer = findConsumer(spec, digest);
1082
- for (const node of spec.nodes) {
1083
- for (const output of (_b = (_a = node.io) == null ? void 0 : _a.outputs) != null ? _b : []) {
1084
- if (output.digest === digest) {
1085
- const producerPipeRef = pipeRefOf(node);
1086
- return __spreadValues(__spreadValues({
1087
- item: output
1088
- }, producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {});
1089
- }
1090
- }
1084
+ const produced = findProducer(spec, digest);
1085
+ if (produced) {
1086
+ const producerPipeRef = pipeRefOf(produced.node);
1087
+ return __spreadValues(__spreadValues({
1088
+ item: produced.item
1089
+ }, producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {});
1091
1090
  }
1092
1091
  for (const node of spec.nodes) {
1093
- for (const input of (_d = (_c = node.io) == null ? void 0 : _c.inputs) != null ? _d : []) {
1092
+ for (const input of (_b = (_a = node.io) == null ? void 0 : _a.inputs) != null ? _b : []) {
1094
1093
  if (input.digest === digest) return __spreadValues({ item: input }, consumer ? { consumer } : {});
1095
1094
  }
1096
1095
  }
1097
1096
  return null;
1098
1097
  }
1098
+ function findProducer(spec, digest) {
1099
+ var _a, _b, _c, _d;
1100
+ const listing = [];
1101
+ for (const node of spec.nodes) {
1102
+ const item = (_b = (_a = node.io) == null ? void 0 : _a.outputs) == null ? void 0 : _b.find((output) => output.digest === digest);
1103
+ if (item) listing.push({ node, item });
1104
+ }
1105
+ if (listing.length <= 1) return listing[0];
1106
+ const children = /* @__PURE__ */ new Map();
1107
+ for (const edge of (_c = spec.edges) != null ? _c : []) {
1108
+ if (edge.kind !== "contains") continue;
1109
+ const contained = children.get(edge.source);
1110
+ if (contained) contained.push(edge.target);
1111
+ else children.set(edge.source, [edge.target]);
1112
+ }
1113
+ const listed = new Set(listing.map(({ node }) => node.id));
1114
+ return (_d = listing.find(({ node }) => !containsAnyOf(node.id, children, listed))) != null ? _d : (
1115
+ // A containment cycle, which a valid spec cannot hold: the first listing.
1116
+ listing[0]
1117
+ );
1118
+ }
1119
+ function containsAnyOf(id, children, targets) {
1120
+ var _a, _b;
1121
+ const seen = /* @__PURE__ */ new Set([id]);
1122
+ const pending = [...(_a = children.get(id)) != null ? _a : []];
1123
+ while (pending.length > 0) {
1124
+ const next = pending.pop();
1125
+ if (seen.has(next)) continue;
1126
+ if (targets.has(next)) return true;
1127
+ seen.add(next);
1128
+ pending.push(...(_b = children.get(next)) != null ? _b : []);
1129
+ }
1130
+ return false;
1131
+ }
1099
1132
  function findConsumer(spec, digest) {
1100
1133
  var _a, _b;
1101
1134
  for (const node of spec.nodes) {
@@ -2175,8 +2208,22 @@ function stepIdentity(spec) {
2175
2208
  function forEachLabel(itemName) {
2176
2209
  return `For each ${humanizeInSentence(itemName)}`;
2177
2210
  }
2211
+ function isBuiltInConcept(graphspec, conceptRef) {
2212
+ const info = resolveConceptRef(graphspec, conceptRef);
2213
+ if (info) return info.domain_code === NATIVE_DOMAIN;
2214
+ return conceptRef.startsWith(`${NATIVE_DOMAIN}.`) || isGenericConcept(conceptRef);
2215
+ }
2216
+ function simpleValueTitle(graphspec, item, role) {
2217
+ const concept = item.concept;
2218
+ if (role === "output" && concept && !isBuiltInConcept(graphspec, concept)) {
2219
+ return { title: conceptPlainName(concept) };
2220
+ }
2221
+ const title = humanizeIdentifier(item.name);
2222
+ const plain = concept ? conceptPlainName(concept) : void 0;
2223
+ return plain && plain.toLowerCase() !== title.toLowerCase() ? { title, subtitle: plain } : { title };
2224
+ }
2178
2225
  function projectSimpleGraph(input) {
2179
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2226
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2180
2227
  const { graphspec, nodes, analysis, rawAnalysis } = input;
2181
2228
  const graphMode = graphSpecMode(graphspec);
2182
2229
  const specById = new Map(graphspec.nodes.map((n) => [n.id, n]));
@@ -2249,11 +2296,15 @@ function projectSimpleGraph(input) {
2249
2296
  if (!hidden.has(batchId) && cards.has(branchId)) markedSteps[branchId] = batchId;
2250
2297
  }
2251
2298
  const runStatuses = /* @__PURE__ */ new Map();
2299
+ const runIds = /* @__PURE__ */ new Map();
2252
2300
  for (const spec of graphspec.nodes) {
2253
2301
  const rep = repOf(spec.id);
2254
2302
  const statuses = runStatuses.get(rep);
2255
2303
  if (statuses) statuses.push(spec.status);
2256
2304
  else runStatuses.set(rep, [spec.status]);
2305
+ const ids = runIds.get(rep);
2306
+ if (ids) ids.push(spec.id);
2307
+ else runIds.set(rep, [spec.id]);
2257
2308
  }
2258
2309
  function stepStatus(spec) {
2259
2310
  var _a2, _b2;
@@ -2287,6 +2338,7 @@ function projectSimpleGraph(input) {
2287
2338
  }
2288
2339
  }
2289
2340
  const combinedFrom = /* @__PURE__ */ new Map();
2341
+ const combinedInto = /* @__PURE__ */ new Map();
2290
2342
  for (const edge of graphspec.edges) {
2291
2343
  const from = edge.source_stuff_digest;
2292
2344
  const into = edge.target_stuff_digest;
@@ -2297,6 +2349,9 @@ function projectSimpleGraph(input) {
2297
2349
  const list = combinedFrom.get(into);
2298
2350
  if (list) list.push(from);
2299
2351
  else combinedFrom.set(into, [from]);
2352
+ const intos = combinedInto.get(from);
2353
+ if (intos) intos.push(into);
2354
+ else combinedInto.set(from, [into]);
2300
2355
  }
2301
2356
  const sourceMemo = /* @__PURE__ */ new Map();
2302
2357
  function sourcesOf(digest, visiting = /* @__PURE__ */ new Set()) {
@@ -2375,22 +2430,28 @@ function projectSimpleGraph(input) {
2375
2430
  }
2376
2431
  const edges = /* @__PURE__ */ new Map();
2377
2432
  let edgeCount = 0;
2378
- function addEdge(source, target) {
2433
+ function addEdge(source, target, digest, newOnly = false) {
2434
+ var _a2, _b2;
2379
2435
  if (source === target) return;
2380
2436
  const key = `${source}->${target}`;
2381
- if (edges.has(key)) return;
2382
- const label = decisionSet.has(source) ? outcomeFor(source, branchOf(source, target)) : void 0;
2383
- edges.set(key, simpleEdge(`simple_edge_${edgeCount++}`, source, target, label));
2437
+ let edge = edges.get(key);
2438
+ if (edge && newOnly) return;
2439
+ if (!edge) {
2440
+ const label = decisionSet.has(source) ? outcomeFor(source, branchOf(source, target)) : void 0;
2441
+ edge = simpleEdge(`simple_edge_${edgeCount++}`, source, target, label);
2442
+ edges.set(key, edge);
2443
+ }
2444
+ if (digest && !((_a2 = edge.carries) == null ? void 0 : _a2.includes(digest))) edge.carries = [...(_b2 = edge.carries) != null ? _b2 : [], digest];
2384
2445
  }
2385
- function route(sources, target) {
2446
+ function route(sources, target, digest, newOnly = false) {
2386
2447
  let froms = [...sources];
2387
2448
  for (const decisionId of decisionsAbove(target)) {
2388
2449
  const outside = froms.filter((s) => !isInside(s, decisionId));
2389
2450
  if (outside.length === 0) continue;
2390
- for (const source of outside) addEdge(source, decisionId);
2451
+ for (const source of outside) addEdge(source, decisionId, digest, newOnly);
2391
2452
  froms = [decisionId, ...froms.filter((s) => isInside(s, decisionId))];
2392
2453
  }
2393
- for (const source of froms) addEdge(source, target);
2454
+ for (const source of froms) addEdge(source, target, digest, newOnly);
2394
2455
  }
2395
2456
  const danglingInputs = /* @__PURE__ */ new Map();
2396
2457
  function sourcesOrDangling(digest) {
@@ -2404,10 +2465,11 @@ function projectSimpleGraph(input) {
2404
2465
  }, entry.concept !== void 0 ? { concept: entry.concept } : {}), entry.multiplicity !== void 0 ? { multiplicity: entry.multiplicity } : {}));
2405
2466
  return [stuffNodeId(digest)];
2406
2467
  }
2468
+ const laterReads = [];
2407
2469
  function routeRead(digest, readerId) {
2408
2470
  const target = drawnAs(readerId);
2409
- if (target === readerId) route(sourcesOrDangling(digest), target);
2410
- else route(sourcesOf(digest), target);
2471
+ if (target === readerId) route(sourcesOrDangling(digest), target, digest);
2472
+ else laterReads.push([digest, readerId]);
2411
2473
  }
2412
2474
  for (const [digest, consumers] of Object.entries(analysis.stuffConsumers)) {
2413
2475
  for (const consumerId of consumers) {
@@ -2420,8 +2482,11 @@ function projectSimpleGraph(input) {
2420
2482
  if (item.digest) routeRead(item.digest, conditionId);
2421
2483
  }
2422
2484
  }
2485
+ for (const [digest, readerId] of laterReads) {
2486
+ route(sourcesOf(digest), drawnAs(readerId), digest, true);
2487
+ }
2423
2488
  for (const digest of outputItems.keys()) {
2424
- for (const source of sourcesOf(digest)) addEdge(source, stuffNodeId(digest));
2489
+ for (const source of sourcesOf(digest)) addEdge(source, stuffNodeId(digest), digest);
2425
2490
  }
2426
2491
  for (const [key, edge] of [...edges]) {
2427
2492
  if (!decisionSet.has(edge.source)) continue;
@@ -2450,24 +2515,10 @@ function projectSimpleGraph(input) {
2450
2515
  }
2451
2516
  }
2452
2517
  const simpleNodes = [];
2453
- function isBuiltInConcept(conceptRef) {
2454
- const info = resolveConceptRef(graphspec, conceptRef);
2455
- if (info) return info.domain_code === NATIVE_DOMAIN;
2456
- return conceptRef.startsWith(`${NATIVE_DOMAIN}.`) || isGenericConcept(conceptRef);
2457
- }
2458
2518
  function terminalNode(item, kind) {
2459
2519
  const digest = item.digest;
2460
- const concept = item.concept;
2461
2520
  const isList = isPluralMultiplicity(item.multiplicity);
2462
- let title;
2463
- let subtitle;
2464
- if (kind === "output" && concept && !isBuiltInConcept(concept)) {
2465
- title = conceptPlainName(concept);
2466
- } else {
2467
- title = humanizeIdentifier(item.name);
2468
- const plain = concept ? conceptPlainName(concept) : void 0;
2469
- subtitle = plain && plain.toLowerCase() !== title.toLowerCase() ? plain : void 0;
2470
- }
2521
+ const { title, subtitle } = simpleValueTitle(graphspec, item, kind);
2471
2522
  const simple = __spreadValues({ kind, title, isList }, subtitle ? { subtitle } : {});
2472
2523
  return {
2473
2524
  id: stuffNodeId(digest),
@@ -2686,10 +2737,56 @@ function projectSimpleGraph(input) {
2686
2737
  return found;
2687
2738
  }
2688
2739
  for (const spec of graphspec.nodes) standIn(spec.id);
2740
+ const decisionReads = /* @__PURE__ */ new Map();
2741
+ for (const conditionId of liveControllers) {
2742
+ const drawn = drawnAs(conditionId);
2743
+ if (!decisionSet.has(drawn)) continue;
2744
+ for (const item of (_k = (_j = specById.get(conditionId)) == null ? void 0 : _j.io.inputs) != null ? _k : []) {
2745
+ if (!item.digest) continue;
2746
+ const readers = decisionReads.get(item.digest);
2747
+ if (readers) readers.push(drawn);
2748
+ else decisionReads.set(item.digest, [drawn]);
2749
+ }
2750
+ }
2751
+ function readersOf(digest, visiting = /* @__PURE__ */ new Set()) {
2752
+ var _a2, _b2, _c2, _d2, _e2, _f2;
2753
+ if (visiting.has(digest)) return [];
2754
+ visiting.add(digest);
2755
+ const found = [];
2756
+ for (const consumerId of (_a2 = analysis.stuffConsumers[digest]) != null ? _a2 : []) {
2757
+ const drawn = drawnAs(consumerId);
2758
+ if (drawnStepIds.has(drawn)) {
2759
+ found.push(drawn);
2760
+ continue;
2761
+ }
2762
+ if (((_b2 = cards.get(drawn)) == null ? void 0 : _b2.data.pipeType) === BINDING_STEP_TYPE) {
2763
+ for (const item of (_d2 = (_c2 = specById.get(consumerId)) == null ? void 0 : _c2.io.outputs) != null ? _d2 : []) {
2764
+ if (item.digest) found.push(...readersOf(item.digest, visiting));
2765
+ }
2766
+ }
2767
+ }
2768
+ found.push(...(_e2 = decisionReads.get(digest)) != null ? _e2 : []);
2769
+ for (const into of (_f2 = combinedInto.get(digest)) != null ? _f2 : []) {
2770
+ found.push(...readersOf(into, visiting));
2771
+ }
2772
+ if (outputItems.has(digest)) found.push(stuffNodeId(digest));
2773
+ visiting.delete(digest);
2774
+ return unique(found);
2775
+ }
2776
+ const valueFlows = /* @__PURE__ */ new Map();
2777
+ for (const digest of Object.keys(analysis.stuffRegistry)) {
2778
+ const from = danglingInputs.has(digest) ? [stuffNodeId(digest)] : sourcesOf(digest).filter((id) => drawnIds.has(id));
2779
+ const to = readersOf(digest).filter((id) => drawnIds.has(id) && !from.includes(id));
2780
+ if (from.length > 0 || to.length > 0) valueFlows.set(digest, { from, to });
2781
+ }
2782
+ const runs = /* @__PURE__ */ new Map();
2783
+ for (const id of drawnIds) runs.set(id, (_l = runIds.get(id)) != null ? _l : [id]);
2689
2784
  return {
2690
2785
  nodes: simpleNodes,
2691
2786
  edges: [...edges.values()],
2692
2787
  standIns,
2788
+ valueFlows,
2789
+ runs,
2693
2790
  analysis: {
2694
2791
  stuffRegistry: analysis.stuffRegistry,
2695
2792
  stuffProducers: {},
@@ -2807,6 +2904,320 @@ var GRAPH_STYLE_PIPELINES = {
2807
2904
  }
2808
2905
  };
2809
2906
 
2907
+ // src/graph/styles/simpleDetail.ts
2908
+ function buildSimpleNodeDetail(input, target) {
2909
+ var _a, _b, _c, _d;
2910
+ const { graphspec, nodes, edges, valueFlows, runs, frameContents } = input;
2911
+ const specById = new Map(graphspec.nodes.map((n) => [n.id, n]));
2912
+ const childrenOf = childrenIndex(graphspec);
2913
+ const nodeById = new Map(nodes.map((n) => [n.id, n]));
2914
+ const isStatic = isStaticGraphSpec(graphspec);
2915
+ const isDry = isDryGraphSpec(graphspec);
2916
+ const finalOutputs = new Set(
2917
+ nodes.filter((n) => n.type === NODE_TYPE_SIMPLE_TERMINAL && n.data.stuffRole === "output").map((n) => n.data.stuffDigest).filter((digest) => digest !== void 0)
2918
+ );
2919
+ function link(nodeId) {
2920
+ var _a2, _b2;
2921
+ const node2 = nodeById.get(nodeId);
2922
+ if (!node2) return null;
2923
+ return { nodeId, title: (_b2 = (_a2 = node2.data.simple) == null ? void 0 : _a2.title) != null ? _b2 : node2.data.labelText, kind: linkKind(node2) };
2924
+ }
2925
+ const links = (ids) => ids.map(link).filter((l) => l !== null);
2926
+ function value(item, selfId) {
2927
+ var _a2, _b2, _c2, _d2, _e;
2928
+ const digest = (_a2 = item.digest) != null ? _a2 : "";
2929
+ const others = (ids) => links(ids.filter((id) => id !== selfId));
2930
+ const { title, subtitle } = simpleValueTitle(
2931
+ graphspec,
2932
+ item,
2933
+ finalOutputs.has(digest) ? "output" : "input"
2934
+ );
2935
+ const description = item.concept ? (_c2 = (_b2 = resolveConceptRef(graphspec, item.concept)) == null ? void 0 : _b2.description) == null ? void 0 : _c2.trim() : void 0;
2936
+ const flow = digest ? valueFlows.get(digest) : void 0;
2937
+ const result = {
2938
+ digest,
2939
+ title,
2940
+ isList: isPluralMultiplicity(item.multiplicity),
2941
+ from: others((_d2 = flow == null ? void 0 : flow.from) != null ? _d2 : []),
2942
+ to: others((_e = flow == null ? void 0 : flow.to) != null ? _e : []),
2943
+ location: digest ? findStuffByDigest(graphspec, digest) : null
2944
+ };
2945
+ if (subtitle) result.subtitle = subtitle;
2946
+ if (description) result.description = description;
2947
+ return result;
2948
+ }
2949
+ const valueOfDigest = (digest, selfId) => {
2950
+ const location = findStuffByDigest(graphspec, digest);
2951
+ return location ? value(location.item, selfId) : null;
2952
+ };
2953
+ const runSpecs = (nodeId) => {
2954
+ var _a2;
2955
+ return ((_a2 = runs.get(nodeId)) != null ? _a2 : [nodeId]).map((id) => specById.get(id)).filter((n) => n !== void 0);
2956
+ };
2957
+ function runSummary(nodeId, status) {
2958
+ var _a2, _b2, _c2;
2959
+ if (isStatic) return void 0;
2960
+ const ids = (_a2 = runs.get(nodeId)) != null ? _a2 : [nodeId];
2961
+ const summary = { status, runs: ids.length };
2962
+ if (ids.length > 1) {
2963
+ const statuses = runSpecs(nodeId).map((n) => n.status);
2964
+ if (aggregateStatus(statuses) === status) summary.tally = tallyOf(statuses);
2965
+ } else {
2966
+ const duration = (_c2 = (_b2 = specById.get(nodeId)) == null ? void 0 : _b2.timing) == null ? void 0 : _c2.duration;
2967
+ if (typeof duration === "number") summary.durationSeconds = duration;
2968
+ }
2969
+ return summary;
2970
+ }
2971
+ function base(node2, spec2, title) {
2972
+ var _a2, _b2;
2973
+ const status = statusOf(node2, spec2);
2974
+ const detail = { nodeId: node2.id, title, specNode: spec2 };
2975
+ const run = runSummary(node2.id, status);
2976
+ if (run) detail.run = run;
2977
+ const problem = (_b2 = spec2.error) != null ? _b2 : (_a2 = runSpecs(node2.id).find((n) => n.error)) == null ? void 0 : _a2.error;
2978
+ if (problem) detail.problem = problem;
2979
+ return detail;
2980
+ }
2981
+ if (target.kind === "arrow") {
2982
+ const edge = edges.find((e) => e.source === target.source && e.target === target.target);
2983
+ if (!edge) return null;
2984
+ const from = link(edge.source);
2985
+ const to = link(edge.target);
2986
+ if (!from || !to) return null;
2987
+ const detail = {
2988
+ kind: "arrow",
2989
+ edgeId: edge.id,
2990
+ from,
2991
+ to,
2992
+ values: ((_a = edge.carries) != null ? _a : []).map((digest) => valueOfDigest(digest)).filter((v) => v !== null)
2993
+ };
2994
+ if (edge.label) detail.outcome = edge.label;
2995
+ return detail;
2996
+ }
2997
+ const node = nodeById.get(target.id);
2998
+ if (!node) return null;
2999
+ const simple = node.data.simple;
3000
+ if (node.type === NODE_TYPE_SIMPLE_TERMINAL) {
3001
+ const digest = node.data.stuffDigest;
3002
+ const located = digest ? valueOfDigest(digest, node.id) : null;
3003
+ if (!located) return null;
3004
+ const role = node.data.stuffRole === "output" ? "output" : "input";
3005
+ const conceptRef = (_b = located.location) == null ? void 0 : _b.item.concept;
3006
+ const concept = conceptRef ? resolveConceptRef(graphspec, conceptRef) : void 0;
3007
+ return {
3008
+ kind: "value",
3009
+ nodeId: node.id,
3010
+ role,
3011
+ value: located,
3012
+ fields: conceptFields(concept == null ? void 0 : concept.json_schema)
3013
+ };
3014
+ }
3015
+ const spec = specById.get(node.id);
3016
+ if (!spec) return null;
3017
+ if (node.type === NODE_TYPE_SIMPLE_STEP && (simple == null ? void 0 : simple.kind) === "step") {
3018
+ const detail = __spreadProps(__spreadValues({}, base(node, spec, simple.title)), {
3019
+ kind: "step",
3020
+ category: simple.category,
3021
+ uses: spec.io.inputs.map((item) => value(item, node.id)),
3022
+ produces: spec.io.outputs.map((item) => value(item, node.id))
3023
+ });
3024
+ if (simple.innerStepCount !== void 0) {
3025
+ detail.inner = __spreadValues({
3026
+ count: simple.innerStepCount,
3027
+ steps: stepTitlesInside(specById, childrenOf, spec.id)
3028
+ }, simple.onExpand ? { onExpand: simple.onExpand } : {});
3029
+ } else {
3030
+ const instructions = instructionsOf(graphspec, spec, simple.category);
3031
+ if (instructions) detail.instructions = instructions;
3032
+ }
3033
+ if (simple.forEach) detail.forEach = simple.forEach;
3034
+ return detail;
3035
+ }
3036
+ if (node.type === NODE_TYPE_SIMPLE_DECISION && (simple == null ? void 0 : simple.kind) === "decision") {
3037
+ const decisionRuns = runSpecs(node.id);
3038
+ return __spreadProps(__spreadValues({}, base(node, spec, simple.title)), {
3039
+ kind: "decision",
3040
+ uses: spec.io.inputs.map((item) => value(item, node.id)),
3041
+ outcomes: decisionOutcomes(graphspec, spec, decisionRuns, {
3042
+ resolved: !isStatic && !isDry,
3043
+ edges: edges.filter((e) => e.source === node.id),
3044
+ link,
3045
+ specById,
3046
+ childrenOf
3047
+ }),
3048
+ runs: decisionRuns.length
3049
+ });
3050
+ }
3051
+ if (node.type === NODE_TYPE_SIMPLE_FRAME && (simple == null ? void 0 : simple.kind) === "frame") {
3052
+ const detail = __spreadProps(__spreadValues({}, base(node, spec, simple.title)), {
3053
+ kind: "frame",
3054
+ steps: links((_c = frameContents[node.id]) != null ? _c : [])
3055
+ });
3056
+ const listName = batchListName(graphspec, spec);
3057
+ const list = listName ? spec.io.inputs.find((item) => item.name === listName) : void 0;
3058
+ if (list) detail.over = value(list, node.id);
3059
+ if (!isStatic) {
3060
+ const items = ((_d = runs.get(node.id)) != null ? _d : [node.id]).flatMap(
3061
+ (id) => childrenOf(id).map((child) => {
3062
+ var _a2;
3063
+ return (_a2 = specById.get(child)) == null ? void 0 : _a2.status;
3064
+ })
3065
+ );
3066
+ if (items.length > 0) detail.items = tallyOf(items);
3067
+ }
3068
+ return detail;
3069
+ }
3070
+ return null;
3071
+ }
3072
+ function linkKind(node) {
3073
+ switch (node.type) {
3074
+ case NODE_TYPE_SIMPLE_TERMINAL:
3075
+ return node.data.stuffRole === "output" ? "output" : "input";
3076
+ case NODE_TYPE_SIMPLE_DECISION:
3077
+ return "decision";
3078
+ case NODE_TYPE_SIMPLE_FRAME:
3079
+ return "frame";
3080
+ default:
3081
+ return "step";
3082
+ }
3083
+ }
3084
+ function statusOf(node, spec) {
3085
+ const simple = node.data.simple;
3086
+ return simple && "status" in simple ? simple.status : spec.status;
3087
+ }
3088
+ function tallyOf(statuses) {
3089
+ var _a;
3090
+ const byStatus = {};
3091
+ let total = 0;
3092
+ for (const status of statuses) {
3093
+ if (!status) continue;
3094
+ total += 1;
3095
+ byStatus[status] = ((_a = byStatus[status]) != null ? _a : 0) + 1;
3096
+ }
3097
+ return { total, byStatus };
3098
+ }
3099
+ function childrenIndex(graphspec) {
3100
+ const children = /* @__PURE__ */ new Map();
3101
+ for (const edge of graphspec.edges) {
3102
+ if (edge.kind !== "contains") continue;
3103
+ const list = children.get(edge.source);
3104
+ if (list) list.push(edge.target);
3105
+ else children.set(edge.source, [edge.target]);
3106
+ }
3107
+ return (id) => {
3108
+ var _a;
3109
+ return (_a = children.get(id)) != null ? _a : [];
3110
+ };
3111
+ }
3112
+ function stepTitlesInside(specById, childrenOf, id) {
3113
+ const titles = [];
3114
+ const visit = (nodeId) => {
3115
+ var _a;
3116
+ const spec = specById.get(nodeId);
3117
+ const children = childrenOf(nodeId);
3118
+ if (children.length === 0) {
3119
+ if ((spec == null ? void 0 : spec.kind) === "operator") {
3120
+ titles.push(pipeTitle(spec.description, (_a = spec.pipe_code) != null ? _a : "").title);
3121
+ }
3122
+ return;
3123
+ }
3124
+ for (const child of (spec == null ? void 0 : spec.pipe_type) === "PipeBatch" ? children.slice(0, 1) : children) {
3125
+ visit(child);
3126
+ }
3127
+ };
3128
+ visit(id);
3129
+ return titles;
3130
+ }
3131
+ function instructionsOf(graphspec, spec, category) {
3132
+ var _a, _b;
3133
+ const blueprint = resolveNodeBlueprint(graphspec, spec);
3134
+ if (!blueprint) return void 0;
3135
+ let text;
3136
+ switch (blueprint.type) {
3137
+ case "PipeLLM":
3138
+ text = (_a = blueprint.llm_prompt_spec.prompt_blueprint) == null ? void 0 : _a.template;
3139
+ break;
3140
+ case "PipeJudge":
3141
+ text = blueprint.judgment_question.instructions;
3142
+ break;
3143
+ case "PipeImgGen":
3144
+ text = (_b = blueprint.img_gen_prompt_blueprint.prompt_blueprint) == null ? void 0 : _b.template;
3145
+ break;
3146
+ case "PipeSearch":
3147
+ text = blueprint.prompt_blueprint.template;
3148
+ break;
3149
+ default:
3150
+ return void 0;
3151
+ }
3152
+ const trimmed = text == null ? void 0 : text.trim();
3153
+ return trimmed ? { category, text: trimmed } : void 0;
3154
+ }
3155
+ function batchListName(graphspec, spec) {
3156
+ const blueprint = resolveNodeBlueprint(graphspec, spec);
3157
+ return (blueprint == null ? void 0 : blueprint.type) === "PipeBatch" ? blueprint.batch_params.input_list_stuff_name : void 0;
3158
+ }
3159
+ function decisionOutcomes(graphspec, decision, decisionRuns, context) {
3160
+ if (!decision.domain_code || !decision.pipe_code) return [];
3161
+ const blueprint = getPipeBlueprint(
3162
+ graphspec,
3163
+ makePipeRef(decision.domain_code, decision.pipe_code)
3164
+ );
3165
+ if ((blueprint == null ? void 0 : blueprint.type) !== "PipeCondition") return [];
3166
+ const domain = decision.domain_code;
3167
+ const { specById, childrenOf } = context;
3168
+ const fullRef = (pipeRef) => {
3169
+ var _a;
3170
+ if (isOutcomeEnd(pipeRef)) return pipeRef;
3171
+ const parsed = parsePipeRef(pipeRef);
3172
+ return parsed ? makePipeRef((_a = parsed.domainPath) != null ? _a : domain, parsed.pipeCode) : pipeRef;
3173
+ };
3174
+ const byBranch = /* @__PURE__ */ new Map();
3175
+ const named = Object.entries(blueprint.outcome_map);
3176
+ if (blueprint.default_outcome) named.push(["default", blueprint.default_outcome]);
3177
+ for (const [outcome, pipeRef] of named) {
3178
+ if (!pipeRef) continue;
3179
+ const ref = fullRef(pipeRef);
3180
+ const outcomes = byBranch.get(ref);
3181
+ if (outcomes) outcomes.push(outcome);
3182
+ else byBranch.set(ref, [outcome]);
3183
+ }
3184
+ const ranIn = (ref, run) => childrenOf(run.id).some((childId) => {
3185
+ var _a;
3186
+ const child = specById.get(childId);
3187
+ if (!(child == null ? void 0 : child.pipe_code)) return false;
3188
+ const childRef = makePipeRef((_a = child.domain_code) != null ? _a : domain, child.pipe_code);
3189
+ return childRef === ref && child.status !== "skipped" && child.status !== "scheduled";
3190
+ });
3191
+ return [...byBranch.entries()].map(([ref, outcomes]) => {
3192
+ var _a;
3193
+ const label = outcomeLabel(outcomes.join("|"));
3194
+ if (isOutcomeEnd(ref)) return { label, leadsToTitle: "", ends: ref };
3195
+ const branch = getPipeBlueprint(graphspec, ref);
3196
+ const parsed = parsePipeRef(ref);
3197
+ const code = (_a = parsed == null ? void 0 : parsed.pipeCode) != null ? _a : stripDomain(ref);
3198
+ const row = {
3199
+ label,
3200
+ leadsToTitle: pipeTitle(branch == null ? void 0 : branch.description, code).title
3201
+ };
3202
+ const edge = context.edges.find((e) => e.label === label);
3203
+ const leadsTo = edge ? context.link(edge.target) : null;
3204
+ if (leadsTo) row.leadsTo = leadsTo;
3205
+ if (context.resolved) row.taken = decisionRuns.filter((run) => ranIn(ref, run)).length;
3206
+ return row;
3207
+ });
3208
+ }
3209
+ function isOutcomeEnd(pipeRef) {
3210
+ return pipeRef === "fail" || pipeRef === "continue";
3211
+ }
3212
+ function conceptFields(schema) {
3213
+ const properties = schema == null ? void 0 : schema.properties;
3214
+ if (!properties) return [];
3215
+ return Object.entries(properties).map(([name, field]) => {
3216
+ const description = typeof field.description === "string" ? field.description.trim() : void 0;
3217
+ return description ? { title: humanizeIdentifier(name), description } : { title: humanizeIdentifier(name) };
3218
+ });
3219
+ }
3220
+
2810
3221
  export {
2811
3222
  GraphSpecValidationError,
2812
3223
  validateGraphSpec,
@@ -2863,10 +3274,12 @@ export {
2863
3274
  simpleDecisionSize,
2864
3275
  simpleTitleWrap,
2865
3276
  aggregateStatus,
3277
+ simpleValueTitle,
2866
3278
  projectSimpleGraph,
2867
3279
  simpleEdgeLabelSize,
2868
3280
  simpleDefaultFolds,
2869
3281
  applySimpleFrames,
2870
- GRAPH_STYLE_PIPELINES
3282
+ GRAPH_STYLE_PIPELINES,
3283
+ buildSimpleNodeDetail
2871
3284
  };
2872
- //# sourceMappingURL=chunk-HPARBH6K.js.map
3285
+ //# sourceMappingURL=chunk-SCKRIESM.js.map