@dxos/client-services 0.1.57-main.e87098f → 0.1.57

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 (40) hide show
  1. package/dist/lib/browser/{chunk-WYYB3FSH.mjs → chunk-ZOFA377V.mjs} +222 -133
  2. package/dist/lib/browser/chunk-ZOFA377V.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +17 -17
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +2 -2
  7. package/dist/lib/node/index.cjs +251 -162
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +235 -146
  11. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  12. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts +1 -1
  14. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  15. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  16. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  17. package/dist/types/src/packlets/services/service-host.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 +1 -0
  20. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  22. package/dist/types/src/packlets/vault/worker-runtime.d.ts +2 -2
  23. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/dist/types/src/version.d.ts.map +1 -1
  26. package/package.json +35 -34
  27. package/src/packlets/devtools/network.ts +5 -1
  28. package/src/packlets/identity/identity-manager.test.ts +4 -0
  29. package/src/packlets/identity/identity-manager.ts +5 -3
  30. package/src/packlets/services/service-context.test.ts +2 -2
  31. package/src/packlets/services/service-context.ts +3 -0
  32. package/src/packlets/services/service-host.ts +18 -2
  33. package/src/packlets/spaces/data-space-manager.ts +11 -8
  34. package/src/packlets/spaces/data-space.ts +41 -23
  35. package/src/packlets/spaces/spaces-service.ts +5 -3
  36. package/src/packlets/vault/iframe-host-runtime.ts +2 -2
  37. package/src/packlets/vault/iframe-proxy-runtime.ts +2 -2
  38. package/src/packlets/vault/worker-runtime.ts +9 -9
  39. package/src/version.ts +5 -1
  40. package/dist/lib/browser/chunk-WYYB3FSH.mjs.map +0 -7
@@ -194,6 +194,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf4.Stream
194
194
  signalManager.swarmEvent.on(ctx, (swarmEvent) => {
195
195
  next({
196
196
  swarmEvent: swarmEvent.swarmEvent,
197
+ topic: swarmEvent.topic.asUint8Array(),
197
198
  receivedAt: /* @__PURE__ */ new Date()
198
199
  });
199
200
  });
@@ -402,7 +403,7 @@ var import_context2 = require("@dxos/context");
402
403
  var import_credentials = require("@dxos/credentials");
403
404
  var import_log = require("@dxos/log");
404
405
  var import_protocols = require("@dxos/protocols");
405
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
406
+ var __dxlog_file = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
406
407
  var Credential = import_protocols.schema.getCodecForType("dxos.halo.credentials.Credential");
407
408
  var createAuthProvider = (signer) => async (nonce) => {
408
409
  const credential = await signer.createCredential({
@@ -532,7 +533,7 @@ function _ts_decorate(decorators, target, key, desc) {
532
533
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
533
534
  return c > 3 && r && Object.defineProperty(target, key, r), r;
534
535
  }
535
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
536
+ var __dxlog_file2 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity.ts";
536
537
  var Identity = class Identity2 {
537
538
  constructor({ space, signer, identityKey, deviceKey }) {
538
539
  this.stateUpdate = new import_async5.Event();
@@ -705,7 +706,7 @@ function _ts_decorate2(decorators, target, key, desc) {
705
706
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
706
707
  return c > 3 && r && Object.defineProperty(target, key, r), r;
707
708
  }
708
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
709
+ var __dxlog_file3 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
709
710
  var IdentityManager = class IdentityManager2 {
710
711
  // TODO(burdon): IdentityManagerParams.
711
712
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
@@ -729,13 +730,12 @@ var IdentityManager = class IdentityManager2 {
729
730
  S: this,
730
731
  C: (f, a) => f(...a)
731
732
  });
732
- await this._metadataStore.load();
733
733
  const identityRecord = this._metadataStore.getIdentityRecord();
734
734
  (0, import_log3.log)("identity record", {
735
735
  identityRecord
736
736
  }, {
737
737
  F: __dxlog_file3,
738
- L: 77,
738
+ L: 76,
739
739
  S: this,
740
740
  C: (f, a) => f(...a)
741
741
  });
@@ -748,7 +748,7 @@ var IdentityManager = class IdentityManager2 {
748
748
  displayName: this._identity.profileDocument?.displayName
749
749
  }, {
750
750
  F: __dxlog_file3,
751
- L: 82,
751
+ L: 81,
752
752
  S: this,
753
753
  C: (f, a) => f(...a)
754
754
  });
@@ -758,7 +758,7 @@ var IdentityManager = class IdentityManager2 {
758
758
  id: traceId
759
759
  }), {
760
760
  F: __dxlog_file3,
761
- L: 88,
761
+ L: 87,
762
762
  S: this,
763
763
  C: (f, a) => f(...a)
764
764
  });
@@ -769,7 +769,7 @@ var IdentityManager = class IdentityManager2 {
769
769
  async createIdentity({ displayName } = {}) {
770
770
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
771
771
  F: __dxlog_file3,
772
- L: 96,
772
+ L: 95,
773
773
  S: this,
774
774
  A: [
775
775
  "!this._identity",
@@ -778,7 +778,7 @@ var IdentityManager = class IdentityManager2 {
778
778
  });
779
779
  (0, import_log3.log)("creating identity...", void 0, {
780
780
  F: __dxlog_file3,
781
- L: 97,
781
+ L: 96,
782
782
  S: this,
783
783
  C: (f, a) => f(...a)
784
784
  });
@@ -799,7 +799,7 @@ var IdentityManager = class IdentityManager2 {
799
799
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
800
800
  (0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
801
801
  F: __dxlog_file3,
802
- L: 116,
802
+ L: 115,
803
803
  S: this,
804
804
  A: [
805
805
  "identityRecord.haloSpace.genesisFeedKey",
@@ -808,7 +808,7 @@ var IdentityManager = class IdentityManager2 {
808
808
  });
809
809
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
810
810
  F: __dxlog_file3,
811
- L: 117,
811
+ L: 116,
812
812
  S: this,
813
813
  A: [
814
814
  "identityRecord.haloSpace.dataFeedKey",
@@ -843,7 +843,7 @@ var IdentityManager = class IdentityManager2 {
843
843
  displayName: this._identity.profileDocument?.displayName
844
844
  }, {
845
845
  F: __dxlog_file3,
846
- L: 152,
846
+ L: 151,
847
847
  S: this,
848
848
  C: (f, a) => f(...a)
849
849
  });
@@ -853,7 +853,7 @@ var IdentityManager = class IdentityManager2 {
853
853
  deviceKey: identity.deviceKey
854
854
  }, {
855
855
  F: __dxlog_file3,
856
- L: 158,
856
+ L: 157,
857
857
  S: this,
858
858
  C: (f, a) => f(...a)
859
859
  });
@@ -867,13 +867,13 @@ var IdentityManager = class IdentityManager2 {
867
867
  params
868
868
  }, {
869
869
  F: __dxlog_file3,
870
- L: 166,
870
+ L: 165,
871
871
  S: this,
872
872
  C: (f, a) => f(...a)
873
873
  });
874
874
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
875
875
  F: __dxlog_file3,
876
- L: 167,
876
+ L: 166,
877
877
  S: this,
878
878
  A: [
879
879
  "!this._identity",
@@ -901,7 +901,7 @@ var IdentityManager = class IdentityManager2 {
901
901
  displayName: this._identity.profileDocument?.displayName
902
902
  }, {
903
903
  F: __dxlog_file3,
904
- L: 186,
904
+ L: 185,
905
905
  S: this,
906
906
  C: (f, a) => f(...a)
907
907
  });
@@ -911,7 +911,7 @@ var IdentityManager = class IdentityManager2 {
911
911
  deviceKey: identity.deviceKey
912
912
  }, {
913
913
  F: __dxlog_file3,
914
- L: 192,
914
+ L: 191,
915
915
  S: this,
916
916
  C: (f, a) => f(...a)
917
917
  });
@@ -923,7 +923,7 @@ var IdentityManager = class IdentityManager2 {
923
923
  async updateProfile(profile) {
924
924
  (0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
925
925
  F: __dxlog_file3,
926
- L: 200,
926
+ L: 199,
927
927
  S: this,
928
928
  A: [
929
929
  "this._identity",
@@ -948,11 +948,13 @@ var IdentityManager = class IdentityManager2 {
948
948
  receipt.seq
949
949
  ]
950
950
  ]));
951
+ this.stateUpdate.emit();
952
+ return profile;
951
953
  }
952
954
  async _constructIdentity(identityRecord) {
953
955
  (0, import_invariant2.invariant)(!this._identity, void 0, {
954
956
  F: __dxlog_file3,
955
- L: 214,
957
+ L: 216,
956
958
  S: this,
957
959
  A: [
958
960
  "!this._identity",
@@ -963,13 +965,13 @@ var IdentityManager = class IdentityManager2 {
963
965
  identityRecord
964
966
  }, {
965
967
  F: __dxlog_file3,
966
- L: 215,
968
+ L: 217,
967
969
  S: this,
968
970
  C: (f, a) => f(...a)
969
971
  });
970
972
  (0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
971
973
  F: __dxlog_file3,
972
- L: 218,
974
+ L: 220,
973
975
  S: this,
974
976
  A: [
975
977
  "identityRecord.haloSpace.controlFeedKey",
@@ -981,7 +983,7 @@ var IdentityManager = class IdentityManager2 {
981
983
  });
982
984
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
983
985
  F: __dxlog_file3,
984
- L: 222,
986
+ L: 224,
985
987
  S: this,
986
988
  A: [
987
989
  "identityRecord.haloSpace.dataFeedKey",
@@ -1013,7 +1015,7 @@ var IdentityManager = class IdentityManager2 {
1013
1015
  identityKey: identityRecord.identityKey
1014
1016
  }, {
1015
1017
  F: __dxlog_file3,
1016
- L: 246,
1018
+ L: 248,
1017
1019
  S: this,
1018
1020
  C: (f, a) => f(...a)
1019
1021
  });
@@ -1034,7 +1036,7 @@ var IdentityManager = class IdentityManager2 {
1034
1036
  onAuthFailure: () => {
1035
1037
  import_log3.log.warn("auth failure", void 0, {
1036
1038
  F: __dxlog_file3,
1037
- L: 265,
1039
+ L: 267,
1038
1040
  S: this,
1039
1041
  C: (f, a) => f(...a)
1040
1042
  });
@@ -1044,7 +1046,9 @@ var IdentityManager = class IdentityManager2 {
1044
1046
  }
1045
1047
  };
1046
1048
  _ts_decorate2([
1047
- import_tracing2.trace.span()
1049
+ import_tracing2.trace.span({
1050
+ showInBrowserTimeline: true
1051
+ })
1048
1052
  ], IdentityManager.prototype, "open", null);
1049
1053
  IdentityManager = _ts_decorate2([
1050
1054
  import_tracing2.trace.resource()
@@ -1055,7 +1059,7 @@ var import_codec_protobuf7 = require("@dxos/codec-protobuf");
1055
1059
  var import_credentials6 = require("@dxos/credentials");
1056
1060
  var import_debug2 = require("@dxos/debug");
1057
1061
  var import_invariant3 = require("@dxos/invariant");
1058
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1062
+ var __dxlog_file4 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1059
1063
  var IdentityServiceImpl = class {
1060
1064
  constructor(_createIdentity, _identityManager, _keyring) {
1061
1065
  this._createIdentity = _createIdentity;
@@ -1124,7 +1128,7 @@ var IdentityServiceImpl = class {
1124
1128
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
1125
1129
  var import_invariant4 = require("@dxos/invariant");
1126
1130
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
1127
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1131
+ var __dxlog_file5 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1128
1132
  var DeviceInvitationProtocol = class {
1129
1133
  constructor(_keyring, _getIdentity, _acceptIdentity) {
1130
1134
  this._keyring = _keyring;
@@ -1236,7 +1240,7 @@ var import_protocols3 = require("@dxos/protocols");
1236
1240
  var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
1237
1241
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
1238
1242
  var import_teleport = require("@dxos/teleport");
1239
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1243
+ var __dxlog_file6 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1240
1244
  var OPTIONS_TIMEOUT = 1e4;
1241
1245
  var MAX_OTP_ATTEMPTS = 3;
1242
1246
  var InvitationHostExtension = class extends import_teleport.RpcExtension {
@@ -1567,7 +1571,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1567
1571
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
1568
1572
 
1569
1573
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1570
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1574
+ var __dxlog_file7 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1571
1575
  var InvitationsHandler = class {
1572
1576
  /**
1573
1577
  * @internal
@@ -2126,7 +2130,7 @@ var import_codec_protobuf8 = require("@dxos/codec-protobuf");
2126
2130
  var import_invariant7 = require("@dxos/invariant");
2127
2131
  var import_log6 = require("@dxos/log");
2128
2132
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
2129
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
2133
+ var __dxlog_file8 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
2130
2134
  var InvitationsServiceImpl = class {
2131
2135
  constructor(_invitationsHandler, _getHandler) {
2132
2136
  this._invitationsHandler = _invitationsHandler;
@@ -2311,7 +2315,7 @@ var import_feed_store3 = require("@dxos/feed-store");
2311
2315
  var import_invariant8 = require("@dxos/invariant");
2312
2316
  var import_log7 = require("@dxos/log");
2313
2317
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
2314
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2318
+ var __dxlog_file9 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2315
2319
  var SpaceInvitationProtocol = class {
2316
2320
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
2317
2321
  this._spaceManager = _spaceManager;
@@ -2522,7 +2526,7 @@ var import_protocols5 = require("@dxos/protocols");
2522
2526
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2523
2527
 
2524
2528
  // packages/sdk/client-services/src/version.ts
2525
- var DXOS_VERSION = "0.1.57-main.e87098f";
2529
+ var DXOS_VERSION = "0.1.57";
2526
2530
 
2527
2531
  // packages/sdk/client-services/src/packlets/services/platform.ts
2528
2532
  var getPlatform = () => {
@@ -2553,7 +2557,7 @@ var getPlatform = () => {
2553
2557
  };
2554
2558
 
2555
2559
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2556
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2560
+ var __dxlog_file10 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2557
2561
  var DEFAULT_TIMEOUT = 1e3;
2558
2562
  var createDiagnostics = async (clientServices, serviceContext, config) => {
2559
2563
  const diagnostics = {
@@ -2684,8 +2688,8 @@ var import_log13 = require("@dxos/log");
2684
2688
  var import_protocols9 = require("@dxos/protocols");
2685
2689
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2686
2690
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2687
- var import_tracing3 = require("@dxos/tracing");
2688
- var import_util7 = require("@dxos/util");
2691
+ var import_tracing4 = require("@dxos/tracing");
2692
+ var import_util6 = require("@dxos/util");
2689
2693
 
2690
2694
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2691
2695
  var import_async12 = require("@dxos/async");
@@ -2711,6 +2715,7 @@ var import_log10 = require("@dxos/log");
2711
2715
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2712
2716
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2713
2717
  var import_timeframe2 = require("@dxos/timeframe");
2718
+ var import_tracing3 = require("@dxos/tracing");
2714
2719
  var import_util4 = require("@dxos/util");
2715
2720
 
2716
2721
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
@@ -2722,7 +2727,7 @@ var import_log9 = require("@dxos/log");
2722
2727
  var import_protocols6 = require("@dxos/protocols");
2723
2728
  var import_teleport2 = require("@dxos/teleport");
2724
2729
  var import_util3 = require("@dxos/util");
2725
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2730
+ var __dxlog_file11 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2726
2731
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2727
2732
  var DEFAULT_SUCCESS_DELAY = 1e3;
2728
2733
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2992,7 +2997,7 @@ function _ts_decorate3(decorators, target, key, desc) {
2992
2997
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2993
2998
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2994
2999
  }
2995
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3000
+ var __dxlog_file12 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2996
3001
  var ENABLE_FEED_PURGE = false;
2997
3002
  var DataSpace = class DataSpace2 {
2998
3003
  constructor(params) {
@@ -3021,6 +3026,14 @@ var DataSpace = class DataSpace2 {
3021
3026
  });
3022
3027
  this._cache = params.cache;
3023
3028
  this._state = params.initialState;
3029
+ (0, import_log10.log)("new state", {
3030
+ state: import_services7.SpaceState[this._state]
3031
+ }, {
3032
+ F: __dxlog_file12,
3033
+ L: 112,
3034
+ S: this,
3035
+ C: (f, a) => f(...a)
3036
+ });
3024
3037
  }
3025
3038
  get key() {
3026
3039
  return this._inner.key;
@@ -3055,6 +3068,14 @@ var DataSpace = class DataSpace2 {
3055
3068
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3056
3069
  await this._inner.open(new import_context7.Context());
3057
3070
  this._state = import_services7.SpaceState.CONTROL_ONLY;
3071
+ (0, import_log10.log)("new state", {
3072
+ state: import_services7.SpaceState[this._state]
3073
+ }, {
3074
+ F: __dxlog_file12,
3075
+ L: 158,
3076
+ S: this,
3077
+ C: (f, a) => f(...a)
3078
+ });
3058
3079
  this.stateUpdate.emit();
3059
3080
  this.metrics = {};
3060
3081
  this.metrics.open = /* @__PURE__ */ new Date();
@@ -3065,6 +3086,14 @@ var DataSpace = class DataSpace2 {
3065
3086
  async _close() {
3066
3087
  await this._callbacks.beforeClose?.();
3067
3088
  this._state = import_services7.SpaceState.CLOSED;
3089
+ (0, import_log10.log)("new state", {
3090
+ state: import_services7.SpaceState[this._state]
3091
+ }, {
3092
+ F: __dxlog_file12,
3093
+ L: 172,
3094
+ S: this,
3095
+ C: (f, a) => f(...a)
3096
+ });
3068
3097
  await this._ctx.dispose();
3069
3098
  this._ctx = new import_context7.Context();
3070
3099
  await this.authVerifier.close();
@@ -3091,7 +3120,7 @@ var DataSpace = class DataSpace2 {
3091
3120
  if (err instanceof import_errors3.CancelledError) {
3092
3121
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3093
3122
  F: __dxlog_file12,
3094
- L: 199,
3123
+ L: 203,
3095
3124
  S: this,
3096
3125
  C: (f, a) => f(...a)
3097
3126
  });
@@ -3099,11 +3128,19 @@ var DataSpace = class DataSpace2 {
3099
3128
  }
3100
3129
  import_log10.log.error("Error initializing data pipeline", err, {
3101
3130
  F: __dxlog_file12,
3102
- L: 203,
3131
+ L: 207,
3103
3132
  S: this,
3104
3133
  C: (f, a) => f(...a)
3105
3134
  });
3106
3135
  this._state = import_services7.SpaceState.ERROR;
3136
+ (0, import_log10.log)("new state", {
3137
+ state: import_services7.SpaceState[this._state]
3138
+ }, {
3139
+ F: __dxlog_file12,
3140
+ L: 209,
3141
+ S: this,
3142
+ C: (f, a) => f(...a)
3143
+ });
3107
3144
  this.error = err;
3108
3145
  this.stateUpdate.emit();
3109
3146
  } finally {
@@ -3116,32 +3153,22 @@ var DataSpace = class DataSpace2 {
3116
3153
  throw new import_errors3.SystemError("Invalid operation");
3117
3154
  }
3118
3155
  this._state = import_services7.SpaceState.INITIALIZING;
3119
- await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
3120
- ctx: this._ctx,
3121
- breakOnStall: false
3122
- });
3123
- this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
3124
- await this._createWritableFeeds();
3125
- (0, import_log10.log)("writable feeds created", void 0, {
3156
+ (0, import_log10.log)("new state", {
3157
+ state: import_services7.SpaceState[this._state]
3158
+ }, {
3126
3159
  F: __dxlog_file12,
3127
- L: 227,
3160
+ L: 225,
3128
3161
  S: this,
3129
3162
  C: (f, a) => f(...a)
3130
3163
  });
3131
- this.stateUpdate.emit();
3132
- if (!this.notarizationPlugin.hasWriter) {
3133
- this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
3134
- credential: {
3135
- credential
3136
- }
3137
- }), this._inner.controlPipeline.writer));
3138
- }
3164
+ await this._initializeAndReadControlPipeline();
3165
+ await (0, import_async11.sleep)(1);
3139
3166
  await this._inner.initializeDataPipeline();
3140
3167
  this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
3141
3168
  await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3142
3169
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3143
3170
  F: __dxlog_file12,
3144
- L: 248,
3171
+ L: 239,
3145
3172
  S: this,
3146
3173
  C: (f, a) => f(...a)
3147
3174
  });
@@ -3152,15 +3179,45 @@ var DataSpace = class DataSpace2 {
3152
3179
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3153
3180
  (0, import_log10.log)("data pipeline ready", void 0, {
3154
3181
  F: __dxlog_file12,
3155
- L: 257,
3182
+ L: 248,
3156
3183
  S: this,
3157
3184
  C: (f, a) => f(...a)
3158
3185
  });
3159
3186
  await this._callbacks.beforeReady?.();
3160
3187
  this._state = import_services7.SpaceState.READY;
3188
+ (0, import_log10.log)("new state", {
3189
+ state: import_services7.SpaceState[this._state]
3190
+ }, {
3191
+ F: __dxlog_file12,
3192
+ L: 252,
3193
+ S: this,
3194
+ C: (f, a) => f(...a)
3195
+ });
3161
3196
  this.stateUpdate.emit();
3162
3197
  await this._callbacks.afterReady?.();
3163
3198
  }
3199
+ async _initializeAndReadControlPipeline() {
3200
+ await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
3201
+ ctx: this._ctx,
3202
+ breakOnStall: false
3203
+ });
3204
+ this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
3205
+ await this._createWritableFeeds();
3206
+ (0, import_log10.log)("writable feeds created", void 0, {
3207
+ F: __dxlog_file12,
3208
+ L: 268,
3209
+ S: this,
3210
+ C: (f, a) => f(...a)
3211
+ });
3212
+ this.stateUpdate.emit();
3213
+ if (!this.notarizationPlugin.hasWriter) {
3214
+ this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
3215
+ credential: {
3216
+ credential
3217
+ }
3218
+ }), this._inner.controlPipeline.writer));
3219
+ }
3220
+ }
3164
3221
  async _createWritableFeeds() {
3165
3222
  const credentials = [];
3166
3223
  if (!this.inner.controlFeedKey) {
@@ -3202,8 +3259,8 @@ var DataSpace = class DataSpace2 {
3202
3259
  credentials,
3203
3260
  timeout: 0
3204
3261
  });
3262
+ await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
3205
3263
  }
3206
- await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
3207
3264
  }
3208
3265
  async createEpoch() {
3209
3266
  const epoch = await this.dataPipeline.createEpoch();
@@ -3249,6 +3306,14 @@ var DataSpace = class DataSpace2 {
3249
3306
  await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
3250
3307
  await this._close();
3251
3308
  this._state = import_services7.SpaceState.INACTIVE;
3309
+ (0, import_log10.log)("new state", {
3310
+ state: import_services7.SpaceState[this._state]
3311
+ }, {
3312
+ F: __dxlog_file12,
3313
+ L: 384,
3314
+ S: this,
3315
+ C: (f, a) => f(...a)
3316
+ });
3252
3317
  this.stateUpdate.emit();
3253
3318
  }
3254
3319
  };
@@ -3258,6 +3323,16 @@ _ts_decorate3([
3258
3323
  _ts_decorate3([
3259
3324
  import_async11.synchronized
3260
3325
  ], DataSpace.prototype, "close", null);
3326
+ _ts_decorate3([
3327
+ import_tracing3.trace.span({
3328
+ showInBrowserTimeline: true
3329
+ })
3330
+ ], DataSpace.prototype, "initializeDataPipeline", null);
3331
+ _ts_decorate3([
3332
+ import_tracing3.trace.span({
3333
+ showInBrowserTimeline: true
3334
+ })
3335
+ ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
3261
3336
  _ts_decorate3([
3262
3337
  (0, import_debug4.timed)(1e4)
3263
3338
  ], DataSpace.prototype, "_createWritableFeeds", null);
@@ -3351,7 +3426,7 @@ function _ts_decorate4(decorators, target, key, desc) {
3351
3426
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3352
3427
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3353
3428
  }
3354
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3429
+ var __dxlog_file13 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3355
3430
  var DataSpaceManager = class DataSpaceManager2 {
3356
3431
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
3357
3432
  this._spaceManager = _spaceManager;
@@ -3385,48 +3460,49 @@ var DataSpaceManager = class DataSpaceManager2 {
3385
3460
  S: this,
3386
3461
  C: (f, a) => f(...a)
3387
3462
  });
3388
- await this._metadataStore.load();
3389
3463
  (0, import_log11.log)("metadata loaded", {
3390
3464
  spaces: this._metadataStore.spaces.length
3391
3465
  }, {
3392
3466
  F: __dxlog_file13,
3393
- L: 82,
3467
+ L: 81,
3394
3468
  S: this,
3395
3469
  C: (f, a) => f(...a)
3396
3470
  });
3397
- for (const spaceMetadata of this._metadataStore.spaces) {
3471
+ await (0, import_util5.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3398
3472
  try {
3399
3473
  (0, import_log11.log)("load space", {
3400
3474
  spaceMetadata
3401
3475
  }, {
3402
3476
  F: __dxlog_file13,
3403
- L: 86,
3477
+ L: 85,
3404
3478
  S: this,
3405
3479
  C: (f, a) => f(...a)
3406
3480
  });
3407
- const space = await this._constructSpace(spaceMetadata);
3408
- if (spaceMetadata.state !== import_services8.SpaceState.INACTIVE) {
3409
- space.initializeDataPipelineAsync();
3410
- }
3481
+ await this._constructSpace(spaceMetadata);
3411
3482
  } catch (err) {
3412
3483
  import_log11.log.error("Error loading space", {
3413
3484
  spaceMetadata,
3414
3485
  err
3415
3486
  }, {
3416
3487
  F: __dxlog_file13,
3417
- L: 92,
3488
+ L: 88,
3418
3489
  S: this,
3419
3490
  C: (f, a) => f(...a)
3420
3491
  });
3421
3492
  }
3422
- }
3493
+ });
3423
3494
  this._isOpen = true;
3424
3495
  this.updated.emit();
3496
+ for (const space of this._spaces.values()) {
3497
+ if (space.state !== import_services8.SpaceState.INACTIVE) {
3498
+ space.initializeDataPipelineAsync();
3499
+ }
3500
+ }
3425
3501
  import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3426
3502
  id: this._instanceId
3427
3503
  }), {
3428
3504
  F: __dxlog_file13,
3429
- L: 98,
3505
+ L: 101,
3430
3506
  S: this,
3431
3507
  C: (f, a) => f(...a)
3432
3508
  });
@@ -3434,7 +3510,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3434
3510
  async close() {
3435
3511
  (0, import_log11.log)("close", void 0, {
3436
3512
  F: __dxlog_file13,
3437
- L: 103,
3513
+ L: 106,
3438
3514
  S: this,
3439
3515
  C: (f, a) => f(...a)
3440
3516
  });
@@ -3450,7 +3526,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3450
3526
  async createSpace() {
3451
3527
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3452
3528
  F: __dxlog_file13,
3453
- L: 116,
3529
+ L: 119,
3454
3530
  S: this,
3455
3531
  A: [
3456
3532
  "this._isOpen",
@@ -3471,7 +3547,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3471
3547
  spaceKey
3472
3548
  }, {
3473
3549
  F: __dxlog_file13,
3474
- L: 128,
3550
+ L: 131,
3475
3551
  S: this,
3476
3552
  C: (f, a) => f(...a)
3477
3553
  });
@@ -3481,7 +3557,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3481
3557
  const memberCredential = credentials[1];
3482
3558
  (0, import_invariant11.invariant)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3483
3559
  F: __dxlog_file13,
3484
- L: 135,
3560
+ L: 138,
3485
3561
  S: this,
3486
3562
  A: [
3487
3563
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3499,13 +3575,13 @@ var DataSpaceManager = class DataSpaceManager2 {
3499
3575
  opts
3500
3576
  }, {
3501
3577
  F: __dxlog_file13,
3502
- L: 147,
3578
+ L: 150,
3503
3579
  S: this,
3504
3580
  C: (f, a) => f(...a)
3505
3581
  });
3506
3582
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3507
3583
  F: __dxlog_file13,
3508
- L: 148,
3584
+ L: 151,
3509
3585
  S: this,
3510
3586
  A: [
3511
3587
  "this._isOpen",
@@ -3514,7 +3590,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3514
3590
  });
3515
3591
  (0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3516
3592
  F: __dxlog_file13,
3517
- L: 149,
3593
+ L: 152,
3518
3594
  S: this,
3519
3595
  A: [
3520
3596
  "!this._spaces.has(opts.spaceKey)",
@@ -3549,7 +3625,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3549
3625
  metadata
3550
3626
  }, {
3551
3627
  F: __dxlog_file13,
3552
- L: 182,
3628
+ L: 185,
3553
3629
  S: this,
3554
3630
  C: (f, a) => f(...a)
3555
3631
  });
@@ -3585,7 +3661,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3585
3661
  onAuthFailure: () => {
3586
3662
  import_log11.log.warn("auth failure", void 0, {
3587
3663
  F: __dxlog_file13,
3588
- L: 217,
3664
+ L: 220,
3589
3665
  S: this,
3590
3666
  C: (f, a) => f(...a)
3591
3667
  });
@@ -3609,7 +3685,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3609
3685
  space: space.key
3610
3686
  }, {
3611
3687
  F: __dxlog_file13,
3612
- L: 235,
3688
+ L: 238,
3613
3689
  S: this,
3614
3690
  C: (f, a) => f(...a)
3615
3691
  });
@@ -3621,7 +3697,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3621
3697
  open: this._isOpen
3622
3698
  }, {
3623
3699
  F: __dxlog_file13,
3624
- L: 242,
3700
+ L: 245,
3625
3701
  S: this,
3626
3702
  C: (f, a) => f(...a)
3627
3703
  });
@@ -3634,7 +3710,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3634
3710
  space: space.key
3635
3711
  }, {
3636
3712
  F: __dxlog_file13,
3637
- L: 248,
3713
+ L: 251,
3638
3714
  S: this,
3639
3715
  C: (f, a) => f(...a)
3640
3716
  });
@@ -3681,8 +3757,7 @@ var import_errors4 = require("@dxos/errors");
3681
3757
  var import_log12 = require("@dxos/log");
3682
3758
  var import_protocols8 = require("@dxos/protocols");
3683
3759
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3684
- var import_util6 = require("@dxos/util");
3685
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3760
+ var __dxlog_file14 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3686
3761
  var SpacesServiceImpl = class {
3687
3762
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
3688
3763
  this._identityManager = _identityManager;
@@ -3740,7 +3815,7 @@ var SpacesServiceImpl = class {
3740
3815
  const subscribeSpaces = () => {
3741
3816
  subscriptions.clear();
3742
3817
  for (const space of dataSpaceManager.spaces.values()) {
3743
- subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
3818
+ subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3744
3819
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3745
3820
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3746
3821
  space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
@@ -3835,7 +3910,7 @@ var SpacesServiceImpl = class {
3835
3910
  identity: {
3836
3911
  identityKey: member.key,
3837
3912
  profile: {
3838
- displayName: member.assertion.profile?.displayName ?? (0, import_util6.humanize)(member.key)
3913
+ displayName: member.assertion.profile?.displayName
3839
3914
  }
3840
3915
  },
3841
3916
  presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
@@ -3861,7 +3936,7 @@ function _ts_decorate5(decorators, target, key, desc) {
3861
3936
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3862
3937
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3863
3938
  }
3864
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3939
+ var __dxlog_file15 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/service-context.ts";
3865
3940
  var ServiceContext = class ServiceContext2 {
3866
3941
  // prettier-ignore
3867
3942
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3917,6 +3992,7 @@ var ServiceContext = class ServiceContext2 {
3917
3992
  });
3918
3993
  await this.signalManager.open();
3919
3994
  await this.networkManager.open();
3995
+ await this.metadataStore.load();
3920
3996
  await this.spaceManager.open();
3921
3997
  await this.identityManager.open(ctx);
3922
3998
  if (this.identityManager.identity) {
@@ -3926,13 +4002,13 @@ var ServiceContext = class ServiceContext2 {
3926
4002
  id: this._instanceId
3927
4003
  }), {
3928
4004
  F: __dxlog_file15,
3929
- L: 144,
4005
+ L: 146,
3930
4006
  S: this,
3931
4007
  C: (f, a) => f(...a)
3932
4008
  });
3933
4009
  (0, import_log13.log)("opened", void 0, {
3934
4010
  F: __dxlog_file15,
3935
- L: 145,
4011
+ L: 147,
3936
4012
  S: this,
3937
4013
  C: (f, a) => f(...a)
3938
4014
  });
@@ -3940,7 +4016,7 @@ var ServiceContext = class ServiceContext2 {
3940
4016
  async close() {
3941
4017
  (0, import_log13.log)("closing...", void 0, {
3942
4018
  F: __dxlog_file15,
3943
- L: 149,
4019
+ L: 151,
3944
4020
  S: this,
3945
4021
  C: (f, a) => f(...a)
3946
4022
  });
@@ -3954,9 +4030,10 @@ var ServiceContext = class ServiceContext2 {
3954
4030
  await this.networkManager.close();
3955
4031
  await this.signalManager.close();
3956
4032
  this.dataServiceSubscriptions.clear();
4033
+ await this.metadataStore.close();
3957
4034
  (0, import_log13.log)("closed", void 0, {
3958
4035
  F: __dxlog_file15,
3959
- L: 160,
4036
+ L: 163,
3960
4037
  S: this,
3961
4038
  C: (f, a) => f(...a)
3962
4039
  });
@@ -3970,7 +4047,7 @@ var ServiceContext = class ServiceContext2 {
3970
4047
  const factory = this._handlerFactories.get(invitation.kind);
3971
4048
  (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3972
4049
  F: __dxlog_file15,
3973
- L: 171,
4050
+ L: 174,
3974
4051
  S: this,
3975
4052
  A: [
3976
4053
  "factory",
@@ -3994,7 +4071,7 @@ var ServiceContext = class ServiceContext2 {
3994
4071
  async _initialize(ctx) {
3995
4072
  (0, import_log13.log)("initializing spaces...", void 0, {
3996
4073
  F: __dxlog_file15,
3997
- L: 192,
4074
+ L: 195,
3998
4075
  S: this,
3999
4076
  C: (f, a) => f(...a)
4000
4077
  });
@@ -4017,7 +4094,7 @@ var ServiceContext = class ServiceContext2 {
4017
4094
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4018
4095
  (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4019
4096
  F: __dxlog_file15,
4020
- L: 215,
4097
+ L: 218,
4021
4098
  S: this,
4022
4099
  A: [
4023
4100
  "this.dataSpaceManager",
@@ -4041,7 +4118,7 @@ var ServiceContext = class ServiceContext2 {
4041
4118
  details: assertion
4042
4119
  }, {
4043
4120
  F: __dxlog_file15,
4044
- L: 231,
4121
+ L: 234,
4045
4122
  S: this,
4046
4123
  C: (f, a) => f(...a)
4047
4124
  });
@@ -4052,7 +4129,7 @@ var ServiceContext = class ServiceContext2 {
4052
4129
  details: assertion
4053
4130
  }, {
4054
4131
  F: __dxlog_file15,
4055
- L: 235,
4132
+ L: 238,
4056
4133
  S: this,
4057
4134
  C: (f, a) => f(...a)
4058
4135
  });
@@ -4063,7 +4140,7 @@ var ServiceContext = class ServiceContext2 {
4063
4140
  details: assertion
4064
4141
  }, {
4065
4142
  F: __dxlog_file15,
4066
- L: 240,
4143
+ L: 243,
4067
4144
  S: this,
4068
4145
  C: (f, a) => f(...a)
4069
4146
  });
@@ -4074,7 +4151,7 @@ var ServiceContext = class ServiceContext2 {
4074
4151
  } catch (err) {
4075
4152
  import_log13.log.catch(err, void 0, {
4076
4153
  F: __dxlog_file15,
4077
- L: 246,
4154
+ L: 249,
4078
4155
  S: this,
4079
4156
  C: (f, a) => f(...a)
4080
4157
  });
@@ -4085,14 +4162,14 @@ var ServiceContext = class ServiceContext2 {
4085
4162
  }
4086
4163
  };
4087
4164
  _ts_decorate5([
4088
- import_tracing3.trace.span()
4165
+ import_tracing4.trace.span()
4089
4166
  ], ServiceContext.prototype, "open", null);
4090
4167
  _ts_decorate5([
4091
- import_tracing3.trace.span()
4168
+ import_tracing4.trace.span()
4092
4169
  ], ServiceContext.prototype, "_initialize", null);
4093
4170
  ServiceContext = _ts_decorate5([
4094
- (0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
4095
- import_tracing3.trace.resource()
4171
+ (0, import_util6.safeInstanceof)("dxos.client-services.ServiceContext"),
4172
+ import_tracing4.trace.resource()
4096
4173
  ], ServiceContext);
4097
4174
 
4098
4175
  // packages/sdk/client-services/src/packlets/services/service-host.ts
@@ -4110,7 +4187,8 @@ var import_network_manager2 = require("@dxos/network-manager");
4110
4187
  var import_protocols10 = require("@dxos/protocols");
4111
4188
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4112
4189
  var import_text_model = require("@dxos/text-model");
4113
- var import_tracing4 = require("@dxos/tracing");
4190
+ var import_tracing5 = require("@dxos/tracing");
4191
+ var import_websocket_rpc = require("@dxos/websocket-rpc");
4114
4192
 
4115
4193
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4116
4194
  var import_async15 = require("@dxos/async");
@@ -4169,7 +4247,7 @@ function _ts_decorate6(decorators, target, key, desc) {
4169
4247
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4170
4248
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4171
4249
  }
4172
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
4250
+ var __dxlog_file16 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/locks/node.ts";
4173
4251
  var Lock = class {
4174
4252
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
4175
4253
  this._lockPath = lockPath;
@@ -4219,7 +4297,7 @@ var import_async16 = require("@dxos/async");
4219
4297
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4220
4298
  var import_log15 = require("@dxos/log");
4221
4299
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4222
- var import_util8 = require("@dxos/util");
4300
+ var import_util7 = require("@dxos/util");
4223
4301
  var LoggingServiceImpl = class {
4224
4302
  constructor() {
4225
4303
  this._logs = new import_async16.Event();
@@ -4237,15 +4315,15 @@ var LoggingServiceImpl = class {
4237
4315
  }
4238
4316
  async controlMetrics({ reset, record }) {
4239
4317
  if (reset) {
4240
- import_util8.tracer.clear();
4318
+ import_util7.tracer.clear();
4241
4319
  }
4242
4320
  if (record === true) {
4243
- import_util8.tracer.start();
4321
+ import_util7.tracer.start();
4244
4322
  } else if (record === false) {
4245
- import_util8.tracer.stop();
4323
+ import_util7.tracer.stop();
4246
4324
  }
4247
4325
  return {
4248
- recording: import_util8.tracer.recording
4326
+ recording: import_util7.tracer.recording
4249
4327
  };
4250
4328
  }
4251
4329
  /**
@@ -4253,10 +4331,10 @@ var LoggingServiceImpl = class {
4253
4331
  */
4254
4332
  queryMetrics({ interval = 5e3 }) {
4255
4333
  const getNumericalValues = (key) => {
4256
- const events = import_util8.tracer.get(key) ?? [];
4334
+ const events = import_util7.tracer.get(key) ?? [];
4257
4335
  return {
4258
4336
  key,
4259
- stats: (0, import_util8.numericalValues)(events, "duration")
4337
+ stats: (0, import_util7.numericalValues)(events, "duration")
4260
4338
  };
4261
4339
  };
4262
4340
  return new import_codec_protobuf13.Stream(({ next }) => {
@@ -4294,7 +4372,7 @@ var LoggingServiceImpl = class {
4294
4372
  }
4295
4373
  const record = {
4296
4374
  ...entry2,
4297
- context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4375
+ context: (0, import_util7.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4298
4376
  timestamp: /* @__PURE__ */ new Date(),
4299
4377
  meta: {
4300
4378
  // TODO(dmaretskyi): Fix proto.
@@ -4368,10 +4446,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
4368
4446
  var import_errors5 = require("@dxos/errors");
4369
4447
  var import_config = require("@dxos/protocols/proto/dxos/config");
4370
4448
  var import_random_access_storage = require("@dxos/random-access-storage");
4371
- var import_util9 = require("@dxos/util");
4449
+ var import_util8 = require("@dxos/util");
4372
4450
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4373
4451
  var createStorageObjects = (config) => {
4374
- const { path = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4452
+ const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4375
4453
  if (persistent && storageType === StorageDriver.RAM) {
4376
4454
  throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4377
4455
  }
@@ -4415,7 +4493,7 @@ var toStorageType = (type) => {
4415
4493
  // packages/sdk/client-services/src/packlets/system/system-service.ts
4416
4494
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
4417
4495
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
4418
- var import_util10 = require("@dxos/util");
4496
+ var import_util9 = require("@dxos/util");
4419
4497
  var SystemServiceImpl = class {
4420
4498
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
4421
4499
  this._config = config;
@@ -4435,7 +4513,7 @@ var SystemServiceImpl = class {
4435
4513
  const diagnostics = await this._getDiagnostics();
4436
4514
  return {
4437
4515
  timestamp: /* @__PURE__ */ new Date(),
4438
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4516
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util9.jsonKeyReplacer)({
4439
4517
  truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4440
4518
  humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4441
4519
  })))
@@ -4501,7 +4579,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4501
4579
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4502
4580
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4503
4581
  }
4504
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4582
+ var __dxlog_file17 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/service-host.ts";
4505
4583
  var createDefaultModelFactory = () => {
4506
4584
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4507
4585
  };
@@ -4516,7 +4594,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4516
4594
  lockKey,
4517
4595
  callbacks
4518
4596
  } = {}) {
4519
- this._tracingService = import_tracing4.TRACE_PROCESSOR.createTraceSender();
4597
+ this._tracingService = import_tracing5.TRACE_PROCESSOR.createTraceSender();
4520
4598
  this._statusUpdate = new import_async17.Event();
4521
4599
  this._opening = false;
4522
4600
  this._open = false;
@@ -4591,7 +4669,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4591
4669
  initialize({ config, ...options }) {
4592
4670
  (0, import_invariant14.invariant)(!this._open, "service host is open", {
4593
4671
  F: __dxlog_file17,
4594
- L: 181,
4672
+ L: 184,
4595
4673
  S: this,
4596
4674
  A: [
4597
4675
  "!this._open",
@@ -4600,14 +4678,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4600
4678
  });
4601
4679
  (0, import_log16.log)("initializing...", void 0, {
4602
4680
  F: __dxlog_file17,
4603
- L: 182,
4681
+ L: 185,
4604
4682
  S: this,
4605
4683
  C: (f, a) => f(...a)
4606
4684
  });
4607
4685
  if (config) {
4608
4686
  (0, import_invariant14.invariant)(!this._config, "config already set", {
4609
4687
  F: __dxlog_file17,
4610
- L: 185,
4688
+ L: 188,
4611
4689
  S: this,
4612
4690
  A: [
4613
4691
  "!this._config",
@@ -4619,13 +4697,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4619
4697
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
4620
4698
  }
4621
4699
  }
4622
- const { connectionLog = true, transportFactory = (0, import_network_manager2.createWebRTCTransportFactory)({
4700
+ const { connectionLog = true, transportFactory = (0, import_network_manager2.createSimplePeerTransportFactory)({
4623
4701
  iceServers: this._config?.get("runtime.services.ice")
4624
4702
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4625
4703
  this._signalManager = signalManager;
4626
4704
  (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4627
4705
  F: __dxlog_file17,
4628
- L: 201,
4706
+ L: 204,
4629
4707
  S: this,
4630
4708
  A: [
4631
4709
  "!this._networkManager",
@@ -4639,7 +4717,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4639
4717
  });
4640
4718
  (0, import_log16.log)("initialized", void 0, {
4641
4719
  F: __dxlog_file17,
4642
- L: 208,
4720
+ L: 211,
4643
4721
  S: this,
4644
4722
  C: (f, a) => f(...a)
4645
4723
  });
@@ -4653,13 +4731,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4653
4731
  id: traceId
4654
4732
  }), {
4655
4733
  F: __dxlog_file17,
4656
- L: 219,
4734
+ L: 222,
4657
4735
  S: this,
4658
4736
  C: (f, a) => f(...a)
4659
4737
  });
4660
4738
  (0, import_invariant14.invariant)(this._config, "config not set", {
4661
4739
  F: __dxlog_file17,
4662
- L: 221,
4740
+ L: 224,
4663
4741
  S: this,
4664
4742
  A: [
4665
4743
  "this._config",
@@ -4668,7 +4746,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4668
4746
  });
4669
4747
  (0, import_invariant14.invariant)(this._storage, "storage not set", {
4670
4748
  F: __dxlog_file17,
4671
- L: 222,
4749
+ L: 225,
4672
4750
  S: this,
4673
4751
  A: [
4674
4752
  "this._storage",
@@ -4677,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4677
4755
  });
4678
4756
  (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4679
4757
  F: __dxlog_file17,
4680
- L: 223,
4758
+ L: 226,
4681
4759
  S: this,
4682
4760
  A: [
4683
4761
  "this._signalManager",
@@ -4686,7 +4764,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4686
4764
  });
4687
4765
  (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4688
4766
  F: __dxlog_file17,
4689
- L: 224,
4767
+ L: 227,
4690
4768
  S: this,
4691
4769
  A: [
4692
4770
  "this._networkManager",
@@ -4698,7 +4776,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4698
4776
  lockKey: this._resourceLock?.lockKey
4699
4777
  }, {
4700
4778
  F: __dxlog_file17,
4701
- L: 227,
4779
+ L: 230,
4702
4780
  S: this,
4703
4781
  C: (f, a) => f(...a)
4704
4782
  });
@@ -4726,6 +4804,16 @@ var ClientServicesHost = class ClientServicesHost2 {
4726
4804
  })
4727
4805
  });
4728
4806
  await this._serviceContext.open(ctx);
4807
+ const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
4808
+ if (devtoolsProxy) {
4809
+ this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
4810
+ url: devtoolsProxy,
4811
+ requested: {},
4812
+ exposed: import_client_protocol5.clientServiceBundle,
4813
+ handlers: this.services
4814
+ });
4815
+ void this._devtoolsProxy.open();
4816
+ }
4729
4817
  this._opening = false;
4730
4818
  this._open = true;
4731
4819
  this._statusUpdate.emit();
@@ -4734,7 +4822,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4734
4822
  deviceKey
4735
4823
  }, {
4736
4824
  F: __dxlog_file17,
4737
- L: 284,
4825
+ L: 299,
4738
4826
  S: this,
4739
4827
  C: (f, a) => f(...a)
4740
4828
  });
@@ -4742,7 +4830,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4742
4830
  id: traceId
4743
4831
  }), {
4744
4832
  F: __dxlog_file17,
4745
- L: 285,
4833
+ L: 300,
4746
4834
  S: this,
4747
4835
  C: (f, a) => f(...a)
4748
4836
  });
@@ -4756,10 +4844,11 @@ var ClientServicesHost = class ClientServicesHost2 {
4756
4844
  deviceKey
4757
4845
  }, {
4758
4846
  F: __dxlog_file17,
4759
- L: 296,
4847
+ L: 311,
4760
4848
  S: this,
4761
4849
  C: (f, a) => f(...a)
4762
4850
  });
4851
+ await this._devtoolsProxy?.close();
4763
4852
  this._serviceRegistry.setServices({
4764
4853
  SystemService: this._systemService
4765
4854
  });
@@ -4771,7 +4860,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4771
4860
  deviceKey
4772
4861
  }, {
4773
4862
  F: __dxlog_file17,
4774
- L: 302,
4863
+ L: 318,
4775
4864
  S: this,
4776
4865
  C: (f, a) => f(...a)
4777
4866
  });
@@ -4782,13 +4871,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4782
4871
  id: traceId
4783
4872
  }), {
4784
4873
  F: __dxlog_file17,
4785
- L: 307,
4874
+ L: 323,
4786
4875
  S: this,
4787
4876
  C: (f, a) => f(...a)
4788
4877
  });
4789
4878
  (0, import_log16.log)("resetting...", void 0, {
4790
4879
  F: __dxlog_file17,
4791
- L: 309,
4880
+ L: 325,
4792
4881
  S: this,
4793
4882
  C: (f, a) => f(...a)
4794
4883
  });
@@ -4796,7 +4885,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4796
4885
  await this._storage.reset();
4797
4886
  (0, import_log16.log)("reset", void 0, {
4798
4887
  F: __dxlog_file17,
4799
- L: 312,
4888
+ L: 328,
4800
4889
  S: this,
4801
4890
  C: (f, a) => f(...a)
4802
4891
  });
@@ -4804,7 +4893,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4804
4893
  id: traceId
4805
4894
  }), {
4806
4895
  F: __dxlog_file17,
4807
- L: 313,
4896
+ L: 329,
4808
4897
  S: this,
4809
4898
  C: (f, a) => f(...a)
4810
4899
  });
@@ -4812,21 +4901,21 @@ var ClientServicesHost = class ClientServicesHost2 {
4812
4901
  }
4813
4902
  };
4814
4903
  _ts_decorate7([
4815
- import_tracing4.trace.info()
4904
+ import_tracing5.trace.info()
4816
4905
  ], ClientServicesHost.prototype, "_opening", void 0);
4817
4906
  _ts_decorate7([
4818
- import_tracing4.trace.info()
4907
+ import_tracing5.trace.info()
4819
4908
  ], ClientServicesHost.prototype, "_open", void 0);
4820
4909
  _ts_decorate7([
4821
4910
  import_async17.synchronized,
4822
- import_tracing4.trace.span()
4911
+ import_tracing5.trace.span()
4823
4912
  ], ClientServicesHost.prototype, "open", null);
4824
4913
  _ts_decorate7([
4825
4914
  import_async17.synchronized,
4826
- import_tracing4.trace.span()
4915
+ import_tracing5.trace.span()
4827
4916
  ], ClientServicesHost.prototype, "close", null);
4828
4917
  ClientServicesHost = _ts_decorate7([
4829
- import_tracing4.trace.resource()
4918
+ import_tracing5.trace.resource()
4830
4919
  ], ClientServicesHost);
4831
4920
 
4832
4921
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
@@ -4836,7 +4925,7 @@ var import_context11 = require("@dxos/context");
4836
4925
  var import_log17 = require("@dxos/log");
4837
4926
  var import_messaging2 = require("@dxos/messaging");
4838
4927
  var import_network_manager3 = require("@dxos/network-manager");
4839
- var import_util11 = require("@dxos/util");
4928
+ var import_util10 = require("@dxos/util");
4840
4929
 
4841
4930
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4842
4931
  var import_async18 = require("@dxos/async");
@@ -4844,7 +4933,7 @@ var import_client_protocol6 = require("@dxos/client-protocol");
4844
4933
  var import_invariant15 = require("@dxos/invariant");
4845
4934
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
4846
4935
  var import_rpc2 = require("@dxos/rpc");
4847
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
4936
+ var __dxlog_file18 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
4848
4937
  var ShellRuntimeImpl = class {
4849
4938
  constructor(_port) {
4850
4939
  this._port = _port;
@@ -4916,7 +5005,7 @@ function _ts_decorate8(decorators, target, key, desc) {
4916
5005
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4917
5006
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4918
5007
  }
4919
- var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
5008
+ var __dxlog_file19 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
4920
5009
  var LOCK_KEY = "DXOS_RESOURCE_LOCK";
4921
5010
  var IFrameHostRuntime = class {
4922
5011
  constructor({ config, origin, appPort, shellPort }) {
@@ -4943,8 +5032,8 @@ var IFrameHostRuntime = class {
4943
5032
  C: (f, a) => f(...a)
4944
5033
  });
4945
5034
  try {
4946
- this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
4947
- this._transportFactory = (0, import_network_manager3.createWebRTCTransportFactory)({
5035
+ this._config = await (0, import_util10.getAsyncValue)(this._configProvider);
5036
+ this._transportFactory = (0, import_network_manager3.createSimplePeerTransportFactory)({
4948
5037
  iceServers: this._config.get("runtime.services.ice")
4949
5038
  });
4950
5039
  const signals = this._config.get("runtime.services.signaling");
@@ -5030,8 +5119,8 @@ var import_errors6 = require("@dxos/errors");
5030
5119
  var import_log18 = require("@dxos/log");
5031
5120
  var import_network_manager4 = require("@dxos/network-manager");
5032
5121
  var import_rpc3 = require("@dxos/rpc");
5033
- var import_util12 = require("@dxos/util");
5034
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
5122
+ var import_util11 = require("@dxos/util");
5123
+ var __dxlog_file20 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
5035
5124
  var IFrameProxyRuntime = class {
5036
5125
  constructor({ config, systemPort, shellPort }) {
5037
5126
  this._id = String(Math.floor(Math.random() * 1e6));
@@ -5047,8 +5136,8 @@ var IFrameProxyRuntime = class {
5047
5136
  return this._shellRuntime;
5048
5137
  }
5049
5138
  async open(origin) {
5050
- this._config = await (0, import_util12.getAsyncValue)(this._configProvider);
5051
- this._transportService = new import_network_manager4.WebRTCTransportService({
5139
+ this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
5140
+ this._transportService = new import_network_manager4.SimplePeerTransportService({
5052
5141
  iceServers: this._config.get("runtime.services.ice")
5053
5142
  });
5054
5143
  this._systemRpc = (0, import_rpc3.createProtoRpcPeer)({
@@ -5112,7 +5201,7 @@ var import_client_protocol9 = require("@dxos/client-protocol");
5112
5201
  var import_invariant16 = require("@dxos/invariant");
5113
5202
  var import_log19 = require("@dxos/log");
5114
5203
  var import_rpc4 = require("@dxos/rpc");
5115
- var import_util13 = require("@dxos/util");
5204
+ var import_util12 = require("@dxos/util");
5116
5205
  function _ts_decorate9(decorators, target, key, desc) {
5117
5206
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5118
5207
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -5123,11 +5212,11 @@ function _ts_decorate9(decorators, target, key, desc) {
5123
5212
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5124
5213
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5125
5214
  }
5126
- var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
5215
+ var __dxlog_file21 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
5127
5216
  var WorkerSession = class {
5128
5217
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
5129
5218
  this._startTrigger = new import_async21.Trigger();
5130
- this.onClose = new import_util13.Callback();
5219
+ this.onClose = new import_util12.Callback();
5131
5220
  (0, import_invariant16.invariant)(serviceHost, void 0, {
5132
5221
  F: __dxlog_file21,
5133
5222
  L: 49,
@@ -5277,14 +5366,14 @@ _ts_decorate9([
5277
5366
  ], WorkerSession.prototype, "lockKey", void 0);
5278
5367
 
5279
5368
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
5280
- var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
5369
+ var __dxlog_file22 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
5281
5370
  var WorkerRuntime = class {
5282
5371
  // prettier-ignore
5283
5372
  constructor(_configProvider) {
5284
5373
  this._configProvider = _configProvider;
5285
- this._transportFactory = new import_network_manager5.WebRTCTransportProxyFactory();
5374
+ this._transportFactory = new import_network_manager5.SimplePeerTransportProxyFactory();
5286
5375
  this._ready = new import_async22.Trigger();
5287
- this.sessions = /* @__PURE__ */ new Set();
5376
+ this._sessions = /* @__PURE__ */ new Set();
5288
5377
  this._clientServices = new ClientServicesHost({
5289
5378
  callbacks: {
5290
5379
  onReset: async () => {
@@ -5344,11 +5433,11 @@ var WorkerRuntime = class {
5344
5433
  readySignal: this._ready
5345
5434
  });
5346
5435
  session.onClose.set(async () => {
5347
- this.sessions.delete(session);
5436
+ this._sessions.delete(session);
5348
5437
  this._reconnectWebrtc();
5349
5438
  });
5350
5439
  await session.open();
5351
- this.sessions.add(session);
5440
+ this._sessions.add(session);
5352
5441
  this._reconnectWebrtc();
5353
5442
  }
5354
5443
  /**
@@ -5362,12 +5451,12 @@ var WorkerRuntime = class {
5362
5451
  C: (f, a) => f(...a)
5363
5452
  });
5364
5453
  if (this._sessionForNetworking) {
5365
- if (!this.sessions.has(this._sessionForNetworking)) {
5454
+ if (!this._sessions.has(this._sessionForNetworking)) {
5366
5455
  this._sessionForNetworking = void 0;
5367
5456
  }
5368
5457
  }
5369
5458
  if (!this._sessionForNetworking) {
5370
- const selected = Array.from(this.sessions).find((session) => session.bridgeService);
5459
+ const selected = Array.from(this._sessions).find((session) => session.bridgeService);
5371
5460
  if (selected) {
5372
5461
  this._sessionForNetworking = selected;
5373
5462
  this._transportFactory.setBridgeService(selected.bridgeService);