@dxos/client-services 0.1.58-main.e4cedde → 0.1.58-main.eedac7a

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-FIKNAQOZ.mjs → chunk-5NAD4IAA.mjs} +145 -103
  2. package/dist/lib/browser/chunk-5NAD4IAA.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 +191 -148
  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 +190 -148
  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 +8 -2
  32. package/src/packlets/spaces/spaces-service.ts +30 -9
  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-FIKNAQOZ.mjs.map +0 -7
@@ -1158,26 +1158,24 @@ var DeviceInvitationProtocol = class {
1158
1158
 
1159
1159
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1160
1160
  import { PushStream, scheduleTask as scheduleTask2, TimeoutError, Trigger as Trigger3 } from "@dxos/async";
1161
- import { AuthenticatingInvitationObservable, AUTHENTICATION_CODE_LENGTH, CancellableInvitationObservable, INVITATION_TIMEOUT } from "@dxos/client-protocol";
1161
+ import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT } from "@dxos/client-protocol";
1162
1162
  import { Context as Context5 } from "@dxos/context";
1163
1163
  import { generatePasscode } from "@dxos/credentials";
1164
- import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2 } from "@dxos/errors";
1165
1164
  import { invariant as invariant6 } from "@dxos/invariant";
1166
1165
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1167
1166
  import { log as log5 } from "@dxos/log";
1168
1167
  import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
1169
- import { trace as trace4 } from "@dxos/protocols";
1168
+ import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace4 } from "@dxos/protocols";
1170
1169
  import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
1171
1170
  import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
1172
1171
 
1173
1172
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1174
1173
  import { Trigger as Trigger2 } from "@dxos/async";
1175
1174
  import { cancelWithContext, Context as Context4 } from "@dxos/context";
1176
- import { InvalidInvitationExtensionRoleError } from "@dxos/errors";
1177
1175
  import { invariant as invariant5 } from "@dxos/invariant";
1178
1176
  import { PublicKey as PublicKey4 } from "@dxos/keys";
1179
1177
  import { log as log4 } from "@dxos/log";
1180
- import { schema as schema2, trace as trace3 } from "@dxos/protocols";
1178
+ import { InvalidInvitationExtensionRoleError, schema as schema2, trace as trace3 } from "@dxos/protocols";
1181
1179
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
1182
1180
  import { AuthenticationResponse, Options } from "@dxos/protocols/proto/dxos/halo/invitations";
1183
1181
  import { RpcExtension } from "@dxos/teleport";
@@ -1211,7 +1209,7 @@ var InvitationHostExtension = class extends RpcExtension {
1211
1209
  options: async (options) => {
1212
1210
  invariant5(!this._remoteOptions, "Remote options already set.", {
1213
1211
  F: __dxlog_file6,
1214
- L: 88,
1212
+ L: 87,
1215
1213
  S: this,
1216
1214
  A: [
1217
1215
  "!this._remoteOptions",
@@ -1228,7 +1226,7 @@ var InvitationHostExtension = class extends RpcExtension {
1228
1226
  id: traceId
1229
1227
  }), {
1230
1228
  F: __dxlog_file6,
1231
- L: 97,
1229
+ L: 96,
1232
1230
  S: this,
1233
1231
  C: (f, a) => f(...a)
1234
1232
  });
@@ -1238,7 +1236,7 @@ var InvitationHostExtension = class extends RpcExtension {
1238
1236
  invitationId
1239
1237
  }, {
1240
1238
  F: __dxlog_file6,
1241
- L: 101,
1239
+ L: 100,
1242
1240
  S: this,
1243
1241
  C: (f, a) => f(...a)
1244
1242
  });
@@ -1252,7 +1250,7 @@ var InvitationHostExtension = class extends RpcExtension {
1252
1250
  guestProfile: profile
1253
1251
  }, {
1254
1252
  F: __dxlog_file6,
1255
- L: 110,
1253
+ L: 109,
1256
1254
  S: this,
1257
1255
  C: (f, a) => f(...a)
1258
1256
  });
@@ -1265,7 +1263,7 @@ var InvitationHostExtension = class extends RpcExtension {
1265
1263
  id: traceId
1266
1264
  }), {
1267
1265
  F: __dxlog_file6,
1268
- L: 117,
1266
+ L: 116,
1269
1267
  S: this,
1270
1268
  C: (f, a) => f(...a)
1271
1269
  });
@@ -1280,7 +1278,7 @@ var InvitationHostExtension = class extends RpcExtension {
1280
1278
  id: traceId
1281
1279
  }), {
1282
1280
  F: __dxlog_file6,
1283
- L: 126,
1281
+ L: 125,
1284
1282
  S: this,
1285
1283
  C: (f, a) => f(...a)
1286
1284
  });
@@ -1288,14 +1286,14 @@ var InvitationHostExtension = class extends RpcExtension {
1288
1286
  authCode: code
1289
1287
  }, {
1290
1288
  F: __dxlog_file6,
1291
- L: 127,
1289
+ L: 126,
1292
1290
  S: this,
1293
1291
  C: (f, a) => f(...a)
1294
1292
  });
1295
1293
  let status = AuthenticationResponse.Status.OK;
1296
1294
  invariant5(this.invitation, "Invitation is not set.", {
1297
1295
  F: __dxlog_file6,
1298
- L: 130,
1296
+ L: 129,
1299
1297
  S: this,
1300
1298
  A: [
1301
1299
  "this.invitation",
@@ -1306,7 +1304,7 @@ var InvitationHostExtension = class extends RpcExtension {
1306
1304
  case Invitation2.AuthMethod.NONE: {
1307
1305
  log4("authentication not required", void 0, {
1308
1306
  F: __dxlog_file6,
1309
- L: 133,
1307
+ L: 132,
1310
1308
  S: this,
1311
1309
  C: (f, a) => f(...a)
1312
1310
  });
@@ -1331,7 +1329,7 @@ var InvitationHostExtension = class extends RpcExtension {
1331
1329
  authMethod: this.invitation.authMethod
1332
1330
  }, {
1333
1331
  F: __dxlog_file6,
1334
- L: 151,
1332
+ L: 150,
1335
1333
  S: this,
1336
1334
  C: (f, a) => f(...a)
1337
1335
  });
@@ -1346,7 +1344,7 @@ var InvitationHostExtension = class extends RpcExtension {
1346
1344
  }
1347
1345
  }), {
1348
1346
  F: __dxlog_file6,
1349
- L: 157,
1347
+ L: 156,
1350
1348
  S: this,
1351
1349
  C: (f, a) => f(...a)
1352
1350
  });
@@ -1360,14 +1358,14 @@ var InvitationHostExtension = class extends RpcExtension {
1360
1358
  id: traceId
1361
1359
  }), {
1362
1360
  F: __dxlog_file6,
1363
- L: 163,
1361
+ L: 162,
1364
1362
  S: this,
1365
1363
  C: (f, a) => f(...a)
1366
1364
  });
1367
1365
  try {
1368
1366
  invariant5(this.invitation, "Invitation is not set.", {
1369
1367
  F: __dxlog_file6,
1370
- L: 166,
1368
+ L: 165,
1371
1369
  S: this,
1372
1370
  A: [
1373
1371
  "this.invitation",
@@ -1382,7 +1380,7 @@ var InvitationHostExtension = class extends RpcExtension {
1382
1380
  id: traceId
1383
1381
  }), {
1384
1382
  F: __dxlog_file6,
1385
- L: 174,
1383
+ L: 173,
1386
1384
  S: this,
1387
1385
  C: (f, a) => f(...a)
1388
1386
  });
@@ -1439,7 +1437,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1439
1437
  options: async (options) => {
1440
1438
  invariant5(!this._remoteOptions, "Remote options already set.", {
1441
1439
  F: __dxlog_file6,
1442
- L: 241,
1440
+ L: 240,
1443
1441
  S: this,
1444
1442
  A: [
1445
1443
  "!this._remoteOptions",
@@ -1466,7 +1464,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1466
1464
  try {
1467
1465
  log4("begin options", void 0, {
1468
1466
  F: __dxlog_file6,
1469
- L: 262,
1467
+ L: 261,
1470
1468
  S: this,
1471
1469
  C: (f, a) => f(...a)
1472
1470
  });
@@ -1478,7 +1476,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1478
1476
  }));
1479
1477
  log4("end options", void 0, {
1480
1478
  F: __dxlog_file6,
1481
- L: 265,
1479
+ L: 264,
1482
1480
  S: this,
1483
1481
  C: (f, a) => f(...a)
1484
1482
  });
@@ -1492,7 +1490,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1492
1490
  } catch (err) {
1493
1491
  log4("openError", err, {
1494
1492
  F: __dxlog_file6,
1495
- L: 275,
1493
+ L: 274,
1496
1494
  S: this,
1497
1495
  C: (f, a) => f(...a)
1498
1496
  });
@@ -1502,7 +1500,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1502
1500
  async onClose() {
1503
1501
  log4("onClose", void 0, {
1504
1502
  F: __dxlog_file6,
1505
- L: 281,
1503
+ L: 280,
1506
1504
  S: this,
1507
1505
  C: (f, a) => f(...a)
1508
1506
  });
@@ -1525,7 +1523,7 @@ var InvitationsHandler = class {
1525
1523
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1526
1524
  invariant6(protocol, void 0, {
1527
1525
  F: __dxlog_file7,
1528
- L: 76,
1526
+ L: 75,
1529
1527
  S: this,
1530
1528
  A: [
1531
1529
  "protocol",
@@ -1554,7 +1552,7 @@ var InvitationsHandler = class {
1554
1552
  ...protocol.toJSON()
1555
1553
  }, {
1556
1554
  F: __dxlog_file7,
1557
- L: 98,
1555
+ L: 97,
1558
1556
  S: this,
1559
1557
  C: (f, a) => f(...a)
1560
1558
  });
@@ -1579,7 +1577,7 @@ var InvitationsHandler = class {
1579
1577
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1580
1578
  invariant6(deviceKey, void 0, {
1581
1579
  F: __dxlog_file7,
1582
- L: 119,
1580
+ L: 118,
1583
1581
  S: this,
1584
1582
  A: [
1585
1583
  "deviceKey",
@@ -1602,7 +1600,7 @@ var InvitationsHandler = class {
1602
1600
  id: traceId
1603
1601
  }), {
1604
1602
  F: __dxlog_file7,
1605
- L: 137,
1603
+ L: 136,
1606
1604
  S: this,
1607
1605
  C: (f, a) => f(...a)
1608
1606
  });
@@ -1610,7 +1608,7 @@ var InvitationsHandler = class {
1610
1608
  ...protocol.toJSON()
1611
1609
  }, {
1612
1610
  F: __dxlog_file7,
1613
- L: 138,
1611
+ L: 137,
1614
1612
  S: this,
1615
1613
  C: (f, a) => f(...a)
1616
1614
  });
@@ -1626,7 +1624,7 @@ var InvitationsHandler = class {
1626
1624
  ...protocol.toJSON()
1627
1625
  }, {
1628
1626
  F: __dxlog_file7,
1629
- L: 141,
1627
+ L: 140,
1630
1628
  S: this,
1631
1629
  C: (f, a) => f(...a)
1632
1630
  });
@@ -1638,7 +1636,7 @@ var InvitationsHandler = class {
1638
1636
  id: traceId
1639
1637
  }), {
1640
1638
  F: __dxlog_file7,
1641
- L: 143,
1639
+ L: 142,
1642
1640
  S: this,
1643
1641
  C: (f, a) => f(...a)
1644
1642
  });
@@ -1648,7 +1646,7 @@ var InvitationsHandler = class {
1648
1646
  ...protocol.toJSON()
1649
1647
  }, {
1650
1648
  F: __dxlog_file7,
1651
- L: 146,
1649
+ L: 145,
1652
1650
  S: this,
1653
1651
  C: (f, a) => f(...a)
1654
1652
  });
@@ -1659,7 +1657,7 @@ var InvitationsHandler = class {
1659
1657
  } else {
1660
1658
  log5.error("failed", err, {
1661
1659
  F: __dxlog_file7,
1662
- L: 149,
1660
+ L: 148,
1663
1661
  S: this,
1664
1662
  C: (f, a) => f(...a)
1665
1663
  });
@@ -1670,7 +1668,7 @@ var InvitationsHandler = class {
1670
1668
  error: err
1671
1669
  }), {
1672
1670
  F: __dxlog_file7,
1673
- L: 152,
1671
+ L: 151,
1674
1672
  S: this,
1675
1673
  C: (f, a) => f(...a)
1676
1674
  });
@@ -1691,7 +1689,7 @@ var InvitationsHandler = class {
1691
1689
  ...protocol.toJSON()
1692
1690
  }, {
1693
1691
  F: __dxlog_file7,
1694
- L: 167,
1692
+ L: 166,
1695
1693
  S: this,
1696
1694
  C: (f, a) => f(...a)
1697
1695
  });
@@ -1702,7 +1700,7 @@ var InvitationsHandler = class {
1702
1700
  } else {
1703
1701
  log5.error("failed", err, {
1704
1702
  F: __dxlog_file7,
1705
- L: 170,
1703
+ L: 169,
1706
1704
  S: this,
1707
1705
  C: (f, a) => f(...a)
1708
1706
  });
@@ -1730,7 +1728,7 @@ var InvitationsHandler = class {
1730
1728
  state: Invitation3.State.CONNECTING
1731
1729
  });
1732
1730
  });
1733
- const observable = new CancellableInvitationObservable({
1731
+ const observable = new CancellableInvitation({
1734
1732
  initialInvitation: invitation,
1735
1733
  subscriber: stream.observable,
1736
1734
  onCancel: async () => {
@@ -1747,7 +1745,7 @@ var InvitationsHandler = class {
1747
1745
  const { timeout = INVITATION_TIMEOUT } = invitation;
1748
1746
  invariant6(protocol, void 0, {
1749
1747
  F: __dxlog_file7,
1750
- L: 211,
1748
+ L: 210,
1751
1749
  S: this,
1752
1750
  A: [
1753
1751
  "protocol",
@@ -1761,7 +1759,7 @@ var InvitationsHandler = class {
1761
1759
  const setState = (newData) => {
1762
1760
  invariant6(newData.state !== void 0, void 0, {
1763
1761
  F: __dxlog_file7,
1764
- L: 222,
1762
+ L: 221,
1765
1763
  S: this,
1766
1764
  A: [
1767
1765
  "newData.state !== undefined",
@@ -1781,7 +1779,7 @@ var InvitationsHandler = class {
1781
1779
  ...protocol.toJSON()
1782
1780
  }, {
1783
1781
  F: __dxlog_file7,
1784
- L: 230,
1782
+ L: 229,
1785
1783
  S: this,
1786
1784
  C: (f, a) => f(...a)
1787
1785
  });
@@ -1791,7 +1789,7 @@ var InvitationsHandler = class {
1791
1789
  } else {
1792
1790
  log5.warn("auth failed", err, {
1793
1791
  F: __dxlog_file7,
1794
- L: 233,
1792
+ L: 232,
1795
1793
  S: this,
1796
1794
  C: (f, a) => f(...a)
1797
1795
  });
@@ -1805,7 +1803,7 @@ var InvitationsHandler = class {
1805
1803
  ...protocol.toJSON()
1806
1804
  }, {
1807
1805
  F: __dxlog_file7,
1808
- L: 241,
1806
+ L: 240,
1809
1807
  S: this,
1810
1808
  C: (f, a) => f(...a)
1811
1809
  });
@@ -1820,7 +1818,7 @@ var InvitationsHandler = class {
1820
1818
  currentState
1821
1819
  }, {
1822
1820
  F: __dxlog_file7,
1823
- L: 251,
1821
+ L: 250,
1824
1822
  S: this,
1825
1823
  C: (f, a) => f(...a)
1826
1824
  });
@@ -1835,7 +1833,7 @@ var InvitationsHandler = class {
1835
1833
  id: traceId
1836
1834
  }), {
1837
1835
  F: __dxlog_file7,
1838
- L: 260,
1836
+ L: 259,
1839
1837
  S: this,
1840
1838
  C: (f, a) => f(...a)
1841
1839
  });
@@ -1847,7 +1845,7 @@ var InvitationsHandler = class {
1847
1845
  ...protocol.toJSON()
1848
1846
  }, {
1849
1847
  F: __dxlog_file7,
1850
- L: 268,
1848
+ L: 267,
1851
1849
  S: this,
1852
1850
  C: (f, a) => f(...a)
1853
1851
  });
@@ -1858,7 +1856,7 @@ var InvitationsHandler = class {
1858
1856
  ...protocol.toJSON()
1859
1857
  }, {
1860
1858
  F: __dxlog_file7,
1861
- L: 272,
1859
+ L: 271,
1862
1860
  S: this,
1863
1861
  C: (f, a) => f(...a)
1864
1862
  });
@@ -1868,7 +1866,7 @@ var InvitationsHandler = class {
1868
1866
  response: introductionResponse
1869
1867
  }, {
1870
1868
  F: __dxlog_file7,
1871
- L: 276,
1869
+ L: 275,
1872
1870
  S: this,
1873
1871
  C: (f, a) => f(...a)
1874
1872
  });
@@ -1880,7 +1878,7 @@ var InvitationsHandler = class {
1880
1878
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1881
1879
  log5("guest waiting for authentication code...", void 0, {
1882
1880
  F: __dxlog_file7,
1883
- L: 285,
1881
+ L: 284,
1884
1882
  S: this,
1885
1883
  C: (f, a) => f(...a)
1886
1884
  });
@@ -1892,7 +1890,7 @@ var InvitationsHandler = class {
1892
1890
  });
1893
1891
  log5("sending authentication request", void 0, {
1894
1892
  F: __dxlog_file7,
1895
- L: 289,
1893
+ L: 288,
1896
1894
  S: this,
1897
1895
  C: (f, a) => f(...a)
1898
1896
  });
@@ -1913,7 +1911,7 @@ var InvitationsHandler = class {
1913
1911
  attempt
1914
1912
  }, {
1915
1913
  F: __dxlog_file7,
1916
- L: 300,
1914
+ L: 299,
1917
1915
  S: this,
1918
1916
  C: (f, a) => f(...a)
1919
1917
  });
@@ -1930,7 +1928,7 @@ var InvitationsHandler = class {
1930
1928
  ...protocol.toJSON()
1931
1929
  }, {
1932
1930
  F: __dxlog_file7,
1933
- L: 311,
1931
+ L: 310,
1934
1932
  S: this,
1935
1933
  C: (f, a) => f(...a)
1936
1934
  });
@@ -1942,7 +1940,7 @@ var InvitationsHandler = class {
1942
1940
  ...protocol.toJSON()
1943
1941
  }, {
1944
1942
  F: __dxlog_file7,
1945
- L: 322,
1943
+ L: 321,
1946
1944
  S: this,
1947
1945
  C: (f, a) => f(...a)
1948
1946
  });
@@ -1954,7 +1952,7 @@ var InvitationsHandler = class {
1954
1952
  id: traceId
1955
1953
  }), {
1956
1954
  F: __dxlog_file7,
1957
- L: 324,
1955
+ L: 323,
1958
1956
  S: this,
1959
1957
  C: (f, a) => f(...a)
1960
1958
  });
@@ -1964,7 +1962,7 @@ var InvitationsHandler = class {
1964
1962
  ...protocol.toJSON()
1965
1963
  }, {
1966
1964
  F: __dxlog_file7,
1967
- L: 327,
1965
+ L: 326,
1968
1966
  S: this,
1969
1967
  C: (f, a) => f(...a)
1970
1968
  });
@@ -1974,7 +1972,7 @@ var InvitationsHandler = class {
1974
1972
  } else {
1975
1973
  log5("auth failed", err, {
1976
1974
  F: __dxlog_file7,
1977
- L: 330,
1975
+ L: 329,
1978
1976
  S: this,
1979
1977
  C: (f, a) => f(...a)
1980
1978
  });
@@ -1985,7 +1983,7 @@ var InvitationsHandler = class {
1985
1983
  error: err
1986
1984
  }), {
1987
1985
  F: __dxlog_file7,
1988
- L: 333,
1986
+ L: 332,
1989
1987
  S: this,
1990
1988
  C: (f, a) => f(...a)
1991
1989
  });
@@ -2003,7 +2001,7 @@ var InvitationsHandler = class {
2003
2001
  ...protocol.toJSON()
2004
2002
  }, {
2005
2003
  F: __dxlog_file7,
2006
- L: 344,
2004
+ L: 343,
2007
2005
  S: this,
2008
2006
  C: (f, a) => f(...a)
2009
2007
  });
@@ -2013,7 +2011,7 @@ var InvitationsHandler = class {
2013
2011
  } else {
2014
2012
  log5("auth failed", err, {
2015
2013
  F: __dxlog_file7,
2016
- L: 347,
2014
+ L: 346,
2017
2015
  S: this,
2018
2016
  C: (f, a) => f(...a)
2019
2017
  });
@@ -2026,7 +2024,7 @@ var InvitationsHandler = class {
2026
2024
  scheduleTask2(ctx, async () => {
2027
2025
  invariant6(invitation.swarmKey, void 0, {
2028
2026
  F: __dxlog_file7,
2029
- L: 357,
2027
+ L: 356,
2030
2028
  S: this,
2031
2029
  A: [
2032
2030
  "invitation.swarmKey",
@@ -2048,7 +2046,7 @@ var InvitationsHandler = class {
2048
2046
  state: Invitation3.State.CONNECTING
2049
2047
  });
2050
2048
  });
2051
- const observable = new AuthenticatingInvitationObservable({
2049
+ const observable = new AuthenticatingInvitation({
2052
2050
  initialInvitation: invitation,
2053
2051
  subscriber: stream.observable,
2054
2052
  onCancel: async () => {
@@ -2473,7 +2471,7 @@ import { STORAGE_VERSION } from "@dxos/protocols";
2473
2471
  import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
2474
2472
 
2475
2473
  // packages/sdk/client-services/src/version.ts
2476
- var DXOS_VERSION = "0.1.58-main.e4cedde";
2474
+ var DXOS_VERSION = "0.1.58-main.eedac7a";
2477
2475
 
2478
2476
  // packages/sdk/client-services/src/packlets/services/platform.ts
2479
2477
  var getPlatform = () => {
@@ -2627,9 +2625,9 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
2627
2625
  import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
2628
2626
  import { timed } from "@dxos/debug";
2629
2627
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2630
- import { CancelledError, SystemError } from "@dxos/errors";
2631
2628
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2632
2629
  import { log as log10 } from "@dxos/log";
2630
+ import { CancelledError, SystemError } from "@dxos/protocols";
2633
2631
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
2634
2632
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
2635
2633
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
@@ -2938,7 +2936,7 @@ var DataSpace = class DataSpace2 {
2938
2936
  this._signingContext = params.signingContext;
2939
2937
  this._callbacks = params.callbacks ?? {};
2940
2938
  this.authVerifier = new TrustedKeySetAuthVerifier({
2941
- trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.keys())),
2939
+ trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2942
2940
  update: this._inner.stateUpdate,
2943
2941
  authTimeout: AUTH_TIMEOUT2
2944
2942
  });
@@ -2948,7 +2946,7 @@ var DataSpace = class DataSpace2 {
2948
2946
  state: SpaceState[this._state]
2949
2947
  }, {
2950
2948
  F: __dxlog_file12,
2951
- L: 112,
2949
+ L: 118,
2952
2950
  S: this,
2953
2951
  C: (f, a) => f(...a)
2954
2952
  });
@@ -2991,7 +2989,7 @@ var DataSpace = class DataSpace2 {
2991
2989
  state: SpaceState[this._state]
2992
2990
  }, {
2993
2991
  F: __dxlog_file12,
2994
- L: 159,
2992
+ L: 165,
2995
2993
  S: this,
2996
2994
  C: (f, a) => f(...a)
2997
2995
  });
@@ -3009,7 +3007,7 @@ var DataSpace = class DataSpace2 {
3009
3007
  state: SpaceState[this._state]
3010
3008
  }, {
3011
3009
  F: __dxlog_file12,
3012
- L: 173,
3010
+ L: 179,
3013
3011
  S: this,
3014
3012
  C: (f, a) => f(...a)
3015
3013
  });
@@ -3040,7 +3038,7 @@ var DataSpace = class DataSpace2 {
3040
3038
  if (err instanceof CancelledError) {
3041
3039
  log10("data pipeline initialization cancelled", err, {
3042
3040
  F: __dxlog_file12,
3043
- L: 205,
3041
+ L: 211,
3044
3042
  S: this,
3045
3043
  C: (f, a) => f(...a)
3046
3044
  });
@@ -3048,7 +3046,7 @@ var DataSpace = class DataSpace2 {
3048
3046
  }
3049
3047
  log10.error("Error initializing data pipeline", err, {
3050
3048
  F: __dxlog_file12,
3051
- L: 209,
3049
+ L: 215,
3052
3050
  S: this,
3053
3051
  C: (f, a) => f(...a)
3054
3052
  });
@@ -3057,7 +3055,7 @@ var DataSpace = class DataSpace2 {
3057
3055
  state: SpaceState[this._state]
3058
3056
  }, {
3059
3057
  F: __dxlog_file12,
3060
- L: 211,
3058
+ L: 217,
3061
3059
  S: this,
3062
3060
  C: (f, a) => f(...a)
3063
3061
  });
@@ -3077,7 +3075,7 @@ var DataSpace = class DataSpace2 {
3077
3075
  state: SpaceState[this._state]
3078
3076
  }, {
3079
3077
  F: __dxlog_file12,
3080
- L: 227,
3078
+ L: 233,
3081
3079
  S: this,
3082
3080
  C: (f, a) => f(...a)
3083
3081
  });
@@ -3088,7 +3086,7 @@ var DataSpace = class DataSpace2 {
3088
3086
  await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3089
3087
  log10("waiting for data pipeline to reach target timeframe", void 0, {
3090
3088
  F: __dxlog_file12,
3091
- L: 241,
3089
+ L: 247,
3092
3090
  S: this,
3093
3091
  C: (f, a) => f(...a)
3094
3092
  });
@@ -3099,7 +3097,7 @@ var DataSpace = class DataSpace2 {
3099
3097
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3100
3098
  log10("data pipeline ready", void 0, {
3101
3099
  F: __dxlog_file12,
3102
- L: 250,
3100
+ L: 256,
3103
3101
  S: this,
3104
3102
  C: (f, a) => f(...a)
3105
3103
  });
@@ -3109,7 +3107,7 @@ var DataSpace = class DataSpace2 {
3109
3107
  state: SpaceState[this._state]
3110
3108
  }, {
3111
3109
  F: __dxlog_file12,
3112
- L: 254,
3110
+ L: 260,
3113
3111
  S: this,
3114
3112
  C: (f, a) => f(...a)
3115
3113
  });
@@ -3125,7 +3123,7 @@ var DataSpace = class DataSpace2 {
3125
3123
  await this._createWritableFeeds();
3126
3124
  log10("writable feeds created", void 0, {
3127
3125
  F: __dxlog_file12,
3128
- L: 270,
3126
+ L: 276,
3129
3127
  S: this,
3130
3128
  C: (f, a) => f(...a)
3131
3129
  });
@@ -3230,7 +3228,7 @@ var DataSpace = class DataSpace2 {
3230
3228
  state: SpaceState[this._state]
3231
3229
  }, {
3232
3230
  F: __dxlog_file12,
3233
- L: 386,
3231
+ L: 392,
3234
3232
  S: this,
3235
3233
  C: (f, a) => f(...a)
3236
3234
  });
@@ -3684,10 +3682,9 @@ DataSpaceManager = _ts_decorate4([
3684
3682
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
3685
3683
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
3686
3684
  import { raise as raise2 } from "@dxos/debug";
3687
- import { SpaceNotFoundError } from "@dxos/echo-pipeline";
3688
- import { ApiError } from "@dxos/errors";
3685
+ import { invariant as invariant12 } from "@dxos/invariant";
3689
3686
  import { log as log12 } from "@dxos/log";
3690
- import { encodeError } from "@dxos/protocols";
3687
+ import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
3691
3688
  import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
3692
3689
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3693
3690
  var SpacesServiceImpl = class {
@@ -3750,7 +3747,7 @@ var SpacesServiceImpl = class {
3750
3747
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3751
3748
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3752
3749
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3753
- space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
3750
+ subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3754
3751
  if (space.dataPipeline.pipelineState) {
3755
3752
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3756
3753
  }
@@ -3787,8 +3784,8 @@ var SpacesServiceImpl = class {
3787
3784
  });
3788
3785
  });
3789
3786
  }
3790
- queryCredentials({ spaceKey }) {
3791
- return new Stream10(({ ctx, next }) => {
3787
+ queryCredentials({ spaceKey, noTail }) {
3788
+ return new Stream10(({ ctx, next, close }) => {
3792
3789
  const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
3793
3790
  const processor = {
3794
3791
  processCredential: async (credential) => {
@@ -3796,17 +3793,62 @@ var SpacesServiceImpl = class {
3796
3793
  }
3797
3794
  };
3798
3795
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3799
- scheduleTask5(ctx, () => space.spaceState.addCredentialProcessor(processor));
3796
+ scheduleTask5(ctx, async () => {
3797
+ await space.spaceState.addCredentialProcessor(processor);
3798
+ if (noTail) {
3799
+ close();
3800
+ }
3801
+ });
3800
3802
  });
3801
3803
  }
3802
3804
  async writeCredentials({ spaceKey, credentials }) {
3803
3805
  const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
3804
3806
  for (const credential of credentials ?? []) {
3805
- await space.controlPipeline.writer.write({
3806
- credential: {
3807
- credential
3808
- }
3809
- });
3807
+ if (credential.proof) {
3808
+ await space.controlPipeline.writer.write({
3809
+ credential: {
3810
+ credential
3811
+ }
3812
+ });
3813
+ } else {
3814
+ invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
3815
+ F: __dxlog_file14,
3816
+ L: 168,
3817
+ S: this,
3818
+ A: [
3819
+ "!credential.id",
3820
+ "'Id on unsigned credentials is not allowed'"
3821
+ ]
3822
+ });
3823
+ invariant12(this._identityManager.identity, "Identity is not available", {
3824
+ F: __dxlog_file14,
3825
+ L: 169,
3826
+ S: this,
3827
+ A: [
3828
+ "this._identityManager.identity",
3829
+ "'Identity is not available'"
3830
+ ]
3831
+ });
3832
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3833
+ invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
3834
+ F: __dxlog_file14,
3835
+ L: 171,
3836
+ S: this,
3837
+ A: [
3838
+ "credential.issuer.equals(signer.getIssuer())",
3839
+ ""
3840
+ ]
3841
+ });
3842
+ const signedCredential = await signer.createCredential({
3843
+ subject: credential.subject.id,
3844
+ assertion: credential.subject.assertion
3845
+ });
3846
+ await space.controlPipeline.writer.write({
3847
+ credential: {
3848
+ credential: signedCredential
3849
+ }
3850
+ });
3851
+ }
3810
3852
  }
3811
3853
  }
3812
3854
  async createEpoch({ spaceKey }) {
@@ -3845,7 +3887,7 @@ var SpacesServiceImpl = class {
3845
3887
  displayName: member.assertion.profile?.displayName
3846
3888
  }
3847
3889
  },
3848
- presence: isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
3890
+ presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
3849
3891
  peerStates: peers
3850
3892
  };
3851
3893
  }),
@@ -3864,11 +3906,11 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
3864
3906
  import { failUndefined as failUndefined3 } from "@dxos/debug";
3865
3907
  import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
3866
3908
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
3867
- import { invariant as invariant12 } from "@dxos/invariant";
3909
+ import { invariant as invariant13 } from "@dxos/invariant";
3868
3910
  import { Keyring } from "@dxos/keyring";
3869
3911
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3870
3912
  import { log as log13 } from "@dxos/log";
3871
- import { STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3913
+ import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3872
3914
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
3873
3915
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
3874
3916
  import { trace as Trace2 } from "@dxos/tracing";
@@ -3992,7 +4034,7 @@ var ServiceContext = class ServiceContext2 {
3992
4034
  }
3993
4035
  getInvitationHandler(invitation) {
3994
4036
  const factory = this._handlerFactories.get(invitation.kind);
3995
- invariant12(factory, `Unknown invitation kind: ${invitation.kind}`, {
4037
+ invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
3996
4038
  F: __dxlog_file15,
3997
4039
  L: 174,
3998
4040
  S: this,
@@ -4011,7 +4053,7 @@ var ServiceContext = class ServiceContext2 {
4011
4053
  async _checkStorageVersion() {
4012
4054
  await this.metadataStore.load();
4013
4055
  if (this.metadataStore.version !== STORAGE_VERSION2) {
4014
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${STORAGE_VERSION2}`);
4056
+ throw new InvalidStorageVersionError(STORAGE_VERSION2, this.metadataStore.version);
4015
4057
  }
4016
4058
  }
4017
4059
  // Called when identity is created.
@@ -4039,7 +4081,7 @@ var ServiceContext = class ServiceContext2 {
4039
4081
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
4040
4082
  await this.dataSpaceManager.open();
4041
4083
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4042
- invariant12(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4084
+ invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4043
4085
  F: __dxlog_file15,
4044
4086
  L: 218,
4045
4087
  S: this,
@@ -4245,7 +4287,7 @@ var isLocked = (lockPath) => {
4245
4287
 
4246
4288
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4247
4289
  import { DX_DATA } from "@dxos/client-protocol";
4248
- import { InvalidConfigError } from "@dxos/errors";
4290
+ import { InvalidConfigError } from "@dxos/protocols";
4249
4291
  import { Runtime } from "@dxos/protocols/proto/dxos/config";
4250
4292
  import { createStorage, StorageType } from "@dxos/random-access-storage";
4251
4293
  import { isNode } from "@dxos/util";
@@ -4322,7 +4364,7 @@ import { clientServiceBundle } from "@dxos/client-protocol";
4322
4364
  import { Context as Context10 } from "@dxos/context";
4323
4365
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4324
4366
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4325
- import { invariant as invariant13 } from "@dxos/invariant";
4367
+ import { invariant as invariant14 } from "@dxos/invariant";
4326
4368
  import { PublicKey as PublicKey10 } from "@dxos/keys";
4327
4369
  import { log as log16 } from "@dxos/log";
4328
4370
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4679,7 +4721,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4679
4721
  * Can only be called once.
4680
4722
  */
4681
4723
  initialize({ config, ...options }) {
4682
- invariant13(!this._open, "service host is open", {
4724
+ invariant14(!this._open, "service host is open", {
4683
4725
  F: __dxlog_file17,
4684
4726
  L: 184,
4685
4727
  S: this,
@@ -4695,7 +4737,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4695
4737
  C: (f, a) => f(...a)
4696
4738
  });
4697
4739
  if (config) {
4698
- invariant13(!this._config, "config already set", {
4740
+ invariant14(!this._config, "config already set", {
4699
4741
  F: __dxlog_file17,
4700
4742
  L: 188,
4701
4743
  S: this,
@@ -4713,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4713
4755
  iceServers: this._config?.get("runtime.services.ice")
4714
4756
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4715
4757
  this._signalManager = signalManager;
4716
- invariant13(!this._networkManager, "network manager already set", {
4758
+ invariant14(!this._networkManager, "network manager already set", {
4717
4759
  F: __dxlog_file17,
4718
4760
  L: 204,
4719
4761
  S: this,
@@ -4747,7 +4789,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4747
4789
  S: this,
4748
4790
  C: (f, a) => f(...a)
4749
4791
  });
4750
- invariant13(this._config, "config not set", {
4792
+ invariant14(this._config, "config not set", {
4751
4793
  F: __dxlog_file17,
4752
4794
  L: 224,
4753
4795
  S: this,
@@ -4756,7 +4798,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4756
4798
  "'config not set'"
4757
4799
  ]
4758
4800
  });
4759
- invariant13(this._storage, "storage not set", {
4801
+ invariant14(this._storage, "storage not set", {
4760
4802
  F: __dxlog_file17,
4761
4803
  L: 225,
4762
4804
  S: this,
@@ -4765,7 +4807,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4765
4807
  "'storage not set'"
4766
4808
  ]
4767
4809
  });
4768
- invariant13(this._signalManager, "signal manager not set", {
4810
+ invariant14(this._signalManager, "signal manager not set", {
4769
4811
  F: __dxlog_file17,
4770
4812
  L: 226,
4771
4813
  S: this,
@@ -4774,7 +4816,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4774
4816
  "'signal manager not set'"
4775
4817
  ]
4776
4818
  });
4777
- invariant13(this._networkManager, "network manager not set", {
4819
+ invariant14(this._networkManager, "network manager not set", {
4778
4820
  F: __dxlog_file17,
4779
4821
  L: 227,
4780
4822
  S: this,
@@ -4963,4 +5005,4 @@ export {
4963
5005
  createDefaultModelFactory,
4964
5006
  ClientServicesHost
4965
5007
  };
4966
- //# sourceMappingURL=chunk-FIKNAQOZ.mjs.map
5008
+ //# sourceMappingURL=chunk-5NAD4IAA.mjs.map