@ractive-ch/tab-mcp-client 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types.d.ts CHANGED
@@ -107,6 +107,14 @@ export interface TabMcpOptions {
107
107
  * constructor throws a `TypeError` for anything but a number of ms.
108
108
  */
109
109
  confirmDelayMs?: number;
110
+ /**
111
+ * Offer "Always allow" in the default confirmation: it lets a tool run
112
+ * without asking for one AI app until the page is reloaded or the app is
113
+ * disconnected. Off by default (DEC-096): the confirmation then shows only
114
+ * "Don't allow" and "Allow", and every call asks. Turn it on only for
115
+ * tools whose calls the user does not need to check one by one.
116
+ */
117
+ alwaysAllow?: boolean;
110
118
  /**
111
119
  * Where the address secret lives; default `localStorage`. `null` keeps it
112
120
  * only for the page's lifetime (a new address on every visit).
@@ -253,6 +261,20 @@ export interface DisconnectDetail {
253
261
  /** The WebSocket close code. */
254
262
  code: number;
255
263
  }
264
+ /** The `replaced` event: who took over the page's address. */
265
+ export interface ReplacedDetail {
266
+ /**
267
+ * `true`: a tab of the same page in this browser said, just before, that it
268
+ * took over the address; the usual, harmless cause ("Opened in another
269
+ * tab"). `false`: no such tab was heard (or the browser has no
270
+ * `BroadcastChannel`), so it may be a program with a copy of the address
271
+ * secret, and the AI apps paired with the address now talk to it. Offer
272
+ * `newAddress()`, which takes the address back and disconnects them
273
+ * (DEC-095). Script on the page's origin can make a takeover look like a
274
+ * sibling, so `true` is a hint, not a proof.
275
+ */
276
+ sibling: boolean;
277
+ }
256
278
  /** A tool call from an AI app as it starts (the `toolcall` event). */
257
279
  export interface ToolCallStart {
258
280
  /** Unique in this page; `toolcallend` carries the same id. */
@@ -287,8 +309,13 @@ export interface TabMcpEventMap {
287
309
  }>;
288
310
  connected: CustomEvent<SessionInfo>;
289
311
  disconnected: CustomEvent<DisconnectDetail>;
290
- /** Another tab took over this address; `disconnected` follows. */
291
- replaced: CustomEvent<null>;
312
+ /**
313
+ * Another tab, or a program with this page's address secret, took over
314
+ * the address. It follows `disconnected` (reason `replaced`), up to a second
315
+ * later while the library listens for a sibling tab. `sibling` says which it
316
+ * probably was.
317
+ */
318
+ replaced: CustomEvent<ReplacedDetail>;
292
319
  /** Something went wrong outside a pending promise (e.g. a relay error message). */
293
320
  error: CustomEvent<{
294
321
  error: Error;