bazilion 0.52.0 → 0.54.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 (210) hide show
  1. package/dist/cli.js +3 -3
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +296 -232
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-CkwSq3C7.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-CEn_4qVs.js +1 -0
  7. package/dist/web/client/assets/Button-UiegBKOK.js +1 -0
  8. package/dist/web/client/assets/ConfigPage-CUbHBhzx.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-VqBOFZEp.js +1 -0
  10. package/dist/web/client/assets/ConnectionsView-ByARMcWP.js +1 -0
  11. package/dist/web/client/assets/ManagePage-BJWZd1ts.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-ViZKm3-B.js +1 -0
  13. package/dist/web/client/assets/Segmented-MYKKTuZO.js +1 -0
  14. package/dist/web/client/assets/SkillsParts-UvNK5SYP.js +1 -0
  15. package/dist/web/client/assets/SpawnTeamModal-DG5UbJNK.js +1 -0
  16. package/dist/web/client/assets/TeamForm-DGlxWv4e.js +1 -0
  17. package/dist/web/client/assets/TeamThread-mkwODO0S.js +1 -0
  18. package/dist/web/client/assets/UnsavedChangesGuard-BmdwLH99.js +1 -0
  19. package/dist/web/client/assets/_id-CvcxNmBH.js +1 -0
  20. package/dist/web/client/assets/_id-UyBk7gRl.js +1 -0
  21. package/dist/web/client/assets/access-C8d8vaQ6.js +1 -0
  22. package/dist/web/client/assets/agent-actions-BgE9fKHH.js +1 -0
  23. package/dist/web/client/assets/agents-CgtzqBpD.js +1 -0
  24. package/dist/web/client/assets/agents-D7W4BT8r.js +1 -0
  25. package/dist/web/client/assets/arrow-right-D0HKRb7U.js +1 -0
  26. package/dist/web/client/assets/attention-D9mQWoKt.js +1 -0
  27. package/dist/web/client/assets/bot-Bb--PFVU.js +1 -0
  28. package/dist/web/client/assets/chevron-right-bs0TUSl2.js +1 -0
  29. package/dist/web/client/assets/config-Dw6GWf38.js +1 -0
  30. package/dist/web/client/assets/createLucideIcon-DkniuEtD.js +1 -0
  31. package/dist/web/client/assets/download-C4t9l5wR.js +1 -0
  32. package/dist/web/client/assets/file-text-DzbjpYrV.js +1 -0
  33. package/dist/web/client/assets/images-DSYgPKM7.js +1 -0
  34. package/dist/web/client/assets/index-YW0gXPfk.js +14 -0
  35. package/dist/web/client/assets/key-round-BpK4-E3T.js +1 -0
  36. package/dist/web/client/assets/list-checks-JNXcmws9.js +1 -0
  37. package/dist/web/client/assets/login-DcQJk5-U.js +1 -0
  38. package/dist/web/client/assets/manage-SRGSx8n2.js +1 -0
  39. package/dist/web/client/assets/mcp-BUWu4TvS.js +1 -0
  40. package/dist/web/client/assets/message-square-DM2MP9vF.js +1 -0
  41. package/dist/web/client/assets/network-BJ4iPjQO.js +1 -0
  42. package/dist/web/client/assets/parts-LZxl9Gvc.js +41 -0
  43. package/dist/web/client/assets/plus-CLGNN5QX.js +1 -0
  44. package/dist/web/client/assets/routes-BxIIyGho.js +85 -0
  45. package/dist/web/client/assets/skills-C7DzIwFJ.js +1 -0
  46. package/dist/web/client/assets/square-terminal-Dmm6cV-G.js +1 -0
  47. package/dist/web/client/assets/style-CA2GAk9b.js +7 -0
  48. package/dist/web/client/assets/styles-C3CDSGAr.css +2 -0
  49. package/dist/web/client/assets/system-zQ0NnQML.js +1 -0
  50. package/dist/web/client/assets/teams-BEIJHObN.js +1 -0
  51. package/dist/web/client/assets/teams-DlOc7Ods.js +1 -0
  52. package/dist/web/client/assets/telegram-DKHq5DpE.js +1 -0
  53. package/dist/web/client/assets/tools-BKIpLaiC.js +1 -0
  54. package/dist/web/client/assets/use-resource-CQaIZbpy.js +1 -0
  55. package/dist/web/client/assets/users-round-BJrym3FG.js +1 -0
  56. package/dist/web/client/assets/welcome-CyS4Hrd-.js +1 -0
  57. package/dist/web/client/assets/wrench-GbE1M1RJ.js +1 -0
  58. package/dist/web/server/assets/{AddProviderDialog-Tn4AskPm.js → AddProviderDialog-Nc5mc_P6.js} +106 -8
  59. package/dist/web/server/assets/AgentTemplateParts-DZK_r3nQ.js +266 -0
  60. package/dist/web/server/assets/{ConfigPage-DqDUujmt.js → ConfigPage-CxzL-gTm.js} +2 -2
  61. package/dist/web/server/assets/{ConfirmDialog-DfaJ--A6.js → ConfirmDialog-4xeCXKHe.js} +1 -2
  62. package/dist/web/server/assets/{ConnectionsView-DAG-zNBz.js → ConnectionsView-B02FjNsM.js} +9 -9
  63. package/dist/web/server/assets/ManagePage-BfCWE8Lj.js +29 -0
  64. package/dist/web/server/assets/ModelMenu-D-hTgYOO.js +278 -0
  65. package/dist/web/server/assets/{Rail-BIC_4ptO.js → Rail-3gbidhyv.js} +17 -110
  66. package/dist/web/server/assets/{SectionTabs-BGsrf-UQ.js → SectionTabs-CWQ5orUW.js} +9 -2
  67. package/dist/web/server/assets/SkillsParts-D58l8voo.js +199 -0
  68. package/dist/web/server/assets/SpawnDialog-MJWwppgC.js +1648 -0
  69. package/dist/web/server/assets/SpawnTeamModal-RjzAeX_Q.js +124 -0
  70. package/dist/web/server/assets/TeamForm-DdOgIMiV.js +138 -0
  71. package/dist/web/server/assets/{TeamThread-DuLlGDcw.js → TeamThread-D-PvO3fu.js} +9 -9
  72. package/dist/web/server/assets/{UnsavedChangesGuard-DrOvPV14.js → UnsavedChangesGuard-Bb5frygQ.js} +1 -1
  73. package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
  74. package/dist/web/server/assets/_id-BPjVkcNb.js +396 -0
  75. package/dist/web/server/assets/_id-BUfy-GwH.js +16 -0
  76. package/dist/web/server/assets/{_id-yN0z7VqE.js → _id-C1_l6oSR.js} +257 -207
  77. package/dist/web/server/assets/{_id-DJnYgisy.js → _id-CHvYQhWt.js} +8 -4
  78. package/dist/web/server/assets/_id-De3Bm0SG.js +39 -0
  79. package/dist/web/server/assets/_tanstack-start-manifest_v-CR3jm1nY.js +256 -0
  80. package/dist/web/server/assets/access-CNfvQ3NB.js +295 -0
  81. package/dist/web/server/assets/{access-GMGed5O8.js → access-Cm_izIIC.js} +2 -2
  82. package/dist/web/server/assets/{access-C_pupPks.js → access-WWspT0v4.js} +2 -1
  83. package/dist/web/server/assets/agent-actions-COnfW5AU.js +20 -0
  84. package/dist/web/server/assets/agents-C7UmTjfO.js +13 -0
  85. package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-CRtMfKqX.js} +9 -6
  86. package/dist/web/server/assets/agents-D0hfGIMK.js +134 -0
  87. package/dist/web/server/assets/agents-DQowl6Ly.js +31 -0
  88. package/dist/web/server/assets/agents-DzpqlIuJ.js +12 -0
  89. package/dist/web/server/assets/agents-NOkh61dV.js +323 -0
  90. package/dist/web/server/assets/attention-CRvxt22X.js +232 -0
  91. package/dist/web/server/assets/{attention-Cr7puThv.js → attention-CgWhXjX7.js} +4 -1
  92. package/dist/web/server/assets/{attention-DS3O9UmJ.js → attention-Cx9ZWPOO.js} +4 -2
  93. package/dist/web/server/assets/{config-DjTGA4iZ.js → config-B5CS8juO.js} +2 -2
  94. package/dist/web/server/assets/{config-Q7livfa3.js → config-D117117T.js} +51 -102
  95. package/dist/web/server/assets/createSsrRpc-CwTd0zrB.js +72 -0
  96. package/dist/web/server/assets/{login-VV10kZBl.js → login-IF0Gbsuq.js} +36 -2
  97. package/dist/web/server/assets/{login-JoIjlcmu.js → login-va4EtvA8.js} +34 -45
  98. package/dist/web/server/assets/manage-Ce6cI4eW.js +240 -0
  99. package/dist/web/server/assets/{mcp-ZARSOxZW.js → mcp-Bm9U6x7N.js} +2 -2
  100. package/dist/web/server/assets/mcp-C96PBxpb.js +376 -0
  101. package/dist/web/server/assets/page-title-CwcbXMhx.js +95 -0
  102. package/dist/web/server/assets/{router-Dh2-IvLL.js → router-8Iq19GOz.js} +366 -203
  103. package/dist/web/server/assets/{routes-C9NawqcV.js → routes-BLo-fWbQ.js} +2681 -1667
  104. package/dist/web/server/assets/{routes-CDskMy5C.js → routes-BXvYYFrN.js} +2 -2
  105. package/dist/web/server/assets/routes-Kwam6JmS.js +89 -0
  106. package/dist/web/server/assets/{skills-StN15QhC.js → skills-BqCnA-74.js} +2 -2
  107. package/dist/web/server/assets/skills-DSezIdDc.js +157 -0
  108. package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
  109. package/dist/web/server/assets/{style-GYDODk2F.js → style-C2hIPY_Y.js} +2 -2
  110. package/dist/web/server/assets/{system-Dl-1RhoP.js → system-CcLCmkIC.js} +2 -2
  111. package/dist/web/server/assets/{system-DtswhLW6.js → system-D3th6n2E.js} +4 -2
  112. package/dist/web/server/assets/system-E0VePdzO.js +145 -0
  113. package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
  114. package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
  115. package/dist/web/server/assets/teams-CQVV18D3.js +216 -0
  116. package/dist/web/server/assets/teams-CdCmBJIj.js +174 -0
  117. package/dist/web/server/assets/{teams-5PMGvHuM.js → teams-DScFp8mK.js} +2 -2
  118. package/dist/web/server/assets/{teams-CbIPKf99.js → teams-DxA-vnzY.js} +4 -2
  119. package/dist/web/server/assets/telegram-DJ8s_91Y.js +1057 -0
  120. package/dist/web/server/assets/{telegram-Cv0D4gyz.js → telegram-DR7xijeS.js} +2 -2
  121. package/dist/web/server/assets/{tools-ioJcPzMW.js → tools-CsH9DI-4.js} +2 -2
  122. package/dist/web/server/assets/{tools-OfD22R-C.js → tools-V6kezUpL.js} +55 -218
  123. package/dist/web/server/assets/{use-resource-DVzK0toP.js → use-resource-CjcJwn7F.js} +1 -1
  124. package/dist/web/server/assets/{welcome-jxmpE_Jb.js → welcome-BpmcD-ia.js} +2 -2
  125. package/dist/web/server/assets/{welcome-FFEbrNT1.js → welcome-Ya8TkL4v.js} +10 -10
  126. package/dist/web/server/server.js +19 -19
  127. package/dist/worker.js +17 -0
  128. package/dist/worker.js.map +1 -1
  129. package/package.json +1 -1
  130. package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +0 -1
  131. package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +0 -1
  132. package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +0 -1
  133. package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +0 -1
  134. package/dist/web/client/assets/Dialog-s_kPtI-W.js +0 -1
  135. package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +0 -1
  136. package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +0 -1
  137. package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
  138. package/dist/web/client/assets/SkillFindings-Xng11qqx.js +0 -1
  139. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
  140. package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +0 -1
  141. package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
  142. package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
  143. package/dist/web/client/assets/TeamThread-2rm1JGSk.js +0 -1
  144. package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +0 -1
  145. package/dist/web/client/assets/_id-B72mIpcE.js +0 -1
  146. package/dist/web/client/assets/_id-Bzavnza1.js +0 -1
  147. package/dist/web/client/assets/access-Yw9jODuk.js +0 -1
  148. package/dist/web/client/assets/agents-C9xoyL7o.js +0 -1
  149. package/dist/web/client/assets/agents-TviG16wx.js +0 -1
  150. package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
  151. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
  152. package/dist/web/client/assets/attention-DmURtlJm.js +0 -1
  153. package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
  154. package/dist/web/client/assets/chevron-right-CUZiA2aG.js +0 -1
  155. package/dist/web/client/assets/config-UZz_mjO5.js +0 -1
  156. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
  157. package/dist/web/client/assets/dist-BWppw70N.js +0 -41
  158. package/dist/web/client/assets/dist-D2dwY7MR.js +0 -1
  159. package/dist/web/client/assets/entities-xVoB-p2j.js +0 -1
  160. package/dist/web/client/assets/index-Df1oUtAP.js +0 -14
  161. package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
  162. package/dist/web/client/assets/login-CPfdaqsV.js +0 -1
  163. package/dist/web/client/assets/mcp-FlYnNon0.js +0 -1
  164. package/dist/web/client/assets/model-facts-DoB6QD5y.js +0 -1
  165. package/dist/web/client/assets/parts-tIDBNsYA.js +0 -1
  166. package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
  167. package/dist/web/client/assets/routes-BZaWCoQj.js +0 -76
  168. package/dist/web/client/assets/save-f9O-CQia.js +0 -1
  169. package/dist/web/client/assets/skills-C7yDPC8s.js +0 -1
  170. package/dist/web/client/assets/style-DDuTFJUu.js +0 -7
  171. package/dist/web/client/assets/styles-BviXU81u.css +0 -2
  172. package/dist/web/client/assets/system-CL3Kz36L.js +0 -1
  173. package/dist/web/client/assets/teams-CQTEF5gV.js +0 -1
  174. package/dist/web/client/assets/teams-DQ7SqVyF.js +0 -1
  175. package/dist/web/client/assets/telegram-BLgxtGhZ.js +0 -1
  176. package/dist/web/client/assets/tools-pOQyGVYo.js +0 -1
  177. package/dist/web/client/assets/use-resource-C3MBZJop.js +0 -1
  178. package/dist/web/client/assets/welcome-Hr6JpMef.js +0 -1
  179. package/dist/web/client/assets/wrench-6BEIqKDn.js +0 -1
  180. package/dist/web/server/assets/Dialog-aup_yJv5.js +0 -85
  181. package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +0 -138
  182. package/dist/web/server/assets/SkillFindings-BdATze1A.js +0 -46
  183. package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
  184. package/dist/web/server/assets/SpawnDialog-D_SMPCG_.js +0 -132
  185. package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
  186. package/dist/web/server/assets/TeamForm-ilBaeLI4.js +0 -96
  187. package/dist/web/server/assets/_id-BsZcsabI.js +0 -383
  188. package/dist/web/server/assets/_id-D8Kj0F30.js +0 -18
  189. package/dist/web/server/assets/_id-QYifTM9w.js +0 -28
  190. package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +0 -223
  191. package/dist/web/server/assets/access-DKOpcHIJ.js +0 -232
  192. package/dist/web/server/assets/agents-B6OR3x99.js +0 -327
  193. package/dist/web/server/assets/agents-B7642eRO.js +0 -130
  194. package/dist/web/server/assets/agents-BJ-_oC2e.js +0 -14
  195. package/dist/web/server/assets/agents-CjV0w-Zy.js +0 -12
  196. package/dist/web/server/assets/agents-Dy_Q-9lG.js +0 -27
  197. package/dist/web/server/assets/attention-CLP4HYBz.js +0 -216
  198. package/dist/web/server/assets/createSsrRpc-GCCF14VW.js +0 -169
  199. package/dist/web/server/assets/entities-Dn2xzKIw.js +0 -16
  200. package/dist/web/server/assets/mcp-BI-FD-JI.js +0 -250
  201. package/dist/web/server/assets/model-facts-mrfrWQne.js +0 -136
  202. package/dist/web/server/assets/parts-B31PJkhi.js +0 -190
  203. package/dist/web/server/assets/routes-BJIJWCIE.js +0 -16
  204. package/dist/web/server/assets/skills-BqLq3ZXq.js +0 -275
  205. package/dist/web/server/assets/system-BtRA2HUs.js +0 -138
  206. package/dist/web/server/assets/teams-COaU0wN9.js +0 -108
  207. package/dist/web/server/assets/teams-Ca8W4mvl.js +0 -88
  208. package/dist/web/server/assets/telegram-Yx8nm6Ei.js +0 -984
  209. package/dist/web/server/assets/utils-C_uf36nf.js +0 -8
  210. package/dist/web/server/assets/workspace-DaitCM0t.js +0 -651
@@ -0,0 +1,376 @@
1
+ import { K as Button, M as SetupCard, O as ListRow, P as Waiting, b as CardRow, c as SelectField, dt as errorMessage, f as TextField, g as CardBody, k as Notice, lt as api, s as SecretField, v as CardForm, w as Chip, y as CardList } from "./SpawnDialog-MJWwppgC.js";
2
+ import { t as ConfirmDialog } from "./ConfirmDialog-4xeCXKHe.js";
3
+ import { t as Route } from "./mcp-Bm9U6x7N.js";
4
+ import { t as ConfigPage } from "./ConfigPage-CxzL-gTm.js";
5
+ import { useState } from "react";
6
+ import { useRouter } from "@tanstack/react-router";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Plus, Server } from "lucide-react";
9
+ //#region src/lib/mcp-form.ts
10
+ var EMPTY_MCP_DRAFT = {
11
+ name: "",
12
+ transport: "stdio",
13
+ command: "",
14
+ args: "",
15
+ url: "",
16
+ token: ""
17
+ };
18
+ /** The daemon's own rule for an endpoint: http(s), no credentials in it, no fragment. */
19
+ function endpointProblem(value) {
20
+ try {
21
+ const url = new URL(value);
22
+ if (!["http:", "https:"].includes(url.protocol)) return "An http:// or https:// address.";
23
+ if (url.username || url.password) return "No user name or password in the address: a token goes in the field beside it.";
24
+ if (url.hash) return "An address without a # part.";
25
+ return;
26
+ } catch {
27
+ return "An http:// or https:// address.";
28
+ }
29
+ }
30
+ function mcpServerForm(draft) {
31
+ const name = draft.name.trim();
32
+ const command = draft.command.trim();
33
+ const url = draft.url.trim();
34
+ const problems = {};
35
+ if (name && !/^[a-zA-Z0-9_]+$/.test(name)) problems.name = "Letters, digits and underscores only: its tools are named after it.";
36
+ const stdio = draft.transport === "stdio";
37
+ if (!stdio && url) {
38
+ const problem = endpointProblem(url);
39
+ if (problem) problems.url = problem;
40
+ }
41
+ const complete = name !== "" && (stdio ? command !== "" : url !== "");
42
+ const missing = [
43
+ name,
44
+ command,
45
+ draft.args.trim(),
46
+ url,
47
+ draft.token
48
+ ].some((value) => value !== "") && !complete ? stdio ? "A stdio server needs a name and a command." : "An http server needs a name and a URL." : null;
49
+ if (!complete || problems.name || problems.url) return {
50
+ problems,
51
+ missing,
52
+ body: null
53
+ };
54
+ return {
55
+ problems,
56
+ missing,
57
+ body: {
58
+ name,
59
+ transport: draft.transport,
60
+ command: stdio ? command : null,
61
+ args: stdio ? draft.args.split(" ").filter(Boolean) : [],
62
+ url: stdio ? null : url,
63
+ authToken: !stdio && draft.token ? draft.token : void 0
64
+ }
65
+ };
66
+ }
67
+ /** How many servers Agents are offered, as a card's state. */
68
+ function serversState(servers) {
69
+ if (servers.length === 0) return null;
70
+ const on = servers.filter((server) => server.enabled).length;
71
+ if (on === 0) return {
72
+ label: "None on",
73
+ tone: "neutral"
74
+ };
75
+ if (on === servers.length) return {
76
+ label: on === 1 ? "1 server on" : `${on} servers on`,
77
+ tone: "success"
78
+ };
79
+ return {
80
+ label: `${on} of ${servers.length} on`,
81
+ tone: "success"
82
+ };
83
+ }
84
+ //#endregion
85
+ //#region src/components/setup/McpCards.tsx
86
+ var serverPath = (id) => `/api/mcp-servers/${encodeURIComponent(id)}`;
87
+ var TRANSPORTS = [{
88
+ value: "stdio",
89
+ label: "stdio"
90
+ }, {
91
+ value: "http",
92
+ label: "http"
93
+ }];
94
+ /** A command Bazilion starts, or an address it calls. */
95
+ function AddServerCard({ onAdded }) {
96
+ const [draft, setDraft] = useState(EMPTY_MCP_DRAFT);
97
+ const [busy, setBusy] = useState(false);
98
+ const [error, setError] = useState(null);
99
+ const form = mcpServerForm(draft);
100
+ const edit = (change) => {
101
+ setError(null);
102
+ setDraft((current) => ({
103
+ ...current,
104
+ ...change
105
+ }));
106
+ };
107
+ async function add(event) {
108
+ event.preventDefault();
109
+ if (!form.body || busy) return;
110
+ setBusy(true);
111
+ setError(null);
112
+ try {
113
+ await api("/api/mcp-servers", { body: form.body });
114
+ setDraft({
115
+ ...EMPTY_MCP_DRAFT,
116
+ transport: draft.transport
117
+ });
118
+ await onAdded();
119
+ } catch (cause) {
120
+ setError(errorMessage(cause));
121
+ } finally {
122
+ setBusy(false);
123
+ }
124
+ }
125
+ return /* @__PURE__ */ jsx(SetupCard, {
126
+ labelledBy: "mcp-add",
127
+ icon: /* @__PURE__ */ jsx(Plus, { className: "size-5" }),
128
+ title: "Add a server",
129
+ description: "A stdio server is a command Bazilion starts; an http server is an address it calls.",
130
+ children: /* @__PURE__ */ jsxs(CardForm, {
131
+ onSubmit: add,
132
+ children: [
133
+ /* @__PURE__ */ jsxs("div", {
134
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_12rem]",
135
+ children: [/* @__PURE__ */ jsx(TextField, {
136
+ label: "Name",
137
+ value: draft.name,
138
+ disabled: busy,
139
+ placeholder: "playwright",
140
+ mono: true,
141
+ className: "max-w-none",
142
+ problem: form.problems.name,
143
+ onChange: (name) => edit({ name })
144
+ }), /* @__PURE__ */ jsx(SelectField, {
145
+ label: "Transport",
146
+ value: draft.transport,
147
+ options: TRANSPORTS,
148
+ disabled: busy,
149
+ className: "max-w-none",
150
+ onChange: (transport) => edit({ transport })
151
+ })]
152
+ }),
153
+ draft.transport === "stdio" ? /* @__PURE__ */ jsxs("div", {
154
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[12rem_minmax(0,1fr)]",
155
+ children: [/* @__PURE__ */ jsx(TextField, {
156
+ label: "Command",
157
+ value: draft.command,
158
+ disabled: busy,
159
+ placeholder: "npx",
160
+ mono: true,
161
+ className: "max-w-none",
162
+ onChange: (command) => edit({ command })
163
+ }), /* @__PURE__ */ jsx(TextField, {
164
+ label: "Args (space-separated)",
165
+ value: draft.args,
166
+ disabled: busy,
167
+ placeholder: "-y @modelcontextprotocol/server-filesystem /srv/data",
168
+ mono: true,
169
+ className: "max-w-none",
170
+ onChange: (args) => edit({ args })
171
+ })]
172
+ }) : /* @__PURE__ */ jsxs("div", {
173
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_16rem]",
174
+ children: [/* @__PURE__ */ jsx(TextField, {
175
+ label: "URL",
176
+ value: draft.url,
177
+ disabled: busy,
178
+ placeholder: "https://mcp.example.com/mcp",
179
+ mono: true,
180
+ inputMode: "url",
181
+ className: "max-w-none",
182
+ problem: form.problems.url,
183
+ onChange: (url) => edit({ url })
184
+ }), /* @__PURE__ */ jsx(SecretField, {
185
+ label: "Bearer token (optional)",
186
+ saved: false,
187
+ value: draft.token,
188
+ disabled: busy,
189
+ onChange: (token) => edit({ token })
190
+ })]
191
+ }),
192
+ /* @__PURE__ */ jsxs("div", {
193
+ className: "flex flex-wrap items-center gap-x-4 gap-y-2",
194
+ children: [/* @__PURE__ */ jsx(Button, {
195
+ variant: "primary",
196
+ type: "submit",
197
+ disabled: busy || !form.body,
198
+ children: busy ? "Adding…" : "Add server"
199
+ }), error ? /* @__PURE__ */ jsxs("p", {
200
+ role: "alert",
201
+ className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
202
+ children: ["Nothing was added: ", error]
203
+ }) : form.missing && /* @__PURE__ */ jsx("p", {
204
+ role: "status",
205
+ className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
206
+ children: form.missing
207
+ })]
208
+ })
209
+ ]
210
+ })
211
+ });
212
+ }
213
+ /** The servers whose tools are offered to every Agent turn while they are switched on. */
214
+ function ServersCard({ servers, onChanged }) {
215
+ const [tests, setTests] = useState({});
216
+ const [busyId, setBusyId] = useState(null);
217
+ const [error, setError] = useState(null);
218
+ const [deleting, setDeleting] = useState(null);
219
+ const state = serversState(servers);
220
+ async function toggle(server) {
221
+ setBusyId(server.id);
222
+ setError(null);
223
+ try {
224
+ await api(serverPath(server.id), {
225
+ method: "PATCH",
226
+ body: { enabled: !server.enabled }
227
+ });
228
+ await onChanged();
229
+ } catch (cause) {
230
+ setError(errorMessage(cause));
231
+ } finally {
232
+ setBusyId(null);
233
+ }
234
+ }
235
+ async function test(id) {
236
+ setTests((current) => ({
237
+ ...current,
238
+ [id]: { kind: "pending" }
239
+ }));
240
+ let result;
241
+ try {
242
+ const body = await api(`${serverPath(id)}/test`, { method: "POST" });
243
+ const tools = body.tools ?? [];
244
+ result = body.ok ? {
245
+ kind: "success",
246
+ message: `${tools.length === 1 ? "1 tool" : `${tools.length} tools`}: ${tools.map((tool) => tool.name).join(", ")}`
247
+ } : {
248
+ kind: "error",
249
+ message: body.error ?? "Test failed"
250
+ };
251
+ } catch (cause) {
252
+ result = {
253
+ kind: "error",
254
+ message: errorMessage(cause)
255
+ };
256
+ }
257
+ setTests((current) => ({
258
+ ...current,
259
+ [id]: result
260
+ }));
261
+ }
262
+ return /* @__PURE__ */ jsxs(SetupCard, {
263
+ labelledBy: "mcp-servers",
264
+ icon: /* @__PURE__ */ jsx(Server, { className: "size-5" }),
265
+ title: "Servers",
266
+ description: "Their tools are offered to every Agent turn while they are switched on.",
267
+ action: state && /* @__PURE__ */ jsx(Chip, {
268
+ tone: state.tone,
269
+ children: state.label
270
+ }),
271
+ children: [
272
+ servers.length === 0 ? /* @__PURE__ */ jsx(CardRow, {
273
+ className: "py-4 text-sm text-muted-foreground",
274
+ children: "No MCP servers yet; add one above."
275
+ }) : /* @__PURE__ */ jsx(CardList, { children: servers.map((server) => {
276
+ const result = tests[server.id];
277
+ const busy = busyId === server.id;
278
+ return /* @__PURE__ */ jsxs(ListRow, {
279
+ title: server.name,
280
+ chip: /* @__PURE__ */ jsx(Chip, {
281
+ tone: server.enabled ? "success" : "neutral",
282
+ children: server.enabled ? "Enabled" : "Disabled"
283
+ }),
284
+ meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
285
+ /* @__PURE__ */ jsx("span", { children: server.transport }),
286
+ server.hasAuthToken && /* @__PURE__ */ jsx("span", { children: "bearer token" }),
287
+ /* @__PURE__ */ jsx("code", {
288
+ className: "break-all",
289
+ children: server.transport === "stdio" ? `${server.command ?? ""} ${server.args.join(" ")}`.trim() : server.url
290
+ })
291
+ ] }),
292
+ actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
293
+ /* @__PURE__ */ jsx(Button, {
294
+ variant: "ghost",
295
+ disabled: result?.kind === "pending",
296
+ "aria-label": `Test ${server.name}`,
297
+ onClick: () => void test(server.id),
298
+ children: "Test"
299
+ }),
300
+ /* @__PURE__ */ jsx(Button, {
301
+ variant: "ghost",
302
+ disabled: busy,
303
+ "aria-label": `${server.enabled ? "Disable" : "Enable"} ${server.name}`,
304
+ onClick: () => void toggle(server),
305
+ children: busy ? "Working…" : server.enabled ? "Disable" : "Enable"
306
+ }),
307
+ /* @__PURE__ */ jsx(Button, {
308
+ variant: "danger",
309
+ disabled: busy,
310
+ "aria-label": `Delete ${server.name}`,
311
+ onClick: () => setDeleting(server),
312
+ children: "Delete"
313
+ })
314
+ ] }),
315
+ children: [
316
+ result?.kind === "pending" && /* @__PURE__ */ jsx(Waiting, { children: "Connecting…" }),
317
+ result?.kind === "success" && /* @__PURE__ */ jsx(Notice, {
318
+ tone: "success",
319
+ children: result.message
320
+ }),
321
+ result?.kind === "error" && /* @__PURE__ */ jsx(Notice, {
322
+ tone: "warning",
323
+ role: "alert",
324
+ children: result.message
325
+ })
326
+ ]
327
+ }, server.id);
328
+ }) }),
329
+ error && /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Notice, {
330
+ tone: "warning",
331
+ role: "alert",
332
+ title: "That did not work.",
333
+ children: error
334
+ }) }),
335
+ /* @__PURE__ */ jsx(ConfirmDialog, {
336
+ open: deleting !== null,
337
+ onOpenChange: (open) => {
338
+ if (!open) setDeleting(null);
339
+ },
340
+ title: `Delete MCP server ${deleting?.name ?? ""}?`,
341
+ description: /* @__PURE__ */ jsx("p", {
342
+ className: "m-0",
343
+ children: "This removes the server and its stored bearer token, closes its connection and removes its tools from later Agent turns."
344
+ }),
345
+ confirmLabel: "Delete MCP server",
346
+ onConfirm: async () => {
347
+ if (!deleting) return;
348
+ await api(serverPath(deleting.id), { method: "DELETE" });
349
+ await onChanged();
350
+ }
351
+ })
352
+ ]
353
+ });
354
+ }
355
+ //#endregion
356
+ //#region src/routes/config/mcp.tsx?tsr-split=component
357
+ function McpPage() {
358
+ const { servers } = Route.useLoaderData();
359
+ const router = useRouter();
360
+ const reload = () => router.invalidate({ sync: true });
361
+ return /* @__PURE__ */ jsxs(ConfigPage, {
362
+ title: "MCP servers",
363
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
364
+ "Tools from these Model Context Protocol servers are offered to every Agent turn as",
365
+ " ",
366
+ /* @__PURE__ */ jsx("code", { children: "mcp__<server>__<tool>" }),
367
+ ". A stdio server runs as a daemon child process with the configured provider keys and secrets, never Bazilion's own credentials; a Streamable HTTP server can use a bearer token."
368
+ ] }),
369
+ children: [/* @__PURE__ */ jsx(AddServerCard, { onAdded: reload }), /* @__PURE__ */ jsx(ServersCard, {
370
+ servers,
371
+ onChanged: reload
372
+ })]
373
+ });
374
+ }
375
+ //#endregion
376
+ export { McpPage as component };
@@ -0,0 +1,95 @@
1
+ import { lt as api } from "./SpawnDialog-MJWwppgC.js";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
+ import { useRouterState } from "@tanstack/react-router";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/lib/attention-count.tsx
6
+ var POLL_MS = 5e3;
7
+ var AttentionCountContext = createContext({
8
+ open: 0,
9
+ waiting: 0,
10
+ agentWaits: 0,
11
+ refresh: () => {}
12
+ });
13
+ function useAttentionCount() {
14
+ return useContext(AttentionCountContext);
15
+ }
16
+ /** The counts from a summary: what the badge shows and what the title shows. */
17
+ function attentionCounts(summary) {
18
+ return {
19
+ open: summary.openTotal,
20
+ waiting: summary.bySeverity.action_required,
21
+ agentWaits: (summary.byKind.agent_question ?? 0) + (summary.byKind.command_approval ?? 0)
22
+ };
23
+ }
24
+ function AttentionCountProvider({ enabled, children }) {
25
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
26
+ const [counts, setCounts] = useState({
27
+ open: 0,
28
+ waiting: 0,
29
+ agentWaits: 0
30
+ });
31
+ const controller = useRef(null);
32
+ const load = useCallback(() => {
33
+ if (document.visibilityState === "hidden") return;
34
+ controller.current?.abort();
35
+ const current = new AbortController();
36
+ controller.current = current;
37
+ api("/api/attention/summary", { signal: current.signal }).then((summary) => setCounts(attentionCounts(summary))).catch(() => {});
38
+ }, []);
39
+ useEffect(() => {
40
+ if (!enabled) return;
41
+ load();
42
+ const timer = setInterval(load, POLL_MS);
43
+ const onShow = () => {
44
+ if (document.visibilityState === "visible") load();
45
+ };
46
+ document.addEventListener("visibilitychange", onShow);
47
+ return () => {
48
+ clearInterval(timer);
49
+ document.removeEventListener("visibilitychange", onShow);
50
+ controller.current?.abort();
51
+ };
52
+ }, [
53
+ enabled,
54
+ load,
55
+ pathname
56
+ ]);
57
+ const value = useMemo(() => ({
58
+ ...counts,
59
+ refresh: load
60
+ }), [counts, load]);
61
+ return /* @__PURE__ */ jsx(AttentionCountContext.Provider, {
62
+ value,
63
+ children
64
+ });
65
+ }
66
+ //#endregion
67
+ //#region src/lib/page-title.tsx
68
+ var APP = "bazilion";
69
+ var SetTitle = createContext(() => {});
70
+ /** "(2) Mira · Launch — bazilion": the count only while something waits. */
71
+ function documentTitle(title, waiting) {
72
+ const page = title ? `${title} — ${APP}` : APP;
73
+ return waiting > 0 ? `(${waiting > 99 ? "99+" : waiting}) ${page}` : page;
74
+ }
75
+ function PageTitleProvider({ children }) {
76
+ const [title, setTitle] = useState(null);
77
+ const { waiting } = useAttentionCount();
78
+ useEffect(() => {
79
+ document.title = documentTitle(title, waiting);
80
+ }, [title, waiting]);
81
+ return /* @__PURE__ */ jsx(SetTitle.Provider, {
82
+ value: setTitle,
83
+ children
84
+ });
85
+ }
86
+ /** Name the page in the tab; null leaves the app's name alone. */
87
+ function usePageTitle(title) {
88
+ const set = useContext(SetTitle);
89
+ useEffect(() => {
90
+ set(title);
91
+ return () => set(null);
92
+ }, [set, title]);
93
+ }
94
+ //#endregion
95
+ export { useAttentionCount as i, usePageTitle as n, AttentionCountProvider as r, PageTitleProvider as t };