bazilion 0.51.0 → 0.53.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 (205) hide show
  1. package/dist/cli.js +74 -28
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +547 -187
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-CO_uijWF.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-Dl35c-Ux.js +1 -0
  7. package/dist/web/client/assets/ConfigPage-DiQiJXP6.js +1 -0
  8. package/dist/web/client/assets/ConfirmDialog-BVytx3kN.js +1 -0
  9. package/dist/web/client/assets/ConnectionsView-DDrBaiLg.js +1 -0
  10. package/dist/web/client/assets/Dialog-BTDzv3J5.js +1 -0
  11. package/dist/web/client/assets/ManagePage-xlePXXx5.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-BMiRKFfb.js +1 -0
  13. package/dist/web/client/assets/Segmented-Co4n2C5X.js +1 -0
  14. package/dist/web/client/assets/SpawnDialog-ejwXnyxy.js +1 -0
  15. package/dist/web/client/assets/SpawnTeamModal-Cp-nAvIC.js +1 -0
  16. package/dist/web/client/assets/TeamForm-Cz9uDVvb.js +1 -0
  17. package/dist/web/client/assets/TeamThread-D8xqE_gb.js +1 -0
  18. package/dist/web/client/assets/UnsavedChangesGuard-DmT4nBQU.js +1 -0
  19. package/dist/web/client/assets/_id-DEQxwq2v.js +1 -0
  20. package/dist/web/client/assets/_id-DSRgpxEc.js +1 -0
  21. package/dist/web/client/assets/access-34_ShgHU.js +1 -0
  22. package/dist/web/client/assets/agent-actions--EO4yJ4Q.js +1 -0
  23. package/dist/web/client/assets/agents-C87yBHaR.js +1 -0
  24. package/dist/web/client/assets/agents-DvCSl1Ro.js +1 -0
  25. package/dist/web/client/assets/api-CoLs57oO.js +1 -0
  26. package/dist/web/client/assets/arrow-right-BhTWtC9z.js +1 -0
  27. package/dist/web/client/assets/attention-CteEeRvX.js +1 -0
  28. package/dist/web/client/assets/chevron-right-BqOIX9UM.js +1 -0
  29. package/dist/web/client/assets/config-XJuQeEP4.js +1 -0
  30. package/dist/web/client/assets/createLucideIcon-dN8ooBD1.js +1 -0
  31. package/dist/web/client/assets/download-Dj-1ltZb.js +1 -0
  32. package/dist/web/client/assets/file-text-DiP-LaEg.js +1 -0
  33. package/dist/web/client/assets/form-Bvr_f9lR.js +1 -0
  34. package/dist/web/client/assets/images-BKjyhYUc.js +1 -0
  35. package/dist/web/client/assets/index-J_Uqj4md.js +54 -0
  36. package/dist/web/client/assets/key-round-QpqZklz6.js +1 -0
  37. package/dist/web/client/assets/list-checks-BeyG5SVQ.js +1 -0
  38. package/dist/web/client/assets/login-076Bc601.js +1 -0
  39. package/dist/web/client/assets/manage-CsrV2hhK.js +1 -0
  40. package/dist/web/client/assets/mcp-8N0BqZ0G.js +1 -0
  41. package/dist/web/client/assets/message-square-DnpSOYv4.js +1 -0
  42. package/dist/web/client/assets/model-facts-DoB6QD5y.js +1 -0
  43. package/dist/web/client/assets/network-BC7rNaOC.js +1 -0
  44. package/dist/web/client/assets/parts-B0JBolvG.js +1 -0
  45. package/dist/web/client/assets/plus-DZ3KVo7E.js +1 -0
  46. package/dist/web/client/assets/routes-3HkZZOOe.js +76 -0
  47. package/dist/web/client/assets/skills-DiaqZRXT.js +1 -0
  48. package/dist/web/client/assets/square-terminal-hQZ6pexU.js +1 -0
  49. package/dist/web/client/assets/style-BtcFIkOS.js +7 -0
  50. package/dist/web/client/assets/styles-C7Ztw15K.css +2 -0
  51. package/dist/web/client/assets/system-YWlJ8ogO.js +1 -0
  52. package/dist/web/client/assets/teams-DQwceMvk.js +1 -0
  53. package/dist/web/client/assets/teams-DTC3plIH.js +1 -0
  54. package/dist/web/client/assets/telegram-D4wINntt.js +1 -0
  55. package/dist/web/client/assets/tools-CZeQ9pDx.js +1 -0
  56. package/dist/web/client/assets/use-resource-BaTkTGvG.js +1 -0
  57. package/dist/web/client/assets/welcome-CnxP_RCk.js +1 -0
  58. package/dist/web/client/assets/wrench-BrwBswfo.js +1 -0
  59. package/dist/web/server/assets/{AddProviderDialog-CR6TRYdZ.js → AddProviderDialog-Di5crZUB.js} +9 -205
  60. package/dist/web/server/assets/AgentTemplateParts-Cqy7kSzx.js +269 -0
  61. package/dist/web/server/assets/{ConfigPage-CIh3ohea.js → ConfigPage-oXM3wyOU.js} +2 -2
  62. package/dist/web/server/assets/{ConfirmDialog-B79K2KEW.js → ConfirmDialog-DfaJ--A6.js} +2 -2
  63. package/dist/web/server/assets/{ConnectionsView-BIMYdp9C.js → ConnectionsView-DZrLoNoW.js} +7 -7
  64. package/dist/web/server/assets/{Dialog-CVqpXxuN.js → Dialog-aup_yJv5.js} +1 -1
  65. package/dist/web/server/assets/ManagePage-0LKHEcT_.js +29 -0
  66. package/dist/web/server/assets/ModelMenu-BAZeARx6.js +138 -0
  67. package/dist/web/server/assets/{Rail-Cg-efcpA.js → Rail-7JU6ly2O.js} +17 -107
  68. package/dist/web/server/assets/{SectionTabs-DrcgVeZd.js → SectionTabs-CWQ5orUW.js} +12 -5
  69. package/dist/web/server/assets/SpawnDialog-CYkwzETs.js +124 -0
  70. package/dist/web/server/assets/SpawnTeamModal-CCe6P82H.js +127 -0
  71. package/dist/web/server/assets/TeamForm-BzQmdhVi.js +141 -0
  72. package/dist/web/server/assets/{TeamThread-5CjVPcDr.js → TeamThread-SyQpUvz5.js} +3 -3
  73. package/dist/web/server/assets/{UnsavedChangesGuard-CyF2Z9p1.js → UnsavedChangesGuard-DrOvPV14.js} +1 -1
  74. package/dist/web/server/assets/_id-AcyGvFrE.js +400 -0
  75. package/dist/web/server/assets/{_id-8bsYEcGg.js → _id-BGTgqsWm.js} +8 -4
  76. package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
  77. package/dist/web/server/assets/{_id-0fEWiVZX.js → _id-DPGzfmjG.js} +258 -206
  78. package/dist/web/server/assets/_id-DXm9W55C.js +16 -0
  79. package/dist/web/server/assets/_id-DojvxRZn.js +39 -0
  80. package/dist/web/server/assets/_tanstack-start-manifest_v-D7RvKGRH.js +285 -0
  81. package/dist/web/server/assets/{tokens-C-oDTqnp.js → access-BJe-NduL.js} +5 -5
  82. package/dist/web/server/assets/access-CKSW7MFH.js +297 -0
  83. package/dist/web/server/assets/{tokens-CEdl8puR.js → access-WWspT0v4.js} +5 -4
  84. package/dist/web/server/assets/agent-actions-CUDMCG0F.js +20 -0
  85. package/dist/web/server/assets/agents-1sjSvp5p.js +12 -0
  86. package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-6d9WxbYF.js} +9 -6
  87. package/dist/web/server/assets/agents-DKVGUwD1.js +31 -0
  88. package/dist/web/server/assets/agents-DUI4Yjtg.js +13 -0
  89. package/dist/web/server/assets/agents-DsHeRaLq.js +327 -0
  90. package/dist/web/server/assets/agents-DtLDoZ_u.js +136 -0
  91. package/dist/web/server/assets/{attention-Cr7puThv.js → attention-B6sSDR_4.js} +2 -1
  92. package/dist/web/server/assets/{attention-CHQEQiZl.js → attention-DefKwvgm.js} +2 -2
  93. package/dist/web/server/assets/attention-johfkM0_.js +203 -0
  94. package/dist/web/server/assets/{config-DOp28gcy.js → config-Clz57LuN.js} +186 -87
  95. package/dist/web/server/assets/{config-DzgkbBoD.js → config-DYAaaE9Z.js} +2 -2
  96. package/dist/web/server/assets/{createSsrRpc-CcLbajrF.js → createSsrRpc-BijMHgqE.js} +2 -46
  97. package/dist/web/server/assets/form-BRQAsKKq.js +319 -0
  98. package/dist/web/server/assets/manage-Ppyi3Y5y.js +230 -0
  99. package/dist/web/server/assets/mcp-Ce6O8Qs2.js +378 -0
  100. package/dist/web/server/assets/{mcp-D3OCoHtO.js → mcp-DB38leWS.js} +2 -2
  101. package/dist/web/server/assets/model-facts-mrfrWQne.js +136 -0
  102. package/dist/web/server/assets/parts-mabERIJZ.js +380 -0
  103. package/dist/web/server/assets/{router-Cs2Ak4II.js → router-C97bwlXi.js} +55 -50
  104. package/dist/web/server/assets/{routes-BSNOKE-C.js → routes-C4aGqXfr.js} +65 -17
  105. package/dist/web/server/assets/{routes-CO4l-GJ0.js → routes-DuOShl4q.js} +2 -2
  106. package/dist/web/server/assets/{routes-BVwqgZGI.js → routes-IHMVKpDK.js} +3 -3
  107. package/dist/web/server/assets/{skills-CggQJk6a.js → skills-B7sg0QKS.js} +2 -2
  108. package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
  109. package/dist/web/server/assets/skills-hfTSwqsG.js +353 -0
  110. package/dist/web/server/assets/{style-GYDODk2F.js → style-BR7ufS6Z.js} +1 -1
  111. package/dist/web/server/assets/system-CNQpt3JB.js +145 -0
  112. package/dist/web/server/assets/{system-DtswhLW62.js → system-D3th6n2E.js} +4 -2
  113. package/dist/web/server/assets/{system-DsJfpBPl.js → system-DaP0ol67.js} +2 -2
  114. package/dist/web/server/assets/{teams-B6lBhvdL.js → teams-4cEZ4_rw.js} +4 -2
  115. package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
  116. package/dist/web/server/assets/teams-BKHe67f3.js +176 -0
  117. package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
  118. package/dist/web/server/assets/teams-C3xwTz8-.js +219 -0
  119. package/dist/web/server/assets/{teams-Bp2tERZe.js → teams-CuKE5iAK.js} +2 -2
  120. package/dist/web/server/assets/{telegram-D2RZriz_.js → telegram-BnQADwnj.js} +5 -5
  121. package/dist/web/server/assets/telegram-BpmK-HHV.js +1059 -0
  122. package/dist/web/server/assets/{telegram-Gy7_9yih.js → telegram-CGol0CKX.js} +3 -3
  123. package/dist/web/server/assets/tools-BQeWn7Tj.js +12 -0
  124. package/dist/web/server/assets/tools-C-wwWjLI.js +12 -0
  125. package/dist/web/server/assets/tools-CURTfG2q.js +341 -0
  126. package/dist/web/server/assets/{use-resource-ChQozXVI.js → use-resource-DVzK0toP.js} +1 -1
  127. package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
  128. package/dist/web/server/assets/{welcome-BLw1G6SS.js → welcome-OiZCAIHZ.js} +5 -5
  129. package/dist/web/server/assets/{welcome-ByAkvHSP.js → welcome-SNsE49JO.js} +2 -2
  130. package/dist/web/server/assets/{workspace-DeEYMPDX.js → workspace-DaitCM0t.js} +1 -8
  131. package/dist/web/server/server.js +30 -30
  132. package/dist/worker.js +202 -120
  133. package/dist/worker.js.map +1 -1
  134. package/package.json +1 -1
  135. package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +0 -1
  136. package/dist/web/client/assets/ConfigPage-pupvtSCX.js +0 -1
  137. package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +0 -1
  138. package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +0 -1
  139. package/dist/web/client/assets/Dialog-bg86_x4v.js +0 -1
  140. package/dist/web/client/assets/FieldRow-B8eIni5r.js +0 -1
  141. package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +0 -1
  142. package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +0 -1
  143. package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
  144. package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +0 -1
  145. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
  146. package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +0 -1
  147. package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
  148. package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
  149. package/dist/web/client/assets/TeamThread-DFvbakHo.js +0 -1
  150. package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +0 -1
  151. package/dist/web/client/assets/_id-BjNtLwak.js +0 -1
  152. package/dist/web/client/assets/_id-BklaQf3z.js +0 -1
  153. package/dist/web/client/assets/agents-D9cUF2d9.js +0 -1
  154. package/dist/web/client/assets/agents-wuBlzx4e.js +0 -1
  155. package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
  156. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
  157. package/dist/web/client/assets/attention-8ZkSLl2e.js +0 -1
  158. package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
  159. package/dist/web/client/assets/config-Con_BbSh.js +0 -1
  160. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
  161. package/dist/web/client/assets/index-Br9qkGM-.js +0 -54
  162. package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
  163. package/dist/web/client/assets/login-llnOKSJc.js +0 -1
  164. package/dist/web/client/assets/mcp-zIUguMSI.js +0 -1
  165. package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
  166. package/dist/web/client/assets/routes-BY5uqJ2n.js +0 -76
  167. package/dist/web/client/assets/save-f9O-CQia.js +0 -1
  168. package/dist/web/client/assets/services-esLrcTwe.js +0 -1
  169. package/dist/web/client/assets/skills-DzYXksM0.js +0 -1
  170. package/dist/web/client/assets/style-Cdzqt_TJ.js +0 -7
  171. package/dist/web/client/assets/styles-BRSS6yrm.css +0 -2
  172. package/dist/web/client/assets/system-CsI66nyZ.js +0 -1
  173. package/dist/web/client/assets/teams-CHE_zpxS.js +0 -1
  174. package/dist/web/client/assets/teams-dxG9OESG.js +0 -1
  175. package/dist/web/client/assets/telegram-C3dGndJV.js +0 -1
  176. package/dist/web/client/assets/tokens-CNNH-Wr9.js +0 -1
  177. package/dist/web/client/assets/use-resource-BjnxgGvh.js +0 -1
  178. package/dist/web/client/assets/welcome-C8EOtc8P.js +0 -1
  179. package/dist/web/server/assets/FieldRow-CHVhX2rS.js +0 -173
  180. package/dist/web/server/assets/ModelSelect-DrZrdndo.js +0 -43
  181. package/dist/web/server/assets/SkillFindings-DSDiL6hn.js +0 -46
  182. package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
  183. package/dist/web/server/assets/SpawnDialog-BUUlLxE9.js +0 -129
  184. package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
  185. package/dist/web/server/assets/TeamForm-CvQAs2FA.js +0 -96
  186. package/dist/web/server/assets/_id-BvAaRSUW.js +0 -18
  187. package/dist/web/server/assets/_id-Dg6M_qfr.js +0 -383
  188. package/dist/web/server/assets/_id-Dji7xr9C.js +0 -28
  189. package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +0 -214
  190. package/dist/web/server/assets/agents-BDA5yYZ2.js +0 -130
  191. package/dist/web/server/assets/agents-BTDxmp-F.js +0 -12
  192. package/dist/web/server/assets/agents-DM7guWF2.js +0 -14
  193. package/dist/web/server/assets/agents-DktqUffG.js +0 -327
  194. package/dist/web/server/assets/agents-xgZ9rsac.js +0 -27
  195. package/dist/web/server/assets/attention-De3-ehuf.js +0 -216
  196. package/dist/web/server/assets/mcp-CO_tycXU.js +0 -250
  197. package/dist/web/server/assets/services-DZLxUSG8.js +0 -13
  198. package/dist/web/server/assets/services-DsHRLL8q.js +0 -12
  199. package/dist/web/server/assets/services-DsvpaF3L.js +0 -74
  200. package/dist/web/server/assets/skills-DKYV7PTk.js +0 -275
  201. package/dist/web/server/assets/system-CZ2qzBz3.js +0 -138
  202. package/dist/web/server/assets/teams-B6PzNcoy.js +0 -88
  203. package/dist/web/server/assets/teams-C-8iz-uV.js +0 -108
  204. package/dist/web/server/assets/telegram-CXrP3hMp.js +0 -984
  205. package/dist/web/server/assets/tokens-DSLwQ1Pw.js +0 -232
@@ -0,0 +1,378 @@
1
+ import { C as api, T as errorMessage, u as Button } from "./workspace-DaitCM0t.js";
2
+ import { t as ConfirmDialog } from "./ConfirmDialog-DfaJ--A6.js";
3
+ import { a as CardForm, d as Chip, g as Notice, h as ListRow, o as CardList, r as CardBody, s as CardRow, x as Waiting, y as SetupCard } from "./parts-mabERIJZ.js";
4
+ import { l as TextField, o as SecretField, s as SelectField } from "./form-BRQAsKKq.js";
5
+ import { t as Route } from "./mcp-DB38leWS.js";
6
+ import { t as ConfigPage } from "./ConfigPage-oXM3wyOU.js";
7
+ import { useState } from "react";
8
+ import { useRouter } from "@tanstack/react-router";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Plus, Server } from "lucide-react";
11
+ //#region src/lib/mcp-form.ts
12
+ var EMPTY_MCP_DRAFT = {
13
+ name: "",
14
+ transport: "stdio",
15
+ command: "",
16
+ args: "",
17
+ url: "",
18
+ token: ""
19
+ };
20
+ /** The daemon's own rule for an endpoint: http(s), no credentials in it, no fragment. */
21
+ function endpointProblem(value) {
22
+ try {
23
+ const url = new URL(value);
24
+ if (!["http:", "https:"].includes(url.protocol)) return "An http:// or https:// address.";
25
+ if (url.username || url.password) return "No user name or password in the address: a token goes in the field beside it.";
26
+ if (url.hash) return "An address without a # part.";
27
+ return;
28
+ } catch {
29
+ return "An http:// or https:// address.";
30
+ }
31
+ }
32
+ function mcpServerForm(draft) {
33
+ const name = draft.name.trim();
34
+ const command = draft.command.trim();
35
+ const url = draft.url.trim();
36
+ const problems = {};
37
+ if (name && !/^[a-zA-Z0-9_]+$/.test(name)) problems.name = "Letters, digits and underscores only: its tools are named after it.";
38
+ const stdio = draft.transport === "stdio";
39
+ if (!stdio && url) {
40
+ const problem = endpointProblem(url);
41
+ if (problem) problems.url = problem;
42
+ }
43
+ const complete = name !== "" && (stdio ? command !== "" : url !== "");
44
+ const missing = [
45
+ name,
46
+ command,
47
+ draft.args.trim(),
48
+ url,
49
+ draft.token
50
+ ].some((value) => value !== "") && !complete ? stdio ? "A stdio server needs a name and a command." : "An http server needs a name and a URL." : null;
51
+ if (!complete || problems.name || problems.url) return {
52
+ problems,
53
+ missing,
54
+ body: null
55
+ };
56
+ return {
57
+ problems,
58
+ missing,
59
+ body: {
60
+ name,
61
+ transport: draft.transport,
62
+ command: stdio ? command : null,
63
+ args: stdio ? draft.args.split(" ").filter(Boolean) : [],
64
+ url: stdio ? null : url,
65
+ authToken: !stdio && draft.token ? draft.token : void 0
66
+ }
67
+ };
68
+ }
69
+ /** How many servers Agents are offered, as a card's state. */
70
+ function serversState(servers) {
71
+ if (servers.length === 0) return null;
72
+ const on = servers.filter((server) => server.enabled).length;
73
+ if (on === 0) return {
74
+ label: "None on",
75
+ tone: "neutral"
76
+ };
77
+ if (on === servers.length) return {
78
+ label: on === 1 ? "1 server on" : `${on} servers on`,
79
+ tone: "success"
80
+ };
81
+ return {
82
+ label: `${on} of ${servers.length} on`,
83
+ tone: "success"
84
+ };
85
+ }
86
+ //#endregion
87
+ //#region src/components/setup/McpCards.tsx
88
+ var serverPath = (id) => `/api/mcp-servers/${encodeURIComponent(id)}`;
89
+ var TRANSPORTS = [{
90
+ value: "stdio",
91
+ label: "stdio"
92
+ }, {
93
+ value: "http",
94
+ label: "http"
95
+ }];
96
+ /** A command Bazilion starts, or an address it calls. */
97
+ function AddServerCard({ onAdded }) {
98
+ const [draft, setDraft] = useState(EMPTY_MCP_DRAFT);
99
+ const [busy, setBusy] = useState(false);
100
+ const [error, setError] = useState(null);
101
+ const form = mcpServerForm(draft);
102
+ const edit = (change) => {
103
+ setError(null);
104
+ setDraft((current) => ({
105
+ ...current,
106
+ ...change
107
+ }));
108
+ };
109
+ async function add(event) {
110
+ event.preventDefault();
111
+ if (!form.body || busy) return;
112
+ setBusy(true);
113
+ setError(null);
114
+ try {
115
+ await api("/api/mcp-servers", { body: form.body });
116
+ setDraft({
117
+ ...EMPTY_MCP_DRAFT,
118
+ transport: draft.transport
119
+ });
120
+ await onAdded();
121
+ } catch (cause) {
122
+ setError(errorMessage(cause));
123
+ } finally {
124
+ setBusy(false);
125
+ }
126
+ }
127
+ return /* @__PURE__ */ jsx(SetupCard, {
128
+ labelledBy: "mcp-add",
129
+ icon: /* @__PURE__ */ jsx(Plus, { className: "size-5" }),
130
+ title: "Add a server",
131
+ description: "A stdio server is a command Bazilion starts; an http server is an address it calls.",
132
+ children: /* @__PURE__ */ jsxs(CardForm, {
133
+ onSubmit: add,
134
+ children: [
135
+ /* @__PURE__ */ jsxs("div", {
136
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_12rem]",
137
+ children: [/* @__PURE__ */ jsx(TextField, {
138
+ label: "Name",
139
+ value: draft.name,
140
+ disabled: busy,
141
+ placeholder: "playwright",
142
+ mono: true,
143
+ className: "max-w-none",
144
+ problem: form.problems.name,
145
+ onChange: (name) => edit({ name })
146
+ }), /* @__PURE__ */ jsx(SelectField, {
147
+ label: "Transport",
148
+ value: draft.transport,
149
+ options: TRANSPORTS,
150
+ disabled: busy,
151
+ className: "max-w-none",
152
+ onChange: (transport) => edit({ transport })
153
+ })]
154
+ }),
155
+ draft.transport === "stdio" ? /* @__PURE__ */ jsxs("div", {
156
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[12rem_minmax(0,1fr)]",
157
+ children: [/* @__PURE__ */ jsx(TextField, {
158
+ label: "Command",
159
+ value: draft.command,
160
+ disabled: busy,
161
+ placeholder: "npx",
162
+ mono: true,
163
+ className: "max-w-none",
164
+ onChange: (command) => edit({ command })
165
+ }), /* @__PURE__ */ jsx(TextField, {
166
+ label: "Args (space-separated)",
167
+ value: draft.args,
168
+ disabled: busy,
169
+ placeholder: "-y @modelcontextprotocol/server-filesystem /srv/data",
170
+ mono: true,
171
+ className: "max-w-none",
172
+ onChange: (args) => edit({ args })
173
+ })]
174
+ }) : /* @__PURE__ */ jsxs("div", {
175
+ className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_16rem]",
176
+ children: [/* @__PURE__ */ jsx(TextField, {
177
+ label: "URL",
178
+ value: draft.url,
179
+ disabled: busy,
180
+ placeholder: "https://mcp.example.com/mcp",
181
+ mono: true,
182
+ inputMode: "url",
183
+ className: "max-w-none",
184
+ problem: form.problems.url,
185
+ onChange: (url) => edit({ url })
186
+ }), /* @__PURE__ */ jsx(SecretField, {
187
+ label: "Bearer token (optional)",
188
+ saved: false,
189
+ value: draft.token,
190
+ disabled: busy,
191
+ onChange: (token) => edit({ token })
192
+ })]
193
+ }),
194
+ /* @__PURE__ */ jsxs("div", {
195
+ className: "flex flex-wrap items-center gap-x-4 gap-y-2",
196
+ children: [/* @__PURE__ */ jsx(Button, {
197
+ variant: "primary",
198
+ type: "submit",
199
+ disabled: busy || !form.body,
200
+ children: busy ? "Adding…" : "Add server"
201
+ }), error ? /* @__PURE__ */ jsxs("p", {
202
+ role: "alert",
203
+ className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
204
+ children: ["Nothing was added: ", error]
205
+ }) : form.missing && /* @__PURE__ */ jsx("p", {
206
+ role: "status",
207
+ className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
208
+ children: form.missing
209
+ })]
210
+ })
211
+ ]
212
+ })
213
+ });
214
+ }
215
+ /** The servers whose tools are offered to every Agent turn while they are switched on. */
216
+ function ServersCard({ servers, onChanged }) {
217
+ const [tests, setTests] = useState({});
218
+ const [busyId, setBusyId] = useState(null);
219
+ const [error, setError] = useState(null);
220
+ const [deleting, setDeleting] = useState(null);
221
+ const state = serversState(servers);
222
+ async function toggle(server) {
223
+ setBusyId(server.id);
224
+ setError(null);
225
+ try {
226
+ await api(serverPath(server.id), {
227
+ method: "PATCH",
228
+ body: { enabled: !server.enabled }
229
+ });
230
+ await onChanged();
231
+ } catch (cause) {
232
+ setError(errorMessage(cause));
233
+ } finally {
234
+ setBusyId(null);
235
+ }
236
+ }
237
+ async function test(id) {
238
+ setTests((current) => ({
239
+ ...current,
240
+ [id]: { kind: "pending" }
241
+ }));
242
+ let result;
243
+ try {
244
+ const body = await api(`${serverPath(id)}/test`, { method: "POST" });
245
+ const tools = body.tools ?? [];
246
+ result = body.ok ? {
247
+ kind: "success",
248
+ message: `${tools.length === 1 ? "1 tool" : `${tools.length} tools`}: ${tools.map((tool) => tool.name).join(", ")}`
249
+ } : {
250
+ kind: "error",
251
+ message: body.error ?? "Test failed"
252
+ };
253
+ } catch (cause) {
254
+ result = {
255
+ kind: "error",
256
+ message: errorMessage(cause)
257
+ };
258
+ }
259
+ setTests((current) => ({
260
+ ...current,
261
+ [id]: result
262
+ }));
263
+ }
264
+ return /* @__PURE__ */ jsxs(SetupCard, {
265
+ labelledBy: "mcp-servers",
266
+ icon: /* @__PURE__ */ jsx(Server, { className: "size-5" }),
267
+ title: "Servers",
268
+ description: "Their tools are offered to every Agent turn while they are switched on.",
269
+ action: state && /* @__PURE__ */ jsx(Chip, {
270
+ tone: state.tone,
271
+ children: state.label
272
+ }),
273
+ children: [
274
+ servers.length === 0 ? /* @__PURE__ */ jsx(CardRow, {
275
+ className: "py-4 text-sm text-muted-foreground",
276
+ children: "No MCP servers yet; add one above."
277
+ }) : /* @__PURE__ */ jsx(CardList, { children: servers.map((server) => {
278
+ const result = tests[server.id];
279
+ const busy = busyId === server.id;
280
+ return /* @__PURE__ */ jsxs(ListRow, {
281
+ title: server.name,
282
+ chip: /* @__PURE__ */ jsx(Chip, {
283
+ tone: server.enabled ? "success" : "neutral",
284
+ children: server.enabled ? "Enabled" : "Disabled"
285
+ }),
286
+ meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
287
+ /* @__PURE__ */ jsx("span", { children: server.transport }),
288
+ server.hasAuthToken && /* @__PURE__ */ jsx("span", { children: "bearer token" }),
289
+ /* @__PURE__ */ jsx("code", {
290
+ className: "break-all",
291
+ children: server.transport === "stdio" ? `${server.command ?? ""} ${server.args.join(" ")}`.trim() : server.url
292
+ })
293
+ ] }),
294
+ actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
295
+ /* @__PURE__ */ jsx(Button, {
296
+ variant: "ghost",
297
+ disabled: result?.kind === "pending",
298
+ "aria-label": `Test ${server.name}`,
299
+ onClick: () => void test(server.id),
300
+ children: "Test"
301
+ }),
302
+ /* @__PURE__ */ jsx(Button, {
303
+ variant: "ghost",
304
+ disabled: busy,
305
+ "aria-label": `${server.enabled ? "Disable" : "Enable"} ${server.name}`,
306
+ onClick: () => void toggle(server),
307
+ children: busy ? "Working…" : server.enabled ? "Disable" : "Enable"
308
+ }),
309
+ /* @__PURE__ */ jsx(Button, {
310
+ variant: "danger",
311
+ disabled: busy,
312
+ "aria-label": `Delete ${server.name}`,
313
+ onClick: () => setDeleting(server),
314
+ children: "Delete"
315
+ })
316
+ ] }),
317
+ children: [
318
+ result?.kind === "pending" && /* @__PURE__ */ jsx(Waiting, { children: "Connecting…" }),
319
+ result?.kind === "success" && /* @__PURE__ */ jsx(Notice, {
320
+ tone: "success",
321
+ children: result.message
322
+ }),
323
+ result?.kind === "error" && /* @__PURE__ */ jsx(Notice, {
324
+ tone: "warning",
325
+ role: "alert",
326
+ children: result.message
327
+ })
328
+ ]
329
+ }, server.id);
330
+ }) }),
331
+ error && /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Notice, {
332
+ tone: "warning",
333
+ role: "alert",
334
+ title: "That did not work.",
335
+ children: error
336
+ }) }),
337
+ /* @__PURE__ */ jsx(ConfirmDialog, {
338
+ open: deleting !== null,
339
+ onOpenChange: (open) => {
340
+ if (!open) setDeleting(null);
341
+ },
342
+ title: `Delete MCP server ${deleting?.name ?? ""}?`,
343
+ description: /* @__PURE__ */ jsx("p", {
344
+ className: "m-0",
345
+ children: "This removes the server and its stored bearer token, closes its connection and removes its tools from later Agent turns."
346
+ }),
347
+ confirmLabel: "Delete MCP server",
348
+ onConfirm: async () => {
349
+ if (!deleting) return;
350
+ await api(serverPath(deleting.id), { method: "DELETE" });
351
+ await onChanged();
352
+ }
353
+ })
354
+ ]
355
+ });
356
+ }
357
+ //#endregion
358
+ //#region src/routes/config/mcp.tsx?tsr-split=component
359
+ function McpPage() {
360
+ const { servers } = Route.useLoaderData();
361
+ const router = useRouter();
362
+ const reload = () => router.invalidate({ sync: true });
363
+ return /* @__PURE__ */ jsxs(ConfigPage, {
364
+ title: "MCP servers",
365
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
366
+ "Tools from these Model Context Protocol servers are offered to every Agent turn as",
367
+ " ",
368
+ /* @__PURE__ */ jsx("code", { children: "mcp__<server>__<tool>" }),
369
+ ". 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."
370
+ ] }),
371
+ children: [/* @__PURE__ */ jsx(AddServerCard, { onAdded: reload }), /* @__PURE__ */ jsx(ServersCard, {
372
+ servers,
373
+ onChanged: reload
374
+ })]
375
+ });
376
+ }
377
+ //#endregion
378
+ export { McpPage as component };
@@ -1,8 +1,8 @@
1
1
  import { n as createServerFn } from "../server.js";
2
- import { t as createSsrRpc } from "./createSsrRpc-CcLbajrF.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-BijMHgqE.js";
3
3
  import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
4
  //#region src/routes/config/mcp.tsx
5
- var $$splitComponentImporter = () => import("./mcp-CO_tycXU.js");
5
+ var $$splitComponentImporter = () => import("./mcp-Ce6O8Qs2.js");
6
6
  var fetchServers = createServerFn({ method: "GET" }).handler(createSsrRpc("278849457893891c3d22806d15e11a0a42cc3630b30e9e62b74cf2d3b982ded7"));
7
7
  var Route = createFileRoute("/config/mcp")({
8
8
  loader: () => fetchServers(),
@@ -0,0 +1,136 @@
1
+ //#region src/lib/model-facts.ts
2
+ function modelName(model) {
3
+ return model.name ?? model.id;
4
+ }
5
+ /** A context window in the units people say: `1M`, `272K`. */
6
+ function formatContext(tokens) {
7
+ if (!tokens || tokens <= 0) return null;
8
+ if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1).replace(/\.0$/, "")}M`;
9
+ return `${Math.round(tokens / 1e3)}K`;
10
+ }
11
+ /** A dollar amount with cents, and the third decimal only when it carries something. */
12
+ function formatUsd(value) {
13
+ if (Number.isInteger(value)) return `$${value}`;
14
+ const fixed = value.toFixed(3);
15
+ return `$${fixed.endsWith("0") ? fixed.slice(0, -1) : fixed}`;
16
+ }
17
+ /** What a model can do, in one line. A model the catalog does not know has nothing to say. */
18
+ function factsLine(model, connect) {
19
+ const context = formatContext(model.contextWindow);
20
+ if (!model.name && !context) return connect === "local" ? "Loaded on the server" : "Not in the bundled catalog";
21
+ return [
22
+ context ? `${context} context` : null,
23
+ model.images ? "sees images" : "text only",
24
+ model.reasoning ? "reasoning" : null
25
+ ].filter(Boolean).join(" · ");
26
+ }
27
+ /** What a model costs: the list price per million tokens, or who pays instead. */
28
+ function priceLine(model, connect) {
29
+ if (connect === "signin") return "Included in your plan";
30
+ if (connect === "local") return "Runs on your hardware";
31
+ if (!model.price) return "No list price";
32
+ return `${formatUsd(model.price.input)} in · ${formatUsd(model.price.output)} out`;
33
+ }
34
+ function usedByLine(usedBy) {
35
+ const parts = [...usedBy.templates.map((name) => `${name} template`), usedBy.agents === 1 ? "1 Agent" : usedBy.agents > 1 ? `${usedBy.agents} Agents` : null].filter(Boolean);
36
+ return parts.length > 0 ? parts.join(", ") : "Not used yet";
37
+ }
38
+ /** The two facts that matter when choosing a model: how much it reads, whether it sees images. */
39
+ function menuFacts(model) {
40
+ const context = formatContext(model.contextWindow);
41
+ if (!context) return model.providerConnect === "local" ? "on this computer" : "";
42
+ return `${context} · ${model.images ? "sees images" : "text only"}`;
43
+ }
44
+ /** Chat models by provider, in the order the Models page lists them. */
45
+ function menuGroups(models) {
46
+ const groups = /* @__PURE__ */ new Map();
47
+ for (const model of models) {
48
+ const group = groups.get(model.provider) ?? {
49
+ provider: model.provider,
50
+ name: model.providerName,
51
+ trouble: model.providerState === "failing" || model.providerState === "incomplete" ? "not working" : null,
52
+ models: []
53
+ };
54
+ group.models.push(model);
55
+ groups.set(model.provider, group);
56
+ }
57
+ return [...groups.values()];
58
+ }
59
+ /** Whether a model matches what was typed: every word, in its name or id. */
60
+ function matchesModel(model, query) {
61
+ const haystack = `${model.name ?? ""} ${model.id}`.toLowerCase();
62
+ return query.toLowerCase().split(/\s+/).filter(Boolean).every((word) => haystack.includes(word));
63
+ }
64
+ /** "2 minutes ago", for something that happened at `at`. */
65
+ function ago(at, now) {
66
+ const seconds = Math.max(0, Math.round((now - at) / 1e3));
67
+ if (seconds < 45) return "just now";
68
+ const minutes = Math.round(seconds / 60);
69
+ if (minutes < 60) return minutes === 1 ? "1 minute ago" : `${minutes} minutes ago`;
70
+ const hours = Math.round(minutes / 60);
71
+ if (hours < 24) return hours === 1 ? "1 hour ago" : `${hours} hours ago`;
72
+ const days = Math.round(hours / 24);
73
+ if (days < 30) return days === 1 ? "yesterday" : `${days} days ago`;
74
+ return `on ${new Date(at).toISOString().slice(0, 10)}`;
75
+ }
76
+ var FAILURE_LABEL = {
77
+ credentials: "Key rejected",
78
+ unreachable: "Not answering",
79
+ model: "Model unavailable",
80
+ limit: "Limit reached",
81
+ other: "Failing"
82
+ };
83
+ /** A provider's state as a chip: a few words and how loud they are. */
84
+ function providerStatus(provider, now) {
85
+ switch (provider.state) {
86
+ case "working": return {
87
+ label: provider.check ? `Working · tested ${ago(provider.check.at, now)}` : "Working",
88
+ tone: "success"
89
+ };
90
+ case "failing": {
91
+ const kind = provider.check?.failure?.kind ?? "other";
92
+ const label = kind === "credentials" && provider.connect === "signin" ? "Sign-in rejected" : FAILURE_LABEL[kind];
93
+ return {
94
+ label: provider.check ? `${label} · tried ${ago(provider.check.at, now)}` : label,
95
+ tone: "warning"
96
+ };
97
+ }
98
+ case "incomplete": return {
99
+ label: provider.connect === "signin" ? "Not signed in" : provider.fields.some((field) => field.kind === "secret") ? "Needs a key" : "Needs credentials",
100
+ tone: "warning"
101
+ };
102
+ case "off": return {
103
+ label: provider.models.length === 0 ? "Saved, not in use" : "Turned off",
104
+ tone: "neutral"
105
+ };
106
+ default: return {
107
+ label: "Not tested yet",
108
+ tone: "neutral"
109
+ };
110
+ }
111
+ }
112
+ /** How a provider is connected, in a few words, for its row. */
113
+ function credentialLine(provider) {
114
+ if (provider.connect === "signin") return provider.configured ? "Signed in with your ChatGPT account" : "Not signed in";
115
+ if (provider.connect === "local") return provider.address ?? "A model server on this network";
116
+ const key = provider.fields.find((field) => field.kind === "secret" && field.set);
117
+ if (key) return `${key.label} ${key.preview ?? "saved"}`;
118
+ if (provider.configured) return "Credentials from the daemon’s environment";
119
+ return "No credentials saved";
120
+ }
121
+ /** The models to ask first: suggested ones, then the ones already in use. */
122
+ function initialPicks(models) {
123
+ const selected = models.filter((model) => model.selected).map((model) => model.id);
124
+ if (selected.length > 0) return selected;
125
+ return models.filter((model) => model.suggested).map((model) => model.id);
126
+ }
127
+ /** The cheapest of the given models by list price; unpriced ones come last, in order. */
128
+ function cheapest(models) {
129
+ const cost = (model) => model.price ? model.price.input + model.price.output : Number.POSITIVE_INFINITY;
130
+ return models.map((model, index) => ({
131
+ model,
132
+ index
133
+ })).sort((a, b) => cost(a.model) - cost(b.model) || a.index - b.index)[0]?.model;
134
+ }
135
+ //#endregion
136
+ export { initialPicks as a, menuGroups as c, providerStatus as d, usedByLine as f, factsLine as i, modelName as l, cheapest as n, matchesModel as o, credentialLine as r, menuFacts as s, ago as t, priceLine as u };