@pipelex/mthds-ui 0.44.0 → 0.46.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 (37) 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-5E3UJI2I.js → chunk-SCKRIESM.js} +411 -29
  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 +17 -11
  11. package/dist/form/react/index.js +2 -2
  12. package/dist/form/react/index.js.map +1 -1
  13. package/dist/graph/index.d.ts +226 -4
  14. package/dist/graph/index.js +8 -4
  15. package/dist/graph/react/index.d.ts +2 -2
  16. package/dist/graph/react/index.js +1679 -985
  17. package/dist/graph/react/index.js.map +1 -1
  18. package/dist/graph/react/styles/simple/SimpleDetailPanel.css +492 -0
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +8 -4
  21. package/dist/{registryJoin-C6Wfkik-.d.ts → registryJoin-C7paykZ2.d.ts} +1 -1
  22. package/dist/standalone/graph-standalone.html +620 -127
  23. package/dist/standalone/graph-viewer.css +493 -0
  24. package/dist/standalone/graph-viewer.js +127 -127
  25. package/dist/static-graph/index.d.ts +1 -1
  26. package/dist/static-graph/index.js +1 -1
  27. package/dist/timeline/index.d.ts +3 -3
  28. package/dist/timeline/index.js +2 -2
  29. package/dist/timeline/react/index.d.ts +2 -2
  30. package/dist/timeline/react/index.js +5 -5
  31. package/dist/{types-DLAnYNoi.d.ts → types-DgYaVX6K.d.ts} +8 -0
  32. package/package.json +3 -2
  33. package/dist/chunk-5E3UJI2I.js.map +0 -1
  34. package/dist/chunk-N2F62MW7.js.map +0 -1
  35. /package/dist/{chunk-ENRYQOCO.js.map → chunk-CZGIDVT7.js.map} +0 -0
  36. /package/dist/{chunk-7JZBXBZS.js.map → chunk-DNYJEPHT.js.map} +0 -0
  37. /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,
@@ -2206,8 +2208,22 @@ function stepIdentity(spec) {
2206
2208
  function forEachLabel(itemName) {
2207
2209
  return `For each ${humanizeInSentence(itemName)}`;
2208
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
+ }
2209
2225
  function projectSimpleGraph(input) {
2210
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2226
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2211
2227
  const { graphspec, nodes, analysis, rawAnalysis } = input;
2212
2228
  const graphMode = graphSpecMode(graphspec);
2213
2229
  const specById = new Map(graphspec.nodes.map((n) => [n.id, n]));
@@ -2280,11 +2296,15 @@ function projectSimpleGraph(input) {
2280
2296
  if (!hidden.has(batchId) && cards.has(branchId)) markedSteps[branchId] = batchId;
2281
2297
  }
2282
2298
  const runStatuses = /* @__PURE__ */ new Map();
2299
+ const runIds = /* @__PURE__ */ new Map();
2283
2300
  for (const spec of graphspec.nodes) {
2284
2301
  const rep = repOf(spec.id);
2285
2302
  const statuses = runStatuses.get(rep);
2286
2303
  if (statuses) statuses.push(spec.status);
2287
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]);
2288
2308
  }
2289
2309
  function stepStatus(spec) {
2290
2310
  var _a2, _b2;
@@ -2318,6 +2338,7 @@ function projectSimpleGraph(input) {
2318
2338
  }
2319
2339
  }
2320
2340
  const combinedFrom = /* @__PURE__ */ new Map();
2341
+ const combinedInto = /* @__PURE__ */ new Map();
2321
2342
  for (const edge of graphspec.edges) {
2322
2343
  const from = edge.source_stuff_digest;
2323
2344
  const into = edge.target_stuff_digest;
@@ -2328,6 +2349,9 @@ function projectSimpleGraph(input) {
2328
2349
  const list = combinedFrom.get(into);
2329
2350
  if (list) list.push(from);
2330
2351
  else combinedFrom.set(into, [from]);
2352
+ const intos = combinedInto.get(from);
2353
+ if (intos) intos.push(into);
2354
+ else combinedInto.set(from, [into]);
2331
2355
  }
2332
2356
  const sourceMemo = /* @__PURE__ */ new Map();
2333
2357
  function sourcesOf(digest, visiting = /* @__PURE__ */ new Set()) {
@@ -2406,22 +2430,28 @@ function projectSimpleGraph(input) {
2406
2430
  }
2407
2431
  const edges = /* @__PURE__ */ new Map();
2408
2432
  let edgeCount = 0;
2409
- function addEdge(source, target) {
2433
+ function addEdge(source, target, digest, newOnly = false) {
2434
+ var _a2, _b2;
2410
2435
  if (source === target) return;
2411
2436
  const key = `${source}->${target}`;
2412
- if (edges.has(key)) return;
2413
- const label = decisionSet.has(source) ? outcomeFor(source, branchOf(source, target)) : void 0;
2414
- 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];
2415
2445
  }
2416
- function route(sources, target) {
2446
+ function route(sources, target, digest, newOnly = false) {
2417
2447
  let froms = [...sources];
2418
2448
  for (const decisionId of decisionsAbove(target)) {
2419
2449
  const outside = froms.filter((s) => !isInside(s, decisionId));
2420
2450
  if (outside.length === 0) continue;
2421
- for (const source of outside) addEdge(source, decisionId);
2451
+ for (const source of outside) addEdge(source, decisionId, digest, newOnly);
2422
2452
  froms = [decisionId, ...froms.filter((s) => isInside(s, decisionId))];
2423
2453
  }
2424
- for (const source of froms) addEdge(source, target);
2454
+ for (const source of froms) addEdge(source, target, digest, newOnly);
2425
2455
  }
2426
2456
  const danglingInputs = /* @__PURE__ */ new Map();
2427
2457
  function sourcesOrDangling(digest) {
@@ -2435,10 +2465,11 @@ function projectSimpleGraph(input) {
2435
2465
  }, entry.concept !== void 0 ? { concept: entry.concept } : {}), entry.multiplicity !== void 0 ? { multiplicity: entry.multiplicity } : {}));
2436
2466
  return [stuffNodeId(digest)];
2437
2467
  }
2468
+ const laterReads = [];
2438
2469
  function routeRead(digest, readerId) {
2439
2470
  const target = drawnAs(readerId);
2440
- if (target === readerId) route(sourcesOrDangling(digest), target);
2441
- else route(sourcesOf(digest), target);
2471
+ if (target === readerId) route(sourcesOrDangling(digest), target, digest);
2472
+ else laterReads.push([digest, readerId]);
2442
2473
  }
2443
2474
  for (const [digest, consumers] of Object.entries(analysis.stuffConsumers)) {
2444
2475
  for (const consumerId of consumers) {
@@ -2451,8 +2482,11 @@ function projectSimpleGraph(input) {
2451
2482
  if (item.digest) routeRead(item.digest, conditionId);
2452
2483
  }
2453
2484
  }
2485
+ for (const [digest, readerId] of laterReads) {
2486
+ route(sourcesOf(digest), drawnAs(readerId), digest, true);
2487
+ }
2454
2488
  for (const digest of outputItems.keys()) {
2455
- for (const source of sourcesOf(digest)) addEdge(source, stuffNodeId(digest));
2489
+ for (const source of sourcesOf(digest)) addEdge(source, stuffNodeId(digest), digest);
2456
2490
  }
2457
2491
  for (const [key, edge] of [...edges]) {
2458
2492
  if (!decisionSet.has(edge.source)) continue;
@@ -2481,24 +2515,10 @@ function projectSimpleGraph(input) {
2481
2515
  }
2482
2516
  }
2483
2517
  const simpleNodes = [];
2484
- function isBuiltInConcept(conceptRef) {
2485
- const info = resolveConceptRef(graphspec, conceptRef);
2486
- if (info) return info.domain_code === NATIVE_DOMAIN;
2487
- return conceptRef.startsWith(`${NATIVE_DOMAIN}.`) || isGenericConcept(conceptRef);
2488
- }
2489
2518
  function terminalNode(item, kind) {
2490
2519
  const digest = item.digest;
2491
- const concept = item.concept;
2492
2520
  const isList = isPluralMultiplicity(item.multiplicity);
2493
- let title;
2494
- let subtitle;
2495
- if (kind === "output" && concept && !isBuiltInConcept(concept)) {
2496
- title = conceptPlainName(concept);
2497
- } else {
2498
- title = humanizeIdentifier(item.name);
2499
- const plain = concept ? conceptPlainName(concept) : void 0;
2500
- subtitle = plain && plain.toLowerCase() !== title.toLowerCase() ? plain : void 0;
2501
- }
2521
+ const { title, subtitle } = simpleValueTitle(graphspec, item, kind);
2502
2522
  const simple = __spreadValues({ kind, title, isList }, subtitle ? { subtitle } : {});
2503
2523
  return {
2504
2524
  id: stuffNodeId(digest),
@@ -2717,10 +2737,56 @@ function projectSimpleGraph(input) {
2717
2737
  return found;
2718
2738
  }
2719
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]);
2720
2784
  return {
2721
2785
  nodes: simpleNodes,
2722
2786
  edges: [...edges.values()],
2723
2787
  standIns,
2788
+ valueFlows,
2789
+ runs,
2724
2790
  analysis: {
2725
2791
  stuffRegistry: analysis.stuffRegistry,
2726
2792
  stuffProducers: {},
@@ -2838,6 +2904,320 @@ var GRAPH_STYLE_PIPELINES = {
2838
2904
  }
2839
2905
  };
2840
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
+
2841
3221
  export {
2842
3222
  GraphSpecValidationError,
2843
3223
  validateGraphSpec,
@@ -2894,10 +3274,12 @@ export {
2894
3274
  simpleDecisionSize,
2895
3275
  simpleTitleWrap,
2896
3276
  aggregateStatus,
3277
+ simpleValueTitle,
2897
3278
  projectSimpleGraph,
2898
3279
  simpleEdgeLabelSize,
2899
3280
  simpleDefaultFolds,
2900
3281
  applySimpleFrames,
2901
- GRAPH_STYLE_PIPELINES
3282
+ GRAPH_STYLE_PIPELINES,
3283
+ buildSimpleNodeDetail
2902
3284
  };
2903
- //# sourceMappingURL=chunk-5E3UJI2I.js.map
3285
+ //# sourceMappingURL=chunk-SCKRIESM.js.map