@dxos/client-services 0.4.7-main.0aeacda → 0.4.7-main.731b147

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