@dxos/client-services 0.5.9-main.4fc2821 → 0.5.9-main.51854a6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/lib/browser/{chunk-VM3DVDWQ.mjs → chunk-LFGNDWPO.mjs} +635 -416
  2. package/dist/lib/browser/chunk-LFGNDWPO.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -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-5B5T4YX6.cjs → chunk-SSRPYM2G.cjs} +640 -423
  9. package/dist/lib/node/chunk-SSRPYM2G.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +45 -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/version.d.ts +1 -1
  25. package/package.json +36 -36
  26. package/src/packlets/identity/contacts-service.ts +85 -0
  27. package/src/packlets/invitations/invitations-handler.ts +13 -5
  28. package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
  29. package/src/packlets/services/service-host.ts +12 -4
  30. package/src/packlets/spaces/data-space-manager.ts +55 -2
  31. package/src/packlets/spaces/spaces-service.ts +38 -0
  32. package/src/version.ts +1 -1
  33. package/dist/lib/browser/chunk-VM3DVDWQ.mjs.map +0 -7
  34. package/dist/lib/node/chunk-5B5T4YX6.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_5B5T4YX6_exports = {};
30
- __export(chunk_5B5T4YX6_exports, {
29
+ var chunk_SSRPYM2G_exports = {};
30
+ __export(chunk_SSRPYM2G_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -66,7 +66,7 @@ __export(chunk_5B5T4YX6_exports, {
66
66
  subscribeToSpaces: () => subscribeToSpaces,
67
67
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
68
68
  });
69
- module.exports = __toCommonJS(chunk_5B5T4YX6_exports);
69
+ module.exports = __toCommonJS(chunk_SSRPYM2G_exports);
70
70
  var import_async = require("@dxos/async");
71
71
  var import_codec_protobuf = require("@dxos/codec-protobuf");
72
72
  var import_feed_store = require("@dxos/feed-store");
@@ -236,8 +236,10 @@ var import_context14 = require("@dxos/context");
236
236
  var import_credentials15 = require("@dxos/credentials");
237
237
  var import_echo_db2 = require("@dxos/echo-db");
238
238
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
239
+ var import_echo_pipeline5 = require("@dxos/echo-pipeline");
239
240
  var import_echo_protocol2 = require("@dxos/echo-protocol");
240
241
  var import_echo_schema2 = require("@dxos/echo-schema");
242
+ var import_feed_store4 = require("@dxos/feed-store");
241
243
  var import_invariant15 = require("@dxos/invariant");
242
244
  var import_keys12 = require("@dxos/keys");
243
245
  var import_log15 = require("@dxos/log");
@@ -255,7 +257,7 @@ var import_async18 = require("@dxos/async");
255
257
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
256
258
  var import_credentials19 = require("@dxos/credentials");
257
259
  var import_debug5 = require("@dxos/debug");
258
- var import_feed_store4 = require("@dxos/feed-store");
260
+ var import_feed_store5 = require("@dxos/feed-store");
259
261
  var import_invariant16 = require("@dxos/invariant");
260
262
  var import_log16 = require("@dxos/log");
261
263
  var import_protocols12 = require("@dxos/protocols");
@@ -266,8 +268,8 @@ var import_context15 = require("@dxos/context");
266
268
  var import_credentials20 = require("@dxos/credentials");
267
269
  var import_debug6 = require("@dxos/debug");
268
270
  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");
271
+ var import_echo_pipeline6 = require("@dxos/echo-pipeline");
272
+ var import_feed_store6 = require("@dxos/feed-store");
271
273
  var import_invariant17 = require("@dxos/invariant");
272
274
  var import_keyring = require("@dxos/keyring");
273
275
  var import_keys13 = require("@dxos/keys");
@@ -314,13 +316,17 @@ var import_util14 = require("@dxos/util");
314
316
  var import_async22 = require("@dxos/async");
315
317
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
316
318
  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
319
  var import_util15 = require("@dxos/util");
320
+ var import_async23 = require("@dxos/async");
320
321
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
322
+ var import_keys18 = require("@dxos/keys");
323
+ var import_log20 = require("@dxos/log");
324
+ var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
325
+ var import_util16 = require("@dxos/util");
321
326
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
327
+ var import_codec_protobuf16 = require("@dxos/codec-protobuf");
322
328
  var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
323
- var import_util16 = require("@dxos/util");
329
+ var import_util17 = require("@dxos/util");
324
330
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
325
331
  return new import_codec_protobuf.Stream(({ next }) => {
326
332
  const subscriptions = new import_async.EventSubscriptions();
@@ -388,6 +394,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
388
394
  };
389
395
  });
390
396
  };
397
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
391
398
  var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
392
399
  const update = () => {
393
400
  try {
@@ -403,7 +410,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
403
410
  update();
404
411
  });
405
412
  var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
406
- const ctx = new import_context.Context();
413
+ const ctx = new import_context.Context(void 0, {
414
+ F: __dxlog_file,
415
+ L: 36
416
+ });
407
417
  signalManager.onMessage.on(ctx, (message) => {
408
418
  next({
409
419
  message: {
@@ -631,7 +641,7 @@ var DevtoolsServiceImpl = class {
631
641
  });
632
642
  }
633
643
  };
634
- var DXOS_VERSION = "0.5.9-main.4fc2821";
644
+ var DXOS_VERSION = "0.5.9-main.51854a6";
635
645
  var getPlatform = () => {
636
646
  if (process.browser) {
637
647
  if (typeof window !== "undefined") {
@@ -659,7 +669,7 @@ var getPlatform = () => {
659
669
  };
660
670
  }
661
671
  };
662
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
672
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
663
673
  var DEFAULT_TIMEOUT = 1e3;
664
674
  var createDiagnostics = async (clientServices, serviceContext, config) => {
665
675
  const diagnostics = {
@@ -676,7 +686,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
676
686
  await Promise.all([
677
687
  (async () => {
678
688
  (0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
679
- F: __dxlog_file,
689
+ F: __dxlog_file2,
680
690
  L: 110,
681
691
  S: void 0,
682
692
  A: [
@@ -865,7 +875,7 @@ _ts_decorate([
865
875
  ClientRpcServer = _ts_decorate([
866
876
  import_tracing2.trace.resource()
867
877
  ], ClientRpcServer);
868
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
878
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
869
879
  var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
870
880
  var createAuthProvider = (signer) => async (nonce) => {
871
881
  const credential = await signer.createCredential({
@@ -880,7 +890,10 @@ var createAuthProvider = (signer) => async (nonce) => {
880
890
  var TrustedKeySetAuthVerifier = class {
881
891
  constructor(_params) {
882
892
  this._params = _params;
883
- this._ctx = new import_context2.Context();
893
+ this._ctx = new import_context2.Context(void 0, {
894
+ F: __dxlog_file3,
895
+ L: 45
896
+ });
884
897
  }
885
898
  async close() {
886
899
  await this._ctx.dispose();
@@ -891,7 +904,7 @@ var TrustedKeySetAuthVerifier = class {
891
904
  (0, import_log.log)("authenticating...", {
892
905
  credential
893
906
  }, {
894
- F: __dxlog_file2,
907
+ F: __dxlog_file3,
895
908
  L: 56,
896
909
  S: this,
897
910
  C: (f, a) => f(...a)
@@ -901,7 +914,7 @@ var TrustedKeySetAuthVerifier = class {
901
914
  (0, import_log.log)("Invalid credential", {
902
915
  result
903
916
  }, {
904
- F: __dxlog_file2,
917
+ F: __dxlog_file3,
905
918
  L: 60,
906
919
  S: this,
907
920
  C: (f, a) => f(...a)
@@ -913,7 +926,7 @@ var TrustedKeySetAuthVerifier = class {
913
926
  nonce,
914
927
  credential
915
928
  }, {
916
- F: __dxlog_file2,
929
+ F: __dxlog_file3,
917
930
  L: 65,
918
931
  S: this,
919
932
  C: (f, a) => f(...a)
@@ -924,7 +937,7 @@ var TrustedKeySetAuthVerifier = class {
924
937
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
925
938
  key: credential.issuer
926
939
  }, {
927
- F: __dxlog_file2,
940
+ F: __dxlog_file3,
928
941
  L: 70,
929
942
  S: this,
930
943
  C: (f, a) => f(...a)
@@ -940,7 +953,7 @@ var TrustedKeySetAuthVerifier = class {
940
953
  (0, import_log.log)("auth success", {
941
954
  key: credential.issuer
942
955
  }, {
943
- F: __dxlog_file2,
956
+ F: __dxlog_file3,
944
957
  L: 81,
945
958
  S: this,
946
959
  C: (f, a) => f(...a)
@@ -950,7 +963,7 @@ var TrustedKeySetAuthVerifier = class {
950
963
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
951
964
  key: credential.issuer
952
965
  }, {
953
- F: __dxlog_file2,
966
+ F: __dxlog_file3,
954
967
  L: 84,
955
968
  S: this,
956
969
  C: (f, a) => f(...a)
@@ -973,7 +986,7 @@ var TrustedKeySetAuthVerifier = class {
973
986
  return deviceSet.has(deviceKey);
974
987
  }
975
988
  };
976
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
989
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
977
990
  var DefaultSpaceStateMachine = class {
978
991
  constructor(_params) {
979
992
  this._params = _params;
@@ -990,7 +1003,7 @@ var DefaultSpaceStateMachine = class {
990
1003
  expectedIdentity: this._params.identityKey,
991
1004
  credential
992
1005
  }, {
993
- F: __dxlog_file3,
1006
+ F: __dxlog_file4,
994
1007
  L: 32,
995
1008
  S: this,
996
1009
  C: (f, a) => f(...a)
@@ -1001,7 +1014,7 @@ var DefaultSpaceStateMachine = class {
1001
1014
  import_log3.log.warn("Invalid default space id", {
1002
1015
  id: assertion.spaceId
1003
1016
  }, {
1004
- F: __dxlog_file3,
1017
+ F: __dxlog_file4,
1005
1018
  L: 36,
1006
1019
  S: this,
1007
1020
  C: (f, a) => f(...a)
@@ -1024,7 +1037,7 @@ function _ts_decorate2(decorators, target, key, desc) {
1024
1037
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1025
1038
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1026
1039
  }
1027
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
1040
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
1028
1041
  var Identity = class {
1029
1042
  constructor({ space, signer, identityKey, deviceKey, presence }) {
1030
1043
  this.stateUpdate = new import_async6.Event();
@@ -1036,7 +1049,7 @@ var Identity = class {
1036
1049
  import_log2.log.trace("dxos.halo.device", {
1037
1050
  deviceKey
1038
1051
  }, {
1039
- F: __dxlog_file4,
1052
+ F: __dxlog_file5,
1040
1053
  L: 70,
1041
1054
  S: this,
1042
1055
  C: (f, a) => f(...a)
@@ -1115,7 +1128,7 @@ var Identity = class {
1115
1128
  */
1116
1129
  getIdentityCredentialSigner() {
1117
1130
  (0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
1118
- F: __dxlog_file4,
1131
+ F: __dxlog_file5,
1119
1132
  L: 159,
1120
1133
  S: this,
1121
1134
  A: [
@@ -1159,7 +1172,7 @@ var Identity = class {
1159
1172
  controlFeedKey,
1160
1173
  dataFeedKey
1161
1174
  }, {
1162
- F: __dxlog_file4,
1175
+ F: __dxlog_file5,
1163
1176
  L: 184,
1164
1177
  S: this,
1165
1178
  C: (f, a) => f(...a)
@@ -1220,7 +1233,7 @@ function _ts_decorate3(decorators, target, key, desc) {
1220
1233
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1221
1234
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1222
1235
  }
1223
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1236
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1224
1237
  var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
1225
1238
  var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
1226
1239
  var IdentityManager = class {
@@ -1244,7 +1257,7 @@ var IdentityManager = class {
1244
1257
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
1245
1258
  id: traceId
1246
1259
  }), {
1247
- F: __dxlog_file5,
1260
+ F: __dxlog_file6,
1248
1261
  L: 104,
1249
1262
  S: this,
1250
1263
  C: (f, a) => f(...a)
@@ -1253,7 +1266,7 @@ var IdentityManager = class {
1253
1266
  (0, import_log4.log)("identity record", {
1254
1267
  identityRecord
1255
1268
  }, {
1256
- F: __dxlog_file5,
1269
+ F: __dxlog_file6,
1257
1270
  L: 107,
1258
1271
  S: this,
1259
1272
  C: (f, a) => f(...a)
@@ -1266,7 +1279,7 @@ var IdentityManager = class {
1266
1279
  identityKey: identityRecord.identityKey,
1267
1280
  displayName: this._identity.profileDocument?.displayName
1268
1281
  }, {
1269
- F: __dxlog_file5,
1282
+ F: __dxlog_file6,
1270
1283
  L: 112,
1271
1284
  S: this,
1272
1285
  C: (f, a) => f(...a)
@@ -1276,18 +1289,21 @@ var IdentityManager = class {
1276
1289
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
1277
1290
  id: traceId
1278
1291
  }), {
1279
- F: __dxlog_file5,
1292
+ F: __dxlog_file6,
1280
1293
  L: 119,
1281
1294
  S: this,
1282
1295
  C: (f, a) => f(...a)
1283
1296
  });
1284
1297
  }
1285
1298
  async close() {
1286
- await this._identity?.close(new import_context3.Context());
1299
+ await this._identity?.close(new import_context3.Context(void 0, {
1300
+ F: __dxlog_file6,
1301
+ L: 123
1302
+ }));
1287
1303
  }
1288
1304
  async createIdentity({ displayName, deviceProfile } = {}) {
1289
1305
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1290
- F: __dxlog_file5,
1306
+ F: __dxlog_file6,
1291
1307
  L: 128,
1292
1308
  S: this,
1293
1309
  A: [
@@ -1296,7 +1312,7 @@ var IdentityManager = class {
1296
1312
  ]
1297
1313
  });
1298
1314
  (0, import_log4.log)("creating identity...", void 0, {
1299
- F: __dxlog_file5,
1315
+ F: __dxlog_file6,
1300
1316
  L: 129,
1301
1317
  S: this,
1302
1318
  C: (f, a) => f(...a)
@@ -1313,11 +1329,14 @@ var IdentityManager = class {
1313
1329
  }
1314
1330
  };
1315
1331
  const identity = await this._constructIdentity(identityRecord);
1316
- await identity.open(new import_context3.Context());
1332
+ await identity.open(new import_context3.Context(void 0, {
1333
+ F: __dxlog_file6,
1334
+ L: 144
1335
+ }));
1317
1336
  {
1318
1337
  const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
1319
1338
  (0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
1320
- F: __dxlog_file5,
1339
+ F: __dxlog_file6,
1321
1340
  L: 148,
1322
1341
  S: this,
1323
1342
  A: [
@@ -1326,7 +1345,7 @@ var IdentityManager = class {
1326
1345
  ]
1327
1346
  });
1328
1347
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
1329
- F: __dxlog_file5,
1348
+ F: __dxlog_file6,
1330
1349
  L: 149,
1331
1350
  S: this,
1332
1351
  A: [
@@ -1365,7 +1384,7 @@ var IdentityManager = class {
1365
1384
  identityKey: identityRecord.identityKey,
1366
1385
  displayName: this._identity.profileDocument?.displayName
1367
1386
  }, {
1368
- F: __dxlog_file5,
1387
+ F: __dxlog_file6,
1369
1388
  L: 191,
1370
1389
  S: this,
1371
1390
  C: (f, a) => f(...a)
@@ -1376,7 +1395,7 @@ var IdentityManager = class {
1376
1395
  deviceKey: identity.deviceKey,
1377
1396
  profile: identity.profileDocument
1378
1397
  }, {
1379
- F: __dxlog_file5,
1398
+ F: __dxlog_file6,
1380
1399
  L: 197,
1381
1400
  S: this,
1382
1401
  C: (f, a) => f(...a)
@@ -1413,13 +1432,13 @@ var IdentityManager = class {
1413
1432
  (0, import_log4.log)("accepting identity", {
1414
1433
  params
1415
1434
  }, {
1416
- F: __dxlog_file5,
1435
+ F: __dxlog_file6,
1417
1436
  L: 235,
1418
1437
  S: this,
1419
1438
  C: (f, a) => f(...a)
1420
1439
  });
1421
1440
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1422
- F: __dxlog_file5,
1441
+ F: __dxlog_file6,
1423
1442
  L: 236,
1424
1443
  S: this,
1425
1444
  A: [
@@ -1439,7 +1458,10 @@ var IdentityManager = class {
1439
1458
  }
1440
1459
  };
1441
1460
  const identity = await this._constructIdentity(identityRecord);
1442
- await identity.open(new import_context3.Context());
1461
+ await identity.open(new import_context3.Context(void 0, {
1462
+ F: __dxlog_file6,
1463
+ L: 251
1464
+ }));
1443
1465
  this._identity = identity;
1444
1466
  await this._metadataStore.setIdentityRecord(identityRecord);
1445
1467
  await this._identity.ready();
@@ -1447,7 +1469,7 @@ var IdentityManager = class {
1447
1469
  identityKey: identityRecord.identityKey,
1448
1470
  displayName: this._identity.profileDocument?.displayName
1449
1471
  }, {
1450
- F: __dxlog_file5,
1472
+ F: __dxlog_file6,
1451
1473
  L: 255,
1452
1474
  S: this,
1453
1475
  C: (f, a) => f(...a)
@@ -1461,7 +1483,7 @@ var IdentityManager = class {
1461
1483
  identityKey: identity.identityKey,
1462
1484
  deviceKey: identity.deviceKey
1463
1485
  }, {
1464
- F: __dxlog_file5,
1486
+ F: __dxlog_file6,
1465
1487
  L: 265,
1466
1488
  S: this,
1467
1489
  C: (f, a) => f(...a)
@@ -1473,7 +1495,7 @@ var IdentityManager = class {
1473
1495
  */
1474
1496
  async updateProfile(profile) {
1475
1497
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1476
- F: __dxlog_file5,
1498
+ F: __dxlog_file6,
1477
1499
  L: 273,
1478
1500
  S: this,
1479
1501
  A: [
@@ -1504,7 +1526,7 @@ var IdentityManager = class {
1504
1526
  }
1505
1527
  async updateDeviceProfile(profile) {
1506
1528
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1507
- F: __dxlog_file5,
1529
+ F: __dxlog_file6,
1508
1530
  L: 290,
1509
1531
  S: this,
1510
1532
  A: [
@@ -1540,7 +1562,7 @@ var IdentityManager = class {
1540
1562
  }
1541
1563
  async _constructIdentity(identityRecord) {
1542
1564
  (0, import_invariant3.invariant)(!this._identity, void 0, {
1543
- F: __dxlog_file5,
1565
+ F: __dxlog_file6,
1544
1566
  L: 316,
1545
1567
  S: this,
1546
1568
  A: [
@@ -1551,7 +1573,7 @@ var IdentityManager = class {
1551
1573
  (0, import_log4.log)("constructing identity", {
1552
1574
  identityRecord
1553
1575
  }, {
1554
- F: __dxlog_file5,
1576
+ F: __dxlog_file6,
1555
1577
  L: 317,
1556
1578
  S: this,
1557
1579
  C: (f, a) => f(...a)
@@ -1566,7 +1588,7 @@ var IdentityManager = class {
1566
1588
  gossip
1567
1589
  });
1568
1590
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
1569
- F: __dxlog_file5,
1591
+ F: __dxlog_file6,
1570
1592
  L: 330,
1571
1593
  S: this,
1572
1594
  A: [
@@ -1578,7 +1600,7 @@ var IdentityManager = class {
1578
1600
  writable: true
1579
1601
  });
1580
1602
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
1581
- F: __dxlog_file5,
1603
+ F: __dxlog_file6,
1582
1604
  L: 334,
1583
1605
  S: this,
1584
1606
  A: [
@@ -1612,7 +1634,7 @@ var IdentityManager = class {
1612
1634
  (0, import_log4.log)("done", {
1613
1635
  identityKey: identityRecord.identityKey
1614
1636
  }, {
1615
- F: __dxlog_file5,
1637
+ F: __dxlog_file6,
1616
1638
  L: 360,
1617
1639
  S: this,
1618
1640
  C: (f, a) => f(...a)
@@ -1637,7 +1659,7 @@ var IdentityManager = class {
1637
1659
  },
1638
1660
  onAuthFailure: () => {
1639
1661
  import_log4.log.warn("auth failure", void 0, {
1640
- F: __dxlog_file5,
1662
+ F: __dxlog_file6,
1641
1663
  L: 385,
1642
1664
  S: this,
1643
1665
  C: (f, a) => f(...a)
@@ -1659,7 +1681,7 @@ _ts_decorate3([
1659
1681
  IdentityManager = _ts_decorate3([
1660
1682
  import_tracing4.trace.resource()
1661
1683
  ], IdentityManager);
1662
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1684
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1663
1685
  var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
1664
1686
  var IdentityServiceImpl = class extends import_context4.Resource {
1665
1687
  constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
@@ -1689,7 +1711,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1689
1711
  const space = await dataSpaceManager.createDefaultSpace();
1690
1712
  const identity = this._identityManager.identity;
1691
1713
  (0, import_invariant4.invariant)(identity, void 0, {
1692
- F: __dxlog_file6,
1714
+ F: __dxlog_file7,
1693
1715
  L: 59,
1694
1716
  S: this,
1695
1717
  A: [
@@ -1723,7 +1745,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1723
1745
  }
1724
1746
  async updateProfile(profile) {
1725
1747
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1726
- F: __dxlog_file6,
1748
+ F: __dxlog_file7,
1727
1749
  L: 89,
1728
1750
  S: this,
1729
1751
  A: [
@@ -1737,7 +1759,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1737
1759
  }
1738
1760
  async signPresentation({ presentation, nonce }) {
1739
1761
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1740
- F: __dxlog_file6,
1762
+ F: __dxlog_file7,
1741
1763
  L: 96,
1742
1764
  S: this,
1743
1765
  A: [
@@ -1772,7 +1794,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1772
1794
  import_log5.log.warn("Multiple default spaces found. Using the first one.", {
1773
1795
  duplicate: space.id
1774
1796
  }, {
1775
- F: __dxlog_file6,
1797
+ F: __dxlog_file7,
1776
1798
  L: 127,
1777
1799
  S: this,
1778
1800
  C: (f, a) => f(...a)
@@ -1795,7 +1817,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1795
1817
  }
1796
1818
  }
1797
1819
  };
1798
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1820
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1799
1821
  var DeviceInvitationProtocol = class {
1800
1822
  constructor(_keyring, _getIdentity, _acceptIdentity) {
1801
1823
  this._keyring = _keyring;
@@ -1821,7 +1843,7 @@ var DeviceInvitationProtocol = class {
1821
1843
  }
1822
1844
  async admit(_, request) {
1823
1845
  (0, import_invariant5.invariant)(request.device, void 0, {
1824
- F: __dxlog_file7,
1846
+ F: __dxlog_file8,
1825
1847
  L: 50,
1826
1848
  S: this,
1827
1849
  A: [
@@ -1867,7 +1889,7 @@ var DeviceInvitationProtocol = class {
1867
1889
  }
1868
1890
  async accept(response, request) {
1869
1891
  (0, import_invariant5.invariant)(response.device, void 0, {
1870
- F: __dxlog_file7,
1892
+ F: __dxlog_file8,
1871
1893
  L: 95,
1872
1894
  S: this,
1873
1895
  A: [
@@ -1877,7 +1899,7 @@ var DeviceInvitationProtocol = class {
1877
1899
  });
1878
1900
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1879
1901
  (0, import_invariant5.invariant)(request.device, void 0, {
1880
- F: __dxlog_file7,
1902
+ F: __dxlog_file8,
1881
1903
  L: 98,
1882
1904
  S: this,
1883
1905
  A: [
@@ -1916,7 +1938,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
1916
1938
  return guard;
1917
1939
  })());
1918
1940
  };
1919
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1941
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1920
1942
  var OPTIONS_TIMEOUT = 1e4;
1921
1943
  var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1922
1944
  constructor(_invitationFlowMutex, _callbacks) {
@@ -1930,7 +1952,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1930
1952
  });
1931
1953
  this._invitationFlowMutex = _invitationFlowMutex;
1932
1954
  this._callbacks = _callbacks;
1933
- this._ctx = new import_context6.Context();
1955
+ this._ctx = new import_context6.Context(void 0, {
1956
+ F: __dxlog_file9,
1957
+ L: 33
1958
+ });
1934
1959
  this._remoteOptionsTrigger = new import_async10.Trigger();
1935
1960
  this._invitationFlowLock = null;
1936
1961
  }
@@ -1942,7 +1967,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1942
1967
  InvitationHostService: {
1943
1968
  options: async (options) => {
1944
1969
  (0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
1945
- F: __dxlog_file8,
1970
+ F: __dxlog_file9,
1946
1971
  L: 63,
1947
1972
  S: this,
1948
1973
  A: [
@@ -1969,14 +1994,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1969
1994
  await super.onOpen(context);
1970
1995
  try {
1971
1996
  (0, import_log7.log)("guest acquire lock", void 0, {
1972
- F: __dxlog_file8,
1997
+ F: __dxlog_file9,
1973
1998
  L: 84,
1974
1999
  S: this,
1975
2000
  C: (f, a) => f(...a)
1976
2001
  });
1977
2002
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
1978
2003
  (0, import_log7.log)("guest lock acquired", void 0, {
1979
- F: __dxlog_file8,
2004
+ F: __dxlog_file9,
1980
2005
  L: 86,
1981
2006
  S: this,
1982
2007
  C: (f, a) => f(...a)
@@ -1985,7 +2010,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1985
2010
  role: import_invitations3.Options.Role.GUEST
1986
2011
  }));
1987
2012
  (0, import_log7.log)("options sent", void 0, {
1988
- F: __dxlog_file8,
2013
+ F: __dxlog_file9,
1989
2014
  L: 88,
1990
2015
  S: this,
1991
2016
  C: (f, a) => f(...a)
@@ -1994,7 +2019,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1994
2019
  timeout: OPTIONS_TIMEOUT
1995
2020
  }));
1996
2021
  (0, import_log7.log)("options received", void 0, {
1997
- F: __dxlog_file8,
2022
+ F: __dxlog_file9,
1998
2023
  L: 90,
1999
2024
  S: this,
2000
2025
  C: (f, a) => f(...a)
@@ -2028,7 +2053,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
2028
2053
  this._invitationFlowLock.release();
2029
2054
  this._invitationFlowLock = null;
2030
2055
  (0, import_log7.log)("invitation flow lock released", void 0, {
2031
- F: __dxlog_file8,
2056
+ F: __dxlog_file9,
2032
2057
  L: 123,
2033
2058
  S: this,
2034
2059
  C: (f, a) => f(...a)
@@ -2036,7 +2061,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
2036
2061
  }
2037
2062
  }
2038
2063
  };
2039
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
2064
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
2040
2065
  var OPTIONS_TIMEOUT2 = 1e4;
2041
2066
  var MAX_OTP_ATTEMPTS = 3;
2042
2067
  var InvitationHostExtension = class extends import_teleport2.RpcExtension {
@@ -2051,7 +2076,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2051
2076
  });
2052
2077
  this._invitationFlowMutex = _invitationFlowMutex;
2053
2078
  this._callbacks = _callbacks;
2054
- this._ctx = new import_context8.Context();
2079
+ this._ctx = new import_context8.Context(void 0, {
2080
+ F: __dxlog_file10,
2081
+ L: 52
2082
+ });
2055
2083
  this._remoteOptionsTrigger = new import_async11.Trigger();
2056
2084
  this._challenge = void 0;
2057
2085
  this.guestProfile = void 0;
@@ -2070,7 +2098,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2070
2098
  InvitationHostService: {
2071
2099
  options: async (options) => {
2072
2100
  (0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
2073
- F: __dxlog_file9,
2101
+ F: __dxlog_file10,
2074
2102
  L: 101,
2075
2103
  S: this,
2076
2104
  A: [
@@ -2087,7 +2115,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2087
2115
  import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
2088
2116
  id: traceId
2089
2117
  }), {
2090
- F: __dxlog_file9,
2118
+ F: __dxlog_file10,
2091
2119
  L: 110,
2092
2120
  S: this,
2093
2121
  C: (f, a) => f(...a)
@@ -2099,7 +2127,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2099
2127
  expected: invitation.invitationId,
2100
2128
  actual: invitationId
2101
2129
  }, {
2102
- F: __dxlog_file9,
2130
+ F: __dxlog_file10,
2103
2131
  L: 116,
2104
2132
  S: this,
2105
2133
  C: (f, a) => f(...a)
@@ -2113,7 +2141,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2113
2141
  (0, import_log8.log)("guest introduced themselves", {
2114
2142
  guestProfile: profile
2115
2143
  }, {
2116
- F: __dxlog_file9,
2144
+ F: __dxlog_file10,
2117
2145
  L: 125,
2118
2146
  S: this,
2119
2147
  C: (f, a) => f(...a)
@@ -2124,7 +2152,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2124
2152
  import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
2125
2153
  id: traceId
2126
2154
  }), {
2127
- F: __dxlog_file9,
2155
+ F: __dxlog_file10,
2128
2156
  L: 132,
2129
2157
  S: this,
2130
2158
  C: (f, a) => f(...a)
@@ -2139,7 +2167,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2139
2167
  import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
2140
2168
  id: traceId
2141
2169
  }), {
2142
- F: __dxlog_file9,
2170
+ F: __dxlog_file10,
2143
2171
  L: 141,
2144
2172
  S: this,
2145
2173
  C: (f, a) => f(...a)
@@ -2148,7 +2176,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2148
2176
  (0, import_log8.log)("received authentication request", {
2149
2177
  authCode: code
2150
2178
  }, {
2151
- F: __dxlog_file9,
2179
+ F: __dxlog_file10,
2152
2180
  L: 144,
2153
2181
  S: this,
2154
2182
  C: (f, a) => f(...a)
@@ -2162,7 +2190,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2162
2190
  switch (invitation.authMethod) {
2163
2191
  case import_services8.Invitation.AuthMethod.NONE: {
2164
2192
  (0, import_log8.log)("authentication not required", void 0, {
2165
- F: __dxlog_file9,
2193
+ F: __dxlog_file10,
2166
2194
  L: 152,
2167
2195
  S: this,
2168
2196
  C: (f, a) => f(...a)
@@ -2200,7 +2228,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2200
2228
  import_log8.log.error("invalid authentication method", {
2201
2229
  authMethod: invitation.authMethod
2202
2230
  }, {
2203
- F: __dxlog_file9,
2231
+ F: __dxlog_file10,
2204
2232
  L: 190,
2205
2233
  S: this,
2206
2234
  C: (f, a) => f(...a)
@@ -2225,7 +2253,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2225
2253
  status
2226
2254
  }
2227
2255
  }), {
2228
- F: __dxlog_file9,
2256
+ F: __dxlog_file10,
2229
2257
  L: 202,
2230
2258
  S: this,
2231
2259
  C: (f, a) => f(...a)
@@ -2239,7 +2267,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2239
2267
  import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
2240
2268
  id: traceId
2241
2269
  }), {
2242
- F: __dxlog_file9,
2270
+ F: __dxlog_file10,
2243
2271
  L: 208,
2244
2272
  S: this,
2245
2273
  C: (f, a) => f(...a)
@@ -2256,7 +2284,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2256
2284
  import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
2257
2285
  id: traceId
2258
2286
  }), {
2259
- F: __dxlog_file9,
2287
+ F: __dxlog_file10,
2260
2288
  L: 222,
2261
2289
  S: this,
2262
2290
  C: (f, a) => f(...a)
@@ -2274,14 +2302,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2274
2302
  await super.onOpen(context);
2275
2303
  try {
2276
2304
  (0, import_log8.log)("host acquire lock", void 0, {
2277
- F: __dxlog_file9,
2305
+ F: __dxlog_file10,
2278
2306
  L: 237,
2279
2307
  S: this,
2280
2308
  C: (f, a) => f(...a)
2281
2309
  });
2282
2310
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
2283
2311
  (0, import_log8.log)("host lock acquired", void 0, {
2284
- F: __dxlog_file9,
2312
+ F: __dxlog_file10,
2285
2313
  L: 239,
2286
2314
  S: this,
2287
2315
  C: (f, a) => f(...a)
@@ -2292,7 +2320,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2292
2320
  role: import_invitations4.Options.Role.HOST
2293
2321
  });
2294
2322
  (0, import_log8.log)("options sent", void 0, {
2295
- F: __dxlog_file9,
2323
+ F: __dxlog_file10,
2296
2324
  L: 243,
2297
2325
  S: this,
2298
2326
  C: (f, a) => f(...a)
@@ -2301,7 +2329,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2301
2329
  timeout: OPTIONS_TIMEOUT2
2302
2330
  }));
2303
2331
  (0, import_log8.log)("options received", void 0, {
2304
- F: __dxlog_file9,
2332
+ F: __dxlog_file10,
2305
2333
  L: 245,
2306
2334
  S: this,
2307
2335
  C: (f, a) => f(...a)
@@ -2355,7 +2383,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2355
2383
  this._invitationFlowLock?.release();
2356
2384
  this._invitationFlowLock = null;
2357
2385
  (0, import_log8.log)("invitation flow lock released", void 0, {
2358
- F: __dxlog_file9,
2386
+ F: __dxlog_file10,
2359
2387
  L: 300,
2360
2388
  S: this,
2361
2389
  C: (f, a) => f(...a)
@@ -2364,7 +2392,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2364
2392
  }
2365
2393
  };
2366
2394
  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";
2395
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2368
2396
  var InvitationTopology = class {
2369
2397
  constructor(_role) {
2370
2398
  this._role = _role;
@@ -2372,7 +2400,7 @@ var InvitationTopology = class {
2372
2400
  }
2373
2401
  init(controller) {
2374
2402
  (0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
2375
- F: __dxlog_file10,
2403
+ F: __dxlog_file11,
2376
2404
  L: 42,
2377
2405
  S: this,
2378
2406
  A: [
@@ -2384,7 +2412,7 @@ var InvitationTopology = class {
2384
2412
  }
2385
2413
  update() {
2386
2414
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2387
- F: __dxlog_file10,
2415
+ F: __dxlog_file11,
2388
2416
  L: 47,
2389
2417
  S: this,
2390
2418
  A: [
@@ -2407,7 +2435,7 @@ var InvitationTopology = class {
2407
2435
  ownPeerId,
2408
2436
  remotePeerId: firstUnknownPeer
2409
2437
  }, {
2410
- F: __dxlog_file10,
2438
+ F: __dxlog_file11,
2411
2439
  L: 69,
2412
2440
  S: this,
2413
2441
  C: (f, a) => f(...a)
@@ -2418,7 +2446,7 @@ var InvitationTopology = class {
2418
2446
  }
2419
2447
  async onOffer(peer) {
2420
2448
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2421
- F: __dxlog_file10,
2449
+ F: __dxlog_file11,
2422
2450
  L: 76,
2423
2451
  S: this,
2424
2452
  A: [
@@ -2435,7 +2463,7 @@ var InvitationTopology = class {
2435
2463
  return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
2436
2464
  }
2437
2465
  };
2438
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2466
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2439
2467
  var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
2440
2468
  var InvitationsHandler = class {
2441
2469
  /**
@@ -2460,7 +2488,7 @@ var InvitationsHandler = class {
2460
2488
  try {
2461
2489
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
2462
2490
  (0, import_invariant6.invariant)(deviceKey, void 0, {
2463
- F: __dxlog_file11,
2491
+ F: __dxlog_file12,
2464
2492
  L: 90,
2465
2493
  S: this,
2466
2494
  A: [
@@ -2489,7 +2517,7 @@ var InvitationsHandler = class {
2489
2517
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
2490
2518
  id: traceId
2491
2519
  }), {
2492
- F: __dxlog_file11,
2520
+ F: __dxlog_file12,
2493
2521
  L: 115,
2494
2522
  S: this,
2495
2523
  C: (f, a) => f(...a)
@@ -2497,7 +2525,7 @@ var InvitationsHandler = class {
2497
2525
  (0, import_log6.log)("connected", {
2498
2526
  ...protocol.toJSON()
2499
2527
  }, {
2500
- F: __dxlog_file11,
2528
+ F: __dxlog_file12,
2501
2529
  L: 116,
2502
2530
  S: this,
2503
2531
  C: (f, a) => f(...a)
@@ -2509,7 +2537,7 @@ var InvitationsHandler = class {
2509
2537
  guest: deviceKey,
2510
2538
  ...protocol.toJSON()
2511
2539
  }, {
2512
- F: __dxlog_file11,
2540
+ F: __dxlog_file12,
2513
2541
  L: 118,
2514
2542
  S: this,
2515
2543
  C: (f, a) => f(...a)
@@ -2518,7 +2546,7 @@ var InvitationsHandler = class {
2518
2546
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
2519
2547
  id: traceId
2520
2548
  }), {
2521
- F: __dxlog_file11,
2549
+ F: __dxlog_file12,
2522
2550
  L: 120,
2523
2551
  S: this,
2524
2552
  C: (f, a) => f(...a)
@@ -2533,7 +2561,7 @@ var InvitationsHandler = class {
2533
2561
  (0, import_log6.log)("timeout", {
2534
2562
  ...protocol.toJSON()
2535
2563
  }, {
2536
- F: __dxlog_file11,
2564
+ F: __dxlog_file12,
2537
2565
  L: 129,
2538
2566
  S: this,
2539
2567
  C: (f, a) => f(...a)
@@ -2542,7 +2570,7 @@ var InvitationsHandler = class {
2542
2570
  } else {
2543
2571
  if (guardedState.error(extension, err)) {
2544
2572
  import_log6.log.error("failed", err, {
2545
- F: __dxlog_file11,
2573
+ F: __dxlog_file12,
2546
2574
  L: 133,
2547
2575
  S: this,
2548
2576
  C: (f, a) => f(...a)
@@ -2553,7 +2581,7 @@ var InvitationsHandler = class {
2553
2581
  id: traceId,
2554
2582
  error: err
2555
2583
  }), {
2556
- F: __dxlog_file11,
2584
+ F: __dxlog_file12,
2557
2585
  L: 136,
2558
2586
  S: this,
2559
2587
  C: (f, a) => f(...a)
@@ -2567,7 +2595,7 @@ var InvitationsHandler = class {
2567
2595
  (0, import_log6.log)("invalid role", {
2568
2596
  ...err.context
2569
2597
  }, {
2570
- F: __dxlog_file11,
2598
+ F: __dxlog_file12,
2571
2599
  L: 144,
2572
2600
  S: this,
2573
2601
  C: (f, a) => f(...a)
@@ -2579,7 +2607,7 @@ var InvitationsHandler = class {
2579
2607
  (0, import_log6.log)("timeout", {
2580
2608
  err
2581
2609
  }, {
2582
- F: __dxlog_file11,
2610
+ F: __dxlog_file12,
2583
2611
  L: 149,
2584
2612
  S: this,
2585
2613
  C: (f, a) => f(...a)
@@ -2588,7 +2616,7 @@ var InvitationsHandler = class {
2588
2616
  } else {
2589
2617
  if (guardedState.error(extension, err)) {
2590
2618
  import_log6.log.error("failed", err, {
2591
- F: __dxlog_file11,
2619
+ F: __dxlog_file12,
2592
2620
  L: 153,
2593
2621
  S: this,
2594
2622
  C: (f, a) => f(...a)
@@ -2602,7 +2630,7 @@ var InvitationsHandler = class {
2602
2630
  if (invitation.lifetime && invitation.created) {
2603
2631
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2604
2632
  import_log6.log.warn("invitation has already expired", void 0, {
2605
- F: __dxlog_file11,
2633
+ F: __dxlog_file12,
2606
2634
  L: 164,
2607
2635
  S: this,
2608
2636
  C: (f, a) => f(...a)
@@ -2625,7 +2653,7 @@ var InvitationsHandler = class {
2625
2653
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
2626
2654
  if (deviceProfile) {
2627
2655
  (0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2628
- F: __dxlog_file11,
2656
+ F: __dxlog_file12,
2629
2657
  L: 197,
2630
2658
  S: this,
2631
2659
  A: [
@@ -2643,7 +2671,7 @@ var InvitationsHandler = class {
2643
2671
  invitationType: import_services6.Invitation.Type.DELEGATED,
2644
2672
  triedPeers: triedPeersIds.size
2645
2673
  }, {
2646
- F: __dxlog_file11,
2674
+ F: __dxlog_file12,
2647
2675
  L: 205,
2648
2676
  S: this,
2649
2677
  C: (f, a) => f(...a)
@@ -2670,7 +2698,7 @@ var InvitationsHandler = class {
2670
2698
  admitted,
2671
2699
  currentState: guardedState.current.state
2672
2700
  }, {
2673
- F: __dxlog_file11,
2701
+ F: __dxlog_file12,
2674
2702
  L: 233,
2675
2703
  S: this,
2676
2704
  C: (f, a) => f(...a)
@@ -2688,7 +2716,7 @@ var InvitationsHandler = class {
2688
2716
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
2689
2717
  id: traceId
2690
2718
  }), {
2691
- F: __dxlog_file11,
2719
+ F: __dxlog_file12,
2692
2720
  L: 245,
2693
2721
  S: this,
2694
2722
  C: (f, a) => f(...a)
@@ -2700,7 +2728,7 @@ var InvitationsHandler = class {
2700
2728
  (0, import_log6.log)("connected", {
2701
2729
  ...protocol.toJSON()
2702
2730
  }, {
2703
- F: __dxlog_file11,
2731
+ F: __dxlog_file12,
2704
2732
  L: 256,
2705
2733
  S: this,
2706
2734
  C: (f, a) => f(...a)
@@ -2709,7 +2737,7 @@ var InvitationsHandler = class {
2709
2737
  (0, import_log6.log)("introduce", {
2710
2738
  ...protocol.toJSON()
2711
2739
  }, {
2712
- F: __dxlog_file11,
2740
+ F: __dxlog_file12,
2713
2741
  L: 260,
2714
2742
  S: this,
2715
2743
  C: (f, a) => f(...a)
@@ -2722,7 +2750,7 @@ var InvitationsHandler = class {
2722
2750
  ...protocol.toJSON(),
2723
2751
  response: introductionResponse
2724
2752
  }, {
2725
- F: __dxlog_file11,
2753
+ F: __dxlog_file12,
2726
2754
  L: 265,
2727
2755
  S: this,
2728
2756
  C: (f, a) => f(...a)
@@ -2743,7 +2771,7 @@ var InvitationsHandler = class {
2743
2771
  (0, import_log6.log)("request admission", {
2744
2772
  ...protocol.toJSON()
2745
2773
  }, {
2746
- F: __dxlog_file11,
2774
+ F: __dxlog_file12,
2747
2775
  L: 291,
2748
2776
  S: this,
2749
2777
  C: (f, a) => f(...a)
@@ -2755,7 +2783,7 @@ var InvitationsHandler = class {
2755
2783
  (0, import_log6.log)("admitted by host", {
2756
2784
  ...protocol.toJSON()
2757
2785
  }, {
2758
- F: __dxlog_file11,
2786
+ F: __dxlog_file12,
2759
2787
  L: 302,
2760
2788
  S: this,
2761
2789
  C: (f, a) => f(...a)
@@ -2768,7 +2796,7 @@ var InvitationsHandler = class {
2768
2796
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
2769
2797
  id: traceId
2770
2798
  }), {
2771
- F: __dxlog_file11,
2799
+ F: __dxlog_file12,
2772
2800
  L: 308,
2773
2801
  S: this,
2774
2802
  C: (f, a) => f(...a)
@@ -2778,7 +2806,7 @@ var InvitationsHandler = class {
2778
2806
  (0, import_log6.log)("timeout", {
2779
2807
  ...protocol.toJSON()
2780
2808
  }, {
2781
- F: __dxlog_file11,
2809
+ F: __dxlog_file12,
2782
2810
  L: 311,
2783
2811
  S: this,
2784
2812
  C: (f, a) => f(...a)
@@ -2786,7 +2814,7 @@ var InvitationsHandler = class {
2786
2814
  guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2787
2815
  } else {
2788
2816
  (0, import_log6.log)("auth failed", err, {
2789
- F: __dxlog_file11,
2817
+ F: __dxlog_file12,
2790
2818
  L: 314,
2791
2819
  S: this,
2792
2820
  C: (f, a) => f(...a)
@@ -2798,7 +2826,7 @@ var InvitationsHandler = class {
2798
2826
  id: traceId,
2799
2827
  error: err
2800
2828
  }), {
2801
- F: __dxlog_file11,
2829
+ F: __dxlog_file12,
2802
2830
  L: 318,
2803
2831
  S: this,
2804
2832
  C: (f, a) => f(...a)
@@ -2814,7 +2842,7 @@ var InvitationsHandler = class {
2814
2842
  (0, import_log6.log)("timeout", {
2815
2843
  ...protocol.toJSON()
2816
2844
  }, {
2817
- F: __dxlog_file11,
2845
+ F: __dxlog_file12,
2818
2846
  L: 327,
2819
2847
  S: this,
2820
2848
  C: (f, a) => f(...a)
@@ -2822,7 +2850,7 @@ var InvitationsHandler = class {
2822
2850
  guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2823
2851
  } else {
2824
2852
  (0, import_log6.log)("auth failed", err, {
2825
- F: __dxlog_file11,
2853
+ F: __dxlog_file12,
2826
2854
  L: 330,
2827
2855
  S: this,
2828
2856
  C: (f, a) => f(...a)
@@ -2840,7 +2868,7 @@ var InvitationsHandler = class {
2840
2868
  await ctx.dispose();
2841
2869
  } else {
2842
2870
  (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2843
- F: __dxlog_file11,
2871
+ F: __dxlog_file12,
2844
2872
  L: 345,
2845
2873
  S: this,
2846
2874
  A: [
@@ -2934,16 +2962,29 @@ var InvitationsHandler = class {
2934
2962
  };
2935
2963
  }
2936
2964
  _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
- });
2965
+ if (this._isNotTerminal(newState)) {
2966
+ (0, import_log6.log)("invitation state update", {
2967
+ actor: actor?.constructor.name,
2968
+ newState: stateToString(newState),
2969
+ oldState: stateToString(invitation.state)
2970
+ }, {
2971
+ F: __dxlog_file12,
2972
+ L: 439,
2973
+ S: this,
2974
+ C: (f, a) => f(...a)
2975
+ });
2976
+ } else {
2977
+ import_log6.log.info("invitation state update", {
2978
+ actor: actor?.constructor.name,
2979
+ newState: stateToString(newState),
2980
+ oldState: stateToString(invitation.state)
2981
+ }, {
2982
+ F: __dxlog_file12,
2983
+ L: 445,
2984
+ S: this,
2985
+ C: (f, a) => f(...a)
2986
+ });
2987
+ }
2947
2988
  }
2948
2989
  _isNotTerminal(currentState) {
2949
2990
  return ![
@@ -2957,16 +2998,16 @@ var InvitationsHandler = class {
2957
2998
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2958
2999
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2959
3000
  (0, import_log6.log)("guest waiting for authentication code...", void 0, {
2960
- F: __dxlog_file11,
2961
- L: 462,
3001
+ F: __dxlog_file12,
3002
+ L: 470,
2962
3003
  S: this,
2963
3004
  C: (f, a) => f(...a)
2964
3005
  });
2965
3006
  setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
2966
3007
  const authCode = await authenticated.wait(options);
2967
3008
  (0, import_log6.log)("sending authentication request", void 0, {
2968
- F: __dxlog_file11,
2969
- L: 466,
3009
+ F: __dxlog_file12,
3010
+ L: 474,
2970
3011
  S: this,
2971
3012
  C: (f, a) => f(...a)
2972
3013
  });
@@ -2984,8 +3025,8 @@ var InvitationsHandler = class {
2984
3025
  (0, import_log6.log)("retrying invalid code", {
2985
3026
  attempt
2986
3027
  }, {
2987
- F: __dxlog_file11,
2988
- L: 477,
3028
+ F: __dxlog_file12,
3029
+ L: 485,
2989
3030
  S: this,
2990
3031
  C: (f, a) => f(...a)
2991
3032
  });
@@ -3002,8 +3043,8 @@ var InvitationsHandler = class {
3002
3043
  throw new Error("challenge missing in the introduction");
3003
3044
  }
3004
3045
  (0, import_log6.log)("sending authentication request", void 0, {
3005
- F: __dxlog_file11,
3006
- L: 496,
3046
+ F: __dxlog_file12,
3047
+ L: 504,
3007
3048
  S: this,
3008
3049
  C: (f, a) => f(...a)
3009
3050
  });
@@ -3117,7 +3158,7 @@ var InvitationsServiceImpl = class {
3117
3158
  });
3118
3159
  }
3119
3160
  };
3120
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3161
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3121
3162
  var SpaceInvitationProtocol = class {
3122
3163
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
3123
3164
  this._spaceManager = _spaceManager;
@@ -3151,79 +3192,43 @@ var SpaceInvitationProtocol = class {
3151
3192
  };
3152
3193
  }
3153
3194
  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,
3195
+ (0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
3196
+ F: __dxlog_file13,
3197
+ L: 74,
3176
3198
  S: this,
3177
3199
  A: [
3178
- "request.space",
3200
+ "this._spaceKey && request.space",
3179
3201
  ""
3180
3202
  ]
3181
3203
  });
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
3204
  (0, import_log10.log)("writing guest credentials", {
3187
3205
  host: this._signingContext.deviceKey,
3188
- guest: deviceKey
3206
+ guest: request.space.deviceKey
3189
3207
  }, {
3190
- F: __dxlog_file12,
3191
- L: 87,
3208
+ F: __dxlog_file13,
3209
+ L: 75,
3192
3210
  S: this,
3193
3211
  C: (f, a) => f(...a)
3194
3212
  });
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
- ]
3213
+ const spaceMemberCredential = await this._spaceManager.admitMember({
3214
+ spaceKey: this._spaceKey,
3215
+ identityKey: request.space.identityKey,
3216
+ role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
3217
+ profile: guestProfile,
3218
+ delegationCredentialId: invitation.delegationCredentialId
3214
3219
  });
3215
- await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
3220
+ const space = this._spaceManager.spaces.get(this._spaceKey);
3216
3221
  return {
3217
3222
  space: {
3218
3223
  credential: spaceMemberCredential,
3219
- controlTimeframe: space.inner.controlPipeline.state.timeframe
3224
+ controlTimeframe: space?.inner.controlPipeline.state.timeframe
3220
3225
  }
3221
3226
  };
3222
3227
  }
3223
3228
  async delegate(invitation) {
3224
3229
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3225
- F: __dxlog_file12,
3226
- L: 116,
3230
+ F: __dxlog_file13,
3231
+ L: 95,
3227
3232
  S: this,
3228
3233
  A: [
3229
3234
  "this._spaceKey",
@@ -3232,8 +3237,8 @@ var SpaceInvitationProtocol = class {
3232
3237
  });
3233
3238
  const space = this._spaceManager.spaces.get(this._spaceKey);
3234
3239
  (0, import_invariant10.invariant)(space, void 0, {
3235
- F: __dxlog_file12,
3236
- L: 118,
3240
+ F: __dxlog_file13,
3241
+ L: 97,
3237
3242
  S: this,
3238
3243
  A: [
3239
3244
  "space",
@@ -3242,8 +3247,8 @@ var SpaceInvitationProtocol = class {
3242
3247
  });
3243
3248
  if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
3244
3249
  (0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
3245
- F: __dxlog_file12,
3246
- L: 120,
3250
+ F: __dxlog_file13,
3251
+ L: 99,
3247
3252
  S: this,
3248
3253
  A: [
3249
3254
  "invitation.guestKeypair?.publicKey",
@@ -3255,8 +3260,8 @@ var SpaceInvitationProtocol = class {
3255
3260
  host: this._signingContext.deviceKey,
3256
3261
  id: invitation.invitationId
3257
3262
  }, {
3258
- F: __dxlog_file12,
3259
- L: 123,
3263
+ F: __dxlog_file13,
3264
+ L: 102,
3260
3265
  S: this,
3261
3266
  C: (f, a) => f(...a)
3262
3267
  });
@@ -3270,8 +3275,8 @@ var SpaceInvitationProtocol = class {
3270
3275
  guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
3271
3276
  });
3272
3277
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3273
- F: __dxlog_file12,
3274
- L: 143,
3278
+ F: __dxlog_file13,
3279
+ L: 122,
3275
3280
  S: this,
3276
3281
  A: [
3277
3282
  "credential.credential",
@@ -3285,8 +3290,8 @@ var SpaceInvitationProtocol = class {
3285
3290
  }
3286
3291
  async cancelDelegation(invitation) {
3287
3292
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3288
- F: __dxlog_file12,
3289
- L: 149,
3293
+ F: __dxlog_file13,
3294
+ L: 128,
3290
3295
  S: this,
3291
3296
  A: [
3292
3297
  "this._spaceKey",
@@ -3294,8 +3299,8 @@ var SpaceInvitationProtocol = class {
3294
3299
  ]
3295
3300
  });
3296
3301
  (0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
3297
- F: __dxlog_file12,
3298
- L: 150,
3302
+ F: __dxlog_file13,
3303
+ L: 129,
3299
3304
  S: this,
3300
3305
  A: [
3301
3306
  "invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
@@ -3304,8 +3309,8 @@ var SpaceInvitationProtocol = class {
3304
3309
  });
3305
3310
  const space = this._spaceManager.spaces.get(this._spaceKey);
3306
3311
  (0, import_invariant10.invariant)(space, void 0, {
3307
- F: __dxlog_file12,
3308
- L: 152,
3312
+ F: __dxlog_file13,
3313
+ L: 131,
3309
3314
  S: this,
3310
3315
  A: [
3311
3316
  "space",
@@ -3316,15 +3321,15 @@ var SpaceInvitationProtocol = class {
3316
3321
  host: this._signingContext.deviceKey,
3317
3322
  id: invitation.invitationId
3318
3323
  }, {
3319
- F: __dxlog_file12,
3320
- L: 154,
3324
+ F: __dxlog_file13,
3325
+ L: 133,
3321
3326
  S: this,
3322
3327
  C: (f, a) => f(...a)
3323
3328
  });
3324
3329
  const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
3325
3330
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3326
- F: __dxlog_file12,
3327
- L: 161,
3331
+ F: __dxlog_file13,
3332
+ L: 140,
3328
3333
  S: this,
3329
3334
  A: [
3330
3335
  "credential.credential",
@@ -3362,8 +3367,8 @@ var SpaceInvitationProtocol = class {
3362
3367
  }
3363
3368
  async accept(response) {
3364
3369
  (0, import_invariant10.invariant)(response.space, void 0, {
3365
- F: __dxlog_file12,
3366
- L: 196,
3370
+ F: __dxlog_file13,
3371
+ L: 175,
3367
3372
  S: this,
3368
3373
  A: [
3369
3374
  "response.space",
@@ -3373,8 +3378,8 @@ var SpaceInvitationProtocol = class {
3373
3378
  const { credential, controlTimeframe, dataTimeframe } = response.space;
3374
3379
  const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
3375
3380
  (0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3376
- F: __dxlog_file12,
3377
- L: 199,
3381
+ F: __dxlog_file13,
3382
+ L: 178,
3378
3383
  S: this,
3379
3384
  A: [
3380
3385
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3382,8 +3387,8 @@ var SpaceInvitationProtocol = class {
3382
3387
  ]
3383
3388
  });
3384
3389
  (0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
3385
- F: __dxlog_file12,
3386
- L: 200,
3390
+ F: __dxlog_file13,
3391
+ L: 179,
3387
3392
  S: this,
3388
3393
  A: [
3389
3394
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -3405,7 +3410,7 @@ var SpaceInvitationProtocol = class {
3405
3410
  };
3406
3411
  }
3407
3412
  };
3408
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3413
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3409
3414
  var InvitationsManager = class {
3410
3415
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
3411
3416
  this._invitationsHandler = _invitationsHandler;
@@ -3448,7 +3453,7 @@ var InvitationsManager = class {
3448
3453
  await this._persistIfRequired(handler, stream, invitation);
3449
3454
  } catch (err) {
3450
3455
  import_log11.log.catch(err, void 0, {
3451
- F: __dxlog_file13,
3456
+ F: __dxlog_file14,
3452
3457
  L: 82,
3453
3458
  S: this,
3454
3459
  C: (f, a) => f(...a)
@@ -3471,7 +3476,7 @@ var InvitationsManager = class {
3471
3476
  const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
3472
3477
  const loadTasks = freshInvitations.map((persistentInvitation) => {
3473
3478
  (0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
3474
- F: __dxlog_file13,
3479
+ F: __dxlog_file14,
3475
3480
  L: 103,
3476
3481
  S: this,
3477
3482
  A: [
@@ -3490,7 +3495,7 @@ var InvitationsManager = class {
3490
3495
  };
3491
3496
  } catch (err) {
3492
3497
  import_log11.log.catch(err, void 0, {
3493
- F: __dxlog_file13,
3498
+ F: __dxlog_file14,
3494
3499
  L: 110,
3495
3500
  S: this,
3496
3501
  C: (f, a) => f(...a)
@@ -3522,13 +3527,13 @@ var InvitationsManager = class {
3522
3527
  }
3523
3528
  async authenticate({ invitationId, authCode }) {
3524
3529
  (0, import_log11.log)("authenticating...", void 0, {
3525
- F: __dxlog_file13,
3530
+ F: __dxlog_file14,
3526
3531
  L: 140,
3527
3532
  S: this,
3528
3533
  C: (f, a) => f(...a)
3529
3534
  });
3530
3535
  (0, import_invariant11.invariant)(invitationId, void 0, {
3531
- F: __dxlog_file13,
3536
+ F: __dxlog_file14,
3532
3537
  L: 141,
3533
3538
  S: this,
3534
3539
  A: [
@@ -3541,7 +3546,7 @@ var InvitationsManager = class {
3541
3546
  import_log11.log.warn("invalid invitation", {
3542
3547
  invitationId
3543
3548
  }, {
3544
- F: __dxlog_file13,
3549
+ F: __dxlog_file14,
3545
3550
  L: 144,
3546
3551
  S: this,
3547
3552
  C: (f, a) => f(...a)
@@ -3554,13 +3559,13 @@ var InvitationsManager = class {
3554
3559
  (0, import_log11.log)("cancelInvitation...", {
3555
3560
  invitationId
3556
3561
  }, {
3557
- F: __dxlog_file13,
3562
+ F: __dxlog_file14,
3558
3563
  L: 151,
3559
3564
  S: this,
3560
3565
  C: (f, a) => f(...a)
3561
3566
  });
3562
3567
  (0, import_invariant11.invariant)(invitationId, void 0, {
3563
- F: __dxlog_file13,
3568
+ F: __dxlog_file14,
3564
3569
  L: 152,
3565
3570
  S: this,
3566
3571
  A: [
@@ -3634,12 +3639,15 @@ var InvitationsManager = class {
3634
3639
  stream.error(err);
3635
3640
  void ctx.dispose();
3636
3641
  }
3642
+ }, {
3643
+ F: __dxlog_file14,
3644
+ L: 234
3637
3645
  });
3638
3646
  ctx.onDispose(() => {
3639
3647
  (0, import_log11.log)("complete", {
3640
3648
  ...handler.toJSON()
3641
3649
  }, {
3642
- F: __dxlog_file13,
3650
+ F: __dxlog_file14,
3643
3651
  L: 241,
3644
3652
  S: this,
3645
3653
  C: (f, a) => f(...a)
@@ -3672,7 +3680,7 @@ var InvitationsManager = class {
3672
3680
  (0, import_log11.log)("timeout", {
3673
3681
  ...handler.toJSON()
3674
3682
  }, {
3675
- F: __dxlog_file13,
3683
+ F: __dxlog_file14,
3676
3684
  L: 261,
3677
3685
  S: this,
3678
3686
  C: (f, a) => f(...a)
@@ -3683,7 +3691,7 @@ var InvitationsManager = class {
3683
3691
  });
3684
3692
  } else {
3685
3693
  import_log11.log.warn("auth failed", err, {
3686
- F: __dxlog_file13,
3694
+ F: __dxlog_file14,
3687
3695
  L: 264,
3688
3696
  S: this,
3689
3697
  C: (f, a) => f(...a)
@@ -3695,12 +3703,15 @@ var InvitationsManager = class {
3695
3703
  }
3696
3704
  void ctx.dispose();
3697
3705
  }
3706
+ }, {
3707
+ F: __dxlog_file14,
3708
+ L: 258
3698
3709
  });
3699
3710
  ctx.onDispose(() => {
3700
3711
  (0, import_log11.log)("complete", {
3701
3712
  ...handler.toJSON()
3702
3713
  }, {
3703
- F: __dxlog_file13,
3714
+ F: __dxlog_file14,
3704
3715
  L: 271,
3705
3716
  S: this,
3706
3717
  C: (f, a) => f(...a)
@@ -3745,7 +3756,7 @@ var InvitationsManager = class {
3745
3756
  await this._metadataStore.removeInvitation(invitation.invitationId);
3746
3757
  } catch (err) {
3747
3758
  import_log11.log.catch(err, void 0, {
3748
- F: __dxlog_file13,
3759
+ F: __dxlog_file14,
3749
3760
  L: 307,
3750
3761
  S: this,
3751
3762
  C: (f, a) => f(...a)
@@ -3798,7 +3809,7 @@ var AutomergeSpaceState = class extends import_context11.Resource {
3798
3809
  await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
3799
3810
  }
3800
3811
  };
3801
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
3812
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
3802
3813
  var runEpochMigration = async (ctx, context) => {
3803
3814
  switch (context.migration) {
3804
3815
  case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
@@ -3822,7 +3833,7 @@ var runEpochMigration = async (ctx, context) => {
3822
3833
  }
3823
3834
  case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
3824
3835
  import_log13.log.info("Fragmenting", void 0, {
3825
- F: __dxlog_file14,
3836
+ F: __dxlog_file15,
3826
3837
  L: 63,
3827
3838
  S: void 0,
3828
3839
  C: (f, a) => f(...a)
@@ -3834,7 +3845,7 @@ var runEpochMigration = async (ctx, context) => {
3834
3845
  const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
3835
3846
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3836
3847
  (0, import_invariant13.invariant)(properties, "Properties not found", {
3837
- F: __dxlog_file14,
3848
+ F: __dxlog_file15,
3838
3849
  L: 73,
3839
3850
  S: void 0,
3840
3851
  A: [
@@ -3850,7 +3861,7 @@ var runEpochMigration = async (ctx, context) => {
3850
3861
  };
3851
3862
  const newRoot = context.repo.create(newSpaceDoc);
3852
3863
  (0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3853
- F: __dxlog_file14,
3864
+ F: __dxlog_file15,
3854
3865
  L: 78,
3855
3866
  S: void 0,
3856
3867
  A: [
@@ -3881,7 +3892,7 @@ var runEpochMigration = async (ctx, context) => {
3881
3892
  const rootHandle = context.repo.find(currentRootUrl);
3882
3893
  await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
3883
3894
  (0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
3884
- F: __dxlog_file14,
3895
+ F: __dxlog_file15,
3885
3896
  L: 100,
3886
3897
  S: void 0,
3887
3898
  A: [
@@ -3894,7 +3905,7 @@ var runEpochMigration = async (ctx, context) => {
3894
3905
  const handle = context.repo.find(url);
3895
3906
  await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
3896
3907
  (0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
3897
- F: __dxlog_file14,
3908
+ F: __dxlog_file15,
3898
3909
  L: 107,
3899
3910
  S: void 0,
3900
3911
  A: [
@@ -3916,7 +3927,7 @@ var runEpochMigration = async (ctx, context) => {
3916
3927
  }
3917
3928
  case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
3918
3929
  (0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
3919
- F: __dxlog_file14,
3930
+ F: __dxlog_file15,
3920
3931
  L: 124,
3921
3932
  S: void 0,
3922
3933
  A: [
@@ -3932,14 +3943,17 @@ var runEpochMigration = async (ctx, context) => {
3932
3943
  }
3933
3944
  return {};
3934
3945
  };
3935
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3946
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3936
3947
  var DEFAULT_RETRY_TIMEOUT = 1e3;
3937
3948
  var DEFAULT_SUCCESS_DELAY = 1e3;
3938
3949
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
3939
3950
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
3940
3951
  var NotarizationPlugin = class {
3941
3952
  constructor() {
3942
- this._ctx = new import_context13.Context();
3953
+ this._ctx = new import_context13.Context(void 0, {
3954
+ F: __dxlog_file16,
3955
+ L: 62
3956
+ });
3943
3957
  this._extensionOpened = new import_async16.Event();
3944
3958
  this._extensions = /* @__PURE__ */ new Set();
3945
3959
  this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
@@ -3960,13 +3974,13 @@ var NotarizationPlugin = class {
3960
3974
  (0, import_log14.log)("notarize", {
3961
3975
  credentials
3962
3976
  }, {
3963
- F: __dxlog_file15,
3977
+ F: __dxlog_file16,
3964
3978
  L: 90,
3965
3979
  S: this,
3966
3980
  C: (f, a) => f(...a)
3967
3981
  });
3968
3982
  (0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
3969
- F: __dxlog_file15,
3983
+ F: __dxlog_file16,
3970
3984
  L: 91,
3971
3985
  S: this,
3972
3986
  A: [
@@ -3980,7 +3994,7 @@ var NotarizationPlugin = class {
3980
3994
  import_log14.log.warn("Notarization error", {
3981
3995
  err
3982
3996
  }, {
3983
- F: __dxlog_file15,
3997
+ F: __dxlog_file16,
3984
3998
  L: 99,
3985
3999
  S: this,
3986
4000
  C: (f, a) => f(...a)
@@ -3996,7 +4010,7 @@ var NotarizationPlugin = class {
3996
4010
  timeout,
3997
4011
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3998
4012
  }, {
3999
- F: __dxlog_file15,
4013
+ F: __dxlog_file16,
4000
4014
  L: 111,
4001
4015
  S: this,
4002
4016
  C: (f, a) => f(...a)
@@ -4019,7 +4033,7 @@ var NotarizationPlugin = class {
4019
4033
  import_log14.log.info("Exhausted all peers to notarize with", {
4020
4034
  retryIn: retryTimeout
4021
4035
  }, {
4022
- F: __dxlog_file15,
4036
+ F: __dxlog_file16,
4023
4037
  L: 136,
4024
4038
  S: this,
4025
4039
  C: (f, a) => f(...a)
@@ -4033,7 +4047,7 @@ var NotarizationPlugin = class {
4033
4047
  peer: peer.localPeerId,
4034
4048
  credentialId: credentials.map((credential) => credential.id)
4035
4049
  }, {
4036
- F: __dxlog_file15,
4050
+ F: __dxlog_file16,
4037
4051
  L: 143,
4038
4052
  S: this,
4039
4053
  C: (f, a) => f(...a)
@@ -4042,7 +4056,7 @@ var NotarizationPlugin = class {
4042
4056
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
4043
4057
  });
4044
4058
  (0, import_log14.log)("success", void 0, {
4045
- F: __dxlog_file15,
4059
+ F: __dxlog_file16,
4046
4060
  L: 147,
4047
4061
  S: this,
4048
4062
  C: (f, a) => f(...a)
@@ -4051,7 +4065,7 @@ var NotarizationPlugin = class {
4051
4065
  } catch (err) {
4052
4066
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
4053
4067
  import_log14.log.info("error notarizing (recoverable)", err, {
4054
- F: __dxlog_file15,
4068
+ F: __dxlog_file16,
4055
4069
  L: 151,
4056
4070
  S: this,
4057
4071
  C: (f, a) => f(...a)
@@ -4069,7 +4083,7 @@ var NotarizationPlugin = class {
4069
4083
  errors.wait()
4070
4084
  ]);
4071
4085
  (0, import_log14.log)("done", void 0, {
4072
- F: __dxlog_file15,
4086
+ F: __dxlog_file16,
4073
4087
  L: 162,
4074
4088
  S: this,
4075
4089
  C: (f, a) => f(...a)
@@ -4091,7 +4105,7 @@ var NotarizationPlugin = class {
4091
4105
  }
4092
4106
  setWriter(writer) {
4093
4107
  (0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
4094
- F: __dxlog_file15,
4108
+ F: __dxlog_file16,
4095
4109
  L: 181,
4096
4110
  S: this,
4097
4111
  A: [
@@ -4116,7 +4130,7 @@ var NotarizationPlugin = class {
4116
4130
  }
4117
4131
  for (const credential of request.credentials ?? []) {
4118
4132
  (0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
4119
- F: __dxlog_file15,
4133
+ F: __dxlog_file16,
4120
4134
  L: 200,
4121
4135
  S: this,
4122
4136
  A: [
@@ -4136,7 +4150,7 @@ var NotarizationPlugin = class {
4136
4150
  (0, import_log14.log)("extension opened", {
4137
4151
  peer: extension.localPeerId
4138
4152
  }, {
4139
- F: __dxlog_file15,
4153
+ F: __dxlog_file16,
4140
4154
  L: 211,
4141
4155
  S: this,
4142
4156
  C: (f, a) => f(...a)
@@ -4148,7 +4162,7 @@ var NotarizationPlugin = class {
4148
4162
  (0, import_log14.log)("extension closed", {
4149
4163
  peer: extension.localPeerId
4150
4164
  }, {
4151
- F: __dxlog_file15,
4165
+ F: __dxlog_file16,
4152
4166
  L: 216,
4153
4167
  S: this,
4154
4168
  C: (f, a) => f(...a)
@@ -4263,10 +4277,13 @@ function _using_ctx() {
4263
4277
  }
4264
4278
  };
4265
4279
  }
4266
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4280
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4267
4281
  var DataSpace = class {
4268
4282
  constructor(params) {
4269
- this._ctx = new import_context10.Context();
4283
+ this._ctx = new import_context10.Context(void 0, {
4284
+ F: __dxlog_file17,
4285
+ L: 84
4286
+ });
4270
4287
  this._notarizationPlugin = new NotarizationPlugin();
4271
4288
  this._cache = void 0;
4272
4289
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
@@ -4296,7 +4313,7 @@ var DataSpace = class {
4296
4313
  (0, import_log12.log)("new state", {
4297
4314
  state: import_services12.SpaceState[this._state]
4298
4315
  }, {
4299
- F: __dxlog_file16,
4316
+ F: __dxlog_file17,
4300
4317
  L: 146,
4301
4318
  S: this,
4302
4319
  C: (f, a) => f(...a)
@@ -4351,12 +4368,15 @@ var DataSpace = class {
4351
4368
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
4352
4369
  await this._automergeSpaceState.open();
4353
4370
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
4354
- await this._inner.open(new import_context10.Context());
4371
+ await this._inner.open(new import_context10.Context(void 0, {
4372
+ F: __dxlog_file17,
4373
+ L: 215
4374
+ }));
4355
4375
  this._state = import_services12.SpaceState.CONTROL_ONLY;
4356
4376
  (0, import_log12.log)("new state", {
4357
4377
  state: import_services12.SpaceState[this._state]
4358
4378
  }, {
4359
- F: __dxlog_file16,
4379
+ F: __dxlog_file17,
4360
4380
  L: 217,
4361
4381
  S: this,
4362
4382
  C: (f, a) => f(...a)
@@ -4374,13 +4394,16 @@ var DataSpace = class {
4374
4394
  (0, import_log12.log)("new state", {
4375
4395
  state: import_services12.SpaceState[this._state]
4376
4396
  }, {
4377
- F: __dxlog_file16,
4397
+ F: __dxlog_file17,
4378
4398
  L: 231,
4379
4399
  S: this,
4380
4400
  C: (f, a) => f(...a)
4381
4401
  });
4382
4402
  await this._ctx.dispose();
4383
- this._ctx = new import_context10.Context();
4403
+ this._ctx = new import_context10.Context(void 0, {
4404
+ F: __dxlog_file17,
4405
+ L: 233
4406
+ });
4384
4407
  await this.authVerifier.close();
4385
4408
  await this._inner.close();
4386
4409
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
@@ -4407,7 +4430,7 @@ var DataSpace = class {
4407
4430
  } catch (err) {
4408
4431
  if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
4409
4432
  (0, import_log12.log)("data pipeline initialization cancelled", err, {
4410
- F: __dxlog_file16,
4433
+ F: __dxlog_file17,
4411
4434
  L: 265,
4412
4435
  S: this,
4413
4436
  C: (f, a) => f(...a)
@@ -4415,7 +4438,7 @@ var DataSpace = class {
4415
4438
  return;
4416
4439
  }
4417
4440
  import_log12.log.error("Error initializing data pipeline", err, {
4418
- F: __dxlog_file16,
4441
+ F: __dxlog_file17,
4419
4442
  L: 269,
4420
4443
  S: this,
4421
4444
  C: (f, a) => f(...a)
@@ -4424,7 +4447,7 @@ var DataSpace = class {
4424
4447
  (0, import_log12.log)("new state", {
4425
4448
  state: import_services12.SpaceState[this._state]
4426
4449
  }, {
4427
- F: __dxlog_file16,
4450
+ F: __dxlog_file17,
4428
4451
  L: 271,
4429
4452
  S: this,
4430
4453
  C: (f, a) => f(...a)
@@ -4444,7 +4467,7 @@ var DataSpace = class {
4444
4467
  (0, import_log12.log)("new state", {
4445
4468
  state: import_services12.SpaceState[this._state]
4446
4469
  }, {
4447
- F: __dxlog_file16,
4470
+ F: __dxlog_file17,
4448
4471
  L: 287,
4449
4472
  S: this,
4450
4473
  C: (f, a) => f(...a)
@@ -4461,7 +4484,7 @@ var DataSpace = class {
4461
4484
  (0, import_log12.log)("new state", {
4462
4485
  state: import_services12.SpaceState[this._state]
4463
4486
  }, {
4464
- F: __dxlog_file16,
4487
+ F: __dxlog_file17,
4465
4488
  L: 306,
4466
4489
  S: this,
4467
4490
  C: (f, a) => f(...a)
@@ -4477,7 +4500,7 @@ var DataSpace = class {
4477
4500
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4478
4501
  await this._createWritableFeeds();
4479
4502
  (0, import_log12.log)("writable feeds created", void 0, {
4480
- F: __dxlog_file16,
4503
+ F: __dxlog_file17,
4481
4504
  L: 322,
4482
4505
  S: this,
4483
4506
  C: (f, a) => f(...a)
@@ -4540,7 +4563,7 @@ var DataSpace = class {
4540
4563
  space: this.key,
4541
4564
  rootUrl
4542
4565
  }, {
4543
- F: __dxlog_file16,
4566
+ F: __dxlog_file17,
4544
4567
  L: 388,
4545
4568
  S: this,
4546
4569
  C: (f, a) => f(...a)
@@ -4594,7 +4617,7 @@ var DataSpace = class {
4594
4617
  rootUrl,
4595
4618
  err
4596
4619
  }, {
4597
- F: __dxlog_file16,
4620
+ F: __dxlog_file17,
4598
4621
  L: 431,
4599
4622
  S: this,
4600
4623
  C: (f, a) => f(...a)
@@ -4680,7 +4703,7 @@ var DataSpace = class {
4680
4703
  (0, import_log12.log)("new state", {
4681
4704
  state: import_services12.SpaceState[this._state]
4682
4705
  }, {
4683
- F: __dxlog_file16,
4706
+ F: __dxlog_file17,
4684
4707
  L: 512,
4685
4708
  S: this,
4686
4709
  C: (f, a) => f(...a)
@@ -4810,7 +4833,7 @@ function _ts_decorate5(decorators, target, key, desc) {
4810
4833
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4811
4834
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4812
4835
  }
4813
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4836
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4814
4837
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4815
4838
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
4816
4839
  var DEFAULT_SPACE_KEY = "__DEFAULT__";
@@ -4824,7 +4847,10 @@ var DataSpaceManager = class {
4824
4847
  this._echoHost = _echoHost;
4825
4848
  this._invitationsManager = _invitationsManager;
4826
4849
  this._params = _params;
4827
- this._ctx = new import_context14.Context();
4850
+ this._ctx = new import_context14.Context(void 0, {
4851
+ F: __dxlog_file18,
4852
+ L: 104
4853
+ });
4828
4854
  this.updated = new import_async17.Event();
4829
4855
  this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
4830
4856
  this._isOpen = false;
@@ -4858,24 +4884,24 @@ var DataSpaceManager = class {
4858
4884
  }
4859
4885
  async open() {
4860
4886
  (0, import_log15.log)("open", void 0, {
4861
- F: __dxlog_file17,
4862
- L: 146,
4887
+ F: __dxlog_file18,
4888
+ L: 156,
4863
4889
  S: this,
4864
4890
  C: (f, a) => f(...a)
4865
4891
  });
4866
4892
  import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
4867
4893
  id: this._instanceId
4868
4894
  }), {
4869
- F: __dxlog_file17,
4870
- L: 147,
4895
+ F: __dxlog_file18,
4896
+ L: 157,
4871
4897
  S: this,
4872
4898
  C: (f, a) => f(...a)
4873
4899
  });
4874
4900
  (0, import_log15.log)("metadata loaded", {
4875
4901
  spaces: this._metadataStore.spaces.length
4876
4902
  }, {
4877
- F: __dxlog_file17,
4878
- L: 148,
4903
+ F: __dxlog_file18,
4904
+ L: 158,
4879
4905
  S: this,
4880
4906
  C: (f, a) => f(...a)
4881
4907
  });
@@ -4884,8 +4910,8 @@ var DataSpaceManager = class {
4884
4910
  (0, import_log15.log)("load space", {
4885
4911
  spaceMetadata
4886
4912
  }, {
4887
- F: __dxlog_file17,
4888
- L: 152,
4913
+ F: __dxlog_file18,
4914
+ L: 162,
4889
4915
  S: this,
4890
4916
  C: (f, a) => f(...a)
4891
4917
  });
@@ -4895,8 +4921,8 @@ var DataSpaceManager = class {
4895
4921
  spaceMetadata,
4896
4922
  err
4897
4923
  }, {
4898
- F: __dxlog_file17,
4899
- L: 155,
4924
+ F: __dxlog_file18,
4925
+ L: 165,
4900
4926
  S: this,
4901
4927
  C: (f, a) => f(...a)
4902
4928
  });
@@ -4907,16 +4933,16 @@ var DataSpaceManager = class {
4907
4933
  import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
4908
4934
  id: this._instanceId
4909
4935
  }), {
4910
- F: __dxlog_file17,
4911
- L: 162,
4936
+ F: __dxlog_file18,
4937
+ L: 172,
4912
4938
  S: this,
4913
4939
  C: (f, a) => f(...a)
4914
4940
  });
4915
4941
  }
4916
4942
  async close() {
4917
4943
  (0, import_log15.log)("close", void 0, {
4918
- F: __dxlog_file17,
4919
- L: 167,
4944
+ F: __dxlog_file18,
4945
+ L: 177,
4920
4946
  S: this,
4921
4947
  C: (f, a) => f(...a)
4922
4948
  });
@@ -4932,8 +4958,8 @@ var DataSpaceManager = class {
4932
4958
  */
4933
4959
  async createSpace() {
4934
4960
  (0, import_invariant15.invariant)(this._isOpen, "Not open.", {
4935
- F: __dxlog_file17,
4936
- L: 181,
4961
+ F: __dxlog_file18,
4962
+ L: 191,
4937
4963
  S: this,
4938
4964
  A: [
4939
4965
  "this._isOpen",
@@ -4953,8 +4979,8 @@ var DataSpaceManager = class {
4953
4979
  (0, import_log15.log)("creating space...", {
4954
4980
  spaceKey
4955
4981
  }, {
4956
- F: __dxlog_file17,
4957
- L: 193,
4982
+ F: __dxlog_file18,
4983
+ L: 203,
4958
4984
  S: this,
4959
4985
  C: (f, a) => f(...a)
4960
4986
  });
@@ -4965,8 +4991,8 @@ var DataSpaceManager = class {
4965
4991
  await this._metadataStore.addSpace(metadata);
4966
4992
  const memberCredential = credentials[1];
4967
4993
  (0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4968
- F: __dxlog_file17,
4969
- L: 203,
4994
+ F: __dxlog_file18,
4995
+ L: 213,
4970
4996
  S: this,
4971
4997
  A: [
4972
4998
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4997,8 +5023,8 @@ var DataSpaceManager = class {
4997
5023
  version: space.databaseRoot.getVersion(),
4998
5024
  spaceId: space.id
4999
5025
  }, {
5000
- F: __dxlog_file17,
5001
- L: 228,
5026
+ F: __dxlog_file18,
5027
+ L: 238,
5002
5028
  S: this,
5003
5029
  C: (f, a) => f(...a)
5004
5030
  });
@@ -5032,8 +5058,8 @@ var DataSpaceManager = class {
5032
5058
  async _getSpaceRootDocument(space) {
5033
5059
  const automergeIndex = space.automergeSpaceState.rootUrl;
5034
5060
  (0, import_invariant15.invariant)(automergeIndex, void 0, {
5035
- F: __dxlog_file17,
5036
- L: 261,
5061
+ F: __dxlog_file18,
5062
+ L: 271,
5037
5063
  S: this,
5038
5064
  A: [
5039
5065
  "automergeIndex",
@@ -5049,14 +5075,14 @@ var DataSpaceManager = class {
5049
5075
  (0, import_log15.log)("accept space", {
5050
5076
  opts
5051
5077
  }, {
5052
- F: __dxlog_file17,
5053
- L: 270,
5078
+ F: __dxlog_file18,
5079
+ L: 280,
5054
5080
  S: this,
5055
5081
  C: (f, a) => f(...a)
5056
5082
  });
5057
5083
  (0, import_invariant15.invariant)(this._isOpen, "Not open.", {
5058
- F: __dxlog_file17,
5059
- L: 271,
5084
+ F: __dxlog_file18,
5085
+ L: 281,
5060
5086
  S: this,
5061
5087
  A: [
5062
5088
  "this._isOpen",
@@ -5064,8 +5090,8 @@ var DataSpaceManager = class {
5064
5090
  ]
5065
5091
  });
5066
5092
  (0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
5067
- F: __dxlog_file17,
5068
- L: 272,
5093
+ F: __dxlog_file18,
5094
+ L: 282,
5069
5095
  S: this,
5070
5096
  A: [
5071
5097
  "!this._spaces.has(opts.spaceKey)",
@@ -5085,6 +5111,43 @@ var DataSpaceManager = class {
5085
5111
  this.updated.emit();
5086
5112
  return space;
5087
5113
  }
5114
+ async admitMember(options) {
5115
+ const space = this._spaceManager.spaces.get(options.spaceKey);
5116
+ (0, import_invariant15.invariant)(space, void 0, {
5117
+ F: __dxlog_file18,
5118
+ L: 302,
5119
+ S: this,
5120
+ A: [
5121
+ "space",
5122
+ ""
5123
+ ]
5124
+ });
5125
+ if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
5126
+ throw new import_protocols11.AlreadyJoinedError();
5127
+ }
5128
+ 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);
5129
+ (0, import_invariant15.invariant)(credentials[0].credential, void 0, {
5130
+ F: __dxlog_file18,
5131
+ L: 321,
5132
+ S: this,
5133
+ A: [
5134
+ "credentials[0].credential",
5135
+ ""
5136
+ ]
5137
+ });
5138
+ const spaceMemberCredential = credentials[0].credential.credential;
5139
+ (0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5140
+ F: __dxlog_file18,
5141
+ L: 323,
5142
+ S: this,
5143
+ A: [
5144
+ "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
5145
+ ""
5146
+ ]
5147
+ });
5148
+ await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
5149
+ return spaceMemberCredential;
5150
+ }
5088
5151
  /**
5089
5152
  * Wait until the space data pipeline is fully initialized.
5090
5153
  * Used by invitation handler.
@@ -5096,12 +5159,24 @@ var DataSpaceManager = class {
5096
5159
  return !!space && space.state === import_services14.SpaceState.READY;
5097
5160
  }));
5098
5161
  }
5162
+ async requestSpaceAdmissionCredential(spaceKey) {
5163
+ return this._spaceManager.requestSpaceAdmissionCredential({
5164
+ spaceKey,
5165
+ identityKey: this._signingContext.identityKey,
5166
+ timeout: 15e3,
5167
+ swarmIdentity: {
5168
+ peerKey: this._signingContext.deviceKey,
5169
+ credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
5170
+ credentialAuthenticator: async () => true
5171
+ }
5172
+ });
5173
+ }
5099
5174
  async _constructSpace(metadata) {
5100
5175
  (0, import_log15.log)("construct space", {
5101
5176
  metadata
5102
5177
  }, {
5103
- F: __dxlog_file17,
5104
- L: 306,
5178
+ F: __dxlog_file18,
5179
+ L: 358,
5105
5180
  S: this,
5106
5181
  C: (f, a) => f(...a)
5107
5182
  });
@@ -5129,6 +5204,7 @@ var DataSpaceManager = class {
5129
5204
  credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
5130
5205
  },
5131
5206
  onAuthorizedConnection: (session) => {
5207
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
5132
5208
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5133
5209
  remotePeerId: session.remotePeerId
5134
5210
  }));
@@ -5138,8 +5214,8 @@ var DataSpaceManager = class {
5138
5214
  },
5139
5215
  onAuthFailure: () => {
5140
5216
  import_log15.log.warn("auth failure", void 0, {
5141
- F: __dxlog_file17,
5142
- L: 343,
5217
+ F: __dxlog_file18,
5218
+ L: 396,
5143
5219
  S: this,
5144
5220
  C: (f, a) => f(...a)
5145
5221
  });
@@ -5171,8 +5247,8 @@ var DataSpaceManager = class {
5171
5247
  (0, import_log15.log)("before space ready", {
5172
5248
  space: space.key
5173
5249
  }, {
5174
- F: __dxlog_file17,
5175
- L: 370,
5250
+ F: __dxlog_file18,
5251
+ L: 423,
5176
5252
  S: this,
5177
5253
  C: (f, a) => f(...a)
5178
5254
  });
@@ -5182,8 +5258,8 @@ var DataSpaceManager = class {
5182
5258
  space: space.key,
5183
5259
  open: this._isOpen
5184
5260
  }, {
5185
- F: __dxlog_file17,
5186
- L: 373,
5261
+ F: __dxlog_file18,
5262
+ L: 426,
5187
5263
  S: this,
5188
5264
  C: (f, a) => f(...a)
5189
5265
  });
@@ -5201,8 +5277,8 @@ var DataSpaceManager = class {
5201
5277
  (0, import_log15.log)("before space close", {
5202
5278
  space: space.key
5203
5279
  }, {
5204
- F: __dxlog_file17,
5205
- L: 381,
5280
+ F: __dxlog_file18,
5281
+ L: 434,
5206
5282
  S: this,
5207
5283
  C: (f, a) => f(...a)
5208
5284
  });
@@ -5242,8 +5318,8 @@ var DataSpaceManager = class {
5242
5318
  peersOnline: presence.getPeersOnline().length,
5243
5319
  closedSessions
5244
5320
  }, {
5245
- F: __dxlog_file17,
5246
- L: 417,
5321
+ F: __dxlog_file18,
5322
+ L: 470,
5247
5323
  S: this,
5248
5324
  C: (f, a) => f(...a)
5249
5325
  });
@@ -5257,8 +5333,8 @@ var DataSpaceManager = class {
5257
5333
  (0, import_log15.log)("closing a session with a removed peer", {
5258
5334
  peerId: peerState.peerId
5259
5335
  }, {
5260
- F: __dxlog_file17,
5261
- L: 431,
5336
+ F: __dxlog_file18,
5337
+ L: 484,
5262
5338
  S: this,
5263
5339
  C: (f, a) => f(...a)
5264
5340
  });
@@ -5317,7 +5393,7 @@ _ts_decorate5([
5317
5393
  DataSpaceManager = _ts_decorate5([
5318
5394
  (0, import_async17.trackLeaks)("open", "close")
5319
5395
  ], DataSpaceManager);
5320
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5396
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5321
5397
  var SpacesServiceImpl = class {
5322
5398
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
5323
5399
  this._identityManager = _identityManager;
@@ -5361,8 +5437,8 @@ var SpacesServiceImpl = class {
5361
5437
  }
5362
5438
  const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5363
5439
  (0, import_invariant16.invariant)(credentials[0].credential, void 0, {
5364
- F: __dxlog_file18,
5365
- L: 98,
5440
+ F: __dxlog_file19,
5441
+ L: 102,
5366
5442
  S: this,
5367
5443
  A: [
5368
5444
  "credentials[0].credential",
@@ -5371,15 +5447,15 @@ var SpacesServiceImpl = class {
5371
5447
  });
5372
5448
  const spaceMemberCredential = credentials[0].credential.credential;
5373
5449
  (0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5374
- F: __dxlog_file18,
5375
- L: 100,
5450
+ F: __dxlog_file19,
5451
+ L: 104,
5376
5452
  S: this,
5377
5453
  A: [
5378
5454
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
5379
5455
  ""
5380
5456
  ]
5381
5457
  });
5382
- await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
5458
+ await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
5383
5459
  }
5384
5460
  querySpaces() {
5385
5461
  return new import_codec_protobuf11.Stream(({ next, ctx }) => {
@@ -5389,8 +5465,8 @@ var SpacesServiceImpl = class {
5389
5465
  (0, import_log16.log)("update", {
5390
5466
  spaces
5391
5467
  }, {
5392
- F: __dxlog_file18,
5393
- L: 111,
5468
+ F: __dxlog_file19,
5469
+ L: 115,
5394
5470
  S: this,
5395
5471
  C: (f, a) => f(...a)
5396
5472
  });
@@ -5481,8 +5557,8 @@ var SpacesServiceImpl = class {
5481
5557
  });
5482
5558
  } else {
5483
5559
  (0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
5484
- F: __dxlog_file18,
5485
- L: 209,
5560
+ F: __dxlog_file19,
5561
+ L: 213,
5486
5562
  S: this,
5487
5563
  A: [
5488
5564
  "!credential.id",
@@ -5490,8 +5566,8 @@ var SpacesServiceImpl = class {
5490
5566
  ]
5491
5567
  });
5492
5568
  (0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
5493
- F: __dxlog_file18,
5494
- L: 210,
5569
+ F: __dxlog_file19,
5570
+ L: 214,
5495
5571
  S: this,
5496
5572
  A: [
5497
5573
  "this._identityManager.identity",
@@ -5500,8 +5576,8 @@ var SpacesServiceImpl = class {
5500
5576
  });
5501
5577
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5502
5578
  (0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
5503
- F: __dxlog_file18,
5504
- L: 212,
5579
+ F: __dxlog_file19,
5580
+ L: 216,
5505
5581
  S: this,
5506
5582
  A: [
5507
5583
  "credential.issuer.equals(signer.getIssuer())",
@@ -5531,6 +5607,59 @@ var SpacesServiceImpl = class {
5531
5607
  epochCredential: credential ?? void 0
5532
5608
  };
5533
5609
  }
5610
+ async admitContact(request) {
5611
+ const dataSpaceManager = await this._getDataSpaceManager();
5612
+ await dataSpaceManager.admitMember({
5613
+ spaceKey: request.spaceKey,
5614
+ identityKey: request.contact.identityKey,
5615
+ role: request.role
5616
+ });
5617
+ }
5618
+ async joinBySpaceKey({ spaceKey }) {
5619
+ const dataSpaceManager = await this._getDataSpaceManager();
5620
+ const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
5621
+ return this._joinByAdmission({
5622
+ credential
5623
+ });
5624
+ }
5625
+ async _joinByAdmission({ credential }) {
5626
+ const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
5627
+ (0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
5628
+ F: __dxlog_file19,
5629
+ L: 250,
5630
+ S: this,
5631
+ A: [
5632
+ "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
5633
+ "'Invalid credential'"
5634
+ ]
5635
+ });
5636
+ const myIdentity = this._identityManager.identity;
5637
+ (0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
5638
+ F: __dxlog_file19,
5639
+ L: 252,
5640
+ S: this,
5641
+ A: [
5642
+ "myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
5643
+ ""
5644
+ ]
5645
+ });
5646
+ const dataSpaceManager = await this._getDataSpaceManager();
5647
+ let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
5648
+ if (!dataSpace) {
5649
+ dataSpace = await dataSpaceManager.acceptSpace({
5650
+ spaceKey: assertion.spaceKey,
5651
+ genesisFeedKey: assertion.genesisFeedKey
5652
+ });
5653
+ await myIdentity.controlPipeline.writer.write({
5654
+ credential: {
5655
+ credential
5656
+ }
5657
+ });
5658
+ }
5659
+ return {
5660
+ space: this._serializeSpace(dataSpace)
5661
+ };
5662
+ }
5534
5663
  _serializeSpace(space) {
5535
5664
  return {
5536
5665
  id: space.id,
@@ -5600,7 +5729,7 @@ function _ts_decorate6(decorators, target, key, desc) {
5600
5729
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5601
5730
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5602
5731
  }
5603
- var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5732
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5604
5733
  var ServiceContext = class extends import_context15.Resource {
5605
5734
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5606
5735
  super();
@@ -5612,21 +5741,21 @@ var ServiceContext = class extends import_context15.Resource {
5612
5741
  this.initialized = new import_async19.Trigger();
5613
5742
  this._handlerFactories = /* @__PURE__ */ new Map();
5614
5743
  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"));
5744
+ this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
5745
+ this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
5617
5746
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
5618
5747
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
5619
- this.feedStore = new import_feed_store5.FeedStore({
5620
- factory: new import_feed_store5.FeedFactory({
5748
+ this.feedStore = new import_feed_store6.FeedStore({
5749
+ factory: new import_feed_store6.FeedFactory({
5621
5750
  root: storage.createDirectory("feeds"),
5622
5751
  signer: this.keyring,
5623
5752
  hypercore: {
5624
- valueEncoding: import_echo_pipeline5.valueEncoding,
5753
+ valueEncoding: import_echo_pipeline6.valueEncoding,
5625
5754
  stats: true
5626
5755
  }
5627
5756
  })
5628
5757
  });
5629
- this.spaceManager = new import_echo_pipeline5.SpaceManager({
5758
+ this.spaceManager = new import_echo_pipeline6.SpaceManager({
5630
5759
  feedStore: this.feedStore,
5631
5760
  networkManager: this.networkManager,
5632
5761
  blobStore: this.blobStore,
@@ -5644,7 +5773,7 @@ var ServiceContext = class extends import_context15.Resource {
5644
5773
  async _open(ctx) {
5645
5774
  await this._checkStorageVersion();
5646
5775
  (0, import_log17.log)("opening...", void 0, {
5647
- F: __dxlog_file19,
5776
+ F: __dxlog_file20,
5648
5777
  L: 149,
5649
5778
  S: this,
5650
5779
  C: (f, a) => f(...a)
@@ -5652,7 +5781,7 @@ var ServiceContext = class extends import_context15.Resource {
5652
5781
  import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
5653
5782
  id: this._instanceId
5654
5783
  }), {
5655
- F: __dxlog_file19,
5784
+ F: __dxlog_file20,
5656
5785
  L: 150,
5657
5786
  S: this,
5658
5787
  C: (f, a) => f(...a)
@@ -5670,7 +5799,7 @@ var ServiceContext = class extends import_context15.Resource {
5670
5799
  (0, import_log17.log)("loaded persistent invitations", {
5671
5800
  count: loadedInvitations.invitations?.length
5672
5801
  }, {
5673
- F: __dxlog_file19,
5802
+ F: __dxlog_file20,
5674
5803
  L: 163,
5675
5804
  S: this,
5676
5805
  C: (f, a) => f(...a)
@@ -5678,13 +5807,13 @@ var ServiceContext = class extends import_context15.Resource {
5678
5807
  import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
5679
5808
  id: this._instanceId
5680
5809
  }), {
5681
- F: __dxlog_file19,
5810
+ F: __dxlog_file20,
5682
5811
  L: 165,
5683
5812
  S: this,
5684
5813
  C: (f, a) => f(...a)
5685
5814
  });
5686
5815
  (0, import_log17.log)("opened", void 0, {
5687
- F: __dxlog_file19,
5816
+ F: __dxlog_file20,
5688
5817
  L: 166,
5689
5818
  S: this,
5690
5819
  C: (f, a) => f(...a)
@@ -5692,7 +5821,7 @@ var ServiceContext = class extends import_context15.Resource {
5692
5821
  }
5693
5822
  async _close(ctx) {
5694
5823
  (0, import_log17.log)("closing...", void 0, {
5695
- F: __dxlog_file19,
5824
+ F: __dxlog_file20,
5696
5825
  L: 170,
5697
5826
  S: this,
5698
5827
  C: (f, a) => f(...a)
@@ -5709,7 +5838,7 @@ var ServiceContext = class extends import_context15.Resource {
5709
5838
  await this.networkManager.close();
5710
5839
  await this.signalManager.close();
5711
5840
  (0, import_log17.log)("closed", void 0, {
5712
- F: __dxlog_file19,
5841
+ F: __dxlog_file20,
5713
5842
  L: 182,
5714
5843
  S: this,
5715
5844
  C: (f, a) => f(...a)
@@ -5717,13 +5846,16 @@ var ServiceContext = class extends import_context15.Resource {
5717
5846
  }
5718
5847
  async createIdentity(params = {}) {
5719
5848
  const identity = await this.identityManager.createIdentity(params);
5720
- await this._initialize(new import_context15.Context());
5849
+ await this._initialize(new import_context15.Context(void 0, {
5850
+ F: __dxlog_file20,
5851
+ L: 187
5852
+ }));
5721
5853
  return identity;
5722
5854
  }
5723
5855
  getInvitationHandler(invitation) {
5724
5856
  const factory = this._handlerFactories.get(invitation.kind);
5725
5857
  (0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
5726
- F: __dxlog_file19,
5858
+ F: __dxlog_file20,
5727
5859
  L: 193,
5728
5860
  S: this,
5729
5861
  A: [
@@ -5743,7 +5875,10 @@ var ServiceContext = class extends import_context15.Resource {
5743
5875
  }
5744
5876
  async _acceptIdentity(params) {
5745
5877
  const identity = await this.identityManager.acceptIdentity(params);
5746
- await this._initialize(new import_context15.Context());
5878
+ await this._initialize(new import_context15.Context(void 0, {
5879
+ F: __dxlog_file20,
5880
+ L: 209
5881
+ }));
5747
5882
  return identity;
5748
5883
  }
5749
5884
  async _checkStorageVersion() {
@@ -5755,7 +5890,7 @@ var ServiceContext = class extends import_context15.Resource {
5755
5890
  // Called when identity is created.
5756
5891
  async _initialize(ctx) {
5757
5892
  (0, import_log17.log)("initializing spaces...", void 0, {
5758
- F: __dxlog_file19,
5893
+ F: __dxlog_file20,
5759
5894
  L: 224,
5760
5895
  S: this,
5761
5896
  C: (f, a) => f(...a)
@@ -5778,7 +5913,7 @@ var ServiceContext = class extends import_context15.Resource {
5778
5913
  await this.dataSpaceManager.open();
5779
5914
  this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
5780
5915
  (0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
5781
- F: __dxlog_file19,
5916
+ F: __dxlog_file20,
5782
5917
  L: 249,
5783
5918
  S: this,
5784
5919
  A: [
@@ -5802,7 +5937,7 @@ var ServiceContext = class extends import_context15.Resource {
5802
5937
  (0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
5803
5938
  details: assertion
5804
5939
  }, {
5805
- F: __dxlog_file19,
5940
+ F: __dxlog_file20,
5806
5941
  L: 265,
5807
5942
  S: this,
5808
5943
  C: (f, a) => f(...a)
@@ -5813,7 +5948,7 @@ var ServiceContext = class extends import_context15.Resource {
5813
5948
  (0, import_log17.log)("space already exists, ignoring space admission", {
5814
5949
  details: assertion
5815
5950
  }, {
5816
- F: __dxlog_file19,
5951
+ F: __dxlog_file20,
5817
5952
  L: 269,
5818
5953
  S: this,
5819
5954
  C: (f, a) => f(...a)
@@ -5824,7 +5959,7 @@ var ServiceContext = class extends import_context15.Resource {
5824
5959
  (0, import_log17.log)("accepting space recorded in halo", {
5825
5960
  details: assertion
5826
5961
  }, {
5827
- F: __dxlog_file19,
5962
+ F: __dxlog_file20,
5828
5963
  L: 274,
5829
5964
  S: this,
5830
5965
  C: (f, a) => f(...a)
@@ -5835,7 +5970,7 @@ var ServiceContext = class extends import_context15.Resource {
5835
5970
  });
5836
5971
  } catch (err) {
5837
5972
  import_log17.log.catch(err, void 0, {
5838
- F: __dxlog_file19,
5973
+ F: __dxlog_file20,
5839
5974
  L: 280,
5840
5975
  S: this,
5841
5976
  C: (f, a) => f(...a)
@@ -5888,7 +6023,7 @@ function _ts_decorate7(decorators, target, key, desc) {
5888
6023
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5889
6024
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5890
6025
  }
5891
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
6026
+ var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
5892
6027
  var Lock = class {
5893
6028
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
5894
6029
  this._lockPath = lockPath;
@@ -5900,7 +6035,7 @@ var Lock = class {
5900
6035
  }
5901
6036
  async acquire() {
5902
6037
  (0, import_log18.log)("acquiring lock...", void 0, {
5903
- F: __dxlog_file20,
6038
+ F: __dxlog_file21,
5904
6039
  L: 32,
5905
6040
  S: this,
5906
6041
  C: (f, a) => f(...a)
@@ -5908,7 +6043,7 @@ var Lock = class {
5908
6043
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
5909
6044
  await this._onAcquire?.();
5910
6045
  (0, import_log18.log)("acquired lock", void 0, {
5911
- F: __dxlog_file20,
6046
+ F: __dxlog_file21,
5912
6047
  L: 37,
5913
6048
  S: this,
5914
6049
  C: (f, a) => f(...a)
@@ -5917,7 +6052,7 @@ var Lock = class {
5917
6052
  async release() {
5918
6053
  await this._onRelease?.();
5919
6054
  (0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
5920
- F: __dxlog_file20,
6055
+ F: __dxlog_file21,
5921
6056
  L: 42,
5922
6057
  S: this,
5923
6058
  A: [
@@ -5989,7 +6124,7 @@ var createLevel = async (config) => {
5989
6124
  await level.open();
5990
6125
  return level;
5991
6126
  };
5992
- var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
6127
+ var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5993
6128
  var DevicesServiceImpl = class {
5994
6129
  constructor(_identityManager) {
5995
6130
  this._identityManager = _identityManager;
@@ -6007,7 +6142,7 @@ var DevicesServiceImpl = class {
6007
6142
  });
6008
6143
  } else {
6009
6144
  (0, import_invariant20.invariant)(this._identityManager.identity?.presence, "presence not present", {
6010
- F: __dxlog_file21,
6145
+ F: __dxlog_file22,
6011
6146
  L: 32,
6012
6147
  S: this,
6013
6148
  A: [
@@ -6100,11 +6235,88 @@ var findConfigs = () => {
6100
6235
  const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
6101
6236
  return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
6102
6237
  };
6238
+ var ContactsServiceImpl = class {
6239
+ constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
6240
+ this._identityManager = _identityManager;
6241
+ this._spaceManager = _spaceManager;
6242
+ this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
6243
+ }
6244
+ async getContacts() {
6245
+ const identity = this._identityManager.identity;
6246
+ if (identity == null) {
6247
+ return {
6248
+ contacts: []
6249
+ };
6250
+ }
6251
+ const contacts = [
6252
+ ...this._spaceManager.spaces.values()
6253
+ ].flatMap((s) => [
6254
+ ...s.spaceState.members.values()
6255
+ ].map((m) => [
6256
+ s.key,
6257
+ m
6258
+ ])).reduce((acc, v) => {
6259
+ const [spaceKey, memberInfo] = v;
6260
+ if (memberInfo.key.equals(identity.identityKey)) {
6261
+ return acc;
6262
+ }
6263
+ const existing = acc.get(memberInfo.key);
6264
+ if (existing != null) {
6265
+ existing.profile ??= memberInfo.profile;
6266
+ existing.commonSpaces?.push(spaceKey);
6267
+ } else {
6268
+ acc.set(memberInfo.key, {
6269
+ identityKey: memberInfo.key,
6270
+ profile: memberInfo.profile,
6271
+ commonSpaces: [
6272
+ spaceKey
6273
+ ]
6274
+ });
6275
+ }
6276
+ return acc;
6277
+ }, new import_util15.ComplexMap(import_keys17.PublicKey.hash));
6278
+ return {
6279
+ contacts: [
6280
+ ...contacts.values()
6281
+ ]
6282
+ };
6283
+ }
6284
+ queryContacts() {
6285
+ const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys17.PublicKey.hash);
6286
+ return new import_codec_protobuf13.Stream(({ next, ctx }) => {
6287
+ const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
6288
+ const contacts = await this.getContacts();
6289
+ next(contacts);
6290
+ }, {
6291
+ maxFrequency: 2
6292
+ });
6293
+ (0, import_async22.scheduleTask)(ctx, async () => {
6294
+ const subscriptions = new import_async22.EventSubscriptions();
6295
+ ctx.onDispose(() => subscriptions.clear());
6296
+ const subscribeToSpaceAndUpdate = () => {
6297
+ const oldSetSize = subscribedSpaceKeySet.size;
6298
+ for (const space of this._spaceManager.spaces.values()) {
6299
+ if (!subscribedSpaceKeySet.has(space.key)) {
6300
+ subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
6301
+ subscribedSpaceKeySet.add(space.key);
6302
+ }
6303
+ }
6304
+ if (oldSetSize !== subscribedSpaceKeySet.size) {
6305
+ pushUpdateTask.trigger();
6306
+ }
6307
+ };
6308
+ const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
6309
+ ctx.onDispose(unsubscribe);
6310
+ subscribeToSpaceAndUpdate();
6311
+ });
6312
+ });
6313
+ }
6314
+ };
6103
6315
  var LoggingServiceImpl = class {
6104
6316
  constructor() {
6105
- this._logs = new import_async22.Event();
6317
+ this._logs = new import_async23.Event();
6106
6318
  this._started = Date.now();
6107
- this._sessionId = import_keys17.PublicKey.random().toHex();
6319
+ this._sessionId = import_keys18.PublicKey.random().toHex();
6108
6320
  this._logProcessor = (_config, entry2) => {
6109
6321
  this._logs.emit(entry2);
6110
6322
  };
@@ -6118,15 +6330,15 @@ var LoggingServiceImpl = class {
6118
6330
  }
6119
6331
  async controlMetrics({ reset, record }) {
6120
6332
  if (reset) {
6121
- import_util15.tracer.clear();
6333
+ import_util16.tracer.clear();
6122
6334
  }
6123
6335
  if (record === true) {
6124
- import_util15.tracer.start();
6336
+ import_util16.tracer.start();
6125
6337
  } else if (record === false) {
6126
- import_util15.tracer.stop();
6338
+ import_util16.tracer.stop();
6127
6339
  }
6128
6340
  return {
6129
- recording: import_util15.tracer.recording
6341
+ recording: import_util16.tracer.recording
6130
6342
  };
6131
6343
  }
6132
6344
  /**
@@ -6134,13 +6346,13 @@ var LoggingServiceImpl = class {
6134
6346
  */
6135
6347
  queryMetrics({ interval = 5e3 }) {
6136
6348
  const getNumericalValues = (key) => {
6137
- const events = import_util15.tracer.get(key) ?? [];
6349
+ const events = import_util16.tracer.get(key) ?? [];
6138
6350
  return {
6139
6351
  key,
6140
- stats: (0, import_util15.numericalValues)(events, "duration")
6352
+ stats: (0, import_util16.numericalValues)(events, "duration")
6141
6353
  };
6142
6354
  };
6143
- return new import_codec_protobuf13.Stream(({ next }) => {
6355
+ return new import_codec_protobuf14.Stream(({ next }) => {
6144
6356
  const update = () => {
6145
6357
  const metrics = {
6146
6358
  timestamp: /* @__PURE__ */ new Date(),
@@ -6162,7 +6374,7 @@ var LoggingServiceImpl = class {
6162
6374
  });
6163
6375
  }
6164
6376
  queryLogs(request) {
6165
- return new import_codec_protobuf13.Stream(({ ctx, next }) => {
6377
+ return new import_codec_protobuf14.Stream(({ ctx, next }) => {
6166
6378
  const handler = (entry2) => {
6167
6379
  if (LOG_PROCESSING > 0) {
6168
6380
  return;
@@ -6175,7 +6387,7 @@ var LoggingServiceImpl = class {
6175
6387
  }
6176
6388
  const record = {
6177
6389
  ...entry2,
6178
- context: (0, import_util15.jsonify)((0, import_log20.getContextFromEntry)(entry2)),
6390
+ context: (0, import_util16.jsonify)((0, import_log20.getContextFromEntry)(entry2)),
6179
6391
  timestamp: /* @__PURE__ */ new Date(),
6180
6392
  meta: {
6181
6393
  // TODO(dmaretskyi): Fix proto.
@@ -6184,7 +6396,7 @@ var LoggingServiceImpl = class {
6184
6396
  scope: {
6185
6397
  hostSessionId: this._sessionId,
6186
6398
  uptimeSeconds: (Date.now() - this._started) / 1e3,
6187
- name: (0, import_util15.getDebugName)(entry2.meta?.S)
6399
+ name: (0, import_util16.getDebugName)(entry2.meta?.S)
6188
6400
  }
6189
6401
  }
6190
6402
  };
@@ -6222,7 +6434,7 @@ var NetworkServiceImpl = class {
6222
6434
  this.signalManager = signalManager;
6223
6435
  }
6224
6436
  queryStatus() {
6225
- return new import_codec_protobuf14.Stream(({ next }) => {
6437
+ return new import_codec_protobuf15.Stream(({ next }) => {
6226
6438
  const update = () => {
6227
6439
  next({
6228
6440
  swarm: this.networkManager.connectionState,
@@ -6265,7 +6477,7 @@ var SystemServiceImpl = class {
6265
6477
  const diagnostics = await this._getDiagnostics();
6266
6478
  return {
6267
6479
  timestamp: /* @__PURE__ */ new Date(),
6268
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util16.jsonKeyReplacer)({
6480
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
6269
6481
  truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
6270
6482
  humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
6271
6483
  })))
@@ -6279,7 +6491,7 @@ var SystemServiceImpl = class {
6279
6491
  }
6280
6492
  // TODO(burdon): Standardize interval option in stream request?
6281
6493
  queryStatus({ interval = 3e3 } = {}) {
6282
- return new import_codec_protobuf15.Stream(({ next }) => {
6494
+ return new import_codec_protobuf16.Stream(({ next }) => {
6283
6495
  const update = () => {
6284
6496
  next({
6285
6497
  status: this._getCurrentStatus()
@@ -6308,7 +6520,7 @@ function _ts_decorate8(decorators, target, key, desc) {
6308
6520
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6309
6521
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6310
6522
  }
6311
- var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6523
+ var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6312
6524
  var ClientServicesHost = class {
6313
6525
  constructor({
6314
6526
  config,
@@ -6341,7 +6553,10 @@ var ClientServicesHost = class {
6341
6553
  lockKey,
6342
6554
  onAcquire: () => {
6343
6555
  if (!this._opening) {
6344
- void this.open(new import_context16.Context());
6556
+ void this.open(new import_context16.Context(void 0, {
6557
+ F: __dxlog_file23,
6558
+ L: 121
6559
+ }));
6345
6560
  }
6346
6561
  },
6347
6562
  onRelease: () => this.close()
@@ -6397,8 +6612,8 @@ var ClientServicesHost = class {
6397
6612
  */
6398
6613
  initialize({ config, ...options }) {
6399
6614
  (0, import_invariant19.invariant)(!this._open, "service host is open", {
6400
- F: __dxlog_file22,
6401
- L: 186,
6615
+ F: __dxlog_file23,
6616
+ L: 187,
6402
6617
  S: this,
6403
6618
  A: [
6404
6619
  "!this._open",
@@ -6406,15 +6621,15 @@ var ClientServicesHost = class {
6406
6621
  ]
6407
6622
  });
6408
6623
  (0, import_log19.log)("initializing...", void 0, {
6409
- F: __dxlog_file22,
6410
- L: 187,
6624
+ F: __dxlog_file23,
6625
+ L: 188,
6411
6626
  S: this,
6412
6627
  C: (f, a) => f(...a)
6413
6628
  });
6414
6629
  if (config) {
6415
6630
  (0, import_invariant19.invariant)(!this._config, "config already set", {
6416
- F: __dxlog_file22,
6417
- L: 190,
6631
+ F: __dxlog_file23,
6632
+ L: 191,
6418
6633
  S: this,
6419
6634
  A: [
6420
6635
  "!this._config",
@@ -6428,8 +6643,8 @@ var ClientServicesHost = class {
6428
6643
  }
6429
6644
  if (!options.signalManager) {
6430
6645
  import_log19.log.warn("running signaling without telemetry metadata.", void 0, {
6431
- F: __dxlog_file22,
6432
- L: 198,
6646
+ F: __dxlog_file23,
6647
+ L: 199,
6433
6648
  S: this,
6434
6649
  C: (f, a) => f(...a)
6435
6650
  });
@@ -6439,8 +6654,8 @@ var ClientServicesHost = class {
6439
6654
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
6440
6655
  this._signalManager = signalManager;
6441
6656
  (0, import_invariant19.invariant)(!this._networkManager, "network manager already set", {
6442
- F: __dxlog_file22,
6443
- L: 209,
6657
+ F: __dxlog_file23,
6658
+ L: 210,
6444
6659
  S: this,
6445
6660
  A: [
6446
6661
  "!this._networkManager",
@@ -6453,8 +6668,8 @@ var ClientServicesHost = class {
6453
6668
  signalManager
6454
6669
  });
6455
6670
  (0, import_log19.log)("initialized", void 0, {
6456
- F: __dxlog_file22,
6457
- L: 216,
6671
+ F: __dxlog_file23,
6672
+ L: 217,
6458
6673
  S: this,
6459
6674
  C: (f, a) => f(...a)
6460
6675
  });
@@ -6467,14 +6682,14 @@ var ClientServicesHost = class {
6467
6682
  import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
6468
6683
  id: traceId
6469
6684
  }), {
6470
- F: __dxlog_file22,
6471
- L: 227,
6685
+ F: __dxlog_file23,
6686
+ L: 228,
6472
6687
  S: this,
6473
6688
  C: (f, a) => f(...a)
6474
6689
  });
6475
6690
  (0, import_invariant19.invariant)(this._config, "config not set", {
6476
- F: __dxlog_file22,
6477
- L: 229,
6691
+ F: __dxlog_file23,
6692
+ L: 230,
6478
6693
  S: this,
6479
6694
  A: [
6480
6695
  "this._config",
@@ -6482,8 +6697,8 @@ var ClientServicesHost = class {
6482
6697
  ]
6483
6698
  });
6484
6699
  (0, import_invariant19.invariant)(this._storage, "storage not set", {
6485
- F: __dxlog_file22,
6486
- L: 230,
6700
+ F: __dxlog_file23,
6701
+ L: 231,
6487
6702
  S: this,
6488
6703
  A: [
6489
6704
  "this._storage",
@@ -6491,8 +6706,8 @@ var ClientServicesHost = class {
6491
6706
  ]
6492
6707
  });
6493
6708
  (0, import_invariant19.invariant)(this._signalManager, "signal manager not set", {
6494
- F: __dxlog_file22,
6495
- L: 231,
6709
+ F: __dxlog_file23,
6710
+ L: 232,
6496
6711
  S: this,
6497
6712
  A: [
6498
6713
  "this._signalManager",
@@ -6500,8 +6715,8 @@ var ClientServicesHost = class {
6500
6715
  ]
6501
6716
  });
6502
6717
  (0, import_invariant19.invariant)(this._networkManager, "network manager not set", {
6503
- F: __dxlog_file22,
6504
- L: 232,
6718
+ F: __dxlog_file23,
6719
+ L: 233,
6505
6720
  S: this,
6506
6721
  A: [
6507
6722
  "this._networkManager",
@@ -6512,8 +6727,8 @@ var ClientServicesHost = class {
6512
6727
  (0, import_log19.log)("opening...", {
6513
6728
  lockKey: this._resourceLock?.lockKey
6514
6729
  }, {
6515
- F: __dxlog_file22,
6516
- L: 235,
6730
+ F: __dxlog_file23,
6731
+ L: 236,
6517
6732
  S: this,
6518
6733
  C: (f, a) => f(...a)
6519
6734
  });
@@ -6524,16 +6739,18 @@ var ClientServicesHost = class {
6524
6739
  await this._level.open();
6525
6740
  await this._loggingService.open();
6526
6741
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
6742
+ const dataSpaceManagerProvider = async () => {
6743
+ await this._serviceContext.initialized.wait();
6744
+ return this._serviceContext.dataSpaceManager;
6745
+ };
6527
6746
  const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
6528
6747
  this._serviceRegistry.setServices({
6529
6748
  SystemService: this._systemService,
6530
6749
  IdentityService: identityService,
6750
+ ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
6531
6751
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
6532
6752
  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
- }),
6753
+ SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
6537
6754
  DataService: this._serviceContext.echoHost.dataService,
6538
6755
  QueryService: this._serviceContext.echoHost.queryService,
6539
6756
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
@@ -6566,16 +6783,16 @@ var ClientServicesHost = class {
6566
6783
  (0, import_log19.log)("opened", {
6567
6784
  deviceKey
6568
6785
  }, {
6569
- F: __dxlog_file22,
6570
- L: 314,
6786
+ F: __dxlog_file23,
6787
+ L: 322,
6571
6788
  S: this,
6572
6789
  C: (f, a) => f(...a)
6573
6790
  });
6574
6791
  import_log19.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
6575
6792
  id: traceId
6576
6793
  }), {
6577
- F: __dxlog_file22,
6578
- L: 315,
6794
+ F: __dxlog_file23,
6795
+ L: 323,
6579
6796
  S: this,
6580
6797
  C: (f, a) => f(...a)
6581
6798
  });
@@ -6588,8 +6805,8 @@ var ClientServicesHost = class {
6588
6805
  (0, import_log19.log)("closing...", {
6589
6806
  deviceKey
6590
6807
  }, {
6591
- F: __dxlog_file22,
6592
- L: 326,
6808
+ F: __dxlog_file23,
6809
+ L: 334,
6593
6810
  S: this,
6594
6811
  C: (f, a) => f(...a)
6595
6812
  });
@@ -6606,8 +6823,8 @@ var ClientServicesHost = class {
6606
6823
  (0, import_log19.log)("closed", {
6607
6824
  deviceKey
6608
6825
  }, {
6609
- F: __dxlog_file22,
6610
- L: 335,
6826
+ F: __dxlog_file23,
6827
+ L: 343,
6611
6828
  S: this,
6612
6829
  C: (f, a) => f(...a)
6613
6830
  });
@@ -6617,30 +6834,30 @@ var ClientServicesHost = class {
6617
6834
  import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
6618
6835
  id: traceId
6619
6836
  }), {
6620
- F: __dxlog_file22,
6621
- L: 340,
6837
+ F: __dxlog_file23,
6838
+ L: 348,
6622
6839
  S: this,
6623
6840
  C: (f, a) => f(...a)
6624
6841
  });
6625
6842
  import_log19.log.info("resetting...", void 0, {
6626
- F: __dxlog_file22,
6627
- L: 342,
6843
+ F: __dxlog_file23,
6844
+ L: 350,
6628
6845
  S: this,
6629
6846
  C: (f, a) => f(...a)
6630
6847
  });
6631
6848
  await this._serviceContext?.close();
6632
6849
  await this._storage.reset();
6633
6850
  import_log19.log.info("reset", void 0, {
6634
- F: __dxlog_file22,
6635
- L: 345,
6851
+ F: __dxlog_file23,
6852
+ L: 353,
6636
6853
  S: this,
6637
6854
  C: (f, a) => f(...a)
6638
6855
  });
6639
6856
  import_log19.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
6640
6857
  id: traceId
6641
6858
  }), {
6642
- F: __dxlog_file22,
6643
- L: 346,
6859
+ F: __dxlog_file23,
6860
+ L: 354,
6644
6861
  S: this,
6645
6862
  C: (f, a) => f(...a)
6646
6863
  });
@@ -6709,4 +6926,4 @@ ClientServicesHost = _ts_decorate8([
6709
6926
  subscribeToSpaces,
6710
6927
  subscribeToSwarmInfo
6711
6928
  });
6712
- //# sourceMappingURL=chunk-5B5T4YX6.cjs.map
6929
+ //# sourceMappingURL=chunk-SSRPYM2G.cjs.map