@dxos/client-services 0.1.58-main.353d0d1 → 0.1.58-main.44da53d

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 (38) hide show
  1. package/dist/lib/browser/{chunk-FJAPMZDU.mjs → chunk-PSL7MYD4.mjs} +164 -116
  2. package/dist/lib/browser/chunk-PSL7MYD4.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +7 -6
  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 +3 -3
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +204 -155
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +203 -155
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  14. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
  15. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  16. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  17. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  18. package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
  19. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  20. package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
  21. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  22. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
  23. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/package.json +34 -35
  26. package/src/packlets/identity/authenticator.ts +1 -1
  27. package/src/packlets/invitations/invitation-extension.ts +1 -2
  28. package/src/packlets/invitations/invitations-handler.ts +7 -8
  29. package/src/packlets/invitations/invitations-service.ts +11 -7
  30. package/src/packlets/services/service-context.ts +2 -2
  31. package/src/packlets/spaces/data-space.ts +10 -2
  32. package/src/packlets/spaces/spaces-service.ts +29 -8
  33. package/src/packlets/storage/storage.ts +1 -1
  34. package/src/packlets/testing/invitation-utils.ts +9 -9
  35. package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
  36. package/src/packlets/vault/shell-runtime.ts +4 -4
  37. package/src/version.ts +1 -1
  38. package/dist/lib/browser/chunk-FJAPMZDU.mjs.map +0 -7
@@ -1220,7 +1220,6 @@ var import_async8 = require("@dxos/async");
1220
1220
  var import_client_protocol2 = require("@dxos/client-protocol");
1221
1221
  var import_context5 = require("@dxos/context");
1222
1222
  var import_credentials7 = require("@dxos/credentials");
1223
- var import_errors2 = require("@dxos/errors");
1224
1223
  var import_invariant6 = require("@dxos/invariant");
1225
1224
  var import_keys6 = require("@dxos/keys");
1226
1225
  var import_log5 = require("@dxos/log");
@@ -1232,7 +1231,6 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1232
1231
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1233
1232
  var import_async7 = require("@dxos/async");
1234
1233
  var import_context4 = require("@dxos/context");
1235
- var import_errors = require("@dxos/errors");
1236
1234
  var import_invariant5 = require("@dxos/invariant");
1237
1235
  var import_keys5 = require("@dxos/keys");
1238
1236
  var import_log4 = require("@dxos/log");
@@ -1270,7 +1268,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1270
1268
  options: async (options) => {
1271
1269
  (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1272
1270
  F: __dxlog_file6,
1273
- L: 88,
1271
+ L: 87,
1274
1272
  S: this,
1275
1273
  A: [
1276
1274
  "!this._remoteOptions",
@@ -1287,7 +1285,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1287
1285
  id: traceId
1288
1286
  }), {
1289
1287
  F: __dxlog_file6,
1290
- L: 97,
1288
+ L: 96,
1291
1289
  S: this,
1292
1290
  C: (f, a) => f(...a)
1293
1291
  });
@@ -1297,7 +1295,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1297
1295
  invitationId
1298
1296
  }, {
1299
1297
  F: __dxlog_file6,
1300
- L: 101,
1298
+ L: 100,
1301
1299
  S: this,
1302
1300
  C: (f, a) => f(...a)
1303
1301
  });
@@ -1311,7 +1309,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1311
1309
  guestProfile: profile
1312
1310
  }, {
1313
1311
  F: __dxlog_file6,
1314
- L: 110,
1312
+ L: 109,
1315
1313
  S: this,
1316
1314
  C: (f, a) => f(...a)
1317
1315
  });
@@ -1324,7 +1322,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1324
1322
  id: traceId
1325
1323
  }), {
1326
1324
  F: __dxlog_file6,
1327
- L: 117,
1325
+ L: 116,
1328
1326
  S: this,
1329
1327
  C: (f, a) => f(...a)
1330
1328
  });
@@ -1339,7 +1337,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1339
1337
  id: traceId
1340
1338
  }), {
1341
1339
  F: __dxlog_file6,
1342
- L: 126,
1340
+ L: 125,
1343
1341
  S: this,
1344
1342
  C: (f, a) => f(...a)
1345
1343
  });
@@ -1347,14 +1345,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1347
1345
  authCode: code
1348
1346
  }, {
1349
1347
  F: __dxlog_file6,
1350
- L: 127,
1348
+ L: 126,
1351
1349
  S: this,
1352
1350
  C: (f, a) => f(...a)
1353
1351
  });
1354
1352
  let status = import_invitations.AuthenticationResponse.Status.OK;
1355
1353
  (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1356
1354
  F: __dxlog_file6,
1357
- L: 130,
1355
+ L: 129,
1358
1356
  S: this,
1359
1357
  A: [
1360
1358
  "this.invitation",
@@ -1365,7 +1363,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1365
1363
  case import_services2.Invitation.AuthMethod.NONE: {
1366
1364
  (0, import_log4.log)("authentication not required", void 0, {
1367
1365
  F: __dxlog_file6,
1368
- L: 133,
1366
+ L: 132,
1369
1367
  S: this,
1370
1368
  C: (f, a) => f(...a)
1371
1369
  });
@@ -1390,7 +1388,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1390
1388
  authMethod: this.invitation.authMethod
1391
1389
  }, {
1392
1390
  F: __dxlog_file6,
1393
- L: 151,
1391
+ L: 150,
1394
1392
  S: this,
1395
1393
  C: (f, a) => f(...a)
1396
1394
  });
@@ -1405,7 +1403,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1405
1403
  }
1406
1404
  }), {
1407
1405
  F: __dxlog_file6,
1408
- L: 157,
1406
+ L: 156,
1409
1407
  S: this,
1410
1408
  C: (f, a) => f(...a)
1411
1409
  });
@@ -1419,14 +1417,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1419
1417
  id: traceId
1420
1418
  }), {
1421
1419
  F: __dxlog_file6,
1422
- L: 163,
1420
+ L: 162,
1423
1421
  S: this,
1424
1422
  C: (f, a) => f(...a)
1425
1423
  });
1426
1424
  try {
1427
1425
  (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1428
1426
  F: __dxlog_file6,
1429
- L: 166,
1427
+ L: 165,
1430
1428
  S: this,
1431
1429
  A: [
1432
1430
  "this.invitation",
@@ -1441,7 +1439,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1441
1439
  id: traceId
1442
1440
  }), {
1443
1441
  F: __dxlog_file6,
1444
- L: 174,
1442
+ L: 173,
1445
1443
  S: this,
1446
1444
  C: (f, a) => f(...a)
1447
1445
  });
@@ -1464,7 +1462,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1464
1462
  timeout: OPTIONS_TIMEOUT
1465
1463
  }));
1466
1464
  if (this._remoteOptions?.role !== import_invitations.Options.Role.GUEST) {
1467
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1465
+ throw new import_protocols3.InvalidInvitationExtensionRoleError(void 0, {
1468
1466
  expected: import_invitations.Options.Role.GUEST,
1469
1467
  remoteOptions: this._remoteOptions
1470
1468
  });
@@ -1498,7 +1496,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1498
1496
  options: async (options) => {
1499
1497
  (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1500
1498
  F: __dxlog_file6,
1501
- L: 241,
1499
+ L: 240,
1502
1500
  S: this,
1503
1501
  A: [
1504
1502
  "!this._remoteOptions",
@@ -1525,7 +1523,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1525
1523
  try {
1526
1524
  (0, import_log4.log)("begin options", void 0, {
1527
1525
  F: __dxlog_file6,
1528
- L: 262,
1526
+ L: 261,
1529
1527
  S: this,
1530
1528
  C: (f, a) => f(...a)
1531
1529
  });
@@ -1537,12 +1535,12 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1537
1535
  }));
1538
1536
  (0, import_log4.log)("end options", void 0, {
1539
1537
  F: __dxlog_file6,
1540
- L: 265,
1538
+ L: 264,
1541
1539
  S: this,
1542
1540
  C: (f, a) => f(...a)
1543
1541
  });
1544
1542
  if (this._remoteOptions?.role !== import_invitations.Options.Role.HOST) {
1545
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1543
+ throw new import_protocols3.InvalidInvitationExtensionRoleError(void 0, {
1546
1544
  expected: import_invitations.Options.Role.HOST,
1547
1545
  remoteOptions: this._remoteOptions
1548
1546
  });
@@ -1551,7 +1549,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1551
1549
  } catch (err) {
1552
1550
  (0, import_log4.log)("openError", err, {
1553
1551
  F: __dxlog_file6,
1554
- L: 275,
1552
+ L: 274,
1555
1553
  S: this,
1556
1554
  C: (f, a) => f(...a)
1557
1555
  });
@@ -1561,7 +1559,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1561
1559
  async onClose() {
1562
1560
  (0, import_log4.log)("onClose", void 0, {
1563
1561
  F: __dxlog_file6,
1564
- L: 281,
1562
+ L: 280,
1565
1563
  S: this,
1566
1564
  C: (f, a) => f(...a)
1567
1565
  });
@@ -1584,7 +1582,7 @@ var InvitationsHandler = class {
1584
1582
  const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1585
1583
  (0, import_invariant6.invariant)(protocol, void 0, {
1586
1584
  F: __dxlog_file7,
1587
- L: 76,
1585
+ L: 75,
1588
1586
  S: this,
1589
1587
  A: [
1590
1588
  "protocol",
@@ -1613,7 +1611,7 @@ var InvitationsHandler = class {
1613
1611
  ...protocol.toJSON()
1614
1612
  }, {
1615
1613
  F: __dxlog_file7,
1616
- L: 98,
1614
+ L: 97,
1617
1615
  S: this,
1618
1616
  C: (f, a) => f(...a)
1619
1617
  });
@@ -1638,7 +1636,7 @@ var InvitationsHandler = class {
1638
1636
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1639
1637
  (0, import_invariant6.invariant)(deviceKey, void 0, {
1640
1638
  F: __dxlog_file7,
1641
- L: 119,
1639
+ L: 118,
1642
1640
  S: this,
1643
1641
  A: [
1644
1642
  "deviceKey",
@@ -1661,7 +1659,7 @@ var InvitationsHandler = class {
1661
1659
  id: traceId
1662
1660
  }), {
1663
1661
  F: __dxlog_file7,
1664
- L: 137,
1662
+ L: 136,
1665
1663
  S: this,
1666
1664
  C: (f, a) => f(...a)
1667
1665
  });
@@ -1669,7 +1667,7 @@ var InvitationsHandler = class {
1669
1667
  ...protocol.toJSON()
1670
1668
  }, {
1671
1669
  F: __dxlog_file7,
1672
- L: 138,
1670
+ L: 137,
1673
1671
  S: this,
1674
1672
  C: (f, a) => f(...a)
1675
1673
  });
@@ -1685,7 +1683,7 @@ var InvitationsHandler = class {
1685
1683
  ...protocol.toJSON()
1686
1684
  }, {
1687
1685
  F: __dxlog_file7,
1688
- L: 141,
1686
+ L: 140,
1689
1687
  S: this,
1690
1688
  C: (f, a) => f(...a)
1691
1689
  });
@@ -1697,7 +1695,7 @@ var InvitationsHandler = class {
1697
1695
  id: traceId
1698
1696
  }), {
1699
1697
  F: __dxlog_file7,
1700
- L: 143,
1698
+ L: 142,
1701
1699
  S: this,
1702
1700
  C: (f, a) => f(...a)
1703
1701
  });
@@ -1707,7 +1705,7 @@ var InvitationsHandler = class {
1707
1705
  ...protocol.toJSON()
1708
1706
  }, {
1709
1707
  F: __dxlog_file7,
1710
- L: 146,
1708
+ L: 145,
1711
1709
  S: this,
1712
1710
  C: (f, a) => f(...a)
1713
1711
  });
@@ -1718,7 +1716,7 @@ var InvitationsHandler = class {
1718
1716
  } else {
1719
1717
  import_log5.log.error("failed", err, {
1720
1718
  F: __dxlog_file7,
1721
- L: 149,
1719
+ L: 148,
1722
1720
  S: this,
1723
1721
  C: (f, a) => f(...a)
1724
1722
  });
@@ -1729,7 +1727,7 @@ var InvitationsHandler = class {
1729
1727
  error: err
1730
1728
  }), {
1731
1729
  F: __dxlog_file7,
1732
- L: 152,
1730
+ L: 151,
1733
1731
  S: this,
1734
1732
  C: (f, a) => f(...a)
1735
1733
  });
@@ -1742,7 +1740,7 @@ var InvitationsHandler = class {
1742
1740
  });
1743
1741
  },
1744
1742
  onError: (err) => {
1745
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1743
+ if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
1746
1744
  return;
1747
1745
  }
1748
1746
  if (err instanceof import_async8.TimeoutError) {
@@ -1750,7 +1748,7 @@ var InvitationsHandler = class {
1750
1748
  ...protocol.toJSON()
1751
1749
  }, {
1752
1750
  F: __dxlog_file7,
1753
- L: 167,
1751
+ L: 166,
1754
1752
  S: this,
1755
1753
  C: (f, a) => f(...a)
1756
1754
  });
@@ -1761,7 +1759,7 @@ var InvitationsHandler = class {
1761
1759
  } else {
1762
1760
  import_log5.log.error("failed", err, {
1763
1761
  F: __dxlog_file7,
1764
- L: 170,
1762
+ L: 169,
1765
1763
  S: this,
1766
1764
  C: (f, a) => f(...a)
1767
1765
  });
@@ -1789,7 +1787,7 @@ var InvitationsHandler = class {
1789
1787
  state: import_services3.Invitation.State.CONNECTING
1790
1788
  });
1791
1789
  });
1792
- const observable = new import_client_protocol2.CancellableInvitationObservable({
1790
+ const observable = new import_client_protocol2.CancellableInvitation({
1793
1791
  initialInvitation: invitation,
1794
1792
  subscriber: stream.observable,
1795
1793
  onCancel: async () => {
@@ -1806,7 +1804,7 @@ var InvitationsHandler = class {
1806
1804
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1807
1805
  (0, import_invariant6.invariant)(protocol, void 0, {
1808
1806
  F: __dxlog_file7,
1809
- L: 211,
1807
+ L: 210,
1810
1808
  S: this,
1811
1809
  A: [
1812
1810
  "protocol",
@@ -1820,7 +1818,7 @@ var InvitationsHandler = class {
1820
1818
  const setState = (newData) => {
1821
1819
  (0, import_invariant6.invariant)(newData.state !== void 0, void 0, {
1822
1820
  F: __dxlog_file7,
1823
- L: 222,
1821
+ L: 221,
1824
1822
  S: this,
1825
1823
  A: [
1826
1824
  "newData.state !== undefined",
@@ -1840,7 +1838,7 @@ var InvitationsHandler = class {
1840
1838
  ...protocol.toJSON()
1841
1839
  }, {
1842
1840
  F: __dxlog_file7,
1843
- L: 230,
1841
+ L: 229,
1844
1842
  S: this,
1845
1843
  C: (f, a) => f(...a)
1846
1844
  });
@@ -1850,7 +1848,7 @@ var InvitationsHandler = class {
1850
1848
  } else {
1851
1849
  import_log5.log.warn("auth failed", err, {
1852
1850
  F: __dxlog_file7,
1853
- L: 233,
1851
+ L: 232,
1854
1852
  S: this,
1855
1853
  C: (f, a) => f(...a)
1856
1854
  });
@@ -1864,7 +1862,7 @@ var InvitationsHandler = class {
1864
1862
  ...protocol.toJSON()
1865
1863
  }, {
1866
1864
  F: __dxlog_file7,
1867
- L: 241,
1865
+ L: 240,
1868
1866
  S: this,
1869
1867
  C: (f, a) => f(...a)
1870
1868
  });
@@ -1879,7 +1877,7 @@ var InvitationsHandler = class {
1879
1877
  currentState
1880
1878
  }, {
1881
1879
  F: __dxlog_file7,
1882
- L: 251,
1880
+ L: 250,
1883
1881
  S: this,
1884
1882
  C: (f, a) => f(...a)
1885
1883
  });
@@ -1894,7 +1892,7 @@ var InvitationsHandler = class {
1894
1892
  id: traceId
1895
1893
  }), {
1896
1894
  F: __dxlog_file7,
1897
- L: 260,
1895
+ L: 259,
1898
1896
  S: this,
1899
1897
  C: (f, a) => f(...a)
1900
1898
  });
@@ -1906,7 +1904,7 @@ var InvitationsHandler = class {
1906
1904
  ...protocol.toJSON()
1907
1905
  }, {
1908
1906
  F: __dxlog_file7,
1909
- L: 268,
1907
+ L: 267,
1910
1908
  S: this,
1911
1909
  C: (f, a) => f(...a)
1912
1910
  });
@@ -1917,7 +1915,7 @@ var InvitationsHandler = class {
1917
1915
  ...protocol.toJSON()
1918
1916
  }, {
1919
1917
  F: __dxlog_file7,
1920
- L: 272,
1918
+ L: 271,
1921
1919
  S: this,
1922
1920
  C: (f, a) => f(...a)
1923
1921
  });
@@ -1927,7 +1925,7 @@ var InvitationsHandler = class {
1927
1925
  response: introductionResponse
1928
1926
  }, {
1929
1927
  F: __dxlog_file7,
1930
- L: 276,
1928
+ L: 275,
1931
1929
  S: this,
1932
1930
  C: (f, a) => f(...a)
1933
1931
  });
@@ -1939,7 +1937,7 @@ var InvitationsHandler = class {
1939
1937
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1940
1938
  (0, import_log5.log)("guest waiting for authentication code...", void 0, {
1941
1939
  F: __dxlog_file7,
1942
- L: 285,
1940
+ L: 284,
1943
1941
  S: this,
1944
1942
  C: (f, a) => f(...a)
1945
1943
  });
@@ -1951,7 +1949,7 @@ var InvitationsHandler = class {
1951
1949
  });
1952
1950
  (0, import_log5.log)("sending authentication request", void 0, {
1953
1951
  F: __dxlog_file7,
1954
- L: 289,
1952
+ L: 288,
1955
1953
  S: this,
1956
1954
  C: (f, a) => f(...a)
1957
1955
  });
@@ -1972,7 +1970,7 @@ var InvitationsHandler = class {
1972
1970
  attempt
1973
1971
  }, {
1974
1972
  F: __dxlog_file7,
1975
- L: 300,
1973
+ L: 299,
1976
1974
  S: this,
1977
1975
  C: (f, a) => f(...a)
1978
1976
  });
@@ -1989,7 +1987,7 @@ var InvitationsHandler = class {
1989
1987
  ...protocol.toJSON()
1990
1988
  }, {
1991
1989
  F: __dxlog_file7,
1992
- L: 311,
1990
+ L: 310,
1993
1991
  S: this,
1994
1992
  C: (f, a) => f(...a)
1995
1993
  });
@@ -2001,7 +1999,7 @@ var InvitationsHandler = class {
2001
1999
  ...protocol.toJSON()
2002
2000
  }, {
2003
2001
  F: __dxlog_file7,
2004
- L: 322,
2002
+ L: 321,
2005
2003
  S: this,
2006
2004
  C: (f, a) => f(...a)
2007
2005
  });
@@ -2013,7 +2011,7 @@ var InvitationsHandler = class {
2013
2011
  id: traceId
2014
2012
  }), {
2015
2013
  F: __dxlog_file7,
2016
- L: 324,
2014
+ L: 323,
2017
2015
  S: this,
2018
2016
  C: (f, a) => f(...a)
2019
2017
  });
@@ -2023,7 +2021,7 @@ var InvitationsHandler = class {
2023
2021
  ...protocol.toJSON()
2024
2022
  }, {
2025
2023
  F: __dxlog_file7,
2026
- L: 327,
2024
+ L: 326,
2027
2025
  S: this,
2028
2026
  C: (f, a) => f(...a)
2029
2027
  });
@@ -2033,7 +2031,7 @@ var InvitationsHandler = class {
2033
2031
  } else {
2034
2032
  (0, import_log5.log)("auth failed", err, {
2035
2033
  F: __dxlog_file7,
2036
- L: 330,
2034
+ L: 329,
2037
2035
  S: this,
2038
2036
  C: (f, a) => f(...a)
2039
2037
  });
@@ -2044,7 +2042,7 @@ var InvitationsHandler = class {
2044
2042
  error: err
2045
2043
  }), {
2046
2044
  F: __dxlog_file7,
2047
- L: 333,
2045
+ L: 332,
2048
2046
  S: this,
2049
2047
  C: (f, a) => f(...a)
2050
2048
  });
@@ -2054,7 +2052,7 @@ var InvitationsHandler = class {
2054
2052
  });
2055
2053
  },
2056
2054
  onError: (err) => {
2057
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
2055
+ if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
2058
2056
  return;
2059
2057
  }
2060
2058
  if (err instanceof import_async8.TimeoutError) {
@@ -2062,7 +2060,7 @@ var InvitationsHandler = class {
2062
2060
  ...protocol.toJSON()
2063
2061
  }, {
2064
2062
  F: __dxlog_file7,
2065
- L: 344,
2063
+ L: 343,
2066
2064
  S: this,
2067
2065
  C: (f, a) => f(...a)
2068
2066
  });
@@ -2072,7 +2070,7 @@ var InvitationsHandler = class {
2072
2070
  } else {
2073
2071
  (0, import_log5.log)("auth failed", err, {
2074
2072
  F: __dxlog_file7,
2075
- L: 347,
2073
+ L: 346,
2076
2074
  S: this,
2077
2075
  C: (f, a) => f(...a)
2078
2076
  });
@@ -2085,7 +2083,7 @@ var InvitationsHandler = class {
2085
2083
  (0, import_async8.scheduleTask)(ctx, async () => {
2086
2084
  (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2087
2085
  F: __dxlog_file7,
2088
- L: 357,
2086
+ L: 356,
2089
2087
  S: this,
2090
2088
  A: [
2091
2089
  "invitation.swarmKey",
@@ -2107,7 +2105,7 @@ var InvitationsHandler = class {
2107
2105
  state: import_services3.Invitation.State.CONNECTING
2108
2106
  });
2109
2107
  });
2110
- const observable = new import_client_protocol2.AuthenticatingInvitationObservable({
2108
+ const observable = new import_client_protocol2.AuthenticatingInvitation({
2111
2109
  initialInvitation: invitation,
2112
2110
  subscriber: stream.observable,
2113
2111
  onCancel: async () => {
@@ -2165,7 +2163,9 @@ var InvitationsServiceImpl = class {
2165
2163
  }, () => {
2166
2164
  close();
2167
2165
  this._createInvitations.delete(invitation.get().invitationId);
2168
- this._removedCreated.emit(invitation.get());
2166
+ if (invitation.get().type !== import_services4.Invitation.Type.MULTIUSE) {
2167
+ this._removedCreated.emit(invitation.get());
2168
+ }
2169
2169
  });
2170
2170
  });
2171
2171
  }
@@ -2188,20 +2188,22 @@ var InvitationsServiceImpl = class {
2188
2188
  }, () => {
2189
2189
  close();
2190
2190
  this._acceptInvitations.delete(invitation.get().invitationId);
2191
- this._removedAccepted.emit(invitation.get());
2191
+ if (invitation.get().type !== import_services4.Invitation.Type.MULTIUSE) {
2192
+ this._removedAccepted.emit(invitation.get());
2193
+ }
2192
2194
  });
2193
2195
  });
2194
2196
  }
2195
2197
  async authenticate({ invitationId, authCode }) {
2196
2198
  (0, import_log6.log)("authenticating...", void 0, {
2197
2199
  F: __dxlog_file8,
2198
- L: 104,
2200
+ L: 108,
2199
2201
  S: this,
2200
2202
  C: (f, a) => f(...a)
2201
2203
  });
2202
2204
  (0, import_invariant7.invariant)(invitationId, void 0, {
2203
2205
  F: __dxlog_file8,
2204
- L: 105,
2206
+ L: 109,
2205
2207
  S: this,
2206
2208
  A: [
2207
2209
  "invitationId",
@@ -2214,7 +2216,7 @@ var InvitationsServiceImpl = class {
2214
2216
  invitationId
2215
2217
  }, {
2216
2218
  F: __dxlog_file8,
2217
- L: 108,
2219
+ L: 112,
2218
2220
  S: this,
2219
2221
  C: (f, a) => f(...a)
2220
2222
  });
@@ -2225,13 +2227,13 @@ var InvitationsServiceImpl = class {
2225
2227
  async cancelInvitation({ invitationId }) {
2226
2228
  (0, import_log6.log)("deleting...", void 0, {
2227
2229
  F: __dxlog_file8,
2228
- L: 115,
2230
+ L: 119,
2229
2231
  S: this,
2230
2232
  C: (f, a) => f(...a)
2231
2233
  });
2232
2234
  (0, import_invariant7.invariant)(invitationId, void 0, {
2233
2235
  F: __dxlog_file8,
2234
- L: 116,
2236
+ L: 120,
2235
2237
  S: this,
2236
2238
  A: [
2237
2239
  "invitationId",
@@ -2253,7 +2255,7 @@ var InvitationsServiceImpl = class {
2253
2255
  invitationId
2254
2256
  }, {
2255
2257
  F: __dxlog_file8,
2256
- L: 128,
2258
+ L: 132,
2257
2259
  S: this,
2258
2260
  C: (f, a) => f(...a)
2259
2261
  });
@@ -2528,7 +2530,7 @@ var import_protocols5 = require("@dxos/protocols");
2528
2530
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2529
2531
 
2530
2532
  // packages/sdk/client-services/src/version.ts
2531
- var DXOS_VERSION = "0.1.58-main.353d0d1";
2533
+ var DXOS_VERSION = "0.1.58-main.44da53d";
2532
2534
 
2533
2535
  // packages/sdk/client-services/src/packlets/services/platform.ts
2534
2536
  var getPlatform = () => {
@@ -2681,13 +2683,13 @@ var import_async14 = require("@dxos/async");
2681
2683
  var import_context9 = require("@dxos/context");
2682
2684
  var import_credentials14 = require("@dxos/credentials");
2683
2685
  var import_debug7 = require("@dxos/debug");
2684
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
2686
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
2685
2687
  var import_feed_store4 = require("@dxos/feed-store");
2686
- var import_invariant12 = require("@dxos/invariant");
2688
+ var import_invariant13 = require("@dxos/invariant");
2687
2689
  var import_keyring = require("@dxos/keyring");
2688
2690
  var import_keys10 = require("@dxos/keys");
2689
2691
  var import_log13 = require("@dxos/log");
2690
- var import_protocols9 = require("@dxos/protocols");
2692
+ var import_protocols10 = require("@dxos/protocols");
2691
2693
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2692
2694
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2693
2695
  var import_tracing4 = require("@dxos/tracing");
@@ -2700,7 +2702,7 @@ var import_credentials13 = require("@dxos/credentials");
2700
2702
  var import_invariant11 = require("@dxos/invariant");
2701
2703
  var import_keys9 = require("@dxos/keys");
2702
2704
  var import_log11 = require("@dxos/log");
2703
- var import_protocols7 = require("@dxos/protocols");
2705
+ var import_protocols8 = require("@dxos/protocols");
2704
2706
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2705
2707
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2706
2708
  var import_util5 = require("@dxos/util");
@@ -2711,9 +2713,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2711
2713
  var import_context7 = require("@dxos/context");
2712
2714
  var import_debug4 = require("@dxos/debug");
2713
2715
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2714
- var import_errors3 = require("@dxos/errors");
2715
2716
  var import_keys8 = require("@dxos/keys");
2716
2717
  var import_log10 = require("@dxos/log");
2718
+ var import_protocols7 = require("@dxos/protocols");
2717
2719
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2718
2720
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2719
2721
  var import_timeframe2 = require("@dxos/timeframe");
@@ -3022,7 +3024,7 @@ var DataSpace = class DataSpace2 {
3022
3024
  this._signingContext = params.signingContext;
3023
3025
  this._callbacks = params.callbacks ?? {};
3024
3026
  this.authVerifier = new TrustedKeySetAuthVerifier({
3025
- trustedKeysProvider: () => new import_util4.ComplexSet(import_keys8.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
3027
+ trustedKeysProvider: () => new import_util4.ComplexSet(import_keys8.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
3026
3028
  update: this._inner.stateUpdate,
3027
3029
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
3028
3030
  });
@@ -3032,7 +3034,7 @@ var DataSpace = class DataSpace2 {
3032
3034
  state: import_services7.SpaceState[this._state]
3033
3035
  }, {
3034
3036
  F: __dxlog_file12,
3035
- L: 112,
3037
+ L: 118,
3036
3038
  S: this,
3037
3039
  C: (f, a) => f(...a)
3038
3040
  });
@@ -3066,6 +3068,7 @@ var DataSpace = class DataSpace2 {
3066
3068
  await this._open();
3067
3069
  }
3068
3070
  async _open() {
3071
+ await this._gossip.open();
3069
3072
  await this._notarizationPlugin.open();
3070
3073
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3071
3074
  await this._inner.open(new import_context7.Context());
@@ -3074,7 +3077,7 @@ var DataSpace = class DataSpace2 {
3074
3077
  state: import_services7.SpaceState[this._state]
3075
3078
  }, {
3076
3079
  F: __dxlog_file12,
3077
- L: 158,
3080
+ L: 165,
3078
3081
  S: this,
3079
3082
  C: (f, a) => f(...a)
3080
3083
  });
@@ -3092,7 +3095,7 @@ var DataSpace = class DataSpace2 {
3092
3095
  state: import_services7.SpaceState[this._state]
3093
3096
  }, {
3094
3097
  F: __dxlog_file12,
3095
- L: 172,
3098
+ L: 179,
3096
3099
  S: this,
3097
3100
  C: (f, a) => f(...a)
3098
3101
  });
@@ -3103,6 +3106,7 @@ var DataSpace = class DataSpace2 {
3103
3106
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
3104
3107
  await this._notarizationPlugin.close();
3105
3108
  await this._presence.destroy();
3109
+ await this._gossip.close();
3106
3110
  }
3107
3111
  async postMessage(channel, message) {
3108
3112
  return this._gossip.postMessage(channel, message);
@@ -3119,10 +3123,10 @@ var DataSpace = class DataSpace2 {
3119
3123
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3120
3124
  await this.initializeDataPipeline();
3121
3125
  } catch (err) {
3122
- if (err instanceof import_errors3.CancelledError) {
3126
+ if (err instanceof import_protocols7.CancelledError) {
3123
3127
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3124
3128
  F: __dxlog_file12,
3125
- L: 203,
3129
+ L: 211,
3126
3130
  S: this,
3127
3131
  C: (f, a) => f(...a)
3128
3132
  });
@@ -3130,7 +3134,7 @@ var DataSpace = class DataSpace2 {
3130
3134
  }
3131
3135
  import_log10.log.error("Error initializing data pipeline", err, {
3132
3136
  F: __dxlog_file12,
3133
- L: 207,
3137
+ L: 215,
3134
3138
  S: this,
3135
3139
  C: (f, a) => f(...a)
3136
3140
  });
@@ -3139,7 +3143,7 @@ var DataSpace = class DataSpace2 {
3139
3143
  state: import_services7.SpaceState[this._state]
3140
3144
  }, {
3141
3145
  F: __dxlog_file12,
3142
- L: 209,
3146
+ L: 217,
3143
3147
  S: this,
3144
3148
  C: (f, a) => f(...a)
3145
3149
  });
@@ -3152,14 +3156,14 @@ var DataSpace = class DataSpace2 {
3152
3156
  }
3153
3157
  async initializeDataPipeline() {
3154
3158
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
3155
- throw new import_errors3.SystemError("Invalid operation");
3159
+ throw new import_protocols7.SystemError("Invalid operation");
3156
3160
  }
3157
3161
  this._state = import_services7.SpaceState.INITIALIZING;
3158
3162
  (0, import_log10.log)("new state", {
3159
3163
  state: import_services7.SpaceState[this._state]
3160
3164
  }, {
3161
3165
  F: __dxlog_file12,
3162
- L: 225,
3166
+ L: 233,
3163
3167
  S: this,
3164
3168
  C: (f, a) => f(...a)
3165
3169
  });
@@ -3170,7 +3174,7 @@ var DataSpace = class DataSpace2 {
3170
3174
  await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3171
3175
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3172
3176
  F: __dxlog_file12,
3173
- L: 239,
3177
+ L: 247,
3174
3178
  S: this,
3175
3179
  C: (f, a) => f(...a)
3176
3180
  });
@@ -3181,7 +3185,7 @@ var DataSpace = class DataSpace2 {
3181
3185
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3182
3186
  (0, import_log10.log)("data pipeline ready", void 0, {
3183
3187
  F: __dxlog_file12,
3184
- L: 248,
3188
+ L: 256,
3185
3189
  S: this,
3186
3190
  C: (f, a) => f(...a)
3187
3191
  });
@@ -3191,7 +3195,7 @@ var DataSpace = class DataSpace2 {
3191
3195
  state: import_services7.SpaceState[this._state]
3192
3196
  }, {
3193
3197
  F: __dxlog_file12,
3194
- L: 252,
3198
+ L: 260,
3195
3199
  S: this,
3196
3200
  C: (f, a) => f(...a)
3197
3201
  });
@@ -3207,7 +3211,7 @@ var DataSpace = class DataSpace2 {
3207
3211
  await this._createWritableFeeds();
3208
3212
  (0, import_log10.log)("writable feeds created", void 0, {
3209
3213
  F: __dxlog_file12,
3210
- L: 268,
3214
+ L: 276,
3211
3215
  S: this,
3212
3216
  C: (f, a) => f(...a)
3213
3217
  });
@@ -3312,7 +3316,7 @@ var DataSpace = class DataSpace2 {
3312
3316
  state: import_services7.SpaceState[this._state]
3313
3317
  }, {
3314
3318
  F: __dxlog_file12,
3315
- L: 384,
3319
+ L: 392,
3316
3320
  S: this,
3317
3321
  C: (f, a) => f(...a)
3318
3322
  });
@@ -3454,7 +3458,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3454
3458
  S: this,
3455
3459
  C: (f, a) => f(...a)
3456
3460
  });
3457
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.begin({
3461
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.begin({
3458
3462
  id: this._instanceId
3459
3463
  }), {
3460
3464
  F: __dxlog_file13,
@@ -3500,7 +3504,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3500
3504
  space.initializeDataPipelineAsync();
3501
3505
  }
3502
3506
  }
3503
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3507
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.end({
3504
3508
  id: this._instanceId
3505
3509
  }), {
3506
3510
  F: __dxlog_file13,
@@ -3754,10 +3758,9 @@ DataSpaceManager = _ts_decorate4([
3754
3758
  var import_async13 = require("@dxos/async");
3755
3759
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3756
3760
  var import_debug6 = require("@dxos/debug");
3757
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3758
- var import_errors4 = require("@dxos/errors");
3761
+ var import_invariant12 = require("@dxos/invariant");
3759
3762
  var import_log12 = require("@dxos/log");
3760
- var import_protocols8 = require("@dxos/protocols");
3763
+ var import_protocols9 = require("@dxos/protocols");
3761
3764
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3762
3765
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3763
3766
  var SpacesServiceImpl = class {
@@ -3777,7 +3780,7 @@ var SpacesServiceImpl = class {
3777
3780
  }
3778
3781
  async updateSpace({ spaceKey, state }) {
3779
3782
  const dataSpaceManager = await this._getDataSpaceManager();
3780
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3783
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3781
3784
  if (state) {
3782
3785
  switch (state) {
3783
3786
  case import_services9.SpaceState.ACTIVE:
@@ -3787,7 +3790,7 @@ var SpacesServiceImpl = class {
3787
3790
  await space.deactivate();
3788
3791
  break;
3789
3792
  default:
3790
- throw new import_errors4.ApiError("Invalid space state");
3793
+ throw new import_protocols9.ApiError("Invalid space state");
3791
3794
  }
3792
3795
  }
3793
3796
  }
@@ -3842,14 +3845,14 @@ var SpacesServiceImpl = class {
3842
3845
  }
3843
3846
  async postMessage({ spaceKey, channel, message }) {
3844
3847
  const dataSpaceManager = await this._getDataSpaceManager();
3845
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3848
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3846
3849
  await space.postMessage(getChannelId(channel), message);
3847
3850
  }
3848
3851
  subscribeMessages({ spaceKey, channel }) {
3849
3852
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3850
3853
  (0, import_async13.scheduleTask)(ctx, async () => {
3851
3854
  const dataSpaceManager = await this._getDataSpaceManager();
3852
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3855
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3853
3856
  const handle = space.listen(getChannelId(channel), (message) => {
3854
3857
  next(message);
3855
3858
  });
@@ -3857,38 +3860,83 @@ var SpacesServiceImpl = class {
3857
3860
  });
3858
3861
  });
3859
3862
  }
3860
- queryCredentials({ spaceKey }) {
3861
- return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3862
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3863
+ queryCredentials({ spaceKey, noTail }) {
3864
+ return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
3865
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3863
3866
  const processor = {
3864
3867
  processCredential: async (credential) => {
3865
3868
  next(credential);
3866
3869
  }
3867
3870
  };
3868
3871
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3869
- (0, import_async13.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
3872
+ (0, import_async13.scheduleTask)(ctx, async () => {
3873
+ await space.spaceState.addCredentialProcessor(processor);
3874
+ if (noTail) {
3875
+ close();
3876
+ }
3877
+ });
3870
3878
  });
3871
3879
  }
3872
3880
  async writeCredentials({ spaceKey, credentials }) {
3873
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3881
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3874
3882
  for (const credential of credentials ?? []) {
3875
- await space.controlPipeline.writer.write({
3876
- credential: {
3877
- credential
3878
- }
3879
- });
3883
+ if (credential.proof) {
3884
+ await space.controlPipeline.writer.write({
3885
+ credential: {
3886
+ credential
3887
+ }
3888
+ });
3889
+ } else {
3890
+ (0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3891
+ F: __dxlog_file14,
3892
+ L: 168,
3893
+ S: this,
3894
+ A: [
3895
+ "!credential.id",
3896
+ "'Id on unsigned credentials is not allowed'"
3897
+ ]
3898
+ });
3899
+ (0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
3900
+ F: __dxlog_file14,
3901
+ L: 169,
3902
+ S: this,
3903
+ A: [
3904
+ "this._identityManager.identity",
3905
+ "'Identity is not available'"
3906
+ ]
3907
+ });
3908
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3909
+ (0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3910
+ F: __dxlog_file14,
3911
+ L: 171,
3912
+ S: this,
3913
+ A: [
3914
+ "credential.issuer.equals(signer.getIssuer())",
3915
+ ""
3916
+ ]
3917
+ });
3918
+ const signedCredential = await signer.createCredential({
3919
+ subject: credential.subject.id,
3920
+ assertion: credential.subject.assertion
3921
+ });
3922
+ await space.controlPipeline.writer.write({
3923
+ credential: {
3924
+ credential: signedCredential
3925
+ }
3926
+ });
3927
+ }
3880
3928
  }
3881
3929
  }
3882
3930
  async createEpoch({ spaceKey }) {
3883
3931
  const dataSpaceManager = await this._getDataSpaceManager();
3884
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3932
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3885
3933
  await space.createEpoch();
3886
3934
  }
3887
3935
  _serializeSpace(space) {
3888
3936
  return {
3889
3937
  spaceKey: space.key,
3890
3938
  state: space.state,
3891
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3939
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3892
3940
  pipeline: {
3893
3941
  currentEpoch: space.dataPipeline.currentEpoch,
3894
3942
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3915,7 +3963,7 @@ var SpacesServiceImpl = class {
3915
3963
  displayName: member.assertion.profile?.displayName
3916
3964
  }
3917
3965
  },
3918
- presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3966
+ presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3919
3967
  peerStates: peers
3920
3968
  };
3921
3969
  }),
@@ -3947,11 +3995,11 @@ var ServiceContext = class ServiceContext2 {
3947
3995
  this.signalManager = signalManager;
3948
3996
  this.modelFactory = modelFactory;
3949
3997
  this.initialized = new import_async14.Trigger();
3950
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3998
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3951
3999
  this._handlerFactories = /* @__PURE__ */ new Map();
3952
4000
  this._instanceId = import_keys10.PublicKey.random().toHex();
3953
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3954
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
4001
+ this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
4002
+ this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3955
4003
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3956
4004
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3957
4005
  this.feedStore = new import_feed_store4.FeedStore({
@@ -3959,12 +4007,12 @@ var ServiceContext = class ServiceContext2 {
3959
4007
  root: storage.createDirectory("feeds"),
3960
4008
  signer: this.keyring,
3961
4009
  hypercore: {
3962
- valueEncoding: import_echo_pipeline3.valueEncoding,
4010
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3963
4011
  stats: true
3964
4012
  }
3965
4013
  })
3966
4014
  });
3967
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
4015
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3968
4016
  feedStore: this.feedStore,
3969
4017
  networkManager: this.networkManager,
3970
4018
  blobStore: this.blobStore,
@@ -3984,7 +4032,7 @@ var ServiceContext = class ServiceContext2 {
3984
4032
  S: this,
3985
4033
  C: (f, a) => f(...a)
3986
4034
  });
3987
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.begin({
4035
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.begin({
3988
4036
  id: this._instanceId
3989
4037
  }), {
3990
4038
  F: __dxlog_file15,
@@ -4000,7 +4048,7 @@ var ServiceContext = class ServiceContext2 {
4000
4048
  if (this.identityManager.identity) {
4001
4049
  await this._initialize(ctx);
4002
4050
  }
4003
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
4051
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.end({
4004
4052
  id: this._instanceId
4005
4053
  }), {
4006
4054
  F: __dxlog_file15,
@@ -4047,7 +4095,7 @@ var ServiceContext = class ServiceContext2 {
4047
4095
  }
4048
4096
  getInvitationHandler(invitation) {
4049
4097
  const factory = this._handlerFactories.get(invitation.kind);
4050
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4098
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4051
4099
  F: __dxlog_file15,
4052
4100
  L: 174,
4053
4101
  S: this,
@@ -4065,8 +4113,8 @@ var ServiceContext = class ServiceContext2 {
4065
4113
  }
4066
4114
  async _checkStorageVersion() {
4067
4115
  await this.metadataStore.load();
4068
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
4069
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
4116
+ if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
4117
+ throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
4070
4118
  }
4071
4119
  }
4072
4120
  // Called when identity is created.
@@ -4094,7 +4142,7 @@ var ServiceContext = class ServiceContext2 {
4094
4142
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
4095
4143
  await this.dataSpaceManager.open();
4096
4144
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4097
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4145
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4098
4146
  F: __dxlog_file15,
4099
4147
  L: 218,
4100
4148
  S: this,
@@ -4179,14 +4227,14 @@ var import_async17 = require("@dxos/async");
4179
4227
  var import_client_protocol5 = require("@dxos/client-protocol");
4180
4228
  var import_context10 = require("@dxos/context");
4181
4229
  var import_document_model2 = require("@dxos/document-model");
4182
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4183
- var import_invariant14 = require("@dxos/invariant");
4230
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
4231
+ var import_invariant15 = require("@dxos/invariant");
4184
4232
  var import_keys11 = require("@dxos/keys");
4185
4233
  var import_log16 = require("@dxos/log");
4186
4234
  var import_messaging = require("@dxos/messaging");
4187
4235
  var import_model_factory = require("@dxos/model-factory");
4188
4236
  var import_network_manager2 = require("@dxos/network-manager");
4189
- var import_protocols10 = require("@dxos/protocols");
4237
+ var import_protocols12 = require("@dxos/protocols");
4190
4238
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4191
4239
  var import_text_model = require("@dxos/text-model");
4192
4240
  var import_tracing5 = require("@dxos/tracing");
@@ -4236,7 +4284,7 @@ var DevicesServiceImpl = class {
4236
4284
  };
4237
4285
 
4238
4286
  // packages/sdk/client-services/src/packlets/locks/node.ts
4239
- var import_invariant13 = require("@dxos/invariant");
4287
+ var import_invariant14 = require("@dxos/invariant");
4240
4288
  var import_lock_file = require("@dxos/lock-file");
4241
4289
  var import_log14 = require("@dxos/log");
4242
4290
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4277,7 +4325,7 @@ var Lock = class {
4277
4325
  }
4278
4326
  async release() {
4279
4327
  await this._onRelease?.();
4280
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4328
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4281
4329
  F: __dxlog_file16,
4282
4330
  L: 42,
4283
4331
  S: this,
@@ -4445,7 +4493,7 @@ var NetworkServiceImpl = class {
4445
4493
 
4446
4494
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4447
4495
  var import_client_protocol4 = require("@dxos/client-protocol");
4448
- var import_errors5 = require("@dxos/errors");
4496
+ var import_protocols11 = require("@dxos/protocols");
4449
4497
  var import_config = require("@dxos/protocols/proto/dxos/config");
4450
4498
  var import_random_access_storage = require("@dxos/random-access-storage");
4451
4499
  var import_util8 = require("@dxos/util");
@@ -4453,16 +4501,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4453
4501
  var createStorageObjects = (config) => {
4454
4502
  const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4455
4503
  if (persistent && storageType === StorageDriver.RAM) {
4456
- throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4504
+ throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4457
4505
  }
4458
4506
  if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4459
- throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4507
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4460
4508
  }
4461
4509
  if (persistent && keyStorage === StorageDriver.RAM) {
4462
- throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4510
+ throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4463
4511
  }
4464
4512
  if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4465
- throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4513
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4466
4514
  }
4467
4515
  return {
4468
4516
  storage: (0, import_random_access_storage.createStorage)({
@@ -4669,7 +4717,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4669
4717
  * Can only be called once.
4670
4718
  */
4671
4719
  initialize({ config, ...options }) {
4672
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4720
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4673
4721
  F: __dxlog_file17,
4674
4722
  L: 184,
4675
4723
  S: this,
@@ -4685,7 +4733,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4685
4733
  C: (f, a) => f(...a)
4686
4734
  });
4687
4735
  if (config) {
4688
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4736
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4689
4737
  F: __dxlog_file17,
4690
4738
  L: 188,
4691
4739
  S: this,
@@ -4703,7 +4751,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4703
4751
  iceServers: this._config?.get("runtime.services.ice")
4704
4752
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4705
4753
  this._signalManager = signalManager;
4706
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4754
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4707
4755
  F: __dxlog_file17,
4708
4756
  L: 204,
4709
4757
  S: this,
@@ -4729,7 +4777,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4729
4777
  return;
4730
4778
  }
4731
4779
  const traceId = import_keys11.PublicKey.random().toHex();
4732
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.begin({
4780
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4733
4781
  id: traceId
4734
4782
  }), {
4735
4783
  F: __dxlog_file17,
@@ -4737,7 +4785,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4737
4785
  S: this,
4738
4786
  C: (f, a) => f(...a)
4739
4787
  });
4740
- (0, import_invariant14.invariant)(this._config, "config not set", {
4788
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4741
4789
  F: __dxlog_file17,
4742
4790
  L: 224,
4743
4791
  S: this,
@@ -4746,7 +4794,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4746
4794
  "'config not set'"
4747
4795
  ]
4748
4796
  });
4749
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4797
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4750
4798
  F: __dxlog_file17,
4751
4799
  L: 225,
4752
4800
  S: this,
@@ -4755,7 +4803,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4755
4803
  "'storage not set'"
4756
4804
  ]
4757
4805
  });
4758
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4806
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4759
4807
  F: __dxlog_file17,
4760
4808
  L: 226,
4761
4809
  S: this,
@@ -4764,7 +4812,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4764
4812
  "'signal manager not set'"
4765
4813
  ]
4766
4814
  });
4767
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4815
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4768
4816
  F: __dxlog_file17,
4769
4817
  L: 227,
4770
4818
  S: this,
@@ -4794,7 +4842,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4794
4842
  await this._serviceContext.initialized.wait();
4795
4843
  return this._serviceContext.dataSpaceManager;
4796
4844
  }),
4797
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4845
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4798
4846
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4799
4847
  LoggingService: this._loggingService,
4800
4848
  TracingService: this._tracingService,
@@ -4828,7 +4876,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4828
4876
  S: this,
4829
4877
  C: (f, a) => f(...a)
4830
4878
  });
4831
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.end({
4879
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
4832
4880
  id: traceId
4833
4881
  }), {
4834
4882
  F: __dxlog_file17,
@@ -4869,7 +4917,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4869
4917
  }
4870
4918
  async reset() {
4871
4919
  const traceId = import_keys11.PublicKey.random().toHex();
4872
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.begin({
4920
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4873
4921
  id: traceId
4874
4922
  }), {
4875
4923
  F: __dxlog_file17,
@@ -4891,7 +4939,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4891
4939
  S: this,
4892
4940
  C: (f, a) => f(...a)
4893
4941
  });
4894
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.end({
4942
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
4895
4943
  id: traceId
4896
4944
  }), {
4897
4945
  F: __dxlog_file17,
@@ -4932,7 +4980,7 @@ var import_util10 = require("@dxos/util");
4932
4980
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4933
4981
  var import_async18 = require("@dxos/async");
4934
4982
  var import_client_protocol6 = require("@dxos/client-protocol");
4935
- var import_invariant15 = require("@dxos/invariant");
4983
+ var import_invariant16 = require("@dxos/invariant");
4936
4984
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
4937
4985
  var import_rpc2 = require("@dxos/rpc");
4938
4986
  var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
@@ -4951,17 +4999,18 @@ var ShellRuntimeImpl = class {
4951
4999
  get spaceKey() {
4952
5000
  return this._spaceKey;
4953
5001
  }
4954
- setLayout(layout, options = {}) {
5002
+ setLayout({ layout, invitationCode, spaceKey }) {
4955
5003
  this._layout = layout;
4956
- this._invitationCode = options.invitationCode;
4957
- this._spaceKey = options.spaceKey;
5004
+ this._invitationCode = invitationCode;
5005
+ this._spaceKey = spaceKey;
4958
5006
  this.layoutUpdate.emit({
4959
5007
  layout,
4960
- ...options
5008
+ invitationCode,
5009
+ spaceKey
4961
5010
  });
4962
5011
  }
4963
5012
  async setAppContext(context) {
4964
- (0, import_invariant15.invariant)(this._appRpc, "runtime not open", {
5013
+ (0, import_invariant16.invariant)(this._appRpc, "runtime not open", {
4965
5014
  F: __dxlog_file18,
4966
5015
  L: 44,
4967
5016
  S: this,
@@ -5117,9 +5166,9 @@ _ts_decorate8([
5117
5166
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
5118
5167
  var import_async20 = require("@dxos/async");
5119
5168
  var import_client_protocol8 = require("@dxos/client-protocol");
5120
- var import_errors6 = require("@dxos/errors");
5121
5169
  var import_log18 = require("@dxos/log");
5122
5170
  var import_network_manager4 = require("@dxos/network-manager");
5171
+ var import_protocols13 = require("@dxos/protocols");
5123
5172
  var import_rpc3 = require("@dxos/rpc");
5124
5173
  var import_util11 = require("@dxos/util");
5125
5174
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
@@ -5175,7 +5224,7 @@ var IFrameProxyRuntime = class {
5175
5224
  S: this,
5176
5225
  C: (f, a) => f(...a)
5177
5226
  });
5178
- throw new import_errors6.RemoteServiceConnectionError("Failed to connect to worker");
5227
+ throw new import_protocols13.RemoteServiceConnectionError("Failed to connect to worker");
5179
5228
  }
5180
5229
  await this._shellRuntime?.open();
5181
5230
  }
@@ -5200,7 +5249,7 @@ var import_network_manager5 = require("@dxos/network-manager");
5200
5249
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
5201
5250
  var import_async21 = require("@dxos/async");
5202
5251
  var import_client_protocol9 = require("@dxos/client-protocol");
5203
- var import_invariant16 = require("@dxos/invariant");
5252
+ var import_invariant17 = require("@dxos/invariant");
5204
5253
  var import_log19 = require("@dxos/log");
5205
5254
  var import_rpc4 = require("@dxos/rpc");
5206
5255
  var import_util12 = require("@dxos/util");
@@ -5219,7 +5268,7 @@ var WorkerSession = class {
5219
5268
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
5220
5269
  this._startTrigger = new import_async21.Trigger();
5221
5270
  this.onClose = new import_util12.Callback();
5222
- (0, import_invariant16.invariant)(serviceHost, void 0, {
5271
+ (0, import_invariant17.invariant)(serviceHost, void 0, {
5223
5272
  F: __dxlog_file21,
5224
5273
  L: 49,
5225
5274
  S: this,