@railtownai/railtracks-visualizer 0.0.68 → 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$z = [
12922
+ const __iconNode$C = [
12923
12923
  [
12924
12924
  "path",
12925
12925
  {
@@ -12935,9 +12935,9 @@ const __iconNode$z = [
12935
12935
  }
12936
12936
  ]
12937
12937
  ];
12938
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$z);
12938
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$C);
12939
12939
 
12940
- const __iconNode$y = [
12940
+ const __iconNode$B = [
12941
12941
  [
12942
12942
  "path",
12943
12943
  {
@@ -12953,9 +12953,9 @@ const __iconNode$y = [
12953
12953
  }
12954
12954
  ]
12955
12955
  ];
12956
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$y);
12956
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$B);
12957
12957
 
12958
- const __iconNode$x = [
12958
+ const __iconNode$A = [
12959
12959
  [
12960
12960
  "path",
12961
12961
  {
@@ -13003,9 +13003,9 @@ const __iconNode$x = [
13003
13003
  }
13004
13004
  ]
13005
13005
  ];
13006
- const Bot = createLucideIcon("bot", __iconNode$x);
13006
+ const Bot = createLucideIcon("bot", __iconNode$A);
13007
13007
 
13008
- const __iconNode$w = [
13008
+ const __iconNode$z = [
13009
13009
  [
13010
13010
  "path",
13011
13011
  {
@@ -13039,9 +13039,9 @@ const __iconNode$w = [
13039
13039
  }
13040
13040
  ]
13041
13041
  ];
13042
- const Calendar = createLucideIcon("calendar", __iconNode$w);
13042
+ const Calendar = createLucideIcon("calendar", __iconNode$z);
13043
13043
 
13044
- const __iconNode$v = [
13044
+ const __iconNode$y = [
13045
13045
  [
13046
13046
  "path",
13047
13047
  {
@@ -13098,9 +13098,9 @@ const __iconNode$v = [
13098
13098
  }
13099
13099
  ]
13100
13100
  ];
13101
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$v);
13101
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$y);
13102
13102
 
13103
- const __iconNode$u = [
13103
+ const __iconNode$x = [
13104
13104
  [
13105
13105
  "path",
13106
13106
  {
@@ -13109,9 +13109,9 @@ const __iconNode$u = [
13109
13109
  }
13110
13110
  ]
13111
13111
  ];
13112
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$u);
13112
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$x);
13113
13113
 
13114
- const __iconNode$t = [
13114
+ const __iconNode$w = [
13115
13115
  [
13116
13116
  "path",
13117
13117
  {
@@ -13120,9 +13120,9 @@ const __iconNode$t = [
13120
13120
  }
13121
13121
  ]
13122
13122
  ];
13123
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$t);
13123
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$w);
13124
13124
 
13125
- const __iconNode$s = [
13125
+ const __iconNode$v = [
13126
13126
  [
13127
13127
  "path",
13128
13128
  {
@@ -13138,9 +13138,9 @@ const __iconNode$s = [
13138
13138
  }
13139
13139
  ]
13140
13140
  ];
13141
- const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$s);
13141
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$v);
13142
13142
 
13143
- const __iconNode$r = [
13143
+ const __iconNode$u = [
13144
13144
  [
13145
13145
  "path",
13146
13146
  {
@@ -13156,9 +13156,9 @@ const __iconNode$r = [
13156
13156
  }
13157
13157
  ]
13158
13158
  ];
13159
- const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$r);
13159
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$u);
13160
13160
 
13161
- const __iconNode$q = [
13161
+ const __iconNode$t = [
13162
13162
  [
13163
13163
  "circle",
13164
13164
  {
@@ -13189,9 +13189,9 @@ const __iconNode$q = [
13189
13189
  }
13190
13190
  ]
13191
13191
  ];
13192
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$q);
13192
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$t);
13193
13193
 
13194
- const __iconNode$p = [
13194
+ const __iconNode$s = [
13195
13195
  [
13196
13196
  "path",
13197
13197
  {
@@ -13207,9 +13207,9 @@ const __iconNode$p = [
13207
13207
  }
13208
13208
  ]
13209
13209
  ];
13210
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$p);
13210
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$s);
13211
13211
 
13212
- const __iconNode$o = [
13212
+ const __iconNode$r = [
13213
13213
  [
13214
13214
  "circle",
13215
13215
  {
@@ -13234,9 +13234,9 @@ const __iconNode$o = [
13234
13234
  }
13235
13235
  ]
13236
13236
  ];
13237
- const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$o);
13237
+ const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$r);
13238
13238
 
13239
- const __iconNode$n = [
13239
+ const __iconNode$q = [
13240
13240
  [
13241
13241
  "circle",
13242
13242
  {
@@ -13254,9 +13254,9 @@ const __iconNode$n = [
13254
13254
  }
13255
13255
  ]
13256
13256
  ];
13257
- const Clock = createLucideIcon("clock", __iconNode$n);
13257
+ const Clock = createLucideIcon("clock", __iconNode$q);
13258
13258
 
13259
- const __iconNode$m = [
13259
+ const __iconNode$p = [
13260
13260
  [
13261
13261
  "rect",
13262
13262
  {
@@ -13277,9 +13277,9 @@ const __iconNode$m = [
13277
13277
  }
13278
13278
  ]
13279
13279
  ];
13280
- const Copy = createLucideIcon("copy", __iconNode$m);
13280
+ const Copy = createLucideIcon("copy", __iconNode$p);
13281
13281
 
13282
- const __iconNode$l = [
13282
+ const __iconNode$o = [
13283
13283
  [
13284
13284
  "path",
13285
13285
  {
@@ -13387,9 +13387,9 @@ const __iconNode$l = [
13387
13387
  }
13388
13388
  ]
13389
13389
  ];
13390
- const Cpu = createLucideIcon("cpu", __iconNode$l);
13390
+ const Cpu = createLucideIcon("cpu", __iconNode$o);
13391
13391
 
13392
- const __iconNode$k = [
13392
+ const __iconNode$n = [
13393
13393
  [
13394
13394
  "line",
13395
13395
  {
@@ -13408,9 +13408,9 @@ const __iconNode$k = [
13408
13408
  }
13409
13409
  ]
13410
13410
  ];
13411
- const DollarSign = createLucideIcon("dollar-sign", __iconNode$k);
13411
+ const DollarSign = createLucideIcon("dollar-sign", __iconNode$n);
13412
13412
 
13413
- const __iconNode$j = [
13413
+ const __iconNode$m = [
13414
13414
  [
13415
13415
  "path",
13416
13416
  {
@@ -13440,9 +13440,9 @@ const __iconNode$j = [
13440
13440
  }
13441
13441
  ]
13442
13442
  ];
13443
- const FileInput = createLucideIcon("file-input", __iconNode$j);
13443
+ const FileInput = createLucideIcon("file-input", __iconNode$m);
13444
13444
 
13445
- const __iconNode$i = [
13445
+ const __iconNode$l = [
13446
13446
  [
13447
13447
  "path",
13448
13448
  {
@@ -13472,9 +13472,9 @@ const __iconNode$i = [
13472
13472
  }
13473
13473
  ]
13474
13474
  ];
13475
- const FileOutput = createLucideIcon("file-output", __iconNode$i);
13475
+ const FileOutput = createLucideIcon("file-output", __iconNode$l);
13476
13476
 
13477
- const __iconNode$h = [
13477
+ const __iconNode$k = [
13478
13478
  [
13479
13479
  "path",
13480
13480
  {
@@ -13532,9 +13532,27 @@ const __iconNode$h = [
13532
13532
  }
13533
13533
  ]
13534
13534
  ];
13535
- const FoldVertical = createLucideIcon("fold-vertical", __iconNode$h);
13535
+ const FoldVertical = createLucideIcon("fold-vertical", __iconNode$k);
13536
13536
 
13537
- const __iconNode$g = [
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$g = [
13576
13594
  }
13577
13595
  ]
13578
13596
  ];
13579
- const Hash = createLucideIcon("hash", __iconNode$g);
13597
+ const Hash = createLucideIcon("hash", __iconNode$i);
13580
13598
 
13581
- const __iconNode$f = [
13599
+ const __iconNode$h = [
13582
13600
  [
13583
13601
  "circle",
13584
13602
  {
@@ -13603,9 +13621,9 @@ const __iconNode$f = [
13603
13621
  }
13604
13622
  ]
13605
13623
  ];
13606
- const Info = createLucideIcon("info", __iconNode$f);
13624
+ const Info = createLucideIcon("info", __iconNode$h);
13607
13625
 
13608
- const __iconNode$e = [
13626
+ const __iconNode$g = [
13609
13627
  [
13610
13628
  "path",
13611
13629
  {
@@ -13642,9 +13660,9 @@ const __iconNode$e = [
13642
13660
  }
13643
13661
  ]
13644
13662
  ];
13645
- const ListChecks = createLucideIcon("list-checks", __iconNode$e);
13663
+ const ListChecks = createLucideIcon("list-checks", __iconNode$g);
13646
13664
 
13647
- const __iconNode$d = [
13665
+ const __iconNode$f = [
13648
13666
  [
13649
13667
  "path",
13650
13668
  {
@@ -13674,9 +13692,9 @@ const __iconNode$d = [
13674
13692
  }
13675
13693
  ]
13676
13694
  ];
13677
- const MessageSquareText = createLucideIcon("message-square-text", __iconNode$d);
13695
+ const MessageSquareText = createLucideIcon("message-square-text", __iconNode$f);
13678
13696
 
13679
- const __iconNode$c = [
13697
+ const __iconNode$e = [
13680
13698
  [
13681
13699
  "path",
13682
13700
  {
@@ -13692,9 +13710,9 @@ const __iconNode$c = [
13692
13710
  }
13693
13711
  ]
13694
13712
  ];
13695
- const MessagesSquare = createLucideIcon("messages-square", __iconNode$c);
13713
+ const MessagesSquare = createLucideIcon("messages-square", __iconNode$e);
13696
13714
 
13697
- const __iconNode$b = [
13715
+ const __iconNode$d = [
13698
13716
  [
13699
13717
  "rect",
13700
13718
  {
@@ -13714,9 +13732,38 @@ const __iconNode$b = [
13714
13732
  }
13715
13733
  ]
13716
13734
  ];
13717
- const PanelLeft = createLucideIcon("panel-left", __iconNode$b);
13735
+ const PanelLeft = createLucideIcon("panel-left", __iconNode$d);
13718
13736
 
13719
- const __iconNode$a = [
13737
+ const __iconNode$c = [
13738
+ [
13739
+ "rect",
13740
+ {
13741
+ width: "18",
13742
+ height: "18",
13743
+ x: "3",
13744
+ y: "3",
13745
+ rx: "2",
13746
+ key: "afitv7"
13747
+ }
13748
+ ],
13749
+ [
13750
+ "path",
13751
+ {
13752
+ d: "M15 3v18",
13753
+ key: "14nvp0"
13754
+ }
13755
+ ],
13756
+ [
13757
+ "path",
13758
+ {
13759
+ d: "m10 15-3-3 3-3",
13760
+ key: "1pgupc"
13761
+ }
13762
+ ]
13763
+ ];
13764
+ const PanelRightOpen = createLucideIcon("panel-right-open", __iconNode$c);
13765
+
13766
+ const __iconNode$b = [
13720
13767
  [
13721
13768
  "path",
13722
13769
  {
@@ -13746,9 +13793,9 @@ const __iconNode$a = [
13746
13793
  }
13747
13794
  ]
13748
13795
  ];
13749
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$a);
13796
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$b);
13750
13797
 
13751
- const __iconNode$9 = [
13798
+ const __iconNode$a = [
13752
13799
  [
13753
13800
  "path",
13754
13801
  {
@@ -13785,9 +13832,9 @@ const __iconNode$9 = [
13785
13832
  }
13786
13833
  ]
13787
13834
  ];
13788
- const Scale = createLucideIcon("scale", __iconNode$9);
13835
+ const Scale = createLucideIcon("scale", __iconNode$a);
13789
13836
 
13790
- const __iconNode$8 = [
13837
+ const __iconNode$9 = [
13791
13838
  [
13792
13839
  "path",
13793
13840
  {
@@ -13821,9 +13868,9 @@ const __iconNode$8 = [
13821
13868
  }
13822
13869
  ]
13823
13870
  ];
13824
- const Settings2 = createLucideIcon("settings-2", __iconNode$8);
13871
+ const Settings2 = createLucideIcon("settings-2", __iconNode$9);
13825
13872
 
13826
- const __iconNode$7 = [
13873
+ const __iconNode$8 = [
13827
13874
  [
13828
13875
  "path",
13829
13876
  {
@@ -13846,9 +13893,9 @@ const __iconNode$7 = [
13846
13893
  }
13847
13894
  ]
13848
13895
  ];
13849
- const Share = createLucideIcon("share", __iconNode$7);
13896
+ const Share = createLucideIcon("share", __iconNode$8);
13850
13897
 
13851
- const __iconNode$6 = [
13898
+ const __iconNode$7 = [
13852
13899
  [
13853
13900
  "path",
13854
13901
  {
@@ -13857,7 +13904,35 @@ const __iconNode$6 = [
13857
13904
  }
13858
13905
  ]
13859
13906
  ];
13860
- 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);
13861
13936
 
13862
13937
  const __iconNode$5 = [
13863
13938
  [
@@ -112576,7 +112651,32 @@ const GuardrailsPopover = ({ guardrails, title = "Guardrails", placement = "righ
112576
112651
  })));
112577
112652
  };
112578
112653
 
112579
- 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));
112580
112680
  const SessionTreeNodeTitle = ({ displayName, subtreeLatency, guardrails })=>{
112581
112681
  return /*#__PURE__*/ React__default.createElement("span", {
112582
112682
  style: {
@@ -112704,8 +112804,7 @@ const buildNodeTree = (run)=>{
112704
112804
  const nodeKey = `node::${run.run_id}::${node.identifier}`;
112705
112805
  const childIds = childrenMap.get(node.identifier) || [];
112706
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);
112707
- const childLatency = children.reduce((s, c)=>s + (c.subtreeLatency ?? 0), 0);
112708
- const subtreeLatency = getNodeLatency(node) + childLatency;
112807
+ const subtreeLatency = getSubtreeWallClockSeconds(node.identifier, childrenMap, nodeMap);
112709
112808
  const guardrails = node.details?.internals?.guard_details ?? [];
112710
112809
  const isTool = node.node_type === "Tool";
112711
112810
  const failed = isNodeFailureFromIncomingEdge(run, node.identifier);
@@ -113327,7 +113426,7 @@ const SessionDetails = ({ session, open, onClose, initialNodeId, initialRunId, l
113327
113426
 
113328
113427
  /**
113329
113428
  * DTOs for evaluation data from .railtracks/data/evaluations/*.json
113330
- */ /** 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) {
113331
113430
  return item.type === "LLM";
113332
113431
  }
113333
113432
  /** Type guard for Tool result */ function isToolResult(item) {
@@ -113345,8 +113444,12 @@ const SessionDetails = ({ session, open, onClose, initialNodeId, initialRunId, l
113345
113444
  /** Type guard for CategoricalAggregate */ function isAggregateCategorical(item) {
113346
113445
  return item.type === "CategoricalAggregate";
113347
113446
  }
113348
- /** Type guard for aggregated stats (numeric - LLMInferenceAggregate or ToolAggregate) */ function isAggregatedStats(item) {
113349
- 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";
113350
113453
  }
113351
113454
 
113352
113455
  function isCategoricalMetric$1(def) {
@@ -113362,7 +113465,8 @@ function isCategoricalMetric$1(def) {
113362
113465
  const aggregateTypes = [
113363
113466
  "ToolAggregate",
113364
113467
  "LLMInferenceAggregate",
113365
- "CategoricalAggregate"
113468
+ "CategoricalAggregate",
113469
+ "NumericalAggregate"
113366
113470
  ];
113367
113471
  const aggregateItems = Object.values(nodes).filter((n)=>n?.type && aggregateTypes.includes(n.type));
113368
113472
  return [
@@ -117028,7 +117132,7 @@ function buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCount
117028
117132
 
117029
117133
  const JUDGE_RESULT_PREFIX = "JudgeResult/";
117030
117134
  const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
117031
- /** 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) {
117032
117136
  const map = new Map();
117033
117137
  for (const agent of agents ?? []){
117034
117138
  for (const entry of agent.agent_node_ids ?? []){
@@ -117052,10 +117156,10 @@ const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
117052
117156
  }
117053
117157
  return map;
117054
117158
  }
117055
- function metricNameOf(agg) {
117159
+ function metricNameOf$1(agg) {
117056
117160
  return agg.metric?.name ?? agg.name?.replace(/^Aggregate\//, "") ?? "Unknown";
117057
117161
  }
117058
- /** 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) {
117059
117163
  const byLabel = new Map();
117060
117164
  const seen = new Set();
117061
117165
  const push = (label, nodeId)=>{
@@ -117093,15 +117197,15 @@ function metricNameOf(agg) {
117093
117197
  }
117094
117198
  return byLabel;
117095
117199
  }
117096
- /** 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) {
117097
117201
  const { roots, nodes, agents, rawResults = [] } = input;
117098
- const sessionByNodeId = buildSessionByNodeId(agents);
117202
+ const sessionByNodeId = buildSessionByNodeId$1(agents);
117099
117203
  const reasoningByKey = buildReasoningByKey(rawResults);
117100
117204
  // Prefer roots; fall back to scanning all nodes for categorical aggregates.
117101
117205
  const rootAggregates = roots.map((id)=>nodes[id]).filter((n)=>isAggregateCategorical(n));
117102
117206
  const aggregates = rootAggregates.length > 0 ? rootAggregates : Object.values(nodes).filter((n)=>isAggregateCategorical(n));
117103
117207
  return aggregates.map((agg, index)=>{
117104
- const metricName = metricNameOf(agg);
117208
+ const metricName = metricNameOf$1(agg);
117105
117209
  const counts = agg.counts ?? {};
117106
117210
  const categories = agg.categories ?? agg.metric?.categories ?? Object.keys(counts);
117107
117211
  const byLabel = groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey);
@@ -117133,13 +117237,139 @@ function metricNameOf(agg) {
117133
117237
  });
117134
117238
  }
117135
117239
 
117136
- const SHORT_ID_LENGTH = 8;
117137
- const shortenId = (id)=>id.length > SHORT_ID_LENGTH ? id.slice(0, SHORT_ID_LENGTH) : id;
117138
- const NodeRow = ({ node, metricName, onAgentNodeClick })=>{
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
+
117309
+ const NodeActions = ({ sessionId, nodeId, onAgentNodeClick, onOpenVisualizer })=>{
117310
+ const { theme } = useTheme$1();
117311
+ const baseStyle = {
117312
+ display: "inline-flex",
117313
+ alignItems: "center",
117314
+ gap: 5,
117315
+ padding: "3px 9px",
117316
+ borderRadius: 6,
117317
+ fontSize: 12,
117318
+ fontWeight: 500,
117319
+ cursor: "pointer",
117320
+ background: "transparent",
117321
+ color: theme.colors.primary,
117322
+ border: `1px solid ${theme.colors.primary}`,
117323
+ whiteSpace: "nowrap",
117324
+ lineHeight: 1.4
117325
+ };
117326
+ if (!onAgentNodeClick && !onOpenVisualizer) {
117327
+ // No handlers: fall back to surfacing the (shortened) id so context isn't lost.
117328
+ return /*#__PURE__*/ React__default.createElement(Tooltip, {
117329
+ title: nodeId
117330
+ }, /*#__PURE__*/ React__default.createElement("span", {
117331
+ style: {
117332
+ fontFamily: "monospace",
117333
+ fontSize: 12,
117334
+ color: theme.colors.mutedForeground
117335
+ }
117336
+ }, nodeId.length > 8 ? nodeId.slice(0, 8) : nodeId));
117337
+ }
117338
+ return /*#__PURE__*/ React__default.createElement("span", {
117339
+ style: {
117340
+ display: "inline-flex",
117341
+ alignItems: "center",
117342
+ gap: 8
117343
+ },
117344
+ onClick: (e)=>e.stopPropagation()
117345
+ }, onAgentNodeClick && /*#__PURE__*/ React__default.createElement(Tooltip, {
117346
+ title: `Open Flow Details · ${nodeId}`
117347
+ }, /*#__PURE__*/ React__default.createElement("button", {
117348
+ type: "button",
117349
+ style: baseStyle,
117350
+ onClick: ()=>onAgentNodeClick(sessionId, nodeId)
117351
+ }, /*#__PURE__*/ React__default.createElement(PanelRightOpen, {
117352
+ size: 13,
117353
+ style: {
117354
+ flexShrink: 0
117355
+ }
117356
+ }), "Flow Details")), onOpenVisualizer && /*#__PURE__*/ React__default.createElement(Tooltip, {
117357
+ title: `Open in Visualizer · ${nodeId}`
117358
+ }, /*#__PURE__*/ React__default.createElement("button", {
117359
+ type: "button",
117360
+ style: baseStyle,
117361
+ onClick: ()=>onOpenVisualizer(sessionId, nodeId)
117362
+ }, /*#__PURE__*/ React__default.createElement(ChartNetwork, {
117363
+ size: 13,
117364
+ style: {
117365
+ flexShrink: 0
117366
+ }
117367
+ }), "Visualizer")));
117368
+ };
117369
+
117370
+ const NodeRow$1 = ({ node, metricName, onAgentNodeClick, onOpenVisualizer })=>{
117139
117371
  const { theme } = useTheme$1();
117140
117372
  const [showReasoning, setShowReasoning] = useState(false);
117141
- const clickable = !!onAgentNodeClick;
117142
- const open = ()=>onAgentNodeClick?.(node.sessionId, node.nodeId);
117143
117373
  return /*#__PURE__*/ React__default.createElement("div", {
117144
117374
  style: {
117145
117375
  display: "flex",
@@ -117153,38 +117383,27 @@ const NodeRow = ({ node, metricName, onAgentNodeClick })=>{
117153
117383
  gap: 10,
117154
117384
  flexWrap: "wrap"
117155
117385
  }
117156
- }, /*#__PURE__*/ React__default.createElement(Tooltip, {
117157
- title: clickable ? `Inspect run · ${node.nodeId}` : node.nodeId
117158
- }, /*#__PURE__*/ React__default.createElement("span", {
117159
- role: clickable ? "button" : undefined,
117160
- tabIndex: clickable ? 0 : undefined,
117161
- onClick: clickable ? open : undefined,
117162
- onKeyDown: clickable ? (e)=>{
117163
- if (e.key === "Enter" || e.key === " ") {
117164
- e.preventDefault();
117165
- open();
117166
- }
117167
- } : undefined,
117386
+ }, /*#__PURE__*/ React__default.createElement(Tag, {
117168
117387
  style: {
117388
+ margin: 0,
117169
117389
  display: "inline-flex",
117170
117390
  alignItems: "center",
117171
117391
  gap: 6,
117172
- padding: "3px 10px",
117173
- borderRadius: 6,
117174
- fontFamily: "monospace",
117175
- fontSize: 12,
117176
- fontWeight: 500,
117177
- background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
117178
- color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
117179
- border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`,
117180
- cursor: clickable ? "pointer" : "default"
117392
+ background: theme.colors.tagToolLevel2?.bg ?? theme.colors.primary,
117393
+ color: theme.colors.tagToolLevel2?.color ?? theme.colors.primaryForeground,
117394
+ border: "none"
117181
117395
  }
117182
117396
  }, /*#__PURE__*/ React__default.createElement(Bot, {
117183
- size: 13,
117397
+ size: 12,
117184
117398
  style: {
117185
117399
  flexShrink: 0
117186
117400
  }
117187
- }), shortenId(node.nodeId))), node.reasoning && /*#__PURE__*/ React__default.createElement("button", {
117401
+ }), "Agent Node"), /*#__PURE__*/ React__default.createElement(NodeActions, {
117402
+ sessionId: node.sessionId,
117403
+ nodeId: node.nodeId,
117404
+ onAgentNodeClick: onAgentNodeClick,
117405
+ onOpenVisualizer: onOpenVisualizer
117406
+ }), node.reasoning && /*#__PURE__*/ React__default.createElement("button", {
117188
117407
  type: "button",
117189
117408
  onClick: ()=>setShowReasoning((s)=>!s),
117190
117409
  style: {
@@ -117218,7 +117437,7 @@ const NodeRow = ({ node, metricName, onAgentNodeClick })=>{
117218
117437
  marginBottom: 6,
117219
117438
  color: theme.colors.mutedForeground
117220
117439
  }
117221
- }, "Judge reasoning · ", metricName), node.reasoning));
117440
+ }, "Reasoning · ", metricName), node.reasoning));
117222
117441
  };
117223
117442
  const LabelPanelHeader = ({ label })=>{
117224
117443
  const { theme } = useTheme$1();
@@ -117251,7 +117470,7 @@ const LabelPanelHeader = ({ label })=>{
117251
117470
  }
117252
117471
  }, label.count, " ", label.count === 1 ? "node" : "nodes"));
117253
117472
  };
117254
- const MetricCard = ({ metric, onAgentNodeClick })=>{
117473
+ const MetricCard$1 = ({ metric, icon: Icon, onAgentNodeClick, onOpenVisualizer })=>{
117255
117474
  const { theme } = useTheme$1();
117256
117475
  const items = metric.labels.map((label)=>({
117257
117476
  key: label.labelName,
@@ -117271,11 +117490,12 @@ const MetricCard = ({ metric, onAgentNodeClick })=>{
117271
117490
  flexDirection: "column",
117272
117491
  gap: 12
117273
117492
  }
117274
- }, label.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow, {
117493
+ }, label.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow$1, {
117275
117494
  key: node.nodeId,
117276
117495
  node: node,
117277
117496
  metricName: metric.metricName,
117278
- onAgentNodeClick: onAgentNodeClick
117497
+ onAgentNodeClick: onAgentNodeClick,
117498
+ onOpenVisualizer: onOpenVisualizer
117279
117499
  })))
117280
117500
  }));
117281
117501
  return /*#__PURE__*/ React__default.createElement("div", {
@@ -117298,7 +117518,7 @@ const MetricCard = ({ metric, onAgentNodeClick })=>{
117298
117518
  gap: 12,
117299
117519
  flexWrap: "wrap"
117300
117520
  }
117301
- }, /*#__PURE__*/ React__default.createElement(Scale, {
117521
+ }, /*#__PURE__*/ React__default.createElement(Icon, {
117302
117522
  size: 16,
117303
117523
  style: {
117304
117524
  color: theme.colors.primary,
@@ -117339,13 +117559,13 @@ const MetricCard = ({ metric, onAgentNodeClick })=>{
117339
117559
  marginLeft: "auto",
117340
117560
  flexShrink: 0
117341
117561
  }
117342
- }, /*#__PURE__*/ React__default.createElement(Meta, {
117562
+ }, /*#__PURE__*/ React__default.createElement(Meta$1, {
117343
117563
  label: "Most common",
117344
117564
  value: metric.mostCommon
117345
- }), /*#__PURE__*/ React__default.createElement(Meta, {
117565
+ }), /*#__PURE__*/ React__default.createElement(Meta$1, {
117346
117566
  label: "Least common",
117347
117567
  value: metric.leastCommon
117348
- }), /*#__PURE__*/ React__default.createElement(Meta, {
117568
+ }), /*#__PURE__*/ React__default.createElement(Meta$1, {
117349
117569
  label: "Evaluations",
117350
117570
  value: String(metric.total)
117351
117571
  }))), metric.description && /*#__PURE__*/ React__default.createElement("div", {
@@ -117362,6 +117582,76 @@ const MetricCard = ({ metric, onAgentNodeClick })=>{
117362
117582
  }
117363
117583
  }));
117364
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
+ }
117365
117655
  const Meta = ({ label, value })=>{
117366
117656
  const { theme } = useTheme$1();
117367
117657
  return /*#__PURE__*/ React__default.createElement("span", {
@@ -117385,7 +117675,149 @@ const Meta = ({ label, value })=>{
117385
117675
  }
117386
117676
  }, value ?? "—"));
117387
117677
  };
117388
- const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
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 })=>{
117389
117821
  const { theme } = useTheme$1();
117390
117822
  if (!metrics.length) {
117391
117823
  return /*#__PURE__*/ React__default.createElement("div", {
@@ -117395,7 +117827,7 @@ const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
117395
117827
  color: theme.colors.mutedForeground,
117396
117828
  fontSize: 14
117397
117829
  }
117398
- }, "No judge metrics available");
117830
+ }, "No numerical metrics available");
117399
117831
  }
117400
117832
  return /*#__PURE__*/ React__default.createElement("div", {
117401
117833
  style: {
@@ -117408,7 +117840,7 @@ const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
117408
117840
  fontSize: 16,
117409
117841
  fontWeight: 600
117410
117842
  }
117411
- }, "Judge Evaluator - Aggregate View"), /*#__PURE__*/ React__default.createElement("div", {
117843
+ }, "Custom Evaluator - Aggregate View"), /*#__PURE__*/ React__default.createElement("div", {
117412
117844
  style: {
117413
117845
  display: "flex",
117414
117846
  flexDirection: "column",
@@ -117417,7 +117849,8 @@ const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
117417
117849
  }, metrics.map((metric)=>/*#__PURE__*/ React__default.createElement(MetricCard, {
117418
117850
  key: metric.key,
117419
117851
  metric: metric,
117420
- onAgentNodeClick: onAgentNodeClick
117852
+ onAgentNodeClick: onAgentNodeClick,
117853
+ onOpenVisualizer: onOpenVisualizer
117421
117854
  }))));
117422
117855
  };
117423
117856
 
@@ -117425,7 +117858,10 @@ function detectAggregateType(nodes) {
117425
117858
  const values = Object.values(nodes);
117426
117859
  if (values.some((n)=>n?.type === "ToolAggregate")) return "ToolUse";
117427
117860
  if (values.some((n)=>n?.type === "LLMInferenceAggregate")) return "LLMInference";
117428
- 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";
117429
117865
  return null;
117430
117866
  }
117431
117867
  function buildLLMInferenceFlatRows(nodes) {
@@ -117467,9 +117903,10 @@ function formatAggregateValue(value, metricName) {
117467
117903
  const DEFAULT_TITLES = {
117468
117904
  ToolUse: "Tool Use Evaluator - Aggregate View",
117469
117905
  LLMInference: "LLM Inference Evaluator - Aggregate View",
117470
- Judge: "Judge Evaluator - Aggregate View"
117906
+ Categorical: "Categorical Evaluator - Aggregate View",
117907
+ Numerical: "Custom Evaluator - Aggregate View"
117471
117908
  };
117472
- const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, title, evaluatorName, onAgentNodeClick })=>{
117909
+ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, title, evaluatorName, onAgentNodeClick, onOpenVisualizer })=>{
117473
117910
  const { theme } = useTheme$1();
117474
117911
  const [expandedRowKeys, setExpandedRowKeys] = useState([]);
117475
117912
  const { aggregateType, dataSource, llmIsTree, llmExpandableKeys } = useMemo(()=>{
@@ -117509,10 +117946,23 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117509
117946
  llmExpandableKeys
117510
117947
  };
117511
117948
  }
117512
- if (type === "Judge") {
117949
+ if (type === "Categorical") {
117950
+ return {
117951
+ aggregateType: type,
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") {
117513
117963
  return {
117514
117964
  aggregateType: type,
117515
- dataSource: buildJudgeMetricsFromAggregate({
117965
+ dataSource: buildNumericalMetricsFromAggregate({
117516
117966
  roots: aggregateResults.roots,
117517
117967
  nodes: aggregateResults.nodes,
117518
117968
  agents,
@@ -117637,7 +118087,7 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117637
118087
  dataIndex: "name",
117638
118088
  key: "name",
117639
118089
  render: (name, row)=>{
117640
- const isClickable = row.level === 3 && row.agentNodeId && onAgentNodeClick;
118090
+ const showActions = row.level === 3 && row.agentNodeId && (onAgentNodeClick || onOpenVisualizer);
117641
118091
  return /*#__PURE__*/ React__default.createElement("span", {
117642
118092
  style: {
117643
118093
  display: "inline-flex",
@@ -117645,27 +118095,16 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117645
118095
  gap: 8,
117646
118096
  fontFamily: "monospace",
117647
118097
  fontSize: 13,
117648
- ...isClickable && {
117649
- cursor: "pointer",
117650
- color: theme.colors.primary
117651
- }
117652
- },
117653
- onClick: isClickable ? (e)=>{
117654
- e.stopPropagation();
117655
- onAgentNodeClick(row.sessionId, row.agentNodeId);
117656
- } : undefined,
117657
- onKeyDown: isClickable ? (e)=>{
117658
- if (e.key === "Enter" || e.key === " ") {
117659
- e.preventDefault();
117660
- e.stopPropagation();
117661
- onAgentNodeClick(row.sessionId, row.agentNodeId);
117662
- }
117663
- } : undefined,
117664
- role: isClickable ? "button" : undefined,
117665
- tabIndex: isClickable ? 0 : undefined
118098
+ flexWrap: "wrap"
118099
+ }
117666
118100
  }, /*#__PURE__*/ React__default.createElement(LLMTagForLevel, {
117667
118101
  level: row.level
117668
- }), name);
118102
+ }), showActions ? /*#__PURE__*/ React__default.createElement(NodeActions, {
118103
+ sessionId: row.sessionId,
118104
+ nodeId: row.agentNodeId,
118105
+ onAgentNodeClick: onAgentNodeClick,
118106
+ onOpenVisualizer: onOpenVisualizer
118107
+ }) : name);
117669
118108
  }
117670
118109
  },
117671
118110
  ...METRIC_COLUMNS.map(({ key, title, Icon })=>({
@@ -117849,10 +118288,24 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117849
118288
  }
117850
118289
  }));
117851
118290
  }
117852
- if (aggregateType === "Judge") {
117853
- 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, {
117854
118306
  metrics: dataSource,
117855
- onAgentNodeClick: onAgentNodeClick
118307
+ onAgentNodeClick: onAgentNodeClick,
118308
+ onOpenVisualizer: onOpenVisualizer
117856
118309
  });
117857
118310
  }
117858
118311
  // ToolUse (tree table)
@@ -117921,7 +118374,7 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117921
118374
  dataIndex: "name",
117922
118375
  key: "name",
117923
118376
  render: (name, row)=>{
117924
- const isClickable = (row.level === 2 || row.level === 3) && row.nodeId && onAgentNodeClick;
118377
+ const showActions = (row.level === 2 || row.level === 3) && row.nodeId && (onAgentNodeClick || onOpenVisualizer);
117925
118378
  return /*#__PURE__*/ React__default.createElement("span", {
117926
118379
  style: {
117927
118380
  display: "inline-flex",
@@ -117929,27 +118382,16 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117929
118382
  gap: 8,
117930
118383
  fontFamily: "monospace",
117931
118384
  fontSize: 13,
117932
- ...isClickable && {
117933
- cursor: "pointer",
117934
- color: theme.colors.primary
117935
- }
117936
- },
117937
- onClick: isClickable ? (e)=>{
117938
- e.stopPropagation();
117939
- onAgentNodeClick(row.sessionId, row.nodeId);
117940
- } : undefined,
117941
- onKeyDown: isClickable ? (e)=>{
117942
- if (e.key === "Enter" || e.key === " ") {
117943
- e.preventDefault();
117944
- e.stopPropagation();
117945
- onAgentNodeClick(row.sessionId, row.nodeId);
117946
- }
117947
- } : undefined,
117948
- role: isClickable ? "button" : undefined,
117949
- tabIndex: isClickable ? 0 : undefined
118385
+ flexWrap: "wrap"
118386
+ }
117950
118387
  }, /*#__PURE__*/ React__default.createElement(TagForLevel, {
117951
118388
  level: row.level
117952
- }), name);
118389
+ }), showActions ? /*#__PURE__*/ React__default.createElement(NodeActions, {
118390
+ sessionId: row.sessionId,
118391
+ nodeId: row.nodeId,
118392
+ onAgentNodeClick: onAgentNodeClick,
118393
+ onOpenVisualizer: onOpenVisualizer
118394
+ }) : name);
117953
118395
  }
117954
118396
  },
117955
118397
  {
@@ -118127,7 +118569,8 @@ function isCategoricalMetric(def) {
118127
118569
  const aggregateTypes = [
118128
118570
  "ToolAggregate",
118129
118571
  "LLMInferenceAggregate",
118130
- "CategoricalAggregate"
118572
+ "CategoricalAggregate",
118573
+ "NumericalAggregate"
118131
118574
  ];
118132
118575
  const aggregateItems = Object.values(nodes).filter((n)=>n?.type && aggregateTypes.includes(n.type));
118133
118576
  return [
@@ -118267,7 +118710,7 @@ function isCategoricalMetric(def) {
118267
118710
  }, 0) ?? 0;
118268
118711
  }
118269
118712
 
118270
- const EvaluatorResult = ({ evaluation, evaluatorId, backHref, onAgentNodeClick })=>{
118713
+ const EvaluatorResult = ({ evaluation, evaluatorId, backHref, onAgentNodeClick, onOpenVisualizer })=>{
118271
118714
  const { theme } = useTheme$1();
118272
118715
  const labelColor = theme.colors.mutedForeground;
118273
118716
  const derived = evaluation ? deriveEvaluatorResultData(evaluation, evaluatorId) : null;
@@ -118410,7 +118853,8 @@ const EvaluatorResult = ({ evaluation, evaluatorId, backHref, onAgentNodeClick }
118410
118853
  aggregateResults: aggregateResults,
118411
118854
  agents: evaluation.agents,
118412
118855
  evaluatorName: evaluatorName,
118413
- onAgentNodeClick: onAgentNodeClick
118856
+ onAgentNodeClick: onAgentNodeClick,
118857
+ onOpenVisualizer: onOpenVisualizer
118414
118858
  }))));
118415
118859
  };
118416
118860