@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
@@ -71,7 +71,7 @@ var import_protocols = require("@dxos/protocols");
71
71
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
72
72
 
73
73
  // packages/sdk/client-services/src/version.ts
74
- var DXOS_VERSION = "0.1.57-main.e87098f";
74
+ var DXOS_VERSION = "0.1.57";
75
75
 
76
76
  // packages/sdk/client-services/src/packlets/services/platform.ts
77
77
  var getPlatform = () => {
@@ -102,7 +102,7 @@ var getPlatform = () => {
102
102
  };
103
103
 
104
104
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
105
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
105
+ var __dxlog_file = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
106
106
  var DEFAULT_TIMEOUT = 1e3;
107
107
  var createDiagnostics = async (clientServices, serviceContext, config) => {
108
108
  const diagnostics = {
@@ -233,8 +233,8 @@ var import_log13 = require("@dxos/log");
233
233
  var import_protocols9 = require("@dxos/protocols");
234
234
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
235
235
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
236
- var import_tracing3 = require("@dxos/tracing");
237
- var import_util6 = require("@dxos/util");
236
+ var import_tracing4 = require("@dxos/tracing");
237
+ var import_util5 = require("@dxos/util");
238
238
 
239
239
  // packages/sdk/client-services/src/packlets/identity/authenticator.ts
240
240
  var import_async = require("@dxos/async");
@@ -242,7 +242,7 @@ var import_context = require("@dxos/context");
242
242
  var import_credentials3 = require("@dxos/credentials");
243
243
  var import_log2 = require("@dxos/log");
244
244
  var import_protocols2 = require("@dxos/protocols");
245
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
245
+ var __dxlog_file2 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
246
246
  var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
247
247
  var createAuthProvider = (signer) => async (nonce) => {
248
248
  const credential = await signer.createCredential({
@@ -372,7 +372,7 @@ function _ts_decorate(decorators, target, key, desc) {
372
372
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
373
373
  return c > 3 && r && Object.defineProperty(target, key, r), r;
374
374
  }
375
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
375
+ var __dxlog_file3 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity.ts";
376
376
  var Identity = class Identity2 {
377
377
  constructor({ space, signer, identityKey, deviceKey }) {
378
378
  this.stateUpdate = new import_async2.Event();
@@ -545,7 +545,7 @@ function _ts_decorate2(decorators, target, key, desc) {
545
545
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
546
546
  return c > 3 && r && Object.defineProperty(target, key, r), r;
547
547
  }
548
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
548
+ var __dxlog_file4 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
549
549
  var IdentityManager = class IdentityManager2 {
550
550
  // TODO(burdon): IdentityManagerParams.
551
551
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
@@ -569,13 +569,12 @@ var IdentityManager = class IdentityManager2 {
569
569
  S: this,
570
570
  C: (f, a) => f(...a)
571
571
  });
572
- await this._metadataStore.load();
573
572
  const identityRecord = this._metadataStore.getIdentityRecord();
574
573
  (0, import_log4.log)("identity record", {
575
574
  identityRecord
576
575
  }, {
577
576
  F: __dxlog_file4,
578
- L: 77,
577
+ L: 76,
579
578
  S: this,
580
579
  C: (f, a) => f(...a)
581
580
  });
@@ -588,7 +587,7 @@ var IdentityManager = class IdentityManager2 {
588
587
  displayName: this._identity.profileDocument?.displayName
589
588
  }, {
590
589
  F: __dxlog_file4,
591
- L: 82,
590
+ L: 81,
592
591
  S: this,
593
592
  C: (f, a) => f(...a)
594
593
  });
@@ -598,7 +597,7 @@ var IdentityManager = class IdentityManager2 {
598
597
  id: traceId
599
598
  }), {
600
599
  F: __dxlog_file4,
601
- L: 88,
600
+ L: 87,
602
601
  S: this,
603
602
  C: (f, a) => f(...a)
604
603
  });
@@ -609,7 +608,7 @@ var IdentityManager = class IdentityManager2 {
609
608
  async createIdentity({ displayName } = {}) {
610
609
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
611
610
  F: __dxlog_file4,
612
- L: 96,
611
+ L: 95,
613
612
  S: this,
614
613
  A: [
615
614
  "!this._identity",
@@ -618,7 +617,7 @@ var IdentityManager = class IdentityManager2 {
618
617
  });
619
618
  (0, import_log4.log)("creating identity...", void 0, {
620
619
  F: __dxlog_file4,
621
- L: 97,
620
+ L: 96,
622
621
  S: this,
623
622
  C: (f, a) => f(...a)
624
623
  });
@@ -639,7 +638,7 @@ var IdentityManager = class IdentityManager2 {
639
638
  const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
640
639
  (0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
641
640
  F: __dxlog_file4,
642
- L: 116,
641
+ L: 115,
643
642
  S: this,
644
643
  A: [
645
644
  "identityRecord.haloSpace.genesisFeedKey",
@@ -648,7 +647,7 @@ var IdentityManager = class IdentityManager2 {
648
647
  });
649
648
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
650
649
  F: __dxlog_file4,
651
- L: 117,
650
+ L: 116,
652
651
  S: this,
653
652
  A: [
654
653
  "identityRecord.haloSpace.dataFeedKey",
@@ -683,7 +682,7 @@ var IdentityManager = class IdentityManager2 {
683
682
  displayName: this._identity.profileDocument?.displayName
684
683
  }, {
685
684
  F: __dxlog_file4,
686
- L: 152,
685
+ L: 151,
687
686
  S: this,
688
687
  C: (f, a) => f(...a)
689
688
  });
@@ -693,7 +692,7 @@ var IdentityManager = class IdentityManager2 {
693
692
  deviceKey: identity.deviceKey
694
693
  }, {
695
694
  F: __dxlog_file4,
696
- L: 158,
695
+ L: 157,
697
696
  S: this,
698
697
  C: (f, a) => f(...a)
699
698
  });
@@ -707,13 +706,13 @@ var IdentityManager = class IdentityManager2 {
707
706
  params
708
707
  }, {
709
708
  F: __dxlog_file4,
710
- L: 166,
709
+ L: 165,
711
710
  S: this,
712
711
  C: (f, a) => f(...a)
713
712
  });
714
713
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
715
714
  F: __dxlog_file4,
716
- L: 167,
715
+ L: 166,
717
716
  S: this,
718
717
  A: [
719
718
  "!this._identity",
@@ -741,7 +740,7 @@ var IdentityManager = class IdentityManager2 {
741
740
  displayName: this._identity.profileDocument?.displayName
742
741
  }, {
743
742
  F: __dxlog_file4,
744
- L: 186,
743
+ L: 185,
745
744
  S: this,
746
745
  C: (f, a) => f(...a)
747
746
  });
@@ -751,7 +750,7 @@ var IdentityManager = class IdentityManager2 {
751
750
  deviceKey: identity.deviceKey
752
751
  }, {
753
752
  F: __dxlog_file4,
754
- L: 192,
753
+ L: 191,
755
754
  S: this,
756
755
  C: (f, a) => f(...a)
757
756
  });
@@ -763,7 +762,7 @@ var IdentityManager = class IdentityManager2 {
763
762
  async updateProfile(profile) {
764
763
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
765
764
  F: __dxlog_file4,
766
- L: 200,
765
+ L: 199,
767
766
  S: this,
768
767
  A: [
769
768
  "this._identity",
@@ -788,11 +787,13 @@ var IdentityManager = class IdentityManager2 {
788
787
  receipt.seq
789
788
  ]
790
789
  ]));
790
+ this.stateUpdate.emit();
791
+ return profile;
791
792
  }
792
793
  async _constructIdentity(identityRecord) {
793
794
  (0, import_invariant3.invariant)(!this._identity, void 0, {
794
795
  F: __dxlog_file4,
795
- L: 214,
796
+ L: 216,
796
797
  S: this,
797
798
  A: [
798
799
  "!this._identity",
@@ -803,13 +804,13 @@ var IdentityManager = class IdentityManager2 {
803
804
  identityRecord
804
805
  }, {
805
806
  F: __dxlog_file4,
806
- L: 215,
807
+ L: 217,
807
808
  S: this,
808
809
  C: (f, a) => f(...a)
809
810
  });
810
811
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
811
812
  F: __dxlog_file4,
812
- L: 218,
813
+ L: 220,
813
814
  S: this,
814
815
  A: [
815
816
  "identityRecord.haloSpace.controlFeedKey",
@@ -821,7 +822,7 @@ var IdentityManager = class IdentityManager2 {
821
822
  });
822
823
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
823
824
  F: __dxlog_file4,
824
- L: 222,
825
+ L: 224,
825
826
  S: this,
826
827
  A: [
827
828
  "identityRecord.haloSpace.dataFeedKey",
@@ -853,7 +854,7 @@ var IdentityManager = class IdentityManager2 {
853
854
  identityKey: identityRecord.identityKey
854
855
  }, {
855
856
  F: __dxlog_file4,
856
- L: 246,
857
+ L: 248,
857
858
  S: this,
858
859
  C: (f, a) => f(...a)
859
860
  });
@@ -874,7 +875,7 @@ var IdentityManager = class IdentityManager2 {
874
875
  onAuthFailure: () => {
875
876
  import_log4.log.warn("auth failure", void 0, {
876
877
  F: __dxlog_file4,
877
- L: 265,
878
+ L: 267,
878
879
  S: this,
879
880
  C: (f, a) => f(...a)
880
881
  });
@@ -884,7 +885,9 @@ var IdentityManager = class IdentityManager2 {
884
885
  }
885
886
  };
886
887
  _ts_decorate2([
887
- import_tracing2.trace.span()
888
+ import_tracing2.trace.span({
889
+ showInBrowserTimeline: true
890
+ })
888
891
  ], IdentityManager.prototype, "open", null);
889
892
  IdentityManager = _ts_decorate2([
890
893
  import_tracing2.trace.resource()
@@ -895,7 +898,7 @@ var import_codec_protobuf3 = require("@dxos/codec-protobuf");
895
898
  var import_credentials8 = require("@dxos/credentials");
896
899
  var import_debug3 = require("@dxos/debug");
897
900
  var import_invariant4 = require("@dxos/invariant");
898
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
901
+ var __dxlog_file5 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
899
902
  var IdentityServiceImpl = class {
900
903
  constructor(_createIdentity, _identityManager, _keyring) {
901
904
  this._createIdentity = _createIdentity;
@@ -964,7 +967,7 @@ var IdentityServiceImpl = class {
964
967
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
965
968
  var import_invariant5 = require("@dxos/invariant");
966
969
  var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
967
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
970
+ var __dxlog_file6 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
968
971
  var DeviceInvitationProtocol = class {
969
972
  constructor(_keyring, _getIdentity, _acceptIdentity) {
970
973
  this._keyring = _keyring;
@@ -1076,7 +1079,7 @@ var import_protocols4 = require("@dxos/protocols");
1076
1079
  var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
1077
1080
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
1078
1081
  var import_teleport = require("@dxos/teleport");
1079
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1082
+ var __dxlog_file7 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1080
1083
  var OPTIONS_TIMEOUT = 1e4;
1081
1084
  var MAX_OTP_ATTEMPTS = 3;
1082
1085
  var InvitationHostExtension = class extends import_teleport.RpcExtension {
@@ -1407,7 +1410,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1407
1410
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services3.Invitation.AuthMethod.NONE;
1408
1411
 
1409
1412
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1410
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1413
+ var __dxlog_file8 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1411
1414
  var InvitationsHandler = class {
1412
1415
  /**
1413
1416
  * @internal
@@ -1966,7 +1969,7 @@ var import_codec_protobuf4 = require("@dxos/codec-protobuf");
1966
1969
  var import_invariant8 = require("@dxos/invariant");
1967
1970
  var import_log7 = require("@dxos/log");
1968
1971
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
1969
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1972
+ var __dxlog_file9 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1970
1973
  var InvitationsServiceImpl = class {
1971
1974
  constructor(_invitationsHandler, _getHandler) {
1972
1975
  this._invitationsHandler = _invitationsHandler;
@@ -2151,7 +2154,7 @@ var import_feed_store2 = require("@dxos/feed-store");
2151
2154
  var import_invariant9 = require("@dxos/invariant");
2152
2155
  var import_log8 = require("@dxos/log");
2153
2156
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2154
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2157
+ var __dxlog_file10 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2155
2158
  var SpaceInvitationProtocol = class {
2156
2159
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
2157
2160
  this._spaceManager = _spaceManager;
@@ -2323,6 +2326,7 @@ var import_log10 = require("@dxos/log");
2323
2326
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2324
2327
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2325
2328
  var import_timeframe2 = require("@dxos/timeframe");
2329
+ var import_tracing3 = require("@dxos/tracing");
2326
2330
  var import_util3 = require("@dxos/util");
2327
2331
 
2328
2332
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
@@ -2334,7 +2338,7 @@ var import_log9 = require("@dxos/log");
2334
2338
  var import_protocols6 = require("@dxos/protocols");
2335
2339
  var import_teleport2 = require("@dxos/teleport");
2336
2340
  var import_util2 = require("@dxos/util");
2337
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2341
+ var __dxlog_file11 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2338
2342
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2339
2343
  var DEFAULT_SUCCESS_DELAY = 1e3;
2340
2344
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2604,7 +2608,7 @@ function _ts_decorate3(decorators, target, key, desc) {
2604
2608
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2605
2609
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2606
2610
  }
2607
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2611
+ var __dxlog_file12 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2608
2612
  var ENABLE_FEED_PURGE = false;
2609
2613
  var DataSpace = class DataSpace2 {
2610
2614
  constructor(params) {
@@ -2633,6 +2637,14 @@ var DataSpace = class DataSpace2 {
2633
2637
  });
2634
2638
  this._cache = params.cache;
2635
2639
  this._state = params.initialState;
2640
+ (0, import_log10.log)("new state", {
2641
+ state: import_services7.SpaceState[this._state]
2642
+ }, {
2643
+ F: __dxlog_file12,
2644
+ L: 112,
2645
+ S: this,
2646
+ C: (f, a) => f(...a)
2647
+ });
2636
2648
  }
2637
2649
  get key() {
2638
2650
  return this._inner.key;
@@ -2667,6 +2679,14 @@ var DataSpace = class DataSpace2 {
2667
2679
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2668
2680
  await this._inner.open(new import_context6.Context());
2669
2681
  this._state = import_services7.SpaceState.CONTROL_ONLY;
2682
+ (0, import_log10.log)("new state", {
2683
+ state: import_services7.SpaceState[this._state]
2684
+ }, {
2685
+ F: __dxlog_file12,
2686
+ L: 158,
2687
+ S: this,
2688
+ C: (f, a) => f(...a)
2689
+ });
2670
2690
  this.stateUpdate.emit();
2671
2691
  this.metrics = {};
2672
2692
  this.metrics.open = /* @__PURE__ */ new Date();
@@ -2677,6 +2697,14 @@ var DataSpace = class DataSpace2 {
2677
2697
  async _close() {
2678
2698
  await this._callbacks.beforeClose?.();
2679
2699
  this._state = import_services7.SpaceState.CLOSED;
2700
+ (0, import_log10.log)("new state", {
2701
+ state: import_services7.SpaceState[this._state]
2702
+ }, {
2703
+ F: __dxlog_file12,
2704
+ L: 172,
2705
+ S: this,
2706
+ C: (f, a) => f(...a)
2707
+ });
2680
2708
  await this._ctx.dispose();
2681
2709
  this._ctx = new import_context6.Context();
2682
2710
  await this.authVerifier.close();
@@ -2703,7 +2731,7 @@ var DataSpace = class DataSpace2 {
2703
2731
  if (err instanceof import_errors3.CancelledError) {
2704
2732
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
2705
2733
  F: __dxlog_file12,
2706
- L: 199,
2734
+ L: 203,
2707
2735
  S: this,
2708
2736
  C: (f, a) => f(...a)
2709
2737
  });
@@ -2711,11 +2739,19 @@ var DataSpace = class DataSpace2 {
2711
2739
  }
2712
2740
  import_log10.log.error("Error initializing data pipeline", err, {
2713
2741
  F: __dxlog_file12,
2714
- L: 203,
2742
+ L: 207,
2715
2743
  S: this,
2716
2744
  C: (f, a) => f(...a)
2717
2745
  });
2718
2746
  this._state = import_services7.SpaceState.ERROR;
2747
+ (0, import_log10.log)("new state", {
2748
+ state: import_services7.SpaceState[this._state]
2749
+ }, {
2750
+ F: __dxlog_file12,
2751
+ L: 209,
2752
+ S: this,
2753
+ C: (f, a) => f(...a)
2754
+ });
2719
2755
  this.error = err;
2720
2756
  this.stateUpdate.emit();
2721
2757
  } finally {
@@ -2728,32 +2764,22 @@ var DataSpace = class DataSpace2 {
2728
2764
  throw new import_errors3.SystemError("Invalid operation");
2729
2765
  }
2730
2766
  this._state = import_services7.SpaceState.INITIALIZING;
2731
- await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
2732
- ctx: this._ctx,
2733
- breakOnStall: false
2734
- });
2735
- this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
2736
- await this._createWritableFeeds();
2737
- (0, import_log10.log)("writable feeds created", void 0, {
2767
+ (0, import_log10.log)("new state", {
2768
+ state: import_services7.SpaceState[this._state]
2769
+ }, {
2738
2770
  F: __dxlog_file12,
2739
- L: 227,
2771
+ L: 225,
2740
2772
  S: this,
2741
2773
  C: (f, a) => f(...a)
2742
2774
  });
2743
- this.stateUpdate.emit();
2744
- if (!this.notarizationPlugin.hasWriter) {
2745
- this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
2746
- credential: {
2747
- credential
2748
- }
2749
- }), this._inner.controlPipeline.writer));
2750
- }
2775
+ await this._initializeAndReadControlPipeline();
2776
+ await (0, import_async8.sleep)(1);
2751
2777
  await this._inner.initializeDataPipeline();
2752
2778
  this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
2753
2779
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2754
2780
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
2755
2781
  F: __dxlog_file12,
2756
- L: 248,
2782
+ L: 239,
2757
2783
  S: this,
2758
2784
  C: (f, a) => f(...a)
2759
2785
  });
@@ -2764,15 +2790,45 @@ var DataSpace = class DataSpace2 {
2764
2790
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
2765
2791
  (0, import_log10.log)("data pipeline ready", void 0, {
2766
2792
  F: __dxlog_file12,
2767
- L: 257,
2793
+ L: 248,
2768
2794
  S: this,
2769
2795
  C: (f, a) => f(...a)
2770
2796
  });
2771
2797
  await this._callbacks.beforeReady?.();
2772
2798
  this._state = import_services7.SpaceState.READY;
2799
+ (0, import_log10.log)("new state", {
2800
+ state: import_services7.SpaceState[this._state]
2801
+ }, {
2802
+ F: __dxlog_file12,
2803
+ L: 252,
2804
+ S: this,
2805
+ C: (f, a) => f(...a)
2806
+ });
2773
2807
  this.stateUpdate.emit();
2774
2808
  await this._callbacks.afterReady?.();
2775
2809
  }
2810
+ async _initializeAndReadControlPipeline() {
2811
+ await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
2812
+ ctx: this._ctx,
2813
+ breakOnStall: false
2814
+ });
2815
+ this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
2816
+ await this._createWritableFeeds();
2817
+ (0, import_log10.log)("writable feeds created", void 0, {
2818
+ F: __dxlog_file12,
2819
+ L: 268,
2820
+ S: this,
2821
+ C: (f, a) => f(...a)
2822
+ });
2823
+ this.stateUpdate.emit();
2824
+ if (!this.notarizationPlugin.hasWriter) {
2825
+ this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
2826
+ credential: {
2827
+ credential
2828
+ }
2829
+ }), this._inner.controlPipeline.writer));
2830
+ }
2831
+ }
2776
2832
  async _createWritableFeeds() {
2777
2833
  const credentials = [];
2778
2834
  if (!this.inner.controlFeedKey) {
@@ -2814,8 +2870,8 @@ var DataSpace = class DataSpace2 {
2814
2870
  credentials,
2815
2871
  timeout: 0
2816
2872
  });
2873
+ await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
2817
2874
  }
2818
- await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
2819
2875
  }
2820
2876
  async createEpoch() {
2821
2877
  const epoch = await this.dataPipeline.createEpoch();
@@ -2861,6 +2917,14 @@ var DataSpace = class DataSpace2 {
2861
2917
  await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
2862
2918
  await this._close();
2863
2919
  this._state = import_services7.SpaceState.INACTIVE;
2920
+ (0, import_log10.log)("new state", {
2921
+ state: import_services7.SpaceState[this._state]
2922
+ }, {
2923
+ F: __dxlog_file12,
2924
+ L: 384,
2925
+ S: this,
2926
+ C: (f, a) => f(...a)
2927
+ });
2864
2928
  this.stateUpdate.emit();
2865
2929
  }
2866
2930
  };
@@ -2870,6 +2934,16 @@ _ts_decorate3([
2870
2934
  _ts_decorate3([
2871
2935
  import_async8.synchronized
2872
2936
  ], DataSpace.prototype, "close", null);
2937
+ _ts_decorate3([
2938
+ import_tracing3.trace.span({
2939
+ showInBrowserTimeline: true
2940
+ })
2941
+ ], DataSpace.prototype, "initializeDataPipeline", null);
2942
+ _ts_decorate3([
2943
+ import_tracing3.trace.span({
2944
+ showInBrowserTimeline: true
2945
+ })
2946
+ ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
2873
2947
  _ts_decorate3([
2874
2948
  (0, import_debug4.timed)(1e4)
2875
2949
  ], DataSpace.prototype, "_createWritableFeeds", null);
@@ -2963,7 +3037,7 @@ function _ts_decorate4(decorators, target, key, desc) {
2963
3037
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2964
3038
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2965
3039
  }
2966
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3040
+ var __dxlog_file13 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
2967
3041
  var DataSpaceManager = class DataSpaceManager2 {
2968
3042
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
2969
3043
  this._spaceManager = _spaceManager;
@@ -2997,48 +3071,49 @@ var DataSpaceManager = class DataSpaceManager2 {
2997
3071
  S: this,
2998
3072
  C: (f, a) => f(...a)
2999
3073
  });
3000
- await this._metadataStore.load();
3001
3074
  (0, import_log11.log)("metadata loaded", {
3002
3075
  spaces: this._metadataStore.spaces.length
3003
3076
  }, {
3004
3077
  F: __dxlog_file13,
3005
- L: 82,
3078
+ L: 81,
3006
3079
  S: this,
3007
3080
  C: (f, a) => f(...a)
3008
3081
  });
3009
- for (const spaceMetadata of this._metadataStore.spaces) {
3082
+ await (0, import_util4.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3010
3083
  try {
3011
3084
  (0, import_log11.log)("load space", {
3012
3085
  spaceMetadata
3013
3086
  }, {
3014
3087
  F: __dxlog_file13,
3015
- L: 86,
3088
+ L: 85,
3016
3089
  S: this,
3017
3090
  C: (f, a) => f(...a)
3018
3091
  });
3019
- const space = await this._constructSpace(spaceMetadata);
3020
- if (spaceMetadata.state !== import_services8.SpaceState.INACTIVE) {
3021
- space.initializeDataPipelineAsync();
3022
- }
3092
+ await this._constructSpace(spaceMetadata);
3023
3093
  } catch (err) {
3024
3094
  import_log11.log.error("Error loading space", {
3025
3095
  spaceMetadata,
3026
3096
  err
3027
3097
  }, {
3028
3098
  F: __dxlog_file13,
3029
- L: 92,
3099
+ L: 88,
3030
3100
  S: this,
3031
3101
  C: (f, a) => f(...a)
3032
3102
  });
3033
3103
  }
3034
- }
3104
+ });
3035
3105
  this._isOpen = true;
3036
3106
  this.updated.emit();
3107
+ for (const space of this._spaces.values()) {
3108
+ if (space.state !== import_services8.SpaceState.INACTIVE) {
3109
+ space.initializeDataPipelineAsync();
3110
+ }
3111
+ }
3037
3112
  import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3038
3113
  id: this._instanceId
3039
3114
  }), {
3040
3115
  F: __dxlog_file13,
3041
- L: 98,
3116
+ L: 101,
3042
3117
  S: this,
3043
3118
  C: (f, a) => f(...a)
3044
3119
  });
@@ -3046,7 +3121,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3046
3121
  async close() {
3047
3122
  (0, import_log11.log)("close", void 0, {
3048
3123
  F: __dxlog_file13,
3049
- L: 103,
3124
+ L: 106,
3050
3125
  S: this,
3051
3126
  C: (f, a) => f(...a)
3052
3127
  });
@@ -3062,7 +3137,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3062
3137
  async createSpace() {
3063
3138
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3064
3139
  F: __dxlog_file13,
3065
- L: 116,
3140
+ L: 119,
3066
3141
  S: this,
3067
3142
  A: [
3068
3143
  "this._isOpen",
@@ -3083,7 +3158,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3083
3158
  spaceKey
3084
3159
  }, {
3085
3160
  F: __dxlog_file13,
3086
- L: 128,
3161
+ L: 131,
3087
3162
  S: this,
3088
3163
  C: (f, a) => f(...a)
3089
3164
  });
@@ -3093,7 +3168,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3093
3168
  const memberCredential = credentials[1];
3094
3169
  (0, import_invariant11.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3095
3170
  F: __dxlog_file13,
3096
- L: 135,
3171
+ L: 138,
3097
3172
  S: this,
3098
3173
  A: [
3099
3174
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3111,13 +3186,13 @@ var DataSpaceManager = class DataSpaceManager2 {
3111
3186
  opts
3112
3187
  }, {
3113
3188
  F: __dxlog_file13,
3114
- L: 147,
3189
+ L: 150,
3115
3190
  S: this,
3116
3191
  C: (f, a) => f(...a)
3117
3192
  });
3118
3193
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3119
3194
  F: __dxlog_file13,
3120
- L: 148,
3195
+ L: 151,
3121
3196
  S: this,
3122
3197
  A: [
3123
3198
  "this._isOpen",
@@ -3126,7 +3201,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3126
3201
  });
3127
3202
  (0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3128
3203
  F: __dxlog_file13,
3129
- L: 149,
3204
+ L: 152,
3130
3205
  S: this,
3131
3206
  A: [
3132
3207
  "!this._spaces.has(opts.spaceKey)",
@@ -3161,7 +3236,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3161
3236
  metadata
3162
3237
  }, {
3163
3238
  F: __dxlog_file13,
3164
- L: 182,
3239
+ L: 185,
3165
3240
  S: this,
3166
3241
  C: (f, a) => f(...a)
3167
3242
  });
@@ -3197,7 +3272,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3197
3272
  onAuthFailure: () => {
3198
3273
  import_log11.log.warn("auth failure", void 0, {
3199
3274
  F: __dxlog_file13,
3200
- L: 217,
3275
+ L: 220,
3201
3276
  S: this,
3202
3277
  C: (f, a) => f(...a)
3203
3278
  });
@@ -3221,7 +3296,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3221
3296
  space: space.key
3222
3297
  }, {
3223
3298
  F: __dxlog_file13,
3224
- L: 235,
3299
+ L: 238,
3225
3300
  S: this,
3226
3301
  C: (f, a) => f(...a)
3227
3302
  });
@@ -3233,7 +3308,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3233
3308
  open: this._isOpen
3234
3309
  }, {
3235
3310
  F: __dxlog_file13,
3236
- L: 242,
3311
+ L: 245,
3237
3312
  S: this,
3238
3313
  C: (f, a) => f(...a)
3239
3314
  });
@@ -3246,7 +3321,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3246
3321
  space: space.key
3247
3322
  }, {
3248
3323
  F: __dxlog_file13,
3249
- L: 248,
3324
+ L: 251,
3250
3325
  S: this,
3251
3326
  C: (f, a) => f(...a)
3252
3327
  });
@@ -3293,8 +3368,7 @@ var import_errors4 = require("@dxos/errors");
3293
3368
  var import_log12 = require("@dxos/log");
3294
3369
  var import_protocols8 = require("@dxos/protocols");
3295
3370
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3296
- var import_util5 = require("@dxos/util");
3297
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3371
+ var __dxlog_file14 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3298
3372
  var SpacesServiceImpl = class {
3299
3373
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
3300
3374
  this._identityManager = _identityManager;
@@ -3352,7 +3426,7 @@ var SpacesServiceImpl = class {
3352
3426
  const subscribeSpaces = () => {
3353
3427
  subscriptions.clear();
3354
3428
  for (const space of dataSpaceManager.spaces.values()) {
3355
- subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
3429
+ subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3356
3430
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3357
3431
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3358
3432
  space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
@@ -3447,7 +3521,7 @@ var SpacesServiceImpl = class {
3447
3521
  identity: {
3448
3522
  identityKey: member.key,
3449
3523
  profile: {
3450
- displayName: member.assertion.profile?.displayName ?? (0, import_util5.humanize)(member.key)
3524
+ displayName: member.assertion.profile?.displayName
3451
3525
  }
3452
3526
  },
3453
3527
  presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
@@ -3473,7 +3547,7 @@ function _ts_decorate5(decorators, target, key, desc) {
3473
3547
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3474
3548
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3475
3549
  }
3476
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3550
+ var __dxlog_file15 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/service-context.ts";
3477
3551
  var ServiceContext = class ServiceContext2 {
3478
3552
  // prettier-ignore
3479
3553
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3529,6 +3603,7 @@ var ServiceContext = class ServiceContext2 {
3529
3603
  });
3530
3604
  await this.signalManager.open();
3531
3605
  await this.networkManager.open();
3606
+ await this.metadataStore.load();
3532
3607
  await this.spaceManager.open();
3533
3608
  await this.identityManager.open(ctx);
3534
3609
  if (this.identityManager.identity) {
@@ -3538,13 +3613,13 @@ var ServiceContext = class ServiceContext2 {
3538
3613
  id: this._instanceId
3539
3614
  }), {
3540
3615
  F: __dxlog_file15,
3541
- L: 144,
3616
+ L: 146,
3542
3617
  S: this,
3543
3618
  C: (f, a) => f(...a)
3544
3619
  });
3545
3620
  (0, import_log13.log)("opened", void 0, {
3546
3621
  F: __dxlog_file15,
3547
- L: 145,
3622
+ L: 147,
3548
3623
  S: this,
3549
3624
  C: (f, a) => f(...a)
3550
3625
  });
@@ -3552,7 +3627,7 @@ var ServiceContext = class ServiceContext2 {
3552
3627
  async close() {
3553
3628
  (0, import_log13.log)("closing...", void 0, {
3554
3629
  F: __dxlog_file15,
3555
- L: 149,
3630
+ L: 151,
3556
3631
  S: this,
3557
3632
  C: (f, a) => f(...a)
3558
3633
  });
@@ -3566,9 +3641,10 @@ var ServiceContext = class ServiceContext2 {
3566
3641
  await this.networkManager.close();
3567
3642
  await this.signalManager.close();
3568
3643
  this.dataServiceSubscriptions.clear();
3644
+ await this.metadataStore.close();
3569
3645
  (0, import_log13.log)("closed", void 0, {
3570
3646
  F: __dxlog_file15,
3571
- L: 160,
3647
+ L: 163,
3572
3648
  S: this,
3573
3649
  C: (f, a) => f(...a)
3574
3650
  });
@@ -3582,7 +3658,7 @@ var ServiceContext = class ServiceContext2 {
3582
3658
  const factory = this._handlerFactories.get(invitation.kind);
3583
3659
  (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3584
3660
  F: __dxlog_file15,
3585
- L: 171,
3661
+ L: 174,
3586
3662
  S: this,
3587
3663
  A: [
3588
3664
  "factory",
@@ -3606,7 +3682,7 @@ var ServiceContext = class ServiceContext2 {
3606
3682
  async _initialize(ctx) {
3607
3683
  (0, import_log13.log)("initializing spaces...", void 0, {
3608
3684
  F: __dxlog_file15,
3609
- L: 192,
3685
+ L: 195,
3610
3686
  S: this,
3611
3687
  C: (f, a) => f(...a)
3612
3688
  });
@@ -3629,7 +3705,7 @@ var ServiceContext = class ServiceContext2 {
3629
3705
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3630
3706
  (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3631
3707
  F: __dxlog_file15,
3632
- L: 215,
3708
+ L: 218,
3633
3709
  S: this,
3634
3710
  A: [
3635
3711
  "this.dataSpaceManager",
@@ -3653,7 +3729,7 @@ var ServiceContext = class ServiceContext2 {
3653
3729
  details: assertion
3654
3730
  }, {
3655
3731
  F: __dxlog_file15,
3656
- L: 231,
3732
+ L: 234,
3657
3733
  S: this,
3658
3734
  C: (f, a) => f(...a)
3659
3735
  });
@@ -3664,7 +3740,7 @@ var ServiceContext = class ServiceContext2 {
3664
3740
  details: assertion
3665
3741
  }, {
3666
3742
  F: __dxlog_file15,
3667
- L: 235,
3743
+ L: 238,
3668
3744
  S: this,
3669
3745
  C: (f, a) => f(...a)
3670
3746
  });
@@ -3675,7 +3751,7 @@ var ServiceContext = class ServiceContext2 {
3675
3751
  details: assertion
3676
3752
  }, {
3677
3753
  F: __dxlog_file15,
3678
- L: 240,
3754
+ L: 243,
3679
3755
  S: this,
3680
3756
  C: (f, a) => f(...a)
3681
3757
  });
@@ -3686,7 +3762,7 @@ var ServiceContext = class ServiceContext2 {
3686
3762
  } catch (err) {
3687
3763
  import_log13.log.catch(err, void 0, {
3688
3764
  F: __dxlog_file15,
3689
- L: 246,
3765
+ L: 249,
3690
3766
  S: this,
3691
3767
  C: (f, a) => f(...a)
3692
3768
  });
@@ -3697,14 +3773,14 @@ var ServiceContext = class ServiceContext2 {
3697
3773
  }
3698
3774
  };
3699
3775
  _ts_decorate5([
3700
- import_tracing3.trace.span()
3776
+ import_tracing4.trace.span()
3701
3777
  ], ServiceContext.prototype, "open", null);
3702
3778
  _ts_decorate5([
3703
- import_tracing3.trace.span()
3779
+ import_tracing4.trace.span()
3704
3780
  ], ServiceContext.prototype, "_initialize", null);
3705
3781
  ServiceContext = _ts_decorate5([
3706
- (0, import_util6.safeInstanceof)("dxos.client-services.ServiceContext"),
3707
- import_tracing3.trace.resource()
3782
+ (0, import_util5.safeInstanceof)("dxos.client-services.ServiceContext"),
3783
+ import_tracing4.trace.resource()
3708
3784
  ], ServiceContext);
3709
3785
 
3710
3786
  // packages/sdk/client-services/src/packlets/services/service-host.ts
@@ -3722,7 +3798,8 @@ var import_network_manager2 = require("@dxos/network-manager");
3722
3798
  var import_protocols10 = require("@dxos/protocols");
3723
3799
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3724
3800
  var import_text_model = require("@dxos/text-model");
3725
- var import_tracing4 = require("@dxos/tracing");
3801
+ var import_tracing5 = require("@dxos/tracing");
3802
+ var import_websocket_rpc = require("@dxos/websocket-rpc");
3726
3803
 
3727
3804
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3728
3805
  var import_async12 = require("@dxos/async");
@@ -3776,11 +3853,11 @@ var import_async13 = require("@dxos/async");
3776
3853
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
3777
3854
  var import_feed_store4 = require("@dxos/feed-store");
3778
3855
  var import_keys9 = require("@dxos/keys");
3779
- var import_util7 = require("@dxos/util");
3856
+ var import_util6 = require("@dxos/util");
3780
3857
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
3781
3858
  return new import_codec_protobuf7.Stream(({ next }) => {
3782
3859
  const subscriptions = new import_async13.EventSubscriptions();
3783
- const feedMap = new import_util7.ComplexMap(import_keys9.PublicKey.hash);
3860
+ const feedMap = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
3784
3861
  const update = () => {
3785
3862
  const { feeds } = feedStore;
3786
3863
  feeds.filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key))).forEach((feed) => {
@@ -3902,6 +3979,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf10.Strea
3902
3979
  signalManager.swarmEvent.on(ctx, (swarmEvent) => {
3903
3980
  next({
3904
3981
  swarmEvent: swarmEvent.swarmEvent,
3982
+ topic: swarmEvent.topic.asUint8Array(),
3905
3983
  receivedAt: /* @__PURE__ */ new Date()
3906
3984
  });
3907
3985
  });
@@ -4088,7 +4166,7 @@ function _ts_decorate6(decorators, target, key, desc) {
4088
4166
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4089
4167
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4090
4168
  }
4091
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
4169
+ var __dxlog_file16 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/locks/node.ts";
4092
4170
  var Lock = class {
4093
4171
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
4094
4172
  this._lockPath = lockPath;
@@ -4137,7 +4215,7 @@ var import_async16 = require("@dxos/async");
4137
4215
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4138
4216
  var import_log15 = require("@dxos/log");
4139
4217
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4140
- var import_util8 = require("@dxos/util");
4218
+ var import_util7 = require("@dxos/util");
4141
4219
  var LoggingServiceImpl = class {
4142
4220
  constructor() {
4143
4221
  this._logs = new import_async16.Event();
@@ -4155,15 +4233,15 @@ var LoggingServiceImpl = class {
4155
4233
  }
4156
4234
  async controlMetrics({ reset, record }) {
4157
4235
  if (reset) {
4158
- import_util8.tracer.clear();
4236
+ import_util7.tracer.clear();
4159
4237
  }
4160
4238
  if (record === true) {
4161
- import_util8.tracer.start();
4239
+ import_util7.tracer.start();
4162
4240
  } else if (record === false) {
4163
- import_util8.tracer.stop();
4241
+ import_util7.tracer.stop();
4164
4242
  }
4165
4243
  return {
4166
- recording: import_util8.tracer.recording
4244
+ recording: import_util7.tracer.recording
4167
4245
  };
4168
4246
  }
4169
4247
  /**
@@ -4171,10 +4249,10 @@ var LoggingServiceImpl = class {
4171
4249
  */
4172
4250
  queryMetrics({ interval = 5e3 }) {
4173
4251
  const getNumericalValues = (key) => {
4174
- const events = import_util8.tracer.get(key) ?? [];
4252
+ const events = import_util7.tracer.get(key) ?? [];
4175
4253
  return {
4176
4254
  key,
4177
- stats: (0, import_util8.numericalValues)(events, "duration")
4255
+ stats: (0, import_util7.numericalValues)(events, "duration")
4178
4256
  };
4179
4257
  };
4180
4258
  return new import_codec_protobuf13.Stream(({ next }) => {
@@ -4212,7 +4290,7 @@ var LoggingServiceImpl = class {
4212
4290
  }
4213
4291
  const record = {
4214
4292
  ...entry2,
4215
- context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4293
+ context: (0, import_util7.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4216
4294
  timestamp: /* @__PURE__ */ new Date(),
4217
4295
  meta: {
4218
4296
  // TODO(dmaretskyi): Fix proto.
@@ -4286,10 +4364,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
4286
4364
  var import_errors5 = require("@dxos/errors");
4287
4365
  var import_config = require("@dxos/protocols/proto/dxos/config");
4288
4366
  var import_random_access_storage = require("@dxos/random-access-storage");
4289
- var import_util9 = require("@dxos/util");
4367
+ var import_util8 = require("@dxos/util");
4290
4368
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4291
4369
  var createStorageObjects = (config) => {
4292
- const { path = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4370
+ const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4293
4371
  if (persistent && storageType === StorageDriver.RAM) {
4294
4372
  throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4295
4373
  }
@@ -4333,7 +4411,7 @@ var toStorageType = (type) => {
4333
4411
  // packages/sdk/client-services/src/packlets/system/system-service.ts
4334
4412
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
4335
4413
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
4336
- var import_util10 = require("@dxos/util");
4414
+ var import_util9 = require("@dxos/util");
4337
4415
  var SystemServiceImpl = class {
4338
4416
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
4339
4417
  this._config = config;
@@ -4353,7 +4431,7 @@ var SystemServiceImpl = class {
4353
4431
  const diagnostics = await this._getDiagnostics();
4354
4432
  return {
4355
4433
  timestamp: /* @__PURE__ */ new Date(),
4356
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4434
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util9.jsonKeyReplacer)({
4357
4435
  truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4358
4436
  humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4359
4437
  })))
@@ -4419,7 +4497,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4419
4497
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4420
4498
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4421
4499
  }
4422
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4500
+ var __dxlog_file17 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/services/service-host.ts";
4423
4501
  var createDefaultModelFactory = () => {
4424
4502
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4425
4503
  };
@@ -4434,7 +4512,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4434
4512
  lockKey,
4435
4513
  callbacks
4436
4514
  } = {}) {
4437
- this._tracingService = import_tracing4.TRACE_PROCESSOR.createTraceSender();
4515
+ this._tracingService = import_tracing5.TRACE_PROCESSOR.createTraceSender();
4438
4516
  this._statusUpdate = new import_async17.Event();
4439
4517
  this._opening = false;
4440
4518
  this._open = false;
@@ -4509,7 +4587,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4509
4587
  initialize({ config, ...options }) {
4510
4588
  (0, import_invariant14.invariant)(!this._open, "service host is open", {
4511
4589
  F: __dxlog_file17,
4512
- L: 181,
4590
+ L: 184,
4513
4591
  S: this,
4514
4592
  A: [
4515
4593
  "!this._open",
@@ -4518,14 +4596,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4518
4596
  });
4519
4597
  (0, import_log16.log)("initializing...", void 0, {
4520
4598
  F: __dxlog_file17,
4521
- L: 182,
4599
+ L: 185,
4522
4600
  S: this,
4523
4601
  C: (f, a) => f(...a)
4524
4602
  });
4525
4603
  if (config) {
4526
4604
  (0, import_invariant14.invariant)(!this._config, "config already set", {
4527
4605
  F: __dxlog_file17,
4528
- L: 185,
4606
+ L: 188,
4529
4607
  S: this,
4530
4608
  A: [
4531
4609
  "!this._config",
@@ -4537,13 +4615,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4537
4615
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
4538
4616
  }
4539
4617
  }
4540
- const { connectionLog = true, transportFactory = (0, import_network_manager2.createWebRTCTransportFactory)({
4618
+ const { connectionLog = true, transportFactory = (0, import_network_manager2.createSimplePeerTransportFactory)({
4541
4619
  iceServers: this._config?.get("runtime.services.ice")
4542
4620
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4543
4621
  this._signalManager = signalManager;
4544
4622
  (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4545
4623
  F: __dxlog_file17,
4546
- L: 201,
4624
+ L: 204,
4547
4625
  S: this,
4548
4626
  A: [
4549
4627
  "!this._networkManager",
@@ -4557,7 +4635,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4557
4635
  });
4558
4636
  (0, import_log16.log)("initialized", void 0, {
4559
4637
  F: __dxlog_file17,
4560
- L: 208,
4638
+ L: 211,
4561
4639
  S: this,
4562
4640
  C: (f, a) => f(...a)
4563
4641
  });
@@ -4571,13 +4649,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4571
4649
  id: traceId
4572
4650
  }), {
4573
4651
  F: __dxlog_file17,
4574
- L: 219,
4652
+ L: 222,
4575
4653
  S: this,
4576
4654
  C: (f, a) => f(...a)
4577
4655
  });
4578
4656
  (0, import_invariant14.invariant)(this._config, "config not set", {
4579
4657
  F: __dxlog_file17,
4580
- L: 221,
4658
+ L: 224,
4581
4659
  S: this,
4582
4660
  A: [
4583
4661
  "this._config",
@@ -4586,7 +4664,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4586
4664
  });
4587
4665
  (0, import_invariant14.invariant)(this._storage, "storage not set", {
4588
4666
  F: __dxlog_file17,
4589
- L: 222,
4667
+ L: 225,
4590
4668
  S: this,
4591
4669
  A: [
4592
4670
  "this._storage",
@@ -4595,7 +4673,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4595
4673
  });
4596
4674
  (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4597
4675
  F: __dxlog_file17,
4598
- L: 223,
4676
+ L: 226,
4599
4677
  S: this,
4600
4678
  A: [
4601
4679
  "this._signalManager",
@@ -4604,7 +4682,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4604
4682
  });
4605
4683
  (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4606
4684
  F: __dxlog_file17,
4607
- L: 224,
4685
+ L: 227,
4608
4686
  S: this,
4609
4687
  A: [
4610
4688
  "this._networkManager",
@@ -4616,7 +4694,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4616
4694
  lockKey: this._resourceLock?.lockKey
4617
4695
  }, {
4618
4696
  F: __dxlog_file17,
4619
- L: 227,
4697
+ L: 230,
4620
4698
  S: this,
4621
4699
  C: (f, a) => f(...a)
4622
4700
  });
@@ -4644,6 +4722,16 @@ var ClientServicesHost = class ClientServicesHost2 {
4644
4722
  })
4645
4723
  });
4646
4724
  await this._serviceContext.open(ctx);
4725
+ const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
4726
+ if (devtoolsProxy) {
4727
+ this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
4728
+ url: devtoolsProxy,
4729
+ requested: {},
4730
+ exposed: import_client_protocol5.clientServiceBundle,
4731
+ handlers: this.services
4732
+ });
4733
+ void this._devtoolsProxy.open();
4734
+ }
4647
4735
  this._opening = false;
4648
4736
  this._open = true;
4649
4737
  this._statusUpdate.emit();
@@ -4652,7 +4740,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4652
4740
  deviceKey
4653
4741
  }, {
4654
4742
  F: __dxlog_file17,
4655
- L: 284,
4743
+ L: 299,
4656
4744
  S: this,
4657
4745
  C: (f, a) => f(...a)
4658
4746
  });
@@ -4660,7 +4748,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4660
4748
  id: traceId
4661
4749
  }), {
4662
4750
  F: __dxlog_file17,
4663
- L: 285,
4751
+ L: 300,
4664
4752
  S: this,
4665
4753
  C: (f, a) => f(...a)
4666
4754
  });
@@ -4674,10 +4762,11 @@ var ClientServicesHost = class ClientServicesHost2 {
4674
4762
  deviceKey
4675
4763
  }, {
4676
4764
  F: __dxlog_file17,
4677
- L: 296,
4765
+ L: 311,
4678
4766
  S: this,
4679
4767
  C: (f, a) => f(...a)
4680
4768
  });
4769
+ await this._devtoolsProxy?.close();
4681
4770
  this._serviceRegistry.setServices({
4682
4771
  SystemService: this._systemService
4683
4772
  });
@@ -4689,7 +4778,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4689
4778
  deviceKey
4690
4779
  }, {
4691
4780
  F: __dxlog_file17,
4692
- L: 302,
4781
+ L: 318,
4693
4782
  S: this,
4694
4783
  C: (f, a) => f(...a)
4695
4784
  });
@@ -4700,13 +4789,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4700
4789
  id: traceId
4701
4790
  }), {
4702
4791
  F: __dxlog_file17,
4703
- L: 307,
4792
+ L: 323,
4704
4793
  S: this,
4705
4794
  C: (f, a) => f(...a)
4706
4795
  });
4707
4796
  (0, import_log16.log)("resetting...", void 0, {
4708
4797
  F: __dxlog_file17,
4709
- L: 309,
4798
+ L: 325,
4710
4799
  S: this,
4711
4800
  C: (f, a) => f(...a)
4712
4801
  });
@@ -4714,7 +4803,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4714
4803
  await this._storage.reset();
4715
4804
  (0, import_log16.log)("reset", void 0, {
4716
4805
  F: __dxlog_file17,
4717
- L: 312,
4806
+ L: 328,
4718
4807
  S: this,
4719
4808
  C: (f, a) => f(...a)
4720
4809
  });
@@ -4722,7 +4811,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4722
4811
  id: traceId
4723
4812
  }), {
4724
4813
  F: __dxlog_file17,
4725
- L: 313,
4814
+ L: 329,
4726
4815
  S: this,
4727
4816
  C: (f, a) => f(...a)
4728
4817
  });
@@ -4730,25 +4819,25 @@ var ClientServicesHost = class ClientServicesHost2 {
4730
4819
  }
4731
4820
  };
4732
4821
  _ts_decorate7([
4733
- import_tracing4.trace.info()
4822
+ import_tracing5.trace.info()
4734
4823
  ], ClientServicesHost.prototype, "_opening", void 0);
4735
4824
  _ts_decorate7([
4736
- import_tracing4.trace.info()
4825
+ import_tracing5.trace.info()
4737
4826
  ], ClientServicesHost.prototype, "_open", void 0);
4738
4827
  _ts_decorate7([
4739
4828
  import_async17.synchronized,
4740
- import_tracing4.trace.span()
4829
+ import_tracing5.trace.span()
4741
4830
  ], ClientServicesHost.prototype, "open", null);
4742
4831
  _ts_decorate7([
4743
4832
  import_async17.synchronized,
4744
- import_tracing4.trace.span()
4833
+ import_tracing5.trace.span()
4745
4834
  ], ClientServicesHost.prototype, "close", null);
4746
4835
  ClientServicesHost = _ts_decorate7([
4747
- import_tracing4.trace.resource()
4836
+ import_tracing5.trace.resource()
4748
4837
  ], ClientServicesHost);
4749
4838
 
4750
4839
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
4751
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
4840
+ var __dxlog_file18 = "/mnt/ramdisk/work/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
4752
4841
  var sanitizeInvitation = (invitation) => {
4753
4842
  return {
4754
4843
  invitationId: invitation.invitationId,