@ractive-ch/tab-mcp-client 0.1.0-alpha.1 → 0.2.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/README.md +124 -10
- package/always-allowed.d.ts +15 -0
- package/cdn/connection-5ehqkmw1.min.js +10 -0
- package/cdn/{connection-cfq1n4kh.min.js.map → connection-5ehqkmw1.min.js.map} +4 -4
- package/cdn/tab-mcp-client.min.js +3 -3
- package/cdn/tab-mcp-client.min.js.map +6 -5
- package/cdn/ui-zmrhb8xg.min.js +4 -0
- package/cdn/ui-zmrhb8xg.min.js.map +10 -0
- package/{connection-1gf7vqz2.js → connection-ag7eyd36.js} +50 -9
- package/connection-ag7eyd36.js.map +13 -0
- package/index.d.ts +1 -1
- package/index.js +58 -9
- package/index.js.map +6 -5
- package/internal.d.ts +4 -1
- package/mcp.d.ts +6 -1
- package/package.json +1 -1
- package/tab-mcp.d.ts +1 -1
- package/types.d.ts +31 -0
- package/{ui-168746sb.js → ui-wrm46a0a.js} +98 -16
- package/ui-wrm46a0a.js.map +10 -0
- package/ui.d.ts +13 -8
- package/version.d.ts +1 -1
- package/cdn/connection-cfq1n4kh.min.js +0 -10
- package/cdn/ui-aac2cw9f.min.js +0 -4
- package/cdn/ui-aac2cw9f.min.js.map +0 -10
- package/connection-1gf7vqz2.js.map +0 -13
- package/ui-168746sb.js.map +0 -10
|
@@ -53,7 +53,7 @@ var MIN_ALLOW_DELAY_MS = 500;
|
|
|
53
53
|
function confirmDialog(request, doc, options = {}) {
|
|
54
54
|
const delay = Math.max(MIN_ALLOW_DELAY_MS, options.allowDelayMs ?? ALLOW_DELAY_MS);
|
|
55
55
|
if (request.signal.aborted)
|
|
56
|
-
return Promise.resolve(
|
|
56
|
+
return Promise.resolve("deny");
|
|
57
57
|
const title = request.tool.title ?? request.tool.name;
|
|
58
58
|
const { dialog } = newDialog(doc, "tab-mcp-confirm", `Allow ${title}?`);
|
|
59
59
|
const deny = button(doc, "Don't allow", () => dialog.close("deny"));
|
|
@@ -61,15 +61,27 @@ function confirmDialog(request, doc, options = {}) {
|
|
|
61
61
|
if (!allow.disabled)
|
|
62
62
|
dialog.close("allow");
|
|
63
63
|
});
|
|
64
|
+
const always = button(doc, "Always allow", () => {
|
|
65
|
+
if (!always.disabled)
|
|
66
|
+
dialog.close("always");
|
|
67
|
+
});
|
|
64
68
|
allow.disabled = true;
|
|
65
|
-
|
|
69
|
+
always.disabled = true;
|
|
70
|
+
const actions = el(doc, "div", { className: "tab-mcp-actions" }, deny, " ", allow, " ", always);
|
|
71
|
+
const alwaysNote = el(doc, "p", {
|
|
72
|
+
className: "tab-mcp-always-note",
|
|
73
|
+
text: `Always allow: ${title} runs without asking for ${clientLabel(request.client)} until you reload this page or disconnect it.`
|
|
74
|
+
});
|
|
66
75
|
const shown = showArguments(request.arguments);
|
|
67
76
|
const args = el(doc, "pre", {
|
|
68
77
|
className: "tab-mcp-arguments",
|
|
69
78
|
text: shown ?? "The arguments cannot be shown, so this call cannot be allowed."
|
|
70
79
|
});
|
|
71
|
-
if (shown === undefined)
|
|
80
|
+
if (shown === undefined) {
|
|
72
81
|
allow.hidden = true;
|
|
82
|
+
always.hidden = true;
|
|
83
|
+
alwaysNote.hidden = true;
|
|
84
|
+
}
|
|
73
85
|
args.style.setProperty("white-space", "pre-wrap");
|
|
74
86
|
args.style.setProperty("max-height", "12rem");
|
|
75
87
|
args.style.setProperty("overflow", "auto");
|
|
@@ -79,7 +91,7 @@ function confirmDialog(request, doc, options = {}) {
|
|
|
79
91
|
}), el(doc, "p", {
|
|
80
92
|
className: "tab-mcp-description",
|
|
81
93
|
text: request.tool.description
|
|
82
|
-
}), args, actions);
|
|
94
|
+
}), args, actions, alwaysNote);
|
|
83
95
|
doc.body.append(dialog);
|
|
84
96
|
return new Promise((resolve) => {
|
|
85
97
|
const onAbort = () => dialog.close("deny");
|
|
@@ -88,14 +100,15 @@ function confirmDialog(request, doc, options = {}) {
|
|
|
88
100
|
dialog.addEventListener("close", () => {
|
|
89
101
|
clearTimeout(timer);
|
|
90
102
|
request.signal.removeEventListener("abort", onAbort);
|
|
91
|
-
const
|
|
103
|
+
const value = dialog.returnValue;
|
|
92
104
|
dialog.remove();
|
|
93
|
-
resolve(
|
|
105
|
+
resolve(value === "allow" || value === "always" ? value : "deny");
|
|
94
106
|
}, { once: true });
|
|
95
107
|
dialog.showModal();
|
|
96
108
|
deny.focus();
|
|
97
109
|
timer = setTimeout(() => {
|
|
98
110
|
allow.disabled = false;
|
|
111
|
+
always.disabled = false;
|
|
99
112
|
}, delay);
|
|
100
113
|
});
|
|
101
114
|
}
|
|
@@ -110,15 +123,18 @@ var INSTRUCTIONS = [
|
|
|
110
123
|
],
|
|
111
124
|
["Claude Code", "Run: claude mcp add --transport http tools ADDRESS"]
|
|
112
125
|
];
|
|
126
|
+
function listOf(items) {
|
|
127
|
+
return items.length < 2 ? items[0] ?? "" : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
128
|
+
}
|
|
113
129
|
function showConnectDialog(mcp, connecting, doc) {
|
|
114
|
-
const { dialog } = newDialog(doc, "tab-mcp-connect", "Connect your AI
|
|
130
|
+
const { dialog } = newDialog(doc, "tab-mcp-connect", "Connect your AI app");
|
|
115
131
|
const status = el(doc, "p", {
|
|
116
132
|
className: "tab-mcp-status",
|
|
117
133
|
text: "Connecting…"
|
|
118
134
|
});
|
|
119
135
|
status.setAttribute("role", "status");
|
|
120
136
|
const addressId = `tab-mcp-${++counter}-address`;
|
|
121
|
-
const label = el(doc, "label", { text: "Add this address to your AI
|
|
137
|
+
const label = el(doc, "label", { text: "Add this address to your AI app:" });
|
|
122
138
|
label.htmlFor = addressId;
|
|
123
139
|
const address = el(doc, "input", {
|
|
124
140
|
id: addressId,
|
|
@@ -137,11 +153,28 @@ function showConnectDialog(mcp, connecting, doc) {
|
|
|
137
153
|
else
|
|
138
154
|
address.select();
|
|
139
155
|
});
|
|
140
|
-
const
|
|
156
|
+
const fresh = button(doc, "New address", () => askNewAddress());
|
|
157
|
+
fresh.className = "tab-mcp-new-address";
|
|
158
|
+
const addressBox = el(doc, "div", { className: "tab-mcp-address" }, label, address, " ", copy, " ", fresh);
|
|
159
|
+
const confirmId = `tab-mcp-${++counter}-new-address`;
|
|
160
|
+
const confirmText = el(doc, "p", { id: confirmId });
|
|
161
|
+
const cancelNew = button(doc, "Cancel", () => {
|
|
162
|
+
confirmBox.hidden = true;
|
|
163
|
+
fresh.focus();
|
|
164
|
+
});
|
|
165
|
+
const confirmNew = button(doc, "Disconnect and get new address", () => getNewAddress());
|
|
166
|
+
confirmNew.className = "tab-mcp-new-address-confirm";
|
|
167
|
+
const confirmBox = el(doc, "div", { className: "tab-mcp-new-address-question" }, confirmText, el(doc, "div", { className: "tab-mcp-actions" }, cancelNew, " ", confirmNew));
|
|
168
|
+
confirmBox.setAttribute("role", "group");
|
|
169
|
+
confirmBox.setAttribute("aria-labelledby", confirmId);
|
|
170
|
+
confirmBox.hidden = true;
|
|
141
171
|
const code = el(doc, "strong", { className: "tab-mcp-code-value" });
|
|
142
172
|
code.style.setProperty("font-size", "var(--tab-mcp-code-size, 1.5em)");
|
|
143
173
|
code.style.setProperty("letter-spacing", "0.1em");
|
|
144
|
-
const codeLine = el(doc, "p", { className: "tab-mcp-code" }, "When asked, enter the code ", code)
|
|
174
|
+
const codeLine = el(doc, "p", { className: "tab-mcp-code" }, "When asked, enter the code ", code, el(doc, "br"), el(doc, "small", {
|
|
175
|
+
className: "tab-mcp-code-note",
|
|
176
|
+
text: "A new code appears every 2 minutes and after each use."
|
|
177
|
+
}));
|
|
145
178
|
codeLine.setAttribute("aria-live", "polite");
|
|
146
179
|
const steps = el(doc, "ul");
|
|
147
180
|
const help = el(doc, "details", { className: "tab-mcp-help" }, el(doc, "summary", { text: "How do I add it?" }), steps);
|
|
@@ -149,20 +182,57 @@ function showConnectDialog(mcp, connecting, doc) {
|
|
|
149
182
|
const apps = el(doc, "div", { className: "tab-mcp-apps" }, el(doc, "h3", { text: "Connected" }), appList);
|
|
150
183
|
const close = button(doc, "Close", () => dialog.close());
|
|
151
184
|
const actions = el(doc, "div", { className: "tab-mcp-actions" }, close);
|
|
152
|
-
dialog.append(status, addressBox, codeLine, help, apps, actions);
|
|
185
|
+
dialog.append(status, addressBox, confirmBox, codeLine, help, apps, actions);
|
|
153
186
|
addressBox.hidden = true;
|
|
154
187
|
codeLine.hidden = true;
|
|
155
188
|
help.hidden = true;
|
|
156
189
|
apps.hidden = true;
|
|
190
|
+
let renewing = false;
|
|
191
|
+
const renderQuestion = () => {
|
|
192
|
+
const names = mcp.grants.map((g) => clientLabel(g.client));
|
|
193
|
+
if (names.length === 0)
|
|
194
|
+
return false;
|
|
195
|
+
confirmText.textContent = `A new address disconnects ${listOf(names)}. To use this page again, add the new address to ${names.length === 1 ? "it" : "them"}.`;
|
|
196
|
+
return true;
|
|
197
|
+
};
|
|
198
|
+
const askNewAddress = () => {
|
|
199
|
+
if (mcp.state !== "connected")
|
|
200
|
+
return;
|
|
201
|
+
if (!renderQuestion()) {
|
|
202
|
+
getNewAddress();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
confirmBox.hidden = false;
|
|
206
|
+
cancelNew.focus();
|
|
207
|
+
};
|
|
208
|
+
const getNewAddress = () => {
|
|
209
|
+
close.focus();
|
|
210
|
+
confirmBox.hidden = true;
|
|
211
|
+
renewing = true;
|
|
212
|
+
status.textContent = "Getting a new address…";
|
|
213
|
+
mcp.newAddress().then(() => {
|
|
214
|
+
renewing = false;
|
|
215
|
+
status.textContent = "This is a new address. Add it to your AI app again.";
|
|
216
|
+
close.focus();
|
|
217
|
+
}, (error) => {
|
|
218
|
+
renewing = false;
|
|
219
|
+
status.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}. Close this and connect again.`;
|
|
220
|
+
close.focus();
|
|
221
|
+
});
|
|
222
|
+
};
|
|
157
223
|
const renderSession = (session) => {
|
|
158
224
|
if (session === undefined) {
|
|
159
225
|
addressBox.hidden = true;
|
|
226
|
+
confirmBox.hidden = true;
|
|
160
227
|
help.hidden = true;
|
|
161
228
|
return;
|
|
162
229
|
}
|
|
163
230
|
address.value = session.address;
|
|
231
|
+
copy.textContent = "Copy";
|
|
164
232
|
const appName = session.appName ?? mcp.appName;
|
|
165
|
-
|
|
233
|
+
if (!renewing)
|
|
234
|
+
status.textContent = appName !== undefined ? `${appName} is ready for your AI app.` : "This page is ready for your AI app.";
|
|
235
|
+
fresh.disabled = mcp.state !== "connected";
|
|
166
236
|
addressBox.hidden = false;
|
|
167
237
|
help.hidden = false;
|
|
168
238
|
steps.replaceChildren(...INSTRUCTIONS.map(([app, how]) => el(doc, "li", {}, el(doc, "strong", { text: app }), `: ${how.replace("ADDRESS", session.address)}`)));
|
|
@@ -174,7 +244,14 @@ function showConnectDialog(mcp, connecting, doc) {
|
|
|
174
244
|
};
|
|
175
245
|
const appsNote = el(doc, "p", { className: "tab-mcp-apps-note" });
|
|
176
246
|
apps.append(appsNote);
|
|
247
|
+
const known = new Set(mcp.grants.map((g) => g.grantId));
|
|
177
248
|
const renderGrants = () => {
|
|
249
|
+
for (const grant of mcp.grants) {
|
|
250
|
+
if (known.has(grant.grantId))
|
|
251
|
+
continue;
|
|
252
|
+
known.add(grant.grantId);
|
|
253
|
+
status.textContent = `${clientLabel(grant.client)} is connected.`;
|
|
254
|
+
}
|
|
178
255
|
const connected = mcp.state === "connected";
|
|
179
256
|
appList.replaceChildren(...mcp.grants.map((grant) => {
|
|
180
257
|
const disconnect = button(doc, "Disconnect", () => {
|
|
@@ -187,9 +264,14 @@ function showConnectDialog(mcp, connecting, doc) {
|
|
|
187
264
|
appsNote.textContent = connected ? "" : "To disconnect an app, connect this page again first.";
|
|
188
265
|
appsNote.hidden = connected;
|
|
189
266
|
apps.hidden = mcp.grants.length === 0;
|
|
267
|
+
if (!confirmBox.hidden && !renderQuestion()) {
|
|
268
|
+
confirmBox.hidden = true;
|
|
269
|
+
fresh.focus();
|
|
270
|
+
}
|
|
190
271
|
};
|
|
191
|
-
const onDisconnected = () => {
|
|
192
|
-
|
|
272
|
+
const onDisconnected = (event) => {
|
|
273
|
+
if (event.detail.reason !== "new_address")
|
|
274
|
+
status.textContent = "Disconnected. AI apps can use this page again after you connect.";
|
|
193
275
|
renderSession(undefined);
|
|
194
276
|
renderGrants();
|
|
195
277
|
renderCode();
|
|
@@ -229,5 +311,5 @@ export {
|
|
|
229
311
|
showConnectDialog
|
|
230
312
|
};
|
|
231
313
|
|
|
232
|
-
//# debugId=
|
|
233
|
-
//# sourceMappingURL=ui-
|
|
314
|
+
//# debugId=C325E3CDD99F482964756E2164756E21
|
|
315
|
+
//# sourceMappingURL=ui-wrm46a0a.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ui.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The default UI, loaded on demand: the \"Connect your AI app\" dialog\n * (DEC-028) and the confirmation of consequential tools. Plain `<dialog>`\n * elements, no styles beyond a few CSS custom properties (`--tab-mcp-*`), all\n * text set with `textContent`. Pages with their own UI use the events and\n * methods of `TabMcp` instead.\n */\n\nimport type { TabMcp } from \"./tab-mcp.ts\";\nimport type {\n\tConfirmRequest,\n\tDisconnectDetail,\n\tGrant,\n\tSessionInfo,\n\tToolCallClient,\n} from \"./types.ts\";\n\nlet counter = 0;\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n\tdoc: Document,\n\ttag: K,\n\tprops: { className?: string; text?: string; id?: string } = {},\n\t...children: (Node | string)[]\n): HTMLElementTagNameMap[K] {\n\tconst node = doc.createElement(tag);\n\tif (props.className !== undefined) node.className = props.className;\n\tif (props.id !== undefined) node.id = props.id;\n\tif (props.text !== undefined) node.textContent = props.text;\n\tnode.append(...children);\n\treturn node;\n}\n\nfunction button(\n\tdoc: Document,\n\ttext: string,\n\tonClick: () => void,\n): HTMLButtonElement {\n\tconst node = el(doc, \"button\", { text });\n\tnode.type = \"button\";\n\tnode.addEventListener(\"click\", onClick);\n\treturn node;\n}\n\nfunction newDialog(\n\tdoc: Document,\n\tclassName: string,\n\ttitle: string,\n): { dialog: HTMLDialogElement; heading: HTMLHeadingElement } {\n\tconst id = `tab-mcp-${++counter}`;\n\tconst dialog = el(doc, \"dialog\", {\n\t\tclassName: `tab-mcp-dialog ${className}`,\n\t});\n\tdialog.setAttribute(\"aria-labelledby\", `${id}-title`);\n\t// CSSOM properties are allowed under a strict CSP (no inline style attribute).\n\tconst style = dialog.style;\n\tstyle.setProperty(\"max-width\", \"var(--tab-mcp-max-width, 34rem)\");\n\tstyle.setProperty(\"font\", \"var(--tab-mcp-font, inherit)\");\n\tstyle.setProperty(\"color\", \"var(--tab-mcp-color, CanvasText)\");\n\tstyle.setProperty(\"background\", \"var(--tab-mcp-background, Canvas)\");\n\tstyle.setProperty(\"border\", \"var(--tab-mcp-border, 1px solid GrayText)\");\n\tstyle.setProperty(\"border-radius\", \"var(--tab-mcp-radius, 0.5rem)\");\n\tstyle.setProperty(\"padding\", \"var(--tab-mcp-padding, 1rem 1.25rem)\");\n\tconst heading = el(doc, \"h2\", { id: `${id}-title`, text: title });\n\theading.style.setProperty(\"margin-top\", \"0\");\n\theading.style.setProperty(\"font-size\", \"var(--tab-mcp-title-size, 1.25em)\");\n\tdialog.append(heading);\n\treturn { dialog, heading };\n}\n\nfunction clientLabel(client: ToolCallClient | Grant[\"client\"]): string {\n\tconst host = client.host || client.id;\n\treturn client.name !== undefined && client.name !== \"\"\n\t\t? `${client.name} (${host})`\n\t\t: host;\n}\n\n/**\n * The arguments as text, in full: what the user approves must be visible.\n * (The relay caps a request at 1 MiB, so this stays bounded.) `undefined`\n * when they cannot be shown, and then \"Allow\" is not offered.\n */\nfunction showArguments(args: Record<string, unknown>): string | undefined {\n\ttry {\n\t\treturn JSON.stringify(args, null, 2);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** How long \"Allow\" stays disabled after the confirmation opens, and the floor. */\nexport const ALLOW_DELAY_MS = 750;\nexport const MIN_ALLOW_DELAY_MS = 500;\n\n/** The user's answer: \"always\" allows this tool for this AI app from now on. */\nexport type ConfirmAnswer = \"allow\" | \"always\" | \"deny\";\n\n/**\n * Ask whether a consequential tool may run. \"Allow\" and \"Always allow\" stay\n * disabled for `allowDelayMs` (default 750, at least 500) after the dialog\n * opens, so a click meant for the page cannot approve. Everything else\n * (Don't allow, Escape, an aborted call) is \"deny\".\n */\nexport function confirmDialog(\n\trequest: ConfirmRequest,\n\tdoc: Document,\n\toptions: { allowDelayMs?: number } = {},\n): Promise<ConfirmAnswer> {\n\tconst delay = Math.max(\n\t\tMIN_ALLOW_DELAY_MS,\n\t\toptions.allowDelayMs ?? ALLOW_DELAY_MS,\n\t);\n\tif (request.signal.aborted) return Promise.resolve(\"deny\");\n\tconst title = request.tool.title ?? request.tool.name;\n\tconst { dialog } = newDialog(doc, \"tab-mcp-confirm\", `Allow ${title}?`);\n\tconst deny = button(doc, \"Don't allow\", () => dialog.close(\"deny\"));\n\tconst allow = button(doc, \"Allow\", () => {\n\t\tif (!allow.disabled) dialog.close(\"allow\");\n\t});\n\tconst always = button(doc, \"Always allow\", () => {\n\t\tif (!always.disabled) dialog.close(\"always\");\n\t});\n\tallow.disabled = true;\n\talways.disabled = true;\n\tconst actions = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-actions\" },\n\t\tdeny,\n\t\t\" \",\n\t\tallow,\n\t\t\" \",\n\t\talways,\n\t);\n\tconst alwaysNote = el(doc, \"p\", {\n\t\tclassName: \"tab-mcp-always-note\",\n\t\ttext: `Always allow: ${title} runs without asking for ${clientLabel(request.client)} until you reload this page or disconnect it.`,\n\t});\n\tconst shown = showArguments(request.arguments);\n\tconst args = el(doc, \"pre\", {\n\t\tclassName: \"tab-mcp-arguments\",\n\t\ttext:\n\t\t\tshown ?? \"The arguments cannot be shown, so this call cannot be allowed.\",\n\t});\n\tif (shown === undefined) {\n\t\tallow.hidden = true;\n\t\talways.hidden = true;\n\t\talwaysNote.hidden = true;\n\t}\n\targs.style.setProperty(\"white-space\", \"pre-wrap\");\n\targs.style.setProperty(\"max-height\", \"12rem\");\n\targs.style.setProperty(\"overflow\", \"auto\");\n\targs.hidden = Object.keys(request.arguments).length === 0;\n\tdialog.append(\n\t\tel(doc, \"p\", {\n\t\t\ttext: `${clientLabel(request.client)} wants to run ${title}.`,\n\t\t}),\n\t\tel(doc, \"p\", {\n\t\t\tclassName: \"tab-mcp-description\",\n\t\t\ttext: request.tool.description,\n\t\t}),\n\t\targs,\n\t\tactions,\n\t\talwaysNote,\n\t);\n\tdoc.body.append(dialog);\n\treturn new Promise((resolve) => {\n\t\tconst onAbort = () => dialog.close(\"deny\");\n\t\trequest.signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\trequest.signal.removeEventListener(\"abort\", onAbort);\n\t\t\t\tconst value = dialog.returnValue;\n\t\t\t\tdialog.remove();\n\t\t\t\tresolve(value === \"allow\" || value === \"always\" ? value : \"deny\");\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\tdialog.showModal();\n\t\tdeny.focus(); // the safe choice is the default\n\t\t// Counted from when the dialog is shown, not from when it was built.\n\t\ttimer = setTimeout(() => {\n\t\t\tallow.disabled = false;\n\t\t\talways.disabled = false;\n\t\t}, delay);\n\t});\n}\n\nconst INSTRUCTIONS: [string, string][] = [\n\t[\n\t\t\"Claude (claude.ai and the desktop app)\",\n\t\t\"Settings → Connectors → Add custom connector, then paste the address.\",\n\t],\n\t[\n\t\t\"ChatGPT\",\n\t\t\"Settings → Apps and connectors → Advanced settings: turn on developer mode, then Create and paste the address.\",\n\t],\n\t[\"Claude Code\", \"Run: claude mcp add --transport http tools ADDRESS\"],\n];\n\n/** \"A and B\", \"A, B and C\". */\nfunction listOf(items: string[]): string {\n\treturn items.length < 2\n\t\t? (items[0] ?? \"\")\n\t\t: `${items.slice(0, -1).join(\", \")} and ${items.at(-1)}`;\n}\n\n/**\n * The \"Connect your AI app\" dialog: the address with Copy and New address,\n * short instructions, the pairing code while the relay sends one, and the\n * connected apps with Disconnect. Pairing is on while it is open. New address\n * asks first when it would disconnect connected apps (`newAddress()` revokes\n * them).\n */\nexport function showConnectDialog(\n\tmcp: TabMcp,\n\tconnecting: Promise<SessionInfo>,\n\tdoc: Document,\n): Promise<void> {\n\tconst { dialog } = newDialog(doc, \"tab-mcp-connect\", \"Connect your AI app\");\n\tconst status = el(doc, \"p\", {\n\t\tclassName: \"tab-mcp-status\",\n\t\ttext: \"Connecting…\",\n\t});\n\tstatus.setAttribute(\"role\", \"status\");\n\n\tconst addressId = `tab-mcp-${++counter}-address`;\n\tconst label = el(doc, \"label\", { text: \"Add this address to your AI app:\" });\n\tlabel.htmlFor = addressId;\n\tconst address = el(doc, \"input\", {\n\t\tid: addressId,\n\t\tclassName: \"tab-mcp-address-input\",\n\t});\n\taddress.readOnly = true;\n\taddress.style.setProperty(\"width\", \"100%\");\n\taddress.style.setProperty(\"font-family\", \"var(--tab-mcp-mono, monospace)\");\n\tconst copy = button(doc, \"Copy\", () => {\n\t\tconst done = () => {\n\t\t\tcopy.textContent = \"Copied\";\n\t\t};\n\t\tconst clipboard = (doc.defaultView?.navigator as Navigator | undefined)\n\t\t\t?.clipboard;\n\t\tif (clipboard !== undefined)\n\t\t\tclipboard.writeText(address.value).then(done, () => address.select());\n\t\telse address.select();\n\t});\n\tconst fresh = button(doc, \"New address\", () => askNewAddress());\n\tfresh.className = \"tab-mcp-new-address\";\n\tconst addressBox = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-address\" },\n\t\tlabel,\n\t\taddress,\n\t\t\" \",\n\t\tcopy,\n\t\t\" \",\n\t\tfresh,\n\t);\n\n\t// Asked in the dialog before New address disconnects connected apps.\n\tconst confirmId = `tab-mcp-${++counter}-new-address`;\n\tconst confirmText = el(doc, \"p\", { id: confirmId });\n\tconst cancelNew = button(doc, \"Cancel\", () => {\n\t\tconfirmBox.hidden = true;\n\t\tfresh.focus();\n\t});\n\tconst confirmNew = button(doc, \"Disconnect and get new address\", () =>\n\t\tgetNewAddress(),\n\t);\n\tconfirmNew.className = \"tab-mcp-new-address-confirm\";\n\tconst confirmBox = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-new-address-question\" },\n\t\tconfirmText,\n\t\tel(\n\t\t\tdoc,\n\t\t\t\"div\",\n\t\t\t{ className: \"tab-mcp-actions\" },\n\t\t\tcancelNew,\n\t\t\t\" \",\n\t\t\tconfirmNew,\n\t\t),\n\t);\n\tconfirmBox.setAttribute(\"role\", \"group\");\n\tconfirmBox.setAttribute(\"aria-labelledby\", confirmId);\n\tconfirmBox.hidden = true;\n\n\tconst code = el(doc, \"strong\", { className: \"tab-mcp-code-value\" });\n\tcode.style.setProperty(\"font-size\", \"var(--tab-mcp-code-size, 1.5em)\");\n\tcode.style.setProperty(\"letter-spacing\", \"0.1em\");\n\tconst codeLine = el(\n\t\tdoc,\n\t\t\"p\",\n\t\t{ className: \"tab-mcp-code\" },\n\t\t\"When asked, enter the code \",\n\t\tcode,\n\t\tel(doc, \"br\"),\n\t\tel(doc, \"small\", {\n\t\t\tclassName: \"tab-mcp-code-note\",\n\t\t\ttext: \"A new code appears every 2 minutes and after each use.\",\n\t\t}),\n\t);\n\tcodeLine.setAttribute(\"aria-live\", \"polite\");\n\n\tconst steps = el(doc, \"ul\");\n\tconst help = el(\n\t\tdoc,\n\t\t\"details\",\n\t\t{ className: \"tab-mcp-help\" },\n\t\tel(doc, \"summary\", { text: \"How do I add it?\" }),\n\t\tsteps,\n\t);\n\n\tconst appList = el(doc, \"ul\");\n\tconst apps = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-apps\" },\n\t\tel(doc, \"h3\", { text: \"Connected\" }),\n\t\tappList,\n\t);\n\n\tconst close = button(doc, \"Close\", () => dialog.close());\n\tconst actions = el(doc, \"div\", { className: \"tab-mcp-actions\" }, close);\n\n\tdialog.append(status, addressBox, confirmBox, codeLine, help, apps, actions);\n\taddressBox.hidden = true;\n\tcodeLine.hidden = true;\n\thelp.hidden = true;\n\tapps.hidden = true;\n\n\t// Set while New address waits for the new session.\n\tlet renewing = false;\n\t// The question names the apps connected now; pairing goes on while it is open.\n\tconst renderQuestion = (): boolean => {\n\t\tconst names = mcp.grants.map((g) => clientLabel(g.client));\n\t\tif (names.length === 0) return false;\n\t\tconfirmText.textContent = `A new address disconnects ${listOf(names)}. To use this page again, add the new address to ${names.length === 1 ? \"it\" : \"them\"}.`;\n\t\treturn true;\n\t};\n\tconst askNewAddress = () => {\n\t\tif (mcp.state !== \"connected\") return;\n\t\tif (!renderQuestion()) {\n\t\t\tgetNewAddress();\n\t\t\treturn;\n\t\t}\n\t\tconfirmBox.hidden = false;\n\t\tcancelNew.focus(); // the safe choice is the default\n\t};\n\tconst getNewAddress = () => {\n\t\t// Focus moves before the focused control is hidden.\n\t\tclose.focus();\n\t\tconfirmBox.hidden = true;\n\t\trenewing = true;\n\t\tstatus.textContent = \"Getting a new address…\";\n\t\t// Called from the click, so the reconnect has the user action it needs.\n\t\tmcp.newAddress().then(\n\t\t\t() => {\n\t\t\t\trenewing = false;\n\t\t\t\tstatus.textContent =\n\t\t\t\t\t\"This is a new address. Add it to your AI app again.\";\n\t\t\t\tclose.focus();\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\trenewing = false;\n\t\t\t\tstatus.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}. Close this and connect again.`;\n\t\t\t\tclose.focus();\n\t\t\t},\n\t\t);\n\t};\n\tconst renderSession = (session: SessionInfo | undefined) => {\n\t\tif (session === undefined) {\n\t\t\taddressBox.hidden = true;\n\t\t\tconfirmBox.hidden = true;\n\t\t\thelp.hidden = true;\n\t\t\treturn;\n\t\t}\n\t\taddress.value = session.address;\n\t\tcopy.textContent = \"Copy\";\n\t\tconst appName = session.appName ?? mcp.appName;\n\t\tif (!renewing)\n\t\t\tstatus.textContent =\n\t\t\t\tappName !== undefined\n\t\t\t\t\t? `${appName} is ready for your AI app.`\n\t\t\t\t\t: \"This page is ready for your AI app.\";\n\t\tfresh.disabled = mcp.state !== \"connected\";\n\t\taddressBox.hidden = false;\n\t\thelp.hidden = false;\n\t\tsteps.replaceChildren(\n\t\t\t...INSTRUCTIONS.map(([app, how]) =>\n\t\t\t\tel(\n\t\t\t\t\tdoc,\n\t\t\t\t\t\"li\",\n\t\t\t\t\t{},\n\t\t\t\t\tel(doc, \"strong\", { text: app }),\n\t\t\t\t\t`: ${how.replace(\"ADDRESS\", session.address)}`,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t};\n\tconst renderCode = () => {\n\t\tconst current = mcp.pairingCode;\n\t\tcode.textContent = current?.code ?? \"\";\n\t\tcodeLine.hidden = current === undefined;\n\t};\n\tconst appsNote = el(doc, \"p\", { className: \"tab-mcp-apps-note\" });\n\tapps.append(appsNote);\n\t// Grants that were there when the dialog opened; a new one is announced.\n\tconst known = new Set(mcp.grants.map((g) => g.grantId));\n\tconst renderGrants = () => {\n\t\tfor (const grant of mcp.grants) {\n\t\t\tif (known.has(grant.grantId)) continue;\n\t\t\tknown.add(grant.grantId);\n\t\t\tstatus.textContent = `${clientLabel(grant.client)} is connected.`;\n\t\t}\n\t\tconst connected = mcp.state === \"connected\";\n\t\tappList.replaceChildren(\n\t\t\t...mcp.grants.map((grant) => {\n\t\t\t\tconst disconnect = button(doc, \"Disconnect\", () => {\n\t\t\t\t\tif (!mcp.revoke(grant.grantId)) renderGrants();\n\t\t\t\t});\n\t\t\t\t// Only the relay can revoke, so only while connected.\n\t\t\t\tdisconnect.disabled = !connected;\n\t\t\t\treturn el(\n\t\t\t\t\tdoc,\n\t\t\t\t\t\"li\",\n\t\t\t\t\t{},\n\t\t\t\t\t`${clientLabel(grant.client)} connected `,\n\t\t\t\t\tdisconnect,\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t\tappsNote.textContent = connected\n\t\t\t? \"\"\n\t\t\t: \"To disconnect an app, connect this page again first.\";\n\t\tappsNote.hidden = connected;\n\t\tapps.hidden = mcp.grants.length === 0;\n\t\tif (!confirmBox.hidden && !renderQuestion()) {\n\t\t\t// Nobody left to disconnect: no question needed.\n\t\t\tconfirmBox.hidden = true;\n\t\t\tfresh.focus();\n\t\t}\n\t};\n\tconst onDisconnected = (event: CustomEvent<DisconnectDetail>) => {\n\t\tif (event.detail.reason !== \"new_address\")\n\t\t\tstatus.textContent =\n\t\t\t\t\"Disconnected. AI apps can use this page again after you connect.\";\n\t\trenderSession(undefined);\n\t\trenderGrants();\n\t\trenderCode();\n\t};\n\tconst onConnected = () => {\n\t\trenderSession(mcp.session);\n\t\trenderGrants();\n\t};\n\n\tmcp.addEventListener(\"pairingcode\", renderCode);\n\tmcp.addEventListener(\"grantschange\", renderGrants);\n\tmcp.addEventListener(\"connected\", onConnected);\n\tmcp.addEventListener(\"disconnected\", onDisconnected);\n\tdoc.body.append(dialog);\n\tmcp.startPairing();\n\trenderGrants();\n\trenderCode();\n\trenderSession(mcp.session);\n\tconnecting.then(\n\t\t(session) => renderSession(session),\n\t\t(error: unknown) => {\n\t\t\tstatus.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}`;\n\t\t},\n\t);\n\n\treturn new Promise((resolve) => {\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tmcp.stopPairing();\n\t\t\t\tmcp.removeEventListener(\"pairingcode\", renderCode);\n\t\t\t\tmcp.removeEventListener(\"grantschange\", renderGrants);\n\t\t\t\tmcp.removeEventListener(\"connected\", onConnected);\n\t\t\t\tmcp.removeEventListener(\"disconnected\", onDisconnected);\n\t\t\t\tdialog.remove();\n\t\t\t\tresolve();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n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M;AAAA,EACtB,IAAI,aAAa;AAAA,EACjB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc,IAAI,OAAO;AAAA,EACzB,WAAW,KACV,CAAC,YAAY,cAAc,OAAO,GAClC,CAAC,UAAmB;AAAA,IACnB,OAAO,cAAc,sBAAsB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,GAElG;AAAA,EAEA,OAAO,IAAI,QAAQ,CAAC,YAAY;AAAA,IAC/B,OAAO,iBACN,SACA,MAAM;AAAA,MACL,IAAI,YAAY;AAAA,MAChB,IAAI,oBAAoB,eAAe,UAAU;AAAA,MACjD,IAAI,oBAAoB,gBAAgB,YAAY;AAAA,MACpD,IAAI,oBAAoB,aAAa,WAAW;AAAA,MAChD,IAAI,oBAAoB,gBAAgB,cAAc;AAAA,MACtD,OAAO,OAAO;AAAA,MACd,QAAQ;AAAA,OAET,EAAE,MAAM,KAAK,CACd;AAAA,IACA,OAAO,UAAU;AAAA,IACjB,MAAM,MAAM;AAAA,GACZ;AAAA;",
|
|
8
|
+
"debugId": "C325E3CDD99F482964756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The default UI, loaded on demand: the "Connect your AI
|
|
2
|
+
* The default UI, loaded on demand: the "Connect your AI app" dialog
|
|
3
3
|
* (DEC-028) and the confirmation of consequential tools. Plain `<dialog>`
|
|
4
4
|
* elements, no styles beyond a few CSS custom properties (`--tab-mcp-*`), all
|
|
5
5
|
* text set with `textContent`. Pages with their own UI use the events and
|
|
@@ -10,17 +10,22 @@ import type { ConfirmRequest, SessionInfo } from "./types.js";
|
|
|
10
10
|
/** How long "Allow" stays disabled after the confirmation opens, and the floor. */
|
|
11
11
|
export declare const ALLOW_DELAY_MS = 750;
|
|
12
12
|
export declare const MIN_ALLOW_DELAY_MS = 500;
|
|
13
|
+
/** The user's answer: "always" allows this tool for this AI app from now on. */
|
|
14
|
+
export type ConfirmAnswer = "allow" | "always" | "deny";
|
|
13
15
|
/**
|
|
14
|
-
* Ask whether a consequential tool may run.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Ask whether a consequential tool may run. "Allow" and "Always allow" stay
|
|
17
|
+
* disabled for `allowDelayMs` (default 750, at least 500) after the dialog
|
|
18
|
+
* opens, so a click meant for the page cannot approve. Everything else
|
|
19
|
+
* (Don't allow, Escape, an aborted call) is "deny".
|
|
17
20
|
*/
|
|
18
21
|
export declare function confirmDialog(request: ConfirmRequest, doc: Document, options?: {
|
|
19
22
|
allowDelayMs?: number;
|
|
20
|
-
}): Promise<
|
|
23
|
+
}): Promise<ConfirmAnswer>;
|
|
21
24
|
/**
|
|
22
|
-
* The "Connect your AI
|
|
23
|
-
* instructions, the pairing code while the relay sends one, and the
|
|
24
|
-
* apps with Disconnect. Pairing is on while it is open.
|
|
25
|
+
* The "Connect your AI app" dialog: the address with Copy and New address,
|
|
26
|
+
* short instructions, the pairing code while the relay sends one, and the
|
|
27
|
+
* connected apps with Disconnect. Pairing is on while it is open. New address
|
|
28
|
+
* asks first when it would disconnect connected apps (`newAddress()` revokes
|
|
29
|
+
* them).
|
|
25
30
|
*/
|
|
26
31
|
export declare function showConnectDialog(mcp: TabMcp, connecting: Promise<SessionInfo>, doc: Document): Promise<void>;
|
package/version.d.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function ne(e,t){let o=typeof e;if(o!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let s=e.length;if(s!==t.length)return!1;for(let i=0;i<s;i++)if(!ne(e[i],t[i]))return!1;return!0}if(o==="object"){if(!e||!t)return e===t;let s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(let n of s)if(!ne(e[n],t[n]))return!1;return!0}return e===t}function U(e){return encodeURI(Le(e))}function Le(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var et={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},tt={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},rt={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},nt=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function F(e,t=Object.create(null),o=nt,s=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let d=e.$id||e.id;if(d){let n=new URL(d,o.href);if(n.hash.length>1)t[n.href]=e;else if(n.hash="",s==="")o=n;else F(e,t,o)}}else if(e!==!0&&e!==!1)return t;let i=o.href+(s?"#"+s:"");if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i});if(e.$ref&&e.__absolute_ref__===void 0){let d=new URL(e.$ref,o.href);d.hash=d.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:d.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let d=new URL(e.$recursiveRef,o.href);d.hash=d.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:d.href})}if(e.$anchor){let d=new URL("#"+e.$anchor,o.href);t[d.href]=e}for(let d in e){if(rt[d])continue;let n=`${s}/${U(d)}`,f=e[d];if(Array.isArray(f)){if(et[d]){let I=f.length;for(let q=0;q<I;q++)F(f[q],t,o,`${n}/${q}`)}}else if(tt[d])for(let I in f)F(f[I],t,o,`${n}/${U(I)}`);else F(f,t,o,n)}return t}var ot=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,st=[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}|~0|~1)*)*$/i,mt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,yt=(e)=>{if(e[0]==='"')return!1;let[t,o,...s]=e.split("@");if(!t||!o||s.length!==0||t.length>64||o.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return o.split(".").every((i)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(i))},gt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ht=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,$t=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function D(e){return e.test.bind(e)}var xe={date:Ae,time:Ne.bind(void 0,!1),"date-time":kt,duration:$t,uri:It,"uri-reference":D(at),"uri-template":D(ut),url:D(ft),email:yt,hostname:D(dt),ipv4:D(gt),ipv6:D(ht),regex:Mt,uuid:D(lt),"json-pointer":D(pt),"json-pointer-uri-fragment":D(ct),"relative-json-pointer":D(mt)};function wt(e){return e%4===0&&(e%100!==0||e%400===0)}function Ae(e){let t=e.match(ot);if(!t)return!1;let o=+t[1],s=+t[2],i=+t[3];return s>=1&&s<=12&&i>=1&&i<=(s==2&&wt(o)?29:st[s])}function Ne(e,t){let o=t.match(it);if(!o)return!1;let s=+o[1],i=+o[2],d=+o[3],n=!!o[5];return(s<=23&&i<=59&&d<=59||s==23&&i==59&&d==60)&&(!e||n)}var bt=/t|\s/i;function kt(e){let t=e.split(bt);return t.length==2&&Ae(t[0])&&Ne(!0,t[1])}var Rt=/\/|:/,xt=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}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(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function Ce(e){let t=0,o=e.length,s=0,i;while(s<o)if(t++,i=e.charCodeAt(s++),i>=55296&&i<=56319&&s<o){if(i=e.charCodeAt(s),(i&64512)==56320)s++}return t}function S(e,t,o="2019-09",s=F(t),i=!0,d=null,n="#",f="#",I=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:n,keyword:"false",keywordLocation:n,error:"False boolean schema."}]};let q=typeof e,T;switch(q){case"boolean":case"number":case"string":T=q;break;case"object":if(e===null)T="null";else if(Array.isArray(e))T="array";else T="object";break;default:throw Error(`Instances of "${q}" type are not supported.`)}let{$ref:B,$recursiveRef:re,$recursiveAnchor:W,type:N,const:V,enum:E,required:p,not:y,anyOf:R,allOf:v,oneOf:k,if:r,then:x,else:m,format:_,properties:M,patternProperties:H,additionalProperties:P,unevaluatedProperties:G,minProperties:j,maxProperties:A,propertyNames:J,dependentRequired:ie,dependentSchemas:de,dependencies:we,prefixItems:be,items:ae,additionalItems:_e,unevaluatedItems:Te,contains:Se,minContains:Y,maxContains:le,minItems:ke,maxItems:Re,uniqueItems:Xe,minimum:X,maximum:Q,exclusiveMinimum:ue,exclusiveMaximum:fe,multipleOf:pe,minLength:ce,maxLength:me,pattern:Oe,__absolute_ref__:ye,__absolute_recursive_ref__:Qe}=t,u=[];if(W===!0&&d===null)d=t;if(re==="#"){let g=d===null?s[Qe]:d,c=`${f}/$recursiveRef`,b=S(e,d===null?t:d,o,s,i,g,n,c,I);if(!b.valid)u.push({instanceLocation:n,keyword:"$recursiveRef",keywordLocation:c,error:"A subschema had errors."},...b.errors)}if(B!==void 0){let c=s[ye||B];if(c===void 0){let a=`Unresolved $ref "${B}".`;if(ye&&ye!==B)a+=` Absolute URI "${ye}".`;throw a+=`
|
|
2
|
-
Known schemas:
|
|
3
|
-
- ${Object.keys(s).join(`
|
|
4
|
-
- `)}`,Error(a)}let b=`${f}/$ref`,l=S(e,c,o,s,i,d,n,b,I);if(!l.valid)u.push({instanceLocation:n,keyword:"$ref",keywordLocation:b,error:"A subschema had errors."},...l.errors);if(o==="4"||o==="7")return{valid:u.length===0,errors:u}}if(Array.isArray(N)){let g=N.length,c=!1;for(let b=0;b<g;b++)if(T===N[b]||N[b]==="integer"&&T==="number"&&e%1===0&&e===e){c=!0;break}if(!c)u.push({instanceLocation:n,keyword:"type",keywordLocation:`${f}/type`,error:`Instance type "${T}" is invalid. Expected "${N.join('", "')}".`})}else if(N==="integer"){if(T!=="number"||e%1||e!==e)u.push({instanceLocation:n,keyword:"type",keywordLocation:`${f}/type`,error:`Instance type "${T}" is invalid. Expected "${N}".`})}else if(N!==void 0&&T!==N)u.push({instanceLocation:n,keyword:"type",keywordLocation:`${f}/type`,error:`Instance type "${T}" is invalid. Expected "${N}".`});if(V!==void 0){if(T==="object"||T==="array"){if(!ne(e,V))u.push({instanceLocation:n,keyword:"const",keywordLocation:`${f}/const`,error:`Instance does not match ${JSON.stringify(V)}.`})}else if(e!==V)u.push({instanceLocation:n,keyword:"const",keywordLocation:`${f}/const`,error:`Instance does not match ${JSON.stringify(V)}.`})}if(E!==void 0){if(T==="object"||T==="array"){if(!E.some((g)=>ne(e,g)))u.push({instanceLocation:n,keyword:"enum",keywordLocation:`${f}/enum`,error:`Instance does not match any of ${JSON.stringify(E)}.`})}else if(!E.some((g)=>e===g))u.push({instanceLocation:n,keyword:"enum",keywordLocation:`${f}/enum`,error:`Instance does not match any of ${JSON.stringify(E)}.`})}if(y!==void 0){let g=`${f}/not`;if(S(e,y,o,s,i,d,n,g).valid)u.push({instanceLocation:n,keyword:"not",keywordLocation:g,error:'Instance matched "not" schema.'})}let ge=[];if(R!==void 0){let g=`${f}/anyOf`,c=u.length,b=!1;for(let l=0;l<R.length;l++){let a=R[l],w=Object.create(I),h=S(e,a,o,s,i,W===!0?d:null,n,`${g}/${l}`,w);if(u.push(...h.errors),b=b||h.valid,h.valid)ge.push(w)}if(b)u.length=c;else u.splice(c,0,{instanceLocation:n,keyword:"anyOf",keywordLocation:g,error:"Instance does not match any subschemas."})}if(v!==void 0){let g=`${f}/allOf`,c=u.length,b=!0;for(let l=0;l<v.length;l++){let a=v[l],w=Object.create(I),h=S(e,a,o,s,i,W===!0?d:null,n,`${g}/${l}`,w);if(u.push(...h.errors),b=b&&h.valid,h.valid)ge.push(w)}if(b)u.length=c;else u.splice(c,0,{instanceLocation:n,keyword:"allOf",keywordLocation:g,error:"Instance does not match every subschema."})}if(k!==void 0){let g=`${f}/oneOf`,c=u.length,b=k.filter((l,a)=>{let w=Object.create(I),h=S(e,l,o,s,i,W===!0?d:null,n,`${g}/${a}`,w);if(u.push(...h.errors),h.valid)ge.push(w);return h.valid}).length;if(b===1)u.length=c;else u.splice(c,0,{instanceLocation:n,keyword:"oneOf",keywordLocation:g,error:`Instance does not match exactly one subschema (${b} matches).`})}if(T==="object"||T==="array")Object.assign(I,...ge);if(r!==void 0){let g=`${f}/if`;if(S(e,r,o,s,i,d,n,g,I).valid){if(x!==void 0){let b=S(e,x,o,s,i,d,n,`${f}/then`,I);if(!b.valid)u.push({instanceLocation:n,keyword:"if",keywordLocation:g,error:'Instance does not match "then" schema.'},...b.errors)}}else if(m!==void 0){let b=S(e,m,o,s,i,d,n,`${f}/else`,I);if(!b.valid)u.push({instanceLocation:n,keyword:"if",keywordLocation:g,error:'Instance does not match "else" schema.'},...b.errors)}}if(T==="object"){if(p!==void 0){for(let l of p)if(!(l in e))u.push({instanceLocation:n,keyword:"required",keywordLocation:`${f}/required`,error:`Instance does not have required property "${l}".`})}let g=Object.keys(e);if(j!==void 0&&g.length<j)u.push({instanceLocation:n,keyword:"minProperties",keywordLocation:`${f}/minProperties`,error:`Instance does not have at least ${j} properties.`});if(A!==void 0&&g.length>A)u.push({instanceLocation:n,keyword:"maxProperties",keywordLocation:`${f}/maxProperties`,error:`Instance does not have at least ${A} properties.`});if(J!==void 0){let l=`${f}/propertyNames`;for(let a in e){let w=`${n}/${U(a)}`,h=S(a,J,o,s,i,d,w,l);if(!h.valid)u.push({instanceLocation:n,keyword:"propertyNames",keywordLocation:l,error:`Property name "${a}" does not match schema.`},...h.errors)}}if(ie!==void 0){let l=`${f}/dependantRequired`;for(let a in ie)if(a in e){let w=ie[a];for(let h of w)if(!(h in e))u.push({instanceLocation:n,keyword:"dependentRequired",keywordLocation:l,error:`Instance has "${a}" but does not have "${h}".`})}}if(de!==void 0)for(let l in de){let a=`${f}/dependentSchemas`;if(l in e){let w=S(e,de[l],o,s,i,d,n,`${a}/${U(l)}`,I);if(!w.valid)u.push({instanceLocation:n,keyword:"dependentSchemas",keywordLocation:a,error:`Instance has "${l}" but does not match dependant schema.`},...w.errors)}}if(we!==void 0){let l=`${f}/dependencies`;for(let a in we)if(a in e){let w=we[a];if(Array.isArray(w)){for(let h of w)if(!(h in e))u.push({instanceLocation:n,keyword:"dependencies",keywordLocation:l,error:`Instance has "${a}" but does not have "${h}".`})}else{let h=S(e,w,o,s,i,d,n,`${l}/${U(a)}`);if(!h.valid)u.push({instanceLocation:n,keyword:"dependencies",keywordLocation:l,error:`Instance has "${a}" but does not match dependant schema.`},...h.errors)}}}let c=Object.create(null),b=!1;if(M!==void 0){let l=`${f}/properties`;for(let a in M){if(!(a in e))continue;let w=`${n}/${U(a)}`,h=S(e[a],M[a],o,s,i,d,w,`${l}/${U(a)}`);if(h.valid)I[a]=c[a]=!0;else if(b=i,u.push({instanceLocation:n,keyword:"properties",keywordLocation:l,error:`Property "${a}" does not match schema.`},...h.errors),b)break}}if(!b&&H!==void 0){let l=`${f}/patternProperties`;for(let a in H){let w=new RegExp(a,"u"),h=H[a];for(let z in e){if(!w.test(z))continue;let Ee=`${n}/${U(z)}`,Pe=S(e[z],h,o,s,i,d,Ee,`${l}/${U(a)}`);if(Pe.valid)I[z]=c[z]=!0;else b=i,u.push({instanceLocation:n,keyword:"patternProperties",keywordLocation:l,error:`Property "${z}" matches pattern "${a}" but does not match associated schema.`},...Pe.errors)}}}if(!b&&P!==void 0){let l=`${f}/additionalProperties`;for(let a in e){if(c[a])continue;let w=`${n}/${U(a)}`,h=S(e[a],P,o,s,i,d,w,l);if(h.valid)I[a]=!0;else b=i,u.push({instanceLocation:n,keyword:"additionalProperties",keywordLocation:l,error:`Property "${a}" does not match additional properties schema.`},...h.errors)}}else if(!b&&G!==void 0){let l=`${f}/unevaluatedProperties`;for(let a in e)if(!I[a]){let w=`${n}/${U(a)}`,h=S(e[a],G,o,s,i,d,w,l);if(h.valid)I[a]=!0;else u.push({instanceLocation:n,keyword:"unevaluatedProperties",keywordLocation:l,error:`Property "${a}" does not match unevaluated properties schema.`},...h.errors)}}}else if(T==="array"){if(Re!==void 0&&e.length>Re)u.push({instanceLocation:n,keyword:"maxItems",keywordLocation:`${f}/maxItems`,error:`Array has too many items (${e.length} > ${Re}).`});if(ke!==void 0&&e.length<ke)u.push({instanceLocation:n,keyword:"minItems",keywordLocation:`${f}/minItems`,error:`Array has too few items (${e.length} < ${ke}).`});let g=e.length,c=0,b=!1;if(be!==void 0){let l=`${f}/prefixItems`,a=Math.min(be.length,g);for(;c<a;c++){let w=S(e[c],be[c],o,s,i,d,`${n}/${c}`,`${l}/${c}`);if(I[c]=!0,!w.valid){if(b=i,u.push({instanceLocation:n,keyword:"prefixItems",keywordLocation:l,error:"Items did not match schema."},...w.errors),b)break}}}if(ae!==void 0){let l=`${f}/items`;if(Array.isArray(ae)){let a=Math.min(ae.length,g);for(;c<a;c++){let w=S(e[c],ae[c],o,s,i,d,`${n}/${c}`,`${l}/${c}`);if(I[c]=!0,!w.valid){if(b=i,u.push({instanceLocation:n,keyword:"items",keywordLocation:l,error:"Items did not match schema."},...w.errors),b)break}}}else for(;c<g;c++){let a=S(e[c],ae,o,s,i,d,`${n}/${c}`,l);if(I[c]=!0,!a.valid){if(b=i,u.push({instanceLocation:n,keyword:"items",keywordLocation:l,error:"Items did not match schema."},...a.errors),b)break}}if(!b&&_e!==void 0){let a=`${f}/additionalItems`;for(;c<g;c++){let w=S(e[c],_e,o,s,i,d,`${n}/${c}`,a);if(I[c]=!0,!w.valid)b=i,u.push({instanceLocation:n,keyword:"additionalItems",keywordLocation:a,error:"Items did not match additional items schema."},...w.errors)}}}if(Se!==void 0)if(g===0&&Y===void 0)u.push({instanceLocation:n,keyword:"contains",keywordLocation:`${f}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Y!==void 0&&g<Y)u.push({instanceLocation:n,keyword:"minContains",keywordLocation:`${f}/minContains`,error:`Array has less items (${g}) than minContains (${Y}).`});else{let l=`${f}/contains`,a=u.length,w=0;for(let h=0;h<g;h++){let z=S(e[h],Se,o,s,i,d,`${n}/${h}`,l);if(z.valid)I[h]=!0,w++;else u.push(...z.errors)}if(w>=(Y||0))u.length=a;if(Y===void 0&&le===void 0&&w===0)u.splice(a,0,{instanceLocation:n,keyword:"contains",keywordLocation:l,error:"Array does not contain item matching schema."});else if(Y!==void 0&&w<Y)u.push({instanceLocation:n,keyword:"minContains",keywordLocation:`${f}/minContains`,error:`Array must contain at least ${Y} items matching schema. Only ${w} items were found.`});else if(le!==void 0&&w>le)u.push({instanceLocation:n,keyword:"maxContains",keywordLocation:`${f}/maxContains`,error:`Array may contain at most ${le} items matching schema. ${w} items were found.`})}if(!b&&Te!==void 0){let l=`${f}/unevaluatedItems`;for(c;c<g;c++){if(I[c])continue;let a=S(e[c],Te,o,s,i,d,`${n}/${c}`,l);if(I[c]=!0,!a.valid)u.push({instanceLocation:n,keyword:"unevaluatedItems",keywordLocation:l,error:"Items did not match unevaluated items schema."},...a.errors)}}if(Xe)for(let l=0;l<g;l++){let a=e[l],w=typeof a==="object"&&a!==null;for(let h=0;h<g;h++){if(l===h)continue;let z=e[h];if(a===z||w&&(typeof z==="object"&&z!==null)&&ne(a,z))u.push({instanceLocation:n,keyword:"uniqueItems",keywordLocation:`${f}/uniqueItems`,error:`Duplicate items at indexes ${l} and ${h}.`}),l=Number.MAX_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER}}}else if(T==="number"){if(o==="4"){if(X!==void 0&&(ue===!0&&e<=X||e<X))u.push({instanceLocation:n,keyword:"minimum",keywordLocation:`${f}/minimum`,error:`${e} is less than ${ue?"or equal to ":""} ${X}.`});if(Q!==void 0&&(fe===!0&&e>=Q||e>Q))u.push({instanceLocation:n,keyword:"maximum",keywordLocation:`${f}/maximum`,error:`${e} is greater than ${fe?"or equal to ":""} ${Q}.`})}else{if(X!==void 0&&e<X)u.push({instanceLocation:n,keyword:"minimum",keywordLocation:`${f}/minimum`,error:`${e} is less than ${X}.`});if(Q!==void 0&&e>Q)u.push({instanceLocation:n,keyword:"maximum",keywordLocation:`${f}/maximum`,error:`${e} is greater than ${Q}.`});if(ue!==void 0&&e<=ue)u.push({instanceLocation:n,keyword:"exclusiveMinimum",keywordLocation:`${f}/exclusiveMinimum`,error:`${e} is less than ${ue}.`});if(fe!==void 0&&e>=fe)u.push({instanceLocation:n,keyword:"exclusiveMaximum",keywordLocation:`${f}/exclusiveMaximum`,error:`${e} is greater than or equal to ${fe}.`})}if(pe!==void 0){let g=e%pe;if(Math.abs(0-g)>=0.00000011920929&&Math.abs(pe-g)>=0.00000011920929)u.push({instanceLocation:n,keyword:"multipleOf",keywordLocation:`${f}/multipleOf`,error:`${e} is not a multiple of ${pe}.`})}}else if(T==="string"){let g=ce===void 0&&me===void 0?0:Ce(e);if(ce!==void 0&&g<ce)u.push({instanceLocation:n,keyword:"minLength",keywordLocation:`${f}/minLength`,error:`String is too short (${g} < ${ce}).`});if(me!==void 0&&g>me)u.push({instanceLocation:n,keyword:"maxLength",keywordLocation:`${f}/maxLength`,error:`String is too long (${g} > ${me}).`});if(Oe!==void 0&&!new RegExp(Oe,"u").test(e))u.push({instanceLocation:n,keyword:"pattern",keywordLocation:`${f}/pattern`,error:"String does not match pattern."});if(_!==void 0&&xe[_]&&!xe[_](e))u.push({instanceLocation:n,keyword:"format",keywordLocation:`${f}/format`,error:`String does not match format "${_}".`})}return{valid:u.length===0,errors:u}}class Ie{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",o=!0){this.schema=e,this.draft=t,this.shortCircuit=o,this.lookup=F(e)}validate(e){return S(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};F(e,this.lookup)}}var je="ch.ractive.tab-mcp/annotations",_t=["readOnlyHint","untrustedContentHint","consequentialHint","debugging"],Tt=["destructiveHint","idempotentHint","openWorldHint"];function ze(e){let t={};if(e.readOnlyHint===!0)t.readOnlyHint=!0,t.destructiveHint=!1;else if(e.readOnlyHint===!1)t.readOnlyHint=!1;if(e.consequentialHint===!0)t.destructiveHint=!0;if(e.untrustedContentHint===!0)t.openWorldHint=!0;for(let i of Tt){let d=e[i];if(d!==void 0)t[i]=d}let o={};for(let i of _t){let d=e[i];if(d!==void 0)o[i]=d}let s={};if(Object.keys(t).length>0)s.annotations=t;if(Object.keys(o).length>0)s.meta=o;return s}function L(e){return{content:[{type:"text",text:e}],isError:!0}}function qe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function He(e){if(typeof e==="string")return{content:[{type:"text",text:e}]};if(e===void 0)return{content:[]};if(qe(e)&&Array.isArray(e.content))return e;let t;try{t=JSON.stringify(e)}catch{}if(t===void 0)return L("The tool returned a value that is not JSON.");let o={content:[{type:"text",text:t}]};if(qe(e))o.structuredContent=e;return o}function Je(e){let t=e instanceof Error?e.message:String(e);return L(t||"The tool failed.")}var ee="2026-07-28",Z="io.modelcontextprotocol/protocolVersion",he="io.modelcontextprotocol/clientCapabilities",Ue="io.modelcontextprotocol/clientInfo",St="io.modelcontextprotocol/serverInfo",ve="io.modelcontextprotocol/subscriptionId",Ot=-32020,Ve=-32022,Et=new TextEncoder;function te(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Me(e,t){return new Response(JSON.stringify(t),{status:e,headers:{"content-type":"application/json"}})}function C(e,t,o,s,i){let d={code:o,message:s};if(i!==void 0)d.data=i;return Me(e,{jsonrpc:"2.0",id:t,error:d})}function K(e,t,o){return C(400,e,Ot,`Bad Request: the request headers and body disagree: ${o}`,{mismatch:{header:t,body:o}})}function oe(e){return Et.encode(`event: message
|
|
5
|
-
data: ${JSON.stringify(e)}
|
|
6
|
-
|
|
7
|
-
`)}var Be={"content-type":"text/event-stream","cache-control":"no-cache"};function Pt(e){return(e??"").split(";")[0]?.trim().toLowerCase()==="application/json"}function At(e){if(!(e.startsWith("=?base64?")&&e.endsWith("?=")))return e;let t=e.slice(9,-2);if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t))return;try{let o=atob(t),s=Uint8Array.from(o,(i)=>i.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!0}).decode(s)}catch{return}}function Nt(e){if(!(Z in e))return{key:Z,problem:"missing"};if(!(he in e))return{key:he,problem:"missing"};if(typeof e[Z]!=="string")return{key:Z,problem:"expected a protocol version string"};if(!te(e[he]))return{key:he,problem:"expected an object"};let t=e[Ue];if(t!==void 0&&!(te(t)&&typeof t.name==="string"&&typeof t.version==="string"))return{key:Ue,problem:"expected {name, version}"};return}function Ct(e){let t=e.notifications;return te(t)&&t.toolsListChanged===!0?{toolsListChanged:!0}:{}}function Ge(e){let{tools:t,server:o}=e,s={name:o.name,version:o.version};if(o.title!==void 0)s.title=o.title;let i=new WeakMap,d=new Set,n=!1,f=(p={})=>({...p,[St]:s});function I(p,y){return{jsonrpc:"2.0",id:p,result:{...y,resultType:"complete",_meta:f()}}}function q(p,y){let R=i.get(p);if(R===void 0)R=new Ie(p.inputSchema,"2020-12",!1),i.set(p,R);let v=R.validate(y);if(v.valid)return;let k=v.errors.filter((r)=>r.keyword!=="properties"&&r.keyword!=="$ref").map((r)=>`${r.instanceLocation} ${r.error}`).slice(0,5).join("; ");return`Input validation error: Invalid arguments for tool ${p.name}: ${k||"the arguments do not match the schema"}`}function T(){return t.list().map((p)=>{let y={name:p.name};if(p.title!==void 0)y.title=p.title;y.description=p.description,y.inputSchema=p.inputSchema;let{annotations:R,meta:v}=ze(p.annotations);if(R!==void 0)y.annotations=R;if(v!==void 0)y._meta={[je]:v};return y})}async function B(p,y,R){let v=p.name;if(typeof v!=="string")return{invalid:"Invalid params: name must be a string"};let k=t.get(v);if(k===void 0)return{invalid:`Tool ${v} not found`};let r=p.arguments??{};if(!te(r))return{invalid:"Invalid params: arguments must be an object"};let x=q(k,r);if(x!==void 0)return L(x);let m=e.client(R);if(k.annotations.consequentialHint===!0){let _={tool:{name:k.name,description:k.description},arguments:r,client:m,signal:y};if(k.title!==void 0)_.tool.title=k.title;let M=!1;try{M=await e.confirm(_)}catch{M=!1}if(!M)return L("The user declined")}if(y.aborted)return L("Cancelled");try{return He(await k.execute(r,{signal:y,client:m}))}catch(_){return Je(_)}}function re(p,y,R,v){let k=new ReadableStream({start:(r)=>{let x=(m)=>{if(R.aborted)return;let _;try{_=oe(m)}catch{_=oe(I(p,L("The tool returned a result that is not JSON.")))}try{r.enqueue(_),r.close()}catch{}};B(y,R,v).then((m)=>x(typeof m.invalid==="string"?{jsonrpc:"2.0",id:p,error:{code:-32602,message:m.invalid}}:I(p,m)),()=>x({jsonrpc:"2.0",id:p,error:{code:-32603,message:"Internal error"}}))}});return new Response(k,{status:200,headers:Be})}function W(p,y,R){let v=Ct(y),k={jsonrpc:"2.0",id:p,result:{resultType:"complete",_meta:f({[ve]:p})}},r,x=new ReadableStream({start:(m)=>{if(m.enqueue(oe({jsonrpc:"2.0",method:"notifications/subscriptions/acknowledged",params:{notifications:v,_meta:{[ve]:p}}})),Object.keys(v).length===0){m.enqueue(oe(k)),m.close();return}let _={id:p,send:(M)=>{try{m.enqueue(oe(M))}catch{d.delete(_)}},end:()=>{d.delete(_);try{m.enqueue(oe(k)),m.close()}catch{}}};r=_,d.add(_),R.addEventListener("abort",()=>{d.delete(_);try{m.close()}catch{}})},cancel:()=>{if(r!==void 0)d.delete(r)}});return new Response(x,{status:200,headers:Be})}function N(p,y){if(Array.isArray(y))return C(400,null,-32600,"Bad Request: JSON-RPC batches are not supported by this endpoint");if(!te(y)||y.jsonrpc!=="2.0")return C(400,null,-32600,"Bad Request: the request body is not a valid JSON-RPC message");let{method:R,id:v}=y;if(typeof R!=="string")return"result"in y||"error"in y?C(400,null,-32600,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"):C(400,null,-32600,"Bad Request: the request body is not a valid JSON-RPC message");let k=p.headers.get("mcp-protocol-version"),r=p.headers.get("mcp-method"),x=te(y.params)?y.params:{},m=te(x._meta)?x._meta:void 0,_=m!==void 0&&Z in m,M=typeof m?.[Z]==="string"?m[Z]:void 0,H=k!==null&&k>=ee;if(v===void 0){if(M!==void 0&&k!==null&&k!==M)return K(null,k,`the notification envelope names protocol version ${M} but the MCP-Protocol-Version header names ${k}`);if((_||H)&&r!==null&&r!==R)return K(null,r,`the notification body names method ${R} but the Mcp-Method header names ${r}`);return"notification"}if(typeof v!=="string"&&typeof v!=="number")return C(400,null,-32600,"Bad Request: the request body is not a valid JSON-RPC message");let P=v;if(!_||R==="initialize"&&(M===void 0||M<ee)){if(R==="initialize"){if(H)return K(P,k,"an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header");let j=typeof x.protocolVersion==="string"?x.protocolVersion:void 0;return V(P,j)}if(H){let j=m===void 0?["_meta"]:[Z];return C(400,P,-32602,`Invalid params: the MCP-Protocol-Version header names protocol revision ${k}, but the request is missing the required per-request envelope key(s): ${j.join(", ")}`,{envelope:{missing:j}})}return V(P,k??void 0)}let G=Nt(m);if(G!==void 0)return C(400,P,-32602,`Invalid _meta envelope for protocol revision ${ee}: ${G.key}: ${G.problem}`,{envelope:G});if(k!==null&&M!==void 0&&k!==M)return K(P,k,`the body envelope names protocol version ${M} but the MCP-Protocol-Version header names ${k}`);if(r!==null&&r!==R)return K(P,r,`the body names method ${R} but the Mcp-Method header names ${r}`);if(M!==ee)return V(P,M);if(k===null)return K(P,"(missing)",`the body envelope names protocol version ${M} but the required MCP-Protocol-Version header is absent`);if(r===null)return K(P,"(missing)",`the body names method ${R} but the required Mcp-Method header is absent`);if(R==="tools/call"&&typeof x.name==="string"){let j=x.name,A=p.headers.get("mcp-name");if(A===null)return K(P,"(missing)",`the body carries params.name="${j}" but the required Mcp-Name header is absent`);let J=At(A);if(J===void 0)return K(P,A,"the Mcp-Name header carries an invalid Base64 sentinel value");if(J!==j)return K(P,A,`the body carries params.name="${j}" but the Mcp-Name header names "${J}"`)}return{id:P,method:R,params:x}}function V(p,y){return y===void 0?C(400,p,Ve,"Unsupported protocol version: the request did not name a protocol version",{supported:[ee]}):C(400,p,Ve,`Unsupported protocol version: ${y}`,{supported:[ee],requested:y})}async function E(p,y){if(p.method.toUpperCase()!=="POST")return C(405,null,-32000,"Method not allowed.");if(!Pt(p.headers.get("content-type")))return C(415,null,-32000,"Unsupported Media Type: Content-Type must be application/json");let R;try{R=JSON.parse(y.body??await p.text())}catch{return C(400,null,-32700,"Parse error: the request body is not valid JSON")}let v=N(p,R);if(v instanceof Response)return v;if(v==="notification")return new Response(null,{status:202});let{id:k,method:r,params:x}=v;switch(r){case"server/discover":{let m={supportedVersions:[ee],capabilities:{tools:{listChanged:!0}}};if(o.instructions!==void 0)m.instructions=o.instructions;return m.ttlMs=0,m.cacheScope="private",Me(200,I(k,m))}case"tools/list":return Me(200,I(k,{tools:T(),ttlMs:0,cacheScope:"private"}));case"tools/call":return re(k,x,p.signal,y.grant);case"subscriptions/listen":return W(k,x,p.signal);default:return C(404,k,-32601,"Method not found")}}return{handle:(p,y)=>E(p,y).catch(()=>C(500,null,-32603,"Internal server error")),toolsChanged(){if(n)return;n=!0,queueMicrotask(()=>{n=!1;for(let p of[...d])p.send({jsonrpc:"2.0",method:"notifications/tools/list_changed",params:{_meta:{[ve]:p.id}}})})},close(){for(let p of[...d])p.end()}}}var $e="tab-mcp.v1";function se(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var O=(e)=>typeof e==="string";function De(e){if(!se(e)||!O(e.grantId)||!O(e.createdAt))return!1;let t=e.client;return se(t)&&O(t.id)&&O(t.name)&&O(t.host)}function qt(e){if(!se(e))return!1;return["maxMessageBytes","maxBodyBytes","requestTimeoutMs","idleTimeoutMs","heartbeatMs","keepAliveMs","maxConcurrentRequests"].every((t)=>typeof e[t]==="number")}function jt(e){return se(e)&&Object.values(e).every(O)}function Ke(e){let t;try{t=JSON.parse(e)}catch{return}if(!se(t))return;switch(t.type){case"session":return O(t.sessionId)&&O(t.address)&&O(t.origin)&&O(t.expiresAt)&&qt(t.limits)&&Array.isArray(t.grants)&&t.grants.every(De)&&(t.appName===void 0||O(t.appName))?t:void 0;case"ping":return typeof t.t==="number"?t:void 0;case"bye":return{type:"bye",reason:O(t.reason)?t.reason:""};case"http.request":return O(t.id)&&O(t.method)&&O(t.path)&&jt(t.headers)&&O(t.body)&&se(t.grant)&&O(t.grant.grantId)&&O(t.grant.clientId)?t:void 0;case"http.cancel":return O(t.id)?t:void 0;case"pairing.code":return O(t.code)&&O(t.expiresAt)?t:void 0;case"grant.added":return De(t.grant)?t:void 0;case"grant.removed":return O(t.grantId)?{type:"grant.removed",grantId:t.grantId,reason:O(t.reason)?t.reason:""}:void 0;case"error":return O(t.code)?t:void 0;default:return}}var zt=15000,Ht={1000:"closed",1008:"policy",1009:"too_large",4001:"expired",4002:"idle",4003:"heartbeat",4004:"shutdown",4005:"replaced",4008:"rate_limited"},Jt={replaced:"replaced",expired:"expired",idle:"idle",shutdown:"shutdown"},Ut=["content-type","cache-control"];function Vt(){let e=globalThis.document?.title;return typeof e==="string"?e.slice(0,300):""}function Bt(e){try{let t=JSON.parse(e);if(typeof t!=="object"||t===null||typeof t.type!=="string")return;return typeof t.id==="string"?{type:t.type,id:t.id}:{type:t.type}}catch{return}}var Gt=new Set(["session","ping","bye","http.request","http.cancel","pairing.code","grant.added","grant.removed","error"]),Ye=512,Fe=6,Ze=64,Dt=Ye+Fe*Ze;function Kt(e){let t=Math.floor((e-Ye)/Fe);return t>=Ze?t:void 0}function*We(e,t){let o=0;while(o<e.length){let s=Math.min(o+t,e.length),i=e.charCodeAt(s-1);if(s<e.length&&i>=55296&&i<=56319)s+=s-1>o?-1:1;yield e.slice(o,s),o=s}}function yr(e,t,o){let s=new WebSocket(t,$e),i=new Map,d="opening",n,f=65536,I,q=0,T,B,re=new Promise((r,x)=>{T=r,B=x});re.catch(()=>{});let W=setTimeout(()=>{y(Error("The relay did not answer in time."))},zt),N=Ge({tools:e.registry,server:e.server,confirm:(r)=>e.confirm(r),client:(r)=>e.clientFor(r)}),V=e.registry.onChange(()=>N.toolsChanged());function E(r){if(s.readyState!==WebSocket.OPEN)return!1;try{return s.send(JSON.stringify(r)),!0}catch{return!1}}function p(){if(q<=0)return;clearTimeout(I),I=setTimeout(()=>{n??="heartbeat",R(4003);try{s.close()}catch{}},q*2.5)}function y(r){if(d!=="opening")return;R(0),B(r);try{s.close()}catch{}}function R(r){if(d==="closed")return;let x=d==="ready";d="closed",clearTimeout(W),clearTimeout(I),V();for(let m of i.values())m.abort();if(i.clear(),N.close(),x){let m=n??Ht[r]??(r===1006?"network":"closed");e.closed(m,r)}}async function v(r){let x=new AbortController;i.set(r.id,x);let m=()=>d==="ready"&&i.get(r.id)===x&&!x.signal.aborted;try{let _=new Request(`https://tab.invalid${r.path}`,{method:r.method,headers:r.headers,signal:x.signal}),M=await N.handle(_,{grant:r.grant,body:r.body});if(!m()){await M.body?.cancel().catch(()=>{});return}let H={};for(let A of Ut){let J=M.headers.get(A);if(J!==null)H[A]=J}if(!(H["content-type"]??"").startsWith("text/event-stream")||M.body===null){let A=await M.text();if(!m())return;if(A.length<=f){E({type:"http.response",id:r.id,status:M.status,headers:H,body:A});return}E({type:"http.response.start",id:r.id,status:M.status,headers:H});for(let J of We(A,f)){if(!m())break;E({type:"http.response.chunk",id:r.id,data:J})}if(m())E({type:"http.response.end",id:r.id});return}E({type:"http.response.start",id:r.id,status:M.status,headers:H});let G=M.body.getReader(),j=new TextDecoder;x.signal.addEventListener("abort",()=>{G.cancel().catch(()=>{})});for(;;){let{done:A,value:J}=await G.read();if(A||!m())break;let ie=j.decode(J,{stream:!0});for(let de of We(ie,f))E({type:"http.response.chunk",id:r.id,data:de})}if(m())E({type:"http.response.end",id:r.id})}catch(_){if(m())e.error(_ instanceof Error?_:Error(String(_))),E({type:"http.response",id:r.id,status:500,headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32603,message:"Internal server error"}})})}finally{if(i.get(r.id)===x)i.delete(r.id)}}function k(r){if(d==="opening"){if(r.type==="session"){let x=Kt(r.limits.maxMessageBytes);if(x===void 0){y(Error(`The relay's message limit (${r.limits.maxMessageBytes} bytes) is too small; tab-mcp needs at least ${Dt}.`));return}f=x,d="ready",clearTimeout(W),q=r.limits.heartbeatMs,p(),T(e.sessionStarted(r))}else if(r.type==="error")y(Error(`The relay refused the connection: ${r.message||r.code}`));else if(r.type==="bye")y(Error(`The relay ended the connection: ${r.reason}`));return}if(d!=="ready")return;switch(r.type){case"ping":p(),E({type:"pong",t:r.t});return;case"http.request":v(r);return;case"http.cancel":i.get(r.id)?.abort(),i.delete(r.id);return;case"pairing.code":e.pairingCode({code:r.code,expiresAt:r.expiresAt});return;case"grant.added":e.grantAdded(r.grant);return;case"grant.removed":e.grantRemoved(r.grantId);return;case"bye":if(n=Jt[r.reason]??"closed",n==="replaced")e.replaced();return;case"error":e.error(Error(`Relay error ${r.code}: ${r.message}`));return;case"session":return}}return s.addEventListener("open",()=>{if(s.protocol!==""&&s.protocol!==$e){y(Error(`The relay speaks ${s.protocol}, not ${$e}.`));return}let r={type:"hello",library:e.library,page:{title:Vt()},secret:o};if(e.appName!==void 0)r.app={name:e.appName};E(r)}),s.addEventListener("message",(r)=>{if(typeof r.data!=="string")return;let x=Ke(r.data);if(x!==void 0){if(d==="ready")p();k(x);return}let m=Bt(r.data);if(m?.id!==void 0)E(Gt.has(m.type)?{type:"error",code:"bad_message",message:`malformed ${m.type}`,id:m.id}:{type:"error",code:"unknown_type",message:`unknown type ${m.type}`,id:m.id})}),s.addEventListener("close",(r)=>{if(d==="opening"){R(r.code),B(Error(r.code===1006?"Could not connect to the relay (refused, unreachable, or this page's origin is not allowed).":`The relay closed the connection (${r.code}${r.reason?`: ${r.reason}`:""}).`));return}R(r.code)}),{ready:re,send:E,close(r){if(d==="closed")return;if(d==="opening"){y(new DOMException("The connection was cancelled","AbortError"));return}n=r,E({type:"bye",reason:"user"}),R(1000);try{s.close(1000,"bye")}catch{}}}}export{yr as openConnection};
|
|
8
|
-
|
|
9
|
-
//# debugId=F3A0C8E8F3BFC76E64756E2164756E21
|
|
10
|
-
//# sourceMappingURL=connection-cfq1n4kh.min.js.map
|
package/cdn/ui-aac2cw9f.min.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var A=0;function n(e,o,t={},...i){let r=e.createElement(o);if(t.className!==void 0)r.className=t.className;if(t.id!==void 0)r.id=t.id;if(t.text!==void 0)r.textContent=t.text;return r.append(...i),r}function h(e,o,t){let i=n(e,"button",{text:o});return i.type="button",i.addEventListener("click",t),i}function D(e,o,t){let i=`tab-mcp-${++A}`,r=n(e,"dialog",{className:`tab-mcp-dialog ${o}`});r.setAttribute("aria-labelledby",`${i}-title`);let a=r.style;a.setProperty("max-width","var(--tab-mcp-max-width, 34rem)"),a.setProperty("font","var(--tab-mcp-font, inherit)"),a.setProperty("color","var(--tab-mcp-color, CanvasText)"),a.setProperty("background","var(--tab-mcp-background, Canvas)"),a.setProperty("border","var(--tab-mcp-border, 1px solid GrayText)"),a.setProperty("border-radius","var(--tab-mcp-radius, 0.5rem)"),a.setProperty("padding","var(--tab-mcp-padding, 1rem 1.25rem)");let l=n(e,"h2",{id:`${i}-title`,text:t});return l.style.setProperty("margin-top","0"),l.style.setProperty("font-size","var(--tab-mcp-title-size, 1.25em)"),r.append(l),{dialog:r,heading:l}}function M(e){let o=e.host||e.id;return e.name!==void 0&&e.name!==""?`${e.name} (${o})`:o}function k(e){try{return JSON.stringify(e,null,2)}catch{return}}var R=750,H=500;function G(e,o,t={}){let i=Math.max(H,t.allowDelayMs??R);if(e.signal.aborted)return Promise.resolve(!1);let r=e.tool.title??e.tool.name,{dialog:a}=D(o,"tab-mcp-confirm",`Allow ${r}?`),l=h(o,"Don't allow",()=>a.close("deny")),d=h(o,"Allow",()=>{if(!d.disabled)a.close("allow")});d.disabled=!0;let y=n(o,"div",{className:"tab-mcp-actions"},l," ",d),m=k(e.arguments),c=n(o,"pre",{className:"tab-mcp-arguments",text:m??"The arguments cannot be shown, so this call cannot be allowed."});if(m===void 0)d.hidden=!0;return c.style.setProperty("white-space","pre-wrap"),c.style.setProperty("max-height","12rem"),c.style.setProperty("overflow","auto"),c.hidden=Object.keys(e.arguments).length===0,a.append(n(o,"p",{text:`${M(e.client)} wants to run ${r}.`}),n(o,"p",{className:"tab-mcp-description",text:e.tool.description}),c,y),o.body.append(a),new Promise((g)=>{let f=()=>a.close("deny");e.signal.addEventListener("abort",f,{once:!0});let u;a.addEventListener("close",()=>{clearTimeout(u),e.signal.removeEventListener("abort",f);let v=a.returnValue==="allow";a.remove(),g(v)},{once:!0}),a.showModal(),l.focus(),u=setTimeout(()=>{d.disabled=!1},i)})}var O=[["Claude (claude.ai and the desktop app)","Settings → Connectors → Add custom connector, then paste the address."],["ChatGPT","Settings → Apps and connectors → Advanced settings: turn on developer mode, then Create and paste the address."],["Claude Code","Run: claude mcp add --transport http tools ADDRESS"]];function _(e,o,t){let{dialog:i}=D(t,"tab-mcp-connect","Connect your AI tool"),r=n(t,"p",{className:"tab-mcp-status",text:"Connecting…"});r.setAttribute("role","status");let a=`tab-mcp-${++A}-address`,l=n(t,"label",{text:"Add this address to your AI tool:"});l.htmlFor=a;let d=n(t,"input",{id:a,className:"tab-mcp-address-input"});d.readOnly=!0,d.style.setProperty("width","100%"),d.style.setProperty("font-family","var(--tab-mcp-mono, monospace)");let y=h(t,"Copy",()=>{let s=()=>{y.textContent="Copied"},p=t.defaultView?.navigator?.clipboard;if(p!==void 0)p.writeText(d.value).then(s,()=>d.select());else d.select()}),m=n(t,"div",{className:"tab-mcp-address"},l,d," ",y),c=n(t,"strong",{className:"tab-mcp-code-value"});c.style.setProperty("font-size","var(--tab-mcp-code-size, 1.5em)"),c.style.setProperty("letter-spacing","0.1em");let g=n(t,"p",{className:"tab-mcp-code"},"When asked, enter the code ",c);g.setAttribute("aria-live","polite");let f=n(t,"ul"),u=n(t,"details",{className:"tab-mcp-help"},n(t,"summary",{text:"How do I add it?"}),f),v=n(t,"ul"),C=n(t,"div",{className:"tab-mcp-apps"},n(t,"h3",{text:"Connected"}),v),P=h(t,"Close",()=>i.close()),S=n(t,"div",{className:"tab-mcp-actions"},P);i.append(r,m,g,u,C,S),m.hidden=!0,g.hidden=!0,u.hidden=!0,C.hidden=!0;let x=(s)=>{if(s===void 0){m.hidden=!0,u.hidden=!0;return}d.value=s.address;let p=s.appName??e.appName;r.textContent=p!==void 0?`${p} is ready for your AI tool.`:"This page is ready for your AI tool.",m.hidden=!1,u.hidden=!1,f.replaceChildren(...O.map(([N,I])=>n(t,"li",{},n(t,"strong",{text:N}),`: ${I.replace("ADDRESS",s.address)}`)))},w=()=>{let s=e.pairingCode;c.textContent=s?.code??"",g.hidden=s===void 0},L=n(t,"p",{className:"tab-mcp-apps-note"});C.append(L);let b=()=>{let s=e.state==="connected";v.replaceChildren(...e.grants.map((p)=>{let N=h(t,"Disconnect",()=>{if(!e.revoke(p.grantId))b()});return N.disabled=!s,n(t,"li",{},`${M(p.client)} connected `,N)})),L.textContent=s?"":"To disconnect an app, connect this page again first.",L.hidden=s,C.hidden=e.grants.length===0},E=()=>{r.textContent="Disconnected. AI tools can use this page again after you connect.",x(void 0),b(),w()},T=()=>{x(e.session),b()};return e.addEventListener("pairingcode",w),e.addEventListener("grantschange",b),e.addEventListener("connected",T),e.addEventListener("disconnected",E),t.body.append(i),e.startPairing(),b(),w(),x(e.session),o.then((s)=>x(s),(s)=>{r.textContent=`Could not connect: ${s instanceof Error?s.message:String(s)}`}),new Promise((s)=>{i.addEventListener("close",()=>{e.stopPairing(),e.removeEventListener("pairingcode",w),e.removeEventListener("grantschange",b),e.removeEventListener("connected",T),e.removeEventListener("disconnected",E),i.remove(),s()},{once:!0}),i.showModal(),P.focus()})}export{G as confirmDialog,_ as showConnectDialog};
|
|
2
|
-
|
|
3
|
-
//# debugId=9D93C7850B75B8BA64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=ui-aac2cw9f.min.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ui.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * The default UI, loaded on demand: the \"Connect your AI tool\" dialog\n * (DEC-028) and the confirmation of consequential tools. Plain `<dialog>`\n * elements, no styles beyond a few CSS custom properties (`--tab-mcp-*`), all\n * text set with `textContent`. Pages with their own UI use the events and\n * methods of `TabMcp` instead.\n */\n\nimport type { TabMcp } from \"./tab-mcp.ts\";\nimport type {\n\tConfirmRequest,\n\tGrant,\n\tSessionInfo,\n\tToolCallClient,\n} from \"./types.ts\";\n\nlet counter = 0;\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n\tdoc: Document,\n\ttag: K,\n\tprops: { className?: string; text?: string; id?: string } = {},\n\t...children: (Node | string)[]\n): HTMLElementTagNameMap[K] {\n\tconst node = doc.createElement(tag);\n\tif (props.className !== undefined) node.className = props.className;\n\tif (props.id !== undefined) node.id = props.id;\n\tif (props.text !== undefined) node.textContent = props.text;\n\tnode.append(...children);\n\treturn node;\n}\n\nfunction button(\n\tdoc: Document,\n\ttext: string,\n\tonClick: () => void,\n): HTMLButtonElement {\n\tconst node = el(doc, \"button\", { text });\n\tnode.type = \"button\";\n\tnode.addEventListener(\"click\", onClick);\n\treturn node;\n}\n\nfunction newDialog(\n\tdoc: Document,\n\tclassName: string,\n\ttitle: string,\n): { dialog: HTMLDialogElement; heading: HTMLHeadingElement } {\n\tconst id = `tab-mcp-${++counter}`;\n\tconst dialog = el(doc, \"dialog\", {\n\t\tclassName: `tab-mcp-dialog ${className}`,\n\t});\n\tdialog.setAttribute(\"aria-labelledby\", `${id}-title`);\n\t// CSSOM properties are allowed under a strict CSP (no inline style attribute).\n\tconst style = dialog.style;\n\tstyle.setProperty(\"max-width\", \"var(--tab-mcp-max-width, 34rem)\");\n\tstyle.setProperty(\"font\", \"var(--tab-mcp-font, inherit)\");\n\tstyle.setProperty(\"color\", \"var(--tab-mcp-color, CanvasText)\");\n\tstyle.setProperty(\"background\", \"var(--tab-mcp-background, Canvas)\");\n\tstyle.setProperty(\"border\", \"var(--tab-mcp-border, 1px solid GrayText)\");\n\tstyle.setProperty(\"border-radius\", \"var(--tab-mcp-radius, 0.5rem)\");\n\tstyle.setProperty(\"padding\", \"var(--tab-mcp-padding, 1rem 1.25rem)\");\n\tconst heading = el(doc, \"h2\", { id: `${id}-title`, text: title });\n\theading.style.setProperty(\"margin-top\", \"0\");\n\theading.style.setProperty(\"font-size\", \"var(--tab-mcp-title-size, 1.25em)\");\n\tdialog.append(heading);\n\treturn { dialog, heading };\n}\n\nfunction clientLabel(client: ToolCallClient | Grant[\"client\"]): string {\n\tconst host = client.host || client.id;\n\treturn client.name !== undefined && client.name !== \"\"\n\t\t? `${client.name} (${host})`\n\t\t: host;\n}\n\n/**\n * The arguments as text, in full: what the user approves must be visible.\n * (The relay caps a request at 1 MiB, so this stays bounded.) `undefined`\n * when they cannot be shown, and then \"Allow\" is not offered.\n */\nfunction showArguments(args: Record<string, unknown>): string | undefined {\n\ttry {\n\t\treturn JSON.stringify(args, null, 2);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** How long \"Allow\" stays disabled after the confirmation opens, and the floor. */\nexport const ALLOW_DELAY_MS = 750;\nexport const MIN_ALLOW_DELAY_MS = 500;\n\n/**\n * Ask whether a consequential tool may run. Resolves `true` only for \"Allow\",\n * which stays disabled for `allowDelayMs` (default 750, at least 500) after\n * the dialog opens, so a click meant for the page cannot approve.\n */\nexport function confirmDialog(\n\trequest: ConfirmRequest,\n\tdoc: Document,\n\toptions: { allowDelayMs?: number } = {},\n): Promise<boolean> {\n\tconst delay = Math.max(\n\t\tMIN_ALLOW_DELAY_MS,\n\t\toptions.allowDelayMs ?? ALLOW_DELAY_MS,\n\t);\n\tif (request.signal.aborted) return Promise.resolve(false);\n\tconst title = request.tool.title ?? request.tool.name;\n\tconst { dialog } = newDialog(doc, \"tab-mcp-confirm\", `Allow ${title}?`);\n\tconst deny = button(doc, \"Don't allow\", () => dialog.close(\"deny\"));\n\tconst allow = button(doc, \"Allow\", () => {\n\t\tif (!allow.disabled) dialog.close(\"allow\");\n\t});\n\tallow.disabled = true;\n\tconst actions = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-actions\" },\n\t\tdeny,\n\t\t\" \",\n\t\tallow,\n\t);\n\tconst shown = showArguments(request.arguments);\n\tconst args = el(doc, \"pre\", {\n\t\tclassName: \"tab-mcp-arguments\",\n\t\ttext:\n\t\t\tshown ?? \"The arguments cannot be shown, so this call cannot be allowed.\",\n\t});\n\tif (shown === undefined) allow.hidden = true;\n\targs.style.setProperty(\"white-space\", \"pre-wrap\");\n\targs.style.setProperty(\"max-height\", \"12rem\");\n\targs.style.setProperty(\"overflow\", \"auto\");\n\targs.hidden = Object.keys(request.arguments).length === 0;\n\tdialog.append(\n\t\tel(doc, \"p\", {\n\t\t\ttext: `${clientLabel(request.client)} wants to run ${title}.`,\n\t\t}),\n\t\tel(doc, \"p\", {\n\t\t\tclassName: \"tab-mcp-description\",\n\t\t\ttext: request.tool.description,\n\t\t}),\n\t\targs,\n\t\tactions,\n\t);\n\tdoc.body.append(dialog);\n\treturn new Promise((resolve) => {\n\t\tconst onAbort = () => dialog.close(\"deny\");\n\t\trequest.signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\trequest.signal.removeEventListener(\"abort\", onAbort);\n\t\t\t\tconst allowed = dialog.returnValue === \"allow\";\n\t\t\t\tdialog.remove();\n\t\t\t\tresolve(allowed);\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\tdialog.showModal();\n\t\tdeny.focus(); // the safe choice is the default\n\t\t// Counted from when the dialog is shown, not from when it was built.\n\t\ttimer = setTimeout(() => {\n\t\t\tallow.disabled = false;\n\t\t}, delay);\n\t});\n}\n\nconst INSTRUCTIONS: [string, string][] = [\n\t[\n\t\t\"Claude (claude.ai and the desktop app)\",\n\t\t\"Settings → Connectors → Add custom connector, then paste the address.\",\n\t],\n\t[\n\t\t\"ChatGPT\",\n\t\t\"Settings → Apps and connectors → Advanced settings: turn on developer mode, then Create and paste the address.\",\n\t],\n\t[\"Claude Code\", \"Run: claude mcp add --transport http tools ADDRESS\"],\n];\n\n/**\n * The \"Connect your AI tool\" dialog: the address with a copy button, short\n * instructions, the pairing code while the relay sends one, and the connected\n * apps with Disconnect. Pairing is on while it is open.\n */\nexport function showConnectDialog(\n\tmcp: TabMcp,\n\tconnecting: Promise<SessionInfo>,\n\tdoc: Document,\n): Promise<void> {\n\tconst { dialog } = newDialog(doc, \"tab-mcp-connect\", \"Connect your AI tool\");\n\tconst status = el(doc, \"p\", {\n\t\tclassName: \"tab-mcp-status\",\n\t\ttext: \"Connecting…\",\n\t});\n\tstatus.setAttribute(\"role\", \"status\");\n\n\tconst addressId = `tab-mcp-${++counter}-address`;\n\tconst label = el(doc, \"label\", { text: \"Add this address to your AI tool:\" });\n\tlabel.htmlFor = addressId;\n\tconst address = el(doc, \"input\", {\n\t\tid: addressId,\n\t\tclassName: \"tab-mcp-address-input\",\n\t});\n\taddress.readOnly = true;\n\taddress.style.setProperty(\"width\", \"100%\");\n\taddress.style.setProperty(\"font-family\", \"var(--tab-mcp-mono, monospace)\");\n\tconst copy = button(doc, \"Copy\", () => {\n\t\tconst done = () => {\n\t\t\tcopy.textContent = \"Copied\";\n\t\t};\n\t\tconst clipboard = (doc.defaultView?.navigator as Navigator | undefined)\n\t\t\t?.clipboard;\n\t\tif (clipboard !== undefined)\n\t\t\tclipboard.writeText(address.value).then(done, () => address.select());\n\t\telse address.select();\n\t});\n\tconst addressBox = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-address\" },\n\t\tlabel,\n\t\taddress,\n\t\t\" \",\n\t\tcopy,\n\t);\n\n\tconst code = el(doc, \"strong\", { className: \"tab-mcp-code-value\" });\n\tcode.style.setProperty(\"font-size\", \"var(--tab-mcp-code-size, 1.5em)\");\n\tcode.style.setProperty(\"letter-spacing\", \"0.1em\");\n\tconst codeLine = el(\n\t\tdoc,\n\t\t\"p\",\n\t\t{ className: \"tab-mcp-code\" },\n\t\t\"When asked, enter the code \",\n\t\tcode,\n\t);\n\tcodeLine.setAttribute(\"aria-live\", \"polite\");\n\n\tconst steps = el(doc, \"ul\");\n\tconst help = el(\n\t\tdoc,\n\t\t\"details\",\n\t\t{ className: \"tab-mcp-help\" },\n\t\tel(doc, \"summary\", { text: \"How do I add it?\" }),\n\t\tsteps,\n\t);\n\n\tconst appList = el(doc, \"ul\");\n\tconst apps = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-apps\" },\n\t\tel(doc, \"h3\", { text: \"Connected\" }),\n\t\tappList,\n\t);\n\n\tconst close = button(doc, \"Close\", () => dialog.close());\n\tconst actions = el(doc, \"div\", { className: \"tab-mcp-actions\" }, close);\n\n\tdialog.append(status, addressBox, codeLine, help, apps, actions);\n\taddressBox.hidden = true;\n\tcodeLine.hidden = true;\n\thelp.hidden = true;\n\tapps.hidden = true;\n\n\tconst renderSession = (session: SessionInfo | undefined) => {\n\t\tif (session === undefined) {\n\t\t\taddressBox.hidden = true;\n\t\t\thelp.hidden = true;\n\t\t\treturn;\n\t\t}\n\t\taddress.value = session.address;\n\t\tconst appName = session.appName ?? mcp.appName;\n\t\tstatus.textContent =\n\t\t\tappName !== undefined\n\t\t\t\t? `${appName} is ready for your AI tool.`\n\t\t\t\t: \"This page is ready for your AI tool.\";\n\t\taddressBox.hidden = false;\n\t\thelp.hidden = false;\n\t\tsteps.replaceChildren(\n\t\t\t...INSTRUCTIONS.map(([app, how]) =>\n\t\t\t\tel(\n\t\t\t\t\tdoc,\n\t\t\t\t\t\"li\",\n\t\t\t\t\t{},\n\t\t\t\t\tel(doc, \"strong\", { text: app }),\n\t\t\t\t\t`: ${how.replace(\"ADDRESS\", session.address)}`,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t};\n\tconst renderCode = () => {\n\t\tconst current = mcp.pairingCode;\n\t\tcode.textContent = current?.code ?? \"\";\n\t\tcodeLine.hidden = current === undefined;\n\t};\n\tconst appsNote = el(doc, \"p\", { className: \"tab-mcp-apps-note\" });\n\tapps.append(appsNote);\n\tconst renderGrants = () => {\n\t\tconst connected = mcp.state === \"connected\";\n\t\tappList.replaceChildren(\n\t\t\t...mcp.grants.map((grant) => {\n\t\t\t\tconst disconnect = button(doc, \"Disconnect\", () => {\n\t\t\t\t\tif (!mcp.revoke(grant.grantId)) renderGrants();\n\t\t\t\t});\n\t\t\t\t// Only the relay can revoke, so only while connected.\n\t\t\t\tdisconnect.disabled = !connected;\n\t\t\t\treturn el(\n\t\t\t\t\tdoc,\n\t\t\t\t\t\"li\",\n\t\t\t\t\t{},\n\t\t\t\t\t`${clientLabel(grant.client)} connected `,\n\t\t\t\t\tdisconnect,\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t\tappsNote.textContent = connected\n\t\t\t? \"\"\n\t\t\t: \"To disconnect an app, connect this page again first.\";\n\t\tappsNote.hidden = connected;\n\t\tapps.hidden = mcp.grants.length === 0;\n\t};\n\tconst onDisconnected = () => {\n\t\tstatus.textContent =\n\t\t\t\"Disconnected. AI tools can use this page again after you connect.\";\n\t\trenderSession(undefined);\n\t\trenderGrants();\n\t\trenderCode();\n\t};\n\tconst onConnected = () => {\n\t\trenderSession(mcp.session);\n\t\trenderGrants();\n\t};\n\n\tmcp.addEventListener(\"pairingcode\", renderCode);\n\tmcp.addEventListener(\"grantschange\", renderGrants);\n\tmcp.addEventListener(\"connected\", onConnected);\n\tmcp.addEventListener(\"disconnected\", onDisconnected);\n\tdoc.body.append(dialog);\n\tmcp.startPairing();\n\trenderGrants();\n\trenderCode();\n\trenderSession(mcp.session);\n\tconnecting.then(\n\t\t(session) => renderSession(session),\n\t\t(error: unknown) => {\n\t\t\tstatus.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}`;\n\t\t},\n\t);\n\n\treturn new Promise((resolve) => {\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tmcp.stopPairing();\n\t\t\t\tmcp.removeEventListener(\"pairingcode\", renderCode);\n\t\t\t\tmcp.removeEventListener(\"grantschange\", renderGrants);\n\t\t\t\tmcp.removeEventListener(\"connected\", onConnected);\n\t\t\t\tmcp.removeEventListener(\"disconnected\", onDisconnected);\n\t\t\t\tdialog.remove();\n\t\t\t\tresolve();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\tdialog.showModal();\n\t\tclose.focus();\n\t});\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "AAgBA,IAAI,EAAU,EAEd,SAAS,CAAyC,CACjD,EACA,EACA,EAA4D,CAAC,KAC1D,EACwB,CAC3B,IAAM,EAAO,EAAI,cAAc,CAAG,EAClC,GAAI,EAAM,YAAc,OAAW,EAAK,UAAY,EAAM,UAC1D,GAAI,EAAM,KAAO,OAAW,EAAK,GAAK,EAAM,GAC5C,GAAI,EAAM,OAAS,OAAW,EAAK,YAAc,EAAM,KAEvD,OADA,EAAK,OAAO,GAAG,CAAQ,EAChB,EAGR,SAAS,CAAM,CACd,EACA,EACA,EACoB,CACpB,IAAM,EAAO,EAAG,EAAK,SAAU,CAAE,MAAK,CAAC,EAGvC,OAFA,EAAK,KAAO,SACZ,EAAK,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