footprint-explainable-ui 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2285,7 +2285,7 @@ function flattenTree(node, out, sharedState, accumulatedMs = 0, subflowResults,
2285
2285
  const startMs = accumulatedMs;
2286
2286
  const stageId = node.id || node.name || "unknown";
2287
2287
  const displayName = node.name || node.id || "unknown";
2288
- const stageLines = stageNarrativeMap.get(stageId);
2288
+ const stageLines = stageNarrativeMap.get(stageId) ?? stageNarrativeMap.get(displayName);
2289
2289
  let narrative;
2290
2290
  if (stageLines) {
2291
2291
  narrative = stageLines.join("\n");
@@ -3848,7 +3848,9 @@ function resolveSubflowLevel(parentSpec, parentSnapshots, subflowNodeName, narra
3848
3848
  (s) => s.stageName === subflowNodeName || s.stageLabel === subflowNodeName
3849
3849
  );
3850
3850
  if (!parentSnap?.subflowResult) return null;
3851
- const sfNarrative = narrativeEntries ? extractSubflowNarrative(narrativeEntries, subflowNodeName) : void 0;
3851
+ const sfId = specNode.subflowId ?? subflowNodeName;
3852
+ const sfDisplayName = specNode.subflowName ?? specNode.name;
3853
+ const sfNarrative = narrativeEntries ? extractSubflowNarrative(narrativeEntries, sfId, sfDisplayName) : void 0;
3852
3854
  const sfSnapshots = subflowResultToSnapshots(parentSnap.subflowResult, sfNarrative);
3853
3855
  if (sfSnapshots.length === 0) return null;
3854
3856
  return {
@@ -3858,15 +3860,21 @@ function resolveSubflowLevel(parentSpec, parentSnapshots, subflowNodeName, narra
3858
3860
  snapshots: sfSnapshots
3859
3861
  };
3860
3862
  }
3861
- function extractSubflowNarrative(entries, subflowName) {
3863
+ function extractSubflowNarrative(entries, subflowId, subflowName) {
3864
+ const prefix = subflowId + "/";
3865
+ const byPrefix = entries.filter((e) => e.stageName?.startsWith(prefix));
3866
+ if (byPrefix.length > 0) return byPrefix;
3867
+ const byId = entries.filter((e) => e.subflowId === subflowId);
3868
+ if (byId.length > 0) return byId;
3862
3869
  const result = [];
3870
+ const searchName = subflowName ?? subflowId;
3863
3871
  let inside = false;
3864
3872
  for (const entry of entries) {
3865
- if (entry.type === "subflow" && entry.text.includes(subflowName) && entry.text.startsWith("Entering")) {
3873
+ if (entry.type === "subflow" && entry.text.includes(searchName) && entry.text.startsWith("Entering")) {
3866
3874
  inside = true;
3867
3875
  continue;
3868
3876
  }
3869
- if (inside && entry.type === "subflow" && entry.text.includes(subflowName) && entry.text.startsWith("Exiting")) break;
3877
+ if (inside && entry.type === "subflow" && entry.text.includes(searchName) && entry.text.startsWith("Exiting")) break;
3870
3878
  if (inside) result.push(entry);
3871
3879
  }
3872
3880
  return result;