bazilion 0.57.1 → 0.58.1
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 +392 -92
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +674 -259
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-DIxB5CRz.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-B9JD9mno.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-D-Qk9p6V.js +1 -0
- package/dist/web/client/assets/ConnectionsView-Dfbn7vfB.js +1 -0
- package/dist/web/client/assets/SkillsParts-DN_JvpRU.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-Btj3My2v.js +1 -0
- package/dist/web/client/assets/TeamForm-BX_68QZQ.js +1 -0
- package/dist/web/client/assets/TeamThread-CJXudrt6.js +1 -0
- package/dist/web/client/assets/{UnsavedChangesGuard-CYz0AopL.js → UnsavedChangesGuard-B_e5_ck_.js} +1 -1
- package/dist/web/client/assets/_id-BJt13p-G.js +1 -0
- package/dist/web/client/assets/_id-DoP6Mlct.js +1 -0
- package/dist/web/client/assets/{access-BGtASxet.js → access-DnkUj0iM.js} +1 -1
- package/dist/web/client/assets/{agents-BAODfMcm.js → agents-CrfF2ZOS.js} +1 -1
- package/dist/web/client/assets/agents-Cv07gKT0.js +1 -0
- package/dist/web/client/assets/{attention-BIC0TL8d.js → attention-TQpP915m.js} +1 -1
- package/dist/web/client/assets/config-CKPln0Ng.js +1 -0
- package/dist/web/client/assets/index-Bwz8tnmS.js +14 -0
- package/dist/web/client/assets/{login-q9O7dqRe.js → login-C-FCzcQU.js} +1 -1
- package/dist/web/client/assets/manage-BSGsiEPw.js +1 -0
- package/dist/web/client/assets/mcp-DDw8SGMV.js +1 -0
- package/dist/web/client/assets/routes-C5KzZ73E.js +85 -0
- package/dist/web/client/assets/shield-alert-CO7P-cbq.js +1 -0
- package/dist/web/client/assets/{skills-VEtq-MQJ.js → skills-H_AVE6G7.js} +1 -1
- package/dist/web/client/assets/style-HG30duye.js +7 -0
- package/dist/web/client/assets/styles-DyFDuWBI.css +2 -0
- package/dist/web/client/assets/system-C7vZKVdU.js +1 -0
- package/dist/web/client/assets/teams-DcxoMrsV.js +1 -0
- package/dist/web/client/assets/teams-Dcy3Wb4u.js +1 -0
- package/dist/web/client/assets/telegram-CUw1r_J5.js +1 -0
- package/dist/web/client/assets/{tools-C0FIeAL1.js → tools-BNZxmJJk.js} +1 -1
- package/dist/web/client/assets/usage-BhqvXWtk.js +1 -0
- package/dist/web/client/assets/welcome-4H9Gvu-u.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-CpLDHOcA.js → AddProviderDialog-Bqsz5NaL.js} +1 -1
- package/dist/web/server/assets/{AgentTemplateParts-Dh9F_-T_.js → AgentTemplateParts-D97gKNdN.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-C89B8qKM.js → ConfirmDialog-CuD5HXTw.js} +1 -1
- package/dist/web/server/assets/{ConnectionsView-DslcKQmA.js → ConnectionsView-CSf83J-v.js} +32 -10
- package/dist/web/server/assets/{Dialog-_Gt_Nt86.js → Dialog-CwAfaXpM.js} +5 -0
- package/dist/web/server/assets/{SkillsParts-CqS2B45v.js → SkillsParts-hjS9a_Ht.js} +2 -2
- package/dist/web/server/assets/{SpawnDialog-BNKj2Lup.js → SpawnDialog-BjVZl7xK.js} +19 -6
- package/dist/web/server/assets/{SpawnTeamModal-zcLxtFOO.js → SpawnTeamModal-BmBXqfFi.js} +7 -7
- package/dist/web/server/assets/{TeamForm-XFP0l2TB.js → TeamForm-B4702hBg.js} +2 -2
- package/dist/web/server/assets/{TeamThread-gYV_ToRM.js → TeamThread-BGl5z8_I.js} +40 -2
- package/dist/web/server/assets/{UnsavedChangesGuard-CB_TugFF.js → UnsavedChangesGuard-Be8EqfV_.js} +1 -1
- package/dist/web/server/assets/{_id-D4RFNqaJ.js → _id-BWtcQovD.js} +1 -1
- package/dist/web/server/assets/{_id-josYXBx3.js → _id-CKBQM7LH.js} +1 -1
- package/dist/web/server/assets/{_id-BTyd2i5U.js → _id-Cf1461pN.js} +1 -1
- package/dist/web/server/assets/{_id-517adSuB.js → _id-DBhvSxVl.js} +1 -1
- package/dist/web/server/assets/{_id-CyinHJam.js → _id-TT_ZsaSc.js} +6 -6
- package/dist/web/server/assets/{_id-BsQnL9LV.js → _id-VqiN2zRR.js} +35 -12
- package/dist/web/server/assets/{_tanstack-start-manifest_v-DIMayzEa.js → _tanstack-start-manifest_v-Df5LTm5g.js} +60 -58
- package/dist/web/server/assets/{access-BdQmjMJV.js → access-Bog7dbtP.js} +1 -1
- package/dist/web/server/assets/{access-Cc7fMMod.js → access-C5lXP5JS.js} +2 -2
- package/dist/web/server/assets/{access-B97-94Wt.js → access-bTlESGXh.js} +1 -1
- package/dist/web/server/assets/{agents-CjrkaEz8.js → agents-8XZAjHh0.js} +5 -5
- package/dist/web/server/assets/{agents-Tg3zkmQv.js → agents-BepbikC0.js} +1 -1
- package/dist/web/server/assets/{agents-BL918wVc.js → agents-CKkMouJX.js} +1 -1
- package/dist/web/server/assets/{agents-BzJFjA2i.js → agents-Co6S2Ml9.js} +1 -1
- package/dist/web/server/assets/{agents-BlUZqqJn.js → agents-DDUHE3eY.js} +17 -9
- package/dist/web/server/assets/{agents-uw32jPWx.js → agents-DnUK-7qJ.js} +1 -1
- package/dist/web/server/assets/{attention-C94WWwQe.js → attention--1dBWt0c.js} +1 -1
- package/dist/web/server/assets/{attention-2unmuO-q.js → attention-ColV2zMz.js} +1 -1
- package/dist/web/server/assets/{attention-a_OmC6L3.js → attention-n8edCJBL.js} +2 -2
- package/dist/web/server/assets/{auth-DuIqEAed.js → auth-Q5eVKoKR.js} +1 -1
- package/dist/web/server/assets/{config-BG1KOtwA.js → config-BpwsF11b.js} +1 -1
- package/dist/web/server/assets/{config-D1Li_7Yt2.js → config-Cfn1TU8w.js} +1 -1
- package/dist/web/server/assets/{config-Bhem9XER.js → config-UHRqSrh4.js} +4 -4
- package/dist/web/server/assets/{daemon-client-D-NWKQto.js → daemon-client-Dw3ut4pU.js} +1 -1
- package/dist/web/server/assets/{manage-C7ReF2ZZ.js → manage-C7ss0xG5.js} +147 -1
- package/dist/web/server/assets/{mcp-BFixpBQk.js → mcp-COn047tO.js} +1 -1
- package/dist/web/server/assets/mcp-CUoF4jIO.js +753 -0
- package/dist/web/server/assets/{mcp-Ceg9gzKE.js → mcp-DVjTaRq3.js} +1 -1
- package/dist/web/server/assets/{open-groups-C89TEK85.js → open-groups-lUX_YX9X.js} +1 -1
- package/dist/web/server/assets/{router-DizFxqh-.js → router-q3PwQgDH.js} +22 -22
- package/dist/web/server/assets/{routes-DsuaDPTO.js → routes-BgjikzXy.js} +2 -2
- package/dist/web/server/assets/{routes-CVrH9qgo.js → routes-DRtxA9c1.js} +1 -1
- package/dist/web/server/assets/{routes-D9Mw1_VV.js → routes-Do8a2liK.js} +261 -71
- package/dist/web/server/assets/{skills-BNbZ75am.js → skills-B--hjk-0.js} +1 -1
- package/dist/web/server/assets/{skills-D5rnOmKJ.js → skills-D5oN5ehC.js} +4 -4
- package/dist/web/server/assets/{skills-BWwEFc4a.js → skills-DouMCq_2.js} +1 -1
- package/dist/web/server/assets/src-ErO6nYmi.js +226 -0
- package/dist/web/server/assets/{start-2MvkBRdC.js → start-D4sx5Ovq.js} +1 -1
- package/dist/web/server/assets/style-BgFXDhAR.js +64 -0
- package/dist/web/server/assets/{system-Cr4C-YRw.js → system-4WV2pOS4.js} +1 -1
- package/dist/web/server/assets/{system-DsmXkgqn.js → system-A2Aib6JE.js} +2 -1
- package/dist/web/server/assets/{system-DT7AU0e6.js → system-DtGHi7X7.js} +31 -11
- package/dist/web/server/assets/{teams-u6m6JzuU.js → teams-BJNZ7ZsS.js} +1 -1
- package/dist/web/server/assets/{teams-Dix5XVIx.js → teams-Blfyu8ej.js} +1 -1
- package/dist/web/server/assets/{teams-DjE0swAZ.js → teams-BnsbH4YW.js} +9 -9
- package/dist/web/server/assets/{teams-Rk_RED7X.js → teams-GDzT7Tv0.js} +1 -1
- package/dist/web/server/assets/{teams-BeStcDvQ.js → teams-QVxXJfo7.js} +1 -1
- package/dist/web/server/assets/{teams-CsEBLW8-.js → teams-gzY3tOtu.js} +7 -7
- package/dist/web/server/assets/{telegram-CQpF3EHA.js → telegram-BSp9aCz6.js} +1 -1
- package/dist/web/server/assets/{telegram-DhzHgDfg.js → telegram-CIbuQ5-U.js} +1 -1
- package/dist/web/server/assets/{telegram-BjqABrl-.js → telegram-Ctj5dqvs.js} +2 -2
- package/dist/web/server/assets/{tools-DC69leH7.js → tools-BPhol5jb.js} +1 -1
- package/dist/web/server/assets/{usage-mvQegG4l.js → usage-CeiyPffw.js} +1 -1
- package/dist/web/server/assets/{usage-4zMG0sab.js → usage-Dsi2V9Wh.js} +2 -2
- package/dist/web/server/assets/{welcome-DrYbWGd_.js → welcome-A2Koo4HI.js} +3 -3
- package/dist/web/server/assets/{welcome-BuE9FRf4.js → welcome-C71pZOQ9.js} +1 -1
- package/dist/web/server/assets/{welcome-DYw35wl5.js → welcome-PxSZeoU6.js} +1 -1
- package/dist/web/server/server.js +20 -20
- package/dist/worker.js +15 -5
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-D8VvDmbM.js +0 -1
- package/dist/web/client/assets/AgentTemplateParts-BWorU6-F.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-DrN26lN_.js +0 -1
- package/dist/web/client/assets/ConnectionsView-DcO7RJZ7.js +0 -1
- package/dist/web/client/assets/SkillsParts-BueR3HoP.js +0 -1
- package/dist/web/client/assets/SpawnTeamModal-B65eQyzu.js +0 -1
- package/dist/web/client/assets/TeamForm-BhI9FbjV.js +0 -1
- package/dist/web/client/assets/TeamThread-FPpHlVFc.js +0 -1
- package/dist/web/client/assets/_id-5mTcKU2j.js +0 -1
- package/dist/web/client/assets/_id-DKgyyyeX.js +0 -1
- package/dist/web/client/assets/agents-Bfwz3dl5.js +0 -1
- package/dist/web/client/assets/config-kMzM8kdp.js +0 -1
- package/dist/web/client/assets/index-DuLpyCSP.js +0 -14
- package/dist/web/client/assets/manage-DdCiSgG9.js +0 -1
- package/dist/web/client/assets/mcp-B3LzNtrr.js +0 -1
- package/dist/web/client/assets/routes-BDdLZEGO.js +0 -85
- package/dist/web/client/assets/style-J8ypSsCb.js +0 -7
- package/dist/web/client/assets/styles-C7NsCHeU.css +0 -2
- package/dist/web/client/assets/system-DtBBeAjO.js +0 -1
- package/dist/web/client/assets/teams-D4X9oNx8.js +0 -1
- package/dist/web/client/assets/teams-QlaY2Sxd.js +0 -1
- package/dist/web/client/assets/telegram-B7vlTQbt.js +0 -1
- package/dist/web/client/assets/usage-3mYfS5C-.js +0 -1
- package/dist/web/client/assets/welcome-CkmanVa_.js +0 -1
- package/dist/web/server/assets/mcp-BTZkDvdc.js +0 -379
- package/dist/web/server/assets/src-BeMh8Fze.js +0 -113
- package/dist/web/server/assets/style-B3l0Wtlf.js +0 -178
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { i as api, o as errorMessage } from "./live-DbJeq6KP.js";
|
|
2
|
-
import { t as Button } from "./Button-Dsnw22OF.js";
|
|
3
|
-
import { t as ConfirmDialog } from "./ConfirmDialog-C89B8qKM.js";
|
|
4
|
-
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-B0wbj_yK.js";
|
|
5
|
-
import { d as TextField, o as SecretField, s as SelectField } from "./form-Bwsyt9OY.js";
|
|
6
|
-
import { t as Route } from "./mcp-BFixpBQk.js";
|
|
7
|
-
import { t as ConfigPage } from "./ConfigPage-CrxctbtN.js";
|
|
8
|
-
import { useState } from "react";
|
|
9
|
-
import { useRouter } from "@tanstack/react-router";
|
|
10
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Plus, Server } from "lucide-react";
|
|
12
|
-
//#region src/lib/mcp-form.ts
|
|
13
|
-
var EMPTY_MCP_DRAFT = {
|
|
14
|
-
name: "",
|
|
15
|
-
transport: "stdio",
|
|
16
|
-
command: "",
|
|
17
|
-
args: "",
|
|
18
|
-
url: "",
|
|
19
|
-
token: ""
|
|
20
|
-
};
|
|
21
|
-
/** The daemon's own rule for an endpoint: http(s), no credentials in it, no fragment. */
|
|
22
|
-
function endpointProblem(value) {
|
|
23
|
-
try {
|
|
24
|
-
const url = new URL(value);
|
|
25
|
-
if (!["http:", "https:"].includes(url.protocol)) return "An http:// or https:// address.";
|
|
26
|
-
if (url.username || url.password) return "No user name or password in the address: a token goes in the field beside it.";
|
|
27
|
-
if (url.hash) return "An address without a # part.";
|
|
28
|
-
return;
|
|
29
|
-
} catch {
|
|
30
|
-
return "An http:// or https:// address.";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function mcpServerForm(draft) {
|
|
34
|
-
const name = draft.name.trim();
|
|
35
|
-
const command = draft.command.trim();
|
|
36
|
-
const url = draft.url.trim();
|
|
37
|
-
const problems = {};
|
|
38
|
-
if (name && !/^[a-zA-Z0-9_]+$/.test(name)) problems.name = "Letters, digits and underscores only: its tools are named after it.";
|
|
39
|
-
const stdio = draft.transport === "stdio";
|
|
40
|
-
if (!stdio && url) {
|
|
41
|
-
const problem = endpointProblem(url);
|
|
42
|
-
if (problem) problems.url = problem;
|
|
43
|
-
}
|
|
44
|
-
const complete = name !== "" && (stdio ? command !== "" : url !== "");
|
|
45
|
-
const missing = [
|
|
46
|
-
name,
|
|
47
|
-
command,
|
|
48
|
-
draft.args.trim(),
|
|
49
|
-
url,
|
|
50
|
-
draft.token
|
|
51
|
-
].some((value) => value !== "") && !complete ? stdio ? "A stdio server needs a name and a command." : "An http server needs a name and a URL." : null;
|
|
52
|
-
if (!complete || problems.name || problems.url) return {
|
|
53
|
-
problems,
|
|
54
|
-
missing,
|
|
55
|
-
body: null
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
problems,
|
|
59
|
-
missing,
|
|
60
|
-
body: {
|
|
61
|
-
name,
|
|
62
|
-
transport: draft.transport,
|
|
63
|
-
command: stdio ? command : null,
|
|
64
|
-
args: stdio ? draft.args.split(" ").filter(Boolean) : [],
|
|
65
|
-
url: stdio ? null : url,
|
|
66
|
-
authToken: !stdio && draft.token ? draft.token : void 0
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/** How many servers Agents are offered, as a card's state. */
|
|
71
|
-
function serversState(servers) {
|
|
72
|
-
if (servers.length === 0) return null;
|
|
73
|
-
const on = servers.filter((server) => server.enabled).length;
|
|
74
|
-
if (on === 0) return {
|
|
75
|
-
label: "None on",
|
|
76
|
-
tone: "neutral"
|
|
77
|
-
};
|
|
78
|
-
if (on === servers.length) return {
|
|
79
|
-
label: on === 1 ? "1 server on" : `${on} servers on`,
|
|
80
|
-
tone: "success"
|
|
81
|
-
};
|
|
82
|
-
return {
|
|
83
|
-
label: `${on} of ${servers.length} on`,
|
|
84
|
-
tone: "success"
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/components/setup/McpCards.tsx
|
|
89
|
-
var serverPath = (id) => `/api/mcp-servers/${encodeURIComponent(id)}`;
|
|
90
|
-
var TRANSPORTS = [{
|
|
91
|
-
value: "stdio",
|
|
92
|
-
label: "stdio"
|
|
93
|
-
}, {
|
|
94
|
-
value: "http",
|
|
95
|
-
label: "http"
|
|
96
|
-
}];
|
|
97
|
-
/** A command Bazilion starts, or an address it calls. */
|
|
98
|
-
function AddServerCard({ onAdded }) {
|
|
99
|
-
const [draft, setDraft] = useState(EMPTY_MCP_DRAFT);
|
|
100
|
-
const [busy, setBusy] = useState(false);
|
|
101
|
-
const [error, setError] = useState(null);
|
|
102
|
-
const form = mcpServerForm(draft);
|
|
103
|
-
const edit = (change) => {
|
|
104
|
-
setError(null);
|
|
105
|
-
setDraft((current) => ({
|
|
106
|
-
...current,
|
|
107
|
-
...change
|
|
108
|
-
}));
|
|
109
|
-
};
|
|
110
|
-
async function add(event) {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
if (!form.body || busy) return;
|
|
113
|
-
setBusy(true);
|
|
114
|
-
setError(null);
|
|
115
|
-
try {
|
|
116
|
-
await api("/api/mcp-servers", { body: form.body });
|
|
117
|
-
setDraft({
|
|
118
|
-
...EMPTY_MCP_DRAFT,
|
|
119
|
-
transport: draft.transport
|
|
120
|
-
});
|
|
121
|
-
await onAdded();
|
|
122
|
-
} catch (cause) {
|
|
123
|
-
setError(errorMessage(cause));
|
|
124
|
-
} finally {
|
|
125
|
-
setBusy(false);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return /* @__PURE__ */ jsx(SetupCard, {
|
|
129
|
-
labelledBy: "mcp-add",
|
|
130
|
-
icon: /* @__PURE__ */ jsx(Plus, { className: "size-5" }),
|
|
131
|
-
title: "Add a server",
|
|
132
|
-
description: "A stdio server is a command Bazilion starts; an http server is an address it calls.",
|
|
133
|
-
children: /* @__PURE__ */ jsxs(CardForm, {
|
|
134
|
-
onSubmit: add,
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ jsxs("div", {
|
|
137
|
-
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_12rem]",
|
|
138
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
139
|
-
label: "Name",
|
|
140
|
-
value: draft.name,
|
|
141
|
-
disabled: busy,
|
|
142
|
-
placeholder: "playwright",
|
|
143
|
-
mono: true,
|
|
144
|
-
className: "max-w-none",
|
|
145
|
-
problem: form.problems.name,
|
|
146
|
-
onChange: (name) => edit({ name })
|
|
147
|
-
}), /* @__PURE__ */ jsx(SelectField, {
|
|
148
|
-
label: "Transport",
|
|
149
|
-
value: draft.transport,
|
|
150
|
-
options: TRANSPORTS,
|
|
151
|
-
disabled: busy,
|
|
152
|
-
className: "max-w-none",
|
|
153
|
-
onChange: (transport) => edit({ transport })
|
|
154
|
-
})]
|
|
155
|
-
}),
|
|
156
|
-
draft.transport === "stdio" ? /* @__PURE__ */ jsxs("div", {
|
|
157
|
-
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[12rem_minmax(0,1fr)]",
|
|
158
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
159
|
-
label: "Command",
|
|
160
|
-
value: draft.command,
|
|
161
|
-
disabled: busy,
|
|
162
|
-
placeholder: "npx",
|
|
163
|
-
mono: true,
|
|
164
|
-
className: "max-w-none",
|
|
165
|
-
onChange: (command) => edit({ command })
|
|
166
|
-
}), /* @__PURE__ */ jsx(TextField, {
|
|
167
|
-
label: "Args (space-separated)",
|
|
168
|
-
value: draft.args,
|
|
169
|
-
disabled: busy,
|
|
170
|
-
placeholder: "-y @modelcontextprotocol/server-filesystem /srv/data",
|
|
171
|
-
mono: true,
|
|
172
|
-
className: "max-w-none",
|
|
173
|
-
onChange: (args) => edit({ args })
|
|
174
|
-
})]
|
|
175
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
176
|
-
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_16rem]",
|
|
177
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
178
|
-
label: "URL",
|
|
179
|
-
value: draft.url,
|
|
180
|
-
disabled: busy,
|
|
181
|
-
placeholder: "https://mcp.example.com/mcp",
|
|
182
|
-
mono: true,
|
|
183
|
-
inputMode: "url",
|
|
184
|
-
className: "max-w-none",
|
|
185
|
-
problem: form.problems.url,
|
|
186
|
-
onChange: (url) => edit({ url })
|
|
187
|
-
}), /* @__PURE__ */ jsx(SecretField, {
|
|
188
|
-
label: "Bearer token (optional)",
|
|
189
|
-
saved: false,
|
|
190
|
-
value: draft.token,
|
|
191
|
-
disabled: busy,
|
|
192
|
-
onChange: (token) => edit({ token })
|
|
193
|
-
})]
|
|
194
|
-
}),
|
|
195
|
-
/* @__PURE__ */ jsxs("div", {
|
|
196
|
-
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
197
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
198
|
-
variant: "primary",
|
|
199
|
-
type: "submit",
|
|
200
|
-
disabled: busy || !form.body,
|
|
201
|
-
children: busy ? "Adding…" : "Add server"
|
|
202
|
-
}), error ? /* @__PURE__ */ jsxs("p", {
|
|
203
|
-
role: "alert",
|
|
204
|
-
className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
|
|
205
|
-
children: ["Nothing was added: ", error]
|
|
206
|
-
}) : form.missing && /* @__PURE__ */ jsx("p", {
|
|
207
|
-
role: "status",
|
|
208
|
-
className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
|
|
209
|
-
children: form.missing
|
|
210
|
-
})]
|
|
211
|
-
})
|
|
212
|
-
]
|
|
213
|
-
})
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
/** The servers whose tools are offered to every Agent turn while they are switched on. */
|
|
217
|
-
function ServersCard({ servers, onChanged }) {
|
|
218
|
-
const [tests, setTests] = useState({});
|
|
219
|
-
const [busyId, setBusyId] = useState(null);
|
|
220
|
-
const [error, setError] = useState(null);
|
|
221
|
-
const [deleting, setDeleting] = useState(null);
|
|
222
|
-
const state = serversState(servers);
|
|
223
|
-
async function toggle(server) {
|
|
224
|
-
setBusyId(server.id);
|
|
225
|
-
setError(null);
|
|
226
|
-
try {
|
|
227
|
-
await api(serverPath(server.id), {
|
|
228
|
-
method: "PATCH",
|
|
229
|
-
body: { enabled: !server.enabled }
|
|
230
|
-
});
|
|
231
|
-
await onChanged();
|
|
232
|
-
} catch (cause) {
|
|
233
|
-
setError(errorMessage(cause));
|
|
234
|
-
} finally {
|
|
235
|
-
setBusyId(null);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
async function test(id) {
|
|
239
|
-
setTests((current) => ({
|
|
240
|
-
...current,
|
|
241
|
-
[id]: { kind: "pending" }
|
|
242
|
-
}));
|
|
243
|
-
let result;
|
|
244
|
-
try {
|
|
245
|
-
const body = await api(`${serverPath(id)}/test`, { method: "POST" });
|
|
246
|
-
const tools = body.tools ?? [];
|
|
247
|
-
result = body.ok ? {
|
|
248
|
-
kind: "success",
|
|
249
|
-
message: `${tools.length === 1 ? "1 tool" : `${tools.length} tools`}: ${tools.map((tool) => tool.name).join(", ")}`
|
|
250
|
-
} : {
|
|
251
|
-
kind: "error",
|
|
252
|
-
message: body.error ?? "Test failed"
|
|
253
|
-
};
|
|
254
|
-
} catch (cause) {
|
|
255
|
-
result = {
|
|
256
|
-
kind: "error",
|
|
257
|
-
message: errorMessage(cause)
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
setTests((current) => ({
|
|
261
|
-
...current,
|
|
262
|
-
[id]: result
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
return /* @__PURE__ */ jsxs(SetupCard, {
|
|
266
|
-
labelledBy: "mcp-servers",
|
|
267
|
-
icon: /* @__PURE__ */ jsx(Server, { className: "size-5" }),
|
|
268
|
-
title: "Servers",
|
|
269
|
-
description: "Their tools are offered to every Agent turn while they are switched on.",
|
|
270
|
-
action: state && /* @__PURE__ */ jsx(Chip, {
|
|
271
|
-
tone: state.tone,
|
|
272
|
-
children: state.label
|
|
273
|
-
}),
|
|
274
|
-
children: [
|
|
275
|
-
servers.length === 0 ? /* @__PURE__ */ jsx(CardRow, {
|
|
276
|
-
className: "py-4 text-sm text-muted-foreground",
|
|
277
|
-
children: "No MCP servers yet; add one above."
|
|
278
|
-
}) : /* @__PURE__ */ jsx(CardList, { children: servers.map((server) => {
|
|
279
|
-
const result = tests[server.id];
|
|
280
|
-
const busy = busyId === server.id;
|
|
281
|
-
return /* @__PURE__ */ jsxs(ListRow, {
|
|
282
|
-
title: server.name,
|
|
283
|
-
chip: /* @__PURE__ */ jsx(Chip, {
|
|
284
|
-
tone: server.enabled ? "success" : "neutral",
|
|
285
|
-
children: server.enabled ? "Enabled" : "Disabled"
|
|
286
|
-
}),
|
|
287
|
-
meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
288
|
-
/* @__PURE__ */ jsx("span", { children: server.transport }),
|
|
289
|
-
server.hasAuthToken && /* @__PURE__ */ jsx("span", { children: "bearer token" }),
|
|
290
|
-
/* @__PURE__ */ jsx("code", {
|
|
291
|
-
className: "break-all",
|
|
292
|
-
children: server.transport === "stdio" ? `${server.command ?? ""} ${server.args.join(" ")}`.trim() : server.url
|
|
293
|
-
})
|
|
294
|
-
] }),
|
|
295
|
-
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
296
|
-
/* @__PURE__ */ jsx(Button, {
|
|
297
|
-
variant: "ghost",
|
|
298
|
-
disabled: result?.kind === "pending",
|
|
299
|
-
"aria-label": `Test ${server.name}`,
|
|
300
|
-
onClick: () => void test(server.id),
|
|
301
|
-
children: "Test"
|
|
302
|
-
}),
|
|
303
|
-
/* @__PURE__ */ jsx(Button, {
|
|
304
|
-
variant: "ghost",
|
|
305
|
-
disabled: busy,
|
|
306
|
-
"aria-label": `${server.enabled ? "Disable" : "Enable"} ${server.name}`,
|
|
307
|
-
onClick: () => void toggle(server),
|
|
308
|
-
children: busy ? "Working…" : server.enabled ? "Disable" : "Enable"
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ jsx(Button, {
|
|
311
|
-
variant: "danger",
|
|
312
|
-
disabled: busy,
|
|
313
|
-
"aria-label": `Delete ${server.name}`,
|
|
314
|
-
onClick: () => setDeleting(server),
|
|
315
|
-
children: "Delete"
|
|
316
|
-
})
|
|
317
|
-
] }),
|
|
318
|
-
children: [
|
|
319
|
-
result?.kind === "pending" && /* @__PURE__ */ jsx(Waiting, { children: "Connecting…" }),
|
|
320
|
-
result?.kind === "success" && /* @__PURE__ */ jsx(Notice, {
|
|
321
|
-
tone: "success",
|
|
322
|
-
children: result.message
|
|
323
|
-
}),
|
|
324
|
-
result?.kind === "error" && /* @__PURE__ */ jsx(Notice, {
|
|
325
|
-
tone: "warning",
|
|
326
|
-
role: "alert",
|
|
327
|
-
children: result.message
|
|
328
|
-
})
|
|
329
|
-
]
|
|
330
|
-
}, server.id);
|
|
331
|
-
}) }),
|
|
332
|
-
error && /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Notice, {
|
|
333
|
-
tone: "warning",
|
|
334
|
-
role: "alert",
|
|
335
|
-
title: "That did not work.",
|
|
336
|
-
children: error
|
|
337
|
-
}) }),
|
|
338
|
-
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
339
|
-
open: deleting !== null,
|
|
340
|
-
onOpenChange: (open) => {
|
|
341
|
-
if (!open) setDeleting(null);
|
|
342
|
-
},
|
|
343
|
-
title: `Delete MCP server ${deleting?.name ?? ""}?`,
|
|
344
|
-
description: /* @__PURE__ */ jsx("p", {
|
|
345
|
-
className: "m-0",
|
|
346
|
-
children: "This removes the server and its stored bearer token, closes its connection and removes its tools from later Agent turns."
|
|
347
|
-
}),
|
|
348
|
-
confirmLabel: "Delete MCP server",
|
|
349
|
-
onConfirm: async () => {
|
|
350
|
-
if (!deleting) return;
|
|
351
|
-
await api(serverPath(deleting.id), { method: "DELETE" });
|
|
352
|
-
await onChanged();
|
|
353
|
-
}
|
|
354
|
-
})
|
|
355
|
-
]
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
//#endregion
|
|
359
|
-
//#region src/routes/config/mcp.tsx?tsr-split=component
|
|
360
|
-
function McpPage() {
|
|
361
|
-
const { servers } = Route.useLoaderData();
|
|
362
|
-
const router = useRouter();
|
|
363
|
-
const reload = () => router.invalidate({ sync: true });
|
|
364
|
-
return /* @__PURE__ */ jsxs(ConfigPage, {
|
|
365
|
-
title: "MCP servers",
|
|
366
|
-
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
367
|
-
"Tools from these Model Context Protocol servers are offered to every Agent turn as",
|
|
368
|
-
" ",
|
|
369
|
-
/* @__PURE__ */ jsx("code", { children: "mcp__<server>__<tool>" }),
|
|
370
|
-
". 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."
|
|
371
|
-
] }),
|
|
372
|
-
children: [/* @__PURE__ */ jsx(AddServerCard, { onAdded: reload }), /* @__PURE__ */ jsx(ServersCard, {
|
|
373
|
-
servers,
|
|
374
|
-
onChanged: reload
|
|
375
|
-
})]
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
//#endregion
|
|
379
|
-
export { McpPage as component };
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
//#region ../../packages/api-types/src/entities.ts
|
|
2
|
-
/** The Team and the Profile first-run setup creates. */
|
|
3
|
-
var DEFAULT_TEAM_ID = "default";
|
|
4
|
-
/**
|
|
5
|
-
* Why a name cannot be an Agent's, or null. A name is one line of visible text: it is shown in
|
|
6
|
-
* every teammate's instructions, so line breaks and control or format characters are refused.
|
|
7
|
-
*/
|
|
8
|
-
function agentNameProblem(name) {
|
|
9
|
-
if (!name.trim()) return "A name cannot be empty.";
|
|
10
|
-
if (name.length > 120) return `A name is at most 120 characters.`;
|
|
11
|
-
if (/[\p{Cc}\p{Cf}\u2028\u2029]/u.test(name)) return "A name is one line of text, without control characters.";
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
var DEFAULT_PROFILE_ID = "default";
|
|
15
|
-
/** Edge endpoint standing for every Agent in other Teams. */
|
|
16
|
-
var OUTSIDE_TEAM = "outside";
|
|
17
|
-
var REASONING_LEVELS = [
|
|
18
|
-
"off",
|
|
19
|
-
"minimal",
|
|
20
|
-
"low",
|
|
21
|
-
"medium",
|
|
22
|
-
"high",
|
|
23
|
-
"xhigh"
|
|
24
|
-
];
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region ../../packages/api-types/src/public-origin.ts
|
|
27
|
-
/** The configuration for a BAZILION_PUBLIC_ORIGIN value; anything but an exact HTTPS origin throws. */
|
|
28
|
-
function publicOriginConfig(raw) {
|
|
29
|
-
const value = raw?.trim();
|
|
30
|
-
if (!value) return {
|
|
31
|
-
origin: null,
|
|
32
|
-
production: false,
|
|
33
|
-
sessionCookie: "bz_session_dev",
|
|
34
|
-
csrfCookie: "bz_csrf_dev"
|
|
35
|
-
};
|
|
36
|
-
let url;
|
|
37
|
-
try {
|
|
38
|
-
url = new URL(value);
|
|
39
|
-
} catch {
|
|
40
|
-
throw new Error("BAZILION_PUBLIC_ORIGIN must be an exact HTTPS origin");
|
|
41
|
-
}
|
|
42
|
-
if (url.protocol !== "https:" || url.username || url.password || url.pathname !== "/" || url.search || url.hash || url.origin !== value.replace(/\/$/, "")) throw new Error("BAZILION_PUBLIC_ORIGIN must be an exact HTTPS origin");
|
|
43
|
-
return {
|
|
44
|
-
origin: url.origin,
|
|
45
|
-
production: true,
|
|
46
|
-
sessionCookie: "__Host-bz_session",
|
|
47
|
-
csrfCookie: "__Host-bz_csrf"
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function isLoopbackHost(hostname) {
|
|
51
|
-
return [
|
|
52
|
-
"127.0.0.1",
|
|
53
|
-
"localhost",
|
|
54
|
-
"[::1]",
|
|
55
|
-
"::1"
|
|
56
|
-
].includes(hostname);
|
|
57
|
-
}
|
|
58
|
-
var TEXT_TYPES = new Set([
|
|
59
|
-
"application/json",
|
|
60
|
-
"application/ld+json",
|
|
61
|
-
"application/xml",
|
|
62
|
-
"application/yaml",
|
|
63
|
-
"application/x-yaml",
|
|
64
|
-
"application/toml",
|
|
65
|
-
"application/javascript",
|
|
66
|
-
"application/x-sh",
|
|
67
|
-
"application/sql",
|
|
68
|
-
"application/x-ndjson"
|
|
69
|
-
]);
|
|
70
|
-
/** Files sent without a text type (`application/octet-stream`) that are text by their name. */
|
|
71
|
-
var TEXT_EXTENSIONS = new Set("txt md markdown csv tsv json jsonl ndjson yaml yml toml ini cfg conf log xml css scss js mjs cjs jsx ts tsx py rb go rs java kt swift c h cc cpp hpp cs php sh bash zsh fish ps1 sql r lua pl tex diff patch vue svelte graphql proto dockerfile makefile".split(" "));
|
|
72
|
-
/** Pages a browser would run are only ever downloaded, never shown, not even as text. */
|
|
73
|
-
var ACTIVE_TYPES = new Set([
|
|
74
|
-
"text/html",
|
|
75
|
-
"application/xhtml+xml",
|
|
76
|
-
"image/svg+xml"
|
|
77
|
-
]);
|
|
78
|
-
/** Whether Files can show a saved file as text: its type or its name says text, and it is small. */
|
|
79
|
-
function isTextPreview(result) {
|
|
80
|
-
if (result.byteLength > 262144) return false;
|
|
81
|
-
const type = result.mimeType.toLowerCase();
|
|
82
|
-
if (ACTIVE_TYPES.has(type)) return false;
|
|
83
|
-
if (type.startsWith("text/") || TEXT_TYPES.has(type) || /\+(json|xml)$/.test(type)) return true;
|
|
84
|
-
if (type !== "application/octet-stream") return false;
|
|
85
|
-
const name = result.name.toLowerCase();
|
|
86
|
-
const extension = name.includes(".") ? name.slice(name.lastIndexOf(".") + 1) : name;
|
|
87
|
-
return TEXT_EXTENSIONS.has(extension);
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region ../../packages/api-types/src/usage.ts
|
|
91
|
-
/** US dollars as Usage shows them: `$0.42`, `<$0.01`, `$1,234`. */
|
|
92
|
-
function formatCost(usd) {
|
|
93
|
-
if (usd <= 0) return "$0.00";
|
|
94
|
-
if (usd < .01) return "<$0.01";
|
|
95
|
-
if (usd < 1e3) return `$${usd.toFixed(2)}`;
|
|
96
|
-
return `$${Math.round(usd).toLocaleString("en-US")}`;
|
|
97
|
-
}
|
|
98
|
-
/** A use in a few words: `$0.42 · 12k tokens`, `15k tokens, on a plan`, `3.1k tokens, local`. */
|
|
99
|
-
function usageSummary(usage) {
|
|
100
|
-
const tokens = `${formatTokens(usage.totalTokens)} tokens`;
|
|
101
|
-
if (usage.cost > 0) return `${formatCost(usage.cost)} · ${tokens}`;
|
|
102
|
-
if (usage.totalTokens > 0 && usage.planTokens === usage.totalTokens) return `${tokens}, on a plan`;
|
|
103
|
-
if (usage.totalTokens > 0 && usage.localTokens === usage.totalTokens) return `${tokens}, local`;
|
|
104
|
-
return tokens;
|
|
105
|
-
}
|
|
106
|
-
/** A token count in a few characters: `950`, `12.5k`, `3.4M`. */
|
|
107
|
-
function formatTokens(tokens) {
|
|
108
|
-
if (tokens < 1e3) return String(Math.round(tokens));
|
|
109
|
-
if (tokens < 1e6) return `${(tokens / 1e3).toFixed(tokens < 1e4 ? 1 : 0)}k`;
|
|
110
|
-
return `${(tokens / 1e6).toFixed(tokens < 1e7 ? 1 : 0)}M`;
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
export { isLoopbackHost as a, DEFAULT_TEAM_ID as c, agentNameProblem as d, isTextPreview as i, OUTSIDE_TEAM as l, formatTokens as n, publicOriginConfig as o, usageSummary as r, DEFAULT_PROFILE_ID as s, formatCost as t, REASONING_LEVELS as u };
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { l as OUTSIDE_TEAM } from "./src-BeMh8Fze.js";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Check, Minus, X } from "lucide-react";
|
|
4
|
-
//#region src/lib/team-policy.ts
|
|
5
|
-
var OUTSIDE = OUTSIDE_TEAM;
|
|
6
|
-
function edgeKey(from, to) {
|
|
7
|
-
return `${from}>${to}`;
|
|
8
|
-
}
|
|
9
|
-
function hasEdge(document, from, to) {
|
|
10
|
-
return document.edges.some((edge) => edge.from === from && edge.to === to);
|
|
11
|
-
}
|
|
12
|
-
/** Add or remove one allow edge; an endpoint never connects to itself. */
|
|
13
|
-
function setEdge(document, from, to, allowed) {
|
|
14
|
-
if (from === to || hasEdge(document, from, to) === allowed) return document;
|
|
15
|
-
const edges = allowed ? [...document.edges, {
|
|
16
|
-
from,
|
|
17
|
-
to
|
|
18
|
-
}] : document.edges.filter((edge) => edge.from !== from || edge.to !== to);
|
|
19
|
-
return {
|
|
20
|
-
...document,
|
|
21
|
-
edges
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function endpointLabel(document, key) {
|
|
25
|
-
if (key === OUTSIDE) return "Other teams";
|
|
26
|
-
return document.members.find((member) => member.key === key)?.name || key;
|
|
27
|
-
}
|
|
28
|
-
function defaultPosition(index) {
|
|
29
|
-
return {
|
|
30
|
-
x: 40 + index % 3 * 250,
|
|
31
|
-
y: 40 + Math.floor(index / 3) * 130
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function liveDocument(policy) {
|
|
35
|
-
return {
|
|
36
|
-
kind: "live",
|
|
37
|
-
name: policy.teamId,
|
|
38
|
-
userMd: null,
|
|
39
|
-
mode: policy.mode,
|
|
40
|
-
members: policy.members.map((agent, index) => ({
|
|
41
|
-
key: agent.id,
|
|
42
|
-
name: agent.name,
|
|
43
|
-
profileId: agent.profileId,
|
|
44
|
-
status: agent.status,
|
|
45
|
-
position: defaultPosition(index)
|
|
46
|
-
})),
|
|
47
|
-
edges: policy.edges.map((edge) => ({
|
|
48
|
-
from: edge.from,
|
|
49
|
-
to: edge.to
|
|
50
|
-
}))
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function liveEdges(document) {
|
|
54
|
-
return document.edges.map((edge) => ({
|
|
55
|
-
from: edge.from,
|
|
56
|
-
to: edge.to
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
function templateDocument(template) {
|
|
60
|
-
const key = (end) => end === OUTSIDE ? OUTSIDE : `slot:${end}`;
|
|
61
|
-
return {
|
|
62
|
-
kind: "template",
|
|
63
|
-
name: template.name,
|
|
64
|
-
userMd: template.userMd,
|
|
65
|
-
mode: template.policyMode,
|
|
66
|
-
members: template.slots.map((slot, index) => ({
|
|
67
|
-
key: `slot:${index}`,
|
|
68
|
-
name: slot.agentName,
|
|
69
|
-
profileId: slot.profileId,
|
|
70
|
-
modelOverride: slot.modelOverride,
|
|
71
|
-
reasoningLevel: slot.reasoningLevel,
|
|
72
|
-
position: slot.layoutPosition ?? defaultPosition(index)
|
|
73
|
-
})),
|
|
74
|
-
edges: template.edges.map((edge) => ({
|
|
75
|
-
from: key(edge.from),
|
|
76
|
-
to: key(edge.to)
|
|
77
|
-
}))
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
/** The PUT body for a template draft; slots are numbered by their order in the draft. */
|
|
81
|
-
function templateInput(document, profiles) {
|
|
82
|
-
const profileIds = new Set(profiles.map((profile) => profile.id));
|
|
83
|
-
const position = new Map(document.members.map((member, index) => [member.key, index]));
|
|
84
|
-
const endpoint = (key) => {
|
|
85
|
-
if (key === OUTSIDE) return OUTSIDE;
|
|
86
|
-
const index = position.get(key);
|
|
87
|
-
if (index === void 0) throw new Error(`Edge names a removed slot: ${key}`);
|
|
88
|
-
return index;
|
|
89
|
-
};
|
|
90
|
-
return {
|
|
91
|
-
name: document.name,
|
|
92
|
-
userMd: document.userMd,
|
|
93
|
-
policyMode: document.mode,
|
|
94
|
-
slots: document.members.map((member) => {
|
|
95
|
-
if (!profileIds.has(member.profileId)) throw new Error(`Missing Agent template: ${member.profileId || "(none)"}`);
|
|
96
|
-
return {
|
|
97
|
-
profileId: member.profileId,
|
|
98
|
-
agentName: member.name,
|
|
99
|
-
modelOverride: member.modelOverride ?? null,
|
|
100
|
-
reasoningLevel: member.reasoningLevel ?? null,
|
|
101
|
-
layoutPosition: member.position
|
|
102
|
-
};
|
|
103
|
-
}),
|
|
104
|
-
edges: document.edges.map((edge) => ({
|
|
105
|
-
from: endpoint(edge.from),
|
|
106
|
-
to: endpoint(edge.to)
|
|
107
|
-
}))
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/** A live Team stores no layout, so dragging its nodes never makes the draft dirty. */
|
|
111
|
-
function sameDocument(left, right) {
|
|
112
|
-
const edges = (document) => document.edges.map((edge) => edgeKey(edge.from, edge.to)).sort().join("|");
|
|
113
|
-
if (left.mode !== right.mode || edges(left) !== edges(right)) return false;
|
|
114
|
-
if (left.kind === "live") return true;
|
|
115
|
-
return left.name === right.name && left.userMd === right.userMd && JSON.stringify(left.members) === JSON.stringify(right.members);
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/components/team-policy/TeamPolicyMatrix.tsx
|
|
119
|
-
function TeamPolicyMatrix({ document, selectedId, onSelect, onToggle }) {
|
|
120
|
-
const actors = [...document.members.map((member) => member.key), OUTSIDE];
|
|
121
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
122
|
-
className: "h-full min-h-[420px] overflow-auto bg-ivory p-4 sm:p-6",
|
|
123
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
124
|
-
className: "mb-4",
|
|
125
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
126
|
-
className: "m-0 font-body text-base font-semibold text-chocolate",
|
|
127
|
-
children: "Communication matrix"
|
|
128
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
129
|
-
className: "mt-1 text-xs text-mocha-light",
|
|
130
|
-
children: "Rows send; columns receive. Every cell edits the same connections as Flow."
|
|
131
|
-
})]
|
|
132
|
-
}), /* @__PURE__ */ jsxs("table", {
|
|
133
|
-
className: "m-0 min-w-[620px] table-fixed overflow-visible rounded-md text-xs",
|
|
134
|
-
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
135
|
-
className: "sticky left-0 z-20 w-40 bg-ivory",
|
|
136
|
-
children: "from / to"
|
|
137
|
-
}), actors.map((target) => /* @__PURE__ */ jsx("th", {
|
|
138
|
-
className: "w-24 max-w-24 text-center normal-case tracking-normal",
|
|
139
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
140
|
-
type: "button",
|
|
141
|
-
onClick: () => onSelect(target),
|
|
142
|
-
className: `w-full truncate rounded-sm px-1 py-1 hover:bg-sapphire-glow ${selectedId === target ? "text-sapphire" : "text-mocha"}`,
|
|
143
|
-
title: endpointLabel(document, target),
|
|
144
|
-
children: endpointLabel(document, target)
|
|
145
|
-
})
|
|
146
|
-
}, target))] }) }), /* @__PURE__ */ jsx("tbody", { children: actors.map((source) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
147
|
-
className: "sticky left-0 z-10 max-w-40 bg-snow normal-case tracking-normal",
|
|
148
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
149
|
-
type: "button",
|
|
150
|
-
onClick: () => onSelect(source),
|
|
151
|
-
className: `w-full truncate rounded-sm px-1 py-1 text-left hover:bg-sapphire-glow ${selectedId === source ? "text-sapphire" : "text-mocha"}`,
|
|
152
|
-
title: endpointLabel(document, source),
|
|
153
|
-
children: endpointLabel(document, source)
|
|
154
|
-
})
|
|
155
|
-
}), actors.map((target) => {
|
|
156
|
-
const allowed = hasEdge(document, source, target);
|
|
157
|
-
const label = `${endpointLabel(document, source)} to ${endpointLabel(document, target)}`;
|
|
158
|
-
return /* @__PURE__ */ jsx("td", {
|
|
159
|
-
className: "h-14 p-1 text-center",
|
|
160
|
-
children: source !== target ? /* @__PURE__ */ jsx("button", {
|
|
161
|
-
type: "button",
|
|
162
|
-
onClick: () => onToggle(source, target, !allowed),
|
|
163
|
-
"aria-pressed": allowed,
|
|
164
|
-
"aria-label": `${allowed ? "Deny" : "Allow"} ${label}`,
|
|
165
|
-
title: `${allowed ? "Allowed" : "Not allowed"}: ${label}`,
|
|
166
|
-
className: `mx-auto flex h-9 w-9 items-center justify-center rounded-md border transition-colors ${allowed ? "border-sapphire bg-sapphire text-snow hover:bg-sapphire-deep" : "border-frost bg-ivory text-mocha-light hover:border-rose-baziu hover:text-rose-baziu"}`,
|
|
167
|
-
children: allowed ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
168
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
169
|
-
className: "mx-auto flex h-9 w-9 items-center justify-center text-mocha-light",
|
|
170
|
-
children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" })
|
|
171
|
-
})
|
|
172
|
-
}, target);
|
|
173
|
-
})] }, source)) })]
|
|
174
|
-
})]
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
export { endpointLabel as a, liveEdges as c, templateDocument as d, templateInput as f, edgeKey as i, sameDocument as l, OUTSIDE as n, hasEdge as o, defaultPosition as r, liveDocument as s, TeamPolicyMatrix as t, setEdge as u };
|