@dxos/client-services 0.5.9-main.a2de4fa → 0.5.9-main.aa46ff0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/lib/browser/{chunk-7ZORW75D.mjs → chunk-3CWG7YPJ.mjs} +805 -444
  2. package/dist/lib/browser/chunk-3CWG7YPJ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +13 -2
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +10 -3
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
  8. package/dist/lib/node/{chunk-VQ7KZOFD.cjs → chunk-F4GQDNYS.cjs} +817 -456
  9. package/dist/lib/node/chunk-F4GQDNYS.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +53 -42
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +17 -10
  14. package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
  15. package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
  16. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
  17. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  19. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  20. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -1
  21. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/spaces-service.d.ts +4 -1
  23. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  24. package/dist/types/src/packlets/storage/index.d.ts +1 -0
  25. package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
  26. package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
  27. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
  28. package/dist/types/src/version.d.ts +1 -1
  29. package/package.json +36 -36
  30. package/src/packlets/identity/contacts-service.ts +85 -0
  31. package/src/packlets/invitations/invitations-handler.ts +13 -5
  32. package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
  33. package/src/packlets/services/service-host.ts +12 -4
  34. package/src/packlets/spaces/data-space-manager.ts +55 -2
  35. package/src/packlets/spaces/spaces-service.ts +38 -0
  36. package/src/packlets/storage/index.ts +1 -0
  37. package/src/packlets/storage/profile-archive.ts +97 -0
  38. package/src/version.ts +1 -1
  39. package/dist/lib/browser/chunk-7ZORW75D.mjs.map +0 -7
  40. package/dist/lib/node/chunk-VQ7KZOFD.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_VQ7KZOFD_exports = {};
30
- __export(chunk_VQ7KZOFD_exports, {
29
+ var chunk_F4GQDNYS_exports = {};
30
+ __export(chunk_F4GQDNYS_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -56,7 +56,11 @@ __export(chunk_VQ7KZOFD_exports, {
56
56
  createDiagnostics: () => createDiagnostics,
57
57
  createLevel: () => createLevel,
58
58
  createStorageObjects: () => createStorageObjects,
59
+ decodeProfileArchive: () => decodeProfileArchive,
60
+ encodeProfileArchive: () => encodeProfileArchive,
61
+ exportProfileData: () => exportProfileData,
59
62
  getNetworkPeers: () => getNetworkPeers,
63
+ importProfileData: () => importProfileData,
60
64
  isLocked: () => isLocked,
61
65
  subscribeToFeedBlocks: () => subscribeToFeedBlocks,
62
66
  subscribeToFeeds: () => subscribeToFeeds,
@@ -66,7 +70,7 @@ __export(chunk_VQ7KZOFD_exports, {
66
70
  subscribeToSpaces: () => subscribeToSpaces,
67
71
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
68
72
  });
69
- module.exports = __toCommonJS(chunk_VQ7KZOFD_exports);
73
+ module.exports = __toCommonJS(chunk_F4GQDNYS_exports);
70
74
  var import_async = require("@dxos/async");
71
75
  var import_codec_protobuf = require("@dxos/codec-protobuf");
72
76
  var import_feed_store = require("@dxos/feed-store");
@@ -236,8 +240,10 @@ var import_context14 = require("@dxos/context");
236
240
  var import_credentials15 = require("@dxos/credentials");
237
241
  var import_echo_db2 = require("@dxos/echo-db");
238
242
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
243
+ var import_echo_pipeline5 = require("@dxos/echo-pipeline");
239
244
  var import_echo_protocol2 = require("@dxos/echo-protocol");
240
245
  var import_echo_schema2 = require("@dxos/echo-schema");
246
+ var import_feed_store4 = require("@dxos/feed-store");
241
247
  var import_invariant15 = require("@dxos/invariant");
242
248
  var import_keys12 = require("@dxos/keys");
243
249
  var import_log15 = require("@dxos/log");
@@ -255,7 +261,7 @@ var import_async18 = require("@dxos/async");
255
261
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
256
262
  var import_credentials19 = require("@dxos/credentials");
257
263
  var import_debug5 = require("@dxos/debug");
258
- var import_feed_store4 = require("@dxos/feed-store");
264
+ var import_feed_store5 = require("@dxos/feed-store");
259
265
  var import_invariant16 = require("@dxos/invariant");
260
266
  var import_log16 = require("@dxos/log");
261
267
  var import_protocols12 = require("@dxos/protocols");
@@ -266,8 +272,8 @@ var import_context15 = require("@dxos/context");
266
272
  var import_credentials20 = require("@dxos/credentials");
267
273
  var import_debug6 = require("@dxos/debug");
268
274
  var import_echo_db3 = require("@dxos/echo-db");
269
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
270
- var import_feed_store5 = require("@dxos/feed-store");
275
+ var import_echo_pipeline6 = require("@dxos/echo-pipeline");
276
+ var import_feed_store6 = require("@dxos/feed-store");
271
277
  var import_invariant17 = require("@dxos/invariant");
272
278
  var import_keyring = require("@dxos/keyring");
273
279
  var import_keys13 = require("@dxos/keys");
@@ -289,38 +295,47 @@ var import_util12 = require("@dxos/util");
289
295
  var import_node_path = __toESM(require("node:path"));
290
296
  var import_keys14 = require("@dxos/keys");
291
297
  var import_kv_store = require("@dxos/kv-store");
298
+ var import_automerge_repo = require("@dxos/automerge/automerge-repo");
299
+ var import_invariant19 = require("@dxos/invariant");
300
+ var import_log19 = require("@dxos/log");
301
+ var import_protocols15 = require("@dxos/protocols");
302
+ var import_util13 = require("@dxos/util");
292
303
  var import_async20 = require("@dxos/async");
293
304
  var import_client_protocol7 = require("@dxos/client-protocol");
294
305
  var import_context16 = require("@dxos/context");
295
- var import_invariant19 = require("@dxos/invariant");
306
+ var import_invariant20 = require("@dxos/invariant");
296
307
  var import_keys15 = require("@dxos/keys");
297
- var import_log19 = require("@dxos/log");
308
+ var import_log20 = require("@dxos/log");
298
309
  var import_messaging = require("@dxos/messaging");
299
310
  var import_network_manager2 = require("@dxos/network-manager");
300
- var import_protocols15 = require("@dxos/protocols");
311
+ var import_protocols16 = require("@dxos/protocols");
301
312
  var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
302
313
  var import_tracing9 = require("@dxos/tracing");
303
314
  var import_websocket_rpc = require("@dxos/websocket-rpc");
304
315
  var import_async21 = require("@dxos/async");
305
316
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
306
- var import_invariant20 = require("@dxos/invariant");
317
+ var import_invariant21 = require("@dxos/invariant");
307
318
  var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
308
319
  var import_config3 = require("@dxos/config");
309
320
  var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
310
321
  var import_tracing10 = require("@dxos/tracing");
311
- var import_util13 = require("@dxos/util");
312
- var import_keys16 = require("@dxos/keys");
313
322
  var import_util14 = require("@dxos/util");
323
+ var import_keys16 = require("@dxos/keys");
324
+ var import_util15 = require("@dxos/util");
314
325
  var import_async22 = require("@dxos/async");
315
326
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
316
327
  var import_keys17 = require("@dxos/keys");
317
- var import_log20 = require("@dxos/log");
318
- var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
319
- var import_util15 = require("@dxos/util");
328
+ var import_util16 = require("@dxos/util");
329
+ var import_async23 = require("@dxos/async");
320
330
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
331
+ var import_keys18 = require("@dxos/keys");
332
+ var import_log21 = require("@dxos/log");
333
+ var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
334
+ var import_util17 = require("@dxos/util");
321
335
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
336
+ var import_codec_protobuf16 = require("@dxos/codec-protobuf");
322
337
  var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
323
- var import_util16 = require("@dxos/util");
338
+ var import_util18 = require("@dxos/util");
324
339
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
325
340
  return new import_codec_protobuf.Stream(({ next }) => {
326
341
  const subscriptions = new import_async.EventSubscriptions();
@@ -388,6 +403,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
388
403
  };
389
404
  });
390
405
  };
406
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
391
407
  var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
392
408
  const update = () => {
393
409
  try {
@@ -403,7 +419,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
403
419
  update();
404
420
  });
405
421
  var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
406
- const ctx = new import_context.Context();
422
+ const ctx = new import_context.Context(void 0, {
423
+ F: __dxlog_file,
424
+ L: 36
425
+ });
407
426
  signalManager.onMessage.on(ctx, (message) => {
408
427
  next({
409
428
  message: {
@@ -631,7 +650,7 @@ var DevtoolsServiceImpl = class {
631
650
  });
632
651
  }
633
652
  };
634
- var DXOS_VERSION = "0.5.9-main.a2de4fa";
653
+ var DXOS_VERSION = "0.5.9-main.aa46ff0";
635
654
  var getPlatform = () => {
636
655
  if (process.browser) {
637
656
  if (typeof window !== "undefined") {
@@ -659,7 +678,7 @@ var getPlatform = () => {
659
678
  };
660
679
  }
661
680
  };
662
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
681
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
663
682
  var DEFAULT_TIMEOUT = 1e3;
664
683
  var createDiagnostics = async (clientServices, serviceContext, config) => {
665
684
  const diagnostics = {
@@ -676,7 +695,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
676
695
  await Promise.all([
677
696
  (async () => {
678
697
  (0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
679
- F: __dxlog_file,
698
+ F: __dxlog_file2,
680
699
  L: 110,
681
700
  S: void 0,
682
701
  A: [
@@ -865,7 +884,7 @@ _ts_decorate([
865
884
  ClientRpcServer = _ts_decorate([
866
885
  import_tracing2.trace.resource()
867
886
  ], ClientRpcServer);
868
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
887
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
869
888
  var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
870
889
  var createAuthProvider = (signer) => async (nonce) => {
871
890
  const credential = await signer.createCredential({
@@ -880,7 +899,10 @@ var createAuthProvider = (signer) => async (nonce) => {
880
899
  var TrustedKeySetAuthVerifier = class {
881
900
  constructor(_params) {
882
901
  this._params = _params;
883
- this._ctx = new import_context2.Context();
902
+ this._ctx = new import_context2.Context(void 0, {
903
+ F: __dxlog_file3,
904
+ L: 45
905
+ });
884
906
  }
885
907
  async close() {
886
908
  await this._ctx.dispose();
@@ -891,7 +913,7 @@ var TrustedKeySetAuthVerifier = class {
891
913
  (0, import_log.log)("authenticating...", {
892
914
  credential
893
915
  }, {
894
- F: __dxlog_file2,
916
+ F: __dxlog_file3,
895
917
  L: 56,
896
918
  S: this,
897
919
  C: (f, a) => f(...a)
@@ -901,7 +923,7 @@ var TrustedKeySetAuthVerifier = class {
901
923
  (0, import_log.log)("Invalid credential", {
902
924
  result
903
925
  }, {
904
- F: __dxlog_file2,
926
+ F: __dxlog_file3,
905
927
  L: 60,
906
928
  S: this,
907
929
  C: (f, a) => f(...a)
@@ -913,7 +935,7 @@ var TrustedKeySetAuthVerifier = class {
913
935
  nonce,
914
936
  credential
915
937
  }, {
916
- F: __dxlog_file2,
938
+ F: __dxlog_file3,
917
939
  L: 65,
918
940
  S: this,
919
941
  C: (f, a) => f(...a)
@@ -924,7 +946,7 @@ var TrustedKeySetAuthVerifier = class {
924
946
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
925
947
  key: credential.issuer
926
948
  }, {
927
- F: __dxlog_file2,
949
+ F: __dxlog_file3,
928
950
  L: 70,
929
951
  S: this,
930
952
  C: (f, a) => f(...a)
@@ -940,7 +962,7 @@ var TrustedKeySetAuthVerifier = class {
940
962
  (0, import_log.log)("auth success", {
941
963
  key: credential.issuer
942
964
  }, {
943
- F: __dxlog_file2,
965
+ F: __dxlog_file3,
944
966
  L: 81,
945
967
  S: this,
946
968
  C: (f, a) => f(...a)
@@ -950,7 +972,7 @@ var TrustedKeySetAuthVerifier = class {
950
972
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
951
973
  key: credential.issuer
952
974
  }, {
953
- F: __dxlog_file2,
975
+ F: __dxlog_file3,
954
976
  L: 84,
955
977
  S: this,
956
978
  C: (f, a) => f(...a)
@@ -973,7 +995,7 @@ var TrustedKeySetAuthVerifier = class {
973
995
  return deviceSet.has(deviceKey);
974
996
  }
975
997
  };
976
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
998
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
977
999
  var DefaultSpaceStateMachine = class {
978
1000
  constructor(_params) {
979
1001
  this._params = _params;
@@ -990,7 +1012,7 @@ var DefaultSpaceStateMachine = class {
990
1012
  expectedIdentity: this._params.identityKey,
991
1013
  credential
992
1014
  }, {
993
- F: __dxlog_file3,
1015
+ F: __dxlog_file4,
994
1016
  L: 32,
995
1017
  S: this,
996
1018
  C: (f, a) => f(...a)
@@ -1001,7 +1023,7 @@ var DefaultSpaceStateMachine = class {
1001
1023
  import_log3.log.warn("Invalid default space id", {
1002
1024
  id: assertion.spaceId
1003
1025
  }, {
1004
- F: __dxlog_file3,
1026
+ F: __dxlog_file4,
1005
1027
  L: 36,
1006
1028
  S: this,
1007
1029
  C: (f, a) => f(...a)
@@ -1024,7 +1046,7 @@ function _ts_decorate2(decorators, target, key, desc) {
1024
1046
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1025
1047
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1026
1048
  }
1027
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
1049
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
1028
1050
  var Identity = class {
1029
1051
  constructor({ space, signer, identityKey, deviceKey, presence }) {
1030
1052
  this.stateUpdate = new import_async6.Event();
@@ -1036,7 +1058,7 @@ var Identity = class {
1036
1058
  import_log2.log.trace("dxos.halo.device", {
1037
1059
  deviceKey
1038
1060
  }, {
1039
- F: __dxlog_file4,
1061
+ F: __dxlog_file5,
1040
1062
  L: 70,
1041
1063
  S: this,
1042
1064
  C: (f, a) => f(...a)
@@ -1115,7 +1137,7 @@ var Identity = class {
1115
1137
  */
1116
1138
  getIdentityCredentialSigner() {
1117
1139
  (0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
1118
- F: __dxlog_file4,
1140
+ F: __dxlog_file5,
1119
1141
  L: 159,
1120
1142
  S: this,
1121
1143
  A: [
@@ -1159,7 +1181,7 @@ var Identity = class {
1159
1181
  controlFeedKey,
1160
1182
  dataFeedKey
1161
1183
  }, {
1162
- F: __dxlog_file4,
1184
+ F: __dxlog_file5,
1163
1185
  L: 184,
1164
1186
  S: this,
1165
1187
  C: (f, a) => f(...a)
@@ -1220,7 +1242,7 @@ function _ts_decorate3(decorators, target, key, desc) {
1220
1242
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1221
1243
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1222
1244
  }
1223
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1245
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1224
1246
  var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
1225
1247
  var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
1226
1248
  var IdentityManager = class {
@@ -1244,7 +1266,7 @@ var IdentityManager = class {
1244
1266
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
1245
1267
  id: traceId
1246
1268
  }), {
1247
- F: __dxlog_file5,
1269
+ F: __dxlog_file6,
1248
1270
  L: 104,
1249
1271
  S: this,
1250
1272
  C: (f, a) => f(...a)
@@ -1253,7 +1275,7 @@ var IdentityManager = class {
1253
1275
  (0, import_log4.log)("identity record", {
1254
1276
  identityRecord
1255
1277
  }, {
1256
- F: __dxlog_file5,
1278
+ F: __dxlog_file6,
1257
1279
  L: 107,
1258
1280
  S: this,
1259
1281
  C: (f, a) => f(...a)
@@ -1266,7 +1288,7 @@ var IdentityManager = class {
1266
1288
  identityKey: identityRecord.identityKey,
1267
1289
  displayName: this._identity.profileDocument?.displayName
1268
1290
  }, {
1269
- F: __dxlog_file5,
1291
+ F: __dxlog_file6,
1270
1292
  L: 112,
1271
1293
  S: this,
1272
1294
  C: (f, a) => f(...a)
@@ -1276,18 +1298,21 @@ var IdentityManager = class {
1276
1298
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
1277
1299
  id: traceId
1278
1300
  }), {
1279
- F: __dxlog_file5,
1301
+ F: __dxlog_file6,
1280
1302
  L: 119,
1281
1303
  S: this,
1282
1304
  C: (f, a) => f(...a)
1283
1305
  });
1284
1306
  }
1285
1307
  async close() {
1286
- await this._identity?.close(new import_context3.Context());
1308
+ await this._identity?.close(new import_context3.Context(void 0, {
1309
+ F: __dxlog_file6,
1310
+ L: 123
1311
+ }));
1287
1312
  }
1288
1313
  async createIdentity({ displayName, deviceProfile } = {}) {
1289
1314
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1290
- F: __dxlog_file5,
1315
+ F: __dxlog_file6,
1291
1316
  L: 128,
1292
1317
  S: this,
1293
1318
  A: [
@@ -1296,7 +1321,7 @@ var IdentityManager = class {
1296
1321
  ]
1297
1322
  });
1298
1323
  (0, import_log4.log)("creating identity...", void 0, {
1299
- F: __dxlog_file5,
1324
+ F: __dxlog_file6,
1300
1325
  L: 129,
1301
1326
  S: this,
1302
1327
  C: (f, a) => f(...a)
@@ -1313,11 +1338,14 @@ var IdentityManager = class {
1313
1338
  }
1314
1339
  };
1315
1340
  const identity = await this._constructIdentity(identityRecord);
1316
- await identity.open(new import_context3.Context());
1341
+ await identity.open(new import_context3.Context(void 0, {
1342
+ F: __dxlog_file6,
1343
+ L: 144
1344
+ }));
1317
1345
  {
1318
1346
  const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
1319
1347
  (0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
1320
- F: __dxlog_file5,
1348
+ F: __dxlog_file6,
1321
1349
  L: 148,
1322
1350
  S: this,
1323
1351
  A: [
@@ -1326,7 +1354,7 @@ var IdentityManager = class {
1326
1354
  ]
1327
1355
  });
1328
1356
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
1329
- F: __dxlog_file5,
1357
+ F: __dxlog_file6,
1330
1358
  L: 149,
1331
1359
  S: this,
1332
1360
  A: [
@@ -1365,7 +1393,7 @@ var IdentityManager = class {
1365
1393
  identityKey: identityRecord.identityKey,
1366
1394
  displayName: this._identity.profileDocument?.displayName
1367
1395
  }, {
1368
- F: __dxlog_file5,
1396
+ F: __dxlog_file6,
1369
1397
  L: 191,
1370
1398
  S: this,
1371
1399
  C: (f, a) => f(...a)
@@ -1376,7 +1404,7 @@ var IdentityManager = class {
1376
1404
  deviceKey: identity.deviceKey,
1377
1405
  profile: identity.profileDocument
1378
1406
  }, {
1379
- F: __dxlog_file5,
1407
+ F: __dxlog_file6,
1380
1408
  L: 197,
1381
1409
  S: this,
1382
1410
  C: (f, a) => f(...a)
@@ -1413,13 +1441,13 @@ var IdentityManager = class {
1413
1441
  (0, import_log4.log)("accepting identity", {
1414
1442
  params
1415
1443
  }, {
1416
- F: __dxlog_file5,
1444
+ F: __dxlog_file6,
1417
1445
  L: 235,
1418
1446
  S: this,
1419
1447
  C: (f, a) => f(...a)
1420
1448
  });
1421
1449
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1422
- F: __dxlog_file5,
1450
+ F: __dxlog_file6,
1423
1451
  L: 236,
1424
1452
  S: this,
1425
1453
  A: [
@@ -1439,7 +1467,10 @@ var IdentityManager = class {
1439
1467
  }
1440
1468
  };
1441
1469
  const identity = await this._constructIdentity(identityRecord);
1442
- await identity.open(new import_context3.Context());
1470
+ await identity.open(new import_context3.Context(void 0, {
1471
+ F: __dxlog_file6,
1472
+ L: 251
1473
+ }));
1443
1474
  this._identity = identity;
1444
1475
  await this._metadataStore.setIdentityRecord(identityRecord);
1445
1476
  await this._identity.ready();
@@ -1447,7 +1478,7 @@ var IdentityManager = class {
1447
1478
  identityKey: identityRecord.identityKey,
1448
1479
  displayName: this._identity.profileDocument?.displayName
1449
1480
  }, {
1450
- F: __dxlog_file5,
1481
+ F: __dxlog_file6,
1451
1482
  L: 255,
1452
1483
  S: this,
1453
1484
  C: (f, a) => f(...a)
@@ -1461,7 +1492,7 @@ var IdentityManager = class {
1461
1492
  identityKey: identity.identityKey,
1462
1493
  deviceKey: identity.deviceKey
1463
1494
  }, {
1464
- F: __dxlog_file5,
1495
+ F: __dxlog_file6,
1465
1496
  L: 265,
1466
1497
  S: this,
1467
1498
  C: (f, a) => f(...a)
@@ -1473,7 +1504,7 @@ var IdentityManager = class {
1473
1504
  */
1474
1505
  async updateProfile(profile) {
1475
1506
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1476
- F: __dxlog_file5,
1507
+ F: __dxlog_file6,
1477
1508
  L: 273,
1478
1509
  S: this,
1479
1510
  A: [
@@ -1504,7 +1535,7 @@ var IdentityManager = class {
1504
1535
  }
1505
1536
  async updateDeviceProfile(profile) {
1506
1537
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1507
- F: __dxlog_file5,
1538
+ F: __dxlog_file6,
1508
1539
  L: 290,
1509
1540
  S: this,
1510
1541
  A: [
@@ -1540,7 +1571,7 @@ var IdentityManager = class {
1540
1571
  }
1541
1572
  async _constructIdentity(identityRecord) {
1542
1573
  (0, import_invariant3.invariant)(!this._identity, void 0, {
1543
- F: __dxlog_file5,
1574
+ F: __dxlog_file6,
1544
1575
  L: 316,
1545
1576
  S: this,
1546
1577
  A: [
@@ -1551,7 +1582,7 @@ var IdentityManager = class {
1551
1582
  (0, import_log4.log)("constructing identity", {
1552
1583
  identityRecord
1553
1584
  }, {
1554
- F: __dxlog_file5,
1585
+ F: __dxlog_file6,
1555
1586
  L: 317,
1556
1587
  S: this,
1557
1588
  C: (f, a) => f(...a)
@@ -1566,7 +1597,7 @@ var IdentityManager = class {
1566
1597
  gossip
1567
1598
  });
1568
1599
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
1569
- F: __dxlog_file5,
1600
+ F: __dxlog_file6,
1570
1601
  L: 330,
1571
1602
  S: this,
1572
1603
  A: [
@@ -1578,7 +1609,7 @@ var IdentityManager = class {
1578
1609
  writable: true
1579
1610
  });
1580
1611
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
1581
- F: __dxlog_file5,
1612
+ F: __dxlog_file6,
1582
1613
  L: 334,
1583
1614
  S: this,
1584
1615
  A: [
@@ -1612,7 +1643,7 @@ var IdentityManager = class {
1612
1643
  (0, import_log4.log)("done", {
1613
1644
  identityKey: identityRecord.identityKey
1614
1645
  }, {
1615
- F: __dxlog_file5,
1646
+ F: __dxlog_file6,
1616
1647
  L: 360,
1617
1648
  S: this,
1618
1649
  C: (f, a) => f(...a)
@@ -1637,7 +1668,7 @@ var IdentityManager = class {
1637
1668
  },
1638
1669
  onAuthFailure: () => {
1639
1670
  import_log4.log.warn("auth failure", void 0, {
1640
- F: __dxlog_file5,
1671
+ F: __dxlog_file6,
1641
1672
  L: 385,
1642
1673
  S: this,
1643
1674
  C: (f, a) => f(...a)
@@ -1659,7 +1690,7 @@ _ts_decorate3([
1659
1690
  IdentityManager = _ts_decorate3([
1660
1691
  import_tracing4.trace.resource()
1661
1692
  ], IdentityManager);
1662
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1693
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1663
1694
  var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
1664
1695
  var IdentityServiceImpl = class extends import_context4.Resource {
1665
1696
  constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
@@ -1689,7 +1720,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1689
1720
  const space = await dataSpaceManager.createDefaultSpace();
1690
1721
  const identity = this._identityManager.identity;
1691
1722
  (0, import_invariant4.invariant)(identity, void 0, {
1692
- F: __dxlog_file6,
1723
+ F: __dxlog_file7,
1693
1724
  L: 59,
1694
1725
  S: this,
1695
1726
  A: [
@@ -1723,7 +1754,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1723
1754
  }
1724
1755
  async updateProfile(profile) {
1725
1756
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1726
- F: __dxlog_file6,
1757
+ F: __dxlog_file7,
1727
1758
  L: 89,
1728
1759
  S: this,
1729
1760
  A: [
@@ -1737,7 +1768,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1737
1768
  }
1738
1769
  async signPresentation({ presentation, nonce }) {
1739
1770
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1740
- F: __dxlog_file6,
1771
+ F: __dxlog_file7,
1741
1772
  L: 96,
1742
1773
  S: this,
1743
1774
  A: [
@@ -1772,7 +1803,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1772
1803
  import_log5.log.warn("Multiple default spaces found. Using the first one.", {
1773
1804
  duplicate: space.id
1774
1805
  }, {
1775
- F: __dxlog_file6,
1806
+ F: __dxlog_file7,
1776
1807
  L: 127,
1777
1808
  S: this,
1778
1809
  C: (f, a) => f(...a)
@@ -1795,7 +1826,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1795
1826
  }
1796
1827
  }
1797
1828
  };
1798
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1829
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1799
1830
  var DeviceInvitationProtocol = class {
1800
1831
  constructor(_keyring, _getIdentity, _acceptIdentity) {
1801
1832
  this._keyring = _keyring;
@@ -1821,7 +1852,7 @@ var DeviceInvitationProtocol = class {
1821
1852
  }
1822
1853
  async admit(_, request) {
1823
1854
  (0, import_invariant5.invariant)(request.device, void 0, {
1824
- F: __dxlog_file7,
1855
+ F: __dxlog_file8,
1825
1856
  L: 50,
1826
1857
  S: this,
1827
1858
  A: [
@@ -1867,7 +1898,7 @@ var DeviceInvitationProtocol = class {
1867
1898
  }
1868
1899
  async accept(response, request) {
1869
1900
  (0, import_invariant5.invariant)(response.device, void 0, {
1870
- F: __dxlog_file7,
1901
+ F: __dxlog_file8,
1871
1902
  L: 95,
1872
1903
  S: this,
1873
1904
  A: [
@@ -1877,7 +1908,7 @@ var DeviceInvitationProtocol = class {
1877
1908
  });
1878
1909
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1879
1910
  (0, import_invariant5.invariant)(request.device, void 0, {
1880
- F: __dxlog_file7,
1911
+ F: __dxlog_file8,
1881
1912
  L: 98,
1882
1913
  S: this,
1883
1914
  A: [
@@ -1916,7 +1947,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
1916
1947
  return guard;
1917
1948
  })());
1918
1949
  };
1919
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1950
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1920
1951
  var OPTIONS_TIMEOUT = 1e4;
1921
1952
  var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1922
1953
  constructor(_invitationFlowMutex, _callbacks) {
@@ -1930,7 +1961,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1930
1961
  });
1931
1962
  this._invitationFlowMutex = _invitationFlowMutex;
1932
1963
  this._callbacks = _callbacks;
1933
- this._ctx = new import_context6.Context();
1964
+ this._ctx = new import_context6.Context(void 0, {
1965
+ F: __dxlog_file9,
1966
+ L: 33
1967
+ });
1934
1968
  this._remoteOptionsTrigger = new import_async10.Trigger();
1935
1969
  this._invitationFlowLock = null;
1936
1970
  }
@@ -1942,7 +1976,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1942
1976
  InvitationHostService: {
1943
1977
  options: async (options) => {
1944
1978
  (0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
1945
- F: __dxlog_file8,
1979
+ F: __dxlog_file9,
1946
1980
  L: 63,
1947
1981
  S: this,
1948
1982
  A: [
@@ -1969,14 +2003,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1969
2003
  await super.onOpen(context);
1970
2004
  try {
1971
2005
  (0, import_log7.log)("guest acquire lock", void 0, {
1972
- F: __dxlog_file8,
2006
+ F: __dxlog_file9,
1973
2007
  L: 84,
1974
2008
  S: this,
1975
2009
  C: (f, a) => f(...a)
1976
2010
  });
1977
2011
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
1978
2012
  (0, import_log7.log)("guest lock acquired", void 0, {
1979
- F: __dxlog_file8,
2013
+ F: __dxlog_file9,
1980
2014
  L: 86,
1981
2015
  S: this,
1982
2016
  C: (f, a) => f(...a)
@@ -1985,7 +2019,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1985
2019
  role: import_invitations3.Options.Role.GUEST
1986
2020
  }));
1987
2021
  (0, import_log7.log)("options sent", void 0, {
1988
- F: __dxlog_file8,
2022
+ F: __dxlog_file9,
1989
2023
  L: 88,
1990
2024
  S: this,
1991
2025
  C: (f, a) => f(...a)
@@ -1994,7 +2028,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1994
2028
  timeout: OPTIONS_TIMEOUT
1995
2029
  }));
1996
2030
  (0, import_log7.log)("options received", void 0, {
1997
- F: __dxlog_file8,
2031
+ F: __dxlog_file9,
1998
2032
  L: 90,
1999
2033
  S: this,
2000
2034
  C: (f, a) => f(...a)
@@ -2028,7 +2062,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
2028
2062
  this._invitationFlowLock.release();
2029
2063
  this._invitationFlowLock = null;
2030
2064
  (0, import_log7.log)("invitation flow lock released", void 0, {
2031
- F: __dxlog_file8,
2065
+ F: __dxlog_file9,
2032
2066
  L: 123,
2033
2067
  S: this,
2034
2068
  C: (f, a) => f(...a)
@@ -2036,7 +2070,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
2036
2070
  }
2037
2071
  }
2038
2072
  };
2039
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
2073
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
2040
2074
  var OPTIONS_TIMEOUT2 = 1e4;
2041
2075
  var MAX_OTP_ATTEMPTS = 3;
2042
2076
  var InvitationHostExtension = class extends import_teleport2.RpcExtension {
@@ -2051,7 +2085,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2051
2085
  });
2052
2086
  this._invitationFlowMutex = _invitationFlowMutex;
2053
2087
  this._callbacks = _callbacks;
2054
- this._ctx = new import_context8.Context();
2088
+ this._ctx = new import_context8.Context(void 0, {
2089
+ F: __dxlog_file10,
2090
+ L: 52
2091
+ });
2055
2092
  this._remoteOptionsTrigger = new import_async11.Trigger();
2056
2093
  this._challenge = void 0;
2057
2094
  this.guestProfile = void 0;
@@ -2070,7 +2107,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2070
2107
  InvitationHostService: {
2071
2108
  options: async (options) => {
2072
2109
  (0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
2073
- F: __dxlog_file9,
2110
+ F: __dxlog_file10,
2074
2111
  L: 101,
2075
2112
  S: this,
2076
2113
  A: [
@@ -2087,7 +2124,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2087
2124
  import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
2088
2125
  id: traceId
2089
2126
  }), {
2090
- F: __dxlog_file9,
2127
+ F: __dxlog_file10,
2091
2128
  L: 110,
2092
2129
  S: this,
2093
2130
  C: (f, a) => f(...a)
@@ -2099,7 +2136,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2099
2136
  expected: invitation.invitationId,
2100
2137
  actual: invitationId
2101
2138
  }, {
2102
- F: __dxlog_file9,
2139
+ F: __dxlog_file10,
2103
2140
  L: 116,
2104
2141
  S: this,
2105
2142
  C: (f, a) => f(...a)
@@ -2113,7 +2150,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2113
2150
  (0, import_log8.log)("guest introduced themselves", {
2114
2151
  guestProfile: profile
2115
2152
  }, {
2116
- F: __dxlog_file9,
2153
+ F: __dxlog_file10,
2117
2154
  L: 125,
2118
2155
  S: this,
2119
2156
  C: (f, a) => f(...a)
@@ -2124,7 +2161,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2124
2161
  import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
2125
2162
  id: traceId
2126
2163
  }), {
2127
- F: __dxlog_file9,
2164
+ F: __dxlog_file10,
2128
2165
  L: 132,
2129
2166
  S: this,
2130
2167
  C: (f, a) => f(...a)
@@ -2139,7 +2176,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2139
2176
  import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
2140
2177
  id: traceId
2141
2178
  }), {
2142
- F: __dxlog_file9,
2179
+ F: __dxlog_file10,
2143
2180
  L: 141,
2144
2181
  S: this,
2145
2182
  C: (f, a) => f(...a)
@@ -2148,7 +2185,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2148
2185
  (0, import_log8.log)("received authentication request", {
2149
2186
  authCode: code
2150
2187
  }, {
2151
- F: __dxlog_file9,
2188
+ F: __dxlog_file10,
2152
2189
  L: 144,
2153
2190
  S: this,
2154
2191
  C: (f, a) => f(...a)
@@ -2162,7 +2199,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2162
2199
  switch (invitation.authMethod) {
2163
2200
  case import_services8.Invitation.AuthMethod.NONE: {
2164
2201
  (0, import_log8.log)("authentication not required", void 0, {
2165
- F: __dxlog_file9,
2202
+ F: __dxlog_file10,
2166
2203
  L: 152,
2167
2204
  S: this,
2168
2205
  C: (f, a) => f(...a)
@@ -2200,7 +2237,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2200
2237
  import_log8.log.error("invalid authentication method", {
2201
2238
  authMethod: invitation.authMethod
2202
2239
  }, {
2203
- F: __dxlog_file9,
2240
+ F: __dxlog_file10,
2204
2241
  L: 190,
2205
2242
  S: this,
2206
2243
  C: (f, a) => f(...a)
@@ -2225,7 +2262,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2225
2262
  status
2226
2263
  }
2227
2264
  }), {
2228
- F: __dxlog_file9,
2265
+ F: __dxlog_file10,
2229
2266
  L: 202,
2230
2267
  S: this,
2231
2268
  C: (f, a) => f(...a)
@@ -2239,7 +2276,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2239
2276
  import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
2240
2277
  id: traceId
2241
2278
  }), {
2242
- F: __dxlog_file9,
2279
+ F: __dxlog_file10,
2243
2280
  L: 208,
2244
2281
  S: this,
2245
2282
  C: (f, a) => f(...a)
@@ -2256,7 +2293,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2256
2293
  import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
2257
2294
  id: traceId
2258
2295
  }), {
2259
- F: __dxlog_file9,
2296
+ F: __dxlog_file10,
2260
2297
  L: 222,
2261
2298
  S: this,
2262
2299
  C: (f, a) => f(...a)
@@ -2274,14 +2311,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2274
2311
  await super.onOpen(context);
2275
2312
  try {
2276
2313
  (0, import_log8.log)("host acquire lock", void 0, {
2277
- F: __dxlog_file9,
2314
+ F: __dxlog_file10,
2278
2315
  L: 237,
2279
2316
  S: this,
2280
2317
  C: (f, a) => f(...a)
2281
2318
  });
2282
2319
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
2283
2320
  (0, import_log8.log)("host lock acquired", void 0, {
2284
- F: __dxlog_file9,
2321
+ F: __dxlog_file10,
2285
2322
  L: 239,
2286
2323
  S: this,
2287
2324
  C: (f, a) => f(...a)
@@ -2292,7 +2329,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2292
2329
  role: import_invitations4.Options.Role.HOST
2293
2330
  });
2294
2331
  (0, import_log8.log)("options sent", void 0, {
2295
- F: __dxlog_file9,
2332
+ F: __dxlog_file10,
2296
2333
  L: 243,
2297
2334
  S: this,
2298
2335
  C: (f, a) => f(...a)
@@ -2301,7 +2338,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2301
2338
  timeout: OPTIONS_TIMEOUT2
2302
2339
  }));
2303
2340
  (0, import_log8.log)("options received", void 0, {
2304
- F: __dxlog_file9,
2341
+ F: __dxlog_file10,
2305
2342
  L: 245,
2306
2343
  S: this,
2307
2344
  C: (f, a) => f(...a)
@@ -2355,7 +2392,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2355
2392
  this._invitationFlowLock?.release();
2356
2393
  this._invitationFlowLock = null;
2357
2394
  (0, import_log8.log)("invitation flow lock released", void 0, {
2358
- F: __dxlog_file9,
2395
+ F: __dxlog_file10,
2359
2396
  L: 300,
2360
2397
  S: this,
2361
2398
  C: (f, a) => f(...a)
@@ -2364,7 +2401,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2364
2401
  }
2365
2402
  };
2366
2403
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
2367
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2404
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2368
2405
  var InvitationTopology = class {
2369
2406
  constructor(_role) {
2370
2407
  this._role = _role;
@@ -2372,7 +2409,7 @@ var InvitationTopology = class {
2372
2409
  }
2373
2410
  init(controller) {
2374
2411
  (0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
2375
- F: __dxlog_file10,
2412
+ F: __dxlog_file11,
2376
2413
  L: 42,
2377
2414
  S: this,
2378
2415
  A: [
@@ -2384,7 +2421,7 @@ var InvitationTopology = class {
2384
2421
  }
2385
2422
  update() {
2386
2423
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2387
- F: __dxlog_file10,
2424
+ F: __dxlog_file11,
2388
2425
  L: 47,
2389
2426
  S: this,
2390
2427
  A: [
@@ -2407,7 +2444,7 @@ var InvitationTopology = class {
2407
2444
  ownPeerId,
2408
2445
  remotePeerId: firstUnknownPeer
2409
2446
  }, {
2410
- F: __dxlog_file10,
2447
+ F: __dxlog_file11,
2411
2448
  L: 69,
2412
2449
  S: this,
2413
2450
  C: (f, a) => f(...a)
@@ -2418,7 +2455,7 @@ var InvitationTopology = class {
2418
2455
  }
2419
2456
  async onOffer(peer) {
2420
2457
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2421
- F: __dxlog_file10,
2458
+ F: __dxlog_file11,
2422
2459
  L: 76,
2423
2460
  S: this,
2424
2461
  A: [
@@ -2435,7 +2472,7 @@ var InvitationTopology = class {
2435
2472
  return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
2436
2473
  }
2437
2474
  };
2438
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2475
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2439
2476
  var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
2440
2477
  var InvitationsHandler = class {
2441
2478
  /**
@@ -2460,7 +2497,7 @@ var InvitationsHandler = class {
2460
2497
  try {
2461
2498
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
2462
2499
  (0, import_invariant6.invariant)(deviceKey, void 0, {
2463
- F: __dxlog_file11,
2500
+ F: __dxlog_file12,
2464
2501
  L: 90,
2465
2502
  S: this,
2466
2503
  A: [
@@ -2489,7 +2526,7 @@ var InvitationsHandler = class {
2489
2526
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
2490
2527
  id: traceId
2491
2528
  }), {
2492
- F: __dxlog_file11,
2529
+ F: __dxlog_file12,
2493
2530
  L: 115,
2494
2531
  S: this,
2495
2532
  C: (f, a) => f(...a)
@@ -2497,7 +2534,7 @@ var InvitationsHandler = class {
2497
2534
  (0, import_log6.log)("connected", {
2498
2535
  ...protocol.toJSON()
2499
2536
  }, {
2500
- F: __dxlog_file11,
2537
+ F: __dxlog_file12,
2501
2538
  L: 116,
2502
2539
  S: this,
2503
2540
  C: (f, a) => f(...a)
@@ -2509,7 +2546,7 @@ var InvitationsHandler = class {
2509
2546
  guest: deviceKey,
2510
2547
  ...protocol.toJSON()
2511
2548
  }, {
2512
- F: __dxlog_file11,
2549
+ F: __dxlog_file12,
2513
2550
  L: 118,
2514
2551
  S: this,
2515
2552
  C: (f, a) => f(...a)
@@ -2518,7 +2555,7 @@ var InvitationsHandler = class {
2518
2555
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
2519
2556
  id: traceId
2520
2557
  }), {
2521
- F: __dxlog_file11,
2558
+ F: __dxlog_file12,
2522
2559
  L: 120,
2523
2560
  S: this,
2524
2561
  C: (f, a) => f(...a)
@@ -2533,7 +2570,7 @@ var InvitationsHandler = class {
2533
2570
  (0, import_log6.log)("timeout", {
2534
2571
  ...protocol.toJSON()
2535
2572
  }, {
2536
- F: __dxlog_file11,
2573
+ F: __dxlog_file12,
2537
2574
  L: 129,
2538
2575
  S: this,
2539
2576
  C: (f, a) => f(...a)
@@ -2542,7 +2579,7 @@ var InvitationsHandler = class {
2542
2579
  } else {
2543
2580
  if (guardedState.error(extension, err)) {
2544
2581
  import_log6.log.error("failed", err, {
2545
- F: __dxlog_file11,
2582
+ F: __dxlog_file12,
2546
2583
  L: 133,
2547
2584
  S: this,
2548
2585
  C: (f, a) => f(...a)
@@ -2553,7 +2590,7 @@ var InvitationsHandler = class {
2553
2590
  id: traceId,
2554
2591
  error: err
2555
2592
  }), {
2556
- F: __dxlog_file11,
2593
+ F: __dxlog_file12,
2557
2594
  L: 136,
2558
2595
  S: this,
2559
2596
  C: (f, a) => f(...a)
@@ -2567,7 +2604,7 @@ var InvitationsHandler = class {
2567
2604
  (0, import_log6.log)("invalid role", {
2568
2605
  ...err.context
2569
2606
  }, {
2570
- F: __dxlog_file11,
2607
+ F: __dxlog_file12,
2571
2608
  L: 144,
2572
2609
  S: this,
2573
2610
  C: (f, a) => f(...a)
@@ -2579,7 +2616,7 @@ var InvitationsHandler = class {
2579
2616
  (0, import_log6.log)("timeout", {
2580
2617
  err
2581
2618
  }, {
2582
- F: __dxlog_file11,
2619
+ F: __dxlog_file12,
2583
2620
  L: 149,
2584
2621
  S: this,
2585
2622
  C: (f, a) => f(...a)
@@ -2588,7 +2625,7 @@ var InvitationsHandler = class {
2588
2625
  } else {
2589
2626
  if (guardedState.error(extension, err)) {
2590
2627
  import_log6.log.error("failed", err, {
2591
- F: __dxlog_file11,
2628
+ F: __dxlog_file12,
2592
2629
  L: 153,
2593
2630
  S: this,
2594
2631
  C: (f, a) => f(...a)
@@ -2602,7 +2639,7 @@ var InvitationsHandler = class {
2602
2639
  if (invitation.lifetime && invitation.created) {
2603
2640
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2604
2641
  import_log6.log.warn("invitation has already expired", void 0, {
2605
- F: __dxlog_file11,
2642
+ F: __dxlog_file12,
2606
2643
  L: 164,
2607
2644
  S: this,
2608
2645
  C: (f, a) => f(...a)
@@ -2625,7 +2662,7 @@ var InvitationsHandler = class {
2625
2662
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
2626
2663
  if (deviceProfile) {
2627
2664
  (0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2628
- F: __dxlog_file11,
2665
+ F: __dxlog_file12,
2629
2666
  L: 197,
2630
2667
  S: this,
2631
2668
  A: [
@@ -2643,7 +2680,7 @@ var InvitationsHandler = class {
2643
2680
  invitationType: import_services6.Invitation.Type.DELEGATED,
2644
2681
  triedPeers: triedPeersIds.size
2645
2682
  }, {
2646
- F: __dxlog_file11,
2683
+ F: __dxlog_file12,
2647
2684
  L: 205,
2648
2685
  S: this,
2649
2686
  C: (f, a) => f(...a)
@@ -2670,7 +2707,7 @@ var InvitationsHandler = class {
2670
2707
  admitted,
2671
2708
  currentState: guardedState.current.state
2672
2709
  }, {
2673
- F: __dxlog_file11,
2710
+ F: __dxlog_file12,
2674
2711
  L: 233,
2675
2712
  S: this,
2676
2713
  C: (f, a) => f(...a)
@@ -2688,7 +2725,7 @@ var InvitationsHandler = class {
2688
2725
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
2689
2726
  id: traceId
2690
2727
  }), {
2691
- F: __dxlog_file11,
2728
+ F: __dxlog_file12,
2692
2729
  L: 245,
2693
2730
  S: this,
2694
2731
  C: (f, a) => f(...a)
@@ -2700,7 +2737,7 @@ var InvitationsHandler = class {
2700
2737
  (0, import_log6.log)("connected", {
2701
2738
  ...protocol.toJSON()
2702
2739
  }, {
2703
- F: __dxlog_file11,
2740
+ F: __dxlog_file12,
2704
2741
  L: 256,
2705
2742
  S: this,
2706
2743
  C: (f, a) => f(...a)
@@ -2709,7 +2746,7 @@ var InvitationsHandler = class {
2709
2746
  (0, import_log6.log)("introduce", {
2710
2747
  ...protocol.toJSON()
2711
2748
  }, {
2712
- F: __dxlog_file11,
2749
+ F: __dxlog_file12,
2713
2750
  L: 260,
2714
2751
  S: this,
2715
2752
  C: (f, a) => f(...a)
@@ -2722,7 +2759,7 @@ var InvitationsHandler = class {
2722
2759
  ...protocol.toJSON(),
2723
2760
  response: introductionResponse
2724
2761
  }, {
2725
- F: __dxlog_file11,
2762
+ F: __dxlog_file12,
2726
2763
  L: 265,
2727
2764
  S: this,
2728
2765
  C: (f, a) => f(...a)
@@ -2743,7 +2780,7 @@ var InvitationsHandler = class {
2743
2780
  (0, import_log6.log)("request admission", {
2744
2781
  ...protocol.toJSON()
2745
2782
  }, {
2746
- F: __dxlog_file11,
2783
+ F: __dxlog_file12,
2747
2784
  L: 291,
2748
2785
  S: this,
2749
2786
  C: (f, a) => f(...a)
@@ -2755,7 +2792,7 @@ var InvitationsHandler = class {
2755
2792
  (0, import_log6.log)("admitted by host", {
2756
2793
  ...protocol.toJSON()
2757
2794
  }, {
2758
- F: __dxlog_file11,
2795
+ F: __dxlog_file12,
2759
2796
  L: 302,
2760
2797
  S: this,
2761
2798
  C: (f, a) => f(...a)
@@ -2768,7 +2805,7 @@ var InvitationsHandler = class {
2768
2805
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
2769
2806
  id: traceId
2770
2807
  }), {
2771
- F: __dxlog_file11,
2808
+ F: __dxlog_file12,
2772
2809
  L: 308,
2773
2810
  S: this,
2774
2811
  C: (f, a) => f(...a)
@@ -2778,7 +2815,7 @@ var InvitationsHandler = class {
2778
2815
  (0, import_log6.log)("timeout", {
2779
2816
  ...protocol.toJSON()
2780
2817
  }, {
2781
- F: __dxlog_file11,
2818
+ F: __dxlog_file12,
2782
2819
  L: 311,
2783
2820
  S: this,
2784
2821
  C: (f, a) => f(...a)
@@ -2786,7 +2823,7 @@ var InvitationsHandler = class {
2786
2823
  guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2787
2824
  } else {
2788
2825
  (0, import_log6.log)("auth failed", err, {
2789
- F: __dxlog_file11,
2826
+ F: __dxlog_file12,
2790
2827
  L: 314,
2791
2828
  S: this,
2792
2829
  C: (f, a) => f(...a)
@@ -2798,7 +2835,7 @@ var InvitationsHandler = class {
2798
2835
  id: traceId,
2799
2836
  error: err
2800
2837
  }), {
2801
- F: __dxlog_file11,
2838
+ F: __dxlog_file12,
2802
2839
  L: 318,
2803
2840
  S: this,
2804
2841
  C: (f, a) => f(...a)
@@ -2814,7 +2851,7 @@ var InvitationsHandler = class {
2814
2851
  (0, import_log6.log)("timeout", {
2815
2852
  ...protocol.toJSON()
2816
2853
  }, {
2817
- F: __dxlog_file11,
2854
+ F: __dxlog_file12,
2818
2855
  L: 327,
2819
2856
  S: this,
2820
2857
  C: (f, a) => f(...a)
@@ -2822,7 +2859,7 @@ var InvitationsHandler = class {
2822
2859
  guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2823
2860
  } else {
2824
2861
  (0, import_log6.log)("auth failed", err, {
2825
- F: __dxlog_file11,
2862
+ F: __dxlog_file12,
2826
2863
  L: 330,
2827
2864
  S: this,
2828
2865
  C: (f, a) => f(...a)
@@ -2840,7 +2877,7 @@ var InvitationsHandler = class {
2840
2877
  await ctx.dispose();
2841
2878
  } else {
2842
2879
  (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2843
- F: __dxlog_file11,
2880
+ F: __dxlog_file12,
2844
2881
  L: 345,
2845
2882
  S: this,
2846
2883
  A: [
@@ -2934,16 +2971,29 @@ var InvitationsHandler = class {
2934
2971
  };
2935
2972
  }
2936
2973
  _logStateUpdate(invitation, actor, newState) {
2937
- (0, import_log6.log)("invitation state update", {
2938
- actor: actor?.constructor.name,
2939
- newState: stateToString(newState),
2940
- oldState: stateToString(invitation.state)
2941
- }, {
2942
- F: __dxlog_file11,
2943
- L: 438,
2944
- S: this,
2945
- C: (f, a) => f(...a)
2946
- });
2974
+ if (this._isNotTerminal(newState)) {
2975
+ (0, import_log6.log)("invitation state update", {
2976
+ actor: actor?.constructor.name,
2977
+ newState: stateToString(newState),
2978
+ oldState: stateToString(invitation.state)
2979
+ }, {
2980
+ F: __dxlog_file12,
2981
+ L: 439,
2982
+ S: this,
2983
+ C: (f, a) => f(...a)
2984
+ });
2985
+ } else {
2986
+ import_log6.log.info("invitation state update", {
2987
+ actor: actor?.constructor.name,
2988
+ newState: stateToString(newState),
2989
+ oldState: stateToString(invitation.state)
2990
+ }, {
2991
+ F: __dxlog_file12,
2992
+ L: 445,
2993
+ S: this,
2994
+ C: (f, a) => f(...a)
2995
+ });
2996
+ }
2947
2997
  }
2948
2998
  _isNotTerminal(currentState) {
2949
2999
  return ![
@@ -2957,16 +3007,16 @@ var InvitationsHandler = class {
2957
3007
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2958
3008
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2959
3009
  (0, import_log6.log)("guest waiting for authentication code...", void 0, {
2960
- F: __dxlog_file11,
2961
- L: 462,
3010
+ F: __dxlog_file12,
3011
+ L: 470,
2962
3012
  S: this,
2963
3013
  C: (f, a) => f(...a)
2964
3014
  });
2965
3015
  setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
2966
3016
  const authCode = await authenticated.wait(options);
2967
3017
  (0, import_log6.log)("sending authentication request", void 0, {
2968
- F: __dxlog_file11,
2969
- L: 466,
3018
+ F: __dxlog_file12,
3019
+ L: 474,
2970
3020
  S: this,
2971
3021
  C: (f, a) => f(...a)
2972
3022
  });
@@ -2984,8 +3034,8 @@ var InvitationsHandler = class {
2984
3034
  (0, import_log6.log)("retrying invalid code", {
2985
3035
  attempt
2986
3036
  }, {
2987
- F: __dxlog_file11,
2988
- L: 477,
3037
+ F: __dxlog_file12,
3038
+ L: 485,
2989
3039
  S: this,
2990
3040
  C: (f, a) => f(...a)
2991
3041
  });
@@ -3002,8 +3052,8 @@ var InvitationsHandler = class {
3002
3052
  throw new Error("challenge missing in the introduction");
3003
3053
  }
3004
3054
  (0, import_log6.log)("sending authentication request", void 0, {
3005
- F: __dxlog_file11,
3006
- L: 496,
3055
+ F: __dxlog_file12,
3056
+ L: 504,
3007
3057
  S: this,
3008
3058
  C: (f, a) => f(...a)
3009
3059
  });
@@ -3117,7 +3167,7 @@ var InvitationsServiceImpl = class {
3117
3167
  });
3118
3168
  }
3119
3169
  };
3120
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3170
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3121
3171
  var SpaceInvitationProtocol = class {
3122
3172
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
3123
3173
  this._spaceManager = _spaceManager;
@@ -3151,79 +3201,43 @@ var SpaceInvitationProtocol = class {
3151
3201
  };
3152
3202
  }
3153
3203
  async admit(invitation, request, guestProfile) {
3154
- (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3155
- F: __dxlog_file12,
3156
- L: 76,
3157
- S: this,
3158
- A: [
3159
- "this._spaceKey",
3160
- ""
3161
- ]
3162
- });
3163
- const space = this._spaceManager.spaces.get(this._spaceKey);
3164
- (0, import_invariant10.invariant)(space, void 0, {
3165
- F: __dxlog_file12,
3166
- L: 78,
3167
- S: this,
3168
- A: [
3169
- "space",
3170
- ""
3171
- ]
3172
- });
3173
- (0, import_invariant10.invariant)(request.space, void 0, {
3174
- F: __dxlog_file12,
3175
- L: 80,
3204
+ (0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
3205
+ F: __dxlog_file13,
3206
+ L: 74,
3176
3207
  S: this,
3177
3208
  A: [
3178
- "request.space",
3209
+ "this._spaceKey && request.space",
3179
3210
  ""
3180
3211
  ]
3181
3212
  });
3182
- const { identityKey, deviceKey } = request.space;
3183
- if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
3184
- throw new import_protocols8.AlreadyJoinedError();
3185
- }
3186
3213
  (0, import_log10.log)("writing guest credentials", {
3187
3214
  host: this._signingContext.deviceKey,
3188
- guest: deviceKey
3215
+ guest: request.space.deviceKey
3189
3216
  }, {
3190
- F: __dxlog_file12,
3191
- L: 87,
3217
+ F: __dxlog_file13,
3218
+ L: 75,
3192
3219
  S: this,
3193
3220
  C: (f, a) => f(...a)
3194
3221
  });
3195
- const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
3196
- (0, import_invariant10.invariant)(credentials[0].credential, void 0, {
3197
- F: __dxlog_file12,
3198
- L: 101,
3199
- S: this,
3200
- A: [
3201
- "credentials[0].credential",
3202
- ""
3203
- ]
3204
- });
3205
- const spaceMemberCredential = credentials[0].credential.credential;
3206
- (0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3207
- F: __dxlog_file12,
3208
- L: 103,
3209
- S: this,
3210
- A: [
3211
- "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
3212
- ""
3213
- ]
3222
+ const spaceMemberCredential = await this._spaceManager.admitMember({
3223
+ spaceKey: this._spaceKey,
3224
+ identityKey: request.space.identityKey,
3225
+ role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
3226
+ profile: guestProfile,
3227
+ delegationCredentialId: invitation.delegationCredentialId
3214
3228
  });
3215
- await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
3229
+ const space = this._spaceManager.spaces.get(this._spaceKey);
3216
3230
  return {
3217
3231
  space: {
3218
3232
  credential: spaceMemberCredential,
3219
- controlTimeframe: space.inner.controlPipeline.state.timeframe
3233
+ controlTimeframe: space?.inner.controlPipeline.state.timeframe
3220
3234
  }
3221
3235
  };
3222
3236
  }
3223
3237
  async delegate(invitation) {
3224
3238
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3225
- F: __dxlog_file12,
3226
- L: 116,
3239
+ F: __dxlog_file13,
3240
+ L: 95,
3227
3241
  S: this,
3228
3242
  A: [
3229
3243
  "this._spaceKey",
@@ -3232,8 +3246,8 @@ var SpaceInvitationProtocol = class {
3232
3246
  });
3233
3247
  const space = this._spaceManager.spaces.get(this._spaceKey);
3234
3248
  (0, import_invariant10.invariant)(space, void 0, {
3235
- F: __dxlog_file12,
3236
- L: 118,
3249
+ F: __dxlog_file13,
3250
+ L: 97,
3237
3251
  S: this,
3238
3252
  A: [
3239
3253
  "space",
@@ -3242,8 +3256,8 @@ var SpaceInvitationProtocol = class {
3242
3256
  });
3243
3257
  if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
3244
3258
  (0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
3245
- F: __dxlog_file12,
3246
- L: 120,
3259
+ F: __dxlog_file13,
3260
+ L: 99,
3247
3261
  S: this,
3248
3262
  A: [
3249
3263
  "invitation.guestKeypair?.publicKey",
@@ -3255,8 +3269,8 @@ var SpaceInvitationProtocol = class {
3255
3269
  host: this._signingContext.deviceKey,
3256
3270
  id: invitation.invitationId
3257
3271
  }, {
3258
- F: __dxlog_file12,
3259
- L: 123,
3272
+ F: __dxlog_file13,
3273
+ L: 102,
3260
3274
  S: this,
3261
3275
  C: (f, a) => f(...a)
3262
3276
  });
@@ -3270,8 +3284,8 @@ var SpaceInvitationProtocol = class {
3270
3284
  guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
3271
3285
  });
3272
3286
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3273
- F: __dxlog_file12,
3274
- L: 143,
3287
+ F: __dxlog_file13,
3288
+ L: 122,
3275
3289
  S: this,
3276
3290
  A: [
3277
3291
  "credential.credential",
@@ -3285,8 +3299,8 @@ var SpaceInvitationProtocol = class {
3285
3299
  }
3286
3300
  async cancelDelegation(invitation) {
3287
3301
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3288
- F: __dxlog_file12,
3289
- L: 149,
3302
+ F: __dxlog_file13,
3303
+ L: 128,
3290
3304
  S: this,
3291
3305
  A: [
3292
3306
  "this._spaceKey",
@@ -3294,8 +3308,8 @@ var SpaceInvitationProtocol = class {
3294
3308
  ]
3295
3309
  });
3296
3310
  (0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
3297
- F: __dxlog_file12,
3298
- L: 150,
3311
+ F: __dxlog_file13,
3312
+ L: 129,
3299
3313
  S: this,
3300
3314
  A: [
3301
3315
  "invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
@@ -3304,8 +3318,8 @@ var SpaceInvitationProtocol = class {
3304
3318
  });
3305
3319
  const space = this._spaceManager.spaces.get(this._spaceKey);
3306
3320
  (0, import_invariant10.invariant)(space, void 0, {
3307
- F: __dxlog_file12,
3308
- L: 152,
3321
+ F: __dxlog_file13,
3322
+ L: 131,
3309
3323
  S: this,
3310
3324
  A: [
3311
3325
  "space",
@@ -3316,15 +3330,15 @@ var SpaceInvitationProtocol = class {
3316
3330
  host: this._signingContext.deviceKey,
3317
3331
  id: invitation.invitationId
3318
3332
  }, {
3319
- F: __dxlog_file12,
3320
- L: 154,
3333
+ F: __dxlog_file13,
3334
+ L: 133,
3321
3335
  S: this,
3322
3336
  C: (f, a) => f(...a)
3323
3337
  });
3324
3338
  const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
3325
3339
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3326
- F: __dxlog_file12,
3327
- L: 161,
3340
+ F: __dxlog_file13,
3341
+ L: 140,
3328
3342
  S: this,
3329
3343
  A: [
3330
3344
  "credential.credential",
@@ -3362,8 +3376,8 @@ var SpaceInvitationProtocol = class {
3362
3376
  }
3363
3377
  async accept(response) {
3364
3378
  (0, import_invariant10.invariant)(response.space, void 0, {
3365
- F: __dxlog_file12,
3366
- L: 196,
3379
+ F: __dxlog_file13,
3380
+ L: 175,
3367
3381
  S: this,
3368
3382
  A: [
3369
3383
  "response.space",
@@ -3373,8 +3387,8 @@ var SpaceInvitationProtocol = class {
3373
3387
  const { credential, controlTimeframe, dataTimeframe } = response.space;
3374
3388
  const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
3375
3389
  (0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3376
- F: __dxlog_file12,
3377
- L: 199,
3390
+ F: __dxlog_file13,
3391
+ L: 178,
3378
3392
  S: this,
3379
3393
  A: [
3380
3394
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3382,8 +3396,8 @@ var SpaceInvitationProtocol = class {
3382
3396
  ]
3383
3397
  });
3384
3398
  (0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
3385
- F: __dxlog_file12,
3386
- L: 200,
3399
+ F: __dxlog_file13,
3400
+ L: 179,
3387
3401
  S: this,
3388
3402
  A: [
3389
3403
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -3405,7 +3419,7 @@ var SpaceInvitationProtocol = class {
3405
3419
  };
3406
3420
  }
3407
3421
  };
3408
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3422
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3409
3423
  var InvitationsManager = class {
3410
3424
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
3411
3425
  this._invitationsHandler = _invitationsHandler;
@@ -3448,7 +3462,7 @@ var InvitationsManager = class {
3448
3462
  await this._persistIfRequired(handler, stream, invitation);
3449
3463
  } catch (err) {
3450
3464
  import_log11.log.catch(err, void 0, {
3451
- F: __dxlog_file13,
3465
+ F: __dxlog_file14,
3452
3466
  L: 82,
3453
3467
  S: this,
3454
3468
  C: (f, a) => f(...a)
@@ -3471,7 +3485,7 @@ var InvitationsManager = class {
3471
3485
  const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
3472
3486
  const loadTasks = freshInvitations.map((persistentInvitation) => {
3473
3487
  (0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
3474
- F: __dxlog_file13,
3488
+ F: __dxlog_file14,
3475
3489
  L: 103,
3476
3490
  S: this,
3477
3491
  A: [
@@ -3490,7 +3504,7 @@ var InvitationsManager = class {
3490
3504
  };
3491
3505
  } catch (err) {
3492
3506
  import_log11.log.catch(err, void 0, {
3493
- F: __dxlog_file13,
3507
+ F: __dxlog_file14,
3494
3508
  L: 110,
3495
3509
  S: this,
3496
3510
  C: (f, a) => f(...a)
@@ -3522,13 +3536,13 @@ var InvitationsManager = class {
3522
3536
  }
3523
3537
  async authenticate({ invitationId, authCode }) {
3524
3538
  (0, import_log11.log)("authenticating...", void 0, {
3525
- F: __dxlog_file13,
3539
+ F: __dxlog_file14,
3526
3540
  L: 140,
3527
3541
  S: this,
3528
3542
  C: (f, a) => f(...a)
3529
3543
  });
3530
3544
  (0, import_invariant11.invariant)(invitationId, void 0, {
3531
- F: __dxlog_file13,
3545
+ F: __dxlog_file14,
3532
3546
  L: 141,
3533
3547
  S: this,
3534
3548
  A: [
@@ -3541,7 +3555,7 @@ var InvitationsManager = class {
3541
3555
  import_log11.log.warn("invalid invitation", {
3542
3556
  invitationId
3543
3557
  }, {
3544
- F: __dxlog_file13,
3558
+ F: __dxlog_file14,
3545
3559
  L: 144,
3546
3560
  S: this,
3547
3561
  C: (f, a) => f(...a)
@@ -3554,13 +3568,13 @@ var InvitationsManager = class {
3554
3568
  (0, import_log11.log)("cancelInvitation...", {
3555
3569
  invitationId
3556
3570
  }, {
3557
- F: __dxlog_file13,
3571
+ F: __dxlog_file14,
3558
3572
  L: 151,
3559
3573
  S: this,
3560
3574
  C: (f, a) => f(...a)
3561
3575
  });
3562
3576
  (0, import_invariant11.invariant)(invitationId, void 0, {
3563
- F: __dxlog_file13,
3577
+ F: __dxlog_file14,
3564
3578
  L: 152,
3565
3579
  S: this,
3566
3580
  A: [
@@ -3634,12 +3648,15 @@ var InvitationsManager = class {
3634
3648
  stream.error(err);
3635
3649
  void ctx.dispose();
3636
3650
  }
3651
+ }, {
3652
+ F: __dxlog_file14,
3653
+ L: 234
3637
3654
  });
3638
3655
  ctx.onDispose(() => {
3639
3656
  (0, import_log11.log)("complete", {
3640
3657
  ...handler.toJSON()
3641
3658
  }, {
3642
- F: __dxlog_file13,
3659
+ F: __dxlog_file14,
3643
3660
  L: 241,
3644
3661
  S: this,
3645
3662
  C: (f, a) => f(...a)
@@ -3672,7 +3689,7 @@ var InvitationsManager = class {
3672
3689
  (0, import_log11.log)("timeout", {
3673
3690
  ...handler.toJSON()
3674
3691
  }, {
3675
- F: __dxlog_file13,
3692
+ F: __dxlog_file14,
3676
3693
  L: 261,
3677
3694
  S: this,
3678
3695
  C: (f, a) => f(...a)
@@ -3683,7 +3700,7 @@ var InvitationsManager = class {
3683
3700
  });
3684
3701
  } else {
3685
3702
  import_log11.log.warn("auth failed", err, {
3686
- F: __dxlog_file13,
3703
+ F: __dxlog_file14,
3687
3704
  L: 264,
3688
3705
  S: this,
3689
3706
  C: (f, a) => f(...a)
@@ -3695,12 +3712,15 @@ var InvitationsManager = class {
3695
3712
  }
3696
3713
  void ctx.dispose();
3697
3714
  }
3715
+ }, {
3716
+ F: __dxlog_file14,
3717
+ L: 258
3698
3718
  });
3699
3719
  ctx.onDispose(() => {
3700
3720
  (0, import_log11.log)("complete", {
3701
3721
  ...handler.toJSON()
3702
3722
  }, {
3703
- F: __dxlog_file13,
3723
+ F: __dxlog_file14,
3704
3724
  L: 271,
3705
3725
  S: this,
3706
3726
  C: (f, a) => f(...a)
@@ -3745,7 +3765,7 @@ var InvitationsManager = class {
3745
3765
  await this._metadataStore.removeInvitation(invitation.invitationId);
3746
3766
  } catch (err) {
3747
3767
  import_log11.log.catch(err, void 0, {
3748
- F: __dxlog_file13,
3768
+ F: __dxlog_file14,
3749
3769
  L: 307,
3750
3770
  S: this,
3751
3771
  C: (f, a) => f(...a)
@@ -3798,7 +3818,7 @@ var AutomergeSpaceState = class extends import_context11.Resource {
3798
3818
  await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
3799
3819
  }
3800
3820
  };
3801
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
3821
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
3802
3822
  var runEpochMigration = async (ctx, context) => {
3803
3823
  switch (context.migration) {
3804
3824
  case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
@@ -3822,7 +3842,7 @@ var runEpochMigration = async (ctx, context) => {
3822
3842
  }
3823
3843
  case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
3824
3844
  import_log13.log.info("Fragmenting", void 0, {
3825
- F: __dxlog_file14,
3845
+ F: __dxlog_file15,
3826
3846
  L: 63,
3827
3847
  S: void 0,
3828
3848
  C: (f, a) => f(...a)
@@ -3834,7 +3854,7 @@ var runEpochMigration = async (ctx, context) => {
3834
3854
  const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
3835
3855
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3836
3856
  (0, import_invariant13.invariant)(properties, "Properties not found", {
3837
- F: __dxlog_file14,
3857
+ F: __dxlog_file15,
3838
3858
  L: 73,
3839
3859
  S: void 0,
3840
3860
  A: [
@@ -3850,7 +3870,7 @@ var runEpochMigration = async (ctx, context) => {
3850
3870
  };
3851
3871
  const newRoot = context.repo.create(newSpaceDoc);
3852
3872
  (0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3853
- F: __dxlog_file14,
3873
+ F: __dxlog_file15,
3854
3874
  L: 78,
3855
3875
  S: void 0,
3856
3876
  A: [
@@ -3881,7 +3901,7 @@ var runEpochMigration = async (ctx, context) => {
3881
3901
  const rootHandle = context.repo.find(currentRootUrl);
3882
3902
  await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
3883
3903
  (0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
3884
- F: __dxlog_file14,
3904
+ F: __dxlog_file15,
3885
3905
  L: 100,
3886
3906
  S: void 0,
3887
3907
  A: [
@@ -3894,7 +3914,7 @@ var runEpochMigration = async (ctx, context) => {
3894
3914
  const handle = context.repo.find(url);
3895
3915
  await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
3896
3916
  (0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
3897
- F: __dxlog_file14,
3917
+ F: __dxlog_file15,
3898
3918
  L: 107,
3899
3919
  S: void 0,
3900
3920
  A: [
@@ -3916,7 +3936,7 @@ var runEpochMigration = async (ctx, context) => {
3916
3936
  }
3917
3937
  case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
3918
3938
  (0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
3919
- F: __dxlog_file14,
3939
+ F: __dxlog_file15,
3920
3940
  L: 124,
3921
3941
  S: void 0,
3922
3942
  A: [
@@ -3932,14 +3952,17 @@ var runEpochMigration = async (ctx, context) => {
3932
3952
  }
3933
3953
  return {};
3934
3954
  };
3935
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3955
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3936
3956
  var DEFAULT_RETRY_TIMEOUT = 1e3;
3937
3957
  var DEFAULT_SUCCESS_DELAY = 1e3;
3938
3958
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
3939
3959
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
3940
3960
  var NotarizationPlugin = class {
3941
3961
  constructor() {
3942
- this._ctx = new import_context13.Context();
3962
+ this._ctx = new import_context13.Context(void 0, {
3963
+ F: __dxlog_file16,
3964
+ L: 62
3965
+ });
3943
3966
  this._extensionOpened = new import_async16.Event();
3944
3967
  this._extensions = /* @__PURE__ */ new Set();
3945
3968
  this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
@@ -3960,13 +3983,13 @@ var NotarizationPlugin = class {
3960
3983
  (0, import_log14.log)("notarize", {
3961
3984
  credentials
3962
3985
  }, {
3963
- F: __dxlog_file15,
3986
+ F: __dxlog_file16,
3964
3987
  L: 90,
3965
3988
  S: this,
3966
3989
  C: (f, a) => f(...a)
3967
3990
  });
3968
3991
  (0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
3969
- F: __dxlog_file15,
3992
+ F: __dxlog_file16,
3970
3993
  L: 91,
3971
3994
  S: this,
3972
3995
  A: [
@@ -3980,7 +4003,7 @@ var NotarizationPlugin = class {
3980
4003
  import_log14.log.warn("Notarization error", {
3981
4004
  err
3982
4005
  }, {
3983
- F: __dxlog_file15,
4006
+ F: __dxlog_file16,
3984
4007
  L: 99,
3985
4008
  S: this,
3986
4009
  C: (f, a) => f(...a)
@@ -3996,7 +4019,7 @@ var NotarizationPlugin = class {
3996
4019
  timeout,
3997
4020
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3998
4021
  }, {
3999
- F: __dxlog_file15,
4022
+ F: __dxlog_file16,
4000
4023
  L: 111,
4001
4024
  S: this,
4002
4025
  C: (f, a) => f(...a)
@@ -4019,7 +4042,7 @@ var NotarizationPlugin = class {
4019
4042
  import_log14.log.info("Exhausted all peers to notarize with", {
4020
4043
  retryIn: retryTimeout
4021
4044
  }, {
4022
- F: __dxlog_file15,
4045
+ F: __dxlog_file16,
4023
4046
  L: 136,
4024
4047
  S: this,
4025
4048
  C: (f, a) => f(...a)
@@ -4033,7 +4056,7 @@ var NotarizationPlugin = class {
4033
4056
  peer: peer.localPeerId,
4034
4057
  credentialId: credentials.map((credential) => credential.id)
4035
4058
  }, {
4036
- F: __dxlog_file15,
4059
+ F: __dxlog_file16,
4037
4060
  L: 143,
4038
4061
  S: this,
4039
4062
  C: (f, a) => f(...a)
@@ -4042,7 +4065,7 @@ var NotarizationPlugin = class {
4042
4065
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
4043
4066
  });
4044
4067
  (0, import_log14.log)("success", void 0, {
4045
- F: __dxlog_file15,
4068
+ F: __dxlog_file16,
4046
4069
  L: 147,
4047
4070
  S: this,
4048
4071
  C: (f, a) => f(...a)
@@ -4051,7 +4074,7 @@ var NotarizationPlugin = class {
4051
4074
  } catch (err) {
4052
4075
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
4053
4076
  import_log14.log.info("error notarizing (recoverable)", err, {
4054
- F: __dxlog_file15,
4077
+ F: __dxlog_file16,
4055
4078
  L: 151,
4056
4079
  S: this,
4057
4080
  C: (f, a) => f(...a)
@@ -4069,7 +4092,7 @@ var NotarizationPlugin = class {
4069
4092
  errors.wait()
4070
4093
  ]);
4071
4094
  (0, import_log14.log)("done", void 0, {
4072
- F: __dxlog_file15,
4095
+ F: __dxlog_file16,
4073
4096
  L: 162,
4074
4097
  S: this,
4075
4098
  C: (f, a) => f(...a)
@@ -4091,7 +4114,7 @@ var NotarizationPlugin = class {
4091
4114
  }
4092
4115
  setWriter(writer) {
4093
4116
  (0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
4094
- F: __dxlog_file15,
4117
+ F: __dxlog_file16,
4095
4118
  L: 181,
4096
4119
  S: this,
4097
4120
  A: [
@@ -4116,7 +4139,7 @@ var NotarizationPlugin = class {
4116
4139
  }
4117
4140
  for (const credential of request.credentials ?? []) {
4118
4141
  (0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
4119
- F: __dxlog_file15,
4142
+ F: __dxlog_file16,
4120
4143
  L: 200,
4121
4144
  S: this,
4122
4145
  A: [
@@ -4136,7 +4159,7 @@ var NotarizationPlugin = class {
4136
4159
  (0, import_log14.log)("extension opened", {
4137
4160
  peer: extension.localPeerId
4138
4161
  }, {
4139
- F: __dxlog_file15,
4162
+ F: __dxlog_file16,
4140
4163
  L: 211,
4141
4164
  S: this,
4142
4165
  C: (f, a) => f(...a)
@@ -4148,7 +4171,7 @@ var NotarizationPlugin = class {
4148
4171
  (0, import_log14.log)("extension closed", {
4149
4172
  peer: extension.localPeerId
4150
4173
  }, {
4151
- F: __dxlog_file15,
4174
+ F: __dxlog_file16,
4152
4175
  L: 216,
4153
4176
  S: this,
4154
4177
  C: (f, a) => f(...a)
@@ -4263,10 +4286,13 @@ function _using_ctx() {
4263
4286
  }
4264
4287
  };
4265
4288
  }
4266
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4289
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4267
4290
  var DataSpace = class {
4268
4291
  constructor(params) {
4269
- this._ctx = new import_context10.Context();
4292
+ this._ctx = new import_context10.Context(void 0, {
4293
+ F: __dxlog_file17,
4294
+ L: 84
4295
+ });
4270
4296
  this._notarizationPlugin = new NotarizationPlugin();
4271
4297
  this._cache = void 0;
4272
4298
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
@@ -4296,7 +4322,7 @@ var DataSpace = class {
4296
4322
  (0, import_log12.log)("new state", {
4297
4323
  state: import_services12.SpaceState[this._state]
4298
4324
  }, {
4299
- F: __dxlog_file16,
4325
+ F: __dxlog_file17,
4300
4326
  L: 146,
4301
4327
  S: this,
4302
4328
  C: (f, a) => f(...a)
@@ -4351,12 +4377,15 @@ var DataSpace = class {
4351
4377
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
4352
4378
  await this._automergeSpaceState.open();
4353
4379
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
4354
- await this._inner.open(new import_context10.Context());
4380
+ await this._inner.open(new import_context10.Context(void 0, {
4381
+ F: __dxlog_file17,
4382
+ L: 215
4383
+ }));
4355
4384
  this._state = import_services12.SpaceState.CONTROL_ONLY;
4356
4385
  (0, import_log12.log)("new state", {
4357
4386
  state: import_services12.SpaceState[this._state]
4358
4387
  }, {
4359
- F: __dxlog_file16,
4388
+ F: __dxlog_file17,
4360
4389
  L: 217,
4361
4390
  S: this,
4362
4391
  C: (f, a) => f(...a)
@@ -4374,13 +4403,16 @@ var DataSpace = class {
4374
4403
  (0, import_log12.log)("new state", {
4375
4404
  state: import_services12.SpaceState[this._state]
4376
4405
  }, {
4377
- F: __dxlog_file16,
4406
+ F: __dxlog_file17,
4378
4407
  L: 231,
4379
4408
  S: this,
4380
4409
  C: (f, a) => f(...a)
4381
4410
  });
4382
4411
  await this._ctx.dispose();
4383
- this._ctx = new import_context10.Context();
4412
+ this._ctx = new import_context10.Context(void 0, {
4413
+ F: __dxlog_file17,
4414
+ L: 233
4415
+ });
4384
4416
  await this.authVerifier.close();
4385
4417
  await this._inner.close();
4386
4418
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
@@ -4407,7 +4439,7 @@ var DataSpace = class {
4407
4439
  } catch (err) {
4408
4440
  if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
4409
4441
  (0, import_log12.log)("data pipeline initialization cancelled", err, {
4410
- F: __dxlog_file16,
4442
+ F: __dxlog_file17,
4411
4443
  L: 265,
4412
4444
  S: this,
4413
4445
  C: (f, a) => f(...a)
@@ -4415,7 +4447,7 @@ var DataSpace = class {
4415
4447
  return;
4416
4448
  }
4417
4449
  import_log12.log.error("Error initializing data pipeline", err, {
4418
- F: __dxlog_file16,
4450
+ F: __dxlog_file17,
4419
4451
  L: 269,
4420
4452
  S: this,
4421
4453
  C: (f, a) => f(...a)
@@ -4424,7 +4456,7 @@ var DataSpace = class {
4424
4456
  (0, import_log12.log)("new state", {
4425
4457
  state: import_services12.SpaceState[this._state]
4426
4458
  }, {
4427
- F: __dxlog_file16,
4459
+ F: __dxlog_file17,
4428
4460
  L: 271,
4429
4461
  S: this,
4430
4462
  C: (f, a) => f(...a)
@@ -4444,7 +4476,7 @@ var DataSpace = class {
4444
4476
  (0, import_log12.log)("new state", {
4445
4477
  state: import_services12.SpaceState[this._state]
4446
4478
  }, {
4447
- F: __dxlog_file16,
4479
+ F: __dxlog_file17,
4448
4480
  L: 287,
4449
4481
  S: this,
4450
4482
  C: (f, a) => f(...a)
@@ -4461,7 +4493,7 @@ var DataSpace = class {
4461
4493
  (0, import_log12.log)("new state", {
4462
4494
  state: import_services12.SpaceState[this._state]
4463
4495
  }, {
4464
- F: __dxlog_file16,
4496
+ F: __dxlog_file17,
4465
4497
  L: 306,
4466
4498
  S: this,
4467
4499
  C: (f, a) => f(...a)
@@ -4477,7 +4509,7 @@ var DataSpace = class {
4477
4509
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4478
4510
  await this._createWritableFeeds();
4479
4511
  (0, import_log12.log)("writable feeds created", void 0, {
4480
- F: __dxlog_file16,
4512
+ F: __dxlog_file17,
4481
4513
  L: 322,
4482
4514
  S: this,
4483
4515
  C: (f, a) => f(...a)
@@ -4540,7 +4572,7 @@ var DataSpace = class {
4540
4572
  space: this.key,
4541
4573
  rootUrl
4542
4574
  }, {
4543
- F: __dxlog_file16,
4575
+ F: __dxlog_file17,
4544
4576
  L: 388,
4545
4577
  S: this,
4546
4578
  C: (f, a) => f(...a)
@@ -4594,7 +4626,7 @@ var DataSpace = class {
4594
4626
  rootUrl,
4595
4627
  err
4596
4628
  }, {
4597
- F: __dxlog_file16,
4629
+ F: __dxlog_file17,
4598
4630
  L: 431,
4599
4631
  S: this,
4600
4632
  C: (f, a) => f(...a)
@@ -4680,7 +4712,7 @@ var DataSpace = class {
4680
4712
  (0, import_log12.log)("new state", {
4681
4713
  state: import_services12.SpaceState[this._state]
4682
4714
  }, {
4683
- F: __dxlog_file16,
4715
+ F: __dxlog_file17,
4684
4716
  L: 512,
4685
4717
  S: this,
4686
4718
  C: (f, a) => f(...a)
@@ -4810,7 +4842,7 @@ function _ts_decorate5(decorators, target, key, desc) {
4810
4842
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4811
4843
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4812
4844
  }
4813
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4845
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4814
4846
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4815
4847
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
4816
4848
  var DEFAULT_SPACE_KEY = "__DEFAULT__";
@@ -4824,7 +4856,10 @@ var DataSpaceManager = class {
4824
4856
  this._echoHost = _echoHost;
4825
4857
  this._invitationsManager = _invitationsManager;
4826
4858
  this._params = _params;
4827
- this._ctx = new import_context14.Context();
4859
+ this._ctx = new import_context14.Context(void 0, {
4860
+ F: __dxlog_file18,
4861
+ L: 104
4862
+ });
4828
4863
  this.updated = new import_async17.Event();
4829
4864
  this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
4830
4865
  this._isOpen = false;
@@ -4858,24 +4893,24 @@ var DataSpaceManager = class {
4858
4893
  }
4859
4894
  async open() {
4860
4895
  (0, import_log15.log)("open", void 0, {
4861
- F: __dxlog_file17,
4862
- L: 146,
4896
+ F: __dxlog_file18,
4897
+ L: 156,
4863
4898
  S: this,
4864
4899
  C: (f, a) => f(...a)
4865
4900
  });
4866
4901
  import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
4867
4902
  id: this._instanceId
4868
4903
  }), {
4869
- F: __dxlog_file17,
4870
- L: 147,
4904
+ F: __dxlog_file18,
4905
+ L: 157,
4871
4906
  S: this,
4872
4907
  C: (f, a) => f(...a)
4873
4908
  });
4874
4909
  (0, import_log15.log)("metadata loaded", {
4875
4910
  spaces: this._metadataStore.spaces.length
4876
4911
  }, {
4877
- F: __dxlog_file17,
4878
- L: 148,
4912
+ F: __dxlog_file18,
4913
+ L: 158,
4879
4914
  S: this,
4880
4915
  C: (f, a) => f(...a)
4881
4916
  });
@@ -4884,8 +4919,8 @@ var DataSpaceManager = class {
4884
4919
  (0, import_log15.log)("load space", {
4885
4920
  spaceMetadata
4886
4921
  }, {
4887
- F: __dxlog_file17,
4888
- L: 152,
4922
+ F: __dxlog_file18,
4923
+ L: 162,
4889
4924
  S: this,
4890
4925
  C: (f, a) => f(...a)
4891
4926
  });
@@ -4895,8 +4930,8 @@ var DataSpaceManager = class {
4895
4930
  spaceMetadata,
4896
4931
  err
4897
4932
  }, {
4898
- F: __dxlog_file17,
4899
- L: 155,
4933
+ F: __dxlog_file18,
4934
+ L: 165,
4900
4935
  S: this,
4901
4936
  C: (f, a) => f(...a)
4902
4937
  });
@@ -4907,16 +4942,16 @@ var DataSpaceManager = class {
4907
4942
  import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
4908
4943
  id: this._instanceId
4909
4944
  }), {
4910
- F: __dxlog_file17,
4911
- L: 162,
4945
+ F: __dxlog_file18,
4946
+ L: 172,
4912
4947
  S: this,
4913
4948
  C: (f, a) => f(...a)
4914
4949
  });
4915
4950
  }
4916
4951
  async close() {
4917
4952
  (0, import_log15.log)("close", void 0, {
4918
- F: __dxlog_file17,
4919
- L: 167,
4953
+ F: __dxlog_file18,
4954
+ L: 177,
4920
4955
  S: this,
4921
4956
  C: (f, a) => f(...a)
4922
4957
  });
@@ -4932,8 +4967,8 @@ var DataSpaceManager = class {
4932
4967
  */
4933
4968
  async createSpace() {
4934
4969
  (0, import_invariant15.invariant)(this._isOpen, "Not open.", {
4935
- F: __dxlog_file17,
4936
- L: 181,
4970
+ F: __dxlog_file18,
4971
+ L: 191,
4937
4972
  S: this,
4938
4973
  A: [
4939
4974
  "this._isOpen",
@@ -4953,8 +4988,8 @@ var DataSpaceManager = class {
4953
4988
  (0, import_log15.log)("creating space...", {
4954
4989
  spaceKey
4955
4990
  }, {
4956
- F: __dxlog_file17,
4957
- L: 193,
4991
+ F: __dxlog_file18,
4992
+ L: 203,
4958
4993
  S: this,
4959
4994
  C: (f, a) => f(...a)
4960
4995
  });
@@ -4965,8 +5000,8 @@ var DataSpaceManager = class {
4965
5000
  await this._metadataStore.addSpace(metadata);
4966
5001
  const memberCredential = credentials[1];
4967
5002
  (0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4968
- F: __dxlog_file17,
4969
- L: 203,
5003
+ F: __dxlog_file18,
5004
+ L: 213,
4970
5005
  S: this,
4971
5006
  A: [
4972
5007
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4997,8 +5032,8 @@ var DataSpaceManager = class {
4997
5032
  version: space.databaseRoot.getVersion(),
4998
5033
  spaceId: space.id
4999
5034
  }, {
5000
- F: __dxlog_file17,
5001
- L: 228,
5035
+ F: __dxlog_file18,
5036
+ L: 238,
5002
5037
  S: this,
5003
5038
  C: (f, a) => f(...a)
5004
5039
  });
@@ -5032,8 +5067,8 @@ var DataSpaceManager = class {
5032
5067
  async _getSpaceRootDocument(space) {
5033
5068
  const automergeIndex = space.automergeSpaceState.rootUrl;
5034
5069
  (0, import_invariant15.invariant)(automergeIndex, void 0, {
5035
- F: __dxlog_file17,
5036
- L: 261,
5070
+ F: __dxlog_file18,
5071
+ L: 271,
5037
5072
  S: this,
5038
5073
  A: [
5039
5074
  "automergeIndex",
@@ -5049,14 +5084,14 @@ var DataSpaceManager = class {
5049
5084
  (0, import_log15.log)("accept space", {
5050
5085
  opts
5051
5086
  }, {
5052
- F: __dxlog_file17,
5053
- L: 270,
5087
+ F: __dxlog_file18,
5088
+ L: 280,
5054
5089
  S: this,
5055
5090
  C: (f, a) => f(...a)
5056
5091
  });
5057
5092
  (0, import_invariant15.invariant)(this._isOpen, "Not open.", {
5058
- F: __dxlog_file17,
5059
- L: 271,
5093
+ F: __dxlog_file18,
5094
+ L: 281,
5060
5095
  S: this,
5061
5096
  A: [
5062
5097
  "this._isOpen",
@@ -5064,8 +5099,8 @@ var DataSpaceManager = class {
5064
5099
  ]
5065
5100
  });
5066
5101
  (0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
5067
- F: __dxlog_file17,
5068
- L: 272,
5102
+ F: __dxlog_file18,
5103
+ L: 282,
5069
5104
  S: this,
5070
5105
  A: [
5071
5106
  "!this._spaces.has(opts.spaceKey)",
@@ -5085,6 +5120,43 @@ var DataSpaceManager = class {
5085
5120
  this.updated.emit();
5086
5121
  return space;
5087
5122
  }
5123
+ async admitMember(options) {
5124
+ const space = this._spaceManager.spaces.get(options.spaceKey);
5125
+ (0, import_invariant15.invariant)(space, void 0, {
5126
+ F: __dxlog_file18,
5127
+ L: 302,
5128
+ S: this,
5129
+ A: [
5130
+ "space",
5131
+ ""
5132
+ ]
5133
+ });
5134
+ if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
5135
+ throw new import_protocols11.AlreadyJoinedError();
5136
+ }
5137
+ const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
5138
+ (0, import_invariant15.invariant)(credentials[0].credential, void 0, {
5139
+ F: __dxlog_file18,
5140
+ L: 321,
5141
+ S: this,
5142
+ A: [
5143
+ "credentials[0].credential",
5144
+ ""
5145
+ ]
5146
+ });
5147
+ const spaceMemberCredential = credentials[0].credential.credential;
5148
+ (0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5149
+ F: __dxlog_file18,
5150
+ L: 323,
5151
+ S: this,
5152
+ A: [
5153
+ "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
5154
+ ""
5155
+ ]
5156
+ });
5157
+ await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
5158
+ return spaceMemberCredential;
5159
+ }
5088
5160
  /**
5089
5161
  * Wait until the space data pipeline is fully initialized.
5090
5162
  * Used by invitation handler.
@@ -5096,12 +5168,24 @@ var DataSpaceManager = class {
5096
5168
  return !!space && space.state === import_services14.SpaceState.READY;
5097
5169
  }));
5098
5170
  }
5171
+ async requestSpaceAdmissionCredential(spaceKey) {
5172
+ return this._spaceManager.requestSpaceAdmissionCredential({
5173
+ spaceKey,
5174
+ identityKey: this._signingContext.identityKey,
5175
+ timeout: 15e3,
5176
+ swarmIdentity: {
5177
+ peerKey: this._signingContext.deviceKey,
5178
+ credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
5179
+ credentialAuthenticator: async () => true
5180
+ }
5181
+ });
5182
+ }
5099
5183
  async _constructSpace(metadata) {
5100
5184
  (0, import_log15.log)("construct space", {
5101
5185
  metadata
5102
5186
  }, {
5103
- F: __dxlog_file17,
5104
- L: 306,
5187
+ F: __dxlog_file18,
5188
+ L: 358,
5105
5189
  S: this,
5106
5190
  C: (f, a) => f(...a)
5107
5191
  });
@@ -5129,6 +5213,7 @@ var DataSpaceManager = class {
5129
5213
  credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
5130
5214
  },
5131
5215
  onAuthorizedConnection: (session) => {
5216
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
5132
5217
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5133
5218
  remotePeerId: session.remotePeerId
5134
5219
  }));
@@ -5138,8 +5223,8 @@ var DataSpaceManager = class {
5138
5223
  },
5139
5224
  onAuthFailure: () => {
5140
5225
  import_log15.log.warn("auth failure", void 0, {
5141
- F: __dxlog_file17,
5142
- L: 343,
5226
+ F: __dxlog_file18,
5227
+ L: 396,
5143
5228
  S: this,
5144
5229
  C: (f, a) => f(...a)
5145
5230
  });
@@ -5171,8 +5256,8 @@ var DataSpaceManager = class {
5171
5256
  (0, import_log15.log)("before space ready", {
5172
5257
  space: space.key
5173
5258
  }, {
5174
- F: __dxlog_file17,
5175
- L: 370,
5259
+ F: __dxlog_file18,
5260
+ L: 423,
5176
5261
  S: this,
5177
5262
  C: (f, a) => f(...a)
5178
5263
  });
@@ -5182,8 +5267,8 @@ var DataSpaceManager = class {
5182
5267
  space: space.key,
5183
5268
  open: this._isOpen
5184
5269
  }, {
5185
- F: __dxlog_file17,
5186
- L: 373,
5270
+ F: __dxlog_file18,
5271
+ L: 426,
5187
5272
  S: this,
5188
5273
  C: (f, a) => f(...a)
5189
5274
  });
@@ -5201,8 +5286,8 @@ var DataSpaceManager = class {
5201
5286
  (0, import_log15.log)("before space close", {
5202
5287
  space: space.key
5203
5288
  }, {
5204
- F: __dxlog_file17,
5205
- L: 381,
5289
+ F: __dxlog_file18,
5290
+ L: 434,
5206
5291
  S: this,
5207
5292
  C: (f, a) => f(...a)
5208
5293
  });
@@ -5242,8 +5327,8 @@ var DataSpaceManager = class {
5242
5327
  peersOnline: presence.getPeersOnline().length,
5243
5328
  closedSessions
5244
5329
  }, {
5245
- F: __dxlog_file17,
5246
- L: 417,
5330
+ F: __dxlog_file18,
5331
+ L: 470,
5247
5332
  S: this,
5248
5333
  C: (f, a) => f(...a)
5249
5334
  });
@@ -5257,8 +5342,8 @@ var DataSpaceManager = class {
5257
5342
  (0, import_log15.log)("closing a session with a removed peer", {
5258
5343
  peerId: peerState.peerId
5259
5344
  }, {
5260
- F: __dxlog_file17,
5261
- L: 431,
5345
+ F: __dxlog_file18,
5346
+ L: 484,
5262
5347
  S: this,
5263
5348
  C: (f, a) => f(...a)
5264
5349
  });
@@ -5317,7 +5402,7 @@ _ts_decorate5([
5317
5402
  DataSpaceManager = _ts_decorate5([
5318
5403
  (0, import_async17.trackLeaks)("open", "close")
5319
5404
  ], DataSpaceManager);
5320
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5405
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5321
5406
  var SpacesServiceImpl = class {
5322
5407
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
5323
5408
  this._identityManager = _identityManager;
@@ -5361,8 +5446,8 @@ var SpacesServiceImpl = class {
5361
5446
  }
5362
5447
  const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5363
5448
  (0, import_invariant16.invariant)(credentials[0].credential, void 0, {
5364
- F: __dxlog_file18,
5365
- L: 98,
5449
+ F: __dxlog_file19,
5450
+ L: 102,
5366
5451
  S: this,
5367
5452
  A: [
5368
5453
  "credentials[0].credential",
@@ -5371,15 +5456,15 @@ var SpacesServiceImpl = class {
5371
5456
  });
5372
5457
  const spaceMemberCredential = credentials[0].credential.credential;
5373
5458
  (0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5374
- F: __dxlog_file18,
5375
- L: 100,
5459
+ F: __dxlog_file19,
5460
+ L: 104,
5376
5461
  S: this,
5377
5462
  A: [
5378
5463
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
5379
5464
  ""
5380
5465
  ]
5381
5466
  });
5382
- await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
5467
+ await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
5383
5468
  }
5384
5469
  querySpaces() {
5385
5470
  return new import_codec_protobuf11.Stream(({ next, ctx }) => {
@@ -5389,8 +5474,8 @@ var SpacesServiceImpl = class {
5389
5474
  (0, import_log16.log)("update", {
5390
5475
  spaces
5391
5476
  }, {
5392
- F: __dxlog_file18,
5393
- L: 111,
5477
+ F: __dxlog_file19,
5478
+ L: 115,
5394
5479
  S: this,
5395
5480
  C: (f, a) => f(...a)
5396
5481
  });
@@ -5481,8 +5566,8 @@ var SpacesServiceImpl = class {
5481
5566
  });
5482
5567
  } else {
5483
5568
  (0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
5484
- F: __dxlog_file18,
5485
- L: 209,
5569
+ F: __dxlog_file19,
5570
+ L: 213,
5486
5571
  S: this,
5487
5572
  A: [
5488
5573
  "!credential.id",
@@ -5490,8 +5575,8 @@ var SpacesServiceImpl = class {
5490
5575
  ]
5491
5576
  });
5492
5577
  (0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
5493
- F: __dxlog_file18,
5494
- L: 210,
5578
+ F: __dxlog_file19,
5579
+ L: 214,
5495
5580
  S: this,
5496
5581
  A: [
5497
5582
  "this._identityManager.identity",
@@ -5500,8 +5585,8 @@ var SpacesServiceImpl = class {
5500
5585
  });
5501
5586
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5502
5587
  (0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
5503
- F: __dxlog_file18,
5504
- L: 212,
5588
+ F: __dxlog_file19,
5589
+ L: 216,
5505
5590
  S: this,
5506
5591
  A: [
5507
5592
  "credential.issuer.equals(signer.getIssuer())",
@@ -5531,6 +5616,59 @@ var SpacesServiceImpl = class {
5531
5616
  epochCredential: credential ?? void 0
5532
5617
  };
5533
5618
  }
5619
+ async admitContact(request) {
5620
+ const dataSpaceManager = await this._getDataSpaceManager();
5621
+ await dataSpaceManager.admitMember({
5622
+ spaceKey: request.spaceKey,
5623
+ identityKey: request.contact.identityKey,
5624
+ role: request.role
5625
+ });
5626
+ }
5627
+ async joinBySpaceKey({ spaceKey }) {
5628
+ const dataSpaceManager = await this._getDataSpaceManager();
5629
+ const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
5630
+ return this._joinByAdmission({
5631
+ credential
5632
+ });
5633
+ }
5634
+ async _joinByAdmission({ credential }) {
5635
+ const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
5636
+ (0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
5637
+ F: __dxlog_file19,
5638
+ L: 250,
5639
+ S: this,
5640
+ A: [
5641
+ "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
5642
+ "'Invalid credential'"
5643
+ ]
5644
+ });
5645
+ const myIdentity = this._identityManager.identity;
5646
+ (0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
5647
+ F: __dxlog_file19,
5648
+ L: 252,
5649
+ S: this,
5650
+ A: [
5651
+ "myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
5652
+ ""
5653
+ ]
5654
+ });
5655
+ const dataSpaceManager = await this._getDataSpaceManager();
5656
+ let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
5657
+ if (!dataSpace) {
5658
+ dataSpace = await dataSpaceManager.acceptSpace({
5659
+ spaceKey: assertion.spaceKey,
5660
+ genesisFeedKey: assertion.genesisFeedKey
5661
+ });
5662
+ await myIdentity.controlPipeline.writer.write({
5663
+ credential: {
5664
+ credential
5665
+ }
5666
+ });
5667
+ }
5668
+ return {
5669
+ space: this._serializeSpace(dataSpace)
5670
+ };
5671
+ }
5534
5672
  _serializeSpace(space) {
5535
5673
  return {
5536
5674
  id: space.id,
@@ -5600,7 +5738,7 @@ function _ts_decorate6(decorators, target, key, desc) {
5600
5738
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5601
5739
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5602
5740
  }
5603
- var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5741
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5604
5742
  var ServiceContext = class extends import_context15.Resource {
5605
5743
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5606
5744
  super();
@@ -5612,21 +5750,21 @@ var ServiceContext = class extends import_context15.Resource {
5612
5750
  this.initialized = new import_async19.Trigger();
5613
5751
  this._handlerFactories = /* @__PURE__ */ new Map();
5614
5752
  this._instanceId = import_keys13.PublicKey.random().toHex();
5615
- this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
5616
- this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
5753
+ this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
5754
+ this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
5617
5755
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
5618
5756
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
5619
- this.feedStore = new import_feed_store5.FeedStore({
5620
- factory: new import_feed_store5.FeedFactory({
5757
+ this.feedStore = new import_feed_store6.FeedStore({
5758
+ factory: new import_feed_store6.FeedFactory({
5621
5759
  root: storage.createDirectory("feeds"),
5622
5760
  signer: this.keyring,
5623
5761
  hypercore: {
5624
- valueEncoding: import_echo_pipeline5.valueEncoding,
5762
+ valueEncoding: import_echo_pipeline6.valueEncoding,
5625
5763
  stats: true
5626
5764
  }
5627
5765
  })
5628
5766
  });
5629
- this.spaceManager = new import_echo_pipeline5.SpaceManager({
5767
+ this.spaceManager = new import_echo_pipeline6.SpaceManager({
5630
5768
  feedStore: this.feedStore,
5631
5769
  networkManager: this.networkManager,
5632
5770
  blobStore: this.blobStore,
@@ -5644,7 +5782,7 @@ var ServiceContext = class extends import_context15.Resource {
5644
5782
  async _open(ctx) {
5645
5783
  await this._checkStorageVersion();
5646
5784
  (0, import_log17.log)("opening...", void 0, {
5647
- F: __dxlog_file19,
5785
+ F: __dxlog_file20,
5648
5786
  L: 149,
5649
5787
  S: this,
5650
5788
  C: (f, a) => f(...a)
@@ -5652,7 +5790,7 @@ var ServiceContext = class extends import_context15.Resource {
5652
5790
  import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
5653
5791
  id: this._instanceId
5654
5792
  }), {
5655
- F: __dxlog_file19,
5793
+ F: __dxlog_file20,
5656
5794
  L: 150,
5657
5795
  S: this,
5658
5796
  C: (f, a) => f(...a)
@@ -5670,7 +5808,7 @@ var ServiceContext = class extends import_context15.Resource {
5670
5808
  (0, import_log17.log)("loaded persistent invitations", {
5671
5809
  count: loadedInvitations.invitations?.length
5672
5810
  }, {
5673
- F: __dxlog_file19,
5811
+ F: __dxlog_file20,
5674
5812
  L: 163,
5675
5813
  S: this,
5676
5814
  C: (f, a) => f(...a)
@@ -5678,13 +5816,13 @@ var ServiceContext = class extends import_context15.Resource {
5678
5816
  import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
5679
5817
  id: this._instanceId
5680
5818
  }), {
5681
- F: __dxlog_file19,
5819
+ F: __dxlog_file20,
5682
5820
  L: 165,
5683
5821
  S: this,
5684
5822
  C: (f, a) => f(...a)
5685
5823
  });
5686
5824
  (0, import_log17.log)("opened", void 0, {
5687
- F: __dxlog_file19,
5825
+ F: __dxlog_file20,
5688
5826
  L: 166,
5689
5827
  S: this,
5690
5828
  C: (f, a) => f(...a)
@@ -5692,7 +5830,7 @@ var ServiceContext = class extends import_context15.Resource {
5692
5830
  }
5693
5831
  async _close(ctx) {
5694
5832
  (0, import_log17.log)("closing...", void 0, {
5695
- F: __dxlog_file19,
5833
+ F: __dxlog_file20,
5696
5834
  L: 170,
5697
5835
  S: this,
5698
5836
  C: (f, a) => f(...a)
@@ -5709,7 +5847,7 @@ var ServiceContext = class extends import_context15.Resource {
5709
5847
  await this.networkManager.close();
5710
5848
  await this.signalManager.close();
5711
5849
  (0, import_log17.log)("closed", void 0, {
5712
- F: __dxlog_file19,
5850
+ F: __dxlog_file20,
5713
5851
  L: 182,
5714
5852
  S: this,
5715
5853
  C: (f, a) => f(...a)
@@ -5717,13 +5855,16 @@ var ServiceContext = class extends import_context15.Resource {
5717
5855
  }
5718
5856
  async createIdentity(params = {}) {
5719
5857
  const identity = await this.identityManager.createIdentity(params);
5720
- await this._initialize(new import_context15.Context());
5858
+ await this._initialize(new import_context15.Context(void 0, {
5859
+ F: __dxlog_file20,
5860
+ L: 187
5861
+ }));
5721
5862
  return identity;
5722
5863
  }
5723
5864
  getInvitationHandler(invitation) {
5724
5865
  const factory = this._handlerFactories.get(invitation.kind);
5725
5866
  (0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
5726
- F: __dxlog_file19,
5867
+ F: __dxlog_file20,
5727
5868
  L: 193,
5728
5869
  S: this,
5729
5870
  A: [
@@ -5743,7 +5884,10 @@ var ServiceContext = class extends import_context15.Resource {
5743
5884
  }
5744
5885
  async _acceptIdentity(params) {
5745
5886
  const identity = await this.identityManager.acceptIdentity(params);
5746
- await this._initialize(new import_context15.Context());
5887
+ await this._initialize(new import_context15.Context(void 0, {
5888
+ F: __dxlog_file20,
5889
+ L: 209
5890
+ }));
5747
5891
  return identity;
5748
5892
  }
5749
5893
  async _checkStorageVersion() {
@@ -5755,7 +5899,7 @@ var ServiceContext = class extends import_context15.Resource {
5755
5899
  // Called when identity is created.
5756
5900
  async _initialize(ctx) {
5757
5901
  (0, import_log17.log)("initializing spaces...", void 0, {
5758
- F: __dxlog_file19,
5902
+ F: __dxlog_file20,
5759
5903
  L: 224,
5760
5904
  S: this,
5761
5905
  C: (f, a) => f(...a)
@@ -5778,7 +5922,7 @@ var ServiceContext = class extends import_context15.Resource {
5778
5922
  await this.dataSpaceManager.open();
5779
5923
  this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
5780
5924
  (0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
5781
- F: __dxlog_file19,
5925
+ F: __dxlog_file20,
5782
5926
  L: 249,
5783
5927
  S: this,
5784
5928
  A: [
@@ -5802,7 +5946,7 @@ var ServiceContext = class extends import_context15.Resource {
5802
5946
  (0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
5803
5947
  details: assertion
5804
5948
  }, {
5805
- F: __dxlog_file19,
5949
+ F: __dxlog_file20,
5806
5950
  L: 265,
5807
5951
  S: this,
5808
5952
  C: (f, a) => f(...a)
@@ -5813,7 +5957,7 @@ var ServiceContext = class extends import_context15.Resource {
5813
5957
  (0, import_log17.log)("space already exists, ignoring space admission", {
5814
5958
  details: assertion
5815
5959
  }, {
5816
- F: __dxlog_file19,
5960
+ F: __dxlog_file20,
5817
5961
  L: 269,
5818
5962
  S: this,
5819
5963
  C: (f, a) => f(...a)
@@ -5824,7 +5968,7 @@ var ServiceContext = class extends import_context15.Resource {
5824
5968
  (0, import_log17.log)("accepting space recorded in halo", {
5825
5969
  details: assertion
5826
5970
  }, {
5827
- F: __dxlog_file19,
5971
+ F: __dxlog_file20,
5828
5972
  L: 274,
5829
5973
  S: this,
5830
5974
  C: (f, a) => f(...a)
@@ -5835,7 +5979,7 @@ var ServiceContext = class extends import_context15.Resource {
5835
5979
  });
5836
5980
  } catch (err) {
5837
5981
  import_log17.log.catch(err, void 0, {
5838
- F: __dxlog_file19,
5982
+ F: __dxlog_file20,
5839
5983
  L: 280,
5840
5984
  S: this,
5841
5985
  C: (f, a) => f(...a)
@@ -5888,7 +6032,7 @@ function _ts_decorate7(decorators, target, key, desc) {
5888
6032
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5889
6033
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5890
6034
  }
5891
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
6035
+ var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
5892
6036
  var Lock = class {
5893
6037
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
5894
6038
  this._lockPath = lockPath;
@@ -5900,7 +6044,7 @@ var Lock = class {
5900
6044
  }
5901
6045
  async acquire() {
5902
6046
  (0, import_log18.log)("acquiring lock...", void 0, {
5903
- F: __dxlog_file20,
6047
+ F: __dxlog_file21,
5904
6048
  L: 32,
5905
6049
  S: this,
5906
6050
  C: (f, a) => f(...a)
@@ -5908,7 +6052,7 @@ var Lock = class {
5908
6052
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
5909
6053
  await this._onAcquire?.();
5910
6054
  (0, import_log18.log)("acquired lock", void 0, {
5911
- F: __dxlog_file20,
6055
+ F: __dxlog_file21,
5912
6056
  L: 37,
5913
6057
  S: this,
5914
6058
  C: (f, a) => f(...a)
@@ -5917,7 +6061,7 @@ var Lock = class {
5917
6061
  async release() {
5918
6062
  await this._onRelease?.();
5919
6063
  (0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
5920
- F: __dxlog_file20,
6064
+ F: __dxlog_file21,
5921
6065
  L: 42,
5922
6066
  S: this,
5923
6067
  A: [
@@ -5989,7 +6133,138 @@ var createLevel = async (config) => {
5989
6133
  await level.open();
5990
6134
  return level;
5991
6135
  };
5992
- var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
6136
+ var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
6137
+ var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
6138
+ var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
6139
+ var exportProfileData = async ({ storage, level }) => {
6140
+ const archive = {
6141
+ storage: [],
6142
+ meta: {
6143
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
6144
+ }
6145
+ };
6146
+ {
6147
+ const directory = await storage.createDirectory();
6148
+ const files = await directory.list();
6149
+ import_log19.log.info("begin exporting files", {
6150
+ count: files.length
6151
+ }, {
6152
+ F: __dxlog_file22,
6153
+ L: 30,
6154
+ S: void 0,
6155
+ C: (f, a) => f(...a)
6156
+ });
6157
+ for (const filename of files) {
6158
+ const file = await directory.getOrCreateFile(filename);
6159
+ const { size } = await file.stat();
6160
+ const data = await file.read(0, size);
6161
+ archive.storage.push({
6162
+ type: import_protocols15.ProfileArchiveEntryType.FILE,
6163
+ key: filename,
6164
+ value: data
6165
+ });
6166
+ }
6167
+ import_log19.log.info("done exporting files", {
6168
+ count: files.length
6169
+ }, {
6170
+ F: __dxlog_file22,
6171
+ L: 41,
6172
+ S: void 0,
6173
+ C: (f, a) => f(...a)
6174
+ });
6175
+ }
6176
+ {
6177
+ import_log19.log.info("begin exporting kv pairs", void 0, {
6178
+ F: __dxlog_file22,
6179
+ L: 45,
6180
+ S: void 0,
6181
+ C: (f, a) => f(...a)
6182
+ });
6183
+ const iter = await level.iterator({
6184
+ keyEncoding: "binary",
6185
+ valueEncoding: "binary"
6186
+ });
6187
+ let count = 0;
6188
+ for await (const [key, value] of iter) {
6189
+ archive.storage.push({
6190
+ type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
6191
+ key,
6192
+ value
6193
+ });
6194
+ count++;
6195
+ }
6196
+ import_log19.log.info("done exporting kv pairs", {
6197
+ count
6198
+ }, {
6199
+ F: __dxlog_file22,
6200
+ L: 56,
6201
+ S: void 0,
6202
+ C: (f, a) => f(...a)
6203
+ });
6204
+ }
6205
+ return archive;
6206
+ };
6207
+ var importProfileData = async ({ storage, level }, archive) => {
6208
+ const batch = level.batch();
6209
+ for (const entry2 of archive.storage) {
6210
+ switch (entry2.type) {
6211
+ case import_protocols15.ProfileArchiveEntryType.FILE: {
6212
+ const directory = await storage.createDirectory();
6213
+ (0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
6214
+ F: __dxlog_file22,
6215
+ L: 78,
6216
+ S: void 0,
6217
+ A: [
6218
+ "typeof entry.key === 'string'",
6219
+ "'Invalid key type'"
6220
+ ]
6221
+ });
6222
+ const file = await directory.getOrCreateFile(entry2.key);
6223
+ (0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
6224
+ F: __dxlog_file22,
6225
+ L: 80,
6226
+ S: void 0,
6227
+ A: [
6228
+ "entry.value instanceof Uint8Array",
6229
+ "'Invalid value type'"
6230
+ ]
6231
+ });
6232
+ await file.write(0, (0, import_util13.arrayToBuffer)(entry2.value));
6233
+ await file.close();
6234
+ break;
6235
+ }
6236
+ case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
6237
+ (0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
6238
+ F: __dxlog_file22,
6239
+ L: 86,
6240
+ S: void 0,
6241
+ A: [
6242
+ "entry.key instanceof Uint8Array",
6243
+ "'Invalid key type'"
6244
+ ]
6245
+ });
6246
+ (0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
6247
+ F: __dxlog_file22,
6248
+ L: 87,
6249
+ S: void 0,
6250
+ A: [
6251
+ "entry.value instanceof Uint8Array",
6252
+ "'Invalid value type'"
6253
+ ]
6254
+ });
6255
+ batch.put(entry2.key, entry2.value, {
6256
+ keyEncoding: "binary",
6257
+ valueEncoding: "binary"
6258
+ });
6259
+ break;
6260
+ }
6261
+ default:
6262
+ throw new Error(`Invalid entry type: ${entry2.type}`);
6263
+ }
6264
+ }
6265
+ await batch.write();
6266
+ };
6267
+ var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5993
6268
  var DevicesServiceImpl = class {
5994
6269
  constructor(_identityManager) {
5995
6270
  this._identityManager = _identityManager;
@@ -6006,8 +6281,8 @@ var DevicesServiceImpl = class {
6006
6281
  devices: []
6007
6282
  });
6008
6283
  } else {
6009
- (0, import_invariant20.invariant)(this._identityManager.identity?.presence, "presence not present", {
6010
- F: __dxlog_file21,
6284
+ (0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
6285
+ F: __dxlog_file23,
6011
6286
  L: 32,
6012
6287
  S: this,
6013
6288
  A: [
@@ -6088,7 +6363,7 @@ var DiagnosticsCollector = class {
6088
6363
  client: clientDiagnostics,
6089
6364
  broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
6090
6365
  };
6091
- return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
6366
+ return JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)(options)));
6092
6367
  }
6093
6368
  };
6094
6369
  var findSystemServiceProvider = () => {
@@ -6098,35 +6373,112 @@ var findSystemServiceProvider = () => {
6098
6373
  };
6099
6374
  var findConfigs = () => {
6100
6375
  const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
6101
- return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
6376
+ return configs.map((r) => r.instance.deref()).filter(import_util14.nonNullable);
6377
+ };
6378
+ var ContactsServiceImpl = class {
6379
+ constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
6380
+ this._identityManager = _identityManager;
6381
+ this._spaceManager = _spaceManager;
6382
+ this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
6383
+ }
6384
+ async getContacts() {
6385
+ const identity = this._identityManager.identity;
6386
+ if (identity == null) {
6387
+ return {
6388
+ contacts: []
6389
+ };
6390
+ }
6391
+ const contacts = [
6392
+ ...this._spaceManager.spaces.values()
6393
+ ].flatMap((s) => [
6394
+ ...s.spaceState.members.values()
6395
+ ].map((m) => [
6396
+ s.key,
6397
+ m
6398
+ ])).reduce((acc, v) => {
6399
+ const [spaceKey, memberInfo] = v;
6400
+ if (memberInfo.key.equals(identity.identityKey)) {
6401
+ return acc;
6402
+ }
6403
+ const existing = acc.get(memberInfo.key);
6404
+ if (existing != null) {
6405
+ existing.profile ??= memberInfo.profile;
6406
+ existing.commonSpaces?.push(spaceKey);
6407
+ } else {
6408
+ acc.set(memberInfo.key, {
6409
+ identityKey: memberInfo.key,
6410
+ profile: memberInfo.profile,
6411
+ commonSpaces: [
6412
+ spaceKey
6413
+ ]
6414
+ });
6415
+ }
6416
+ return acc;
6417
+ }, new import_util16.ComplexMap(import_keys17.PublicKey.hash));
6418
+ return {
6419
+ contacts: [
6420
+ ...contacts.values()
6421
+ ]
6422
+ };
6423
+ }
6424
+ queryContacts() {
6425
+ const subscribedSpaceKeySet = new import_util16.ComplexSet(import_keys17.PublicKey.hash);
6426
+ return new import_codec_protobuf13.Stream(({ next, ctx }) => {
6427
+ const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
6428
+ const contacts = await this.getContacts();
6429
+ next(contacts);
6430
+ }, {
6431
+ maxFrequency: 2
6432
+ });
6433
+ (0, import_async22.scheduleTask)(ctx, async () => {
6434
+ const subscriptions = new import_async22.EventSubscriptions();
6435
+ ctx.onDispose(() => subscriptions.clear());
6436
+ const subscribeToSpaceAndUpdate = () => {
6437
+ const oldSetSize = subscribedSpaceKeySet.size;
6438
+ for (const space of this._spaceManager.spaces.values()) {
6439
+ if (!subscribedSpaceKeySet.has(space.key)) {
6440
+ subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
6441
+ subscribedSpaceKeySet.add(space.key);
6442
+ }
6443
+ }
6444
+ if (oldSetSize !== subscribedSpaceKeySet.size) {
6445
+ pushUpdateTask.trigger();
6446
+ }
6447
+ };
6448
+ const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
6449
+ ctx.onDispose(unsubscribe);
6450
+ subscribeToSpaceAndUpdate();
6451
+ });
6452
+ });
6453
+ }
6102
6454
  };
6103
6455
  var LoggingServiceImpl = class {
6104
6456
  constructor() {
6105
- this._logs = new import_async22.Event();
6457
+ this._logs = new import_async23.Event();
6106
6458
  this._started = Date.now();
6107
- this._sessionId = import_keys17.PublicKey.random().toHex();
6459
+ this._sessionId = import_keys18.PublicKey.random().toHex();
6108
6460
  this._logProcessor = (_config, entry2) => {
6109
6461
  this._logs.emit(entry2);
6110
6462
  };
6111
6463
  }
6112
6464
  async open() {
6113
- import_log20.log.runtimeConfig.processors.push(this._logProcessor);
6465
+ import_log21.log.runtimeConfig.processors.push(this._logProcessor);
6114
6466
  }
6115
6467
  async close() {
6116
- const index = import_log20.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6117
- import_log20.log.runtimeConfig.processors.splice(index, 1);
6468
+ const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6469
+ import_log21.log.runtimeConfig.processors.splice(index, 1);
6118
6470
  }
6119
6471
  async controlMetrics({ reset, record }) {
6120
6472
  if (reset) {
6121
- import_util15.tracer.clear();
6473
+ import_util17.tracer.clear();
6122
6474
  }
6123
6475
  if (record === true) {
6124
- import_util15.tracer.start();
6476
+ import_util17.tracer.start();
6125
6477
  } else if (record === false) {
6126
- import_util15.tracer.stop();
6478
+ import_util17.tracer.stop();
6127
6479
  }
6128
6480
  return {
6129
- recording: import_util15.tracer.recording
6481
+ recording: import_util17.tracer.recording
6130
6482
  };
6131
6483
  }
6132
6484
  /**
@@ -6134,13 +6486,13 @@ var LoggingServiceImpl = class {
6134
6486
  */
6135
6487
  queryMetrics({ interval = 5e3 }) {
6136
6488
  const getNumericalValues = (key) => {
6137
- const events = import_util15.tracer.get(key) ?? [];
6489
+ const events = import_util17.tracer.get(key) ?? [];
6138
6490
  return {
6139
6491
  key,
6140
- stats: (0, import_util15.numericalValues)(events, "duration")
6492
+ stats: (0, import_util17.numericalValues)(events, "duration")
6141
6493
  };
6142
6494
  };
6143
- return new import_codec_protobuf13.Stream(({ next }) => {
6495
+ return new import_codec_protobuf14.Stream(({ next }) => {
6144
6496
  const update = () => {
6145
6497
  const metrics = {
6146
6498
  timestamp: /* @__PURE__ */ new Date(),
@@ -6162,7 +6514,7 @@ var LoggingServiceImpl = class {
6162
6514
  });
6163
6515
  }
6164
6516
  queryLogs(request) {
6165
- return new import_codec_protobuf13.Stream(({ ctx, next }) => {
6517
+ return new import_codec_protobuf14.Stream(({ ctx, next }) => {
6166
6518
  const handler = (entry2) => {
6167
6519
  if (LOG_PROCESSING > 0) {
6168
6520
  return;
@@ -6175,7 +6527,7 @@ var LoggingServiceImpl = class {
6175
6527
  }
6176
6528
  const record = {
6177
6529
  ...entry2,
6178
- context: (0, import_util15.jsonify)((0, import_log20.getContextFromEntry)(entry2)),
6530
+ context: (0, import_util17.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
6179
6531
  timestamp: /* @__PURE__ */ new Date(),
6180
6532
  meta: {
6181
6533
  // TODO(dmaretskyi): Fix proto.
@@ -6184,7 +6536,7 @@ var LoggingServiceImpl = class {
6184
6536
  scope: {
6185
6537
  hostSessionId: this._sessionId,
6186
6538
  uptimeSeconds: (Date.now() - this._started) / 1e3,
6187
- name: (0, import_util15.getDebugName)(entry2.meta?.S)
6539
+ name: (0, import_util17.getDebugName)(entry2.meta?.S)
6188
6540
  }
6189
6541
  }
6190
6542
  };
@@ -6222,7 +6574,7 @@ var NetworkServiceImpl = class {
6222
6574
  this.signalManager = signalManager;
6223
6575
  }
6224
6576
  queryStatus() {
6225
- return new import_codec_protobuf14.Stream(({ next }) => {
6577
+ return new import_codec_protobuf15.Stream(({ next }) => {
6226
6578
  const update = () => {
6227
6579
  next({
6228
6580
  swarm: this.networkManager.connectionState,
@@ -6265,7 +6617,7 @@ var SystemServiceImpl = class {
6265
6617
  const diagnostics = await this._getDiagnostics();
6266
6618
  return {
6267
6619
  timestamp: /* @__PURE__ */ new Date(),
6268
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util16.jsonKeyReplacer)({
6620
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util18.jsonKeyReplacer)({
6269
6621
  truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
6270
6622
  humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
6271
6623
  })))
@@ -6279,7 +6631,7 @@ var SystemServiceImpl = class {
6279
6631
  }
6280
6632
  // TODO(burdon): Standardize interval option in stream request?
6281
6633
  queryStatus({ interval = 3e3 } = {}) {
6282
- return new import_codec_protobuf15.Stream(({ next }) => {
6634
+ return new import_codec_protobuf16.Stream(({ next }) => {
6283
6635
  const update = () => {
6284
6636
  next({
6285
6637
  status: this._getCurrentStatus()
@@ -6308,7 +6660,7 @@ function _ts_decorate8(decorators, target, key, desc) {
6308
6660
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6309
6661
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6310
6662
  }
6311
- var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6663
+ var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6312
6664
  var ClientServicesHost = class {
6313
6665
  constructor({
6314
6666
  config,
@@ -6341,7 +6693,10 @@ var ClientServicesHost = class {
6341
6693
  lockKey,
6342
6694
  onAcquire: () => {
6343
6695
  if (!this._opening) {
6344
- void this.open(new import_context16.Context());
6696
+ void this.open(new import_context16.Context(void 0, {
6697
+ F: __dxlog_file24,
6698
+ L: 121
6699
+ }));
6345
6700
  }
6346
6701
  },
6347
6702
  onRelease: () => this.close()
@@ -6396,25 +6751,25 @@ var ClientServicesHost = class {
6396
6751
  * Can only be called once.
6397
6752
  */
6398
6753
  initialize({ config, ...options }) {
6399
- (0, import_invariant19.invariant)(!this._open, "service host is open", {
6400
- F: __dxlog_file22,
6401
- L: 186,
6754
+ (0, import_invariant20.invariant)(!this._open, "service host is open", {
6755
+ F: __dxlog_file24,
6756
+ L: 187,
6402
6757
  S: this,
6403
6758
  A: [
6404
6759
  "!this._open",
6405
6760
  "'service host is open'"
6406
6761
  ]
6407
6762
  });
6408
- (0, import_log19.log)("initializing...", void 0, {
6409
- F: __dxlog_file22,
6410
- L: 187,
6763
+ (0, import_log20.log)("initializing...", void 0, {
6764
+ F: __dxlog_file24,
6765
+ L: 188,
6411
6766
  S: this,
6412
6767
  C: (f, a) => f(...a)
6413
6768
  });
6414
6769
  if (config) {
6415
- (0, import_invariant19.invariant)(!this._config, "config already set", {
6416
- F: __dxlog_file22,
6417
- L: 190,
6770
+ (0, import_invariant20.invariant)(!this._config, "config already set", {
6771
+ F: __dxlog_file24,
6772
+ L: 191,
6418
6773
  S: this,
6419
6774
  A: [
6420
6775
  "!this._config",
@@ -6427,9 +6782,9 @@ var ClientServicesHost = class {
6427
6782
  }
6428
6783
  }
6429
6784
  if (!options.signalManager) {
6430
- import_log19.log.warn("running signaling without telemetry metadata.", void 0, {
6431
- F: __dxlog_file22,
6432
- L: 198,
6785
+ import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
6786
+ F: __dxlog_file24,
6787
+ L: 199,
6433
6788
  S: this,
6434
6789
  C: (f, a) => f(...a)
6435
6790
  });
@@ -6438,9 +6793,9 @@ var ClientServicesHost = class {
6438
6793
  iceServers: this._config?.get("runtime.services.ice")
6439
6794
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
6440
6795
  this._signalManager = signalManager;
6441
- (0, import_invariant19.invariant)(!this._networkManager, "network manager already set", {
6442
- F: __dxlog_file22,
6443
- L: 209,
6796
+ (0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
6797
+ F: __dxlog_file24,
6798
+ L: 210,
6444
6799
  S: this,
6445
6800
  A: [
6446
6801
  "!this._networkManager",
@@ -6452,9 +6807,9 @@ var ClientServicesHost = class {
6452
6807
  transportFactory,
6453
6808
  signalManager
6454
6809
  });
6455
- (0, import_log19.log)("initialized", void 0, {
6456
- F: __dxlog_file22,
6457
- L: 216,
6810
+ (0, import_log20.log)("initialized", void 0, {
6811
+ F: __dxlog_file24,
6812
+ L: 217,
6458
6813
  S: this,
6459
6814
  C: (f, a) => f(...a)
6460
6815
  });
@@ -6464,44 +6819,44 @@ var ClientServicesHost = class {
6464
6819
  return;
6465
6820
  }
6466
6821
  const traceId = import_keys15.PublicKey.random().toHex();
6467
- import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
6822
+ import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
6468
6823
  id: traceId
6469
6824
  }), {
6470
- F: __dxlog_file22,
6471
- L: 227,
6825
+ F: __dxlog_file24,
6826
+ L: 228,
6472
6827
  S: this,
6473
6828
  C: (f, a) => f(...a)
6474
6829
  });
6475
- (0, import_invariant19.invariant)(this._config, "config not set", {
6476
- F: __dxlog_file22,
6477
- L: 229,
6830
+ (0, import_invariant20.invariant)(this._config, "config not set", {
6831
+ F: __dxlog_file24,
6832
+ L: 230,
6478
6833
  S: this,
6479
6834
  A: [
6480
6835
  "this._config",
6481
6836
  "'config not set'"
6482
6837
  ]
6483
6838
  });
6484
- (0, import_invariant19.invariant)(this._storage, "storage not set", {
6485
- F: __dxlog_file22,
6486
- L: 230,
6839
+ (0, import_invariant20.invariant)(this._storage, "storage not set", {
6840
+ F: __dxlog_file24,
6841
+ L: 231,
6487
6842
  S: this,
6488
6843
  A: [
6489
6844
  "this._storage",
6490
6845
  "'storage not set'"
6491
6846
  ]
6492
6847
  });
6493
- (0, import_invariant19.invariant)(this._signalManager, "signal manager not set", {
6494
- F: __dxlog_file22,
6495
- L: 231,
6848
+ (0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
6849
+ F: __dxlog_file24,
6850
+ L: 232,
6496
6851
  S: this,
6497
6852
  A: [
6498
6853
  "this._signalManager",
6499
6854
  "'signal manager not set'"
6500
6855
  ]
6501
6856
  });
6502
- (0, import_invariant19.invariant)(this._networkManager, "network manager not set", {
6503
- F: __dxlog_file22,
6504
- L: 232,
6857
+ (0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
6858
+ F: __dxlog_file24,
6859
+ L: 233,
6505
6860
  S: this,
6506
6861
  A: [
6507
6862
  "this._networkManager",
@@ -6509,11 +6864,11 @@ var ClientServicesHost = class {
6509
6864
  ]
6510
6865
  });
6511
6866
  this._opening = true;
6512
- (0, import_log19.log)("opening...", {
6867
+ (0, import_log20.log)("opening...", {
6513
6868
  lockKey: this._resourceLock?.lockKey
6514
6869
  }, {
6515
- F: __dxlog_file22,
6516
- L: 235,
6870
+ F: __dxlog_file24,
6871
+ L: 236,
6517
6872
  S: this,
6518
6873
  C: (f, a) => f(...a)
6519
6874
  });
@@ -6524,16 +6879,18 @@ var ClientServicesHost = class {
6524
6879
  await this._level.open();
6525
6880
  await this._loggingService.open();
6526
6881
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
6882
+ const dataSpaceManagerProvider = async () => {
6883
+ await this._serviceContext.initialized.wait();
6884
+ return this._serviceContext.dataSpaceManager;
6885
+ };
6527
6886
  const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
6528
6887
  this._serviceRegistry.setServices({
6529
6888
  SystemService: this._systemService,
6530
6889
  IdentityService: identityService,
6890
+ ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
6531
6891
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
6532
6892
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
6533
- SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
6534
- await this._serviceContext.initialized.wait();
6535
- return this._serviceContext.dataSpaceManager;
6536
- }),
6893
+ SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
6537
6894
  DataService: this._serviceContext.echoHost.dataService,
6538
6895
  QueryService: this._serviceContext.echoHost.queryService,
6539
6896
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
@@ -6563,19 +6920,19 @@ var ClientServicesHost = class {
6563
6920
  this._open = true;
6564
6921
  this._statusUpdate.emit();
6565
6922
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6566
- (0, import_log19.log)("opened", {
6923
+ (0, import_log20.log)("opened", {
6567
6924
  deviceKey
6568
6925
  }, {
6569
- F: __dxlog_file22,
6570
- L: 314,
6926
+ F: __dxlog_file24,
6927
+ L: 322,
6571
6928
  S: this,
6572
6929
  C: (f, a) => f(...a)
6573
6930
  });
6574
- import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
6931
+ import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
6575
6932
  id: traceId
6576
6933
  }), {
6577
- F: __dxlog_file22,
6578
- L: 315,
6934
+ F: __dxlog_file24,
6935
+ L: 323,
6579
6936
  S: this,
6580
6937
  C: (f, a) => f(...a)
6581
6938
  });
@@ -6585,11 +6942,11 @@ var ClientServicesHost = class {
6585
6942
  return;
6586
6943
  }
6587
6944
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6588
- (0, import_log19.log)("closing...", {
6945
+ (0, import_log20.log)("closing...", {
6589
6946
  deviceKey
6590
6947
  }, {
6591
- F: __dxlog_file22,
6592
- L: 326,
6948
+ F: __dxlog_file24,
6949
+ L: 334,
6593
6950
  S: this,
6594
6951
  C: (f, a) => f(...a)
6595
6952
  });
@@ -6603,44 +6960,44 @@ var ClientServicesHost = class {
6603
6960
  await this._level?.close();
6604
6961
  this._open = false;
6605
6962
  this._statusUpdate.emit();
6606
- (0, import_log19.log)("closed", {
6963
+ (0, import_log20.log)("closed", {
6607
6964
  deviceKey
6608
6965
  }, {
6609
- F: __dxlog_file22,
6610
- L: 335,
6966
+ F: __dxlog_file24,
6967
+ L: 343,
6611
6968
  S: this,
6612
6969
  C: (f, a) => f(...a)
6613
6970
  });
6614
6971
  }
6615
6972
  async reset() {
6616
6973
  const traceId = import_keys15.PublicKey.random().toHex();
6617
- import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
6974
+ import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
6618
6975
  id: traceId
6619
6976
  }), {
6620
- F: __dxlog_file22,
6621
- L: 340,
6977
+ F: __dxlog_file24,
6978
+ L: 348,
6622
6979
  S: this,
6623
6980
  C: (f, a) => f(...a)
6624
6981
  });
6625
- import_log19.log.info("resetting...", void 0, {
6626
- F: __dxlog_file22,
6627
- L: 342,
6982
+ import_log20.log.info("resetting...", void 0, {
6983
+ F: __dxlog_file24,
6984
+ L: 350,
6628
6985
  S: this,
6629
6986
  C: (f, a) => f(...a)
6630
6987
  });
6631
6988
  await this._serviceContext?.close();
6632
6989
  await this._storage.reset();
6633
- import_log19.log.info("reset", void 0, {
6634
- F: __dxlog_file22,
6635
- L: 345,
6990
+ import_log20.log.info("reset", void 0, {
6991
+ F: __dxlog_file24,
6992
+ L: 353,
6636
6993
  S: this,
6637
6994
  C: (f, a) => f(...a)
6638
6995
  });
6639
- import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
6996
+ import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
6640
6997
  id: traceId
6641
6998
  }), {
6642
- F: __dxlog_file22,
6643
- L: 346,
6999
+ F: __dxlog_file24,
7000
+ L: 354,
6644
7001
  S: this,
6645
7002
  C: (f, a) => f(...a)
6646
7003
  });
@@ -6699,7 +7056,11 @@ ClientServicesHost = _ts_decorate8([
6699
7056
  createDiagnostics,
6700
7057
  createLevel,
6701
7058
  createStorageObjects,
7059
+ decodeProfileArchive,
7060
+ encodeProfileArchive,
7061
+ exportProfileData,
6702
7062
  getNetworkPeers,
7063
+ importProfileData,
6703
7064
  isLocked,
6704
7065
  subscribeToFeedBlocks,
6705
7066
  subscribeToFeeds,
@@ -6709,4 +7070,4 @@ ClientServicesHost = _ts_decorate8([
6709
7070
  subscribeToSpaces,
6710
7071
  subscribeToSwarmInfo
6711
7072
  });
6712
- //# sourceMappingURL=chunk-VQ7KZOFD.cjs.map
7073
+ //# sourceMappingURL=chunk-F4GQDNYS.cjs.map