@dxos/client-services 0.5.8-next.4b7fabd → 0.5.9-main.2d0a5e6
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/dist/lib/browser/{chunk-ACQUT3OK.mjs → chunk-5SOW3KZQ.mjs} +1141 -1134
- package/dist/lib/browser/chunk-5SOW3KZQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +55 -363
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -4
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-IBTSMFQY.cjs → chunk-KYH2GPWL.cjs} +1145 -1138
- package/dist/lib/node/chunk-KYH2GPWL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +93 -396
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts +4 -4
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +2 -2
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +4 -5
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -3
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/index.d.ts +3 -0
- package/dist/types/src/packlets/worker/index.d.ts.map +1 -0
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -0
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/index.ts +3 -3
- package/src/packlets/devtools/network.ts +4 -4
- package/src/packlets/identity/identity-manager.test.ts +2 -2
- package/src/packlets/identity/identity.test.ts +8 -4
- package/src/packlets/invitations/invitations-handler.ts +2 -2
- package/src/packlets/network/network-service.ts +2 -2
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +6 -7
- package/src/packlets/spaces/data-space.ts +11 -1
- package/src/packlets/spaces/spaces-service.ts +1 -0
- package/src/packlets/testing/test-builder.ts +4 -4
- package/src/packlets/worker/index.ts +6 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-ACQUT3OK.mjs.map +0 -7
- package/dist/lib/node/chunk-IBTSMFQY.cjs.map +0 -7
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +0 -37
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/index.d.ts +0 -6
- package/dist/types/src/packlets/vault/index.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/shared-worker-connection.d.ts +0 -36
- package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +0 -33
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +0 -1
- package/src/packlets/vault/iframe-host-runtime.ts +0 -130
- package/src/packlets/vault/index.ts +0 -9
- package/src/packlets/vault/shared-worker-connection.ts +0 -115
- package/src/packlets/vault/shell-runtime.ts +0 -111
- /package/dist/types/src/packlets/{vault → worker}/worker-runtime.d.ts +0 -0
- /package/dist/types/src/packlets/{vault → worker}/worker-session.d.ts +0 -0
- /package/src/packlets/{vault → worker}/worker-runtime.ts +0 -0
- /package/src/packlets/{vault → worker}/worker-session.ts +0 -0
|
@@ -38,329 +38,24 @@ import {
|
|
|
38
38
|
subscribeToSignal,
|
|
39
39
|
subscribeToSpaces,
|
|
40
40
|
subscribeToSwarmInfo
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-5SOW3KZQ.mjs";
|
|
42
42
|
|
|
43
|
-
// packages/sdk/client-services/src/packlets/
|
|
44
|
-
import { Trigger } from "@dxos/async";
|
|
45
|
-
import { PROXY_CONNECTION_TIMEOUT } from "@dxos/client-protocol";
|
|
46
|
-
import { Context } from "@dxos/context";
|
|
47
|
-
import { log, logInfo } from "@dxos/log";
|
|
48
|
-
import { MemorySignalManager, MemorySignalManagerContext, WebsocketSignalManager } from "@dxos/messaging";
|
|
49
|
-
import { createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
50
|
-
import { getAsyncValue } from "@dxos/util";
|
|
51
|
-
|
|
52
|
-
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
53
|
-
import { Event } from "@dxos/async";
|
|
54
|
-
import { appServiceBundle, shellServiceBundle } from "@dxos/client-protocol";
|
|
55
|
-
import { invariant } from "@dxos/invariant";
|
|
56
|
-
import { ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
57
|
-
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
58
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
|
|
59
|
-
var ShellRuntimeImpl = class {
|
|
60
|
-
constructor(_port) {
|
|
61
|
-
this._port = _port;
|
|
62
|
-
this.layoutUpdate = new Event();
|
|
63
|
-
this.invitationUrlUpdate = new Event();
|
|
64
|
-
this._layout = ShellLayout.DEFAULT;
|
|
65
|
-
this._invitationUrl = typeof window !== "undefined" ? window.location.origin : void 0;
|
|
66
|
-
this._deviceInvitationParam = "deviceInvitationCode";
|
|
67
|
-
this._spaceInvitationParam = "spaceInvitationCode";
|
|
68
|
-
}
|
|
69
|
-
get layout() {
|
|
70
|
-
return this._layout;
|
|
71
|
-
}
|
|
72
|
-
get invitationCode() {
|
|
73
|
-
return this._invitationCode;
|
|
74
|
-
}
|
|
75
|
-
get spaceKey() {
|
|
76
|
-
return this._spaceKey;
|
|
77
|
-
}
|
|
78
|
-
get invitationUrl() {
|
|
79
|
-
return this._invitationUrl;
|
|
80
|
-
}
|
|
81
|
-
get deviceInvitationParam() {
|
|
82
|
-
return this._deviceInvitationParam;
|
|
83
|
-
}
|
|
84
|
-
get spaceInvitationParam() {
|
|
85
|
-
return this._spaceInvitationParam;
|
|
86
|
-
}
|
|
87
|
-
setLayout({ layout, invitationCode, spaceKey }) {
|
|
88
|
-
this._layout = layout;
|
|
89
|
-
this._invitationCode = invitationCode;
|
|
90
|
-
this._spaceKey = spaceKey;
|
|
91
|
-
this.layoutUpdate.emit({
|
|
92
|
-
layout,
|
|
93
|
-
invitationCode,
|
|
94
|
-
spaceKey
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
setInvitationUrl({ invitationUrl, deviceInvitationParam, spaceInvitationParam }) {
|
|
98
|
-
this._invitationUrl = invitationUrl;
|
|
99
|
-
this._deviceInvitationParam = deviceInvitationParam;
|
|
100
|
-
this._spaceInvitationParam = spaceInvitationParam;
|
|
101
|
-
this.invitationUrlUpdate.emit({
|
|
102
|
-
invitationUrl,
|
|
103
|
-
deviceInvitationParam,
|
|
104
|
-
spaceInvitationParam
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
async setAppContext(context) {
|
|
108
|
-
invariant(this._appRpc, "runtime not open", {
|
|
109
|
-
F: __dxlog_file,
|
|
110
|
-
L: 76,
|
|
111
|
-
S: this,
|
|
112
|
-
A: [
|
|
113
|
-
"this._appRpc",
|
|
114
|
-
"'runtime not open'"
|
|
115
|
-
]
|
|
116
|
-
});
|
|
117
|
-
await this._appRpc.rpc.AppService.setContext(context);
|
|
118
|
-
}
|
|
119
|
-
async open() {
|
|
120
|
-
this._appRpc = createProtoRpcPeer({
|
|
121
|
-
requested: appServiceBundle,
|
|
122
|
-
exposed: shellServiceBundle,
|
|
123
|
-
handlers: {
|
|
124
|
-
ShellService: {
|
|
125
|
-
setLayout: async (request) => {
|
|
126
|
-
this._layout = request.layout;
|
|
127
|
-
this._invitationCode = request.invitationCode;
|
|
128
|
-
this._spaceKey = request.spaceKey;
|
|
129
|
-
this.layoutUpdate.emit(request);
|
|
130
|
-
},
|
|
131
|
-
setInvitationUrl: async (request) => {
|
|
132
|
-
this._invitationUrl = request.invitationUrl;
|
|
133
|
-
this._deviceInvitationParam = request.deviceInvitationParam;
|
|
134
|
-
this._spaceInvitationParam = request.spaceInvitationParam;
|
|
135
|
-
this.invitationUrlUpdate.emit(request);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
port: this._port
|
|
140
|
-
});
|
|
141
|
-
await this._appRpc.open();
|
|
142
|
-
}
|
|
143
|
-
async close() {
|
|
144
|
-
await this._appRpc?.close();
|
|
145
|
-
this._appRpc = void 0;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
150
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
151
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
152
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
153
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
154
|
-
else
|
|
155
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
156
|
-
if (d = decorators[i])
|
|
157
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
158
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
159
|
-
}
|
|
160
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
161
|
-
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
162
|
-
var IFrameHostRuntime = class {
|
|
163
|
-
constructor({ config, origin, appPort, shellPort }) {
|
|
164
|
-
this._ready = new Trigger();
|
|
165
|
-
this._configProvider = config;
|
|
166
|
-
this.origin = origin;
|
|
167
|
-
this._appPort = appPort;
|
|
168
|
-
this._shellPort = shellPort;
|
|
169
|
-
if (this._shellPort) {
|
|
170
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
get services() {
|
|
174
|
-
return this._clientServices;
|
|
175
|
-
}
|
|
176
|
-
get shell() {
|
|
177
|
-
return this._shellRuntime;
|
|
178
|
-
}
|
|
179
|
-
async start() {
|
|
180
|
-
log("starting...", void 0, {
|
|
181
|
-
F: __dxlog_file2,
|
|
182
|
-
L: 73,
|
|
183
|
-
S: this,
|
|
184
|
-
C: (f, a) => f(...a)
|
|
185
|
-
});
|
|
186
|
-
try {
|
|
187
|
-
this._config = await getAsyncValue(this._configProvider);
|
|
188
|
-
this._transportFactory = createSimplePeerTransportFactory({
|
|
189
|
-
iceServers: this._config.get("runtime.services.ice")
|
|
190
|
-
});
|
|
191
|
-
const signals = this._config.get("runtime.services.signaling");
|
|
192
|
-
this._clientServices = new ClientServicesHost({
|
|
193
|
-
lockKey: LOCK_KEY,
|
|
194
|
-
config: this._config,
|
|
195
|
-
signalManager: signals ? new WebsocketSignalManager(signals) : new MemorySignalManager(new MemorySignalManagerContext()),
|
|
196
|
-
transportFactory: this._transportFactory
|
|
197
|
-
});
|
|
198
|
-
const middleware = {
|
|
199
|
-
handleCall: async (method, params, handler) => {
|
|
200
|
-
const error = await this._ready.wait({
|
|
201
|
-
timeout: PROXY_CONNECTION_TIMEOUT
|
|
202
|
-
});
|
|
203
|
-
if (error) {
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
return handler(method, params);
|
|
207
|
-
},
|
|
208
|
-
handleStream: async (method, params, handler) => {
|
|
209
|
-
const error = await this._ready.wait({
|
|
210
|
-
timeout: PROXY_CONNECTION_TIMEOUT
|
|
211
|
-
});
|
|
212
|
-
if (error) {
|
|
213
|
-
throw error;
|
|
214
|
-
}
|
|
215
|
-
return handler(method, params);
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
this._clientRpc = new ClientRpcServer({
|
|
219
|
-
serviceRegistry: this._clientServices.serviceRegistry,
|
|
220
|
-
port: this._appPort,
|
|
221
|
-
...middleware
|
|
222
|
-
});
|
|
223
|
-
await Promise.all([
|
|
224
|
-
this._clientServices.open(new Context()),
|
|
225
|
-
this._clientRpc.open(),
|
|
226
|
-
this._shellRuntime?.open()
|
|
227
|
-
]);
|
|
228
|
-
this._ready.wake(void 0);
|
|
229
|
-
log("started", void 0, {
|
|
230
|
-
F: __dxlog_file2,
|
|
231
|
-
L: 116,
|
|
232
|
-
S: this,
|
|
233
|
-
C: (f, a) => f(...a)
|
|
234
|
-
});
|
|
235
|
-
} catch (err) {
|
|
236
|
-
this._ready.wake(err);
|
|
237
|
-
log.catch(err, void 0, {
|
|
238
|
-
F: __dxlog_file2,
|
|
239
|
-
L: 119,
|
|
240
|
-
S: this,
|
|
241
|
-
C: (f, a) => f(...a)
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
async stop() {
|
|
246
|
-
log("stopping...", void 0, {
|
|
247
|
-
F: __dxlog_file2,
|
|
248
|
-
L: 124,
|
|
249
|
-
S: this,
|
|
250
|
-
C: (f, a) => f(...a)
|
|
251
|
-
});
|
|
252
|
-
await this._clientRpc.close();
|
|
253
|
-
await this._clientServices.close();
|
|
254
|
-
await this._shellRuntime?.close();
|
|
255
|
-
log("stopped", void 0, {
|
|
256
|
-
F: __dxlog_file2,
|
|
257
|
-
L: 128,
|
|
258
|
-
S: this,
|
|
259
|
-
C: (f, a) => f(...a)
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
_ts_decorate([
|
|
264
|
-
logInfo
|
|
265
|
-
], IFrameHostRuntime.prototype, "origin", void 0);
|
|
266
|
-
|
|
267
|
-
// packages/sdk/client-services/src/packlets/vault/shared-worker-connection.ts
|
|
43
|
+
// packages/sdk/client-services/src/packlets/worker/worker-runtime.ts
|
|
268
44
|
import { Trigger as Trigger2 } from "@dxos/async";
|
|
269
|
-
import {
|
|
45
|
+
import { Context } from "@dxos/context";
|
|
46
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
270
47
|
import { log as log2 } from "@dxos/log";
|
|
271
|
-
import {
|
|
272
|
-
import { RemoteServiceConnectionError } from "@dxos/protocols";
|
|
273
|
-
import { createProtoRpcPeer as createProtoRpcPeer2 } from "@dxos/rpc";
|
|
274
|
-
import { getAsyncValue as getAsyncValue2 } from "@dxos/util";
|
|
275
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shared-worker-connection.ts";
|
|
276
|
-
var SharedWorkerConnection = class {
|
|
277
|
-
constructor({ config, systemPort, shellPort }) {
|
|
278
|
-
this._id = String(Math.floor(Math.random() * 1e6));
|
|
279
|
-
this._release = new Trigger2();
|
|
280
|
-
this._configProvider = config;
|
|
281
|
-
this._systemPort = systemPort;
|
|
282
|
-
this._shellPort = shellPort;
|
|
283
|
-
if (this._shellPort) {
|
|
284
|
-
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
get shell() {
|
|
288
|
-
return this._shellRuntime;
|
|
289
|
-
}
|
|
290
|
-
async open(params) {
|
|
291
|
-
this._config = await getAsyncValue2(this._configProvider);
|
|
292
|
-
this._transportService = new SimplePeerTransportService({
|
|
293
|
-
iceServers: this._config.get("runtime.services.ice")
|
|
294
|
-
});
|
|
295
|
-
this._systemRpc = createProtoRpcPeer2({
|
|
296
|
-
requested: workerServiceBundle,
|
|
297
|
-
exposed: iframeServiceBundle,
|
|
298
|
-
handlers: {
|
|
299
|
-
BridgeService: this._transportService
|
|
300
|
-
},
|
|
301
|
-
port: this._systemPort,
|
|
302
|
-
// TODO(wittjosiah): Make longer and factor out to constant.
|
|
303
|
-
// TODO(wittjosiah): If this is too long then it breaks the reset flows in Composer.
|
|
304
|
-
timeout: 200
|
|
305
|
-
});
|
|
306
|
-
let lockKey;
|
|
307
|
-
if (typeof navigator !== "undefined") {
|
|
308
|
-
lockKey = this._lockKey(params.origin);
|
|
309
|
-
this._release = new Trigger2();
|
|
310
|
-
const ready = new Trigger2();
|
|
311
|
-
void navigator.locks.request(lockKey, async () => {
|
|
312
|
-
ready.wake();
|
|
313
|
-
await this._release.wait();
|
|
314
|
-
});
|
|
315
|
-
await ready.wait();
|
|
316
|
-
}
|
|
317
|
-
try {
|
|
318
|
-
await this._systemRpc.open();
|
|
319
|
-
await this._systemRpc.rpc.WorkerService.start({
|
|
320
|
-
lockKey,
|
|
321
|
-
...params
|
|
322
|
-
});
|
|
323
|
-
} catch (err) {
|
|
324
|
-
log2.catch(err, void 0, {
|
|
325
|
-
F: __dxlog_file3,
|
|
326
|
-
L: 95,
|
|
327
|
-
S: this,
|
|
328
|
-
C: (f, a) => f(...a)
|
|
329
|
-
});
|
|
330
|
-
throw new RemoteServiceConnectionError("Failed to connect to worker");
|
|
331
|
-
}
|
|
332
|
-
await this._shellRuntime?.open();
|
|
333
|
-
}
|
|
334
|
-
async close() {
|
|
335
|
-
this._release.wake();
|
|
336
|
-
await this._shellRuntime?.close();
|
|
337
|
-
try {
|
|
338
|
-
await this._systemRpc.rpc.WorkerService.stop();
|
|
339
|
-
} catch {
|
|
340
|
-
}
|
|
341
|
-
await this._systemRpc.close();
|
|
342
|
-
}
|
|
343
|
-
_lockKey(origin) {
|
|
344
|
-
return `${origin}-${this._id}`;
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
349
|
-
import { Trigger as Trigger4 } from "@dxos/async";
|
|
350
|
-
import { Context as Context2 } from "@dxos/context";
|
|
351
|
-
import { invariant as invariant3 } from "@dxos/invariant";
|
|
352
|
-
import { log as log4 } from "@dxos/log";
|
|
353
|
-
import { MemorySignalManager as MemorySignalManager2, MemorySignalManagerContext as MemorySignalManagerContext2, WebsocketSignalManager as WebsocketSignalManager2, setIdentityTags } from "@dxos/messaging";
|
|
48
|
+
import { MemorySignalManager, MemorySignalManagerContext, WebsocketSignalManager, setIdentityTags } from "@dxos/messaging";
|
|
354
49
|
import { SimplePeerTransportProxyFactory } from "@dxos/network-manager";
|
|
355
50
|
|
|
356
|
-
// packages/sdk/client-services/src/packlets/
|
|
357
|
-
import { asyncTimeout, Trigger
|
|
358
|
-
import { iframeServiceBundle
|
|
359
|
-
import { invariant
|
|
360
|
-
import { log
|
|
361
|
-
import { createProtoRpcPeer
|
|
51
|
+
// packages/sdk/client-services/src/packlets/worker/worker-session.ts
|
|
52
|
+
import { asyncTimeout, Trigger } from "@dxos/async";
|
|
53
|
+
import { iframeServiceBundle, PROXY_CONNECTION_TIMEOUT, workerServiceBundle } from "@dxos/client-protocol";
|
|
54
|
+
import { invariant } from "@dxos/invariant";
|
|
55
|
+
import { log, logInfo } from "@dxos/log";
|
|
56
|
+
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
362
57
|
import { Callback } from "@dxos/util";
|
|
363
|
-
function
|
|
58
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
364
59
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
365
60
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
366
61
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -370,13 +65,13 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
370
65
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
371
66
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
372
67
|
}
|
|
373
|
-
var
|
|
68
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/worker/worker-session.ts";
|
|
374
69
|
var WorkerSession = class {
|
|
375
70
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
376
|
-
this._startTrigger = new
|
|
71
|
+
this._startTrigger = new Trigger();
|
|
377
72
|
this.onClose = new Callback();
|
|
378
|
-
|
|
379
|
-
F:
|
|
73
|
+
invariant(serviceHost, void 0, {
|
|
74
|
+
F: __dxlog_file,
|
|
380
75
|
L: 54,
|
|
381
76
|
S: this,
|
|
382
77
|
A: [
|
|
@@ -388,7 +83,7 @@ var WorkerSession = class {
|
|
|
388
83
|
const middleware = {
|
|
389
84
|
handleCall: async (method, params, handler) => {
|
|
390
85
|
const error = await readySignal.wait({
|
|
391
|
-
timeout:
|
|
86
|
+
timeout: PROXY_CONNECTION_TIMEOUT
|
|
392
87
|
});
|
|
393
88
|
if (error) {
|
|
394
89
|
throw error;
|
|
@@ -397,7 +92,7 @@ var WorkerSession = class {
|
|
|
397
92
|
},
|
|
398
93
|
handleStream: async (method, params, handler) => {
|
|
399
94
|
const error = await readySignal.wait({
|
|
400
|
-
timeout:
|
|
95
|
+
timeout: PROXY_CONNECTION_TIMEOUT
|
|
401
96
|
});
|
|
402
97
|
if (error) {
|
|
403
98
|
throw error;
|
|
@@ -415,9 +110,9 @@ var WorkerSession = class {
|
|
|
415
110
|
port: shellPort,
|
|
416
111
|
...middleware
|
|
417
112
|
}) : void 0;
|
|
418
|
-
this._iframeRpc =
|
|
419
|
-
requested:
|
|
420
|
-
exposed:
|
|
113
|
+
this._iframeRpc = createProtoRpcPeer({
|
|
114
|
+
requested: iframeServiceBundle,
|
|
115
|
+
exposed: workerServiceBundle,
|
|
421
116
|
handlers: {
|
|
422
117
|
WorkerService: {
|
|
423
118
|
start: async (request) => {
|
|
@@ -432,8 +127,8 @@ var WorkerSession = class {
|
|
|
432
127
|
try {
|
|
433
128
|
await this.close();
|
|
434
129
|
} catch (err) {
|
|
435
|
-
|
|
436
|
-
F:
|
|
130
|
+
log.catch(err, void 0, {
|
|
131
|
+
F: __dxlog_file,
|
|
437
132
|
L: 108,
|
|
438
133
|
S: this,
|
|
439
134
|
C: (f, a) => f(...a)
|
|
@@ -449,8 +144,8 @@ var WorkerSession = class {
|
|
|
449
144
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
450
145
|
}
|
|
451
146
|
async open() {
|
|
452
|
-
|
|
453
|
-
F:
|
|
147
|
+
log.info("opening...", void 0, {
|
|
148
|
+
F: __dxlog_file,
|
|
454
149
|
L: 122,
|
|
455
150
|
S: this,
|
|
456
151
|
C: (f, a) => f(...a)
|
|
@@ -461,21 +156,21 @@ var WorkerSession = class {
|
|
|
461
156
|
this._maybeOpenShell()
|
|
462
157
|
]);
|
|
463
158
|
await this._startTrigger.wait({
|
|
464
|
-
timeout:
|
|
159
|
+
timeout: PROXY_CONNECTION_TIMEOUT
|
|
465
160
|
});
|
|
466
161
|
if (this.lockKey) {
|
|
467
162
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
468
163
|
}
|
|
469
|
-
|
|
470
|
-
F:
|
|
164
|
+
log.info("opened", void 0, {
|
|
165
|
+
F: __dxlog_file,
|
|
471
166
|
L: 133,
|
|
472
167
|
S: this,
|
|
473
168
|
C: (f, a) => f(...a)
|
|
474
169
|
});
|
|
475
170
|
}
|
|
476
171
|
async close() {
|
|
477
|
-
|
|
478
|
-
F:
|
|
172
|
+
log.info("closing...", void 0, {
|
|
173
|
+
F: __dxlog_file,
|
|
479
174
|
L: 137,
|
|
480
175
|
S: this,
|
|
481
176
|
C: (f, a) => f(...a)
|
|
@@ -483,8 +178,8 @@ var WorkerSession = class {
|
|
|
483
178
|
try {
|
|
484
179
|
await this.onClose.callIfSet();
|
|
485
180
|
} catch (err) {
|
|
486
|
-
|
|
487
|
-
F:
|
|
181
|
+
log.catch(err, void 0, {
|
|
182
|
+
F: __dxlog_file,
|
|
488
183
|
L: 141,
|
|
489
184
|
S: this,
|
|
490
185
|
C: (f, a) => f(...a)
|
|
@@ -494,8 +189,8 @@ var WorkerSession = class {
|
|
|
494
189
|
this._clientRpc.close(),
|
|
495
190
|
this._iframeRpc.close()
|
|
496
191
|
]);
|
|
497
|
-
|
|
498
|
-
F:
|
|
192
|
+
log.info("closed", void 0, {
|
|
193
|
+
F: __dxlog_file,
|
|
499
194
|
L: 145,
|
|
500
195
|
S: this,
|
|
501
196
|
C: (f, a) => f(...a)
|
|
@@ -505,8 +200,8 @@ var WorkerSession = class {
|
|
|
505
200
|
try {
|
|
506
201
|
this._shellClientRpc && await asyncTimeout(this._shellClientRpc.open(), 1e3);
|
|
507
202
|
} catch {
|
|
508
|
-
|
|
509
|
-
F:
|
|
203
|
+
log.info("No shell connected.", void 0, {
|
|
204
|
+
F: __dxlog_file,
|
|
510
205
|
L: 152,
|
|
511
206
|
S: this,
|
|
512
207
|
C: (f, a) => f(...a)
|
|
@@ -518,20 +213,20 @@ var WorkerSession = class {
|
|
|
518
213
|
}).then(callback);
|
|
519
214
|
}
|
|
520
215
|
};
|
|
521
|
-
|
|
522
|
-
|
|
216
|
+
_ts_decorate([
|
|
217
|
+
logInfo
|
|
523
218
|
], WorkerSession.prototype, "origin", void 0);
|
|
524
|
-
|
|
525
|
-
|
|
219
|
+
_ts_decorate([
|
|
220
|
+
logInfo
|
|
526
221
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
527
222
|
|
|
528
|
-
// packages/sdk/client-services/src/packlets/
|
|
529
|
-
var
|
|
223
|
+
// packages/sdk/client-services/src/packlets/worker/worker-runtime.ts
|
|
224
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/worker/worker-runtime.ts";
|
|
530
225
|
var WorkerRuntime = class {
|
|
531
226
|
constructor(_configProvider, { acquireLock, releaseLock, onReset }) {
|
|
532
227
|
this._configProvider = _configProvider;
|
|
533
228
|
this._transportFactory = new SimplePeerTransportProxyFactory();
|
|
534
|
-
this._ready = new
|
|
229
|
+
this._ready = new Trigger2();
|
|
535
230
|
this._sessions = /* @__PURE__ */ new Set();
|
|
536
231
|
this._signalMetadataTags = {
|
|
537
232
|
runtime: "worker-runtime"
|
|
@@ -549,8 +244,8 @@ var WorkerRuntime = class {
|
|
|
549
244
|
return this._clientServices;
|
|
550
245
|
}
|
|
551
246
|
async start() {
|
|
552
|
-
|
|
553
|
-
F:
|
|
247
|
+
log2("starting...", void 0, {
|
|
248
|
+
F: __dxlog_file2,
|
|
554
249
|
L: 71,
|
|
555
250
|
S: this,
|
|
556
251
|
C: (f, a) => f(...a)
|
|
@@ -561,13 +256,13 @@ var WorkerRuntime = class {
|
|
|
561
256
|
const signals = this._config.get("runtime.services.signaling");
|
|
562
257
|
this._clientServices.initialize({
|
|
563
258
|
config: this._config,
|
|
564
|
-
signalManager: signals ? new
|
|
259
|
+
signalManager: signals ? new WebsocketSignalManager(signals, () => this._signalTelemetryEnabled ? this._signalMetadataTags : {}) : new MemorySignalManager(new MemorySignalManagerContext()),
|
|
565
260
|
transportFactory: this._transportFactory
|
|
566
261
|
});
|
|
567
|
-
await this._clientServices.open(new
|
|
262
|
+
await this._clientServices.open(new Context());
|
|
568
263
|
this._ready.wake(void 0);
|
|
569
|
-
|
|
570
|
-
F:
|
|
264
|
+
log2("started", void 0, {
|
|
265
|
+
F: __dxlog_file2,
|
|
571
266
|
L: 86,
|
|
572
267
|
S: this,
|
|
573
268
|
C: (f, a) => f(...a)
|
|
@@ -581,8 +276,8 @@ var WorkerRuntime = class {
|
|
|
581
276
|
});
|
|
582
277
|
} catch (err) {
|
|
583
278
|
this._ready.wake(err);
|
|
584
|
-
|
|
585
|
-
F:
|
|
279
|
+
log2.error("starting", err, {
|
|
280
|
+
F: __dxlog_file2,
|
|
586
281
|
L: 96,
|
|
587
282
|
S: this,
|
|
588
283
|
C: (f, a) => f(...a)
|
|
@@ -615,8 +310,8 @@ var WorkerRuntime = class {
|
|
|
615
310
|
}
|
|
616
311
|
});
|
|
617
312
|
await session.open();
|
|
618
|
-
|
|
619
|
-
F:
|
|
313
|
+
invariant2(!this._signalMetadataTags.origin || this._signalMetadataTags.origin === session.origin, `worker origin changed from ${this._signalMetadataTags.origin} to ${session.origin}?`, {
|
|
314
|
+
F: __dxlog_file2,
|
|
620
315
|
L: 133,
|
|
621
316
|
S: this,
|
|
622
317
|
A: [
|
|
@@ -636,8 +331,8 @@ var WorkerRuntime = class {
|
|
|
636
331
|
* Selects one of the existing session for WebRTC networking.
|
|
637
332
|
*/
|
|
638
333
|
_reconnectWebrtc() {
|
|
639
|
-
|
|
640
|
-
F:
|
|
334
|
+
log2("reconnecting webrtc...", void 0, {
|
|
335
|
+
F: __dxlog_file2,
|
|
641
336
|
L: 151,
|
|
642
337
|
S: this,
|
|
643
338
|
C: (f, a) => f(...a)
|
|
@@ -668,7 +363,6 @@ export {
|
|
|
668
363
|
DevtoolsHostEvents,
|
|
669
364
|
DevtoolsServiceImpl,
|
|
670
365
|
DiagnosticsCollector,
|
|
671
|
-
IFrameHostRuntime,
|
|
672
366
|
Identity,
|
|
673
367
|
IdentityManager,
|
|
674
368
|
IdentityServiceImpl,
|
|
@@ -678,8 +372,6 @@ export {
|
|
|
678
372
|
Lock,
|
|
679
373
|
ServiceContext,
|
|
680
374
|
ServiceRegistry,
|
|
681
|
-
SharedWorkerConnection,
|
|
682
|
-
ShellRuntimeImpl,
|
|
683
375
|
SpaceInvitationProtocol,
|
|
684
376
|
SpacesServiceImpl,
|
|
685
377
|
TrustedKeySetAuthVerifier,
|