@ractive-ch/tab-mcp-client 0.6.0 → 0.8.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 +153 -14
- package/address.d.ts +14 -0
- package/cdn/connection-ssyf3414.min.js +11 -0
- package/cdn/{connection-nygehv52.min.js.map → connection-ssyf3414.min.js.map} +6 -5
- package/cdn/tab-mcp-client.min.js +3 -3
- package/cdn/tab-mcp-client.min.js.map +5 -6
- package/cdn/ui-m7p94t5t.min.js +72 -0
- package/cdn/ui-m7p94t5t.min.js.map +11 -0
- package/{connection-p94fg1r9.js → connection-xtt891qk.js} +116 -7
- package/{connection-p94fg1r9.js.map → connection-xtt891qk.js.map} +6 -5
- package/connection.d.ts +20 -2
- package/index.d.ts +1 -1
- package/index.js +45 -60
- package/index.js.map +5 -6
- package/internal.d.ts +8 -2
- package/package.json +1 -1
- package/protocol.d.ts +2 -0
- package/tab-mcp.d.ts +7 -3
- package/types.d.ts +29 -2
- package/ui-xkw7g2v2.js +660 -0
- package/ui-xkw7g2v2.js.map +11 -0
- package/ui.d.ts +68 -11
- package/version.d.ts +1 -1
- package/cdn/connection-nygehv52.min.js +0 -11
- package/cdn/ui-yknfss9n.min.js +0 -4
- package/cdn/ui-yknfss9n.min.js.map +0 -10
- package/ui-htav9g19.js +0 -430
- package/ui-htav9g19.js.map +0 -10
package/ui-htav9g19.js
DELETED
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
// src/ui.ts
|
|
2
|
-
var counter = 0;
|
|
3
|
-
function el(doc, tag, props = {}, ...children) {
|
|
4
|
-
const node = doc.createElement(tag);
|
|
5
|
-
if (props.className !== undefined)
|
|
6
|
-
node.className = props.className;
|
|
7
|
-
if (props.id !== undefined)
|
|
8
|
-
node.id = props.id;
|
|
9
|
-
if (props.text !== undefined)
|
|
10
|
-
node.textContent = props.text;
|
|
11
|
-
node.append(...children);
|
|
12
|
-
return node;
|
|
13
|
-
}
|
|
14
|
-
function button(doc, text, onClick) {
|
|
15
|
-
const node = el(doc, "button", { text });
|
|
16
|
-
node.type = "button";
|
|
17
|
-
node.addEventListener("click", onClick);
|
|
18
|
-
return node;
|
|
19
|
-
}
|
|
20
|
-
function copyButton(doc, noun, value, select) {
|
|
21
|
-
const node = button(doc, "Copy", () => {
|
|
22
|
-
const done = () => {
|
|
23
|
-
node.textContent = "Copied";
|
|
24
|
-
node.setAttribute("aria-label", `Copied ${noun}`);
|
|
25
|
-
};
|
|
26
|
-
const clipboard = doc.defaultView?.navigator?.clipboard;
|
|
27
|
-
if (clipboard !== undefined)
|
|
28
|
-
clipboard.writeText(value()).then(done, select);
|
|
29
|
-
else
|
|
30
|
-
select();
|
|
31
|
-
});
|
|
32
|
-
const reset = () => {
|
|
33
|
-
node.textContent = "Copy";
|
|
34
|
-
node.setAttribute("aria-label", `Copy ${noun}`);
|
|
35
|
-
};
|
|
36
|
-
reset();
|
|
37
|
-
return { button: node, reset };
|
|
38
|
-
}
|
|
39
|
-
function newDialog(doc, className, title) {
|
|
40
|
-
const id = `tab-mcp-${++counter}`;
|
|
41
|
-
const dialog = el(doc, "dialog", {
|
|
42
|
-
className: `tab-mcp-dialog ${className}`
|
|
43
|
-
});
|
|
44
|
-
dialog.setAttribute("aria-labelledby", `${id}-title`);
|
|
45
|
-
const style = dialog.style;
|
|
46
|
-
style.setProperty("max-width", "var(--tab-mcp-max-width, 34rem)");
|
|
47
|
-
style.setProperty("font", "var(--tab-mcp-font, inherit)");
|
|
48
|
-
style.setProperty("color", "var(--tab-mcp-color, CanvasText)");
|
|
49
|
-
style.setProperty("background", "var(--tab-mcp-background, Canvas)");
|
|
50
|
-
style.setProperty("border", "var(--tab-mcp-border, 1px solid GrayText)");
|
|
51
|
-
style.setProperty("border-radius", "var(--tab-mcp-radius, 0.5rem)");
|
|
52
|
-
style.setProperty("padding", "var(--tab-mcp-padding, 1rem 1.25rem)");
|
|
53
|
-
const heading = el(doc, "h2", { id: `${id}-title`, text: title });
|
|
54
|
-
heading.style.setProperty("margin-top", "0");
|
|
55
|
-
heading.style.setProperty("font-size", "var(--tab-mcp-title-size, 1.25em)");
|
|
56
|
-
dialog.append(heading);
|
|
57
|
-
return { dialog, heading };
|
|
58
|
-
}
|
|
59
|
-
var INVISIBLE = /[\p{Cf}\p{Default_Ignorable_Code_Point}\p{Co}\p{Cn}\u0080-\u009F\u2028\u2029]/gu;
|
|
60
|
-
function visible(text) {
|
|
61
|
-
return text.replace(INVISIBLE, (ch) => {
|
|
62
|
-
let escaped = "";
|
|
63
|
-
for (let i = 0;i < ch.length; i++)
|
|
64
|
-
escaped += `\\u${ch.charCodeAt(i).toString(16).toUpperCase().padStart(4, "0")}`;
|
|
65
|
-
return escaped;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function clientLabel(client) {
|
|
69
|
-
const host = visible(client.host || client.id);
|
|
70
|
-
return client.name !== undefined && client.name !== "" ? `${visible(client.name)} (${host})` : host;
|
|
71
|
-
}
|
|
72
|
-
function name(doc, text) {
|
|
73
|
-
const node = el(doc, "bdi", { text });
|
|
74
|
-
node.dir = "ltr";
|
|
75
|
-
return node;
|
|
76
|
-
}
|
|
77
|
-
function showArguments(args) {
|
|
78
|
-
try {
|
|
79
|
-
return visible(JSON.stringify(args, null, 2));
|
|
80
|
-
} catch {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
var ALLOW_DELAY_MS = 750;
|
|
85
|
-
var MIN_ALLOW_DELAY_MS = 500;
|
|
86
|
-
function allowDelay(ms) {
|
|
87
|
-
const value = typeof ms === "number" && Number.isFinite(ms) && ms < 2 ** 31 ? ms : ALLOW_DELAY_MS;
|
|
88
|
-
return Math.max(MIN_ALLOW_DELAY_MS, value);
|
|
89
|
-
}
|
|
90
|
-
function confirmDialog(request, doc, options = {}) {
|
|
91
|
-
const delay = allowDelay(options.allowDelayMs);
|
|
92
|
-
if (request.signal.aborted)
|
|
93
|
-
return Promise.resolve("deny");
|
|
94
|
-
const title = request.tool.title ?? request.tool.name;
|
|
95
|
-
const { dialog, heading } = newDialog(doc, "tab-mcp-confirm", "");
|
|
96
|
-
heading.append("Allow ", name(doc, title), "?");
|
|
97
|
-
const client = clientLabel(request.client);
|
|
98
|
-
const deny = button(doc, "Don't allow", () => dialog.close("deny"));
|
|
99
|
-
const allow = button(doc, "Allow", () => {
|
|
100
|
-
if (!allow.disabled)
|
|
101
|
-
dialog.close("allow");
|
|
102
|
-
});
|
|
103
|
-
const always = button(doc, "Always allow", () => {
|
|
104
|
-
if (!always.disabled)
|
|
105
|
-
dialog.close("always");
|
|
106
|
-
});
|
|
107
|
-
allow.disabled = true;
|
|
108
|
-
always.disabled = true;
|
|
109
|
-
const actions = el(doc, "div", { className: "tab-mcp-actions" }, deny, " ", allow, " ", always);
|
|
110
|
-
const alwaysNote = el(doc, "p", { className: "tab-mcp-always-note" }, "Always allow: ", name(doc, title), " runs without asking for ", name(doc, client), " until you reload this page or disconnect it.");
|
|
111
|
-
const shown = showArguments(request.arguments);
|
|
112
|
-
const args = el(doc, "pre", {
|
|
113
|
-
className: "tab-mcp-arguments",
|
|
114
|
-
text: shown ?? "The arguments cannot be shown, so this call cannot be allowed."
|
|
115
|
-
});
|
|
116
|
-
if (shown === undefined) {
|
|
117
|
-
allow.hidden = true;
|
|
118
|
-
always.hidden = true;
|
|
119
|
-
alwaysNote.hidden = true;
|
|
120
|
-
}
|
|
121
|
-
args.dir = "ltr";
|
|
122
|
-
args.style.setProperty("white-space", "pre-wrap");
|
|
123
|
-
args.style.setProperty("max-height", "12rem");
|
|
124
|
-
args.style.setProperty("overflow", "auto");
|
|
125
|
-
args.hidden = Object.keys(request.arguments).length === 0;
|
|
126
|
-
dialog.append(el(doc, "p", {}, name(doc, client), " wants to run ", name(doc, title), "."), el(doc, "p", {
|
|
127
|
-
className: "tab-mcp-description",
|
|
128
|
-
text: request.tool.description
|
|
129
|
-
}), args, actions, alwaysNote);
|
|
130
|
-
doc.body.append(dialog);
|
|
131
|
-
const view = doc.defaultView;
|
|
132
|
-
return new Promise((resolve) => {
|
|
133
|
-
const onAbort = () => dialog.close("deny");
|
|
134
|
-
request.signal.addEventListener("abort", onAbort, { once: true });
|
|
135
|
-
let timer;
|
|
136
|
-
const arm = (event) => {
|
|
137
|
-
clearTimeout(timer);
|
|
138
|
-
timer = undefined;
|
|
139
|
-
allow.disabled = true;
|
|
140
|
-
always.disabled = true;
|
|
141
|
-
if (event?.type === "blur" || doc.visibilityState === "hidden" || !doc.hasFocus())
|
|
142
|
-
return;
|
|
143
|
-
timer = setTimeout(() => {
|
|
144
|
-
allow.disabled = false;
|
|
145
|
-
always.disabled = false;
|
|
146
|
-
}, delay);
|
|
147
|
-
};
|
|
148
|
-
doc.addEventListener("visibilitychange", arm);
|
|
149
|
-
view?.addEventListener("focus", arm);
|
|
150
|
-
view?.addEventListener("blur", arm);
|
|
151
|
-
dialog.addEventListener("close", () => {
|
|
152
|
-
clearTimeout(timer);
|
|
153
|
-
doc.removeEventListener("visibilitychange", arm);
|
|
154
|
-
view?.removeEventListener("focus", arm);
|
|
155
|
-
view?.removeEventListener("blur", arm);
|
|
156
|
-
request.signal.removeEventListener("abort", onAbort);
|
|
157
|
-
const value = dialog.returnValue;
|
|
158
|
-
dialog.remove();
|
|
159
|
-
resolve(value === "allow" || value === "always" ? value : "deny");
|
|
160
|
-
}, { once: true });
|
|
161
|
-
dialog.showModal();
|
|
162
|
-
deny.focus();
|
|
163
|
-
arm();
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
var INSTRUCTIONS = [
|
|
167
|
-
[
|
|
168
|
-
"Claude (claude.ai and the desktop app)",
|
|
169
|
-
"Settings → Connectors → Add custom connector, then paste the address."
|
|
170
|
-
],
|
|
171
|
-
[
|
|
172
|
-
"ChatGPT",
|
|
173
|
-
"Settings → Apps and connectors → Advanced settings: turn on developer mode, then Create and paste the address."
|
|
174
|
-
],
|
|
175
|
-
["Claude Code", "Run: claude mcp add --transport http tools ADDRESS"]
|
|
176
|
-
];
|
|
177
|
-
function listOf(items) {
|
|
178
|
-
return items.length < 2 ? items[0] ?? "" : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
179
|
-
}
|
|
180
|
-
function showConnectDialog(mcp, connecting, doc) {
|
|
181
|
-
const { dialog } = newDialog(doc, "tab-mcp-connect", "Connect your AI app");
|
|
182
|
-
dialog.tabIndex = -1;
|
|
183
|
-
dialog.style.setProperty("outline", "none");
|
|
184
|
-
const status = el(doc, "p", {
|
|
185
|
-
className: "tab-mcp-status",
|
|
186
|
-
text: "Connecting…"
|
|
187
|
-
});
|
|
188
|
-
status.setAttribute("role", "status");
|
|
189
|
-
const addressId = `tab-mcp-${++counter}-address`;
|
|
190
|
-
const label = el(doc, "label", { text: "Add this address to your AI app:" });
|
|
191
|
-
label.htmlFor = addressId;
|
|
192
|
-
const address = el(doc, "input", {
|
|
193
|
-
id: addressId,
|
|
194
|
-
className: "tab-mcp-address-input"
|
|
195
|
-
});
|
|
196
|
-
address.readOnly = true;
|
|
197
|
-
address.style.setProperty("width", "100%");
|
|
198
|
-
address.style.setProperty("font-family", "var(--tab-mcp-mono, monospace)");
|
|
199
|
-
const { button: copy, reset: resetCopy } = copyButton(doc, "address", () => address.value, () => address.select());
|
|
200
|
-
copy.className = "tab-mcp-address-copy";
|
|
201
|
-
const fresh = button(doc, "New address", () => askNewAddress());
|
|
202
|
-
fresh.className = "tab-mcp-new-address";
|
|
203
|
-
const addressBox = el(doc, "div", { className: "tab-mcp-address" }, label, address, " ", copy, " ", fresh);
|
|
204
|
-
const confirmId = `tab-mcp-${++counter}-new-address`;
|
|
205
|
-
const confirmText = el(doc, "p", { id: confirmId });
|
|
206
|
-
const cancelNew = button(doc, "Cancel", () => {
|
|
207
|
-
confirmBox.hidden = true;
|
|
208
|
-
fresh.focus();
|
|
209
|
-
});
|
|
210
|
-
const confirmNew = button(doc, "Disconnect and get new address", () => getNewAddress());
|
|
211
|
-
confirmNew.className = "tab-mcp-new-address-confirm";
|
|
212
|
-
const confirmBox = el(doc, "div", { className: "tab-mcp-new-address-question" }, confirmText, el(doc, "div", { className: "tab-mcp-actions" }, cancelNew, " ", confirmNew));
|
|
213
|
-
confirmBox.setAttribute("role", "group");
|
|
214
|
-
confirmBox.setAttribute("aria-labelledby", confirmId);
|
|
215
|
-
confirmBox.hidden = true;
|
|
216
|
-
const code = el(doc, "strong", { className: "tab-mcp-code-value" });
|
|
217
|
-
code.style.setProperty("font-size", "var(--tab-mcp-code-size, 1.5em)");
|
|
218
|
-
code.style.setProperty("letter-spacing", "0.1em");
|
|
219
|
-
code.style.setProperty("font-family", "var(--tab-mcp-mono, monospace)");
|
|
220
|
-
code.style.setProperty("user-select", "all");
|
|
221
|
-
code.style.setProperty("-webkit-user-select", "all");
|
|
222
|
-
const { button: copyCode, reset: resetCopyCode } = copyButton(doc, "code", () => code.textContent ?? "", () => doc.getSelection()?.selectAllChildren(code));
|
|
223
|
-
copyCode.className = "tab-mcp-code-copy";
|
|
224
|
-
const codeSentence = el(doc, "span", {}, "When asked, enter the code ", code);
|
|
225
|
-
codeSentence.setAttribute("aria-live", "polite");
|
|
226
|
-
const codeLine = el(doc, "p", { className: "tab-mcp-code" }, codeSentence, " ", copyCode, el(doc, "br"), el(doc, "small", {
|
|
227
|
-
className: "tab-mcp-code-note",
|
|
228
|
-
text: "A new code appears every 2 minutes and after each use."
|
|
229
|
-
}));
|
|
230
|
-
const signInLine = el(doc, "p", {
|
|
231
|
-
className: "tab-mcp-sign-in",
|
|
232
|
-
text: "When your AI app asks, sign in with the account you use on this page. No code is needed."
|
|
233
|
-
});
|
|
234
|
-
const steps = el(doc, "ul");
|
|
235
|
-
const help = el(doc, "details", { className: "tab-mcp-help" }, el(doc, "summary", { text: "How do I add it?" }), steps);
|
|
236
|
-
const appList = el(doc, "ul");
|
|
237
|
-
const apps = el(doc, "div", { className: "tab-mcp-apps" }, el(doc, "h3", { text: "Connected" }), appList);
|
|
238
|
-
const closeNote = el(doc, "small", {
|
|
239
|
-
className: "tab-mcp-close-note",
|
|
240
|
-
text: "Closing this stops the code. The address stays the same: to connect later, open this again from the page."
|
|
241
|
-
});
|
|
242
|
-
const close = button(doc, "Close", () => dialog.close());
|
|
243
|
-
close.className = "tab-mcp-close";
|
|
244
|
-
close.style.setProperty("font-size", "0.875em");
|
|
245
|
-
const done = button(doc, "Done", () => dialog.close());
|
|
246
|
-
done.className = "tab-mcp-done";
|
|
247
|
-
done.style.setProperty("font-weight", "bold");
|
|
248
|
-
done.hidden = true;
|
|
249
|
-
const actions = el(doc, "div", { className: "tab-mcp-actions" }, closeNote, " ", close, done);
|
|
250
|
-
actions.style.setProperty("display", "flex");
|
|
251
|
-
actions.style.setProperty("align-items", "center");
|
|
252
|
-
actions.style.setProperty("justify-content", "flex-end");
|
|
253
|
-
actions.style.setProperty("gap", "0.75rem");
|
|
254
|
-
actions.style.setProperty("margin-top", "1rem");
|
|
255
|
-
closeNote.style.setProperty("flex", "1");
|
|
256
|
-
let paired = false;
|
|
257
|
-
const pairedGrants = new Set;
|
|
258
|
-
const renderCloseNote = () => {
|
|
259
|
-
closeNote.hidden = paired || codeLine.hidden;
|
|
260
|
-
};
|
|
261
|
-
const setPaired = (value) => {
|
|
262
|
-
paired = value;
|
|
263
|
-
if (!paired)
|
|
264
|
-
pairedGrants.clear();
|
|
265
|
-
const focused = doc.activeElement;
|
|
266
|
-
renderCloseNote();
|
|
267
|
-
close.hidden = paired;
|
|
268
|
-
done.hidden = !paired;
|
|
269
|
-
if (paired && focused === close)
|
|
270
|
-
done.focus();
|
|
271
|
-
if (!paired && focused === done)
|
|
272
|
-
close.focus();
|
|
273
|
-
};
|
|
274
|
-
const closer = () => paired ? done : close;
|
|
275
|
-
dialog.append(status, addressBox, confirmBox, codeLine, signInLine, help, apps, actions);
|
|
276
|
-
addressBox.hidden = true;
|
|
277
|
-
codeLine.hidden = true;
|
|
278
|
-
signInLine.hidden = true;
|
|
279
|
-
help.hidden = true;
|
|
280
|
-
apps.hidden = true;
|
|
281
|
-
let renewing = false;
|
|
282
|
-
const renderQuestion = () => {
|
|
283
|
-
const names = mcp.grants.map((g) => clientLabel(g.client));
|
|
284
|
-
if (names.length === 0)
|
|
285
|
-
return false;
|
|
286
|
-
confirmText.textContent = `A new address disconnects ${listOf(names)}. To use this page again, add the new address to ${names.length === 1 ? "it" : "them"}.`;
|
|
287
|
-
return true;
|
|
288
|
-
};
|
|
289
|
-
const askNewAddress = () => {
|
|
290
|
-
if (mcp.state !== "connected")
|
|
291
|
-
return;
|
|
292
|
-
if (!renderQuestion()) {
|
|
293
|
-
getNewAddress();
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
confirmBox.hidden = false;
|
|
297
|
-
cancelNew.focus();
|
|
298
|
-
};
|
|
299
|
-
const getNewAddress = () => {
|
|
300
|
-
setPaired(false);
|
|
301
|
-
close.focus();
|
|
302
|
-
confirmBox.hidden = true;
|
|
303
|
-
renewing = true;
|
|
304
|
-
status.textContent = "Getting a new address…";
|
|
305
|
-
mcp.newAddress().then(() => {
|
|
306
|
-
renewing = false;
|
|
307
|
-
status.textContent = "This is a new address. Add it to your AI app again.";
|
|
308
|
-
copy.focus();
|
|
309
|
-
}, (error) => {
|
|
310
|
-
renewing = false;
|
|
311
|
-
status.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}. Close this and connect again.`;
|
|
312
|
-
closer().focus();
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
const renderSession = (session) => {
|
|
316
|
-
if (session === undefined) {
|
|
317
|
-
addressBox.hidden = true;
|
|
318
|
-
confirmBox.hidden = true;
|
|
319
|
-
help.hidden = true;
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
address.value = session.address;
|
|
323
|
-
resetCopy();
|
|
324
|
-
const appName = session.appName ?? mcp.appName;
|
|
325
|
-
if (!renewing)
|
|
326
|
-
status.textContent = appName !== undefined ? `${appName} is ready for your AI app.` : "This page is ready for your AI app.";
|
|
327
|
-
fresh.disabled = mcp.state !== "connected";
|
|
328
|
-
addressBox.hidden = false;
|
|
329
|
-
if (doc.activeElement === dialog)
|
|
330
|
-
copy.focus();
|
|
331
|
-
help.hidden = false;
|
|
332
|
-
steps.replaceChildren(...INSTRUCTIONS.map(([app, how]) => el(doc, "li", {}, el(doc, "strong", { text: app }), `: ${how.replace("ADDRESS", session.address)}`)));
|
|
333
|
-
};
|
|
334
|
-
const renderCode = () => {
|
|
335
|
-
const current = mcp.pairingCode;
|
|
336
|
-
const oidc = mcp.session?.pairing === "oidc";
|
|
337
|
-
if (code.textContent !== (current?.code ?? ""))
|
|
338
|
-
resetCopyCode();
|
|
339
|
-
code.textContent = current?.code ?? "";
|
|
340
|
-
codeLine.hidden = oidc || current === undefined;
|
|
341
|
-
signInLine.hidden = !oidc;
|
|
342
|
-
renderCloseNote();
|
|
343
|
-
};
|
|
344
|
-
const appsNote = el(doc, "p", { className: "tab-mcp-apps-note" });
|
|
345
|
-
apps.append(appsNote);
|
|
346
|
-
const known = new Set(mcp.grants.map((g) => g.grantId));
|
|
347
|
-
let session = mcp.session;
|
|
348
|
-
const renderGrants = () => {
|
|
349
|
-
if (mcp.session !== session) {
|
|
350
|
-
session = mcp.session;
|
|
351
|
-
for (const grant of mcp.grants)
|
|
352
|
-
known.add(grant.grantId);
|
|
353
|
-
}
|
|
354
|
-
for (const grant of mcp.grants) {
|
|
355
|
-
if (known.has(grant.grantId))
|
|
356
|
-
continue;
|
|
357
|
-
known.add(grant.grantId);
|
|
358
|
-
status.textContent = `${clientLabel(grant.client)} is connected.`;
|
|
359
|
-
pairedGrants.add(grant.grantId);
|
|
360
|
-
if (!paired)
|
|
361
|
-
setPaired(true);
|
|
362
|
-
}
|
|
363
|
-
if (paired && !mcp.grants.some((g) => pairedGrants.has(g.grantId))) {
|
|
364
|
-
setPaired(false);
|
|
365
|
-
}
|
|
366
|
-
const connected = mcp.state === "connected";
|
|
367
|
-
appList.replaceChildren(...mcp.grants.map((grant) => {
|
|
368
|
-
const disconnect = button(doc, "Disconnect", () => {
|
|
369
|
-
if (!mcp.revoke(grant.grantId))
|
|
370
|
-
renderGrants();
|
|
371
|
-
});
|
|
372
|
-
disconnect.disabled = !connected;
|
|
373
|
-
return el(doc, "li", {}, `${clientLabel(grant.client)} connected `, disconnect);
|
|
374
|
-
}));
|
|
375
|
-
appsNote.textContent = connected ? "" : "To disconnect an app, connect this page again first.";
|
|
376
|
-
appsNote.hidden = connected;
|
|
377
|
-
apps.hidden = mcp.grants.length === 0;
|
|
378
|
-
if (!confirmBox.hidden && !renderQuestion()) {
|
|
379
|
-
confirmBox.hidden = true;
|
|
380
|
-
fresh.focus();
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
const onDisconnected = (event) => {
|
|
384
|
-
if (event.detail.reason !== "new_address")
|
|
385
|
-
status.textContent = "Disconnected. AI apps can use this page again after you connect.";
|
|
386
|
-
renderSession(undefined);
|
|
387
|
-
renderGrants();
|
|
388
|
-
renderCode();
|
|
389
|
-
};
|
|
390
|
-
const onConnected = () => {
|
|
391
|
-
renderSession(mcp.session);
|
|
392
|
-
renderGrants();
|
|
393
|
-
renderCode();
|
|
394
|
-
};
|
|
395
|
-
mcp.addEventListener("pairingcode", renderCode);
|
|
396
|
-
mcp.addEventListener("grantschange", renderGrants);
|
|
397
|
-
mcp.addEventListener("connected", onConnected);
|
|
398
|
-
mcp.addEventListener("disconnected", onDisconnected);
|
|
399
|
-
doc.body.append(dialog);
|
|
400
|
-
mcp.startPairing();
|
|
401
|
-
renderGrants();
|
|
402
|
-
renderCode();
|
|
403
|
-
renderSession(mcp.session);
|
|
404
|
-
connecting.then((session) => renderSession(session), (error) => {
|
|
405
|
-
status.textContent = `Could not connect: ${error instanceof Error ? error.message : String(error)}`;
|
|
406
|
-
});
|
|
407
|
-
return new Promise((resolve) => {
|
|
408
|
-
dialog.addEventListener("close", () => {
|
|
409
|
-
mcp.stopPairing();
|
|
410
|
-
mcp.removeEventListener("pairingcode", renderCode);
|
|
411
|
-
mcp.removeEventListener("grantschange", renderGrants);
|
|
412
|
-
mcp.removeEventListener("connected", onConnected);
|
|
413
|
-
mcp.removeEventListener("disconnected", onDisconnected);
|
|
414
|
-
dialog.remove();
|
|
415
|
-
resolve();
|
|
416
|
-
}, { once: true });
|
|
417
|
-
dialog.showModal();
|
|
418
|
-
if (!addressBox.hidden)
|
|
419
|
-
copy.focus();
|
|
420
|
-
else
|
|
421
|
-
dialog.focus();
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
export {
|
|
425
|
-
confirmDialog,
|
|
426
|
-
showConnectDialog
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
//# debugId=62FD792E93994A5B64756E2164756E21
|
|
430
|
-
//# sourceMappingURL=ui-htav9g19.js.map
|
package/ui-htav9g19.js.map
DELETED
|
@@ -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 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\n/**\n * A Copy button for `value()`, read at click time. Shows \"Copied\" once the\n * clipboard took it; without a clipboard (or when it refuses) `select()` puts\n * the text in the selection for Ctrl+C instead. `noun` names it for assistive\n * technology (\"Copy code\"), as the dialog has more than one Copy.\n */\nfunction copyButton(\n\tdoc: Document,\n\tnoun: string,\n\tvalue: () => string,\n\tselect: () => void,\n): { button: HTMLButtonElement; reset: () => void } {\n\tconst node = button(doc, \"Copy\", () => {\n\t\tconst done = () => {\n\t\t\tnode.textContent = \"Copied\";\n\t\t\tnode.setAttribute(\"aria-label\", `Copied ${noun}`);\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(value()).then(done, select);\n\t\telse select();\n\t});\n\tconst reset = () => {\n\t\tnode.textContent = \"Copy\";\n\t\tnode.setAttribute(\"aria-label\", `Copy ${noun}`);\n\t};\n\treset();\n\treturn { button: node, reset };\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\n/**\n * Characters that are invisible or change the direction of the text around\n * them: format characters (bidi controls and isolates, zero-width ones, tags),\n * the other default-ignorable ones (fillers, variation selectors), private-use\n * and unassigned code points, C1 controls, and line and paragraph separators.\n */\nconst INVISIBLE =\n\t/[\\p{Cf}\\p{Default_Ignorable_Code_Point}\\p{Co}\\p{Cn}\\u0080-\\u009F\\u2028\\u2029]/gu;\n\n/** Each such character as `\\uXXXX` (a pair for one beyond U+FFFF), as JSON would write it. */\nfunction visible(text: string): string {\n\treturn text.replace(INVISIBLE, (ch) => {\n\t\tlet escaped = \"\";\n\t\tfor (let i = 0; i < ch.length; i++)\n\t\t\tescaped += `\\\\u${ch.charCodeAt(i).toString(16).toUpperCase().padStart(4, \"0\")}`;\n\t\treturn escaped;\n\t});\n}\n\nfunction clientLabel(client: ToolCallClient | Grant[\"client\"]): string {\n\tconst host = visible(client.host || client.id);\n\treturn client.name !== undefined && client.name !== \"\"\n\t\t? `${visible(client.name)} (${host})`\n\t\t: host;\n}\n\n/** A name in a sentence, isolated so that it cannot reorder the words around it. */\nfunction name(doc: Document, text: string): HTMLElement {\n\tconst node = el(doc, \"bdi\", { text });\n\tnode.dir = \"ltr\";\n\treturn node;\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.) Invisible and\n * direction characters are shown as escapes, so the text is still JSON for\n * the same arguments; the tool gets them unchanged. `undefined` when they\n * cannot be shown, and then \"Allow\" is not offered.\n */\nfunction showArguments(args: Record<string, unknown>): string | undefined {\n\ttry {\n\t\treturn visible(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/** `allowDelayMs` as a usable delay: the default unless a number of ms, never below the floor. */\nfunction allowDelay(ms: number | undefined): number {\n\tconst value =\n\t\ttypeof ms === \"number\" && Number.isFinite(ms) && ms < 2 ** 31\n\t\t\t? ms\n\t\t\t: ALLOW_DELAY_MS;\n\treturn Math.max(MIN_ALLOW_DELAY_MS, value);\n}\n\n/**\n * Ask whether a consequential tool may run. \"Allow\" and \"Always allow\" stay\n * disabled until the page has been visible and focused for `allowDelayMs`\n * (default 750, at least 500) while the dialog is open, so a click meant for\n * the page, or the click that brings the tab or window back, cannot approve.\n * Leaving the page disables them again. Everything else (Don't allow,\n * 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 = allowDelay(options.allowDelayMs);\n\tif (request.signal.aborted) return Promise.resolve(\"deny\");\n\tconst title = request.tool.title ?? request.tool.name;\n\tconst { dialog, heading } = newDialog(doc, \"tab-mcp-confirm\", \"\");\n\theading.append(\"Allow \", name(doc, title), \"?\");\n\tconst client = clientLabel(request.client);\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(\n\t\tdoc,\n\t\t\"p\",\n\t\t{ className: \"tab-mcp-always-note\" },\n\t\t\"Always allow: \",\n\t\tname(doc, title),\n\t\t\" runs without asking for \",\n\t\tname(doc, client),\n\t\t\" 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.dir = \"ltr\";\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(\n\t\t\tdoc,\n\t\t\t\"p\",\n\t\t\t{},\n\t\t\tname(doc, client),\n\t\t\t\" wants to run \",\n\t\t\tname(doc, title),\n\t\t\t\".\",\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\tconst view = doc.defaultView;\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\t// The delay counts only while the user can see the page: tools are\n\t\t// called while the user is in the AI app, so the dialog often opens in\n\t\t// a background tab or window. Any change starts it again from zero (DEC-087).\n\t\tconst arm = (event?: Event) => {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t\tallow.disabled = true;\n\t\t\talways.disabled = true;\n\t\t\tif (\n\t\t\t\tevent?.type === \"blur\" ||\n\t\t\t\tdoc.visibilityState === \"hidden\" ||\n\t\t\t\t!doc.hasFocus()\n\t\t\t)\n\t\t\t\treturn;\n\t\t\ttimer = setTimeout(() => {\n\t\t\t\tallow.disabled = false;\n\t\t\t\talways.disabled = false;\n\t\t\t}, delay);\n\t\t};\n\t\tdoc.addEventListener(\"visibilitychange\", arm);\n\t\tview?.addEventListener(\"focus\", arm);\n\t\tview?.addEventListener(\"blur\", arm);\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tdoc.removeEventListener(\"visibilitychange\", arm);\n\t\t\t\tview?.removeEventListener(\"focus\", arm);\n\t\t\t\tview?.removeEventListener(\"blur\", arm);\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\tarm();\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 (with Copy) while the relay sends one,\n * and the connected apps with Disconnect. Pairing is on while it is open, so\n * closing it ends the code; the connection and the address stay. Until an app\n * connects, only a small Close (and Escape) close it; then a Done. 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\t// Focusable from script only, for the moment before the address is shown.\n\tdialog.tabIndex = -1;\n\tdialog.style.setProperty(\"outline\", \"none\");\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 { button: copy, reset: resetCopy } = copyButton(\n\t\tdoc,\n\t\t\"address\",\n\t\t() => address.value,\n\t\t() => address.select(),\n\t);\n\tcopy.className = \"tab-mcp-address-copy\";\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\tcode.style.setProperty(\"font-family\", \"var(--tab-mcp-mono, monospace)\");\n\t// One click selects the whole code; it stays plain, selectable text.\n\tcode.style.setProperty(\"user-select\", \"all\");\n\tcode.style.setProperty(\"-webkit-user-select\", \"all\");\n\t// Reads the code shown at click time, so a rotated code is copied as shown.\n\tconst { button: copyCode, reset: resetCopyCode } = copyButton(\n\t\tdoc,\n\t\t\"code\",\n\t\t() => code.textContent ?? \"\",\n\t\t() => doc.getSelection()?.selectAllChildren(code),\n\t);\n\tcopyCode.className = \"tab-mcp-code-copy\";\n\t// Only the sentence with the code is announced when the code changes,\n\t// not its Copy button's \"Copied\".\n\tconst codeSentence = el(doc, \"span\", {}, \"When asked, enter the code \", code);\n\tcodeSentence.setAttribute(\"aria-live\", \"polite\");\n\tconst codeLine = el(\n\t\tdoc,\n\t\t\"p\",\n\t\t{ className: \"tab-mcp-code\" },\n\t\tcodeSentence,\n\t\t\" \",\n\t\tcopyCode,\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\t// Identity binding: no code, the same account at the AI app's sign-in.\n\tconst signInLine = el(doc, \"p\", {\n\t\tclassName: \"tab-mcp-sign-in\",\n\t\ttext: \"When your AI app asks, sign in with the account you use on this page. No code is needed.\",\n\t});\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\t// Until an app connects in this dialog, closing it is not the next step:\n\t// a small Close at the end, saying what closing does (the code stops, the\n\t// address stays). Once one connects, a prominent Done replaces both.\n\tconst closeNote = el(doc, \"small\", {\n\t\tclassName: \"tab-mcp-close-note\",\n\t\ttext: \"Closing this stops the code. The address stays the same: to connect later, open this again from the page.\",\n\t});\n\tconst close = button(doc, \"Close\", () => dialog.close());\n\tclose.className = \"tab-mcp-close\";\n\tclose.style.setProperty(\"font-size\", \"0.875em\");\n\tconst done = button(doc, \"Done\", () => dialog.close());\n\tdone.className = \"tab-mcp-done\";\n\tdone.style.setProperty(\"font-weight\", \"bold\");\n\tdone.hidden = true;\n\tconst actions = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-actions\" },\n\t\tcloseNote,\n\t\t\" \",\n\t\tclose,\n\t\tdone,\n\t);\n\t// The note on the left, the button at the far right, apart from the code.\n\tactions.style.setProperty(\"display\", \"flex\");\n\tactions.style.setProperty(\"align-items\", \"center\");\n\tactions.style.setProperty(\"justify-content\", \"flex-end\");\n\tactions.style.setProperty(\"gap\", \"0.75rem\");\n\tactions.style.setProperty(\"margin-top\", \"1rem\");\n\tcloseNote.style.setProperty(\"flex\", \"1\");\n\t// An app connected while this dialog is open (since the last new address),\n\t// and still connected: the grants that made it so.\n\tlet paired = false;\n\tconst pairedGrants = new Set<string>();\n\t// The note is about the code: only while one is shown and nothing paired.\n\tconst renderCloseNote = () => {\n\t\tcloseNote.hidden = paired || codeLine.hidden;\n\t};\n\tconst setPaired = (value: boolean) => {\n\t\tpaired = value;\n\t\tif (!paired) pairedGrants.clear();\n\t\tconst focused = doc.activeElement;\n\t\trenderCloseNote();\n\t\tclose.hidden = paired;\n\t\tdone.hidden = !paired;\n\t\t// Focus never stays on a control that was just hidden.\n\t\tif (paired && focused === close) done.focus();\n\t\tif (!paired && focused === done) close.focus();\n\t};\n\t// The visible button that closes the dialog.\n\tconst closer = () => (paired ? done : close);\n\n\tdialog.append(\n\t\tstatus,\n\t\taddressBox,\n\t\tconfirmBox,\n\t\tcodeLine,\n\t\tsignInLine,\n\t\thelp,\n\t\tapps,\n\t\tactions,\n\t);\n\taddressBox.hidden = true;\n\tcodeLine.hidden = true;\n\tsignInLine.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// The apps are disconnected: the next one has to pair again.\n\t\tsetPaired(false);\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\tcopy.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\tcloser().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\tresetCopy();\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\t// Opened before the session was known: start at the address's Copy.\n\t\tif (doc.activeElement === dialog) copy.focus();\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\tconst oidc = mcp.session?.pairing === \"oidc\";\n\t\t// A new code is not copied yet.\n\t\tif (code.textContent !== (current?.code ?? \"\")) resetCopyCode();\n\t\tcode.textContent = current?.code ?? \"\";\n\t\tcodeLine.hidden = oidc || current === undefined;\n\t\tsignInLine.hidden = !oidc;\n\t\trenderCloseNote();\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\t// Grants that come with a (new) session were there before; only the ones\n\t// added during a session are new connections.\n\tlet session = mcp.session;\n\tconst renderGrants = () => {\n\t\tif (mcp.session !== session) {\n\t\t\tsession = mcp.session;\n\t\t\tfor (const grant of mcp.grants) known.add(grant.grantId);\n\t\t}\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\tpairedGrants.add(grant.grantId);\n\t\t\tif (!paired) setPaired(true);\n\t\t}\n\t\t// The app that connected here is gone again (Disconnect, or revoked):\n\t\t// back to Close and the note, the code still runs.\n\t\tif (paired && !mcp.grants.some((g) => pairedGrants.has(g.grantId))) {\n\t\t\tsetPaired(false);\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\trenderCode();\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\t// Start at the address's Copy; until the address is there, at the\n\t\t// dialog itself (its title is read out), not at Close.\n\t\tif (!addressBox.hidden) copy.focus();\n\t\telse dialog.focus();\n\t});\n}\n"
|
|
6
|
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