@dxos/client-services 0.3.11-main.c95bc86 → 0.3.11-main.cb5abf5

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 (30) hide show
  1. package/dist/lib/browser/{chunk-4ZZIUZXZ.mjs → chunk-ESWBGQCJ.mjs} +65 -34
  2. package/dist/lib/browser/chunk-ESWBGQCJ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-KA7FPK35.cjs → chunk-Q7FPBLIU.cjs} +125 -94
  7. package/dist/lib/node/chunk-Q7FPBLIU.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +37 -37
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +8 -8
  11. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  12. package/dist/types/src/packlets/services/diagnostics.d.ts +32 -20
  13. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  14. package/dist/types/src/packlets/services/platform.d.ts +1 -14
  15. package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
  16. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
  17. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  18. package/dist/types/src/packlets/system/system-service.d.ts +3 -2
  19. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  20. package/dist/types/src/version.d.ts +1 -1
  21. package/package.json +35 -35
  22. package/src/packlets/network/network-service.ts +5 -1
  23. package/src/packlets/services/diagnostics.ts +35 -17
  24. package/src/packlets/services/platform.ts +7 -19
  25. package/src/packlets/spaces/data-space.ts +18 -5
  26. package/src/packlets/spaces/spaces-service.ts +2 -2
  27. package/src/packlets/system/system-service.ts +7 -1
  28. package/src/version.ts +1 -1
  29. package/dist/lib/browser/chunk-4ZZIUZXZ.mjs.map +0 -7
  30. package/dist/lib/node/chunk-KA7FPK35.cjs.map +0 -7
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_KA7FPK35_exports = {};
30
- __export(chunk_KA7FPK35_exports, {
29
+ var chunk_Q7FPBLIU_exports = {};
30
+ __export(chunk_Q7FPBLIU_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_KA7FPK35_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_KA7FPK35_exports);
63
+ module.exports = __toCommonJS(chunk_Q7FPBLIU_exports);
64
64
  var import_async = require("@dxos/async");
65
65
  var import_codec_protobuf = require("@dxos/codec-protobuf");
66
66
  var import_feed_store = require("@dxos/feed-store");
@@ -153,6 +153,8 @@ var import_invariant9 = require("@dxos/invariant");
153
153
  var import_log8 = require("@dxos/log");
154
154
  var import_protocols7 = require("@dxos/protocols");
155
155
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
156
+ var import_tracing4 = require("@dxos/tracing");
157
+ var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
156
158
  var import_async10 = require("@dxos/async");
157
159
  var import_client_protocol3 = require("@dxos/client-protocol");
158
160
  var import_context6 = require("@dxos/context");
@@ -162,10 +164,10 @@ var import_invariant10 = require("@dxos/invariant");
162
164
  var import_keys7 = require("@dxos/keys");
163
165
  var import_log9 = require("@dxos/log");
164
166
  var import_protocols8 = require("@dxos/protocols");
165
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
167
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
166
168
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
167
169
  var import_timeframe2 = require("@dxos/timeframe");
168
- var import_tracing4 = require("@dxos/tracing");
170
+ var import_tracing5 = require("@dxos/tracing");
169
171
  var import_util4 = require("@dxos/util");
170
172
  var import_credentials11 = require("@dxos/credentials");
171
173
  var import_async11 = require("@dxos/async");
@@ -183,7 +185,7 @@ var import_invariant12 = require("@dxos/invariant");
183
185
  var import_keys9 = require("@dxos/keys");
184
186
  var import_log11 = require("@dxos/log");
185
187
  var import_protocols10 = require("@dxos/protocols");
186
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
188
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
187
189
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
188
190
  var import_util6 = require("@dxos/util");
189
191
  var import_credentials13 = require("@dxos/credentials");
@@ -196,7 +198,7 @@ var import_debug6 = require("@dxos/debug");
196
198
  var import_invariant13 = require("@dxos/invariant");
197
199
  var import_log12 = require("@dxos/log");
198
200
  var import_protocols11 = require("@dxos/protocols");
199
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
201
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
200
202
  var import_async14 = require("@dxos/async");
201
203
  var import_context9 = require("@dxos/context");
202
204
  var import_credentials15 = require("@dxos/credentials");
@@ -208,9 +210,9 @@ var import_keyring = require("@dxos/keyring");
208
210
  var import_keys10 = require("@dxos/keys");
209
211
  var import_log13 = require("@dxos/log");
210
212
  var import_protocols12 = require("@dxos/protocols");
211
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
213
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
212
214
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
213
- var import_tracing5 = require("@dxos/tracing");
215
+ var import_tracing6 = require("@dxos/tracing");
214
216
  var import_util7 = require("@dxos/util");
215
217
  var import_invariant15 = require("@dxos/invariant");
216
218
  var import_lock_file = require("@dxos/lock-file");
@@ -233,21 +235,21 @@ var import_messaging = require("@dxos/messaging");
233
235
  var import_model_factory = require("@dxos/model-factory");
234
236
  var import_network_manager2 = require("@dxos/network-manager");
235
237
  var import_protocols14 = require("@dxos/protocols");
236
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
238
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
237
239
  var import_text_model = require("@dxos/text-model");
238
- var import_tracing6 = require("@dxos/tracing");
240
+ var import_tracing7 = require("@dxos/tracing");
239
241
  var import_websocket_rpc = require("@dxos/websocket-rpc");
240
242
  var import_async16 = require("@dxos/async");
241
243
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
242
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
244
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
243
245
  var import_async17 = require("@dxos/async");
244
246
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
245
247
  var import_log16 = require("@dxos/log");
246
- var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
248
+ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
247
249
  var import_util9 = require("@dxos/util");
248
250
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
249
251
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
250
- var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
252
+ var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
251
253
  var import_util10 = require("@dxos/util");
252
254
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
253
255
  return new import_codec_protobuf.Stream(({ next }) => {
@@ -2651,28 +2653,29 @@ var getPlatform = () => {
2651
2653
  if (typeof window !== "undefined") {
2652
2654
  const { userAgent } = window.navigator;
2653
2655
  return {
2654
- type: "browser",
2656
+ type: import_services7.Platform.PLATFORM_TYPE.BROWSER,
2655
2657
  userAgent,
2656
2658
  uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
2657
2659
  };
2658
2660
  } else {
2659
2661
  return {
2660
- type: "shared-worker",
2662
+ type: import_services7.Platform.PLATFORM_TYPE.SHARED_WORKER,
2661
2663
  uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
2662
2664
  };
2663
2665
  }
2664
2666
  } else {
2665
2667
  const { platform: platform2, version, arch } = process;
2666
2668
  return {
2667
- type: "node",
2668
- platform: `${platform2} ${version} ${arch}`,
2669
- runtime: process.version,
2669
+ type: import_services7.Platform.PLATFORM_TYPE.NODE,
2670
+ platform: platform2,
2671
+ arch,
2672
+ runtime: version,
2670
2673
  uptime: Math.floor(process.uptime()),
2671
2674
  memory: process.memoryUsage()
2672
2675
  };
2673
2676
  }
2674
2677
  };
2675
- var DXOS_VERSION = "0.3.11-main.c95bc86";
2678
+ var DXOS_VERSION = "0.3.11-main.cb5abf5";
2676
2679
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2677
2680
  var DEFAULT_TIMEOUT = 1e3;
2678
2681
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -2684,12 +2687,13 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2684
2687
  storage: {
2685
2688
  version: import_protocols7.STORAGE_VERSION
2686
2689
  }
2687
- }
2690
+ },
2691
+ trace: import_tracing4.TRACE_PROCESSOR.getDiagnostics()
2688
2692
  };
2689
2693
  {
2690
2694
  (0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
2691
2695
  F: __dxlog_file10,
2692
- L: 93,
2696
+ L: 111,
2693
2697
  S: void 0,
2694
2698
  A: [
2695
2699
  "clientServices.LoggingService",
@@ -2755,7 +2759,7 @@ var getProperties = (space) => {
2755
2759
  } catch (err) {
2756
2760
  import_log8.log.warn(err.message, void 0, {
2757
2761
  F: __dxlog_file10,
2758
- L: 178,
2762
+ L: 196,
2759
2763
  S: void 0,
2760
2764
  C: (f, a) => f(...a)
2761
2765
  });
@@ -3102,7 +3106,7 @@ var DataSpace = class {
3102
3106
  this._notarizationPlugin = new NotarizationPlugin();
3103
3107
  this._cache = void 0;
3104
3108
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
3105
- this._state = import_services7.SpaceState.CLOSED;
3109
+ this._state = import_services8.SpaceState.CLOSED;
3106
3110
  this.error = void 0;
3107
3111
  this.stateUpdate = new import_async10.Event();
3108
3112
  this.metrics = {};
@@ -3124,10 +3128,10 @@ var DataSpace = class {
3124
3128
  this._cache = params.cache;
3125
3129
  this._state = params.initialState;
3126
3130
  (0, import_log9.log)("new state", {
3127
- state: import_services7.SpaceState[this._state]
3131
+ state: import_services8.SpaceState[this._state]
3128
3132
  }, {
3129
3133
  F: __dxlog_file12,
3130
- L: 138,
3134
+ L: 141,
3131
3135
  S: this,
3132
3136
  C: (f, a) => f(...a)
3133
3137
  });
@@ -3160,6 +3164,12 @@ var DataSpace = class {
3160
3164
  get automergeSpaceState() {
3161
3165
  return this._automergeSpaceState;
3162
3166
  }
3167
+ get _automergeInfo() {
3168
+ return {
3169
+ rootUrl: this._automergeSpaceState.rootUrl,
3170
+ lastEpoch: this._automergeSpaceState.lastEpoch
3171
+ };
3172
+ }
3163
3173
  async open() {
3164
3174
  await this._open();
3165
3175
  }
@@ -3169,12 +3179,12 @@ var DataSpace = class {
3169
3179
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3170
3180
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
3171
3181
  await this._inner.open(new import_context6.Context());
3172
- this._state = import_services7.SpaceState.CONTROL_ONLY;
3182
+ this._state = import_services8.SpaceState.CONTROL_ONLY;
3173
3183
  (0, import_log9.log)("new state", {
3174
- state: import_services7.SpaceState[this._state]
3184
+ state: import_services8.SpaceState[this._state]
3175
3185
  }, {
3176
3186
  F: __dxlog_file12,
3177
- L: 190,
3187
+ L: 203,
3178
3188
  S: this,
3179
3189
  C: (f, a) => f(...a)
3180
3190
  });
@@ -3187,12 +3197,12 @@ var DataSpace = class {
3187
3197
  }
3188
3198
  async _close() {
3189
3199
  await this._callbacks.beforeClose?.();
3190
- this._state = import_services7.SpaceState.CLOSED;
3200
+ this._state = import_services8.SpaceState.CLOSED;
3191
3201
  (0, import_log9.log)("new state", {
3192
- state: import_services7.SpaceState[this._state]
3202
+ state: import_services8.SpaceState[this._state]
3193
3203
  }, {
3194
3204
  F: __dxlog_file12,
3195
- L: 204,
3205
+ L: 217,
3196
3206
  S: this,
3197
3207
  C: (f, a) => f(...a)
3198
3208
  });
@@ -3221,10 +3231,10 @@ var DataSpace = class {
3221
3231
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3222
3232
  await this.initializeDataPipeline();
3223
3233
  } catch (err) {
3224
- if (err instanceof import_protocols8.CancelledError) {
3234
+ if (err instanceof import_protocols8.CancelledError || err instanceof import_context6.ContextDisposedError) {
3225
3235
  (0, import_log9.log)("data pipeline initialization cancelled", err, {
3226
3236
  F: __dxlog_file12,
3227
- L: 237,
3237
+ L: 250,
3228
3238
  S: this,
3229
3239
  C: (f, a) => f(...a)
3230
3240
  });
@@ -3232,16 +3242,16 @@ var DataSpace = class {
3232
3242
  }
3233
3243
  import_log9.log.error("Error initializing data pipeline", err, {
3234
3244
  F: __dxlog_file12,
3235
- L: 241,
3245
+ L: 254,
3236
3246
  S: this,
3237
3247
  C: (f, a) => f(...a)
3238
3248
  });
3239
- this._state = import_services7.SpaceState.ERROR;
3249
+ this._state = import_services8.SpaceState.ERROR;
3240
3250
  (0, import_log9.log)("new state", {
3241
- state: import_services7.SpaceState[this._state]
3251
+ state: import_services8.SpaceState[this._state]
3242
3252
  }, {
3243
3253
  F: __dxlog_file12,
3244
- L: 243,
3254
+ L: 256,
3245
3255
  S: this,
3246
3256
  C: (f, a) => f(...a)
3247
3257
  });
@@ -3253,15 +3263,15 @@ var DataSpace = class {
3253
3263
  });
3254
3264
  }
3255
3265
  async initializeDataPipeline() {
3256
- if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
3266
+ if (this._state !== import_services8.SpaceState.CONTROL_ONLY) {
3257
3267
  throw new import_protocols8.SystemError("Invalid operation");
3258
3268
  }
3259
- this._state = import_services7.SpaceState.INITIALIZING;
3269
+ this._state = import_services8.SpaceState.INITIALIZING;
3260
3270
  (0, import_log9.log)("new state", {
3261
- state: import_services7.SpaceState[this._state]
3271
+ state: import_services8.SpaceState[this._state]
3262
3272
  }, {
3263
3273
  F: __dxlog_file12,
3264
- L: 259,
3274
+ L: 272,
3265
3275
  S: this,
3266
3276
  C: (f, a) => f(...a)
3267
3277
  });
@@ -3272,7 +3282,7 @@ var DataSpace = class {
3272
3282
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3273
3283
  (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
3274
3284
  F: __dxlog_file12,
3275
- L: 273,
3285
+ L: 286,
3276
3286
  S: this,
3277
3287
  C: (f, a) => f(...a)
3278
3288
  });
@@ -3283,17 +3293,17 @@ var DataSpace = class {
3283
3293
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3284
3294
  (0, import_log9.log)("data pipeline ready", void 0, {
3285
3295
  F: __dxlog_file12,
3286
- L: 282,
3296
+ L: 295,
3287
3297
  S: this,
3288
3298
  C: (f, a) => f(...a)
3289
3299
  });
3290
3300
  await this._callbacks.beforeReady?.();
3291
- this._state = import_services7.SpaceState.READY;
3301
+ this._state = import_services8.SpaceState.READY;
3292
3302
  (0, import_log9.log)("new state", {
3293
- state: import_services7.SpaceState[this._state]
3303
+ state: import_services8.SpaceState[this._state]
3294
3304
  }, {
3295
3305
  F: __dxlog_file12,
3296
- L: 286,
3306
+ L: 299,
3297
3307
  S: this,
3298
3308
  C: (f, a) => f(...a)
3299
3309
  });
@@ -3309,7 +3319,7 @@ var DataSpace = class {
3309
3319
  await this._createWritableFeeds();
3310
3320
  (0, import_log9.log)("writable feeds created", void 0, {
3311
3321
  F: __dxlog_file12,
3312
- L: 302,
3322
+ L: 315,
3313
3323
  S: this,
3314
3324
  C: (f, a) => f(...a)
3315
3325
  });
@@ -3367,19 +3377,19 @@ var DataSpace = class {
3367
3377
  }
3368
3378
  }
3369
3379
  _onNewAutomergeRoot(rootUrl) {
3370
- import_log9.log.info("loading automerge root doc for space", {
3380
+ (0, import_log9.log)("loading automerge root doc for space", {
3371
3381
  space: this.key,
3372
3382
  rootUrl
3373
3383
  }, {
3374
3384
  F: __dxlog_file12,
3375
- L: 368,
3385
+ L: 381,
3376
3386
  S: this,
3377
3387
  C: (f, a) => f(...a)
3378
3388
  });
3379
3389
  const handle = this._automergeHost.repo.find(rootUrl);
3380
3390
  queueMicrotask(async () => {
3381
3391
  try {
3382
- await handle.whenReady();
3392
+ await (0, import_async10.asyncTimeout)(handle.whenReady(), 5e3);
3383
3393
  const doc = handle.docSync() ?? (0, import_invariant10.failedInvariant)();
3384
3394
  if (!doc.experimental_spaceKey) {
3385
3395
  handle.change((doc2) => {
@@ -3393,7 +3403,7 @@ var DataSpace = class {
3393
3403
  err
3394
3404
  }, {
3395
3405
  F: __dxlog_file12,
3396
- L: 381,
3406
+ L: 394,
3397
3407
  S: this,
3398
3408
  C: (f, a) => f(...a)
3399
3409
  });
@@ -3419,12 +3429,12 @@ var DataSpace = class {
3419
3429
  let epoch;
3420
3430
  switch (options?.migration) {
3421
3431
  case void 0:
3422
- case import_services7.CreateEpochRequest.Migration.NONE:
3432
+ case import_services8.CreateEpochRequest.Migration.NONE:
3423
3433
  {
3424
3434
  epoch = await this.dataPipeline.createEpoch();
3425
3435
  }
3426
3436
  break;
3427
- case import_services7.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3437
+ case import_services8.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3428
3438
  const document = this._automergeHost.repo.create();
3429
3439
  epoch = {
3430
3440
  previousId: this._automergeSpaceState.lastEpoch?.id,
@@ -3465,31 +3475,47 @@ var DataSpace = class {
3465
3475
  }
3466
3476
  }
3467
3477
  async activate() {
3468
- if (this._state !== import_services7.SpaceState.INACTIVE) {
3478
+ if (this._state !== import_services8.SpaceState.INACTIVE) {
3469
3479
  return;
3470
3480
  }
3471
- await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.ACTIVE);
3481
+ await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.ACTIVE);
3472
3482
  await this._open();
3473
3483
  this.initializeDataPipelineAsync();
3474
3484
  }
3475
3485
  async deactivate() {
3476
- if (this._state === import_services7.SpaceState.INACTIVE) {
3486
+ if (this._state === import_services8.SpaceState.INACTIVE) {
3477
3487
  return;
3478
3488
  }
3479
- await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
3489
+ await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.INACTIVE);
3480
3490
  await this._close();
3481
- this._state = import_services7.SpaceState.INACTIVE;
3491
+ this._state = import_services8.SpaceState.INACTIVE;
3482
3492
  (0, import_log9.log)("new state", {
3483
- state: import_services7.SpaceState[this._state]
3493
+ state: import_services8.SpaceState[this._state]
3484
3494
  }, {
3485
3495
  F: __dxlog_file12,
3486
- L: 470,
3496
+ L: 483,
3487
3497
  S: this,
3488
3498
  C: (f, a) => f(...a)
3489
3499
  });
3490
3500
  this.stateUpdate.emit();
3491
3501
  }
3492
3502
  };
3503
+ _ts_decorate4([
3504
+ import_tracing5.trace.info()
3505
+ ], DataSpace.prototype, "_inner", void 0);
3506
+ _ts_decorate4([
3507
+ import_tracing5.trace.info()
3508
+ ], DataSpace.prototype, "key", null);
3509
+ _ts_decorate4([
3510
+ import_tracing5.trace.info({
3511
+ enum: import_services8.SpaceState
3512
+ })
3513
+ ], DataSpace.prototype, "state", null);
3514
+ _ts_decorate4([
3515
+ import_tracing5.trace.info({
3516
+ depth: null
3517
+ })
3518
+ ], DataSpace.prototype, "_automergeInfo", null);
3493
3519
  _ts_decorate4([
3494
3520
  import_async10.synchronized
3495
3521
  ], DataSpace.prototype, "open", null);
@@ -3497,12 +3523,12 @@ _ts_decorate4([
3497
3523
  import_async10.synchronized
3498
3524
  ], DataSpace.prototype, "close", null);
3499
3525
  _ts_decorate4([
3500
- import_tracing4.trace.span({
3526
+ import_tracing5.trace.span({
3501
3527
  showInBrowserTimeline: true
3502
3528
  })
3503
3529
  ], DataSpace.prototype, "initializeDataPipeline", null);
3504
3530
  _ts_decorate4([
3505
- import_tracing4.trace.span({
3531
+ import_tracing5.trace.span({
3506
3532
  showInBrowserTimeline: true
3507
3533
  })
3508
3534
  ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
@@ -3516,7 +3542,8 @@ _ts_decorate4([
3516
3542
  import_async10.synchronized
3517
3543
  ], DataSpace.prototype, "deactivate", null);
3518
3544
  DataSpace = _ts_decorate4([
3519
- (0, import_async10.trackLeaks)("open", "close")
3545
+ (0, import_async10.trackLeaks)("open", "close"),
3546
+ import_tracing5.trace.resource()
3520
3547
  ], DataSpace);
3521
3548
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3522
3549
  const credentials = [
@@ -3663,7 +3690,7 @@ var DataSpaceManager = class {
3663
3690
  this._isOpen = true;
3664
3691
  this.updated.emit();
3665
3692
  for (const space of this._spaces.values()) {
3666
- if (space.state !== import_services8.SpaceState.INACTIVE) {
3693
+ if (space.state !== import_services9.SpaceState.INACTIVE) {
3667
3694
  space.initializeDataPipelineAsync();
3668
3695
  }
3669
3696
  }
@@ -3710,7 +3737,7 @@ var DataSpaceManager = class {
3710
3737
  genesisFeedKey: controlFeedKey,
3711
3738
  controlFeedKey,
3712
3739
  dataFeedKey,
3713
- state: import_services8.SpaceState.ACTIVE
3740
+ state: import_services9.SpaceState.ACTIVE
3714
3741
  };
3715
3742
  (0, import_log11.log)("creating space...", {
3716
3743
  spaceKey
@@ -3790,7 +3817,7 @@ var DataSpaceManager = class {
3790
3817
  async waitUntilSpaceReady(spaceKey) {
3791
3818
  await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3792
3819
  const space = this._spaces.get(spaceKey);
3793
- return !!space && space.state === import_services8.SpaceState.READY;
3820
+ return !!space && space.state === import_services9.SpaceState.READY;
3794
3821
  }));
3795
3822
  }
3796
3823
  async _constructSpace(metadata) {
@@ -3847,7 +3874,7 @@ var DataSpaceManager = class {
3847
3874
  dataFeed && space.setDataFeed(dataFeed);
3848
3875
  const dataSpace = new DataSpace({
3849
3876
  inner: space,
3850
- initialState: metadata.state === import_services8.SpaceState.INACTIVE ? import_services8.SpaceState.INACTIVE : import_services8.SpaceState.CLOSED,
3877
+ initialState: metadata.state === import_services9.SpaceState.INACTIVE ? import_services9.SpaceState.INACTIVE : import_services9.SpaceState.CLOSED,
3851
3878
  metadataStore: this._metadataStore,
3852
3879
  gossip,
3853
3880
  presence,
@@ -3895,7 +3922,7 @@ var DataSpaceManager = class {
3895
3922
  cache: metadata.cache,
3896
3923
  automergeHost: this._automergeHost
3897
3924
  });
3898
- if (metadata.state !== import_services8.SpaceState.INACTIVE) {
3925
+ if (metadata.state !== import_services9.SpaceState.INACTIVE) {
3899
3926
  await dataSpace.open();
3900
3927
  }
3901
3928
  if (metadata.controlTimeframe) {
@@ -3944,10 +3971,10 @@ var SpacesServiceImpl = class {
3944
3971
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
3945
3972
  if (state) {
3946
3973
  switch (state) {
3947
- case import_services9.SpaceState.ACTIVE:
3974
+ case import_services10.SpaceState.ACTIVE:
3948
3975
  await space.activate();
3949
3976
  break;
3950
- case import_services9.SpaceState.INACTIVE:
3977
+ case import_services10.SpaceState.INACTIVE:
3951
3978
  await space.deactivate();
3952
3979
  break;
3953
3980
  default:
@@ -4124,7 +4151,7 @@ var SpacesServiceImpl = class {
4124
4151
  displayName: member.profile?.displayName
4125
4152
  }
4126
4153
  },
4127
- presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
4154
+ presence: member.removed ? import_services10.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE,
4128
4155
  peerStates: peers
4129
4156
  };
4130
4157
  }),
@@ -4181,7 +4208,7 @@ var ServiceContext = class {
4181
4208
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4182
4209
  this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
4183
4210
  this.invitations = new InvitationsHandler(this.networkManager);
4184
- this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
4211
+ this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
4185
4212
  }
4186
4213
  async open(ctx) {
4187
4214
  await this._checkStorageVersion();
@@ -4309,7 +4336,7 @@ var ServiceContext = class {
4309
4336
  };
4310
4337
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
4311
4338
  await this.dataSpaceManager.open();
4312
- this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4339
+ this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
4313
4340
  (0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4314
4341
  F: __dxlog_file15,
4315
4342
  L: 228,
@@ -4380,14 +4407,14 @@ var ServiceContext = class {
4380
4407
  }
4381
4408
  };
4382
4409
  _ts_decorate6([
4383
- import_tracing5.trace.span()
4410
+ import_tracing6.trace.span()
4384
4411
  ], ServiceContext.prototype, "open", null);
4385
4412
  _ts_decorate6([
4386
- import_tracing5.trace.span()
4413
+ import_tracing6.trace.span()
4387
4414
  ], ServiceContext.prototype, "_initialize", null);
4388
4415
  ServiceContext = _ts_decorate6([
4389
4416
  (0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
4390
- import_tracing5.trace.resource()
4417
+ import_tracing6.trace.resource()
4391
4418
  ], ServiceContext);
4392
4419
  var ServiceRegistry = class {
4393
4420
  // prettier-ignore
@@ -4526,7 +4553,7 @@ var DevicesServiceImpl = class {
4526
4553
  next({
4527
4554
  devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
4528
4555
  deviceKey: key,
4529
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services12.DeviceKind.CURRENT : import_services12.DeviceKind.TRUSTED,
4556
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services13.DeviceKind.CURRENT : import_services13.DeviceKind.TRUSTED,
4530
4557
  profile
4531
4558
  }))
4532
4559
  });
@@ -4641,16 +4668,16 @@ var LoggingServiceImpl = class {
4641
4668
  };
4642
4669
  var matchFilter = (filter, level, path, options) => {
4643
4670
  switch (options) {
4644
- case import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE:
4671
+ case import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE:
4645
4672
  return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
4646
- case import_services13.QueryLogsRequest.MatchingOptions.EXPLICIT:
4673
+ case import_services14.QueryLogsRequest.MatchingOptions.EXPLICIT:
4647
4674
  return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
4648
4675
  }
4649
4676
  };
4650
4677
  var shouldLog = (entry2, request) => {
4651
- const options = request.options ?? import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4678
+ const options = request.options ?? import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4652
4679
  if (request.filters === void 0) {
4653
- return options === import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4680
+ return options === import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4654
4681
  } else {
4655
4682
  return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
4656
4683
  }
@@ -4666,6 +4693,7 @@ var NetworkServiceImpl = class {
4666
4693
  const update = () => {
4667
4694
  next({
4668
4695
  swarm: this.networkManager.connectionState,
4696
+ connectionInfo: this.networkManager.connectionLog?.swarms,
4669
4697
  signaling: this.signalManager.getStatus().map(({ host, state }) => ({
4670
4698
  server: host,
4671
4699
  state
@@ -4705,11 +4733,14 @@ var SystemServiceImpl = class {
4705
4733
  return {
4706
4734
  timestamp: /* @__PURE__ */ new Date(),
4707
4735
  diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4708
- truncate: keys === import_services14.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4709
- humanize: keys === import_services14.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4736
+ truncate: keys === import_services15.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4737
+ humanize: keys === import_services15.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4710
4738
  })))
4711
4739
  };
4712
4740
  }
4741
+ async getPlatform() {
4742
+ return getPlatform();
4743
+ }
4713
4744
  async updateStatus({ status }) {
4714
4745
  await this._onUpdateStatus(status);
4715
4746
  }
@@ -4771,7 +4802,7 @@ var ClientServicesHost = class {
4771
4802
  lockKey,
4772
4803
  callbacks
4773
4804
  } = {}) {
4774
- this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
4805
+ this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
4775
4806
  this._statusUpdate = new import_async15.Event();
4776
4807
  this._opening = false;
4777
4808
  this._open = false;
@@ -4799,14 +4830,14 @@ var ClientServicesHost = class {
4799
4830
  this._systemService = new SystemServiceImpl({
4800
4831
  config: this._config,
4801
4832
  statusUpdate: this._statusUpdate,
4802
- getCurrentStatus: () => this.isOpen ? import_services11.SystemStatus.ACTIVE : import_services11.SystemStatus.INACTIVE,
4833
+ getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
4803
4834
  getDiagnostics: () => {
4804
4835
  return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
4805
4836
  },
4806
4837
  onUpdateStatus: async (status) => {
4807
- if (!this.isOpen && status === import_services11.SystemStatus.ACTIVE) {
4838
+ if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
4808
4839
  await this._resourceLock?.acquire();
4809
- } else if (this.isOpen && status === import_services11.SystemStatus.INACTIVE) {
4840
+ } else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
4810
4841
  await this._resourceLock?.release();
4811
4842
  }
4812
4843
  },
@@ -5118,21 +5149,21 @@ var ClientServicesHost = class {
5118
5149
  }
5119
5150
  };
5120
5151
  _ts_decorate8([
5121
- import_tracing6.trace.info()
5152
+ import_tracing7.trace.info()
5122
5153
  ], ClientServicesHost.prototype, "_opening", void 0);
5123
5154
  _ts_decorate8([
5124
- import_tracing6.trace.info()
5155
+ import_tracing7.trace.info()
5125
5156
  ], ClientServicesHost.prototype, "_open", void 0);
5126
5157
  _ts_decorate8([
5127
5158
  import_async15.synchronized,
5128
- import_tracing6.trace.span()
5159
+ import_tracing7.trace.span()
5129
5160
  ], ClientServicesHost.prototype, "open", null);
5130
5161
  _ts_decorate8([
5131
5162
  import_async15.synchronized,
5132
- import_tracing6.trace.span()
5163
+ import_tracing7.trace.span()
5133
5164
  ], ClientServicesHost.prototype, "close", null);
5134
5165
  ClientServicesHost = _ts_decorate8([
5135
- import_tracing6.trace.resource()
5166
+ import_tracing7.trace.resource()
5136
5167
  ], ClientServicesHost);
5137
5168
  // Annotate the CommonJS export names for ESM import in node:
5138
5169
  0 && (module.exports = {
@@ -5168,4 +5199,4 @@ ClientServicesHost = _ts_decorate8([
5168
5199
  subscribeToSpaces,
5169
5200
  subscribeToSwarmInfo
5170
5201
  });
5171
- //# sourceMappingURL=chunk-KA7FPK35.cjs.map
5202
+ //# sourceMappingURL=chunk-Q7FPBLIU.cjs.map