@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.
- package/README.md +11 -0
- package/dist/.source-module-urls/64fb00de7b626c888cb871ea7e5171ebc35f3a7ee91800fc2345f930b9e361e7.json +1 -0
- package/dist/browser.d.mts +6 -5
- package/dist/browser.mjs +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +224 -235
- package/dist/{protocol-client-Dg5tIB1S.d.mts → protocol-client-DmQZQQS7.d.mts} +2 -5
- package/dist/{protocol-request-CtVhe3Bj.d.mts → protocol-request-CRDNYiYG.d.mts} +2 -0
- package/dist/{readiness-CkF8_J-1.d.mts → readiness-BuLm1Ikf.d.mts} +12 -17
- package/dist/{readiness-CwRz4ZX8.mjs → readiness-C7IsnvXj.mjs} +11 -10
- package/dist/readiness.d.mts +1 -1
- package/dist/readiness.mjs +1 -2
- package/dist/scope-upgrade.d.mts +2 -3
- package/dist/{session-subscriptions-DJ5H6a_1.mjs → session-subscriptions-Bc7A64MY.mjs} +977 -264
- package/dist/{session-subscriptions-Bcq6_wtR.d.mts → session-subscriptions-UQlp58bR.d.mts} +15 -2
- package/dist/{timeouts-F2UKsnjG.mjs → timeouts-BBVOnLnf.mjs} +2 -5
- package/dist/timeouts.mjs +1 -2
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-
|
|
2
|
-
import { l as GatewayProtocolRequestTiming, n as GatewayClientCloseInfo, r as GatewayClientConnectionMetadata } from "./protocol-client-
|
|
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,
|
|
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-
|
|
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
|
|
85
|
+
maxWaitMs,
|
|
85
86
|
signal: options.signal
|
|
86
87
|
});
|
|
87
88
|
if (readiness.ready && !readiness.aborted && options.signal?.aborted !== true) client.start();
|
package/dist/readiness.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as startGatewayClientWithReadinessWait, i as startGatewayClientWhenEventLoopReady, n as GatewayClientStartReadinessOptions, r as GatewayClientStartable, t as EventLoopReadyWaiter } from "./readiness-
|
|
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 };
|
package/dist/readiness.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };
|
|
1
|
+
export { t as startGatewayClientWhenEventLoopReady, n as startGatewayClientWithReadinessWait } from "./readiness-C7IsnvXj.mjs";
|
package/dist/scope-upgrade.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as GatewayBrowserDeviceTokenStore } from "./browser-device-auth-_UweR4aN.mjs";
|
|
2
|
-
import { n as GatewayProtocolRequestOptions } from "./protocol-request-
|
|
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:
|
|
27
|
+
request: (method: string, params?: unknown, options?: GatewayProtocolRequestOptions) => Promise<unknown>;
|
|
29
28
|
tokenStore: GatewayBrowserDeviceTokenStore;
|
|
30
29
|
reconnect: () => void;
|
|
31
30
|
});
|