@openclaw/gateway-client 2026.8.1-beta.1 → 2026.8.1-beta.2
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 +15 -3
- package/dist/browser-device-auth-Dz6H7eXy.d.mts +112 -0
- package/dist/browser.d.mts +5 -3
- package/dist/browser.mjs +2 -2
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +324 -163
- package/dist/{protocol-client-U142L0j3.d.mts → protocol-client-BbN-I582.d.mts} +15 -30
- package/dist/protocol-request-D4mVhLxE.d.mts +32 -0
- package/dist/{readiness-uSDrqxDM.d.mts → readiness--KX7i8Mq.d.mts} +24 -12
- package/dist/readiness.d.mts +1 -1
- package/dist/scope-upgrade.d.mts +38 -0
- package/dist/scope-upgrade.mjs +73 -0
- package/dist/{session-subscriptions-Das1PATe.d.mts → session-subscriptions-BTNpXybo.d.mts} +6 -111
- package/dist/{session-subscriptions-D4Xv60cN.mjs → session-subscriptions-uKmTyc3P.mjs} +270 -152
- package/dist/timeouts.mjs +3 -3
- package/dist/websocket-data.d.mts +6 -0
- package/dist/websocket-data.mjs +8 -0
- package/package.json +13 -3
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
import { n as GatewayProtocolRequestOptions, t as GatewayProtocolRequestError } from "./protocol-request-D4mVhLxE.mjs";
|
|
1
2
|
import { ErrorShape, EventFrame, HelloOk } from "@openclaw/gateway-protocol";
|
|
2
3
|
|
|
3
|
-
//#region packages/gateway-client/src/
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
//#region packages/gateway-client/src/pending-request.d.ts
|
|
5
|
+
type GatewayProtocolRequestTiming = {
|
|
6
|
+
id: string;
|
|
7
|
+
method: string;
|
|
8
|
+
ok: boolean;
|
|
9
|
+
durationMs: number;
|
|
10
|
+
startedAtMs: number;
|
|
11
|
+
endedAtMs: number;
|
|
12
|
+
errorCode?: string;
|
|
10
13
|
};
|
|
11
|
-
declare class GatewayProtocolRequestError extends Error {
|
|
12
|
-
readonly code: string;
|
|
13
|
-
readonly gatewayCode: string;
|
|
14
|
-
readonly details?: unknown;
|
|
15
|
-
readonly retryable: boolean;
|
|
16
|
-
readonly retryAfterMs?: number;
|
|
17
|
-
constructor(error: Partial<ErrorShape>);
|
|
18
|
-
}
|
|
19
14
|
//#endregion
|
|
20
|
-
//#region packages/gateway-client/src/protocol-client.d.ts
|
|
15
|
+
//#region packages/gateway-client/src/protocol-client-contract.d.ts
|
|
21
16
|
type GatewayProtocolSocket = {
|
|
22
17
|
isOpen: () => boolean;
|
|
23
18
|
send: (data: string) => void;
|
|
@@ -70,15 +65,6 @@ type GatewayProtocolTiming<TPlan> = {
|
|
|
70
65
|
plan?: TPlan;
|
|
71
66
|
detail?: unknown;
|
|
72
67
|
};
|
|
73
|
-
type GatewayProtocolRequestTiming = {
|
|
74
|
-
id: string;
|
|
75
|
-
method: string;
|
|
76
|
-
ok: boolean;
|
|
77
|
-
durationMs: number;
|
|
78
|
-
startedAtMs: number;
|
|
79
|
-
endedAtMs: number;
|
|
80
|
-
errorCode?: string;
|
|
81
|
-
};
|
|
82
68
|
type GatewayProtocolClientOptions<TPlan> = {
|
|
83
69
|
createSocket: (handlers: GatewayProtocolSocketHandlers) => GatewayProtocolSocket;
|
|
84
70
|
createRequestId: () => string;
|
|
@@ -128,6 +114,8 @@ type GatewayProtocolClientOptions<TPlan> = {
|
|
|
128
114
|
shouldRetrySocketFactoryError?: (error: Error) => boolean;
|
|
129
115
|
rethrowSocketFactoryError?: (error: Error) => boolean;
|
|
130
116
|
};
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region packages/gateway-client/src/protocol-client.d.ts
|
|
131
119
|
/**
|
|
132
120
|
* Browser-safe gateway wire client. Environment adapters own transport and auth
|
|
133
121
|
* policy; this class owns the single socket/handshake/reconnect/frame state machine.
|
|
@@ -135,7 +123,7 @@ type GatewayProtocolClientOptions<TPlan> = {
|
|
|
135
123
|
declare class GatewayProtocolClient<TPlan> {
|
|
136
124
|
private readonly opts;
|
|
137
125
|
private socket;
|
|
138
|
-
private readonly
|
|
126
|
+
private readonly requests;
|
|
139
127
|
private readonly listeners;
|
|
140
128
|
private stopped;
|
|
141
129
|
private generation;
|
|
@@ -171,11 +159,8 @@ declare class GatewayProtocolClient<TPlan> {
|
|
|
171
159
|
private handleConnectPlanError;
|
|
172
160
|
private sendConnectPlan;
|
|
173
161
|
private handleMessage;
|
|
174
|
-
private handleResponse;
|
|
175
162
|
private handleClose;
|
|
176
163
|
private handleSocketError;
|
|
177
|
-
private flushRequests;
|
|
178
|
-
private finishRequestTiming;
|
|
179
164
|
private scheduleReconnect;
|
|
180
165
|
private closeContext;
|
|
181
166
|
private isActive;
|
|
@@ -184,4 +169,4 @@ declare class GatewayProtocolClient<TPlan> {
|
|
|
184
169
|
private invoke;
|
|
185
170
|
}
|
|
186
171
|
//#endregion
|
|
187
|
-
export {
|
|
172
|
+
export { GatewayProtocolTiming as a, GatewayProtocolSocketHandlers as i, GatewayProtocolCloseContext as n, GatewayProtocolRequestTiming as o, GatewayProtocolSocket as r, GatewayProtocolClient as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ErrorShape } from "@openclaw/gateway-protocol";
|
|
2
|
+
|
|
3
|
+
//#region packages/gateway-client/src/protocol-request.d.ts
|
|
4
|
+
type GatewayProtocolRequestOptions = {
|
|
5
|
+
timeoutMs?: number | null;
|
|
6
|
+
expectFinal?: boolean;
|
|
7
|
+
onSent?: () => void;
|
|
8
|
+
onAccepted?: (payload: unknown) => void;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
};
|
|
11
|
+
declare class GatewayProtocolRequestError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly gatewayCode: string;
|
|
14
|
+
readonly details?: unknown;
|
|
15
|
+
readonly retryable: boolean;
|
|
16
|
+
readonly retryAfterMs?: number;
|
|
17
|
+
constructor(error: Partial<ErrorShape>);
|
|
18
|
+
}
|
|
19
|
+
/** A local transport deadline, distinct from a Gateway's authoritative rejection. */
|
|
20
|
+
declare class GatewayProtocolRequestTimeoutError extends Error {
|
|
21
|
+
readonly code = "CLIENT_TIMEOUT";
|
|
22
|
+
readonly method: string;
|
|
23
|
+
readonly timeoutMs: number;
|
|
24
|
+
readonly requestSent: boolean;
|
|
25
|
+
constructor(params: {
|
|
26
|
+
method: string;
|
|
27
|
+
timeoutMs: number;
|
|
28
|
+
requestSent: boolean;
|
|
29
|
+
}, message?: string);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { GatewayProtocolRequestOptions as n, GatewayProtocolRequestTimeoutError as r, GatewayProtocolRequestError as t };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorShape, EventFrame, HelloOk } from "@openclaw/gateway-protocol/frame-guards";
|
|
1
|
+
import { n as GatewayProtocolRequestOptions, r as GatewayProtocolRequestTimeoutError, t as GatewayProtocolRequestError } from "./protocol-request-D4mVhLxE.mjs";
|
|
2
|
+
import { ConnectParams, ErrorShape, EventFrame, HelloOk } from "@openclaw/gateway-protocol/frame-guards";
|
|
3
3
|
import { GatewayClientMode, GatewayClientName } from "@openclaw/gateway-protocol/client-info";
|
|
4
4
|
|
|
5
|
+
//#region packages/gateway-client/src/request-error.d.ts
|
|
6
|
+
declare class GatewayClientRequestError extends GatewayProtocolRequestError {
|
|
7
|
+
constructor(error: Partial<ErrorShape>);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
5
10
|
//#region packages/gateway-client/src/client.d.ts
|
|
6
11
|
type DeviceIdentity = {
|
|
7
12
|
deviceId: string;
|
|
@@ -50,15 +55,11 @@ type GatewayClientCloseInfo = {
|
|
|
50
55
|
phase: "pre-hello" | "post-hello";
|
|
51
56
|
socketOpened: boolean;
|
|
52
57
|
transportValidated: boolean;
|
|
58
|
+
connectRequestSent?: boolean;
|
|
53
59
|
transientPreHelloCleanClose: boolean;
|
|
60
|
+
connectError?: Error;
|
|
54
61
|
};
|
|
55
|
-
declare class
|
|
56
|
-
constructor(error: Partial<ErrorShape>);
|
|
57
|
-
}
|
|
58
|
-
declare class GatewayClientRequestTimeoutError extends Error {
|
|
59
|
-
readonly method: string;
|
|
60
|
-
readonly timeoutMs: number;
|
|
61
|
-
readonly requestSent: boolean;
|
|
62
|
+
declare class GatewayClientRequestTimeoutError extends GatewayProtocolRequestTimeoutError {
|
|
62
63
|
constructor(params: {
|
|
63
64
|
method: string;
|
|
64
65
|
timeoutMs: number;
|
|
@@ -79,7 +80,8 @@ type GatewayClientOptions = {
|
|
|
79
80
|
tickWatchTimeoutMs?: number;
|
|
80
81
|
requestTimeoutMs?: number;
|
|
81
82
|
token?: string;
|
|
82
|
-
bootstrapToken?: string;
|
|
83
|
+
bootstrapToken?: string; /** Prefer one setup credential for the first successful device-auth exchange. */
|
|
84
|
+
preferBootstrapToken?: boolean;
|
|
83
85
|
deviceToken?: string;
|
|
84
86
|
password?: string;
|
|
85
87
|
approvalRuntimeToken?: string;
|
|
@@ -88,6 +90,7 @@ type GatewayClientOptions = {
|
|
|
88
90
|
clientName?: GatewayClientName;
|
|
89
91
|
clientDisplayName?: string;
|
|
90
92
|
clientVersion?: string;
|
|
93
|
+
clientBuildId?: string;
|
|
91
94
|
platform?: string;
|
|
92
95
|
deviceFamily?: string;
|
|
93
96
|
mode?: GatewayClientMode;
|
|
@@ -95,6 +98,8 @@ type GatewayClientOptions = {
|
|
|
95
98
|
scopes?: string[];
|
|
96
99
|
caps?: string[];
|
|
97
100
|
commands?: string[];
|
|
101
|
+
computerUse?: ConnectParams["computerUse"];
|
|
102
|
+
workerRuns?: ConnectParams["workerRuns"];
|
|
98
103
|
permissions?: Record<string, boolean>;
|
|
99
104
|
pathEnv?: string;
|
|
100
105
|
env?: NodeJS.ProcessEnv;
|
|
@@ -125,6 +130,9 @@ declare class GatewayClient {
|
|
|
125
130
|
private opts;
|
|
126
131
|
private deps;
|
|
127
132
|
private stopped;
|
|
133
|
+
private useLegacyNodeProtocolEnvelope;
|
|
134
|
+
private nodeProtocolTransitionPending;
|
|
135
|
+
private suppressNextHelloCallback;
|
|
128
136
|
private pendingDeviceTokenRetry;
|
|
129
137
|
private deviceTokenRetryBudgetUsed;
|
|
130
138
|
private approvalRuntimeTokenCompatibilityDisabled;
|
|
@@ -141,6 +149,8 @@ declare class GatewayClient {
|
|
|
141
149
|
updateNodeManifest(manifest: {
|
|
142
150
|
caps: string[];
|
|
143
151
|
commands: string[];
|
|
152
|
+
computerUse?: ConnectParams["computerUse"];
|
|
153
|
+
workerRuns?: ConnectParams["workerRuns"];
|
|
144
154
|
}): void;
|
|
145
155
|
start(): void;
|
|
146
156
|
private createSocket;
|
|
@@ -154,6 +164,9 @@ declare class GatewayClient {
|
|
|
154
164
|
private logDebug;
|
|
155
165
|
private logError;
|
|
156
166
|
private assembleConnectParams;
|
|
167
|
+
private shouldNegotiateLegacyNodeProtocol;
|
|
168
|
+
private shouldRetryWithLegacyNodeProtocol;
|
|
169
|
+
private shouldRetryWithCurrentNodeProtocol;
|
|
157
170
|
private buildDeviceConnectParams;
|
|
158
171
|
private handleConnectHello;
|
|
159
172
|
private handleConnectRequestFailure;
|
|
@@ -167,7 +180,6 @@ declare class GatewayClient {
|
|
|
167
180
|
private isTrustedDeviceRetryEndpoint;
|
|
168
181
|
private selectConnectAuth;
|
|
169
182
|
private startTickWatch;
|
|
170
|
-
private validateTlsFingerprint;
|
|
171
183
|
request<T = Record<string, unknown>>(method: string, params?: unknown, opts?: GatewayClientRequestOptions): Promise<T>;
|
|
172
184
|
}
|
|
173
185
|
//#endregion
|
|
@@ -208,4 +220,4 @@ declare function startGatewayClientWithReadinessWait(waitForReady: EventLoopRead
|
|
|
208
220
|
/** Starts a gateway client after the default event-loop readiness probe succeeds. */
|
|
209
221
|
declare function startGatewayClientWhenEventLoopReady(client: GatewayClientStartable, options?: GatewayClientStartReadinessOptions): Promise<EventLoopReadyResult>;
|
|
210
222
|
//#endregion
|
|
211
|
-
export {
|
|
223
|
+
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 };
|
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--KX7i8Mq.mjs";
|
|
2
2
|
export { EventLoopReadyWaiter, GatewayClientStartReadinessOptions, GatewayClientStartable, startGatewayClientWhenEventLoopReady, startGatewayClientWithReadinessWait };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as GatewayBrowserDeviceTokenStore } from "./browser-device-auth-Dz6H7eXy.mjs";
|
|
2
|
+
import { n as GatewayProtocolRequestOptions } from "./protocol-request-D4mVhLxE.mjs";
|
|
3
|
+
|
|
4
|
+
//#region packages/gateway-client/src/scope-upgrade.d.ts
|
|
5
|
+
type ScopeUpgradeBinding = {
|
|
6
|
+
clientId: string;
|
|
7
|
+
deviceId: string;
|
|
8
|
+
role: string;
|
|
9
|
+
};
|
|
10
|
+
type ScopeUpgradeOutcome = {
|
|
11
|
+
status: "approved";
|
|
12
|
+
requestId: string;
|
|
13
|
+
scopes: string[];
|
|
14
|
+
} | {
|
|
15
|
+
status: "rejected" | "expired";
|
|
16
|
+
requestId: string;
|
|
17
|
+
};
|
|
18
|
+
type ScopeUpgradeOptions = {
|
|
19
|
+
binding: ScopeUpgradeBinding;
|
|
20
|
+
scopes: readonly string[];
|
|
21
|
+
onPending?: (requestId: string) => void;
|
|
22
|
+
};
|
|
23
|
+
type UpgradeRequester = (method: string, params?: unknown, options?: GatewayProtocolRequestOptions) => Promise<unknown>;
|
|
24
|
+
/** Runs one browser device scope upgrade and owns rotated-token persistence. */
|
|
25
|
+
declare class GatewayScopeUpgrade {
|
|
26
|
+
private readonly deps;
|
|
27
|
+
private active?;
|
|
28
|
+
constructor(deps: {
|
|
29
|
+
request: UpgradeRequester;
|
|
30
|
+
tokenStore: GatewayBrowserDeviceTokenStore;
|
|
31
|
+
reconnect: () => void;
|
|
32
|
+
});
|
|
33
|
+
requestScopeUpgrade(options: ScopeUpgradeOptions): Promise<ScopeUpgradeOutcome>;
|
|
34
|
+
cancelScopeUpgrade(): void;
|
|
35
|
+
private runUpgrade;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { GatewayScopeUpgrade, ScopeUpgradeBinding, ScopeUpgradeOptions, ScopeUpgradeOutcome };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//#region packages/gateway-client/src/scope-upgrade.ts
|
|
2
|
+
function readRequestId(value) {
|
|
3
|
+
const requestId = value && typeof value === "object" && "requestId" in value ? value.requestId : void 0;
|
|
4
|
+
if (typeof requestId !== "string" || !requestId.trim()) throw new Error("gateway returned an invalid scope upgrade request id");
|
|
5
|
+
return requestId;
|
|
6
|
+
}
|
|
7
|
+
function readUpgradeResult(value, requestId) {
|
|
8
|
+
if (!value || typeof value !== "object") throw new Error("gateway returned an invalid scope upgrade result");
|
|
9
|
+
const result = value;
|
|
10
|
+
if (result.requestId !== requestId) throw new Error("gateway returned a mismatched scope upgrade result");
|
|
11
|
+
if (result.status === "rejected" || result.status === "expired") return {
|
|
12
|
+
status: result.status,
|
|
13
|
+
requestId
|
|
14
|
+
};
|
|
15
|
+
const deviceToken = result.status === "approved" && typeof result.deviceToken === "string" ? result.deviceToken.trim() : "";
|
|
16
|
+
const rawScopes = result.status === "approved" && Array.isArray(result.scopes) ? result.scopes : [];
|
|
17
|
+
if (!deviceToken || rawScopes.length === 0 || rawScopes.some((scope) => typeof scope !== "string" || !scope.trim())) throw new Error("gateway returned invalid approved scope upgrade credentials");
|
|
18
|
+
return {
|
|
19
|
+
status: "approved",
|
|
20
|
+
requestId,
|
|
21
|
+
deviceToken,
|
|
22
|
+
scopes: rawScopes
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Runs one browser device scope upgrade and owns rotated-token persistence. */
|
|
26
|
+
var GatewayScopeUpgrade = class {
|
|
27
|
+
constructor(deps) {
|
|
28
|
+
this.deps = deps;
|
|
29
|
+
}
|
|
30
|
+
requestScopeUpgrade(options) {
|
|
31
|
+
if (this.active) {
|
|
32
|
+
if (this.active.requestId) options.onPending?.(this.active.requestId);
|
|
33
|
+
return this.active.promise;
|
|
34
|
+
}
|
|
35
|
+
const operation = { controller: new AbortController() };
|
|
36
|
+
const promise = this.runUpgrade(operation, options).finally(() => {
|
|
37
|
+
if (this.active === operation) this.active = void 0;
|
|
38
|
+
});
|
|
39
|
+
operation.promise = promise;
|
|
40
|
+
this.active = operation;
|
|
41
|
+
return promise;
|
|
42
|
+
}
|
|
43
|
+
cancelScopeUpgrade() {
|
|
44
|
+
const operation = this.active;
|
|
45
|
+
this.active = void 0;
|
|
46
|
+
operation?.controller.abort();
|
|
47
|
+
}
|
|
48
|
+
async runUpgrade(operation, options) {
|
|
49
|
+
const requestId = readRequestId(await this.deps.request("device.scopes.requestUpgrade", { scopes: [...options.scopes] }, { signal: operation.controller.signal }));
|
|
50
|
+
operation.requestId = requestId;
|
|
51
|
+
options.onPending?.(requestId);
|
|
52
|
+
const result = readUpgradeResult(await this.deps.request("device.scopes.waitUpgrade", { requestId }, {
|
|
53
|
+
timeoutMs: null,
|
|
54
|
+
signal: operation.controller.signal
|
|
55
|
+
}), requestId);
|
|
56
|
+
if (result.status !== "approved") return result;
|
|
57
|
+
await this.deps.tokenStore.store({
|
|
58
|
+
clientId: options.binding.clientId,
|
|
59
|
+
deviceId: options.binding.deviceId,
|
|
60
|
+
role: options.binding.role,
|
|
61
|
+
token: result.deviceToken,
|
|
62
|
+
scopes: result.scopes
|
|
63
|
+
});
|
|
64
|
+
this.deps.reconnect();
|
|
65
|
+
return {
|
|
66
|
+
status: "approved",
|
|
67
|
+
requestId,
|
|
68
|
+
scopes: result.scopes
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { GatewayScopeUpgrade };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ConnectParams, HelloOk } from "@openclaw/gateway-protocol";
|
|
2
|
-
|
|
3
1
|
//#region packages/gateway-client/src/device-auth.d.ts
|
|
4
2
|
declare function normalizeDeviceMetadataForAuth(value?: string | null): string;
|
|
5
3
|
type DeviceAuthPayloadParams = {
|
|
@@ -19,114 +17,11 @@ type DeviceAuthPayloadV3Params = DeviceAuthPayloadParams & {
|
|
|
19
17
|
declare function buildDeviceAuthPayload(params: DeviceAuthPayloadParams): string;
|
|
20
18
|
declare function buildDeviceAuthPayloadV3(params: DeviceAuthPayloadV3Params): string;
|
|
21
19
|
//#endregion
|
|
22
|
-
//#region packages/gateway-client/src/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
authPassword?: string;
|
|
28
|
-
authApprovalRuntimeToken?: string;
|
|
29
|
-
authAgentRuntimeIdentityToken?: string;
|
|
30
|
-
signatureToken?: string;
|
|
31
|
-
resolvedDeviceToken?: string;
|
|
32
|
-
storedToken?: string;
|
|
33
|
-
storedScopes?: string[];
|
|
34
|
-
usingStoredDeviceToken?: boolean;
|
|
35
|
-
};
|
|
36
|
-
declare function selectGatewayConnectAuth(params: {
|
|
37
|
-
token?: string;
|
|
38
|
-
bootstrapToken?: string;
|
|
39
|
-
deviceToken?: string;
|
|
40
|
-
password?: string;
|
|
41
|
-
approvalRuntimeToken?: string;
|
|
42
|
-
agentRuntimeIdentityToken?: string;
|
|
43
|
-
storedToken?: string;
|
|
44
|
-
storedScopes?: string[];
|
|
45
|
-
pendingDeviceTokenRetry?: boolean;
|
|
46
|
-
trustedDeviceTokenRetry?: boolean;
|
|
47
|
-
preferBootstrapToken?: boolean;
|
|
48
|
-
}): GatewayConnectAuthSelection;
|
|
49
|
-
declare function buildGatewayConnectAuth(selected: GatewayConnectAuthSelection): ConnectParams["auth"];
|
|
50
|
-
declare function resolveGatewayConnectScopes(params: {
|
|
51
|
-
requestedScopes?: string[];
|
|
52
|
-
usingStoredDeviceToken?: boolean;
|
|
53
|
-
storedScopes?: string[];
|
|
54
|
-
defaultScopes: readonly string[];
|
|
55
|
-
}): string[];
|
|
56
|
-
declare function shouldRetryGatewayWithDeviceToken(params: {
|
|
57
|
-
retryBudgetUsed: boolean;
|
|
58
|
-
currentDeviceToken?: string;
|
|
59
|
-
explicitToken?: string;
|
|
60
|
-
storedToken?: string;
|
|
61
|
-
trustedEndpoint: boolean;
|
|
62
|
-
canRetryWithDeviceTokenHint?: boolean;
|
|
63
|
-
errorDetails?: unknown;
|
|
64
|
-
}): boolean;
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region packages/gateway-client/src/browser-device-auth.d.ts
|
|
67
|
-
type GatewayBrowserDeviceIdentity = {
|
|
68
|
-
deviceId: string;
|
|
69
|
-
publicKey: string;
|
|
70
|
-
sign: (payload: string) => Promise<string>;
|
|
71
|
-
};
|
|
72
|
-
type GatewayBrowserDeviceTokenRecord = {
|
|
73
|
-
token: string;
|
|
74
|
-
scopes: string[];
|
|
75
|
-
};
|
|
76
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
77
|
-
type GatewayBrowserDeviceTokenStore = {
|
|
78
|
-
load: (params: {
|
|
79
|
-
clientId: string;
|
|
80
|
-
deviceId: string;
|
|
81
|
-
role: string;
|
|
82
|
-
}) => MaybePromise<GatewayBrowserDeviceTokenRecord | null>;
|
|
83
|
-
store: (params: {
|
|
84
|
-
clientId: string;
|
|
85
|
-
deviceId: string;
|
|
86
|
-
role: string;
|
|
87
|
-
token: string;
|
|
88
|
-
scopes: string[];
|
|
89
|
-
}) => MaybePromise<void>;
|
|
90
|
-
clear: (params: {
|
|
91
|
-
clientId: string;
|
|
92
|
-
deviceId: string;
|
|
93
|
-
role: string;
|
|
94
|
-
}) => MaybePromise<void>;
|
|
95
|
-
};
|
|
96
|
-
type GatewayBrowserDeviceAuthPlan = {
|
|
97
|
-
clientId: string;
|
|
98
|
-
role: string;
|
|
99
|
-
identity: GatewayBrowserDeviceIdentity | null;
|
|
100
|
-
selectedAuth: GatewayConnectAuthSelection;
|
|
101
|
-
scopes: string[];
|
|
102
|
-
device?: NonNullable<ConnectParams["device"]>;
|
|
103
|
-
auth?: ConnectParams["auth"];
|
|
104
|
-
};
|
|
105
|
-
/** Browser-safe device pairing and issued-token lifecycle shared by first-party UI clients. */
|
|
106
|
-
declare class GatewayBrowserDeviceAuthLifecycle {
|
|
107
|
-
private readonly deps;
|
|
108
|
-
constructor(deps: {
|
|
109
|
-
loadIdentity: () => Promise<GatewayBrowserDeviceIdentity | null>;
|
|
110
|
-
tokenStore: GatewayBrowserDeviceTokenStore;
|
|
111
|
-
nowMs?: () => number;
|
|
112
|
-
});
|
|
113
|
-
buildPlan(params: {
|
|
114
|
-
client: ConnectParams["client"];
|
|
115
|
-
role: string;
|
|
116
|
-
defaultScopes: readonly string[];
|
|
117
|
-
bootstrapScopes?: readonly string[];
|
|
118
|
-
token?: string;
|
|
119
|
-
bootstrapToken?: string;
|
|
120
|
-
password?: string;
|
|
121
|
-
pendingDeviceTokenRetry?: boolean;
|
|
122
|
-
trustedDeviceTokenRetry?: boolean;
|
|
123
|
-
preferBootstrapToken?: boolean;
|
|
124
|
-
nonce: string | null;
|
|
125
|
-
challengeTs?: number | null;
|
|
126
|
-
}): Promise<GatewayBrowserDeviceAuthPlan>;
|
|
127
|
-
acceptHello(hello: Pick<HelloOk, "auth">, plan: GatewayBrowserDeviceAuthPlan): Promise<void>;
|
|
128
|
-
clearStoredToken(plan: GatewayBrowserDeviceAuthPlan): Promise<void>;
|
|
129
|
-
}
|
|
20
|
+
//#region packages/gateway-client/src/gateway-origin-scope.d.ts
|
|
21
|
+
/** Normalizes the gateway URL scope used for origin-bound device tokens. */
|
|
22
|
+
declare function gatewayOriginScope(gatewayUrl: string): string;
|
|
23
|
+
/** Normalizes the gateway URL scope used for browser credential records. */
|
|
24
|
+
declare function gatewayCredentialScope(gatewayUrl: string): string;
|
|
130
25
|
//#endregion
|
|
131
26
|
//#region packages/gateway-client/src/session-projection.d.ts
|
|
132
27
|
/** Browser-safe identity and replay rules shared by Gateway conversation clients. */
|
|
@@ -280,4 +175,4 @@ declare function getGatewaySessionMessageSubscriptionCoordinator(client: Gateway
|
|
|
280
175
|
declare function resetGatewaySessionMessageSubscriptionCoordinator(client: GatewaySessionMessageRequestClient): void;
|
|
281
176
|
declare function releaseGatewaySessionMessageSubscription(subscription: GatewaySessionMessageSubscription): Promise<void>;
|
|
282
177
|
//#endregion
|
|
283
|
-
export {
|
|
178
|
+
export { gatewayCredentialScope as A, normalizeSessionProjectionRunId as C, reconcileSessionProjectionSnapshot as D, readSessionMessageSequence as E, buildDeviceAuthPayload as M, buildDeviceAuthPayloadV3 as N, reduceSessionProjection as O, normalizeDeviceMetadataForAuth as P, isLocallyOptimisticSessionMessage as S, readSessionMessageIdentity as T, SessionProjectionScope as _, GatewaySessionMessageSubscriptionOptions as a, createSessionProjection as b, resetGatewaySessionMessageSubscriptionCoordinator as c, SessionProjectionEntry as d, SessionProjectionEvent as f, SessionProjectionRunTransition as g, SessionProjectionRunStatus as h, GatewaySessionMessageSubscriptionCoordinatorOptions as i, gatewayOriginScope as j, reduceSessionProjectionRunEvent as k, SessionMessageEnvelope as l, SessionProjectionRun as m, GatewaySessionMessageSubscription as n, getGatewaySessionMessageSubscriptionCoordinator as o, SessionProjectionGatewayRunEvent as p, GatewaySessionMessageSubscriptionCoordinator as r, releaseGatewaySessionMessageSubscription as s, GatewaySessionMessageRequestClient as t, SessionMessageIdentity as u, SessionProjectionSnapshotOptions as v, projectLiveSessionMessage as w, hasSessionProjectionAcceptedFinal as x, SessionProjectionState as y };
|