@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.
Files changed (67) hide show
  1. package/dist/lib/browser/{chunk-ACQUT3OK.mjs → chunk-5SOW3KZQ.mjs} +1141 -1134
  2. package/dist/lib/browser/chunk-5SOW3KZQ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +55 -363
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +4 -4
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-IBTSMFQY.cjs → chunk-KYH2GPWL.cjs} +1145 -1138
  9. package/dist/lib/node/chunk-KYH2GPWL.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +93 -396
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +10 -10
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/index.d.ts +3 -3
  16. package/dist/types/src/index.d.ts.map +1 -1
  17. package/dist/types/src/packlets/devtools/network.d.ts +4 -4
  18. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  19. package/dist/types/src/packlets/network/network-service.d.ts +2 -2
  20. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-context.d.ts +4 -5
  22. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  24. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
  25. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  26. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  27. package/dist/types/src/packlets/testing/test-builder.d.ts +3 -3
  28. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  29. package/dist/types/src/packlets/worker/index.d.ts +3 -0
  30. package/dist/types/src/packlets/worker/index.d.ts.map +1 -0
  31. package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -0
  32. package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -0
  33. package/dist/types/src/version.d.ts +1 -1
  34. package/package.json +36 -36
  35. package/src/index.ts +3 -3
  36. package/src/packlets/devtools/network.ts +4 -4
  37. package/src/packlets/identity/identity-manager.test.ts +2 -2
  38. package/src/packlets/identity/identity.test.ts +8 -4
  39. package/src/packlets/invitations/invitations-handler.ts +2 -2
  40. package/src/packlets/network/network-service.ts +2 -2
  41. package/src/packlets/services/service-context.ts +3 -3
  42. package/src/packlets/services/service-host.ts +6 -7
  43. package/src/packlets/spaces/data-space.ts +11 -1
  44. package/src/packlets/spaces/spaces-service.ts +1 -0
  45. package/src/packlets/testing/test-builder.ts +4 -4
  46. package/src/packlets/worker/index.ts +6 -0
  47. package/src/version.ts +1 -1
  48. package/dist/lib/browser/chunk-ACQUT3OK.mjs.map +0 -7
  49. package/dist/lib/node/chunk-IBTSMFQY.cjs.map +0 -7
  50. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +0 -37
  51. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +0 -1
  52. package/dist/types/src/packlets/vault/index.d.ts +0 -6
  53. package/dist/types/src/packlets/vault/index.d.ts.map +0 -1
  54. package/dist/types/src/packlets/vault/shared-worker-connection.d.ts +0 -36
  55. package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +0 -1
  56. package/dist/types/src/packlets/vault/shell-runtime.d.ts +0 -33
  57. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +0 -1
  58. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +0 -1
  59. package/dist/types/src/packlets/vault/worker-session.d.ts.map +0 -1
  60. package/src/packlets/vault/iframe-host-runtime.ts +0 -130
  61. package/src/packlets/vault/index.ts +0 -9
  62. package/src/packlets/vault/shared-worker-connection.ts +0 -115
  63. package/src/packlets/vault/shell-runtime.ts +0 -111
  64. /package/dist/types/src/packlets/{vault → worker}/worker-runtime.d.ts +0 -0
  65. /package/dist/types/src/packlets/{vault → worker}/worker-session.d.ts +0 -0
  66. /package/src/packlets/{vault → worker}/worker-runtime.ts +0 -0
  67. /package/src/packlets/{vault → worker}/worker-session.ts +0 -0
@@ -18,173 +18,61 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
- ClientRpcServer: () => import_chunk_IBTSMFQY.ClientRpcServer,
22
- ClientServicesHost: () => import_chunk_IBTSMFQY.ClientServicesHost,
23
- ClientServicesProviderResource: () => import_chunk_IBTSMFQY.ClientServicesProviderResource,
24
- DataSpace: () => import_chunk_IBTSMFQY.DataSpace,
25
- DataSpaceManager: () => import_chunk_IBTSMFQY.DataSpaceManager,
26
- DeviceInvitationProtocol: () => import_chunk_IBTSMFQY.DeviceInvitationProtocol,
27
- DevtoolsHostEvents: () => import_chunk_IBTSMFQY.DevtoolsHostEvents,
28
- DevtoolsServiceImpl: () => import_chunk_IBTSMFQY.DevtoolsServiceImpl,
29
- DiagnosticsCollector: () => import_chunk_IBTSMFQY.DiagnosticsCollector,
30
- IFrameHostRuntime: () => IFrameHostRuntime,
31
- Identity: () => import_chunk_IBTSMFQY.Identity,
32
- IdentityManager: () => import_chunk_IBTSMFQY.IdentityManager,
33
- IdentityServiceImpl: () => import_chunk_IBTSMFQY.IdentityServiceImpl,
34
- InvitationsHandler: () => import_chunk_IBTSMFQY.InvitationsHandler,
35
- InvitationsManager: () => import_chunk_IBTSMFQY.InvitationsManager,
36
- InvitationsServiceImpl: () => import_chunk_IBTSMFQY.InvitationsServiceImpl,
37
- Lock: () => import_chunk_IBTSMFQY.Lock,
38
- ServiceContext: () => import_chunk_IBTSMFQY.ServiceContext,
39
- ServiceRegistry: () => import_chunk_IBTSMFQY.ServiceRegistry,
40
- SharedWorkerConnection: () => SharedWorkerConnection,
41
- ShellRuntimeImpl: () => ShellRuntimeImpl,
42
- SpaceInvitationProtocol: () => import_chunk_IBTSMFQY.SpaceInvitationProtocol,
43
- SpacesServiceImpl: () => import_chunk_IBTSMFQY.SpacesServiceImpl,
44
- TrustedKeySetAuthVerifier: () => import_chunk_IBTSMFQY.TrustedKeySetAuthVerifier,
21
+ ClientRpcServer: () => import_chunk_KYH2GPWL.ClientRpcServer,
22
+ ClientServicesHost: () => import_chunk_KYH2GPWL.ClientServicesHost,
23
+ ClientServicesProviderResource: () => import_chunk_KYH2GPWL.ClientServicesProviderResource,
24
+ DataSpace: () => import_chunk_KYH2GPWL.DataSpace,
25
+ DataSpaceManager: () => import_chunk_KYH2GPWL.DataSpaceManager,
26
+ DeviceInvitationProtocol: () => import_chunk_KYH2GPWL.DeviceInvitationProtocol,
27
+ DevtoolsHostEvents: () => import_chunk_KYH2GPWL.DevtoolsHostEvents,
28
+ DevtoolsServiceImpl: () => import_chunk_KYH2GPWL.DevtoolsServiceImpl,
29
+ DiagnosticsCollector: () => import_chunk_KYH2GPWL.DiagnosticsCollector,
30
+ Identity: () => import_chunk_KYH2GPWL.Identity,
31
+ IdentityManager: () => import_chunk_KYH2GPWL.IdentityManager,
32
+ IdentityServiceImpl: () => import_chunk_KYH2GPWL.IdentityServiceImpl,
33
+ InvitationsHandler: () => import_chunk_KYH2GPWL.InvitationsHandler,
34
+ InvitationsManager: () => import_chunk_KYH2GPWL.InvitationsManager,
35
+ InvitationsServiceImpl: () => import_chunk_KYH2GPWL.InvitationsServiceImpl,
36
+ Lock: () => import_chunk_KYH2GPWL.Lock,
37
+ ServiceContext: () => import_chunk_KYH2GPWL.ServiceContext,
38
+ ServiceRegistry: () => import_chunk_KYH2GPWL.ServiceRegistry,
39
+ SpaceInvitationProtocol: () => import_chunk_KYH2GPWL.SpaceInvitationProtocol,
40
+ SpacesServiceImpl: () => import_chunk_KYH2GPWL.SpacesServiceImpl,
41
+ TrustedKeySetAuthVerifier: () => import_chunk_KYH2GPWL.TrustedKeySetAuthVerifier,
45
42
  WorkerRuntime: () => WorkerRuntime,
46
43
  WorkerSession: () => WorkerSession,
47
- createAdmissionKeypair: () => import_chunk_IBTSMFQY.createAdmissionKeypair,
48
- createAuthProvider: () => import_chunk_IBTSMFQY.createAuthProvider,
49
- createCollectDiagnosticsBroadcastHandler: () => import_chunk_IBTSMFQY.createCollectDiagnosticsBroadcastHandler,
50
- createCollectDiagnosticsBroadcastSender: () => import_chunk_IBTSMFQY.createCollectDiagnosticsBroadcastSender,
51
- createDiagnostics: () => import_chunk_IBTSMFQY.createDiagnostics,
52
- createLevel: () => import_chunk_IBTSMFQY.createLevel,
53
- createStorageObjects: () => import_chunk_IBTSMFQY.createStorageObjects,
54
- findPropertiesObject: () => import_chunk_IBTSMFQY.findPropertiesObject,
55
- getNetworkPeers: () => import_chunk_IBTSMFQY.getNetworkPeers,
56
- isLocked: () => import_chunk_IBTSMFQY.isLocked,
57
- subscribeToFeedBlocks: () => import_chunk_IBTSMFQY.subscribeToFeedBlocks,
58
- subscribeToFeeds: () => import_chunk_IBTSMFQY.subscribeToFeeds,
59
- subscribeToNetworkStatus: () => import_chunk_IBTSMFQY.subscribeToNetworkStatus,
60
- subscribeToNetworkTopics: () => import_chunk_IBTSMFQY.subscribeToNetworkTopics,
61
- subscribeToSignal: () => import_chunk_IBTSMFQY.subscribeToSignal,
62
- subscribeToSpaces: () => import_chunk_IBTSMFQY.subscribeToSpaces,
63
- subscribeToSwarmInfo: () => import_chunk_IBTSMFQY.subscribeToSwarmInfo
44
+ createAdmissionKeypair: () => import_chunk_KYH2GPWL.createAdmissionKeypair,
45
+ createAuthProvider: () => import_chunk_KYH2GPWL.createAuthProvider,
46
+ createCollectDiagnosticsBroadcastHandler: () => import_chunk_KYH2GPWL.createCollectDiagnosticsBroadcastHandler,
47
+ createCollectDiagnosticsBroadcastSender: () => import_chunk_KYH2GPWL.createCollectDiagnosticsBroadcastSender,
48
+ createDiagnostics: () => import_chunk_KYH2GPWL.createDiagnostics,
49
+ createLevel: () => import_chunk_KYH2GPWL.createLevel,
50
+ createStorageObjects: () => import_chunk_KYH2GPWL.createStorageObjects,
51
+ findPropertiesObject: () => import_chunk_KYH2GPWL.findPropertiesObject,
52
+ getNetworkPeers: () => import_chunk_KYH2GPWL.getNetworkPeers,
53
+ isLocked: () => import_chunk_KYH2GPWL.isLocked,
54
+ subscribeToFeedBlocks: () => import_chunk_KYH2GPWL.subscribeToFeedBlocks,
55
+ subscribeToFeeds: () => import_chunk_KYH2GPWL.subscribeToFeeds,
56
+ subscribeToNetworkStatus: () => import_chunk_KYH2GPWL.subscribeToNetworkStatus,
57
+ subscribeToNetworkTopics: () => import_chunk_KYH2GPWL.subscribeToNetworkTopics,
58
+ subscribeToSignal: () => import_chunk_KYH2GPWL.subscribeToSignal,
59
+ subscribeToSpaces: () => import_chunk_KYH2GPWL.subscribeToSpaces,
60
+ subscribeToSwarmInfo: () => import_chunk_KYH2GPWL.subscribeToSwarmInfo
64
61
  });
65
62
  module.exports = __toCommonJS(node_exports);
66
- var import_chunk_IBTSMFQY = require("./chunk-IBTSMFQY.cjs");
63
+ var import_chunk_KYH2GPWL = require("./chunk-KYH2GPWL.cjs");
67
64
  var import_async = require("@dxos/async");
68
- var import_client_protocol = require("@dxos/client-protocol");
69
65
  var import_context = require("@dxos/context");
66
+ var import_invariant = require("@dxos/invariant");
70
67
  var import_log = require("@dxos/log");
71
68
  var import_messaging = require("@dxos/messaging");
72
69
  var import_network_manager = require("@dxos/network-manager");
73
- var import_util = require("@dxos/util");
74
70
  var import_async2 = require("@dxos/async");
75
- var import_client_protocol2 = require("@dxos/client-protocol");
76
- var import_invariant = require("@dxos/invariant");
77
- var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
78
- var import_rpc = require("@dxos/rpc");
79
- var import_async3 = require("@dxos/async");
80
- var import_client_protocol3 = require("@dxos/client-protocol");
81
- var import_log2 = require("@dxos/log");
82
- var import_network_manager2 = require("@dxos/network-manager");
83
- var import_protocols = require("@dxos/protocols");
84
- var import_rpc2 = require("@dxos/rpc");
85
- var import_util2 = require("@dxos/util");
86
- var import_async4 = require("@dxos/async");
87
- var import_context2 = require("@dxos/context");
71
+ var import_client_protocol = require("@dxos/client-protocol");
88
72
  var import_invariant2 = require("@dxos/invariant");
89
- var import_log3 = require("@dxos/log");
90
- var import_messaging2 = require("@dxos/messaging");
91
- var import_network_manager3 = require("@dxos/network-manager");
92
- var import_async5 = require("@dxos/async");
93
- var import_client_protocol4 = require("@dxos/client-protocol");
94
- var import_invariant3 = require("@dxos/invariant");
95
- var import_log4 = require("@dxos/log");
96
- var import_rpc3 = require("@dxos/rpc");
97
- var import_util3 = require("@dxos/util");
98
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
99
- var ShellRuntimeImpl = class {
100
- constructor(_port) {
101
- this._port = _port;
102
- this.layoutUpdate = new import_async2.Event();
103
- this.invitationUrlUpdate = new import_async2.Event();
104
- this._layout = import_iframe.ShellLayout.DEFAULT;
105
- this._invitationUrl = typeof window !== "undefined" ? window.location.origin : void 0;
106
- this._deviceInvitationParam = "deviceInvitationCode";
107
- this._spaceInvitationParam = "spaceInvitationCode";
108
- }
109
- get layout() {
110
- return this._layout;
111
- }
112
- get invitationCode() {
113
- return this._invitationCode;
114
- }
115
- get spaceKey() {
116
- return this._spaceKey;
117
- }
118
- get invitationUrl() {
119
- return this._invitationUrl;
120
- }
121
- get deviceInvitationParam() {
122
- return this._deviceInvitationParam;
123
- }
124
- get spaceInvitationParam() {
125
- return this._spaceInvitationParam;
126
- }
127
- setLayout({ layout, invitationCode, spaceKey }) {
128
- this._layout = layout;
129
- this._invitationCode = invitationCode;
130
- this._spaceKey = spaceKey;
131
- this.layoutUpdate.emit({
132
- layout,
133
- invitationCode,
134
- spaceKey
135
- });
136
- }
137
- setInvitationUrl({ invitationUrl, deviceInvitationParam, spaceInvitationParam }) {
138
- this._invitationUrl = invitationUrl;
139
- this._deviceInvitationParam = deviceInvitationParam;
140
- this._spaceInvitationParam = spaceInvitationParam;
141
- this.invitationUrlUpdate.emit({
142
- invitationUrl,
143
- deviceInvitationParam,
144
- spaceInvitationParam
145
- });
146
- }
147
- async setAppContext(context) {
148
- (0, import_invariant.invariant)(this._appRpc, "runtime not open", {
149
- F: __dxlog_file,
150
- L: 76,
151
- S: this,
152
- A: [
153
- "this._appRpc",
154
- "'runtime not open'"
155
- ]
156
- });
157
- await this._appRpc.rpc.AppService.setContext(context);
158
- }
159
- async open() {
160
- this._appRpc = (0, import_rpc.createProtoRpcPeer)({
161
- requested: import_client_protocol2.appServiceBundle,
162
- exposed: import_client_protocol2.shellServiceBundle,
163
- handlers: {
164
- ShellService: {
165
- setLayout: async (request) => {
166
- this._layout = request.layout;
167
- this._invitationCode = request.invitationCode;
168
- this._spaceKey = request.spaceKey;
169
- this.layoutUpdate.emit(request);
170
- },
171
- setInvitationUrl: async (request) => {
172
- this._invitationUrl = request.invitationUrl;
173
- this._deviceInvitationParam = request.deviceInvitationParam;
174
- this._spaceInvitationParam = request.spaceInvitationParam;
175
- this.invitationUrlUpdate.emit(request);
176
- }
177
- }
178
- },
179
- port: this._port
180
- });
181
- await this._appRpc.open();
182
- }
183
- async close() {
184
- await this._appRpc?.close();
185
- this._appRpc = void 0;
186
- }
187
- };
73
+ var import_log2 = require("@dxos/log");
74
+ var import_rpc = require("@dxos/rpc");
75
+ var import_util = require("@dxos/util");
188
76
  function _ts_decorate(decorators, target, key, desc) {
189
77
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
190
78
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -195,201 +83,13 @@ function _ts_decorate(decorators, target, key, desc) {
195
83
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
196
84
  return c > 3 && r && Object.defineProperty(target, key, r), r;
197
85
  }
198
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
199
- var LOCK_KEY = "DXOS_RESOURCE_LOCK";
200
- var IFrameHostRuntime = class {
201
- constructor({ config, origin, appPort, shellPort }) {
202
- this._ready = new import_async.Trigger();
203
- this._configProvider = config;
204
- this.origin = origin;
205
- this._appPort = appPort;
206
- this._shellPort = shellPort;
207
- if (this._shellPort) {
208
- this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
209
- }
210
- }
211
- get services() {
212
- return this._clientServices;
213
- }
214
- get shell() {
215
- return this._shellRuntime;
216
- }
217
- async start() {
218
- (0, import_log.log)("starting...", void 0, {
219
- F: __dxlog_file2,
220
- L: 73,
221
- S: this,
222
- C: (f, a) => f(...a)
223
- });
224
- try {
225
- this._config = await (0, import_util.getAsyncValue)(this._configProvider);
226
- this._transportFactory = (0, import_network_manager.createSimplePeerTransportFactory)({
227
- iceServers: this._config.get("runtime.services.ice")
228
- });
229
- const signals = this._config.get("runtime.services.signaling");
230
- this._clientServices = new import_chunk_IBTSMFQY.ClientServicesHost({
231
- lockKey: LOCK_KEY,
232
- config: this._config,
233
- signalManager: signals ? new import_messaging.WebsocketSignalManager(signals) : new import_messaging.MemorySignalManager(new import_messaging.MemorySignalManagerContext()),
234
- transportFactory: this._transportFactory
235
- });
236
- const middleware = {
237
- handleCall: async (method, params, handler) => {
238
- const error = await this._ready.wait({
239
- timeout: import_client_protocol.PROXY_CONNECTION_TIMEOUT
240
- });
241
- if (error) {
242
- throw error;
243
- }
244
- return handler(method, params);
245
- },
246
- handleStream: async (method, params, handler) => {
247
- const error = await this._ready.wait({
248
- timeout: import_client_protocol.PROXY_CONNECTION_TIMEOUT
249
- });
250
- if (error) {
251
- throw error;
252
- }
253
- return handler(method, params);
254
- }
255
- };
256
- this._clientRpc = new import_chunk_IBTSMFQY.ClientRpcServer({
257
- serviceRegistry: this._clientServices.serviceRegistry,
258
- port: this._appPort,
259
- ...middleware
260
- });
261
- await Promise.all([
262
- this._clientServices.open(new import_context.Context()),
263
- this._clientRpc.open(),
264
- this._shellRuntime?.open()
265
- ]);
266
- this._ready.wake(void 0);
267
- (0, import_log.log)("started", void 0, {
268
- F: __dxlog_file2,
269
- L: 116,
270
- S: this,
271
- C: (f, a) => f(...a)
272
- });
273
- } catch (err) {
274
- this._ready.wake(err);
275
- import_log.log.catch(err, void 0, {
276
- F: __dxlog_file2,
277
- L: 119,
278
- S: this,
279
- C: (f, a) => f(...a)
280
- });
281
- }
282
- }
283
- async stop() {
284
- (0, import_log.log)("stopping...", void 0, {
285
- F: __dxlog_file2,
286
- L: 124,
287
- S: this,
288
- C: (f, a) => f(...a)
289
- });
290
- await this._clientRpc.close();
291
- await this._clientServices.close();
292
- await this._shellRuntime?.close();
293
- (0, import_log.log)("stopped", void 0, {
294
- F: __dxlog_file2,
295
- L: 128,
296
- S: this,
297
- C: (f, a) => f(...a)
298
- });
299
- }
300
- };
301
- _ts_decorate([
302
- import_log.logInfo
303
- ], IFrameHostRuntime.prototype, "origin", void 0);
304
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shared-worker-connection.ts";
305
- var SharedWorkerConnection = class {
306
- constructor({ config, systemPort, shellPort }) {
307
- this._id = String(Math.floor(Math.random() * 1e6));
308
- this._release = new import_async3.Trigger();
309
- this._configProvider = config;
310
- this._systemPort = systemPort;
311
- this._shellPort = shellPort;
312
- if (this._shellPort) {
313
- this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
314
- }
315
- }
316
- get shell() {
317
- return this._shellRuntime;
318
- }
319
- async open(params) {
320
- this._config = await (0, import_util2.getAsyncValue)(this._configProvider);
321
- this._transportService = new import_network_manager2.SimplePeerTransportService({
322
- iceServers: this._config.get("runtime.services.ice")
323
- });
324
- this._systemRpc = (0, import_rpc2.createProtoRpcPeer)({
325
- requested: import_client_protocol3.workerServiceBundle,
326
- exposed: import_client_protocol3.iframeServiceBundle,
327
- handlers: {
328
- BridgeService: this._transportService
329
- },
330
- port: this._systemPort,
331
- // TODO(wittjosiah): Make longer and factor out to constant.
332
- // TODO(wittjosiah): If this is too long then it breaks the reset flows in Composer.
333
- timeout: 200
334
- });
335
- let lockKey;
336
- if (typeof navigator !== "undefined") {
337
- lockKey = this._lockKey(params.origin);
338
- this._release = new import_async3.Trigger();
339
- const ready = new import_async3.Trigger();
340
- void navigator.locks.request(lockKey, async () => {
341
- ready.wake();
342
- await this._release.wait();
343
- });
344
- await ready.wait();
345
- }
346
- try {
347
- await this._systemRpc.open();
348
- await this._systemRpc.rpc.WorkerService.start({
349
- lockKey,
350
- ...params
351
- });
352
- } catch (err) {
353
- import_log2.log.catch(err, void 0, {
354
- F: __dxlog_file3,
355
- L: 95,
356
- S: this,
357
- C: (f, a) => f(...a)
358
- });
359
- throw new import_protocols.RemoteServiceConnectionError("Failed to connect to worker");
360
- }
361
- await this._shellRuntime?.open();
362
- }
363
- async close() {
364
- this._release.wake();
365
- await this._shellRuntime?.close();
366
- try {
367
- await this._systemRpc.rpc.WorkerService.stop();
368
- } catch {
369
- }
370
- await this._systemRpc.close();
371
- }
372
- _lockKey(origin) {
373
- return `${origin}-${this._id}`;
374
- }
375
- };
376
- function _ts_decorate2(decorators, target, key, desc) {
377
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
378
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
379
- r = Reflect.decorate(decorators, target, key, desc);
380
- else
381
- for (var i = decorators.length - 1; i >= 0; i--)
382
- if (d = decorators[i])
383
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
384
- return c > 3 && r && Object.defineProperty(target, key, r), r;
385
- }
386
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
86
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/worker/worker-session.ts";
387
87
  var WorkerSession = class {
388
88
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
389
- this._startTrigger = new import_async5.Trigger();
390
- this.onClose = new import_util3.Callback();
391
- (0, import_invariant3.invariant)(serviceHost, void 0, {
392
- F: __dxlog_file4,
89
+ this._startTrigger = new import_async2.Trigger();
90
+ this.onClose = new import_util.Callback();
91
+ (0, import_invariant2.invariant)(serviceHost, void 0, {
92
+ F: __dxlog_file,
393
93
  L: 54,
394
94
  S: this,
395
95
  A: [
@@ -401,7 +101,7 @@ var WorkerSession = class {
401
101
  const middleware = {
402
102
  handleCall: async (method, params, handler) => {
403
103
  const error = await readySignal.wait({
404
- timeout: import_client_protocol4.PROXY_CONNECTION_TIMEOUT
104
+ timeout: import_client_protocol.PROXY_CONNECTION_TIMEOUT
405
105
  });
406
106
  if (error) {
407
107
  throw error;
@@ -410,7 +110,7 @@ var WorkerSession = class {
410
110
  },
411
111
  handleStream: async (method, params, handler) => {
412
112
  const error = await readySignal.wait({
413
- timeout: import_client_protocol4.PROXY_CONNECTION_TIMEOUT
113
+ timeout: import_client_protocol.PROXY_CONNECTION_TIMEOUT
414
114
  });
415
115
  if (error) {
416
116
  throw error;
@@ -418,19 +118,19 @@ var WorkerSession = class {
418
118
  return handler(method, params);
419
119
  }
420
120
  };
421
- this._clientRpc = new import_chunk_IBTSMFQY.ClientRpcServer({
121
+ this._clientRpc = new import_chunk_KYH2GPWL.ClientRpcServer({
422
122
  serviceRegistry: this._serviceHost.serviceRegistry,
423
123
  port: appPort,
424
124
  ...middleware
425
125
  });
426
- this._shellClientRpc = shellPort ? new import_chunk_IBTSMFQY.ClientRpcServer({
126
+ this._shellClientRpc = shellPort ? new import_chunk_KYH2GPWL.ClientRpcServer({
427
127
  serviceRegistry: this._serviceHost.serviceRegistry,
428
128
  port: shellPort,
429
129
  ...middleware
430
130
  }) : void 0;
431
- this._iframeRpc = (0, import_rpc3.createProtoRpcPeer)({
432
- requested: import_client_protocol4.iframeServiceBundle,
433
- exposed: import_client_protocol4.workerServiceBundle,
131
+ this._iframeRpc = (0, import_rpc.createProtoRpcPeer)({
132
+ requested: import_client_protocol.iframeServiceBundle,
133
+ exposed: import_client_protocol.workerServiceBundle,
434
134
  handlers: {
435
135
  WorkerService: {
436
136
  start: async (request) => {
@@ -445,8 +145,8 @@ var WorkerSession = class {
445
145
  try {
446
146
  await this.close();
447
147
  } catch (err) {
448
- import_log4.log.catch(err, void 0, {
449
- F: __dxlog_file4,
148
+ import_log2.log.catch(err, void 0, {
149
+ F: __dxlog_file,
450
150
  L: 108,
451
151
  S: this,
452
152
  C: (f, a) => f(...a)
@@ -462,8 +162,8 @@ var WorkerSession = class {
462
162
  this.bridgeService = this._iframeRpc.rpc.BridgeService;
463
163
  }
464
164
  async open() {
465
- import_log4.log.info("opening...", void 0, {
466
- F: __dxlog_file4,
165
+ import_log2.log.info("opening...", void 0, {
166
+ F: __dxlog_file,
467
167
  L: 122,
468
168
  S: this,
469
169
  C: (f, a) => f(...a)
@@ -474,21 +174,21 @@ var WorkerSession = class {
474
174
  this._maybeOpenShell()
475
175
  ]);
476
176
  await this._startTrigger.wait({
477
- timeout: import_client_protocol4.PROXY_CONNECTION_TIMEOUT
177
+ timeout: import_client_protocol.PROXY_CONNECTION_TIMEOUT
478
178
  });
479
179
  if (this.lockKey) {
480
180
  void this._afterLockReleases(this.lockKey, () => this.close());
481
181
  }
482
- import_log4.log.info("opened", void 0, {
483
- F: __dxlog_file4,
182
+ import_log2.log.info("opened", void 0, {
183
+ F: __dxlog_file,
484
184
  L: 133,
485
185
  S: this,
486
186
  C: (f, a) => f(...a)
487
187
  });
488
188
  }
489
189
  async close() {
490
- import_log4.log.info("closing...", void 0, {
491
- F: __dxlog_file4,
190
+ import_log2.log.info("closing...", void 0, {
191
+ F: __dxlog_file,
492
192
  L: 137,
493
193
  S: this,
494
194
  C: (f, a) => f(...a)
@@ -496,8 +196,8 @@ var WorkerSession = class {
496
196
  try {
497
197
  await this.onClose.callIfSet();
498
198
  } catch (err) {
499
- import_log4.log.catch(err, void 0, {
500
- F: __dxlog_file4,
199
+ import_log2.log.catch(err, void 0, {
200
+ F: __dxlog_file,
501
201
  L: 141,
502
202
  S: this,
503
203
  C: (f, a) => f(...a)
@@ -507,8 +207,8 @@ var WorkerSession = class {
507
207
  this._clientRpc.close(),
508
208
  this._iframeRpc.close()
509
209
  ]);
510
- import_log4.log.info("closed", void 0, {
511
- F: __dxlog_file4,
210
+ import_log2.log.info("closed", void 0, {
211
+ F: __dxlog_file,
512
212
  L: 145,
513
213
  S: this,
514
214
  C: (f, a) => f(...a)
@@ -516,10 +216,10 @@ var WorkerSession = class {
516
216
  }
517
217
  async _maybeOpenShell() {
518
218
  try {
519
- this._shellClientRpc && await (0, import_async5.asyncTimeout)(this._shellClientRpc.open(), 1e3);
219
+ this._shellClientRpc && await (0, import_async2.asyncTimeout)(this._shellClientRpc.open(), 1e3);
520
220
  } catch {
521
- import_log4.log.info("No shell connected.", void 0, {
522
- F: __dxlog_file4,
221
+ import_log2.log.info("No shell connected.", void 0, {
222
+ F: __dxlog_file,
523
223
  L: 152,
524
224
  S: this,
525
225
  C: (f, a) => f(...a)
@@ -531,18 +231,18 @@ var WorkerSession = class {
531
231
  }).then(callback);
532
232
  }
533
233
  };
534
- _ts_decorate2([
535
- import_log4.logInfo
234
+ _ts_decorate([
235
+ import_log2.logInfo
536
236
  ], WorkerSession.prototype, "origin", void 0);
537
- _ts_decorate2([
538
- import_log4.logInfo
237
+ _ts_decorate([
238
+ import_log2.logInfo
539
239
  ], WorkerSession.prototype, "lockKey", void 0);
540
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
240
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/worker/worker-runtime.ts";
541
241
  var WorkerRuntime = class {
542
242
  constructor(_configProvider, { acquireLock, releaseLock, onReset }) {
543
243
  this._configProvider = _configProvider;
544
- this._transportFactory = new import_network_manager3.SimplePeerTransportProxyFactory();
545
- this._ready = new import_async4.Trigger();
244
+ this._transportFactory = new import_network_manager.SimplePeerTransportProxyFactory();
245
+ this._ready = new import_async.Trigger();
546
246
  this._sessions = /* @__PURE__ */ new Set();
547
247
  this._signalMetadataTags = {
548
248
  runtime: "worker-runtime"
@@ -550,7 +250,7 @@ var WorkerRuntime = class {
550
250
  this._signalTelemetryEnabled = false;
551
251
  this._acquireLock = acquireLock;
552
252
  this._releaseLock = releaseLock;
553
- this._clientServices = new import_chunk_IBTSMFQY.ClientServicesHost({
253
+ this._clientServices = new import_chunk_KYH2GPWL.ClientServicesHost({
554
254
  callbacks: {
555
255
  onReset: async () => onReset()
556
256
  }
@@ -560,8 +260,8 @@ var WorkerRuntime = class {
560
260
  return this._clientServices;
561
261
  }
562
262
  async start() {
563
- (0, import_log3.log)("starting...", void 0, {
564
- F: __dxlog_file5,
263
+ (0, import_log.log)("starting...", void 0, {
264
+ F: __dxlog_file2,
565
265
  L: 71,
566
266
  S: this,
567
267
  C: (f, a) => f(...a)
@@ -572,18 +272,18 @@ var WorkerRuntime = class {
572
272
  const signals = this._config.get("runtime.services.signaling");
573
273
  this._clientServices.initialize({
574
274
  config: this._config,
575
- signalManager: signals ? new import_messaging2.WebsocketSignalManager(signals, () => this._signalTelemetryEnabled ? this._signalMetadataTags : {}) : new import_messaging2.MemorySignalManager(new import_messaging2.MemorySignalManagerContext()),
275
+ signalManager: signals ? new import_messaging.WebsocketSignalManager(signals, () => this._signalTelemetryEnabled ? this._signalMetadataTags : {}) : new import_messaging.MemorySignalManager(new import_messaging.MemorySignalManagerContext()),
576
276
  transportFactory: this._transportFactory
577
277
  });
578
- await this._clientServices.open(new import_context2.Context());
278
+ await this._clientServices.open(new import_context.Context());
579
279
  this._ready.wake(void 0);
580
- (0, import_log3.log)("started", void 0, {
581
- F: __dxlog_file5,
280
+ (0, import_log.log)("started", void 0, {
281
+ F: __dxlog_file2,
582
282
  L: 86,
583
283
  S: this,
584
284
  C: (f, a) => f(...a)
585
285
  });
586
- (0, import_messaging2.setIdentityTags)({
286
+ (0, import_messaging.setIdentityTags)({
587
287
  identityService: this._clientServices.services.IdentityService,
588
288
  devicesService: this._clientServices.services.DevicesService,
589
289
  setTag: (k, v) => {
@@ -592,8 +292,8 @@ var WorkerRuntime = class {
592
292
  });
593
293
  } catch (err) {
594
294
  this._ready.wake(err);
595
- import_log3.log.error("starting", err, {
596
- F: __dxlog_file5,
295
+ import_log.log.error("starting", err, {
296
+ F: __dxlog_file2,
597
297
  L: 96,
598
298
  S: this,
599
299
  C: (f, a) => f(...a)
@@ -626,8 +326,8 @@ var WorkerRuntime = class {
626
326
  }
627
327
  });
628
328
  await session.open();
629
- (0, import_invariant2.invariant)(!this._signalMetadataTags.origin || this._signalMetadataTags.origin === session.origin, `worker origin changed from ${this._signalMetadataTags.origin} to ${session.origin}?`, {
630
- F: __dxlog_file5,
329
+ (0, import_invariant.invariant)(!this._signalMetadataTags.origin || this._signalMetadataTags.origin === session.origin, `worker origin changed from ${this._signalMetadataTags.origin} to ${session.origin}?`, {
330
+ F: __dxlog_file2,
631
331
  L: 133,
632
332
  S: this,
633
333
  A: [
@@ -647,8 +347,8 @@ var WorkerRuntime = class {
647
347
  * Selects one of the existing session for WebRTC networking.
648
348
  */
649
349
  _reconnectWebrtc() {
650
- (0, import_log3.log)("reconnecting webrtc...", void 0, {
651
- F: __dxlog_file5,
350
+ (0, import_log.log)("reconnecting webrtc...", void 0, {
351
+ F: __dxlog_file2,
652
352
  L: 151,
653
353
  S: this,
654
354
  C: (f, a) => f(...a)
@@ -680,7 +380,6 @@ var WorkerRuntime = class {
680
380
  DevtoolsHostEvents,
681
381
  DevtoolsServiceImpl,
682
382
  DiagnosticsCollector,
683
- IFrameHostRuntime,
684
383
  Identity,
685
384
  IdentityManager,
686
385
  IdentityServiceImpl,
@@ -690,8 +389,6 @@ var WorkerRuntime = class {
690
389
  Lock,
691
390
  ServiceContext,
692
391
  ServiceRegistry,
693
- SharedWorkerConnection,
694
- ShellRuntimeImpl,
695
392
  SpaceInvitationProtocol,
696
393
  SpacesServiceImpl,
697
394
  TrustedKeySetAuthVerifier,