@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/cjs/index.js CHANGED
@@ -12939,7 +12939,7 @@ const createLucideIcon = (iconName, iconNode)=>{
12939
12939
  return Component;
12940
12940
  };
12941
12941
 
12942
- const __iconNode$y = [
12942
+ const __iconNode$z = [
12943
12943
  [
12944
12944
  "path",
12945
12945
  {
@@ -12955,9 +12955,9 @@ const __iconNode$y = [
12955
12955
  }
12956
12956
  ]
12957
12957
  ];
12958
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$y);
12958
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$z);
12959
12959
 
12960
- const __iconNode$x = [
12960
+ const __iconNode$y = [
12961
12961
  [
12962
12962
  "path",
12963
12963
  {
@@ -12973,9 +12973,9 @@ const __iconNode$x = [
12973
12973
  }
12974
12974
  ]
12975
12975
  ];
12976
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$x);
12976
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$y);
12977
12977
 
12978
- const __iconNode$w = [
12978
+ const __iconNode$x = [
12979
12979
  [
12980
12980
  "path",
12981
12981
  {
@@ -13023,9 +13023,9 @@ const __iconNode$w = [
13023
13023
  }
13024
13024
  ]
13025
13025
  ];
13026
- const Bot = createLucideIcon("bot", __iconNode$w);
13026
+ const Bot = createLucideIcon("bot", __iconNode$x);
13027
13027
 
13028
- const __iconNode$v = [
13028
+ const __iconNode$w = [
13029
13029
  [
13030
13030
  "path",
13031
13031
  {
@@ -13059,9 +13059,9 @@ const __iconNode$v = [
13059
13059
  }
13060
13060
  ]
13061
13061
  ];
13062
- const Calendar = createLucideIcon("calendar", __iconNode$v);
13062
+ const Calendar = createLucideIcon("calendar", __iconNode$w);
13063
13063
 
13064
- const __iconNode$u = [
13064
+ const __iconNode$v = [
13065
13065
  [
13066
13066
  "path",
13067
13067
  {
@@ -13118,9 +13118,9 @@ const __iconNode$u = [
13118
13118
  }
13119
13119
  ]
13120
13120
  ];
13121
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$u);
13121
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$v);
13122
13122
 
13123
- const __iconNode$t = [
13123
+ const __iconNode$u = [
13124
13124
  [
13125
13125
  "path",
13126
13126
  {
@@ -13129,9 +13129,9 @@ const __iconNode$t = [
13129
13129
  }
13130
13130
  ]
13131
13131
  ];
13132
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$t);
13132
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$u);
13133
13133
 
13134
- const __iconNode$s = [
13134
+ const __iconNode$t = [
13135
13135
  [
13136
13136
  "path",
13137
13137
  {
@@ -13140,9 +13140,9 @@ const __iconNode$s = [
13140
13140
  }
13141
13141
  ]
13142
13142
  ];
13143
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$s);
13143
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$t);
13144
13144
 
13145
- const __iconNode$r = [
13145
+ const __iconNode$s = [
13146
13146
  [
13147
13147
  "path",
13148
13148
  {
@@ -13158,9 +13158,9 @@ const __iconNode$r = [
13158
13158
  }
13159
13159
  ]
13160
13160
  ];
13161
- const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$r);
13161
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$s);
13162
13162
 
13163
- const __iconNode$q = [
13163
+ const __iconNode$r = [
13164
13164
  [
13165
13165
  "path",
13166
13166
  {
@@ -13176,9 +13176,9 @@ const __iconNode$q = [
13176
13176
  }
13177
13177
  ]
13178
13178
  ];
13179
- const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$q);
13179
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$r);
13180
13180
 
13181
- const __iconNode$p = [
13181
+ const __iconNode$q = [
13182
13182
  [
13183
13183
  "circle",
13184
13184
  {
@@ -13209,9 +13209,9 @@ const __iconNode$p = [
13209
13209
  }
13210
13210
  ]
13211
13211
  ];
13212
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$p);
13212
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$q);
13213
13213
 
13214
- const __iconNode$o = [
13214
+ const __iconNode$p = [
13215
13215
  [
13216
13216
  "path",
13217
13217
  {
@@ -13227,9 +13227,9 @@ const __iconNode$o = [
13227
13227
  }
13228
13228
  ]
13229
13229
  ];
13230
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$o);
13230
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$p);
13231
13231
 
13232
- const __iconNode$n = [
13232
+ const __iconNode$o = [
13233
13233
  [
13234
13234
  "circle",
13235
13235
  {
@@ -13254,9 +13254,9 @@ const __iconNode$n = [
13254
13254
  }
13255
13255
  ]
13256
13256
  ];
13257
- const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$n);
13257
+ const CircleDollarSign = createLucideIcon("circle-dollar-sign", __iconNode$o);
13258
13258
 
13259
- const __iconNode$m = [
13259
+ const __iconNode$n = [
13260
13260
  [
13261
13261
  "circle",
13262
13262
  {
@@ -13274,9 +13274,9 @@ const __iconNode$m = [
13274
13274
  }
13275
13275
  ]
13276
13276
  ];
13277
- const Clock = createLucideIcon("clock", __iconNode$m);
13277
+ const Clock = createLucideIcon("clock", __iconNode$n);
13278
13278
 
13279
- const __iconNode$l = [
13279
+ const __iconNode$m = [
13280
13280
  [
13281
13281
  "rect",
13282
13282
  {
@@ -13297,9 +13297,9 @@ const __iconNode$l = [
13297
13297
  }
13298
13298
  ]
13299
13299
  ];
13300
- const Copy = createLucideIcon("copy", __iconNode$l);
13300
+ const Copy = createLucideIcon("copy", __iconNode$m);
13301
13301
 
13302
- const __iconNode$k = [
13302
+ const __iconNode$l = [
13303
13303
  [
13304
13304
  "path",
13305
13305
  {
@@ -13407,9 +13407,9 @@ const __iconNode$k = [
13407
13407
  }
13408
13408
  ]
13409
13409
  ];
13410
- const Cpu = createLucideIcon("cpu", __iconNode$k);
13410
+ const Cpu = createLucideIcon("cpu", __iconNode$l);
13411
13411
 
13412
- const __iconNode$j = [
13412
+ const __iconNode$k = [
13413
13413
  [
13414
13414
  "line",
13415
13415
  {
@@ -13428,9 +13428,9 @@ const __iconNode$j = [
13428
13428
  }
13429
13429
  ]
13430
13430
  ];
13431
- const DollarSign = createLucideIcon("dollar-sign", __iconNode$j);
13431
+ const DollarSign = createLucideIcon("dollar-sign", __iconNode$k);
13432
13432
 
13433
- const __iconNode$i = [
13433
+ const __iconNode$j = [
13434
13434
  [
13435
13435
  "path",
13436
13436
  {
@@ -13460,9 +13460,9 @@ const __iconNode$i = [
13460
13460
  }
13461
13461
  ]
13462
13462
  ];
13463
- const FileInput = createLucideIcon("file-input", __iconNode$i);
13463
+ const FileInput = createLucideIcon("file-input", __iconNode$j);
13464
13464
 
13465
- const __iconNode$h = [
13465
+ const __iconNode$i = [
13466
13466
  [
13467
13467
  "path",
13468
13468
  {
@@ -13492,9 +13492,9 @@ const __iconNode$h = [
13492
13492
  }
13493
13493
  ]
13494
13494
  ];
13495
- const FileOutput = createLucideIcon("file-output", __iconNode$h);
13495
+ const FileOutput = createLucideIcon("file-output", __iconNode$i);
13496
13496
 
13497
- const __iconNode$g = [
13497
+ const __iconNode$h = [
13498
13498
  [
13499
13499
  "path",
13500
13500
  {
@@ -13552,9 +13552,9 @@ const __iconNode$g = [
13552
13552
  }
13553
13553
  ]
13554
13554
  ];
13555
- const FoldVertical = createLucideIcon("fold-vertical", __iconNode$g);
13555
+ const FoldVertical = createLucideIcon("fold-vertical", __iconNode$h);
13556
13556
 
13557
- const __iconNode$f = [
13557
+ const __iconNode$g = [
13558
13558
  [
13559
13559
  "line",
13560
13560
  {
@@ -13596,9 +13596,9 @@ const __iconNode$f = [
13596
13596
  }
13597
13597
  ]
13598
13598
  ];
13599
- const Hash = createLucideIcon("hash", __iconNode$f);
13599
+ const Hash = createLucideIcon("hash", __iconNode$g);
13600
13600
 
13601
- const __iconNode$e = [
13601
+ const __iconNode$f = [
13602
13602
  [
13603
13603
  "circle",
13604
13604
  {
@@ -13623,9 +13623,9 @@ const __iconNode$e = [
13623
13623
  }
13624
13624
  ]
13625
13625
  ];
13626
- const Info = createLucideIcon("info", __iconNode$e);
13626
+ const Info = createLucideIcon("info", __iconNode$f);
13627
13627
 
13628
- const __iconNode$d = [
13628
+ const __iconNode$e = [
13629
13629
  [
13630
13630
  "path",
13631
13631
  {
@@ -13662,7 +13662,39 @@ const __iconNode$d = [
13662
13662
  }
13663
13663
  ]
13664
13664
  ];
13665
- const ListChecks = createLucideIcon("list-checks", __iconNode$d);
13665
+ const ListChecks = createLucideIcon("list-checks", __iconNode$e);
13666
+
13667
+ const __iconNode$d = [
13668
+ [
13669
+ "path",
13670
+ {
13671
+ 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",
13672
+ key: "18887p"
13673
+ }
13674
+ ],
13675
+ [
13676
+ "path",
13677
+ {
13678
+ d: "M7 11h10",
13679
+ key: "1twpyw"
13680
+ }
13681
+ ],
13682
+ [
13683
+ "path",
13684
+ {
13685
+ d: "M7 15h6",
13686
+ key: "d9of3u"
13687
+ }
13688
+ ],
13689
+ [
13690
+ "path",
13691
+ {
13692
+ d: "M7 7h8",
13693
+ key: "af5zfr"
13694
+ }
13695
+ ]
13696
+ ];
13697
+ const MessageSquareText = createLucideIcon("message-square-text", __iconNode$d);
13666
13698
 
13667
13699
  const __iconNode$c = [
13668
13700
  [
@@ -116825,6 +116857,401 @@ function buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCount
116825
116857
  return buildTreeFromProcessedData(latencyByTool, failureRateByTool, usageCountByTool, latencyResults, failureResults, agentIdToSessionId);
116826
116858
  }
116827
116859
 
116860
+ const JUDGE_RESULT_PREFIX = "JudgeResult/";
116861
+ const JUDGE_REASONING_PREFIX = "JudgeReasoning/";
116862
+ /** Map agent node id -> session id from the agents array (new format only). */ function buildSessionByNodeId(agents) {
116863
+ const map = new Map();
116864
+ for (const agent of agents ?? []){
116865
+ for (const entry of agent.agent_node_ids ?? []){
116866
+ if (entry && typeof entry === "object" && "agent_node_id" in entry) {
116867
+ map.set(entry.agent_node_id, entry.session_id);
116868
+ }
116869
+ }
116870
+ }
116871
+ return map;
116872
+ }
116873
+ /** Map `${nodeId}::${metricName}` -> reasoning text from JudgeReasoning/* results. */ function buildReasoningByKey(rawResults) {
116874
+ const map = new Map();
116875
+ for (const item of rawResults){
116876
+ if (!isBaseResult(item)) continue;
116877
+ if (!item.result_name?.startsWith(JUDGE_REASONING_PREFIX)) continue;
116878
+ const metricName = item.result_name.slice(JUDGE_REASONING_PREFIX.length);
116879
+ const nodeId = item.agent_data_id?.[0];
116880
+ if (nodeId && typeof item.value === "string") {
116881
+ map.set(`${nodeId}::${metricName}`, item.value);
116882
+ }
116883
+ }
116884
+ return map;
116885
+ }
116886
+ function metricNameOf(agg) {
116887
+ return agg.metric?.name ?? agg.name?.replace(/^Aggregate\//, "") ?? "Unknown";
116888
+ }
116889
+ /** Collect the JudgeResult leaf nodes (label + node id) grouped by label. */ function groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey) {
116890
+ const byLabel = new Map();
116891
+ const seen = new Set();
116892
+ const push = (label, nodeId)=>{
116893
+ const dedupeKey = `${label}::${nodeId}`;
116894
+ if (seen.has(dedupeKey)) return;
116895
+ seen.add(dedupeKey);
116896
+ const ref = {
116897
+ nodeId,
116898
+ sessionId: sessionByNodeId.get(nodeId),
116899
+ reasoning: reasoningByKey.get(`${nodeId}::${metricName}`)
116900
+ };
116901
+ const existing = byLabel.get(label);
116902
+ if (existing) existing.push(ref);
116903
+ else byLabel.set(label, [
116904
+ ref
116905
+ ]);
116906
+ };
116907
+ // Preferred: walk the aggregate's children leaf nodes.
116908
+ for (const childId of agg.children ?? []){
116909
+ const child = nodes[childId];
116910
+ if (child && isBaseResult(child)) {
116911
+ const nodeId = child.agent_data_id?.[0];
116912
+ if (nodeId) push(String(child.value), nodeId);
116913
+ }
116914
+ }
116915
+ // Fallback: derive from raw JudgeResult/<metric> results when no children are present.
116916
+ if (byLabel.size === 0) {
116917
+ const resultName = `${JUDGE_RESULT_PREFIX}${metricName}`;
116918
+ for (const item of rawResults){
116919
+ if (isBaseResult(item) && item.result_name === resultName) {
116920
+ const nodeId = item.agent_data_id?.[0];
116921
+ if (nodeId) push(String(item.value), nodeId);
116922
+ }
116923
+ }
116924
+ }
116925
+ return byLabel;
116926
+ }
116927
+ /** Build the Judge view model: one entry per categorical metric. */ function buildJudgeMetricsFromAggregate(input) {
116928
+ const { roots, nodes, agents, rawResults = [] } = input;
116929
+ const sessionByNodeId = buildSessionByNodeId(agents);
116930
+ const reasoningByKey = buildReasoningByKey(rawResults);
116931
+ // Prefer roots; fall back to scanning all nodes for categorical aggregates.
116932
+ const rootAggregates = roots.map((id)=>nodes[id]).filter((n)=>isAggregateCategorical(n));
116933
+ const aggregates = rootAggregates.length > 0 ? rootAggregates : Object.values(nodes).filter((n)=>isAggregateCategorical(n));
116934
+ return aggregates.map((agg, index)=>{
116935
+ const metricName = metricNameOf(agg);
116936
+ const counts = agg.counts ?? {};
116937
+ const categories = agg.categories ?? agg.metric?.categories ?? Object.keys(counts);
116938
+ const byLabel = groupNodesByLabel(agg, nodes, rawResults, metricName, sessionByNodeId, reasoningByKey);
116939
+ // Order labels by the metric's category order, then any extras found in the data.
116940
+ const orderedLabels = [
116941
+ ...categories
116942
+ ];
116943
+ for (const label of byLabel.keys()){
116944
+ if (!orderedLabels.includes(label)) orderedLabels.push(label);
116945
+ }
116946
+ const labels = orderedLabels.map((labelName)=>{
116947
+ const nodesForLabel = byLabel.get(labelName) ?? [];
116948
+ return {
116949
+ labelName,
116950
+ count: counts[labelName] ?? nodesForLabel.length,
116951
+ nodes: nodesForLabel
116952
+ };
116953
+ });
116954
+ const total = labels.reduce((sum, l)=>sum + l.count, 0);
116955
+ return {
116956
+ key: agg.identifier ?? `${metricName}-${index}`,
116957
+ metricName,
116958
+ description: agg.metric?.description ?? undefined,
116959
+ mostCommon: agg.most_common_label ?? undefined,
116960
+ leastCommon: agg.least_common_label ?? undefined,
116961
+ total,
116962
+ labels
116963
+ };
116964
+ });
116965
+ }
116966
+
116967
+ const SHORT_ID_LENGTH = 8;
116968
+ const shortenId = (id)=>id.length > SHORT_ID_LENGTH ? id.slice(0, SHORT_ID_LENGTH) : id;
116969
+ const NodeRow = ({ node, metricName, onAgentNodeClick })=>{
116970
+ const { theme } = useTheme$1();
116971
+ const [showReasoning, setShowReasoning] = React.useState(false);
116972
+ const clickable = !!onAgentNodeClick;
116973
+ const open = ()=>onAgentNodeClick?.(node.sessionId, node.nodeId);
116974
+ return /*#__PURE__*/ React.createElement("div", {
116975
+ style: {
116976
+ display: "flex",
116977
+ flexDirection: "column",
116978
+ gap: 8
116979
+ }
116980
+ }, /*#__PURE__*/ React.createElement("div", {
116981
+ style: {
116982
+ display: "flex",
116983
+ alignItems: "center",
116984
+ gap: 10,
116985
+ flexWrap: "wrap"
116986
+ }
116987
+ }, /*#__PURE__*/ React.createElement(Tooltip, {
116988
+ title: clickable ? `Inspect run · ${node.nodeId}` : node.nodeId
116989
+ }, /*#__PURE__*/ React.createElement("span", {
116990
+ role: clickable ? "button" : undefined,
116991
+ tabIndex: clickable ? 0 : undefined,
116992
+ onClick: clickable ? open : undefined,
116993
+ onKeyDown: clickable ? (e)=>{
116994
+ if (e.key === "Enter" || e.key === " ") {
116995
+ e.preventDefault();
116996
+ open();
116997
+ }
116998
+ } : undefined,
116999
+ style: {
117000
+ display: "inline-flex",
117001
+ alignItems: "center",
117002
+ gap: 6,
117003
+ padding: "3px 10px",
117004
+ borderRadius: 6,
117005
+ fontFamily: "monospace",
117006
+ fontSize: 12,
117007
+ fontWeight: 500,
117008
+ background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
117009
+ color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
117010
+ border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`,
117011
+ cursor: clickable ? "pointer" : "default"
117012
+ }
117013
+ }, /*#__PURE__*/ React.createElement(Bot, {
117014
+ size: 13,
117015
+ style: {
117016
+ flexShrink: 0
117017
+ }
117018
+ }), shortenId(node.nodeId))), node.reasoning && /*#__PURE__*/ React.createElement("button", {
117019
+ type: "button",
117020
+ onClick: ()=>setShowReasoning((s)=>!s),
117021
+ style: {
117022
+ display: "inline-flex",
117023
+ alignItems: "center",
117024
+ gap: 5,
117025
+ padding: "3px 9px",
117026
+ borderRadius: 6,
117027
+ fontSize: 12,
117028
+ cursor: "pointer",
117029
+ background: "transparent",
117030
+ color: theme.colors.primary,
117031
+ border: `1px solid ${theme.colors.primary}`
117032
+ }
117033
+ }, /*#__PURE__*/ React.createElement(MessageSquareText, {
117034
+ size: 12
117035
+ }), showReasoning ? "Hide reasoning" : "Show reasoning")), node.reasoning && showReasoning && /*#__PURE__*/ React.createElement("div", {
117036
+ style: {
117037
+ padding: "10px 14px",
117038
+ background: theme.colors.muted,
117039
+ border: `1px solid ${theme.colors.border}`,
117040
+ borderRadius: 6,
117041
+ fontSize: 13,
117042
+ lineHeight: 1.5,
117043
+ whiteSpace: "pre-wrap",
117044
+ color: theme.colors.foreground
117045
+ }
117046
+ }, /*#__PURE__*/ React.createElement("div", {
117047
+ style: {
117048
+ fontWeight: 600,
117049
+ marginBottom: 6,
117050
+ color: theme.colors.mutedForeground
117051
+ }
117052
+ }, "Judge reasoning · ", metricName), node.reasoning));
117053
+ };
117054
+ const LabelPanelHeader = ({ label })=>{
117055
+ const { theme } = useTheme$1();
117056
+ const isEmpty = label.count === 0;
117057
+ return /*#__PURE__*/ React.createElement("div", {
117058
+ style: {
117059
+ display: "flex",
117060
+ alignItems: "center",
117061
+ gap: 10
117062
+ }
117063
+ }, /*#__PURE__*/ React.createElement("span", {
117064
+ style: {
117065
+ width: 7,
117066
+ height: 7,
117067
+ borderRadius: "50%",
117068
+ flexShrink: 0,
117069
+ background: isEmpty ? theme.colors.border : theme.colors.primary
117070
+ }
117071
+ }), /*#__PURE__*/ React.createElement("span", {
117072
+ style: {
117073
+ fontSize: 13,
117074
+ fontWeight: 600,
117075
+ color: isEmpty ? theme.colors.mutedForeground : undefined
117076
+ }
117077
+ }, label.labelName), /*#__PURE__*/ React.createElement("span", {
117078
+ style: {
117079
+ marginLeft: "auto",
117080
+ fontSize: 12,
117081
+ color: theme.colors.mutedForeground
117082
+ }
117083
+ }, label.count, " ", label.count === 1 ? "node" : "nodes"));
117084
+ };
117085
+ const MetricCard = ({ metric, onAgentNodeClick })=>{
117086
+ const { theme } = useTheme$1();
117087
+ const items = metric.labels.map((label)=>({
117088
+ key: label.labelName,
117089
+ label: /*#__PURE__*/ React.createElement(LabelPanelHeader, {
117090
+ label: label
117091
+ }),
117092
+ collapsible: label.count === 0 ? "disabled" : undefined,
117093
+ children: label.nodes.length === 0 ? /*#__PURE__*/ React.createElement("span", {
117094
+ style: {
117095
+ fontSize: 12,
117096
+ fontStyle: "italic",
117097
+ color: theme.colors.mutedForeground
117098
+ }
117099
+ }, "No evaluations") : /*#__PURE__*/ React.createElement("div", {
117100
+ style: {
117101
+ display: "flex",
117102
+ flexDirection: "column",
117103
+ gap: 12
117104
+ }
117105
+ }, label.nodes.map((node)=>/*#__PURE__*/ React.createElement(NodeRow, {
117106
+ key: node.nodeId,
117107
+ node: node,
117108
+ metricName: metric.metricName,
117109
+ onAgentNodeClick: onAgentNodeClick
117110
+ })))
117111
+ }));
117112
+ return /*#__PURE__*/ React.createElement("div", {
117113
+ style: {
117114
+ background: theme.colors.card,
117115
+ border: `1px solid ${theme.colors.border}`,
117116
+ borderRadius: 8,
117117
+ overflow: "hidden"
117118
+ }
117119
+ }, /*#__PURE__*/ React.createElement("div", {
117120
+ style: {
117121
+ padding: "14px 18px",
117122
+ borderBottom: `1px solid ${theme.colors.border}`,
117123
+ background: theme.colors.secondary
117124
+ }
117125
+ }, /*#__PURE__*/ React.createElement("div", {
117126
+ style: {
117127
+ display: "flex",
117128
+ alignItems: "center",
117129
+ gap: 12,
117130
+ flexWrap: "wrap"
117131
+ }
117132
+ }, /*#__PURE__*/ React.createElement(Scale, {
117133
+ size: 16,
117134
+ style: {
117135
+ color: theme.colors.primary,
117136
+ flexShrink: 0
117137
+ }
117138
+ }), /*#__PURE__*/ React.createElement("span", {
117139
+ style: {
117140
+ fontSize: 15,
117141
+ fontWeight: 600
117142
+ }
117143
+ }, metric.metricName), /*#__PURE__*/ React.createElement("div", {
117144
+ style: {
117145
+ display: "flex",
117146
+ flexWrap: "wrap",
117147
+ gap: 6,
117148
+ marginLeft: 4
117149
+ }
117150
+ }, metric.labels.map((label)=>/*#__PURE__*/ React.createElement(Tag, {
117151
+ key: label.labelName,
117152
+ style: {
117153
+ margin: 0,
117154
+ borderRadius: 12,
117155
+ fontSize: 12,
117156
+ ...label.count > 0 ? {
117157
+ background: theme.colors.tagLlminference?.bg ?? theme.colors.muted,
117158
+ color: theme.colors.tagLlminference?.color ?? theme.colors.foreground,
117159
+ border: `1px solid ${theme.colors.tagLlminference?.border ?? theme.colors.border}`
117160
+ } : {
117161
+ background: "transparent",
117162
+ color: theme.colors.mutedForeground,
117163
+ border: `1px solid ${theme.colors.border}`
117164
+ }
117165
+ }
117166
+ }, label.labelName, " ", /*#__PURE__*/ React.createElement("strong", null, label.count)))), /*#__PURE__*/ React.createElement("div", {
117167
+ style: {
117168
+ display: "flex",
117169
+ gap: 20,
117170
+ marginLeft: "auto",
117171
+ flexShrink: 0
117172
+ }
117173
+ }, /*#__PURE__*/ React.createElement(Meta, {
117174
+ label: "Most common",
117175
+ value: metric.mostCommon
117176
+ }), /*#__PURE__*/ React.createElement(Meta, {
117177
+ label: "Least common",
117178
+ value: metric.leastCommon
117179
+ }), /*#__PURE__*/ React.createElement(Meta, {
117180
+ label: "Evaluations",
117181
+ value: String(metric.total)
117182
+ }))), metric.description && /*#__PURE__*/ React.createElement("div", {
117183
+ style: {
117184
+ marginTop: 6,
117185
+ fontSize: 12,
117186
+ color: theme.colors.mutedForeground
117187
+ }
117188
+ }, metric.description)), /*#__PURE__*/ React.createElement(Collapse, {
117189
+ items: items,
117190
+ bordered: false,
117191
+ style: {
117192
+ background: theme.colors.card
117193
+ }
117194
+ }));
117195
+ };
117196
+ const Meta = ({ label, value })=>{
117197
+ const { theme } = useTheme$1();
117198
+ return /*#__PURE__*/ React.createElement("span", {
117199
+ style: {
117200
+ display: "flex",
117201
+ flexDirection: "column",
117202
+ alignItems: "flex-end",
117203
+ gap: 1
117204
+ }
117205
+ }, /*#__PURE__*/ React.createElement("span", {
117206
+ style: {
117207
+ fontSize: 10,
117208
+ textTransform: "uppercase",
117209
+ letterSpacing: 0.4,
117210
+ color: theme.colors.mutedForeground
117211
+ }
117212
+ }, label), /*#__PURE__*/ React.createElement("span", {
117213
+ style: {
117214
+ fontSize: 13,
117215
+ fontWeight: 500
117216
+ }
117217
+ }, value ?? "—"));
117218
+ };
117219
+ const JudgeAggregateView = ({ metrics, onAgentNodeClick })=>{
117220
+ const { theme } = useTheme$1();
117221
+ if (!metrics.length) {
117222
+ return /*#__PURE__*/ React.createElement("div", {
117223
+ style: {
117224
+ padding: 24,
117225
+ textAlign: "center",
117226
+ color: theme.colors.mutedForeground,
117227
+ fontSize: 14
117228
+ }
117229
+ }, "No judge metrics available");
117230
+ }
117231
+ return /*#__PURE__*/ React.createElement("div", {
117232
+ style: {
117233
+ width: "100%",
117234
+ minWidth: 0
117235
+ }
117236
+ }, /*#__PURE__*/ React.createElement("h3", {
117237
+ style: {
117238
+ margin: "0 0 16px",
117239
+ fontSize: 16,
117240
+ fontWeight: 600
117241
+ }
117242
+ }, "Judge Evaluator - Aggregate View"), /*#__PURE__*/ React.createElement("div", {
117243
+ style: {
117244
+ display: "flex",
117245
+ flexDirection: "column",
117246
+ gap: 12
117247
+ }
117248
+ }, metrics.map((metric)=>/*#__PURE__*/ React.createElement(MetricCard, {
117249
+ key: metric.key,
117250
+ metric: metric,
117251
+ onAgentNodeClick: onAgentNodeClick
117252
+ }))));
117253
+ };
117254
+
116828
117255
  function detectAggregateType(nodes) {
116829
117256
  const values = Object.values(nodes);
116830
117257
  if (values.some((n)=>n?.type === "ToolAggregate")) return "ToolUse";
@@ -116845,22 +117272,6 @@ function buildLLMInferenceFlatRows(nodes) {
116845
117272
  count: agg.values?.length ?? 0
116846
117273
  }));
116847
117274
  }
116848
- function buildJudgeRows(nodes) {
116849
- const values = Object.values(nodes);
116850
- const aggregates = values.filter((n)=>isAggregateCategorical(n));
116851
- return aggregates.map((agg)=>{
116852
- const counts = agg.counts ?? {};
116853
- const total = Object.values(counts).reduce((a, b)=>a + b, 0);
116854
- return {
116855
- key: agg.identifier ?? agg.metric?.name ?? "unknown",
116856
- metric: agg.metric?.name ?? "Unknown",
116857
- mostCommon: agg.most_common_label ?? "-",
116858
- leastCommon: agg.least_common_label ?? "-",
116859
- counts,
116860
- total
116861
- };
116862
- });
116863
- }
116864
117275
  // --- Shared helpers ---
116865
117276
  function getAllExpandableKeys(rows) {
116866
117277
  const keys = [];
@@ -116932,7 +117343,12 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
116932
117343
  if (type === "Judge") {
116933
117344
  return {
116934
117345
  aggregateType: type,
116935
- dataSource: buildJudgeRows(aggregateResults.nodes),
117346
+ dataSource: buildJudgeMetricsFromAggregate({
117347
+ roots: aggregateResults.roots,
117348
+ nodes: aggregateResults.nodes,
117349
+ agents,
117350
+ rawResults
117351
+ }),
116936
117352
  llmIsTree: false,
116937
117353
  llmExpandableKeys: []
116938
117354
  };
@@ -117265,86 +117681,10 @@ const AggregateResultsTable = ({ rawResults = [], aggregateResults, agents, titl
117265
117681
  }));
117266
117682
  }
117267
117683
  if (aggregateType === "Judge") {
117268
- const rows = dataSource;
117269
- const columns = [
117270
- {
117271
- title: "METRIC",
117272
- dataIndex: "metric",
117273
- key: "metric",
117274
- render: (metric)=>/*#__PURE__*/ React.createElement("span", {
117275
- style: {
117276
- fontFamily: "monospace",
117277
- fontSize: 13
117278
- }
117279
- }, /*#__PURE__*/ React.createElement(Scale, {
117280
- size: 14,
117281
- style: {
117282
- marginRight: 8,
117283
- verticalAlign: "middle",
117284
- color: theme.colors.primary
117285
- }
117286
- }), metric)
117287
- },
117288
- {
117289
- title: "MOST COMMON",
117290
- dataIndex: "mostCommon",
117291
- key: "mostCommon",
117292
- render: (v)=>/*#__PURE__*/ React.createElement(Tag, {
117293
- style: {
117294
- background: theme.colors.success,
117295
- color: theme.colors.successForeground,
117296
- border: "none"
117297
- }
117298
- }, v)
117299
- },
117300
- {
117301
- title: "LEAST COMMON",
117302
- dataIndex: "leastCommon",
117303
- key: "leastCommon",
117304
- render: (v)=>/*#__PURE__*/ React.createElement("span", {
117305
- style: {
117306
- color: theme.colors.mutedForeground
117307
- }
117308
- }, v)
117309
- },
117310
- {
117311
- title: "DISTRIBUTION",
117312
- key: "distribution",
117313
- render: (_, row)=>{
117314
- const entries = Object.entries(row.counts).sort((a, b)=>b[1] - a[1]);
117315
- return /*#__PURE__*/ React.createElement("span", {
117316
- style: {
117317
- fontSize: 12,
117318
- color: theme.colors.mutedForeground
117319
- }
117320
- }, entries.map(([label, count])=>`${label}: ${count}`).join(" · "));
117321
- }
117322
- }
117323
- ];
117324
- return /*#__PURE__*/ React.createElement("div", {
117325
- style: {
117326
- width: "100%",
117327
- minWidth: 0,
117328
- overflow: "hidden"
117329
- }
117330
- }, /*#__PURE__*/ React.createElement("h3", {
117331
- style: {
117332
- margin: "0 0 16px",
117333
- fontSize: 16,
117334
- fontWeight: 600
117335
- }
117336
- }, resolvedTitle), /*#__PURE__*/ React.createElement(ForwardTable, {
117337
- dataSource: rows,
117338
- columns: columns,
117339
- rowKey: "key",
117340
- pagination: false,
117341
- size: "small",
117342
- style: {
117343
- width: "100%",
117344
- background: theme.colors.card,
117345
- border: `1px solid ${theme.colors.border}`
117346
- }
117347
- }));
117684
+ return /*#__PURE__*/ React.createElement(JudgeAggregateView, {
117685
+ metrics: dataSource,
117686
+ onAgentNodeClick: onAgentNodeClick
117687
+ });
117348
117688
  }
117349
117689
  // ToolUse (tree table)
117350
117690
  const toolRows = dataSource;
@@ -117897,7 +118237,7 @@ const EvaluatorResult = ({ evaluation, evaluatorId, backHref, onAgentNodeClick }
117897
118237
  minWidth: 0
117898
118238
  }
117899
118239
  }, /*#__PURE__*/ React.createElement(AggregateResultsTable, {
117900
- rawResults: rawResults.filter((r)=>isToolResult(r) || isToolAggregate(r)),
118240
+ rawResults: rawResults,
117901
118241
  aggregateResults: aggregateResults,
117902
118242
  agents: evaluation.agents,
117903
118243
  evaluatorName: evaluatorName,