@tangle-network/sandbox-cli 0.21.64 → 0.21.65

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.
Files changed (136) hide show
  1. package/README.md +31 -3
  2. package/SKILL.md +29 -1
  3. package/dist/graph-native-CS_TmaCK.mjs +1 -0
  4. package/dist/graph-viewer/Analytics-bWsqhurt.js +1001 -0
  5. package/dist/graph-viewer/{AnswerStrip-DhwqOyxI.js → AnswerStrip-COxV7gLW.js} +2 -2
  6. package/dist/graph-viewer/Checks-CQGmKcQ0.js +164 -0
  7. package/dist/graph-viewer/Conversations-DgCshBAf.js +627 -0
  8. package/dist/graph-viewer/{Files-DtZhf0ii.js → Files-CvIOGrAs.js} +81 -90
  9. package/dist/graph-viewer/LiveRun-DHmsr6F7.js +311 -0
  10. package/dist/graph-viewer/{Outputs-QET3nPPp.js → Outputs-rwBg_x36.js} +4 -4
  11. package/dist/graph-viewer/Overview-C150tkVa.js +194 -0
  12. package/dist/graph-viewer/{RunOverview-DJQDAMIx.js → RunOverview-CSqsunqf.js} +2 -2
  13. package/dist/graph-viewer/RunPage-F_prVwiV.js +286 -0
  14. package/dist/graph-viewer/Timeline-BFDywlmz.js +335 -0
  15. package/dist/graph-viewer/Today-BdDuqZGF.js +623 -0
  16. package/dist/graph-viewer/Topology-SAfGtd5u.js +238 -0
  17. package/dist/graph-viewer/Traces-BYqXaS_s.js +254 -0
  18. package/dist/graph-viewer/{WallPages-4d9QUZDq.js → WallPages-MM70VZrC.js} +48 -30
  19. package/dist/graph-viewer/agent-runtime.js +55 -55
  20. package/dist/graph-viewer/{data-BJmP7F1M.js → data-DTGmre1W.js} +31 -27
  21. package/dist/graph-viewer/harness-sessions.js +1 -1
  22. package/dist/graph-viewer/index.js +1357 -1392
  23. package/dist/graph-viewer/{lazy-pages-DM0cZM10.js → lazy-pages-BYuq_L_n.js} +9 -5
  24. package/dist/graph-viewer/{outputs-model-CGdvjkQh.js → outputs-model-CHTx8rMz.js} +2 -2
  25. package/dist/graph-viewer/{viewer/plain-words-CgvxtEOa.js → plain-words-BrMHl0On.js} +9 -4
  26. package/dist/graph-viewer/receipt.js +2 -2
  27. package/dist/graph-viewer/record-CsP_3NJS.js +612 -0
  28. package/dist/graph-viewer/record-part-CuT9Xw37.js +334 -0
  29. package/dist/graph-viewer/record.js +2 -336
  30. package/dist/graph-viewer/report-viewer.js +65 -65
  31. package/dist/graph-viewer/report.js +1 -1
  32. package/dist/graph-viewer/research-publication.js +1 -1
  33. package/dist/graph-viewer/{run-files-C1NgzM0l.js → run-files-BckQDdTD.js} +1 -1
  34. package/dist/graph-viewer/{run-receipt-Bvi4-KVM.js → run-receipt-Bt2iXJUy.js} +1 -0
  35. package/dist/graph-viewer/schemas/agent-workspace.play.v1.json +3 -0
  36. package/dist/graph-viewer/schemas/agent-workspace.plays.v1.json +2 -0
  37. package/dist/graph-viewer/schemas/agent-workspace.run.v1.json +1 -0
  38. package/dist/graph-viewer/styles.css +4559 -2385
  39. package/dist/graph-viewer/trace-spans.js +1 -1
  40. package/dist/graph-viewer/ui-xa5w5bEN.js +889 -0
  41. package/dist/graph-viewer/viewer/{AgentGraphCanvas-CMdOlSlh-4EervjeC.js → AgentGraphCanvas-B74GN1o6-BZEumF7-.js} +2610 -2707
  42. package/dist/graph-viewer/viewer/Analytics-E3XS570U.js +1002 -0
  43. package/dist/graph-viewer/viewer/{AnswerStrip-CGUyXuYH.js → AnswerStrip-B7xMU57A.js} +2 -2
  44. package/dist/graph-viewer/viewer/Checks-CJ5XSHbv.js +165 -0
  45. package/dist/graph-viewer/viewer/Conversations-AX8G7Qyl.js +904 -0
  46. package/dist/graph-viewer/viewer/Files-DxL1576V.js +630 -0
  47. package/dist/graph-viewer/viewer/LiveRun-B-BckyEj.js +820 -0
  48. package/dist/graph-viewer/viewer/{Outputs-CumGyjQo.js → Outputs-BoIpgfMv.js} +24 -23
  49. package/dist/graph-viewer/viewer/Overview-Dzg5XJgy.js +436 -0
  50. package/dist/graph-viewer/viewer/RunPage-NtevWXBs.js +285 -0
  51. package/dist/graph-viewer/viewer/{Scores-ZS16yk0n.js → Scores-Dgv4WePL.js} +3 -3
  52. package/dist/graph-viewer/viewer/Timeline-CzY3LVDu.js +335 -0
  53. package/dist/graph-viewer/viewer/Today-Bi9IIwuh.js +623 -0
  54. package/dist/graph-viewer/viewer/Topology-CzjqSFXH.js +239 -0
  55. package/dist/graph-viewer/viewer/Traces-CMX0H1VU.js +254 -0
  56. package/dist/graph-viewer/viewer/{WallPages-CzWpyIfp.js → WallPages-Clj4bORg.js} +50 -32
  57. package/dist/graph-viewer/viewer/addon-webgl-BSCscllv.js +4027 -0
  58. package/dist/graph-viewer/viewer/agent-record-BrP-ENHg.css +2 -0
  59. package/dist/graph-viewer/viewer/{bot-D6Nrej7Z.js → bot-BaQU59LG.js} +1 -1
  60. package/dist/graph-viewer/viewer/{chevron-right-D_5IKLxu.js → chevron-right-Xn05jYLT.js} +1 -1
  61. package/dist/graph-viewer/viewer/{createLucideIcon-yH0cxLMy.js → createLucideIcon-BSphcoOJ.js} +1 -1
  62. package/dist/graph-viewer/viewer/dashboard-D3JhmRhe-DSl0zhkw.js +371 -0
  63. package/dist/graph-viewer/viewer/{data-CkWfWr7i.js → data-CVHeKhrh.js} +144 -139
  64. package/dist/graph-viewer/viewer/dist-4_KJz8ZM.js +349 -0
  65. package/dist/graph-viewer/viewer/dist-Dy-wrdTt.js +1615 -0
  66. package/dist/graph-viewer/viewer/es2015-utW4DTOJ.js +3506 -0
  67. package/dist/graph-viewer/viewer/{final-output-kwY11u9X.js → final-output-BYT-g-9j.js} +1 -1
  68. package/dist/graph-viewer/viewer/flow-waterfall-model-DvrgPLGS-BdThSFH-.js +2696 -0
  69. package/dist/graph-viewer/viewer/git-branch-BzTbIcYL.js +28 -0
  70. package/dist/graph-viewer/viewer/{highlights-Btsi5OXl.js → highlights-DWeSCtiR.js} +4 -4
  71. package/dist/graph-viewer/viewer/jsx-runtime-DPT6sCLq.js +319 -0
  72. package/dist/graph-viewer/viewer/lazy-pages-ChiMJ8r_.js +803 -0
  73. package/dist/graph-viewer/viewer/{markdown-CX_sVrXB.js → markdown-lADwhD7y.js} +2324 -2608
  74. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-RSb7EbGB.js +476 -0
  75. package/dist/graph-viewer/viewer/{page-header-Brq611fd.js → page-header-QbUg8F8i.js} +12 -11
  76. package/dist/graph-viewer/{plain-words-CgvxtEOa.js → viewer/plain-words-BrMHl0On.js} +9 -4
  77. package/dist/graph-viewer/viewer/primitives-znfPK9NP-B6UO7uDr.js +346 -0
  78. package/dist/graph-viewer/viewer/react-DQ7E2Epi.js +4254 -0
  79. package/dist/graph-viewer/viewer/{react-dom-t1L4_-il.js → react-dom-BEusmvQH.js} +1 -1
  80. package/dist/graph-viewer/viewer/record-DZnT6SWN-H-ul3U3a.js +3523 -0
  81. package/dist/graph-viewer/viewer/record-W39D5MO-.js +1 -0
  82. package/dist/graph-viewer/viewer/record-part-CbweyYoV.js +335 -0
  83. package/dist/graph-viewer/viewer/{segmented-control-BaJmvTNd.js → segmented-control-Di1mbQlP.js} +27 -26
  84. package/dist/graph-viewer/viewer/{shiki-Qnby7Sh6.js → shiki-BfNNlmfZ.js} +15 -15
  85. package/dist/graph-viewer/viewer/status-meta-S0kV_RDp.js +273 -0
  86. package/dist/graph-viewer/viewer/{stream-tokenizer-CWtnjmRd.js → stream-tokenizer-B5wWaM3U.js} +12 -12
  87. package/dist/graph-viewer/viewer/{themes-1i1fzpRk.js → themes-DuRxHiga.js} +1 -1
  88. package/dist/graph-viewer/viewer/ui-Co03nZUX.js +889 -0
  89. package/dist/graph-viewer/viewer/utils-BuObIC0n.js +1815 -0
  90. package/dist/graph-viewer/viewer/workbench-E6_5q_oL.js +28351 -0
  91. package/dist/graph-viewer/viewer/workflows--mZpHYqo.js +3298 -0
  92. package/dist/graph-viewer/viewer/workspace-cKs9sGEO.js +2468 -0
  93. package/dist/graph-viewer/{workspace-model-Ewf17pTW.js → workspace-model-BkPl_J8E.js} +1 -1
  94. package/dist/graph-viewer/workspace-viewer.js +7452 -7489
  95. package/dist/graph-viewer/workspace.js +1 -1
  96. package/dist/index.mjs +27 -22
  97. package/package.json +9 -8
  98. package/dist/graph-viewer/Analytics-DFWW8Phh.js +0 -938
  99. package/dist/graph-viewer/Checks-qgqV4xgV.js +0 -155
  100. package/dist/graph-viewer/Conversations-CGB45kpj.js +0 -545
  101. package/dist/graph-viewer/LiveRun-C21wUKAY.js +0 -210
  102. package/dist/graph-viewer/Overview-BjeLsA2I.js +0 -506
  103. package/dist/graph-viewer/RunPage-CkkcBEUe.js +0 -258
  104. package/dist/graph-viewer/Timeline-C2Xolk0t.js +0 -293
  105. package/dist/graph-viewer/Today-BVVDtSVN.js +0 -660
  106. package/dist/graph-viewer/Topology-DO5XX8e4.js +0 -545
  107. package/dist/graph-viewer/Traces-BhMxjNgw.js +0 -259
  108. package/dist/graph-viewer/part-events-BrLrg_EV.js +0 -276
  109. package/dist/graph-viewer/record-part-CZal_IMH.js +0 -1408
  110. package/dist/graph-viewer/ui-D8QZRsC3.js +0 -938
  111. package/dist/graph-viewer/viewer/Analytics-DD__nbLm.js +0 -939
  112. package/dist/graph-viewer/viewer/Checks-Ds5M7eAW.js +0 -156
  113. package/dist/graph-viewer/viewer/Conversations-C1n0EBBd.js +0 -819
  114. package/dist/graph-viewer/viewer/Files-Cjr7NMU_.js +0 -448
  115. package/dist/graph-viewer/viewer/LiveRun-uPTkPSjo.js +0 -6772
  116. package/dist/graph-viewer/viewer/Overview-4Umk14_2.js +0 -507
  117. package/dist/graph-viewer/viewer/RunPage-DZlBW7Va.js +0 -257
  118. package/dist/graph-viewer/viewer/Timeline-BnK6-yBR.js +0 -294
  119. package/dist/graph-viewer/viewer/Today-a_-oNigi.js +0 -660
  120. package/dist/graph-viewer/viewer/Topology-CQPCLQT6.js +0 -546
  121. package/dist/graph-viewer/viewer/Traces-C0IGk0L4.js +0 -259
  122. package/dist/graph-viewer/viewer/WorkflowGraph-DZ3xejKE-jRXKeSrg.js +0 -1559
  123. package/dist/graph-viewer/viewer/agent-record-Dw772ROs.css +0 -2
  124. package/dist/graph-viewer/viewer/agent-timeline-Cs9Qbpvo.js +0 -1798
  125. package/dist/graph-viewer/viewer/dist-C1-7EfoW.js +0 -488
  126. package/dist/graph-viewer/viewer/file-text-m7a3piQF.js +0 -47
  127. package/dist/graph-viewer/viewer/jsx-runtime-DQWyJOhv.js +0 -2136
  128. package/dist/graph-viewer/viewer/lazy-pages-BowaGsg-.js +0 -20
  129. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-fagiBQam.js +0 -723
  130. package/dist/graph-viewer/viewer/popover-CvOAjlnk.js +0 -5329
  131. package/dist/graph-viewer/viewer/react-CY3IbSNO.js +0 -4262
  132. package/dist/graph-viewer/viewer/record-part-D3_Anfpe.js +0 -1329
  133. package/dist/graph-viewer/viewer/terminal-83J_I4Ne.js +0 -52
  134. package/dist/graph-viewer/viewer/ui-C9b1rIUH.js +0 -938
  135. package/dist/graph-viewer/viewer/workspace-CekmOBs3.js +0 -25100
  136. package/dist/graph-viewer/viewer/x-DOc2URqZ.js +0 -56
@@ -0,0 +1,1002 @@
1
+ import { i as e } from "./rolldown-runtime-DArdT4gl.js";
2
+ import { n as t, t as n } from "./jsx-runtime-DPT6sCLq.js";
3
+ import { t as r } from "./segmented-control-Di1mbQlP.js";
4
+ import { C as i, O as a, S as o, b as s, d as c, f as l, l as u, m as d, o as f, s as p, t as m, u as h, v as g, w as _, x as v } from "./ui-Co03nZUX.js";
5
+ //#region src/workspace/run/Analytics.tsx
6
+ var y = /* @__PURE__ */ e(t(), 1), b = n();
7
+ function x({ m: e }) {
8
+ let [t, n] = (0, y.useState)(/* @__PURE__ */ new Set()), r = (0, y.useMemo)(() => t.size ? e.tree.filter((e) => t.has(e.id)) : e.tree, [e, t]), a = (0, y.useMemo)(() => i(r), [r]), o = t.size ? t.size === 1 ? e.byId.get([...t][0])?.name : `${t.size} agents` : "All";
9
+ return /* @__PURE__ */ (0, b.jsxs)("div", {
10
+ className: "rp-an",
11
+ children: [
12
+ /* @__PURE__ */ (0, b.jsx)("div", {
13
+ className: "rp-an-f",
14
+ children: /* @__PURE__ */ (0, b.jsx)(f, {
15
+ label: "Agents",
16
+ multi: !0,
17
+ options: h(e),
18
+ groups: u(e),
19
+ all: {
20
+ label: "All agents",
21
+ meta: String(e.agents.length)
22
+ },
23
+ value: t,
24
+ onChange: n,
25
+ width: 360,
26
+ placeholder: `Search ${e.agents.length} agents`,
27
+ style: { width: 280 },
28
+ children: t.size ? o : `All ${e.agents.length} agents`
29
+ })
30
+ }),
31
+ /* @__PURE__ */ (0, b.jsx)(S, {
32
+ m: e,
33
+ agents: r,
34
+ tools: a
35
+ }),
36
+ /* @__PURE__ */ (0, b.jsxs)("div", {
37
+ className: "rp-an-g",
38
+ children: [
39
+ /* @__PURE__ */ (0, b.jsx)(k, {
40
+ m: e,
41
+ agents: r,
42
+ tools: a
43
+ }),
44
+ /* @__PURE__ */ (0, b.jsx)(j, {
45
+ m: e,
46
+ agents: r
47
+ }),
48
+ /* @__PURE__ */ (0, b.jsx)(N, {
49
+ m: e,
50
+ agents: r
51
+ }),
52
+ /* @__PURE__ */ (0, b.jsx)(P, {
53
+ m: e,
54
+ agents: r,
55
+ tools: a
56
+ }),
57
+ /* @__PURE__ */ (0, b.jsx)(I, {
58
+ m: e,
59
+ agents: r,
60
+ tools: a
61
+ })
62
+ ]
63
+ })
64
+ ]
65
+ });
66
+ }
67
+ function S({ m: e, agents: t, tools: n }) {
68
+ let r = (e) => t.reduce((t, n) => t + (e(n) ?? 0), 0), i = t.length === e.agents.length, o = i ? e.totals.tokens : t.every((e) => e.tokens !== null) ? r((e) => e.tokens) : null, c = t.reduce((e, t) => t.byClass ? {
69
+ input: e.input + t.byClass.input,
70
+ output: e.output + t.byClass.output,
71
+ cacheRead: e.cacheRead + t.byClass.cacheRead
72
+ } : e, {
73
+ input: 0,
74
+ output: 0,
75
+ cacheRead: 0
76
+ }), l = t.every((e) => e.modelCalls !== null) ? r((e) => e.modelCalls) : null, u = t.every((e) => e.toolCalls !== null) ? r((e) => e.toolCalls) : null, f = r((e) => e.toolFailures), p = i ? e.totals.billedUsd : t.every((e) => e.billedUsd !== null) ? r((e) => e.billedUsd) : null, m = i ? e.totals.listUsd : t.every((e) => e.listUsd !== null) ? r((e) => e.listUsd) : null, h = [
77
+ [d(o), c.input + c.output + c.cacheRead ? `in ${d(c.input)} · out ${d(c.output)} · cached ${d(c.cacheRead)}` : "tokens"],
78
+ [s(l), "model calls"],
79
+ [s(u), `tool calls · ${n.length} tools`],
80
+ [s(f), `tool failures · ${u === null ? "—" : u ? (f / u * 100).toFixed(1) : "0"}%`],
81
+ [s(r((e) => e.retries)), "retried steps"],
82
+ [s(r((e) => e.restarts.length)), "restarts"],
83
+ [v(r((e) => e.busy)), `busy of ${v(e.duration)}`],
84
+ [a(m === null ? p : m), m === null ? "billed" : `list · ${a(p)} billed`]
85
+ ];
86
+ return /* @__PURE__ */ (0, b.jsx)("section", {
87
+ className: "rp-card rp-kpis",
88
+ "aria-label": "Totals",
89
+ children: h.map(([e, t]) => /* @__PURE__ */ (0, b.jsxs)("div", { children: [/* @__PURE__ */ (0, b.jsx)("b", { children: e }), /* @__PURE__ */ (0, b.jsx)("span", {
90
+ title: t,
91
+ children: t
92
+ })] }, t))
93
+ });
94
+ }
95
+ var C = 232, w = 76, T = 88, E = 14;
96
+ function D(e) {
97
+ let [t, n] = (0, y.useState)(0), r = Math.min(t, Math.max(0, Math.ceil(e.length / E) - 1)), i = r * E;
98
+ return {
99
+ rows: e.slice(i, i + E),
100
+ controls: e.length > E ? /* @__PURE__ */ (0, b.jsxs)("nav", {
101
+ className: "rp-more-row",
102
+ "aria-label": "Agent pages",
103
+ style: {
104
+ display: "flex",
105
+ justifyContent: "space-between",
106
+ alignItems: "center"
107
+ },
108
+ children: [
109
+ /* @__PURE__ */ (0, b.jsx)("button", {
110
+ className: "rp-link",
111
+ type: "button",
112
+ disabled: !r,
113
+ onClick: () => n(r - 1),
114
+ children: "Previous"
115
+ }),
116
+ /* @__PURE__ */ (0, b.jsxs)("span", { children: [
117
+ i + 1,
118
+ "–",
119
+ Math.min(i + E, e.length),
120
+ " of ",
121
+ e.length
122
+ ] }),
123
+ /* @__PURE__ */ (0, b.jsx)("button", {
124
+ className: "rp-link",
125
+ type: "button",
126
+ disabled: i + E >= e.length,
127
+ onClick: () => n(r + 1),
128
+ children: "Next"
129
+ })
130
+ ]
131
+ }) : null
132
+ };
133
+ }
134
+ function O() {
135
+ let e = (0, y.useRef)(null), [t, n] = (0, y.useState)({
136
+ w: 0,
137
+ h: 0
138
+ });
139
+ return (0, y.useLayoutEffect)(() => {
140
+ let t = e.current;
141
+ if (!t) return;
142
+ let r = () => n({
143
+ w: t.clientWidth,
144
+ h: t.clientHeight
145
+ }), i = new ResizeObserver(r);
146
+ return i.observe(t), r(), () => i.disconnect();
147
+ }, []), [e, t];
148
+ }
149
+ function k({ m: e, agents: t, tools: n }) {
150
+ let [i, a] = (0, y.useState)("calls"), u = c(), d = l(), [f, { w: m }] = O(), h = (0, y.useMemo)(() => {
151
+ let e = t.filter((e) => (e.toolCalls ?? 0) > 0), n = i === "calls" ? (e) => -(e.toolCalls ?? 0) : i === "fails" ? (e) => -e.toolFailures * 1e6 - (e.toolCalls ?? 0) : null;
152
+ return n ? [...e].sort((e, t) => n(e) - n(t)) : [...e].sort((e, t) => e.name.localeCompare(t.name));
153
+ }, [t, i]), g = D(h), _ = d ? 120 : C, x = Math.floor(((m || 1e4) - 32 - _ - T) / w), S = n.length <= x ? n.length : Math.max(0, x - 1), E = n.slice(0, S), k = n.slice(S), A = Math.max(1, ...h.flatMap((e) => e.tools.map((e) => e.calls))), j = Math.max(1, ...h.map((e) => e.toolCalls ?? 0)), M = (e) => e ? `color-mix(in oklab, var(--rp-tool) ${Math.round(14 + 86 * Math.sqrt(e / A))}%, hsl(var(--hsl-card)))` : void 0, N = (e) => e && Math.sqrt(e / A) > .55 ? "on" : "", P = { gridTemplateColumns: `minmax(${_}px, 2fr) repeat(${E.length + +!!k.length}, minmax(${d ? 64 : w}px, 1fr)) ${T}px` }, F = (e, t, n, r) => u.show({
154
+ rect: r.getBoundingClientRect(),
155
+ wide: !1,
156
+ content: /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [/* @__PURE__ */ (0, b.jsxs)("div", {
157
+ className: "rp-card-h",
158
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
159
+ className: "t",
160
+ children: [
161
+ /* @__PURE__ */ (0, b.jsx)(p, { tone: e.state.tone }),
162
+ /* @__PURE__ */ (0, b.jsx)("span", {
163
+ className: "nm",
164
+ children: e.name
165
+ }),
166
+ /* @__PURE__ */ (0, b.jsx)("span", {
167
+ className: "v",
168
+ children: n
169
+ })
170
+ ]
171
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
172
+ className: "s",
173
+ children: t ? `${s(t.calls)} calls · ${v(t.ms)} in all` : "no calls"
174
+ })]
175
+ }), t && /* @__PURE__ */ (0, b.jsx)("div", {
176
+ className: "rp-card-cols",
177
+ children: /* @__PURE__ */ (0, b.jsx)("section", { children: /* @__PURE__ */ (0, b.jsxs)("dl", { children: [
178
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Calls" }),
179
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: s(t.calls) }),
180
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Failed" }),
181
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: t.failures ? /* @__PURE__ */ (0, b.jsxs)("span", {
182
+ className: "f",
183
+ children: [
184
+ t.failures,
185
+ " ✕ · ",
186
+ (t.failures / t.calls * 100).toFixed(0),
187
+ "%"
188
+ ]
189
+ }) : "0" }),
190
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "p50 · p90 · p99" }),
191
+ /* @__PURE__ */ (0, b.jsxs)("dd", { children: [
192
+ o(t.p50),
193
+ " · ",
194
+ o(t.p90),
195
+ " · ",
196
+ o(t.p99)
197
+ ] }),
198
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Share of its tool calls" }),
199
+ /* @__PURE__ */ (0, b.jsxs)("dd", { children: [(t.calls / Math.max(1, e.toolCalls ?? 0) * 100).toFixed(0), "%"] })
200
+ ] }) })
201
+ })] })
202
+ });
203
+ return /* @__PURE__ */ (0, b.jsxs)("section", {
204
+ className: "rp-card w7",
205
+ "aria-label": "Tool calls by agent and tool",
206
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
207
+ className: "rp-hd sm",
208
+ children: [/* @__PURE__ */ (0, b.jsxs)("h3", { children: ["Tool calls by agent and tool", /* @__PURE__ */ (0, b.jsxs)("span", {
209
+ className: "ct",
210
+ children: [
211
+ h.length,
212
+ " agents · ",
213
+ n.length,
214
+ " tools"
215
+ ]
216
+ })] }), /* @__PURE__ */ (0, b.jsx)("span", {
217
+ className: "end",
218
+ children: /* @__PURE__ */ (0, b.jsx)(r, {
219
+ "aria-label": "Sort",
220
+ value: i,
221
+ onValueChange: a,
222
+ options: [
223
+ {
224
+ value: "calls",
225
+ label: "By calls"
226
+ },
227
+ {
228
+ value: "fails",
229
+ label: "By failures"
230
+ },
231
+ {
232
+ value: "name",
233
+ label: "By name"
234
+ }
235
+ ]
236
+ })
237
+ })]
238
+ }), /* @__PURE__ */ (0, b.jsxs)("div", {
239
+ className: "rp-chart",
240
+ children: [
241
+ /* @__PURE__ */ (0, b.jsx)("div", {
242
+ className: "rp-hm-wrap",
243
+ ref: f,
244
+ children: /* @__PURE__ */ (0, b.jsxs)("div", {
245
+ className: "rp-hm",
246
+ style: P,
247
+ children: [
248
+ /* @__PURE__ */ (0, b.jsx)("span", { className: "ch c0" }),
249
+ E.map((e) => /* @__PURE__ */ (0, b.jsx)("span", {
250
+ className: "ch",
251
+ title: e.name,
252
+ children: /* @__PURE__ */ (0, b.jsx)("span", { children: e.name.replace(/^agent-runtime-coordination_/, "").replaceAll("_", " ") })
253
+ }, e.name)),
254
+ k.length > 0 && /* @__PURE__ */ (0, b.jsx)("span", {
255
+ className: "ch",
256
+ title: k.map((e) => e.name).join(", "),
257
+ children: /* @__PURE__ */ (0, b.jsx)("span", { children: E.length ? `${k.length} more` : `${k.length} tools` })
258
+ }),
259
+ /* @__PURE__ */ (0, b.jsx)("span", {
260
+ className: "ch tot",
261
+ children: "Total"
262
+ }),
263
+ g.rows.map((e) => {
264
+ let t = new Map(e.tools.map((e) => [e.name, e])), n = e.tools.filter((e) => !E.some((t) => t.name === e.name)), r = n.reduce((e, t) => e + t.calls, 0), i = n.reduce((e, t) => e + t.failures, 0);
265
+ return [
266
+ /* @__PURE__ */ (0, b.jsxs)("span", {
267
+ className: "rh",
268
+ title: e.name,
269
+ children: [/* @__PURE__ */ (0, b.jsx)(p, { tone: e.state.tone }), /* @__PURE__ */ (0, b.jsx)("span", {
270
+ className: "nm",
271
+ children: e.name
272
+ })]
273
+ }, `${e.id}:n`),
274
+ ...E.map((n) => {
275
+ let r = t.get(n.name), i = r?.calls ?? 0;
276
+ return /* @__PURE__ */ (0, b.jsxs)("span", {
277
+ className: `c${i ? "" : " z"} ${N(i)}`,
278
+ style: { background: M(i) },
279
+ tabIndex: i ? 0 : -1,
280
+ onPointerEnter: (t) => F(e, r ?? null, n.name, t.currentTarget),
281
+ onPointerLeave: () => u.hide(),
282
+ onFocus: (t) => F(e, r ?? null, n.name, t.currentTarget),
283
+ onBlur: () => u.hide(),
284
+ children: [i ? s(i) : "", r?.failures ? /* @__PURE__ */ (0, b.jsxs)("span", {
285
+ className: "xf",
286
+ children: ["✕", r.failures]
287
+ }) : null]
288
+ }, `${e.id}:${n.name}`);
289
+ }),
290
+ ...k.length ? [/* @__PURE__ */ (0, b.jsxs)("span", {
291
+ className: `c${r ? "" : " z"} ${N(r)}`,
292
+ style: { background: M(r) },
293
+ children: [r ? s(r) : "", i ? /* @__PURE__ */ (0, b.jsxs)("span", {
294
+ className: "xf",
295
+ children: ["✕", i]
296
+ }) : null]
297
+ }, `${e.id}:rest`)] : [],
298
+ /* @__PURE__ */ (0, b.jsxs)("span", {
299
+ className: "tot",
300
+ children: [/* @__PURE__ */ (0, b.jsx)("b", { style: { width: `${(e.toolCalls ?? 0) / j * 56}px` } }), s(e.toolCalls)]
301
+ }, `${e.id}:t`)
302
+ ];
303
+ })
304
+ ]
305
+ })
306
+ }),
307
+ g.controls,
308
+ /* @__PURE__ */ (0, b.jsxs)("div", {
309
+ className: "rp-hm-foot",
310
+ children: [
311
+ /* @__PURE__ */ (0, b.jsxs)("span", {
312
+ className: "ramp",
313
+ children: [
314
+ /* @__PURE__ */ (0, b.jsx)("span", { children: "1" }),
315
+ /* @__PURE__ */ (0, b.jsx)("i", {}),
316
+ /* @__PURE__ */ (0, b.jsx)("span", { children: s(A) })
317
+ ]
318
+ }),
319
+ /* @__PURE__ */ (0, b.jsxs)("span", { children: [/* @__PURE__ */ (0, b.jsx)("span", {
320
+ className: "x",
321
+ children: "✕"
322
+ }), " failed calls in the cell"] }),
323
+ t.some((e) => e.toolCalls === 0) && /* @__PURE__ */ (0, b.jsxs)("span", {
324
+ className: "end",
325
+ children: [t.filter((e) => e.toolCalls === 0).length, " agents made no tool calls"]
326
+ })
327
+ ]
328
+ })
329
+ ]
330
+ })]
331
+ });
332
+ }
333
+ var A = [
334
+ 6e4,
335
+ 12e4,
336
+ 3e5,
337
+ 6e5,
338
+ 9e5,
339
+ 18e5,
340
+ 36e5,
341
+ 72e5
342
+ ];
343
+ function j({ m: e, agents: t }) {
344
+ let [n, i] = (0, y.useState)("calls"), a = c(), o = (0, y.useMemo)(() => t.flatMap((e) => e.steps.filter((e) => e.kind !== "waiting")), [t]), l = o.length ? Math.min(...o.map((e) => e.t)) : 0, u = o.length ? Math.max(...o.map((e) => e.t + e.d)) : 1, f = A.find((e) => (u - l) / e <= 36) ?? 144e5, p = Math.floor((e.t0 + l) / f) * f - e.t0, m = Math.max(1, Math.ceil((u - p) / f)), h = (0, y.useMemo)(() => {
345
+ let e = Array.from({ length: m }, () => ({
346
+ model: 0,
347
+ tool: 0,
348
+ failed: 0,
349
+ tokens: 0
350
+ }));
351
+ for (let t of o) {
352
+ let n = e[Math.min(m - 1, Math.floor((t.t - p) / f))];
353
+ t.kind === "model" ? n.model++ : n.tool++, t.failed && n.failed++, t.tokens && (n.tokens += t.tokens.input + t.tokens.output + t.tokens.cacheRead);
354
+ }
355
+ return e;
356
+ }, [
357
+ o,
358
+ m,
359
+ p,
360
+ f
361
+ ]), _ = (0, y.useMemo)(() => new Set(h.map((e, t) => [e.failed, t]).filter(([e]) => e > 0).sort((e, t) => t[0] - e[0]).slice(0, 3).map(([, e]) => e)), [h]), v = (e) => n === "calls" ? e.model + e.tool : e.tokens, x = Math.max(1, ...h.map(v)), [S, C] = O(), w = C.w || 600, T = C.h || 240, E = (w - 40) / m, D = M(x), k = (e) => T - 24 - e / D * (T - 24 - 18), j = g(e.t0), N = f === 6e4 ? "minute" : f === 36e5 ? "hour" : f > 36e5 ? `${f / 36e5} h` : `${f / 6e4} min`, P = [
362
+ 1,
363
+ 2,
364
+ 3,
365
+ 4,
366
+ 6,
367
+ 12,
368
+ 24
369
+ ].find((e) => m / e <= 7) ?? Math.ceil(m / 6), F = (t) => Math.round((e.t0 + p + t * f) / f) % P === 0;
370
+ return /* @__PURE__ */ (0, b.jsxs)("section", {
371
+ className: "rp-card w5",
372
+ "aria-label": n === "calls" ? "Calls over time" : "Tokens over time",
373
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
374
+ className: "rp-hd sm",
375
+ children: [/* @__PURE__ */ (0, b.jsx)("h3", { children: n === "calls" ? `Calls per ${N}` : `Metered tokens per ${N}` }), /* @__PURE__ */ (0, b.jsx)("span", {
376
+ className: "end",
377
+ children: /* @__PURE__ */ (0, b.jsx)(r, {
378
+ "aria-label": "Measure",
379
+ value: n,
380
+ onValueChange: i,
381
+ options: [{
382
+ value: "calls",
383
+ label: "Calls"
384
+ }, {
385
+ value: "tokens",
386
+ label: "Tokens"
387
+ }]
388
+ })
389
+ })]
390
+ }), /* @__PURE__ */ (0, b.jsxs)("div", {
391
+ className: "rp-chart",
392
+ children: [/* @__PURE__ */ (0, b.jsx)("div", {
393
+ className: "rp-legend sm",
394
+ children: n === "calls" ? /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [
395
+ /* @__PURE__ */ (0, b.jsxs)("span", {
396
+ className: "rp-key",
397
+ children: [/* @__PURE__ */ (0, b.jsx)("i", { className: "model" }), "Model call"]
398
+ }),
399
+ /* @__PURE__ */ (0, b.jsxs)("span", {
400
+ className: "rp-key",
401
+ children: [/* @__PURE__ */ (0, b.jsx)("i", { className: "tool" }), "Tool call"]
402
+ }),
403
+ /* @__PURE__ */ (0, b.jsxs)("span", {
404
+ className: "rp-key",
405
+ children: [/* @__PURE__ */ (0, b.jsx)("i", { className: "fail" }), "Failed"]
406
+ })
407
+ ] }) : /* @__PURE__ */ (0, b.jsxs)("span", {
408
+ className: "rp-key",
409
+ children: [/* @__PURE__ */ (0, b.jsx)("i", { className: "model" }), "Tokens on calls that recorded them"]
410
+ })
411
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
412
+ className: "rp-cpm-box",
413
+ ref: S,
414
+ children: /* @__PURE__ */ (0, b.jsxs)("svg", {
415
+ className: "rp-cpm",
416
+ viewBox: `0 0 ${w} ${T}`,
417
+ role: "img",
418
+ "aria-label": `${n} per ${N}, peak ${s(x)}`,
419
+ children: [[
420
+ 0,
421
+ .5,
422
+ 1
423
+ ].map((e) => /* @__PURE__ */ (0, b.jsxs)("g", { children: [/* @__PURE__ */ (0, b.jsx)("line", {
424
+ x1: 40,
425
+ x2: w,
426
+ y1: k(D * e),
427
+ y2: k(D * e),
428
+ className: "grid"
429
+ }), /* @__PURE__ */ (0, b.jsx)("text", {
430
+ x: 34,
431
+ y: k(D * e) + 4,
432
+ textAnchor: "end",
433
+ children: n === "calls" ? s(Math.round(D * e)) : d(D * e)
434
+ })] }, e)), h.map((e, t) => {
435
+ let r = 40 + t * E + 1, i = Math.max(1, E - 2), o = n === "calls" ? e.model / D * (T - 24 - 18) : e.tokens / D * (T - 24 - 18), c = n === "calls" ? e.tool / D * (T - 24 - 18) : 0, l = n === "calls" ? Math.min(o + c, e.failed / D * (T - 24 - 18)) : 0, u = (n) => a.show({
436
+ rect: n.currentTarget.getBoundingClientRect(),
437
+ content: /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [/* @__PURE__ */ (0, b.jsx)("div", {
438
+ className: "rp-card-h",
439
+ children: /* @__PURE__ */ (0, b.jsx)("div", {
440
+ className: "t",
441
+ children: /* @__PURE__ */ (0, b.jsxs)("span", {
442
+ className: "nm",
443
+ children: [
444
+ j(p + t * f),
445
+ "–",
446
+ j(p + (t + 1) * f),
447
+ " UTC"
448
+ ]
449
+ })
450
+ })
451
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
452
+ className: "rp-card-cols",
453
+ children: /* @__PURE__ */ (0, b.jsx)("section", { children: /* @__PURE__ */ (0, b.jsxs)("dl", { children: [
454
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Model calls" }),
455
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: s(e.model) }),
456
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Tool calls" }),
457
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: s(e.tool) }),
458
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Failed" }),
459
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: e.failed ? /* @__PURE__ */ (0, b.jsxs)("span", {
460
+ className: "f",
461
+ children: [e.failed, " ✕"]
462
+ }) : "0" }),
463
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Metered tokens" }),
464
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: e.tokens ? d(e.tokens) : "not recorded" })
465
+ ] }) })
466
+ })] })
467
+ });
468
+ return /* @__PURE__ */ (0, b.jsxs)("g", {
469
+ tabIndex: v(e) ? 0 : -1,
470
+ onPointerEnter: u,
471
+ onPointerLeave: () => a.hide(),
472
+ onFocus: u,
473
+ onBlur: () => a.hide(),
474
+ children: [
475
+ /* @__PURE__ */ (0, b.jsx)("rect", {
476
+ x: 40 + t * E,
477
+ y: 18,
478
+ width: E,
479
+ height: T - 24 - 18,
480
+ className: "hit"
481
+ }),
482
+ o > 0 && /* @__PURE__ */ (0, b.jsx)("rect", {
483
+ x: r,
484
+ y: T - 24 - o,
485
+ width: i,
486
+ height: o,
487
+ rx: Math.min(2, i / 2),
488
+ className: "model"
489
+ }),
490
+ c > 0 && /* @__PURE__ */ (0, b.jsx)("rect", {
491
+ x: r,
492
+ y: T - 24 - o - c - (o > 0 ? 1.5 : 0),
493
+ width: i,
494
+ height: c,
495
+ rx: Math.min(2, i / 2),
496
+ className: "tool"
497
+ }),
498
+ l > 0 && /* @__PURE__ */ (0, b.jsx)("rect", {
499
+ x: r,
500
+ y: T - 24 - Math.max(1.5, l),
501
+ width: i,
502
+ height: Math.max(1.5, l),
503
+ className: "fail"
504
+ }),
505
+ _.has(t) && n === "calls" && /* @__PURE__ */ (0, b.jsxs)("text", {
506
+ x: r + i / 2,
507
+ y: T - 24 - o - c - 6,
508
+ textAnchor: "middle",
509
+ className: "xf",
510
+ children: ["✕", e.failed]
511
+ }),
512
+ F(t) && /* @__PURE__ */ (0, b.jsx)("text", {
513
+ x: r + i / 2,
514
+ y: T - 6,
515
+ textAnchor: "middle",
516
+ children: j(p + t * f)
517
+ })
518
+ ]
519
+ }, t);
520
+ })]
521
+ })
522
+ })]
523
+ })]
524
+ });
525
+ }
526
+ function M(e) {
527
+ let t = 10 ** Math.floor(Math.log10(Math.max(1, e)));
528
+ return [
529
+ 1,
530
+ 2,
531
+ 2.5,
532
+ 5,
533
+ 10
534
+ ].map((e) => e * t).find((t) => t >= e) ?? e;
535
+ }
536
+ function N({ m: e, agents: t }) {
537
+ let [n, r] = (0, y.useState)({
538
+ k: "tokens",
539
+ d: -1
540
+ }), i = c(), o = (e) => ({
541
+ tokens: e.tokens ?? -1,
542
+ model: e.modelCalls ?? -1,
543
+ tool: e.toolCalls ?? -1,
544
+ failed: e.failedSteps,
545
+ restarts: e.restarts.length,
546
+ spawns: e.children.length,
547
+ cost: e.listUsd ?? e.billedUsd ?? -1,
548
+ name: e.name
549
+ })[n.k], l = (0, y.useMemo)(() => [...t].sort((e, t) => {
550
+ let r = o(e), i = o(t);
551
+ return (typeof r == "string" ? r.localeCompare(i) : r - i) * n.d;
552
+ }), [t, n]), u = D(l), f = Math.max(1, ...t.map((e) => e.tokens ?? 0)), p = [
553
+ "failed",
554
+ "restarts",
555
+ "spawns"
556
+ ].filter((e) => t.some((t) => (e === "failed" ? t.failedSteps : e === "restarts" ? t.restarts.length : t.children.length) > 0)), h = { gridTemplateColumns: `minmax(96px, 1fr) 112px 52px 44px ${p.map((e) => e === "restarts" ? "72px" : e === "spawns" ? "64px" : "56px").join(" ")} 64px` }, g = (e, t, i = "") => /* @__PURE__ */ (0, b.jsx)("span", {
557
+ role: "columnheader",
558
+ className: i,
559
+ "aria-sort": n.k === e ? n.d < 0 ? "descending" : "ascending" : void 0,
560
+ children: /* @__PURE__ */ (0, b.jsxs)("button", {
561
+ type: "button",
562
+ onClick: () => r((t) => ({
563
+ k: e,
564
+ d: t.k === e ? t.d === 1 ? -1 : 1 : e === "name" ? 1 : -1
565
+ })),
566
+ children: [t, n.k === e ? n.d < 0 ? " ↓" : " ↑" : ""]
567
+ })
568
+ }, e);
569
+ return /* @__PURE__ */ (0, b.jsxs)("section", {
570
+ className: "rp-card w5",
571
+ "aria-label": "Agents",
572
+ children: [
573
+ /* @__PURE__ */ (0, b.jsx)("div", {
574
+ className: "rp-hd sm",
575
+ children: /* @__PURE__ */ (0, b.jsxs)("h3", { children: ["Agents", /* @__PURE__ */ (0, b.jsx)("span", {
576
+ className: "ct",
577
+ children: t.length
578
+ })] })
579
+ }),
580
+ /* @__PURE__ */ (0, b.jsxs)("div", {
581
+ className: "rp-at-wrap",
582
+ role: "table",
583
+ "aria-label": "Agents",
584
+ "aria-rowcount": l.length,
585
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
586
+ className: "rp-at th",
587
+ role: "row",
588
+ style: h,
589
+ children: [
590
+ g("name", "Agent"),
591
+ g("tokens", "Tokens", "tk"),
592
+ g("model", "Model", "r"),
593
+ g("tool", "Tool", "r"),
594
+ p.map((e) => g(e, {
595
+ failed: "Failed",
596
+ restarts: "Restarts",
597
+ spawns: "Spawns"
598
+ }[e], "r")),
599
+ g("cost", "Cost", "r")
600
+ ]
601
+ }), u.rows.map((t) => /* @__PURE__ */ (0, b.jsxs)("div", {
602
+ className: "rp-at",
603
+ role: "row",
604
+ tabIndex: 0,
605
+ style: h,
606
+ onPointerEnter: (n) => i.show({
607
+ content: /* @__PURE__ */ (0, b.jsx)(m, {
608
+ m: e,
609
+ a: t
610
+ }),
611
+ rect: n.currentTarget.getBoundingClientRect(),
612
+ wide: t.tools.length > 0
613
+ }),
614
+ onPointerLeave: () => i.hide(),
615
+ onFocus: (n) => i.show({
616
+ content: /* @__PURE__ */ (0, b.jsx)(m, {
617
+ m: e,
618
+ a: t
619
+ }),
620
+ rect: n.currentTarget.getBoundingClientRect(),
621
+ wide: t.tools.length > 0
622
+ }),
623
+ onBlur: () => i.hide(),
624
+ children: [
625
+ /* @__PURE__ */ (0, b.jsx)("span", {
626
+ className: "nm",
627
+ role: "cell",
628
+ title: t.name,
629
+ children: t.name
630
+ }),
631
+ /* @__PURE__ */ (0, b.jsxs)("span", {
632
+ className: "tk",
633
+ role: "cell",
634
+ children: [/* @__PURE__ */ (0, b.jsx)("b", { style: { width: `${(t.tokens ?? 0) / f * 48}px` } }), /* @__PURE__ */ (0, b.jsx)("span", { children: d(t.tokens) })]
635
+ }),
636
+ /* @__PURE__ */ (0, b.jsx)("span", {
637
+ className: "r",
638
+ role: "cell",
639
+ children: s(t.modelCalls)
640
+ }),
641
+ /* @__PURE__ */ (0, b.jsx)("span", {
642
+ className: "r",
643
+ role: "cell",
644
+ children: s(t.toolCalls)
645
+ }),
646
+ p.map((e) => /* @__PURE__ */ (0, b.jsx)("span", {
647
+ className: "r",
648
+ role: "cell",
649
+ children: (e === "failed" ? t.failedSteps : e === "restarts" ? t.restarts.length : t.children.length) || ""
650
+ }, e)),
651
+ /* @__PURE__ */ (0, b.jsx)("span", {
652
+ className: "r",
653
+ role: "cell",
654
+ children: t.listUsd === null ? t.billedUsd === null ? "—" : a(t.billedUsd) : a(t.listUsd)
655
+ })
656
+ ]
657
+ }, t.id))]
658
+ }),
659
+ u.controls
660
+ ]
661
+ });
662
+ }
663
+ function P({ m: e, agents: t, tools: n }) {
664
+ let [i, a] = (0, y.useState)("range"), l = c(), u = (0, y.useMemo)(() => {
665
+ let e = /* @__PURE__ */ new Map();
666
+ for (let n of t) for (let t of n.steps) if (t.kind === "model" && t.latency !== null) {
667
+ let r = t.model?.split("/").pop() ?? n.model ?? "model";
668
+ (e.get(r) ?? e.set(r, []).get(r)).push(t.latency);
669
+ }
670
+ return [...e].map(([e, t]) => ({
671
+ name: e,
672
+ model: !0,
673
+ calls: t.length,
674
+ values: t,
675
+ p50: _(t, 50),
676
+ p90: _(t, 90),
677
+ p99: _(t, 99)
678
+ }));
679
+ }, [t]), d = [...u, ...n.filter((e) => e.durations.length).slice(0, 9).map((e) => ({
680
+ name: e.name,
681
+ model: !1,
682
+ calls: e.calls,
683
+ values: e.durations,
684
+ p50: e.p50,
685
+ p90: e.p90,
686
+ p99: e.p99
687
+ }))], f = d.flatMap((e) => e.values).filter((e) => e > 0), p = Math.max(1e3, ...f) * 1.2, m = (e) => (Math.log10(Math.max(10, e)) - Math.log10(10)) / (Math.log10(p) - Math.log10(10)), h = [
688
+ 10,
689
+ 100,
690
+ 1e3,
691
+ 1e4,
692
+ 1e5,
693
+ 1e6
694
+ ].filter((e) => e <= p), g = (e, t) => l.show({
695
+ rect: t.getBoundingClientRect(),
696
+ content: /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [/* @__PURE__ */ (0, b.jsxs)("div", {
697
+ className: "rp-card-h",
698
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
699
+ className: "t",
700
+ children: [
701
+ /* @__PURE__ */ (0, b.jsx)("i", { className: `rp-sw ${e.model ? "model" : "tool"}` }),
702
+ /* @__PURE__ */ (0, b.jsx)("span", {
703
+ className: "nm",
704
+ children: e.name
705
+ }),
706
+ /* @__PURE__ */ (0, b.jsxs)("span", {
707
+ className: "v",
708
+ children: [s(e.calls), " calls"]
709
+ })
710
+ ]
711
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
712
+ className: "s",
713
+ children: e.model ? "model call latency" : "tool call duration"
714
+ })]
715
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
716
+ className: "rp-card-cols",
717
+ children: /* @__PURE__ */ (0, b.jsx)("section", { children: /* @__PURE__ */ (0, b.jsxs)("dl", { children: [
718
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "p50" }),
719
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: o(e.p50) }),
720
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "p90" }),
721
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: o(e.p90) }),
722
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "p99" }),
723
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: o(e.p99) }),
724
+ /* @__PURE__ */ (0, b.jsx)("dt", { children: "Max" }),
725
+ /* @__PURE__ */ (0, b.jsx)("dd", { children: o(Math.max(...e.values)) })
726
+ ] }) })
727
+ })] })
728
+ });
729
+ return /* @__PURE__ */ (0, b.jsxs)("section", {
730
+ className: "rp-card w4",
731
+ "aria-label": "Latency",
732
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
733
+ className: "rp-hd sm",
734
+ children: [/* @__PURE__ */ (0, b.jsx)("h3", { children: "Latency" }), /* @__PURE__ */ (0, b.jsx)("span", {
735
+ className: "end",
736
+ children: /* @__PURE__ */ (0, b.jsx)(r, {
737
+ "aria-label": "Latency view",
738
+ value: i,
739
+ onValueChange: a,
740
+ options: [{
741
+ value: "range",
742
+ label: "p50 · p90 · p99"
743
+ }, {
744
+ value: "dist",
745
+ label: "Distribution"
746
+ }]
747
+ })
748
+ })]
749
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
750
+ className: "rp-chart",
751
+ children: i === "range" ? /* @__PURE__ */ (0, b.jsxs)("div", {
752
+ className: "rp-lat",
753
+ children: [d.map((e) => /* @__PURE__ */ (0, b.jsxs)("div", {
754
+ className: "row",
755
+ tabIndex: 0,
756
+ onPointerEnter: (t) => g(e, t.currentTarget),
757
+ onPointerLeave: () => l.hide(),
758
+ onFocus: (t) => g(e, t.currentTarget),
759
+ onBlur: () => l.hide(),
760
+ children: [
761
+ /* @__PURE__ */ (0, b.jsx)("span", {
762
+ className: `l${e.model ? " model" : ""}`,
763
+ title: e.name,
764
+ children: e.name.replace(/^agent-runtime-coordination_/, "")
765
+ }),
766
+ /* @__PURE__ */ (0, b.jsxs)("svg", {
767
+ viewBox: "0 0 100 22",
768
+ preserveAspectRatio: "none",
769
+ "aria-hidden": "true",
770
+ children: [h.map((e) => /* @__PURE__ */ (0, b.jsx)("line", {
771
+ x1: m(e) * 100,
772
+ x2: m(e) * 100,
773
+ y1: "2",
774
+ y2: "20",
775
+ className: "grid"
776
+ }, e)), /* @__PURE__ */ (0, b.jsx)("line", {
777
+ x1: m(e.p50 ?? 10) * 100,
778
+ x2: m(e.p99 ?? 10) * 100,
779
+ y1: "11",
780
+ y2: "11",
781
+ className: e.model ? "model" : "tool"
782
+ })]
783
+ }),
784
+ /* @__PURE__ */ (0, b.jsxs)("span", {
785
+ className: "dots",
786
+ "aria-hidden": "true",
787
+ children: [
788
+ /* @__PURE__ */ (0, b.jsx)("i", {
789
+ className: `p50 ${e.model ? "model" : "tool"}`,
790
+ style: { left: `${m(e.p50 ?? 10) * 100}%` }
791
+ }),
792
+ /* @__PURE__ */ (0, b.jsx)("i", {
793
+ className: `p90 ${e.model ? "model" : "tool"}`,
794
+ style: { left: `${m(e.p90 ?? 10) * 100}%` }
795
+ }),
796
+ /* @__PURE__ */ (0, b.jsx)("i", {
797
+ className: `p99 ${e.model ? "model" : "tool"}`,
798
+ style: { left: `${m(e.p99 ?? 10) * 100}%` }
799
+ })
800
+ ]
801
+ }),
802
+ /* @__PURE__ */ (0, b.jsxs)("span", {
803
+ className: "v",
804
+ children: [
805
+ /* @__PURE__ */ (0, b.jsx)("b", { children: o(e.p50) }),
806
+ " · ",
807
+ o(e.p90),
808
+ " · ",
809
+ o(e.p99)
810
+ ]
811
+ })
812
+ ]
813
+ }, `${e.model}:${e.name}`)), /* @__PURE__ */ (0, b.jsxs)("div", {
814
+ className: "row axis",
815
+ children: [
816
+ /* @__PURE__ */ (0, b.jsx)("span", {}),
817
+ /* @__PURE__ */ (0, b.jsx)("span", {
818
+ className: "ax",
819
+ children: h.map((e) => /* @__PURE__ */ (0, b.jsx)("span", {
820
+ style: { left: `${m(e) * 100}%` },
821
+ children: o(e)
822
+ }, e))
823
+ }),
824
+ /* @__PURE__ */ (0, b.jsx)("span", {
825
+ className: "v dim",
826
+ children: "● p50 ○ p90 | p99"
827
+ })
828
+ ]
829
+ })]
830
+ }) : /* @__PURE__ */ (0, b.jsx)(F, {
831
+ rows: [{
832
+ name: "Model calls",
833
+ model: !0,
834
+ values: u.flatMap((e) => e.values)
835
+ }, {
836
+ name: "Tool calls",
837
+ model: !1,
838
+ values: n.flatMap((e) => e.durations)
839
+ }],
840
+ lo: 10,
841
+ hi: p
842
+ })
843
+ })]
844
+ });
845
+ }
846
+ function F({ rows: e, lo: t, hi: n }) {
847
+ let r = c(), i = [];
848
+ for (let e = Math.log10(t); e <= Math.log10(n) + 1e-9; e += 1 / 4) i.push(10 ** e);
849
+ let a = (e) => 34 + (Math.log10(Math.max(t, e)) - Math.log10(t)) / (Math.log10(n) - Math.log10(t)) * 366;
850
+ return /* @__PURE__ */ (0, b.jsx)("div", {
851
+ className: "rp-hist",
852
+ children: e.filter((e) => e.values.length).map((e) => {
853
+ let t = i.slice(0, -1).map((t, n) => ({
854
+ from: t,
855
+ to: i[n + 1],
856
+ n: e.values.filter((e) => e >= t && e < i[n + 1]).length
857
+ })), c = Math.max(1, ...t.map((e) => e.n)), l = [
858
+ ["p50", _(e.values, 50)],
859
+ ["p90", _(e.values, 90)],
860
+ ["p99", _(e.values, 99)]
861
+ ];
862
+ return /* @__PURE__ */ (0, b.jsxs)("figure", { children: [/* @__PURE__ */ (0, b.jsxs)("figcaption", { children: [
863
+ /* @__PURE__ */ (0, b.jsx)("i", { className: `rp-sw ${e.model ? "model" : "tool"}` }),
864
+ e.name,
865
+ /* @__PURE__ */ (0, b.jsx)("span", {
866
+ className: "ct",
867
+ children: s(e.values.length)
868
+ })
869
+ ] }), /* @__PURE__ */ (0, b.jsxs)("svg", {
870
+ viewBox: "0 0 400 114",
871
+ role: "img",
872
+ "aria-label": `${e.name} by duration`,
873
+ children: [
874
+ /* @__PURE__ */ (0, b.jsx)("text", {
875
+ x: 28,
876
+ y: 12,
877
+ textAnchor: "end",
878
+ children: c
879
+ }),
880
+ /* @__PURE__ */ (0, b.jsx)("text", {
881
+ x: 28,
882
+ y: 96,
883
+ textAnchor: "end",
884
+ children: "0"
885
+ }),
886
+ /* @__PURE__ */ (0, b.jsx)("line", {
887
+ x1: 34,
888
+ x2: 400,
889
+ y1: 96,
890
+ y2: 96,
891
+ className: "grid"
892
+ }),
893
+ t.map((t, n) => t.n ? /* @__PURE__ */ (0, b.jsx)("rect", {
894
+ x: a(t.from) + 1,
895
+ width: Math.max(1, a(t.to) - a(t.from) - 2),
896
+ y: 96 - t.n / c * 88,
897
+ height: t.n / c * 88,
898
+ rx: "1.5",
899
+ className: e.model ? "model" : "tool",
900
+ tabIndex: 0,
901
+ onPointerEnter: (n) => r.show({
902
+ rect: n.currentTarget.getBoundingClientRect(),
903
+ content: /* @__PURE__ */ (0, b.jsxs)("div", {
904
+ className: "rp-card-h",
905
+ children: [/* @__PURE__ */ (0, b.jsxs)("div", {
906
+ className: "t",
907
+ children: [/* @__PURE__ */ (0, b.jsxs)("span", {
908
+ className: "nm",
909
+ children: [
910
+ o(t.from),
911
+ "–",
912
+ o(t.to)
913
+ ]
914
+ }), /* @__PURE__ */ (0, b.jsxs)("span", {
915
+ className: "v",
916
+ children: [t.n, " calls"]
917
+ })]
918
+ }), /* @__PURE__ */ (0, b.jsxs)("div", {
919
+ className: "s",
920
+ children: [
921
+ (t.n / e.values.length * 100).toFixed(1),
922
+ "% of ",
923
+ e.name.toLowerCase()
924
+ ]
925
+ })]
926
+ })
927
+ }),
928
+ onPointerLeave: () => r.hide()
929
+ }, n) : null),
930
+ l.map(([e, t]) => t !== null && /* @__PURE__ */ (0, b.jsxs)("g", { children: [/* @__PURE__ */ (0, b.jsx)("line", {
931
+ x1: a(t),
932
+ x2: a(t),
933
+ y1: 4,
934
+ y2: 96,
935
+ className: "rule"
936
+ }), /* @__PURE__ */ (0, b.jsxs)("text", {
937
+ x: a(t) + 3,
938
+ y: 12,
939
+ className: "rl",
940
+ children: [
941
+ e,
942
+ " ",
943
+ o(t)
944
+ ]
945
+ })] }, e)),
946
+ [
947
+ 10,
948
+ 100,
949
+ 1e3,
950
+ 1e4,
951
+ 1e5
952
+ ].filter((e) => e <= n).map((e) => /* @__PURE__ */ (0, b.jsx)("text", {
953
+ x: a(e),
954
+ y: 110,
955
+ textAnchor: "middle",
956
+ children: o(e)
957
+ }, e))
958
+ ]
959
+ })] }, e.name);
960
+ })
961
+ });
962
+ }
963
+ function I({ agents: e, tools: t }) {
964
+ let n = t.filter((e) => e.failures).sort((e, t) => t.failures - e.failures || t.calls - e.calls), r = e.filter((e) => e.failedSteps).sort((e, t) => t.failedSteps - e.failedSteps), i = (e, t, n, r, i) => /* @__PURE__ */ (0, b.jsxs)("div", {
965
+ className: "row",
966
+ title: i,
967
+ children: [
968
+ /* @__PURE__ */ (0, b.jsx)("span", {
969
+ className: "l",
970
+ children: e
971
+ }),
972
+ /* @__PURE__ */ (0, b.jsx)("span", {
973
+ className: "track",
974
+ children: /* @__PURE__ */ (0, b.jsx)("b", { style: { width: `${t / Math.max(1, n) * 100}%` } })
975
+ }),
976
+ /* @__PURE__ */ (0, b.jsxs)("span", {
977
+ className: "n",
978
+ children: [
979
+ t,
980
+ " ",
981
+ /* @__PURE__ */ (0, b.jsxs)("small", { children: ["of ", s(n)] })
982
+ ]
983
+ })
984
+ ]
985
+ }, r);
986
+ return /* @__PURE__ */ (0, b.jsxs)("section", {
987
+ className: "rp-card w3",
988
+ "aria-label": "Failed steps",
989
+ children: [/* @__PURE__ */ (0, b.jsx)("div", {
990
+ className: "rp-hd sm",
991
+ children: /* @__PURE__ */ (0, b.jsx)("h3", { children: "Failed steps" })
992
+ }), /* @__PURE__ */ (0, b.jsx)("div", {
993
+ className: "rp-chart rp-fb",
994
+ children: !n.length && !r.length ? /* @__PURE__ */ (0, b.jsx)("p", {
995
+ className: "ws-status",
996
+ children: "No step failed."
997
+ }) : /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [n.length > 0 && /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [/* @__PURE__ */ (0, b.jsxs)("h5", { children: ["By tool · ", n.length] }), n.slice(0, 6).map((e) => i(e.name.replace(/^agent-runtime-coordination_/, ""), e.failures, e.calls, e.name, `${e.name}: ${e.failures} of ${e.calls} calls failed`))] }), r.length > 0 && /* @__PURE__ */ (0, b.jsxs)(b.Fragment, { children: [/* @__PURE__ */ (0, b.jsxs)("h5", { children: ["By agent · ", r.length] }), r.slice(0, 6).map((e) => i(e.name, e.failedSteps, e.steps.length, e.id, `${e.name}: ${e.failedSteps} of ${e.steps.length} steps failed`))] })] })
998
+ })]
999
+ });
1000
+ }
1001
+ //#endregion
1002
+ export { x as Analytics };