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