@railtownai/railtracks-visualizer 0.0.69 → 0.0.70

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/esm/index.js CHANGED
@@ -12919,7 +12919,7 @@ const createLucideIcon = (iconName, iconNode)=>{
12919
12919
  return Component;
12920
12920
  };
12921
12921
 
12922
- const __iconNode$A = [
12922
+ const __iconNode$C = [
12923
12923
  [
12924
12924
  "path",
12925
12925
  {
@@ -12935,9 +12935,9 @@ const __iconNode$A = [
12935
12935
  }
12936
12936
  ]
12937
12937
  ];
12938
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$A);
12938
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$C);
12939
12939
 
12940
- const __iconNode$z = [
12940
+ const __iconNode$B = [
12941
12941
  [
12942
12942
  "path",
12943
12943
  {
@@ -12953,9 +12953,9 @@ const __iconNode$z = [
12953
12953
  }
12954
12954
  ]
12955
12955
  ];
12956
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$z);
12956
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$B);
12957
12957
 
12958
- const __iconNode$y = [
12958
+ const __iconNode$A = [
12959
12959
  [
12960
12960
  "path",
12961
12961
  {
@@ -13003,9 +13003,9 @@ const __iconNode$y = [
13003
13003
  }
13004
13004
  ]
13005
13005
  ];
13006
- const Bot = createLucideIcon("bot", __iconNode$y);
13006
+ const Bot = createLucideIcon("bot", __iconNode$A);
13007
13007
 
13008
- const __iconNode$x = [
13008
+ const __iconNode$z = [
13009
13009
  [
13010
13010
  "path",
13011
13011
  {
@@ -13039,9 +13039,9 @@ const __iconNode$x = [
13039
13039
  }
13040
13040
  ]
13041
13041
  ];
13042
- const Calendar = createLucideIcon("calendar", __iconNode$x);
13042
+ const Calendar = createLucideIcon("calendar", __iconNode$z);
13043
13043
 
13044
- const __iconNode$w = [
13044
+ const __iconNode$y = [
13045
13045
  [
13046
13046
  "path",
13047
13047
  {
@@ -13098,9 +13098,9 @@ const __iconNode$w = [
13098
13098
  }
13099
13099
  ]
13100
13100
  ];
13101
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$w);
13101
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$y);
13102
13102
 
13103
- const __iconNode$v = [
13103
+ const __iconNode$x = [
13104
13104
  [
13105
13105
  "path",
13106
13106
  {
@@ -13109,9 +13109,9 @@ const __iconNode$v = [
13109
13109
  }
13110
13110
  ]
13111
13111
  ];
13112
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$v);
13112
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
13113
13113
 
13114
- const __iconNode$u = [
13114
+ const __iconNode$w = [
13115
13115
  [
13116
13116
  "path",
13117
13117
  {
@@ -13120,9 +13120,9 @@ const __iconNode$u = [
13120
13120
  }
13121
13121
  ]
13122
13122
  ];
13123
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$u);
13123
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$w);
13124
13124
 
13125
- const __iconNode$t = [
13125
+ const __iconNode$v = [
13126
13126
  [
13127
13127
  "path",
13128
13128
  {
@@ -13138,9 +13138,9 @@ const __iconNode$t = [
13138
13138
  }
13139
13139
  ]
13140
13140
  ];
13141
- const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$t);
13141
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$v);
13142
13142
 
13143
- const __iconNode$s = [
13143
+ const __iconNode$u = [
13144
13144
  [
13145
13145
  "path",
13146
13146
  {
@@ -13156,9 +13156,9 @@ const __iconNode$s = [
13156
13156
  }
13157
13157
  ]
13158
13158
  ];
13159
- const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$s);
13159
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$u);
13160
13160
 
13161
- const __iconNode$r = [
13161
+ const __iconNode$t = [
13162
13162
  [
13163
13163
  "circle",
13164
13164
  {
@@ -13189,9 +13189,9 @@ const __iconNode$r = [
13189
13189
  }
13190
13190
  ]
13191
13191
  ];
13192
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$r);
13192
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$t);
13193
13193
 
13194
- const __iconNode$q = [
13194
+ const __iconNode$s = [
13195
13195
  [
13196
13196
  "path",
13197
13197
  {
@@ -13207,9 +13207,9 @@ const __iconNode$q = [
13207
13207
  }
13208
13208
  ]
13209
13209
  ];
13210
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$q);
13210
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$s);
13211
13211
 
13212
- const __iconNode$p = [
13212
+ const __iconNode$r = [
13213
13213
  [
13214
13214
  "circle",
13215
13215
  {
@@ -13234,9 +13234,9 @@ const __iconNode$p = [
13234
13234
  }
13235
13235
  ]
13236
13236
  ];
13237
- const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$p);
13237
+ const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$r);
13238
13238
 
13239
- const __iconNode$o = [
13239
+ const __iconNode$q = [
13240
13240
  [
13241
13241
  "circle",
13242
13242
  {
@@ -13254,9 +13254,9 @@ const __iconNode$o = [
13254
13254
  }
13255
13255
  ]
13256
13256
  ];
13257
- const Clock = createLucideIcon("clock", __iconNode$o);
13257
+ const Clock = createLucideIcon("clock", __iconNode$q);
13258
13258
 
13259
- const __iconNode$n = [
13259
+ const __iconNode$p = [
13260
13260
  [
13261
13261
  "rect",
13262
13262
  {
@@ -13277,9 +13277,9 @@ const __iconNode$n = [
13277
13277
  }
13278
13278
  ]
13279
13279
  ];
13280
- const Copy = createLucideIcon("copy", __iconNode$n);
13280
+ const Copy = createLucideIcon("copy", __iconNode$p);
13281
13281
 
13282
- const __iconNode$m = [
13282
+ const __iconNode$o = [
13283
13283
  [
13284
13284
  "path",
13285
13285
  {
@@ -13387,9 +13387,9 @@ const __iconNode$m = [
13387
13387
  }
13388
13388
  ]
13389
13389
  ];
13390
- const Cpu = createLucideIcon("cpu", __iconNode$m);
13390
+ const Cpu = createLucideIcon("cpu", __iconNode$o);
13391
13391
 
13392
- const __iconNode$l = [
13392
+ const __iconNode$n = [
13393
13393
  [
13394
13394
  "line",
13395
13395
  {
@@ -13408,9 +13408,9 @@ const __iconNode$l = [
13408
13408
  }
13409
13409
  ]
13410
13410
  ];
13411
- const DollarSign = createLucideIcon("dollar-sign", __iconNode$l);
13411
+ const DollarSign = createLucideIcon("dollar-sign", __iconNode$n);
13412
13412
 
13413
- const __iconNode$k = [
13413
+ const __iconNode$m = [
13414
13414
  [
13415
13415
  "path",
13416
13416
  {
@@ -13440,9 +13440,9 @@ const __iconNode$k = [
13440
13440
  }
13441
13441
  ]
13442
13442
  ];
13443
- const FileInput = createLucideIcon("file-input", __iconNode$k);
13443
+ const FileInput = createLucideIcon("file-input", __iconNode$m);
13444
13444
 
13445
- const __iconNode$j = [
13445
+ const __iconNode$l = [
13446
13446
  [
13447
13447
  "path",
13448
13448
  {
@@ -13472,9 +13472,9 @@ const __iconNode$j = [
13472
13472
  }
13473
13473
  ]
13474
13474
  ];
13475
- const FileOutput = createLucideIcon("file-output", __iconNode$j);
13475
+ const FileOutput = createLucideIcon("file-output", __iconNode$l);
13476
13476
 
13477
- const __iconNode$i = [
13477
+ const __iconNode$k = [
13478
13478
  [
13479
13479
  "path",
13480
13480
  {
@@ -13532,9 +13532,27 @@ const __iconNode$i = [
13532
13532
  }
13533
13533
  ]
13534
13534
  ];
13535
- const FoldVertical = createLucideIcon("fold-vertical", __iconNode$i);
13535
+ const FoldVertical = createLucideIcon("fold-vertical", __iconNode$k);
13536
13536
 
13537
- const __iconNode$h = [
13537
+ const __iconNode$j = [
13538
+ [
13539
+ "path",
13540
+ {
13541
+ d: "m12 14 4-4",
13542
+ key: "9kzdfg"
13543
+ }
13544
+ ],
13545
+ [
13546
+ "path",
13547
+ {
13548
+ d: "M3.34 19a10 10 0 1 1 17.32 0",
13549
+ key: "19p75a"
13550
+ }
13551
+ ]
13552
+ ];
13553
+ const Gauge = createLucideIcon("gauge", __iconNode$j);
13554
+
13555
+ const __iconNode$i = [
13538
13556
  [
13539
13557
  "line",
13540
13558
  {
@@ -13576,9 +13594,9 @@ const __iconNode$h = [
13576
13594
  }
13577
13595
  ]
13578
13596
  ];
13579
- const Hash = createLucideIcon("hash", __iconNode$h);
13597
+ const Hash = createLucideIcon("hash", __iconNode$i);
13580
13598
 
13581
- const __iconNode$g = [
13599
+ const __iconNode$h = [
13582
13600
  [
13583
13601
  "circle",
13584
13602
  {
@@ -13603,9 +13621,9 @@ const __iconNode$g = [
13603
13621
  }
13604
13622
  ]
13605
13623
  ];
13606
- const Info = createLucideIcon("info", __iconNode$g);
13624
+ const Info = createLucideIcon("info", __iconNode$h);
13607
13625
 
13608
- const __iconNode$f = [
13626
+ const __iconNode$g = [
13609
13627
  [
13610
13628
  "path",
13611
13629
  {
@@ -13642,9 +13660,9 @@ const __iconNode$f = [
13642
13660
  }
13643
13661
  ]
13644
13662
  ];
13645
- const ListChecks = createLucideIcon("list-checks", __iconNode$f);
13663
+ const ListChecks = createLucideIcon("list-checks", __iconNode$g);
13646
13664
 
13647
- const __iconNode$e = [
13665
+ const __iconNode$f = [
13648
13666
  [
13649
13667
  "path",
13650
13668
  {
@@ -13674,9 +13692,9 @@ const __iconNode$e = [
13674
13692
  }
13675
13693
  ]
13676
13694
  ];
13677
- const MessageSquareText = createLucideIcon("message-square-text", __iconNode$e);
13695
+ const MessageSquareText = createLucideIcon("message-square-text", __iconNode$f);
13678
13696
 
13679
- const __iconNode$d = [
13697
+ const __iconNode$e = [
13680
13698
  [
13681
13699
  "path",
13682
13700
  {
@@ -13692,9 +13710,9 @@ const __iconNode$d = [
13692
13710
  }
13693
13711
  ]
13694
13712
  ];
13695
- const MessagesSquare = createLucideIcon("messages-square", __iconNode$d);
13713
+ const MessagesSquare = createLucideIcon("messages-square", __iconNode$e);
13696
13714
 
13697
- const __iconNode$c = [
13715
+ const __iconNode$d = [
13698
13716
  [
13699
13717
  "rect",
13700
13718
  {
@@ -13714,9 +13732,9 @@ const __iconNode$c = [
13714
13732
  }
13715
13733
  ]
13716
13734
  ];
13717
- const PanelLeft = createLucideIcon("panel-left", __iconNode$c);
13735
+ const PanelLeft = createLucideIcon("panel-left", __iconNode$d);
13718
13736
 
13719
- const __iconNode$b = [
13737
+ const __iconNode$c = [
13720
13738
  [
13721
13739
  "rect",
13722
13740
  {
@@ -13743,9 +13761,9 @@ const __iconNode$b = [
13743
13761
  }
13744
13762
  ]
13745
13763
  ];
13746
- const PanelRightOpen = createLucideIcon("panel-right-open", __iconNode$b);
13764
+ const PanelRightOpen = createLucideIcon("panel-right-open", __iconNode$c);
13747
13765
 
13748
- const __iconNode$a = [
13766
+ const __iconNode$b = [
13749
13767
  [
13750
13768
  "path",
13751
13769
  {
@@ -13775,9 +13793,9 @@ const __iconNode$a = [
13775
13793
  }
13776
13794
  ]
13777
13795
  ];
13778
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$a);
13796
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$b);
13779
13797
 
13780
- const __iconNode$9 = [
13798
+ const __iconNode$a = [
13781
13799
  [
13782
13800
  "path",
13783
13801
  {
@@ -13814,9 +13832,9 @@ const __iconNode$9 = [
13814
13832
  }
13815
13833
  ]
13816
13834
  ];
13817
- const Scale = createLucideIcon("scale", __iconNode$9);
13835
+ const Scale = createLucideIcon("scale", __iconNode$a);
13818
13836
 
13819
- const __iconNode$8 = [
13837
+ const __iconNode$9 = [
13820
13838
  [
13821
13839
  "path",
13822
13840
  {
@@ -13850,9 +13868,9 @@ const __iconNode$8 = [
13850
13868
  }
13851
13869
  ]
13852
13870
  ];
13853
- const Settings2 = createLucideIcon("settings-2", __iconNode$8);
13871
+ const Settings2 = createLucideIcon("settings-2", __iconNode$9);
13854
13872
 
13855
- const __iconNode$7 = [
13873
+ const __iconNode$8 = [
13856
13874
  [
13857
13875
  "path",
13858
13876
  {
@@ -13875,9 +13893,9 @@ const __iconNode$7 = [
13875
13893
  }
13876
13894
  ]
13877
13895
  ];
13878
- const Share = createLucideIcon("share", __iconNode$7);
13896
+ const Share = createLucideIcon("share", __iconNode$8);
13879
13897
 
13880
- const __iconNode$6 = [
13898
+ const __iconNode$7 = [
13881
13899
  [
13882
13900
  "path",
13883
13901
  {
@@ -13886,7 +13904,35 @@ const __iconNode$6 = [
13886
13904
  }
13887
13905
  ]
13888
13906
  ];
13889
- const Shield = createLucideIcon("shield", __iconNode$6);
13907
+ const Shield = createLucideIcon("shield", __iconNode$7);
13908
+
13909
+ const __iconNode$6 = [
13910
+ [
13911
+ "path",
13912
+ {
13913
+ d: "M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",
13914
+ key: "16rjxf"
13915
+ }
13916
+ ],
13917
+ [
13918
+ "path",
13919
+ {
13920
+ d: "M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",
13921
+ key: "178nd4"
13922
+ }
13923
+ ],
13924
+ [
13925
+ "circle",
13926
+ {
13927
+ cx: "10.5",
13928
+ cy: "6.5",
13929
+ r: ".5",
13930
+ fill: "currentColor",
13931
+ key: "12ikhr"
13932
+ }
13933
+ ]
13934
+ ];
13935
+ const Tags = createLucideIcon("tags", __iconNode$6);
13890
13936
 
13891
13937
  const __iconNode$5 = [
13892
13938
  [
@@ -112605,7 +112651,32 @@ const GuardrailsPopover = ({ guardrails, title = "Guardrails", placement = "righ
112605
112651
  })));
112606
112652
  };
112607
112653
 
112608
- const getNodeLatency = (node)=>node.details?.internals?.latency?.total_time ?? 0;
112654
+ /** Collect start/end instants (unix seconds) for wall-clock span of a single node. */ const getNodeStampTimes = (node)=>{
112655
+ const start = node.stamp?.time;
112656
+ if (start == null) return [];
112657
+ const times = [
112658
+ start
112659
+ ];
112660
+ const latency = node.details?.internals?.latency?.total_time;
112661
+ if (latency != null && latency > 0) times.push(start + latency);
112662
+ return times;
112663
+ };
112664
+ const wallClockSpanSeconds = (times)=>{
112665
+ if (times.length === 0) return 0;
112666
+ const min = Math.min(...times);
112667
+ const max = Math.max(...times);
112668
+ return Math.max(0, max - min);
112669
+ };
112670
+ const collectSubtreeStampTimes = (nodeId, childrenMap, nodeMap)=>{
112671
+ const node = nodeMap.get(nodeId);
112672
+ if (!node) return [];
112673
+ const times = getNodeStampTimes(node);
112674
+ for (const childId of childrenMap.get(nodeId) ?? []){
112675
+ times.push(...collectSubtreeStampTimes(childId, childrenMap, nodeMap));
112676
+ }
112677
+ return times;
112678
+ };
112679
+ /** Wall-clock elapsed time across a node and all descendants (unix stamp times). */ const getSubtreeWallClockSeconds = (nodeId, childrenMap, nodeMap)=>wallClockSpanSeconds(collectSubtreeStampTimes(nodeId, childrenMap, nodeMap));
112609
112680
  const SessionTreeNodeTitle = ({ displayName, subtreeLatency, guardrails })=>{
112610
112681
  return /*#__PURE__*/ React__default.createElement("span", {
112611
112682
  style: {
@@ -112733,8 +112804,7 @@ const buildNodeTree = (run)=>{
112733
112804
  const nodeKey = `node::${run.run_id}::${node.identifier}`;
112734
112805
  const childIds = childrenMap.get(node.identifier) || [];
112735
112806
  const children = childIds.map((id)=>nodeMap.get(id)).filter((n)=>n != null).sort((a, b)=>(a.stamp?.step ?? 0) - (b.stamp?.step ?? 0)).map(buildTreeNode);
112736
- const childLatency = children.reduce((s, c)=>s + (c.subtreeLatency ?? 0), 0);
112737
- const subtreeLatency = getNodeLatency(node) + childLatency;
112807
+ const subtreeLatency = getSubtreeWallClockSeconds(node.identifier, childrenMap, nodeMap);
112738
112808
  const guardrails = node.details?.internals?.guard_details ?? [];
112739
112809
  const isTool = node.node_type === "Tool";
112740
112810
  const failed = isNodeFailureFromIncomingEdge(run, node.identifier);
@@ -113356,7 +113426,7 @@ const SessionDetails = ({ session, open, onClose, initialNodeId, initialRunId, l
113356
113426
 
113357
113427
  /**
113358
113428
  * DTOs for evaluation data from .railtracks/data/evaluations/*.json
113359
- */ /** Numeric metric definition (LLMMetric or ToolMetric) */ /** Type guard for LLM result */ function isLLMResult(item) {
113429
+ */ /** Numeric metric definition (LLMMetric, ToolMetric, or Numerical for custom evaluators) */ /** Type guard for LLM result */ function isLLMResult(item) {
113360
113430
  return item.type === "LLM";
113361
113431
  }
113362
113432
  /** Type guard for Tool result */ function isToolResult(item) {
@@ -113374,8 +113444,12 @@ const SessionDetails = ({ session, open, onClose, initialNodeId, initialRunId, l
113374
113444
  /** Type guard for CategoricalAggregate */ function isAggregateCategorical(item) {
113375
113445
  return item.type === "CategoricalAggregate";
113376
113446
  }
113377
- /** Type guard for aggregated stats (numeric - LLMInferenceAggregate or ToolAggregate) */ function isAggregatedStats(item) {
113378
- return item.type === "LLMInferenceAggregate" || item.type === "ToolAggregate";
113447
+ /** Type guard for NumericalAggregate (custom evaluator numeric aggregate) */ function isNumericalAggregate(item) {
113448
+ return item.type === "NumericalAggregate";
113449
+ }
113450
+ /** Type guard for aggregated stats (numeric - LLMInferenceAggregate, ToolAggregate, or NumericalAggregate) */ function isAggregatedStats(item) {
113451
+ const type = item.type;
113452
+ return type === "LLMInferenceAggregate" || type === "ToolAggregate" || type === "NumericalAggregate";
113379
113453
  }
113380
113454
 
113381
113455
  function isCategoricalMetric$1(def) {
@@ -113391,7 +113465,8 @@ function isCategoricalMetric$1(def) {
113391
113465
  const aggregateTypes = [
113392
113466
  "ToolAggregate",
113393
113467
  "LLMInferenceAggregate",
113394
- "CategoricalAggregate"
113468
+ "CategoricalAggregate",
113469
+ "NumericalAggregate"
113395
113470
  ];
113396
113471
  const aggregateItems = Object.values(nodes).filter((n)=>n?.type && aggregateTypes.includes(n.type));
113397
113472
  return [
@@ -117057,7 +117132,7 @@ function buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCount
117057
117132
 
117058
117133
  const JUDGE_RESULT_PREFIX = "JudgeResult/";
117059
117134
  const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
117060
- /** Map agent node id -> session id from the agents array (new format only). */ function buildSessionByNodeId(agents) {
117135
+ /** Map agent node id -> session id from the agents array (new format only). */ function buildSessionByNodeId$1(agents) {
117061
117136
  const map = new Map();
117062
117137
  for (const agent of agents ?? []){
117063
117138
  for (const entry of agent.agent_node_ids ?? []){
@@ -117081,10 +117156,10 @@ const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
117081
117156
  }
117082
117157
  return map;
117083
117158
  }
117084
- function metricNameOf(agg) {
117159
+ function metricNameOf$1(agg) {
117085
117160
  return agg.metric?.name ?? agg.name?.replace(/^Aggregate\//, "") ?? "Unknown";
117086
117161
  }
117087
- /** Collect the JudgeResult leaf nodes (label + node id) grouped by label. */ function groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey) {
117162
+ /** Collect the leaf nodes (label + node id) grouped by label. */ function groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey) {
117088
117163
  const byLabel = new Map();
117089
117164
  const seen = new Set();
117090
117165
  const push = (label, nodeId)=>{
@@ -117122,15 +117197,15 @@ function metricNameOf(agg) {
117122
117197
  }
117123
117198
  return byLabel;
117124
117199
  }
117125
- /** Build the Judge view model: one entry per categorical metric. */ function buildJudgeMetricsFromAggregate(input) {
117200
+ /** Build the categorical view model: one entry per categorical metric. */ function buildCategoricalMetricsFromAggregate(input) {
117126
117201
  const { roots, nodes, agents, rawResults = [] } = input;
117127
- const sessionByNodeId = buildSessionByNodeId(agents);
117202
+ const sessionByNodeId = buildSessionByNodeId$1(agents);
117128
117203
  const reasoningByKey = buildReasoningByKey(rawResults);
117129
117204
  // Prefer roots; fall back to scanning all nodes for categorical aggregates.
117130
117205
  const rootAggregates = roots.map((id)=>nodes[id]).filter((n)=>isAggregateCategorical(n));
117131
117206
  const aggregates = rootAggregates.length > 0 ? rootAggregates : Object.values(nodes).filter((n)=>isAggregateCategorical(n));
117132
117207
  return aggregates.map((agg, index)=>{
117133
- const metricName = metricNameOf(agg);
117208
+ const metricName = metricNameOf$1(agg);
117134
117209
  const counts = agg.counts ?? {};
117135
117210
  const categories = agg.categories ?? agg.metric?.categories ?? Object.keys(counts);
117136
117211
  const byLabel = groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey);
@@ -117162,6 +117237,75 @@ function metricNameOf(agg) {
117162
117237
  });
117163
117238
  }
117164
117239
 
117240
+ /** Map agent node id -> session id from the agents array (new format only). */ function buildSessionByNodeId(agents) {
117241
+ const map = new Map();
117242
+ for (const agent of agents ?? []){
117243
+ for (const entry of agent.agent_node_ids ?? []){
117244
+ if (entry && typeof entry === "object" && "agent_node_id" in entry) {
117245
+ map.set(entry.agent_node_id, entry.session_id);
117246
+ }
117247
+ }
117248
+ }
117249
+ return map;
117250
+ }
117251
+ function metricNameOf(agg) {
117252
+ return agg.metric?.name ?? agg.name?.replace(/^Aggregate\//, "") ?? "Unknown";
117253
+ }
117254
+ /** Collect the per-run leaf values (value + node id) for a numerical aggregate. */ function collectNodes(agg, nodes, rawResults, metricName, sessionByNodeId) {
117255
+ const refs = [];
117256
+ const seen = new Set();
117257
+ const push = (nodeId, value)=>{
117258
+ if (!Number.isFinite(value) || seen.has(nodeId)) return;
117259
+ seen.add(nodeId);
117260
+ refs.push({
117261
+ nodeId,
117262
+ sessionId: sessionByNodeId.get(nodeId),
117263
+ value
117264
+ });
117265
+ };
117266
+ // Preferred: walk the aggregate's children leaf nodes.
117267
+ for (const childId of agg.children ?? []){
117268
+ const child = nodes[childId];
117269
+ if (child && isBaseResult(child)) {
117270
+ const nodeId = child.agent_data_id?.[0];
117271
+ if (nodeId) push(nodeId, Number(child.value));
117272
+ }
117273
+ }
117274
+ // Fallback: derive from raw Base results named after the metric when no children resolve.
117275
+ if (refs.length === 0) {
117276
+ for (const item of rawResults){
117277
+ if (isBaseResult(item) && item.result_name === metricName) {
117278
+ const nodeId = item.agent_data_id?.[0];
117279
+ if (nodeId) push(nodeId, Number(item.value));
117280
+ }
117281
+ }
117282
+ }
117283
+ return refs;
117284
+ }
117285
+ /** Build the custom (numerical) evaluator view model: one entry per numerical metric. */ function buildNumericalMetricsFromAggregate(input) {
117286
+ const { roots, nodes, agents, rawResults = [] } = input;
117287
+ const sessionByNodeId = buildSessionByNodeId(agents);
117288
+ // Prefer roots; fall back to scanning all nodes for numerical aggregates.
117289
+ const rootAggregates = roots.map((id)=>nodes[id]).filter((n)=>isNumericalAggregate(n));
117290
+ const aggregates = rootAggregates.length > 0 ? rootAggregates : Object.values(nodes).filter((n)=>isNumericalAggregate(n));
117291
+ return aggregates.map((agg, index)=>{
117292
+ const metricName = metricNameOf(agg);
117293
+ const nodeRefs = collectNodes(agg, nodes, rawResults, metricName, sessionByNodeId);
117294
+ return {
117295
+ key: agg.identifier ?? `${metricName}-${index}`,
117296
+ metricName,
117297
+ description: agg.metric?.description ?? undefined,
117298
+ mean: agg.mean,
117299
+ minimum: agg.minimum,
117300
+ maximum: agg.maximum,
117301
+ median: agg.median,
117302
+ std: agg.std,
117303
+ count: agg.values?.length ?? nodeRefs.length,
117304
+ nodes: nodeRefs
117305
+ };
117306
+ });
117307
+ }
117308
+
117165
117309
  const NodeActions = ({ sessionId, nodeId, onAgentNodeClick, onOpenVisualizer })=>{
117166
117310
  const { theme } = useTheme$1();
117167
117311
  const baseStyle = {
@@ -117223,7 +117367,7 @@ const NodeActions = ({ sessionId, nodeId, onAgentNodeClick, onOpenVisualizer })=
117223
117367
  }), "Visualizer")));
117224
117368
  };
117225
117369
 
117226
- const NodeRow = ({ node, metricName, onAgentNodeClick, onOpenVisualizer })=>{
117370
+ const NodeRow$1 = ({ node, metricName, onAgentNodeClick, onOpenVisualizer })=>{
117227
117371
  const { theme } = useTheme$1();
117228
117372
  const [showReasoning, setShowReasoning] = useState(false);
117229
117373
  return /*#__PURE__*/ React__default.createElement("div", {
@@ -117293,7 +117437,7 @@ const NodeRow = ({ node, metricName, onAgentNodeClick, onOpenVisualizer })=>{
117293
117437
  marginBottom: 6,
117294
117438
  color: theme.colors.mutedForeground
117295
117439
  }
117296
- }, "Judge reasoning · ", metricName), node.reasoning));
117440
+ }, "Reasoning · ", metricName), node.reasoning));
117297
117441
  };
117298
117442
  const LabelPanelHeader = ({ label })=>{
117299
117443
  const { theme } = useTheme$1();
@@ -117326,7 +117470,7 @@ const LabelPanelHeader = ({ label })=>{
117326
117470
  }
117327
117471
  }, label.count, " ", label.count === 1 ? "node" : "nodes"));
117328
117472
  };
117329
- const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117473
+ const MetricCard$1 = ({ metric, icon: Icon, onAgentNodeClick, onOpenVisualizer })=>{
117330
117474
  const { theme } = useTheme$1();
117331
117475
  const items = metric.labels.map((label)=>({
117332
117476
  key: label.labelName,
@@ -117346,7 +117490,7 @@ const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117346
117490
  flexDirection: "column",
117347
117491
  gap: 12
117348
117492
  }
117349
- }, label.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow, {
117493
+ }, label.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow$1, {
117350
117494
  key: node.nodeId,
117351
117495
  node: node,
117352
117496
  metricName: metric.metricName,
@@ -117374,7 +117518,7 @@ const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117374
117518
  gap: 12,
117375
117519
  flexWrap: "wrap"
117376
117520
  }
117377
- }, /*#__PURE__*/ React__default.createElement(Scale, {
117521
+ }, /*#__PURE__*/ React__default.createElement(Icon, {
117378
117522
  size: 16,
117379
117523
  style: {
117380
117524
  color: theme.colors.primary,
@@ -117415,13 +117559,13 @@ const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117415
117559
  marginLeft: "auto",
117416
117560
  flexShrink: 0
117417
117561
  }
117418
- }, /*#__PURE__*/ React__default.createElement(Meta, {
117562
+ }, /*#__PURE__*/ React__default.createElement(Meta$1, {
117419
117563
  label: "Most common",
117420
117564
  value: metric.mostCommon
117421
- }), /*#__PURE__*/ React__default.createElement(Meta, {
117565
+ }), /*#__PURE__*/ React__default.createElement(Meta$1, {
117422
117566
  label: "Least common",
117423
117567
  value: metric.leastCommon
117424
- }), /*#__PURE__*/ React__default.createElement(Meta, {
117568
+ }), /*#__PURE__*/ React__default.createElement(Meta$1, {
117425
117569
  label: "Evaluations",
117426
117570
  value: String(metric.total)
117427
117571
  }))), metric.description && /*#__PURE__*/ React__default.createElement("div", {
@@ -117438,6 +117582,76 @@ const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117438
117582
  }
117439
117583
  }));
117440
117584
  };
117585
+ const Meta$1 = ({ label, value })=>{
117586
+ const { theme } = useTheme$1();
117587
+ return /*#__PURE__*/ React__default.createElement("span", {
117588
+ style: {
117589
+ display: "flex",
117590
+ flexDirection: "column",
117591
+ alignItems: "flex-end",
117592
+ gap: 1
117593
+ }
117594
+ }, /*#__PURE__*/ React__default.createElement("span", {
117595
+ style: {
117596
+ fontSize: 10,
117597
+ textTransform: "uppercase",
117598
+ letterSpacing: 0.4,
117599
+ color: theme.colors.mutedForeground
117600
+ }
117601
+ }, label), /*#__PURE__*/ React__default.createElement("span", {
117602
+ style: {
117603
+ fontSize: 13,
117604
+ fontWeight: 500
117605
+ }
117606
+ }, value ?? "—"));
117607
+ };
117608
+ const CategoricalAggregateView = ({ metrics, title = "Categorical Evaluator - Aggregate View", icon = Tags, emptyLabel = "No categorical metrics available", onAgentNodeClick, onOpenVisualizer })=>{
117609
+ const { theme } = useTheme$1();
117610
+ if (!metrics.length) {
117611
+ return /*#__PURE__*/ React__default.createElement("div", {
117612
+ style: {
117613
+ padding: 24,
117614
+ textAlign: "center",
117615
+ color: theme.colors.mutedForeground,
117616
+ fontSize: 14
117617
+ }
117618
+ }, emptyLabel);
117619
+ }
117620
+ return /*#__PURE__*/ React__default.createElement("div", {
117621
+ style: {
117622
+ width: "100%",
117623
+ minWidth: 0
117624
+ }
117625
+ }, /*#__PURE__*/ React__default.createElement("h3", {
117626
+ style: {
117627
+ margin: "0 0 16px",
117628
+ fontSize: 16,
117629
+ fontWeight: 600
117630
+ }
117631
+ }, title), /*#__PURE__*/ React__default.createElement("div", {
117632
+ style: {
117633
+ display: "flex",
117634
+ flexDirection: "column",
117635
+ gap: 12
117636
+ }
117637
+ }, metrics.map((metric)=>/*#__PURE__*/ React__default.createElement(MetricCard$1, {
117638
+ key: metric.key,
117639
+ metric: metric,
117640
+ icon: icon,
117641
+ onAgentNodeClick: onAgentNodeClick,
117642
+ onOpenVisualizer: onOpenVisualizer
117643
+ }))));
117644
+ };
117645
+
117646
+ /**
117647
+ * Format a numerical value for display. Custom metric names are arbitrary, so we
117648
+ * use a light heuristic: latency-like metrics render as durations, integers get
117649
+ * thousands separators, everything else gets two decimals.
117650
+ */ function formatStat(value, metricName) {
117651
+ if (value === undefined || !Number.isFinite(value)) return "—";
117652
+ if (/seconds$/i.test(metricName) || /latency/i.test(metricName)) return formatLatency(value);
117653
+ return Number.isInteger(value) ? formatNumberWithCommas(value) : value.toFixed(2);
117654
+ }
117441
117655
  const Meta = ({ label, value })=>{
117442
117656
  const { theme } = useTheme$1();
117443
117657
  return /*#__PURE__*/ React__default.createElement("span", {
@@ -117461,7 +117675,149 @@ const Meta = ({ label, value })=>{
117461
117675
  }
117462
117676
  }, value ?? "—"));
117463
117677
  };
117464
- const JudgeAggregateView = ({ metrics, onAgentNodeClick, onOpenVisualizer })=>{
117678
+ const NodeRow = ({ node, metricName, onAgentNodeClick, onOpenVisualizer })=>{
117679
+ const { theme } = useTheme$1();
117680
+ return /*#__PURE__*/ React__default.createElement("div", {
117681
+ style: {
117682
+ display: "flex",
117683
+ alignItems: "center",
117684
+ gap: 10,
117685
+ flexWrap: "wrap"
117686
+ }
117687
+ }, /*#__PURE__*/ React__default.createElement(Tag, {
117688
+ style: {
117689
+ margin: 0,
117690
+ fontFamily: "monospace",
117691
+ fontWeight: 600,
117692
+ background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
117693
+ color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
117694
+ border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`
117695
+ }
117696
+ }, formatStat(node.value, metricName)), /*#__PURE__*/ React__default.createElement(Tag, {
117697
+ style: {
117698
+ margin: 0,
117699
+ display: "inline-flex",
117700
+ alignItems: "center",
117701
+ gap: 6,
117702
+ background: theme.colors.tagToolLevel2?.bg ?? theme.colors.primary,
117703
+ color: theme.colors.tagToolLevel2?.color ?? theme.colors.primaryForeground,
117704
+ border: "none"
117705
+ }
117706
+ }, /*#__PURE__*/ React__default.createElement(Bot, {
117707
+ size: 12,
117708
+ style: {
117709
+ flexShrink: 0
117710
+ }
117711
+ }), "Agent Node"), /*#__PURE__*/ React__default.createElement(NodeActions, {
117712
+ sessionId: node.sessionId,
117713
+ nodeId: node.nodeId,
117714
+ onAgentNodeClick: onAgentNodeClick,
117715
+ onOpenVisualizer: onOpenVisualizer
117716
+ }));
117717
+ };
117718
+ const MetricCard = ({ metric, onAgentNodeClick, onOpenVisualizer })=>{
117719
+ const { theme } = useTheme$1();
117720
+ const items = metric.nodes.length > 0 ? [
117721
+ {
117722
+ key: "per-run",
117723
+ label: /*#__PURE__*/ React__default.createElement("span", {
117724
+ style: {
117725
+ fontSize: 13,
117726
+ fontWeight: 600
117727
+ }
117728
+ }, "Per-run values", " ", /*#__PURE__*/ React__default.createElement("span", {
117729
+ style: {
117730
+ color: theme.colors.mutedForeground,
117731
+ fontWeight: 400
117732
+ }
117733
+ }, "(", metric.nodes.length, ")")),
117734
+ children: /*#__PURE__*/ React__default.createElement("div", {
117735
+ style: {
117736
+ display: "flex",
117737
+ flexDirection: "column",
117738
+ gap: 12
117739
+ }
117740
+ }, metric.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow, {
117741
+ key: node.nodeId,
117742
+ node: node,
117743
+ metricName: metric.metricName,
117744
+ onAgentNodeClick: onAgentNodeClick,
117745
+ onOpenVisualizer: onOpenVisualizer
117746
+ })))
117747
+ }
117748
+ ] : [];
117749
+ return /*#__PURE__*/ React__default.createElement("div", {
117750
+ style: {
117751
+ background: theme.colors.card,
117752
+ border: `1px solid ${theme.colors.border}`,
117753
+ borderRadius: 8,
117754
+ overflow: "hidden"
117755
+ }
117756
+ }, /*#__PURE__*/ React__default.createElement("div", {
117757
+ style: {
117758
+ padding: "14px 18px",
117759
+ borderBottom: metric.nodes.length > 0 ? `1px solid ${theme.colors.border}` : "none",
117760
+ background: theme.colors.secondary
117761
+ }
117762
+ }, /*#__PURE__*/ React__default.createElement("div", {
117763
+ style: {
117764
+ display: "flex",
117765
+ alignItems: "center",
117766
+ gap: 12,
117767
+ flexWrap: "wrap"
117768
+ }
117769
+ }, /*#__PURE__*/ React__default.createElement(Gauge, {
117770
+ size: 16,
117771
+ style: {
117772
+ color: theme.colors.primary,
117773
+ flexShrink: 0
117774
+ }
117775
+ }), /*#__PURE__*/ React__default.createElement("span", {
117776
+ style: {
117777
+ fontSize: 15,
117778
+ fontWeight: 600
117779
+ }
117780
+ }, metric.metricName), /*#__PURE__*/ React__default.createElement("div", {
117781
+ style: {
117782
+ display: "flex",
117783
+ gap: 20,
117784
+ marginLeft: "auto",
117785
+ flexShrink: 0,
117786
+ flexWrap: "wrap"
117787
+ }
117788
+ }, /*#__PURE__*/ React__default.createElement(Meta, {
117789
+ label: "Mean",
117790
+ value: formatStat(metric.mean, metric.metricName)
117791
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117792
+ label: "Min",
117793
+ value: formatStat(metric.minimum, metric.metricName)
117794
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117795
+ label: "Max",
117796
+ value: formatStat(metric.maximum, metric.metricName)
117797
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117798
+ label: "Median",
117799
+ value: formatStat(metric.median, metric.metricName)
117800
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117801
+ label: "Std",
117802
+ value: formatStat(metric.std, metric.metricName)
117803
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117804
+ label: "Runs",
117805
+ value: String(metric.count)
117806
+ }))), metric.description && /*#__PURE__*/ React__default.createElement("div", {
117807
+ style: {
117808
+ marginTop: 6,
117809
+ fontSize: 12,
117810
+ color: theme.colors.mutedForeground
117811
+ }
117812
+ }, metric.description)), metric.nodes.length > 0 && /*#__PURE__*/ React__default.createElement(Collapse$1, {
117813
+ items: items,
117814
+ bordered: false,
117815
+ style: {
117816
+ background: theme.colors.card
117817
+ }
117818
+ }));
117819
+ };
117820
+ const NumericalAggregateView = ({ metrics, onAgentNodeClick, onOpenVisualizer })=>{
117465
117821
  const { theme } = useTheme$1();
117466
117822
  if (!metrics.length) {
117467
117823
  return /*#__PURE__*/ React__default.createElement("div", {
@@ -117471,7 +117827,7 @@ const JudgeAggregateView = ({ metrics, onAgentNodeClick, onOpenVisualizer })=>{
117471
117827
  color: theme.colors.mutedForeground,
117472
117828
  fontSize: 14
117473
117829
  }
117474
- }, "No judge metrics available");
117830
+ }, "No numerical metrics available");
117475
117831
  }
117476
117832
  return /*#__PURE__*/ React__default.createElement("div", {
117477
117833
  style: {
@@ -117484,7 +117840,7 @@ const JudgeAggregateView = ({ metrics, onAgentNodeClick, onOpenVisualizer })=>{
117484
117840
  fontSize: 16,
117485
117841
  fontWeight: 600
117486
117842
  }
117487
- }, "Judge Evaluator - Aggregate View"), /*#__PURE__*/ React__default.createElement("div", {
117843
+ }, "Custom Evaluator - Aggregate View"), /*#__PURE__*/ React__default.createElement("div", {
117488
117844
  style: {
117489
117845
  display: "flex",
117490
117846
  flexDirection: "column",
@@ -117502,7 +117858,10 @@ function detectAggregateType(nodes) {
117502
117858
  const values = Object.values(nodes);
117503
117859
  if (values.some((n)=>n?.type === "ToolAggregate")) return "ToolUse";
117504
117860
  if (values.some((n)=>n?.type === "LLMInferenceAggregate")) return "LLMInference";
117505
- if (values.some((n)=>n?.type === "CategoricalAggregate")) return "Judge";
117861
+ // Categorical covers the built-in JudgeEvaluator and any custom evaluator with categorical metrics.
117862
+ if (values.some((n)=>n?.type === "CategoricalAggregate")) return "Categorical";
117863
+ // Custom numerical evaluators (anything that isn't ToolUse/LLMInference/categorical) emit NumericalAggregate.
117864
+ if (values.some((n)=>n?.type === "NumericalAggregate")) return "Numerical";
117506
117865
  return null;
117507
117866
  }
117508
117867
  function buildLLMInferenceFlatRows(nodes) {
@@ -117544,7 +117903,8 @@ function formatAggregateValue(value, metricName) {
117544
117903
  const DEFAULT_TITLES = {
117545
117904
  ToolUse: "Tool Use Evaluator - Aggregate View",
117546
117905
  LLMInference: "LLM Inference Evaluator - Aggregate View",
117547
- Judge: "Judge Evaluator - Aggregate View"
117906
+ Categorical: "Categorical Evaluator - Aggregate View",
117907
+ Numerical: "Custom Evaluator - Aggregate View"
117548
117908
  };
117549
117909
  const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, title, evaluatorName, onAgentNodeClick, onOpenVisualizer })=>{
117550
117910
  const { theme } = useTheme$1();
@@ -117586,10 +117946,23 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117586
117946
  llmExpandableKeys
117587
117947
  };
117588
117948
  }
117589
- if (type === "Judge") {
117949
+ if (type === "Categorical") {
117590
117950
  return {
117591
117951
  aggregateType: type,
117592
- dataSource: buildJudgeMetricsFromAggregate({
117952
+ dataSource: buildCategoricalMetricsFromAggregate({
117953
+ roots: aggregateResults.roots,
117954
+ nodes: aggregateResults.nodes,
117955
+ agents,
117956
+ rawResults
117957
+ }),
117958
+ llmIsTree: false,
117959
+ llmExpandableKeys: []
117960
+ };
117961
+ }
117962
+ if (type === "Numerical") {
117963
+ return {
117964
+ aggregateType: type,
117965
+ dataSource: buildNumericalMetricsFromAggregate({
117593
117966
  roots: aggregateResults.roots,
117594
117967
  nodes: aggregateResults.nodes,
117595
117968
  agents,
@@ -117915,8 +118288,21 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117915
118288
  }
117916
118289
  }));
117917
118290
  }
117918
- if (aggregateType === "Judge") {
117919
- return /*#__PURE__*/ React__default.createElement(JudgeAggregateView, {
118291
+ if (aggregateType === "Categorical") {
118292
+ // JudgeEvaluator keeps its branding; any other (custom) categorical evaluator
118293
+ // renders through the same view with neutral categorical branding.
118294
+ const isJudge = (evaluatorName ?? "").includes("Judge");
118295
+ return /*#__PURE__*/ React__default.createElement(CategoricalAggregateView, {
118296
+ metrics: dataSource,
118297
+ title: title ?? (isJudge ? "Judge Evaluator - Aggregate View" : "Custom Evaluator - Aggregate View"),
118298
+ icon: isJudge ? Scale : Tags,
118299
+ emptyLabel: isJudge ? "No judge metrics available" : "No categorical metrics available",
118300
+ onAgentNodeClick: onAgentNodeClick,
118301
+ onOpenVisualizer: onOpenVisualizer
118302
+ });
118303
+ }
118304
+ if (aggregateType === "Numerical") {
118305
+ return /*#__PURE__*/ React__default.createElement(NumericalAggregateView, {
117920
118306
  metrics: dataSource,
117921
118307
  onAgentNodeClick: onAgentNodeClick,
117922
118308
  onOpenVisualizer: onOpenVisualizer
@@ -118183,7 +118569,8 @@ function isCategoricalMetric(def) {
118183
118569
  const aggregateTypes = [
118184
118570
  "ToolAggregate",
118185
118571
  "LLMInferenceAggregate",
118186
- "CategoricalAggregate"
118572
+ "CategoricalAggregate",
118573
+ "NumericalAggregate"
118187
118574
  ];
118188
118575
  const aggregateItems = Object.values(nodes).filter((n)=>n?.type && aggregateTypes.includes(n.type));
118189
118576
  return [