@openclaw/gateway-client 2026.9.3 → 2026.9.5

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,43 +1,55 @@
1
1
  import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-B5gBmLgq.mjs";
2
- import "./protocol-client-DbX7wQED.mjs";
2
+ import "./protocol-client-DZ7F1DIs.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
- //#region packages/gateway-client/src/request-error.d.ts
6
- declare class GatewayClientRequestError extends GatewayProtocolRequestError {
7
- constructor(error: Partial<ErrorShape>);
8
- }
9
- //#endregion
10
- //#region packages/gateway-client/src/client.d.ts
11
- type DeviceIdentity = {
12
- deviceId: string;
13
- privateKeyPem: string;
14
- publicKeyPem: string;
15
- };
5
+ //#region packages/gateway-client/src/client-device-auth.d.ts
16
6
  type DeviceAuthTokenRecord = {
17
7
  token?: string;
18
8
  scopes?: string[];
19
9
  };
20
- type GatewayClientHostDeps = {
21
- loadOrCreateDeviceIdentity?: () => DeviceIdentity | undefined;
22
- signDevicePayload?: (privateKeyPem: string, payload: string) => string;
23
- publicKeyRawBase64UrlFromPem?: (publicKeyPem: string) => string;
24
- loadDeviceAuthToken?: (params: {
10
+ type MaybePromise<T> = T | Promise<T>;
11
+ type DeviceAuthOperation = {
12
+ signal?: AbortSignal;
13
+ assertCurrent?: () => void;
14
+ };
15
+ type GatewayClientDeviceAuthStorage = {
16
+ loadDeviceAuthToken?: (params: DeviceAuthOperation & {
25
17
  deviceId: string;
26
18
  role: string;
27
19
  env?: NodeJS.ProcessEnv;
28
- }) => DeviceAuthTokenRecord | null;
29
- storeDeviceAuthToken?: (params: {
20
+ }) => MaybePromise<DeviceAuthTokenRecord | null>;
21
+ storeDeviceAuthToken?: (params: DeviceAuthOperation & {
30
22
  deviceId: string;
31
23
  role: string;
32
24
  token: string;
33
25
  scopes: string[];
34
26
  env?: NodeJS.ProcessEnv;
35
- }) => void;
36
- clearDeviceAuthToken?: (params: {
27
+ expectedToken?: string | null;
28
+ }) => unknown;
29
+ clearDeviceAuthToken?: (params: DeviceAuthOperation & {
37
30
  deviceId: string;
38
31
  role: string;
39
32
  env?: NodeJS.ProcessEnv;
40
- }) => void;
33
+ expectedToken?: string;
34
+ }) => unknown;
35
+ };
36
+ //#endregion
37
+ //#region packages/gateway-client/src/request-error.d.ts
38
+ declare class GatewayClientRequestError extends GatewayProtocolRequestError {
39
+ constructor(error: Partial<ErrorShape>);
40
+ }
41
+ declare function isGatewayConnectAssemblyError(value: unknown): value is Error;
42
+ //#endregion
43
+ //#region packages/gateway-client/src/client.d.ts
44
+ type DeviceIdentity = {
45
+ deviceId: string;
46
+ privateKeyPem: string;
47
+ publicKeyPem: string;
48
+ };
49
+ type GatewayClientHostDeps = GatewayClientDeviceAuthStorage & {
50
+ loadOrCreateDeviceIdentity?: () => DeviceIdentity | undefined;
51
+ signDevicePayload?: (privateKeyPem: string, payload: string) => string;
52
+ publicKeyRawBase64UrlFromPem?: (publicKeyPem: string) => string;
41
53
  beforeConnect?: () => void;
42
54
  registerGatewayLoopbackBypass?: (url: string) => (() => void) | undefined;
43
55
  logDebug?: (message: string) => void;
@@ -66,7 +78,6 @@ declare class GatewayClientRequestTimeoutError extends GatewayProtocolRequestTim
66
78
  requestSent: boolean;
67
79
  });
68
80
  }
69
- declare function isGatewayConnectAssemblyError(value: unknown): value is Error;
70
81
  type GatewayClientOptions = {
71
82
  url?: string;
72
83
  origin?: string;
@@ -100,6 +111,7 @@ type GatewayClientOptions = {
100
111
  mode?: GatewayClientMode;
101
112
  role?: string;
102
113
  scopes?: string[];
114
+ modelCatalog?: ConnectParams["modelCatalog"];
103
115
  caps?: string[];
104
116
  commands?: string[];
105
117
  computerUse?: ConnectParams["computerUse"];
@@ -139,7 +151,6 @@ declare class GatewayClient {
139
151
  private stopped;
140
152
  private useLegacyNodeProtocolEnvelope;
141
153
  private nodeProtocolTransitionPending;
142
- private suppressNextHelloCallback;
143
154
  private pendingDeviceTokenRetry;
144
155
  private deviceTokenRetryBudgetUsed;
145
156
  private approvalRuntimeTokenCompatibilityDisabled;
@@ -149,9 +160,14 @@ declare class GatewayClient {
149
160
  private tickTimer;
150
161
  private readonly requestTimeoutMs;
151
162
  private pendingStop;
163
+ private readonly deviceAuth;
164
+ private connectionStoredToken?;
152
165
  private transportValidated;
153
166
  private suppressedTransientPreHelloCleanCloses;
154
167
  constructor(opts: GatewayClientOptions);
168
+ /** Current transport state, including CLOSING before the close callback fires.
169
+ * This is not authentication or readiness evidence on its own. */
170
+ get connected(): boolean;
155
171
  getConnectionMetadata(): GatewayClientConnectionMetadata;
156
172
  updateNodeManifest(manifest: {
157
173
  caps: string[];
@@ -177,10 +193,13 @@ declare class GatewayClient {
177
193
  private shouldRetryWithCurrentNodeProtocol;
178
194
  private buildDeviceConnectParams;
179
195
  private handleConnectHello;
196
+ private completeConnectHello;
180
197
  private handleConnectRequestFailure;
198
+ private resolveConnectRequestFailure;
181
199
  private resolveClose;
182
200
  private closeInfo;
183
201
  private clearStaleDeviceTokenForClose;
202
+ private clearDeviceToken;
184
203
  private notifyConnectError;
185
204
  private notifyReconnectPaused;
186
205
  private shouldRetryWithoutApprovalRuntimeToken;
@@ -228,4 +247,4 @@ declare function startGatewayClientWithReadinessWait(waitForReady: EventLoopRead
228
247
  /** Starts a gateway client after the default event-loop readiness probe succeeds. */
229
248
  declare function startGatewayClientWhenEventLoopReady(client: GatewayClientStartable, options?: GatewayClientStartReadinessOptions): Promise<EventLoopReadyResult>;
230
249
  //#endregion
231
- export { GatewayClientRequestTimeoutError as _, startGatewayClientWithReadinessWait as a, GatewayClientRequestError as b, waitForEventLoopReady as c, GatewayClient as d, GatewayClientCloseInfo as f, GatewayClientRequestOptions as g, GatewayClientOptions as h, startGatewayClientWhenEventLoopReady as i, DeviceAuthTokenRecord as l, GatewayClientHostDeps as m, GatewayClientStartReadinessOptions as n, EventLoopReadyOptions as o, GatewayClientConnectionMetadata as p, GatewayClientStartable as r, EventLoopReadyResult as s, EventLoopReadyWaiter as t, DeviceIdentity as u, GatewayReconnectPausedInfo as v, isGatewayConnectAssemblyError as y };
250
+ export { GatewayReconnectPausedInfo as _, startGatewayClientWithReadinessWait as a, DeviceAuthTokenRecord as b, waitForEventLoopReady as c, GatewayClientCloseInfo as d, GatewayClientConnectionMetadata as f, GatewayClientRequestTimeoutError as g, GatewayClientRequestOptions as h, startGatewayClientWhenEventLoopReady as i, DeviceIdentity as l, GatewayClientOptions as m, GatewayClientStartReadinessOptions as n, EventLoopReadyOptions as o, GatewayClientHostDeps as p, GatewayClientStartable as r, EventLoopReadyResult as s, EventLoopReadyWaiter as t, GatewayClient as u, GatewayClientRequestError as v, isGatewayConnectAssemblyError as y };
@@ -1,2 +1,2 @@
1
- import { a as startGatewayClientWithReadinessWait, i as startGatewayClientWhenEventLoopReady, n as GatewayClientStartReadinessOptions, r as GatewayClientStartable, t as EventLoopReadyWaiter } from "./readiness-uQKoJkl5.mjs";
1
+ import { a as startGatewayClientWithReadinessWait, i as startGatewayClientWhenEventLoopReady, n as GatewayClientStartReadinessOptions, r as GatewayClientStartable, t as EventLoopReadyWaiter } from "./readiness-B99dV5nY.mjs";
2
2
  export { EventLoopReadyWaiter, GatewayClientStartReadinessOptions, GatewayClientStartable, startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };