@ractive-ch/tab-mcp 0.4.0 → 0.5.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.
@@ -19,6 +19,8 @@ export interface PairingTarget {
19
19
  export interface PairingContext {
20
20
  requestId: string;
21
21
  browserId: string;
22
+ /** The address being paired: the routing key of the return trip (DEC-098). */
23
+ addressId: string;
22
24
  }
23
25
  export type PairingResult =
24
26
  /** Paired; `subject` is recorded on the grant (identity binding, DEC-077). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ractive-ch/tab-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Relay that lets AI agents call the MCP tools of a web page open in a browser tab",
5
5
  "type": "module",
6
6
  "bin": {
package/protocol.d.ts CHANGED
@@ -21,6 +21,8 @@ export declare const CloseCode: {
21
21
  readonly replaced: 4005;
22
22
  /** Reserved in the protocol (`rate_limited`); the relay does not send it yet. */
23
23
  readonly rateLimited: 4008;
24
+ /** The address id in the `/tab` URL is not the secret's (DEC-098). */
25
+ readonly addressMismatch: 4009;
24
26
  };
25
27
  export type ByeReason = "replaced" | "expired" | "idle" | "shutdown" | "user";
26
28
  export interface Limits {
@@ -112,7 +114,7 @@ export interface ErrorMessage {
112
114
  round?: number;
113
115
  }
114
116
  export type RelayMessage = SessionMessage | PingMessage | ByeMessage | HttpRequestMessage | HttpCancelMessage | PairingCodeMessage | GrantAddedMessage | GrantRemovedMessage | IdentityBoundMessage | ErrorMessage;
115
- export type ErrorCode = "bad_message" | "unknown_type" | "unknown_id" | "too_large" | "rate_limited" | "identity_refused";
117
+ export type ErrorCode = "bad_message" | "unknown_type" | "unknown_id" | "too_large" | "rate_limited" | "identity_refused" | "address_mismatch";
116
118
  export interface HelloMessage {
117
119
  type: "hello";
118
120
  library: {
@@ -127,6 +129,12 @@ export interface HelloMessage {
127
129
  name: string;
128
130
  };
129
131
  secret: string;
132
+ /**
133
+ * Revoke every grant of the address as the session claims it, before the
134
+ * `session` answer (which then lists none): a page taking its address back
135
+ * from whoever took it over (DEC-095).
136
+ */
137
+ revokeAll?: boolean;
130
138
  }
131
139
  export interface PongMessage {
132
140
  type: "pong";
package/relay.d.ts CHANGED
@@ -37,6 +37,8 @@ export interface RelayTestHooks extends AuthorizationTestMode {
37
37
  assertionKeys?: KeySource;
38
38
  /** A smaller relay-wide replay cache for tab assertions. */
39
39
  maxSeenAssertions?: number;
40
+ /** How long `/healthz` waits before a new read while one hangs. */
41
+ healthRetryMs?: number;
40
42
  }
41
43
  /** Start a relay. Returns once the server listens. */
42
44
  export declare function createRelay(options?: CreateRelayOptions): Relay;
package/session.d.ts CHANGED
@@ -58,6 +58,11 @@ export declare class TabSession {
58
58
  /** The site this session's origin belongs to (DEC-045). */
59
59
  readonly site: Site;
60
60
  readonly openedAt: number;
61
+ /**
62
+ * The address id the `/tab` URL named (`?a=`, DEC-098), checked against
63
+ * the secret in `hello`; `undefined` for libraries that do not send it.
64
+ */
65
+ readonly expectedAddress: string | undefined;
61
66
  /** Set once `hello` was accepted. */
62
67
  addressId: string | undefined;
63
68
  /** The app name `/authorize` shows: the site's name, else the page's claim. */
@@ -75,7 +80,7 @@ export declare class TabSession {
75
80
  */
76
81
  identityUnchecked: boolean;
77
82
  readonly pending: Map<string, Exchange>;
78
- constructor(ws: SocketLike, ip: string, origin: string, site: Site, host: SessionHost);
83
+ constructor(ws: SocketLike, ip: string, origin: string, site: Site, host: SessionHost, expectedAddress?: string);
79
84
  get ready(): boolean;
80
85
  /** Whether the page's "Connect your AI app" dialog is open. */
81
86
  get pairingOpen(): boolean;