@dxos/client-services 0.4.7-main.731b147 → 0.4.7-main.76c1dea

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 (47) hide show
  1. package/dist/lib/browser/{chunk-XPIRHRIB.mjs → chunk-3WY4NCBV.mjs} +227 -146
  2. package/dist/lib/browser/chunk-3WY4NCBV.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +4 -2
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +4 -2
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-BIYZDTFF.cjs → chunk-7A7AEJZG.cjs} +216 -135
  9. package/dist/lib/node/chunk-7A7AEJZG.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +40 -38
  11. package/dist/lib/node/index.cjs.map +2 -2
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +11 -9
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  16. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  17. package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
  18. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/identity/identity.d.ts +5 -1
  20. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  21. package/dist/types/src/packlets/logging/logging-service.d.ts +1 -0
  22. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/service-context.d.ts +7 -3
  24. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  25. package/dist/types/src/packlets/services/service-host.d.ts +4 -2
  26. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
  28. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  29. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  30. package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
  31. package/dist/types/src/version.d.ts +1 -1
  32. package/package.json +35 -35
  33. package/src/packlets/devices/devices-service.test.ts +8 -4
  34. package/src/packlets/devices/devices-service.ts +47 -11
  35. package/src/packlets/identity/identity-manager.ts +48 -6
  36. package/src/packlets/identity/identity.ts +9 -1
  37. package/src/packlets/logging/logging-service.ts +9 -2
  38. package/src/packlets/services/automerge-host.test.ts +1 -1
  39. package/src/packlets/services/service-context.ts +24 -4
  40. package/src/packlets/services/service-host.ts +8 -3
  41. package/src/packlets/spaces/data-space-manager.ts +18 -3
  42. package/src/packlets/spaces/spaces-service.ts +1 -3
  43. package/src/packlets/testing/test-builder.ts +1 -1
  44. package/src/packlets/vault/shared-worker-connection.ts +2 -0
  45. package/src/version.ts +1 -1
  46. package/dist/lib/browser/chunk-XPIRHRIB.mjs.map +0 -7
  47. package/dist/lib/node/chunk-BIYZDTFF.cjs.map +0 -7
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_BIYZDTFF_exports = {};
30
- __export(chunk_BIYZDTFF_exports, {
29
+ var chunk_7A7AEJZG_exports = {};
30
+ __export(chunk_7A7AEJZG_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_BIYZDTFF_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_BIYZDTFF_exports);
63
+ module.exports = __toCommonJS(chunk_7A7AEJZG_exports);
64
64
  var import_async = require("@dxos/async");
65
65
  var import_codec_protobuf = require("@dxos/codec-protobuf");
66
66
  var import_feed_store = require("@dxos/feed-store");
@@ -100,6 +100,7 @@ var import_log3 = require("@dxos/log");
100
100
  var import_protocols2 = require("@dxos/protocols");
101
101
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
102
102
  var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
103
+ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
103
104
  var import_timeframe = require("@dxos/timeframe");
104
105
  var import_tracing2 = require("@dxos/tracing");
105
106
  var import_util3 = require("@dxos/util");
@@ -186,7 +187,7 @@ var import_keys9 = require("@dxos/keys");
186
187
  var import_log11 = require("@dxos/log");
187
188
  var import_protocols10 = require("@dxos/protocols");
188
189
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
189
- var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
190
+ var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
190
191
  var import_util6 = require("@dxos/util");
191
192
  var import_credentials13 = require("@dxos/credentials");
192
193
  var import_debug4 = require("@dxos/debug");
@@ -204,6 +205,7 @@ var import_context9 = require("@dxos/context");
204
205
  var import_credentials15 = require("@dxos/credentials");
205
206
  var import_debug6 = require("@dxos/debug");
206
207
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
208
+ var import_echo_schema = require("@dxos/echo-schema");
207
209
  var import_feed_store4 = require("@dxos/feed-store");
208
210
  var import_invariant14 = require("@dxos/invariant");
209
211
  var import_keyring = require("@dxos/keyring");
@@ -227,7 +229,7 @@ var import_client_protocol5 = require("@dxos/client-protocol");
227
229
  var import_context10 = require("@dxos/context");
228
230
  var import_document_model2 = require("@dxos/document-model");
229
231
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
230
- var import_echo_schema = require("@dxos/echo-schema");
232
+ var import_echo_schema2 = require("@dxos/echo-schema");
231
233
  var import_invariant16 = require("@dxos/invariant");
232
234
  var import_keys11 = require("@dxos/keys");
233
235
  var import_log15 = require("@dxos/log");
@@ -242,9 +244,11 @@ var import_util9 = require("@dxos/util");
242
244
  var import_websocket_rpc = require("@dxos/websocket-rpc");
243
245
  var import_async16 = require("@dxos/async");
244
246
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
247
+ var import_invariant17 = require("@dxos/invariant");
245
248
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
246
249
  var import_async17 = require("@dxos/async");
247
250
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
251
+ var import_keys12 = require("@dxos/keys");
248
252
  var import_log16 = require("@dxos/log");
249
253
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
250
254
  var import_util10 = require("@dxos/util");
@@ -682,17 +686,18 @@ function _ts_decorate(decorators, target, key, desc) {
682
686
  }
683
687
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
684
688
  var Identity = class {
685
- constructor({ space, signer, identityKey, deviceKey }) {
689
+ constructor({ space, signer, identityKey, deviceKey, presence }) {
686
690
  this.stateUpdate = new import_async5.Event();
687
691
  this.space = space;
688
692
  this._signer = signer;
693
+ this._presence = presence;
689
694
  this.identityKey = identityKey;
690
695
  this.deviceKey = deviceKey;
691
696
  import_log2.log.trace("dxos.halo.device", {
692
697
  deviceKey
693
698
  }, {
694
699
  F: __dxlog_file2,
695
- L: 63,
700
+ L: 67,
696
701
  S: this,
697
702
  C: (f, a) => f(...a)
698
703
  });
@@ -750,6 +755,9 @@ var Identity = class {
750
755
  get deviceCredentialChain() {
751
756
  return this._deviceStateMachine.deviceCredentialChain;
752
757
  }
758
+ get presence() {
759
+ return this._presence;
760
+ }
753
761
  /**
754
762
  * Issues credentials as identity.
755
763
  * Requires identity to be ready.
@@ -757,7 +765,7 @@ var Identity = class {
757
765
  getIdentityCredentialSigner() {
758
766
  (0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
759
767
  F: __dxlog_file2,
760
- L: 136,
768
+ L: 144,
761
769
  S: this,
762
770
  A: [
763
771
  "this._deviceStateMachine.deviceCredentialChain",
@@ -781,7 +789,7 @@ var Identity = class {
781
789
  dataFeedKey
782
790
  }, {
783
791
  F: __dxlog_file2,
784
- L: 152,
792
+ L: 160,
785
793
  S: this,
786
794
  C: (f, a) => f(...a)
787
795
  });
@@ -842,15 +850,20 @@ function _ts_decorate2(decorators, target, key, desc) {
842
850
  return c > 3 && r && Object.defineProperty(target, key, r), r;
843
851
  }
844
852
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
853
+ var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
854
+ var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
845
855
  var IdentityManager = class {
846
856
  // TODO(burdon): IdentityManagerParams.
847
857
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
848
- constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
858
+ constructor(_metadataStore, _keyring, _feedStore, _spaceManager, params) {
849
859
  this._metadataStore = _metadataStore;
850
860
  this._keyring = _keyring;
851
861
  this._feedStore = _feedStore;
852
862
  this._spaceManager = _spaceManager;
853
863
  this.stateUpdate = new import_async6.Event();
864
+ const { devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL, devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
865
+ this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
866
+ this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
854
867
  }
855
868
  get identity() {
856
869
  return this._identity;
@@ -861,7 +874,7 @@ var IdentityManager = class {
861
874
  id: traceId
862
875
  }), {
863
876
  F: __dxlog_file3,
864
- L: 84,
877
+ L: 104,
865
878
  S: this,
866
879
  C: (f, a) => f(...a)
867
880
  });
@@ -870,7 +883,7 @@ var IdentityManager = class {
870
883
  identityRecord
871
884
  }, {
872
885
  F: __dxlog_file3,
873
- L: 87,
886
+ L: 107,
874
887
  S: this,
875
888
  C: (f, a) => f(...a)
876
889
  });
@@ -883,7 +896,7 @@ var IdentityManager = class {
883
896
  displayName: this._identity.profileDocument?.displayName
884
897
  }, {
885
898
  F: __dxlog_file3,
886
- L: 92,
899
+ L: 112,
887
900
  S: this,
888
901
  C: (f, a) => f(...a)
889
902
  });
@@ -893,7 +906,7 @@ var IdentityManager = class {
893
906
  id: traceId
894
907
  }), {
895
908
  F: __dxlog_file3,
896
- L: 99,
909
+ L: 119,
897
910
  S: this,
898
911
  C: (f, a) => f(...a)
899
912
  });
@@ -904,7 +917,7 @@ var IdentityManager = class {
904
917
  async createIdentity({ displayName, deviceProfile } = {}) {
905
918
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
906
919
  F: __dxlog_file3,
907
- L: 108,
920
+ L: 128,
908
921
  S: this,
909
922
  A: [
910
923
  "!this._identity",
@@ -913,7 +926,7 @@ var IdentityManager = class {
913
926
  });
914
927
  (0, import_log3.log)("creating identity...", void 0, {
915
928
  F: __dxlog_file3,
916
- L: 109,
929
+ L: 129,
917
930
  S: this,
918
931
  C: (f, a) => f(...a)
919
932
  });
@@ -934,7 +947,7 @@ var IdentityManager = class {
934
947
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
935
948
  (0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
936
949
  F: __dxlog_file3,
937
- L: 128,
950
+ L: 148,
938
951
  S: this,
939
952
  A: [
940
953
  "identityRecord.haloSpace.genesisFeedKey",
@@ -943,7 +956,7 @@ var IdentityManager = class {
943
956
  });
944
957
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
945
958
  F: __dxlog_file3,
946
- L: 129,
959
+ L: 149,
947
960
  S: this,
948
961
  A: [
949
962
  "identityRecord.haloSpace.dataFeedKey",
@@ -982,7 +995,7 @@ var IdentityManager = class {
982
995
  displayName: this._identity.profileDocument?.displayName
983
996
  }, {
984
997
  F: __dxlog_file3,
985
- L: 171,
998
+ L: 191,
986
999
  S: this,
987
1000
  C: (f, a) => f(...a)
988
1001
  });
@@ -993,7 +1006,7 @@ var IdentityManager = class {
993
1006
  profile: identity.profileDocument
994
1007
  }, {
995
1008
  F: __dxlog_file3,
996
- L: 177,
1009
+ L: 197,
997
1010
  S: this,
998
1011
  C: (f, a) => f(...a)
999
1012
  });
@@ -1030,13 +1043,13 @@ var IdentityManager = class {
1030
1043
  params
1031
1044
  }, {
1032
1045
  F: __dxlog_file3,
1033
- L: 215,
1046
+ L: 235,
1034
1047
  S: this,
1035
1048
  C: (f, a) => f(...a)
1036
1049
  });
1037
1050
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
1038
1051
  F: __dxlog_file3,
1039
- L: 216,
1052
+ L: 236,
1040
1053
  S: this,
1041
1054
  A: [
1042
1055
  "!this._identity",
@@ -1064,7 +1077,7 @@ var IdentityManager = class {
1064
1077
  displayName: this._identity.profileDocument?.displayName
1065
1078
  }, {
1066
1079
  F: __dxlog_file3,
1067
- L: 235,
1080
+ L: 255,
1068
1081
  S: this,
1069
1082
  C: (f, a) => f(...a)
1070
1083
  });
@@ -1078,7 +1091,7 @@ var IdentityManager = class {
1078
1091
  deviceKey: identity.deviceKey
1079
1092
  }, {
1080
1093
  F: __dxlog_file3,
1081
- L: 245,
1094
+ L: 265,
1082
1095
  S: this,
1083
1096
  C: (f, a) => f(...a)
1084
1097
  });
@@ -1090,7 +1103,7 @@ var IdentityManager = class {
1090
1103
  async updateProfile(profile) {
1091
1104
  (0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
1092
1105
  F: __dxlog_file3,
1093
- L: 253,
1106
+ L: 273,
1094
1107
  S: this,
1095
1108
  A: [
1096
1109
  "this._identity",
@@ -1121,7 +1134,7 @@ var IdentityManager = class {
1121
1134
  async updateDeviceProfile(profile) {
1122
1135
  (0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
1123
1136
  F: __dxlog_file3,
1124
- L: 270,
1137
+ L: 290,
1125
1138
  S: this,
1126
1139
  A: [
1127
1140
  "this._identity",
@@ -1150,13 +1163,14 @@ var IdentityManager = class {
1150
1163
  return {
1151
1164
  deviceKey: this._identity.deviceKey,
1152
1165
  kind: import_services.DeviceKind.CURRENT,
1166
+ presence: import_services.Device.PresenceState.ONLINE,
1153
1167
  profile
1154
1168
  };
1155
1169
  }
1156
1170
  async _constructIdentity(identityRecord) {
1157
1171
  (0, import_invariant2.invariant)(!this._identity, void 0, {
1158
1172
  F: __dxlog_file3,
1159
- L: 291,
1173
+ L: 316,
1160
1174
  S: this,
1161
1175
  A: [
1162
1176
  "!this._identity",
@@ -1167,13 +1181,22 @@ var IdentityManager = class {
1167
1181
  identityRecord
1168
1182
  }, {
1169
1183
  F: __dxlog_file3,
1170
- L: 292,
1184
+ L: 317,
1171
1185
  S: this,
1172
1186
  C: (f, a) => f(...a)
1173
1187
  });
1188
+ const gossip = new import_teleport_extension_gossip.Gossip({
1189
+ localPeerId: identityRecord.deviceKey
1190
+ });
1191
+ const presence = new import_teleport_extension_gossip.Presence({
1192
+ announceInterval: this._devicePresenceAnnounceInterval,
1193
+ offlineTimeout: this._devicePresenceOfflineTimeout,
1194
+ identityKey: identityRecord.deviceKey,
1195
+ gossip
1196
+ });
1174
1197
  (0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
1175
1198
  F: __dxlog_file3,
1176
- L: 295,
1199
+ L: 330,
1177
1200
  S: this,
1178
1201
  A: [
1179
1202
  "identityRecord.haloSpace.controlFeedKey",
@@ -1185,7 +1208,7 @@ var IdentityManager = class {
1185
1208
  });
1186
1209
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
1187
1210
  F: __dxlog_file3,
1188
- L: 299,
1211
+ L: 334,
1189
1212
  S: this,
1190
1213
  A: [
1191
1214
  "identityRecord.haloSpace.dataFeedKey",
@@ -1203,12 +1226,14 @@ var IdentityManager = class {
1203
1226
  credentialProvider: createAuthProvider((0, import_credentials4.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
1204
1227
  credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
1205
1228
  },
1229
+ gossip,
1206
1230
  identityKey: identityRecord.identityKey
1207
1231
  });
1208
1232
  await space.setControlFeed(controlFeed);
1209
- space.setDataFeed(dataFeed);
1233
+ void space.setDataFeed(dataFeed);
1210
1234
  const identity = new Identity({
1211
1235
  space,
1236
+ presence,
1212
1237
  signer: this._keyring,
1213
1238
  identityKey: identityRecord.identityKey,
1214
1239
  deviceKey: identityRecord.deviceKey
@@ -1217,7 +1242,7 @@ var IdentityManager = class {
1217
1242
  identityKey: identityRecord.identityKey
1218
1243
  }, {
1219
1244
  F: __dxlog_file3,
1220
- L: 323,
1245
+ L: 360,
1221
1246
  S: this,
1222
1247
  C: (f, a) => f(...a)
1223
1248
  });
@@ -1227,19 +1252,22 @@ var IdentityManager = class {
1227
1252
  identity.stateUpdate.on(() => this.stateUpdate.emit());
1228
1253
  return identity;
1229
1254
  }
1230
- async _constructSpace({ spaceRecord, swarmIdentity, identityKey }) {
1255
+ async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }) {
1231
1256
  return this._spaceManager.constructSpace({
1232
1257
  metadata: {
1233
1258
  key: spaceRecord.key,
1234
1259
  genesisFeedKey: spaceRecord.genesisFeedKey
1235
1260
  },
1236
1261
  swarmIdentity,
1237
- onAuthorizedConnection: () => {
1262
+ onAuthorizedConnection: (session) => {
1263
+ session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
1264
+ remotePeerId: session.remotePeerId
1265
+ }));
1238
1266
  },
1239
1267
  onAuthFailure: () => {
1240
1268
  import_log3.log.warn("auth failure", void 0, {
1241
1269
  F: __dxlog_file3,
1242
- L: 343,
1270
+ L: 385,
1243
1271
  S: this,
1244
1272
  C: (f, a) => f(...a)
1245
1273
  });
@@ -2756,7 +2784,7 @@ var getPlatform = () => {
2756
2784
  };
2757
2785
  }
2758
2786
  };
2759
- var DXOS_VERSION = "0.4.7-main.731b147";
2787
+ var DXOS_VERSION = "0.4.7-main.76c1dea";
2760
2788
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2761
2789
  var DEFAULT_TIMEOUT = 1e3;
2762
2790
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -3715,7 +3743,7 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
3715
3743
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
3716
3744
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
3717
3745
  var DataSpaceManager = class {
3718
- constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
3746
+ constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost, params) {
3719
3747
  this._spaceManager = _spaceManager;
3720
3748
  this._metadataStore = _metadataStore;
3721
3749
  this._dataServiceSubscriptions = _dataServiceSubscriptions;
@@ -3728,6 +3756,9 @@ var DataSpaceManager = class {
3728
3756
  this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
3729
3757
  this._isOpen = false;
3730
3758
  this._instanceId = import_keys9.PublicKey.random().toHex();
3759
+ const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
3760
+ this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
3761
+ this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
3731
3762
  }
3732
3763
  // TODO(burdon): Remove.
3733
3764
  get spaces() {
@@ -3736,7 +3767,7 @@ var DataSpaceManager = class {
3736
3767
  async open() {
3737
3768
  (0, import_log11.log)("open", void 0, {
3738
3769
  F: __dxlog_file13,
3739
- L: 90,
3770
+ L: 105,
3740
3771
  S: this,
3741
3772
  C: (f, a) => f(...a)
3742
3773
  });
@@ -3744,7 +3775,7 @@ var DataSpaceManager = class {
3744
3775
  id: this._instanceId
3745
3776
  }), {
3746
3777
  F: __dxlog_file13,
3747
- L: 91,
3778
+ L: 106,
3748
3779
  S: this,
3749
3780
  C: (f, a) => f(...a)
3750
3781
  });
@@ -3752,7 +3783,7 @@ var DataSpaceManager = class {
3752
3783
  spaces: this._metadataStore.spaces.length
3753
3784
  }, {
3754
3785
  F: __dxlog_file13,
3755
- L: 92,
3786
+ L: 107,
3756
3787
  S: this,
3757
3788
  C: (f, a) => f(...a)
3758
3789
  });
@@ -3762,7 +3793,7 @@ var DataSpaceManager = class {
3762
3793
  spaceMetadata
3763
3794
  }, {
3764
3795
  F: __dxlog_file13,
3765
- L: 96,
3796
+ L: 111,
3766
3797
  S: this,
3767
3798
  C: (f, a) => f(...a)
3768
3799
  });
@@ -3773,7 +3804,7 @@ var DataSpaceManager = class {
3773
3804
  err
3774
3805
  }, {
3775
3806
  F: __dxlog_file13,
3776
- L: 99,
3807
+ L: 114,
3777
3808
  S: this,
3778
3809
  C: (f, a) => f(...a)
3779
3810
  });
@@ -3790,7 +3821,7 @@ var DataSpaceManager = class {
3790
3821
  id: this._instanceId
3791
3822
  }), {
3792
3823
  F: __dxlog_file13,
3793
- L: 112,
3824
+ L: 127,
3794
3825
  S: this,
3795
3826
  C: (f, a) => f(...a)
3796
3827
  });
@@ -3798,7 +3829,7 @@ var DataSpaceManager = class {
3798
3829
  async close() {
3799
3830
  (0, import_log11.log)("close", void 0, {
3800
3831
  F: __dxlog_file13,
3801
- L: 117,
3832
+ L: 132,
3802
3833
  S: this,
3803
3834
  C: (f, a) => f(...a)
3804
3835
  });
@@ -3814,7 +3845,7 @@ var DataSpaceManager = class {
3814
3845
  async createSpace() {
3815
3846
  (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
3816
3847
  F: __dxlog_file13,
3817
- L: 130,
3848
+ L: 145,
3818
3849
  S: this,
3819
3850
  A: [
3820
3851
  "this._isOpen",
@@ -3835,7 +3866,7 @@ var DataSpaceManager = class {
3835
3866
  spaceKey
3836
3867
  }, {
3837
3868
  F: __dxlog_file13,
3838
- L: 142,
3869
+ L: 157,
3839
3870
  S: this,
3840
3871
  C: (f, a) => f(...a)
3841
3872
  });
@@ -3851,7 +3882,7 @@ var DataSpaceManager = class {
3851
3882
  const memberCredential = credentials[1];
3852
3883
  (0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3853
3884
  F: __dxlog_file13,
3854
- L: 155,
3885
+ L: 170,
3855
3886
  S: this,
3856
3887
  A: [
3857
3888
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3869,13 +3900,13 @@ var DataSpaceManager = class {
3869
3900
  opts
3870
3901
  }, {
3871
3902
  F: __dxlog_file13,
3872
- L: 167,
3903
+ L: 182,
3873
3904
  S: this,
3874
3905
  C: (f, a) => f(...a)
3875
3906
  });
3876
3907
  (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
3877
3908
  F: __dxlog_file13,
3878
- L: 168,
3909
+ L: 183,
3879
3910
  S: this,
3880
3911
  A: [
3881
3912
  "this._isOpen",
@@ -3884,7 +3915,7 @@ var DataSpaceManager = class {
3884
3915
  });
3885
3916
  (0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3886
3917
  F: __dxlog_file13,
3887
- L: 169,
3918
+ L: 184,
3888
3919
  S: this,
3889
3920
  A: [
3890
3921
  "!this._spaces.has(opts.spaceKey)",
@@ -3919,16 +3950,16 @@ var DataSpaceManager = class {
3919
3950
  metadata
3920
3951
  }, {
3921
3952
  F: __dxlog_file13,
3922
- L: 202,
3953
+ L: 217,
3923
3954
  S: this,
3924
3955
  C: (f, a) => f(...a)
3925
3956
  });
3926
- const gossip = new import_teleport_extension_gossip.Gossip({
3957
+ const gossip = new import_teleport_extension_gossip2.Gossip({
3927
3958
  localPeerId: this._signingContext.deviceKey
3928
3959
  });
3929
- const presence = new import_teleport_extension_gossip.Presence({
3930
- announceInterval: PRESENCE_ANNOUNCE_INTERVAL,
3931
- offlineTimeout: PRESENCE_OFFLINE_TIMEOUT,
3960
+ const presence = new import_teleport_extension_gossip2.Presence({
3961
+ announceInterval: this._spaceMemberPresenceAnnounceInterval,
3962
+ offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
3932
3963
  identityKey: this._signingContext.identityKey,
3933
3964
  gossip
3934
3965
  });
@@ -3957,7 +3988,7 @@ var DataSpaceManager = class {
3957
3988
  onAuthFailure: () => {
3958
3989
  import_log11.log.warn("auth failure", void 0, {
3959
3990
  F: __dxlog_file13,
3960
- L: 239,
3991
+ L: 254,
3961
3992
  S: this,
3962
3993
  C: (f, a) => f(...a)
3963
3994
  });
@@ -3981,7 +4012,7 @@ var DataSpaceManager = class {
3981
4012
  space: space.key
3982
4013
  }, {
3983
4014
  F: __dxlog_file13,
3984
- L: 257,
4015
+ L: 272,
3985
4016
  S: this,
3986
4017
  C: (f, a) => f(...a)
3987
4018
  });
@@ -3993,7 +4024,7 @@ var DataSpaceManager = class {
3993
4024
  open: this._isOpen
3994
4025
  }, {
3995
4026
  F: __dxlog_file13,
3996
- L: 264,
4027
+ L: 279,
3997
4028
  S: this,
3998
4029
  C: (f, a) => f(...a)
3999
4030
  });
@@ -4006,7 +4037,7 @@ var DataSpaceManager = class {
4006
4037
  space: space.key
4007
4038
  }, {
4008
4039
  F: __dxlog_file13,
4009
- L: 270,
4040
+ L: 285,
4010
4041
  S: this,
4011
4042
  C: (f, a) => f(...a)
4012
4043
  });
@@ -4241,9 +4272,7 @@ var SpacesServiceImpl = class {
4241
4272
  return {
4242
4273
  identity: {
4243
4274
  identityKey: member.key,
4244
- profile: {
4245
- displayName: member.profile?.displayName
4246
- }
4275
+ profile: member.profile ?? {}
4247
4276
  },
4248
4277
  presence: member.removed ? import_services11.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE,
4249
4278
  peerStates: peers
@@ -4268,16 +4297,20 @@ function _ts_decorate6(decorators, target, key, desc) {
4268
4297
  }
4269
4298
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4270
4299
  var ServiceContext = class {
4271
- constructor(storage, networkManager, signalManager, modelFactory) {
4300
+ constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
4272
4301
  this.storage = storage;
4273
4302
  this.networkManager = networkManager;
4274
4303
  this.signalManager = signalManager;
4275
4304
  this.modelFactory = modelFactory;
4305
+ this._runtimeParams = _runtimeParams;
4276
4306
  this.initialized = new import_async14.Trigger();
4277
4307
  this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
4278
4308
  this._handlerFactories = /* @__PURE__ */ new Map();
4279
4309
  this._instanceId = import_keys10.PublicKey.random().toHex();
4280
4310
  this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
4311
+ this.indexMetadata = new import_echo_schema.IndexMetadataStore({
4312
+ directory: storage.createDirectory("index-metadata")
4313
+ });
4281
4314
  this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
4282
4315
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
4283
4316
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
@@ -4299,8 +4332,11 @@ var ServiceContext = class {
4299
4332
  modelFactory: this.modelFactory,
4300
4333
  snapshotStore: this.snapshotStore
4301
4334
  });
4302
- this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4303
- this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
4335
+ this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4336
+ this.automergeHost = new import_echo_pipeline2.AutomergeHost({
4337
+ directory: storage.createDirectory("automerge"),
4338
+ metadata: this.indexMetadata
4339
+ });
4304
4340
  this.invitations = new InvitationsHandler(this.networkManager);
4305
4341
  this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
4306
4342
  }
@@ -4308,7 +4344,7 @@ var ServiceContext = class {
4308
4344
  await this._checkStorageVersion();
4309
4345
  (0, import_log13.log)("opening...", void 0, {
4310
4346
  F: __dxlog_file15,
4311
- L: 133,
4347
+ L: 152,
4312
4348
  S: this,
4313
4349
  C: (f, a) => f(...a)
4314
4350
  });
@@ -4316,7 +4352,7 @@ var ServiceContext = class {
4316
4352
  id: this._instanceId
4317
4353
  }), {
4318
4354
  F: __dxlog_file15,
4319
- L: 134,
4355
+ L: 153,
4320
4356
  S: this,
4321
4357
  C: (f, a) => f(...a)
4322
4358
  });
@@ -4332,13 +4368,13 @@ var ServiceContext = class {
4332
4368
  id: this._instanceId
4333
4369
  }), {
4334
4370
  F: __dxlog_file15,
4335
- L: 144,
4371
+ L: 163,
4336
4372
  S: this,
4337
4373
  C: (f, a) => f(...a)
4338
4374
  });
4339
4375
  (0, import_log13.log)("opened", void 0, {
4340
4376
  F: __dxlog_file15,
4341
- L: 145,
4377
+ L: 164,
4342
4378
  S: this,
4343
4379
  C: (f, a) => f(...a)
4344
4380
  });
@@ -4346,7 +4382,7 @@ var ServiceContext = class {
4346
4382
  async close() {
4347
4383
  (0, import_log13.log)("closing...", void 0, {
4348
4384
  F: __dxlog_file15,
4349
- L: 149,
4385
+ L: 168,
4350
4386
  S: this,
4351
4387
  C: (f, a) => f(...a)
4352
4388
  });
@@ -4364,7 +4400,7 @@ var ServiceContext = class {
4364
4400
  await this.metadataStore.close();
4365
4401
  (0, import_log13.log)("closed", void 0, {
4366
4402
  F: __dxlog_file15,
4367
- L: 162,
4403
+ L: 181,
4368
4404
  S: this,
4369
4405
  C: (f, a) => f(...a)
4370
4406
  });
@@ -4378,7 +4414,7 @@ var ServiceContext = class {
4378
4414
  const factory = this._handlerFactories.get(invitation.kind);
4379
4415
  (0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4380
4416
  F: __dxlog_file15,
4381
- L: 173,
4417
+ L: 192,
4382
4418
  S: this,
4383
4419
  A: [
4384
4420
  "factory",
@@ -4410,7 +4446,7 @@ var ServiceContext = class {
4410
4446
  async _initialize(ctx) {
4411
4447
  (0, import_log13.log)("initializing spaces...", void 0, {
4412
4448
  F: __dxlog_file15,
4413
- L: 204,
4449
+ L: 223,
4414
4450
  S: this,
4415
4451
  C: (f, a) => f(...a)
4416
4452
  });
@@ -4428,12 +4464,12 @@ var ServiceContext = class {
4428
4464
  });
4429
4465
  }
4430
4466
  };
4431
- this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
4467
+ this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4432
4468
  await this.dataSpaceManager.open();
4433
4469
  this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
4434
4470
  (0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4435
4471
  F: __dxlog_file15,
4436
- L: 228,
4472
+ L: 248,
4437
4473
  S: this,
4438
4474
  A: [
4439
4475
  "this.dataSpaceManager",
@@ -4457,7 +4493,7 @@ var ServiceContext = class {
4457
4493
  details: assertion
4458
4494
  }, {
4459
4495
  F: __dxlog_file15,
4460
- L: 244,
4496
+ L: 264,
4461
4497
  S: this,
4462
4498
  C: (f, a) => f(...a)
4463
4499
  });
@@ -4468,7 +4504,7 @@ var ServiceContext = class {
4468
4504
  details: assertion
4469
4505
  }, {
4470
4506
  F: __dxlog_file15,
4471
- L: 248,
4507
+ L: 268,
4472
4508
  S: this,
4473
4509
  C: (f, a) => f(...a)
4474
4510
  });
@@ -4479,7 +4515,7 @@ var ServiceContext = class {
4479
4515
  details: assertion
4480
4516
  }, {
4481
4517
  F: __dxlog_file15,
4482
- L: 253,
4518
+ L: 273,
4483
4519
  S: this,
4484
4520
  C: (f, a) => f(...a)
4485
4521
  });
@@ -4490,7 +4526,7 @@ var ServiceContext = class {
4490
4526
  } catch (err) {
4491
4527
  import_log13.log.catch(err, void 0, {
4492
4528
  F: __dxlog_file15,
4493
- L: 259,
4529
+ L: 279,
4494
4530
  S: this,
4495
4531
  C: (f, a) => f(...a)
4496
4532
  });
@@ -4628,6 +4664,7 @@ var toStorageType = (type) => {
4628
4664
  throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
4629
4665
  }
4630
4666
  };
4667
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4631
4668
  var DevicesServiceImpl = class {
4632
4669
  constructor(_identityManager) {
4633
4670
  this._identityManager = _identityManager;
@@ -4644,22 +4681,58 @@ var DevicesServiceImpl = class {
4644
4681
  devices: []
4645
4682
  });
4646
4683
  } else {
4684
+ (0, import_invariant17.invariant)(this._identityManager.identity?.presence, "presence not present", {
4685
+ F: __dxlog_file17,
4686
+ L: 32,
4687
+ S: this,
4688
+ A: [
4689
+ "this._identityManager.identity?.presence",
4690
+ "'presence not present'"
4691
+ ]
4692
+ });
4693
+ const peers = this._identityManager.identity.presence.getPeersOnline();
4647
4694
  next({
4648
- devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
4649
- deviceKey: key,
4650
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
4651
- profile
4652
- }))
4695
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
4696
+ const isMe = this._identityManager.identity?.deviceKey.equals(key);
4697
+ const peerState = peers.find((peer) => peer.identityKey.equals(key));
4698
+ return {
4699
+ deviceKey: key,
4700
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
4701
+ profile,
4702
+ presence: isMe ? import_services14.Device.PresenceState.ONLINE : peerState ? import_services14.Device.PresenceState.ONLINE : import_services14.Device.PresenceState.OFFLINE
4703
+ };
4704
+ })
4653
4705
  });
4654
4706
  }
4655
4707
  };
4708
+ let identitySubscribed = false;
4709
+ let presenceSubscribed = false;
4710
+ const subscribeIdentity = () => {
4711
+ if (!identitySubscribed) {
4712
+ this._identityManager.identity?.stateUpdate.on(() => {
4713
+ update();
4714
+ });
4715
+ identitySubscribed = true;
4716
+ }
4717
+ };
4718
+ const subscribePresence = () => {
4719
+ if (!presenceSubscribed) {
4720
+ this._identityManager.identity?.presence?.updated.on(() => {
4721
+ update();
4722
+ });
4723
+ presenceSubscribed = true;
4724
+ }
4725
+ };
4656
4726
  const subscriptions = new import_async16.EventSubscriptions();
4727
+ if (this._identityManager.identity) {
4728
+ subscribeIdentity();
4729
+ subscribePresence();
4730
+ }
4657
4731
  subscriptions.add(this._identityManager.stateUpdate.on(() => {
4658
4732
  update();
4659
4733
  if (this._identityManager.identity) {
4660
- subscriptions.add(this._identityManager.identity.stateUpdate.on(() => {
4661
- update();
4662
- }));
4734
+ subscribeIdentity();
4735
+ subscribePresence();
4663
4736
  }
4664
4737
  }));
4665
4738
  update();
@@ -4670,7 +4743,8 @@ var DevicesServiceImpl = class {
4670
4743
  var LoggingServiceImpl = class {
4671
4744
  constructor() {
4672
4745
  this._logs = new import_async17.Event();
4673
- this._started = /* @__PURE__ */ new Date();
4746
+ this._started = Date.now();
4747
+ this._sessionId = import_keys12.PublicKey.random().toHex();
4674
4748
  this._logProcessor = (_config, entry2) => {
4675
4749
  this._logs.emit(entry2);
4676
4750
  };
@@ -4746,7 +4820,12 @@ var LoggingServiceImpl = class {
4746
4820
  meta: {
4747
4821
  // TODO(dmaretskyi): Fix proto.
4748
4822
  file: entry2.meta?.F ?? "",
4749
- line: entry2.meta?.L ?? 0
4823
+ line: entry2.meta?.L ?? 0,
4824
+ scope: {
4825
+ hostSessionId: this._sessionId,
4826
+ uptimeSeconds: (Date.now() - this._started) / 1e3,
4827
+ name: (0, import_util10.getDebugName)(entry2.meta?.S)
4828
+ }
4750
4829
  }
4751
4830
  };
4752
4831
  try {
@@ -4869,7 +4948,7 @@ function _ts_decorate8(decorators, target, key, desc) {
4869
4948
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4870
4949
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4871
4950
  }
4872
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4951
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4873
4952
  var createDefaultModelFactory = () => {
4874
4953
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4875
4954
  };
@@ -4882,7 +4961,8 @@ var ClientServicesHost = class {
4882
4961
  storage,
4883
4962
  // TODO(wittjosiah): Turn this on by default.
4884
4963
  lockKey,
4885
- callbacks
4964
+ callbacks,
4965
+ runtimeParams
4886
4966
  } = {}) {
4887
4967
  this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
4888
4968
  this._statusUpdate = new import_async15.Event();
@@ -4891,6 +4971,7 @@ var ClientServicesHost = class {
4891
4971
  this._storage = storage;
4892
4972
  this._modelFactory = modelFactory;
4893
4973
  this._callbacks = callbacks;
4974
+ this._runtimeParams = runtimeParams;
4894
4975
  if (config) {
4895
4976
  this.initialize({
4896
4977
  config,
@@ -4958,8 +5039,8 @@ var ClientServicesHost = class {
4958
5039
  */
4959
5040
  initialize({ config, ...options }) {
4960
5041
  (0, import_invariant16.invariant)(!this._open, "service host is open", {
4961
- F: __dxlog_file17,
4962
- L: 186,
5042
+ F: __dxlog_file18,
5043
+ L: 190,
4963
5044
  S: this,
4964
5045
  A: [
4965
5046
  "!this._open",
@@ -4967,15 +5048,15 @@ var ClientServicesHost = class {
4967
5048
  ]
4968
5049
  });
4969
5050
  (0, import_log15.log)("initializing...", void 0, {
4970
- F: __dxlog_file17,
4971
- L: 187,
5051
+ F: __dxlog_file18,
5052
+ L: 191,
4972
5053
  S: this,
4973
5054
  C: (f, a) => f(...a)
4974
5055
  });
4975
5056
  if (config) {
4976
5057
  (0, import_invariant16.invariant)(!this._config, "config already set", {
4977
- F: __dxlog_file17,
4978
- L: 190,
5058
+ F: __dxlog_file18,
5059
+ L: 194,
4979
5060
  S: this,
4980
5061
  A: [
4981
5062
  "!this._config",
@@ -4992,8 +5073,8 @@ var ClientServicesHost = class {
4992
5073
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4993
5074
  this._signalManager = signalManager;
4994
5075
  (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
4995
- F: __dxlog_file17,
4996
- L: 206,
5076
+ F: __dxlog_file18,
5077
+ L: 210,
4997
5078
  S: this,
4998
5079
  A: [
4999
5080
  "!this._networkManager",
@@ -5006,8 +5087,8 @@ var ClientServicesHost = class {
5006
5087
  signalManager
5007
5088
  });
5008
5089
  (0, import_log15.log)("initialized", void 0, {
5009
- F: __dxlog_file17,
5010
- L: 213,
5090
+ F: __dxlog_file18,
5091
+ L: 217,
5011
5092
  S: this,
5012
5093
  C: (f, a) => f(...a)
5013
5094
  });
@@ -5020,14 +5101,14 @@ var ClientServicesHost = class {
5020
5101
  import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
5021
5102
  id: traceId
5022
5103
  }), {
5023
- F: __dxlog_file17,
5024
- L: 224,
5104
+ F: __dxlog_file18,
5105
+ L: 228,
5025
5106
  S: this,
5026
5107
  C: (f, a) => f(...a)
5027
5108
  });
5028
5109
  (0, import_invariant16.invariant)(this._config, "config not set", {
5029
- F: __dxlog_file17,
5030
- L: 226,
5110
+ F: __dxlog_file18,
5111
+ L: 230,
5031
5112
  S: this,
5032
5113
  A: [
5033
5114
  "this._config",
@@ -5035,8 +5116,8 @@ var ClientServicesHost = class {
5035
5116
  ]
5036
5117
  });
5037
5118
  (0, import_invariant16.invariant)(this._storage, "storage not set", {
5038
- F: __dxlog_file17,
5039
- L: 227,
5119
+ F: __dxlog_file18,
5120
+ L: 231,
5040
5121
  S: this,
5041
5122
  A: [
5042
5123
  "this._storage",
@@ -5044,8 +5125,8 @@ var ClientServicesHost = class {
5044
5125
  ]
5045
5126
  });
5046
5127
  (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
5047
- F: __dxlog_file17,
5048
- L: 228,
5128
+ F: __dxlog_file18,
5129
+ L: 232,
5049
5130
  S: this,
5050
5131
  A: [
5051
5132
  "this._signalManager",
@@ -5053,8 +5134,8 @@ var ClientServicesHost = class {
5053
5134
  ]
5054
5135
  });
5055
5136
  (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
5056
- F: __dxlog_file17,
5057
- L: 229,
5137
+ F: __dxlog_file18,
5138
+ L: 233,
5058
5139
  S: this,
5059
5140
  A: [
5060
5141
  "this._networkManager",
@@ -5065,14 +5146,14 @@ var ClientServicesHost = class {
5065
5146
  (0, import_log15.log)("opening...", {
5066
5147
  lockKey: this._resourceLock?.lockKey
5067
5148
  }, {
5068
- F: __dxlog_file17,
5069
- L: 232,
5149
+ F: __dxlog_file18,
5150
+ L: 236,
5070
5151
  S: this,
5071
5152
  C: (f, a) => f(...a)
5072
5153
  });
5073
5154
  await this._resourceLock?.acquire();
5074
5155
  await this._loggingService.open();
5075
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
5156
+ this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
5076
5157
  this._serviceRegistry.setServices({
5077
5158
  SystemService: this._systemService,
5078
5159
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5111,16 +5192,16 @@ var ClientServicesHost = class {
5111
5192
  (0, import_log15.log)("opened", {
5112
5193
  deviceKey
5113
5194
  }, {
5114
- F: __dxlog_file17,
5115
- L: 305,
5195
+ F: __dxlog_file18,
5196
+ L: 310,
5116
5197
  S: this,
5117
5198
  C: (f, a) => f(...a)
5118
5199
  });
5119
5200
  import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
5120
5201
  id: traceId
5121
5202
  }), {
5122
- F: __dxlog_file17,
5123
- L: 306,
5203
+ F: __dxlog_file18,
5204
+ L: 311,
5124
5205
  S: this,
5125
5206
  C: (f, a) => f(...a)
5126
5207
  });
@@ -5133,8 +5214,8 @@ var ClientServicesHost = class {
5133
5214
  (0, import_log15.log)("closing...", {
5134
5215
  deviceKey
5135
5216
  }, {
5136
- F: __dxlog_file17,
5137
- L: 317,
5217
+ F: __dxlog_file18,
5218
+ L: 322,
5138
5219
  S: this,
5139
5220
  C: (f, a) => f(...a)
5140
5221
  });
@@ -5149,8 +5230,8 @@ var ClientServicesHost = class {
5149
5230
  (0, import_log15.log)("closed", {
5150
5231
  deviceKey
5151
5232
  }, {
5152
- F: __dxlog_file17,
5153
- L: 324,
5233
+ F: __dxlog_file18,
5234
+ L: 329,
5154
5235
  S: this,
5155
5236
  C: (f, a) => f(...a)
5156
5237
  });
@@ -5160,30 +5241,30 @@ var ClientServicesHost = class {
5160
5241
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
5161
5242
  id: traceId
5162
5243
  }), {
5163
- F: __dxlog_file17,
5164
- L: 329,
5244
+ F: __dxlog_file18,
5245
+ L: 334,
5165
5246
  S: this,
5166
5247
  C: (f, a) => f(...a)
5167
5248
  });
5168
5249
  (0, import_log15.log)("resetting...", void 0, {
5169
- F: __dxlog_file17,
5170
- L: 331,
5250
+ F: __dxlog_file18,
5251
+ L: 336,
5171
5252
  S: this,
5172
5253
  C: (f, a) => f(...a)
5173
5254
  });
5174
5255
  await this._serviceContext?.close();
5175
5256
  await this._storage.reset();
5176
5257
  (0, import_log15.log)("reset", void 0, {
5177
- F: __dxlog_file17,
5178
- L: 334,
5258
+ F: __dxlog_file18,
5259
+ L: 339,
5179
5260
  S: this,
5180
5261
  C: (f, a) => f(...a)
5181
5262
  });
5182
5263
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
5183
5264
  id: traceId
5184
5265
  }), {
5185
- F: __dxlog_file17,
5186
- L: 335,
5266
+ F: __dxlog_file18,
5267
+ L: 340,
5187
5268
  S: this,
5188
5269
  C: (f, a) => f(...a)
5189
5270
  });
@@ -5197,8 +5278,8 @@ var ClientServicesHost = class {
5197
5278
  obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
5198
5279
  const automergeIndex = space.automergeSpaceState.rootUrl;
5199
5280
  (0, import_invariant16.invariant)(automergeIndex, void 0, {
5200
- F: __dxlog_file17,
5201
- L: 350,
5281
+ F: __dxlog_file18,
5282
+ L: 355,
5202
5283
  S: this,
5203
5284
  A: [
5204
5285
  "automergeIndex",
@@ -5210,8 +5291,8 @@ var ClientServicesHost = class {
5210
5291
  document.change((doc) => {
5211
5292
  (0, import_util9.assignDeep)(doc, [
5212
5293
  "objects",
5213
- obj[import_echo_schema.base]._id
5214
- ], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
5294
+ (0, import_echo_schema2.getAutomergeObjectCore)(obj).id
5295
+ ], (0, import_echo_schema2.getRawDoc)(obj).handle.docSync());
5215
5296
  });
5216
5297
  return identity;
5217
5298
  }
@@ -5267,4 +5348,4 @@ ClientServicesHost = _ts_decorate8([
5267
5348
  subscribeToSpaces,
5268
5349
  subscribeToSwarmInfo
5269
5350
  });
5270
- //# sourceMappingURL=chunk-BIYZDTFF.cjs.map
5351
+ //# sourceMappingURL=chunk-7A7AEJZG.cjs.map