@dxos/client-services 0.4.6 → 0.4.7-main.06facb4

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-NVX5DORM.mjs → chunk-WFFCVLUR.mjs} +206 -139
  2. package/dist/lib/browser/chunk-WFFCVLUR.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +2 -2
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-JQTJTW5S.cjs → chunk-4JAI4X5H.cjs} +197 -130
  8. package/dist/lib/node/chunk-4JAI4X5H.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +38 -38
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/packlets/testing/index.cjs +8 -8
  13. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  14. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
  16. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  17. package/dist/types/src/packlets/identity/identity.d.ts +5 -1
  18. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  19. package/dist/types/src/packlets/services/service-context.d.ts +5 -3
  20. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-host.d.ts +4 -2
  22. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  23. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
  24. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  25. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  26. package/dist/types/src/version.d.ts +1 -1
  27. package/dist/types/src/version.d.ts.map +1 -1
  28. package/package.json +35 -35
  29. package/src/packlets/devices/devices-service.test.ts +8 -4
  30. package/src/packlets/devices/devices-service.ts +47 -11
  31. package/src/packlets/identity/identity-manager.ts +48 -6
  32. package/src/packlets/identity/identity.ts +9 -1
  33. package/src/packlets/services/service-context.ts +17 -3
  34. package/src/packlets/services/service-host.ts +8 -3
  35. package/src/packlets/spaces/data-space-manager.ts +18 -3
  36. package/src/packlets/spaces/spaces-service.ts +1 -3
  37. package/src/packlets/vault/shared-worker-connection.ts +1 -1
  38. package/src/version.ts +1 -5
  39. package/dist/lib/browser/chunk-NVX5DORM.mjs.map +0 -7
  40. package/dist/lib/node/chunk-JQTJTW5S.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.6";
2674
+ var DXOS_VERSION = "0.4.7-main.06facb4";
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
@@ -4241,11 +4267,12 @@ function _ts_decorate6(decorators, target, key, desc) {
4241
4267
  }
4242
4268
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4243
4269
  var ServiceContext = class {
4244
- constructor(storage, networkManager, signalManager, modelFactory) {
4270
+ constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
4245
4271
  this.storage = storage;
4246
4272
  this.networkManager = networkManager;
4247
4273
  this.signalManager = signalManager;
4248
4274
  this.modelFactory = modelFactory;
4275
+ this._runtimeParams = _runtimeParams;
4249
4276
  this.initialized = new Trigger5();
4250
4277
  this.dataServiceSubscriptions = new DataServiceSubscriptions();
4251
4278
  this._handlerFactories = /* @__PURE__ */ new Map();
@@ -4272,7 +4299,7 @@ var ServiceContext = class {
4272
4299
  modelFactory: this.modelFactory,
4273
4300
  snapshotStore: this.snapshotStore
4274
4301
  });
4275
- this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4302
+ this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4276
4303
  this.automergeHost = new AutomergeHost(storage.createDirectory("automerge"));
4277
4304
  this.invitations = new InvitationsHandler(this.networkManager);
4278
4305
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
@@ -4281,7 +4308,7 @@ var ServiceContext = class {
4281
4308
  await this._checkStorageVersion();
4282
4309
  log13("opening...", void 0, {
4283
4310
  F: __dxlog_file15,
4284
- L: 133,
4311
+ L: 146,
4285
4312
  S: this,
4286
4313
  C: (f, a) => f(...a)
4287
4314
  });
@@ -4289,7 +4316,7 @@ var ServiceContext = class {
4289
4316
  id: this._instanceId
4290
4317
  }), {
4291
4318
  F: __dxlog_file15,
4292
- L: 134,
4319
+ L: 147,
4293
4320
  S: this,
4294
4321
  C: (f, a) => f(...a)
4295
4322
  });
@@ -4305,13 +4332,13 @@ var ServiceContext = class {
4305
4332
  id: this._instanceId
4306
4333
  }), {
4307
4334
  F: __dxlog_file15,
4308
- L: 144,
4335
+ L: 157,
4309
4336
  S: this,
4310
4337
  C: (f, a) => f(...a)
4311
4338
  });
4312
4339
  log13("opened", void 0, {
4313
4340
  F: __dxlog_file15,
4314
- L: 145,
4341
+ L: 158,
4315
4342
  S: this,
4316
4343
  C: (f, a) => f(...a)
4317
4344
  });
@@ -4319,7 +4346,7 @@ var ServiceContext = class {
4319
4346
  async close() {
4320
4347
  log13("closing...", void 0, {
4321
4348
  F: __dxlog_file15,
4322
- L: 149,
4349
+ L: 162,
4323
4350
  S: this,
4324
4351
  C: (f, a) => f(...a)
4325
4352
  });
@@ -4337,7 +4364,7 @@ var ServiceContext = class {
4337
4364
  await this.metadataStore.close();
4338
4365
  log13("closed", void 0, {
4339
4366
  F: __dxlog_file15,
4340
- L: 162,
4367
+ L: 175,
4341
4368
  S: this,
4342
4369
  C: (f, a) => f(...a)
4343
4370
  });
@@ -4351,7 +4378,7 @@ var ServiceContext = class {
4351
4378
  const factory = this._handlerFactories.get(invitation.kind);
4352
4379
  invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4353
4380
  F: __dxlog_file15,
4354
- L: 173,
4381
+ L: 186,
4355
4382
  S: this,
4356
4383
  A: [
4357
4384
  "factory",
@@ -4383,7 +4410,7 @@ var ServiceContext = class {
4383
4410
  async _initialize(ctx) {
4384
4411
  log13("initializing spaces...", void 0, {
4385
4412
  F: __dxlog_file15,
4386
- L: 204,
4413
+ L: 217,
4387
4414
  S: this,
4388
4415
  C: (f, a) => f(...a)
4389
4416
  });
@@ -4401,12 +4428,12 @@ var ServiceContext = class {
4401
4428
  });
4402
4429
  }
4403
4430
  };
4404
- this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
4431
+ this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4405
4432
  await this.dataSpaceManager.open();
4406
4433
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4407
4434
  invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4408
4435
  F: __dxlog_file15,
4409
- L: 228,
4436
+ L: 242,
4410
4437
  S: this,
4411
4438
  A: [
4412
4439
  "this.dataSpaceManager",
@@ -4430,7 +4457,7 @@ var ServiceContext = class {
4430
4457
  details: assertion
4431
4458
  }, {
4432
4459
  F: __dxlog_file15,
4433
- L: 244,
4460
+ L: 258,
4434
4461
  S: this,
4435
4462
  C: (f, a) => f(...a)
4436
4463
  });
@@ -4441,7 +4468,7 @@ var ServiceContext = class {
4441
4468
  details: assertion
4442
4469
  }, {
4443
4470
  F: __dxlog_file15,
4444
- L: 248,
4471
+ L: 262,
4445
4472
  S: this,
4446
4473
  C: (f, a) => f(...a)
4447
4474
  });
@@ -4452,7 +4479,7 @@ var ServiceContext = class {
4452
4479
  details: assertion
4453
4480
  }, {
4454
4481
  F: __dxlog_file15,
4455
- L: 253,
4482
+ L: 267,
4456
4483
  S: this,
4457
4484
  C: (f, a) => f(...a)
4458
4485
  });
@@ -4463,7 +4490,7 @@ var ServiceContext = class {
4463
4490
  } catch (err) {
4464
4491
  log13.catch(err, void 0, {
4465
4492
  F: __dxlog_file15,
4466
- L: 259,
4493
+ L: 273,
4467
4494
  S: this,
4468
4495
  C: (f, a) => f(...a)
4469
4496
  });
@@ -4687,8 +4714,8 @@ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protoc
4687
4714
  import { Context as Context10 } from "@dxos/context";
4688
4715
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4689
4716
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4690
- import { base, getRawDoc } from "@dxos/echo-schema";
4691
- import { invariant as invariant14 } from "@dxos/invariant";
4717
+ import { getRawDoc, getAutomergeObjectCore } from "@dxos/echo-schema";
4718
+ import { invariant as invariant15 } from "@dxos/invariant";
4692
4719
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4693
4720
  import { log as log16 } from "@dxos/log";
4694
4721
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4704,7 +4731,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4704
4731
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4705
4732
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4706
4733
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4707
- import { DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
4734
+ import { invariant as invariant14 } from "@dxos/invariant";
4735
+ import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
4736
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4708
4737
  var DevicesServiceImpl = class {
4709
4738
  constructor(_identityManager) {
4710
4739
  this._identityManager = _identityManager;
@@ -4721,22 +4750,58 @@ var DevicesServiceImpl = class {
4721
4750
  devices: []
4722
4751
  });
4723
4752
  } else {
4753
+ invariant14(this._identityManager.identity?.presence, "presence not present", {
4754
+ F: __dxlog_file17,
4755
+ L: 32,
4756
+ S: this,
4757
+ A: [
4758
+ "this._identityManager.identity?.presence",
4759
+ "'presence not present'"
4760
+ ]
4761
+ });
4762
+ const peers = this._identityManager.identity.presence.getPeersOnline();
4724
4763
  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
- }))
4764
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
4765
+ const isMe = this._identityManager.identity?.deviceKey.equals(key);
4766
+ const peerState = peers.find((peer) => peer.identityKey.equals(key));
4767
+ return {
4768
+ deviceKey: key,
4769
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
4770
+ profile,
4771
+ presence: isMe ? Device2.PresenceState.ONLINE : peerState ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE
4772
+ };
4773
+ })
4774
+ });
4775
+ }
4776
+ };
4777
+ let identitySubscribed = false;
4778
+ let presenceSubscribed = false;
4779
+ const subscribeIdentity = () => {
4780
+ if (!identitySubscribed) {
4781
+ this._identityManager.identity?.stateUpdate.on(() => {
4782
+ update();
4730
4783
  });
4784
+ identitySubscribed = true;
4785
+ }
4786
+ };
4787
+ const subscribePresence = () => {
4788
+ if (!presenceSubscribed) {
4789
+ this._identityManager.identity?.presence?.updated.on(() => {
4790
+ update();
4791
+ });
4792
+ presenceSubscribed = true;
4731
4793
  }
4732
4794
  };
4733
4795
  const subscriptions = new EventSubscriptions3();
4796
+ if (this._identityManager.identity) {
4797
+ subscribeIdentity();
4798
+ subscribePresence();
4799
+ }
4734
4800
  subscriptions.add(this._identityManager.stateUpdate.on(() => {
4735
4801
  update();
4736
4802
  if (this._identityManager.identity) {
4737
- subscriptions.add(this._identityManager.identity.stateUpdate.on(() => {
4738
- update();
4739
- }));
4803
+ subscribeIdentity();
4804
+ subscribePresence();
4740
4805
  }
4741
4806
  }));
4742
4807
  update();
@@ -4963,7 +5028,7 @@ function _ts_decorate8(decorators, target, key, desc) {
4963
5028
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4964
5029
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4965
5030
  }
4966
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5031
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4967
5032
  var createDefaultModelFactory = () => {
4968
5033
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4969
5034
  };
@@ -4976,7 +5041,8 @@ var ClientServicesHost = class {
4976
5041
  storage,
4977
5042
  // TODO(wittjosiah): Turn this on by default.
4978
5043
  lockKey,
4979
- callbacks
5044
+ callbacks,
5045
+ runtimeParams
4980
5046
  } = {}) {
4981
5047
  this._tracingService = TRACE_PROCESSOR2.createTraceSender();
4982
5048
  this._statusUpdate = new Event8();
@@ -4985,6 +5051,7 @@ var ClientServicesHost = class {
4985
5051
  this._storage = storage;
4986
5052
  this._modelFactory = modelFactory;
4987
5053
  this._callbacks = callbacks;
5054
+ this._runtimeParams = runtimeParams;
4988
5055
  if (config) {
4989
5056
  this.initialize({
4990
5057
  config,
@@ -5051,9 +5118,9 @@ var ClientServicesHost = class {
5051
5118
  * Can only be called once.
5052
5119
  */
5053
5120
  initialize({ config, ...options }) {
5054
- invariant14(!this._open, "service host is open", {
5055
- F: __dxlog_file17,
5056
- L: 186,
5121
+ invariant15(!this._open, "service host is open", {
5122
+ F: __dxlog_file18,
5123
+ L: 190,
5057
5124
  S: this,
5058
5125
  A: [
5059
5126
  "!this._open",
@@ -5061,15 +5128,15 @@ var ClientServicesHost = class {
5061
5128
  ]
5062
5129
  });
5063
5130
  log16("initializing...", void 0, {
5064
- F: __dxlog_file17,
5065
- L: 187,
5131
+ F: __dxlog_file18,
5132
+ L: 191,
5066
5133
  S: this,
5067
5134
  C: (f, a) => f(...a)
5068
5135
  });
5069
5136
  if (config) {
5070
- invariant14(!this._config, "config already set", {
5071
- F: __dxlog_file17,
5072
- L: 190,
5137
+ invariant15(!this._config, "config already set", {
5138
+ F: __dxlog_file18,
5139
+ L: 194,
5073
5140
  S: this,
5074
5141
  A: [
5075
5142
  "!this._config",
@@ -5085,9 +5152,9 @@ var ClientServicesHost = class {
5085
5152
  iceServers: this._config?.get("runtime.services.ice")
5086
5153
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
5087
5154
  this._signalManager = signalManager;
5088
- invariant14(!this._networkManager, "network manager already set", {
5089
- F: __dxlog_file17,
5090
- L: 206,
5155
+ invariant15(!this._networkManager, "network manager already set", {
5156
+ F: __dxlog_file18,
5157
+ L: 210,
5091
5158
  S: this,
5092
5159
  A: [
5093
5160
  "!this._networkManager",
@@ -5100,8 +5167,8 @@ var ClientServicesHost = class {
5100
5167
  signalManager
5101
5168
  });
5102
5169
  log16("initialized", void 0, {
5103
- F: __dxlog_file17,
5104
- L: 213,
5170
+ F: __dxlog_file18,
5171
+ L: 217,
5105
5172
  S: this,
5106
5173
  C: (f, a) => f(...a)
5107
5174
  });
@@ -5114,41 +5181,41 @@ var ClientServicesHost = class {
5114
5181
  log16.trace("dxos.client-services.host.open", trace9.begin({
5115
5182
  id: traceId
5116
5183
  }), {
5117
- F: __dxlog_file17,
5118
- L: 224,
5184
+ F: __dxlog_file18,
5185
+ L: 228,
5119
5186
  S: this,
5120
5187
  C: (f, a) => f(...a)
5121
5188
  });
5122
- invariant14(this._config, "config not set", {
5123
- F: __dxlog_file17,
5124
- L: 226,
5189
+ invariant15(this._config, "config not set", {
5190
+ F: __dxlog_file18,
5191
+ L: 230,
5125
5192
  S: this,
5126
5193
  A: [
5127
5194
  "this._config",
5128
5195
  "'config not set'"
5129
5196
  ]
5130
5197
  });
5131
- invariant14(this._storage, "storage not set", {
5132
- F: __dxlog_file17,
5133
- L: 227,
5198
+ invariant15(this._storage, "storage not set", {
5199
+ F: __dxlog_file18,
5200
+ L: 231,
5134
5201
  S: this,
5135
5202
  A: [
5136
5203
  "this._storage",
5137
5204
  "'storage not set'"
5138
5205
  ]
5139
5206
  });
5140
- invariant14(this._signalManager, "signal manager not set", {
5141
- F: __dxlog_file17,
5142
- L: 228,
5207
+ invariant15(this._signalManager, "signal manager not set", {
5208
+ F: __dxlog_file18,
5209
+ L: 232,
5143
5210
  S: this,
5144
5211
  A: [
5145
5212
  "this._signalManager",
5146
5213
  "'signal manager not set'"
5147
5214
  ]
5148
5215
  });
5149
- invariant14(this._networkManager, "network manager not set", {
5150
- F: __dxlog_file17,
5151
- L: 229,
5216
+ invariant15(this._networkManager, "network manager not set", {
5217
+ F: __dxlog_file18,
5218
+ L: 233,
5152
5219
  S: this,
5153
5220
  A: [
5154
5221
  "this._networkManager",
@@ -5159,14 +5226,14 @@ var ClientServicesHost = class {
5159
5226
  log16("opening...", {
5160
5227
  lockKey: this._resourceLock?.lockKey
5161
5228
  }, {
5162
- F: __dxlog_file17,
5163
- L: 232,
5229
+ F: __dxlog_file18,
5230
+ L: 236,
5164
5231
  S: this,
5165
5232
  C: (f, a) => f(...a)
5166
5233
  });
5167
5234
  await this._resourceLock?.acquire();
5168
5235
  await this._loggingService.open();
5169
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
5236
+ this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
5170
5237
  this._serviceRegistry.setServices({
5171
5238
  SystemService: this._systemService,
5172
5239
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5205,16 +5272,16 @@ var ClientServicesHost = class {
5205
5272
  log16("opened", {
5206
5273
  deviceKey
5207
5274
  }, {
5208
- F: __dxlog_file17,
5209
- L: 305,
5275
+ F: __dxlog_file18,
5276
+ L: 310,
5210
5277
  S: this,
5211
5278
  C: (f, a) => f(...a)
5212
5279
  });
5213
5280
  log16.trace("dxos.client-services.host.open", trace9.end({
5214
5281
  id: traceId
5215
5282
  }), {
5216
- F: __dxlog_file17,
5217
- L: 306,
5283
+ F: __dxlog_file18,
5284
+ L: 311,
5218
5285
  S: this,
5219
5286
  C: (f, a) => f(...a)
5220
5287
  });
@@ -5227,8 +5294,8 @@ var ClientServicesHost = class {
5227
5294
  log16("closing...", {
5228
5295
  deviceKey
5229
5296
  }, {
5230
- F: __dxlog_file17,
5231
- L: 317,
5297
+ F: __dxlog_file18,
5298
+ L: 322,
5232
5299
  S: this,
5233
5300
  C: (f, a) => f(...a)
5234
5301
  });
@@ -5243,8 +5310,8 @@ var ClientServicesHost = class {
5243
5310
  log16("closed", {
5244
5311
  deviceKey
5245
5312
  }, {
5246
- F: __dxlog_file17,
5247
- L: 324,
5313
+ F: __dxlog_file18,
5314
+ L: 329,
5248
5315
  S: this,
5249
5316
  C: (f, a) => f(...a)
5250
5317
  });
@@ -5254,30 +5321,30 @@ var ClientServicesHost = class {
5254
5321
  log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5255
5322
  id: traceId
5256
5323
  }), {
5257
- F: __dxlog_file17,
5258
- L: 329,
5324
+ F: __dxlog_file18,
5325
+ L: 334,
5259
5326
  S: this,
5260
5327
  C: (f, a) => f(...a)
5261
5328
  });
5262
5329
  log16("resetting...", void 0, {
5263
- F: __dxlog_file17,
5264
- L: 331,
5330
+ F: __dxlog_file18,
5331
+ L: 336,
5265
5332
  S: this,
5266
5333
  C: (f, a) => f(...a)
5267
5334
  });
5268
5335
  await this._serviceContext?.close();
5269
5336
  await this._storage.reset();
5270
5337
  log16("reset", void 0, {
5271
- F: __dxlog_file17,
5272
- L: 334,
5338
+ F: __dxlog_file18,
5339
+ L: 339,
5273
5340
  S: this,
5274
5341
  C: (f, a) => f(...a)
5275
5342
  });
5276
5343
  log16.trace("dxos.sdk.client-services-host.reset", trace9.end({
5277
5344
  id: traceId
5278
5345
  }), {
5279
- F: __dxlog_file17,
5280
- L: 335,
5346
+ F: __dxlog_file18,
5347
+ L: 340,
5281
5348
  S: this,
5282
5349
  C: (f, a) => f(...a)
5283
5350
  });
@@ -5290,9 +5357,9 @@ var ClientServicesHost = class {
5290
5357
  const obj = new Properties(void 0);
5291
5358
  obj[defaultKey] = identity.identityKey.toHex();
5292
5359
  const automergeIndex = space.automergeSpaceState.rootUrl;
5293
- invariant14(automergeIndex, void 0, {
5294
- F: __dxlog_file17,
5295
- L: 350,
5360
+ invariant15(automergeIndex, void 0, {
5361
+ F: __dxlog_file18,
5362
+ L: 355,
5296
5363
  S: this,
5297
5364
  A: [
5298
5365
  "automergeIndex",
@@ -5304,7 +5371,7 @@ var ClientServicesHost = class {
5304
5371
  document.change((doc) => {
5305
5372
  assignDeep(doc, [
5306
5373
  "objects",
5307
- obj[base]._id
5374
+ getAutomergeObjectCore(obj).id
5308
5375
  ], getRawDoc(obj).handle.docSync());
5309
5376
  });
5310
5377
  return identity;
@@ -5362,4 +5429,4 @@ export {
5362
5429
  createDefaultModelFactory,
5363
5430
  ClientServicesHost
5364
5431
  };
5365
- //# sourceMappingURL=chunk-NVX5DORM.mjs.map
5432
+ //# sourceMappingURL=chunk-WFFCVLUR.mjs.map