@openclaw/gateway-client 2026.9.4 → 2026.9.6
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 +35 -0
- package/dist/browser.d.mts +13 -4
- package/dist/browser.mjs +3 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +243 -127
- package/dist/{protocol-client-DbX7wQED.d.mts → protocol-client-D6mJuY1_.d.mts} +15 -6
- package/dist/{protocol-request-B5gBmLgq.d.mts → protocol-request-CtVhe3Bj.d.mts} +1 -1
- package/dist/{readiness-DabX0O0A.d.mts → readiness-ChxbBSMj.d.mts} +42 -26
- package/dist/readiness.d.mts +1 -1
- package/dist/scope-upgrade.d.mts +1 -1
- package/dist/{session-subscriptions-BSQIANvX.d.mts → session-subscriptions-C91CEXwY.d.mts} +15 -13
- package/dist/{session-subscriptions-DIcpqS8A.mjs → session-subscriptions-DUpRfWJb.mjs} +277 -85
- package/package.json +2 -2
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-
|
|
2
|
-
import "./protocol-client-
|
|
1
|
+
import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-CtVhe3Bj.mjs";
|
|
2
|
+
import "./protocol-client-D6mJuY1_.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/
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
36
|
-
|
|
27
|
+
expectedToken?: string | null;
|
|
28
|
+
}) => unknown;
|
|
29
|
+
clearDeviceAuthToken?: (params: DeviceAuthOperation & {
|
|
37
30
|
deviceId: string;
|
|
38
31
|
role: string;
|
|
39
32
|
env?: NodeJS.ProcessEnv;
|
|
40
|
-
|
|
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,6 +160,8 @@ 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);
|
|
@@ -180,10 +193,13 @@ declare class GatewayClient {
|
|
|
180
193
|
private shouldRetryWithCurrentNodeProtocol;
|
|
181
194
|
private buildDeviceConnectParams;
|
|
182
195
|
private handleConnectHello;
|
|
196
|
+
private completeConnectHello;
|
|
183
197
|
private handleConnectRequestFailure;
|
|
198
|
+
private resolveConnectRequestFailure;
|
|
184
199
|
private resolveClose;
|
|
185
200
|
private closeInfo;
|
|
186
201
|
private clearStaleDeviceTokenForClose;
|
|
202
|
+
private clearDeviceToken;
|
|
187
203
|
private notifyConnectError;
|
|
188
204
|
private notifyReconnectPaused;
|
|
189
205
|
private shouldRetryWithoutApprovalRuntimeToken;
|
|
@@ -231,4 +247,4 @@ declare function startGatewayClientWithReadinessWait(waitForReady: EventLoopRead
|
|
|
231
247
|
/** Starts a gateway client after the default event-loop readiness probe succeeds. */
|
|
232
248
|
declare function startGatewayClientWhenEventLoopReady(client: GatewayClientStartable, options?: GatewayClientStartReadinessOptions): Promise<EventLoopReadyResult>;
|
|
233
249
|
//#endregion
|
|
234
|
-
export {
|
|
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 };
|
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-ChxbBSMj.mjs";
|
|
2
2
|
export { EventLoopReadyWaiter, GatewayClientStartReadinessOptions, GatewayClientStartable, startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };
|
package/dist/scope-upgrade.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as GatewayBrowserDeviceTokenStore } from "./browser-device-auth-DoPo-sPB.mjs";
|
|
2
|
-
import { n as GatewayProtocolRequestOptions } from "./protocol-request-
|
|
2
|
+
import { n as GatewayProtocolRequestOptions } from "./protocol-request-CtVhe3Bj.mjs";
|
|
3
3
|
//#region packages/gateway-client/src/scope-upgrade.d.ts
|
|
4
4
|
export type ScopeUpgradeBinding = {
|
|
5
5
|
clientId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as GatewayProtocolRequestOptions } from "./protocol-request-
|
|
1
|
+
import { n as GatewayProtocolRequestOptions } from "./protocol-request-CtVhe3Bj.mjs";
|
|
2
2
|
//#region packages/gateway-client/src/device-auth.d.ts
|
|
3
3
|
declare function normalizeDeviceMetadataForAuth(value?: string | null): string;
|
|
4
4
|
type DeviceAuthPayloadParams = {
|
|
@@ -56,6 +56,16 @@ declare function readAssistantStreamSegmentIdentity(message: unknown): {
|
|
|
56
56
|
itemId: string;
|
|
57
57
|
runId?: string;
|
|
58
58
|
} | undefined;
|
|
59
|
+
/** Local turns have no durable transcript metadata beyond their own optional send key. */
|
|
60
|
+
declare function isLocallyOptimisticSessionMessage(message: unknown): boolean;
|
|
61
|
+
type SessionProjectionEntry = {
|
|
62
|
+
message: unknown;
|
|
63
|
+
identity: SessionMessageIdentity | null;
|
|
64
|
+
afterSequence?: number | null;
|
|
65
|
+
live: boolean;
|
|
66
|
+
pending: boolean;
|
|
67
|
+
pendingRunId: string | null;
|
|
68
|
+
};
|
|
59
69
|
//#endregion
|
|
60
70
|
//#region packages/gateway-client/src/session-projection-final-identity.d.ts
|
|
61
71
|
type TerminalProjectionRun = {
|
|
@@ -83,6 +93,8 @@ type SessionProjectionRunTransition = {
|
|
|
83
93
|
declare function reduceSessionProjectionRunEvent(projection: SessionProjectionState, event: SessionProjectionGatewayRunEvent, scope?: SessionProjectionScope): SessionProjectionRunTransition | null;
|
|
84
94
|
//#endregion
|
|
85
95
|
//#region packages/gateway-client/src/session-projection-message-content.d.ts
|
|
96
|
+
/** Status notices remain visible but do not define the terminal reply they accompany. */
|
|
97
|
+
declare function projectSessionTerminalReplyMessage(message: unknown): unknown;
|
|
86
98
|
/** Diagnostic-only error projections can be retired when their run resumes. */
|
|
87
99
|
declare function isSessionProjectionErrorMessage(message: unknown, errorMessage?: string): boolean;
|
|
88
100
|
//#endregion
|
|
@@ -112,14 +124,6 @@ type SessionProjectionRun = {
|
|
|
112
124
|
errorKind?: string;
|
|
113
125
|
errorMessage?: string;
|
|
114
126
|
};
|
|
115
|
-
type SessionProjectionEntry = {
|
|
116
|
-
message: unknown;
|
|
117
|
-
identity: SessionMessageIdentity | null;
|
|
118
|
-
afterSequence?: number | null;
|
|
119
|
-
live: boolean;
|
|
120
|
-
pending: boolean;
|
|
121
|
-
pendingRunId: string | null;
|
|
122
|
-
};
|
|
123
127
|
type SessionProjectionState = {
|
|
124
128
|
scope: SessionProjectionScope;
|
|
125
129
|
entries: readonly SessionProjectionEntry[];
|
|
@@ -166,10 +170,8 @@ type SessionProjectionEvent = ScopedSessionProjectionEvent & ({
|
|
|
166
170
|
} | {
|
|
167
171
|
type: "reconnected";
|
|
168
172
|
});
|
|
169
|
-
/** Local turns have no durable transcript metadata beyond their own optional send key. */
|
|
170
|
-
declare function isLocallyOptimisticSessionMessage(message: unknown): boolean;
|
|
171
173
|
declare function createSessionProjection(scope?: SessionProjectionScope, messages?: readonly unknown[]): SessionProjectionState;
|
|
172
|
-
declare function projectLiveSessionMessage(
|
|
174
|
+
declare function projectLiveSessionMessage(initialState: SessionProjectionState, message: unknown, envelope?: SessionMessageEnvelope, scope?: SessionProjectionScope): SessionProjectionState;
|
|
173
175
|
/** Only observed live events and this client's pending turns may survive an older snapshot. */
|
|
174
176
|
declare function reconcileSessionProjectionSnapshot(state: SessionProjectionState, messages: readonly unknown[], scope?: SessionProjectionScope, options?: SessionProjectionSnapshotOptions): SessionProjectionState;
|
|
175
177
|
/** Reduces durable events, snapshots, and transport lifecycle without client-specific policy. */
|
|
@@ -209,4 +211,4 @@ declare function getGatewaySessionMessageSubscriptionCoordinator(client: Gateway
|
|
|
209
211
|
declare function resetGatewaySessionMessageSubscriptionCoordinator(client: GatewaySessionMessageRequestClient): void;
|
|
210
212
|
declare function releaseGatewaySessionMessageSubscription(subscription: GatewaySessionMessageSubscription): Promise<void>;
|
|
211
213
|
//#endregion
|
|
212
|
-
export {
|
|
214
|
+
export { normalizeSessionProjectionRunId as A, reduceSessionProjectionRunEvent as C, SessionMessageIdentity as D, SessionMessageEnvelope as E, gatewayOriginScope as F, buildDeviceAuthPayload as I, buildDeviceAuthPayloadV3 as L, readSessionMessageIdentity as M, readSessionMessageSequence as N, SessionProjectionEntry as O, gatewayCredentialScope as P, normalizeDeviceMetadataForAuth as R, SessionProjectionRunTransition as S, readSessionProjectionFinalMessageIdentity as T, reconcileSessionProjectionSnapshot as _, GatewaySessionMessageSubscriptionOptions as a, projectSessionTerminalReplyMessage as b, resetGatewaySessionMessageSubscriptionCoordinator as c, SessionProjectionRunStatus as d, SessionProjectionScope as f, projectLiveSessionMessage as g, createSessionProjection as h, GatewaySessionMessageSubscriptionCoordinatorOptions as i, readAssistantStreamSegmentIdentity as j, isLocallyOptimisticSessionMessage as k, SessionProjectionEvent as l, SessionProjectionState as m, GatewaySessionMessageSubscription as n, getGatewaySessionMessageSubscriptionCoordinator as o, SessionProjectionSnapshotOptions as p, GatewaySessionMessageSubscriptionCoordinator as r, releaseGatewaySessionMessageSubscription as s, GatewaySessionMessageRequestClient as t, SessionProjectionRun as u, reduceSessionProjection as v, hasSessionProjectionAcceptedFinal as w, SessionProjectionGatewayRunEvent as x, isSessionProjectionErrorMessage as y };
|