@dxos/client-services 0.3.11-main.674a7f9 → 0.3.11-main.6901f09

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 (36) hide show
  1. package/dist/lib/browser/{chunk-5QUGG7ZZ.mjs → chunk-PMVT5BLQ.mjs} +115 -43
  2. package/dist/lib/browser/chunk-PMVT5BLQ.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-X2OSDSLP.cjs → chunk-BQVFPJSS.cjs} +202 -130
  7. package/dist/lib/node/chunk-BQVFPJSS.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/automerge-space-state.d.ts +2 -0
  17. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  18. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space.d.ts +2 -0
  20. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  21. package/dist/types/src/packlets/system/system-service.d.ts +3 -2
  22. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  23. package/dist/types/src/version.d.ts +1 -1
  24. package/package.json +35 -35
  25. package/src/packlets/identity/identity-manager.ts +1 -1
  26. package/src/packlets/network/network-service.ts +5 -1
  27. package/src/packlets/services/diagnostics.ts +35 -17
  28. package/src/packlets/services/platform.ts +7 -19
  29. package/src/packlets/spaces/automerge-space-state.ts +4 -0
  30. package/src/packlets/spaces/data-space-manager.ts +5 -1
  31. package/src/packlets/spaces/data-space.ts +37 -4
  32. package/src/packlets/spaces/spaces-service.ts +2 -2
  33. package/src/packlets/system/system-service.ts +7 -1
  34. package/src/version.ts +1 -1
  35. package/dist/lib/browser/chunk-5QUGG7ZZ.mjs.map +0 -7
  36. package/dist/lib/node/chunk-X2OSDSLP.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_X2OSDSLP_exports = {};
30
- __export(chunk_X2OSDSLP_exports, {
29
+ var chunk_BQVFPJSS_exports = {};
30
+ __export(chunk_BQVFPJSS_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_X2OSDSLP_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_X2OSDSLP_exports);
63
+ module.exports = __toCommonJS(chunk_BQVFPJSS_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,23 +153,26 @@ 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");
159
161
  var import_debug4 = require("@dxos/debug");
160
162
  var import_echo_pipeline = require("@dxos/echo-pipeline");
163
+ var import_invariant10 = require("@dxos/invariant");
161
164
  var import_keys7 = require("@dxos/keys");
162
165
  var import_log9 = require("@dxos/log");
163
166
  var import_protocols8 = require("@dxos/protocols");
164
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
167
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
165
168
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
166
169
  var import_timeframe2 = require("@dxos/timeframe");
167
- var import_tracing4 = require("@dxos/tracing");
170
+ var import_tracing5 = require("@dxos/tracing");
168
171
  var import_util4 = require("@dxos/util");
169
172
  var import_credentials11 = require("@dxos/credentials");
170
173
  var import_async11 = require("@dxos/async");
171
174
  var import_context7 = require("@dxos/context");
172
- var import_invariant10 = require("@dxos/invariant");
175
+ var import_invariant11 = require("@dxos/invariant");
173
176
  var import_keys8 = require("@dxos/keys");
174
177
  var import_log10 = require("@dxos/log");
175
178
  var import_protocols9 = require("@dxos/protocols");
@@ -178,11 +181,11 @@ var import_util5 = require("@dxos/util");
178
181
  var import_async12 = require("@dxos/async");
179
182
  var import_context8 = require("@dxos/context");
180
183
  var import_credentials12 = require("@dxos/credentials");
181
- var import_invariant11 = require("@dxos/invariant");
184
+ var import_invariant12 = require("@dxos/invariant");
182
185
  var import_keys9 = require("@dxos/keys");
183
186
  var import_log11 = require("@dxos/log");
184
187
  var import_protocols10 = require("@dxos/protocols");
185
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
188
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
186
189
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
187
190
  var import_util6 = require("@dxos/util");
188
191
  var import_credentials13 = require("@dxos/credentials");
@@ -192,26 +195,26 @@ var import_timeframe3 = require("@dxos/timeframe");
192
195
  var import_async13 = require("@dxos/async");
193
196
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
194
197
  var import_debug6 = require("@dxos/debug");
195
- var import_invariant12 = require("@dxos/invariant");
198
+ var import_invariant13 = require("@dxos/invariant");
196
199
  var import_log12 = require("@dxos/log");
197
200
  var import_protocols11 = require("@dxos/protocols");
198
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
201
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
199
202
  var import_async14 = require("@dxos/async");
200
203
  var import_context9 = require("@dxos/context");
201
204
  var import_credentials15 = require("@dxos/credentials");
202
205
  var import_debug7 = require("@dxos/debug");
203
206
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
204
207
  var import_feed_store4 = require("@dxos/feed-store");
205
- var import_invariant13 = require("@dxos/invariant");
208
+ var import_invariant14 = require("@dxos/invariant");
206
209
  var import_keyring = require("@dxos/keyring");
207
210
  var import_keys10 = require("@dxos/keys");
208
211
  var import_log13 = require("@dxos/log");
209
212
  var import_protocols12 = require("@dxos/protocols");
210
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
213
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
211
214
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
212
- var import_tracing5 = require("@dxos/tracing");
215
+ var import_tracing6 = require("@dxos/tracing");
213
216
  var import_util7 = require("@dxos/util");
214
- var import_invariant14 = require("@dxos/invariant");
217
+ var import_invariant15 = require("@dxos/invariant");
215
218
  var import_lock_file = require("@dxos/lock-file");
216
219
  var import_log14 = require("@dxos/log");
217
220
  var import_client_protocol4 = require("@dxos/client-protocol");
@@ -225,28 +228,28 @@ var import_context10 = require("@dxos/context");
225
228
  var import_document_model2 = require("@dxos/document-model");
226
229
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
227
230
  var import_echo_schema = require("@dxos/echo-schema");
228
- var import_invariant15 = require("@dxos/invariant");
231
+ var import_invariant16 = require("@dxos/invariant");
229
232
  var import_keys11 = require("@dxos/keys");
230
233
  var import_log15 = require("@dxos/log");
231
234
  var import_messaging = require("@dxos/messaging");
232
235
  var import_model_factory = require("@dxos/model-factory");
233
236
  var import_network_manager2 = require("@dxos/network-manager");
234
237
  var import_protocols14 = require("@dxos/protocols");
235
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
238
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
236
239
  var import_text_model = require("@dxos/text-model");
237
- var import_tracing6 = require("@dxos/tracing");
240
+ var import_tracing7 = require("@dxos/tracing");
238
241
  var import_websocket_rpc = require("@dxos/websocket-rpc");
239
242
  var import_async16 = require("@dxos/async");
240
243
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
241
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
244
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
242
245
  var import_async17 = require("@dxos/async");
243
246
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
244
247
  var import_log16 = require("@dxos/log");
245
- var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
248
+ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
246
249
  var import_util9 = require("@dxos/util");
247
250
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
248
251
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
249
- var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
252
+ var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
250
253
  var import_util10 = require("@dxos/util");
251
254
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
252
255
  return new import_codec_protobuf.Stream(({ next }) => {
@@ -1176,7 +1179,7 @@ var IdentityManager = class {
1176
1179
  genesisFeedKey: spaceRecord.genesisFeedKey
1177
1180
  },
1178
1181
  swarmIdentity,
1179
- onNetworkConnection: () => {
1182
+ onAuthorizedConnection: () => {
1180
1183
  },
1181
1184
  onAuthFailure: () => {
1182
1185
  import_log3.log.warn("auth failure", void 0, {
@@ -2650,28 +2653,29 @@ var getPlatform = () => {
2650
2653
  if (typeof window !== "undefined") {
2651
2654
  const { userAgent } = window.navigator;
2652
2655
  return {
2653
- type: "browser",
2656
+ type: import_services7.Platform.PLATFORM_TYPE.BROWSER,
2654
2657
  userAgent,
2655
2658
  uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
2656
2659
  };
2657
2660
  } else {
2658
2661
  return {
2659
- type: "shared-worker",
2662
+ type: import_services7.Platform.PLATFORM_TYPE.SHARED_WORKER,
2660
2663
  uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
2661
2664
  };
2662
2665
  }
2663
2666
  } else {
2664
2667
  const { platform: platform2, version, arch } = process;
2665
2668
  return {
2666
- type: "node",
2667
- platform: `${platform2} ${version} ${arch}`,
2668
- runtime: process.version,
2669
+ type: import_services7.Platform.PLATFORM_TYPE.NODE,
2670
+ platform: platform2,
2671
+ arch,
2672
+ runtime: version,
2669
2673
  uptime: Math.floor(process.uptime()),
2670
2674
  memory: process.memoryUsage()
2671
2675
  };
2672
2676
  }
2673
2677
  };
2674
- var DXOS_VERSION = "0.3.11-main.674a7f9";
2678
+ var DXOS_VERSION = "0.3.11-main.6901f09";
2675
2679
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2676
2680
  var DEFAULT_TIMEOUT = 1e3;
2677
2681
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -2683,12 +2687,13 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2683
2687
  storage: {
2684
2688
  version: import_protocols7.STORAGE_VERSION
2685
2689
  }
2686
- }
2690
+ },
2691
+ trace: import_tracing4.TRACE_PROCESSOR.getDiagnostics()
2687
2692
  };
2688
2693
  {
2689
2694
  (0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
2690
2695
  F: __dxlog_file10,
2691
- L: 93,
2696
+ L: 111,
2692
2697
  S: void 0,
2693
2698
  A: [
2694
2699
  "clientServices.LoggingService",
@@ -2754,7 +2759,7 @@ var getProperties = (space) => {
2754
2759
  } catch (err) {
2755
2760
  import_log8.log.warn(err.message, void 0, {
2756
2761
  F: __dxlog_file10,
2757
- L: 178,
2762
+ L: 196,
2758
2763
  S: void 0,
2759
2764
  C: (f, a) => f(...a)
2760
2765
  });
@@ -2809,7 +2814,8 @@ var getSpaceStats = async (space) => {
2809
2814
  return stats;
2810
2815
  };
2811
2816
  var AutomergeSpaceState = class {
2812
- constructor() {
2817
+ constructor(_onNewRoot) {
2818
+ this._onNewRoot = _onNewRoot;
2813
2819
  this.rootUrl = void 0;
2814
2820
  this.lastEpoch = void 0;
2815
2821
  }
@@ -2820,6 +2826,7 @@ var AutomergeSpaceState = class {
2820
2826
  this.lastEpoch = credential;
2821
2827
  if (credential.subject.assertion.automergeRoot) {
2822
2828
  this.rootUrl = credential.subject.assertion.automergeRoot;
2829
+ this._onNewRoot(this.rootUrl);
2823
2830
  }
2824
2831
  }
2825
2832
  };
@@ -2856,7 +2863,7 @@ var NotarizationPlugin = class {
2856
2863
  S: this,
2857
2864
  C: (f, a) => f(...a)
2858
2865
  });
2859
- (0, import_invariant10.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
2866
+ (0, import_invariant11.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
2860
2867
  F: __dxlog_file11,
2861
2868
  L: 91,
2862
2869
  S: this,
@@ -2981,7 +2988,7 @@ var NotarizationPlugin = class {
2981
2988
  this._processCredentialsTriggers.delete(credential.id);
2982
2989
  }
2983
2990
  setWriter(writer) {
2984
- (0, import_invariant10.invariant)(!this._writer, "Writer already set.", {
2991
+ (0, import_invariant11.invariant)(!this._writer, "Writer already set.", {
2985
2992
  F: __dxlog_file11,
2986
2993
  L: 181,
2987
2994
  S: this,
@@ -3006,7 +3013,7 @@ var NotarizationPlugin = class {
3006
3013
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
3007
3014
  }
3008
3015
  for (const credential of request.credentials ?? []) {
3009
- (0, import_invariant10.invariant)(credential.id, "Credential must have an id", {
3016
+ (0, import_invariant11.invariant)(credential.id, "Credential must have an id", {
3010
3017
  F: __dxlog_file11,
3011
3018
  L: 200,
3012
3019
  S: this,
@@ -3098,8 +3105,8 @@ var DataSpace = class {
3098
3105
  this._ctx = new import_context6.Context();
3099
3106
  this._notarizationPlugin = new NotarizationPlugin();
3100
3107
  this._cache = void 0;
3101
- this._automergeSpaceState = new AutomergeSpaceState();
3102
- this._state = import_services7.SpaceState.CLOSED;
3108
+ this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
3109
+ this._state = import_services8.SpaceState.CLOSED;
3103
3110
  this.error = void 0;
3104
3111
  this.stateUpdate = new import_async10.Event();
3105
3112
  this.metrics = {};
@@ -3121,10 +3128,10 @@ var DataSpace = class {
3121
3128
  this._cache = params.cache;
3122
3129
  this._state = params.initialState;
3123
3130
  (0, import_log9.log)("new state", {
3124
- state: import_services7.SpaceState[this._state]
3131
+ state: import_services8.SpaceState[this._state]
3125
3132
  }, {
3126
3133
  F: __dxlog_file12,
3127
- L: 137,
3134
+ L: 141,
3128
3135
  S: this,
3129
3136
  C: (f, a) => f(...a)
3130
3137
  });
@@ -3157,6 +3164,12 @@ var DataSpace = class {
3157
3164
  get automergeSpaceState() {
3158
3165
  return this._automergeSpaceState;
3159
3166
  }
3167
+ get _automergeInfo() {
3168
+ return {
3169
+ rootUrl: this._automergeSpaceState.rootUrl,
3170
+ lastEpoch: this._automergeSpaceState.lastEpoch
3171
+ };
3172
+ }
3160
3173
  async open() {
3161
3174
  await this._open();
3162
3175
  }
@@ -3166,12 +3179,12 @@ var DataSpace = class {
3166
3179
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3167
3180
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
3168
3181
  await this._inner.open(new import_context6.Context());
3169
- this._state = import_services7.SpaceState.CONTROL_ONLY;
3182
+ this._state = import_services8.SpaceState.CONTROL_ONLY;
3170
3183
  (0, import_log9.log)("new state", {
3171
- state: import_services7.SpaceState[this._state]
3184
+ state: import_services8.SpaceState[this._state]
3172
3185
  }, {
3173
3186
  F: __dxlog_file12,
3174
- L: 189,
3187
+ L: 203,
3175
3188
  S: this,
3176
3189
  C: (f, a) => f(...a)
3177
3190
  });
@@ -3184,12 +3197,12 @@ var DataSpace = class {
3184
3197
  }
3185
3198
  async _close() {
3186
3199
  await this._callbacks.beforeClose?.();
3187
- this._state = import_services7.SpaceState.CLOSED;
3200
+ this._state = import_services8.SpaceState.CLOSED;
3188
3201
  (0, import_log9.log)("new state", {
3189
- state: import_services7.SpaceState[this._state]
3202
+ state: import_services8.SpaceState[this._state]
3190
3203
  }, {
3191
3204
  F: __dxlog_file12,
3192
- L: 203,
3205
+ L: 217,
3193
3206
  S: this,
3194
3207
  C: (f, a) => f(...a)
3195
3208
  });
@@ -3218,10 +3231,10 @@ var DataSpace = class {
3218
3231
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3219
3232
  await this.initializeDataPipeline();
3220
3233
  } catch (err) {
3221
- if (err instanceof import_protocols8.CancelledError) {
3234
+ if (err instanceof import_protocols8.CancelledError || err instanceof import_context6.ContextDisposedError) {
3222
3235
  (0, import_log9.log)("data pipeline initialization cancelled", err, {
3223
3236
  F: __dxlog_file12,
3224
- L: 236,
3237
+ L: 250,
3225
3238
  S: this,
3226
3239
  C: (f, a) => f(...a)
3227
3240
  });
@@ -3229,16 +3242,16 @@ var DataSpace = class {
3229
3242
  }
3230
3243
  import_log9.log.error("Error initializing data pipeline", err, {
3231
3244
  F: __dxlog_file12,
3232
- L: 240,
3245
+ L: 254,
3233
3246
  S: this,
3234
3247
  C: (f, a) => f(...a)
3235
3248
  });
3236
- this._state = import_services7.SpaceState.ERROR;
3249
+ this._state = import_services8.SpaceState.ERROR;
3237
3250
  (0, import_log9.log)("new state", {
3238
- state: import_services7.SpaceState[this._state]
3251
+ state: import_services8.SpaceState[this._state]
3239
3252
  }, {
3240
3253
  F: __dxlog_file12,
3241
- L: 242,
3254
+ L: 256,
3242
3255
  S: this,
3243
3256
  C: (f, a) => f(...a)
3244
3257
  });
@@ -3250,15 +3263,15 @@ var DataSpace = class {
3250
3263
  });
3251
3264
  }
3252
3265
  async initializeDataPipeline() {
3253
- if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
3266
+ if (this._state !== import_services8.SpaceState.CONTROL_ONLY) {
3254
3267
  throw new import_protocols8.SystemError("Invalid operation");
3255
3268
  }
3256
- this._state = import_services7.SpaceState.INITIALIZING;
3269
+ this._state = import_services8.SpaceState.INITIALIZING;
3257
3270
  (0, import_log9.log)("new state", {
3258
- state: import_services7.SpaceState[this._state]
3271
+ state: import_services8.SpaceState[this._state]
3259
3272
  }, {
3260
3273
  F: __dxlog_file12,
3261
- L: 258,
3274
+ L: 272,
3262
3275
  S: this,
3263
3276
  C: (f, a) => f(...a)
3264
3277
  });
@@ -3269,7 +3282,7 @@ var DataSpace = class {
3269
3282
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3270
3283
  (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
3271
3284
  F: __dxlog_file12,
3272
- L: 272,
3285
+ L: 286,
3273
3286
  S: this,
3274
3287
  C: (f, a) => f(...a)
3275
3288
  });
@@ -3280,17 +3293,17 @@ var DataSpace = class {
3280
3293
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3281
3294
  (0, import_log9.log)("data pipeline ready", void 0, {
3282
3295
  F: __dxlog_file12,
3283
- L: 281,
3296
+ L: 295,
3284
3297
  S: this,
3285
3298
  C: (f, a) => f(...a)
3286
3299
  });
3287
3300
  await this._callbacks.beforeReady?.();
3288
- this._state = import_services7.SpaceState.READY;
3301
+ this._state = import_services8.SpaceState.READY;
3289
3302
  (0, import_log9.log)("new state", {
3290
- state: import_services7.SpaceState[this._state]
3303
+ state: import_services8.SpaceState[this._state]
3291
3304
  }, {
3292
3305
  F: __dxlog_file12,
3293
- L: 285,
3306
+ L: 299,
3294
3307
  S: this,
3295
3308
  C: (f, a) => f(...a)
3296
3309
  });
@@ -3306,7 +3319,7 @@ var DataSpace = class {
3306
3319
  await this._createWritableFeeds();
3307
3320
  (0, import_log9.log)("writable feeds created", void 0, {
3308
3321
  F: __dxlog_file12,
3309
- L: 301,
3322
+ L: 315,
3310
3323
  S: this,
3311
3324
  C: (f, a) => f(...a)
3312
3325
  });
@@ -3363,6 +3376,40 @@ var DataSpace = class {
3363
3376
  await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
3364
3377
  }
3365
3378
  }
3379
+ _onNewAutomergeRoot(rootUrl) {
3380
+ (0, import_log9.log)("loading automerge root doc for space", {
3381
+ space: this.key,
3382
+ rootUrl
3383
+ }, {
3384
+ F: __dxlog_file12,
3385
+ L: 381,
3386
+ S: this,
3387
+ C: (f, a) => f(...a)
3388
+ });
3389
+ const handle = this._automergeHost.repo.find(rootUrl);
3390
+ queueMicrotask(async () => {
3391
+ try {
3392
+ await (0, import_async10.asyncTimeout)(handle.whenReady(), 5e3);
3393
+ const doc = handle.docSync() ?? (0, import_invariant10.failedInvariant)();
3394
+ if (!doc.experimental_spaceKey) {
3395
+ handle.change((doc2) => {
3396
+ doc2.experimental_spaceKey = this.key.toHex();
3397
+ });
3398
+ }
3399
+ } catch (err) {
3400
+ import_log9.log.warn("error loading automerge root doc", {
3401
+ space: this.key,
3402
+ rootUrl,
3403
+ err
3404
+ }, {
3405
+ F: __dxlog_file12,
3406
+ L: 394,
3407
+ S: this,
3408
+ C: (f, a) => f(...a)
3409
+ });
3410
+ }
3411
+ });
3412
+ }
3366
3413
  // TODO(dmaretskyi): Use profile from signing context.
3367
3414
  async updateOwnProfile(profile) {
3368
3415
  const credential = await this._signingContext.credentialSigner.createCredential({
@@ -3382,12 +3429,12 @@ var DataSpace = class {
3382
3429
  let epoch;
3383
3430
  switch (options?.migration) {
3384
3431
  case void 0:
3385
- case import_services7.CreateEpochRequest.Migration.NONE:
3432
+ case import_services8.CreateEpochRequest.Migration.NONE:
3386
3433
  {
3387
3434
  epoch = await this.dataPipeline.createEpoch();
3388
3435
  }
3389
3436
  break;
3390
- case import_services7.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3437
+ case import_services8.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3391
3438
  const document = this._automergeHost.repo.create();
3392
3439
  epoch = {
3393
3440
  previousId: this._automergeSpaceState.lastEpoch?.id,
@@ -3428,31 +3475,47 @@ var DataSpace = class {
3428
3475
  }
3429
3476
  }
3430
3477
  async activate() {
3431
- if (this._state !== import_services7.SpaceState.INACTIVE) {
3478
+ if (this._state !== import_services8.SpaceState.INACTIVE) {
3432
3479
  return;
3433
3480
  }
3434
- await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.ACTIVE);
3481
+ await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.ACTIVE);
3435
3482
  await this._open();
3436
3483
  this.initializeDataPipelineAsync();
3437
3484
  }
3438
3485
  async deactivate() {
3439
- if (this._state === import_services7.SpaceState.INACTIVE) {
3486
+ if (this._state === import_services8.SpaceState.INACTIVE) {
3440
3487
  return;
3441
3488
  }
3442
- await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
3489
+ await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.INACTIVE);
3443
3490
  await this._close();
3444
- this._state = import_services7.SpaceState.INACTIVE;
3491
+ this._state = import_services8.SpaceState.INACTIVE;
3445
3492
  (0, import_log9.log)("new state", {
3446
- state: import_services7.SpaceState[this._state]
3493
+ state: import_services8.SpaceState[this._state]
3447
3494
  }, {
3448
3495
  F: __dxlog_file12,
3449
- L: 450,
3496
+ L: 483,
3450
3497
  S: this,
3451
3498
  C: (f, a) => f(...a)
3452
3499
  });
3453
3500
  this.stateUpdate.emit();
3454
3501
  }
3455
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);
3456
3519
  _ts_decorate4([
3457
3520
  import_async10.synchronized
3458
3521
  ], DataSpace.prototype, "open", null);
@@ -3460,12 +3523,12 @@ _ts_decorate4([
3460
3523
  import_async10.synchronized
3461
3524
  ], DataSpace.prototype, "close", null);
3462
3525
  _ts_decorate4([
3463
- import_tracing4.trace.span({
3526
+ import_tracing5.trace.span({
3464
3527
  showInBrowserTimeline: true
3465
3528
  })
3466
3529
  ], DataSpace.prototype, "initializeDataPipeline", null);
3467
3530
  _ts_decorate4([
3468
- import_tracing4.trace.span({
3531
+ import_tracing5.trace.span({
3469
3532
  showInBrowserTimeline: true
3470
3533
  })
3471
3534
  ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
@@ -3479,7 +3542,8 @@ _ts_decorate4([
3479
3542
  import_async10.synchronized
3480
3543
  ], DataSpace.prototype, "deactivate", null);
3481
3544
  DataSpace = _ts_decorate4([
3482
- (0, import_async10.trackLeaks)("open", "close")
3545
+ (0, import_async10.trackLeaks)("open", "close"),
3546
+ import_tracing5.trace.resource()
3483
3547
  ], DataSpace);
3484
3548
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3485
3549
  const credentials = [
@@ -3626,7 +3690,7 @@ var DataSpaceManager = class {
3626
3690
  this._isOpen = true;
3627
3691
  this.updated.emit();
3628
3692
  for (const space of this._spaces.values()) {
3629
- if (space.state !== import_services8.SpaceState.INACTIVE) {
3693
+ if (space.state !== import_services9.SpaceState.INACTIVE) {
3630
3694
  space.initializeDataPipelineAsync();
3631
3695
  }
3632
3696
  }
@@ -3656,7 +3720,7 @@ var DataSpaceManager = class {
3656
3720
  * Creates a new space writing the genesis credentials to the control feed.
3657
3721
  */
3658
3722
  async createSpace() {
3659
- (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3723
+ (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
3660
3724
  F: __dxlog_file13,
3661
3725
  L: 130,
3662
3726
  S: this,
@@ -3673,7 +3737,7 @@ var DataSpaceManager = class {
3673
3737
  genesisFeedKey: controlFeedKey,
3674
3738
  controlFeedKey,
3675
3739
  dataFeedKey,
3676
- state: import_services8.SpaceState.ACTIVE
3740
+ state: import_services9.SpaceState.ACTIVE
3677
3741
  };
3678
3742
  (0, import_log11.log)("creating space...", {
3679
3743
  spaceKey
@@ -3685,12 +3749,15 @@ var DataSpaceManager = class {
3685
3749
  });
3686
3750
  const space = await this._constructSpace(metadata);
3687
3751
  const automergeRoot = this._automergeHost.repo.create();
3752
+ automergeRoot.change((doc) => {
3753
+ doc.experimental_spaceKey = spaceKey.toHex();
3754
+ });
3688
3755
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
3689
3756
  await this._metadataStore.addSpace(metadata);
3690
3757
  const memberCredential = credentials[1];
3691
- (0, import_invariant11.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3758
+ (0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3692
3759
  F: __dxlog_file13,
3693
- L: 151,
3760
+ L: 154,
3694
3761
  S: this,
3695
3762
  A: [
3696
3763
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3708,22 +3775,22 @@ var DataSpaceManager = class {
3708
3775
  opts
3709
3776
  }, {
3710
3777
  F: __dxlog_file13,
3711
- L: 163,
3778
+ L: 166,
3712
3779
  S: this,
3713
3780
  C: (f, a) => f(...a)
3714
3781
  });
3715
- (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3782
+ (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
3716
3783
  F: __dxlog_file13,
3717
- L: 164,
3784
+ L: 167,
3718
3785
  S: this,
3719
3786
  A: [
3720
3787
  "this._isOpen",
3721
3788
  "'Not open.'"
3722
3789
  ]
3723
3790
  });
3724
- (0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3791
+ (0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3725
3792
  F: __dxlog_file13,
3726
- L: 165,
3793
+ L: 168,
3727
3794
  S: this,
3728
3795
  A: [
3729
3796
  "!this._spaces.has(opts.spaceKey)",
@@ -3750,7 +3817,7 @@ var DataSpaceManager = class {
3750
3817
  async waitUntilSpaceReady(spaceKey) {
3751
3818
  await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3752
3819
  const space = this._spaces.get(spaceKey);
3753
- return !!space && space.state === import_services8.SpaceState.READY;
3820
+ return !!space && space.state === import_services9.SpaceState.READY;
3754
3821
  }));
3755
3822
  }
3756
3823
  async _constructSpace(metadata) {
@@ -3758,7 +3825,7 @@ var DataSpaceManager = class {
3758
3825
  metadata
3759
3826
  }, {
3760
3827
  F: __dxlog_file13,
3761
- L: 198,
3828
+ L: 201,
3762
3829
  S: this,
3763
3830
  C: (f, a) => f(...a)
3764
3831
  });
@@ -3785,17 +3852,18 @@ var DataSpaceManager = class {
3785
3852
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
3786
3853
  credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
3787
3854
  },
3788
- onNetworkConnection: (session) => {
3855
+ onAuthorizedConnection: (session) => {
3789
3856
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
3790
3857
  remotePeerId: session.remotePeerId
3791
3858
  }));
3792
3859
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
3860
+ this._automergeHost.authorizeDevice(space.key, session.remotePeerId);
3793
3861
  session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
3794
3862
  },
3795
3863
  onAuthFailure: () => {
3796
3864
  import_log11.log.warn("auth failure", void 0, {
3797
3865
  F: __dxlog_file13,
3798
- L: 234,
3866
+ L: 238,
3799
3867
  S: this,
3800
3868
  C: (f, a) => f(...a)
3801
3869
  });
@@ -3806,7 +3874,7 @@ var DataSpaceManager = class {
3806
3874
  dataFeed && space.setDataFeed(dataFeed);
3807
3875
  const dataSpace = new DataSpace({
3808
3876
  inner: space,
3809
- 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,
3810
3878
  metadataStore: this._metadataStore,
3811
3879
  gossip,
3812
3880
  presence,
@@ -3819,7 +3887,7 @@ var DataSpaceManager = class {
3819
3887
  space: space.key
3820
3888
  }, {
3821
3889
  F: __dxlog_file13,
3822
- L: 252,
3890
+ L: 256,
3823
3891
  S: this,
3824
3892
  C: (f, a) => f(...a)
3825
3893
  });
@@ -3831,7 +3899,7 @@ var DataSpaceManager = class {
3831
3899
  open: this._isOpen
3832
3900
  }, {
3833
3901
  F: __dxlog_file13,
3834
- L: 259,
3902
+ L: 263,
3835
3903
  S: this,
3836
3904
  C: (f, a) => f(...a)
3837
3905
  });
@@ -3844,7 +3912,7 @@ var DataSpaceManager = class {
3844
3912
  space: space.key
3845
3913
  }, {
3846
3914
  F: __dxlog_file13,
3847
- L: 265,
3915
+ L: 269,
3848
3916
  S: this,
3849
3917
  C: (f, a) => f(...a)
3850
3918
  });
@@ -3854,7 +3922,7 @@ var DataSpaceManager = class {
3854
3922
  cache: metadata.cache,
3855
3923
  automergeHost: this._automergeHost
3856
3924
  });
3857
- if (metadata.state !== import_services8.SpaceState.INACTIVE) {
3925
+ if (metadata.state !== import_services9.SpaceState.INACTIVE) {
3858
3926
  await dataSpace.open();
3859
3927
  }
3860
3928
  if (metadata.controlTimeframe) {
@@ -3903,10 +3971,10 @@ var SpacesServiceImpl = class {
3903
3971
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
3904
3972
  if (state) {
3905
3973
  switch (state) {
3906
- case import_services9.SpaceState.ACTIVE:
3974
+ case import_services10.SpaceState.ACTIVE:
3907
3975
  await space.activate();
3908
3976
  break;
3909
- case import_services9.SpaceState.INACTIVE:
3977
+ case import_services10.SpaceState.INACTIVE:
3910
3978
  await space.deactivate();
3911
3979
  break;
3912
3980
  default:
@@ -4007,7 +4075,7 @@ var SpacesServiceImpl = class {
4007
4075
  }
4008
4076
  });
4009
4077
  } else {
4010
- (0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
4078
+ (0, import_invariant13.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
4011
4079
  F: __dxlog_file14,
4012
4080
  L: 168,
4013
4081
  S: this,
@@ -4016,7 +4084,7 @@ var SpacesServiceImpl = class {
4016
4084
  "'Id on unsigned credentials is not allowed'"
4017
4085
  ]
4018
4086
  });
4019
- (0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
4087
+ (0, import_invariant13.invariant)(this._identityManager.identity, "Identity is not available", {
4020
4088
  F: __dxlog_file14,
4021
4089
  L: 169,
4022
4090
  S: this,
@@ -4026,7 +4094,7 @@ var SpacesServiceImpl = class {
4026
4094
  ]
4027
4095
  });
4028
4096
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4029
- (0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
4097
+ (0, import_invariant13.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
4030
4098
  F: __dxlog_file14,
4031
4099
  L: 171,
4032
4100
  S: this,
@@ -4083,7 +4151,7 @@ var SpacesServiceImpl = class {
4083
4151
  displayName: member.profile?.displayName
4084
4152
  }
4085
4153
  },
4086
- 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,
4087
4155
  peerStates: peers
4088
4156
  };
4089
4157
  }),
@@ -4140,7 +4208,7 @@ var ServiceContext = class {
4140
4208
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4141
4209
  this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
4142
4210
  this.invitations = new InvitationsHandler(this.networkManager);
4143
- 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)));
4144
4212
  }
4145
4213
  async open(ctx) {
4146
4214
  await this._checkStorageVersion();
@@ -4214,7 +4282,7 @@ var ServiceContext = class {
4214
4282
  }
4215
4283
  getInvitationHandler(invitation) {
4216
4284
  const factory = this._handlerFactories.get(invitation.kind);
4217
- (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4285
+ (0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4218
4286
  F: __dxlog_file15,
4219
4287
  L: 173,
4220
4288
  S: this,
@@ -4268,8 +4336,8 @@ var ServiceContext = class {
4268
4336
  };
4269
4337
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
4270
4338
  await this.dataSpaceManager.open();
4271
- this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4272
- (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4339
+ this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
4340
+ (0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4273
4341
  F: __dxlog_file15,
4274
4342
  L: 228,
4275
4343
  S: this,
@@ -4339,14 +4407,14 @@ var ServiceContext = class {
4339
4407
  }
4340
4408
  };
4341
4409
  _ts_decorate6([
4342
- import_tracing5.trace.span()
4410
+ import_tracing6.trace.span()
4343
4411
  ], ServiceContext.prototype, "open", null);
4344
4412
  _ts_decorate6([
4345
- import_tracing5.trace.span()
4413
+ import_tracing6.trace.span()
4346
4414
  ], ServiceContext.prototype, "_initialize", null);
4347
4415
  ServiceContext = _ts_decorate6([
4348
4416
  (0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
4349
- import_tracing5.trace.resource()
4417
+ import_tracing6.trace.resource()
4350
4418
  ], ServiceContext);
4351
4419
  var ServiceRegistry = class {
4352
4420
  // prettier-ignore
@@ -4408,7 +4476,7 @@ var Lock = class {
4408
4476
  }
4409
4477
  async release() {
4410
4478
  await this._onRelease?.();
4411
- (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4479
+ (0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
4412
4480
  F: __dxlog_file16,
4413
4481
  L: 42,
4414
4482
  S: this,
@@ -4485,7 +4553,7 @@ var DevicesServiceImpl = class {
4485
4553
  next({
4486
4554
  devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
4487
4555
  deviceKey: key,
4488
- 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,
4489
4557
  profile
4490
4558
  }))
4491
4559
  });
@@ -4600,16 +4668,16 @@ var LoggingServiceImpl = class {
4600
4668
  };
4601
4669
  var matchFilter = (filter, level, path, options) => {
4602
4670
  switch (options) {
4603
- case import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE:
4671
+ case import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE:
4604
4672
  return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
4605
- case import_services13.QueryLogsRequest.MatchingOptions.EXPLICIT:
4673
+ case import_services14.QueryLogsRequest.MatchingOptions.EXPLICIT:
4606
4674
  return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
4607
4675
  }
4608
4676
  };
4609
4677
  var shouldLog = (entry2, request) => {
4610
- const options = request.options ?? import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4678
+ const options = request.options ?? import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4611
4679
  if (request.filters === void 0) {
4612
- return options === import_services13.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4680
+ return options === import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4613
4681
  } else {
4614
4682
  return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
4615
4683
  }
@@ -4625,6 +4693,7 @@ var NetworkServiceImpl = class {
4625
4693
  const update = () => {
4626
4694
  next({
4627
4695
  swarm: this.networkManager.connectionState,
4696
+ connectionInfo: this.networkManager.connectionLog?.swarms,
4628
4697
  signaling: this.signalManager.getStatus().map(({ host, state }) => ({
4629
4698
  server: host,
4630
4699
  state
@@ -4664,11 +4733,14 @@ var SystemServiceImpl = class {
4664
4733
  return {
4665
4734
  timestamp: /* @__PURE__ */ new Date(),
4666
4735
  diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4667
- truncate: keys === import_services14.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4668
- 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
4669
4738
  })))
4670
4739
  };
4671
4740
  }
4741
+ async getPlatform() {
4742
+ return getPlatform();
4743
+ }
4672
4744
  async updateStatus({ status }) {
4673
4745
  await this._onUpdateStatus(status);
4674
4746
  }
@@ -4730,7 +4802,7 @@ var ClientServicesHost = class {
4730
4802
  lockKey,
4731
4803
  callbacks
4732
4804
  } = {}) {
4733
- this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
4805
+ this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
4734
4806
  this._statusUpdate = new import_async15.Event();
4735
4807
  this._opening = false;
4736
4808
  this._open = false;
@@ -4758,14 +4830,14 @@ var ClientServicesHost = class {
4758
4830
  this._systemService = new SystemServiceImpl({
4759
4831
  config: this._config,
4760
4832
  statusUpdate: this._statusUpdate,
4761
- getCurrentStatus: () => this.isOpen ? import_services11.SystemStatus.ACTIVE : import_services11.SystemStatus.INACTIVE,
4833
+ getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
4762
4834
  getDiagnostics: () => {
4763
4835
  return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
4764
4836
  },
4765
4837
  onUpdateStatus: async (status) => {
4766
- if (!this.isOpen && status === import_services11.SystemStatus.ACTIVE) {
4838
+ if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
4767
4839
  await this._resourceLock?.acquire();
4768
- } else if (this.isOpen && status === import_services11.SystemStatus.INACTIVE) {
4840
+ } else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
4769
4841
  await this._resourceLock?.release();
4770
4842
  }
4771
4843
  },
@@ -4803,7 +4875,7 @@ var ClientServicesHost = class {
4803
4875
  * Can only be called once.
4804
4876
  */
4805
4877
  initialize({ config, ...options }) {
4806
- (0, import_invariant15.invariant)(!this._open, "service host is open", {
4878
+ (0, import_invariant16.invariant)(!this._open, "service host is open", {
4807
4879
  F: __dxlog_file17,
4808
4880
  L: 201,
4809
4881
  S: this,
@@ -4819,7 +4891,7 @@ var ClientServicesHost = class {
4819
4891
  C: (f, a) => f(...a)
4820
4892
  });
4821
4893
  if (config) {
4822
- (0, import_invariant15.invariant)(!this._config, "config already set", {
4894
+ (0, import_invariant16.invariant)(!this._config, "config already set", {
4823
4895
  F: __dxlog_file17,
4824
4896
  L: 205,
4825
4897
  S: this,
@@ -4837,7 +4909,7 @@ var ClientServicesHost = class {
4837
4909
  iceServers: this._config?.get("runtime.services.ice")
4838
4910
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4839
4911
  this._signalManager = signalManager;
4840
- (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4912
+ (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
4841
4913
  F: __dxlog_file17,
4842
4914
  L: 221,
4843
4915
  S: this,
@@ -4871,7 +4943,7 @@ var ClientServicesHost = class {
4871
4943
  S: this,
4872
4944
  C: (f, a) => f(...a)
4873
4945
  });
4874
- (0, import_invariant15.invariant)(this._config, "config not set", {
4946
+ (0, import_invariant16.invariant)(this._config, "config not set", {
4875
4947
  F: __dxlog_file17,
4876
4948
  L: 241,
4877
4949
  S: this,
@@ -4880,7 +4952,7 @@ var ClientServicesHost = class {
4880
4952
  "'config not set'"
4881
4953
  ]
4882
4954
  });
4883
- (0, import_invariant15.invariant)(this._storage, "storage not set", {
4955
+ (0, import_invariant16.invariant)(this._storage, "storage not set", {
4884
4956
  F: __dxlog_file17,
4885
4957
  L: 242,
4886
4958
  S: this,
@@ -4889,7 +4961,7 @@ var ClientServicesHost = class {
4889
4961
  "'storage not set'"
4890
4962
  ]
4891
4963
  });
4892
- (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4964
+ (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
4893
4965
  F: __dxlog_file17,
4894
4966
  L: 243,
4895
4967
  S: this,
@@ -4898,7 +4970,7 @@ var ClientServicesHost = class {
4898
4970
  "'signal manager not set'"
4899
4971
  ]
4900
4972
  });
4901
- (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4973
+ (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
4902
4974
  F: __dxlog_file17,
4903
4975
  L: 244,
4904
4976
  S: this,
@@ -5057,7 +5129,7 @@ var ClientServicesHost = class {
5057
5129
  });
5058
5130
  } else {
5059
5131
  const automergeIndex = space.automergeSpaceState.rootUrl;
5060
- (0, import_invariant15.invariant)(automergeIndex, void 0, {
5132
+ (0, import_invariant16.invariant)(automergeIndex, void 0, {
5061
5133
  F: __dxlog_file17,
5062
5134
  L: 375,
5063
5135
  S: this,
@@ -5077,21 +5149,21 @@ var ClientServicesHost = class {
5077
5149
  }
5078
5150
  };
5079
5151
  _ts_decorate8([
5080
- import_tracing6.trace.info()
5152
+ import_tracing7.trace.info()
5081
5153
  ], ClientServicesHost.prototype, "_opening", void 0);
5082
5154
  _ts_decorate8([
5083
- import_tracing6.trace.info()
5155
+ import_tracing7.trace.info()
5084
5156
  ], ClientServicesHost.prototype, "_open", void 0);
5085
5157
  _ts_decorate8([
5086
5158
  import_async15.synchronized,
5087
- import_tracing6.trace.span()
5159
+ import_tracing7.trace.span()
5088
5160
  ], ClientServicesHost.prototype, "open", null);
5089
5161
  _ts_decorate8([
5090
5162
  import_async15.synchronized,
5091
- import_tracing6.trace.span()
5163
+ import_tracing7.trace.span()
5092
5164
  ], ClientServicesHost.prototype, "close", null);
5093
5165
  ClientServicesHost = _ts_decorate8([
5094
- import_tracing6.trace.resource()
5166
+ import_tracing7.trace.resource()
5095
5167
  ], ClientServicesHost);
5096
5168
  // Annotate the CommonJS export names for ESM import in node:
5097
5169
  0 && (module.exports = {
@@ -5127,4 +5199,4 @@ ClientServicesHost = _ts_decorate8([
5127
5199
  subscribeToSpaces,
5128
5200
  subscribeToSwarmInfo
5129
5201
  });
5130
- //# sourceMappingURL=chunk-X2OSDSLP.cjs.map
5202
+ //# sourceMappingURL=chunk-BQVFPJSS.cjs.map