@dxos/client-services 0.4.7-main.e015b9e → 0.4.7-main.e0789ae

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 (44) hide show
  1. package/dist/lib/browser/{chunk-M3HBHYHU.mjs → chunk-LQJ2ANWZ.mjs} +214 -140
  2. package/dist/lib/browser/chunk-LQJ2ANWZ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +4 -2
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +4 -2
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-UPGNRF2T.cjs → chunk-6B7VIDBN.cjs} +207 -133
  9. package/dist/lib/node/chunk-6B7VIDBN.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +40 -38
  11. package/dist/lib/node/index.cjs.map +2 -2
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +11 -9
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  16. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  17. package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
  18. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/identity/identity.d.ts +5 -1
  20. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-context.d.ts +7 -3
  22. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/service-host.d.ts +4 -2
  24. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  25. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
  26. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  28. package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
  29. package/dist/types/src/version.d.ts +1 -1
  30. package/package.json +35 -35
  31. package/src/packlets/devices/devices-service.test.ts +8 -4
  32. package/src/packlets/devices/devices-service.ts +47 -11
  33. package/src/packlets/identity/identity-manager.ts +48 -6
  34. package/src/packlets/identity/identity.ts +9 -1
  35. package/src/packlets/services/automerge-host.test.ts +1 -1
  36. package/src/packlets/services/service-context.ts +24 -4
  37. package/src/packlets/services/service-host.ts +8 -3
  38. package/src/packlets/spaces/data-space-manager.ts +18 -3
  39. package/src/packlets/spaces/spaces-service.ts +1 -3
  40. package/src/packlets/testing/test-builder.ts +1 -1
  41. package/src/packlets/vault/shared-worker-connection.ts +2 -0
  42. package/src/version.ts +1 -1
  43. package/dist/lib/browser/chunk-M3HBHYHU.mjs.map +0 -7
  44. package/dist/lib/node/chunk-UPGNRF2T.cjs.map +0 -7
@@ -483,17 +483,18 @@ function _ts_decorate(decorators, target, key, desc) {
483
483
  }
484
484
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
485
485
  var Identity = class {
486
- constructor({ space, signer, identityKey, deviceKey }) {
486
+ constructor({ space, signer, identityKey, deviceKey, presence }) {
487
487
  this.stateUpdate = new Event();
488
488
  this.space = space;
489
489
  this._signer = signer;
490
+ this._presence = presence;
490
491
  this.identityKey = identityKey;
491
492
  this.deviceKey = deviceKey;
492
493
  log2.trace("dxos.halo.device", {
493
494
  deviceKey
494
495
  }, {
495
496
  F: __dxlog_file2,
496
- L: 63,
497
+ L: 67,
497
498
  S: this,
498
499
  C: (f, a) => f(...a)
499
500
  });
@@ -551,6 +552,9 @@ var Identity = class {
551
552
  get deviceCredentialChain() {
552
553
  return this._deviceStateMachine.deviceCredentialChain;
553
554
  }
555
+ get presence() {
556
+ return this._presence;
557
+ }
554
558
  /**
555
559
  * Issues credentials as identity.
556
560
  * Requires identity to be ready.
@@ -558,7 +562,7 @@ var Identity = class {
558
562
  getIdentityCredentialSigner() {
559
563
  invariant(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
560
564
  F: __dxlog_file2,
561
- L: 136,
565
+ L: 144,
562
566
  S: this,
563
567
  A: [
564
568
  "this._deviceStateMachine.deviceCredentialChain",
@@ -582,7 +586,7 @@ var Identity = class {
582
586
  dataFeedKey
583
587
  }, {
584
588
  F: __dxlog_file2,
585
- L: 152,
589
+ L: 160,
586
590
  S: this,
587
591
  C: (f, a) => f(...a)
588
592
  });
@@ -642,8 +646,9 @@ import { invariant as invariant2 } from "@dxos/invariant";
642
646
  import { PublicKey as PublicKey4 } from "@dxos/keys";
643
647
  import { log as log3 } from "@dxos/log";
644
648
  import { trace as trace2 } from "@dxos/protocols";
645
- import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
649
+ import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
646
650
  import { AdmittedFeed as AdmittedFeed2, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
651
+ import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
647
652
  import { Timeframe } from "@dxos/timeframe";
648
653
  import { trace as Trace } from "@dxos/tracing";
649
654
  import { isNode, deferFunction } from "@dxos/util";
@@ -658,15 +663,20 @@ function _ts_decorate2(decorators, target, key, desc) {
658
663
  return c > 3 && r && Object.defineProperty(target, key, r), r;
659
664
  }
660
665
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
666
+ var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
667
+ var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
661
668
  var IdentityManager = class {
662
669
  // TODO(burdon): IdentityManagerParams.
663
670
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
664
- constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
671
+ constructor(_metadataStore, _keyring, _feedStore, _spaceManager, params) {
665
672
  this._metadataStore = _metadataStore;
666
673
  this._keyring = _keyring;
667
674
  this._feedStore = _feedStore;
668
675
  this._spaceManager = _spaceManager;
669
676
  this.stateUpdate = new Event2();
677
+ const { devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL, devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
678
+ this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
679
+ this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
670
680
  }
671
681
  get identity() {
672
682
  return this._identity;
@@ -677,7 +687,7 @@ var IdentityManager = class {
677
687
  id: traceId
678
688
  }), {
679
689
  F: __dxlog_file3,
680
- L: 84,
690
+ L: 104,
681
691
  S: this,
682
692
  C: (f, a) => f(...a)
683
693
  });
@@ -686,7 +696,7 @@ var IdentityManager = class {
686
696
  identityRecord
687
697
  }, {
688
698
  F: __dxlog_file3,
689
- L: 87,
699
+ L: 107,
690
700
  S: this,
691
701
  C: (f, a) => f(...a)
692
702
  });
@@ -699,7 +709,7 @@ var IdentityManager = class {
699
709
  displayName: this._identity.profileDocument?.displayName
700
710
  }, {
701
711
  F: __dxlog_file3,
702
- L: 92,
712
+ L: 112,
703
713
  S: this,
704
714
  C: (f, a) => f(...a)
705
715
  });
@@ -709,7 +719,7 @@ var IdentityManager = class {
709
719
  id: traceId
710
720
  }), {
711
721
  F: __dxlog_file3,
712
- L: 99,
722
+ L: 119,
713
723
  S: this,
714
724
  C: (f, a) => f(...a)
715
725
  });
@@ -720,7 +730,7 @@ var IdentityManager = class {
720
730
  async createIdentity({ displayName, deviceProfile } = {}) {
721
731
  invariant2(!this._identity, "Identity already exists.", {
722
732
  F: __dxlog_file3,
723
- L: 108,
733
+ L: 128,
724
734
  S: this,
725
735
  A: [
726
736
  "!this._identity",
@@ -729,7 +739,7 @@ var IdentityManager = class {
729
739
  });
730
740
  log3("creating identity...", void 0, {
731
741
  F: __dxlog_file3,
732
- L: 109,
742
+ L: 129,
733
743
  S: this,
734
744
  C: (f, a) => f(...a)
735
745
  });
@@ -750,7 +760,7 @@ var IdentityManager = class {
750
760
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
751
761
  invariant2(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
752
762
  F: __dxlog_file3,
753
- L: 128,
763
+ L: 148,
754
764
  S: this,
755
765
  A: [
756
766
  "identityRecord.haloSpace.genesisFeedKey",
@@ -759,7 +769,7 @@ var IdentityManager = class {
759
769
  });
760
770
  invariant2(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
761
771
  F: __dxlog_file3,
762
- L: 129,
772
+ L: 149,
763
773
  S: this,
764
774
  A: [
765
775
  "identityRecord.haloSpace.dataFeedKey",
@@ -798,7 +808,7 @@ var IdentityManager = class {
798
808
  displayName: this._identity.profileDocument?.displayName
799
809
  }, {
800
810
  F: __dxlog_file3,
801
- L: 171,
811
+ L: 191,
802
812
  S: this,
803
813
  C: (f, a) => f(...a)
804
814
  });
@@ -809,7 +819,7 @@ var IdentityManager = class {
809
819
  profile: identity.profileDocument
810
820
  }, {
811
821
  F: __dxlog_file3,
812
- L: 177,
822
+ L: 197,
813
823
  S: this,
814
824
  C: (f, a) => f(...a)
815
825
  });
@@ -846,13 +856,13 @@ var IdentityManager = class {
846
856
  params
847
857
  }, {
848
858
  F: __dxlog_file3,
849
- L: 215,
859
+ L: 235,
850
860
  S: this,
851
861
  C: (f, a) => f(...a)
852
862
  });
853
863
  invariant2(!this._identity, "Identity already exists.", {
854
864
  F: __dxlog_file3,
855
- L: 216,
865
+ L: 236,
856
866
  S: this,
857
867
  A: [
858
868
  "!this._identity",
@@ -880,7 +890,7 @@ var IdentityManager = class {
880
890
  displayName: this._identity.profileDocument?.displayName
881
891
  }, {
882
892
  F: __dxlog_file3,
883
- L: 235,
893
+ L: 255,
884
894
  S: this,
885
895
  C: (f, a) => f(...a)
886
896
  });
@@ -894,7 +904,7 @@ var IdentityManager = class {
894
904
  deviceKey: identity.deviceKey
895
905
  }, {
896
906
  F: __dxlog_file3,
897
- L: 245,
907
+ L: 265,
898
908
  S: this,
899
909
  C: (f, a) => f(...a)
900
910
  });
@@ -906,7 +916,7 @@ var IdentityManager = class {
906
916
  async updateProfile(profile) {
907
917
  invariant2(this._identity, "Identity not initialized.", {
908
918
  F: __dxlog_file3,
909
- L: 253,
919
+ L: 273,
910
920
  S: this,
911
921
  A: [
912
922
  "this._identity",
@@ -937,7 +947,7 @@ var IdentityManager = class {
937
947
  async updateDeviceProfile(profile) {
938
948
  invariant2(this._identity, "Identity not initialized.", {
939
949
  F: __dxlog_file3,
940
- L: 270,
950
+ L: 290,
941
951
  S: this,
942
952
  A: [
943
953
  "this._identity",
@@ -966,13 +976,14 @@ var IdentityManager = class {
966
976
  return {
967
977
  deviceKey: this._identity.deviceKey,
968
978
  kind: DeviceKind.CURRENT,
979
+ presence: Device.PresenceState.ONLINE,
969
980
  profile
970
981
  };
971
982
  }
972
983
  async _constructIdentity(identityRecord) {
973
984
  invariant2(!this._identity, void 0, {
974
985
  F: __dxlog_file3,
975
- L: 291,
986
+ L: 316,
976
987
  S: this,
977
988
  A: [
978
989
  "!this._identity",
@@ -983,13 +994,22 @@ var IdentityManager = class {
983
994
  identityRecord
984
995
  }, {
985
996
  F: __dxlog_file3,
986
- L: 292,
997
+ L: 317,
987
998
  S: this,
988
999
  C: (f, a) => f(...a)
989
1000
  });
1001
+ const gossip = new Gossip({
1002
+ localPeerId: identityRecord.deviceKey
1003
+ });
1004
+ const presence = new Presence({
1005
+ announceInterval: this._devicePresenceAnnounceInterval,
1006
+ offlineTimeout: this._devicePresenceOfflineTimeout,
1007
+ identityKey: identityRecord.deviceKey,
1008
+ gossip
1009
+ });
990
1010
  invariant2(identityRecord.haloSpace.controlFeedKey, void 0, {
991
1011
  F: __dxlog_file3,
992
- L: 295,
1012
+ L: 330,
993
1013
  S: this,
994
1014
  A: [
995
1015
  "identityRecord.haloSpace.controlFeedKey",
@@ -1001,7 +1021,7 @@ var IdentityManager = class {
1001
1021
  });
1002
1022
  invariant2(identityRecord.haloSpace.dataFeedKey, void 0, {
1003
1023
  F: __dxlog_file3,
1004
- L: 299,
1024
+ L: 334,
1005
1025
  S: this,
1006
1026
  A: [
1007
1027
  "identityRecord.haloSpace.dataFeedKey",
@@ -1019,12 +1039,14 @@ var IdentityManager = class {
1019
1039
  credentialProvider: createAuthProvider(createCredentialSignerWithKey2(this._keyring, identityRecord.deviceKey)),
1020
1040
  credentialAuthenticator: deferFunction(() => identity.authVerifier.verifier)
1021
1041
  },
1042
+ gossip,
1022
1043
  identityKey: identityRecord.identityKey
1023
1044
  });
1024
1045
  await space.setControlFeed(controlFeed);
1025
- space.setDataFeed(dataFeed);
1046
+ void space.setDataFeed(dataFeed);
1026
1047
  const identity = new Identity({
1027
1048
  space,
1049
+ presence,
1028
1050
  signer: this._keyring,
1029
1051
  identityKey: identityRecord.identityKey,
1030
1052
  deviceKey: identityRecord.deviceKey
@@ -1033,7 +1055,7 @@ var IdentityManager = class {
1033
1055
  identityKey: identityRecord.identityKey
1034
1056
  }, {
1035
1057
  F: __dxlog_file3,
1036
- L: 323,
1058
+ L: 360,
1037
1059
  S: this,
1038
1060
  C: (f, a) => f(...a)
1039
1061
  });
@@ -1043,19 +1065,22 @@ var IdentityManager = class {
1043
1065
  identity.stateUpdate.on(() => this.stateUpdate.emit());
1044
1066
  return identity;
1045
1067
  }
1046
- async _constructSpace({ spaceRecord, swarmIdentity, identityKey }) {
1068
+ async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }) {
1047
1069
  return this._spaceManager.constructSpace({
1048
1070
  metadata: {
1049
1071
  key: spaceRecord.key,
1050
1072
  genesisFeedKey: spaceRecord.genesisFeedKey
1051
1073
  },
1052
1074
  swarmIdentity,
1053
- onAuthorizedConnection: () => {
1075
+ onAuthorizedConnection: (session) => {
1076
+ session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
1077
+ remotePeerId: session.remotePeerId
1078
+ }));
1054
1079
  },
1055
1080
  onAuthFailure: () => {
1056
1081
  log3.warn("auth failure", void 0, {
1057
1082
  F: __dxlog_file3,
1058
- L: 343,
1083
+ L: 385,
1059
1084
  S: this,
1060
1085
  C: (f, a) => f(...a)
1061
1086
  });
@@ -2646,7 +2671,7 @@ var getPlatform = () => {
2646
2671
  };
2647
2672
 
2648
2673
  // packages/sdk/client-services/src/version.ts
2649
- var DXOS_VERSION = "0.4.7-main.e015b9e";
2674
+ var DXOS_VERSION = "0.4.7-main.e0789ae";
2650
2675
 
2651
2676
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2652
2677
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -3574,7 +3599,7 @@ import { PublicKey as PublicKey9 } from "@dxos/keys";
3574
3599
  import { log as log11 } from "@dxos/log";
3575
3600
  import { trace as trace7 } from "@dxos/protocols";
3576
3601
  import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
3577
- import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
3602
+ import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
3578
3603
  import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
3579
3604
 
3580
3605
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
@@ -3662,7 +3687,7 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
3662
3687
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
3663
3688
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
3664
3689
  var DataSpaceManager = class {
3665
- constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
3690
+ constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost, params) {
3666
3691
  this._spaceManager = _spaceManager;
3667
3692
  this._metadataStore = _metadataStore;
3668
3693
  this._dataServiceSubscriptions = _dataServiceSubscriptions;
@@ -3675,6 +3700,9 @@ var DataSpaceManager = class {
3675
3700
  this._spaces = new ComplexMap3(PublicKey9.hash);
3676
3701
  this._isOpen = false;
3677
3702
  this._instanceId = PublicKey9.random().toHex();
3703
+ const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
3704
+ this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
3705
+ this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
3678
3706
  }
3679
3707
  // TODO(burdon): Remove.
3680
3708
  get spaces() {
@@ -3683,7 +3711,7 @@ var DataSpaceManager = class {
3683
3711
  async open() {
3684
3712
  log11("open", void 0, {
3685
3713
  F: __dxlog_file13,
3686
- L: 90,
3714
+ L: 105,
3687
3715
  S: this,
3688
3716
  C: (f, a) => f(...a)
3689
3717
  });
@@ -3691,7 +3719,7 @@ var DataSpaceManager = class {
3691
3719
  id: this._instanceId
3692
3720
  }), {
3693
3721
  F: __dxlog_file13,
3694
- L: 91,
3722
+ L: 106,
3695
3723
  S: this,
3696
3724
  C: (f, a) => f(...a)
3697
3725
  });
@@ -3699,7 +3727,7 @@ var DataSpaceManager = class {
3699
3727
  spaces: this._metadataStore.spaces.length
3700
3728
  }, {
3701
3729
  F: __dxlog_file13,
3702
- L: 92,
3730
+ L: 107,
3703
3731
  S: this,
3704
3732
  C: (f, a) => f(...a)
3705
3733
  });
@@ -3709,7 +3737,7 @@ var DataSpaceManager = class {
3709
3737
  spaceMetadata
3710
3738
  }, {
3711
3739
  F: __dxlog_file13,
3712
- L: 96,
3740
+ L: 111,
3713
3741
  S: this,
3714
3742
  C: (f, a) => f(...a)
3715
3743
  });
@@ -3720,7 +3748,7 @@ var DataSpaceManager = class {
3720
3748
  err
3721
3749
  }, {
3722
3750
  F: __dxlog_file13,
3723
- L: 99,
3751
+ L: 114,
3724
3752
  S: this,
3725
3753
  C: (f, a) => f(...a)
3726
3754
  });
@@ -3737,7 +3765,7 @@ var DataSpaceManager = class {
3737
3765
  id: this._instanceId
3738
3766
  }), {
3739
3767
  F: __dxlog_file13,
3740
- L: 112,
3768
+ L: 127,
3741
3769
  S: this,
3742
3770
  C: (f, a) => f(...a)
3743
3771
  });
@@ -3745,7 +3773,7 @@ var DataSpaceManager = class {
3745
3773
  async close() {
3746
3774
  log11("close", void 0, {
3747
3775
  F: __dxlog_file13,
3748
- L: 117,
3776
+ L: 132,
3749
3777
  S: this,
3750
3778
  C: (f, a) => f(...a)
3751
3779
  });
@@ -3761,7 +3789,7 @@ var DataSpaceManager = class {
3761
3789
  async createSpace() {
3762
3790
  invariant11(this._isOpen, "Not open.", {
3763
3791
  F: __dxlog_file13,
3764
- L: 130,
3792
+ L: 145,
3765
3793
  S: this,
3766
3794
  A: [
3767
3795
  "this._isOpen",
@@ -3782,7 +3810,7 @@ var DataSpaceManager = class {
3782
3810
  spaceKey
3783
3811
  }, {
3784
3812
  F: __dxlog_file13,
3785
- L: 142,
3813
+ L: 157,
3786
3814
  S: this,
3787
3815
  C: (f, a) => f(...a)
3788
3816
  });
@@ -3798,7 +3826,7 @@ var DataSpaceManager = class {
3798
3826
  const memberCredential = credentials[1];
3799
3827
  invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3800
3828
  F: __dxlog_file13,
3801
- L: 155,
3829
+ L: 170,
3802
3830
  S: this,
3803
3831
  A: [
3804
3832
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3816,13 +3844,13 @@ var DataSpaceManager = class {
3816
3844
  opts
3817
3845
  }, {
3818
3846
  F: __dxlog_file13,
3819
- L: 167,
3847
+ L: 182,
3820
3848
  S: this,
3821
3849
  C: (f, a) => f(...a)
3822
3850
  });
3823
3851
  invariant11(this._isOpen, "Not open.", {
3824
3852
  F: __dxlog_file13,
3825
- L: 168,
3853
+ L: 183,
3826
3854
  S: this,
3827
3855
  A: [
3828
3856
  "this._isOpen",
@@ -3831,7 +3859,7 @@ var DataSpaceManager = class {
3831
3859
  });
3832
3860
  invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3833
3861
  F: __dxlog_file13,
3834
- L: 169,
3862
+ L: 184,
3835
3863
  S: this,
3836
3864
  A: [
3837
3865
  "!this._spaces.has(opts.spaceKey)",
@@ -3866,16 +3894,16 @@ var DataSpaceManager = class {
3866
3894
  metadata
3867
3895
  }, {
3868
3896
  F: __dxlog_file13,
3869
- L: 202,
3897
+ L: 217,
3870
3898
  S: this,
3871
3899
  C: (f, a) => f(...a)
3872
3900
  });
3873
- const gossip = new Gossip({
3901
+ const gossip = new Gossip2({
3874
3902
  localPeerId: this._signingContext.deviceKey
3875
3903
  });
3876
- const presence = new Presence({
3877
- announceInterval: PRESENCE_ANNOUNCE_INTERVAL,
3878
- offlineTimeout: PRESENCE_OFFLINE_TIMEOUT,
3904
+ const presence = new Presence2({
3905
+ announceInterval: this._spaceMemberPresenceAnnounceInterval,
3906
+ offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
3879
3907
  identityKey: this._signingContext.identityKey,
3880
3908
  gossip
3881
3909
  });
@@ -3904,7 +3932,7 @@ var DataSpaceManager = class {
3904
3932
  onAuthFailure: () => {
3905
3933
  log11.warn("auth failure", void 0, {
3906
3934
  F: __dxlog_file13,
3907
- L: 239,
3935
+ L: 254,
3908
3936
  S: this,
3909
3937
  C: (f, a) => f(...a)
3910
3938
  });
@@ -3928,7 +3956,7 @@ var DataSpaceManager = class {
3928
3956
  space: space.key
3929
3957
  }, {
3930
3958
  F: __dxlog_file13,
3931
- L: 257,
3959
+ L: 272,
3932
3960
  S: this,
3933
3961
  C: (f, a) => f(...a)
3934
3962
  });
@@ -3940,7 +3968,7 @@ var DataSpaceManager = class {
3940
3968
  open: this._isOpen
3941
3969
  }, {
3942
3970
  F: __dxlog_file13,
3943
- L: 264,
3971
+ L: 279,
3944
3972
  S: this,
3945
3973
  C: (f, a) => f(...a)
3946
3974
  });
@@ -3953,7 +3981,7 @@ var DataSpaceManager = class {
3953
3981
  space: space.key
3954
3982
  }, {
3955
3983
  F: __dxlog_file13,
3956
- L: 270,
3984
+ L: 285,
3957
3985
  S: this,
3958
3986
  C: (f, a) => f(...a)
3959
3987
  });
@@ -4197,9 +4225,7 @@ var SpacesServiceImpl = class {
4197
4225
  return {
4198
4226
  identity: {
4199
4227
  identityKey: member.key,
4200
- profile: {
4201
- displayName: member.profile?.displayName
4202
- }
4228
+ profile: member.profile ?? {}
4203
4229
  },
4204
4230
  presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
4205
4231
  peerStates: peers
@@ -4219,6 +4245,7 @@ import { Context as Context9 } from "@dxos/context";
4219
4245
  import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4220
4246
  import { failUndefined as failUndefined2 } from "@dxos/debug";
4221
4247
  import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
4248
+ import { IndexMetadataStore } from "@dxos/echo-schema";
4222
4249
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
4223
4250
  import { invariant as invariant13 } from "@dxos/invariant";
4224
4251
  import { Keyring } from "@dxos/keyring";
@@ -4241,16 +4268,20 @@ function _ts_decorate6(decorators, target, key, desc) {
4241
4268
  }
4242
4269
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4243
4270
  var ServiceContext = class {
4244
- constructor(storage, networkManager, signalManager, modelFactory) {
4271
+ constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
4245
4272
  this.storage = storage;
4246
4273
  this.networkManager = networkManager;
4247
4274
  this.signalManager = signalManager;
4248
4275
  this.modelFactory = modelFactory;
4276
+ this._runtimeParams = _runtimeParams;
4249
4277
  this.initialized = new Trigger5();
4250
4278
  this.dataServiceSubscriptions = new DataServiceSubscriptions();
4251
4279
  this._handlerFactories = /* @__PURE__ */ new Map();
4252
4280
  this._instanceId = PublicKey10.random().toHex();
4253
4281
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
4282
+ this.indexMetadata = new IndexMetadataStore({
4283
+ directory: storage.createDirectory("index-metadata")
4284
+ });
4254
4285
  this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
4255
4286
  this.blobStore = new BlobStore(storage.createDirectory("blobs"));
4256
4287
  this.keyring = new Keyring(storage.createDirectory("keyring"));
@@ -4272,8 +4303,11 @@ var ServiceContext = class {
4272
4303
  modelFactory: this.modelFactory,
4273
4304
  snapshotStore: this.snapshotStore
4274
4305
  });
4275
- this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4276
- this.automergeHost = new AutomergeHost(storage.createDirectory("automerge"));
4306
+ this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4307
+ this.automergeHost = new AutomergeHost({
4308
+ directory: storage.createDirectory("automerge"),
4309
+ metadata: this.indexMetadata
4310
+ });
4277
4311
  this.invitations = new InvitationsHandler(this.networkManager);
4278
4312
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
4279
4313
  }
@@ -4281,7 +4315,7 @@ var ServiceContext = class {
4281
4315
  await this._checkStorageVersion();
4282
4316
  log13("opening...", void 0, {
4283
4317
  F: __dxlog_file15,
4284
- L: 133,
4318
+ L: 152,
4285
4319
  S: this,
4286
4320
  C: (f, a) => f(...a)
4287
4321
  });
@@ -4289,7 +4323,7 @@ var ServiceContext = class {
4289
4323
  id: this._instanceId
4290
4324
  }), {
4291
4325
  F: __dxlog_file15,
4292
- L: 134,
4326
+ L: 153,
4293
4327
  S: this,
4294
4328
  C: (f, a) => f(...a)
4295
4329
  });
@@ -4305,13 +4339,13 @@ var ServiceContext = class {
4305
4339
  id: this._instanceId
4306
4340
  }), {
4307
4341
  F: __dxlog_file15,
4308
- L: 144,
4342
+ L: 163,
4309
4343
  S: this,
4310
4344
  C: (f, a) => f(...a)
4311
4345
  });
4312
4346
  log13("opened", void 0, {
4313
4347
  F: __dxlog_file15,
4314
- L: 145,
4348
+ L: 164,
4315
4349
  S: this,
4316
4350
  C: (f, a) => f(...a)
4317
4351
  });
@@ -4319,7 +4353,7 @@ var ServiceContext = class {
4319
4353
  async close() {
4320
4354
  log13("closing...", void 0, {
4321
4355
  F: __dxlog_file15,
4322
- L: 149,
4356
+ L: 168,
4323
4357
  S: this,
4324
4358
  C: (f, a) => f(...a)
4325
4359
  });
@@ -4337,7 +4371,7 @@ var ServiceContext = class {
4337
4371
  await this.metadataStore.close();
4338
4372
  log13("closed", void 0, {
4339
4373
  F: __dxlog_file15,
4340
- L: 162,
4374
+ L: 181,
4341
4375
  S: this,
4342
4376
  C: (f, a) => f(...a)
4343
4377
  });
@@ -4351,7 +4385,7 @@ var ServiceContext = class {
4351
4385
  const factory = this._handlerFactories.get(invitation.kind);
4352
4386
  invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4353
4387
  F: __dxlog_file15,
4354
- L: 173,
4388
+ L: 192,
4355
4389
  S: this,
4356
4390
  A: [
4357
4391
  "factory",
@@ -4383,7 +4417,7 @@ var ServiceContext = class {
4383
4417
  async _initialize(ctx) {
4384
4418
  log13("initializing spaces...", void 0, {
4385
4419
  F: __dxlog_file15,
4386
- L: 204,
4420
+ L: 223,
4387
4421
  S: this,
4388
4422
  C: (f, a) => f(...a)
4389
4423
  });
@@ -4401,12 +4435,12 @@ var ServiceContext = class {
4401
4435
  });
4402
4436
  }
4403
4437
  };
4404
- this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
4438
+ this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4405
4439
  await this.dataSpaceManager.open();
4406
4440
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4407
4441
  invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4408
4442
  F: __dxlog_file15,
4409
- L: 228,
4443
+ L: 248,
4410
4444
  S: this,
4411
4445
  A: [
4412
4446
  "this.dataSpaceManager",
@@ -4430,7 +4464,7 @@ var ServiceContext = class {
4430
4464
  details: assertion
4431
4465
  }, {
4432
4466
  F: __dxlog_file15,
4433
- L: 244,
4467
+ L: 264,
4434
4468
  S: this,
4435
4469
  C: (f, a) => f(...a)
4436
4470
  });
@@ -4441,7 +4475,7 @@ var ServiceContext = class {
4441
4475
  details: assertion
4442
4476
  }, {
4443
4477
  F: __dxlog_file15,
4444
- L: 248,
4478
+ L: 268,
4445
4479
  S: this,
4446
4480
  C: (f, a) => f(...a)
4447
4481
  });
@@ -4452,7 +4486,7 @@ var ServiceContext = class {
4452
4486
  details: assertion
4453
4487
  }, {
4454
4488
  F: __dxlog_file15,
4455
- L: 253,
4489
+ L: 273,
4456
4490
  S: this,
4457
4491
  C: (f, a) => f(...a)
4458
4492
  });
@@ -4463,7 +4497,7 @@ var ServiceContext = class {
4463
4497
  } catch (err) {
4464
4498
  log13.catch(err, void 0, {
4465
4499
  F: __dxlog_file15,
4466
- L: 259,
4500
+ L: 279,
4467
4501
  S: this,
4468
4502
  C: (f, a) => f(...a)
4469
4503
  });
@@ -4687,8 +4721,8 @@ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protoc
4687
4721
  import { Context as Context10 } from "@dxos/context";
4688
4722
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4689
4723
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4690
- import { base, getRawDoc } from "@dxos/echo-schema";
4691
- import { invariant as invariant14 } from "@dxos/invariant";
4724
+ import { getRawDoc, getAutomergeObjectCore } from "@dxos/echo-schema";
4725
+ import { invariant as invariant15 } from "@dxos/invariant";
4692
4726
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4693
4727
  import { log as log16 } from "@dxos/log";
4694
4728
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4704,7 +4738,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4704
4738
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4705
4739
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4706
4740
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4707
- import { DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
4741
+ import { invariant as invariant14 } from "@dxos/invariant";
4742
+ import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
4743
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4708
4744
  var DevicesServiceImpl = class {
4709
4745
  constructor(_identityManager) {
4710
4746
  this._identityManager = _identityManager;
@@ -4721,22 +4757,58 @@ var DevicesServiceImpl = class {
4721
4757
  devices: []
4722
4758
  });
4723
4759
  } else {
4760
+ invariant14(this._identityManager.identity?.presence, "presence not present", {
4761
+ F: __dxlog_file17,
4762
+ L: 32,
4763
+ S: this,
4764
+ A: [
4765
+ "this._identityManager.identity?.presence",
4766
+ "'presence not present'"
4767
+ ]
4768
+ });
4769
+ const peers = this._identityManager.identity.presence.getPeersOnline();
4724
4770
  next({
4725
- devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
4726
- deviceKey: key,
4727
- kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
4728
- profile
4729
- }))
4771
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
4772
+ const isMe = this._identityManager.identity?.deviceKey.equals(key);
4773
+ const peerState = peers.find((peer) => peer.identityKey.equals(key));
4774
+ return {
4775
+ deviceKey: key,
4776
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
4777
+ profile,
4778
+ presence: isMe ? Device2.PresenceState.ONLINE : peerState ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE
4779
+ };
4780
+ })
4730
4781
  });
4731
4782
  }
4732
4783
  };
4784
+ let identitySubscribed = false;
4785
+ let presenceSubscribed = false;
4786
+ const subscribeIdentity = () => {
4787
+ if (!identitySubscribed) {
4788
+ this._identityManager.identity?.stateUpdate.on(() => {
4789
+ update();
4790
+ });
4791
+ identitySubscribed = true;
4792
+ }
4793
+ };
4794
+ const subscribePresence = () => {
4795
+ if (!presenceSubscribed) {
4796
+ this._identityManager.identity?.presence?.updated.on(() => {
4797
+ update();
4798
+ });
4799
+ presenceSubscribed = true;
4800
+ }
4801
+ };
4733
4802
  const subscriptions = new EventSubscriptions3();
4803
+ if (this._identityManager.identity) {
4804
+ subscribeIdentity();
4805
+ subscribePresence();
4806
+ }
4734
4807
  subscriptions.add(this._identityManager.stateUpdate.on(() => {
4735
4808
  update();
4736
4809
  if (this._identityManager.identity) {
4737
- subscriptions.add(this._identityManager.identity.stateUpdate.on(() => {
4738
- update();
4739
- }));
4810
+ subscribeIdentity();
4811
+ subscribePresence();
4740
4812
  }
4741
4813
  }));
4742
4814
  update();
@@ -4963,7 +5035,7 @@ function _ts_decorate8(decorators, target, key, desc) {
4963
5035
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4964
5036
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4965
5037
  }
4966
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5038
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4967
5039
  var createDefaultModelFactory = () => {
4968
5040
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4969
5041
  };
@@ -4976,7 +5048,8 @@ var ClientServicesHost = class {
4976
5048
  storage,
4977
5049
  // TODO(wittjosiah): Turn this on by default.
4978
5050
  lockKey,
4979
- callbacks
5051
+ callbacks,
5052
+ runtimeParams
4980
5053
  } = {}) {
4981
5054
  this._tracingService = TRACE_PROCESSOR2.createTraceSender();
4982
5055
  this._statusUpdate = new Event8();
@@ -4985,6 +5058,7 @@ var ClientServicesHost = class {
4985
5058
  this._storage = storage;
4986
5059
  this._modelFactory = modelFactory;
4987
5060
  this._callbacks = callbacks;
5061
+ this._runtimeParams = runtimeParams;
4988
5062
  if (config) {
4989
5063
  this.initialize({
4990
5064
  config,
@@ -5051,9 +5125,9 @@ var ClientServicesHost = class {
5051
5125
  * Can only be called once.
5052
5126
  */
5053
5127
  initialize({ config, ...options }) {
5054
- invariant14(!this._open, "service host is open", {
5055
- F: __dxlog_file17,
5056
- L: 186,
5128
+ invariant15(!this._open, "service host is open", {
5129
+ F: __dxlog_file18,
5130
+ L: 190,
5057
5131
  S: this,
5058
5132
  A: [
5059
5133
  "!this._open",
@@ -5061,15 +5135,15 @@ var ClientServicesHost = class {
5061
5135
  ]
5062
5136
  });
5063
5137
  log16("initializing...", void 0, {
5064
- F: __dxlog_file17,
5065
- L: 187,
5138
+ F: __dxlog_file18,
5139
+ L: 191,
5066
5140
  S: this,
5067
5141
  C: (f, a) => f(...a)
5068
5142
  });
5069
5143
  if (config) {
5070
- invariant14(!this._config, "config already set", {
5071
- F: __dxlog_file17,
5072
- L: 190,
5144
+ invariant15(!this._config, "config already set", {
5145
+ F: __dxlog_file18,
5146
+ L: 194,
5073
5147
  S: this,
5074
5148
  A: [
5075
5149
  "!this._config",
@@ -5085,9 +5159,9 @@ var ClientServicesHost = class {
5085
5159
  iceServers: this._config?.get("runtime.services.ice")
5086
5160
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
5087
5161
  this._signalManager = signalManager;
5088
- invariant14(!this._networkManager, "network manager already set", {
5089
- F: __dxlog_file17,
5090
- L: 206,
5162
+ invariant15(!this._networkManager, "network manager already set", {
5163
+ F: __dxlog_file18,
5164
+ L: 210,
5091
5165
  S: this,
5092
5166
  A: [
5093
5167
  "!this._networkManager",
@@ -5100,8 +5174,8 @@ var ClientServicesHost = class {
5100
5174
  signalManager
5101
5175
  });
5102
5176
  log16("initialized", void 0, {
5103
- F: __dxlog_file17,
5104
- L: 213,
5177
+ F: __dxlog_file18,
5178
+ L: 217,
5105
5179
  S: this,
5106
5180
  C: (f, a) => f(...a)
5107
5181
  });
@@ -5114,41 +5188,41 @@ var ClientServicesHost = class {
5114
5188
  log16.trace("dxos.client-services.host.open", trace9.begin({
5115
5189
  id: traceId
5116
5190
  }), {
5117
- F: __dxlog_file17,
5118
- L: 224,
5191
+ F: __dxlog_file18,
5192
+ L: 228,
5119
5193
  S: this,
5120
5194
  C: (f, a) => f(...a)
5121
5195
  });
5122
- invariant14(this._config, "config not set", {
5123
- F: __dxlog_file17,
5124
- L: 226,
5196
+ invariant15(this._config, "config not set", {
5197
+ F: __dxlog_file18,
5198
+ L: 230,
5125
5199
  S: this,
5126
5200
  A: [
5127
5201
  "this._config",
5128
5202
  "'config not set'"
5129
5203
  ]
5130
5204
  });
5131
- invariant14(this._storage, "storage not set", {
5132
- F: __dxlog_file17,
5133
- L: 227,
5205
+ invariant15(this._storage, "storage not set", {
5206
+ F: __dxlog_file18,
5207
+ L: 231,
5134
5208
  S: this,
5135
5209
  A: [
5136
5210
  "this._storage",
5137
5211
  "'storage not set'"
5138
5212
  ]
5139
5213
  });
5140
- invariant14(this._signalManager, "signal manager not set", {
5141
- F: __dxlog_file17,
5142
- L: 228,
5214
+ invariant15(this._signalManager, "signal manager not set", {
5215
+ F: __dxlog_file18,
5216
+ L: 232,
5143
5217
  S: this,
5144
5218
  A: [
5145
5219
  "this._signalManager",
5146
5220
  "'signal manager not set'"
5147
5221
  ]
5148
5222
  });
5149
- invariant14(this._networkManager, "network manager not set", {
5150
- F: __dxlog_file17,
5151
- L: 229,
5223
+ invariant15(this._networkManager, "network manager not set", {
5224
+ F: __dxlog_file18,
5225
+ L: 233,
5152
5226
  S: this,
5153
5227
  A: [
5154
5228
  "this._networkManager",
@@ -5159,14 +5233,14 @@ var ClientServicesHost = class {
5159
5233
  log16("opening...", {
5160
5234
  lockKey: this._resourceLock?.lockKey
5161
5235
  }, {
5162
- F: __dxlog_file17,
5163
- L: 232,
5236
+ F: __dxlog_file18,
5237
+ L: 236,
5164
5238
  S: this,
5165
5239
  C: (f, a) => f(...a)
5166
5240
  });
5167
5241
  await this._resourceLock?.acquire();
5168
5242
  await this._loggingService.open();
5169
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
5243
+ this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
5170
5244
  this._serviceRegistry.setServices({
5171
5245
  SystemService: this._systemService,
5172
5246
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5205,16 +5279,16 @@ var ClientServicesHost = class {
5205
5279
  log16("opened", {
5206
5280
  deviceKey
5207
5281
  }, {
5208
- F: __dxlog_file17,
5209
- L: 305,
5282
+ F: __dxlog_file18,
5283
+ L: 310,
5210
5284
  S: this,
5211
5285
  C: (f, a) => f(...a)
5212
5286
  });
5213
5287
  log16.trace("dxos.client-services.host.open", trace9.end({
5214
5288
  id: traceId
5215
5289
  }), {
5216
- F: __dxlog_file17,
5217
- L: 306,
5290
+ F: __dxlog_file18,
5291
+ L: 311,
5218
5292
  S: this,
5219
5293
  C: (f, a) => f(...a)
5220
5294
  });
@@ -5227,8 +5301,8 @@ var ClientServicesHost = class {
5227
5301
  log16("closing...", {
5228
5302
  deviceKey
5229
5303
  }, {
5230
- F: __dxlog_file17,
5231
- L: 317,
5304
+ F: __dxlog_file18,
5305
+ L: 322,
5232
5306
  S: this,
5233
5307
  C: (f, a) => f(...a)
5234
5308
  });
@@ -5243,8 +5317,8 @@ var ClientServicesHost = class {
5243
5317
  log16("closed", {
5244
5318
  deviceKey
5245
5319
  }, {
5246
- F: __dxlog_file17,
5247
- L: 324,
5320
+ F: __dxlog_file18,
5321
+ L: 329,
5248
5322
  S: this,
5249
5323
  C: (f, a) => f(...a)
5250
5324
  });
@@ -5254,30 +5328,30 @@ var ClientServicesHost = class {
5254
5328
  log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5255
5329
  id: traceId
5256
5330
  }), {
5257
- F: __dxlog_file17,
5258
- L: 329,
5331
+ F: __dxlog_file18,
5332
+ L: 334,
5259
5333
  S: this,
5260
5334
  C: (f, a) => f(...a)
5261
5335
  });
5262
5336
  log16("resetting...", void 0, {
5263
- F: __dxlog_file17,
5264
- L: 331,
5337
+ F: __dxlog_file18,
5338
+ L: 336,
5265
5339
  S: this,
5266
5340
  C: (f, a) => f(...a)
5267
5341
  });
5268
5342
  await this._serviceContext?.close();
5269
5343
  await this._storage.reset();
5270
5344
  log16("reset", void 0, {
5271
- F: __dxlog_file17,
5272
- L: 334,
5345
+ F: __dxlog_file18,
5346
+ L: 339,
5273
5347
  S: this,
5274
5348
  C: (f, a) => f(...a)
5275
5349
  });
5276
5350
  log16.trace("dxos.sdk.client-services-host.reset", trace9.end({
5277
5351
  id: traceId
5278
5352
  }), {
5279
- F: __dxlog_file17,
5280
- L: 335,
5353
+ F: __dxlog_file18,
5354
+ L: 340,
5281
5355
  S: this,
5282
5356
  C: (f, a) => f(...a)
5283
5357
  });
@@ -5290,9 +5364,9 @@ var ClientServicesHost = class {
5290
5364
  const obj = new Properties(void 0);
5291
5365
  obj[defaultKey] = identity.identityKey.toHex();
5292
5366
  const automergeIndex = space.automergeSpaceState.rootUrl;
5293
- invariant14(automergeIndex, void 0, {
5294
- F: __dxlog_file17,
5295
- L: 350,
5367
+ invariant15(automergeIndex, void 0, {
5368
+ F: __dxlog_file18,
5369
+ L: 355,
5296
5370
  S: this,
5297
5371
  A: [
5298
5372
  "automergeIndex",
@@ -5304,7 +5378,7 @@ var ClientServicesHost = class {
5304
5378
  document.change((doc) => {
5305
5379
  assignDeep(doc, [
5306
5380
  "objects",
5307
- obj[base]._id
5381
+ getAutomergeObjectCore(obj).id
5308
5382
  ], getRawDoc(obj).handle.docSync());
5309
5383
  });
5310
5384
  return identity;
@@ -5362,4 +5436,4 @@ export {
5362
5436
  createDefaultModelFactory,
5363
5437
  ClientServicesHost
5364
5438
  };
5365
- //# sourceMappingURL=chunk-M3HBHYHU.mjs.map
5439
+ //# sourceMappingURL=chunk-LQJ2ANWZ.mjs.map