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.
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +296 -232
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-CkwSq3C7.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-CEn_4qVs.js +1 -0
- package/dist/web/client/assets/Button-UiegBKOK.js +1 -0
- package/dist/web/client/assets/ConfigPage-CUbHBhzx.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-VqBOFZEp.js +1 -0
- package/dist/web/client/assets/ConnectionsView-ByARMcWP.js +1 -0
- package/dist/web/client/assets/ManagePage-BJWZd1ts.js +1 -0
- package/dist/web/client/assets/SectionTabs-ViZKm3-B.js +1 -0
- package/dist/web/client/assets/Segmented-MYKKTuZO.js +1 -0
- package/dist/web/client/assets/SkillsParts-UvNK5SYP.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-DG5UbJNK.js +1 -0
- package/dist/web/client/assets/TeamForm-DGlxWv4e.js +1 -0
- package/dist/web/client/assets/TeamThread-mkwODO0S.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-BmdwLH99.js +1 -0
- package/dist/web/client/assets/_id-CvcxNmBH.js +1 -0
- package/dist/web/client/assets/_id-UyBk7gRl.js +1 -0
- package/dist/web/client/assets/access-C8d8vaQ6.js +1 -0
- package/dist/web/client/assets/agent-actions-BgE9fKHH.js +1 -0
- package/dist/web/client/assets/agents-CgtzqBpD.js +1 -0
- package/dist/web/client/assets/agents-D7W4BT8r.js +1 -0
- package/dist/web/client/assets/arrow-right-D0HKRb7U.js +1 -0
- package/dist/web/client/assets/attention-D9mQWoKt.js +1 -0
- package/dist/web/client/assets/bot-Bb--PFVU.js +1 -0
- package/dist/web/client/assets/chevron-right-bs0TUSl2.js +1 -0
- package/dist/web/client/assets/config-Dw6GWf38.js +1 -0
- package/dist/web/client/assets/createLucideIcon-DkniuEtD.js +1 -0
- package/dist/web/client/assets/download-C4t9l5wR.js +1 -0
- package/dist/web/client/assets/file-text-DzbjpYrV.js +1 -0
- package/dist/web/client/assets/images-DSYgPKM7.js +1 -0
- package/dist/web/client/assets/index-YW0gXPfk.js +14 -0
- package/dist/web/client/assets/key-round-BpK4-E3T.js +1 -0
- package/dist/web/client/assets/list-checks-JNXcmws9.js +1 -0
- package/dist/web/client/assets/login-DcQJk5-U.js +1 -0
- package/dist/web/client/assets/manage-SRGSx8n2.js +1 -0
- package/dist/web/client/assets/mcp-BUWu4TvS.js +1 -0
- package/dist/web/client/assets/message-square-DM2MP9vF.js +1 -0
- package/dist/web/client/assets/network-BJ4iPjQO.js +1 -0
- package/dist/web/client/assets/parts-LZxl9Gvc.js +41 -0
- package/dist/web/client/assets/plus-CLGNN5QX.js +1 -0
- package/dist/web/client/assets/routes-BxIIyGho.js +85 -0
- package/dist/web/client/assets/skills-C7DzIwFJ.js +1 -0
- package/dist/web/client/assets/square-terminal-Dmm6cV-G.js +1 -0
- package/dist/web/client/assets/style-CA2GAk9b.js +7 -0
- package/dist/web/client/assets/styles-C3CDSGAr.css +2 -0
- package/dist/web/client/assets/system-zQ0NnQML.js +1 -0
- package/dist/web/client/assets/teams-BEIJHObN.js +1 -0
- package/dist/web/client/assets/teams-DlOc7Ods.js +1 -0
- package/dist/web/client/assets/telegram-DKHq5DpE.js +1 -0
- package/dist/web/client/assets/tools-BKIpLaiC.js +1 -0
- package/dist/web/client/assets/use-resource-CQaIZbpy.js +1 -0
- package/dist/web/client/assets/users-round-BJrym3FG.js +1 -0
- package/dist/web/client/assets/welcome-CyS4Hrd-.js +1 -0
- package/dist/web/client/assets/wrench-GbE1M1RJ.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-Tn4AskPm.js → AddProviderDialog-Nc5mc_P6.js} +106 -8
- package/dist/web/server/assets/AgentTemplateParts-DZK_r3nQ.js +266 -0
- package/dist/web/server/assets/{ConfigPage-DqDUujmt.js → ConfigPage-CxzL-gTm.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-DfaJ--A6.js → ConfirmDialog-4xeCXKHe.js} +1 -2
- package/dist/web/server/assets/{ConnectionsView-DAG-zNBz.js → ConnectionsView-B02FjNsM.js} +9 -9
- package/dist/web/server/assets/ManagePage-BfCWE8Lj.js +29 -0
- package/dist/web/server/assets/ModelMenu-D-hTgYOO.js +278 -0
- package/dist/web/server/assets/{Rail-BIC_4ptO.js → Rail-3gbidhyv.js} +17 -110
- package/dist/web/server/assets/{SectionTabs-BGsrf-UQ.js → SectionTabs-CWQ5orUW.js} +9 -2
- package/dist/web/server/assets/SkillsParts-D58l8voo.js +199 -0
- package/dist/web/server/assets/SpawnDialog-MJWwppgC.js +1648 -0
- package/dist/web/server/assets/SpawnTeamModal-RjzAeX_Q.js +124 -0
- package/dist/web/server/assets/TeamForm-DdOgIMiV.js +138 -0
- package/dist/web/server/assets/{TeamThread-DuLlGDcw.js → TeamThread-D-PvO3fu.js} +9 -9
- package/dist/web/server/assets/{UnsavedChangesGuard-DrOvPV14.js → UnsavedChangesGuard-Bb5frygQ.js} +1 -1
- package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
- package/dist/web/server/assets/_id-BPjVkcNb.js +396 -0
- package/dist/web/server/assets/_id-BUfy-GwH.js +16 -0
- package/dist/web/server/assets/{_id-yN0z7VqE.js → _id-C1_l6oSR.js} +257 -207
- package/dist/web/server/assets/{_id-DJnYgisy.js → _id-CHvYQhWt.js} +8 -4
- package/dist/web/server/assets/_id-De3Bm0SG.js +39 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-CR3jm1nY.js +256 -0
- package/dist/web/server/assets/access-CNfvQ3NB.js +295 -0
- package/dist/web/server/assets/{access-GMGed5O8.js → access-Cm_izIIC.js} +2 -2
- package/dist/web/server/assets/{access-C_pupPks.js → access-WWspT0v4.js} +2 -1
- package/dist/web/server/assets/agent-actions-COnfW5AU.js +20 -0
- package/dist/web/server/assets/agents-C7UmTjfO.js +13 -0
- package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-CRtMfKqX.js} +9 -6
- package/dist/web/server/assets/agents-D0hfGIMK.js +134 -0
- package/dist/web/server/assets/agents-DQowl6Ly.js +31 -0
- package/dist/web/server/assets/agents-DzpqlIuJ.js +12 -0
- package/dist/web/server/assets/agents-NOkh61dV.js +323 -0
- package/dist/web/server/assets/attention-CRvxt22X.js +232 -0
- package/dist/web/server/assets/{attention-Cr7puThv.js → attention-CgWhXjX7.js} +4 -1
- package/dist/web/server/assets/{attention-DS3O9UmJ.js → attention-Cx9ZWPOO.js} +4 -2
- package/dist/web/server/assets/{config-DjTGA4iZ.js → config-B5CS8juO.js} +2 -2
- package/dist/web/server/assets/{config-Q7livfa3.js → config-D117117T.js} +51 -102
- package/dist/web/server/assets/createSsrRpc-CwTd0zrB.js +72 -0
- package/dist/web/server/assets/{login-VV10kZBl.js → login-IF0Gbsuq.js} +36 -2
- package/dist/web/server/assets/{login-JoIjlcmu.js → login-va4EtvA8.js} +34 -45
- package/dist/web/server/assets/manage-Ce6cI4eW.js +240 -0
- package/dist/web/server/assets/{mcp-ZARSOxZW.js → mcp-Bm9U6x7N.js} +2 -2
- package/dist/web/server/assets/mcp-C96PBxpb.js +376 -0
- package/dist/web/server/assets/page-title-CwcbXMhx.js +95 -0
- package/dist/web/server/assets/{router-Dh2-IvLL.js → router-8Iq19GOz.js} +366 -203
- package/dist/web/server/assets/{routes-C9NawqcV.js → routes-BLo-fWbQ.js} +2681 -1667
- package/dist/web/server/assets/{routes-CDskMy5C.js → routes-BXvYYFrN.js} +2 -2
- package/dist/web/server/assets/routes-Kwam6JmS.js +89 -0
- package/dist/web/server/assets/{skills-StN15QhC.js → skills-BqCnA-74.js} +2 -2
- package/dist/web/server/assets/skills-DSezIdDc.js +157 -0
- package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
- package/dist/web/server/assets/{style-GYDODk2F.js → style-C2hIPY_Y.js} +2 -2
- package/dist/web/server/assets/{system-Dl-1RhoP.js → system-CcLCmkIC.js} +2 -2
- package/dist/web/server/assets/{system-DtswhLW6.js → system-D3th6n2E.js} +4 -2
- package/dist/web/server/assets/system-E0VePdzO.js +145 -0
- package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
- package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
- package/dist/web/server/assets/teams-CQVV18D3.js +216 -0
- package/dist/web/server/assets/teams-CdCmBJIj.js +174 -0
- package/dist/web/server/assets/{teams-5PMGvHuM.js → teams-DScFp8mK.js} +2 -2
- package/dist/web/server/assets/{teams-CbIPKf99.js → teams-DxA-vnzY.js} +4 -2
- package/dist/web/server/assets/telegram-DJ8s_91Y.js +1057 -0
- package/dist/web/server/assets/{telegram-Cv0D4gyz.js → telegram-DR7xijeS.js} +2 -2
- package/dist/web/server/assets/{tools-ioJcPzMW.js → tools-CsH9DI-4.js} +2 -2
- package/dist/web/server/assets/{tools-OfD22R-C.js → tools-V6kezUpL.js} +55 -218
- package/dist/web/server/assets/{use-resource-DVzK0toP.js → use-resource-CjcJwn7F.js} +1 -1
- package/dist/web/server/assets/{welcome-jxmpE_Jb.js → welcome-BpmcD-ia.js} +2 -2
- package/dist/web/server/assets/{welcome-FFEbrNT1.js → welcome-Ya8TkL4v.js} +10 -10
- package/dist/web/server/server.js +19 -19
- package/dist/worker.js +17 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +0 -1
- package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +0 -1
- package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +0 -1
- package/dist/web/client/assets/Dialog-s_kPtI-W.js +0 -1
- package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +0 -1
- package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +0 -1
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
- package/dist/web/client/assets/SkillFindings-Xng11qqx.js +0 -1
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
- package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +0 -1
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
- package/dist/web/client/assets/TeamThread-2rm1JGSk.js +0 -1
- package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +0 -1
- package/dist/web/client/assets/_id-B72mIpcE.js +0 -1
- package/dist/web/client/assets/_id-Bzavnza1.js +0 -1
- package/dist/web/client/assets/access-Yw9jODuk.js +0 -1
- package/dist/web/client/assets/agents-C9xoyL7o.js +0 -1
- package/dist/web/client/assets/agents-TviG16wx.js +0 -1
- package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
- package/dist/web/client/assets/attention-DmURtlJm.js +0 -1
- package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
- package/dist/web/client/assets/chevron-right-CUZiA2aG.js +0 -1
- package/dist/web/client/assets/config-UZz_mjO5.js +0 -1
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
- package/dist/web/client/assets/dist-BWppw70N.js +0 -41
- package/dist/web/client/assets/dist-D2dwY7MR.js +0 -1
- package/dist/web/client/assets/entities-xVoB-p2j.js +0 -1
- package/dist/web/client/assets/index-Df1oUtAP.js +0 -14
- package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
- package/dist/web/client/assets/login-CPfdaqsV.js +0 -1
- package/dist/web/client/assets/mcp-FlYnNon0.js +0 -1
- package/dist/web/client/assets/model-facts-DoB6QD5y.js +0 -1
- package/dist/web/client/assets/parts-tIDBNsYA.js +0 -1
- package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
- package/dist/web/client/assets/routes-BZaWCoQj.js +0 -76
- package/dist/web/client/assets/save-f9O-CQia.js +0 -1
- package/dist/web/client/assets/skills-C7yDPC8s.js +0 -1
- package/dist/web/client/assets/style-DDuTFJUu.js +0 -7
- package/dist/web/client/assets/styles-BviXU81u.css +0 -2
- package/dist/web/client/assets/system-CL3Kz36L.js +0 -1
- package/dist/web/client/assets/teams-CQTEF5gV.js +0 -1
- package/dist/web/client/assets/teams-DQ7SqVyF.js +0 -1
- package/dist/web/client/assets/telegram-BLgxtGhZ.js +0 -1
- package/dist/web/client/assets/tools-pOQyGVYo.js +0 -1
- package/dist/web/client/assets/use-resource-C3MBZJop.js +0 -1
- package/dist/web/client/assets/welcome-Hr6JpMef.js +0 -1
- package/dist/web/client/assets/wrench-6BEIqKDn.js +0 -1
- package/dist/web/server/assets/Dialog-aup_yJv5.js +0 -85
- package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +0 -138
- package/dist/web/server/assets/SkillFindings-BdATze1A.js +0 -46
- package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
- package/dist/web/server/assets/SpawnDialog-D_SMPCG_.js +0 -132
- package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
- package/dist/web/server/assets/TeamForm-ilBaeLI4.js +0 -96
- package/dist/web/server/assets/_id-BsZcsabI.js +0 -383
- package/dist/web/server/assets/_id-D8Kj0F30.js +0 -18
- package/dist/web/server/assets/_id-QYifTM9w.js +0 -28
- package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +0 -223
- package/dist/web/server/assets/access-DKOpcHIJ.js +0 -232
- package/dist/web/server/assets/agents-B6OR3x99.js +0 -327
- package/dist/web/server/assets/agents-B7642eRO.js +0 -130
- package/dist/web/server/assets/agents-BJ-_oC2e.js +0 -14
- package/dist/web/server/assets/agents-CjV0w-Zy.js +0 -12
- package/dist/web/server/assets/agents-Dy_Q-9lG.js +0 -27
- package/dist/web/server/assets/attention-CLP4HYBz.js +0 -216
- package/dist/web/server/assets/createSsrRpc-GCCF14VW.js +0 -169
- package/dist/web/server/assets/entities-Dn2xzKIw.js +0 -16
- package/dist/web/server/assets/mcp-BI-FD-JI.js +0 -250
- package/dist/web/server/assets/model-facts-mrfrWQne.js +0 -136
- package/dist/web/server/assets/parts-B31PJkhi.js +0 -190
- package/dist/web/server/assets/routes-BJIJWCIE.js +0 -16
- package/dist/web/server/assets/skills-BqLq3ZXq.js +0 -275
- package/dist/web/server/assets/system-BtRA2HUs.js +0 -138
- package/dist/web/server/assets/teams-COaU0wN9.js +0 -108
- package/dist/web/server/assets/teams-Ca8W4mvl.js +0 -88
- package/dist/web/server/assets/telegram-Yx8nm6Ei.js +0 -984
- package/dist/web/server/assets/utils-C_uf36nf.js +0 -8
- 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 };
|