@dxos/client-services 0.4.6-next.c12c15b → 0.4.7-main.0aeacda

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