@railtownai/railtracks-visualizer 0.0.66 → 0.0.67

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$y = [
12922
+ const __iconNode$z = [
12923
12923
  [
12924
12924
  "path",
12925
12925
  {
@@ -12935,9 +12935,9 @@ const __iconNode$y = [
12935
12935
  }
12936
12936
  ]
12937
12937
  ];
12938
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$y);
12938
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$z);
12939
12939
 
12940
- const __iconNode$x = [
12940
+ const __iconNode$y = [
12941
12941
  [
12942
12942
  "path",
12943
12943
  {
@@ -12953,9 +12953,9 @@ const __iconNode$x = [
12953
12953
  }
12954
12954
  ]
12955
12955
  ];
12956
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$x);
12956
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$y);
12957
12957
 
12958
- const __iconNode$w = [
12958
+ const __iconNode$x = [
12959
12959
  [
12960
12960
  "path",
12961
12961
  {
@@ -13003,9 +13003,9 @@ const __iconNode$w = [
13003
13003
  }
13004
13004
  ]
13005
13005
  ];
13006
- const Bot = createLucideIcon("bot", __iconNode$w);
13006
+ const Bot = createLucideIcon("bot", __iconNode$x);
13007
13007
 
13008
- const __iconNode$v = [
13008
+ const __iconNode$w = [
13009
13009
  [
13010
13010
  "path",
13011
13011
  {
@@ -13039,9 +13039,9 @@ const __iconNode$v = [
13039
13039
  }
13040
13040
  ]
13041
13041
  ];
13042
- const Calendar = createLucideIcon("calendar", __iconNode$v);
13042
+ const Calendar = createLucideIcon("calendar", __iconNode$w);
13043
13043
 
13044
- const __iconNode$u = [
13044
+ const __iconNode$v = [
13045
13045
  [
13046
13046
  "path",
13047
13047
  {
@@ -13098,9 +13098,9 @@ const __iconNode$u = [
13098
13098
  }
13099
13099
  ]
13100
13100
  ];
13101
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$u);
13101
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$v);
13102
13102
 
13103
- const __iconNode$t = [
13103
+ const __iconNode$u = [
13104
13104
  [
13105
13105
  "path",
13106
13106
  {
@@ -13109,9 +13109,9 @@ const __iconNode$t = [
13109
13109
  }
13110
13110
  ]
13111
13111
  ];
13112
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$t);
13112
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$u);
13113
13113
 
13114
- const __iconNode$s = [
13114
+ const __iconNode$t = [
13115
13115
  [
13116
13116
  "path",
13117
13117
  {
@@ -13120,9 +13120,9 @@ const __iconNode$s = [
13120
13120
  }
13121
13121
  ]
13122
13122
  ];
13123
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$s);
13123
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$t);
13124
13124
 
13125
- const __iconNode$r = [
13125
+ const __iconNode$s = [
13126
13126
  [
13127
13127
  "path",
13128
13128
  {
@@ -13138,9 +13138,9 @@ const __iconNode$r = [
13138
13138
  }
13139
13139
  ]
13140
13140
  ];
13141
- const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$r);
13141
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$s);
13142
13142
 
13143
- const __iconNode$q = [
13143
+ const __iconNode$r = [
13144
13144
  [
13145
13145
  "path",
13146
13146
  {
@@ -13156,9 +13156,9 @@ const __iconNode$q = [
13156
13156
  }
13157
13157
  ]
13158
13158
  ];
13159
- const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$q);
13159
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$r);
13160
13160
 
13161
- const __iconNode$p = [
13161
+ const __iconNode$q = [
13162
13162
  [
13163
13163
  "circle",
13164
13164
  {
@@ -13189,9 +13189,9 @@ const __iconNode$p = [
13189
13189
  }
13190
13190
  ]
13191
13191
  ];
13192
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$p);
13192
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$q);
13193
13193
 
13194
- const __iconNode$o = [
13194
+ const __iconNode$p = [
13195
13195
  [
13196
13196
  "path",
13197
13197
  {
@@ -13207,9 +13207,9 @@ const __iconNode$o = [
13207
13207
  }
13208
13208
  ]
13209
13209
  ];
13210
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$o);
13210
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$p);
13211
13211
 
13212
- const __iconNode$n = [
13212
+ const __iconNode$o = [
13213
13213
  [
13214
13214
  "circle",
13215
13215
  {
@@ -13234,9 +13234,9 @@ const __iconNode$n = [
13234
13234
  }
13235
13235
  ]
13236
13236
  ];
13237
- const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$n);
13237
+ const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$o);
13238
13238
 
13239
- const __iconNode$m = [
13239
+ const __iconNode$n = [
13240
13240
  [
13241
13241
  "circle",
13242
13242
  {
@@ -13254,9 +13254,9 @@ const __iconNode$m = [
13254
13254
  }
13255
13255
  ]
13256
13256
  ];
13257
- const Clock = createLucideIcon("clock", __iconNode$m);
13257
+ const Clock = createLucideIcon("clock", __iconNode$n);
13258
13258
 
13259
- const __iconNode$l = [
13259
+ const __iconNode$m = [
13260
13260
  [
13261
13261
  "rect",
13262
13262
  {
@@ -13277,9 +13277,9 @@ const __iconNode$l = [
13277
13277
  }
13278
13278
  ]
13279
13279
  ];
13280
- const Copy = createLucideIcon("copy", __iconNode$l);
13280
+ const Copy = createLucideIcon("copy", __iconNode$m);
13281
13281
 
13282
- const __iconNode$k = [
13282
+ const __iconNode$l = [
13283
13283
  [
13284
13284
  "path",
13285
13285
  {
@@ -13387,9 +13387,9 @@ const __iconNode$k = [
13387
13387
  }
13388
13388
  ]
13389
13389
  ];
13390
- const Cpu = createLucideIcon("cpu", __iconNode$k);
13390
+ const Cpu = createLucideIcon("cpu", __iconNode$l);
13391
13391
 
13392
- const __iconNode$j = [
13392
+ const __iconNode$k = [
13393
13393
  [
13394
13394
  "line",
13395
13395
  {
@@ -13408,9 +13408,9 @@ const __iconNode$j = [
13408
13408
  }
13409
13409
  ]
13410
13410
  ];
13411
- const DollarSign = createLucideIcon("dollar-sign", __iconNode$j);
13411
+ const DollarSign = createLucideIcon("dollar-sign", __iconNode$k);
13412
13412
 
13413
- const __iconNode$i = [
13413
+ const __iconNode$j = [
13414
13414
  [
13415
13415
  "path",
13416
13416
  {
@@ -13440,9 +13440,9 @@ const __iconNode$i = [
13440
13440
  }
13441
13441
  ]
13442
13442
  ];
13443
- const FileInput = createLucideIcon("file-input", __iconNode$i);
13443
+ const FileInput = createLucideIcon("file-input", __iconNode$j);
13444
13444
 
13445
- const __iconNode$h = [
13445
+ const __iconNode$i = [
13446
13446
  [
13447
13447
  "path",
13448
13448
  {
@@ -13472,9 +13472,9 @@ const __iconNode$h = [
13472
13472
  }
13473
13473
  ]
13474
13474
  ];
13475
- const FileOutput = createLucideIcon("file-output", __iconNode$h);
13475
+ const FileOutput = createLucideIcon("file-output", __iconNode$i);
13476
13476
 
13477
- const __iconNode$g = [
13477
+ const __iconNode$h = [
13478
13478
  [
13479
13479
  "path",
13480
13480
  {
@@ -13532,9 +13532,9 @@ const __iconNode$g = [
13532
13532
  }
13533
13533
  ]
13534
13534
  ];
13535
- const FoldVertical = createLucideIcon("fold-vertical", __iconNode$g);
13535
+ const FoldVertical = createLucideIcon("fold-vertical", __iconNode$h);
13536
13536
 
13537
- const __iconNode$f = [
13537
+ const __iconNode$g = [
13538
13538
  [
13539
13539
  "line",
13540
13540
  {
@@ -13576,9 +13576,9 @@ const __iconNode$f = [
13576
13576
  }
13577
13577
  ]
13578
13578
  ];
13579
- const Hash = createLucideIcon("hash", __iconNode$f);
13579
+ const Hash = createLucideIcon("hash", __iconNode$g);
13580
13580
 
13581
- const __iconNode$e = [
13581
+ const __iconNode$f = [
13582
13582
  [
13583
13583
  "circle",
13584
13584
  {
@@ -13603,9 +13603,9 @@ const __iconNode$e = [
13603
13603
  }
13604
13604
  ]
13605
13605
  ];
13606
- const Info = createLucideIcon("info", __iconNode$e);
13606
+ const Info = createLucideIcon("info", __iconNode$f);
13607
13607
 
13608
- const __iconNode$d = [
13608
+ const __iconNode$e = [
13609
13609
  [
13610
13610
  "path",
13611
13611
  {
@@ -13642,7 +13642,39 @@ const __iconNode$d = [
13642
13642
  }
13643
13643
  ]
13644
13644
  ];
13645
- const ListChecks = createLucideIcon("list-checks", __iconNode$d);
13645
+ const ListChecks = createLucideIcon("list-checks", __iconNode$e);
13646
+
13647
+ const __iconNode$d = [
13648
+ [
13649
+ "path",
13650
+ {
13651
+ d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
13652
+ key: "18887p"
13653
+ }
13654
+ ],
13655
+ [
13656
+ "path",
13657
+ {
13658
+ d: "M7 11h10",
13659
+ key: "1twpyw"
13660
+ }
13661
+ ],
13662
+ [
13663
+ "path",
13664
+ {
13665
+ d: "M7 15h6",
13666
+ key: "d9of3u"
13667
+ }
13668
+ ],
13669
+ [
13670
+ "path",
13671
+ {
13672
+ d: "M7 7h8",
13673
+ key: "af5zfr"
13674
+ }
13675
+ ]
13676
+ ];
13677
+ const MessageSquareText = createLucideIcon("message-square-text", __iconNode$d);
13646
13678
 
13647
13679
  const __iconNode$c = [
13648
13680
  [
@@ -116805,6 +116837,401 @@ function buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCount
116805
116837
  return buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCountByTool, latencyResults, failureResults, agentIdToSessionId);
116806
116838
  }
116807
116839
 
116840
+ const JUDGE_RESULT_PREFIX = "JudgeResult/";
116841
+ const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
116842
+ /** Map agent node id -> session id from the agents array (new format only). */ function buildSessionByNodeId(agents) {
116843
+ const map = new Map();
116844
+ for (const agent of agents ?? []){
116845
+ for (const entry of agent.agent_node_ids ?? []){
116846
+ if (entry && typeof entry === "object" && "agent_node_id" in entry) {
116847
+ map.set(entry.agent_node_id, entry.session_id);
116848
+ }
116849
+ }
116850
+ }
116851
+ return map;
116852
+ }
116853
+ /** Map `${nodeId}::${metricName}` -> reasoning text from JudgeReasoning/* results. */ function buildReasoningByKey(rawResults) {
116854
+ const map = new Map();
116855
+ for (const item of rawResults){
116856
+ if (!isBaseResult(item)) continue;
116857
+ if (!item.result_name?.startsWith(JUDGE_REASONING_PREFIX)) continue;
116858
+ const metricName = item.result_name.slice(JUDGE_REASONING_PREFIX.length);
116859
+ const nodeId = item.agent_data_id?.[0];
116860
+ if (nodeId && typeof item.value === "string") {
116861
+ map.set(`${nodeId}::${metricName}`, item.value);
116862
+ }
116863
+ }
116864
+ return map;
116865
+ }
116866
+ function metricNameOf(agg) {
116867
+ return agg.metric?.name ?? agg.name?.replace(/^Aggregate\//, "") ?? "Unknown";
116868
+ }
116869
+ /** Collect the JudgeResult leaf nodes (label + node id) grouped by label. */ function groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey) {
116870
+ const byLabel = new Map();
116871
+ const seen = new Set();
116872
+ const push = (label, nodeId)=>{
116873
+ const dedupeKey = `${label}::${nodeId}`;
116874
+ if (seen.has(dedupeKey)) return;
116875
+ seen.add(dedupeKey);
116876
+ const ref = {
116877
+ nodeId,
116878
+ sessionId: sessionByNodeId.get(nodeId),
116879
+ reasoning: reasoningByKey.get(`${nodeId}::${metricName}`)
116880
+ };
116881
+ const existing = byLabel.get(label);
116882
+ if (existing) existing.push(ref);
116883
+ else byLabel.set(label, [
116884
+ ref
116885
+ ]);
116886
+ };
116887
+ // Preferred: walk the aggregate's children leaf nodes.
116888
+ for (const childId of agg.children ?? []){
116889
+ const child = nodes[childId];
116890
+ if (child && isBaseResult(child)) {
116891
+ const nodeId = child.agent_data_id?.[0];
116892
+ if (nodeId) push(String(child.value), nodeId);
116893
+ }
116894
+ }
116895
+ // Fallback: derive from raw JudgeResult/<metric> results when no children are present.
116896
+ if (byLabel.size === 0) {
116897
+ const resultName = `${JUDGE_RESULT_PREFIX}${metricName}`;
116898
+ for (const item of rawResults){
116899
+ if (isBaseResult(item) && item.result_name === resultName) {
116900
+ const nodeId = item.agent_data_id?.[0];
116901
+ if (nodeId) push(String(item.value), nodeId);
116902
+ }
116903
+ }
116904
+ }
116905
+ return byLabel;
116906
+ }
116907
+ /** Build the Judge view model: one entry per categorical metric. */ function buildJudgeMetricsFromAggregate(input) {
116908
+ const { roots, nodes, agents, rawResults = [] } = input;
116909
+ const sessionByNodeId = buildSessionByNodeId(agents);
116910
+ const reasoningByKey = buildReasoningByKey(rawResults);
116911
+ // Prefer roots; fall back to scanning all nodes for categorical aggregates.
116912
+ const rootAggregates = roots.map((id)=>nodes[id]).filter((n)=>isAggregateCategorical(n));
116913
+ const aggregates = rootAggregates.length > 0 ? rootAggregates : Object.values(nodes).filter((n)=>isAggregateCategorical(n));
116914
+ return aggregates.map((agg, index)=>{
116915
+ const metricName = metricNameOf(agg);
116916
+ const counts = agg.counts ?? {};
116917
+ const categories = agg.categories ?? agg.metric?.categories ?? Object.keys(counts);
116918
+ const byLabel = groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey);
116919
+ // Order labels by the metric's category order, then any extras found in the data.
116920
+ const orderedLabels = [
116921
+ ...categories
116922
+ ];
116923
+ for (const label of byLabel.keys()){
116924
+ if (!orderedLabels.includes(label)) orderedLabels.push(label);
116925
+ }
116926
+ const labels = orderedLabels.map((labelName)=>{
116927
+ const nodesForLabel = byLabel.get(labelName) ?? [];
116928
+ return {
116929
+ labelName,
116930
+ count: counts[labelName] ?? nodesForLabel.length,
116931
+ nodes: nodesForLabel
116932
+ };
116933
+ });
116934
+ const total = labels.reduce((sum, l)=>sum + l.count, 0);
116935
+ return {
116936
+ key: agg.identifier ?? `${metricName}-${index}`,
116937
+ metricName,
116938
+ description: agg.metric?.description ?? undefined,
116939
+ mostCommon: agg.most_common_label ?? undefined,
116940
+ leastCommon: agg.least_common_label ?? undefined,
116941
+ total,
116942
+ labels
116943
+ };
116944
+ });
116945
+ }
116946
+
116947
+ const SHORT_ID_LENGTH = 8;
116948
+ const shortenId = (id)=>id.length > SHORT_ID_LENGTH ? id.slice(0, SHORT_ID_LENGTH) : id;
116949
+ const NodeRow = ({ node, metricName, onAgentNodeClick })=>{
116950
+ const { theme } = useTheme$1();
116951
+ const [showReasoning, setShowReasoning] = useState(false);
116952
+ const clickable = !!onAgentNodeClick;
116953
+ const open = ()=>onAgentNodeClick?.(node.sessionId, node.nodeId);
116954
+ return /*#__PURE__*/ React__default.createElement("div", {
116955
+ style: {
116956
+ display: "flex",
116957
+ flexDirection: "column",
116958
+ gap: 8
116959
+ }
116960
+ }, /*#__PURE__*/ React__default.createElement("div", {
116961
+ style: {
116962
+ display: "flex",
116963
+ alignItems: "center",
116964
+ gap: 10,
116965
+ flexWrap: "wrap"
116966
+ }
116967
+ }, /*#__PURE__*/ React__default.createElement(Tooltip, {
116968
+ title: clickable ? `Inspect run · ${node.nodeId}` : node.nodeId
116969
+ }, /*#__PURE__*/ React__default.createElement("span", {
116970
+ role: clickable ? "button" : undefined,
116971
+ tabIndex: clickable ? 0 : undefined,
116972
+ onClick: clickable ? open : undefined,
116973
+ onKeyDown: clickable ? (e)=>{
116974
+ if (e.key === "Enter" || e.key === " ") {
116975
+ e.preventDefault();
116976
+ open();
116977
+ }
116978
+ } : undefined,
116979
+ style: {
116980
+ display: "inline-flex",
116981
+ alignItems: "center",
116982
+ gap: 6,
116983
+ padding: "3px 10px",
116984
+ borderRadius: 6,
116985
+ fontFamily: "monospace",
116986
+ fontSize: 12,
116987
+ fontWeight: 500,
116988
+ background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
116989
+ color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
116990
+ border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`,
116991
+ cursor: clickable ? "pointer" : "default"
116992
+ }
116993
+ }, /*#__PURE__*/ React__default.createElement(Bot, {
116994
+ size: 13,
116995
+ style: {
116996
+ flexShrink: 0
116997
+ }
116998
+ }), shortenId(node.nodeId))), node.reasoning && /*#__PURE__*/ React__default.createElement("button", {
116999
+ type: "button",
117000
+ onClick: ()=>setShowReasoning((s)=>!s),
117001
+ style: {
117002
+ display: "inline-flex",
117003
+ alignItems: "center",
117004
+ gap: 5,
117005
+ padding: "3px 9px",
117006
+ borderRadius: 6,
117007
+ fontSize: 12,
117008
+ cursor: "pointer",
117009
+ background: "transparent",
117010
+ color: theme.colors.primary,
117011
+ border: `1px solid ${theme.colors.primary}`
117012
+ }
117013
+ }, /*#__PURE__*/ React__default.createElement(MessageSquareText, {
117014
+ size: 12
117015
+ }), showReasoning ? "Hide reasoning" : "Show reasoning")), node.reasoning && showReasoning && /*#__PURE__*/ React__default.createElement("div", {
117016
+ style: {
117017
+ padding: "10px 14px",
117018
+ background: theme.colors.muted,
117019
+ border: `1px solid ${theme.colors.border}`,
117020
+ borderRadius: 6,
117021
+ fontSize: 13,
117022
+ lineHeight: 1.5,
117023
+ whiteSpace: "pre-wrap",
117024
+ color: theme.colors.foreground
117025
+ }
117026
+ }, /*#__PURE__*/ React__default.createElement("div", {
117027
+ style: {
117028
+ fontWeight: 600,
117029
+ marginBottom: 6,
117030
+ color: theme.colors.mutedForeground
117031
+ }
117032
+ }, "Judge reasoning · ", metricName), node.reasoning));
117033
+ };
117034
+ const LabelPanelHeader = ({ label })=>{
117035
+ const { theme } = useTheme$1();
117036
+ const isEmpty = label.count === 0;
117037
+ return /*#__PURE__*/ React__default.createElement("div", {
117038
+ style: {
117039
+ display: "flex",
117040
+ alignItems: "center",
117041
+ gap: 10
117042
+ }
117043
+ }, /*#__PURE__*/ React__default.createElement("span", {
117044
+ style: {
117045
+ width: 7,
117046
+ height: 7,
117047
+ borderRadius: "50%",
117048
+ flexShrink: 0,
117049
+ background: isEmpty ? theme.colors.border : theme.colors.primary
117050
+ }
117051
+ }), /*#__PURE__*/ React__default.createElement("span", {
117052
+ style: {
117053
+ fontSize: 13,
117054
+ fontWeight: 600,
117055
+ color: isEmpty ? theme.colors.mutedForeground : undefined
117056
+ }
117057
+ }, label.labelName), /*#__PURE__*/ React__default.createElement("span", {
117058
+ style: {
117059
+ marginLeft: "auto",
117060
+ fontSize: 12,
117061
+ color: theme.colors.mutedForeground
117062
+ }
117063
+ }, label.count, " ", label.count === 1 ? "node" : "nodes"));
117064
+ };
117065
+ const MetricCard = ({ metric, onAgentNodeClick })=>{
117066
+ const { theme } = useTheme$1();
117067
+ const items = metric.labels.map((label)=>({
117068
+ key: label.labelName,
117069
+ label: /*#__PURE__*/ React__default.createElement(LabelPanelHeader, {
117070
+ label: label
117071
+ }),
117072
+ collapsible: label.count === 0 ? "disabled" : undefined,
117073
+ children: label.nodes.length === 0 ? /*#__PURE__*/ React__default.createElement("span", {
117074
+ style: {
117075
+ fontSize: 12,
117076
+ fontStyle: "italic",
117077
+ color: theme.colors.mutedForeground
117078
+ }
117079
+ }, "No evaluations") : /*#__PURE__*/ React__default.createElement("div", {
117080
+ style: {
117081
+ display: "flex",
117082
+ flexDirection: "column",
117083
+ gap: 12
117084
+ }
117085
+ }, label.nodes.map((node)=>/*#__PURE__*/ React__default.createElement(NodeRow, {
117086
+ key: node.nodeId,
117087
+ node: node,
117088
+ metricName: metric.metricName,
117089
+ onAgentNodeClick: onAgentNodeClick
117090
+ })))
117091
+ }));
117092
+ return /*#__PURE__*/ React__default.createElement("div", {
117093
+ style: {
117094
+ background: theme.colors.card,
117095
+ border: `1px solid ${theme.colors.border}`,
117096
+ borderRadius: 8,
117097
+ overflow: "hidden"
117098
+ }
117099
+ }, /*#__PURE__*/ React__default.createElement("div", {
117100
+ style: {
117101
+ padding: "14px 18px",
117102
+ borderBottom: `1px solid ${theme.colors.border}`,
117103
+ background: theme.colors.secondary
117104
+ }
117105
+ }, /*#__PURE__*/ React__default.createElement("div", {
117106
+ style: {
117107
+ display: "flex",
117108
+ alignItems: "center",
117109
+ gap: 12,
117110
+ flexWrap: "wrap"
117111
+ }
117112
+ }, /*#__PURE__*/ React__default.createElement(Scale, {
117113
+ size: 16,
117114
+ style: {
117115
+ color: theme.colors.primary,
117116
+ flexShrink: 0
117117
+ }
117118
+ }), /*#__PURE__*/ React__default.createElement("span", {
117119
+ style: {
117120
+ fontSize: 15,
117121
+ fontWeight: 600
117122
+ }
117123
+ }, metric.metricName), /*#__PURE__*/ React__default.createElement("div", {
117124
+ style: {
117125
+ display: "flex",
117126
+ flexWrap: "wrap",
117127
+ gap: 6,
117128
+ marginLeft: 4
117129
+ }
117130
+ }, metric.labels.map((label)=>/*#__PURE__*/ React__default.createElement(Tag, {
117131
+ key: label.labelName,
117132
+ style: {
117133
+ margin: 0,
117134
+ borderRadius: 12,
117135
+ fontSize: 12,
117136
+ ...label.count > 0 ? {
117137
+ background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
117138
+ color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
117139
+ border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`
117140
+ } : {
117141
+ background: "transparent",
117142
+ color: theme.colors.mutedForeground,
117143
+ border: `1px solid ${theme.colors.border}`
117144
+ }
117145
+ }
117146
+ }, label.labelName, " ", /*#__PURE__*/ React__default.createElement("strong", null, label.count)))), /*#__PURE__*/ React__default.createElement("div", {
117147
+ style: {
117148
+ display: "flex",
117149
+ gap: 20,
117150
+ marginLeft: "auto",
117151
+ flexShrink: 0
117152
+ }
117153
+ }, /*#__PURE__*/ React__default.createElement(Meta, {
117154
+ label: "Most common",
117155
+ value: metric.mostCommon
117156
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117157
+ label: "Least common",
117158
+ value: metric.leastCommon
117159
+ }), /*#__PURE__*/ React__default.createElement(Meta, {
117160
+ label: "Evaluations",
117161
+ value: String(metric.total)
117162
+ }))), metric.description && /*#__PURE__*/ React__default.createElement("div", {
117163
+ style: {
117164
+ marginTop: 6,
117165
+ fontSize: 12,
117166
+ color: theme.colors.mutedForeground
117167
+ }
117168
+ }, metric.description)), /*#__PURE__*/ React__default.createElement(Collapse$1, {
117169
+ items: items,
117170
+ bordered: false,
117171
+ style: {
117172
+ background: theme.colors.card
117173
+ }
117174
+ }));
117175
+ };
117176
+ const Meta = ({ label, value })=>{
117177
+ const { theme } = useTheme$1();
117178
+ return /*#__PURE__*/ React__default.createElement("span", {
117179
+ style: {
117180
+ display: "flex",
117181
+ flexDirection: "column",
117182
+ alignItems: "flex-end",
117183
+ gap: 1
117184
+ }
117185
+ }, /*#__PURE__*/ React__default.createElement("span", {
117186
+ style: {
117187
+ fontSize: 10,
117188
+ textTransform: "uppercase",
117189
+ letterSpacing: 0.4,
117190
+ color: theme.colors.mutedForeground
117191
+ }
117192
+ }, label), /*#__PURE__*/ React__default.createElement("span", {
117193
+ style: {
117194
+ fontSize: 13,
117195
+ fontWeight: 500
117196
+ }
117197
+ }, value ?? "—"));
117198
+ };
117199
+ const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
117200
+ const { theme } = useTheme$1();
117201
+ if (!metrics.length) {
117202
+ return /*#__PURE__*/ React__default.createElement("div", {
117203
+ style: {
117204
+ padding: 24,
117205
+ textAlign: "center",
117206
+ color: theme.colors.mutedForeground,
117207
+ fontSize: 14
117208
+ }
117209
+ }, "No judge metrics available");
117210
+ }
117211
+ return /*#__PURE__*/ React__default.createElement("div", {
117212
+ style: {
117213
+ width: "100%",
117214
+ minWidth: 0
117215
+ }
117216
+ }, /*#__PURE__*/ React__default.createElement("h3", {
117217
+ style: {
117218
+ margin: "0 0 16px",
117219
+ fontSize: 16,
117220
+ fontWeight: 600
117221
+ }
117222
+ }, "Judge Evaluator - Aggregate View"), /*#__PURE__*/ React__default.createElement("div", {
117223
+ style: {
117224
+ display: "flex",
117225
+ flexDirection: "column",
117226
+ gap: 12
117227
+ }
117228
+ }, metrics.map((metric)=>/*#__PURE__*/ React__default.createElement(MetricCard, {
117229
+ key: metric.key,
117230
+ metric: metric,
117231
+ onAgentNodeClick: onAgentNodeClick
117232
+ }))));
117233
+ };
117234
+
116808
117235
  function detectAggregateType(nodes) {
116809
117236
  const values = Object.values(nodes);
116810
117237
  if (values.some((n)=>n?.type === "ToolAggregate")) return "ToolUse";
@@ -116825,22 +117252,6 @@ function buildLLMInferenceFlatRows(nodes) {
116825
117252
  count: agg.values?.length ?? 0
116826
117253
  }));
116827
117254
  }
116828
- function buildJudgeRows(nodes) {
116829
- const values = Object.values(nodes);
116830
- const aggregates = values.filter((n)=>isAggregateCategorical(n));
116831
- return aggregates.map((agg)=>{
116832
- const counts = agg.counts ?? {};
116833
- const total = Object.values(counts).reduce((a, b)=>a + b, 0);
116834
- return {
116835
- key: agg.identifier ?? agg.metric?.name ?? "unknown",
116836
- metric: agg.metric?.name ?? "Unknown",
116837
- mostCommon: agg.most_common_label ?? "-",
116838
- leastCommon: agg.least_common_label ?? "-",
116839
- counts,
116840
- total
116841
- };
116842
- });
116843
- }
116844
117255
  // --- Shared helpers ---
116845
117256
  function getAllExpandableKeys(rows) {
116846
117257
  const keys = [];
@@ -116912,7 +117323,12 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
116912
117323
  if (type === "Judge") {
116913
117324
  return {
116914
117325
  aggregateType: type,
116915
- dataSource: buildJudgeRows(aggregateResults.nodes),
117326
+ dataSource: buildJudgeMetricsFromAggregate({
117327
+ roots: aggregateResults.roots,
117328
+ nodes: aggregateResults.nodes,
117329
+ agents,
117330
+ rawResults
117331
+ }),
116916
117332
  llmIsTree: false,
116917
117333
  llmExpandableKeys: []
116918
117334
  };
@@ -117245,86 +117661,10 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117245
117661
  }));
117246
117662
  }
117247
117663
  if (aggregateType === "Judge") {
117248
- const rows = dataSource;
117249
- const columns = [
117250
- {
117251
- title: "METRIC",
117252
- dataIndex: "metric",
117253
- key: "metric",
117254
- render: (metric)=>/*#__PURE__*/ React__default.createElement("span", {
117255
- style: {
117256
- fontFamily: "monospace",
117257
- fontSize: 13
117258
- }
117259
- }, /*#__PURE__*/ React__default.createElement(Scale, {
117260
- size: 14,
117261
- style: {
117262
- marginRight: 8,
117263
- verticalAlign: "middle",
117264
- color: theme.colors.primary
117265
- }
117266
- }), metric)
117267
- },
117268
- {
117269
- title: "MOST COMMON",
117270
- dataIndex: "mostCommon",
117271
- key: "mostCommon",
117272
- render: (v)=>/*#__PURE__*/ React__default.createElement(Tag, {
117273
- style: {
117274
- background: theme.colors.success,
117275
- color: theme.colors.successForeground,
117276
- border: "none"
117277
- }
117278
- }, v)
117279
- },
117280
- {
117281
- title: "LEAST COMMON",
117282
- dataIndex: "leastCommon",
117283
- key: "leastCommon",
117284
- render: (v)=>/*#__PURE__*/ React__default.createElement("span", {
117285
- style: {
117286
- color: theme.colors.mutedForeground
117287
- }
117288
- }, v)
117289
- },
117290
- {
117291
- title: "DISTRIBUTION",
117292
- key: "distribution",
117293
- render: (_, row)=>{
117294
- const entries = Object.entries(row.counts).sort((a, b)=>b[1] - a[1]);
117295
- return /*#__PURE__*/ React__default.createElement("span", {
117296
- style: {
117297
- fontSize: 12,
117298
- color: theme.colors.mutedForeground
117299
- }
117300
- }, entries.map(([label, count])=>`${label}: ${count}`).join(" · "));
117301
- }
117302
- }
117303
- ];
117304
- return /*#__PURE__*/ React__default.createElement("div", {
117305
- style: {
117306
- width: "100%",
117307
- minWidth: 0,
117308
- overflow: "hidden"
117309
- }
117310
- }, /*#__PURE__*/ React__default.createElement("h3", {
117311
- style: {
117312
- margin: "0 0 16px",
117313
- fontSize: 16,
117314
- fontWeight: 600
117315
- }
117316
- }, resolvedTitle), /*#__PURE__*/ React__default.createElement(ForwardTable, {
117317
- dataSource: rows,
117318
- columns: columns,
117319
- rowKey: "key",
117320
- pagination: false,
117321
- size: "small",
117322
- style: {
117323
- width: "100%",
117324
- background: theme.colors.card,
117325
- border: `1px solid ${theme.colors.border}`
117326
- }
117327
- }));
117664
+ return /*#__PURE__*/ React__default.createElement(JudgeAggregateView, {
117665
+ metrics: dataSource,
117666
+ onAgentNodeClick: onAgentNodeClick
117667
+ });
117328
117668
  }
117329
117669
  // ToolUse (tree table)
117330
117670
  const toolRows = dataSource;
@@ -117877,7 +118217,7 @@ const EvaluatorResult = ({ evaluation, evaluatorId, backHref, onAgentNodeClick }
117877
118217
  minWidth: 0
117878
118218
  }
117879
118219
  }, /*#__PURE__*/ React__default.createElement(AggregateResultsTable, {
117880
- rawResults: rawResults.filter((r)=>isToolResult(r) || isToolAggregate(r)),
118220
+ rawResults: rawResults,
117881
118221
  aggregateResults: aggregateResults,
117882
118222
  agents: evaluation.agents,
117883
118223
  evaluatorName: evaluatorName,