@ractive-ch/tab-mcp-client 0.20.0 → 0.21.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +156 -58
  3. package/cdn/confirm-xgm1ymd0.min.js +4 -0
  4. package/cdn/confirm-xgm1ymd0.min.js.map +10 -0
  5. package/cdn/{connect-my0pbqd7.min.js → connect-3reh9k1f.min.js} +4 -4
  6. package/cdn/{connect-my0pbqd7.min.js.map → connect-3reh9k1f.min.js.map} +4 -4
  7. package/cdn/connection-cxgns38v.min.js +17 -0
  8. package/cdn/{connection-5x2krvfs.min.js.map → connection-cxgns38v.min.js.map} +5 -5
  9. package/cdn/strings.min.js +1 -1
  10. package/cdn/tab-mcp-client-gdj1e1wh.min.js +5 -0
  11. package/cdn/tab-mcp-client-gdj1e1wh.min.js.map +11 -0
  12. package/cdn/{tab-mcp-client-8r6h3wza.min.js → tab-mcp-client-yjcmhpdf.min.js} +5 -5
  13. package/cdn/tab-mcp-client-yjcmhpdf.min.js.map +11 -0
  14. package/cdn/tab-mcp-client.min.js +3 -3
  15. package/cdn/tab-mcp-client.min.js.map +4 -4
  16. package/cdn/webmcp-8xby3trn.min.js +4 -0
  17. package/cdn/{webmcp-ny13npet.min.js.map → webmcp-8xby3trn.min.js.map} +3 -3
  18. package/command.d.ts +9 -3
  19. package/{confirm-hymzwx3b.js → confirm-7de6dvpb.js} +11 -6
  20. package/confirm-7de6dvpb.js.map +10 -0
  21. package/confirm.d.ts +10 -5
  22. package/{connect-fhtjdmf3.js → connect-bc628ax6.js} +4 -4
  23. package/{connection-krd3ncrn.js → connection-arq7qm7b.js} +26 -11
  24. package/connection-arq7qm7b.js.map +16 -0
  25. package/connection.d.ts +8 -3
  26. package/dialog.d.ts +2 -2
  27. package/{index-7qqhn3zv.js → index-bt1rkngm.js} +3 -5
  28. package/index-bt1rkngm.js.map +10 -0
  29. package/{index-00p8b969.js → index-erm4h3sn.js} +2 -3
  30. package/index-erm4h3sn.js.map +11 -0
  31. package/{index-1tssct09.js → index-xx4gmtk5.js} +6 -4
  32. package/index-xx4gmtk5.js.map +11 -0
  33. package/index.js +15 -8
  34. package/index.js.map +4 -4
  35. package/internal.d.ts +7 -3
  36. package/mcp.d.ts +12 -5
  37. package/package.json +1 -1
  38. package/react.js +9 -5
  39. package/react.js.map +3 -3
  40. package/secret.d.ts +2 -1
  41. package/setup.d.ts +5 -5
  42. package/setup.js +2 -2
  43. package/skill/SKILL.md +476 -0
  44. package/skill/references/react.md +59 -0
  45. package/skill/references/sign-in.md +28 -0
  46. package/strings.d.ts +0 -1
  47. package/strings.js +1 -1
  48. package/tab-mcp.d.ts +2 -2
  49. package/types.d.ts +40 -18
  50. package/{webmcp-acj1tef8.js → webmcp-gw6rrbnh.js} +24 -3
  51. package/{webmcp-acj1tef8.js.map → webmcp-gw6rrbnh.js.map} +3 -3
  52. package/webmcp.d.ts +11 -4
  53. package/cdn/confirm-ba3dkf9p.min.js +0 -4
  54. package/cdn/confirm-ba3dkf9p.min.js.map +0 -10
  55. package/cdn/connection-5x2krvfs.min.js +0 -17
  56. package/cdn/tab-mcp-client-8r6h3wza.min.js.map +0 -11
  57. package/cdn/tab-mcp-client-nnxcwrxp.min.js +0 -5
  58. package/cdn/tab-mcp-client-nnxcwrxp.min.js.map +0 -11
  59. package/cdn/webmcp-ny13npet.min.js +0 -4
  60. package/confirm-hymzwx3b.js.map +0 -10
  61. package/connection-krd3ncrn.js.map +0 -16
  62. package/index-00p8b969.js.map +0 -11
  63. package/index-1tssct09.js.map +0 -11
  64. package/index-7qqhn3zv.js.map +0 -10
  65. /package/{connect-fhtjdmf3.js.map → connect-bc628ax6.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,81 @@ the Git tag `client-v<version>`. The format follows
6
6
  [Semantic Versioning](https://semver.org/). The relay has its own
7
7
  [changelog](https://github.com/ractive/tab-mcp/blob/main/packages/tab-mcp/CHANGELOG.md).
8
8
 
9
+ ## [0.21.0-rc.2][client-0.21.0-rc.2] - 2026-11-22
10
+
11
+ ### Breaking
12
+
13
+ - **The library no longer asks a WebMCP call that the tab-mcp browser extension did
14
+ not vouch for** (DEC-215). Its confirmation dialog is never shown for such a call: a
15
+ tool that asks (`consequentialHint`, or only `destructiveHint`) runs, unless the
16
+ page's `onConfirm` refuses it. The tool is still registered with
17
+ `consequentialHint: true`, so that a caller that heeds the hint asks its user. Calls of
18
+ AI apps through the relay or a port, and calls the extension vouched for, are
19
+ unchanged.
20
+ - **Who loses the dialog.** Every unvouched WebMCP call, and the page cannot tell their
21
+ kinds apart: an agent in the browser that drives the tab (it clicked "Allow once"
22
+ itself, after waiting most of a minute for the dialog, so the dialog did not check
23
+ it); another extension that passes on calls of an AI app outside the browser; and a
24
+ document of an origin the page named in `exposedTo` (Chrome 156 lets it list and run
25
+ the tool). The last two cannot click in the page: for them the dialog was a real
26
+ check, and now only the calling extension's own question, if it has one, or the
27
+ page's `onConfirm` stands between them and the tool.
28
+ - **What a page has to do:** nothing to get the new behaviour. A page with a tool that
29
+ must not run on an unvouched WebMCP caller's word either decides in `onConfirm`
30
+ (`request.client.kind === "webmcp"`; refuse, or apply a rule of your own, without
31
+ showing anything an agent could click), keeps the tool from WebMCP with
32
+ `callers: ["relay", "local"]`, or leaves `exposedTo` off it. Search your tool
33
+ descriptions and server instructions for "the page asks" (or similar) and remove the
34
+ promise of a question: an agent told that the page asks may click the page's own
35
+ buttons instead of calling the tool.
36
+ - `TabMcp.confirmInPage()` and the confirmation chunk's `confirmInPage()` resolve `true`
37
+ for a WebMCP call without showing anything, so an `onConfirm` that hands such a call
38
+ to them, as React's `TabMcpProvider` does without a handler of the page, does what the
39
+ library does without `onConfirm`. The confirmation's chunk is not loaded for such a
40
+ call.
41
+ - `trustExtension: false` now treats a vouched call as any other WebMCP call: `onConfirm`
42
+ decides, without one it runs.
43
+ - **`ui.strings.clientWebMcp` is removed** ("An agent in this browser"): no dialog names
44
+ this caller any more. A page's own text under that key is no longer used, as any
45
+ unknown key (the type check flags it in an object literal); remove it.
46
+
47
+ ### Added
48
+
49
+ - **A console warning for a tool that asks with `exposedTo`** (DEC-215): with
50
+ `webmcp: true`, a tool marked `consequentialHint` (or only `destructiveHint`) whose
51
+ `exposedTo` names other origins, on a page without `onConfirm` (in React: the
52
+ provider without one), is warned about once per tool, when the browser accepted its
53
+ registration (an `onConfirm` removed later is not caught). Documents of those origins can
54
+ call it through WebMCP, and the library no longer asks them. Refuse such calls in
55
+ `onConfirm`, or leave `exposedTo` off.
56
+ - The agent skill ships in the package as `skill/SKILL.md` (with `skill/references/`),
57
+ written for this version (DEC-216). With a coding agent, install the package and tell
58
+ it: "Read node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md and add tab-mcp to
59
+ this app." Its links point to the README, CHANGELOG and declarations beside it.
60
+
61
+ ### Fixed
62
+
63
+ - The validator that `connect()` loads checks `outputSchema` as it checks `inputSchema`,
64
+ as the README said it did: an output schema it cannot use (a `$ref` next to a nested
65
+ `$id`, which does not resolve, or a duplicate `$id`) makes `registerTool` throw, and a
66
+ tool registered before with one is unregistered, with the reason in the event `error`
67
+ ("the outputSchema of …"). Until now such a tool was listed, and an AI app whose
68
+ validator compiles output schemas (the MCP SDK's client) could not use it. Results
69
+ are still not checked against the output schema.
70
+ - The setup commands (`./setup`, "How do I add it?") put an address with `[`, `]` or `~`
71
+ in double quotes (DEC-217): zsh refused `claude mcp add --transport http test
72
+ http://[::1]:8080/s/test/mcp` with "no matches found" (`~` with `extendedglob`). POSIX
73
+ shells, zsh, fish, PowerShell and cmd.exe read the quoted address the same. An address
74
+ with any other character than letters, digits and `. : [ ] / _ ~ -` still gets the
75
+ steps without a command.
76
+ - `disconnectAll()` with a `storage` that reads but cannot be written (full, blocked, or
77
+ a custom one whose writes fail) connected again with the old secret: the new one was
78
+ kept only in memory, and the next read of storage returned the old one over it. The
79
+ grants were revoked, but the secret was not changed, so whoever held the old one could
80
+ still take the page's place. The new secret now stays in use until the page is
81
+ reloaded, and storage is not read over it until a write succeeds (code review
82
+ 2026-11-22, CR-02).
83
+
9
84
  ## [0.20.0][client-0.20.0] - 2026-11-22
10
85
 
11
86
  ### Breaking
@@ -1095,6 +1170,7 @@ First alpha of the browser library, on the npm dist-tag `alpha`.
1095
1170
  `<script type="module">` under `@ractive-ch/tab-mcp-client/cdn`.
1096
1171
  - The connect dialog shows the pairing code from the relay.
1097
1172
 
1173
+ [client-0.21.0-rc.2]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.21.0-rc.2
1098
1174
  [client-0.20.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.20.0
1099
1175
  [client-0.19.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.19.0
1100
1176
  [client-0.18.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.18.1
package/README.md CHANGED
@@ -17,9 +17,33 @@ How the library, the relay and the tab-mcp browser extension fit together, with
17
17
  picture:
18
18
  [How the parts fit together](https://github.com/ractive/tab-mcp#how-the-parts-fit-together).
19
19
 
20
- **Status: 0.20.0.** Until 1.0, a new minor version can still change the API. Which AI apps
20
+ **Status: 0.21.0-rc.2.** Until 1.0, a new minor version can still change the API. Which AI apps
21
21
  work is listed in [compatibility](https://github.com/ractive/tab-mcp/blob/main/docs/compatibility.md).
22
22
 
23
+ ## With a coding agent
24
+
25
+ You only need the install:
26
+
27
+ ```sh
28
+ npm install @ractive-ch/tab-mcp-client
29
+ ```
30
+
31
+ Then tell your coding agent (Claude Code, Codex or another):
32
+
33
+ ```text
34
+ Read node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md and add tab-mcp to this app.
35
+ ```
36
+
37
+ Then ask for what you want: which features of the page AI apps may use, and which of them
38
+ ask first. The guide is an [Agent Skill](https://agentskills.io/specification) written for
39
+ the version in your `node_modules`, and it links this README for the details. No such
40
+ file means the installed version is older than this guide: update the package.
41
+
42
+ The path is relative to the folder of the app that installed the package (in a
43
+ monorepo, that app's folder, where its own `node_modules` is), the same with npm, Bun,
44
+ pnpm and Yarn's `node_modules` linker. Yarn Plug'n'Play keeps packages in zip files: run `yarn unplug @ractive-ch/tab-mcp-client`
45
+ and give the agent the `skill/SKILL.md` under `.yarn/unplugged/`.
46
+
23
47
  ## You need a relay
24
48
 
25
49
  The page talks to a tab-mcp relay, which only accepts pages from the origins its operator
@@ -33,7 +57,7 @@ docker run --rm -p 8080:8080 \
33
57
  -e TAB_MCP_PUBLIC_URL=http://localhost:8080 \
34
58
  -e TAB_MCP_ALLOWED_ORIGINS=http://localhost:3000 \
35
59
  -e TAB_MCP_STORE=memory \
36
- ractive/tab-mcp:0.13.0
60
+ ractive/tab-mcp:0.13.2-rc.1
37
61
  ```
38
62
 
39
63
  For production, see
@@ -52,7 +76,7 @@ Or without a bundler, from a CDN as an ES module:
52
76
 
53
77
  ```html
54
78
  <script type="module">
55
- import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.20.0/cdn/tab-mcp-client.min.js";
79
+ import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.2/cdn/tab-mcp-client.min.js";
56
80
  </script>
57
81
  ```
58
82
 
@@ -123,7 +147,7 @@ WebMCP draft's `registerTool` (`callers`: [which callers see a tool](#which-call
123
147
  `$ref` next to a nested `$id`) is unregistered, with the reason in the event `error`;
124
148
  - `outputSchema` (optional): a JSON Schema with `"type": "object"` for the result, listed
125
149
  to AI apps (`tools/list`) and passed on to WebMCP. `registerTool` checks it as it checks
126
- `inputSchema` (an AI app compiles it when it lists the tools, and one that does not
150
+ `inputSchema`, also with the validator once `connect()` has loaded it (an AI app compiles it when it lists the tools, and one that does not
127
151
  compile can cost the whole list), but results are not checked against it. An AI app
128
152
  expects every result of such a tool to carry
129
153
  `structuredContent` that matches it (the MCP SDK's client refuses one without), so
@@ -134,7 +158,8 @@ WebMCP draft's `registerTool` (`callers`: [which callers see a tool](#which-call
134
158
  an AI app through the relay (`id`, verified `host`, declared `name`),
135
159
  `{ kind: "local", id, name? }` for the site's own assistant on a served port, with the
136
160
  `id` and `name` the page gave `serve` ([Your own assistant](#your-own-assistant-on-the-page)),
137
- or `{ kind: "webmcp" }` for an agent in the browser ([WebMCP](#webmcp)), of which nothing
161
+ or `{ kind: "webmcp" }` for a WebMCP caller ([WebMCP](#webmcp): an agent in the
162
+ browser, another extension, or a document of an `exposedTo` origin), of which nothing
138
163
  more is known (unless the tab-mcp browser extension vouched for the call: then
139
164
  `{ kind: "webmcp", via: "tab-mcp-extension", name, host }`, [with the
140
165
  extension](#with-the-tab-mcp-browser-extension)). Check `client.kind` before you read `host`. Return a
@@ -160,13 +185,16 @@ written for the native API behaves differently here:
160
185
  draft rejects the first two with an `InvalidStateError`. A duplicate name is an
161
186
  `InvalidStateError` in both.
162
187
  - `inputSchema` and `outputSchema` need `"type": "object"`, as MCP does; the draft takes
163
- any object. The library also checks `inputSchema`'s patterns and `$ref`s (above).
188
+ any object. The library also checks the patterns and `$ref`s of both (above).
164
189
  - The library checks the arguments against `inputSchema` before `execute` runs; the
165
190
  draft leaves that to the page.
166
191
  - `execute` may return an MCP result; through WebMCP it goes out as its
167
192
  `structuredContent` or its text ([WebMCP](#webmcp)).
168
193
  - `exposedTo` matters only for WebMCP: it is passed on to the native registration of a
169
- mirrored tool, and AI apps never see it.
194
+ mirrored tool, and AI apps never see it. A document of a listed origin can run the
195
+ tool, and the library does not ask it ([who asks](#who-asks-before-a-tool-that-asks-runs)).
196
+ A tool that asks, with an `exposedTo` naming other origins, on a page without
197
+ `onConfirm` gets a console warning once, when it is registered with WebMCP.
170
198
 
171
199
  An already aborted `signal` rejects with its reason and registers nothing, as in the
172
200
  draft.
@@ -196,27 +224,75 @@ Chrome has WebMCP for sites in its
196
224
  `webmcp: true` does nothing. Each `new TabMcp` looks for WebMCP when it is made, so a
197
225
  trial token that a script adds later counts for a `TabMcp` made after it.
198
226
 
199
- - Every tool goes there, tools marked `consequentialHint` or MCP's `destructiveHint`
200
- included, and they ask every WebMCP call (below). A WebMCP call asks by
201
- `consequentialHint ?? destructiveHint`, so a tool marked only `destructiveHint` asks
202
- there too, though it does not ask an AI app (its own client sees the hint). `callers` without
203
- `"webmcp"` keeps a tool out of WebMCP
204
- ([which callers see a tool](#which-callers-see-a-tool)). Until 0.20 such tools were
205
- left out unless `callers` listed `"webmcp"`; an agent that found no tool to delete with
206
- then clicked the page's own Delete buttons, with no question at all (DEC-209). An agent
207
- that drives the tab can click Allow in the page's dialog too, so a tool the page wants
208
- kept from agents in the browser leaves `"webmcp"` out of `callers`. A tool marked only
209
- `destructiveHint: true` is registered natively with `consequentialHint: true`, since
210
- WebMCP has no `destructiveHint` (DEC-022 maps the other way).
227
+ #### Who asks before a tool that asks runs
228
+
229
+ A "tool that asks" is one marked `consequentialHint` (for WebMCP calls also one marked
230
+ only `destructiveHint`). Whether the user is asked before it runs, and by whom, depends
231
+ on the caller (DEC-215):
232
+
233
+ - an AI app through the relay, or the site's own assistant on a served port: the page
234
+ asks the user (`onConfirm`, else the library's dialog), unless the user already
235
+ allowed that tool for that AI app ("Always allow", [below](#tools-that-run-without-asking));
236
+ - a WebMCP call the tab-mcp browser extension vouched for: the extension asked the user;
237
+ - any other WebMCP call: the library asks no one; only the page's `onConfirm`, in code,
238
+ or the caller itself can.
239
+
240
+ The table has the details. Every WebMCP call that the
241
+ tab-mcp browser extension did not vouch for reaches the page as
242
+ `client: { kind: "webmcp" }`, whoever made it: the page cannot tell the last three rows
243
+ apart.
244
+
245
+ | Caller | Can it click in the tab? | Who asks |
246
+ |---|---|---|
247
+ | An AI app through the relay | no | the page: `onConfirm`, else the library's dialog |
248
+ | An AI app through the tab-mcp browser extension (a WebMCP call the extension vouched for) | no | the extension, in its side panel; the page does not ask again |
249
+ | An agent in the browser that drives the tab (unvouched WebMCP call) | yes | the agent, in its own chat, if it heeds `consequentialHint`; the page's `onConfirm` if it has one; never the library's dialog |
250
+ | Another extension that passes on calls of an AI app outside the browser (unvouched WebMCP call) | no, unless that extension lets it | that extension, if it asks (as the tab-mcp browser extension does in its side panel); the page's `onConfirm` if it has one; never the library's dialog |
251
+ | A document of another origin that the page named in `exposedTo` (unvouched WebMCP call) | no, not in the page | only the page's `onConfirm`, if it has one; never the library's dialog |
252
+
253
+ The library shows no question for an unvouched WebMCP call: without `onConfirm` a tool
254
+ that asks runs. For an agent that drives the tab the dialog was no check (with ChatGPT's
255
+ browser the call waited most of a minute, then the agent clicked "Allow once" itself).
256
+ For the other two it was one, and it is gone: whether the user is asked then depends on
257
+ the calling extension or the other origin's script, which the page does not know. A
258
+ page with a tool that must not run on such a caller's word decides in code or keeps the
259
+ tool away:
260
+
261
+ - **`onConfirm`** gets the call with `request.client.kind === "webmcp"` (no `via`). Decide
262
+ there without showing anything an agent could click: refuse every such call, or apply
263
+ a rule of your own (arguments, the time of day, what the user is signed in as). A
264
+ question of your own in the page is no better than the library's against an agent
265
+ that drives the tab.
266
+ - **`callers`** without `"webmcp"` keeps the tool out of WebMCP altogether
267
+ ([which callers see a tool](#which-callers-see-a-tool)), for example
268
+ `{ callers: ["relay", "local"] }`.
269
+ - **`exposedTo`**: leave it off a tool that asks unless the listed origins may run it
270
+ unasked. A document of such an origin lists and runs the tool (Chrome 156). With
271
+ `webmcp: true` the library warns in the console, once per tool, about a tool that asks
272
+ whose `exposedTo` names other origins on a page without `onConfirm` (in React: the
273
+ provider without one), when the browser accepted the registration. It is decided then:
274
+ an `onConfirm` removed later is not caught.
275
+
276
+ None of these stops an agent that drives the tab from clicking the page's own controls,
277
+ which ask nothing either.
278
+
279
+ - Every tool goes to WebMCP, tools marked `consequentialHint` or MCP's `destructiveHint`
280
+ included. A tool marked only `destructiveHint: true` is registered natively with
281
+ `consequentialHint: true`, since WebMCP has no `destructiveHint` (DEC-022 maps the other
282
+ way), and `onConfirm` gets its WebMCP calls by `consequentialHint ?? destructiveHint`,
283
+ though an AI app's call of it does not ask (its own client sees the hint). Until 0.20
284
+ such tools were left out unless `callers` listed `"webmcp"`; an agent that found no tool
285
+ to delete with then clicked the page's own Delete buttons (DEC-209). 0.20 showed the
286
+ library's dialog for every unvouched WebMCP call; since 0.21 it shows none (DEC-215).
211
287
  - The native registration gets the WebMCP fields: `name`, `title`, `description`,
212
288
  `inputSchema`, `outputSchema` and the WebMCP hints, and `exposedTo` from
213
289
  `registerTool`'s options (origins of other documents in the tab that may see the
214
290
  tool; the browser checks it, and an invalid list only warns, as below).
215
291
  - A WebMCP call takes the same path as an AI app's: the arguments are checked against
216
- `inputSchema` (Chrome does not check them), a consequential tool asks (`onConfirm`, or
217
- the library's dialog, which names the caller "An agent in this browser"), and
218
- `toolcall` and `toolcallend` fire with `client: { kind: "webmcp" }`. "Always allow" is
219
- never offered or applied for these calls: there is no identity to remember it for.
292
+ `inputSchema` (Chrome does not check them), a tool that asks goes to `onConfirm` if
293
+ the page has one (above), and `toolcall` and `toolcallend` fire with
294
+ `client: { kind: "webmcp" }`, so a page's record of calls still lists it ("an agent
295
+ in this browser", say). "Always allow" and the switches never apply to these calls.
220
296
  - The call resolves with what `execute` returned, which the browser hands the agent as
221
297
  JSON text. An MCP result goes out as its `structuredContent` if it has one, else as
222
298
  its text blocks, one per line, each other block (an image, a resource) as a line that
@@ -225,9 +301,9 @@ trial token that a script adds later counts for a `TabMcp` made after it.
225
301
  serialize, and an empty MCP result resolve as `"Done."`.
226
302
  - A failure resolves too, as
227
303
  `{ error: "<message>" }`, so that the agent can read it: invalid arguments (the same
228
- message as for an AI app), "Don't allow" (`The user did not allow <tool> to run.`), a
229
- question not answered (`The user did not answer whether <tool> may run.`), a tool that
230
- is gone, an error thrown by `execute` (its message) and an MCP result with
304
+ message as for an AI app), a refusal of `onConfirm` (`The user did not allow <tool> to
305
+ run.`), its `"unanswered"` (`The user did not answer whether <tool> may run.`), a tool
306
+ that is gone, an error thrown by `execute` (its message) and an MCP result with
231
307
  `isError: true` (its text). A rejection would not help: the draft hands the agent
232
308
  every rejection as an `OperationError` without its message, on purpose (a failure the
233
309
  agent should read belongs in the result), and Chrome 156 as `UnknownError`. Two cases still
@@ -279,8 +355,8 @@ that an AI app reaches it through the extension:
279
355
  - **A vouched call.** Right before the extension runs a tool the user allowed there
280
356
  (asked and allowed, or covered by its "Always allow" switch), it tells the page the
281
357
  tool, the exact arguments and the AI app. The next WebMCP call of that tool with equal
282
- arguments (key order aside) within 2 seconds runs without the page's question and
283
- without `onConfirm`: the user just allowed exactly that call. Its caller in
358
+ arguments (key order aside) within 2 seconds runs without `onConfirm`: the user just
359
+ allowed exactly that call. Its caller in
284
360
  `execute`, `toolcall` and `toolcallend` is
285
361
  `{ kind: "webmcp", via: "tab-mcp-extension", name, host }`, so an activity view can say
286
362
  "Claude (claude.ai) through the tab-mcp browser extension". A vouch is used once and
@@ -289,9 +365,10 @@ that an AI app reaches it through the extension:
289
365
  events fire, a tool that is gone does not run. Once the extension's call ended or
290
366
  failed, the extension withdraws the vouch, and one still unused (the call never
291
367
  reached the page) is dropped. Any call that matches no vouch (an agent in the
292
- browser, a call after the 2 seconds) is asked as before.
293
- - **`trustExtension: false`** keeps asking every WebMCP call, vouched or not, for a site
294
- that insists on its own question; `extension` is still reported.
368
+ browser, another extension, an `exposedTo` origin, a call after the 2 seconds) is an
369
+ unvouched WebMCP call: `onConfirm` decides, without one it runs.
370
+ - **`trustExtension: false`** treats a vouched call as any other WebMCP call, for a site
371
+ whose `onConfirm` insists on its own rule; `extension` is still reported.
295
372
  - **What the page tells the extension:** the library's version, the app id and the AI
296
373
  apps connected to the page directly (`name`, `host`, as `grants` has them; at most
297
374
  64), again on
@@ -304,9 +381,9 @@ that an AI app reaches it through the extension:
304
381
  `src/handshake.ts`). Script in the page could fake the extension, but script in the
305
382
  page can already skip any question of the page: this is a convenience between two
306
383
  parts the user trusts, not a security boundary. Only the top frame takes part.
307
- - Old and new mix: an extension that does not know the handshake says nothing, and the
308
- page asks as before; the extension says nothing to a page that did not announce the
309
- library.
384
+ - Old and new mix: an extension that does not know the handshake says nothing, and its
385
+ calls are unvouched WebMCP calls, which the library does not ask; the extension says nothing to a page that
386
+ did not announce the library.
310
387
 
311
388
  A page that registers its WebMCP tools itself, without the library's mirror, can take
312
389
  part the same way: answer the events as `src/handshake.ts` does, skip its own
@@ -465,7 +542,8 @@ a read-only tool such as `get_page_context` (`readOnlyHint: true`, perhaps
465
542
 
466
543
  A consequential tool asks before every call. For the calls through one port, `serve`'s
467
544
  `onConfirm` asks instead of the page's `onConfirm` and the library's dialog; calls through
468
- the relay and WebMCP keep those. That is the recommended way for a site's own assistant:
545
+ the relay keep those, and WebMCP calls the page's `onConfirm` ([who asks](#who-asks-before-a-tool-that-asks-runs)).
546
+ That is the recommended way for a site's own assistant:
469
547
  the question appears where the user talks to the assistant, in the user's language. It
470
548
  answers as the page's `onConfirm` does: `true`, `false` or `"unanswered"`; anything else,
471
549
  and a throw, is a refusal. `request.signal` aborts when the call is cancelled, takes longer
@@ -487,8 +565,11 @@ between that text and the tool.
487
565
 
488
566
  `registerTool(tool, { callers })` lists the callers that see a tool: `"relay"` (AI apps
489
567
  through the relay), `"local"` (a served port) and `"webmcp"` (agents in the browser),
490
- by default all of them. A tool that asks asks each of them; whether a tool deletes
491
- something is no reason to hide it from a caller. `callers` is for who may see it at all.
568
+ by default all of them. A tool that asks asks AI apps and the site's own assistant; a
569
+ WebMCP call the tab-mcp browser extension did not vouch for is not shown the library's
570
+ dialog
571
+ ([who asks](#who-asks-before-a-tool-that-asks-runs)). `callers` is for who may see a tool
572
+ at all.
492
573
  For a caller that is not listed the tool does not exist: `tools/list` leaves it out,
493
574
  `notifications/tools/list_changed` does not fire for it, and a call gets the same error
494
575
  as a call of an unknown tool. For example:
@@ -499,6 +580,9 @@ as a call of an unknown tool. For example:
499
580
  - `{ callers: ["relay"] }`: a tool that needs to know which AI app calls (a paired,
500
581
  named app; an audit line, "Always allow" remembered per app), which an anonymous
501
582
  WebMCP caller is not.
583
+ - `{ callers: ["relay", "local"] }`: kept from WebMCP, for a tool that must not run on
584
+ the word of an unvouched WebMCP caller (the library does not ask one; an `onConfirm`
585
+ that refuses them does the same for the call but still lists the tool).
502
586
  - `{ callers: ["relay", "webmcp"] }`: kept from the port, when the page serves it to a
503
587
  chat frame of another origin.
504
588
 
@@ -552,9 +636,11 @@ instructions, as the recipe does with a delimited block.
552
636
  ### Consequential tools
553
637
 
554
638
  Mark tools that change or delete something with `consequentialHint: true`. The page then
555
- asks the user before every call ("Don't allow" or "Allow once"), showing the AI app and the
556
- arguments. A refusal reaches the AI app as an error result, and so does a call whose tool
557
- was removed while the user was asked.
639
+ asks the user before every call of an AI app ("Don't allow" or "Allow once"), showing the
640
+ AI app and the arguments. A refusal reaches the AI app as an error result, and so does a
641
+ call whose tool was removed while the user was asked. A WebMCP call the tab-mcp browser
642
+ extension did not vouch for is not shown this dialog, whoever made it; see
643
+ [who asks](#who-asks-before-a-tool-that-asks-runs).
558
644
 
559
645
  `alwaysAllow: true` adds "Always allow", which lets that tool run without asking for that
560
646
  AI app from then on; see [Tools that run without asking](#tools-that-run-without-asking).
@@ -600,8 +686,11 @@ const mcp = new TabMcp({
600
686
  server: { name: "calculator", version: "1.0.0" },
601
687
  onConfirm: (request) => {
602
688
  const { tool, arguments: args, client, signal } = request;
603
- // An agent in the browser (`webmcp`), or the site's own assistant (`local`) on a
604
- // port served without its own onConfirm: the library's own dialog.
689
+ // An unvouched WebMCP call (an agent that may drive the tab, another
690
+ // extension, an exposedTo origin): decide in code, show nothing.
691
+ if (client.kind === "webmcp") return false;
692
+ // The site's own assistant (`local`) on a port served without its own
693
+ // onConfirm: the library's own dialog.
605
694
  if (client.kind !== "relay") return mcp.confirmInPage(request);
606
695
  const name = client.name ? escapeInvisible(client.name) : undefined;
607
696
  const app = name ? `${name} (${client.host})` : client.host;
@@ -618,7 +707,8 @@ outcome `unanswered`. Any other value, and a throw, is a refusal.
618
707
 
619
708
  `mcp.confirmInPage(request, { document })` is the library's own dialog, for an
620
709
  `onConfirm` that handles only some calls itself (`document` defaults to the global one).
621
- A call the user allowed for its AI app resolves `true` without the dialog.
710
+ A call the user allowed for its AI app resolves `true` without the dialog, and so does
711
+ every WebMCP call: handed one, it does what the library does without `onConfirm`.
622
712
 
623
713
  An app that shows the dialog for an MCP endpoint of its own, without a `TabMcp` (a
624
714
  desktop app, say), can load the built confirmation chunk (`confirm-<hash>.js`; its name
@@ -630,15 +720,16 @@ grant is in `grants`, also without an event. `options` are
630
720
  `alwaysAllow` (`true` or `"until-reload"` offers "Allow until reload" for that call;
631
721
  without it nothing is allowed or kept), `ui` (the dialog's texts) and `allowDelayMs`
632
722
  (tests only). Such allowances live in memory, for the host's grants, until a reload; only
633
- a client with `kind: "relay"` can be allowed.
723
+ a client with `kind: "relay"` can be allowed. A client with `kind: "webmcp"` resolves
724
+ `true` without the dialog.
634
725
 
635
726
  ### Tools that run without asking
636
727
 
637
728
  The user can let a consequential tool run without asking, for one connected AI app: one
638
729
  tool at a time ("Always allow" this tool), or everything ("Always allow everything"). An allowed call runs at once, with the library's dialog and with your own
639
- `onConfirm` alike: neither is asked. Only AI apps through the relay can be allowed; an
640
- agent in the browser (WebMCP) and a served port have no grant to remember it for and are
641
- always asked.
730
+ `onConfirm` alike: neither is asked. Only AI apps through the relay can be allowed; a
731
+ served port has no grant to remember it for and is always asked. An unvouched WebMCP
732
+ call is not asked by the library at all ([who asks](#who-asks-before-a-tool-that-asks-runs)).
642
733
 
643
734
  The option `alwaysAllow` decides what the library's dialogs offer:
644
735
 
@@ -725,8 +816,8 @@ mcp.addEventListener("grantschange", drawSwitches);
725
816
  that does not import it loads nothing of it. Take both from the same version:
726
817
 
727
818
  ```js
728
- import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.20.0/cdn/tab-mcp-client.min.js";
729
- import { allowedTools } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.20.0/cdn/allowed.min.js";
819
+ import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.2/cdn/tab-mcp-client.min.js";
820
+ import { allowedTools } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.2/cdn/allowed.min.js";
730
821
  ```
731
822
 
732
823
  **The risk.** An allowance outlives the user's attention: for up to the grant's 90 days,
@@ -759,8 +850,9 @@ not seen, and ones the page adds later. The relay cannot help: its one OAuth sco
759
850
  server by a label made from `server.name` that every shell reads as one plain word:
760
851
  lower case, letters without marks, each run of other characters as `-`, at most 40
761
852
  characters, `tools` if nothing is left ("Bücher" gives `bucher`). The address goes
762
- into a command only if it has nothing but plain URL characters; otherwise the help
763
- shows the steps without commands. Each entry ends with the step that starts the
853
+ into a command only if it has nothing but plain URL characters (in double quotes when
854
+ it has `[`, `]` or `~`, as an IPv6 address does: zsh reads those as patterns);
855
+ otherwise the help shows the steps without commands. Each entry ends with the step that starts the
764
856
  sign-in: `/mcp` and Authenticate in Claude Code, `codex mcp login <name>` as the third
765
857
  line of Codex's command. Codex 0.163 needs its feature `mcp_2026_07_28` for the relay's MCP
766
858
  revision, so its command turns that on first. The steps are the minimum; the link at
@@ -818,8 +910,10 @@ page back: it connects with the stored secret, and the relay revokes every grant
818
910
  for it in the same step (`hello.revokeAll`), whether the page was connected or not.
819
911
  Then it makes the new secret, clears `grants`, and connects with it if the page was
820
912
  connected, connecting or reconnecting (or taken over). A page that never had a secret
821
- makes one without connecting. If the page cannot be taken back (the relay is
822
- unreachable, or someone takes it over again first), it rejects and keeps the old secret,
913
+ makes one without connecting. If storage cannot keep the new secret (full, blocked, or a
914
+ `storage` whose writes fail), the page uses it until it is reloaded and does not read the
915
+ old one over it; after a reload it reads the old one, whose grants were revoked. If the
916
+ page cannot be taken back (the relay is unreachable, or someone takes it over again first), it rejects and keeps the old secret,
823
917
  so calling it again tries again. A second call while it runs returns the same promise;
824
918
  `connect()` meanwhile waits for it and then connects with the new secret. A page with
825
919
  its own UI calls `disconnectAll()` from a click. Connected apps keep working after a reload once the page connects
@@ -981,14 +1075,14 @@ sign in with the account you use on this page" only once it is `bound`. Until th
981
1075
  says what is missing: "Checking your sign-in…" (`pending`), "Sign in to this page first."
982
1076
  (`none`), or that the sign-in was not accepted, with `identityMessage` (`refused`).
983
1077
 
984
- An open dialog counts for 10 minutes (relays after 0.13.0): a sign-in pairs the page
1078
+ An open dialog counts for 10 minutes (relays after 0.13.2-rc.1): a sign-in pairs the page
985
1079
  only until 10 minutes after the last `startPairing()`, which the dialog calls when it
986
1080
  opens. The relay says for how long (`pairing.open`); the library counts that on the
987
1081
  page's own clock from the message's arrival and keeps the end in `pairingUntil` (an ISO
988
1082
  time, event `pairinguntil`), so a page whose clock differs from the relay's still shows
989
1083
  the right moment. `pairingUntil` is `undefined` while pairing is off, from each
990
1084
  `startPairing()` until the relay answers, after the session ended (`disconnect()`,
991
- `disconnectAll()`, a refusal), and with a relay up to 0.13.0. The dialog shows "Your AI
1085
+ `disconnectAll()`, a refusal), and with a relay up to 0.13.2-rc.1. The dialog shows "Your AI
992
1086
  app can connect until 14:32." under the sign-in line and, once that time is up (also
993
1087
  checked when the tab comes back to the front), "The time to connect your AI app is up"
994
1088
  with Continue, which calls `startPairing()` again. Nothing starts the 10 minutes again
@@ -996,7 +1090,7 @@ by itself: not a timer, and not a reconnect the library makes by itself once the
996
1090
  was sent, answered or not (after one, `pairingUntil` is the time of the reconnect, so
997
1091
  the dialog shows Continue). `connect()` from a click while reconnecting ("Connect again")
998
1092
  does ask again; codes always come again after a reconnect. A custom UI does the same:
999
- call `startPairing()` only from the user's click. With a relay up to 0.13.0 an open dialog
1093
+ call `startPairing()` only from the user's click. With a relay up to 0.13.2-rc.1 an open dialog
1000
1094
  counts as long as it is open, and after a reconnect the dialog shows Continue too. A
1001
1095
  sign-in that comes back after the time is up gets the relay's answer that no page is
1002
1096
  connecting with that account; Continue, then Connect again on the relay's page, pairs it.
@@ -1022,7 +1116,7 @@ the session ends after the message was sent and before the relay answered, and w
1022
1116
  or may not have done it, and `grants` says so once the page is connected again. They
1023
1117
  also reject with the relay's refusal of that message, an `Error` whose `code` is
1024
1118
  `store_unavailable` (the relay could not save the change: try again) or `unknown_id`.
1025
- A relay after 0.13.0 names the message it answers (`for`, and `grantId` for a
1119
+ A relay after 0.13.2-rc.1 names the message it answers (`for`, and `grantId` for a
1026
1120
  revocation), so with several revocations pending only the one it answers rejects; an
1027
1121
  older relay's refusal rejects every pending `revoke()` and `signOut()`. When the relay
1028
1122
  does not know a grant the page lists (it expired), the grant leaves `grants` (with
@@ -1514,7 +1608,11 @@ counts as new.
1514
1608
  never by what the page says: give `relayOrigin()` the configured relay's origin,
1515
1609
  exactly, and show the verified host in the question.
1516
1610
  - **The user's Allow.** A code leaves the worker only after a yes to a question that
1517
- names the AI app's verified host, and never "always allow": each pairing page asks.
1611
+ names the AI app's verified host. How to ask is the extension's (`ask`): an `ask`
1612
+ that answers `allow` without asking the user ("always allow" for a host) is only
1613
+ safe for a public DNS name the relay verified, at an AI app that ties each sign-in
1614
+ to the account of the browser that started it, with a limit on such fills and a
1615
+ notice for each; the library enforces none of this.
1518
1616
  The one exception is the one more fill for the same tab and the same relay request
1519
1617
  (next point), which follows that request's yes without a new question;
1520
1618
  `retry: false` turns it off, and then no code leaves without a yes of its own. A
@@ -0,0 +1,4 @@
1
+ import{u}from"./tab-mcp-client-gdj1e1wh.min.js";import{a,r,e,t,s,d,l}from"./tab-mcp-client-yjcmhpdf.min.js";import{o}from"./tab-mcp-client-q758jr4g.min.js";function ee(f){try{return s(JSON.stringify(f,null,2))}catch{return}}var ne=750,te=500,J=new WeakMap;function K(f,n,b={}){if(f.signal.aborted)return Promise.resolve("deny");let p=J.get(n);if(p===void 0)p={shown:!1,waiting:[]},J.set(n,p);let i=p,c=()=>{let h=i.waiting.shift();i.shown=h!==void 0,h?.(),i.changed?.()},D=()=>{try{return ie(f,n,b,i,c)}catch(h){return c(),Promise.reject(h)}};if(!i.shown)return i.shown=!0,D();return new Promise((h)=>{let v=()=>{if(f.signal.removeEventListener("abort",E),b.allowedNow?.()===!0){h("allow"),c();return}h(D())},E=()=>{i.waiting.splice(i.waiting.indexOf(v),1),i.changed?.(),h("deny")};f.signal.addEventListener("abort",E,{once:!0}),i.waiting.push(v),i.changed?.()})}function ie(f,n,b,p,i){let c=b.strings??a(void 0),D=b.allowDelayMs??ne,h=f.tool.title??f.tool.name,v=d(f.client,c),E={tool:h,client:v},{dialog:m,id:L}=l(n,"tab-mcp-confirm",c,...r(n,c.confirmTitle,E)),I=e(n,"p",{className:"tab-mcp-waiting"}),S=()=>{let g=p.waiting.length;I.hidden=g===0,I.textContent=u(c.waiting,g,c)};p.changed=S,S();let z=t(n,c.deny,()=>m.close("deny"),"tab-mcp-deny","primary"),B=(g,j,O)=>{let A=t(n,g,()=>{if(!A.disabled)m.close(j)},O);return A},N=[B(c.allow,"allow","tab-mcp-allow")],W=[],Q=b.alwaysAllow;if(Q===!0||Q==="until-reload"){let g=Q===!0;N.unshift(B(g?c.alwaysAllow:c.allowUntilReload,"always","tab-mcp-always")),W.push(e(n,"p",{className:"tab-mcp-always-note"},...r(n,g?c.alwaysAllowNote:c.allowUntilReloadNote,E)))}let Y=e(n,"div",{className:"tab-mcp-actions"},z,...N.flatMap((g)=>[" ",g])),x=!1,U=!1,R=()=>{for(let g of N)g.disabled=!(x&&U)};R();let M=ee(f.arguments),y=e(n,"pre",{className:"tab-mcp-arguments",id:`${L}-arguments`,text:M??c.argumentsHidden});if(M===void 0)for(let g of[...N,...W])g.hidden=!0;y.dir="ltr",y.style.setProperty("white-space","pre-wrap"),y.style.setProperty("overflow-wrap","anywhere"),y.style.setProperty("max-height","var(--tab-mcp-arguments-height, min(50vh, 24rem))"),y.style.setProperty("overflow","auto"),y.hidden=Object.keys(f.arguments).length===0;let T=e(n,"p",{className:"tab-mcp-scroll-note",text:c.scrollToAllow});T.hidden=!0;let _=e(n,"p",{id:`${L}-who`},...r(n,c.confirmWho,E));m.setAttribute("aria-describedby",M!==void 0&&!y.hidden&&M.length<=te?`${_.id} ${y.id}`:_.id),m.append(_,e(n,"p",{className:"tab-mcp-description",text:f.tool.description}),y,T,Y,...W,I),n.body.append(m);let k=n.defaultView;return new Promise((g,j)=>{let O=()=>m.close("deny");f.signal.addEventListener("abort",O,{once:!0});let A,P,F=()=>{if(P!==void 0&&n.title===P.shown)n.title=P.page;P=void 0},X=()=>{if(n.visibilityState!=="hidden")F();else if(P===void 0)P={page:n.title,shown:`${c.titlePrefix}${n.title}`},n.title=P.shown},C=(w)=>{if(w?.type==="close"&&w.target===m)return;if(X(),clearTimeout(A),A=void 0,x=!1,R(),w?.type==="blur"||n.visibilityState==="hidden"||!n.hasFocus())return;A=setTimeout(()=>{x=!0,R()},D)},H=()=>{if(U)return;if(y.scrollTop+y.clientHeight<y.scrollHeight-2){T.hidden=!1,y.tabIndex=0;return}U=!0,T.hidden=!0,R()},V=(w)=>{if(x)return;let q=w.target?.localName==="button";if(w.key==="Escape"||q&&(w.key==="Enter"||w.key===" "))w.preventDefault()},Z=(w)=>{if(!x)w.preventDefault()};n.addEventListener("visibilitychange",C),n.addEventListener("close",C,!0),k?.addEventListener("focus",C),k?.addEventListener("blur",C),k?.addEventListener("resize",H),y.addEventListener("scroll",H),m.addEventListener("keydown",V),m.addEventListener("keyup",V),m.addEventListener("cancel",Z);let G=()=>{if(clearTimeout(A),F(),n.removeEventListener("visibilitychange",C),n.removeEventListener("close",C,!0),k?.removeEventListener("focus",C),k?.removeEventListener("blur",C),k?.removeEventListener("resize",H),f.signal.removeEventListener("abort",O),m.remove(),p.changed===S)p.changed=void 0};m.addEventListener("close",()=>{let w=m.returnValue;G(),g(w==="allow"||w==="always"?w:"deny"),i()},{once:!0});try{m.showModal()}catch(w){G(),j(w),i();return}z.focus(),C(),H()})}function le(f,n,b,p={}){let{client:i}=n;if(i.kind==="webmcp")return Promise.resolve(!0);let c=a(p.ui),{allowDelayMs:D}=p;if(i.kind!=="relay")return K({...n,client:i},b,{strings:c,allowDelayMs:D}).then((L)=>L==="allow");let{grantId:h}=i,v=o(f),E=()=>v.allows(h,n.tool);if(E())return Promise.resolve(!0);let m=p.alwaysAllow??v.offered;return K({...n,client:i},b,{strings:c,allowDelayMs:D,alwaysAllow:m!==!1&&(m===!0&&v.kept?!0:"until-reload"),allowedNow:E}).then((L)=>{if(L==="always")v.keep(h,n.tool);return L!=="deny"})}function se(f,n,b){let{client:p}=n;if(p.kind==="relay"&&o(f).allows(p.grantId,n.tool))return Promise.resolve(!0);if(b===void 0)return f.confirmInPage(n);return Promise.resolve().then(()=>b(n)).then((i)=>i==="unanswered"?i:i===!0)}export{se as confirmCall,le as confirmInPage};
2
+
3
+ //# debugId=A703208B3089B74564756E2164756E21
4
+ //# sourceMappingURL=confirm-xgm1ymd0.min.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/confirm.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * The confirmation of consequential tools, loaded on demand: a `<dialog>`\n * per call, one shown at a time per document, and Always allow (or Allow\n * until reload) for the tools a user allows (`always-allowed.ts`).\n */\n\nimport { allowedFor, type ConfirmHost } from \"./always-allowed.ts\";\nimport {\n\tbutton,\n\tclientLabel,\n\tel,\n\tfill,\n\tnewDialog,\n\tplural,\n\tstringsOf,\n\tvisible,\n} from \"./dialog.ts\";\nimport type { DialogStrings } from \"./strings.ts\";\nimport type { TabMcp } from \"./tab-mcp.ts\";\nimport type {\n\tConfirmAnswer,\n\tConfirmHandler,\n\tConfirmRequest,\n\tDialogOptions,\n\tLocalClient,\n\tRelayClient,\n} from \"./types.ts\";\n\n/** A request the dialog is shown for: never a WebMCP call's (DEC-215). */\nexport type AskedRequest = ConfirmRequest & {\n\tclient: RelayClient | LocalClient;\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 once\" 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/**\n * How long \"Allow once\" stays disabled after the confirmation is shown, while the\n * page is visible and focused (CU 17: a constant; tests pass `allowDelayMs`).\n */\nexport const ALLOW_DELAY_MS = 750;\n\n/** The user's answer: \"always\" allows this tool for this AI app (Always allow, or until reload). */\nexport type DialogAnswer = \"allow\" | \"always\" | \"deny\";\n\n/** Arguments up to this many characters are read out with the question. */\nconst DESCRIBED_ARGUMENTS = 500;\n\n/** Options of `confirmDialog`. */\nexport interface ConfirmDialogOptions {\n\t/** Tests only: another delay than {@link ALLOW_DELAY_MS}. */\n\tallowDelayMs?: number | undefined;\n\t/**\n\t * Offer a third button: `true` \"Always allow\" (kept until the app is\n\t * disconnected), `\"until-reload\"` \"Allow until reload\" (kept in memory).\n\t */\n\talwaysAllow?: boolean | \"until-reload\" | undefined;\n\t/** Asked when a waiting call's turn comes: `true` answers \"allow\" unseen. */\n\tallowedNow?: () => boolean;\n\tstrings?: DialogStrings;\n}\n\n/**\n * The confirmations of one document: one is shown at a time, the others\n * wait in order, so that the click that answered one cannot answer the next\n * (each starts its own delay when it is shown).\n */\ninterface ConfirmQueue {\n\tshown: boolean;\n\twaiting: (() => void)[];\n\t/** Updates the shown dialog's line about the calls that wait. */\n\tchanged?: (() => void) | undefined;\n}\n\nconst queues = new WeakMap<Document, ConfirmQueue>();\n\n/**\n * Ask whether a consequential tool may run. \"Always allow\" (or \"Allow until\n * reload\") is offered only with `alwaysAllow` (DEC-096, DEC-200); never\n * \"allow everything\": that is a deliberate act in the connect dialog, not\n * an answer to one question. One confirmation is shown at a time per\n * document; the others wait their turn, and a call cancelled while it waits\n * is never shown. \"Allow once\" and \"Always allow\" stay disabled until the\n * page has been visible and focused for 750 ms while the dialog is open and\n * is the top one, so a click meant for the page, the click that brings the\n * tab or window back, or the one that closed another dialog, cannot\n * approve; leaving the page disables them again. They also wait until the\n * arguments have been scrolled to their end. Before the delay has run out,\n * Enter or Space on a button and Escape are ignored, so typing meant for the\n * page cannot refuse either. Everything else (Don't allow, Escape, an\n * aborted call) is \"deny\". `allowedNow` is asked when a waiting call's turn\n * comes: `true` (the user allowed it meanwhile) answers \"allow\"\n * without showing it.\n */\nexport function confirmDialog(\n\trequest: AskedRequest,\n\tdoc: Document,\n\toptions: ConfirmDialogOptions = {},\n): Promise<DialogAnswer> {\n\tif (request.signal.aborted) return Promise.resolve(\"deny\");\n\tlet queue = queues.get(doc);\n\tif (queue === undefined) {\n\t\tqueue = { shown: false, waiting: [] };\n\t\tqueues.set(doc, queue);\n\t}\n\tconst q = queue;\n\t/** The shown confirmation closed: the next one, if any. */\n\tconst next = () => {\n\t\tconst start = q.waiting.shift();\n\t\tq.shown = start !== undefined;\n\t\tstart?.();\n\t\tq.changed?.();\n\t};\n\tconst show = () => {\n\t\ttry {\n\t\t\treturn showConfirm(request, doc, options, q, next);\n\t\t} catch (error) {\n\t\t\tnext(); // not shown: the queue goes on\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t};\n\tif (!q.shown) {\n\t\tq.shown = true;\n\t\treturn show();\n\t}\n\treturn new Promise((resolve) => {\n\t\tconst start = () => {\n\t\t\trequest.signal.removeEventListener(\"abort\", onAbort);\n\t\t\tif (options.allowedNow?.() === true) {\n\t\t\t\tresolve(\"allow\");\n\t\t\t\tnext();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(show());\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tq.waiting.splice(q.waiting.indexOf(start), 1);\n\t\t\tq.changed?.();\n\t\t\tresolve(\"deny\");\n\t\t};\n\t\trequest.signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tq.waiting.push(start);\n\t\tq.changed?.();\n\t});\n}\n\n/** `confirmDialog` once it is this request's turn; calls `next` when it closes. */\nfunction showConfirm(\n\trequest: AskedRequest,\n\tdoc: Document,\n\toptions: ConfirmDialogOptions,\n\tqueue: ConfirmQueue,\n\tnext: () => void,\n): Promise<DialogAnswer> {\n\tconst s = options.strings ?? stringsOf(undefined);\n\tconst delay = options.allowDelayMs ?? ALLOW_DELAY_MS;\n\tconst tool = request.tool.title ?? request.tool.name;\n\tconst client = clientLabel(request.client, s);\n\tconst names = { tool, client };\n\tconst { dialog, id } = newDialog(\n\t\tdoc,\n\t\t\"tab-mcp-confirm\",\n\t\ts,\n\t\t...fill(doc, s.confirmTitle, names),\n\t);\n\tconst waiting = el(doc, \"p\", { className: \"tab-mcp-waiting\" });\n\tconst showWaiting = () => {\n\t\tconst n = queue.waiting.length;\n\t\twaiting.hidden = n === 0;\n\t\twaiting.textContent = plural(s.waiting, n, s);\n\t};\n\tqueue.changed = showWaiting;\n\tshowWaiting();\n\t// The safe choice is the default: focused, and the one that stands out.\n\tconst deny = button(\n\t\tdoc,\n\t\ts.deny,\n\t\t() => dialog.close(\"deny\"),\n\t\t\"tab-mcp-deny\",\n\t\t\"primary\",\n\t);\n\tconst approving = (text: string, answer: DialogAnswer, className: string) => {\n\t\tconst node = button(\n\t\t\tdoc,\n\t\t\ttext,\n\t\t\t() => {\n\t\t\t\tif (!node.disabled) dialog.close(answer);\n\t\t\t},\n\t\t\tclassName,\n\t\t);\n\t\treturn node;\n\t};\n\t// The approving buttons: Allow, and Always allow (or Allow until reload)\n\t// when the page offers it, saying how long it lasts.\n\tconst approve = [approving(s.allow, \"allow\", \"tab-mcp-allow\")];\n\tconst extra: HTMLElement[] = [];\n\tconst mode = options.alwaysAllow;\n\tif (mode === true || mode === \"until-reload\") {\n\t\tconst kept = mode === true;\n\t\t// Left of Allow: not where most platforms put the default (CU 11).\n\t\tapprove.unshift(\n\t\t\tapproving(\n\t\t\t\tkept ? s.alwaysAllow : s.allowUntilReload,\n\t\t\t\t\"always\",\n\t\t\t\t\"tab-mcp-always\",\n\t\t\t),\n\t\t);\n\t\textra.push(\n\t\t\tel(\n\t\t\t\tdoc,\n\t\t\t\t\"p\",\n\t\t\t\t{ className: \"tab-mcp-always-note\" },\n\t\t\t\t...fill(doc, kept ? s.alwaysAllowNote : s.allowUntilReloadNote, names),\n\t\t\t),\n\t\t);\n\t}\n\tconst actions = el(\n\t\tdoc,\n\t\t\"div\",\n\t\t{ className: \"tab-mcp-actions\" },\n\t\tdeny,\n\t\t...approve.flatMap((b) => [\" \", b]),\n\t);\n\t// Approving needs both: the delay ran out while the user saw the page\n\t// (`settled`), and the arguments were seen to their end (`seen`).\n\tlet settled = false;\n\tlet seen = false;\n\tconst enable = () => {\n\t\tfor (const b of approve) b.disabled = !(settled && seen);\n\t};\n\tenable();\n\tconst shown = showArguments(request.arguments);\n\tconst args = el(doc, \"pre\", {\n\t\tclassName: \"tab-mcp-arguments\",\n\t\tid: `${id}-arguments`,\n\t\ttext: shown ?? s.argumentsHidden,\n\t});\n\tif (shown === undefined) {\n\t\tfor (const node of [...approve, ...extra]) node.hidden = true;\n\t}\n\targs.dir = \"ltr\";\n\t// Inline, so the arguments stay readable in full without the stylesheet:\n\t// wrapped (also a long word, at 360 px), scrolling when long.\n\targs.style.setProperty(\"white-space\", \"pre-wrap\");\n\targs.style.setProperty(\"overflow-wrap\", \"anywhere\");\n\targs.style.setProperty(\n\t\t\"max-height\",\n\t\t\"var(--tab-mcp-arguments-height, min(50vh, 24rem))\",\n\t);\n\targs.style.setProperty(\"overflow\", \"auto\");\n\targs.hidden = Object.keys(request.arguments).length === 0;\n\t// The caller chooses the order of the keys, so what matters may come\n\t// last: below the end of the box, the user is told, and Allow waits.\n\tconst scrollNote = el(doc, \"p\", {\n\t\tclassName: \"tab-mcp-scroll-note\",\n\t\ttext: s.scrollToAllow,\n\t});\n\tscrollNote.hidden = true;\n\tconst who = el(\n\t\tdoc,\n\t\t\"p\",\n\t\t{ id: `${id}-who` },\n\t\t...fill(doc, s.confirmWho, names),\n\t);\n\tdialog.setAttribute(\n\t\t\"aria-describedby\",\n\t\tshown !== undefined && !args.hidden && shown.length <= DESCRIBED_ARGUMENTS\n\t\t\t? `${who.id} ${args.id}`\n\t\t\t: who.id,\n\t);\n\tdialog.append(\n\t\twho,\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\tscrollNote,\n\t\tactions,\n\t\t...extra,\n\t\twaiting,\n\t);\n\tdoc.body.append(dialog);\n\tconst view = doc.defaultView;\n\treturn new Promise((resolve, reject) => {\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// In a hidden tab, the tab's title says that the page asks (CU 9): the\n\t\t// AI app waits meanwhile. Put back when the tab is shown or the dialog\n\t\t// closes, unless the page changed its title since.\n\t\tlet title: { page: string; shown: string } | undefined;\n\t\tconst untitle = () => {\n\t\t\tif (title !== undefined && doc.title === title.shown)\n\t\t\t\tdoc.title = title.page;\n\t\t\ttitle = undefined;\n\t\t};\n\t\tconst retitle = () => {\n\t\t\tif (doc.visibilityState !== \"hidden\") untitle();\n\t\t\telse if (title === undefined) {\n\t\t\t\ttitle = { page: doc.title, shown: `${s.titlePrefix}${doc.title}` };\n\t\t\t\tdoc.title = title.shown;\n\t\t\t}\n\t\t};\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\n\t\t// (DEC-087), and so does another dialog of the page that closes over\n\t\t// this one.\n\t\tconst arm = (event?: Event) => {\n\t\t\tif (event?.type === \"close\" && event.target === dialog) return;\n\t\t\tretitle();\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t\tsettled = false;\n\t\t\tenable();\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\tsettled = true;\n\t\t\t\tenable();\n\t\t\t}, delay);\n\t\t};\n\t\t// Scrolled to the end, or nothing to scroll (also without layout).\n\t\tconst check = () => {\n\t\t\tif (seen) return;\n\t\t\tif (args.scrollTop + args.clientHeight < args.scrollHeight - 2) {\n\t\t\t\tscrollNote.hidden = false;\n\t\t\t\targs.tabIndex = 0; // to scroll it with the keyboard\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tseen = true;\n\t\t\tscrollNote.hidden = true;\n\t\t\tenable();\n\t\t};\n\t\t// Not answered by a key before the delay has run out.\n\t\tconst guard = (event: KeyboardEvent) => {\n\t\t\tif (settled) return;\n\t\t\tconst onButton = (event.target as Element | null)?.localName === \"button\";\n\t\t\tif (\n\t\t\t\tevent.key === \"Escape\" ||\n\t\t\t\t(onButton && (event.key === \"Enter\" || event.key === \" \"))\n\t\t\t)\n\t\t\t\tevent.preventDefault();\n\t\t};\n\t\tconst onCancel = (event: Event) => {\n\t\t\tif (!settled) event.preventDefault();\n\t\t};\n\t\tdoc.addEventListener(\"visibilitychange\", arm);\n\t\tdoc.addEventListener(\"close\", arm, true); // `close` does not bubble\n\t\tview?.addEventListener(\"focus\", arm);\n\t\tview?.addEventListener(\"blur\", arm);\n\t\tview?.addEventListener(\"resize\", check);\n\t\targs.addEventListener(\"scroll\", check);\n\t\tdialog.addEventListener(\"keydown\", guard);\n\t\tdialog.addEventListener(\"keyup\", guard);\n\t\tdialog.addEventListener(\"cancel\", onCancel);\n\t\tconst cleanup = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tuntitle();\n\t\t\tdoc.removeEventListener(\"visibilitychange\", arm);\n\t\t\tdoc.removeEventListener(\"close\", arm, true);\n\t\t\tview?.removeEventListener(\"focus\", arm);\n\t\t\tview?.removeEventListener(\"blur\", arm);\n\t\t\tview?.removeEventListener(\"resize\", check);\n\t\t\trequest.signal.removeEventListener(\"abort\", onAbort);\n\t\t\tdialog.remove();\n\t\t\tif (queue.changed === showWaiting) queue.changed = undefined;\n\t\t};\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tconst value = dialog.returnValue;\n\t\t\t\tcleanup();\n\t\t\t\tresolve(value === \"allow\" || value === \"always\" ? value : \"deny\");\n\t\t\t\tnext();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t\ttry {\n\t\t\tdialog.showModal();\n\t\t} catch (error) {\n\t\t\t// Never shown, so never closed: the queue must not wait for it.\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t\tnext();\n\t\t\treturn;\n\t\t}\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\tcheck();\n\t});\n}\n\n/** Options of this chunk's `confirmInPage`. */\nexport interface ConfirmInPageOptions {\n\t/**\n\t * The third button, for an AI app through the relay (`kind: \"relay\"`):\n\t * `true` \"Always allow\" (kept in the `TabMcp`'s `storage`; \"Allow until\n\t * reload\" where it is kept in memory, as for a stand-in), `\"until-reload\"`\n\t * \"Allow until reload\", `false` none. Default: the `TabMcp`'s\n\t * `alwaysAllow`; none for a stand-in.\n\t */\n\talwaysAllow?: boolean | \"until-reload\" | undefined;\n\t/** Texts of the dialog, as `TabMcpOptions.ui`. */\n\tui?: DialogOptions | undefined;\n\t/** Tests only: another delay than {@link ALLOW_DELAY_MS}. */\n\tallowDelayMs?: number | undefined;\n}\n\n/**\n * `TabMcp.confirmInPage`: the confirmation, and the tools the user allowed\n * (`always-allowed.ts`), which run unasked. Those only for an AI app through\n * the relay: a served port has no identity to remember an answer for\n * (DEC-115, DEC-124). A WebMCP call is never shown it (an agent that drives\n * the tab would answer it itself; DEC-215): it resolves `true`.\n *\n * Code that loads this chunk itself may pass a stand-in of its own for\n * `mcp` (`ConfirmHost`: `grants`, optionally `grantschange` events). Its\n * allowances live in memory, for its grants only, until the page is\n * reloaded, and exist only where the caller offers them with\n * `options.alwaysAllow`; without it nothing is allowed and nothing is kept.\n */\nexport function confirmInPage(\n\tmcp: TabMcp | ConfirmHost,\n\trequest: ConfirmRequest,\n\tdoc: Document,\n\toptions: ConfirmInPageOptions = {},\n): Promise<boolean> {\n\tconst { client } = request;\n\tif (client.kind === \"webmcp\") return Promise.resolve(true);\n\tconst strings = stringsOf(options.ui);\n\tconst { allowDelayMs } = options;\n\tif (client.kind !== \"relay\")\n\t\treturn confirmDialog({ ...request, client }, doc, {\n\t\t\tstrings,\n\t\t\tallowDelayMs,\n\t\t}).then((answer) => answer === \"allow\");\n\tconst { grantId } = client;\n\tconst allowed = allowedFor(mcp);\n\tconst allowedNow = () => allowed.allows(grantId, request.tool);\n\tif (allowedNow()) return Promise.resolve(true);\n\tconst offer = options.alwaysAllow ?? allowed.offered;\n\t// Asked again when its turn comes: the call before it in the queue may\n\t// have been allowed meanwhile.\n\treturn confirmDialog({ ...request, client }, doc, {\n\t\tstrings,\n\t\tallowDelayMs,\n\t\t// \"Always\" only where it outlives a reload.\n\t\talwaysAllow:\n\t\t\toffer !== false &&\n\t\t\t(offer === true && allowed.kept ? true : \"until-reload\"),\n\t\tallowedNow,\n\t}).then((answer) => {\n\t\t// Only while the grant is still there: a revoked app gets nothing\n\t\t// (`keep` checks).\n\t\tif (answer === \"always\") allowed.keep(grantId, request.tool);\n\t\treturn answer !== \"deny\";\n\t});\n}\n\n/**\n * The core's question about a consequential call: an AI app's call that the\n * user allowed runs without asking, with the dialog and with the page's own\n * `onConfirm` alike; any other goes to `onConfirm`, else to the dialog.\n * Only AI apps through the relay have a grant to allow for.\n */\nexport function confirmCall(\n\tmcp: TabMcp,\n\trequest: ConfirmRequest,\n\tonConfirm: ConfirmHandler | undefined,\n): Promise<ConfirmAnswer> {\n\tconst { client } = request;\n\tif (\n\t\tclient.kind === \"relay\" &&\n\t\tallowedFor(mcp).allows(client.grantId, request.tool)\n\t)\n\t\treturn Promise.resolve(true);\n\tif (onConfirm === undefined) return mcp.confirmInPage(request);\n\t// Anything but true or \"unanswered\"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