@ractive-ch/tab-mcp-client 0.0.0-stage → 0.1.0-alpha.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/mapping.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * WebMCP → MCP mapping of annotations (DEC-022) and results (DEC-023).
3
+ */
4
+ import type { ToolAnnotations } from "./types.js";
5
+ /** `_meta` key that keeps the original WebMCP hints. */
6
+ export declare const ANNOTATIONS_META_KEY = "ch.ractive.tab-mcp/annotations";
7
+ export interface McpToolAnnotations {
8
+ annotations?: Record<string, boolean>;
9
+ meta?: Record<string, boolean>;
10
+ }
11
+ /** MCP annotations plus the WebMCP originals for `_meta`. */
12
+ export declare function mapAnnotations(hints: ToolAnnotations): McpToolAnnotations;
13
+ export interface CallToolResult {
14
+ content: unknown[];
15
+ structuredContent?: Record<string, unknown>;
16
+ isError?: boolean;
17
+ [key: string]: unknown;
18
+ }
19
+ export declare function errorResult(message: string): CallToolResult;
20
+ /**
21
+ * What `execute` returned → a `CallToolResult`: a string is one text block; an
22
+ * object with a `content` array passes through; `undefined` is an empty
23
+ * result; any other JSON value is a text block with its JSON, plus
24
+ * `structuredContent` when it is an object.
25
+ */
26
+ export declare function toCallToolResult(value: unknown): CallToolResult;
27
+ /** A thrown value → an `isError` result with its message. */
28
+ export declare function thrownResult(error: unknown): CallToolResult;
package/mcp.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The tab's MCP server: the stateless 2026-07-28 subset tab-mcp needs
3
+ * (DEC-049), written for the page instead of bundling the SDK. It answers
4
+ * `server/discover`, `tools/list`, `tools/call` (as SSE, DEC-020) and
5
+ * `subscriptions/listen`, and applies the request checks of the 2026-07-28
6
+ * Streamable HTTP transport (content type, JSON-RPC shape, `_meta` envelope,
7
+ * `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name`). Status codes and error
8
+ * codes follow the MCP TypeScript SDK's `createMcpHandler`; the conformance
9
+ * tests compare the two.
10
+ */
11
+ import type { GrantRef } from "./protocol.js";
12
+ import type { RegisteredTool } from "./registry.js";
13
+ import type { ConfirmRequest, ServerInfo, ToolCallClient } from "./types.js";
14
+ export declare const MCP_PROTOCOL_VERSION = "2026-07-28";
15
+ export interface ToolSource {
16
+ list(): RegisteredTool[];
17
+ get(name: string): RegisteredTool | undefined;
18
+ }
19
+ export interface McpHandlerOptions {
20
+ tools: ToolSource;
21
+ server: ServerInfo;
22
+ /** Ask the user before a consequential tool runs. */
23
+ confirm(request: ConfirmRequest): Promise<boolean>;
24
+ /** The caller of a request, from its grant. */
25
+ client(grant: GrantRef): ToolCallClient;
26
+ }
27
+ export interface McpRequestContext {
28
+ grant: GrantRef;
29
+ /** The body as text when the caller already has it. */
30
+ body?: string;
31
+ }
32
+ export interface McpHandler {
33
+ handle(request: Request, context: McpRequestContext): Promise<Response>;
34
+ /** The tool list changed: tell the listen streams. */
35
+ toolsChanged(): void;
36
+ /** End every listen stream (the session is over). */
37
+ close(): void;
38
+ }
39
+ /** Decode the `=?base64?…?=` sentinel of SEP-2243 headers; `undefined` if malformed. */
40
+ export declare function decodeHeaderValue(value: string): string | undefined;
41
+ export declare function createMcpHandler(options: McpHandlerOptions): McpHandler;
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
- "name": "@ractive-ch/tab-mcp-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@ractive-ch/tab-mcp-client",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "Browser library: offer a web page's tools to AI agents through a tab-mcp relay",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./index.d.ts",
9
+ "default": "./index.js"
10
+ },
11
+ "./cdn": "./cdn/tab-mcp-client.min.js"
12
+ },
13
+ "types": "./index.d.ts",
14
+ "sideEffects": false,
15
+ "license": "MIT",
16
+ "author": "Jean-Pierre Bergamin <james@ractive.ch>",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/ractive/tab-mcp.git",
20
+ "directory": "packages/tab-mcp-client"
21
+ },
22
+ "homepage": "https://github.com/ractive/tab-mcp/tree/main/packages/tab-mcp-client#readme",
23
+ "bugs": "https://github.com/ractive/tab-mcp/issues",
24
+ "keywords": [
25
+ "mcp",
26
+ "model-context-protocol",
27
+ "browser",
28
+ "webmcp"
29
+ ],
30
+ "dependencies": {
31
+ "@cfworker/json-schema": "4.1.1"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }
package/protocol.d.ts ADDED
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The tab↔relay protocol, version 1, as the tab speaks it
3
+ * (`kb/design/protocol.md`). Internal: not part of the public API.
4
+ */
5
+ import type { Grant, Limits } from "./types.js";
6
+ export declare const SUBPROTOCOL = "tab-mcp.v1";
7
+ /** Who is calling a tunnelled request (the relay's view of the grant). */
8
+ export interface GrantRef {
9
+ grantId: string;
10
+ clientId: string;
11
+ scopes: string[];
12
+ }
13
+ export interface SessionMessage {
14
+ type: "session";
15
+ sessionId: string;
16
+ address: string;
17
+ origin: string;
18
+ appName?: string;
19
+ expiresAt: string;
20
+ limits: Limits;
21
+ grants: Grant[];
22
+ }
23
+ export interface PingMessage {
24
+ type: "ping";
25
+ t: number;
26
+ }
27
+ export interface ByeMessage {
28
+ type: "bye";
29
+ reason: string;
30
+ }
31
+ export interface HttpRequestMessage {
32
+ type: "http.request";
33
+ id: string;
34
+ method: string;
35
+ path: string;
36
+ headers: Record<string, string>;
37
+ body: string;
38
+ grant: GrantRef;
39
+ }
40
+ export interface HttpCancelMessage {
41
+ type: "http.cancel";
42
+ id: string;
43
+ reason: string;
44
+ }
45
+ export interface PairingCodeMessage {
46
+ type: "pairing.code";
47
+ code: string;
48
+ expiresAt: string;
49
+ }
50
+ export interface GrantAddedMessage {
51
+ type: "grant.added";
52
+ grant: Grant;
53
+ }
54
+ export interface GrantRemovedMessage {
55
+ type: "grant.removed";
56
+ grantId: string;
57
+ reason: string;
58
+ }
59
+ export interface ErrorMessage {
60
+ type: "error";
61
+ code: string;
62
+ message: string;
63
+ id?: string;
64
+ }
65
+ export type RelayMessage = SessionMessage | PingMessage | ByeMessage | HttpRequestMessage | HttpCancelMessage | PairingCodeMessage | GrantAddedMessage | GrantRemovedMessage | ErrorMessage;
66
+ export type TabMessage = {
67
+ type: "hello";
68
+ library: {
69
+ name: string;
70
+ version: string;
71
+ };
72
+ page: {
73
+ title: string;
74
+ };
75
+ app?: {
76
+ name: string;
77
+ };
78
+ secret: string;
79
+ } | {
80
+ type: "pong";
81
+ t: number;
82
+ } | {
83
+ type: "bye";
84
+ reason: string;
85
+ } | {
86
+ type: "http.response";
87
+ id: string;
88
+ status: number;
89
+ headers: Record<string, string>;
90
+ body: string;
91
+ } | {
92
+ type: "http.response.start";
93
+ id: string;
94
+ status: number;
95
+ headers: Record<string, string>;
96
+ } | {
97
+ type: "http.response.chunk";
98
+ id: string;
99
+ data: string;
100
+ } | {
101
+ type: "http.response.end";
102
+ id: string;
103
+ } | {
104
+ type: "pairing.start";
105
+ } | {
106
+ type: "pairing.stop";
107
+ } | {
108
+ type: "grant.revoke";
109
+ grantId: string;
110
+ } | {
111
+ type: "grants.revokeAll";
112
+ } | {
113
+ type: "error";
114
+ code: string;
115
+ message: string;
116
+ id?: string;
117
+ };
118
+ /**
119
+ * Parse one frame from the relay. Returns `undefined` for anything malformed
120
+ * or unknown; the caller ignores it (forward compatibility).
121
+ */
122
+ export declare function parseRelayMessage(text: string): RelayMessage | undefined;
package/registry.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The tool registry, mirroring WebMCP's `registerTool(tool, { signal })`
3
+ * (DEC-010). Part of the eagerly loaded core.
4
+ */
5
+ import type { JsonSchema, RegisterToolOptions, Tool, ToolAnnotations } from "./types.js";
6
+ /** A validated tool as the registry keeps it. */
7
+ export interface RegisteredTool {
8
+ readonly name: string;
9
+ readonly title: string | undefined;
10
+ readonly description: string;
11
+ readonly inputSchema: JsonSchema;
12
+ readonly annotations: ToolAnnotations;
13
+ readonly execute: Tool["execute"];
14
+ }
15
+ /** Validate a tool; throws a `TypeError` naming the problem. */
16
+ export declare function validateTool(tool: Tool): RegisteredTool;
17
+ export declare class ToolRegistry {
18
+ #private;
19
+ /**
20
+ * Register a tool; throws `TypeError` for an invalid tool and an
21
+ * `InvalidStateError` `DOMException` for a duplicate name.
22
+ */
23
+ register(tool: Tool, options?: RegisterToolOptions): void;
24
+ get(name: string): RegisteredTool | undefined;
25
+ /** Tools in registration order. */
26
+ list(): RegisteredTool[];
27
+ /** Listen for changes; returns a function that stops listening. */
28
+ onChange(listener: () => void): () => void;
29
+ }
package/secret.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The address secret (DEC-027): 32 random bytes as base64url without padding,
3
+ * kept in `localStorage`. The relay derives the stable address from it.
4
+ */
5
+ import type { SecretStorage } from "./types.js";
6
+ /** base64url without padding. */
7
+ export declare function base64url(bytes: Uint8Array): string;
8
+ export declare function newSecret(): string;
9
+ export declare function isSecret(value: unknown): value is string;
10
+ /** Reads, creates and rotates the secret; falls back to memory without storage. */
11
+ export declare class SecretStore {
12
+ #private;
13
+ constructor(storage: SecretStorage | null | undefined, key: string);
14
+ /** The current secret; storage first, so a rotation in another tab is seen. */
15
+ get(): string;
16
+ /** Make and keep a new secret (a new address). */
17
+ rotate(): string;
18
+ }
package/tab-mcp.d.ts ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `TabMcp`: the eagerly loaded core (DEC-035). It holds the tool registry, the
3
+ * events, the pairing state and the address secret; `connect()` loads the
4
+ * connection and the MCP handler with a dynamic `import()`.
5
+ */
6
+ import type { ConnectionState, ConnectOptions, Grant, PairingCode, RegisterToolOptions, SessionInfo, TabMcpEventMap, TabMcpOptions, Tool } from "./types.js";
7
+ /** `wss://host/tab` for a relay given as `https://host`, `wss://host` or with `/tab`. */
8
+ export declare function tabUrl(relay: string): {
9
+ url: string;
10
+ origin: string;
11
+ };
12
+ type Listener<K extends keyof TabMcpEventMap> = (event: TabMcpEventMap[K]) => void;
13
+ /**
14
+ * Offers a page's tools to AI apps through a tab-mcp relay.
15
+ *
16
+ * ```ts
17
+ * const mcp = new TabMcp({ relay: "https://relay.example", server: { name: "Calculator", version: "1.0.0" } });
18
+ * mcp.registerTool({ name: "add", description: "Add two numbers", execute: ({ a, b }) => Number(a) + Number(b) });
19
+ * button.onclick = () => mcp.showConnectDialog();
20
+ * ```
21
+ */
22
+ export declare class TabMcp extends EventTarget {
23
+ #private;
24
+ constructor(options: TabMcpOptions);
25
+ /**
26
+ * Register a tool (WebMCP shape). Allowed before and after `connect()`;
27
+ * aborting `options.signal` unregisters it. Rejects with a `TypeError` for
28
+ * an invalid tool and an `InvalidStateError` for a duplicate name.
29
+ */
30
+ registerTool(tool: Tool, options?: RegisterToolOptions): Promise<void>;
31
+ /** Names of the registered tools. */
32
+ get tools(): readonly string[];
33
+ get state(): ConnectionState;
34
+ /** The current session, while connected. */
35
+ get session(): SessionInfo | undefined;
36
+ /** The MCP address to give to AI apps, while connected. */
37
+ get address(): string | undefined;
38
+ /** The app name AI apps see when pairing: the relay's (`session.appName`), else the page's own. */
39
+ get appName(): string | undefined;
40
+ /** The AI apps connected to this address. */
41
+ get grants(): readonly Grant[];
42
+ /** Whether pairing is on (`startPairing()`). */
43
+ get pairing(): boolean;
44
+ /** The pairing code to show, if the relay sent one. */
45
+ get pairingCode(): PairingCode | undefined;
46
+ /**
47
+ * Connect to the relay: loads the connection and MCP handler, opens the
48
+ * WebSocket, resolves with the session. Call it from a user action (a
49
+ * click): where browsers track user activation it is refused otherwise,
50
+ * unless `options.resume` says the user already chose to keep AI access on.
51
+ * Never reconnects by itself.
52
+ */
53
+ connect(options?: ConnectOptions): Promise<SessionInfo>;
54
+ /** End the session (`bye`). Grants stay: AI apps work again after the next `connect()`. */
55
+ disconnect(): void;
56
+ /**
57
+ * A new address: revokes every connected app of the old one (while
58
+ * connected), makes a new secret, and connects again if it was connected or
59
+ * connecting. Call it from a user action.
60
+ */
61
+ newAddress(): Promise<SessionInfo | undefined>;
62
+ /** The pairing dialog opened: ask the relay for codes (DEC-028). */
63
+ startPairing(): void;
64
+ /** The pairing dialog closed: the code becomes invalid. */
65
+ stopPairing(): void;
66
+ /**
67
+ * Disconnect one AI app: its tokens stop working at once. Works only while
68
+ * connected (the relay does it); returns `false` when it could not be sent.
69
+ */
70
+ revoke(grantId: string): boolean;
71
+ /**
72
+ * Open the default "Connect your AI tool" dialog; connects first if needed
73
+ * (call it from a click). Resolves when the dialog closes. Pages with their
74
+ * own UI use the events and methods instead.
75
+ */
76
+ showConnectDialog(options?: {
77
+ document?: Document;
78
+ }): Promise<void>;
79
+ addEventListener<K extends keyof TabMcpEventMap>(type: K, listener: Listener<K> | null, options?: boolean | AddEventListenerOptions): void;
80
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
81
+ removeEventListener<K extends keyof TabMcpEventMap>(type: K, listener: Listener<K> | null, options?: boolean | EventListenerOptions): void;
82
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
83
+ }
84
+ export {};
package/types.d.ts ADDED
@@ -0,0 +1,211 @@
1
+ /**
2
+ * Public types of `@ractive-ch/tab-mcp-client`. Self-contained on purpose: the
3
+ * published declarations must not import from other workspace packages.
4
+ */
5
+ /** A JSON Schema document (draft 2020-12) describing a tool's input object. */
6
+ export type JsonSchema = {
7
+ [key: string]: unknown;
8
+ };
9
+ /**
10
+ * Tool annotations: the WebMCP hints plus the MCP-only hints. The WebMCP hints
11
+ * are mapped to MCP (DEC-022); MCP hints given here win over the mapping.
12
+ */
13
+ export interface ToolAnnotations {
14
+ /** The tool only reads (WebMCP and MCP). */
15
+ readOnlyHint?: boolean;
16
+ /** The tool's results may contain untrusted content (WebMCP). */
17
+ untrustedContentHint?: boolean;
18
+ /** The tool has consequences the user should approve: asks in the page first (WebMCP). */
19
+ consequentialHint?: boolean;
20
+ /** The tool is meant for debugging (WebMCP). */
21
+ debugging?: boolean;
22
+ /** MCP: the tool may destroy data. */
23
+ destructiveHint?: boolean;
24
+ /** MCP: calling it twice with the same arguments has no extra effect. */
25
+ idempotentHint?: boolean;
26
+ /** MCP: the tool talks to the open world. */
27
+ openWorldHint?: boolean;
28
+ }
29
+ /** The AI app that calls a tool, as far as the relay knows it. */
30
+ export interface ToolCallClient {
31
+ /** The grant (connected app) the call came through. */
32
+ grantId: string;
33
+ /** The client's id (its Client ID Metadata Document URL). */
34
+ id: string;
35
+ /** Self-declared name, when known from the connected apps. */
36
+ name?: string;
37
+ /** Host of the client id URL: the verified part. */
38
+ host: string;
39
+ }
40
+ /** Second argument of `execute`. */
41
+ export interface ToolExecuteOptions {
42
+ /** Aborted when the AI app gives up on the call or the page disconnects. */
43
+ signal: AbortSignal;
44
+ /** Who is calling. */
45
+ client: ToolCallClient;
46
+ }
47
+ /** A tool in the WebMCP shape (`document.modelContext.registerTool`). */
48
+ export interface Tool {
49
+ /** 1–128 characters of `A–Z a–z 0–9 _ - .`. */
50
+ name: string;
51
+ title?: string;
52
+ /** What the tool does, for the model. Must not be empty. */
53
+ description: string;
54
+ /** JSON Schema of the input object; defaults to `{ "type": "object" }`. */
55
+ inputSchema?: JsonSchema;
56
+ /** Runs the tool. Its return value becomes the result (DEC-023). */
57
+ execute: (input: Record<string, unknown>, options: ToolExecuteOptions) => unknown;
58
+ annotations?: ToolAnnotations;
59
+ }
60
+ /** Options of `registerTool`. */
61
+ export interface RegisterToolOptions {
62
+ /** Aborting it unregisters the tool. */
63
+ signal?: AbortSignal;
64
+ /** WebMCP's cross-document exposure; ignored by tab-mcp. */
65
+ exposedTo?: string[];
66
+ }
67
+ /** What the page's MCP server says about itself in `server/discover`. */
68
+ export interface ServerInfo {
69
+ name: string;
70
+ version: string;
71
+ title?: string;
72
+ /** Instructions for the model, e.g. how the tools fit together. */
73
+ instructions?: string;
74
+ }
75
+ /** A consequential tool call waiting for the user's approval. */
76
+ export interface ConfirmRequest {
77
+ tool: {
78
+ name: string;
79
+ title?: string;
80
+ description: string;
81
+ };
82
+ arguments: Record<string, unknown>;
83
+ client: ToolCallClient;
84
+ /** Aborted when the call is cancelled; close the question then. */
85
+ signal: AbortSignal;
86
+ }
87
+ /** Decides whether a consequential tool may run. */
88
+ export type ConfirmHandler = (request: ConfirmRequest) => boolean | Promise<boolean>;
89
+ /** Where the address secret is kept (`localStorage` by default). */
90
+ export interface SecretStorage {
91
+ getItem(key: string): string | null;
92
+ setItem(key: string, value: string): void;
93
+ }
94
+ export interface TabMcpOptions {
95
+ /** The relay, e.g. `https://relay.example` or `wss://relay.example`. */
96
+ relay: string;
97
+ /** Name, version and instructions of the page's MCP server. */
98
+ server: ServerInfo;
99
+ /** The page's app name (e.g. `saturnus`), shown when an AI app pairs; at most 64 characters. */
100
+ appName?: string;
101
+ /** Approves consequential tool calls; default: a dialog in the page. */
102
+ onConfirm?: ConfirmHandler;
103
+ /**
104
+ * How long the default confirmation keeps "Allow" disabled after it opens,
105
+ * in milliseconds: 750 by default, never less than 500.
106
+ */
107
+ confirmDelayMs?: number;
108
+ /**
109
+ * Where the address secret lives; default `localStorage`. `null` keeps it
110
+ * only for the page's lifetime (a new address on every visit).
111
+ */
112
+ storage?: SecretStorage | null;
113
+ /** Storage key of the secret; default `tab-mcp:secret:<relay origin>`. */
114
+ storageKey?: string;
115
+ }
116
+ /** The session's limits, as the relay announces them. */
117
+ export interface Limits {
118
+ maxMessageBytes: number;
119
+ maxBodyBytes: number;
120
+ requestTimeoutMs: number;
121
+ idleTimeoutMs: number;
122
+ heartbeatMs: number;
123
+ keepAliveMs: number;
124
+ maxConcurrentRequests: number;
125
+ }
126
+ /** A connected AI app. */
127
+ export interface Grant {
128
+ grantId: string;
129
+ client: {
130
+ id: string;
131
+ name: string;
132
+ host: string;
133
+ };
134
+ createdAt: string;
135
+ }
136
+ /** The current session with the relay. */
137
+ export interface SessionInfo {
138
+ sessionId: string;
139
+ /** The MCP address to give to the AI app. */
140
+ address: string;
141
+ /** The page origin the relay saw. */
142
+ origin: string;
143
+ /** The app name the relay shows when pairing, if any. */
144
+ appName?: string;
145
+ expiresAt: string;
146
+ limits: Limits;
147
+ }
148
+ /** A pairing code to show (DEC-028). */
149
+ export interface PairingCode {
150
+ code: string;
151
+ expiresAt: string;
152
+ }
153
+ /** Options of `connect()`. */
154
+ export interface ConnectOptions {
155
+ /**
156
+ * Connect without a user action, for a page whose user turned on something
157
+ * like "Keep AI access on" earlier (with a click): e.g. on page load or
158
+ * after a `disconnected` event. The library itself never reconnects.
159
+ */
160
+ resume?: boolean;
161
+ }
162
+ export type ConnectionState = "disconnected" | "connecting" | "connected";
163
+ /** Why a session ended. */
164
+ export type DisconnectReason =
165
+ /** `disconnect()` was called. */
166
+ "user"
167
+ /** `newAddress()` ended the old session. */
168
+ | "new_address"
169
+ /** Another tab connected with the same address. */
170
+ | "replaced"
171
+ /** The session lifetime is over. */
172
+ | "expired"
173
+ /** No AI app used the tools for a long time. */
174
+ | "idle"
175
+ /** The relay is shutting down. */
176
+ | "shutdown"
177
+ /** The connection stopped answering. */
178
+ | "heartbeat"
179
+ /** The relay refused a message. */
180
+ | "policy" | "too_large" | "rate_limited"
181
+ /** The relay closed the connection for another reason. */
182
+ | "closed"
183
+ /** The network connection broke. */
184
+ | "network";
185
+ export interface DisconnectDetail {
186
+ reason: DisconnectReason;
187
+ /** The WebSocket close code. */
188
+ code: number;
189
+ }
190
+ /** Events of `TabMcp`. */
191
+ export interface TabMcpEventMap {
192
+ statechange: CustomEvent<{
193
+ state: ConnectionState;
194
+ }>;
195
+ connected: CustomEvent<SessionInfo>;
196
+ disconnected: CustomEvent<DisconnectDetail>;
197
+ /** Another tab took over this address; `disconnected` follows. */
198
+ replaced: CustomEvent<null>;
199
+ /** Something went wrong outside a pending promise (e.g. a relay error message). */
200
+ error: CustomEvent<{
201
+ error: Error;
202
+ }>;
203
+ /** A new pairing code, or `null` when there is none (any more). */
204
+ pairingcode: CustomEvent<PairingCode | null>;
205
+ grantschange: CustomEvent<{
206
+ grants: readonly Grant[];
207
+ }>;
208
+ toolschange: CustomEvent<{
209
+ tools: readonly string[];
210
+ }>;
211
+ }