@ractive-ch/tab-mcp-client 0.20.0-rc.1 → 0.21.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -2
- package/README.md +141 -58
- package/cdn/confirm-xgm1ymd0.min.js +4 -0
- package/cdn/confirm-xgm1ymd0.min.js.map +10 -0
- package/cdn/{connect-my0pbqd7.min.js → connect-3reh9k1f.min.js} +4 -4
- package/cdn/{connect-my0pbqd7.min.js.map → connect-3reh9k1f.min.js.map} +4 -4
- package/cdn/connection-cxgns38v.min.js +17 -0
- package/cdn/{connection-5x2krvfs.min.js.map → connection-cxgns38v.min.js.map} +5 -5
- package/cdn/strings.min.js +1 -1
- package/cdn/tab-mcp-client-gdj1e1wh.min.js +5 -0
- package/cdn/tab-mcp-client-gdj1e1wh.min.js.map +11 -0
- package/cdn/{tab-mcp-client-8r6h3wza.min.js → tab-mcp-client-yjcmhpdf.min.js} +5 -5
- package/cdn/tab-mcp-client-yjcmhpdf.min.js.map +11 -0
- package/cdn/tab-mcp-client.min.js +3 -3
- package/cdn/tab-mcp-client.min.js.map +4 -4
- package/cdn/webmcp-ny13npet.min.js.map +2 -2
- package/command.d.ts +9 -3
- package/{confirm-hymzwx3b.js → confirm-7de6dvpb.js} +11 -6
- package/confirm-7de6dvpb.js.map +10 -0
- package/confirm.d.ts +10 -5
- package/{connect-fhtjdmf3.js → connect-bc628ax6.js} +4 -4
- package/{connection-krd3ncrn.js → connection-arq7qm7b.js} +26 -11
- package/connection-arq7qm7b.js.map +16 -0
- package/connection.d.ts +8 -3
- package/dialog.d.ts +2 -2
- package/{index-7qqhn3zv.js → index-bt1rkngm.js} +3 -5
- package/index-bt1rkngm.js.map +10 -0
- package/{index-00p8b969.js → index-erm4h3sn.js} +2 -3
- package/index-erm4h3sn.js.map +11 -0
- package/{index-1tssct09.js → index-xx4gmtk5.js} +6 -4
- package/index-xx4gmtk5.js.map +11 -0
- package/index.js +14 -7
- package/index.js.map +4 -4
- package/internal.d.ts +7 -3
- package/mcp.d.ts +12 -5
- package/package.json +1 -1
- package/secret.d.ts +2 -1
- package/setup.d.ts +5 -5
- package/setup.js +2 -2
- package/skill/SKILL.md +472 -0
- package/skill/references/react.md +59 -0
- package/skill/references/sign-in.md +28 -0
- package/strings.d.ts +0 -1
- package/strings.js +1 -1
- package/tab-mcp.d.ts +2 -2
- package/types.d.ts +40 -18
- package/webmcp-acj1tef8.js.map +2 -2
- package/webmcp.d.ts +5 -3
- package/cdn/confirm-ba3dkf9p.min.js +0 -4
- package/cdn/confirm-ba3dkf9p.min.js.map +0 -10
- package/cdn/connection-5x2krvfs.min.js +0 -17
- package/cdn/tab-mcp-client-8r6h3wza.min.js.map +0 -11
- package/cdn/tab-mcp-client-nnxcwrxp.min.js +0 -5
- package/cdn/tab-mcp-client-nnxcwrxp.min.js.map +0 -11
- package/confirm-hymzwx3b.js.map +0 -10
- package/connection-krd3ncrn.js.map +0 -16
- package/index-00p8b969.js.map +0 -11
- package/index-1tssct09.js.map +0 -11
- package/index-7qqhn3zv.js.map +0 -10
- /package/{connect-fhtjdmf3.js.map → connect-bc628ax6.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,75 @@ 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.
|
|
9
|
+
## [0.21.0-rc.1][client-0.21.0-rc.1] - 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
|
+
- The agent skill ships in the package as `skill/SKILL.md` (with `skill/references/`),
|
|
50
|
+
written for this version (DEC-216). With a coding agent, install the package and tell
|
|
51
|
+
it: "Read node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md and add tab-mcp to
|
|
52
|
+
this app." Its links point to the README, CHANGELOG and declarations beside it.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- The validator that `connect()` loads checks `outputSchema` as it checks `inputSchema`,
|
|
57
|
+
as the README said it did: an output schema it cannot use (a `$ref` next to a nested
|
|
58
|
+
`$id`, which does not resolve, or a duplicate `$id`) makes `registerTool` throw, and a
|
|
59
|
+
tool registered before with one is unregistered, with the reason in the event `error`
|
|
60
|
+
("the outputSchema of …"). Until now such a tool was listed, and an AI app whose
|
|
61
|
+
validator compiles output schemas (the MCP SDK's client) could not use it. Results
|
|
62
|
+
are still not checked against the output schema.
|
|
63
|
+
- The setup commands (`./setup`, "How do I add it?") put an address with `[`, `]` or `~`
|
|
64
|
+
in double quotes (DEC-217): zsh refused `claude mcp add --transport http test
|
|
65
|
+
http://[::1]:8080/s/test/mcp` with "no matches found" (`~` with `extendedglob`). POSIX
|
|
66
|
+
shells, zsh, fish, PowerShell and cmd.exe read the quoted address the same. An address
|
|
67
|
+
with any other character than letters, digits and `. : [ ] / _ ~ -` still gets the
|
|
68
|
+
steps without a command.
|
|
69
|
+
- `disconnectAll()` with a `storage` that reads but cannot be written (full, blocked, or
|
|
70
|
+
a custom one whose writes fail) connected again with the old secret: the new one was
|
|
71
|
+
kept only in memory, and the next read of storage returned the old one over it. The
|
|
72
|
+
grants were revoked, but the secret was not changed, so whoever held the old one could
|
|
73
|
+
still take the page's place. The new secret now stays in use until the page is
|
|
74
|
+
reloaded, and storage is not read over it until a write succeeds (code review
|
|
75
|
+
2026-11-22, CR-02).
|
|
76
|
+
|
|
77
|
+
## [0.20.0][client-0.20.0] - 2026-11-22
|
|
10
78
|
|
|
11
79
|
### Breaking
|
|
12
80
|
|
|
@@ -1095,7 +1163,8 @@ First alpha of the browser library, on the npm dist-tag `alpha`.
|
|
|
1095
1163
|
`<script type="module">` under `@ractive-ch/tab-mcp-client/cdn`.
|
|
1096
1164
|
- The connect dialog shows the pairing code from the relay.
|
|
1097
1165
|
|
|
1098
|
-
[client-0.
|
|
1166
|
+
[client-0.21.0-rc.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.21.0-rc.1
|
|
1167
|
+
[client-0.20.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.20.0
|
|
1099
1168
|
[client-0.19.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.19.0
|
|
1100
1169
|
[client-0.18.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.18.1
|
|
1101
1170
|
[client-0.18.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.18.0
|
package/README.md
CHANGED
|
@@ -17,9 +17,34 @@ 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
|
+
**Status: 0.21.0-rc.1.** 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 point your coding agent (Claude Code, Codex or another) at the guide in the package.
|
|
32
|
+
That's the whole tutorial:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Read node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md and add tab-mcp to this app.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then ask for what you want: which features of the page AI apps may use, and which of them
|
|
39
|
+
ask first. The guide is an [Agent Skill](https://agentskills.io/specification) written for
|
|
40
|
+
the version in your `node_modules`, and it links this README for the details. No such
|
|
41
|
+
file means the installed version is older than this guide: update the package.
|
|
42
|
+
|
|
43
|
+
The path is relative to the folder of the app that installed the package (in a
|
|
44
|
+
monorepo, that app's folder, where its own `node_modules` is), the same with npm, Bun,
|
|
45
|
+
pnpm and Yarn's `node_modules` linker. Yarn Plug'n'Play keeps packages in zip files: run `yarn unplug @ractive-ch/tab-mcp-client`
|
|
46
|
+
and give the agent the `skill/SKILL.md` under `.yarn/unplugged/`.
|
|
47
|
+
|
|
23
48
|
## You need a relay
|
|
24
49
|
|
|
25
50
|
The page talks to a tab-mcp relay, which only accepts pages from the origins its operator
|
|
@@ -33,7 +58,7 @@ docker run --rm -p 8080:8080 \
|
|
|
33
58
|
-e TAB_MCP_PUBLIC_URL=http://localhost:8080 \
|
|
34
59
|
-e TAB_MCP_ALLOWED_ORIGINS=http://localhost:3000 \
|
|
35
60
|
-e TAB_MCP_STORE=memory \
|
|
36
|
-
ractive/tab-mcp:0.13.
|
|
61
|
+
ractive/tab-mcp:0.13.2-rc.1
|
|
37
62
|
```
|
|
38
63
|
|
|
39
64
|
For production, see
|
|
@@ -52,7 +77,7 @@ Or without a bundler, from a CDN as an ES module:
|
|
|
52
77
|
|
|
53
78
|
```html
|
|
54
79
|
<script type="module">
|
|
55
|
-
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.
|
|
80
|
+
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.1/cdn/tab-mcp-client.min.js";
|
|
56
81
|
</script>
|
|
57
82
|
```
|
|
58
83
|
|
|
@@ -123,7 +148,7 @@ WebMCP draft's `registerTool` (`callers`: [which callers see a tool](#which-call
|
|
|
123
148
|
`$ref` next to a nested `$id`) is unregistered, with the reason in the event `error`;
|
|
124
149
|
- `outputSchema` (optional): a JSON Schema with `"type": "object"` for the result, listed
|
|
125
150
|
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
|
|
151
|
+
`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
152
|
compile can cost the whole list), but results are not checked against it. An AI app
|
|
128
153
|
expects every result of such a tool to carry
|
|
129
154
|
`structuredContent` that matches it (the MCP SDK's client refuses one without), so
|
|
@@ -134,7 +159,8 @@ WebMCP draft's `registerTool` (`callers`: [which callers see a tool](#which-call
|
|
|
134
159
|
an AI app through the relay (`id`, verified `host`, declared `name`),
|
|
135
160
|
`{ kind: "local", id, name? }` for the site's own assistant on a served port, with the
|
|
136
161
|
`id` and `name` the page gave `serve` ([Your own assistant](#your-own-assistant-on-the-page)),
|
|
137
|
-
or `{ kind: "webmcp" }` for
|
|
162
|
+
or `{ kind: "webmcp" }` for a WebMCP caller ([WebMCP](#webmcp): an agent in the
|
|
163
|
+
browser, another extension, or a document of an `exposedTo` origin), of which nothing
|
|
138
164
|
more is known (unless the tab-mcp browser extension vouched for the call: then
|
|
139
165
|
`{ kind: "webmcp", via: "tab-mcp-extension", name, host }`, [with the
|
|
140
166
|
extension](#with-the-tab-mcp-browser-extension)). Check `client.kind` before you read `host`. Return a
|
|
@@ -160,13 +186,14 @@ written for the native API behaves differently here:
|
|
|
160
186
|
draft rejects the first two with an `InvalidStateError`. A duplicate name is an
|
|
161
187
|
`InvalidStateError` in both.
|
|
162
188
|
- `inputSchema` and `outputSchema` need `"type": "object"`, as MCP does; the draft takes
|
|
163
|
-
any object. The library also checks
|
|
189
|
+
any object. The library also checks the patterns and `$ref`s of both (above).
|
|
164
190
|
- The library checks the arguments against `inputSchema` before `execute` runs; the
|
|
165
191
|
draft leaves that to the page.
|
|
166
192
|
- `execute` may return an MCP result; through WebMCP it goes out as its
|
|
167
193
|
`structuredContent` or its text ([WebMCP](#webmcp)).
|
|
168
194
|
- `exposedTo` matters only for WebMCP: it is passed on to the native registration of a
|
|
169
|
-
mirrored tool, and AI apps never see it.
|
|
195
|
+
mirrored tool, and AI apps never see it. A document of a listed origin can run the
|
|
196
|
+
tool, and the library does not ask it ([who asks](#who-asks-before-a-tool-that-asks-runs)).
|
|
170
197
|
|
|
171
198
|
An already aborted `signal` rejects with its reason and registers nothing, as in the
|
|
172
199
|
draft.
|
|
@@ -196,27 +223,61 @@ Chrome has WebMCP for sites in its
|
|
|
196
223
|
`webmcp: true` does nothing. Each `new TabMcp` looks for WebMCP when it is made, so a
|
|
197
224
|
trial token that a script adds later counts for a `TabMcp` made after it.
|
|
198
225
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
226
|
+
#### Who asks before a tool that asks runs
|
|
227
|
+
|
|
228
|
+
A tool marked `consequentialHint` (or, for WebMCP calls, only `destructiveHint`) asks
|
|
229
|
+
before it runs. Who asks depends on the caller (DEC-215). Every WebMCP call that the
|
|
230
|
+
tab-mcp browser extension did not vouch for reaches the page as
|
|
231
|
+
`client: { kind: "webmcp" }`, whoever made it: the page cannot tell the last three rows
|
|
232
|
+
apart.
|
|
233
|
+
|
|
234
|
+
| Caller | Can it click in the tab? | Who asks |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| An AI app through the relay | no | the page: `onConfirm`, else the library's dialog |
|
|
237
|
+
| 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 |
|
|
238
|
+
| 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 |
|
|
239
|
+
| 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 |
|
|
240
|
+
| 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 |
|
|
241
|
+
|
|
242
|
+
The library shows no question for an unvouched WebMCP call: without `onConfirm` a tool
|
|
243
|
+
that asks runs. For an agent that drives the tab the dialog was no check (with ChatGPT's
|
|
244
|
+
browser the call waited most of a minute, then the agent clicked "Allow once" itself).
|
|
245
|
+
For the other two it was one, and it is gone: whether the user is asked then depends on
|
|
246
|
+
the calling extension or the other origin's script, which the page does not know. A
|
|
247
|
+
page with a tool that must not run on such a caller's word decides in code or keeps the
|
|
248
|
+
tool away:
|
|
249
|
+
|
|
250
|
+
- **`onConfirm`** gets the call with `request.client.kind === "webmcp"` (no `via`). Decide
|
|
251
|
+
there without showing anything an agent could click: refuse every such call, or apply
|
|
252
|
+
a rule of your own (arguments, the time of day, what the user is signed in as). A
|
|
253
|
+
question of your own in the page is no better than the library's against an agent
|
|
254
|
+
that drives the tab.
|
|
255
|
+
- **`callers`** without `"webmcp"` keeps the tool out of WebMCP altogether
|
|
256
|
+
([which callers see a tool](#which-callers-see-a-tool)), for example
|
|
257
|
+
`{ callers: ["relay", "local"] }`.
|
|
258
|
+
- **`exposedTo`**: leave it off a tool that asks unless the listed origins may run it
|
|
259
|
+
unasked. A document of such an origin lists and runs the tool (Chrome 156).
|
|
260
|
+
|
|
261
|
+
None of these stops an agent that drives the tab from clicking the page's own controls,
|
|
262
|
+
which ask nothing either.
|
|
263
|
+
|
|
264
|
+
- Every tool goes to WebMCP, tools marked `consequentialHint` or MCP's `destructiveHint`
|
|
265
|
+
included. A tool marked only `destructiveHint: true` is registered natively with
|
|
266
|
+
`consequentialHint: true`, since WebMCP has no `destructiveHint` (DEC-022 maps the other
|
|
267
|
+
way), and `onConfirm` gets its WebMCP calls by `consequentialHint ?? destructiveHint`,
|
|
268
|
+
though an AI app's call of it does not ask (its own client sees the hint). Until 0.20
|
|
269
|
+
such tools were left out unless `callers` listed `"webmcp"`; an agent that found no tool
|
|
270
|
+
to delete with then clicked the page's own Delete buttons (DEC-209). In 0.20 the
|
|
271
|
+
library's dialog asked every unvouched WebMCP call (DEC-215).
|
|
211
272
|
- The native registration gets the WebMCP fields: `name`, `title`, `description`,
|
|
212
273
|
`inputSchema`, `outputSchema` and the WebMCP hints, and `exposedTo` from
|
|
213
274
|
`registerTool`'s options (origins of other documents in the tab that may see the
|
|
214
275
|
tool; the browser checks it, and an invalid list only warns, as below).
|
|
215
276
|
- 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
|
|
217
|
-
the
|
|
218
|
-
`
|
|
219
|
-
|
|
277
|
+
`inputSchema` (Chrome does not check them), a tool that asks goes to `onConfirm` if
|
|
278
|
+
the page has one (above), and `toolcall` and `toolcallend` fire with
|
|
279
|
+
`client: { kind: "webmcp" }`, so a page's record of calls still lists it ("an agent
|
|
280
|
+
in this browser", say). "Always allow" and the switches never apply to these calls.
|
|
220
281
|
- The call resolves with what `execute` returned, which the browser hands the agent as
|
|
221
282
|
JSON text. An MCP result goes out as its `structuredContent` if it has one, else as
|
|
222
283
|
its text blocks, one per line, each other block (an image, a resource) as a line that
|
|
@@ -225,9 +286,9 @@ trial token that a script adds later counts for a `TabMcp` made after it.
|
|
|
225
286
|
serialize, and an empty MCP result resolve as `"Done."`.
|
|
226
287
|
- A failure resolves too, as
|
|
227
288
|
`{ error: "<message>" }`, so that the agent can read it: invalid arguments (the same
|
|
228
|
-
message as for an AI app),
|
|
229
|
-
|
|
230
|
-
is gone, an error thrown by `execute` (its message) and an MCP result with
|
|
289
|
+
message as for an AI app), a refusal of `onConfirm` (`The user did not allow <tool> to
|
|
290
|
+
run.`), its `"unanswered"` (`The user did not answer whether <tool> may run.`), a tool
|
|
291
|
+
that is gone, an error thrown by `execute` (its message) and an MCP result with
|
|
231
292
|
`isError: true` (its text). A rejection would not help: the draft hands the agent
|
|
232
293
|
every rejection as an `OperationError` without its message, on purpose (a failure the
|
|
233
294
|
agent should read belongs in the result), and Chrome 156 as `UnknownError`. Two cases still
|
|
@@ -279,8 +340,8 @@ that an AI app reaches it through the extension:
|
|
|
279
340
|
- **A vouched call.** Right before the extension runs a tool the user allowed there
|
|
280
341
|
(asked and allowed, or covered by its "Always allow" switch), it tells the page the
|
|
281
342
|
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
|
|
283
|
-
|
|
343
|
+
arguments (key order aside) within 2 seconds runs without `onConfirm`: the user just
|
|
344
|
+
allowed exactly that call. Its caller in
|
|
284
345
|
`execute`, `toolcall` and `toolcallend` is
|
|
285
346
|
`{ kind: "webmcp", via: "tab-mcp-extension", name, host }`, so an activity view can say
|
|
286
347
|
"Claude (claude.ai) through the tab-mcp browser extension". A vouch is used once and
|
|
@@ -289,9 +350,10 @@ that an AI app reaches it through the extension:
|
|
|
289
350
|
events fire, a tool that is gone does not run. Once the extension's call ended or
|
|
290
351
|
failed, the extension withdraws the vouch, and one still unused (the call never
|
|
291
352
|
reached the page) is dropped. Any call that matches no vouch (an agent in the
|
|
292
|
-
browser, a call after the 2 seconds) is
|
|
293
|
-
|
|
294
|
-
|
|
353
|
+
browser, another extension, an `exposedTo` origin, a call after the 2 seconds) is an
|
|
354
|
+
unvouched WebMCP call: `onConfirm` decides, without one it runs.
|
|
355
|
+
- **`trustExtension: false`** treats a vouched call as any other WebMCP call, for a site
|
|
356
|
+
whose `onConfirm` insists on its own rule; `extension` is still reported.
|
|
295
357
|
- **What the page tells the extension:** the library's version, the app id and the AI
|
|
296
358
|
apps connected to the page directly (`name`, `host`, as `grants` has them; at most
|
|
297
359
|
64), again on
|
|
@@ -304,9 +366,9 @@ that an AI app reaches it through the extension:
|
|
|
304
366
|
`src/handshake.ts`). Script in the page could fake the extension, but script in the
|
|
305
367
|
page can already skip any question of the page: this is a convenience between two
|
|
306
368
|
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
|
|
308
|
-
|
|
309
|
-
library.
|
|
369
|
+
- Old and new mix: an extension that does not know the handshake says nothing, and its
|
|
370
|
+
calls are unvouched WebMCP calls, which the library does not ask; the extension says nothing to a page that
|
|
371
|
+
did not announce the library.
|
|
310
372
|
|
|
311
373
|
A page that registers its WebMCP tools itself, without the library's mirror, can take
|
|
312
374
|
part the same way: answer the events as `src/handshake.ts` does, skip its own
|
|
@@ -465,7 +527,8 @@ a read-only tool such as `get_page_context` (`readOnlyHint: true`, perhaps
|
|
|
465
527
|
|
|
466
528
|
A consequential tool asks before every call. For the calls through one port, `serve`'s
|
|
467
529
|
`onConfirm` asks instead of the page's `onConfirm` and the library's dialog; calls through
|
|
468
|
-
the relay
|
|
530
|
+
the relay keep those, and WebMCP calls the page's `onConfirm` ([who asks](#who-asks-before-a-tool-that-asks-runs)).
|
|
531
|
+
That is the recommended way for a site's own assistant:
|
|
469
532
|
the question appears where the user talks to the assistant, in the user's language. It
|
|
470
533
|
answers as the page's `onConfirm` does: `true`, `false` or `"unanswered"`; anything else,
|
|
471
534
|
and a throw, is a refusal. `request.signal` aborts when the call is cancelled, takes longer
|
|
@@ -487,8 +550,11 @@ between that text and the tool.
|
|
|
487
550
|
|
|
488
551
|
`registerTool(tool, { callers })` lists the callers that see a tool: `"relay"` (AI apps
|
|
489
552
|
through the relay), `"local"` (a served port) and `"webmcp"` (agents in the browser),
|
|
490
|
-
by default all of them. A tool that asks asks
|
|
491
|
-
|
|
553
|
+
by default all of them. A tool that asks asks AI apps and the site's own assistant; a
|
|
554
|
+
WebMCP call the tab-mcp browser extension did not vouch for is not shown the library's
|
|
555
|
+
dialog
|
|
556
|
+
([who asks](#who-asks-before-a-tool-that-asks-runs)). `callers` is for who may see a tool
|
|
557
|
+
at all.
|
|
492
558
|
For a caller that is not listed the tool does not exist: `tools/list` leaves it out,
|
|
493
559
|
`notifications/tools/list_changed` does not fire for it, and a call gets the same error
|
|
494
560
|
as a call of an unknown tool. For example:
|
|
@@ -499,6 +565,9 @@ as a call of an unknown tool. For example:
|
|
|
499
565
|
- `{ callers: ["relay"] }`: a tool that needs to know which AI app calls (a paired,
|
|
500
566
|
named app; an audit line, "Always allow" remembered per app), which an anonymous
|
|
501
567
|
WebMCP caller is not.
|
|
568
|
+
- `{ callers: ["relay", "local"] }`: kept from WebMCP, for a tool that must not run on
|
|
569
|
+
the word of an unvouched WebMCP caller (the library does not ask one; an `onConfirm`
|
|
570
|
+
that refuses them does the same for the call but still lists the tool).
|
|
502
571
|
- `{ callers: ["relay", "webmcp"] }`: kept from the port, when the page serves it to a
|
|
503
572
|
chat frame of another origin.
|
|
504
573
|
|
|
@@ -552,9 +621,11 @@ instructions, as the recipe does with a delimited block.
|
|
|
552
621
|
### Consequential tools
|
|
553
622
|
|
|
554
623
|
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
|
|
556
|
-
arguments. A refusal reaches the AI app as an error result, and so does a
|
|
557
|
-
was removed while the user was asked.
|
|
624
|
+
asks the user before every call of an AI app ("Don't allow" or "Allow once"), showing the
|
|
625
|
+
AI app and the arguments. A refusal reaches the AI app as an error result, and so does a
|
|
626
|
+
call whose tool was removed while the user was asked. A WebMCP call the tab-mcp browser
|
|
627
|
+
extension did not vouch for is not shown this dialog, whoever made it; see
|
|
628
|
+
[who asks](#who-asks-before-a-tool-that-asks-runs).
|
|
558
629
|
|
|
559
630
|
`alwaysAllow: true` adds "Always allow", which lets that tool run without asking for that
|
|
560
631
|
AI app from then on; see [Tools that run without asking](#tools-that-run-without-asking).
|
|
@@ -600,8 +671,11 @@ const mcp = new TabMcp({
|
|
|
600
671
|
server: { name: "calculator", version: "1.0.0" },
|
|
601
672
|
onConfirm: (request) => {
|
|
602
673
|
const { tool, arguments: args, client, signal } = request;
|
|
603
|
-
// An
|
|
604
|
-
//
|
|
674
|
+
// An unvouched WebMCP call (an agent that may drive the tab, another
|
|
675
|
+
// extension, an exposedTo origin): decide in code, show nothing.
|
|
676
|
+
if (client.kind === "webmcp") return false;
|
|
677
|
+
// The site's own assistant (`local`) on a port served without its own
|
|
678
|
+
// onConfirm: the library's own dialog.
|
|
605
679
|
if (client.kind !== "relay") return mcp.confirmInPage(request);
|
|
606
680
|
const name = client.name ? escapeInvisible(client.name) : undefined;
|
|
607
681
|
const app = name ? `${name} (${client.host})` : client.host;
|
|
@@ -618,7 +692,8 @@ outcome `unanswered`. Any other value, and a throw, is a refusal.
|
|
|
618
692
|
|
|
619
693
|
`mcp.confirmInPage(request, { document })` is the library's own dialog, for an
|
|
620
694
|
`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
|
|
695
|
+
A call the user allowed for its AI app resolves `true` without the dialog, and so does
|
|
696
|
+
every WebMCP call: handed one, it does what the library does without `onConfirm`.
|
|
622
697
|
|
|
623
698
|
An app that shows the dialog for an MCP endpoint of its own, without a `TabMcp` (a
|
|
624
699
|
desktop app, say), can load the built confirmation chunk (`confirm-<hash>.js`; its name
|
|
@@ -630,15 +705,16 @@ grant is in `grants`, also without an event. `options` are
|
|
|
630
705
|
`alwaysAllow` (`true` or `"until-reload"` offers "Allow until reload" for that call;
|
|
631
706
|
without it nothing is allowed or kept), `ui` (the dialog's texts) and `allowDelayMs`
|
|
632
707
|
(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.
|
|
708
|
+
a client with `kind: "relay"` can be allowed. A client with `kind: "webmcp"` resolves
|
|
709
|
+
`true` without the dialog.
|
|
634
710
|
|
|
635
711
|
### Tools that run without asking
|
|
636
712
|
|
|
637
713
|
The user can let a consequential tool run without asking, for one connected AI app: one
|
|
638
714
|
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;
|
|
640
|
-
|
|
641
|
-
|
|
715
|
+
`onConfirm` alike: neither is asked. Only AI apps through the relay can be allowed; a
|
|
716
|
+
served port has no grant to remember it for and is always asked. An unvouched WebMCP
|
|
717
|
+
call is not asked by the library at all ([who asks](#who-asks-before-a-tool-that-asks-runs)).
|
|
642
718
|
|
|
643
719
|
The option `alwaysAllow` decides what the library's dialogs offer:
|
|
644
720
|
|
|
@@ -725,8 +801,8 @@ mcp.addEventListener("grantschange", drawSwitches);
|
|
|
725
801
|
that does not import it loads nothing of it. Take both from the same version:
|
|
726
802
|
|
|
727
803
|
```js
|
|
728
|
-
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.
|
|
729
|
-
import { allowedTools } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.
|
|
804
|
+
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.1/cdn/tab-mcp-client.min.js";
|
|
805
|
+
import { allowedTools } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.1/cdn/allowed.min.js";
|
|
730
806
|
```
|
|
731
807
|
|
|
732
808
|
**The risk.** An allowance outlives the user's attention: for up to the grant's 90 days,
|
|
@@ -759,8 +835,9 @@ not seen, and ones the page adds later. The relay cannot help: its one OAuth sco
|
|
|
759
835
|
server by a label made from `server.name` that every shell reads as one plain word:
|
|
760
836
|
lower case, letters without marks, each run of other characters as `-`, at most 40
|
|
761
837
|
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
|
|
763
|
-
|
|
838
|
+
into a command only if it has nothing but plain URL characters (in double quotes when
|
|
839
|
+
it has `[`, `]` or `~`, as an IPv6 address does: zsh reads those as patterns);
|
|
840
|
+
otherwise the help shows the steps without commands. Each entry ends with the step that starts the
|
|
764
841
|
sign-in: `/mcp` and Authenticate in Claude Code, `codex mcp login <name>` as the third
|
|
765
842
|
line of Codex's command. Codex 0.163 needs its feature `mcp_2026_07_28` for the relay's MCP
|
|
766
843
|
revision, so its command turns that on first. The steps are the minimum; the link at
|
|
@@ -818,8 +895,10 @@ page back: it connects with the stored secret, and the relay revokes every grant
|
|
|
818
895
|
for it in the same step (`hello.revokeAll`), whether the page was connected or not.
|
|
819
896
|
Then it makes the new secret, clears `grants`, and connects with it if the page was
|
|
820
897
|
connected, connecting or reconnecting (or taken over). A page that never had a secret
|
|
821
|
-
makes one without connecting. If
|
|
822
|
-
|
|
898
|
+
makes one without connecting. If storage cannot keep the new secret (full, blocked, or a
|
|
899
|
+
`storage` whose writes fail), the page uses it until it is reloaded and does not read the
|
|
900
|
+
old one over it; after a reload it reads the old one, whose grants were revoked. If the
|
|
901
|
+
page cannot be taken back (the relay is unreachable, or someone takes it over again first), it rejects and keeps the old secret,
|
|
823
902
|
so calling it again tries again. A second call while it runs returns the same promise;
|
|
824
903
|
`connect()` meanwhile waits for it and then connects with the new secret. A page with
|
|
825
904
|
its own UI calls `disconnectAll()` from a click. Connected apps keep working after a reload once the page connects
|
|
@@ -981,14 +1060,14 @@ sign in with the account you use on this page" only once it is `bound`. Until th
|
|
|
981
1060
|
says what is missing: "Checking your sign-in…" (`pending`), "Sign in to this page first."
|
|
982
1061
|
(`none`), or that the sign-in was not accepted, with `identityMessage` (`refused`).
|
|
983
1062
|
|
|
984
|
-
An open dialog counts for 10 minutes (relays after 0.13.
|
|
1063
|
+
An open dialog counts for 10 minutes (relays after 0.13.2-rc.1): a sign-in pairs the page
|
|
985
1064
|
only until 10 minutes after the last `startPairing()`, which the dialog calls when it
|
|
986
1065
|
opens. The relay says for how long (`pairing.open`); the library counts that on the
|
|
987
1066
|
page's own clock from the message's arrival and keeps the end in `pairingUntil` (an ISO
|
|
988
1067
|
time, event `pairinguntil`), so a page whose clock differs from the relay's still shows
|
|
989
1068
|
the right moment. `pairingUntil` is `undefined` while pairing is off, from each
|
|
990
1069
|
`startPairing()` until the relay answers, after the session ended (`disconnect()`,
|
|
991
|
-
`disconnectAll()`, a refusal), and with a relay up to 0.13.
|
|
1070
|
+
`disconnectAll()`, a refusal), and with a relay up to 0.13.2-rc.1. The dialog shows "Your AI
|
|
992
1071
|
app can connect until 14:32." under the sign-in line and, once that time is up (also
|
|
993
1072
|
checked when the tab comes back to the front), "The time to connect your AI app is up"
|
|
994
1073
|
with Continue, which calls `startPairing()` again. Nothing starts the 10 minutes again
|
|
@@ -996,7 +1075,7 @@ by itself: not a timer, and not a reconnect the library makes by itself once the
|
|
|
996
1075
|
was sent, answered or not (after one, `pairingUntil` is the time of the reconnect, so
|
|
997
1076
|
the dialog shows Continue). `connect()` from a click while reconnecting ("Connect again")
|
|
998
1077
|
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.
|
|
1078
|
+
call `startPairing()` only from the user's click. With a relay up to 0.13.2-rc.1 an open dialog
|
|
1000
1079
|
counts as long as it is open, and after a reconnect the dialog shows Continue too. A
|
|
1001
1080
|
sign-in that comes back after the time is up gets the relay's answer that no page is
|
|
1002
1081
|
connecting with that account; Continue, then Connect again on the relay's page, pairs it.
|
|
@@ -1022,7 +1101,7 @@ the session ends after the message was sent and before the relay answered, and w
|
|
|
1022
1101
|
or may not have done it, and `grants` says so once the page is connected again. They
|
|
1023
1102
|
also reject with the relay's refusal of that message, an `Error` whose `code` is
|
|
1024
1103
|
`store_unavailable` (the relay could not save the change: try again) or `unknown_id`.
|
|
1025
|
-
A relay after 0.13.
|
|
1104
|
+
A relay after 0.13.2-rc.1 names the message it answers (`for`, and `grantId` for a
|
|
1026
1105
|
revocation), so with several revocations pending only the one it answers rejects; an
|
|
1027
1106
|
older relay's refusal rejects every pending `revoke()` and `signOut()`. When the relay
|
|
1028
1107
|
does not know a grant the page lists (it expired), the grant leaves `grants` (with
|
|
@@ -1514,7 +1593,11 @@ counts as new.
|
|
|
1514
1593
|
never by what the page says: give `relayOrigin()` the configured relay's origin,
|
|
1515
1594
|
exactly, and show the verified host in the question.
|
|
1516
1595
|
- **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
|
|
1596
|
+
names the AI app's verified host. How to ask is the extension's (`ask`): an `ask`
|
|
1597
|
+
that answers `allow` without asking the user ("always allow" for a host) is only
|
|
1598
|
+
safe for a public DNS name the relay verified, at an AI app that ties each sign-in
|
|
1599
|
+
to the account of the browser that started it, with a limit on such fills and a
|
|
1600
|
+
notice for each; the library enforces none of this.
|
|
1518
1601
|
The one exception is the one more fill for the same tab and the same relay request
|
|
1519
1602
|
(next point), which follows that request's yes without a new question;
|
|
1520
1603
|
`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\" is a refusal.\n\treturn Promise.resolve()\n\t\t.then(() => onConfirm(request))\n\t\t.then((answer) => (answer === \"unanswered\" ? answer : answer === true));\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "4JAwCA,SAAS,EAAa,CAAC,EAAmD,CACzE,GAAI,CACH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