bazilion 0.55.0 → 0.56.0

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 (191) hide show
  1. package/dist/cli.js +192 -37
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1164 -412
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-DZ9mXFdq.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-BfG3a-ri.js +1 -0
  7. package/dist/web/client/assets/{Button-bTJUy9Qf.js → Button-CoKQRO-s.js} +1 -1
  8. package/dist/web/client/assets/ConfigPage-Ch-DSJUO.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-B_jXAPmh.js +1 -0
  10. package/dist/web/client/assets/ConnectionsView-D1Liebtf.js +1 -0
  11. package/dist/web/client/assets/ManagePage-kd7iWYEL.js +1 -0
  12. package/dist/web/client/assets/{SectionTabs-D7kPQGoh.js → SectionTabs-Dc0bNn-J.js} +1 -1
  13. package/dist/web/client/assets/{Segmented-oPkAHPO1.js → Segmented-iylzLwE6.js} +1 -1
  14. package/dist/web/client/assets/SkillsParts-C5T7sYDA.js +1 -0
  15. package/dist/web/client/assets/SpawnTeamModal-DatFF4f_.js +1 -0
  16. package/dist/web/client/assets/TeamForm-l-N_PYeE.js +1 -0
  17. package/dist/web/client/assets/TeamThread-BWmIQiAh.js +1 -0
  18. package/dist/web/client/assets/UnsavedChangesGuard-vQBdMl8h.js +1 -0
  19. package/dist/web/client/assets/_id-C6SADaiD.js +1 -0
  20. package/dist/web/client/assets/_id-CC9r0qsr.js +1 -0
  21. package/dist/web/client/assets/access-BbQFbTPh.js +1 -0
  22. package/dist/web/client/assets/{agent-actions-CUee6aJq.js → agent-actions-B-9KIwn6.js} +1 -1
  23. package/dist/web/client/assets/agents-BXwzmHu8.js +1 -0
  24. package/dist/web/client/assets/agents-BtETzVIY.js +1 -0
  25. package/dist/web/client/assets/arrow-right-BqqfPqVi.js +1 -0
  26. package/dist/web/client/assets/attention-BMrZJ9ui.js +1 -0
  27. package/dist/web/client/assets/{bot-BCone8es.js → bot-BHky7KAX.js} +1 -1
  28. package/dist/web/client/assets/chart-column-DTsDbzL0.js +1 -0
  29. package/dist/web/client/assets/chevron-right-D1shxvdo.js +1 -0
  30. package/dist/web/client/assets/config-B2ZDYo52.js +1 -0
  31. package/dist/web/client/assets/{createLucideIcon-jxSFpY0Q.js → createLucideIcon-CZHSSDYA.js} +1 -1
  32. package/dist/web/client/assets/{download-Dy88XavQ.js → download-Dr0PgyMr.js} +1 -1
  33. package/dist/web/client/assets/es2015-D1pnOGPG.js +41 -0
  34. package/dist/web/client/assets/{file-text-DPsZ8-h9.js → file-text-D6OTHixJ.js} +1 -1
  35. package/dist/web/client/assets/{images-QBh_rL8b.js → images-BULrW-FC.js} +1 -1
  36. package/dist/web/client/assets/index-B-N6NIX4.js +14 -0
  37. package/dist/web/client/assets/{key-round-C-I8fAG0.js → key-round-DmSZN0Kq.js} +1 -1
  38. package/dist/web/client/assets/{list-checks-C9Q-bjEi.js → list-checks-DdTdAQXS.js} +1 -1
  39. package/dist/web/client/assets/login-DM3q-V4R.js +1 -0
  40. package/dist/web/client/assets/{manage-BaIU5zKy.js → manage-R57MUzsY.js} +1 -1
  41. package/dist/web/client/assets/mcp-CSHrVH1t.js +1 -0
  42. package/dist/web/client/assets/{message-square-Bwf9cHOx.js → message-square-B_pULba_.js} +1 -1
  43. package/dist/web/client/assets/{network-B3FA93gC.js → network-BqmVqC4_.js} +1 -1
  44. package/dist/web/client/assets/parts-68zf8Fgw.js +1 -0
  45. package/dist/web/client/assets/plus-CEKaHPBw.js +1 -0
  46. package/dist/web/client/assets/preload-helper-CZOd_z6l.js +1 -0
  47. package/dist/web/client/assets/routes-DOoeKVwr.js +85 -0
  48. package/dist/web/client/assets/skills-CPZftp9O.js +1 -0
  49. package/dist/web/client/assets/{square-terminal-DaNLwvEs.js → square-terminal-CYfGBHPC.js} +1 -1
  50. package/dist/web/client/assets/style-Bm9QsFpy.js +7 -0
  51. package/dist/web/client/assets/styles-B-kTTvCo.css +2 -0
  52. package/dist/web/client/assets/{system-CrTSr5_t.js → system-Dd2P9eqE.js} +1 -1
  53. package/dist/web/client/assets/teams-7FEpSZg1.js +1 -0
  54. package/dist/web/client/assets/teams-ClirFbDV.js +1 -0
  55. package/dist/web/client/assets/telegram-BJnT5THs.js +1 -0
  56. package/dist/web/client/assets/tools-DqNXLMpc.js +1 -0
  57. package/dist/web/client/assets/usage-BC_TStVj.js +1 -0
  58. package/dist/web/client/assets/use-resource-Bn0Sx7r6.js +1 -0
  59. package/dist/web/client/assets/{users-round-BElBVSnw.js → users-round-cxQ5HF-C.js} +1 -1
  60. package/dist/web/client/assets/welcome-g8wtn_or.js +1 -0
  61. package/dist/web/client/assets/{wrench-DotqSqSm.js → wrench-BLEJjETg.js} +1 -1
  62. package/dist/web/server/assets/{AddProviderDialog-BbpuvC2a.js → AddProviderDialog-DtkjBMv4.js} +5 -2
  63. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +37 -0
  64. package/dist/web/server/assets/{AgentTemplateParts-Ce7snK3m.js → AgentTemplateParts-CxWyovvM.js} +6 -2
  65. package/dist/web/server/assets/Button-Dsnw22OF.js +17 -0
  66. package/dist/web/server/assets/{ConfigPage-qP9ejjuw.js → ConfigPage-usZi48Zr.js} +2 -2
  67. package/dist/web/server/assets/{ConfirmDialog-Z-uYbE9B.js → ConfirmDialog-DAcSBHkT.js} +3 -1
  68. package/dist/web/server/assets/{ConnectionsView-CLIV7V5D.js → ConnectionsView-Dy6uYSRI.js} +9 -7
  69. package/dist/web/server/assets/Dialog-DTeF-nOZ.js +85 -0
  70. package/dist/web/server/assets/{ManagePage-BR9FwVZM.js → ManagePage-Dy1EdovO.js} +2 -2
  71. package/dist/web/server/assets/{SectionTabs-CWQ5orUW.js → SectionTabs-BVrMn76H.js} +2 -1
  72. package/dist/web/server/assets/{SkillsParts-DWpdydCJ.js → SkillsParts-Cw05b3al.js} +6 -2
  73. package/dist/web/server/assets/SpawnDialog-BAE8W91z.js +125 -0
  74. package/dist/web/server/assets/{SpawnTeamModal-C-YMvoaB.js → SpawnTeamModal-CgBY0HuN.js} +6 -2
  75. package/dist/web/server/assets/{TeamForm-CL45gBdt.js → TeamForm-JyO5xJXX.js} +6 -2
  76. package/dist/web/server/assets/{TeamThread-CVVH6kKj.js → TeamThread-5o48EbXL.js} +52 -4
  77. package/dist/web/server/assets/{UnsavedChangesGuard-CXK75QQp.js → UnsavedChangesGuard-CJQGu45L.js} +1 -1
  78. package/dist/web/server/assets/{_id-8zsImuGa.js → _id-BE_RSvuN.js} +14 -9
  79. package/dist/web/server/assets/{_id-d2OwovYV.js → _id-BNvm89oJ.js} +2 -2
  80. package/dist/web/server/assets/{_id-De3Bm0SG.js → _id-BW6sVrvw.js} +1 -1
  81. package/dist/web/server/assets/{_id-2I4CSMQj.js → _id-BfjTS4JO.js} +15 -9
  82. package/dist/web/server/assets/{_id-BKzOw78O.js → _id-BpumuCYL.js} +1 -1
  83. package/dist/web/server/assets/{_id-BpfoPuTv.js → _id-C54t_nX6.js} +2 -2
  84. package/dist/web/server/assets/_tanstack-start-manifest_v-BPwQX_5b.js +275 -0
  85. package/dist/web/server/assets/{access-CwZ27Wsl.js → access-6FWih7nC.js} +7 -4
  86. package/dist/web/server/assets/{access-WWspT0v4.js → access-BhAMfi7U.js} +1 -1
  87. package/dist/web/server/assets/{access-CyUoElTP.js → access-DEyq3uP_.js} +2 -2
  88. package/dist/web/server/assets/activity-Czfq-5_F.js +471 -0
  89. package/dist/web/server/assets/{agent-actions-C07Cp5Ue.js → agent-actions-ChH7Mne4.js} +1 -1
  90. package/dist/web/server/assets/{agents-CRtMfKqX.js → agents-3hBjrd8B.js} +1 -1
  91. package/dist/web/server/assets/{agents-vuXrAv1j.js → agents-BXuglv4G.js} +12 -6
  92. package/dist/web/server/assets/{agents-DTub-rJk.js → agents-DhenbitX.js} +2 -2
  93. package/dist/web/server/assets/{agents-CwzhpDPm.js → agents-KJcDMj0Y.js} +9 -6
  94. package/dist/web/server/assets/{agents-DCWEoaxY.js → agents-ncyhVx-T.js} +2 -2
  95. package/dist/web/server/assets/{agents-DQowl6Ly.js → agents-rTDlRZa5.js} +1 -1
  96. package/dist/web/server/assets/{attention-BqCnJ1hg.js → attention-CDdOCOio.js} +2 -2
  97. package/dist/web/server/assets/{attention-DwGaur_w.js → attention-DM__BzWY.js} +8 -6
  98. package/dist/web/server/assets/{attention-Dki8rmGZ.js → attention-X0U6ZmiA.js} +1 -1
  99. package/dist/web/server/assets/{auth-dJnrFW6y.js → auth-BexhV8Yq.js} +1 -1
  100. package/dist/web/server/assets/{config-B9dJiji_.js → config-Cld8Q8N7.js} +2 -2
  101. package/dist/web/server/assets/{config-X7qWbbpH.js → config-Cx5ri2DL2.js} +1 -1
  102. package/dist/web/server/assets/{config-D3MR2VjE.js → config-DpgYAXQ3.js} +9 -6
  103. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +16 -0
  104. package/dist/web/server/assets/{daemon-client-B_ZRIIrT.js → daemon-client-RxAllljf.js} +1 -1
  105. package/dist/web/server/assets/form-BEjeiSy3.js +416 -0
  106. package/dist/web/server/assets/live-DbJeq6KP.js +263 -0
  107. package/dist/web/server/assets/{login-CRd1yTH5.js → login-BJdJ219n.js} +1 -1
  108. package/dist/web/server/assets/{login-ZN6KV8n-.js → login-C4lL4AxI.js} +2 -2
  109. package/dist/web/server/assets/{manage-Ce6cI4eW.js → manage-C6ucNYZW.js} +2 -1
  110. package/dist/web/server/assets/{mcp-BQ15a9dG.js → mcp-BXnWQOwM.js} +7 -4
  111. package/dist/web/server/assets/{mcp-C97uAZe1.js → mcp-C8VLspco.js} +1 -1
  112. package/dist/web/server/assets/{mcp-CYQuYWGX.js → mcp-DwCzj7eO.js} +2 -2
  113. package/dist/web/server/assets/open-groups-BMGYUTtY.js +12 -0
  114. package/dist/web/server/assets/{page-title-CVY-c2Pd.js → page-title-PTpFHXWo.js} +1 -1
  115. package/dist/web/server/assets/parts-k9M-atPa.js +436 -0
  116. package/dist/web/server/assets/{router-CPdWGKQ5.js → router-BttfLktO.js} +185 -77
  117. package/dist/web/server/assets/{routes-BPloBDc8.js → routes-A7UcreVX.js} +3 -3
  118. package/dist/web/server/assets/{routes-Dw1K3TQw.js → routes-B9jw-MJ8.js} +1175 -321
  119. package/dist/web/server/assets/{routes-xDPesCQu.js → routes-BX2FV8rS.js} +3 -3
  120. package/dist/web/server/assets/{skills-D0xrNc2_.js → skills-BVAH93cd.js} +8 -6
  121. package/dist/web/server/assets/{skills-DWzlT_hC.js → skills-Cd5Cfdaz.js} +1 -1
  122. package/dist/web/server/assets/{skills-6VSpEORe.js → skills-y3GsyKce.js} +2 -2
  123. package/dist/web/server/assets/src-vrZVrV9u.js +103 -0
  124. package/dist/web/server/assets/{start-DhW7sy23.js → start-Dl8gQ-95.js} +1 -1
  125. package/dist/web/server/assets/{style-aMybyKzc.js → style-BQ3H9I7Y.js} +1 -1
  126. package/dist/web/server/assets/{system-B5sPgdQW.js → system-BJPKqM6b.js} +2 -2
  127. package/dist/web/server/assets/{system-CXmiWyDG.js → system-C7mejQSc.js} +3 -3
  128. package/dist/web/server/assets/{system-D3th6n2E.js → system-LsLcuVzY.js} +1 -1
  129. package/dist/web/server/assets/{teams-yF3I_Zjq.js → teams-B6gbflsZ.js} +10 -6
  130. package/dist/web/server/assets/{teams-iXiCnN2i.js → teams-C7kXMNgc.js} +10 -6
  131. package/dist/web/server/assets/{teams-BopOP4x7.js → teams-CPXoTggb.js} +1 -1
  132. package/dist/web/server/assets/{teams-70u1XQTr.js → teams-CeLLd2Mf.js} +1 -1
  133. package/dist/web/server/assets/{teams-ClRBVSYU.js → teams-CiX8LUQo.js} +2 -2
  134. package/dist/web/server/assets/{teams-Dq4RCxis.js → teams-D-XdIkCr.js} +2 -2
  135. package/dist/web/server/assets/{telegram-CGol0CKX2.js → telegram-D7TW3LNZ.js} +1 -1
  136. package/dist/web/server/assets/{telegram-DwEgyR1x.js → telegram-D8_V7_sW.js} +286 -272
  137. package/dist/web/server/assets/{telegram-D9U9c1MN.js → telegram-DA2dwLID.js} +2 -2
  138. package/dist/web/server/assets/{tools-VPIKjr3y.js → tools-CckcG9Jl.js} +5 -3
  139. package/dist/web/server/assets/{tools-DflVIdDd.js → tools-CluiJywK.js} +2 -2
  140. package/dist/web/server/assets/{tools-C-wwWjLI.js → tools-D1BBVkRh.js} +1 -1
  141. package/dist/web/server/assets/usage-CrYyvPgf.js +46 -0
  142. package/dist/web/server/assets/usage-PNNb3pPj.js +465 -0
  143. package/dist/web/server/assets/{use-resource-CbHGYti0.js → use-resource-BUA9qGGY.js} +1 -1
  144. package/dist/web/server/assets/{welcome-CxXMI4HI.js → welcome-CUTYf8UG.js} +1 -1
  145. package/dist/web/server/assets/{welcome-966nOyyK.js → welcome-CYhh3iUU.js} +8 -6
  146. package/dist/web/server/assets/{welcome-7DrYZVs6.js → welcome-CwzLt6Rp.js} +2 -2
  147. package/dist/web/server/assets/workspace-0XPILV1W.js +82 -0
  148. package/dist/web/server/server.js +20 -20
  149. package/dist/worker.js +27 -6
  150. package/dist/worker.js.map +1 -1
  151. package/package.json +1 -1
  152. package/dist/web/client/assets/AddProviderDialog-DfFOaCjC.js +0 -1
  153. package/dist/web/client/assets/AgentTemplateParts-IMJmAQjN.js +0 -1
  154. package/dist/web/client/assets/ConfigPage-CzLHZa5o.js +0 -1
  155. package/dist/web/client/assets/ConfirmDialog-Cu_evkgc.js +0 -1
  156. package/dist/web/client/assets/ConnectionsView-D7Fmutl2.js +0 -1
  157. package/dist/web/client/assets/ManagePage-BfvlCrmz.js +0 -1
  158. package/dist/web/client/assets/SkillsParts-BuTxcCam.js +0 -1
  159. package/dist/web/client/assets/SpawnTeamModal-B1UnOvtp.js +0 -1
  160. package/dist/web/client/assets/TeamForm-DbzxtRjj.js +0 -1
  161. package/dist/web/client/assets/TeamThread-jpsWq6vI.js +0 -1
  162. package/dist/web/client/assets/UnsavedChangesGuard-BfyU9v9i.js +0 -1
  163. package/dist/web/client/assets/_id-BCNBLF-2.js +0 -1
  164. package/dist/web/client/assets/_id-D8_H79U2.js +0 -1
  165. package/dist/web/client/assets/access-CDWe1Kwy.js +0 -1
  166. package/dist/web/client/assets/agents-sE686DTf.js +0 -1
  167. package/dist/web/client/assets/agents-yrur1NDa.js +0 -1
  168. package/dist/web/client/assets/arrow-right-U66krZnr.js +0 -1
  169. package/dist/web/client/assets/attention-DYEHDfmx.js +0 -1
  170. package/dist/web/client/assets/chevron-right-CuqJFXTe.js +0 -1
  171. package/dist/web/client/assets/config-BHv886pr.js +0 -1
  172. package/dist/web/client/assets/index-GOthyyE-.js +0 -14
  173. package/dist/web/client/assets/login-Dhe15Uuc.js +0 -1
  174. package/dist/web/client/assets/mcp-A_Eo7x3q.js +0 -1
  175. package/dist/web/client/assets/parts-CpIfn_BH.js +0 -41
  176. package/dist/web/client/assets/plus-CQPjc8uR.js +0 -1
  177. package/dist/web/client/assets/routes-CTg_yjbY.js +0 -85
  178. package/dist/web/client/assets/skills-CLjtYtkA.js +0 -1
  179. package/dist/web/client/assets/style-mjEbxhf5.js +0 -7
  180. package/dist/web/client/assets/styles-DzcEC3Rd.css +0 -2
  181. package/dist/web/client/assets/teams-Bhje5n2h.js +0 -1
  182. package/dist/web/client/assets/teams-Cbgw0Qhv.js +0 -1
  183. package/dist/web/client/assets/telegram-HtUczmaA.js +0 -1
  184. package/dist/web/client/assets/tools-BpjFvmoX.js +0 -1
  185. package/dist/web/client/assets/use-resource-BnvgCpBi.js +0 -1
  186. package/dist/web/client/assets/welcome-D47LKWYO.js +0 -1
  187. package/dist/web/server/assets/Rail-b6EbjBB-.js +0 -605
  188. package/dist/web/server/assets/SpawnDialog-3wNx0W1R.js +0 -1851
  189. package/dist/web/server/assets/_tanstack-start-manifest_v-kkY_s_uR.js +0 -256
  190. package/dist/web/server/assets/createSsrRpc-qesavJv-.js +0 -72
  191. package/dist/web/server/assets/public-origin-BpDkdS5Q.js +0 -34
@@ -1,8 +1,8 @@
1
1
  import { n as createServerFn } from "../server.js";
2
- import { t as createSsrRpc } from "./createSsrRpc-qesavJv-.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
3
3
  import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
4
  //#region src/routes/config/tools.tsx
5
- var $$splitComponentImporter = () => import("./tools-VPIKjr3y.js");
5
+ var $$splitComponentImporter = () => import("./tools-CckcG9Jl.js");
6
6
  var fetchTools = createServerFn({ method: "GET" }).handler(createSsrRpc("946c6cbff3f55931c3fb28c971d20b18b4b8a9f25417a5d1afc0550d7afa393b"));
7
7
  var Route = createFileRoute("/config/tools")({
8
8
  loader: () => fetchTools(),
@@ -1,6 +1,6 @@
1
1
  import { n as createServerFn } from "../server.js";
2
2
  import { t as createServerRpc } from "./createServerRpc-B7Yr1K8i.js";
3
- import { n as daemonClient } from "./daemon-client-B_ZRIIrT.js";
3
+ import { n as daemonClient } from "./daemon-client-RxAllljf.js";
4
4
  //#region src/routes/config/tools.tsx?tss-serverfn-split
5
5
  var fetchTools_createServerFn_handler = createServerRpc({
6
6
  id: "946c6cbff3f55931c3fb28c971d20b18b4b8a9f25417a5d1afc0550d7afa393b",
@@ -0,0 +1,46 @@
1
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
2
+ //#region src/routes/usage/index.tsx?tsr-shared=1
3
+ var PERIODS = [
4
+ {
5
+ id: "1",
6
+ label: "Today"
7
+ },
8
+ {
9
+ id: "7",
10
+ label: "7 days"
11
+ },
12
+ {
13
+ id: "30",
14
+ label: "30 days"
15
+ },
16
+ {
17
+ id: "90",
18
+ label: "90 days"
19
+ },
20
+ {
21
+ id: "all",
22
+ label: "Everything"
23
+ }
24
+ ];
25
+ /** The address's period: `?days=7` reads as the number 7, `?days=all` as text. */
26
+ function parseDays(value) {
27
+ const period = PERIODS.find((entry) => entry.id === String(value))?.id;
28
+ if (!period) return void 0;
29
+ return period === "all" ? "all" : Number(period);
30
+ }
31
+ //#endregion
32
+ //#region src/routes/usage/index.tsx
33
+ var $$splitComponentImporter = () => import("./usage-PNNb3pPj.js");
34
+ var text = (value) => typeof value === "string" && value ? value : void 0;
35
+ /** The address's period: `?days=7` reads as the number 7, `?days=all` as text. */
36
+ var Route = createFileRoute("/usage/")({
37
+ validateSearch: (search) => ({
38
+ days: parseDays(search.days),
39
+ agent: text(search.agent),
40
+ team: text(search.team)
41
+ }),
42
+ component: lazyRouteComponent($$splitComponentImporter, "component")
43
+ });
44
+ /** The report, asked for in this browser's time zone (the server does not know it). */
45
+ //#endregion
46
+ export { PERIODS as n, parseDays as r, Route as t };
@@ -0,0 +1,465 @@
1
+ import { i as api } from "./live-DbJeq6KP.js";
2
+ import { n as formatTokens, r as usageSummary, t as formatCost } from "./src-vrZVrV9u.js";
3
+ import { t as Button } from "./Button-Dsnw22OF.js";
4
+ import { t as Segmented } from "./Segmented-3ZLdqa5U.js";
5
+ import { d as Chip, g as Notice, h as ListRow, i as CardEmpty, o as CardList, r as CardBody, t as Banner, y as SetupCard } from "./parts-k9M-atPa.js";
6
+ import { n as PERIODS, r as parseDays, t as Route } from "./usage-CrYyvPgf.js";
7
+ import { t as ManagePage } from "./ManagePage-Dy1EdovO.js";
8
+ import { useEffect, useId, useState } from "react";
9
+ import { Link, useNavigate } from "@tanstack/react-router";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import { BarChart3, Bot, Cpu, UsersRound } from "lucide-react";
12
+ //#region src/components/usage/DayChart.tsx
13
+ var HEIGHT = 160;
14
+ /** "Sun 22 Nov": a `YYYY-MM-DD` day in this browser's words. */
15
+ function dayLabel(day, options = {}) {
16
+ return (/* @__PURE__ */ new Date(`${day}T12:00:00Z`)).toLocaleDateString(void 0, {
17
+ weekday: "short",
18
+ day: "numeric",
19
+ month: "short",
20
+ timeZone: "UTC",
21
+ ...options
22
+ });
23
+ }
24
+ var dayValue = (day, metric) => metric === "cost" ? day.cost : day.totalTokens;
25
+ var formatMetric = (value, metric) => metric === "cost" ? formatCost(value) : `${formatTokens(value)} tokens`;
26
+ function DayChart({ days, metric }) {
27
+ const [active, setActive] = useState(null);
28
+ const describedBy = useId();
29
+ const max = Math.max(...days.map((day) => dayValue(day, metric)), 0);
30
+ const shown = active === null ? null : days[active];
31
+ const total = days.reduce((sum, day) => sum + dayValue(day, metric), 0);
32
+ const peak = days.reduce((best, day) => !best || dayValue(day, metric) > dayValue(best, metric) ? day : best, null);
33
+ const first = days[0];
34
+ const last = days.at(-1);
35
+ return /* @__PURE__ */ jsxs("div", {
36
+ className: "grid gap-2",
37
+ children: [
38
+ /* @__PURE__ */ jsxs("div", {
39
+ className: "flex items-baseline justify-between text-xs text-muted-foreground",
40
+ children: [/* @__PURE__ */ jsx("span", {
41
+ className: "tabular-nums",
42
+ children: max > 0 ? formatMetric(max, metric) : ""
43
+ }), /* @__PURE__ */ jsx("span", {
44
+ "aria-hidden": "true",
45
+ className: "font-medium text-foreground",
46
+ children: shown ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
47
+ /* @__PURE__ */ jsx("strong", {
48
+ className: "font-semibold",
49
+ children: formatMetric(dayValue(shown, metric), metric)
50
+ }),
51
+ " ",
52
+ /* @__PURE__ */ jsx("span", {
53
+ className: "text-muted-foreground",
54
+ children: dayLabel(shown.day)
55
+ })
56
+ ] }) : /* @__PURE__ */ jsx("span", {
57
+ className: "text-muted-foreground",
58
+ children: "Point at a day, or use the arrow keys"
59
+ })
60
+ })]
61
+ }),
62
+ /* @__PURE__ */ jsxs("div", {
63
+ role: "slider",
64
+ tabIndex: 0,
65
+ "aria-label": `${metric === "cost" ? "Spent" : "Tokens"} per day, ${formatMetric(total, metric)} in all${peak && dayValue(peak, metric) > 0 ? `; most on ${dayLabel(peak.day)}, ${formatMetric(dayValue(peak, metric), metric)}` : ""}`,
66
+ "aria-describedby": describedBy,
67
+ "aria-valuemin": 0,
68
+ "aria-valuemax": Math.max(days.length - 1, 0),
69
+ "aria-valuenow": active ?? Math.max(days.length - 1, 0),
70
+ "aria-valuetext": (() => {
71
+ const day = days[active ?? days.length - 1];
72
+ return day ? `${dayLabel(day.day)}: ${formatMetric(dayValue(day, metric), metric)}` : "";
73
+ })(),
74
+ onKeyDown: (event) => {
75
+ if (days.length === 0) return;
76
+ const at = active ?? days.length - 1;
77
+ let next = null;
78
+ if (event.key === "ArrowLeft") next = Math.max(at - 1, 0);
79
+ else if (event.key === "ArrowRight") next = Math.min(at + 1, days.length - 1);
80
+ else if (event.key === "Home") next = 0;
81
+ else if (event.key === "End") next = days.length - 1;
82
+ if (next === null) return;
83
+ event.preventDefault();
84
+ setActive(next);
85
+ },
86
+ onFocus: () => setActive((current) => current ?? days.length - 1),
87
+ onBlur: () => setActive(null),
88
+ onPointerLeave: () => setActive(null),
89
+ className: "relative flex items-end gap-0.5 rounded-md border-b border-border outline-offset-4",
90
+ style: { height: HEIGHT },
91
+ children: [/* @__PURE__ */ jsx("span", {
92
+ id: describedBy,
93
+ className: "sr-only",
94
+ children: "The table under the chart lists every day."
95
+ }), days.map((day, index) => {
96
+ const value = dayValue(day, metric);
97
+ const height = max > 0 && value > 0 ? Math.max(value / max * HEIGHT, 2) : 0;
98
+ return /* @__PURE__ */ jsx("div", {
99
+ onPointerEnter: () => setActive(index),
100
+ className: "flex h-full min-w-0 flex-1 items-end justify-center",
101
+ children: /* @__PURE__ */ jsx("div", {
102
+ className: `w-full max-w-6 rounded-t-[4px] transition-opacity ${active !== null && active !== index ? "opacity-55" : ""} bg-chart-bar`,
103
+ style: { height }
104
+ })
105
+ }, day.day);
106
+ })]
107
+ }),
108
+ /* @__PURE__ */ jsxs("div", {
109
+ className: "flex justify-between text-xs text-muted-foreground",
110
+ children: [/* @__PURE__ */ jsx("span", { children: first ? dayLabel(first.day) : "" }), /* @__PURE__ */ jsx("span", { children: last && last !== first ? dayLabel(last.day) : "" })]
111
+ })
112
+ ]
113
+ });
114
+ }
115
+ //#endregion
116
+ //#region src/routes/usage/index.tsx?tsr-split=component
117
+ /** The address's period: `?days=7` reads as the number 7, `?days=all` as text. */
118
+ /** The report, asked for in this browser's time zone (the server does not know it). */
119
+ function useUsage(search) {
120
+ const [report, setReport] = useState(null);
121
+ const [error, setError] = useState(null);
122
+ const days = String(search.days ?? 30);
123
+ useEffect(() => {
124
+ const controller = new AbortController();
125
+ const query = new URLSearchParams({
126
+ days,
127
+ tz: Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"
128
+ });
129
+ if (search.agent) query.set("agent", search.agent);
130
+ if (search.team) query.set("team", search.team);
131
+ setError(null);
132
+ api(`/api/usage?${query}`, { signal: controller.signal }).then(setReport).catch((failure) => {
133
+ if (!controller.signal.aborted) setError(failure instanceof Error ? failure.message : String(failure));
134
+ });
135
+ return () => controller.abort();
136
+ }, [
137
+ days,
138
+ search.agent,
139
+ search.team
140
+ ]);
141
+ return {
142
+ report,
143
+ error
144
+ };
145
+ }
146
+ function UsagePage() {
147
+ const search = Route.useSearch();
148
+ const navigate = useNavigate({ from: "/usage/" });
149
+ const { report, error } = useUsage(search);
150
+ const period = String(search.days ?? 30);
151
+ return /* @__PURE__ */ jsxs(ManagePage, {
152
+ title: "Usage",
153
+ description: "What your Agents' model calls used, read from the saved conversations: the money spent on providers paid per use, and the tokens of subscriptions and of models on this computer.",
154
+ actions: /* @__PURE__ */ jsx(Segmented, {
155
+ label: "Period",
156
+ value: period,
157
+ options: PERIODS,
158
+ onChange: (days) => void navigate({ search: (prev) => ({
159
+ ...prev,
160
+ days: parseDays(days)
161
+ }) })
162
+ }),
163
+ children: [
164
+ report?.scope && /* @__PURE__ */ jsxs(Banner, {
165
+ tone: "neutral",
166
+ lead: `Only ${report.scope.name}`,
167
+ action: /* @__PURE__ */ jsx(Button, {
168
+ variant: "ghost",
169
+ onClick: () => void navigate({ search: (prev) => ({ days: prev.days }) }),
170
+ children: "Show every Agent"
171
+ }),
172
+ children: [report.scope.kind === "agent" ? "One Agent" : "The Agents of one Team", ", as Usage counts them below."]
173
+ }),
174
+ error && /* @__PURE__ */ jsx(Notice, {
175
+ tone: "danger",
176
+ title: "Usage could not be read",
177
+ children: error
178
+ }),
179
+ !report && !error && /* @__PURE__ */ jsx("p", {
180
+ className: "text-sm text-muted-foreground",
181
+ children: "Counting…"
182
+ }),
183
+ report && /* @__PURE__ */ jsx(UsageBody, {
184
+ report,
185
+ period
186
+ })
187
+ ]
188
+ });
189
+ }
190
+ function UsageBody({ report, period }) {
191
+ const { totals } = report;
192
+ const [chosen, setMetric] = useState(null);
193
+ const metric = chosen ?? (totals.cost > 0 ? "cost" : "tokens");
194
+ const showDays = report.days !== null && report.days > 1;
195
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
196
+ /* @__PURE__ */ jsx(Totals, { report }),
197
+ report.unreadable > 0 && /* @__PURE__ */ jsxs(Notice, {
198
+ tone: "warning",
199
+ title: "Some conversations are not counted",
200
+ children: [
201
+ report.unreadable,
202
+ " saved conversation",
203
+ report.unreadable === 1 ? "" : "s",
204
+ " could not be read."
205
+ ]
206
+ }),
207
+ totals.calls === 0 ? /* @__PURE__ */ jsx(SetupCard, {
208
+ labelledBy: "usage-empty",
209
+ icon: /* @__PURE__ */ jsx(BarChart3, { className: "size-5" }),
210
+ title: "By day",
211
+ description: periodWords(report),
212
+ children: /* @__PURE__ */ jsx(CardEmpty, {
213
+ icon: /* @__PURE__ */ jsx(BarChart3, { className: "size-5" }),
214
+ title: "No model calls in this period",
215
+ children: period === "all" ? "Nothing is counted until an Agent answers in a conversation." : "Pick a longer period to see earlier use."
216
+ })
217
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
218
+ showDays && /* @__PURE__ */ jsx(SetupCard, {
219
+ labelledBy: "usage-days",
220
+ icon: /* @__PURE__ */ jsx(BarChart3, { className: "size-5" }),
221
+ title: "By day",
222
+ description: periodWords(report),
223
+ action: /* @__PURE__ */ jsx(Segmented, {
224
+ label: "Show",
225
+ value: metric,
226
+ options: [{
227
+ id: "cost",
228
+ label: "Spent"
229
+ }, {
230
+ id: "tokens",
231
+ label: "Tokens"
232
+ }],
233
+ onChange: setMetric
234
+ }),
235
+ children: /* @__PURE__ */ jsxs(CardBody, { children: [
236
+ /* @__PURE__ */ jsx(DayChart, {
237
+ days: report.byDay,
238
+ metric
239
+ }),
240
+ /* @__PURE__ */ jsxs("details", {
241
+ className: "text-sm",
242
+ children: [/* @__PURE__ */ jsx("summary", {
243
+ className: "cursor-pointer text-muted-foreground",
244
+ children: "The days as a table"
245
+ }), /* @__PURE__ */ jsxs("table", {
246
+ className: "mt-2 w-full text-left tabular-nums",
247
+ children: [/* @__PURE__ */ jsx("thead", {
248
+ className: "text-xs text-muted-foreground",
249
+ children: /* @__PURE__ */ jsxs("tr", { children: [
250
+ /* @__PURE__ */ jsx("th", {
251
+ className: "py-1 font-medium",
252
+ children: "Day"
253
+ }),
254
+ /* @__PURE__ */ jsx("th", {
255
+ className: "py-1 font-medium",
256
+ children: "Spent"
257
+ }),
258
+ /* @__PURE__ */ jsx("th", {
259
+ className: "py-1 font-medium",
260
+ children: "Tokens"
261
+ }),
262
+ /* @__PURE__ */ jsx("th", {
263
+ className: "py-1 font-medium",
264
+ children: "Model calls"
265
+ })
266
+ ] })
267
+ }), /* @__PURE__ */ jsx("tbody", { children: report.byDay.toReversed().map((day) => /* @__PURE__ */ jsxs("tr", {
268
+ className: "border-t border-border",
269
+ children: [
270
+ /* @__PURE__ */ jsx("td", {
271
+ className: "py-1",
272
+ children: dayLabel(day.day, { year: "numeric" })
273
+ }),
274
+ /* @__PURE__ */ jsx("td", {
275
+ className: "py-1",
276
+ children: formatCost(day.cost)
277
+ }),
278
+ /* @__PURE__ */ jsx("td", {
279
+ className: "py-1",
280
+ children: formatTokens(day.totalTokens)
281
+ }),
282
+ /* @__PURE__ */ jsx("td", {
283
+ className: "py-1",
284
+ children: day.calls
285
+ })
286
+ ]
287
+ }, day.day)) })]
288
+ })]
289
+ }),
290
+ metric === "cost" && peakDay(report, metric)
291
+ ] })
292
+ }),
293
+ /* @__PURE__ */ jsx(Breakdown, {
294
+ id: "usage-teams",
295
+ icon: /* @__PURE__ */ jsx(UsersRound, { className: "size-5" }),
296
+ title: "By Team",
297
+ description: "Each Agent's use counts for the Team it is in now.",
298
+ rows: report.byTeam.map((team) => ({
299
+ key: team.teamId,
300
+ title: /* @__PURE__ */ jsx(Link, {
301
+ to: "/usage",
302
+ search: {
303
+ days: parseDays(period),
304
+ team: team.teamId
305
+ },
306
+ children: team.teamName
307
+ }),
308
+ totals: team
309
+ }))
310
+ }),
311
+ /* @__PURE__ */ jsx(Breakdown, {
312
+ id: "usage-agents",
313
+ icon: /* @__PURE__ */ jsx(Bot, { className: "size-5" }),
314
+ title: "By Agent",
315
+ description: "Open one for only its use.",
316
+ rows: report.byAgent.map((agent) => ({
317
+ key: agent.agentId,
318
+ title: /* @__PURE__ */ jsx(Link, {
319
+ to: "/usage",
320
+ search: {
321
+ days: parseDays(period),
322
+ agent: agent.agentId
323
+ },
324
+ children: agent.agentName
325
+ }),
326
+ chip: agent.archived ? /* @__PURE__ */ jsx(Chip, {
327
+ tone: "neutral",
328
+ children: "Archived"
329
+ }) : void 0,
330
+ meta: agent.teamName,
331
+ totals: agent
332
+ }))
333
+ }),
334
+ /* @__PURE__ */ jsx(Breakdown, {
335
+ id: "usage-models",
336
+ icon: /* @__PURE__ */ jsx(Cpu, { className: "size-5" }),
337
+ title: "By model",
338
+ description: "Subscriptions and models on this computer cost nothing per use.",
339
+ rows: report.byModel.map((model) => ({
340
+ key: `${model.provider}/${model.model}`,
341
+ title: /* @__PURE__ */ jsx("span", {
342
+ className: "break-all",
343
+ children: model.model
344
+ }),
345
+ chip: model.billing === "plan" ? /* @__PURE__ */ jsx(Chip, {
346
+ tone: "neutral",
347
+ children: "Subscription"
348
+ }) : model.billing === "local" ? /* @__PURE__ */ jsx(Chip, {
349
+ tone: "neutral",
350
+ children: "This computer"
351
+ }) : void 0,
352
+ meta: model.providerName,
353
+ totals: model
354
+ }))
355
+ })
356
+ ] })
357
+ ] });
358
+ }
359
+ function periodWords(report) {
360
+ if (report.days === null) return "Everything in the saved conversations.";
361
+ if (report.days === 1) return `Today, ${dayLabel(report.to)}.`;
362
+ return `${report.from ? dayLabel(report.from) : ""} to ${dayLabel(report.to)}, in this browser's time zone.`;
363
+ }
364
+ function peakDay(report, metric) {
365
+ const peak = report.byDay.reduce((best, day) => !best || dayValue(day, metric) > dayValue(best, metric) ? day : best, null);
366
+ if (!peak || dayValue(peak, metric) === 0) return null;
367
+ return /* @__PURE__ */ jsxs("p", {
368
+ className: "m-0 text-sm text-muted-foreground",
369
+ children: [
370
+ "The most was spent on ",
371
+ dayLabel(peak.day),
372
+ ": ",
373
+ formatMetric(dayValue(peak, metric), metric),
374
+ "."
375
+ ]
376
+ });
377
+ }
378
+ function Totals({ report }) {
379
+ const { totals } = report;
380
+ return /* @__PURE__ */ jsxs("section", {
381
+ "aria-labelledby": "usage-totals",
382
+ className: "grid gap-4 rounded-2xl border border-border bg-card p-5 shadow-baziu-sm sm:grid-cols-[minmax(0,1.4fr)_minmax(0,2fr)]",
383
+ children: [/* @__PURE__ */ jsxs("div", {
384
+ className: "min-w-0",
385
+ children: [
386
+ /* @__PURE__ */ jsx("h2", {
387
+ id: "usage-totals",
388
+ className: "m-0 font-body text-sm font-medium text-muted-foreground",
389
+ children: "Spent"
390
+ }),
391
+ /* @__PURE__ */ jsx("p", {
392
+ className: "m-0 font-body text-5xl font-semibold leading-tight text-foreground",
393
+ children: formatCost(totals.cost)
394
+ }),
395
+ /* @__PURE__ */ jsxs("p", {
396
+ className: "m-0 mt-1 text-sm text-muted-foreground",
397
+ children: [totals.cost === 0 ? "On providers paid per use." : totals.estimated ? "Estimated from catalog prices, except what a provider reported it billed." : "As the providers reported it billed.", totals.unpricedTokens > 0 && ` ${formatTokens(totals.unpricedTokens)} tokens on models with no known price are not in it.`]
398
+ })
399
+ ]
400
+ }), /* @__PURE__ */ jsxs("dl", {
401
+ className: "m-0 grid grid-cols-2 gap-3 self-start sm:grid-cols-4",
402
+ children: [
403
+ /* @__PURE__ */ jsx(Stat, {
404
+ label: "Tokens",
405
+ value: formatTokens(totals.totalTokens)
406
+ }),
407
+ /* @__PURE__ */ jsx(Stat, {
408
+ label: "On a subscription",
409
+ value: formatTokens(totals.planTokens)
410
+ }),
411
+ /* @__PURE__ */ jsx(Stat, {
412
+ label: "On this computer",
413
+ value: formatTokens(totals.localTokens)
414
+ }),
415
+ /* @__PURE__ */ jsx(Stat, {
416
+ label: "Model calls",
417
+ value: totals.calls.toLocaleString()
418
+ })
419
+ ]
420
+ })]
421
+ });
422
+ }
423
+ function Stat({ label, value }) {
424
+ return /* @__PURE__ */ jsxs("div", {
425
+ className: "min-w-0 rounded-xl bg-muted px-3 py-2.5",
426
+ children: [/* @__PURE__ */ jsx("dt", {
427
+ className: "text-xs text-muted-foreground",
428
+ children: label
429
+ }), /* @__PURE__ */ jsx("dd", {
430
+ className: "m-0 text-xl font-semibold text-foreground",
431
+ children: value
432
+ })]
433
+ });
434
+ }
435
+ function Breakdown({ id, icon, title, description, rows }) {
436
+ if (rows.length === 0) return null;
437
+ return /* @__PURE__ */ jsx(SetupCard, {
438
+ labelledBy: id,
439
+ icon,
440
+ title,
441
+ description,
442
+ children: /* @__PURE__ */ jsx(CardList, { children: rows.map((row) => /* @__PURE__ */ jsx(ListRow, {
443
+ inline: true,
444
+ title: row.title,
445
+ chip: row.chip,
446
+ meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [row.meta && /* @__PURE__ */ jsx("span", { children: row.meta }), /* @__PURE__ */ jsxs("span", { children: [
447
+ formatTokens(row.totals.inputTokens + row.totals.cacheReadTokens),
448
+ " in ·",
449
+ " ",
450
+ formatTokens(row.totals.outputTokens),
451
+ " out · ",
452
+ row.totals.calls.toLocaleString(),
453
+ " ",
454
+ "call",
455
+ row.totals.calls === 1 ? "" : "s"
456
+ ] })] }),
457
+ actions: /* @__PURE__ */ jsx("span", {
458
+ className: "text-sm font-semibold tabular-nums text-foreground",
459
+ children: usageSummary(row.totals)
460
+ })
461
+ }, row.key)) })
462
+ });
463
+ }
464
+ //#endregion
465
+ export { UsagePage as component };
@@ -1,4 +1,4 @@
1
- import { pt as errorMessage } from "./SpawnDialog-3wNx0W1R.js";
1
+ import { o as errorMessage } from "./live-DbJeq6KP.js";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  //#region src/lib/use-resource.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { n as createServerFn } from "../server.js";
2
2
  import { t as createServerRpc } from "./createServerRpc-B7Yr1K8i.js";
3
- import { n as daemonClient } from "./daemon-client-B_ZRIIrT.js";
3
+ import { n as daemonClient } from "./daemon-client-RxAllljf.js";
4
4
  //#region src/routes/welcome.tsx?tss-serverfn-split
5
5
  var fetchProviders_createServerFn_handler = createServerRpc({
6
6
  id: "818bf71baeed233268a5ad1a4be5a77e488be79b79ad1bd739463445a7be4d58",
@@ -1,9 +1,11 @@
1
- import { J as DEFAULT_PROFILE_ID, K as Button, dt as api } from "./SpawnDialog-3wNx0W1R.js";
2
- import { r as useResource } from "./use-resource-CbHGYti0.js";
3
- import { n as usePageTitle } from "./page-title-CVY-c2Pd.js";
4
- import { r as PageShell } from "./createSsrRpc-qesavJv-.js";
5
- import { t as Route } from "./welcome-7DrYZVs6.js";
6
- import { a as ProviderConnect, c as ProviderAvatar, i as hostOf, n as ConnectedSummary, r as ProviderChooser } from "./AddProviderDialog-BbpuvC2a.js";
1
+ import { i as api } from "./live-DbJeq6KP.js";
2
+ import { s as DEFAULT_PROFILE_ID } from "./src-vrZVrV9u.js";
3
+ import { r as useResource } from "./use-resource-BUA9qGGY.js";
4
+ import { t as Button } from "./Button-Dsnw22OF.js";
5
+ import { n as usePageTitle } from "./page-title-PTpFHXWo.js";
6
+ import { C as PageShell } from "./parts-k9M-atPa.js";
7
+ import { t as Route } from "./welcome-CwzLt6Rp.js";
8
+ import { a as ProviderConnect, c as ProviderAvatar, i as hostOf, n as ConnectedSummary, r as ProviderChooser } from "./AddProviderDialog-DtkjBMv4.js";
7
9
  import { useState } from "react";
8
10
  import { useNavigate } from "@tanstack/react-router";
9
11
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  import { n as createServerFn } from "../server.js";
2
- import { t as createSsrRpc } from "./createSsrRpc-qesavJv-.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
3
3
  import { createFileRoute, lazyRouteComponent, redirect } from "@tanstack/react-router";
4
4
  //#region src/lib/auth.ts
5
5
  var fetchAuthState = createServerFn({ method: "GET" }).handler(createSsrRpc("a5d3825fc69573bb55bab6df578c750ebb0240dd394c3acee3adea02918a5dc2"));
@@ -11,7 +11,7 @@ function isSetupOpen(path) {
11
11
  }
12
12
  //#endregion
13
13
  //#region src/routes/welcome.tsx
14
- var $$splitComponentImporter = () => import("./welcome-966nOyyK.js");
14
+ var $$splitComponentImporter = () => import("./welcome-CYhh3iUU.js");
15
15
  var fetchProviders = createServerFn({ method: "GET" }).handler(createSsrRpc("818bf71baeed233268a5ad1a4be5a77e488be79b79ad1bd739463445a7be4d58"));
16
16
  var Route = createFileRoute("/welcome")({
17
17
  beforeLoad: async () => {
@@ -0,0 +1,82 @@
1
+ //#region src/lib/workspace.ts
2
+ var isOneOf = (values, value) => typeof value === "string" && values.includes(value);
3
+ var PANEL_TABS = [
4
+ "agent",
5
+ "team",
6
+ "connections",
7
+ "changes",
8
+ "files"
9
+ ];
10
+ /** The three screens that take the whole width, with the Agent list folded to avatars. */
11
+ var FOCUS_VIEWS = [
12
+ "connections",
13
+ "changes",
14
+ "files"
15
+ ];
16
+ var PANEL_LABELS = {
17
+ agent: "Agent",
18
+ team: "Team",
19
+ connections: "Connections",
20
+ changes: "Changes",
21
+ files: "Files"
22
+ };
23
+ /** Sheets of the Agent tab. */
24
+ var AGENT_SECTIONS = [
25
+ "schedules",
26
+ "learning",
27
+ "mailbox",
28
+ "skills",
29
+ "telegram",
30
+ "browser"
31
+ ];
32
+ /** Sheets of the Team tab. */
33
+ var TEAM_SECTIONS = [
34
+ "user-md",
35
+ "memory",
36
+ "settings"
37
+ ];
38
+ var SECTIONS = [...AGENT_SECTIONS, ...TEAM_SECTIONS];
39
+ var isAgentSection = (value) => isOneOf(AGENT_SECTIONS, value);
40
+ var isTeamSection = (value) => isOneOf(TEAM_SECTIONS, value);
41
+ var text = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
42
+ /** A whole number from 0, as the router reads it from the address (a number or its text). */
43
+ var count = (value) => {
44
+ const number = typeof value === "string" ? Number(value) : value;
45
+ return typeof number === "number" && Number.isInteger(number) && number >= 0 ? number : void 0;
46
+ };
47
+ /** The search params the workspace understands; anything else is dropped. */
48
+ function parseWorkspaceSearch(search) {
49
+ const panel = search.panel;
50
+ return {
51
+ agent: text(search.agent),
52
+ team: text(search.team),
53
+ panel: panel === "none" || isOneOf(PANEL_TABS, panel) ? panel : void 0,
54
+ view: isOneOf(FOCUS_VIEWS, search.view) ? search.view : void 0,
55
+ file: text(search.file),
56
+ result: text(search.result),
57
+ conversation: text(search.conversation),
58
+ find: text(search.find),
59
+ match: count(search.match),
60
+ section: isOneOf(SECTIONS, search.section) ? search.section : void 0,
61
+ note: text(search.note)
62
+ };
63
+ }
64
+ /**
65
+ * Cookie that remembers the side panel between visits, so the first paint has it: the last tab,
66
+ * prefixed with `none:` while the panel is hidden.
67
+ */
68
+ var PANEL_COOKIE = "bz_panel";
69
+ function parsePanelCookie(raw) {
70
+ const hidden = raw?.startsWith("none:") ?? false;
71
+ const tab = hidden ? raw?.slice(5) : raw;
72
+ return {
73
+ open: !hidden,
74
+ tab: isOneOf(PANEL_TABS, tab) ? tab : "team"
75
+ };
76
+ }
77
+ function writePanelCookie(memory) {
78
+ const value = memory.open ? memory.tab : `none:${memory.tab}`;
79
+ document.cookie = `${PANEL_COOKIE}=${value}; Path=/; Max-Age=31536000; SameSite=Lax`;
80
+ }
81
+ //#endregion
82
+ export { isAgentSection as a, parseWorkspaceSearch as c, PANEL_TABS as i, writePanelCookie as l, PANEL_COOKIE as n, isTeamSection as o, PANEL_LABELS as r, parsePanelCookie as s, FOCUS_VIEWS as t };