@ractive-ch/tab-mcp-client 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +116 -19
- package/allowed.d.ts +28 -0
- package/allowed.js +14 -0
- package/allowed.js.map +10 -0
- package/always-allowed.d.ts +140 -22
- package/cdn/allowed.min.js +4 -0
- package/cdn/allowed.min.js.map +10 -0
- package/cdn/confirm-f36n8xj5.min.js +4 -0
- package/cdn/confirm-f36n8xj5.min.js.map +10 -0
- package/cdn/connect-ph4xxen4.min.js +6 -0
- package/cdn/connect-ph4xxen4.min.js.map +12 -0
- package/cdn/{index-t33bb2g4.min.js → tab-mcp-client-2vx9mcww.min.js} +20 -9
- package/cdn/tab-mcp-client-2vx9mcww.min.js.map +12 -0
- package/cdn/tab-mcp-client-6gcmd7n8.min.js +5 -0
- package/cdn/tab-mcp-client-6gcmd7n8.min.js.map +10 -0
- package/cdn/tab-mcp-client.min.js +3 -3
- package/cdn/tab-mcp-client.min.js.map +4 -4
- package/{confirm-vj2zbq4w.js → confirm-jbyqzy14.js} +29 -19
- package/confirm-jbyqzy14.js.map +10 -0
- package/confirm.d.ts +27 -20
- package/{connect-9pefy0xe.js → connect-13hkdpcx.js} +113 -16
- package/connect-13hkdpcx.js.map +10 -0
- package/connect.d.ts +2 -2
- package/dialog.d.ts +1 -1
- package/{index-qw8qy5ed.js → index-c1c266tm.js} +27 -89
- package/index-c1c266tm.js.map +11 -0
- package/index-h8b3dc5p.js +245 -0
- package/index-h8b3dc5p.js.map +10 -0
- package/index.js +16 -19
- package/index.js.map +4 -4
- package/package.json +7 -2
- package/react.d.ts +19 -0
- package/react.js +30 -1
- package/react.js.map +3 -3
- package/secret.d.ts +6 -0
- package/strings.d.ts +12 -3
- package/tab-mcp.d.ts +5 -4
- package/types.d.ts +16 -7
- package/cdn/confirm-mqmvsxg1.min.js +0 -4
- package/cdn/confirm-mqmvsxg1.min.js.map +0 -10
- package/cdn/connect-c7wn48yp.min.js +0 -6
- package/cdn/connect-c7wn48yp.min.js.map +0 -12
- package/cdn/index-t33bb2g4.min.js.map +0 -13
- package/confirm-vj2zbq4w.js.map +0 -10
- package/connect-9pefy0xe.js.map +0 -10
- package/index-qw8qy5ed.js.map +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,54 @@ 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.18.0][client-0.18.0] - 2026-11-20
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`@ractive-ch/tab-mcp-client/allowed`**, an entry of its own (not in the core):
|
|
14
|
+
`allowedTools(mcp)` returns the tools that run without asking, per connected AI app,
|
|
15
|
+
for a page that draws its own switches: `tools()` (the tools that ask, each with
|
|
16
|
+
`destructive`), `has`, `list`, `allow`, `ask`, `everything`, `setEverything`,
|
|
17
|
+
`forget`, `onChange` and `kept`. Types `AllowedTools`, `AllowedTool` (DEC-200). It
|
|
18
|
+
works with `alwaysAllow` unset too, kept in `storage`. Without a bundler:
|
|
19
|
+
`cdn/allowed.min.js` beside `cdn/tab-mcp-client.min.js` (package export
|
|
20
|
+
`./cdn/allowed`), sharing its chunks; a page that does not import it loads nothing
|
|
21
|
+
more.
|
|
22
|
+
- **"Allow everything, no questions asked"** per AI app: every tool runs without asking,
|
|
23
|
+
also ones registered later, changed and destructive ones.
|
|
24
|
+
- **Switches in the connect dialog**: under each connected app, a switch per tool that
|
|
25
|
+
asks (destructive ones marked) and "Allow everything, no questions asked" with a
|
|
26
|
+
sentence on what it means; checkboxes with `role="switch"` whose accessible names name
|
|
27
|
+
the app. Tools allowed but not registered right now are listed by name, to turn off.
|
|
28
|
+
Without `alwaysAllow`, only what is allowed for that app is shown, as switches that can
|
|
29
|
+
only be turned off. The methods of `allowedTools(mcp)` are bound; `ask` while
|
|
30
|
+
"everything" is on turns "everything" off for that app.
|
|
31
|
+
- `useAllowedTools(grantId)` in `@ractive-ch/tab-mcp-client/react`: the tools that ask,
|
|
32
|
+
each with `allowed`, `everything` and the `allowedTools` object to change them.
|
|
33
|
+
- `alwaysAllow: "until-reload"`.
|
|
34
|
+
- `ui.strings`: `alwaysAllow`, `alwaysAllowNote`, `destructive`, `allowToolApp`,
|
|
35
|
+
`allowDestructiveToolApp`, `allowEverything`, `allowEverythingApp`,
|
|
36
|
+
`allowEverythingNote`.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- **`alwaysAllow: true` keeps allowances until the app is disconnected**, in `storage`
|
|
41
|
+
under the secret's key with `#allowed` appended (grant ids, tool names, the title and
|
|
42
|
+
description the user saw, a fingerprint of the secret; no arguments). They end when
|
|
43
|
+
the relay reports the grant gone (disconnected, "Disconnect all apps", expired, signed
|
|
44
|
+
out), not on a dropped connection or a reload. With `storage: null` they are kept in
|
|
45
|
+
memory. `alwaysAllow: "until-reload"` is the old behaviour.
|
|
46
|
+
- **The confirmation's third button** says "Always allow" with `alwaysAllow: true`, and
|
|
47
|
+
"Allow until reload" with `"until-reload"` or `storage: null`, each with its own note.
|
|
48
|
+
- **An allowed call no longer reaches the page's own `onConfirm`**: it runs without
|
|
49
|
+
asking. React's provider always installs an `onConfirm`, so this holds there too.
|
|
50
|
+
- **A tool that is unregistered keeps its allowance** (a reload registers every tool
|
|
51
|
+
again); one registered again with another title or description is asked again, as
|
|
52
|
+
before.
|
|
53
|
+
- `ui.strings`: `runsWithoutAsking` is the heading over the switches ("Runs without
|
|
54
|
+
asking", without `{tools}`); `askAgain` and `askAgainApp` are gone ("Ask again" is
|
|
55
|
+
replaced by the switches).
|
|
56
|
+
|
|
9
57
|
## [0.17.0][client-0.17.0] - 2026-11-19
|
|
10
58
|
|
|
11
59
|
### Breaking
|
|
@@ -822,6 +870,7 @@ First alpha of the browser library, on the npm dist-tag `alpha`.
|
|
|
822
870
|
`<script type="module">` under `@ractive-ch/tab-mcp-client/cdn`.
|
|
823
871
|
- The connect dialog shows the pairing code from the relay.
|
|
824
872
|
|
|
873
|
+
[client-0.18.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.18.0
|
|
825
874
|
[client-0.17.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.17.0
|
|
826
875
|
[client-0.16.2]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.16.2
|
|
827
876
|
[client-0.16.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.16.1
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ How the library, the relay and the tab-mcp browser extension fit together, with
|
|
|
15
15
|
picture:
|
|
16
16
|
[How the parts fit together](https://github.com/ractive/tab-mcp#how-the-parts-fit-together).
|
|
17
17
|
|
|
18
|
-
**Status: 0.
|
|
18
|
+
**Status: 0.18.0.** Until 1.0, a new minor version can still change the API. Which AI apps
|
|
19
19
|
work is listed in [compatibility](https://github.com/ractive/tab-mcp/blob/main/docs/compatibility.md).
|
|
20
20
|
|
|
21
21
|
## You need a relay
|
|
@@ -50,7 +50,7 @@ Or without a bundler, from a CDN as an ES module:
|
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
52
|
<script type="module">
|
|
53
|
-
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.
|
|
53
|
+
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.18.0/cdn/tab-mcp-client.min.js";
|
|
54
54
|
</script>
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -206,7 +206,7 @@ trial token that a script adds later counts for a `TabMcp` made after it.
|
|
|
206
206
|
- A WebMCP call takes the same path as an AI app's: the arguments are checked against
|
|
207
207
|
`inputSchema` (Chrome does not check them), a consequential tool asks (`onConfirm`, or
|
|
208
208
|
the library's dialog, which names the caller "An agent in this browser"), and
|
|
209
|
-
`toolcall` and `toolcallend` fire with `client: { kind: "webmcp" }`. "
|
|
209
|
+
`toolcall` and `toolcallend` fire with `client: { kind: "webmcp" }`. "Always allow" is
|
|
210
210
|
never offered or applied for these calls: there is no identity to remember it for.
|
|
211
211
|
- The call resolves with what `execute` returned, which the browser hands the agent as
|
|
212
212
|
JSON text. An MCP result goes out as its `structuredContent` if it has one, else as
|
|
@@ -450,7 +450,7 @@ instructions, as the recipe does with a delimited block.
|
|
|
450
450
|
in a message is ignored, so the other end cannot pass for an AI app of the relay.
|
|
451
451
|
- Without `serve`'s `onConfirm`, a consequential call through the port asks the page's
|
|
452
452
|
`onConfirm` or the library's dialog, which names the caller "Example assistant (this
|
|
453
|
-
site's assistant)" and never offers "
|
|
453
|
+
site's assistant)" and never offers "Always allow".
|
|
454
454
|
- `requestTimeoutMs` (300 s by default, as `createTunnelFetch`; below 2^31 ms) limits each
|
|
455
455
|
request on the page's side: on expiry the call is aborted (`execute`'s signal and the
|
|
456
456
|
question's), `toolcallend` says `cancelled`, a later answer of the tool is dropped, and
|
|
@@ -484,18 +484,12 @@ asks the user before every call ("Don't allow" or "Allow"), showing the AI app a
|
|
|
484
484
|
arguments. A refusal reaches the AI app as an error result, and so does a call whose tool
|
|
485
485
|
was removed while the user was asked.
|
|
486
486
|
|
|
487
|
-
`alwaysAllow: true` adds "
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
again", and a tool registered again unchanged (React's `useTool` on a remount) keeps its
|
|
491
|
-
entry; one whose title or description changed is asked again. It is off by default: it
|
|
492
|
-
lifts the only brake at run time, which is what a prompt injection needs, and the relay
|
|
493
|
-
cannot help, since its one OAuth scope (`tools`) covers every tool of the page. Consent
|
|
494
|
-
per tool is the page's. Turn it on only for tools whose calls the user need not check one
|
|
495
|
-
by one.
|
|
487
|
+
`alwaysAllow: true` adds "Always allow", which lets that tool run without asking for that
|
|
488
|
+
AI app from then on; see [Tools that run without asking](#tools-that-run-without-asking).
|
|
489
|
+
It is off by default.
|
|
496
490
|
|
|
497
491
|
Tools are called while the user is in the AI app, so the dialog often opens in a tab in
|
|
498
|
-
the background. "Allow" and "
|
|
492
|
+
the background. "Allow" and "Always allow" can be clicked only once the page has
|
|
499
493
|
been visible and focused for 750 ms with the dialog open; leaving the page
|
|
500
494
|
disables them and coming back starts the wait again, so the click that brings the page
|
|
501
495
|
forward cannot approve. One confirmation is shown at a time; the others wait, the shown
|
|
@@ -520,8 +514,8 @@ Not when an `onConfirm` answers (the page's, or for a served port its own): it m
|
|
|
520
514
|
anywhere, such as a side panel or the site's chat. Say where in the tool's own
|
|
521
515
|
description if the AI app should know.
|
|
522
516
|
|
|
523
|
-
Pass `onConfirm` to ask in your own UI (it is asked every
|
|
524
|
-
|
|
517
|
+
Pass `onConfirm` to ask in your own UI (it is asked for every call the user has not
|
|
518
|
+
allowed, see [Tools that run without asking](#tools-that-run-without-asking)). Show the verified `client.host` next to the name the AI app declares, as the
|
|
525
519
|
library's dialog does, since anyone can declare any name. Escape the arguments and the
|
|
526
520
|
name as the dialog does with `escapeInvisible` from `@ractive-ch/tab-mcp-client/visible`
|
|
527
521
|
(an entry of its own, not in the core):
|
|
@@ -553,6 +547,109 @@ outcome `unanswered`. Any other value, and a throw, is a refusal.
|
|
|
553
547
|
`mcp.confirmInPage(request, { document })` is the library's own dialog, for an
|
|
554
548
|
`onConfirm` that handles only some calls itself (`document` defaults to the global one).
|
|
555
549
|
|
|
550
|
+
### Tools that run without asking
|
|
551
|
+
|
|
552
|
+
The user can let a consequential tool run without asking, for one connected AI app: one
|
|
553
|
+
tool at a time ("Always allow" this tool), or everything ("Allow everything, no questions
|
|
554
|
+
asked"). An allowed call runs at once, with the library's dialog and with your own
|
|
555
|
+
`onConfirm` alike: neither is asked. Only AI apps through the relay can be allowed; an
|
|
556
|
+
agent in the browser (WebMCP) and a served port have no grant to remember it for and are
|
|
557
|
+
always asked.
|
|
558
|
+
|
|
559
|
+
The option `alwaysAllow` decides what the library's dialogs offer:
|
|
560
|
+
|
|
561
|
+
| `alwaysAllow` | The confirmation offers | The connect dialog shows | Kept |
|
|
562
|
+
| ---------------- | -------------------------- | ------------------------------------- | -------------------------------------------- |
|
|
563
|
+
| unset or `false` | Don't allow, Allow | nothing (unless something is allowed) | in `storage`, for your own switches |
|
|
564
|
+
| `true` | … and "Always allow" | the switches under each app | in `storage`, until the app is disconnected |
|
|
565
|
+
| `"until-reload"` | … and "Allow until reload" | the switches under each app | in memory, until the page is reloaded |
|
|
566
|
+
|
|
567
|
+
With `true` and `storage: null`, nothing outlives the page either, and the button says
|
|
568
|
+
"Allow until reload". The confirmation never offers "allow everything": that is a
|
|
569
|
+
deliberate act in the connect dialog, not an answer to one question. In the connect
|
|
570
|
+
dialog, each connected app gets a switch per tool that asks (its title or name;
|
|
571
|
+
destructive ones marked) and "Allow everything, no questions asked", with a sentence on
|
|
572
|
+
what it means. The switches are checkboxes with `role="switch"` whose accessible names
|
|
573
|
+
name the app. A tool that is allowed but not registered right now (a page may offer some
|
|
574
|
+
tools only on some views) is listed by its name, as a switch that can only be turned
|
|
575
|
+
off. When the page does not offer allowing (`alwaysAllow` unset) but something is
|
|
576
|
+
allowed for an app (by your own switches), the connect dialog shows only that, as
|
|
577
|
+
switches that can only be turned off ("everything" only while it is on): the user can
|
|
578
|
+
see and end what runs without asking where they disconnect apps, and is never offered
|
|
579
|
+
more than the page chose to offer.
|
|
580
|
+
|
|
581
|
+
**What counts.** An allowed tool runs without asking as long as its title and
|
|
582
|
+
description are the ones the user allowed: a tool registered with another one is asked
|
|
583
|
+
again and leaves the list. A tool that is not registered for a while keeps its allowance
|
|
584
|
+
(a reload registers every tool again; a page may offer some only on some views).
|
|
585
|
+
"Everything" covers every tool, also ones registered later, changed ones and destructive
|
|
586
|
+
ones: that is why it is a switch of its own.
|
|
587
|
+
|
|
588
|
+
**Where it is kept, and when it ends.** In the page's `storage` (by default
|
|
589
|
+
`localStorage`), under the address secret's key with `#allowed` appended: the grant ids,
|
|
590
|
+
the tool names and the title and description the user saw, and a fingerprint of the
|
|
591
|
+
secret; no arguments, no results. An allowance ends with its grant, as the relay reports
|
|
592
|
+
it: the app is disconnected (in the page or elsewhere), "Disconnect all apps"
|
|
593
|
+
(`newAddress()`), the grant expired, the user signed out (identity binding). A dropped
|
|
594
|
+
connection, a reload or a page that has not connected yet keeps them. Tabs that share the
|
|
595
|
+
address share them, and a change in one counts in the others at once.
|
|
596
|
+
|
|
597
|
+
**Your own switches.** `@ractive-ch/tab-mcp-client/allowed` (an entry of its own, not in
|
|
598
|
+
the core) has the same allowances for a UI of your own, also with `alwaysAllow` unset:
|
|
599
|
+
|
|
600
|
+
```ts
|
|
601
|
+
import { allowedTools } from "@ractive-ch/tab-mcp-client/allowed";
|
|
602
|
+
|
|
603
|
+
const allowed = allowedTools(mcp); // one object per TabMcp
|
|
604
|
+
function drawSwitches() {
|
|
605
|
+
list.replaceChildren(
|
|
606
|
+
...mcp.grants.flatMap((grant) => [
|
|
607
|
+
...allowed.tools().map((tool) =>
|
|
608
|
+
mySwitch(`${tool.title ?? tool.name}${tool.destructive ? " (destructive)" : ""}`,
|
|
609
|
+
allowed.has(grant.grantId, tool.name),
|
|
610
|
+
(on) => on ? allowed.allow(grant.grantId, tool.name) : allowed.ask(grant.grantId, tool.name)),
|
|
611
|
+
),
|
|
612
|
+
mySwitch("Allow everything, no questions asked",
|
|
613
|
+
allowed.everything(grant.grantId),
|
|
614
|
+
(on) => allowed.setEverything(grant.grantId, on)),
|
|
615
|
+
]),
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
allowed.onChange(drawSwitches); // allowances and tools
|
|
619
|
+
mcp.addEventListener("grantschange", drawSwitches);
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
- `tools()`: the tools that ask (`consequentialHint`, callable through the relay), each
|
|
623
|
+
`{ name, title?, description, destructive }`.
|
|
624
|
+
- `has(grantId, name)`: whether a call runs without asking now. `list(grantId)`: the
|
|
625
|
+
names allowed one by one (one registered now with another title or description is
|
|
626
|
+
not in it). `everything(grantId)`. These only read, so they are safe while drawing.
|
|
627
|
+
- `allow(grantId, name)` (as the tool is registered now), `ask(grantId, name)`,
|
|
628
|
+
`setEverything(grantId, on)`, `forget(grantId)` (everything of that app asks again).
|
|
629
|
+
Allowing does nothing for an app that is not in `mcp.grants`. `ask` while
|
|
630
|
+
"everything" is on turns "everything" off for that app too, and leaves the other
|
|
631
|
+
tools allowed one by one as they are: asking again errs towards asking.
|
|
632
|
+
- `onChange(listener)` returns what stops it. `kept` says whether they outlive a reload.
|
|
633
|
+
The methods are bound: `const { allow, ask } = allowedTools(mcp)` works.
|
|
634
|
+
- In React, `useAllowedTools(grantId)` of `@ractive-ch/tab-mcp-client/react` returns
|
|
635
|
+
`{ tools (each with allowed), everything, allowedTools }` and renders again on a change.
|
|
636
|
+
- Without a bundler, `cdn/allowed.min.js` sits beside the CDN build's
|
|
637
|
+
`tab-mcp-client.min.js` and shares its chunks (one store with the dialogs); a page
|
|
638
|
+
that does not import it loads nothing of it. Take both from the same version:
|
|
639
|
+
|
|
640
|
+
```js
|
|
641
|
+
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.18.0/cdn/tab-mcp-client.min.js";
|
|
642
|
+
import { allowedTools } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.18.0/cdn/allowed.min.js";
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
**The risk.** An allowance outlives the user's attention: for up to the grant's 90 days,
|
|
646
|
+
calls run that nobody looks at. An AI app can be steered by text it reads (a web page, a
|
|
647
|
+
mail, a document), and an allowed tool is then the one that runs on its say. Offer it
|
|
648
|
+
for tools one would not want to check each time, whose worst call is cheap to undo; not
|
|
649
|
+
for tools that pay, send, delete or publish. "Everything" also covers tools the user has
|
|
650
|
+
not seen, and ones the page adds later. The relay cannot help: its one OAuth scope
|
|
651
|
+
(`tools`) covers every tool of the page, so consent per tool is the page's.
|
|
652
|
+
|
|
556
653
|
### Connecting and pairing
|
|
557
654
|
|
|
558
655
|
1. The user clicks your button. `showConnectDialog()` connects (call it from the click
|
|
@@ -593,8 +690,8 @@ outcome `unanswered`. Any other value, and a throw, is a refusal.
|
|
|
593
690
|
(claude.ai) is connected" (every connected app is named) and what to do next (close it and ask the app to use the
|
|
594
691
|
page's tools); screen readers hear the same. The setup (address, code, help) moves
|
|
595
692
|
behind "Connect another app", closed, so the next code does not appear in view; the
|
|
596
|
-
connected app is listed with a Disconnect button (and
|
|
597
|
-
|
|
693
|
+
connected app is listed with a Disconnect button (and, with `alwaysAllow`, the
|
|
694
|
+
switches for what it may run without asking), and "Done" closes the dialog. A Disconnect the relay could
|
|
598
695
|
not save says so in the list ("The relay could not save this. Try again.").
|
|
599
696
|
Opened again while an app is connected, the dialog starts like this, with the focus
|
|
600
697
|
on Done.
|
|
@@ -1046,7 +1143,7 @@ function TodoList() {
|
|
|
1046
1143
|
again only when its name, title, description, input or output schema or annotations
|
|
1047
1144
|
change, or `options.callers` or `options.exposedTo` (by value: a new array with the same
|
|
1048
1145
|
entries is no change; [which callers see a tool](#which-callers-see-a-tool),
|
|
1049
|
-
[WebMCP](#webmcp), whose `webmcp` on the provider turns it on). Registered again unchanged,
|
|
1146
|
+
[WebMCP](#webmcp), whose `webmcp` on the provider turns it on). Registered again unchanged, an allowed tool stays
|
|
1050
1147
|
allowed. StrictMode's double mount registers it once at a time. A duplicate name or an
|
|
1051
1148
|
invalid tool is thrown from the component's render, for an error boundary. Tools that
|
|
1052
1149
|
read state right after another tool changed it should read it from a store (as the
|
package/allowed.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@ractive-ch/tab-mcp-client/allowed`: the tools that run without asking,
|
|
3
|
+
* per connected AI app, for a page that draws its own switches ("always
|
|
4
|
+
* allow this tool", "allow everything, no questions asked"). The library's
|
|
5
|
+
* dialogs use the same allowances. An entry of its own, out of the core
|
|
6
|
+
* (DEC-200).
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { allowedTools } from "@ractive-ch/tab-mcp-client/allowed";
|
|
10
|
+
* const allowed = allowedTools(mcp);
|
|
11
|
+
* for (const tool of allowed.tools()) {
|
|
12
|
+
* box.checked = allowed.has(grant.grantId, tool.name);
|
|
13
|
+
* box.onchange = () => box.checked ? allowed.allow(grant.grantId, tool.name) : allowed.ask(grant.grantId, tool.name);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { type AllowedTool, type AllowedTools } from "./always-allowed.js";
|
|
18
|
+
import type { TabMcp } from "./tab-mcp.js";
|
|
19
|
+
export type { AllowedTool, AllowedTools };
|
|
20
|
+
/**
|
|
21
|
+
* The allowances of `mcp`: one object per `TabMcp`, the same for every
|
|
22
|
+
* call. Kept in its `storage` next to the address secret until the app is
|
|
23
|
+
* disconnected (in memory with `storage: null` or `alwaysAllow:
|
|
24
|
+
* "until-reload"`); they end with the app's grant, as the relay reports it,
|
|
25
|
+
* and with `newAddress()`. A call they allow runs without asking, with the
|
|
26
|
+
* library's dialog and with the page's own `onConfirm` alike.
|
|
27
|
+
*/
|
|
28
|
+
export declare function allowedTools(mcp: TabMcp): AllowedTools;
|
package/allowed.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
allowedFor
|
|
3
|
+
} from "./index-h8b3dc5p.js";
|
|
4
|
+
|
|
5
|
+
// src/allowed.ts
|
|
6
|
+
function allowedTools(mcp) {
|
|
7
|
+
return allowedFor(mcp);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
allowedTools
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# debugId=F620A76B3CA348AE64756E2164756E21
|
|
14
|
+
//# sourceMappingURL=allowed.js.map
|
package/allowed.js.map
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/allowed.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * `@ractive-ch/tab-mcp-client/allowed`: the tools that run without asking,\n * per connected AI app, for a page that draws its own switches (\"always\n * allow this tool\", \"allow everything, no questions asked\"). The library's\n * dialogs use the same allowances. An entry of its own, out of the core\n * (DEC-200).\n *\n * ```ts\n * import { allowedTools } from \"@ractive-ch/tab-mcp-client/allowed\";\n * const allowed = allowedTools(mcp);\n * for (const tool of allowed.tools()) {\n * box.checked = allowed.has(grant.grantId, tool.name);\n * box.onchange = () => box.checked ? allowed.allow(grant.grantId, tool.name) : allowed.ask(grant.grantId, tool.name);\n * }\n * ```\n */\n\nimport {\n\ttype AllowedTool,\n\ttype AllowedTools,\n\tallowedFor,\n} from \"./always-allowed.ts\";\nimport type { TabMcp } from \"./tab-mcp.ts\";\n\nexport type { AllowedTool, AllowedTools };\n\n/**\n * The allowances of `mcp`: one object per `TabMcp`, the same for every\n * call. Kept in its `storage` next to the address secret until the app is\n * disconnected (in memory with `storage: null` or `alwaysAllow:\n * \"until-reload\"`); they end with the app's grant, as the relay reports it,\n * and with `newAddress()`. A call they allow runs without asking, with the\n * library's dialog and with the page's own `onConfirm` alike.\n */\nexport function allowedTools(mcp: TabMcp): AllowedTools {\n\treturn allowedFor(mcp);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;AAkCO,SAAS,YAAY,CAAC,KAA2B;AAAA,EACvD,OAAO,WAAW,GAAG;AAAA;",
|
|
8
|
+
"debugId": "F620A76B3CA348AE64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/always-allowed.d.ts
CHANGED
|
@@ -1,34 +1,152 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The tools
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The tools that run without asking, per AI app (grant), DEC-096 and
|
|
3
|
+
* DEC-200: the ones the user allowed one by one, each with what the user
|
|
4
|
+
* saw of it (title and description; a tool that changed since is asked
|
|
5
|
+
* again and leaves the list), and "everything", which covers every tool of
|
|
6
|
+
* the page, also ones the user has not seen.
|
|
7
|
+
*
|
|
8
|
+
* Kept in the page's `storage` under the secret's key with `#allowed`, so
|
|
9
|
+
* that they outlive a reload; in memory with `alwaysAllow: "until-reload"`,
|
|
10
|
+
* with `storage: null` and without a relay. Storage is read first on every
|
|
11
|
+
* question, so that a change in another tab of the same address counts at
|
|
12
|
+
* once (only one tab at a time holds the connection, DEC-095).
|
|
13
|
+
*
|
|
14
|
+
* An allowance ends with its grant, and only on what the relay says: the
|
|
15
|
+
* grants of a new session, a removed grant, `newAddress()` (the relay
|
|
16
|
+
* revoked them all). A dropped connection, or a page that has not connected
|
|
17
|
+
* yet, keeps them: `grantschange` does not fire then. They also belong to
|
|
18
|
+
* the address secret they were made under, so a new secret (`newAddress()`
|
|
19
|
+
* here or in another tab) ends them even where nothing listened.
|
|
20
|
+
*
|
|
21
|
+
* Out of the core: the confirmation (`confirm.ts`, which the core loads for
|
|
22
|
+
* every consequential call), the connect dialog and
|
|
23
|
+
* `@ractive-ch/tab-mcp-client/allowed` import it.
|
|
8
24
|
*/
|
|
9
25
|
import type { TabMcp } from "./tab-mcp.js";
|
|
10
26
|
import type { ConfirmRequest } from "./types.js";
|
|
27
|
+
/** What the user saw of a tool: its name, title and description. */
|
|
11
28
|
type ToolSeen = ConfirmRequest["tool"];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
/** A tool as the registry or a call names it. */
|
|
30
|
+
type ToolNow = {
|
|
31
|
+
name: string;
|
|
32
|
+
title?: string | undefined;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
/** A tool that asks before it runs, for a page's switch. */
|
|
36
|
+
export interface AllowedTool {
|
|
37
|
+
name: string;
|
|
38
|
+
title?: string;
|
|
39
|
+
description: string;
|
|
40
|
+
/** Marked `destructiveHint`: it may delete or overwrite. */
|
|
41
|
+
destructive: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tools that run without asking, per connected AI app (`Grant.grantId`),
|
|
45
|
+
* for a page that draws its own switches: `allowedTools(mcp)` of
|
|
46
|
+
* `@ractive-ch/tab-mcp-client/allowed`. The library's dialogs use the same.
|
|
47
|
+
* The methods are bound: `const { allow } = allowedTools(mcp)` works. The
|
|
48
|
+
* queries (`tools`, `list`, `has`, `everything`) only read: safe while
|
|
49
|
+
* drawing.
|
|
50
|
+
*/
|
|
51
|
+
export interface AllowedTools {
|
|
52
|
+
/**
|
|
53
|
+
* `true`: kept in the page's `storage` until the app is disconnected;
|
|
54
|
+
* `false`: in memory, until the page is reloaded or the app is
|
|
55
|
+
* disconnected (`alwaysAllow: "until-reload"`, `storage: null`).
|
|
56
|
+
*/
|
|
57
|
+
readonly kept: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The page's tools that ask before they run (`consequentialHint`, callable
|
|
60
|
+
* by AI apps through the relay), in the order registered.
|
|
61
|
+
*/
|
|
62
|
+
tools(): AllowedTool[];
|
|
63
|
+
/**
|
|
64
|
+
* The names of the tools allowed one by one for this app, in the order
|
|
65
|
+
* allowed; also one that is not registered right now (it runs without
|
|
66
|
+
* asking again once it is back unchanged). One registered now with another
|
|
67
|
+
* title or description than the user allowed is not in it (it asks).
|
|
68
|
+
*/
|
|
17
69
|
list(grantId: string): string[];
|
|
18
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Whether a call of this tool by this app runs without asking now:
|
|
72
|
+
* "everything" is on, or the tool is allowed and registered unchanged.
|
|
73
|
+
*/
|
|
74
|
+
has(grantId: string, name: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Allow one tool for this app from now on, as it is registered now (its
|
|
77
|
+
* title and description). Nothing happens for an app that is not in
|
|
78
|
+
* `mcp.grants` or a tool that is not in `tools()`.
|
|
79
|
+
*/
|
|
80
|
+
allow(grantId: string, name: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Ask again before this app runs this tool. While "everything" is on for
|
|
83
|
+
* the app, that goes off too (asking again errs towards asking); the
|
|
84
|
+
* other tools allowed one by one stay allowed.
|
|
85
|
+
*/
|
|
86
|
+
ask(grantId: string, name: string): void;
|
|
87
|
+
/** Whether "Allow everything, no questions asked" is on for this app. */
|
|
88
|
+
everything(grantId: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* "Allow everything, no questions asked" for this app: every tool runs
|
|
91
|
+
* without asking, with any arguments, also tools registered later, changed
|
|
92
|
+
* ones and destructive ones. Turning it on does nothing for an app that
|
|
93
|
+
* is not in `mcp.grants`.
|
|
94
|
+
*/
|
|
95
|
+
setEverything(grantId: string, on: boolean): void;
|
|
96
|
+
/** Ask again for everything of this app: its tools and "everything". */
|
|
19
97
|
forget(grantId: string): void;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** Calls `listener` on every change; returns what stops it. */
|
|
98
|
+
/**
|
|
99
|
+
* Calls `listener` on every change of the allowances (also one in
|
|
100
|
+
* another tab of the same address) and of `tools()`; returns what stops it.
|
|
101
|
+
*/
|
|
25
102
|
onChange(listener: () => void): () => void;
|
|
26
103
|
}
|
|
27
104
|
/**
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
105
|
+
* The allowances of one `TabMcp`. The public methods are arrow fields, so
|
|
106
|
+
* that they work taken off the object; the queries never write.
|
|
107
|
+
*/
|
|
108
|
+
export declare class Allowances implements AllowedTools {
|
|
109
|
+
#private;
|
|
110
|
+
readonly kept: boolean;
|
|
111
|
+
/** The library's dialogs offer allowing (`alwaysAllow` on). */
|
|
112
|
+
readonly offered: boolean;
|
|
113
|
+
constructor(mcp: TabMcp);
|
|
114
|
+
readonly tools: () => AllowedTool[];
|
|
115
|
+
readonly list: (grantId: string) => string[];
|
|
116
|
+
readonly has: (grantId: string, name: string) => boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether this call runs without asking: "everything", or this tool as
|
|
119
|
+
* the user saw it. Only reads: a tool that changed since asks, and leaves
|
|
120
|
+
* the list when the registry or another tab's change is seen
|
|
121
|
+
* (`toolsChanged`).
|
|
122
|
+
*/
|
|
123
|
+
allows(grantId: string, tool: ToolNow): boolean;
|
|
124
|
+
readonly allow: (grantId: string, name: string) => void;
|
|
125
|
+
/** Allow `tool` as the user saw it, for an app the relay still lists. */
|
|
126
|
+
keep(grantId: string, tool: ToolSeen): void;
|
|
127
|
+
readonly ask: (grantId: string, name: string) => void;
|
|
128
|
+
readonly everything: (grantId: string) => boolean;
|
|
129
|
+
readonly setEverything: (grantId: string, on: boolean) => void;
|
|
130
|
+
readonly forget: (grantId: string) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Only the grants the relay lists now: the others ended. What was kept
|
|
133
|
+
* under another secret is dropped from storage too (it allowed nothing
|
|
134
|
+
* already).
|
|
135
|
+
*/
|
|
136
|
+
keepGrants(grantIds: Iterable<string>): void;
|
|
137
|
+
/**
|
|
138
|
+
* The registry changed, or another tab changed the allowances: a tool
|
|
139
|
+
* registered with another title or description than the user saw leaves
|
|
140
|
+
* every list. One that is not registered stays (a reload registers them
|
|
141
|
+
* all again, a page may offer some only on some views). Tells the
|
|
142
|
+
* listeners in any case.
|
|
143
|
+
*/
|
|
144
|
+
toolsChanged(): void;
|
|
145
|
+
readonly onChange: (listener: () => void) => (() => void);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The allowances of `mcp`, made on first use. They follow its grants (only
|
|
149
|
+
* when the relay names them, see above) and its tools.
|
|
32
150
|
*/
|
|
33
|
-
export declare function allowedFor(mcp: TabMcp):
|
|
151
|
+
export declare function allowedFor(mcp: TabMcp): Allowances;
|
|
34
152
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/allowed.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * `@ractive-ch/tab-mcp-client/allowed`: the tools that run without asking,\n * per connected AI app, for a page that draws its own switches (\"always\n * allow this tool\", \"allow everything, no questions asked\"). The library's\n * dialogs use the same allowances. An entry of its own, out of the core\n * (DEC-200).\n *\n * ```ts\n * import { allowedTools } from \"@ractive-ch/tab-mcp-client/allowed\";\n * const allowed = allowedTools(mcp);\n * for (const tool of allowed.tools()) {\n * box.checked = allowed.has(grant.grantId, tool.name);\n * box.onchange = () => box.checked ? allowed.allow(grant.grantId, tool.name) : allowed.ask(grant.grantId, tool.name);\n * }\n * ```\n */\n\nimport {\n\ttype AllowedTool,\n\ttype AllowedTools,\n\tallowedFor,\n} from \"./always-allowed.ts\";\nimport type { TabMcp } from \"./tab-mcp.ts\";\n\nexport type { AllowedTool, AllowedTools };\n\n/**\n * The allowances of `mcp`: one object per `TabMcp`, the same for every\n * call. Kept in its `storage` next to the address secret until the app is\n * disconnected (in memory with `storage: null` or `alwaysAllow:\n * \"until-reload\"`); they end with the app's grant, as the relay reports it,\n * and with `newAddress()`. A call they allow runs without asking, with the\n * library's dialog and with the page's own `onConfirm` alike.\n */\nexport function allowedTools(mcp: TabMcp): AllowedTools {\n\treturn allowedFor(mcp);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "gDAkCO,SAAS,CAAY,CAAC,EAA2B,CACvD,OAAO,EAAW,CAAG",
|
|
8
|
+
"debugId": "276A38D7EC2846AF64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a,t,o,e,n,s,d,l}from"./tab-mcp-client-2vx9mcww.min.js";import{r}from"./tab-mcp-client-6gcmd7n8.min.js";function ee(u){try{return s(JSON.stringify(u,null,2))}catch{return}}var ne=750,te=500,J=new WeakMap;function K(u,i,b={}){if(u.signal.aborted)return Promise.resolve("deny");let p=J.get(i);if(p===void 0)p={shown:!1,waiting:[]},J.set(i,p);let f=p,c=()=>{let g=f.waiting.shift();f.shown=g!==void 0,g?.(),f.changed?.()},D=()=>{try{return ie(u,i,b,f,c)}catch(g){return c(),Promise.reject(g)}};if(!f.shown)return f.shown=!0,D();return new Promise((g)=>{let L=()=>{if(u.signal.removeEventListener("abort",v),b.allowedNow?.()===!0){g("allow"),c();return}g(D())},v=()=>{f.waiting.splice(f.waiting.indexOf(L),1),f.changed?.(),g("deny")};u.signal.addEventListener("abort",v,{once:!0}),f.waiting.push(L),f.changed?.()})}function ie(u,i,b,p,f){let c=b.strings??a(void 0),D=b.allowDelayMs??ne,g=u.tool.title??u.tool.name,L=d(u.client,c),v={tool:g,client:L},{dialog:y,id:j}=l(i,"tab-mcp-confirm",c,...o(i,c.confirmTitle,v)),S=e(i,"p",{className:"tab-mcp-waiting"}),H=()=>{let w=p.waiting.length;S.hidden=w===0,S.textContent=w===1?c.waitingOne:t(c.waitingMany,{n:String(w)})};p.changed=H,H();let z=n(i,c.deny,()=>y.close("deny"),"tab-mcp-deny","primary"),B=(w,_,O)=>{let A=n(i,w,()=>{if(!A.disabled)y.close(_)},O);return A},N=[B(c.allow,"allow","tab-mcp-allow")],I=[],W=b.alwaysAllow;if(W===!0||W==="until-reload"){let w=W===!0;N.unshift(B(w?c.alwaysAllow:c.allowUntilReload,"always","tab-mcp-always")),I.push(e(i,"p",{className:"tab-mcp-always-note"},...o(i,w?c.alwaysAllowNote:c.allowUntilReloadNote,v)))}let Y=e(i,"div",{className:"tab-mcp-actions"},z,...N.flatMap((w)=>[" ",w])),x=!1,Q=!1,k=()=>{for(let w of N)w.disabled=!(x&&Q)};k();let T=ee(u.arguments),h=e(i,"pre",{className:"tab-mcp-arguments",id:`${j}-arguments`,text:T??c.argumentsHidden});if(T===void 0)for(let w of[...N,...I])w.hidden=!0;h.dir="ltr",h.style.setProperty("white-space","pre-wrap"),h.style.setProperty("overflow-wrap","anywhere"),h.style.setProperty("max-height","var(--tab-mcp-arguments-height, min(50vh, 24rem))"),h.style.setProperty("overflow","auto"),h.hidden=Object.keys(u.arguments).length===0;let M=e(i,"p",{className:"tab-mcp-scroll-note",text:c.scrollToAllow});M.hidden=!0;let U=e(i,"p",{id:`${j}-who`},...o(i,c.confirmWho,v));y.setAttribute("aria-describedby",T!==void 0&&!h.hidden&&T.length<=te?`${U.id} ${h.id}`:U.id),y.append(U,e(i,"p",{className:"tab-mcp-description",text:u.tool.description}),h,M,Y,...I,S),i.body.append(y);let P=i.defaultView;return new Promise((w,_)=>{let O=()=>y.close("deny");u.signal.addEventListener("abort",O,{once:!0});let A,C,F=()=>{if(C!==void 0&&i.title===C.shown)i.title=C.page;C=void 0},X=()=>{if(i.visibilityState!=="hidden")F();else if(C===void 0)C={page:i.title,shown:`${c.titlePrefix}${i.title}`},i.title=C.shown},E=(m)=>{if(m?.type==="close"&&m.target===y)return;if(X(),clearTimeout(A),A=void 0,x=!1,k(),m?.type==="blur"||i.visibilityState==="hidden"||!i.hasFocus())return;A=setTimeout(()=>{x=!0,k()},D)},R=()=>{if(Q)return;if(h.scrollTop+h.clientHeight<h.scrollHeight-2){M.hidden=!1,h.tabIndex=0;return}Q=!0,M.hidden=!0,k()},V=(m)=>{if(x)return;let q=m.target?.localName==="button";if(m.key==="Escape"||q&&(m.key==="Enter"||m.key===" "))m.preventDefault()},Z=(m)=>{if(!x)m.preventDefault()};i.addEventListener("visibilitychange",E),i.addEventListener("close",E,!0),P?.addEventListener("focus",E),P?.addEventListener("blur",E),P?.addEventListener("resize",R),h.addEventListener("scroll",R),y.addEventListener("keydown",V),y.addEventListener("keyup",V),y.addEventListener("cancel",Z);let G=()=>{if(clearTimeout(A),F(),i.removeEventListener("visibilitychange",E),i.removeEventListener("close",E,!0),P?.removeEventListener("focus",E),P?.removeEventListener("blur",E),P?.removeEventListener("resize",R),u.signal.removeEventListener("abort",O),y.remove(),p.changed===H)p.changed=void 0};y.addEventListener("close",()=>{let m=y.returnValue;G(),w(m==="allow"||m==="always"?m:"deny"),f()},{once:!0});try{y.showModal()}catch(m){G(),_(m),f();return}z.focus(),E(),R()})}function se(u,i,b,p){let{client:f}=i,c=a(p);if(f.kind!=="relay")return K(i,b,{strings:c}).then((v)=>v==="allow");let{grantId:D}=f,g=r(u),L=()=>g.allows(D,i.tool);if(L())return Promise.resolve(!0);return K(i,b,{strings:c,alwaysAllow:g.offered&&(g.kept||"until-reload"),allowedNow:L}).then((v)=>{if(v==="always")g.keep(D,i.tool);return v!=="deny"})}function ae(u,i,b){let{client:p}=i;if(p.kind==="relay"&&r(u).allows(p.grantId,i.tool))return Promise.resolve(!0);if(b===void 0)return u.confirmInPage(i);return Promise.resolve().then(()=>b(i)).then((f)=>f==="unanswered"?f:f===!0)}export{ae as confirmCall,se as confirmInPage};
|
|
2
|
+
|
|
3
|
+
//# debugId=296601402C8F7BB564756E2164756E21
|
|
4
|
+
//# sourceMappingURL=confirm-f36n8xj5.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 } from \"./always-allowed.ts\";\nimport {\n\tbutton,\n\tclientLabel,\n\tel,\n\tfill,\n\tformat,\n\tnewDialog,\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} from \"./types.ts\";\n\n/**\n * The arguments as text, in full: what the user approves must be visible.\n * (The relay caps a request at 1 MiB, so this stays bounded.) Invisible and\n * direction characters are shown as escapes, so the text is still JSON for\n * the same arguments; the tool gets them unchanged. `undefined` when they\n * cannot be shown, and then \"Allow\" is not offered.\n */\nfunction showArguments(args: Record<string, unknown>): string | undefined {\n\ttry {\n\t\treturn visible(JSON.stringify(args, null, 2));\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * How long \"Allow\" 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\" 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: ConfirmRequest,\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: ConfirmRequest,\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 =\n\t\t\tn === 1 ? s.waitingOne : format(s.waitingMany, { n: String(n) });\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/**\n * `TabMcp.confirmInPage`: the confirmation, and the tools the user allowed\n * (`always-allowed.ts`), which run unasked. Only for an AI app through the\n * relay: an agent in the browser and a served port have no identity to\n * remember an answer for (DEC-115, DEC-124).\n */\nexport function confirmInPage(\n\tmcp: TabMcp,\n\trequest: ConfirmRequest,\n\tdoc: Document,\n\tui?: DialogOptions,\n): Promise<boolean> {\n\tconst { client } = request;\n\tconst strings = stringsOf(ui);\n\tif (client.kind !== \"relay\")\n\t\treturn confirmDialog(request, doc, { strings }).then(\n\t\t\t(answer) => answer === \"allow\",\n\t\t);\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\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, doc, {\n\t\tstrings,\n\t\talwaysAllow: allowed.offered && (allowed.kept || \"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": "8GAiCA,SAAS,EAAa,CAAC,EAAmD,CACzE,GAAI,CACH,OAAO,EAAQ,KAAK,UAAU,EAAM,KAAM,CAAC,CAAC,EAC3C,KAAM,CACP,QAQK,IAAM,GAAiB,IAMxB,GAAsB,IA4BtB,EAAS,IAAI,QAoBZ,SAAS,CAAa,CAC5B,EACA,EACA,EAAgC,CAAC,EACT,CACxB,GAAI,EAAQ,OAAO,QAAS,OAAO,QAAQ,QAAQ,MAAM,EACzD,IAAI,EAAQ,EAAO,IAAI,CAAG,EAC1B,GAAI,IAAU,OACb,EAAQ,CAAE,MAAO,GAAO,QAAS,CAAC,CAAE,EACpC,EAAO,IAAI,EAAK,CAAK,EAEtB,IAAM,EAAI,EAEJ,EAAO,IAAM,CAClB,IAAM,EAAQ,EAAE,QAAQ,MAAM,EAC9B,EAAE,MAAQ,IAAU,OACpB,IAAQ,EACR,EAAE,UAAU,GAEP,EAAO,IAAM,CAClB,GAAI,CACH,OAAO,GAAY,EAAS,EAAK,EAAS,EAAG,CAAI,EAChD,MAAO,EAAO,CAEf,OADA,EAAK,EACE,QAAQ,OAAO,CAAK,IAG7B,GAAI,CAAC,EAAE,MAEN,OADA,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