@dxos/client-services 0.1.58-next.3349da8 → 0.1.58-next.ffb4cc4

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 (72) hide show
  1. package/dist/lib/browser/{chunk-ARM2DYUZ.mjs → chunk-YKLF7KAM.mjs} +251 -179
  2. package/dist/lib/browser/chunk-YKLF7KAM.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11 -11
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +5 -5
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +299 -227
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +296 -224
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  15. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
  16. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
  19. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  20. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
  22. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  24. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  25. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  26. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  28. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
  29. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  30. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
  31. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  32. package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
  33. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  34. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  35. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  36. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  37. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
  38. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  39. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  40. package/dist/types/src/version.d.ts +1 -1
  41. package/package.json +35 -35
  42. package/src/packlets/devices/devices-service.test.ts +1 -1
  43. package/src/packlets/devtools/devtools.ts +1 -1
  44. package/src/packlets/identity/authenticator.ts +2 -5
  45. package/src/packlets/identity/identity-manager.test.ts +1 -1
  46. package/src/packlets/identity/identity-service.test.ts +1 -1
  47. package/src/packlets/identity/identity.test.ts +1 -1
  48. package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
  49. package/src/packlets/invitations/invitation-extension.ts +1 -2
  50. package/src/packlets/invitations/invitations-handler.ts +7 -8
  51. package/src/packlets/invitations/invitations-service.ts +5 -5
  52. package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
  53. package/src/packlets/network/network-service.test.ts +1 -1
  54. package/src/packlets/services/diagnostics.ts +2 -2
  55. package/src/packlets/services/service-context.ts +7 -13
  56. package/src/packlets/services/service-host.test.ts +3 -3
  57. package/src/packlets/services/service-host.ts +42 -6
  58. package/src/packlets/services/service-registry.test.ts +1 -1
  59. package/src/packlets/spaces/data-space-manager.test.ts +1 -1
  60. package/src/packlets/spaces/data-space-manager.ts +1 -1
  61. package/src/packlets/spaces/data-space.ts +9 -3
  62. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  63. package/src/packlets/spaces/spaces-service.ts +31 -10
  64. package/src/packlets/storage/storage.ts +10 -10
  65. package/src/packlets/testing/invitation-utils.ts +9 -9
  66. package/src/packlets/testing/test-builder.ts +3 -3
  67. package/src/packlets/vault/iframe-host-runtime.ts +1 -1
  68. package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
  69. package/src/packlets/vault/shell-runtime.ts +4 -4
  70. package/src/packlets/vault/worker-runtime.ts +9 -6
  71. package/src/version.ts +1 -1
  72. package/dist/lib/browser/chunk-ARM2DYUZ.mjs.map +0 -7
@@ -416,7 +416,6 @@ var createAuthProvider = (signer) => async (nonce) => {
416
416
  return Credential.encode(credential);
417
417
  };
418
418
  var TrustedKeySetAuthVerifier = class {
419
- // prettier-ignore
420
419
  constructor(_params) {
421
420
  this._params = _params;
422
421
  this._ctx = new import_context2.Context();
@@ -431,7 +430,7 @@ var TrustedKeySetAuthVerifier = class {
431
430
  credential
432
431
  }, {
433
432
  F: __dxlog_file,
434
- L: 59,
433
+ L: 56,
435
434
  S: this,
436
435
  C: (f, a) => f(...a)
437
436
  });
@@ -441,7 +440,7 @@ var TrustedKeySetAuthVerifier = class {
441
440
  result
442
441
  }, {
443
442
  F: __dxlog_file,
444
- L: 63,
443
+ L: 60,
445
444
  S: this,
446
445
  C: (f, a) => f(...a)
447
446
  });
@@ -453,7 +452,7 @@ var TrustedKeySetAuthVerifier = class {
453
452
  credential
454
453
  }, {
455
454
  F: __dxlog_file,
456
- L: 68,
455
+ L: 65,
457
456
  S: this,
458
457
  C: (f, a) => f(...a)
459
458
  });
@@ -464,7 +463,7 @@ var TrustedKeySetAuthVerifier = class {
464
463
  key: credential.issuer
465
464
  }, {
466
465
  F: __dxlog_file,
467
- L: 73,
466
+ L: 70,
468
467
  S: this,
469
468
  C: (f, a) => f(...a)
470
469
  });
@@ -480,7 +479,7 @@ var TrustedKeySetAuthVerifier = class {
480
479
  key: credential.issuer
481
480
  }, {
482
481
  F: __dxlog_file,
483
- L: 84,
482
+ L: 81,
484
483
  S: this,
485
484
  C: (f, a) => f(...a)
486
485
  });
@@ -490,7 +489,7 @@ var TrustedKeySetAuthVerifier = class {
490
489
  key: credential.issuer
491
490
  }, {
492
491
  F: __dxlog_file,
493
- L: 87,
492
+ L: 84,
494
493
  S: this,
495
494
  C: (f, a) => f(...a)
496
495
  });
@@ -1220,7 +1219,6 @@ var import_async8 = require("@dxos/async");
1220
1219
  var import_client_protocol2 = require("@dxos/client-protocol");
1221
1220
  var import_context5 = require("@dxos/context");
1222
1221
  var import_credentials7 = require("@dxos/credentials");
1223
- var import_errors2 = require("@dxos/errors");
1224
1222
  var import_invariant6 = require("@dxos/invariant");
1225
1223
  var import_keys6 = require("@dxos/keys");
1226
1224
  var import_log5 = require("@dxos/log");
@@ -1232,7 +1230,6 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1232
1230
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1233
1231
  var import_async7 = require("@dxos/async");
1234
1232
  var import_context4 = require("@dxos/context");
1235
- var import_errors = require("@dxos/errors");
1236
1233
  var import_invariant5 = require("@dxos/invariant");
1237
1234
  var import_keys5 = require("@dxos/keys");
1238
1235
  var import_log4 = require("@dxos/log");
@@ -1270,7 +1267,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1270
1267
  options: async (options) => {
1271
1268
  (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1272
1269
  F: __dxlog_file6,
1273
- L: 88,
1270
+ L: 87,
1274
1271
  S: this,
1275
1272
  A: [
1276
1273
  "!this._remoteOptions",
@@ -1287,7 +1284,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1287
1284
  id: traceId
1288
1285
  }), {
1289
1286
  F: __dxlog_file6,
1290
- L: 97,
1287
+ L: 96,
1291
1288
  S: this,
1292
1289
  C: (f, a) => f(...a)
1293
1290
  });
@@ -1297,7 +1294,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1297
1294
  invitationId
1298
1295
  }, {
1299
1296
  F: __dxlog_file6,
1300
- L: 101,
1297
+ L: 100,
1301
1298
  S: this,
1302
1299
  C: (f, a) => f(...a)
1303
1300
  });
@@ -1311,7 +1308,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1311
1308
  guestProfile: profile
1312
1309
  }, {
1313
1310
  F: __dxlog_file6,
1314
- L: 110,
1311
+ L: 109,
1315
1312
  S: this,
1316
1313
  C: (f, a) => f(...a)
1317
1314
  });
@@ -1324,7 +1321,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1324
1321
  id: traceId
1325
1322
  }), {
1326
1323
  F: __dxlog_file6,
1327
- L: 117,
1324
+ L: 116,
1328
1325
  S: this,
1329
1326
  C: (f, a) => f(...a)
1330
1327
  });
@@ -1339,7 +1336,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1339
1336
  id: traceId
1340
1337
  }), {
1341
1338
  F: __dxlog_file6,
1342
- L: 126,
1339
+ L: 125,
1343
1340
  S: this,
1344
1341
  C: (f, a) => f(...a)
1345
1342
  });
@@ -1347,14 +1344,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1347
1344
  authCode: code
1348
1345
  }, {
1349
1346
  F: __dxlog_file6,
1350
- L: 127,
1347
+ L: 126,
1351
1348
  S: this,
1352
1349
  C: (f, a) => f(...a)
1353
1350
  });
1354
1351
  let status = import_invitations.AuthenticationResponse.Status.OK;
1355
1352
  (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1356
1353
  F: __dxlog_file6,
1357
- L: 130,
1354
+ L: 129,
1358
1355
  S: this,
1359
1356
  A: [
1360
1357
  "this.invitation",
@@ -1365,7 +1362,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1365
1362
  case import_services2.Invitation.AuthMethod.NONE: {
1366
1363
  (0, import_log4.log)("authentication not required", void 0, {
1367
1364
  F: __dxlog_file6,
1368
- L: 133,
1365
+ L: 132,
1369
1366
  S: this,
1370
1367
  C: (f, a) => f(...a)
1371
1368
  });
@@ -1390,7 +1387,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1390
1387
  authMethod: this.invitation.authMethod
1391
1388
  }, {
1392
1389
  F: __dxlog_file6,
1393
- L: 151,
1390
+ L: 150,
1394
1391
  S: this,
1395
1392
  C: (f, a) => f(...a)
1396
1393
  });
@@ -1405,7 +1402,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1405
1402
  }
1406
1403
  }), {
1407
1404
  F: __dxlog_file6,
1408
- L: 157,
1405
+ L: 156,
1409
1406
  S: this,
1410
1407
  C: (f, a) => f(...a)
1411
1408
  });
@@ -1419,14 +1416,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1419
1416
  id: traceId
1420
1417
  }), {
1421
1418
  F: __dxlog_file6,
1422
- L: 163,
1419
+ L: 162,
1423
1420
  S: this,
1424
1421
  C: (f, a) => f(...a)
1425
1422
  });
1426
1423
  try {
1427
1424
  (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1428
1425
  F: __dxlog_file6,
1429
- L: 166,
1426
+ L: 165,
1430
1427
  S: this,
1431
1428
  A: [
1432
1429
  "this.invitation",
@@ -1441,7 +1438,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1441
1438
  id: traceId
1442
1439
  }), {
1443
1440
  F: __dxlog_file6,
1444
- L: 174,
1441
+ L: 173,
1445
1442
  S: this,
1446
1443
  C: (f, a) => f(...a)
1447
1444
  });
@@ -1464,7 +1461,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1464
1461
  timeout: OPTIONS_TIMEOUT
1465
1462
  }));
1466
1463
  if (this._remoteOptions?.role !== import_invitations.Options.Role.GUEST) {
1467
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1464
+ throw new import_protocols3.InvalidInvitationExtensionRoleError(void 0, {
1468
1465
  expected: import_invitations.Options.Role.GUEST,
1469
1466
  remoteOptions: this._remoteOptions
1470
1467
  });
@@ -1498,7 +1495,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1498
1495
  options: async (options) => {
1499
1496
  (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1500
1497
  F: __dxlog_file6,
1501
- L: 241,
1498
+ L: 240,
1502
1499
  S: this,
1503
1500
  A: [
1504
1501
  "!this._remoteOptions",
@@ -1525,7 +1522,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1525
1522
  try {
1526
1523
  (0, import_log4.log)("begin options", void 0, {
1527
1524
  F: __dxlog_file6,
1528
- L: 262,
1525
+ L: 261,
1529
1526
  S: this,
1530
1527
  C: (f, a) => f(...a)
1531
1528
  });
@@ -1537,12 +1534,12 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1537
1534
  }));
1538
1535
  (0, import_log4.log)("end options", void 0, {
1539
1536
  F: __dxlog_file6,
1540
- L: 265,
1537
+ L: 264,
1541
1538
  S: this,
1542
1539
  C: (f, a) => f(...a)
1543
1540
  });
1544
1541
  if (this._remoteOptions?.role !== import_invitations.Options.Role.HOST) {
1545
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1542
+ throw new import_protocols3.InvalidInvitationExtensionRoleError(void 0, {
1546
1543
  expected: import_invitations.Options.Role.HOST,
1547
1544
  remoteOptions: this._remoteOptions
1548
1545
  });
@@ -1551,7 +1548,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1551
1548
  } catch (err) {
1552
1549
  (0, import_log4.log)("openError", err, {
1553
1550
  F: __dxlog_file6,
1554
- L: 275,
1551
+ L: 274,
1555
1552
  S: this,
1556
1553
  C: (f, a) => f(...a)
1557
1554
  });
@@ -1561,7 +1558,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1561
1558
  async onClose() {
1562
1559
  (0, import_log4.log)("onClose", void 0, {
1563
1560
  F: __dxlog_file6,
1564
- L: 281,
1561
+ L: 280,
1565
1562
  S: this,
1566
1563
  C: (f, a) => f(...a)
1567
1564
  });
@@ -1584,7 +1581,7 @@ var InvitationsHandler = class {
1584
1581
  const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1585
1582
  (0, import_invariant6.invariant)(protocol, void 0, {
1586
1583
  F: __dxlog_file7,
1587
- L: 76,
1584
+ L: 75,
1588
1585
  S: this,
1589
1586
  A: [
1590
1587
  "protocol",
@@ -1613,7 +1610,7 @@ var InvitationsHandler = class {
1613
1610
  ...protocol.toJSON()
1614
1611
  }, {
1615
1612
  F: __dxlog_file7,
1616
- L: 98,
1613
+ L: 97,
1617
1614
  S: this,
1618
1615
  C: (f, a) => f(...a)
1619
1616
  });
@@ -1638,7 +1635,7 @@ var InvitationsHandler = class {
1638
1635
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1639
1636
  (0, import_invariant6.invariant)(deviceKey, void 0, {
1640
1637
  F: __dxlog_file7,
1641
- L: 119,
1638
+ L: 118,
1642
1639
  S: this,
1643
1640
  A: [
1644
1641
  "deviceKey",
@@ -1661,7 +1658,7 @@ var InvitationsHandler = class {
1661
1658
  id: traceId
1662
1659
  }), {
1663
1660
  F: __dxlog_file7,
1664
- L: 137,
1661
+ L: 136,
1665
1662
  S: this,
1666
1663
  C: (f, a) => f(...a)
1667
1664
  });
@@ -1669,7 +1666,7 @@ var InvitationsHandler = class {
1669
1666
  ...protocol.toJSON()
1670
1667
  }, {
1671
1668
  F: __dxlog_file7,
1672
- L: 138,
1669
+ L: 137,
1673
1670
  S: this,
1674
1671
  C: (f, a) => f(...a)
1675
1672
  });
@@ -1685,7 +1682,7 @@ var InvitationsHandler = class {
1685
1682
  ...protocol.toJSON()
1686
1683
  }, {
1687
1684
  F: __dxlog_file7,
1688
- L: 141,
1685
+ L: 140,
1689
1686
  S: this,
1690
1687
  C: (f, a) => f(...a)
1691
1688
  });
@@ -1697,7 +1694,7 @@ var InvitationsHandler = class {
1697
1694
  id: traceId
1698
1695
  }), {
1699
1696
  F: __dxlog_file7,
1700
- L: 143,
1697
+ L: 142,
1701
1698
  S: this,
1702
1699
  C: (f, a) => f(...a)
1703
1700
  });
@@ -1707,7 +1704,7 @@ var InvitationsHandler = class {
1707
1704
  ...protocol.toJSON()
1708
1705
  }, {
1709
1706
  F: __dxlog_file7,
1710
- L: 146,
1707
+ L: 145,
1711
1708
  S: this,
1712
1709
  C: (f, a) => f(...a)
1713
1710
  });
@@ -1718,7 +1715,7 @@ var InvitationsHandler = class {
1718
1715
  } else {
1719
1716
  import_log5.log.error("failed", err, {
1720
1717
  F: __dxlog_file7,
1721
- L: 149,
1718
+ L: 148,
1722
1719
  S: this,
1723
1720
  C: (f, a) => f(...a)
1724
1721
  });
@@ -1729,7 +1726,7 @@ var InvitationsHandler = class {
1729
1726
  error: err
1730
1727
  }), {
1731
1728
  F: __dxlog_file7,
1732
- L: 152,
1729
+ L: 151,
1733
1730
  S: this,
1734
1731
  C: (f, a) => f(...a)
1735
1732
  });
@@ -1742,7 +1739,7 @@ var InvitationsHandler = class {
1742
1739
  });
1743
1740
  },
1744
1741
  onError: (err) => {
1745
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1742
+ if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
1746
1743
  return;
1747
1744
  }
1748
1745
  if (err instanceof import_async8.TimeoutError) {
@@ -1750,7 +1747,7 @@ var InvitationsHandler = class {
1750
1747
  ...protocol.toJSON()
1751
1748
  }, {
1752
1749
  F: __dxlog_file7,
1753
- L: 167,
1750
+ L: 166,
1754
1751
  S: this,
1755
1752
  C: (f, a) => f(...a)
1756
1753
  });
@@ -1761,7 +1758,7 @@ var InvitationsHandler = class {
1761
1758
  } else {
1762
1759
  import_log5.log.error("failed", err, {
1763
1760
  F: __dxlog_file7,
1764
- L: 170,
1761
+ L: 169,
1765
1762
  S: this,
1766
1763
  C: (f, a) => f(...a)
1767
1764
  });
@@ -1789,7 +1786,7 @@ var InvitationsHandler = class {
1789
1786
  state: import_services3.Invitation.State.CONNECTING
1790
1787
  });
1791
1788
  });
1792
- const observable = new import_client_protocol2.CancellableInvitationObservable({
1789
+ const observable = new import_client_protocol2.CancellableInvitation({
1793
1790
  initialInvitation: invitation,
1794
1791
  subscriber: stream.observable,
1795
1792
  onCancel: async () => {
@@ -1806,7 +1803,7 @@ var InvitationsHandler = class {
1806
1803
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1807
1804
  (0, import_invariant6.invariant)(protocol, void 0, {
1808
1805
  F: __dxlog_file7,
1809
- L: 211,
1806
+ L: 210,
1810
1807
  S: this,
1811
1808
  A: [
1812
1809
  "protocol",
@@ -1820,7 +1817,7 @@ var InvitationsHandler = class {
1820
1817
  const setState = (newData) => {
1821
1818
  (0, import_invariant6.invariant)(newData.state !== void 0, void 0, {
1822
1819
  F: __dxlog_file7,
1823
- L: 222,
1820
+ L: 221,
1824
1821
  S: this,
1825
1822
  A: [
1826
1823
  "newData.state !== undefined",
@@ -1840,7 +1837,7 @@ var InvitationsHandler = class {
1840
1837
  ...protocol.toJSON()
1841
1838
  }, {
1842
1839
  F: __dxlog_file7,
1843
- L: 230,
1840
+ L: 229,
1844
1841
  S: this,
1845
1842
  C: (f, a) => f(...a)
1846
1843
  });
@@ -1850,7 +1847,7 @@ var InvitationsHandler = class {
1850
1847
  } else {
1851
1848
  import_log5.log.warn("auth failed", err, {
1852
1849
  F: __dxlog_file7,
1853
- L: 233,
1850
+ L: 232,
1854
1851
  S: this,
1855
1852
  C: (f, a) => f(...a)
1856
1853
  });
@@ -1864,7 +1861,7 @@ var InvitationsHandler = class {
1864
1861
  ...protocol.toJSON()
1865
1862
  }, {
1866
1863
  F: __dxlog_file7,
1867
- L: 241,
1864
+ L: 240,
1868
1865
  S: this,
1869
1866
  C: (f, a) => f(...a)
1870
1867
  });
@@ -1879,7 +1876,7 @@ var InvitationsHandler = class {
1879
1876
  currentState
1880
1877
  }, {
1881
1878
  F: __dxlog_file7,
1882
- L: 251,
1879
+ L: 250,
1883
1880
  S: this,
1884
1881
  C: (f, a) => f(...a)
1885
1882
  });
@@ -1894,7 +1891,7 @@ var InvitationsHandler = class {
1894
1891
  id: traceId
1895
1892
  }), {
1896
1893
  F: __dxlog_file7,
1897
- L: 260,
1894
+ L: 259,
1898
1895
  S: this,
1899
1896
  C: (f, a) => f(...a)
1900
1897
  });
@@ -1906,7 +1903,7 @@ var InvitationsHandler = class {
1906
1903
  ...protocol.toJSON()
1907
1904
  }, {
1908
1905
  F: __dxlog_file7,
1909
- L: 268,
1906
+ L: 267,
1910
1907
  S: this,
1911
1908
  C: (f, a) => f(...a)
1912
1909
  });
@@ -1917,7 +1914,7 @@ var InvitationsHandler = class {
1917
1914
  ...protocol.toJSON()
1918
1915
  }, {
1919
1916
  F: __dxlog_file7,
1920
- L: 272,
1917
+ L: 271,
1921
1918
  S: this,
1922
1919
  C: (f, a) => f(...a)
1923
1920
  });
@@ -1927,7 +1924,7 @@ var InvitationsHandler = class {
1927
1924
  response: introductionResponse
1928
1925
  }, {
1929
1926
  F: __dxlog_file7,
1930
- L: 276,
1927
+ L: 275,
1931
1928
  S: this,
1932
1929
  C: (f, a) => f(...a)
1933
1930
  });
@@ -1939,7 +1936,7 @@ var InvitationsHandler = class {
1939
1936
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1940
1937
  (0, import_log5.log)("guest waiting for authentication code...", void 0, {
1941
1938
  F: __dxlog_file7,
1942
- L: 285,
1939
+ L: 284,
1943
1940
  S: this,
1944
1941
  C: (f, a) => f(...a)
1945
1942
  });
@@ -1951,7 +1948,7 @@ var InvitationsHandler = class {
1951
1948
  });
1952
1949
  (0, import_log5.log)("sending authentication request", void 0, {
1953
1950
  F: __dxlog_file7,
1954
- L: 289,
1951
+ L: 288,
1955
1952
  S: this,
1956
1953
  C: (f, a) => f(...a)
1957
1954
  });
@@ -1972,7 +1969,7 @@ var InvitationsHandler = class {
1972
1969
  attempt
1973
1970
  }, {
1974
1971
  F: __dxlog_file7,
1975
- L: 300,
1972
+ L: 299,
1976
1973
  S: this,
1977
1974
  C: (f, a) => f(...a)
1978
1975
  });
@@ -1989,7 +1986,7 @@ var InvitationsHandler = class {
1989
1986
  ...protocol.toJSON()
1990
1987
  }, {
1991
1988
  F: __dxlog_file7,
1992
- L: 311,
1989
+ L: 310,
1993
1990
  S: this,
1994
1991
  C: (f, a) => f(...a)
1995
1992
  });
@@ -2001,7 +1998,7 @@ var InvitationsHandler = class {
2001
1998
  ...protocol.toJSON()
2002
1999
  }, {
2003
2000
  F: __dxlog_file7,
2004
- L: 322,
2001
+ L: 321,
2005
2002
  S: this,
2006
2003
  C: (f, a) => f(...a)
2007
2004
  });
@@ -2013,7 +2010,7 @@ var InvitationsHandler = class {
2013
2010
  id: traceId
2014
2011
  }), {
2015
2012
  F: __dxlog_file7,
2016
- L: 324,
2013
+ L: 323,
2017
2014
  S: this,
2018
2015
  C: (f, a) => f(...a)
2019
2016
  });
@@ -2023,7 +2020,7 @@ var InvitationsHandler = class {
2023
2020
  ...protocol.toJSON()
2024
2021
  }, {
2025
2022
  F: __dxlog_file7,
2026
- L: 327,
2023
+ L: 326,
2027
2024
  S: this,
2028
2025
  C: (f, a) => f(...a)
2029
2026
  });
@@ -2033,7 +2030,7 @@ var InvitationsHandler = class {
2033
2030
  } else {
2034
2031
  (0, import_log5.log)("auth failed", err, {
2035
2032
  F: __dxlog_file7,
2036
- L: 330,
2033
+ L: 329,
2037
2034
  S: this,
2038
2035
  C: (f, a) => f(...a)
2039
2036
  });
@@ -2044,7 +2041,7 @@ var InvitationsHandler = class {
2044
2041
  error: err
2045
2042
  }), {
2046
2043
  F: __dxlog_file7,
2047
- L: 333,
2044
+ L: 332,
2048
2045
  S: this,
2049
2046
  C: (f, a) => f(...a)
2050
2047
  });
@@ -2054,7 +2051,7 @@ var InvitationsHandler = class {
2054
2051
  });
2055
2052
  },
2056
2053
  onError: (err) => {
2057
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
2054
+ if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
2058
2055
  return;
2059
2056
  }
2060
2057
  if (err instanceof import_async8.TimeoutError) {
@@ -2062,7 +2059,7 @@ var InvitationsHandler = class {
2062
2059
  ...protocol.toJSON()
2063
2060
  }, {
2064
2061
  F: __dxlog_file7,
2065
- L: 344,
2062
+ L: 343,
2066
2063
  S: this,
2067
2064
  C: (f, a) => f(...a)
2068
2065
  });
@@ -2072,7 +2069,7 @@ var InvitationsHandler = class {
2072
2069
  } else {
2073
2070
  (0, import_log5.log)("auth failed", err, {
2074
2071
  F: __dxlog_file7,
2075
- L: 347,
2072
+ L: 346,
2076
2073
  S: this,
2077
2074
  C: (f, a) => f(...a)
2078
2075
  });
@@ -2085,7 +2082,7 @@ var InvitationsHandler = class {
2085
2082
  (0, import_async8.scheduleTask)(ctx, async () => {
2086
2083
  (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2087
2084
  F: __dxlog_file7,
2088
- L: 357,
2085
+ L: 356,
2089
2086
  S: this,
2090
2087
  A: [
2091
2088
  "invitation.swarmKey",
@@ -2107,7 +2104,7 @@ var InvitationsHandler = class {
2107
2104
  state: import_services3.Invitation.State.CONNECTING
2108
2105
  });
2109
2106
  });
2110
- const observable = new import_client_protocol2.AuthenticatingInvitationObservable({
2107
+ const observable = new import_client_protocol2.AuthenticatingInvitation({
2111
2108
  initialInvitation: invitation,
2112
2109
  subscriber: stream.observable,
2113
2110
  onCancel: async () => {
@@ -2531,9 +2528,6 @@ var import_log8 = require("@dxos/log");
2531
2528
  var import_protocols5 = require("@dxos/protocols");
2532
2529
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2533
2530
 
2534
- // packages/sdk/client-services/src/version.ts
2535
- var DXOS_VERSION = "0.1.58-next.3349da8";
2536
-
2537
2531
  // packages/sdk/client-services/src/packlets/services/platform.ts
2538
2532
  var getPlatform = () => {
2539
2533
  if (process.browser) {
@@ -2562,6 +2556,9 @@ var getPlatform = () => {
2562
2556
  }
2563
2557
  };
2564
2558
 
2559
+ // packages/sdk/client-services/src/version.ts
2560
+ var DXOS_VERSION = "0.1.58-next.ffb4cc4";
2561
+
2565
2562
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2566
2563
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2567
2564
  var DEFAULT_TIMEOUT = 1e3;
@@ -2685,13 +2682,13 @@ var import_async14 = require("@dxos/async");
2685
2682
  var import_context9 = require("@dxos/context");
2686
2683
  var import_credentials14 = require("@dxos/credentials");
2687
2684
  var import_debug7 = require("@dxos/debug");
2688
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
2685
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
2689
2686
  var import_feed_store4 = require("@dxos/feed-store");
2690
- var import_invariant12 = require("@dxos/invariant");
2687
+ var import_invariant13 = require("@dxos/invariant");
2691
2688
  var import_keyring = require("@dxos/keyring");
2692
2689
  var import_keys10 = require("@dxos/keys");
2693
2690
  var import_log13 = require("@dxos/log");
2694
- var import_protocols9 = require("@dxos/protocols");
2691
+ var import_protocols10 = require("@dxos/protocols");
2695
2692
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2696
2693
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2697
2694
  var import_tracing4 = require("@dxos/tracing");
@@ -2704,7 +2701,7 @@ var import_credentials13 = require("@dxos/credentials");
2704
2701
  var import_invariant11 = require("@dxos/invariant");
2705
2702
  var import_keys9 = require("@dxos/keys");
2706
2703
  var import_log11 = require("@dxos/log");
2707
- var import_protocols7 = require("@dxos/protocols");
2704
+ var import_protocols8 = require("@dxos/protocols");
2708
2705
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2709
2706
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2710
2707
  var import_util5 = require("@dxos/util");
@@ -2715,9 +2712,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2715
2712
  var import_context7 = require("@dxos/context");
2716
2713
  var import_debug4 = require("@dxos/debug");
2717
2714
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2718
- var import_errors3 = require("@dxos/errors");
2719
2715
  var import_keys8 = require("@dxos/keys");
2720
2716
  var import_log10 = require("@dxos/log");
2717
+ var import_protocols7 = require("@dxos/protocols");
2721
2718
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2722
2719
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2723
2720
  var import_timeframe2 = require("@dxos/timeframe");
@@ -3026,7 +3023,7 @@ var DataSpace = class DataSpace2 {
3026
3023
  this._signingContext = params.signingContext;
3027
3024
  this._callbacks = params.callbacks ?? {};
3028
3025
  this.authVerifier = new TrustedKeySetAuthVerifier({
3029
- trustedKeysProvider: () => new import_util4.ComplexSet(import_keys8.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
3026
+ trustedKeysProvider: () => new import_util4.ComplexSet(import_keys8.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
3030
3027
  update: this._inner.stateUpdate,
3031
3028
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
3032
3029
  });
@@ -3036,7 +3033,7 @@ var DataSpace = class DataSpace2 {
3036
3033
  state: import_services7.SpaceState[this._state]
3037
3034
  }, {
3038
3035
  F: __dxlog_file12,
3039
- L: 112,
3036
+ L: 118,
3040
3037
  S: this,
3041
3038
  C: (f, a) => f(...a)
3042
3039
  });
@@ -3079,7 +3076,7 @@ var DataSpace = class DataSpace2 {
3079
3076
  state: import_services7.SpaceState[this._state]
3080
3077
  }, {
3081
3078
  F: __dxlog_file12,
3082
- L: 159,
3079
+ L: 165,
3083
3080
  S: this,
3084
3081
  C: (f, a) => f(...a)
3085
3082
  });
@@ -3097,7 +3094,7 @@ var DataSpace = class DataSpace2 {
3097
3094
  state: import_services7.SpaceState[this._state]
3098
3095
  }, {
3099
3096
  F: __dxlog_file12,
3100
- L: 173,
3097
+ L: 179,
3101
3098
  S: this,
3102
3099
  C: (f, a) => f(...a)
3103
3100
  });
@@ -3125,10 +3122,10 @@ var DataSpace = class DataSpace2 {
3125
3122
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3126
3123
  await this.initializeDataPipeline();
3127
3124
  } catch (err) {
3128
- if (err instanceof import_errors3.CancelledError) {
3125
+ if (err instanceof import_protocols7.CancelledError) {
3129
3126
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3130
3127
  F: __dxlog_file12,
3131
- L: 205,
3128
+ L: 211,
3132
3129
  S: this,
3133
3130
  C: (f, a) => f(...a)
3134
3131
  });
@@ -3136,7 +3133,7 @@ var DataSpace = class DataSpace2 {
3136
3133
  }
3137
3134
  import_log10.log.error("Error initializing data pipeline", err, {
3138
3135
  F: __dxlog_file12,
3139
- L: 209,
3136
+ L: 215,
3140
3137
  S: this,
3141
3138
  C: (f, a) => f(...a)
3142
3139
  });
@@ -3145,7 +3142,7 @@ var DataSpace = class DataSpace2 {
3145
3142
  state: import_services7.SpaceState[this._state]
3146
3143
  }, {
3147
3144
  F: __dxlog_file12,
3148
- L: 211,
3145
+ L: 217,
3149
3146
  S: this,
3150
3147
  C: (f, a) => f(...a)
3151
3148
  });
@@ -3158,14 +3155,14 @@ var DataSpace = class DataSpace2 {
3158
3155
  }
3159
3156
  async initializeDataPipeline() {
3160
3157
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
3161
- throw new import_errors3.SystemError("Invalid operation");
3158
+ throw new import_protocols7.SystemError("Invalid operation");
3162
3159
  }
3163
3160
  this._state = import_services7.SpaceState.INITIALIZING;
3164
3161
  (0, import_log10.log)("new state", {
3165
3162
  state: import_services7.SpaceState[this._state]
3166
3163
  }, {
3167
3164
  F: __dxlog_file12,
3168
- L: 227,
3165
+ L: 233,
3169
3166
  S: this,
3170
3167
  C: (f, a) => f(...a)
3171
3168
  });
@@ -3176,7 +3173,7 @@ var DataSpace = class DataSpace2 {
3176
3173
  await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3177
3174
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3178
3175
  F: __dxlog_file12,
3179
- L: 241,
3176
+ L: 247,
3180
3177
  S: this,
3181
3178
  C: (f, a) => f(...a)
3182
3179
  });
@@ -3187,7 +3184,7 @@ var DataSpace = class DataSpace2 {
3187
3184
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3188
3185
  (0, import_log10.log)("data pipeline ready", void 0, {
3189
3186
  F: __dxlog_file12,
3190
- L: 250,
3187
+ L: 256,
3191
3188
  S: this,
3192
3189
  C: (f, a) => f(...a)
3193
3190
  });
@@ -3197,7 +3194,7 @@ var DataSpace = class DataSpace2 {
3197
3194
  state: import_services7.SpaceState[this._state]
3198
3195
  }, {
3199
3196
  F: __dxlog_file12,
3200
- L: 254,
3197
+ L: 260,
3201
3198
  S: this,
3202
3199
  C: (f, a) => f(...a)
3203
3200
  });
@@ -3213,7 +3210,7 @@ var DataSpace = class DataSpace2 {
3213
3210
  await this._createWritableFeeds();
3214
3211
  (0, import_log10.log)("writable feeds created", void 0, {
3215
3212
  F: __dxlog_file12,
3216
- L: 270,
3213
+ L: 276,
3217
3214
  S: this,
3218
3215
  C: (f, a) => f(...a)
3219
3216
  });
@@ -3318,7 +3315,7 @@ var DataSpace = class DataSpace2 {
3318
3315
  state: import_services7.SpaceState[this._state]
3319
3316
  }, {
3320
3317
  F: __dxlog_file12,
3321
- L: 386,
3318
+ L: 392,
3322
3319
  S: this,
3323
3320
  C: (f, a) => f(...a)
3324
3321
  });
@@ -3460,7 +3457,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3460
3457
  S: this,
3461
3458
  C: (f, a) => f(...a)
3462
3459
  });
3463
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.begin({
3460
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.begin({
3464
3461
  id: this._instanceId
3465
3462
  }), {
3466
3463
  F: __dxlog_file13,
@@ -3506,7 +3503,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3506
3503
  space.initializeDataPipelineAsync();
3507
3504
  }
3508
3505
  }
3509
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3506
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.end({
3510
3507
  id: this._instanceId
3511
3508
  }), {
3512
3509
  F: __dxlog_file13,
@@ -3760,10 +3757,9 @@ DataSpaceManager = _ts_decorate4([
3760
3757
  var import_async13 = require("@dxos/async");
3761
3758
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3762
3759
  var import_debug6 = require("@dxos/debug");
3763
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3764
- var import_errors4 = require("@dxos/errors");
3760
+ var import_invariant12 = require("@dxos/invariant");
3765
3761
  var import_log12 = require("@dxos/log");
3766
- var import_protocols8 = require("@dxos/protocols");
3762
+ var import_protocols9 = require("@dxos/protocols");
3767
3763
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3768
3764
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3769
3765
  var SpacesServiceImpl = class {
@@ -3783,7 +3779,7 @@ var SpacesServiceImpl = class {
3783
3779
  }
3784
3780
  async updateSpace({ spaceKey, state }) {
3785
3781
  const dataSpaceManager = await this._getDataSpaceManager();
3786
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3782
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3787
3783
  if (state) {
3788
3784
  switch (state) {
3789
3785
  case import_services9.SpaceState.ACTIVE:
@@ -3793,7 +3789,7 @@ var SpacesServiceImpl = class {
3793
3789
  await space.deactivate();
3794
3790
  break;
3795
3791
  default:
3796
- throw new import_errors4.ApiError("Invalid space state");
3792
+ throw new import_protocols9.ApiError("Invalid space state");
3797
3793
  }
3798
3794
  }
3799
3795
  }
@@ -3826,7 +3822,7 @@ var SpacesServiceImpl = class {
3826
3822
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3827
3823
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3828
3824
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3829
- space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
3825
+ subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3830
3826
  if (space.dataPipeline.pipelineState) {
3831
3827
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3832
3828
  }
@@ -3848,14 +3844,14 @@ var SpacesServiceImpl = class {
3848
3844
  }
3849
3845
  async postMessage({ spaceKey, channel, message }) {
3850
3846
  const dataSpaceManager = await this._getDataSpaceManager();
3851
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3847
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3852
3848
  await space.postMessage(getChannelId(channel), message);
3853
3849
  }
3854
3850
  subscribeMessages({ spaceKey, channel }) {
3855
3851
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3856
3852
  (0, import_async13.scheduleTask)(ctx, async () => {
3857
3853
  const dataSpaceManager = await this._getDataSpaceManager();
3858
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3854
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3859
3855
  const handle = space.listen(getChannelId(channel), (message) => {
3860
3856
  next(message);
3861
3857
  });
@@ -3863,38 +3859,83 @@ var SpacesServiceImpl = class {
3863
3859
  });
3864
3860
  });
3865
3861
  }
3866
- queryCredentials({ spaceKey }) {
3867
- return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3868
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3862
+ queryCredentials({ spaceKey, noTail }) {
3863
+ return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
3864
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3869
3865
  const processor = {
3870
3866
  processCredential: async (credential) => {
3871
3867
  next(credential);
3872
3868
  }
3873
3869
  };
3874
3870
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3875
- (0, import_async13.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
3871
+ (0, import_async13.scheduleTask)(ctx, async () => {
3872
+ await space.spaceState.addCredentialProcessor(processor);
3873
+ if (noTail) {
3874
+ close();
3875
+ }
3876
+ });
3876
3877
  });
3877
3878
  }
3878
3879
  async writeCredentials({ spaceKey, credentials }) {
3879
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3880
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3880
3881
  for (const credential of credentials ?? []) {
3881
- await space.controlPipeline.writer.write({
3882
- credential: {
3883
- credential
3884
- }
3885
- });
3882
+ if (credential.proof) {
3883
+ await space.controlPipeline.writer.write({
3884
+ credential: {
3885
+ credential
3886
+ }
3887
+ });
3888
+ } else {
3889
+ (0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3890
+ F: __dxlog_file14,
3891
+ L: 168,
3892
+ S: this,
3893
+ A: [
3894
+ "!credential.id",
3895
+ "'Id on unsigned credentials is not allowed'"
3896
+ ]
3897
+ });
3898
+ (0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
3899
+ F: __dxlog_file14,
3900
+ L: 169,
3901
+ S: this,
3902
+ A: [
3903
+ "this._identityManager.identity",
3904
+ "'Identity is not available'"
3905
+ ]
3906
+ });
3907
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3908
+ (0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3909
+ F: __dxlog_file14,
3910
+ L: 171,
3911
+ S: this,
3912
+ A: [
3913
+ "credential.issuer.equals(signer.getIssuer())",
3914
+ ""
3915
+ ]
3916
+ });
3917
+ const signedCredential = await signer.createCredential({
3918
+ subject: credential.subject.id,
3919
+ assertion: credential.subject.assertion
3920
+ });
3921
+ await space.controlPipeline.writer.write({
3922
+ credential: {
3923
+ credential: signedCredential
3924
+ }
3925
+ });
3926
+ }
3886
3927
  }
3887
3928
  }
3888
3929
  async createEpoch({ spaceKey }) {
3889
3930
  const dataSpaceManager = await this._getDataSpaceManager();
3890
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3931
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3891
3932
  await space.createEpoch();
3892
3933
  }
3893
3934
  _serializeSpace(space) {
3894
3935
  return {
3895
3936
  spaceKey: space.key,
3896
3937
  state: space.state,
3897
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3938
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3898
3939
  pipeline: {
3899
3940
  currentEpoch: space.dataPipeline.currentEpoch,
3900
3941
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3921,7 +3962,7 @@ var SpacesServiceImpl = class {
3921
3962
  displayName: member.assertion.profile?.displayName
3922
3963
  }
3923
3964
  },
3924
- presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3965
+ presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3925
3966
  peerStates: peers
3926
3967
  };
3927
3968
  }),
@@ -3946,18 +3987,17 @@ function _ts_decorate5(decorators, target, key, desc) {
3946
3987
  }
3947
3988
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3948
3989
  var ServiceContext = class ServiceContext2 {
3949
- // prettier-ignore
3950
3990
  constructor(storage, networkManager, signalManager, modelFactory) {
3951
3991
  this.storage = storage;
3952
3992
  this.networkManager = networkManager;
3953
3993
  this.signalManager = signalManager;
3954
3994
  this.modelFactory = modelFactory;
3955
3995
  this.initialized = new import_async14.Trigger();
3956
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3996
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3957
3997
  this._handlerFactories = /* @__PURE__ */ new Map();
3958
3998
  this._instanceId = import_keys10.PublicKey.random().toHex();
3959
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3960
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
3999
+ this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
4000
+ this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3961
4001
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3962
4002
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3963
4003
  this.feedStore = new import_feed_store4.FeedStore({
@@ -3965,12 +4005,12 @@ var ServiceContext = class ServiceContext2 {
3965
4005
  root: storage.createDirectory("feeds"),
3966
4006
  signer: this.keyring,
3967
4007
  hypercore: {
3968
- valueEncoding: import_echo_pipeline3.valueEncoding,
4008
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3969
4009
  stats: true
3970
4010
  }
3971
4011
  })
3972
4012
  });
3973
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
4013
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3974
4014
  feedStore: this.feedStore,
3975
4015
  networkManager: this.networkManager,
3976
4016
  blobStore: this.blobStore,
@@ -3986,15 +4026,15 @@ var ServiceContext = class ServiceContext2 {
3986
4026
  await this._checkStorageVersion();
3987
4027
  (0, import_log13.log)("opening...", void 0, {
3988
4028
  F: __dxlog_file15,
3989
- L: 135,
4029
+ L: 129,
3990
4030
  S: this,
3991
4031
  C: (f, a) => f(...a)
3992
4032
  });
3993
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.begin({
4033
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.begin({
3994
4034
  id: this._instanceId
3995
4035
  }), {
3996
4036
  F: __dxlog_file15,
3997
- L: 136,
4037
+ L: 130,
3998
4038
  S: this,
3999
4039
  C: (f, a) => f(...a)
4000
4040
  });
@@ -4006,17 +4046,17 @@ var ServiceContext = class ServiceContext2 {
4006
4046
  if (this.identityManager.identity) {
4007
4047
  await this._initialize(ctx);
4008
4048
  }
4009
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
4049
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.end({
4010
4050
  id: this._instanceId
4011
4051
  }), {
4012
4052
  F: __dxlog_file15,
4013
- L: 146,
4053
+ L: 140,
4014
4054
  S: this,
4015
4055
  C: (f, a) => f(...a)
4016
4056
  });
4017
4057
  (0, import_log13.log)("opened", void 0, {
4018
4058
  F: __dxlog_file15,
4019
- L: 147,
4059
+ L: 141,
4020
4060
  S: this,
4021
4061
  C: (f, a) => f(...a)
4022
4062
  });
@@ -4024,7 +4064,7 @@ var ServiceContext = class ServiceContext2 {
4024
4064
  async close() {
4025
4065
  (0, import_log13.log)("closing...", void 0, {
4026
4066
  F: __dxlog_file15,
4027
- L: 151,
4067
+ L: 145,
4028
4068
  S: this,
4029
4069
  C: (f, a) => f(...a)
4030
4070
  });
@@ -4041,7 +4081,7 @@ var ServiceContext = class ServiceContext2 {
4041
4081
  await this.metadataStore.close();
4042
4082
  (0, import_log13.log)("closed", void 0, {
4043
4083
  F: __dxlog_file15,
4044
- L: 163,
4084
+ L: 157,
4045
4085
  S: this,
4046
4086
  C: (f, a) => f(...a)
4047
4087
  });
@@ -4053,9 +4093,9 @@ var ServiceContext = class ServiceContext2 {
4053
4093
  }
4054
4094
  getInvitationHandler(invitation) {
4055
4095
  const factory = this._handlerFactories.get(invitation.kind);
4056
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4096
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4057
4097
  F: __dxlog_file15,
4058
- L: 174,
4098
+ L: 168,
4059
4099
  S: this,
4060
4100
  A: [
4061
4101
  "factory",
@@ -4071,15 +4111,15 @@ var ServiceContext = class ServiceContext2 {
4071
4111
  }
4072
4112
  async _checkStorageVersion() {
4073
4113
  await this.metadataStore.load();
4074
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
4075
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
4114
+ if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
4115
+ throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
4076
4116
  }
4077
4117
  }
4078
4118
  // Called when identity is created.
4079
4119
  async _initialize(ctx) {
4080
4120
  (0, import_log13.log)("initializing spaces...", void 0, {
4081
4121
  F: __dxlog_file15,
4082
- L: 195,
4122
+ L: 189,
4083
4123
  S: this,
4084
4124
  C: (f, a) => f(...a)
4085
4125
  });
@@ -4100,9 +4140,9 @@ var ServiceContext = class ServiceContext2 {
4100
4140
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
4101
4141
  await this.dataSpaceManager.open();
4102
4142
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4103
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4143
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4104
4144
  F: __dxlog_file15,
4105
- L: 218,
4145
+ L: 212,
4106
4146
  S: this,
4107
4147
  A: [
4108
4148
  "this.dataSpaceManager",
@@ -4126,7 +4166,7 @@ var ServiceContext = class ServiceContext2 {
4126
4166
  details: assertion
4127
4167
  }, {
4128
4168
  F: __dxlog_file15,
4129
- L: 234,
4169
+ L: 228,
4130
4170
  S: this,
4131
4171
  C: (f, a) => f(...a)
4132
4172
  });
@@ -4137,7 +4177,7 @@ var ServiceContext = class ServiceContext2 {
4137
4177
  details: assertion
4138
4178
  }, {
4139
4179
  F: __dxlog_file15,
4140
- L: 238,
4180
+ L: 232,
4141
4181
  S: this,
4142
4182
  C: (f, a) => f(...a)
4143
4183
  });
@@ -4148,7 +4188,7 @@ var ServiceContext = class ServiceContext2 {
4148
4188
  details: assertion
4149
4189
  }, {
4150
4190
  F: __dxlog_file15,
4151
- L: 243,
4191
+ L: 237,
4152
4192
  S: this,
4153
4193
  C: (f, a) => f(...a)
4154
4194
  });
@@ -4159,7 +4199,7 @@ var ServiceContext = class ServiceContext2 {
4159
4199
  } catch (err) {
4160
4200
  import_log13.log.catch(err, void 0, {
4161
4201
  F: __dxlog_file15,
4162
- L: 249,
4202
+ L: 243,
4163
4203
  S: this,
4164
4204
  C: (f, a) => f(...a)
4165
4205
  });
@@ -4185,19 +4225,44 @@ var import_async17 = require("@dxos/async");
4185
4225
  var import_client_protocol5 = require("@dxos/client-protocol");
4186
4226
  var import_context10 = require("@dxos/context");
4187
4227
  var import_document_model2 = require("@dxos/document-model");
4188
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4189
- var import_invariant14 = require("@dxos/invariant");
4228
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
4229
+ var import_echo_schema = require("@dxos/echo-schema");
4230
+ var import_invariant15 = require("@dxos/invariant");
4190
4231
  var import_keys11 = require("@dxos/keys");
4191
4232
  var import_log16 = require("@dxos/log");
4192
4233
  var import_messaging = require("@dxos/messaging");
4193
4234
  var import_model_factory = require("@dxos/model-factory");
4194
4235
  var import_network_manager2 = require("@dxos/network-manager");
4195
- var import_protocols10 = require("@dxos/protocols");
4236
+ var import_protocols12 = require("@dxos/protocols");
4196
4237
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4197
4238
  var import_text_model = require("@dxos/text-model");
4198
4239
  var import_tracing5 = require("@dxos/tracing");
4199
4240
  var import_websocket_rpc = require("@dxos/websocket-rpc");
4200
4241
 
4242
+ // packages/sdk/client-services/src/packlets/services/service-registry.ts
4243
+ var ServiceRegistry = class {
4244
+ // prettier-ignore
4245
+ constructor(_serviceBundle, _handlers = {}) {
4246
+ this._serviceBundle = _serviceBundle;
4247
+ this._handlers = _handlers;
4248
+ }
4249
+ get descriptors() {
4250
+ return this._serviceBundle;
4251
+ }
4252
+ get services() {
4253
+ return this._handlers;
4254
+ }
4255
+ setServices(services) {
4256
+ this._handlers = services;
4257
+ }
4258
+ addService(name, service) {
4259
+ this._handlers[name] = service;
4260
+ }
4261
+ removeService(name) {
4262
+ delete this._handlers[name];
4263
+ }
4264
+ };
4265
+
4201
4266
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4202
4267
  var import_async15 = require("@dxos/async");
4203
4268
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
@@ -4242,7 +4307,7 @@ var DevicesServiceImpl = class {
4242
4307
  };
4243
4308
 
4244
4309
  // packages/sdk/client-services/src/packlets/locks/node.ts
4245
- var import_invariant13 = require("@dxos/invariant");
4310
+ var import_invariant14 = require("@dxos/invariant");
4246
4311
  var import_lock_file = require("@dxos/lock-file");
4247
4312
  var import_log14 = require("@dxos/log");
4248
4313
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4283,7 +4348,7 @@ var Lock = class {
4283
4348
  }
4284
4349
  async release() {
4285
4350
  await this._onRelease?.();
4286
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4351
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4287
4352
  F: __dxlog_file16,
4288
4353
  L: 42,
4289
4354
  S: this,
@@ -4451,29 +4516,29 @@ var NetworkServiceImpl = class {
4451
4516
 
4452
4517
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4453
4518
  var import_client_protocol4 = require("@dxos/client-protocol");
4454
- var import_errors5 = require("@dxos/errors");
4519
+ var import_protocols11 = require("@dxos/protocols");
4455
4520
  var import_config = require("@dxos/protocols/proto/dxos/config");
4456
4521
  var import_random_access_storage = require("@dxos/random-access-storage");
4457
4522
  var import_util8 = require("@dxos/util");
4458
4523
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4459
4524
  var createStorageObjects = (config) => {
4460
- const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4461
- if (persistent && storageType === StorageDriver.RAM) {
4462
- throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4525
+ const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4526
+ if (persistent && dataStore === StorageDriver.RAM) {
4527
+ throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4463
4528
  }
4464
- if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4465
- throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4529
+ if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
4530
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4466
4531
  }
4467
- if (persistent && keyStorage === StorageDriver.RAM) {
4468
- throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4532
+ if (persistent && keyStore === StorageDriver.RAM) {
4533
+ throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4469
4534
  }
4470
- if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4471
- throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4535
+ if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
4536
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4472
4537
  }
4473
4538
  return {
4474
4539
  storage: (0, import_random_access_storage.createStorage)({
4475
- type: persistent ? toStorageType(storageType) : import_random_access_storage.StorageType.RAM,
4476
- root: `${path}/`
4540
+ type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
4541
+ root: `${dataRoot}/`
4477
4542
  })
4478
4543
  };
4479
4544
  };
@@ -4552,30 +4617,6 @@ var SystemServiceImpl = class {
4552
4617
  }
4553
4618
  };
4554
4619
 
4555
- // packages/sdk/client-services/src/packlets/services/service-registry.ts
4556
- var ServiceRegistry = class {
4557
- // prettier-ignore
4558
- constructor(_serviceBundle, _handlers = {}) {
4559
- this._serviceBundle = _serviceBundle;
4560
- this._handlers = _handlers;
4561
- }
4562
- get descriptors() {
4563
- return this._serviceBundle;
4564
- }
4565
- get services() {
4566
- return this._handlers;
4567
- }
4568
- setServices(services) {
4569
- this._handlers = services;
4570
- }
4571
- addService(name, service) {
4572
- this._handlers[name] = service;
4573
- }
4574
- removeService(name) {
4575
- delete this._handlers[name];
4576
- }
4577
- };
4578
-
4579
4620
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4580
4621
  function _ts_decorate7(decorators, target, key, desc) {
4581
4622
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4591,6 +4632,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4591
4632
  var createDefaultModelFactory = () => {
4592
4633
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4593
4634
  };
4635
+ var createGenesisMutationFromTypedObject = (obj) => {
4636
+ const snapshot = obj[import_echo_schema.base]._createSnapshot();
4637
+ return {
4638
+ objectId: obj[import_echo_schema.base]._id,
4639
+ genesis: {
4640
+ modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
4641
+ },
4642
+ snapshot: {
4643
+ model: snapshot
4644
+ }
4645
+ };
4646
+ };
4594
4647
  var ClientServicesHost = class ClientServicesHost2 {
4595
4648
  constructor({
4596
4649
  config,
@@ -4675,9 +4728,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4675
4728
  * Can only be called once.
4676
4729
  */
4677
4730
  initialize({ config, ...options }) {
4678
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4731
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4679
4732
  F: __dxlog_file17,
4680
- L: 184,
4733
+ L: 201,
4681
4734
  S: this,
4682
4735
  A: [
4683
4736
  "!this._open",
@@ -4686,14 +4739,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4686
4739
  });
4687
4740
  (0, import_log16.log)("initializing...", void 0, {
4688
4741
  F: __dxlog_file17,
4689
- L: 185,
4742
+ L: 202,
4690
4743
  S: this,
4691
4744
  C: (f, a) => f(...a)
4692
4745
  });
4693
4746
  if (config) {
4694
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4747
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4695
4748
  F: __dxlog_file17,
4696
- L: 188,
4749
+ L: 205,
4697
4750
  S: this,
4698
4751
  A: [
4699
4752
  "!this._config",
@@ -4709,9 +4762,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4709
4762
  iceServers: this._config?.get("runtime.services.ice")
4710
4763
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4711
4764
  this._signalManager = signalManager;
4712
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4765
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4713
4766
  F: __dxlog_file17,
4714
- L: 204,
4767
+ L: 221,
4715
4768
  S: this,
4716
4769
  A: [
4717
4770
  "!this._networkManager",
@@ -4725,7 +4778,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4725
4778
  });
4726
4779
  (0, import_log16.log)("initialized", void 0, {
4727
4780
  F: __dxlog_file17,
4728
- L: 211,
4781
+ L: 228,
4729
4782
  S: this,
4730
4783
  C: (f, a) => f(...a)
4731
4784
  });
@@ -4735,44 +4788,44 @@ var ClientServicesHost = class ClientServicesHost2 {
4735
4788
  return;
4736
4789
  }
4737
4790
  const traceId = import_keys11.PublicKey.random().toHex();
4738
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.begin({
4791
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4739
4792
  id: traceId
4740
4793
  }), {
4741
4794
  F: __dxlog_file17,
4742
- L: 222,
4795
+ L: 239,
4743
4796
  S: this,
4744
4797
  C: (f, a) => f(...a)
4745
4798
  });
4746
- (0, import_invariant14.invariant)(this._config, "config not set", {
4799
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4747
4800
  F: __dxlog_file17,
4748
- L: 224,
4801
+ L: 241,
4749
4802
  S: this,
4750
4803
  A: [
4751
4804
  "this._config",
4752
4805
  "'config not set'"
4753
4806
  ]
4754
4807
  });
4755
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4808
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4756
4809
  F: __dxlog_file17,
4757
- L: 225,
4810
+ L: 242,
4758
4811
  S: this,
4759
4812
  A: [
4760
4813
  "this._storage",
4761
4814
  "'storage not set'"
4762
4815
  ]
4763
4816
  });
4764
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4817
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4765
4818
  F: __dxlog_file17,
4766
- L: 226,
4819
+ L: 243,
4767
4820
  S: this,
4768
4821
  A: [
4769
4822
  "this._signalManager",
4770
4823
  "'signal manager not set'"
4771
4824
  ]
4772
4825
  });
4773
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4826
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4774
4827
  F: __dxlog_file17,
4775
- L: 227,
4828
+ L: 244,
4776
4829
  S: this,
4777
4830
  A: [
4778
4831
  "this._networkManager",
@@ -4784,7 +4837,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4784
4837
  lockKey: this._resourceLock?.lockKey
4785
4838
  }, {
4786
4839
  F: __dxlog_file17,
4787
- L: 230,
4840
+ L: 247,
4788
4841
  S: this,
4789
4842
  C: (f, a) => f(...a)
4790
4843
  });
@@ -4793,14 +4846,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4793
4846
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4794
4847
  this._serviceRegistry.setServices({
4795
4848
  SystemService: this._systemService,
4796
- IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4849
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4797
4850
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4798
4851
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4799
4852
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
4800
4853
  await this._serviceContext.initialized.wait();
4801
4854
  return this._serviceContext.dataSpaceManager;
4802
4855
  }),
4803
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4856
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4804
4857
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4805
4858
  LoggingService: this._loggingService,
4806
4859
  TracingService: this._tracingService,
@@ -4830,15 +4883,15 @@ var ClientServicesHost = class ClientServicesHost2 {
4830
4883
  deviceKey
4831
4884
  }, {
4832
4885
  F: __dxlog_file17,
4833
- L: 299,
4886
+ L: 316,
4834
4887
  S: this,
4835
4888
  C: (f, a) => f(...a)
4836
4889
  });
4837
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.end({
4890
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
4838
4891
  id: traceId
4839
4892
  }), {
4840
4893
  F: __dxlog_file17,
4841
- L: 300,
4894
+ L: 317,
4842
4895
  S: this,
4843
4896
  C: (f, a) => f(...a)
4844
4897
  });
@@ -4852,7 +4905,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4852
4905
  deviceKey
4853
4906
  }, {
4854
4907
  F: __dxlog_file17,
4855
- L: 311,
4908
+ L: 328,
4856
4909
  S: this,
4857
4910
  C: (f, a) => f(...a)
4858
4911
  });
@@ -4868,24 +4921,24 @@ var ClientServicesHost = class ClientServicesHost2 {
4868
4921
  deviceKey
4869
4922
  }, {
4870
4923
  F: __dxlog_file17,
4871
- L: 318,
4924
+ L: 335,
4872
4925
  S: this,
4873
4926
  C: (f, a) => f(...a)
4874
4927
  });
4875
4928
  }
4876
4929
  async reset() {
4877
4930
  const traceId = import_keys11.PublicKey.random().toHex();
4878
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.begin({
4931
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4879
4932
  id: traceId
4880
4933
  }), {
4881
4934
  F: __dxlog_file17,
4882
- L: 323,
4935
+ L: 340,
4883
4936
  S: this,
4884
4937
  C: (f, a) => f(...a)
4885
4938
  });
4886
4939
  (0, import_log16.log)("resetting...", void 0, {
4887
4940
  F: __dxlog_file17,
4888
- L: 325,
4941
+ L: 342,
4889
4942
  S: this,
4890
4943
  C: (f, a) => f(...a)
4891
4944
  });
@@ -4893,20 +4946,39 @@ var ClientServicesHost = class ClientServicesHost2 {
4893
4946
  await this._storage.reset();
4894
4947
  (0, import_log16.log)("reset", void 0, {
4895
4948
  F: __dxlog_file17,
4896
- L: 328,
4949
+ L: 345,
4897
4950
  S: this,
4898
4951
  C: (f, a) => f(...a)
4899
4952
  });
4900
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.end({
4953
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
4901
4954
  id: traceId
4902
4955
  }), {
4903
4956
  F: __dxlog_file17,
4904
- L: 329,
4957
+ L: 346,
4905
4958
  S: this,
4906
4959
  C: (f, a) => f(...a)
4907
4960
  });
4908
4961
  await this._callbacks?.onReset?.();
4909
4962
  }
4963
+ async _createIdentity(params) {
4964
+ const identity = await this._serviceContext.createIdentity(params);
4965
+ await this._serviceContext.initialized.wait();
4966
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
4967
+ const obj = new import_client_protocol5.Properties();
4968
+ obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
4969
+ await this._serviceRegistry.services.DataService.write({
4970
+ spaceKey: space.key,
4971
+ batch: {
4972
+ objects: [
4973
+ createGenesisMutationFromTypedObject(obj)
4974
+ ]
4975
+ }
4976
+ });
4977
+ await this._serviceRegistry.services.DataService.flush({
4978
+ spaceKey: space.key
4979
+ });
4980
+ return identity;
4981
+ }
4910
4982
  };
4911
4983
  _ts_decorate7([
4912
4984
  import_tracing5.trace.info()
@@ -4938,7 +5010,7 @@ var import_util10 = require("@dxos/util");
4938
5010
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4939
5011
  var import_async18 = require("@dxos/async");
4940
5012
  var import_client_protocol6 = require("@dxos/client-protocol");
4941
- var import_invariant15 = require("@dxos/invariant");
5013
+ var import_invariant16 = require("@dxos/invariant");
4942
5014
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
4943
5015
  var import_rpc2 = require("@dxos/rpc");
4944
5016
  var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
@@ -4957,17 +5029,18 @@ var ShellRuntimeImpl = class {
4957
5029
  get spaceKey() {
4958
5030
  return this._spaceKey;
4959
5031
  }
4960
- setLayout(layout, options = {}) {
5032
+ setLayout({ layout, invitationCode, spaceKey }) {
4961
5033
  this._layout = layout;
4962
- this._invitationCode = options.invitationCode;
4963
- this._spaceKey = options.spaceKey;
5034
+ this._invitationCode = invitationCode;
5035
+ this._spaceKey = spaceKey;
4964
5036
  this.layoutUpdate.emit({
4965
5037
  layout,
4966
- ...options
5038
+ invitationCode,
5039
+ spaceKey
4967
5040
  });
4968
5041
  }
4969
5042
  async setAppContext(context) {
4970
- (0, import_invariant15.invariant)(this._appRpc, "runtime not open", {
5043
+ (0, import_invariant16.invariant)(this._appRpc, "runtime not open", {
4971
5044
  F: __dxlog_file18,
4972
5045
  L: 44,
4973
5046
  S: this,
@@ -5123,9 +5196,9 @@ _ts_decorate8([
5123
5196
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
5124
5197
  var import_async20 = require("@dxos/async");
5125
5198
  var import_client_protocol8 = require("@dxos/client-protocol");
5126
- var import_errors6 = require("@dxos/errors");
5127
5199
  var import_log18 = require("@dxos/log");
5128
5200
  var import_network_manager4 = require("@dxos/network-manager");
5201
+ var import_protocols13 = require("@dxos/protocols");
5129
5202
  var import_rpc3 = require("@dxos/rpc");
5130
5203
  var import_util11 = require("@dxos/util");
5131
5204
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
@@ -5181,7 +5254,7 @@ var IFrameProxyRuntime = class {
5181
5254
  S: this,
5182
5255
  C: (f, a) => f(...a)
5183
5256
  });
5184
- throw new import_errors6.RemoteServiceConnectionError("Failed to connect to worker");
5257
+ throw new import_protocols13.RemoteServiceConnectionError("Failed to connect to worker");
5185
5258
  }
5186
5259
  await this._shellRuntime?.open();
5187
5260
  }
@@ -5206,7 +5279,7 @@ var import_network_manager5 = require("@dxos/network-manager");
5206
5279
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
5207
5280
  var import_async21 = require("@dxos/async");
5208
5281
  var import_client_protocol9 = require("@dxos/client-protocol");
5209
- var import_invariant16 = require("@dxos/invariant");
5282
+ var import_invariant17 = require("@dxos/invariant");
5210
5283
  var import_log19 = require("@dxos/log");
5211
5284
  var import_rpc4 = require("@dxos/rpc");
5212
5285
  var import_util12 = require("@dxos/util");
@@ -5225,7 +5298,7 @@ var WorkerSession = class {
5225
5298
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
5226
5299
  this._startTrigger = new import_async21.Trigger();
5227
5300
  this.onClose = new import_util12.Callback();
5228
- (0, import_invariant16.invariant)(serviceHost, void 0, {
5301
+ (0, import_invariant17.invariant)(serviceHost, void 0, {
5229
5302
  F: __dxlog_file21,
5230
5303
  L: 49,
5231
5304
  S: this,
@@ -5376,7 +5449,6 @@ _ts_decorate9([
5376
5449
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
5377
5450
  var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
5378
5451
  var WorkerRuntime = class {
5379
- // prettier-ignore
5380
5452
  constructor(_configProvider) {
5381
5453
  this._configProvider = _configProvider;
5382
5454
  this._transportFactory = new import_network_manager5.SimplePeerTransportProxyFactory();
@@ -5396,7 +5468,7 @@ var WorkerRuntime = class {
5396
5468
  async start() {
5397
5469
  (0, import_log20.log)("starting...", void 0, {
5398
5470
  F: __dxlog_file22,
5399
- L: 49,
5471
+ L: 52,
5400
5472
  S: this,
5401
5473
  C: (f, a) => f(...a)
5402
5474
  });
@@ -5412,7 +5484,7 @@ var WorkerRuntime = class {
5412
5484
  this._ready.wake(void 0);
5413
5485
  (0, import_log20.log)("started", void 0, {
5414
5486
  F: __dxlog_file22,
5415
- L: 63,
5487
+ L: 66,
5416
5488
  S: this,
5417
5489
  C: (f, a) => f(...a)
5418
5490
  });
@@ -5420,7 +5492,7 @@ var WorkerRuntime = class {
5420
5492
  this._ready.wake(err);
5421
5493
  import_log20.log.error("starting", err, {
5422
5494
  F: __dxlog_file22,
5423
- L: 66,
5495
+ L: 69,
5424
5496
  S: this,
5425
5497
  C: (f, a) => f(...a)
5426
5498
  });
@@ -5454,7 +5526,7 @@ var WorkerRuntime = class {
5454
5526
  _reconnectWebrtc() {
5455
5527
  (0, import_log20.log)("reconnecting webrtc...", void 0, {
5456
5528
  F: __dxlog_file22,
5457
- L: 103,
5529
+ L: 106,
5458
5530
  S: this,
5459
5531
  C: (f, a) => f(...a)
5460
5532
  });