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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/lib/browser/{chunk-ARM2DYUZ.mjs → chunk-DJ4JCFP7.mjs} +251 -179
  2. package/dist/lib/browser/chunk-DJ4JCFP7.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11 -11
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +5 -5
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +299 -227
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +296 -224
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  15. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
  16. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
  19. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  20. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
  22. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  24. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  25. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  26. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  28. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
  29. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  30. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
  31. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  32. package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
  33. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  34. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  35. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  36. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  37. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
  38. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  39. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  40. package/dist/types/src/version.d.ts +1 -1
  41. package/package.json +35 -35
  42. package/src/packlets/devices/devices-service.test.ts +1 -1
  43. package/src/packlets/devtools/devtools.ts +1 -1
  44. package/src/packlets/identity/authenticator.ts +2 -5
  45. package/src/packlets/identity/identity-manager.test.ts +1 -1
  46. package/src/packlets/identity/identity-service.test.ts +1 -1
  47. package/src/packlets/identity/identity.test.ts +1 -1
  48. package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
  49. package/src/packlets/invitations/invitation-extension.ts +1 -2
  50. package/src/packlets/invitations/invitations-handler.ts +7 -8
  51. package/src/packlets/invitations/invitations-service.ts +5 -5
  52. package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
  53. package/src/packlets/network/network-service.test.ts +1 -1
  54. package/src/packlets/services/diagnostics.ts +2 -2
  55. package/src/packlets/services/service-context.ts +7 -13
  56. package/src/packlets/services/service-host.test.ts +3 -3
  57. package/src/packlets/services/service-host.ts +42 -6
  58. package/src/packlets/services/service-registry.test.ts +1 -1
  59. package/src/packlets/spaces/data-space-manager.test.ts +1 -1
  60. package/src/packlets/spaces/data-space-manager.ts +1 -1
  61. package/src/packlets/spaces/data-space.ts +9 -3
  62. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  63. package/src/packlets/spaces/spaces-service.ts +31 -10
  64. package/src/packlets/storage/storage.ts +10 -10
  65. package/src/packlets/testing/invitation-utils.ts +9 -9
  66. package/src/packlets/testing/test-builder.ts +3 -3
  67. package/src/packlets/vault/iframe-host-runtime.ts +1 -1
  68. package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
  69. package/src/packlets/vault/shell-runtime.ts +4 -4
  70. package/src/packlets/vault/worker-runtime.ts +9 -6
  71. package/src/version.ts +1 -1
  72. package/dist/lib/browser/chunk-ARM2DYUZ.mjs.map +0 -7
@@ -357,7 +357,6 @@ var createAuthProvider = (signer) => async (nonce) => {
357
357
  return Credential.encode(credential);
358
358
  };
359
359
  var TrustedKeySetAuthVerifier = class {
360
- // prettier-ignore
361
360
  constructor(_params) {
362
361
  this._params = _params;
363
362
  this._ctx = new Context2();
@@ -372,7 +371,7 @@ var TrustedKeySetAuthVerifier = class {
372
371
  credential
373
372
  }, {
374
373
  F: __dxlog_file,
375
- L: 59,
374
+ L: 56,
376
375
  S: this,
377
376
  C: (f, a) => f(...a)
378
377
  });
@@ -382,7 +381,7 @@ var TrustedKeySetAuthVerifier = class {
382
381
  result
383
382
  }, {
384
383
  F: __dxlog_file,
385
- L: 63,
384
+ L: 60,
386
385
  S: this,
387
386
  C: (f, a) => f(...a)
388
387
  });
@@ -394,7 +393,7 @@ var TrustedKeySetAuthVerifier = class {
394
393
  credential
395
394
  }, {
396
395
  F: __dxlog_file,
397
- L: 68,
396
+ L: 65,
398
397
  S: this,
399
398
  C: (f, a) => f(...a)
400
399
  });
@@ -405,7 +404,7 @@ var TrustedKeySetAuthVerifier = class {
405
404
  key: credential.issuer
406
405
  }, {
407
406
  F: __dxlog_file,
408
- L: 73,
407
+ L: 70,
409
408
  S: this,
410
409
  C: (f, a) => f(...a)
411
410
  });
@@ -421,7 +420,7 @@ var TrustedKeySetAuthVerifier = class {
421
420
  key: credential.issuer
422
421
  }, {
423
422
  F: __dxlog_file,
424
- L: 84,
423
+ L: 81,
425
424
  S: this,
426
425
  C: (f, a) => f(...a)
427
426
  });
@@ -431,7 +430,7 @@ var TrustedKeySetAuthVerifier = class {
431
430
  key: credential.issuer
432
431
  }, {
433
432
  F: __dxlog_file,
434
- L: 87,
433
+ L: 84,
435
434
  S: this,
436
435
  C: (f, a) => f(...a)
437
436
  });
@@ -1158,26 +1157,24 @@ var DeviceInvitationProtocol = class {
1158
1157
 
1159
1158
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1160
1159
  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";
1160
+ import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT } from "@dxos/client-protocol";
1162
1161
  import { Context as Context5 } from "@dxos/context";
1163
1162
  import { generatePasscode } from "@dxos/credentials";
1164
- import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2 } from "@dxos/errors";
1165
1163
  import { invariant as invariant6 } from "@dxos/invariant";
1166
1164
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1167
1165
  import { log as log5 } from "@dxos/log";
1168
1166
  import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
1169
- import { trace as trace4 } from "@dxos/protocols";
1167
+ import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace4 } from "@dxos/protocols";
1170
1168
  import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
1171
1169
  import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
1172
1170
 
1173
1171
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1174
1172
  import { Trigger as Trigger2 } from "@dxos/async";
1175
1173
  import { cancelWithContext, Context as Context4 } from "@dxos/context";
1176
- import { InvalidInvitationExtensionRoleError } from "@dxos/errors";
1177
1174
  import { invariant as invariant5 } from "@dxos/invariant";
1178
1175
  import { PublicKey as PublicKey4 } from "@dxos/keys";
1179
1176
  import { log as log4 } from "@dxos/log";
1180
- import { schema as schema2, trace as trace3 } from "@dxos/protocols";
1177
+ import { InvalidInvitationExtensionRoleError, schema as schema2, trace as trace3 } from "@dxos/protocols";
1181
1178
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
1182
1179
  import { AuthenticationResponse, Options } from "@dxos/protocols/proto/dxos/halo/invitations";
1183
1180
  import { RpcExtension } from "@dxos/teleport";
@@ -1211,7 +1208,7 @@ var InvitationHostExtension = class extends RpcExtension {
1211
1208
  options: async (options) => {
1212
1209
  invariant5(!this._remoteOptions, "Remote options already set.", {
1213
1210
  F: __dxlog_file6,
1214
- L: 88,
1211
+ L: 87,
1215
1212
  S: this,
1216
1213
  A: [
1217
1214
  "!this._remoteOptions",
@@ -1228,7 +1225,7 @@ var InvitationHostExtension = class extends RpcExtension {
1228
1225
  id: traceId
1229
1226
  }), {
1230
1227
  F: __dxlog_file6,
1231
- L: 97,
1228
+ L: 96,
1232
1229
  S: this,
1233
1230
  C: (f, a) => f(...a)
1234
1231
  });
@@ -1238,7 +1235,7 @@ var InvitationHostExtension = class extends RpcExtension {
1238
1235
  invitationId
1239
1236
  }, {
1240
1237
  F: __dxlog_file6,
1241
- L: 101,
1238
+ L: 100,
1242
1239
  S: this,
1243
1240
  C: (f, a) => f(...a)
1244
1241
  });
@@ -1252,7 +1249,7 @@ var InvitationHostExtension = class extends RpcExtension {
1252
1249
  guestProfile: profile
1253
1250
  }, {
1254
1251
  F: __dxlog_file6,
1255
- L: 110,
1252
+ L: 109,
1256
1253
  S: this,
1257
1254
  C: (f, a) => f(...a)
1258
1255
  });
@@ -1265,7 +1262,7 @@ var InvitationHostExtension = class extends RpcExtension {
1265
1262
  id: traceId
1266
1263
  }), {
1267
1264
  F: __dxlog_file6,
1268
- L: 117,
1265
+ L: 116,
1269
1266
  S: this,
1270
1267
  C: (f, a) => f(...a)
1271
1268
  });
@@ -1280,7 +1277,7 @@ var InvitationHostExtension = class extends RpcExtension {
1280
1277
  id: traceId
1281
1278
  }), {
1282
1279
  F: __dxlog_file6,
1283
- L: 126,
1280
+ L: 125,
1284
1281
  S: this,
1285
1282
  C: (f, a) => f(...a)
1286
1283
  });
@@ -1288,14 +1285,14 @@ var InvitationHostExtension = class extends RpcExtension {
1288
1285
  authCode: code
1289
1286
  }, {
1290
1287
  F: __dxlog_file6,
1291
- L: 127,
1288
+ L: 126,
1292
1289
  S: this,
1293
1290
  C: (f, a) => f(...a)
1294
1291
  });
1295
1292
  let status = AuthenticationResponse.Status.OK;
1296
1293
  invariant5(this.invitation, "Invitation is not set.", {
1297
1294
  F: __dxlog_file6,
1298
- L: 130,
1295
+ L: 129,
1299
1296
  S: this,
1300
1297
  A: [
1301
1298
  "this.invitation",
@@ -1306,7 +1303,7 @@ var InvitationHostExtension = class extends RpcExtension {
1306
1303
  case Invitation2.AuthMethod.NONE: {
1307
1304
  log4("authentication not required", void 0, {
1308
1305
  F: __dxlog_file6,
1309
- L: 133,
1306
+ L: 132,
1310
1307
  S: this,
1311
1308
  C: (f, a) => f(...a)
1312
1309
  });
@@ -1331,7 +1328,7 @@ var InvitationHostExtension = class extends RpcExtension {
1331
1328
  authMethod: this.invitation.authMethod
1332
1329
  }, {
1333
1330
  F: __dxlog_file6,
1334
- L: 151,
1331
+ L: 150,
1335
1332
  S: this,
1336
1333
  C: (f, a) => f(...a)
1337
1334
  });
@@ -1346,7 +1343,7 @@ var InvitationHostExtension = class extends RpcExtension {
1346
1343
  }
1347
1344
  }), {
1348
1345
  F: __dxlog_file6,
1349
- L: 157,
1346
+ L: 156,
1350
1347
  S: this,
1351
1348
  C: (f, a) => f(...a)
1352
1349
  });
@@ -1360,14 +1357,14 @@ var InvitationHostExtension = class extends RpcExtension {
1360
1357
  id: traceId
1361
1358
  }), {
1362
1359
  F: __dxlog_file6,
1363
- L: 163,
1360
+ L: 162,
1364
1361
  S: this,
1365
1362
  C: (f, a) => f(...a)
1366
1363
  });
1367
1364
  try {
1368
1365
  invariant5(this.invitation, "Invitation is not set.", {
1369
1366
  F: __dxlog_file6,
1370
- L: 166,
1367
+ L: 165,
1371
1368
  S: this,
1372
1369
  A: [
1373
1370
  "this.invitation",
@@ -1382,7 +1379,7 @@ var InvitationHostExtension = class extends RpcExtension {
1382
1379
  id: traceId
1383
1380
  }), {
1384
1381
  F: __dxlog_file6,
1385
- L: 174,
1382
+ L: 173,
1386
1383
  S: this,
1387
1384
  C: (f, a) => f(...a)
1388
1385
  });
@@ -1439,7 +1436,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1439
1436
  options: async (options) => {
1440
1437
  invariant5(!this._remoteOptions, "Remote options already set.", {
1441
1438
  F: __dxlog_file6,
1442
- L: 241,
1439
+ L: 240,
1443
1440
  S: this,
1444
1441
  A: [
1445
1442
  "!this._remoteOptions",
@@ -1466,7 +1463,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1466
1463
  try {
1467
1464
  log4("begin options", void 0, {
1468
1465
  F: __dxlog_file6,
1469
- L: 262,
1466
+ L: 261,
1470
1467
  S: this,
1471
1468
  C: (f, a) => f(...a)
1472
1469
  });
@@ -1478,7 +1475,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1478
1475
  }));
1479
1476
  log4("end options", void 0, {
1480
1477
  F: __dxlog_file6,
1481
- L: 265,
1478
+ L: 264,
1482
1479
  S: this,
1483
1480
  C: (f, a) => f(...a)
1484
1481
  });
@@ -1492,7 +1489,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1492
1489
  } catch (err) {
1493
1490
  log4("openError", err, {
1494
1491
  F: __dxlog_file6,
1495
- L: 275,
1492
+ L: 274,
1496
1493
  S: this,
1497
1494
  C: (f, a) => f(...a)
1498
1495
  });
@@ -1502,7 +1499,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1502
1499
  async onClose() {
1503
1500
  log4("onClose", void 0, {
1504
1501
  F: __dxlog_file6,
1505
- L: 281,
1502
+ L: 280,
1506
1503
  S: this,
1507
1504
  C: (f, a) => f(...a)
1508
1505
  });
@@ -1525,7 +1522,7 @@ var InvitationsHandler = class {
1525
1522
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1526
1523
  invariant6(protocol, void 0, {
1527
1524
  F: __dxlog_file7,
1528
- L: 76,
1525
+ L: 75,
1529
1526
  S: this,
1530
1527
  A: [
1531
1528
  "protocol",
@@ -1554,7 +1551,7 @@ var InvitationsHandler = class {
1554
1551
  ...protocol.toJSON()
1555
1552
  }, {
1556
1553
  F: __dxlog_file7,
1557
- L: 98,
1554
+ L: 97,
1558
1555
  S: this,
1559
1556
  C: (f, a) => f(...a)
1560
1557
  });
@@ -1579,7 +1576,7 @@ var InvitationsHandler = class {
1579
1576
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1580
1577
  invariant6(deviceKey, void 0, {
1581
1578
  F: __dxlog_file7,
1582
- L: 119,
1579
+ L: 118,
1583
1580
  S: this,
1584
1581
  A: [
1585
1582
  "deviceKey",
@@ -1602,7 +1599,7 @@ var InvitationsHandler = class {
1602
1599
  id: traceId
1603
1600
  }), {
1604
1601
  F: __dxlog_file7,
1605
- L: 137,
1602
+ L: 136,
1606
1603
  S: this,
1607
1604
  C: (f, a) => f(...a)
1608
1605
  });
@@ -1610,7 +1607,7 @@ var InvitationsHandler = class {
1610
1607
  ...protocol.toJSON()
1611
1608
  }, {
1612
1609
  F: __dxlog_file7,
1613
- L: 138,
1610
+ L: 137,
1614
1611
  S: this,
1615
1612
  C: (f, a) => f(...a)
1616
1613
  });
@@ -1626,7 +1623,7 @@ var InvitationsHandler = class {
1626
1623
  ...protocol.toJSON()
1627
1624
  }, {
1628
1625
  F: __dxlog_file7,
1629
- L: 141,
1626
+ L: 140,
1630
1627
  S: this,
1631
1628
  C: (f, a) => f(...a)
1632
1629
  });
@@ -1638,7 +1635,7 @@ var InvitationsHandler = class {
1638
1635
  id: traceId
1639
1636
  }), {
1640
1637
  F: __dxlog_file7,
1641
- L: 143,
1638
+ L: 142,
1642
1639
  S: this,
1643
1640
  C: (f, a) => f(...a)
1644
1641
  });
@@ -1648,7 +1645,7 @@ var InvitationsHandler = class {
1648
1645
  ...protocol.toJSON()
1649
1646
  }, {
1650
1647
  F: __dxlog_file7,
1651
- L: 146,
1648
+ L: 145,
1652
1649
  S: this,
1653
1650
  C: (f, a) => f(...a)
1654
1651
  });
@@ -1659,7 +1656,7 @@ var InvitationsHandler = class {
1659
1656
  } else {
1660
1657
  log5.error("failed", err, {
1661
1658
  F: __dxlog_file7,
1662
- L: 149,
1659
+ L: 148,
1663
1660
  S: this,
1664
1661
  C: (f, a) => f(...a)
1665
1662
  });
@@ -1670,7 +1667,7 @@ var InvitationsHandler = class {
1670
1667
  error: err
1671
1668
  }), {
1672
1669
  F: __dxlog_file7,
1673
- L: 152,
1670
+ L: 151,
1674
1671
  S: this,
1675
1672
  C: (f, a) => f(...a)
1676
1673
  });
@@ -1691,7 +1688,7 @@ var InvitationsHandler = class {
1691
1688
  ...protocol.toJSON()
1692
1689
  }, {
1693
1690
  F: __dxlog_file7,
1694
- L: 167,
1691
+ L: 166,
1695
1692
  S: this,
1696
1693
  C: (f, a) => f(...a)
1697
1694
  });
@@ -1702,7 +1699,7 @@ var InvitationsHandler = class {
1702
1699
  } else {
1703
1700
  log5.error("failed", err, {
1704
1701
  F: __dxlog_file7,
1705
- L: 170,
1702
+ L: 169,
1706
1703
  S: this,
1707
1704
  C: (f, a) => f(...a)
1708
1705
  });
@@ -1730,7 +1727,7 @@ var InvitationsHandler = class {
1730
1727
  state: Invitation3.State.CONNECTING
1731
1728
  });
1732
1729
  });
1733
- const observable = new CancellableInvitationObservable({
1730
+ const observable = new CancellableInvitation({
1734
1731
  initialInvitation: invitation,
1735
1732
  subscriber: stream.observable,
1736
1733
  onCancel: async () => {
@@ -1747,7 +1744,7 @@ var InvitationsHandler = class {
1747
1744
  const { timeout = INVITATION_TIMEOUT } = invitation;
1748
1745
  invariant6(protocol, void 0, {
1749
1746
  F: __dxlog_file7,
1750
- L: 211,
1747
+ L: 210,
1751
1748
  S: this,
1752
1749
  A: [
1753
1750
  "protocol",
@@ -1761,7 +1758,7 @@ var InvitationsHandler = class {
1761
1758
  const setState = (newData) => {
1762
1759
  invariant6(newData.state !== void 0, void 0, {
1763
1760
  F: __dxlog_file7,
1764
- L: 222,
1761
+ L: 221,
1765
1762
  S: this,
1766
1763
  A: [
1767
1764
  "newData.state !== undefined",
@@ -1781,7 +1778,7 @@ var InvitationsHandler = class {
1781
1778
  ...protocol.toJSON()
1782
1779
  }, {
1783
1780
  F: __dxlog_file7,
1784
- L: 230,
1781
+ L: 229,
1785
1782
  S: this,
1786
1783
  C: (f, a) => f(...a)
1787
1784
  });
@@ -1791,7 +1788,7 @@ var InvitationsHandler = class {
1791
1788
  } else {
1792
1789
  log5.warn("auth failed", err, {
1793
1790
  F: __dxlog_file7,
1794
- L: 233,
1791
+ L: 232,
1795
1792
  S: this,
1796
1793
  C: (f, a) => f(...a)
1797
1794
  });
@@ -1805,7 +1802,7 @@ var InvitationsHandler = class {
1805
1802
  ...protocol.toJSON()
1806
1803
  }, {
1807
1804
  F: __dxlog_file7,
1808
- L: 241,
1805
+ L: 240,
1809
1806
  S: this,
1810
1807
  C: (f, a) => f(...a)
1811
1808
  });
@@ -1820,7 +1817,7 @@ var InvitationsHandler = class {
1820
1817
  currentState
1821
1818
  }, {
1822
1819
  F: __dxlog_file7,
1823
- L: 251,
1820
+ L: 250,
1824
1821
  S: this,
1825
1822
  C: (f, a) => f(...a)
1826
1823
  });
@@ -1835,7 +1832,7 @@ var InvitationsHandler = class {
1835
1832
  id: traceId
1836
1833
  }), {
1837
1834
  F: __dxlog_file7,
1838
- L: 260,
1835
+ L: 259,
1839
1836
  S: this,
1840
1837
  C: (f, a) => f(...a)
1841
1838
  });
@@ -1847,7 +1844,7 @@ var InvitationsHandler = class {
1847
1844
  ...protocol.toJSON()
1848
1845
  }, {
1849
1846
  F: __dxlog_file7,
1850
- L: 268,
1847
+ L: 267,
1851
1848
  S: this,
1852
1849
  C: (f, a) => f(...a)
1853
1850
  });
@@ -1858,7 +1855,7 @@ var InvitationsHandler = class {
1858
1855
  ...protocol.toJSON()
1859
1856
  }, {
1860
1857
  F: __dxlog_file7,
1861
- L: 272,
1858
+ L: 271,
1862
1859
  S: this,
1863
1860
  C: (f, a) => f(...a)
1864
1861
  });
@@ -1868,7 +1865,7 @@ var InvitationsHandler = class {
1868
1865
  response: introductionResponse
1869
1866
  }, {
1870
1867
  F: __dxlog_file7,
1871
- L: 276,
1868
+ L: 275,
1872
1869
  S: this,
1873
1870
  C: (f, a) => f(...a)
1874
1871
  });
@@ -1880,7 +1877,7 @@ var InvitationsHandler = class {
1880
1877
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1881
1878
  log5("guest waiting for authentication code...", void 0, {
1882
1879
  F: __dxlog_file7,
1883
- L: 285,
1880
+ L: 284,
1884
1881
  S: this,
1885
1882
  C: (f, a) => f(...a)
1886
1883
  });
@@ -1892,7 +1889,7 @@ var InvitationsHandler = class {
1892
1889
  });
1893
1890
  log5("sending authentication request", void 0, {
1894
1891
  F: __dxlog_file7,
1895
- L: 289,
1892
+ L: 288,
1896
1893
  S: this,
1897
1894
  C: (f, a) => f(...a)
1898
1895
  });
@@ -1913,7 +1910,7 @@ var InvitationsHandler = class {
1913
1910
  attempt
1914
1911
  }, {
1915
1912
  F: __dxlog_file7,
1916
- L: 300,
1913
+ L: 299,
1917
1914
  S: this,
1918
1915
  C: (f, a) => f(...a)
1919
1916
  });
@@ -1930,7 +1927,7 @@ var InvitationsHandler = class {
1930
1927
  ...protocol.toJSON()
1931
1928
  }, {
1932
1929
  F: __dxlog_file7,
1933
- L: 311,
1930
+ L: 310,
1934
1931
  S: this,
1935
1932
  C: (f, a) => f(...a)
1936
1933
  });
@@ -1942,7 +1939,7 @@ var InvitationsHandler = class {
1942
1939
  ...protocol.toJSON()
1943
1940
  }, {
1944
1941
  F: __dxlog_file7,
1945
- L: 322,
1942
+ L: 321,
1946
1943
  S: this,
1947
1944
  C: (f, a) => f(...a)
1948
1945
  });
@@ -1954,7 +1951,7 @@ var InvitationsHandler = class {
1954
1951
  id: traceId
1955
1952
  }), {
1956
1953
  F: __dxlog_file7,
1957
- L: 324,
1954
+ L: 323,
1958
1955
  S: this,
1959
1956
  C: (f, a) => f(...a)
1960
1957
  });
@@ -1964,7 +1961,7 @@ var InvitationsHandler = class {
1964
1961
  ...protocol.toJSON()
1965
1962
  }, {
1966
1963
  F: __dxlog_file7,
1967
- L: 327,
1964
+ L: 326,
1968
1965
  S: this,
1969
1966
  C: (f, a) => f(...a)
1970
1967
  });
@@ -1974,7 +1971,7 @@ var InvitationsHandler = class {
1974
1971
  } else {
1975
1972
  log5("auth failed", err, {
1976
1973
  F: __dxlog_file7,
1977
- L: 330,
1974
+ L: 329,
1978
1975
  S: this,
1979
1976
  C: (f, a) => f(...a)
1980
1977
  });
@@ -1985,7 +1982,7 @@ var InvitationsHandler = class {
1985
1982
  error: err
1986
1983
  }), {
1987
1984
  F: __dxlog_file7,
1988
- L: 333,
1985
+ L: 332,
1989
1986
  S: this,
1990
1987
  C: (f, a) => f(...a)
1991
1988
  });
@@ -2003,7 +2000,7 @@ var InvitationsHandler = class {
2003
2000
  ...protocol.toJSON()
2004
2001
  }, {
2005
2002
  F: __dxlog_file7,
2006
- L: 344,
2003
+ L: 343,
2007
2004
  S: this,
2008
2005
  C: (f, a) => f(...a)
2009
2006
  });
@@ -2013,7 +2010,7 @@ var InvitationsHandler = class {
2013
2010
  } else {
2014
2011
  log5("auth failed", err, {
2015
2012
  F: __dxlog_file7,
2016
- L: 347,
2013
+ L: 346,
2017
2014
  S: this,
2018
2015
  C: (f, a) => f(...a)
2019
2016
  });
@@ -2026,7 +2023,7 @@ var InvitationsHandler = class {
2026
2023
  scheduleTask2(ctx, async () => {
2027
2024
  invariant6(invitation.swarmKey, void 0, {
2028
2025
  F: __dxlog_file7,
2029
- L: 357,
2026
+ L: 356,
2030
2027
  S: this,
2031
2028
  A: [
2032
2029
  "invitation.swarmKey",
@@ -2048,7 +2045,7 @@ var InvitationsHandler = class {
2048
2045
  state: Invitation3.State.CONNECTING
2049
2046
  });
2050
2047
  });
2051
- const observable = new AuthenticatingInvitationObservable({
2048
+ const observable = new AuthenticatingInvitation({
2052
2049
  initialInvitation: invitation,
2053
2050
  subscriber: stream.observable,
2054
2051
  onCancel: async () => {
@@ -2472,9 +2469,6 @@ import { log as log8 } from "@dxos/log";
2472
2469
  import { STORAGE_VERSION } from "@dxos/protocols";
2473
2470
  import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
2474
2471
 
2475
- // packages/sdk/client-services/src/version.ts
2476
- var DXOS_VERSION = "0.1.58-next.3349da8";
2477
-
2478
2472
  // packages/sdk/client-services/src/packlets/services/platform.ts
2479
2473
  var getPlatform = () => {
2480
2474
  if (process.browser) {
@@ -2503,6 +2497,9 @@ var getPlatform = () => {
2503
2497
  }
2504
2498
  };
2505
2499
 
2500
+ // packages/sdk/client-services/src/version.ts
2501
+ var DXOS_VERSION = "0.1.58-next.6d0af18";
2502
+
2506
2503
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2507
2504
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2508
2505
  var DEFAULT_TIMEOUT = 1e3;
@@ -2627,9 +2624,9 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
2627
2624
  import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
2628
2625
  import { timed } from "@dxos/debug";
2629
2626
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2630
- import { CancelledError, SystemError } from "@dxos/errors";
2631
2627
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2632
2628
  import { log as log10 } from "@dxos/log";
2629
+ import { CancelledError, SystemError } from "@dxos/protocols";
2633
2630
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
2634
2631
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
2635
2632
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
@@ -2938,7 +2935,7 @@ var DataSpace = class DataSpace2 {
2938
2935
  this._signingContext = params.signingContext;
2939
2936
  this._callbacks = params.callbacks ?? {};
2940
2937
  this.authVerifier = new TrustedKeySetAuthVerifier({
2941
- trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.keys())),
2938
+ trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2942
2939
  update: this._inner.stateUpdate,
2943
2940
  authTimeout: AUTH_TIMEOUT2
2944
2941
  });
@@ -2948,7 +2945,7 @@ var DataSpace = class DataSpace2 {
2948
2945
  state: SpaceState[this._state]
2949
2946
  }, {
2950
2947
  F: __dxlog_file12,
2951
- L: 112,
2948
+ L: 118,
2952
2949
  S: this,
2953
2950
  C: (f, a) => f(...a)
2954
2951
  });
@@ -2991,7 +2988,7 @@ var DataSpace = class DataSpace2 {
2991
2988
  state: SpaceState[this._state]
2992
2989
  }, {
2993
2990
  F: __dxlog_file12,
2994
- L: 159,
2991
+ L: 165,
2995
2992
  S: this,
2996
2993
  C: (f, a) => f(...a)
2997
2994
  });
@@ -3009,7 +3006,7 @@ var DataSpace = class DataSpace2 {
3009
3006
  state: SpaceState[this._state]
3010
3007
  }, {
3011
3008
  F: __dxlog_file12,
3012
- L: 173,
3009
+ L: 179,
3013
3010
  S: this,
3014
3011
  C: (f, a) => f(...a)
3015
3012
  });
@@ -3040,7 +3037,7 @@ var DataSpace = class DataSpace2 {
3040
3037
  if (err instanceof CancelledError) {
3041
3038
  log10("data pipeline initialization cancelled", err, {
3042
3039
  F: __dxlog_file12,
3043
- L: 205,
3040
+ L: 211,
3044
3041
  S: this,
3045
3042
  C: (f, a) => f(...a)
3046
3043
  });
@@ -3048,7 +3045,7 @@ var DataSpace = class DataSpace2 {
3048
3045
  }
3049
3046
  log10.error("Error initializing data pipeline", err, {
3050
3047
  F: __dxlog_file12,
3051
- L: 209,
3048
+ L: 215,
3052
3049
  S: this,
3053
3050
  C: (f, a) => f(...a)
3054
3051
  });
@@ -3057,7 +3054,7 @@ var DataSpace = class DataSpace2 {
3057
3054
  state: SpaceState[this._state]
3058
3055
  }, {
3059
3056
  F: __dxlog_file12,
3060
- L: 211,
3057
+ L: 217,
3061
3058
  S: this,
3062
3059
  C: (f, a) => f(...a)
3063
3060
  });
@@ -3077,7 +3074,7 @@ var DataSpace = class DataSpace2 {
3077
3074
  state: SpaceState[this._state]
3078
3075
  }, {
3079
3076
  F: __dxlog_file12,
3080
- L: 227,
3077
+ L: 233,
3081
3078
  S: this,
3082
3079
  C: (f, a) => f(...a)
3083
3080
  });
@@ -3088,7 +3085,7 @@ var DataSpace = class DataSpace2 {
3088
3085
  await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3089
3086
  log10("waiting for data pipeline to reach target timeframe", void 0, {
3090
3087
  F: __dxlog_file12,
3091
- L: 241,
3088
+ L: 247,
3092
3089
  S: this,
3093
3090
  C: (f, a) => f(...a)
3094
3091
  });
@@ -3099,7 +3096,7 @@ var DataSpace = class DataSpace2 {
3099
3096
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3100
3097
  log10("data pipeline ready", void 0, {
3101
3098
  F: __dxlog_file12,
3102
- L: 250,
3099
+ L: 256,
3103
3100
  S: this,
3104
3101
  C: (f, a) => f(...a)
3105
3102
  });
@@ -3109,7 +3106,7 @@ var DataSpace = class DataSpace2 {
3109
3106
  state: SpaceState[this._state]
3110
3107
  }, {
3111
3108
  F: __dxlog_file12,
3112
- L: 254,
3109
+ L: 260,
3113
3110
  S: this,
3114
3111
  C: (f, a) => f(...a)
3115
3112
  });
@@ -3125,7 +3122,7 @@ var DataSpace = class DataSpace2 {
3125
3122
  await this._createWritableFeeds();
3126
3123
  log10("writable feeds created", void 0, {
3127
3124
  F: __dxlog_file12,
3128
- L: 270,
3125
+ L: 276,
3129
3126
  S: this,
3130
3127
  C: (f, a) => f(...a)
3131
3128
  });
@@ -3230,7 +3227,7 @@ var DataSpace = class DataSpace2 {
3230
3227
  state: SpaceState[this._state]
3231
3228
  }, {
3232
3229
  F: __dxlog_file12,
3233
- L: 386,
3230
+ L: 392,
3234
3231
  S: this,
3235
3232
  C: (f, a) => f(...a)
3236
3233
  });
@@ -3684,10 +3681,9 @@ DataSpaceManager = _ts_decorate4([
3684
3681
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
3685
3682
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
3686
3683
  import { raise as raise2 } from "@dxos/debug";
3687
- import { SpaceNotFoundError } from "@dxos/echo-pipeline";
3688
- import { ApiError } from "@dxos/errors";
3684
+ import { invariant as invariant12 } from "@dxos/invariant";
3689
3685
  import { log as log12 } from "@dxos/log";
3690
- import { encodeError } from "@dxos/protocols";
3686
+ import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
3691
3687
  import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
3692
3688
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3693
3689
  var SpacesServiceImpl = class {
@@ -3750,7 +3746,7 @@ var SpacesServiceImpl = class {
3750
3746
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3751
3747
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3752
3748
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3753
- space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
3749
+ subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3754
3750
  if (space.dataPipeline.pipelineState) {
3755
3751
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3756
3752
  }
@@ -3787,8 +3783,8 @@ var SpacesServiceImpl = class {
3787
3783
  });
3788
3784
  });
3789
3785
  }
3790
- queryCredentials({ spaceKey }) {
3791
- return new Stream10(({ ctx, next }) => {
3786
+ queryCredentials({ spaceKey, noTail }) {
3787
+ return new Stream10(({ ctx, next, close }) => {
3792
3788
  const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
3793
3789
  const processor = {
3794
3790
  processCredential: async (credential) => {
@@ -3796,17 +3792,62 @@ var SpacesServiceImpl = class {
3796
3792
  }
3797
3793
  };
3798
3794
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3799
- scheduleTask5(ctx, () => space.spaceState.addCredentialProcessor(processor));
3795
+ scheduleTask5(ctx, async () => {
3796
+ await space.spaceState.addCredentialProcessor(processor);
3797
+ if (noTail) {
3798
+ close();
3799
+ }
3800
+ });
3800
3801
  });
3801
3802
  }
3802
3803
  async writeCredentials({ spaceKey, credentials }) {
3803
3804
  const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
3804
3805
  for (const credential of credentials ?? []) {
3805
- await space.controlPipeline.writer.write({
3806
- credential: {
3807
- credential
3808
- }
3809
- });
3806
+ if (credential.proof) {
3807
+ await space.controlPipeline.writer.write({
3808
+ credential: {
3809
+ credential
3810
+ }
3811
+ });
3812
+ } else {
3813
+ invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
3814
+ F: __dxlog_file14,
3815
+ L: 168,
3816
+ S: this,
3817
+ A: [
3818
+ "!credential.id",
3819
+ "'Id on unsigned credentials is not allowed'"
3820
+ ]
3821
+ });
3822
+ invariant12(this._identityManager.identity, "Identity is not available", {
3823
+ F: __dxlog_file14,
3824
+ L: 169,
3825
+ S: this,
3826
+ A: [
3827
+ "this._identityManager.identity",
3828
+ "'Identity is not available'"
3829
+ ]
3830
+ });
3831
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3832
+ invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
3833
+ F: __dxlog_file14,
3834
+ L: 171,
3835
+ S: this,
3836
+ A: [
3837
+ "credential.issuer.equals(signer.getIssuer())",
3838
+ ""
3839
+ ]
3840
+ });
3841
+ const signedCredential = await signer.createCredential({
3842
+ subject: credential.subject.id,
3843
+ assertion: credential.subject.assertion
3844
+ });
3845
+ await space.controlPipeline.writer.write({
3846
+ credential: {
3847
+ credential: signedCredential
3848
+ }
3849
+ });
3850
+ }
3810
3851
  }
3811
3852
  }
3812
3853
  async createEpoch({ spaceKey }) {
@@ -3845,7 +3886,7 @@ var SpacesServiceImpl = class {
3845
3886
  displayName: member.assertion.profile?.displayName
3846
3887
  }
3847
3888
  },
3848
- presence: isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
3889
+ presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
3849
3890
  peerStates: peers
3850
3891
  };
3851
3892
  }),
@@ -3864,11 +3905,11 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
3864
3905
  import { failUndefined as failUndefined3 } from "@dxos/debug";
3865
3906
  import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
3866
3907
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
3867
- import { invariant as invariant12 } from "@dxos/invariant";
3908
+ import { invariant as invariant13 } from "@dxos/invariant";
3868
3909
  import { Keyring } from "@dxos/keyring";
3869
3910
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3870
3911
  import { log as log13 } from "@dxos/log";
3871
- import { STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3912
+ import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3872
3913
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
3873
3914
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
3874
3915
  import { trace as Trace2 } from "@dxos/tracing";
@@ -3885,7 +3926,6 @@ function _ts_decorate5(decorators, target, key, desc) {
3885
3926
  }
3886
3927
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3887
3928
  var ServiceContext = class ServiceContext2 {
3888
- // prettier-ignore
3889
3929
  constructor(storage, networkManager, signalManager, modelFactory) {
3890
3930
  this.storage = storage;
3891
3931
  this.networkManager = networkManager;
@@ -3925,7 +3965,7 @@ var ServiceContext = class ServiceContext2 {
3925
3965
  await this._checkStorageVersion();
3926
3966
  log13("opening...", void 0, {
3927
3967
  F: __dxlog_file15,
3928
- L: 135,
3968
+ L: 129,
3929
3969
  S: this,
3930
3970
  C: (f, a) => f(...a)
3931
3971
  });
@@ -3933,7 +3973,7 @@ var ServiceContext = class ServiceContext2 {
3933
3973
  id: this._instanceId
3934
3974
  }), {
3935
3975
  F: __dxlog_file15,
3936
- L: 136,
3976
+ L: 130,
3937
3977
  S: this,
3938
3978
  C: (f, a) => f(...a)
3939
3979
  });
@@ -3949,13 +3989,13 @@ var ServiceContext = class ServiceContext2 {
3949
3989
  id: this._instanceId
3950
3990
  }), {
3951
3991
  F: __dxlog_file15,
3952
- L: 146,
3992
+ L: 140,
3953
3993
  S: this,
3954
3994
  C: (f, a) => f(...a)
3955
3995
  });
3956
3996
  log13("opened", void 0, {
3957
3997
  F: __dxlog_file15,
3958
- L: 147,
3998
+ L: 141,
3959
3999
  S: this,
3960
4000
  C: (f, a) => f(...a)
3961
4001
  });
@@ -3963,7 +4003,7 @@ var ServiceContext = class ServiceContext2 {
3963
4003
  async close() {
3964
4004
  log13("closing...", void 0, {
3965
4005
  F: __dxlog_file15,
3966
- L: 151,
4006
+ L: 145,
3967
4007
  S: this,
3968
4008
  C: (f, a) => f(...a)
3969
4009
  });
@@ -3980,7 +4020,7 @@ var ServiceContext = class ServiceContext2 {
3980
4020
  await this.metadataStore.close();
3981
4021
  log13("closed", void 0, {
3982
4022
  F: __dxlog_file15,
3983
- L: 163,
4023
+ L: 157,
3984
4024
  S: this,
3985
4025
  C: (f, a) => f(...a)
3986
4026
  });
@@ -3992,9 +4032,9 @@ var ServiceContext = class ServiceContext2 {
3992
4032
  }
3993
4033
  getInvitationHandler(invitation) {
3994
4034
  const factory = this._handlerFactories.get(invitation.kind);
3995
- invariant12(factory, `Unknown invitation kind: ${invitation.kind}`, {
4035
+ invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
3996
4036
  F: __dxlog_file15,
3997
- L: 174,
4037
+ L: 168,
3998
4038
  S: this,
3999
4039
  A: [
4000
4040
  "factory",
@@ -4011,14 +4051,14 @@ var ServiceContext = class ServiceContext2 {
4011
4051
  async _checkStorageVersion() {
4012
4052
  await this.metadataStore.load();
4013
4053
  if (this.metadataStore.version !== STORAGE_VERSION2) {
4014
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${STORAGE_VERSION2}`);
4054
+ throw new InvalidStorageVersionError(STORAGE_VERSION2, this.metadataStore.version);
4015
4055
  }
4016
4056
  }
4017
4057
  // Called when identity is created.
4018
4058
  async _initialize(ctx) {
4019
4059
  log13("initializing spaces...", void 0, {
4020
4060
  F: __dxlog_file15,
4021
- L: 195,
4061
+ L: 189,
4022
4062
  S: this,
4023
4063
  C: (f, a) => f(...a)
4024
4064
  });
@@ -4039,9 +4079,9 @@ var ServiceContext = class ServiceContext2 {
4039
4079
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
4040
4080
  await this.dataSpaceManager.open();
4041
4081
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4042
- invariant12(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4082
+ invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4043
4083
  F: __dxlog_file15,
4044
- L: 218,
4084
+ L: 212,
4045
4085
  S: this,
4046
4086
  A: [
4047
4087
  "this.dataSpaceManager",
@@ -4065,7 +4105,7 @@ var ServiceContext = class ServiceContext2 {
4065
4105
  details: assertion
4066
4106
  }, {
4067
4107
  F: __dxlog_file15,
4068
- L: 234,
4108
+ L: 228,
4069
4109
  S: this,
4070
4110
  C: (f, a) => f(...a)
4071
4111
  });
@@ -4076,7 +4116,7 @@ var ServiceContext = class ServiceContext2 {
4076
4116
  details: assertion
4077
4117
  }, {
4078
4118
  F: __dxlog_file15,
4079
- L: 238,
4119
+ L: 232,
4080
4120
  S: this,
4081
4121
  C: (f, a) => f(...a)
4082
4122
  });
@@ -4087,7 +4127,7 @@ var ServiceContext = class ServiceContext2 {
4087
4127
  details: assertion
4088
4128
  }, {
4089
4129
  F: __dxlog_file15,
4090
- L: 243,
4130
+ L: 237,
4091
4131
  S: this,
4092
4132
  C: (f, a) => f(...a)
4093
4133
  });
@@ -4098,7 +4138,7 @@ var ServiceContext = class ServiceContext2 {
4098
4138
  } catch (err) {
4099
4139
  log13.catch(err, void 0, {
4100
4140
  F: __dxlog_file15,
4101
- L: 249,
4141
+ L: 243,
4102
4142
  S: this,
4103
4143
  C: (f, a) => f(...a)
4104
4144
  });
@@ -4119,6 +4159,30 @@ ServiceContext = _ts_decorate5([
4119
4159
  Trace2.resource()
4120
4160
  ], ServiceContext);
4121
4161
 
4162
+ // packages/sdk/client-services/src/packlets/services/service-registry.ts
4163
+ var ServiceRegistry = class {
4164
+ // prettier-ignore
4165
+ constructor(_serviceBundle, _handlers = {}) {
4166
+ this._serviceBundle = _serviceBundle;
4167
+ this._handlers = _handlers;
4168
+ }
4169
+ get descriptors() {
4170
+ return this._serviceBundle;
4171
+ }
4172
+ get services() {
4173
+ return this._handlers;
4174
+ }
4175
+ setServices(services) {
4176
+ this._handlers = services;
4177
+ }
4178
+ addService(name, service) {
4179
+ this._handlers[name] = service;
4180
+ }
4181
+ removeService(name) {
4182
+ delete this._handlers[name];
4183
+ }
4184
+ };
4185
+
4122
4186
  // packages/sdk/client-services/src/packlets/locks/browser.ts
4123
4187
  import { asyncTimeout, Trigger as Trigger6 } from "@dxos/async";
4124
4188
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
@@ -4245,29 +4309,29 @@ var isLocked = (lockPath) => {
4245
4309
 
4246
4310
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4247
4311
  import { DX_DATA } from "@dxos/client-protocol";
4248
- import { InvalidConfigError } from "@dxos/errors";
4312
+ import { InvalidConfigError } from "@dxos/protocols";
4249
4313
  import { Runtime } from "@dxos/protocols/proto/dxos/config";
4250
4314
  import { createStorage, StorageType } from "@dxos/random-access-storage";
4251
4315
  import { isNode } from "@dxos/util";
4252
4316
  var StorageDriver = Runtime.Client.Storage.StorageDriver;
4253
4317
  var createStorageObjects = (config) => {
4254
- const { path = isNode() ? DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4255
- if (persistent && storageType === StorageDriver.RAM) {
4318
+ const { persistent = false, keyStore, dataStore, dataRoot = isNode() ? DX_DATA : "dxos/storage" } = config ?? {};
4319
+ if (persistent && dataStore === StorageDriver.RAM) {
4256
4320
  throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
4257
4321
  }
4258
- if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4322
+ if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
4259
4323
  throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4260
4324
  }
4261
- if (persistent && keyStorage === StorageDriver.RAM) {
4325
+ if (persistent && keyStore === StorageDriver.RAM) {
4262
4326
  throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4263
4327
  }
4264
- if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4328
+ if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
4265
4329
  throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4266
4330
  }
4267
4331
  return {
4268
4332
  storage: createStorage({
4269
- type: persistent ? toStorageType(storageType) : StorageType.RAM,
4270
- root: `${path}/`
4333
+ type: persistent ? toStorageType(dataStore) : StorageType.RAM,
4334
+ root: `${dataRoot}/`
4271
4335
  })
4272
4336
  };
4273
4337
  };
@@ -4292,37 +4356,14 @@ var toStorageType = (type) => {
4292
4356
  }
4293
4357
  };
4294
4358
 
4295
- // packages/sdk/client-services/src/packlets/services/service-registry.ts
4296
- var ServiceRegistry = class {
4297
- // prettier-ignore
4298
- constructor(_serviceBundle, _handlers = {}) {
4299
- this._serviceBundle = _serviceBundle;
4300
- this._handlers = _handlers;
4301
- }
4302
- get descriptors() {
4303
- return this._serviceBundle;
4304
- }
4305
- get services() {
4306
- return this._handlers;
4307
- }
4308
- setServices(services) {
4309
- this._handlers = services;
4310
- }
4311
- addService(name, service) {
4312
- this._handlers[name] = service;
4313
- }
4314
- removeService(name) {
4315
- delete this._handlers[name];
4316
- }
4317
- };
4318
-
4319
4359
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4320
4360
  import { Event as Event8, synchronized as synchronized3 } from "@dxos/async";
4321
- import { clientServiceBundle } from "@dxos/client-protocol";
4361
+ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4322
4362
  import { Context as Context10 } from "@dxos/context";
4323
4363
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4324
4364
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4325
- import { invariant as invariant13 } from "@dxos/invariant";
4365
+ import { base } from "@dxos/echo-schema";
4366
+ import { invariant as invariant14 } from "@dxos/invariant";
4326
4367
  import { PublicKey as PublicKey10 } from "@dxos/keys";
4327
4368
  import { log as log16 } from "@dxos/log";
4328
4369
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4595,6 +4636,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4595
4636
  var createDefaultModelFactory = () => {
4596
4637
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4597
4638
  };
4639
+ var createGenesisMutationFromTypedObject = (obj) => {
4640
+ const snapshot = obj[base]._createSnapshot();
4641
+ return {
4642
+ objectId: obj[base]._id,
4643
+ genesis: {
4644
+ modelType: obj[base]._modelConstructor.meta.type
4645
+ },
4646
+ snapshot: {
4647
+ model: snapshot
4648
+ }
4649
+ };
4650
+ };
4598
4651
  var ClientServicesHost = class ClientServicesHost2 {
4599
4652
  constructor({
4600
4653
  config,
@@ -4679,9 +4732,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4679
4732
  * Can only be called once.
4680
4733
  */
4681
4734
  initialize({ config, ...options }) {
4682
- invariant13(!this._open, "service host is open", {
4735
+ invariant14(!this._open, "service host is open", {
4683
4736
  F: __dxlog_file17,
4684
- L: 184,
4737
+ L: 201,
4685
4738
  S: this,
4686
4739
  A: [
4687
4740
  "!this._open",
@@ -4690,14 +4743,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4690
4743
  });
4691
4744
  log16("initializing...", void 0, {
4692
4745
  F: __dxlog_file17,
4693
- L: 185,
4746
+ L: 202,
4694
4747
  S: this,
4695
4748
  C: (f, a) => f(...a)
4696
4749
  });
4697
4750
  if (config) {
4698
- invariant13(!this._config, "config already set", {
4751
+ invariant14(!this._config, "config already set", {
4699
4752
  F: __dxlog_file17,
4700
- L: 188,
4753
+ L: 205,
4701
4754
  S: this,
4702
4755
  A: [
4703
4756
  "!this._config",
@@ -4713,9 +4766,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4713
4766
  iceServers: this._config?.get("runtime.services.ice")
4714
4767
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4715
4768
  this._signalManager = signalManager;
4716
- invariant13(!this._networkManager, "network manager already set", {
4769
+ invariant14(!this._networkManager, "network manager already set", {
4717
4770
  F: __dxlog_file17,
4718
- L: 204,
4771
+ L: 221,
4719
4772
  S: this,
4720
4773
  A: [
4721
4774
  "!this._networkManager",
@@ -4729,7 +4782,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4729
4782
  });
4730
4783
  log16("initialized", void 0, {
4731
4784
  F: __dxlog_file17,
4732
- L: 211,
4785
+ L: 228,
4733
4786
  S: this,
4734
4787
  C: (f, a) => f(...a)
4735
4788
  });
@@ -4743,40 +4796,40 @@ var ClientServicesHost = class ClientServicesHost2 {
4743
4796
  id: traceId
4744
4797
  }), {
4745
4798
  F: __dxlog_file17,
4746
- L: 222,
4799
+ L: 239,
4747
4800
  S: this,
4748
4801
  C: (f, a) => f(...a)
4749
4802
  });
4750
- invariant13(this._config, "config not set", {
4803
+ invariant14(this._config, "config not set", {
4751
4804
  F: __dxlog_file17,
4752
- L: 224,
4805
+ L: 241,
4753
4806
  S: this,
4754
4807
  A: [
4755
4808
  "this._config",
4756
4809
  "'config not set'"
4757
4810
  ]
4758
4811
  });
4759
- invariant13(this._storage, "storage not set", {
4812
+ invariant14(this._storage, "storage not set", {
4760
4813
  F: __dxlog_file17,
4761
- L: 225,
4814
+ L: 242,
4762
4815
  S: this,
4763
4816
  A: [
4764
4817
  "this._storage",
4765
4818
  "'storage not set'"
4766
4819
  ]
4767
4820
  });
4768
- invariant13(this._signalManager, "signal manager not set", {
4821
+ invariant14(this._signalManager, "signal manager not set", {
4769
4822
  F: __dxlog_file17,
4770
- L: 226,
4823
+ L: 243,
4771
4824
  S: this,
4772
4825
  A: [
4773
4826
  "this._signalManager",
4774
4827
  "'signal manager not set'"
4775
4828
  ]
4776
4829
  });
4777
- invariant13(this._networkManager, "network manager not set", {
4830
+ invariant14(this._networkManager, "network manager not set", {
4778
4831
  F: __dxlog_file17,
4779
- L: 227,
4832
+ L: 244,
4780
4833
  S: this,
4781
4834
  A: [
4782
4835
  "this._networkManager",
@@ -4788,7 +4841,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4788
4841
  lockKey: this._resourceLock?.lockKey
4789
4842
  }, {
4790
4843
  F: __dxlog_file17,
4791
- L: 230,
4844
+ L: 247,
4792
4845
  S: this,
4793
4846
  C: (f, a) => f(...a)
4794
4847
  });
@@ -4797,7 +4850,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4797
4850
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4798
4851
  this._serviceRegistry.setServices({
4799
4852
  SystemService: this._systemService,
4800
- IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4853
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4801
4854
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4802
4855
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4803
4856
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -4834,7 +4887,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4834
4887
  deviceKey
4835
4888
  }, {
4836
4889
  F: __dxlog_file17,
4837
- L: 299,
4890
+ L: 316,
4838
4891
  S: this,
4839
4892
  C: (f, a) => f(...a)
4840
4893
  });
@@ -4842,7 +4895,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4842
4895
  id: traceId
4843
4896
  }), {
4844
4897
  F: __dxlog_file17,
4845
- L: 300,
4898
+ L: 317,
4846
4899
  S: this,
4847
4900
  C: (f, a) => f(...a)
4848
4901
  });
@@ -4856,7 +4909,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4856
4909
  deviceKey
4857
4910
  }, {
4858
4911
  F: __dxlog_file17,
4859
- L: 311,
4912
+ L: 328,
4860
4913
  S: this,
4861
4914
  C: (f, a) => f(...a)
4862
4915
  });
@@ -4872,7 +4925,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4872
4925
  deviceKey
4873
4926
  }, {
4874
4927
  F: __dxlog_file17,
4875
- L: 318,
4928
+ L: 335,
4876
4929
  S: this,
4877
4930
  C: (f, a) => f(...a)
4878
4931
  });
@@ -4883,13 +4936,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4883
4936
  id: traceId
4884
4937
  }), {
4885
4938
  F: __dxlog_file17,
4886
- L: 323,
4939
+ L: 340,
4887
4940
  S: this,
4888
4941
  C: (f, a) => f(...a)
4889
4942
  });
4890
4943
  log16("resetting...", void 0, {
4891
4944
  F: __dxlog_file17,
4892
- L: 325,
4945
+ L: 342,
4893
4946
  S: this,
4894
4947
  C: (f, a) => f(...a)
4895
4948
  });
@@ -4897,7 +4950,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4897
4950
  await this._storage.reset();
4898
4951
  log16("reset", void 0, {
4899
4952
  F: __dxlog_file17,
4900
- L: 328,
4953
+ L: 345,
4901
4954
  S: this,
4902
4955
  C: (f, a) => f(...a)
4903
4956
  });
@@ -4905,12 +4958,31 @@ var ClientServicesHost = class ClientServicesHost2 {
4905
4958
  id: traceId
4906
4959
  }), {
4907
4960
  F: __dxlog_file17,
4908
- L: 329,
4961
+ L: 346,
4909
4962
  S: this,
4910
4963
  C: (f, a) => f(...a)
4911
4964
  });
4912
4965
  await this._callbacks?.onReset?.();
4913
4966
  }
4967
+ async _createIdentity(params) {
4968
+ const identity = await this._serviceContext.createIdentity(params);
4969
+ await this._serviceContext.initialized.wait();
4970
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
4971
+ const obj = new Properties();
4972
+ obj[defaultKey] = identity.identityKey.toHex();
4973
+ await this._serviceRegistry.services.DataService.write({
4974
+ spaceKey: space.key,
4975
+ batch: {
4976
+ objects: [
4977
+ createGenesisMutationFromTypedObject(obj)
4978
+ ]
4979
+ }
4980
+ });
4981
+ await this._serviceRegistry.services.DataService.flush({
4982
+ spaceKey: space.key
4983
+ });
4984
+ return identity;
4985
+ }
4914
4986
  };
4915
4987
  _ts_decorate7([
4916
4988
  Trace3.info()
@@ -4956,11 +5028,11 @@ export {
4956
5028
  DataSpaceManager,
4957
5029
  SpacesServiceImpl,
4958
5030
  ServiceContext,
5031
+ ServiceRegistry,
4959
5032
  Lock,
4960
5033
  isLocked,
4961
5034
  createStorageObjects,
4962
- ServiceRegistry,
4963
5035
  createDefaultModelFactory,
4964
5036
  ClientServicesHost
4965
5037
  };
4966
- //# sourceMappingURL=chunk-ARM2DYUZ.mjs.map
5038
+ //# sourceMappingURL=chunk-DJ4JCFP7.mjs.map