@dxos/client-services 0.1.58-main.f117c08 → 0.1.58-main.f5feb2a

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-BHJQYBGX.mjs → chunk-L426VUEE.mjs} +146 -102
  2. package/dist/lib/browser/chunk-L426VUEE.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 +192 -147
  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 +191 -147
  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 +5 -5
  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-BHJQYBGX.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 () => {
@@ -2532,7 +2530,7 @@ var import_protocols5 = require("@dxos/protocols");
2532
2530
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2533
2531
 
2534
2532
  // packages/sdk/client-services/src/version.ts
2535
- var DXOS_VERSION = "0.1.58-main.f117c08";
2533
+ var DXOS_VERSION = "0.1.58-main.f5feb2a";
2536
2534
 
2537
2535
  // packages/sdk/client-services/src/packlets/services/platform.ts
2538
2536
  var getPlatform = () => {
@@ -2685,13 +2683,13 @@ var import_async14 = require("@dxos/async");
2685
2683
  var import_context9 = require("@dxos/context");
2686
2684
  var import_credentials14 = require("@dxos/credentials");
2687
2685
  var import_debug7 = require("@dxos/debug");
2688
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
2686
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
2689
2687
  var import_feed_store4 = require("@dxos/feed-store");
2690
- var import_invariant12 = require("@dxos/invariant");
2688
+ var import_invariant13 = require("@dxos/invariant");
2691
2689
  var import_keyring = require("@dxos/keyring");
2692
2690
  var import_keys10 = require("@dxos/keys");
2693
2691
  var import_log13 = require("@dxos/log");
2694
- var import_protocols9 = require("@dxos/protocols");
2692
+ var import_protocols10 = require("@dxos/protocols");
2695
2693
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2696
2694
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2697
2695
  var import_tracing4 = require("@dxos/tracing");
@@ -2704,7 +2702,7 @@ var import_credentials13 = require("@dxos/credentials");
2704
2702
  var import_invariant11 = require("@dxos/invariant");
2705
2703
  var import_keys9 = require("@dxos/keys");
2706
2704
  var import_log11 = require("@dxos/log");
2707
- var import_protocols7 = require("@dxos/protocols");
2705
+ var import_protocols8 = require("@dxos/protocols");
2708
2706
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2709
2707
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2710
2708
  var import_util5 = require("@dxos/util");
@@ -2715,9 +2713,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2715
2713
  var import_context7 = require("@dxos/context");
2716
2714
  var import_debug4 = require("@dxos/debug");
2717
2715
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2718
- var import_errors3 = require("@dxos/errors");
2719
2716
  var import_keys8 = require("@dxos/keys");
2720
2717
  var import_log10 = require("@dxos/log");
2718
+ var import_protocols7 = require("@dxos/protocols");
2721
2719
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2722
2720
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2723
2721
  var import_timeframe2 = require("@dxos/timeframe");
@@ -3026,7 +3024,7 @@ var DataSpace = class DataSpace2 {
3026
3024
  this._signingContext = params.signingContext;
3027
3025
  this._callbacks = params.callbacks ?? {};
3028
3026
  this.authVerifier = new TrustedKeySetAuthVerifier({
3029
- 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)),
3030
3028
  update: this._inner.stateUpdate,
3031
3029
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
3032
3030
  });
@@ -3036,7 +3034,7 @@ var DataSpace = class DataSpace2 {
3036
3034
  state: import_services7.SpaceState[this._state]
3037
3035
  }, {
3038
3036
  F: __dxlog_file12,
3039
- L: 112,
3037
+ L: 118,
3040
3038
  S: this,
3041
3039
  C: (f, a) => f(...a)
3042
3040
  });
@@ -3070,6 +3068,7 @@ var DataSpace = class DataSpace2 {
3070
3068
  await this._open();
3071
3069
  }
3072
3070
  async _open() {
3071
+ await this._gossip.open();
3073
3072
  await this._notarizationPlugin.open();
3074
3073
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3075
3074
  await this._inner.open(new import_context7.Context());
@@ -3078,7 +3077,7 @@ var DataSpace = class DataSpace2 {
3078
3077
  state: import_services7.SpaceState[this._state]
3079
3078
  }, {
3080
3079
  F: __dxlog_file12,
3081
- L: 158,
3080
+ L: 165,
3082
3081
  S: this,
3083
3082
  C: (f, a) => f(...a)
3084
3083
  });
@@ -3096,7 +3095,7 @@ var DataSpace = class DataSpace2 {
3096
3095
  state: import_services7.SpaceState[this._state]
3097
3096
  }, {
3098
3097
  F: __dxlog_file12,
3099
- L: 172,
3098
+ L: 179,
3100
3099
  S: this,
3101
3100
  C: (f, a) => f(...a)
3102
3101
  });
@@ -3107,6 +3106,7 @@ var DataSpace = class DataSpace2 {
3107
3106
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
3108
3107
  await this._notarizationPlugin.close();
3109
3108
  await this._presence.destroy();
3109
+ await this._gossip.close();
3110
3110
  }
3111
3111
  async postMessage(channel, message) {
3112
3112
  return this._gossip.postMessage(channel, message);
@@ -3123,10 +3123,10 @@ var DataSpace = class DataSpace2 {
3123
3123
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3124
3124
  await this.initializeDataPipeline();
3125
3125
  } catch (err) {
3126
- if (err instanceof import_errors3.CancelledError) {
3126
+ if (err instanceof import_protocols7.CancelledError) {
3127
3127
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3128
3128
  F: __dxlog_file12,
3129
- L: 203,
3129
+ L: 211,
3130
3130
  S: this,
3131
3131
  C: (f, a) => f(...a)
3132
3132
  });
@@ -3134,7 +3134,7 @@ var DataSpace = class DataSpace2 {
3134
3134
  }
3135
3135
  import_log10.log.error("Error initializing data pipeline", err, {
3136
3136
  F: __dxlog_file12,
3137
- L: 207,
3137
+ L: 215,
3138
3138
  S: this,
3139
3139
  C: (f, a) => f(...a)
3140
3140
  });
@@ -3143,7 +3143,7 @@ var DataSpace = class DataSpace2 {
3143
3143
  state: import_services7.SpaceState[this._state]
3144
3144
  }, {
3145
3145
  F: __dxlog_file12,
3146
- L: 209,
3146
+ L: 217,
3147
3147
  S: this,
3148
3148
  C: (f, a) => f(...a)
3149
3149
  });
@@ -3156,14 +3156,14 @@ var DataSpace = class DataSpace2 {
3156
3156
  }
3157
3157
  async initializeDataPipeline() {
3158
3158
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
3159
- throw new import_errors3.SystemError("Invalid operation");
3159
+ throw new import_protocols7.SystemError("Invalid operation");
3160
3160
  }
3161
3161
  this._state = import_services7.SpaceState.INITIALIZING;
3162
3162
  (0, import_log10.log)("new state", {
3163
3163
  state: import_services7.SpaceState[this._state]
3164
3164
  }, {
3165
3165
  F: __dxlog_file12,
3166
- L: 225,
3166
+ L: 233,
3167
3167
  S: this,
3168
3168
  C: (f, a) => f(...a)
3169
3169
  });
@@ -3174,7 +3174,7 @@ var DataSpace = class DataSpace2 {
3174
3174
  await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3175
3175
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3176
3176
  F: __dxlog_file12,
3177
- L: 239,
3177
+ L: 247,
3178
3178
  S: this,
3179
3179
  C: (f, a) => f(...a)
3180
3180
  });
@@ -3185,7 +3185,7 @@ var DataSpace = class DataSpace2 {
3185
3185
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3186
3186
  (0, import_log10.log)("data pipeline ready", void 0, {
3187
3187
  F: __dxlog_file12,
3188
- L: 248,
3188
+ L: 256,
3189
3189
  S: this,
3190
3190
  C: (f, a) => f(...a)
3191
3191
  });
@@ -3195,7 +3195,7 @@ var DataSpace = class DataSpace2 {
3195
3195
  state: import_services7.SpaceState[this._state]
3196
3196
  }, {
3197
3197
  F: __dxlog_file12,
3198
- L: 252,
3198
+ L: 260,
3199
3199
  S: this,
3200
3200
  C: (f, a) => f(...a)
3201
3201
  });
@@ -3211,7 +3211,7 @@ var DataSpace = class DataSpace2 {
3211
3211
  await this._createWritableFeeds();
3212
3212
  (0, import_log10.log)("writable feeds created", void 0, {
3213
3213
  F: __dxlog_file12,
3214
- L: 268,
3214
+ L: 276,
3215
3215
  S: this,
3216
3216
  C: (f, a) => f(...a)
3217
3217
  });
@@ -3316,7 +3316,7 @@ var DataSpace = class DataSpace2 {
3316
3316
  state: import_services7.SpaceState[this._state]
3317
3317
  }, {
3318
3318
  F: __dxlog_file12,
3319
- L: 384,
3319
+ L: 392,
3320
3320
  S: this,
3321
3321
  C: (f, a) => f(...a)
3322
3322
  });
@@ -3458,7 +3458,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3458
3458
  S: this,
3459
3459
  C: (f, a) => f(...a)
3460
3460
  });
3461
- 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({
3462
3462
  id: this._instanceId
3463
3463
  }), {
3464
3464
  F: __dxlog_file13,
@@ -3504,7 +3504,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3504
3504
  space.initializeDataPipelineAsync();
3505
3505
  }
3506
3506
  }
3507
- 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({
3508
3508
  id: this._instanceId
3509
3509
  }), {
3510
3510
  F: __dxlog_file13,
@@ -3758,10 +3758,9 @@ DataSpaceManager = _ts_decorate4([
3758
3758
  var import_async13 = require("@dxos/async");
3759
3759
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3760
3760
  var import_debug6 = require("@dxos/debug");
3761
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3762
- var import_errors4 = require("@dxos/errors");
3761
+ var import_invariant12 = require("@dxos/invariant");
3763
3762
  var import_log12 = require("@dxos/log");
3764
- var import_protocols8 = require("@dxos/protocols");
3763
+ var import_protocols9 = require("@dxos/protocols");
3765
3764
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3766
3765
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3767
3766
  var SpacesServiceImpl = class {
@@ -3781,7 +3780,7 @@ var SpacesServiceImpl = class {
3781
3780
  }
3782
3781
  async updateSpace({ spaceKey, state }) {
3783
3782
  const dataSpaceManager = await this._getDataSpaceManager();
3784
- 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));
3785
3784
  if (state) {
3786
3785
  switch (state) {
3787
3786
  case import_services9.SpaceState.ACTIVE:
@@ -3791,7 +3790,7 @@ var SpacesServiceImpl = class {
3791
3790
  await space.deactivate();
3792
3791
  break;
3793
3792
  default:
3794
- throw new import_errors4.ApiError("Invalid space state");
3793
+ throw new import_protocols9.ApiError("Invalid space state");
3795
3794
  }
3796
3795
  }
3797
3796
  }
@@ -3846,14 +3845,14 @@ var SpacesServiceImpl = class {
3846
3845
  }
3847
3846
  async postMessage({ spaceKey, channel, message }) {
3848
3847
  const dataSpaceManager = await this._getDataSpaceManager();
3849
- 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));
3850
3849
  await space.postMessage(getChannelId(channel), message);
3851
3850
  }
3852
3851
  subscribeMessages({ spaceKey, channel }) {
3853
3852
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3854
3853
  (0, import_async13.scheduleTask)(ctx, async () => {
3855
3854
  const dataSpaceManager = await this._getDataSpaceManager();
3856
- 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));
3857
3856
  const handle = space.listen(getChannelId(channel), (message) => {
3858
3857
  next(message);
3859
3858
  });
@@ -3861,38 +3860,83 @@ var SpacesServiceImpl = class {
3861
3860
  });
3862
3861
  });
3863
3862
  }
3864
- queryCredentials({ spaceKey }) {
3865
- return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3866
- 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));
3867
3866
  const processor = {
3868
3867
  processCredential: async (credential) => {
3869
3868
  next(credential);
3870
3869
  }
3871
3870
  };
3872
3871
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3873
- (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
+ });
3874
3878
  });
3875
3879
  }
3876
3880
  async writeCredentials({ spaceKey, credentials }) {
3877
- 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));
3878
3882
  for (const credential of credentials ?? []) {
3879
- await space.controlPipeline.writer.write({
3880
- credential: {
3881
- credential
3882
- }
3883
- });
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
+ }
3884
3928
  }
3885
3929
  }
3886
3930
  async createEpoch({ spaceKey }) {
3887
3931
  const dataSpaceManager = await this._getDataSpaceManager();
3888
- 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));
3889
3933
  await space.createEpoch();
3890
3934
  }
3891
3935
  _serializeSpace(space) {
3892
3936
  return {
3893
3937
  spaceKey: space.key,
3894
3938
  state: space.state,
3895
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3939
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3896
3940
  pipeline: {
3897
3941
  currentEpoch: space.dataPipeline.currentEpoch,
3898
3942
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3919,7 +3963,7 @@ var SpacesServiceImpl = class {
3919
3963
  displayName: member.assertion.profile?.displayName
3920
3964
  }
3921
3965
  },
3922
- 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,
3923
3967
  peerStates: peers
3924
3968
  };
3925
3969
  }),
@@ -3951,11 +3995,11 @@ var ServiceContext = class ServiceContext2 {
3951
3995
  this.signalManager = signalManager;
3952
3996
  this.modelFactory = modelFactory;
3953
3997
  this.initialized = new import_async14.Trigger();
3954
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3998
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3955
3999
  this._handlerFactories = /* @__PURE__ */ new Map();
3956
4000
  this._instanceId = import_keys10.PublicKey.random().toHex();
3957
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3958
- 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"));
3959
4003
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3960
4004
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3961
4005
  this.feedStore = new import_feed_store4.FeedStore({
@@ -3963,12 +4007,12 @@ var ServiceContext = class ServiceContext2 {
3963
4007
  root: storage.createDirectory("feeds"),
3964
4008
  signer: this.keyring,
3965
4009
  hypercore: {
3966
- valueEncoding: import_echo_pipeline3.valueEncoding,
4010
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3967
4011
  stats: true
3968
4012
  }
3969
4013
  })
3970
4014
  });
3971
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
4015
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3972
4016
  feedStore: this.feedStore,
3973
4017
  networkManager: this.networkManager,
3974
4018
  blobStore: this.blobStore,
@@ -3988,7 +4032,7 @@ var ServiceContext = class ServiceContext2 {
3988
4032
  S: this,
3989
4033
  C: (f, a) => f(...a)
3990
4034
  });
3991
- 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({
3992
4036
  id: this._instanceId
3993
4037
  }), {
3994
4038
  F: __dxlog_file15,
@@ -4004,7 +4048,7 @@ var ServiceContext = class ServiceContext2 {
4004
4048
  if (this.identityManager.identity) {
4005
4049
  await this._initialize(ctx);
4006
4050
  }
4007
- 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({
4008
4052
  id: this._instanceId
4009
4053
  }), {
4010
4054
  F: __dxlog_file15,
@@ -4051,7 +4095,7 @@ var ServiceContext = class ServiceContext2 {
4051
4095
  }
4052
4096
  getInvitationHandler(invitation) {
4053
4097
  const factory = this._handlerFactories.get(invitation.kind);
4054
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4098
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4055
4099
  F: __dxlog_file15,
4056
4100
  L: 174,
4057
4101
  S: this,
@@ -4069,8 +4113,8 @@ var ServiceContext = class ServiceContext2 {
4069
4113
  }
4070
4114
  async _checkStorageVersion() {
4071
4115
  await this.metadataStore.load();
4072
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
4073
- 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);
4074
4118
  }
4075
4119
  }
4076
4120
  // Called when identity is created.
@@ -4098,7 +4142,7 @@ var ServiceContext = class ServiceContext2 {
4098
4142
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
4099
4143
  await this.dataSpaceManager.open();
4100
4144
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
4101
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4145
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4102
4146
  F: __dxlog_file15,
4103
4147
  L: 218,
4104
4148
  S: this,
@@ -4183,14 +4227,14 @@ var import_async17 = require("@dxos/async");
4183
4227
  var import_client_protocol5 = require("@dxos/client-protocol");
4184
4228
  var import_context10 = require("@dxos/context");
4185
4229
  var import_document_model2 = require("@dxos/document-model");
4186
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4187
- var import_invariant14 = require("@dxos/invariant");
4230
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
4231
+ var import_invariant15 = require("@dxos/invariant");
4188
4232
  var import_keys11 = require("@dxos/keys");
4189
4233
  var import_log16 = require("@dxos/log");
4190
4234
  var import_messaging = require("@dxos/messaging");
4191
4235
  var import_model_factory = require("@dxos/model-factory");
4192
4236
  var import_network_manager2 = require("@dxos/network-manager");
4193
- var import_protocols10 = require("@dxos/protocols");
4237
+ var import_protocols12 = require("@dxos/protocols");
4194
4238
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4195
4239
  var import_text_model = require("@dxos/text-model");
4196
4240
  var import_tracing5 = require("@dxos/tracing");
@@ -4240,7 +4284,7 @@ var DevicesServiceImpl = class {
4240
4284
  };
4241
4285
 
4242
4286
  // packages/sdk/client-services/src/packlets/locks/node.ts
4243
- var import_invariant13 = require("@dxos/invariant");
4287
+ var import_invariant14 = require("@dxos/invariant");
4244
4288
  var import_lock_file = require("@dxos/lock-file");
4245
4289
  var import_log14 = require("@dxos/log");
4246
4290
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4281,7 +4325,7 @@ var Lock = class {
4281
4325
  }
4282
4326
  async release() {
4283
4327
  await this._onRelease?.();
4284
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4328
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4285
4329
  F: __dxlog_file16,
4286
4330
  L: 42,
4287
4331
  S: this,
@@ -4449,7 +4493,7 @@ var NetworkServiceImpl = class {
4449
4493
 
4450
4494
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4451
4495
  var import_client_protocol4 = require("@dxos/client-protocol");
4452
- var import_errors5 = require("@dxos/errors");
4496
+ var import_protocols11 = require("@dxos/protocols");
4453
4497
  var import_config = require("@dxos/protocols/proto/dxos/config");
4454
4498
  var import_random_access_storage = require("@dxos/random-access-storage");
4455
4499
  var import_util8 = require("@dxos/util");
@@ -4457,16 +4501,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4457
4501
  var createStorageObjects = (config) => {
4458
4502
  const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4459
4503
  if (persistent && storageType === StorageDriver.RAM) {
4460
- 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.");
4461
4505
  }
4462
4506
  if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4463
- 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.");
4464
4508
  }
4465
4509
  if (persistent && keyStorage === StorageDriver.RAM) {
4466
- 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.");
4467
4511
  }
4468
4512
  if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4469
- 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.");
4470
4514
  }
4471
4515
  return {
4472
4516
  storage: (0, import_random_access_storage.createStorage)({
@@ -4673,7 +4717,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4673
4717
  * Can only be called once.
4674
4718
  */
4675
4719
  initialize({ config, ...options }) {
4676
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4720
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4677
4721
  F: __dxlog_file17,
4678
4722
  L: 184,
4679
4723
  S: this,
@@ -4689,7 +4733,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4689
4733
  C: (f, a) => f(...a)
4690
4734
  });
4691
4735
  if (config) {
4692
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4736
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4693
4737
  F: __dxlog_file17,
4694
4738
  L: 188,
4695
4739
  S: this,
@@ -4707,7 +4751,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4707
4751
  iceServers: this._config?.get("runtime.services.ice")
4708
4752
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4709
4753
  this._signalManager = signalManager;
4710
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4754
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4711
4755
  F: __dxlog_file17,
4712
4756
  L: 204,
4713
4757
  S: this,
@@ -4733,7 +4777,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4733
4777
  return;
4734
4778
  }
4735
4779
  const traceId = import_keys11.PublicKey.random().toHex();
4736
- 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({
4737
4781
  id: traceId
4738
4782
  }), {
4739
4783
  F: __dxlog_file17,
@@ -4741,7 +4785,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4741
4785
  S: this,
4742
4786
  C: (f, a) => f(...a)
4743
4787
  });
4744
- (0, import_invariant14.invariant)(this._config, "config not set", {
4788
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4745
4789
  F: __dxlog_file17,
4746
4790
  L: 224,
4747
4791
  S: this,
@@ -4750,7 +4794,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4750
4794
  "'config not set'"
4751
4795
  ]
4752
4796
  });
4753
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4797
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4754
4798
  F: __dxlog_file17,
4755
4799
  L: 225,
4756
4800
  S: this,
@@ -4759,7 +4803,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4759
4803
  "'storage not set'"
4760
4804
  ]
4761
4805
  });
4762
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4806
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4763
4807
  F: __dxlog_file17,
4764
4808
  L: 226,
4765
4809
  S: this,
@@ -4768,7 +4812,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4768
4812
  "'signal manager not set'"
4769
4813
  ]
4770
4814
  });
4771
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4815
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4772
4816
  F: __dxlog_file17,
4773
4817
  L: 227,
4774
4818
  S: this,
@@ -4798,7 +4842,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4798
4842
  await this._serviceContext.initialized.wait();
4799
4843
  return this._serviceContext.dataSpaceManager;
4800
4844
  }),
4801
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4845
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4802
4846
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4803
4847
  LoggingService: this._loggingService,
4804
4848
  TracingService: this._tracingService,
@@ -4832,7 +4876,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4832
4876
  S: this,
4833
4877
  C: (f, a) => f(...a)
4834
4878
  });
4835
- 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({
4836
4880
  id: traceId
4837
4881
  }), {
4838
4882
  F: __dxlog_file17,
@@ -4873,7 +4917,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4873
4917
  }
4874
4918
  async reset() {
4875
4919
  const traceId = import_keys11.PublicKey.random().toHex();
4876
- 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({
4877
4921
  id: traceId
4878
4922
  }), {
4879
4923
  F: __dxlog_file17,
@@ -4895,7 +4939,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4895
4939
  S: this,
4896
4940
  C: (f, a) => f(...a)
4897
4941
  });
4898
- 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({
4899
4943
  id: traceId
4900
4944
  }), {
4901
4945
  F: __dxlog_file17,
@@ -4936,7 +4980,7 @@ var import_util10 = require("@dxos/util");
4936
4980
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4937
4981
  var import_async18 = require("@dxos/async");
4938
4982
  var import_client_protocol6 = require("@dxos/client-protocol");
4939
- var import_invariant15 = require("@dxos/invariant");
4983
+ var import_invariant16 = require("@dxos/invariant");
4940
4984
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
4941
4985
  var import_rpc2 = require("@dxos/rpc");
4942
4986
  var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
@@ -4955,17 +4999,18 @@ var ShellRuntimeImpl = class {
4955
4999
  get spaceKey() {
4956
5000
  return this._spaceKey;
4957
5001
  }
4958
- setLayout(layout, options = {}) {
5002
+ setLayout({ layout, invitationCode, spaceKey }) {
4959
5003
  this._layout = layout;
4960
- this._invitationCode = options.invitationCode;
4961
- this._spaceKey = options.spaceKey;
5004
+ this._invitationCode = invitationCode;
5005
+ this._spaceKey = spaceKey;
4962
5006
  this.layoutUpdate.emit({
4963
5007
  layout,
4964
- ...options
5008
+ invitationCode,
5009
+ spaceKey
4965
5010
  });
4966
5011
  }
4967
5012
  async setAppContext(context) {
4968
- (0, import_invariant15.invariant)(this._appRpc, "runtime not open", {
5013
+ (0, import_invariant16.invariant)(this._appRpc, "runtime not open", {
4969
5014
  F: __dxlog_file18,
4970
5015
  L: 44,
4971
5016
  S: this,
@@ -5121,9 +5166,9 @@ _ts_decorate8([
5121
5166
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
5122
5167
  var import_async20 = require("@dxos/async");
5123
5168
  var import_client_protocol8 = require("@dxos/client-protocol");
5124
- var import_errors6 = require("@dxos/errors");
5125
5169
  var import_log18 = require("@dxos/log");
5126
5170
  var import_network_manager4 = require("@dxos/network-manager");
5171
+ var import_protocols13 = require("@dxos/protocols");
5127
5172
  var import_rpc3 = require("@dxos/rpc");
5128
5173
  var import_util11 = require("@dxos/util");
5129
5174
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
@@ -5179,7 +5224,7 @@ var IFrameProxyRuntime = class {
5179
5224
  S: this,
5180
5225
  C: (f, a) => f(...a)
5181
5226
  });
5182
- throw new import_errors6.RemoteServiceConnectionError("Failed to connect to worker");
5227
+ throw new import_protocols13.RemoteServiceConnectionError("Failed to connect to worker");
5183
5228
  }
5184
5229
  await this._shellRuntime?.open();
5185
5230
  }
@@ -5204,7 +5249,7 @@ var import_network_manager5 = require("@dxos/network-manager");
5204
5249
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
5205
5250
  var import_async21 = require("@dxos/async");
5206
5251
  var import_client_protocol9 = require("@dxos/client-protocol");
5207
- var import_invariant16 = require("@dxos/invariant");
5252
+ var import_invariant17 = require("@dxos/invariant");
5208
5253
  var import_log19 = require("@dxos/log");
5209
5254
  var import_rpc4 = require("@dxos/rpc");
5210
5255
  var import_util12 = require("@dxos/util");
@@ -5223,7 +5268,7 @@ var WorkerSession = class {
5223
5268
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
5224
5269
  this._startTrigger = new import_async21.Trigger();
5225
5270
  this.onClose = new import_util12.Callback();
5226
- (0, import_invariant16.invariant)(serviceHost, void 0, {
5271
+ (0, import_invariant17.invariant)(serviceHost, void 0, {
5227
5272
  F: __dxlog_file21,
5228
5273
  L: 49,
5229
5274
  S: this,