@railtownai/railtracks-visualizer 0.0.50 → 0.0.51

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
@@ -12902,7 +12902,25 @@ const createLucideIcon = (iconName, iconNode)=>{
12902
12902
  return Component;
12903
12903
  };
12904
12904
 
12905
- const __iconNode$i = [
12905
+ const __iconNode$m = [
12906
+ [
12907
+ "path",
12908
+ {
12909
+ d: "m12 19-7-7 7-7",
12910
+ key: "1l729n"
12911
+ }
12912
+ ],
12913
+ [
12914
+ "path",
12915
+ {
12916
+ d: "M19 12H5",
12917
+ key: "x3x0zl"
12918
+ }
12919
+ ]
12920
+ ];
12921
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$m);
12922
+
12923
+ const __iconNode$l = [
12906
12924
  [
12907
12925
  "path",
12908
12926
  {
@@ -12918,9 +12936,9 @@ const __iconNode$i = [
12918
12936
  }
12919
12937
  ]
12920
12938
  ];
12921
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$i);
12939
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$l);
12922
12940
 
12923
- const __iconNode$h = [
12941
+ const __iconNode$k = [
12924
12942
  [
12925
12943
  "path",
12926
12944
  {
@@ -12968,9 +12986,9 @@ const __iconNode$h = [
12968
12986
  }
12969
12987
  ]
12970
12988
  ];
12971
- const Bot = createLucideIcon("bot", __iconNode$h);
12989
+ const Bot = createLucideIcon("bot", __iconNode$k);
12972
12990
 
12973
- const __iconNode$g = [
12991
+ const __iconNode$j = [
12974
12992
  [
12975
12993
  "path",
12976
12994
  {
@@ -13004,9 +13022,9 @@ const __iconNode$g = [
13004
13022
  }
13005
13023
  ]
13006
13024
  ];
13007
- const Calendar = createLucideIcon("calendar", __iconNode$g);
13025
+ const Calendar = createLucideIcon("calendar", __iconNode$j);
13008
13026
 
13009
- const __iconNode$f = [
13027
+ const __iconNode$i = [
13010
13028
  [
13011
13029
  "path",
13012
13030
  {
@@ -13063,9 +13081,9 @@ const __iconNode$f = [
13063
13081
  }
13064
13082
  ]
13065
13083
  ];
13066
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$f);
13084
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$i);
13067
13085
 
13068
- const __iconNode$e = [
13086
+ const __iconNode$h = [
13069
13087
  [
13070
13088
  "path",
13071
13089
  {
@@ -13074,9 +13092,9 @@ const __iconNode$e = [
13074
13092
  }
13075
13093
  ]
13076
13094
  ];
13077
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$e);
13095
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$h);
13078
13096
 
13079
- const __iconNode$d = [
13097
+ const __iconNode$g = [
13080
13098
  [
13081
13099
  "path",
13082
13100
  {
@@ -13085,7 +13103,61 @@ const __iconNode$d = [
13085
13103
  }
13086
13104
  ]
13087
13105
  ];
13088
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$d);
13106
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$g);
13107
+
13108
+ const __iconNode$f = [
13109
+ [
13110
+ "path",
13111
+ {
13112
+ d: "m7 6 5 5 5-5",
13113
+ key: "1lc07p"
13114
+ }
13115
+ ],
13116
+ [
13117
+ "path",
13118
+ {
13119
+ d: "m7 13 5 5 5-5",
13120
+ key: "1d48rs"
13121
+ }
13122
+ ]
13123
+ ];
13124
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$f);
13125
+
13126
+ const __iconNode$e = [
13127
+ [
13128
+ "path",
13129
+ {
13130
+ d: "m17 11-5-5-5 5",
13131
+ key: "e8nh98"
13132
+ }
13133
+ ],
13134
+ [
13135
+ "path",
13136
+ {
13137
+ d: "m17 18-5-5-5 5",
13138
+ key: "2avn1x"
13139
+ }
13140
+ ]
13141
+ ];
13142
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$e);
13143
+
13144
+ const __iconNode$d = [
13145
+ [
13146
+ "path",
13147
+ {
13148
+ d: "M21.801 10A10 10 0 1 1 17 3.335",
13149
+ key: "yps3ct"
13150
+ }
13151
+ ],
13152
+ [
13153
+ "path",
13154
+ {
13155
+ d: "m9 11 3 3L22 4",
13156
+ key: "1pflzl"
13157
+ }
13158
+ ]
13159
+ ];
13160
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$d);
13089
13161
 
13090
13162
  const __iconNode$c = [
13091
13163
  [
@@ -114375,6 +114447,490 @@ const EvaluationsTable = ({ evaluations, loading = false, error = null, onRefres
114375
114447
  }));
114376
114448
  };
114377
114449
 
114450
+ function buildTreeFromRawResults(rawResults) {
114451
+ const toolResults = rawResults.filter((r)=>isToolResult(r));
114452
+ const toolAggregates = rawResults.filter((r)=>isToolAggregate(r));
114453
+ const latencyByTool = new Map();
114454
+ const failureRateByTool = new Map();
114455
+ const usageCountByTool = new Map();
114456
+ for (const agg of toolAggregates){
114457
+ const name = agg.metric.name;
114458
+ const tool = agg.tool_name;
114459
+ if (name === "Latency") {
114460
+ latencyByTool.set(tool, {
114461
+ mean: agg.mean,
114462
+ count: agg.values.length
114463
+ });
114464
+ } else if (name === "FailureRate") {
114465
+ failureRateByTool.set(tool, agg.mean * 100);
114466
+ } else if (name === "UsageCount") {
114467
+ usageCountByTool.set(tool, agg.values.reduce((a, b)=>a + b, 0));
114468
+ }
114469
+ }
114470
+ const latencyResults = toolResults.filter((r)=>r.result_name.startsWith("Latency/"));
114471
+ const failureResults = toolResults.filter((r)=>r.result_name.startsWith("FailureRate/"));
114472
+ const toolNamesFromAgg = Array.from(new Set([
114473
+ ...latencyByTool.keys(),
114474
+ ...failureRateByTool.keys(),
114475
+ ...usageCountByTool.keys()
114476
+ ]));
114477
+ const toolNamesFromResults = Array.from(new Set(latencyResults.map((r)=>r.tool_name)));
114478
+ const allToolNames = Array.from(new Set([
114479
+ ...toolNamesFromAgg,
114480
+ ...toolNamesFromResults
114481
+ ])).sort();
114482
+ // Exclude sub-agent tools (e.g. WebSearchAgent) - they invoke agents, not primitives
114483
+ const toolNames = allToolNames.filter((name)=>!name.endsWith("Agent"));
114484
+ if (toolNames.length === 0) {
114485
+ return [];
114486
+ }
114487
+ const agentKey = (agentDataId)=>agentDataId?.[0] ?? "unknown";
114488
+ const failureByKey = new Map();
114489
+ for (const r of failureResults){
114490
+ const k = r.tool_node_id ? `${r.tool_name}|${agentKey(r.agent_data_id)}|${r.tool_node_id}` : `${r.tool_name}|${agentKey(r.agent_data_id)}|${r.result_name}`;
114491
+ failureByKey.set(k, r.value);
114492
+ }
114493
+ const failureByToolAgentIndex = new Map();
114494
+ for (const r of failureResults){
114495
+ const k = `${r.tool_name}|${agentKey(r.agent_data_id)}`;
114496
+ if (!failureByToolAgentIndex.has(k)) failureByToolAgentIndex.set(k, []);
114497
+ failureByToolAgentIndex.get(k).push(r.value);
114498
+ }
114499
+ const rows = [];
114500
+ for(let ti = 0; ti < toolNames.length; ti++){
114501
+ const toolName = toolNames[ti];
114502
+ const latency = latencyByTool.get(toolName);
114503
+ const failurePct = failureRateByTool.get(toolName);
114504
+ const invocations = usageCountByTool.get(toolName) ?? latency?.count ?? 0;
114505
+ const runtimeMs = latency ? Math.round(latency.mean * 1000) : undefined;
114506
+ const failureRateStr = failurePct !== undefined ? `${failurePct.toFixed(1)}%` : undefined;
114507
+ const agentGroups = new Map();
114508
+ for (const r of latencyResults){
114509
+ if (r.tool_name !== toolName) continue;
114510
+ const aid = agentKey(r.agent_data_id);
114511
+ const rowKey = r.tool_node_id ? `${toolName}|${aid}|${r.tool_node_id}` : `${toolName}|${aid}|${r.result_name}`;
114512
+ if (!agentGroups.has(aid)) {
114513
+ agentGroups.set(aid, {
114514
+ agentId: aid,
114515
+ latencies: []
114516
+ });
114517
+ }
114518
+ agentGroups.get(aid).latencies.push({
114519
+ value: r.value,
114520
+ key: rowKey,
114521
+ toolNodeId: r.tool_node_id
114522
+ });
114523
+ }
114524
+ const children = [];
114525
+ for (const [aid, group] of agentGroups){
114526
+ const totalRuntimeMs = group.latencies.reduce((s, l)=>s + l.value * 1000, 0);
114527
+ const cnt = group.latencies.length;
114528
+ let failed = 0;
114529
+ const failList = failureByToolAgentIndex.get(`${toolName}|${aid}`) ?? [];
114530
+ const leaves = group.latencies.map((l, idx)=>{
114531
+ const failVal = failureByKey.get(l.key);
114532
+ const failValByIndex = failList[idx];
114533
+ const resolvedFail = failVal ?? (failValByIndex !== undefined ? failValByIndex : undefined);
114534
+ const isFailed = resolvedFail !== undefined && resolvedFail >= 0.5;
114535
+ if (isFailed) failed++;
114536
+ const leafName = l.toolNodeId ?? `invocation-${idx + 1}`;
114537
+ return {
114538
+ key: `${toolName}-${aid}-${idx}`,
114539
+ name: leafName,
114540
+ runtimeMs: Math.round(l.value * 1000),
114541
+ failureRate: isFailed ? "Failed" : "Success",
114542
+ level: 3,
114543
+ children: undefined
114544
+ };
114545
+ });
114546
+ const agentFailurePct = cnt > 0 ? (failed / cnt * 100).toFixed(1) + "%" : undefined;
114547
+ children.push({
114548
+ key: `${toolName}-${aid}`,
114549
+ name: aid,
114550
+ invocations: cnt,
114551
+ runtimeMs: Math.round(totalRuntimeMs),
114552
+ failureRate: agentFailurePct,
114553
+ level: 2,
114554
+ children: leaves.length > 0 ? leaves : undefined
114555
+ });
114556
+ }
114557
+ rows.push({
114558
+ key: toolName,
114559
+ name: toolName,
114560
+ invocations,
114561
+ runtimeMs,
114562
+ failureRate: failureRateStr,
114563
+ level: 1,
114564
+ children: children.length > 0 ? children : undefined
114565
+ });
114566
+ }
114567
+ return rows;
114568
+ }
114569
+ function getAllExpandableKeys(rows) {
114570
+ const keys = [];
114571
+ for (const row of rows){
114572
+ if (row.children?.length) {
114573
+ keys.push(row.key);
114574
+ keys.push(...getAllExpandableKeys(row.children));
114575
+ }
114576
+ }
114577
+ return keys;
114578
+ }
114579
+ const ToolUseEvaluatorMetricsTable = ({ rawResults, title = "Tool Use Evaluator - Aggregate View" })=>{
114580
+ const { theme } = useTheme$1();
114581
+ const [expandedRowKeys, setExpandedRowKeys] = React.useState([]);
114582
+ const dataSource = React.useMemo(()=>buildTreeFromRawResults(rawResults), [
114583
+ rawResults
114584
+ ]);
114585
+ const expandableKeys = React.useMemo(()=>getAllExpandableKeys(dataSource), [
114586
+ dataSource
114587
+ ]);
114588
+ const allExpanded = expandableKeys.length > 0 && expandedRowKeys.length === expandableKeys.length;
114589
+ const handleToggleExpandAll = React.useCallback(()=>{
114590
+ setExpandedRowKeys(allExpanded ? [] : expandableKeys);
114591
+ }, [
114592
+ allExpanded,
114593
+ expandableKeys
114594
+ ]);
114595
+ const toolIconColor = theme.colors.tagTooluse?.color ?? theme.colors.primary;
114596
+ const agentIconColor = theme.colors.tagLlminference?.color ?? "#6b21a8";
114597
+ const IconForLevel = ({ level })=>level === 2 ? /*#__PURE__*/ React.createElement(Bot, {
114598
+ size: 14,
114599
+ style: {
114600
+ marginRight: 8,
114601
+ verticalAlign: "middle",
114602
+ flexShrink: 0,
114603
+ color: agentIconColor
114604
+ }
114605
+ }) : /*#__PURE__*/ React.createElement(Wrench, {
114606
+ size: 14,
114607
+ style: {
114608
+ marginRight: 8,
114609
+ verticalAlign: "middle",
114610
+ flexShrink: 0,
114611
+ color: toolIconColor
114612
+ }
114613
+ });
114614
+ const columns = [
114615
+ {
114616
+ title: "NAME",
114617
+ dataIndex: "name",
114618
+ key: "name",
114619
+ render: (name, row)=>/*#__PURE__*/ React.createElement("span", {
114620
+ style: {
114621
+ display: "inline-flex",
114622
+ alignItems: "center",
114623
+ fontFamily: "monospace",
114624
+ fontSize: 13
114625
+ }
114626
+ }, /*#__PURE__*/ React.createElement(IconForLevel, {
114627
+ level: row.level
114628
+ }), name)
114629
+ },
114630
+ {
114631
+ title: "INVOCATIONS",
114632
+ dataIndex: "invocations",
114633
+ key: "invocations",
114634
+ align: "right",
114635
+ width: 120,
114636
+ render: (v, row)=>row.level === 3 ? null : v ?? "-"
114637
+ },
114638
+ {
114639
+ title: "RUNTIME (MS)",
114640
+ dataIndex: "runtimeMs",
114641
+ key: "runtimeMs",
114642
+ align: "right",
114643
+ width: 120,
114644
+ render: (v)=>v !== undefined ? `${v}ms` : "-"
114645
+ },
114646
+ {
114647
+ title: "FAILURE RATE",
114648
+ dataIndex: "failureRate",
114649
+ key: "failureRate",
114650
+ align: "right",
114651
+ width: 130,
114652
+ render: (v, row)=>{
114653
+ if (v === undefined) return "-";
114654
+ if (v === "Failed") {
114655
+ return /*#__PURE__*/ React.createElement("span", {
114656
+ style: {
114657
+ color: theme.colors.destructive,
114658
+ fontWeight: 500
114659
+ }
114660
+ }, "Failed");
114661
+ }
114662
+ if (v === "Success") {
114663
+ return /*#__PURE__*/ React.createElement(Tag, {
114664
+ style: {
114665
+ margin: 0,
114666
+ display: "inline-flex",
114667
+ alignItems: "center",
114668
+ gap: 6,
114669
+ background: theme.colors.success,
114670
+ borderColor: theme.colors.success,
114671
+ color: theme.colors.successForeground
114672
+ }
114673
+ }, /*#__PURE__*/ React.createElement(CircleCheckBig, {
114674
+ size: 14
114675
+ }), "Success");
114676
+ }
114677
+ return /*#__PURE__*/ React.createElement("span", null, v);
114678
+ }
114679
+ }
114680
+ ];
114681
+ const handleRowClick = React.useCallback((record)=>(e)=>{
114682
+ if (!record.children?.length) return;
114683
+ if (e.target.closest(".ant-table-row-expand-icon")) return;
114684
+ setExpandedRowKeys((prev)=>prev.includes(record.key) ? prev.filter((k)=>k !== record.key) : [
114685
+ ...prev,
114686
+ record.key
114687
+ ]);
114688
+ }, []);
114689
+ if (dataSource.length === 0) {
114690
+ return /*#__PURE__*/ React.createElement("div", {
114691
+ style: {
114692
+ padding: 24,
114693
+ textAlign: "center",
114694
+ color: theme.colors.mutedForeground,
114695
+ fontSize: 14
114696
+ }
114697
+ }, "No tool use metrics available");
114698
+ }
114699
+ return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("div", {
114700
+ style: {
114701
+ display: "flex",
114702
+ alignItems: "center",
114703
+ justifyContent: "space-between",
114704
+ marginBottom: 16
114705
+ }
114706
+ }, /*#__PURE__*/ React.createElement("h3", {
114707
+ style: {
114708
+ margin: 0,
114709
+ fontSize: 16,
114710
+ fontWeight: 600
114711
+ }
114712
+ }, title), /*#__PURE__*/ React.createElement(Tooltip, {
114713
+ title: expandableKeys.length === 0 ? "No expandable rows" : allExpanded ? "Collapse all" : "Expand all"
114714
+ }, /*#__PURE__*/ React.createElement(Button$1, {
114715
+ type: "text",
114716
+ size: "small",
114717
+ icon: allExpanded ? /*#__PURE__*/ React.createElement(ChevronsUp, {
114718
+ size: 16
114719
+ }) : /*#__PURE__*/ React.createElement(ChevronsDown, {
114720
+ size: 16
114721
+ }),
114722
+ onClick: handleToggleExpandAll,
114723
+ disabled: expandableKeys.length === 0,
114724
+ style: {
114725
+ display: "flex",
114726
+ alignItems: "center"
114727
+ },
114728
+ "data-testid": "expand-collapse-all"
114729
+ }))), /*#__PURE__*/ React.createElement(ForwardTable, {
114730
+ dataSource: dataSource,
114731
+ columns: columns,
114732
+ rowKey: "key",
114733
+ pagination: false,
114734
+ size: "small",
114735
+ expandable: {
114736
+ expandedRowKeys,
114737
+ onExpandedRowsChange: (keys)=>setExpandedRowKeys([
114738
+ ...keys
114739
+ ]),
114740
+ rowExpandable: (record)=>!!record.children && record.children.length > 0
114741
+ },
114742
+ onRow: (record)=>({
114743
+ onClick: (e)=>handleRowClick(record)(e),
114744
+ style: {
114745
+ cursor: record.children?.length ? "pointer" : undefined
114746
+ }
114747
+ }),
114748
+ style: {
114749
+ background: theme.colors.card,
114750
+ border: `1px solid ${theme.colors.border}`
114751
+ }
114752
+ }));
114753
+ };
114754
+
114755
+ /**
114756
+ * Full-page component that renders a single evaluator's result.
114757
+ * Exportable and reusable: pass Evaluation and evaluatorId from any React app.
114758
+ */ const EvaluatorResult = ({ evaluation, evaluatorId, backHref })=>{
114759
+ const { theme } = useTheme$1();
114760
+ const labelColor = theme.colors.mutedForeground;
114761
+ const evaluator = evaluation?.evaluators.find((e)=>e.evaluator_id === evaluatorId);
114762
+ const results = evaluation?.results[evaluatorId] ?? {};
114763
+ if (!evaluation || !evaluator) {
114764
+ return /*#__PURE__*/ React.createElement("div", {
114765
+ style: {
114766
+ display: "flex",
114767
+ alignItems: "center",
114768
+ justifyContent: "center",
114769
+ minHeight: "400px",
114770
+ color: labelColor
114771
+ }
114772
+ }, /*#__PURE__*/ React.createElement("p", null, "No evaluator result data available"));
114773
+ }
114774
+ const { agent_name, completed_at, runs } = evaluation;
114775
+ const runsCount = runs?.length ?? 0;
114776
+ return /*#__PURE__*/ React.createElement("div", {
114777
+ style: {
114778
+ padding: "24px",
114779
+ width: "100%",
114780
+ minWidth: 0
114781
+ }
114782
+ }, backHref && /*#__PURE__*/ React.createElement("a", {
114783
+ href: backHref,
114784
+ style: {
114785
+ display: "inline-flex",
114786
+ alignItems: "center",
114787
+ gap: 6,
114788
+ marginBottom: 24,
114789
+ color: theme.colors.primary,
114790
+ textDecoration: "none",
114791
+ fontSize: 14
114792
+ }
114793
+ }, /*#__PURE__*/ React.createElement(ArrowLeft, {
114794
+ size: 16
114795
+ }), "Back to Evaluations"), /*#__PURE__*/ React.createElement(Card, {
114796
+ style: {
114797
+ marginBottom: 24,
114798
+ background: theme.colors.secondary,
114799
+ border: `1px solid ${theme.colors.border}`
114800
+ }
114801
+ }, /*#__PURE__*/ React.createElement(Row$1, {
114802
+ gutter: [
114803
+ 32,
114804
+ 16
114805
+ ]
114806
+ }, /*#__PURE__*/ React.createElement(Col, {
114807
+ xs: 24,
114808
+ sm: 12,
114809
+ md: 8,
114810
+ lg: 6
114811
+ }, /*#__PURE__*/ React.createElement("div", {
114812
+ style: {
114813
+ fontSize: 11,
114814
+ color: labelColor,
114815
+ textTransform: "uppercase",
114816
+ marginBottom: 4
114817
+ }
114818
+ }, "Name"), /*#__PURE__*/ React.createElement("div", {
114819
+ style: {
114820
+ fontWeight: 600,
114821
+ fontSize: 15
114822
+ }
114823
+ }, agent_name || "-")), /*#__PURE__*/ React.createElement(Col, {
114824
+ xs: 24,
114825
+ sm: 12,
114826
+ md: 8,
114827
+ lg: 5
114828
+ }, /*#__PURE__*/ React.createElement("div", {
114829
+ style: {
114830
+ fontSize: 11,
114831
+ color: labelColor,
114832
+ textTransform: "uppercase",
114833
+ marginBottom: 4
114834
+ }
114835
+ }, "Completed At"), /*#__PURE__*/ React.createElement("div", {
114836
+ style: {
114837
+ fontWeight: 600,
114838
+ fontSize: 15
114839
+ }
114840
+ }, completed_at ? moment(completed_at).format("M/D/YYYY, h:mm:ss A") : "-")), /*#__PURE__*/ React.createElement(Col, {
114841
+ xs: 24,
114842
+ sm: 12,
114843
+ md: 8,
114844
+ lg: 3
114845
+ }, /*#__PURE__*/ React.createElement("div", {
114846
+ style: {
114847
+ fontSize: 11,
114848
+ color: labelColor,
114849
+ textTransform: "uppercase",
114850
+ marginBottom: 4
114851
+ }
114852
+ }, "Runs"), /*#__PURE__*/ React.createElement("span", {
114853
+ style: {
114854
+ display: "inline-flex",
114855
+ alignItems: "center",
114856
+ justifyContent: "center",
114857
+ minWidth: 28,
114858
+ height: 28,
114859
+ padding: "0 8px",
114860
+ borderRadius: 14,
114861
+ background: theme.colors.primary,
114862
+ color: theme.colors.primaryForeground,
114863
+ fontWeight: 600,
114864
+ fontSize: 14
114865
+ }
114866
+ }, runsCount)), /*#__PURE__*/ React.createElement(Col, {
114867
+ xs: 24,
114868
+ sm: 12,
114869
+ md: 8,
114870
+ lg: 4
114871
+ }, /*#__PURE__*/ React.createElement("div", {
114872
+ style: {
114873
+ fontSize: 11,
114874
+ color: labelColor,
114875
+ textTransform: "uppercase",
114876
+ marginBottom: 4
114877
+ }
114878
+ }, "Evaluator"), /*#__PURE__*/ React.createElement("div", {
114879
+ style: {
114880
+ fontWeight: 600,
114881
+ fontSize: 15
114882
+ }
114883
+ }, evaluator.name)))), /*#__PURE__*/ React.createElement(Row$1, {
114884
+ gutter: [
114885
+ 24,
114886
+ 24
114887
+ ]
114888
+ }, evaluator.metrics.map((metric)=>{
114889
+ const value = results[metric.name];
114890
+ const displayLabel = metric.name.replace(/\s+/g, " ");
114891
+ const displayDescription = metric.description ?? "";
114892
+ const displayValue = formatMetricValue(evaluator, metric.name, value);
114893
+ return /*#__PURE__*/ React.createElement(Col, {
114894
+ key: metric.name,
114895
+ xs: 24,
114896
+ sm: 24,
114897
+ md: 24,
114898
+ lg: 6
114899
+ }, /*#__PURE__*/ React.createElement(Card, {
114900
+ style: {
114901
+ height: "100%",
114902
+ background: theme.colors.card,
114903
+ border: `1px solid ${theme.colors.border}`,
114904
+ boxShadow: theme.shadows.sm
114905
+ }
114906
+ }, /*#__PURE__*/ React.createElement("div", {
114907
+ style: {
114908
+ fontSize: 11,
114909
+ color: labelColor,
114910
+ textTransform: "uppercase",
114911
+ marginBottom: 8
114912
+ }
114913
+ }, displayLabel), /*#__PURE__*/ React.createElement("div", {
114914
+ style: {
114915
+ fontSize: 32,
114916
+ fontWeight: 700,
114917
+ marginBottom: 4
114918
+ }
114919
+ }, displayValue), displayDescription && /*#__PURE__*/ React.createElement("div", {
114920
+ style: {
114921
+ fontSize: 13,
114922
+ color: labelColor
114923
+ }
114924
+ }, displayDescription)));
114925
+ })), evaluator.name.includes("ToolUse") && /*#__PURE__*/ React.createElement("div", {
114926
+ style: {
114927
+ marginTop: 32
114928
+ }
114929
+ }, /*#__PURE__*/ React.createElement(ToolUseEvaluatorMetricsTable, {
114930
+ rawResults: (evaluation.rawEvaluatorResults?.[evaluatorId] ?? []).filter((r)=>isToolResult(r) || isToolAggregate(r))
114931
+ })));
114932
+ };
114933
+
114378
114934
  function __insertCSS(code) {
114379
114935
  if (typeof document == 'undefined') return;
114380
114936
  let head = document.head || document.getElementsByTagName('head')[0];
@@ -116362,7 +116918,9 @@ exports.AnthropicIcon = AnthropicIcon;
116362
116918
  exports.Badge = Badge;
116363
116919
  exports.Drawer = Drawer;
116364
116920
  exports.Edge = Edge;
116921
+ exports.EvaluationDetailsDrawer = EvaluationDetailsDrawer;
116365
116922
  exports.EvaluationsTable = EvaluationsTable;
116923
+ exports.EvaluatorResult = EvaluatorResult;
116366
116924
  exports.GlobalStyles = GlobalStyles;
116367
116925
  exports.GoogleIcon = GoogleIcon;
116368
116926
  exports.JsonTreeViewer = JsonTreeViewer;
package/dist/esm/index.js CHANGED
@@ -12882,7 +12882,25 @@ const createLucideIcon = (iconName, iconNode)=>{
12882
12882
  return Component;
12883
12883
  };
12884
12884
 
12885
- const __iconNode$i = [
12885
+ const __iconNode$m = [
12886
+ [
12887
+ "path",
12888
+ {
12889
+ d: "m12 19-7-7 7-7",
12890
+ key: "1l729n"
12891
+ }
12892
+ ],
12893
+ [
12894
+ "path",
12895
+ {
12896
+ d: "M19 12H5",
12897
+ key: "x3x0zl"
12898
+ }
12899
+ ]
12900
+ ];
12901
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$m);
12902
+
12903
+ const __iconNode$l = [
12886
12904
  [
12887
12905
  "path",
12888
12906
  {
@@ -12898,9 +12916,9 @@ const __iconNode$i = [
12898
12916
  }
12899
12917
  ]
12900
12918
  ];
12901
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$i);
12919
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$l);
12902
12920
 
12903
- const __iconNode$h = [
12921
+ const __iconNode$k = [
12904
12922
  [
12905
12923
  "path",
12906
12924
  {
@@ -12948,9 +12966,9 @@ const __iconNode$h = [
12948
12966
  }
12949
12967
  ]
12950
12968
  ];
12951
- const Bot = createLucideIcon("bot", __iconNode$h);
12969
+ const Bot = createLucideIcon("bot", __iconNode$k);
12952
12970
 
12953
- const __iconNode$g = [
12971
+ const __iconNode$j = [
12954
12972
  [
12955
12973
  "path",
12956
12974
  {
@@ -12984,9 +13002,9 @@ const __iconNode$g = [
12984
13002
  }
12985
13003
  ]
12986
13004
  ];
12987
- const Calendar = createLucideIcon("calendar", __iconNode$g);
13005
+ const Calendar = createLucideIcon("calendar", __iconNode$j);
12988
13006
 
12989
- const __iconNode$f = [
13007
+ const __iconNode$i = [
12990
13008
  [
12991
13009
  "path",
12992
13010
  {
@@ -13043,9 +13061,9 @@ const __iconNode$f = [
13043
13061
  }
13044
13062
  ]
13045
13063
  ];
13046
- const ChartNetwork = createLucideIcon("chart-network", __iconNode$f);
13064
+ const ChartNetwork = createLucideIcon("chart-network", __iconNode$i);
13047
13065
 
13048
- const __iconNode$e = [
13066
+ const __iconNode$h = [
13049
13067
  [
13050
13068
  "path",
13051
13069
  {
@@ -13054,9 +13072,9 @@ const __iconNode$e = [
13054
13072
  }
13055
13073
  ]
13056
13074
  ];
13057
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$e);
13075
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$h);
13058
13076
 
13059
- const __iconNode$d = [
13077
+ const __iconNode$g = [
13060
13078
  [
13061
13079
  "path",
13062
13080
  {
@@ -13065,7 +13083,61 @@ const __iconNode$d = [
13065
13083
  }
13066
13084
  ]
13067
13085
  ];
13068
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$d);
13086
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$g);
13087
+
13088
+ const __iconNode$f = [
13089
+ [
13090
+ "path",
13091
+ {
13092
+ d: "m7 6 5 5 5-5",
13093
+ key: "1lc07p"
13094
+ }
13095
+ ],
13096
+ [
13097
+ "path",
13098
+ {
13099
+ d: "m7 13 5 5 5-5",
13100
+ key: "1d48rs"
13101
+ }
13102
+ ]
13103
+ ];
13104
+ const ChevronsDown = createLucideIcon("chevrons-down", __iconNode$f);
13105
+
13106
+ const __iconNode$e = [
13107
+ [
13108
+ "path",
13109
+ {
13110
+ d: "m17 11-5-5-5 5",
13111
+ key: "e8nh98"
13112
+ }
13113
+ ],
13114
+ [
13115
+ "path",
13116
+ {
13117
+ d: "m17 18-5-5-5 5",
13118
+ key: "2avn1x"
13119
+ }
13120
+ ]
13121
+ ];
13122
+ const ChevronsUp = createLucideIcon("chevrons-up", __iconNode$e);
13123
+
13124
+ const __iconNode$d = [
13125
+ [
13126
+ "path",
13127
+ {
13128
+ d: "M21.801 10A10 10 0 1 1 17 3.335",
13129
+ key: "yps3ct"
13130
+ }
13131
+ ],
13132
+ [
13133
+ "path",
13134
+ {
13135
+ d: "m9 11 3 3L22 4",
13136
+ key: "1pflzl"
13137
+ }
13138
+ ]
13139
+ ];
13140
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$d);
13069
13141
 
13070
13142
  const __iconNode$c = [
13071
13143
  [
@@ -114355,6 +114427,490 @@ const EvaluationsTable = ({ evaluations, loading = false, error = null, onRefres
114355
114427
  }));
114356
114428
  };
114357
114429
 
114430
+ function buildTreeFromRawResults(rawResults) {
114431
+ const toolResults = rawResults.filter((r)=>isToolResult(r));
114432
+ const toolAggregates = rawResults.filter((r)=>isToolAggregate(r));
114433
+ const latencyByTool = new Map();
114434
+ const failureRateByTool = new Map();
114435
+ const usageCountByTool = new Map();
114436
+ for (const agg of toolAggregates){
114437
+ const name = agg.metric.name;
114438
+ const tool = agg.tool_name;
114439
+ if (name === "Latency") {
114440
+ latencyByTool.set(tool, {
114441
+ mean: agg.mean,
114442
+ count: agg.values.length
114443
+ });
114444
+ } else if (name === "FailureRate") {
114445
+ failureRateByTool.set(tool, agg.mean * 100);
114446
+ } else if (name === "UsageCount") {
114447
+ usageCountByTool.set(tool, agg.values.reduce((a, b)=>a + b, 0));
114448
+ }
114449
+ }
114450
+ const latencyResults = toolResults.filter((r)=>r.result_name.startsWith("Latency/"));
114451
+ const failureResults = toolResults.filter((r)=>r.result_name.startsWith("FailureRate/"));
114452
+ const toolNamesFromAgg = Array.from(new Set([
114453
+ ...latencyByTool.keys(),
114454
+ ...failureRateByTool.keys(),
114455
+ ...usageCountByTool.keys()
114456
+ ]));
114457
+ const toolNamesFromResults = Array.from(new Set(latencyResults.map((r)=>r.tool_name)));
114458
+ const allToolNames = Array.from(new Set([
114459
+ ...toolNamesFromAgg,
114460
+ ...toolNamesFromResults
114461
+ ])).sort();
114462
+ // Exclude sub-agent tools (e.g. WebSearchAgent) - they invoke agents, not primitives
114463
+ const toolNames = allToolNames.filter((name)=>!name.endsWith("Agent"));
114464
+ if (toolNames.length === 0) {
114465
+ return [];
114466
+ }
114467
+ const agentKey = (agentDataId)=>agentDataId?.[0] ?? "unknown";
114468
+ const failureByKey = new Map();
114469
+ for (const r of failureResults){
114470
+ const k = r.tool_node_id ? `${r.tool_name}|${agentKey(r.agent_data_id)}|${r.tool_node_id}` : `${r.tool_name}|${agentKey(r.agent_data_id)}|${r.result_name}`;
114471
+ failureByKey.set(k, r.value);
114472
+ }
114473
+ const failureByToolAgentIndex = new Map();
114474
+ for (const r of failureResults){
114475
+ const k = `${r.tool_name}|${agentKey(r.agent_data_id)}`;
114476
+ if (!failureByToolAgentIndex.has(k)) failureByToolAgentIndex.set(k, []);
114477
+ failureByToolAgentIndex.get(k).push(r.value);
114478
+ }
114479
+ const rows = [];
114480
+ for(let ti = 0; ti < toolNames.length; ti++){
114481
+ const toolName = toolNames[ti];
114482
+ const latency = latencyByTool.get(toolName);
114483
+ const failurePct = failureRateByTool.get(toolName);
114484
+ const invocations = usageCountByTool.get(toolName) ?? latency?.count ?? 0;
114485
+ const runtimeMs = latency ? Math.round(latency.mean * 1000) : undefined;
114486
+ const failureRateStr = failurePct !== undefined ? `${failurePct.toFixed(1)}%` : undefined;
114487
+ const agentGroups = new Map();
114488
+ for (const r of latencyResults){
114489
+ if (r.tool_name !== toolName) continue;
114490
+ const aid = agentKey(r.agent_data_id);
114491
+ const rowKey = r.tool_node_id ? `${toolName}|${aid}|${r.tool_node_id}` : `${toolName}|${aid}|${r.result_name}`;
114492
+ if (!agentGroups.has(aid)) {
114493
+ agentGroups.set(aid, {
114494
+ agentId: aid,
114495
+ latencies: []
114496
+ });
114497
+ }
114498
+ agentGroups.get(aid).latencies.push({
114499
+ value: r.value,
114500
+ key: rowKey,
114501
+ toolNodeId: r.tool_node_id
114502
+ });
114503
+ }
114504
+ const children = [];
114505
+ for (const [aid, group] of agentGroups){
114506
+ const totalRuntimeMs = group.latencies.reduce((s, l)=>s + l.value * 1000, 0);
114507
+ const cnt = group.latencies.length;
114508
+ let failed = 0;
114509
+ const failList = failureByToolAgentIndex.get(`${toolName}|${aid}`) ?? [];
114510
+ const leaves = group.latencies.map((l, idx)=>{
114511
+ const failVal = failureByKey.get(l.key);
114512
+ const failValByIndex = failList[idx];
114513
+ const resolvedFail = failVal ?? (failValByIndex !== undefined ? failValByIndex : undefined);
114514
+ const isFailed = resolvedFail !== undefined && resolvedFail >= 0.5;
114515
+ if (isFailed) failed++;
114516
+ const leafName = l.toolNodeId ?? `invocation-${idx + 1}`;
114517
+ return {
114518
+ key: `${toolName}-${aid}-${idx}`,
114519
+ name: leafName,
114520
+ runtimeMs: Math.round(l.value * 1000),
114521
+ failureRate: isFailed ? "Failed" : "Success",
114522
+ level: 3,
114523
+ children: undefined
114524
+ };
114525
+ });
114526
+ const agentFailurePct = cnt > 0 ? (failed / cnt * 100).toFixed(1) + "%" : undefined;
114527
+ children.push({
114528
+ key: `${toolName}-${aid}`,
114529
+ name: aid,
114530
+ invocations: cnt,
114531
+ runtimeMs: Math.round(totalRuntimeMs),
114532
+ failureRate: agentFailurePct,
114533
+ level: 2,
114534
+ children: leaves.length > 0 ? leaves : undefined
114535
+ });
114536
+ }
114537
+ rows.push({
114538
+ key: toolName,
114539
+ name: toolName,
114540
+ invocations,
114541
+ runtimeMs,
114542
+ failureRate: failureRateStr,
114543
+ level: 1,
114544
+ children: children.length > 0 ? children : undefined
114545
+ });
114546
+ }
114547
+ return rows;
114548
+ }
114549
+ function getAllExpandableKeys(rows) {
114550
+ const keys = [];
114551
+ for (const row of rows){
114552
+ if (row.children?.length) {
114553
+ keys.push(row.key);
114554
+ keys.push(...getAllExpandableKeys(row.children));
114555
+ }
114556
+ }
114557
+ return keys;
114558
+ }
114559
+ const ToolUseEvaluatorMetricsTable = ({ rawResults, title = "Tool Use Evaluator - Aggregate View" })=>{
114560
+ const { theme } = useTheme$1();
114561
+ const [expandedRowKeys, setExpandedRowKeys] = useState([]);
114562
+ const dataSource = useMemo(()=>buildTreeFromRawResults(rawResults), [
114563
+ rawResults
114564
+ ]);
114565
+ const expandableKeys = useMemo(()=>getAllExpandableKeys(dataSource), [
114566
+ dataSource
114567
+ ]);
114568
+ const allExpanded = expandableKeys.length > 0 && expandedRowKeys.length === expandableKeys.length;
114569
+ const handleToggleExpandAll = useCallback(()=>{
114570
+ setExpandedRowKeys(allExpanded ? [] : expandableKeys);
114571
+ }, [
114572
+ allExpanded,
114573
+ expandableKeys
114574
+ ]);
114575
+ const toolIconColor = theme.colors.tagTooluse?.color ?? theme.colors.primary;
114576
+ const agentIconColor = theme.colors.tagLlminference?.color ?? "#6b21a8";
114577
+ const IconForLevel = ({ level })=>level === 2 ? /*#__PURE__*/ React__default.createElement(Bot, {
114578
+ size: 14,
114579
+ style: {
114580
+ marginRight: 8,
114581
+ verticalAlign: "middle",
114582
+ flexShrink: 0,
114583
+ color: agentIconColor
114584
+ }
114585
+ }) : /*#__PURE__*/ React__default.createElement(Wrench, {
114586
+ size: 14,
114587
+ style: {
114588
+ marginRight: 8,
114589
+ verticalAlign: "middle",
114590
+ flexShrink: 0,
114591
+ color: toolIconColor
114592
+ }
114593
+ });
114594
+ const columns = [
114595
+ {
114596
+ title: "NAME",
114597
+ dataIndex: "name",
114598
+ key: "name",
114599
+ render: (name, row)=>/*#__PURE__*/ React__default.createElement("span", {
114600
+ style: {
114601
+ display: "inline-flex",
114602
+ alignItems: "center",
114603
+ fontFamily: "monospace",
114604
+ fontSize: 13
114605
+ }
114606
+ }, /*#__PURE__*/ React__default.createElement(IconForLevel, {
114607
+ level: row.level
114608
+ }), name)
114609
+ },
114610
+ {
114611
+ title: "INVOCATIONS",
114612
+ dataIndex: "invocations",
114613
+ key: "invocations",
114614
+ align: "right",
114615
+ width: 120,
114616
+ render: (v, row)=>row.level === 3 ? null : v ?? "-"
114617
+ },
114618
+ {
114619
+ title: "RUNTIME (MS)",
114620
+ dataIndex: "runtimeMs",
114621
+ key: "runtimeMs",
114622
+ align: "right",
114623
+ width: 120,
114624
+ render: (v)=>v !== undefined ? `${v}ms` : "-"
114625
+ },
114626
+ {
114627
+ title: "FAILURE RATE",
114628
+ dataIndex: "failureRate",
114629
+ key: "failureRate",
114630
+ align: "right",
114631
+ width: 130,
114632
+ render: (v, row)=>{
114633
+ if (v === undefined) return "-";
114634
+ if (v === "Failed") {
114635
+ return /*#__PURE__*/ React__default.createElement("span", {
114636
+ style: {
114637
+ color: theme.colors.destructive,
114638
+ fontWeight: 500
114639
+ }
114640
+ }, "Failed");
114641
+ }
114642
+ if (v === "Success") {
114643
+ return /*#__PURE__*/ React__default.createElement(Tag, {
114644
+ style: {
114645
+ margin: 0,
114646
+ display: "inline-flex",
114647
+ alignItems: "center",
114648
+ gap: 6,
114649
+ background: theme.colors.success,
114650
+ borderColor: theme.colors.success,
114651
+ color: theme.colors.successForeground
114652
+ }
114653
+ }, /*#__PURE__*/ React__default.createElement(CircleCheckBig, {
114654
+ size: 14
114655
+ }), "Success");
114656
+ }
114657
+ return /*#__PURE__*/ React__default.createElement("span", null, v);
114658
+ }
114659
+ }
114660
+ ];
114661
+ const handleRowClick = useCallback((record)=>(e)=>{
114662
+ if (!record.children?.length) return;
114663
+ if (e.target.closest(".ant-table-row-expand-icon")) return;
114664
+ setExpandedRowKeys((prev)=>prev.includes(record.key) ? prev.filter((k)=>k !== record.key) : [
114665
+ ...prev,
114666
+ record.key
114667
+ ]);
114668
+ }, []);
114669
+ if (dataSource.length === 0) {
114670
+ return /*#__PURE__*/ React__default.createElement("div", {
114671
+ style: {
114672
+ padding: 24,
114673
+ textAlign: "center",
114674
+ color: theme.colors.mutedForeground,
114675
+ fontSize: 14
114676
+ }
114677
+ }, "No tool use metrics available");
114678
+ }
114679
+ return /*#__PURE__*/ React__default.createElement("div", null, /*#__PURE__*/ React__default.createElement("div", {
114680
+ style: {
114681
+ display: "flex",
114682
+ alignItems: "center",
114683
+ justifyContent: "space-between",
114684
+ marginBottom: 16
114685
+ }
114686
+ }, /*#__PURE__*/ React__default.createElement("h3", {
114687
+ style: {
114688
+ margin: 0,
114689
+ fontSize: 16,
114690
+ fontWeight: 600
114691
+ }
114692
+ }, title), /*#__PURE__*/ React__default.createElement(Tooltip, {
114693
+ title: expandableKeys.length === 0 ? "No expandable rows" : allExpanded ? "Collapse all" : "Expand all"
114694
+ }, /*#__PURE__*/ React__default.createElement(Button$1, {
114695
+ type: "text",
114696
+ size: "small",
114697
+ icon: allExpanded ? /*#__PURE__*/ React__default.createElement(ChevronsUp, {
114698
+ size: 16
114699
+ }) : /*#__PURE__*/ React__default.createElement(ChevronsDown, {
114700
+ size: 16
114701
+ }),
114702
+ onClick: handleToggleExpandAll,
114703
+ disabled: expandableKeys.length === 0,
114704
+ style: {
114705
+ display: "flex",
114706
+ alignItems: "center"
114707
+ },
114708
+ "data-testid": "expand-collapse-all"
114709
+ }))), /*#__PURE__*/ React__default.createElement(ForwardTable, {
114710
+ dataSource: dataSource,
114711
+ columns: columns,
114712
+ rowKey: "key",
114713
+ pagination: false,
114714
+ size: "small",
114715
+ expandable: {
114716
+ expandedRowKeys,
114717
+ onExpandedRowsChange: (keys)=>setExpandedRowKeys([
114718
+ ...keys
114719
+ ]),
114720
+ rowExpandable: (record)=>!!record.children && record.children.length > 0
114721
+ },
114722
+ onRow: (record)=>({
114723
+ onClick: (e)=>handleRowClick(record)(e),
114724
+ style: {
114725
+ cursor: record.children?.length ? "pointer" : undefined
114726
+ }
114727
+ }),
114728
+ style: {
114729
+ background: theme.colors.card,
114730
+ border: `1px solid ${theme.colors.border}`
114731
+ }
114732
+ }));
114733
+ };
114734
+
114735
+ /**
114736
+ * Full-page component that renders a single evaluator's result.
114737
+ * Exportable and reusable: pass Evaluation and evaluatorId from any React app.
114738
+ */ const EvaluatorResult = ({ evaluation, evaluatorId, backHref })=>{
114739
+ const { theme } = useTheme$1();
114740
+ const labelColor = theme.colors.mutedForeground;
114741
+ const evaluator = evaluation?.evaluators.find((e)=>e.evaluator_id === evaluatorId);
114742
+ const results = evaluation?.results[evaluatorId] ?? {};
114743
+ if (!evaluation || !evaluator) {
114744
+ return /*#__PURE__*/ React__default.createElement("div", {
114745
+ style: {
114746
+ display: "flex",
114747
+ alignItems: "center",
114748
+ justifyContent: "center",
114749
+ minHeight: "400px",
114750
+ color: labelColor
114751
+ }
114752
+ }, /*#__PURE__*/ React__default.createElement("p", null, "No evaluator result data available"));
114753
+ }
114754
+ const { agent_name, completed_at, runs } = evaluation;
114755
+ const runsCount = runs?.length ?? 0;
114756
+ return /*#__PURE__*/ React__default.createElement("div", {
114757
+ style: {
114758
+ padding: "24px",
114759
+ width: "100%",
114760
+ minWidth: 0
114761
+ }
114762
+ }, backHref && /*#__PURE__*/ React__default.createElement("a", {
114763
+ href: backHref,
114764
+ style: {
114765
+ display: "inline-flex",
114766
+ alignItems: "center",
114767
+ gap: 6,
114768
+ marginBottom: 24,
114769
+ color: theme.colors.primary,
114770
+ textDecoration: "none",
114771
+ fontSize: 14
114772
+ }
114773
+ }, /*#__PURE__*/ React__default.createElement(ArrowLeft, {
114774
+ size: 16
114775
+ }), "Back to Evaluations"), /*#__PURE__*/ React__default.createElement(Card, {
114776
+ style: {
114777
+ marginBottom: 24,
114778
+ background: theme.colors.secondary,
114779
+ border: `1px solid ${theme.colors.border}`
114780
+ }
114781
+ }, /*#__PURE__*/ React__default.createElement(Row$1, {
114782
+ gutter: [
114783
+ 32,
114784
+ 16
114785
+ ]
114786
+ }, /*#__PURE__*/ React__default.createElement(Col, {
114787
+ xs: 24,
114788
+ sm: 12,
114789
+ md: 8,
114790
+ lg: 6
114791
+ }, /*#__PURE__*/ React__default.createElement("div", {
114792
+ style: {
114793
+ fontSize: 11,
114794
+ color: labelColor,
114795
+ textTransform: "uppercase",
114796
+ marginBottom: 4
114797
+ }
114798
+ }, "Name"), /*#__PURE__*/ React__default.createElement("div", {
114799
+ style: {
114800
+ fontWeight: 600,
114801
+ fontSize: 15
114802
+ }
114803
+ }, agent_name || "-")), /*#__PURE__*/ React__default.createElement(Col, {
114804
+ xs: 24,
114805
+ sm: 12,
114806
+ md: 8,
114807
+ lg: 5
114808
+ }, /*#__PURE__*/ React__default.createElement("div", {
114809
+ style: {
114810
+ fontSize: 11,
114811
+ color: labelColor,
114812
+ textTransform: "uppercase",
114813
+ marginBottom: 4
114814
+ }
114815
+ }, "Completed At"), /*#__PURE__*/ React__default.createElement("div", {
114816
+ style: {
114817
+ fontWeight: 600,
114818
+ fontSize: 15
114819
+ }
114820
+ }, completed_at ? moment(completed_at).format("M/D/YYYY, h:mm:ss A") : "-")), /*#__PURE__*/ React__default.createElement(Col, {
114821
+ xs: 24,
114822
+ sm: 12,
114823
+ md: 8,
114824
+ lg: 3
114825
+ }, /*#__PURE__*/ React__default.createElement("div", {
114826
+ style: {
114827
+ fontSize: 11,
114828
+ color: labelColor,
114829
+ textTransform: "uppercase",
114830
+ marginBottom: 4
114831
+ }
114832
+ }, "Runs"), /*#__PURE__*/ React__default.createElement("span", {
114833
+ style: {
114834
+ display: "inline-flex",
114835
+ alignItems: "center",
114836
+ justifyContent: "center",
114837
+ minWidth: 28,
114838
+ height: 28,
114839
+ padding: "0 8px",
114840
+ borderRadius: 14,
114841
+ background: theme.colors.primary,
114842
+ color: theme.colors.primaryForeground,
114843
+ fontWeight: 600,
114844
+ fontSize: 14
114845
+ }
114846
+ }, runsCount)), /*#__PURE__*/ React__default.createElement(Col, {
114847
+ xs: 24,
114848
+ sm: 12,
114849
+ md: 8,
114850
+ lg: 4
114851
+ }, /*#__PURE__*/ React__default.createElement("div", {
114852
+ style: {
114853
+ fontSize: 11,
114854
+ color: labelColor,
114855
+ textTransform: "uppercase",
114856
+ marginBottom: 4
114857
+ }
114858
+ }, "Evaluator"), /*#__PURE__*/ React__default.createElement("div", {
114859
+ style: {
114860
+ fontWeight: 600,
114861
+ fontSize: 15
114862
+ }
114863
+ }, evaluator.name)))), /*#__PURE__*/ React__default.createElement(Row$1, {
114864
+ gutter: [
114865
+ 24,
114866
+ 24
114867
+ ]
114868
+ }, evaluator.metrics.map((metric)=>{
114869
+ const value = results[metric.name];
114870
+ const displayLabel = metric.name.replace(/\s+/g, " ");
114871
+ const displayDescription = metric.description ?? "";
114872
+ const displayValue = formatMetricValue(evaluator, metric.name, value);
114873
+ return /*#__PURE__*/ React__default.createElement(Col, {
114874
+ key: metric.name,
114875
+ xs: 24,
114876
+ sm: 24,
114877
+ md: 24,
114878
+ lg: 6
114879
+ }, /*#__PURE__*/ React__default.createElement(Card, {
114880
+ style: {
114881
+ height: "100%",
114882
+ background: theme.colors.card,
114883
+ border: `1px solid ${theme.colors.border}`,
114884
+ boxShadow: theme.shadows.sm
114885
+ }
114886
+ }, /*#__PURE__*/ React__default.createElement("div", {
114887
+ style: {
114888
+ fontSize: 11,
114889
+ color: labelColor,
114890
+ textTransform: "uppercase",
114891
+ marginBottom: 8
114892
+ }
114893
+ }, displayLabel), /*#__PURE__*/ React__default.createElement("div", {
114894
+ style: {
114895
+ fontSize: 32,
114896
+ fontWeight: 700,
114897
+ marginBottom: 4
114898
+ }
114899
+ }, displayValue), displayDescription && /*#__PURE__*/ React__default.createElement("div", {
114900
+ style: {
114901
+ fontSize: 13,
114902
+ color: labelColor
114903
+ }
114904
+ }, displayDescription)));
114905
+ })), evaluator.name.includes("ToolUse") && /*#__PURE__*/ React__default.createElement("div", {
114906
+ style: {
114907
+ marginTop: 32
114908
+ }
114909
+ }, /*#__PURE__*/ React__default.createElement(ToolUseEvaluatorMetricsTable, {
114910
+ rawResults: (evaluation.rawEvaluatorResults?.[evaluatorId] ?? []).filter((r)=>isToolResult(r) || isToolAggregate(r))
114911
+ })));
114912
+ };
114913
+
114358
114914
  function __insertCSS(code) {
114359
114915
  if (typeof document == 'undefined') return;
114360
114916
  let head = document.head || document.getElementsByTagName('head')[0];
@@ -116337,4 +116893,4 @@ const GlobalStyles = ()=>{
116337
116893
  return getSafeColor(props.theme, path, fallback);
116338
116894
  };
116339
116895
 
116340
- export { AgenticFlowVisualizer, AnthropicIcon, Badge, Drawer, Edge, EvaluationsTable, GlobalStyles, GoogleIcon, JsonTreeViewer, Node$1 as Node, OpenAIIcon, SafeThemeProvider, SessionDetails, Sheet, ThemeProvider, Timeline, Visualizer, calculateAutoLayout, cn, conditionalStyle, createSafeTheme, darkTheme, defaultTheme$1 as defaultTheme, detectContentType, formatCurrency, formatDateShort, formatDuration, formatLatency, formatMetricValue, formatNumberWithCommas, formatToolCalls, getColor, getSafeColor, getSafeSpacing, getSafeThemeValue, getSpacing, getStatusColor, isEvaluationDto, lightTheme, safeStyled, safeThemeColor, safeThemeSpacing, safeThemeValue, toTitleCase, transformEvaluation, truncateText, useComponentTheme, useSafeTheme, useTheme$1 as useTheme, useThemeValue };
116896
+ export { AgenticFlowVisualizer, AnthropicIcon, Badge, Drawer, Edge, EvaluationDetailsDrawer, EvaluationsTable, EvaluatorResult, GlobalStyles, GoogleIcon, JsonTreeViewer, Node$1 as Node, OpenAIIcon, SafeThemeProvider, SessionDetails, Sheet, ThemeProvider, Timeline, Visualizer, calculateAutoLayout, cn, conditionalStyle, createSafeTheme, darkTheme, defaultTheme$1 as defaultTheme, detectContentType, formatCurrency, formatDateShort, formatDuration, formatLatency, formatMetricValue, formatNumberWithCommas, formatToolCalls, getColor, getSafeColor, getSafeSpacing, getSafeThemeValue, getSpacing, getStatusColor, isEvaluationDto, lightTheme, safeStyled, safeThemeColor, safeThemeSpacing, safeThemeValue, toTitleCase, transformEvaluation, truncateText, useComponentTheme, useSafeTheme, useTheme$1 as useTheme, useThemeValue };
@@ -2,6 +2,8 @@ export { default as AgenticFlowVisualizer } from "./components/AgenticFlowVisual
2
2
  export { default as Visualizer } from "./components/Visualizer";
3
3
  export { SessionDetails } from "./agenthub/pages/session-details";
4
4
  export { EvaluationsTable } from "./agenthub/components/EvaluationsTable";
5
+ export { EvaluationDetailsDrawer } from "./agenthub/pages/evaluation-details-drawer";
6
+ export { EvaluatorResult } from "./agenthub/pages/evaluator-result";
5
7
  export { transformEvaluation, isEvaluationDto } from "./agenthub/utils/transformEvaluation";
6
8
  export type { Evaluation } from "./agenthub/pages/evaluations.types";
7
9
  export type { Evaluation as EvaluationDto } from "./dto/Evaluation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "license": "MIT",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for Railtracks agentic flows",