@openclaw/gateway-client 2026.10.10 → 2026.11.5-beta.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.
@@ -1,5 +1,5 @@
1
- import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-CtVhe3Bj.mjs";
2
- import { l as GatewayProtocolRequestTiming, n as GatewayClientCloseInfo, r as GatewayClientConnectionMetadata } from "./protocol-client-Dg5tIB1S.mjs";
1
+ import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-CRDNYiYG.mjs";
2
+ import { l as GatewayProtocolRequestTiming, n as GatewayClientCloseInfo, r as GatewayClientConnectionMetadata } from "./protocol-client-DmQZQQS7.mjs";
3
3
  import { ConnectParams, ErrorShape, EventFrame, HelloOk } from "@openclaw/gateway-protocol/frame-guards";
4
4
  import { GatewayClientMode, GatewayClientName } from "@openclaw/gateway-protocol/client-info";
5
5
  import "ws";
@@ -47,6 +47,13 @@ type GatewayWebSocketTargetOptions = {
47
47
  declare class GatewayClientRequestError extends GatewayProtocolRequestError {
48
48
  constructor(error: Partial<ErrorShape>);
49
49
  }
50
+ declare class GatewayClientRequestTimeoutError extends GatewayProtocolRequestTimeoutError {
51
+ constructor(params: {
52
+ method: string;
53
+ timeoutMs: number;
54
+ requestSent: boolean;
55
+ });
56
+ }
50
57
  declare function isGatewayConnectAssemblyError(value: unknown): value is Error;
51
58
  //#endregion
52
59
  //#region packages/gateway-client/src/client.d.ts
@@ -72,13 +79,6 @@ type GatewayReconnectPausedInfo = {
72
79
  reason: string;
73
80
  detailCode: string | null;
74
81
  };
75
- declare class GatewayClientRequestTimeoutError extends GatewayProtocolRequestTimeoutError {
76
- constructor(params: {
77
- method: string;
78
- timeoutMs: number;
79
- requestSent: boolean;
80
- });
81
- }
82
82
  type GatewayClientOptions = GatewayWebSocketTargetOptions & NonNullable<ConnectParams["auth"]> & {
83
83
  origin?: string;
84
84
  /** Already-resolved edge-proxy auth headers (identity-aware proxy in front of the Gateway). */
@@ -89,6 +89,8 @@ type GatewayClientOptions = GatewayWebSocketTargetOptions & NonNullable<ConnectP
89
89
  * this to keep the connect-challenge watchdog aligned with the gateway.
90
90
  */
91
91
  preauthHandshakeTimeoutMs?: number;
92
+ /** Synchronously revalidate the caller's live authority before transport writes. */
93
+ assertConnectionCurrent?: () => void;
92
94
  tickWatchMinIntervalMs?: number;
93
95
  tickWatchTimeoutMs?: number;
94
96
  requestTimeoutMs?: number;
@@ -174,13 +176,7 @@ declare class GatewayClient {
174
176
  private resolvePendingStop;
175
177
  private logDebug;
176
178
  private logError;
177
- private assembleConnectParams;
178
- private shouldNegotiateLegacyNodeProtocol;
179
179
  private shouldRetryWithAlternateNodeProtocol;
180
- private buildDeviceConnectParams;
181
- private handleConnectHello;
182
- private completeConnectHello;
183
- private handleConnectRequestFailure;
184
180
  private resolveConnectRequestFailure;
185
181
  private resolveClose;
186
182
  private closeInfo;
@@ -190,7 +186,6 @@ declare class GatewayClient {
190
186
  private notifyReconnectPaused;
191
187
  private isUnsupportedConnectAuthField;
192
188
  private isTrustedDeviceRetryEndpoint;
193
- private selectConnectAuth;
194
189
  private startTickWatch;
195
190
  request<T = Record<string, unknown>>(method: string, params?: unknown, opts?: GatewayClientRequestOptions): Promise<T>;
196
191
  }
@@ -232,4 +227,4 @@ declare function startGatewayClientWithReadinessWait(waitForReady: EventLoopRead
232
227
  /** Starts a gateway client after the default event-loop readiness probe succeeds. */
233
228
  declare function startGatewayClientWhenEventLoopReady(client: GatewayClientStartable, options?: GatewayClientStartReadinessOptions): Promise<EventLoopReadyResult>;
234
229
  //#endregion
235
- export { isGatewayConnectAssemblyError as _, startGatewayClientWithReadinessWait as a, waitForEventLoopReady as c, GatewayClientHostDeps as d, GatewayClientOptions as f, GatewayClientRequestError as g, GatewayReconnectPausedInfo as h, startGatewayClientWhenEventLoopReady as i, DeviceIdentity as l, GatewayClientRequestTimeoutError as m, GatewayClientStartReadinessOptions as n, EventLoopReadyOptions as o, GatewayClientRequestOptions as p, GatewayClientStartable as r, EventLoopReadyResult as s, EventLoopReadyWaiter as t, GatewayClient as u, DeviceAuthTokenRecord as v };
230
+ export { isGatewayConnectAssemblyError as _, startGatewayClientWithReadinessWait as a, waitForEventLoopReady as c, GatewayClientHostDeps as d, GatewayClientOptions as f, GatewayClientRequestTimeoutError as g, GatewayClientRequestError as h, startGatewayClientWhenEventLoopReady as i, DeviceIdentity as l, GatewayReconnectPausedInfo as m, GatewayClientStartReadinessOptions as n, EventLoopReadyOptions as o, GatewayClientRequestOptions as p, GatewayClientStartable as r, EventLoopReadyResult as s, EventLoopReadyWaiter as t, GatewayClient as u, DeviceAuthTokenRecord as v };
@@ -1,4 +1,4 @@
1
- import { d as resolveFiniteTimeoutDelayMs, u as resolveConnectChallengeTimeoutMs } from "./timeouts-F2UKsnjG.mjs";
1
+ import { d as resolveFiniteTimeoutDelayMs, u as resolveConnectChallengeTimeoutMs } from "./timeouts-BBVOnLnf.mjs";
2
2
  //#region packages/gateway-client/src/event-loop-ready.ts
3
3
  const DEFAULT_MAX_WAIT_MS = 1e4;
4
4
  const DEFAULT_INTERVAL_MS = 1;
@@ -70,18 +70,19 @@ async function waitForEventLoopReady(options = {}) {
70
70
  }
71
71
  //#endregion
72
72
  //#region packages/gateway-client/src/readiness.ts
73
- function resolveGatewayClientStartReadinessTimeoutMs(options = {}) {
74
- if (typeof options.timeoutMs === "number" && Number.isFinite(options.timeoutMs)) return options.timeoutMs;
75
- const clientOptions = options.clientOptions ?? {};
76
- return resolveConnectChallengeTimeoutMs(clientOptions.connectChallengeTimeoutMs, {
77
- env: clientOptions.env,
78
- configuredTimeoutMs: clientOptions.preauthHandshakeTimeoutMs
79
- });
80
- }
81
73
  /** Starts a gateway client only after the supplied readiness probe succeeds. */
82
74
  async function startGatewayClientWithReadinessWait(waitForReady, client, options = {}) {
75
+ let maxWaitMs;
76
+ if (typeof options.timeoutMs === "number" && Number.isFinite(options.timeoutMs)) maxWaitMs = options.timeoutMs;
77
+ else {
78
+ const clientOptions = options.clientOptions ?? {};
79
+ maxWaitMs = resolveConnectChallengeTimeoutMs(clientOptions.connectChallengeTimeoutMs, {
80
+ env: clientOptions.env,
81
+ configuredTimeoutMs: clientOptions.preauthHandshakeTimeoutMs
82
+ });
83
+ }
83
84
  const readiness = await waitForReady({
84
- maxWaitMs: resolveGatewayClientStartReadinessTimeoutMs(options),
85
+ maxWaitMs,
85
86
  signal: options.signal
86
87
  });
87
88
  if (readiness.ready && !readiness.aborted && options.signal?.aborted !== true) client.start();
@@ -1,2 +1,2 @@
1
- import { a as startGatewayClientWithReadinessWait, i as startGatewayClientWhenEventLoopReady, n as GatewayClientStartReadinessOptions, r as GatewayClientStartable, t as EventLoopReadyWaiter } from "./readiness-CkF8_J-1.mjs";
1
+ import { a as startGatewayClientWithReadinessWait, i as startGatewayClientWhenEventLoopReady, n as GatewayClientStartReadinessOptions, r as GatewayClientStartable, t as EventLoopReadyWaiter } from "./readiness-BuLm1Ikf.mjs";
2
2
  export { EventLoopReadyWaiter, GatewayClientStartReadinessOptions, GatewayClientStartable, startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };
@@ -1,2 +1 @@
1
- import { n as startGatewayClientWithReadinessWait, t as startGatewayClientWhenEventLoopReady } from "./readiness-CwRz4ZX8.mjs";
2
- export { startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };
1
+ export { t as startGatewayClientWhenEventLoopReady, n as startGatewayClientWithReadinessWait } from "./readiness-C7IsnvXj.mjs";
@@ -1,5 +1,5 @@
1
1
  import { a as GatewayBrowserDeviceTokenStore } from "./browser-device-auth-_UweR4aN.mjs";
2
- import { n as GatewayProtocolRequestOptions } from "./protocol-request-CtVhe3Bj.mjs";
2
+ import { n as GatewayProtocolRequestOptions } from "./protocol-request-CRDNYiYG.mjs";
3
3
  //#region packages/gateway-client/src/scope-upgrade.d.ts
4
4
  export type ScopeUpgradeBinding = {
5
5
  clientId: string;
@@ -19,13 +19,12 @@ export type ScopeUpgradeOptions = {
19
19
  scopes: readonly string[];
20
20
  onPending?: (requestId: string) => void;
21
21
  };
22
- type UpgradeRequester = (method: string, params?: unknown, options?: GatewayProtocolRequestOptions) => Promise<unknown>;
23
22
  /** Runs one browser device scope upgrade and owns rotated-token persistence. */
24
23
  export declare class GatewayScopeUpgrade {
25
24
  private readonly deps;
26
25
  private active?;
27
26
  constructor(deps: {
28
- request: UpgradeRequester;
27
+ request: (method: string, params?: unknown, options?: GatewayProtocolRequestOptions) => Promise<unknown>;
29
28
  tokenStore: GatewayBrowserDeviceTokenStore;
30
29
  reconnect: () => void;
31
30
  });