@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
@@ -52,7 +52,7 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
52
52
 
53
53
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
54
54
  var import_async18 = require("@dxos/async");
55
- var import_invariant15 = require("@dxos/invariant");
55
+ var import_invariant16 = require("@dxos/invariant");
56
56
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
57
57
 
58
58
  // packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
@@ -71,7 +71,7 @@ var import_protocols = require("@dxos/protocols");
71
71
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
72
72
 
73
73
  // packages/sdk/client-services/src/version.ts
74
- var DXOS_VERSION = "0.1.58-main.f117c08";
74
+ var DXOS_VERSION = "0.1.58-main.f5feb2a";
75
75
 
76
76
  // packages/sdk/client-services/src/packlets/services/platform.ts
77
77
  var getPlatform = () => {
@@ -224,13 +224,13 @@ var import_async11 = require("@dxos/async");
224
224
  var import_context8 = require("@dxos/context");
225
225
  var import_credentials15 = require("@dxos/credentials");
226
226
  var import_debug7 = require("@dxos/debug");
227
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
227
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
228
228
  var import_feed_store3 = require("@dxos/feed-store");
229
- var import_invariant12 = require("@dxos/invariant");
229
+ var import_invariant13 = require("@dxos/invariant");
230
230
  var import_keyring = require("@dxos/keyring");
231
231
  var import_keys8 = require("@dxos/keys");
232
232
  var import_log13 = require("@dxos/log");
233
- var import_protocols9 = require("@dxos/protocols");
233
+ var import_protocols10 = require("@dxos/protocols");
234
234
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
235
235
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
236
236
  var import_tracing4 = require("@dxos/tracing");
@@ -1059,7 +1059,6 @@ var import_async5 = require("@dxos/async");
1059
1059
  var import_client_protocol2 = require("@dxos/client-protocol");
1060
1060
  var import_context4 = require("@dxos/context");
1061
1061
  var import_credentials9 = require("@dxos/credentials");
1062
- var import_errors2 = require("@dxos/errors");
1063
1062
  var import_invariant7 = require("@dxos/invariant");
1064
1063
  var import_keys4 = require("@dxos/keys");
1065
1064
  var import_log6 = require("@dxos/log");
@@ -1071,7 +1070,6 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1071
1070
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1072
1071
  var import_async4 = require("@dxos/async");
1073
1072
  var import_context3 = require("@dxos/context");
1074
- var import_errors = require("@dxos/errors");
1075
1073
  var import_invariant6 = require("@dxos/invariant");
1076
1074
  var import_keys3 = require("@dxos/keys");
1077
1075
  var import_log5 = require("@dxos/log");
@@ -1109,7 +1107,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1109
1107
  options: async (options) => {
1110
1108
  (0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
1111
1109
  F: __dxlog_file7,
1112
- L: 88,
1110
+ L: 87,
1113
1111
  S: this,
1114
1112
  A: [
1115
1113
  "!this._remoteOptions",
@@ -1126,7 +1124,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1126
1124
  id: traceId
1127
1125
  }), {
1128
1126
  F: __dxlog_file7,
1129
- L: 97,
1127
+ L: 96,
1130
1128
  S: this,
1131
1129
  C: (f, a) => f(...a)
1132
1130
  });
@@ -1136,7 +1134,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1136
1134
  invitationId
1137
1135
  }, {
1138
1136
  F: __dxlog_file7,
1139
- L: 101,
1137
+ L: 100,
1140
1138
  S: this,
1141
1139
  C: (f, a) => f(...a)
1142
1140
  });
@@ -1150,7 +1148,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1150
1148
  guestProfile: profile
1151
1149
  }, {
1152
1150
  F: __dxlog_file7,
1153
- L: 110,
1151
+ L: 109,
1154
1152
  S: this,
1155
1153
  C: (f, a) => f(...a)
1156
1154
  });
@@ -1163,7 +1161,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1163
1161
  id: traceId
1164
1162
  }), {
1165
1163
  F: __dxlog_file7,
1166
- L: 117,
1164
+ L: 116,
1167
1165
  S: this,
1168
1166
  C: (f, a) => f(...a)
1169
1167
  });
@@ -1178,7 +1176,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1178
1176
  id: traceId
1179
1177
  }), {
1180
1178
  F: __dxlog_file7,
1181
- L: 126,
1179
+ L: 125,
1182
1180
  S: this,
1183
1181
  C: (f, a) => f(...a)
1184
1182
  });
@@ -1186,14 +1184,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1186
1184
  authCode: code
1187
1185
  }, {
1188
1186
  F: __dxlog_file7,
1189
- L: 127,
1187
+ L: 126,
1190
1188
  S: this,
1191
1189
  C: (f, a) => f(...a)
1192
1190
  });
1193
1191
  let status = import_invitations.AuthenticationResponse.Status.OK;
1194
1192
  (0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
1195
1193
  F: __dxlog_file7,
1196
- L: 130,
1194
+ L: 129,
1197
1195
  S: this,
1198
1196
  A: [
1199
1197
  "this.invitation",
@@ -1204,7 +1202,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1204
1202
  case import_services3.Invitation.AuthMethod.NONE: {
1205
1203
  (0, import_log5.log)("authentication not required", void 0, {
1206
1204
  F: __dxlog_file7,
1207
- L: 133,
1205
+ L: 132,
1208
1206
  S: this,
1209
1207
  C: (f, a) => f(...a)
1210
1208
  });
@@ -1229,7 +1227,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1229
1227
  authMethod: this.invitation.authMethod
1230
1228
  }, {
1231
1229
  F: __dxlog_file7,
1232
- L: 151,
1230
+ L: 150,
1233
1231
  S: this,
1234
1232
  C: (f, a) => f(...a)
1235
1233
  });
@@ -1244,7 +1242,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1244
1242
  }
1245
1243
  }), {
1246
1244
  F: __dxlog_file7,
1247
- L: 157,
1245
+ L: 156,
1248
1246
  S: this,
1249
1247
  C: (f, a) => f(...a)
1250
1248
  });
@@ -1258,14 +1256,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1258
1256
  id: traceId
1259
1257
  }), {
1260
1258
  F: __dxlog_file7,
1261
- L: 163,
1259
+ L: 162,
1262
1260
  S: this,
1263
1261
  C: (f, a) => f(...a)
1264
1262
  });
1265
1263
  try {
1266
1264
  (0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
1267
1265
  F: __dxlog_file7,
1268
- L: 166,
1266
+ L: 165,
1269
1267
  S: this,
1270
1268
  A: [
1271
1269
  "this.invitation",
@@ -1280,7 +1278,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1280
1278
  id: traceId
1281
1279
  }), {
1282
1280
  F: __dxlog_file7,
1283
- L: 174,
1281
+ L: 173,
1284
1282
  S: this,
1285
1283
  C: (f, a) => f(...a)
1286
1284
  });
@@ -1303,7 +1301,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1303
1301
  timeout: OPTIONS_TIMEOUT
1304
1302
  }));
1305
1303
  if (this._remoteOptions?.role !== import_invitations.Options.Role.GUEST) {
1306
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1304
+ throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
1307
1305
  expected: import_invitations.Options.Role.GUEST,
1308
1306
  remoteOptions: this._remoteOptions
1309
1307
  });
@@ -1337,7 +1335,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1337
1335
  options: async (options) => {
1338
1336
  (0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
1339
1337
  F: __dxlog_file7,
1340
- L: 241,
1338
+ L: 240,
1341
1339
  S: this,
1342
1340
  A: [
1343
1341
  "!this._remoteOptions",
@@ -1364,7 +1362,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1364
1362
  try {
1365
1363
  (0, import_log5.log)("begin options", void 0, {
1366
1364
  F: __dxlog_file7,
1367
- L: 262,
1365
+ L: 261,
1368
1366
  S: this,
1369
1367
  C: (f, a) => f(...a)
1370
1368
  });
@@ -1376,12 +1374,12 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1376
1374
  }));
1377
1375
  (0, import_log5.log)("end options", void 0, {
1378
1376
  F: __dxlog_file7,
1379
- L: 265,
1377
+ L: 264,
1380
1378
  S: this,
1381
1379
  C: (f, a) => f(...a)
1382
1380
  });
1383
1381
  if (this._remoteOptions?.role !== import_invitations.Options.Role.HOST) {
1384
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1382
+ throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
1385
1383
  expected: import_invitations.Options.Role.HOST,
1386
1384
  remoteOptions: this._remoteOptions
1387
1385
  });
@@ -1390,7 +1388,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1390
1388
  } catch (err) {
1391
1389
  (0, import_log5.log)("openError", err, {
1392
1390
  F: __dxlog_file7,
1393
- L: 275,
1391
+ L: 274,
1394
1392
  S: this,
1395
1393
  C: (f, a) => f(...a)
1396
1394
  });
@@ -1400,7 +1398,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1400
1398
  async onClose() {
1401
1399
  (0, import_log5.log)("onClose", void 0, {
1402
1400
  F: __dxlog_file7,
1403
- L: 281,
1401
+ L: 280,
1404
1402
  S: this,
1405
1403
  C: (f, a) => f(...a)
1406
1404
  });
@@ -1423,7 +1421,7 @@ var InvitationsHandler = class {
1423
1421
  const authCode = options?.authCode ?? (authMethod === import_services4.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1424
1422
  (0, import_invariant7.invariant)(protocol, void 0, {
1425
1423
  F: __dxlog_file8,
1426
- L: 76,
1424
+ L: 75,
1427
1425
  S: this,
1428
1426
  A: [
1429
1427
  "protocol",
@@ -1452,7 +1450,7 @@ var InvitationsHandler = class {
1452
1450
  ...protocol.toJSON()
1453
1451
  }, {
1454
1452
  F: __dxlog_file8,
1455
- L: 98,
1453
+ L: 97,
1456
1454
  S: this,
1457
1455
  C: (f, a) => f(...a)
1458
1456
  });
@@ -1477,7 +1475,7 @@ var InvitationsHandler = class {
1477
1475
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1478
1476
  (0, import_invariant7.invariant)(deviceKey, void 0, {
1479
1477
  F: __dxlog_file8,
1480
- L: 119,
1478
+ L: 118,
1481
1479
  S: this,
1482
1480
  A: [
1483
1481
  "deviceKey",
@@ -1500,7 +1498,7 @@ var InvitationsHandler = class {
1500
1498
  id: traceId
1501
1499
  }), {
1502
1500
  F: __dxlog_file8,
1503
- L: 137,
1501
+ L: 136,
1504
1502
  S: this,
1505
1503
  C: (f, a) => f(...a)
1506
1504
  });
@@ -1508,7 +1506,7 @@ var InvitationsHandler = class {
1508
1506
  ...protocol.toJSON()
1509
1507
  }, {
1510
1508
  F: __dxlog_file8,
1511
- L: 138,
1509
+ L: 137,
1512
1510
  S: this,
1513
1511
  C: (f, a) => f(...a)
1514
1512
  });
@@ -1524,7 +1522,7 @@ var InvitationsHandler = class {
1524
1522
  ...protocol.toJSON()
1525
1523
  }, {
1526
1524
  F: __dxlog_file8,
1527
- L: 141,
1525
+ L: 140,
1528
1526
  S: this,
1529
1527
  C: (f, a) => f(...a)
1530
1528
  });
@@ -1536,7 +1534,7 @@ var InvitationsHandler = class {
1536
1534
  id: traceId
1537
1535
  }), {
1538
1536
  F: __dxlog_file8,
1539
- L: 143,
1537
+ L: 142,
1540
1538
  S: this,
1541
1539
  C: (f, a) => f(...a)
1542
1540
  });
@@ -1546,7 +1544,7 @@ var InvitationsHandler = class {
1546
1544
  ...protocol.toJSON()
1547
1545
  }, {
1548
1546
  F: __dxlog_file8,
1549
- L: 146,
1547
+ L: 145,
1550
1548
  S: this,
1551
1549
  C: (f, a) => f(...a)
1552
1550
  });
@@ -1557,7 +1555,7 @@ var InvitationsHandler = class {
1557
1555
  } else {
1558
1556
  import_log6.log.error("failed", err, {
1559
1557
  F: __dxlog_file8,
1560
- L: 149,
1558
+ L: 148,
1561
1559
  S: this,
1562
1560
  C: (f, a) => f(...a)
1563
1561
  });
@@ -1568,7 +1566,7 @@ var InvitationsHandler = class {
1568
1566
  error: err
1569
1567
  }), {
1570
1568
  F: __dxlog_file8,
1571
- L: 152,
1569
+ L: 151,
1572
1570
  S: this,
1573
1571
  C: (f, a) => f(...a)
1574
1572
  });
@@ -1581,7 +1579,7 @@ var InvitationsHandler = class {
1581
1579
  });
1582
1580
  },
1583
1581
  onError: (err) => {
1584
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1582
+ if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
1585
1583
  return;
1586
1584
  }
1587
1585
  if (err instanceof import_async5.TimeoutError) {
@@ -1589,7 +1587,7 @@ var InvitationsHandler = class {
1589
1587
  ...protocol.toJSON()
1590
1588
  }, {
1591
1589
  F: __dxlog_file8,
1592
- L: 167,
1590
+ L: 166,
1593
1591
  S: this,
1594
1592
  C: (f, a) => f(...a)
1595
1593
  });
@@ -1600,7 +1598,7 @@ var InvitationsHandler = class {
1600
1598
  } else {
1601
1599
  import_log6.log.error("failed", err, {
1602
1600
  F: __dxlog_file8,
1603
- L: 170,
1601
+ L: 169,
1604
1602
  S: this,
1605
1603
  C: (f, a) => f(...a)
1606
1604
  });
@@ -1628,7 +1626,7 @@ var InvitationsHandler = class {
1628
1626
  state: import_services4.Invitation.State.CONNECTING
1629
1627
  });
1630
1628
  });
1631
- const observable = new import_client_protocol2.CancellableInvitationObservable({
1629
+ const observable = new import_client_protocol2.CancellableInvitation({
1632
1630
  initialInvitation: invitation,
1633
1631
  subscriber: stream.observable,
1634
1632
  onCancel: async () => {
@@ -1645,7 +1643,7 @@ var InvitationsHandler = class {
1645
1643
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1646
1644
  (0, import_invariant7.invariant)(protocol, void 0, {
1647
1645
  F: __dxlog_file8,
1648
- L: 211,
1646
+ L: 210,
1649
1647
  S: this,
1650
1648
  A: [
1651
1649
  "protocol",
@@ -1659,7 +1657,7 @@ var InvitationsHandler = class {
1659
1657
  const setState = (newData) => {
1660
1658
  (0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
1661
1659
  F: __dxlog_file8,
1662
- L: 222,
1660
+ L: 221,
1663
1661
  S: this,
1664
1662
  A: [
1665
1663
  "newData.state !== undefined",
@@ -1679,7 +1677,7 @@ var InvitationsHandler = class {
1679
1677
  ...protocol.toJSON()
1680
1678
  }, {
1681
1679
  F: __dxlog_file8,
1682
- L: 230,
1680
+ L: 229,
1683
1681
  S: this,
1684
1682
  C: (f, a) => f(...a)
1685
1683
  });
@@ -1689,7 +1687,7 @@ var InvitationsHandler = class {
1689
1687
  } else {
1690
1688
  import_log6.log.warn("auth failed", err, {
1691
1689
  F: __dxlog_file8,
1692
- L: 233,
1690
+ L: 232,
1693
1691
  S: this,
1694
1692
  C: (f, a) => f(...a)
1695
1693
  });
@@ -1703,7 +1701,7 @@ var InvitationsHandler = class {
1703
1701
  ...protocol.toJSON()
1704
1702
  }, {
1705
1703
  F: __dxlog_file8,
1706
- L: 241,
1704
+ L: 240,
1707
1705
  S: this,
1708
1706
  C: (f, a) => f(...a)
1709
1707
  });
@@ -1718,7 +1716,7 @@ var InvitationsHandler = class {
1718
1716
  currentState
1719
1717
  }, {
1720
1718
  F: __dxlog_file8,
1721
- L: 251,
1719
+ L: 250,
1722
1720
  S: this,
1723
1721
  C: (f, a) => f(...a)
1724
1722
  });
@@ -1733,7 +1731,7 @@ var InvitationsHandler = class {
1733
1731
  id: traceId
1734
1732
  }), {
1735
1733
  F: __dxlog_file8,
1736
- L: 260,
1734
+ L: 259,
1737
1735
  S: this,
1738
1736
  C: (f, a) => f(...a)
1739
1737
  });
@@ -1745,7 +1743,7 @@ var InvitationsHandler = class {
1745
1743
  ...protocol.toJSON()
1746
1744
  }, {
1747
1745
  F: __dxlog_file8,
1748
- L: 268,
1746
+ L: 267,
1749
1747
  S: this,
1750
1748
  C: (f, a) => f(...a)
1751
1749
  });
@@ -1756,7 +1754,7 @@ var InvitationsHandler = class {
1756
1754
  ...protocol.toJSON()
1757
1755
  }, {
1758
1756
  F: __dxlog_file8,
1759
- L: 272,
1757
+ L: 271,
1760
1758
  S: this,
1761
1759
  C: (f, a) => f(...a)
1762
1760
  });
@@ -1766,7 +1764,7 @@ var InvitationsHandler = class {
1766
1764
  response: introductionResponse
1767
1765
  }, {
1768
1766
  F: __dxlog_file8,
1769
- L: 276,
1767
+ L: 275,
1770
1768
  S: this,
1771
1769
  C: (f, a) => f(...a)
1772
1770
  });
@@ -1778,7 +1776,7 @@ var InvitationsHandler = class {
1778
1776
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1779
1777
  (0, import_log6.log)("guest waiting for authentication code...", void 0, {
1780
1778
  F: __dxlog_file8,
1781
- L: 285,
1779
+ L: 284,
1782
1780
  S: this,
1783
1781
  C: (f, a) => f(...a)
1784
1782
  });
@@ -1790,7 +1788,7 @@ var InvitationsHandler = class {
1790
1788
  });
1791
1789
  (0, import_log6.log)("sending authentication request", void 0, {
1792
1790
  F: __dxlog_file8,
1793
- L: 289,
1791
+ L: 288,
1794
1792
  S: this,
1795
1793
  C: (f, a) => f(...a)
1796
1794
  });
@@ -1811,7 +1809,7 @@ var InvitationsHandler = class {
1811
1809
  attempt
1812
1810
  }, {
1813
1811
  F: __dxlog_file8,
1814
- L: 300,
1812
+ L: 299,
1815
1813
  S: this,
1816
1814
  C: (f, a) => f(...a)
1817
1815
  });
@@ -1828,7 +1826,7 @@ var InvitationsHandler = class {
1828
1826
  ...protocol.toJSON()
1829
1827
  }, {
1830
1828
  F: __dxlog_file8,
1831
- L: 311,
1829
+ L: 310,
1832
1830
  S: this,
1833
1831
  C: (f, a) => f(...a)
1834
1832
  });
@@ -1840,7 +1838,7 @@ var InvitationsHandler = class {
1840
1838
  ...protocol.toJSON()
1841
1839
  }, {
1842
1840
  F: __dxlog_file8,
1843
- L: 322,
1841
+ L: 321,
1844
1842
  S: this,
1845
1843
  C: (f, a) => f(...a)
1846
1844
  });
@@ -1852,7 +1850,7 @@ var InvitationsHandler = class {
1852
1850
  id: traceId
1853
1851
  }), {
1854
1852
  F: __dxlog_file8,
1855
- L: 324,
1853
+ L: 323,
1856
1854
  S: this,
1857
1855
  C: (f, a) => f(...a)
1858
1856
  });
@@ -1862,7 +1860,7 @@ var InvitationsHandler = class {
1862
1860
  ...protocol.toJSON()
1863
1861
  }, {
1864
1862
  F: __dxlog_file8,
1865
- L: 327,
1863
+ L: 326,
1866
1864
  S: this,
1867
1865
  C: (f, a) => f(...a)
1868
1866
  });
@@ -1872,7 +1870,7 @@ var InvitationsHandler = class {
1872
1870
  } else {
1873
1871
  (0, import_log6.log)("auth failed", err, {
1874
1872
  F: __dxlog_file8,
1875
- L: 330,
1873
+ L: 329,
1876
1874
  S: this,
1877
1875
  C: (f, a) => f(...a)
1878
1876
  });
@@ -1883,7 +1881,7 @@ var InvitationsHandler = class {
1883
1881
  error: err
1884
1882
  }), {
1885
1883
  F: __dxlog_file8,
1886
- L: 333,
1884
+ L: 332,
1887
1885
  S: this,
1888
1886
  C: (f, a) => f(...a)
1889
1887
  });
@@ -1893,7 +1891,7 @@ var InvitationsHandler = class {
1893
1891
  });
1894
1892
  },
1895
1893
  onError: (err) => {
1896
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1894
+ if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
1897
1895
  return;
1898
1896
  }
1899
1897
  if (err instanceof import_async5.TimeoutError) {
@@ -1901,7 +1899,7 @@ var InvitationsHandler = class {
1901
1899
  ...protocol.toJSON()
1902
1900
  }, {
1903
1901
  F: __dxlog_file8,
1904
- L: 344,
1902
+ L: 343,
1905
1903
  S: this,
1906
1904
  C: (f, a) => f(...a)
1907
1905
  });
@@ -1911,7 +1909,7 @@ var InvitationsHandler = class {
1911
1909
  } else {
1912
1910
  (0, import_log6.log)("auth failed", err, {
1913
1911
  F: __dxlog_file8,
1914
- L: 347,
1912
+ L: 346,
1915
1913
  S: this,
1916
1914
  C: (f, a) => f(...a)
1917
1915
  });
@@ -1924,7 +1922,7 @@ var InvitationsHandler = class {
1924
1922
  (0, import_async5.scheduleTask)(ctx, async () => {
1925
1923
  (0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
1926
1924
  F: __dxlog_file8,
1927
- L: 357,
1925
+ L: 356,
1928
1926
  S: this,
1929
1927
  A: [
1930
1928
  "invitation.swarmKey",
@@ -1946,7 +1944,7 @@ var InvitationsHandler = class {
1946
1944
  state: import_services4.Invitation.State.CONNECTING
1947
1945
  });
1948
1946
  });
1949
- const observable = new import_client_protocol2.AuthenticatingInvitationObservable({
1947
+ const observable = new import_client_protocol2.AuthenticatingInvitation({
1950
1948
  initialInvitation: invitation,
1951
1949
  subscriber: stream.observable,
1952
1950
  onCancel: async () => {
@@ -2315,7 +2313,7 @@ var import_credentials14 = require("@dxos/credentials");
2315
2313
  var import_invariant11 = require("@dxos/invariant");
2316
2314
  var import_keys7 = require("@dxos/keys");
2317
2315
  var import_log11 = require("@dxos/log");
2318
- var import_protocols7 = require("@dxos/protocols");
2316
+ var import_protocols8 = require("@dxos/protocols");
2319
2317
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2320
2318
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2321
2319
  var import_util4 = require("@dxos/util");
@@ -2326,9 +2324,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2326
2324
  var import_context6 = require("@dxos/context");
2327
2325
  var import_debug4 = require("@dxos/debug");
2328
2326
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2329
- var import_errors3 = require("@dxos/errors");
2330
2327
  var import_keys6 = require("@dxos/keys");
2331
2328
  var import_log10 = require("@dxos/log");
2329
+ var import_protocols7 = require("@dxos/protocols");
2332
2330
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2333
2331
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2334
2332
  var import_timeframe2 = require("@dxos/timeframe");
@@ -2637,7 +2635,7 @@ var DataSpace = class DataSpace2 {
2637
2635
  this._signingContext = params.signingContext;
2638
2636
  this._callbacks = params.callbacks ?? {};
2639
2637
  this.authVerifier = new TrustedKeySetAuthVerifier({
2640
- trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
2638
+ trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2641
2639
  update: this._inner.stateUpdate,
2642
2640
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2643
2641
  });
@@ -2647,7 +2645,7 @@ var DataSpace = class DataSpace2 {
2647
2645
  state: import_services7.SpaceState[this._state]
2648
2646
  }, {
2649
2647
  F: __dxlog_file12,
2650
- L: 112,
2648
+ L: 118,
2651
2649
  S: this,
2652
2650
  C: (f, a) => f(...a)
2653
2651
  });
@@ -2681,6 +2679,7 @@ var DataSpace = class DataSpace2 {
2681
2679
  await this._open();
2682
2680
  }
2683
2681
  async _open() {
2682
+ await this._gossip.open();
2684
2683
  await this._notarizationPlugin.open();
2685
2684
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2686
2685
  await this._inner.open(new import_context6.Context());
@@ -2689,7 +2688,7 @@ var DataSpace = class DataSpace2 {
2689
2688
  state: import_services7.SpaceState[this._state]
2690
2689
  }, {
2691
2690
  F: __dxlog_file12,
2692
- L: 158,
2691
+ L: 165,
2693
2692
  S: this,
2694
2693
  C: (f, a) => f(...a)
2695
2694
  });
@@ -2707,7 +2706,7 @@ var DataSpace = class DataSpace2 {
2707
2706
  state: import_services7.SpaceState[this._state]
2708
2707
  }, {
2709
2708
  F: __dxlog_file12,
2710
- L: 172,
2709
+ L: 179,
2711
2710
  S: this,
2712
2711
  C: (f, a) => f(...a)
2713
2712
  });
@@ -2718,6 +2717,7 @@ var DataSpace = class DataSpace2 {
2718
2717
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
2719
2718
  await this._notarizationPlugin.close();
2720
2719
  await this._presence.destroy();
2720
+ await this._gossip.close();
2721
2721
  }
2722
2722
  async postMessage(channel, message) {
2723
2723
  return this._gossip.postMessage(channel, message);
@@ -2734,10 +2734,10 @@ var DataSpace = class DataSpace2 {
2734
2734
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
2735
2735
  await this.initializeDataPipeline();
2736
2736
  } catch (err) {
2737
- if (err instanceof import_errors3.CancelledError) {
2737
+ if (err instanceof import_protocols7.CancelledError) {
2738
2738
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
2739
2739
  F: __dxlog_file12,
2740
- L: 203,
2740
+ L: 211,
2741
2741
  S: this,
2742
2742
  C: (f, a) => f(...a)
2743
2743
  });
@@ -2745,7 +2745,7 @@ var DataSpace = class DataSpace2 {
2745
2745
  }
2746
2746
  import_log10.log.error("Error initializing data pipeline", err, {
2747
2747
  F: __dxlog_file12,
2748
- L: 207,
2748
+ L: 215,
2749
2749
  S: this,
2750
2750
  C: (f, a) => f(...a)
2751
2751
  });
@@ -2754,7 +2754,7 @@ var DataSpace = class DataSpace2 {
2754
2754
  state: import_services7.SpaceState[this._state]
2755
2755
  }, {
2756
2756
  F: __dxlog_file12,
2757
- L: 209,
2757
+ L: 217,
2758
2758
  S: this,
2759
2759
  C: (f, a) => f(...a)
2760
2760
  });
@@ -2767,14 +2767,14 @@ var DataSpace = class DataSpace2 {
2767
2767
  }
2768
2768
  async initializeDataPipeline() {
2769
2769
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
2770
- throw new import_errors3.SystemError("Invalid operation");
2770
+ throw new import_protocols7.SystemError("Invalid operation");
2771
2771
  }
2772
2772
  this._state = import_services7.SpaceState.INITIALIZING;
2773
2773
  (0, import_log10.log)("new state", {
2774
2774
  state: import_services7.SpaceState[this._state]
2775
2775
  }, {
2776
2776
  F: __dxlog_file12,
2777
- L: 225,
2777
+ L: 233,
2778
2778
  S: this,
2779
2779
  C: (f, a) => f(...a)
2780
2780
  });
@@ -2785,7 +2785,7 @@ var DataSpace = class DataSpace2 {
2785
2785
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2786
2786
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
2787
2787
  F: __dxlog_file12,
2788
- L: 239,
2788
+ L: 247,
2789
2789
  S: this,
2790
2790
  C: (f, a) => f(...a)
2791
2791
  });
@@ -2796,7 +2796,7 @@ var DataSpace = class DataSpace2 {
2796
2796
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
2797
2797
  (0, import_log10.log)("data pipeline ready", void 0, {
2798
2798
  F: __dxlog_file12,
2799
- L: 248,
2799
+ L: 256,
2800
2800
  S: this,
2801
2801
  C: (f, a) => f(...a)
2802
2802
  });
@@ -2806,7 +2806,7 @@ var DataSpace = class DataSpace2 {
2806
2806
  state: import_services7.SpaceState[this._state]
2807
2807
  }, {
2808
2808
  F: __dxlog_file12,
2809
- L: 252,
2809
+ L: 260,
2810
2810
  S: this,
2811
2811
  C: (f, a) => f(...a)
2812
2812
  });
@@ -2822,7 +2822,7 @@ var DataSpace = class DataSpace2 {
2822
2822
  await this._createWritableFeeds();
2823
2823
  (0, import_log10.log)("writable feeds created", void 0, {
2824
2824
  F: __dxlog_file12,
2825
- L: 268,
2825
+ L: 276,
2826
2826
  S: this,
2827
2827
  C: (f, a) => f(...a)
2828
2828
  });
@@ -2927,7 +2927,7 @@ var DataSpace = class DataSpace2 {
2927
2927
  state: import_services7.SpaceState[this._state]
2928
2928
  }, {
2929
2929
  F: __dxlog_file12,
2930
- L: 384,
2930
+ L: 392,
2931
2931
  S: this,
2932
2932
  C: (f, a) => f(...a)
2933
2933
  });
@@ -3069,7 +3069,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3069
3069
  S: this,
3070
3070
  C: (f, a) => f(...a)
3071
3071
  });
3072
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.begin({
3072
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.begin({
3073
3073
  id: this._instanceId
3074
3074
  }), {
3075
3075
  F: __dxlog_file13,
@@ -3115,7 +3115,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3115
3115
  space.initializeDataPipelineAsync();
3116
3116
  }
3117
3117
  }
3118
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3118
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.end({
3119
3119
  id: this._instanceId
3120
3120
  }), {
3121
3121
  F: __dxlog_file13,
@@ -3369,10 +3369,9 @@ DataSpaceManager = _ts_decorate4([
3369
3369
  var import_async10 = require("@dxos/async");
3370
3370
  var import_codec_protobuf5 = require("@dxos/codec-protobuf");
3371
3371
  var import_debug6 = require("@dxos/debug");
3372
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3373
- var import_errors4 = require("@dxos/errors");
3372
+ var import_invariant12 = require("@dxos/invariant");
3374
3373
  var import_log12 = require("@dxos/log");
3375
- var import_protocols8 = require("@dxos/protocols");
3374
+ var import_protocols9 = require("@dxos/protocols");
3376
3375
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3377
3376
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3378
3377
  var SpacesServiceImpl = class {
@@ -3392,7 +3391,7 @@ var SpacesServiceImpl = class {
3392
3391
  }
3393
3392
  async updateSpace({ spaceKey, state }) {
3394
3393
  const dataSpaceManager = await this._getDataSpaceManager();
3395
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3394
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3396
3395
  if (state) {
3397
3396
  switch (state) {
3398
3397
  case import_services9.SpaceState.ACTIVE:
@@ -3402,7 +3401,7 @@ var SpacesServiceImpl = class {
3402
3401
  await space.deactivate();
3403
3402
  break;
3404
3403
  default:
3405
- throw new import_errors4.ApiError("Invalid space state");
3404
+ throw new import_protocols9.ApiError("Invalid space state");
3406
3405
  }
3407
3406
  }
3408
3407
  }
@@ -3457,14 +3456,14 @@ var SpacesServiceImpl = class {
3457
3456
  }
3458
3457
  async postMessage({ spaceKey, channel, message }) {
3459
3458
  const dataSpaceManager = await this._getDataSpaceManager();
3460
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3459
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3461
3460
  await space.postMessage(getChannelId(channel), message);
3462
3461
  }
3463
3462
  subscribeMessages({ spaceKey, channel }) {
3464
3463
  return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3465
3464
  (0, import_async10.scheduleTask)(ctx, async () => {
3466
3465
  const dataSpaceManager = await this._getDataSpaceManager();
3467
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3466
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3468
3467
  const handle = space.listen(getChannelId(channel), (message) => {
3469
3468
  next(message);
3470
3469
  });
@@ -3472,38 +3471,83 @@ var SpacesServiceImpl = class {
3472
3471
  });
3473
3472
  });
3474
3473
  }
3475
- queryCredentials({ spaceKey }) {
3476
- return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3477
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3474
+ queryCredentials({ spaceKey, noTail }) {
3475
+ return new import_codec_protobuf5.Stream(({ ctx, next, close }) => {
3476
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3478
3477
  const processor = {
3479
3478
  processCredential: async (credential) => {
3480
3479
  next(credential);
3481
3480
  }
3482
3481
  };
3483
3482
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3484
- (0, import_async10.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
3483
+ (0, import_async10.scheduleTask)(ctx, async () => {
3484
+ await space.spaceState.addCredentialProcessor(processor);
3485
+ if (noTail) {
3486
+ close();
3487
+ }
3488
+ });
3485
3489
  });
3486
3490
  }
3487
3491
  async writeCredentials({ spaceKey, credentials }) {
3488
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3492
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3489
3493
  for (const credential of credentials ?? []) {
3490
- await space.controlPipeline.writer.write({
3491
- credential: {
3492
- credential
3493
- }
3494
- });
3494
+ if (credential.proof) {
3495
+ await space.controlPipeline.writer.write({
3496
+ credential: {
3497
+ credential
3498
+ }
3499
+ });
3500
+ } else {
3501
+ (0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3502
+ F: __dxlog_file14,
3503
+ L: 168,
3504
+ S: this,
3505
+ A: [
3506
+ "!credential.id",
3507
+ "'Id on unsigned credentials is not allowed'"
3508
+ ]
3509
+ });
3510
+ (0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
3511
+ F: __dxlog_file14,
3512
+ L: 169,
3513
+ S: this,
3514
+ A: [
3515
+ "this._identityManager.identity",
3516
+ "'Identity is not available'"
3517
+ ]
3518
+ });
3519
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3520
+ (0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3521
+ F: __dxlog_file14,
3522
+ L: 171,
3523
+ S: this,
3524
+ A: [
3525
+ "credential.issuer.equals(signer.getIssuer())",
3526
+ ""
3527
+ ]
3528
+ });
3529
+ const signedCredential = await signer.createCredential({
3530
+ subject: credential.subject.id,
3531
+ assertion: credential.subject.assertion
3532
+ });
3533
+ await space.controlPipeline.writer.write({
3534
+ credential: {
3535
+ credential: signedCredential
3536
+ }
3537
+ });
3538
+ }
3495
3539
  }
3496
3540
  }
3497
3541
  async createEpoch({ spaceKey }) {
3498
3542
  const dataSpaceManager = await this._getDataSpaceManager();
3499
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3543
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3500
3544
  await space.createEpoch();
3501
3545
  }
3502
3546
  _serializeSpace(space) {
3503
3547
  return {
3504
3548
  spaceKey: space.key,
3505
3549
  state: space.state,
3506
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3550
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3507
3551
  pipeline: {
3508
3552
  currentEpoch: space.dataPipeline.currentEpoch,
3509
3553
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3530,7 +3574,7 @@ var SpacesServiceImpl = class {
3530
3574
  displayName: member.assertion.profile?.displayName
3531
3575
  }
3532
3576
  },
3533
- presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3577
+ presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3534
3578
  peerStates: peers
3535
3579
  };
3536
3580
  }),
@@ -3562,11 +3606,11 @@ var ServiceContext = class ServiceContext2 {
3562
3606
  this.signalManager = signalManager;
3563
3607
  this.modelFactory = modelFactory;
3564
3608
  this.initialized = new import_async11.Trigger();
3565
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3609
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3566
3610
  this._handlerFactories = /* @__PURE__ */ new Map();
3567
3611
  this._instanceId = import_keys8.PublicKey.random().toHex();
3568
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3569
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
3612
+ this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
3613
+ this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3570
3614
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3571
3615
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3572
3616
  this.feedStore = new import_feed_store3.FeedStore({
@@ -3574,12 +3618,12 @@ var ServiceContext = class ServiceContext2 {
3574
3618
  root: storage.createDirectory("feeds"),
3575
3619
  signer: this.keyring,
3576
3620
  hypercore: {
3577
- valueEncoding: import_echo_pipeline3.valueEncoding,
3621
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3578
3622
  stats: true
3579
3623
  }
3580
3624
  })
3581
3625
  });
3582
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
3626
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3583
3627
  feedStore: this.feedStore,
3584
3628
  networkManager: this.networkManager,
3585
3629
  blobStore: this.blobStore,
@@ -3599,7 +3643,7 @@ var ServiceContext = class ServiceContext2 {
3599
3643
  S: this,
3600
3644
  C: (f, a) => f(...a)
3601
3645
  });
3602
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.begin({
3646
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.begin({
3603
3647
  id: this._instanceId
3604
3648
  }), {
3605
3649
  F: __dxlog_file15,
@@ -3615,7 +3659,7 @@ var ServiceContext = class ServiceContext2 {
3615
3659
  if (this.identityManager.identity) {
3616
3660
  await this._initialize(ctx);
3617
3661
  }
3618
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
3662
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.end({
3619
3663
  id: this._instanceId
3620
3664
  }), {
3621
3665
  F: __dxlog_file15,
@@ -3662,7 +3706,7 @@ var ServiceContext = class ServiceContext2 {
3662
3706
  }
3663
3707
  getInvitationHandler(invitation) {
3664
3708
  const factory = this._handlerFactories.get(invitation.kind);
3665
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3709
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3666
3710
  F: __dxlog_file15,
3667
3711
  L: 174,
3668
3712
  S: this,
@@ -3680,8 +3724,8 @@ var ServiceContext = class ServiceContext2 {
3680
3724
  }
3681
3725
  async _checkStorageVersion() {
3682
3726
  await this.metadataStore.load();
3683
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
3684
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
3727
+ if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
3728
+ throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
3685
3729
  }
3686
3730
  }
3687
3731
  // Called when identity is created.
@@ -3709,7 +3753,7 @@ var ServiceContext = class ServiceContext2 {
3709
3753
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3710
3754
  await this.dataSpaceManager.open();
3711
3755
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3712
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3756
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3713
3757
  F: __dxlog_file15,
3714
3758
  L: 218,
3715
3759
  S: this,
@@ -3794,14 +3838,14 @@ var import_async17 = require("@dxos/async");
3794
3838
  var import_client_protocol5 = require("@dxos/client-protocol");
3795
3839
  var import_context10 = require("@dxos/context");
3796
3840
  var import_document_model2 = require("@dxos/document-model");
3797
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3798
- var import_invariant14 = require("@dxos/invariant");
3841
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3842
+ var import_invariant15 = require("@dxos/invariant");
3799
3843
  var import_keys12 = require("@dxos/keys");
3800
3844
  var import_log16 = require("@dxos/log");
3801
3845
  var import_messaging = require("@dxos/messaging");
3802
3846
  var import_model_factory = require("@dxos/model-factory");
3803
3847
  var import_network_manager2 = require("@dxos/network-manager");
3804
- var import_protocols10 = require("@dxos/protocols");
3848
+ var import_protocols12 = require("@dxos/protocols");
3805
3849
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3806
3850
  var import_text_model = require("@dxos/text-model");
3807
3851
  var import_tracing5 = require("@dxos/tracing");
@@ -4159,7 +4203,7 @@ var DevtoolsServiceImpl = class {
4159
4203
  };
4160
4204
 
4161
4205
  // packages/sdk/client-services/src/packlets/locks/node.ts
4162
- var import_invariant13 = require("@dxos/invariant");
4206
+ var import_invariant14 = require("@dxos/invariant");
4163
4207
  var import_lock_file = require("@dxos/lock-file");
4164
4208
  var import_log14 = require("@dxos/log");
4165
4209
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4200,7 +4244,7 @@ var Lock = class {
4200
4244
  }
4201
4245
  async release() {
4202
4246
  await this._onRelease?.();
4203
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4247
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4204
4248
  F: __dxlog_file16,
4205
4249
  L: 42,
4206
4250
  S: this,
@@ -4367,7 +4411,7 @@ var NetworkServiceImpl = class {
4367
4411
 
4368
4412
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4369
4413
  var import_client_protocol4 = require("@dxos/client-protocol");
4370
- var import_errors5 = require("@dxos/errors");
4414
+ var import_protocols11 = require("@dxos/protocols");
4371
4415
  var import_config = require("@dxos/protocols/proto/dxos/config");
4372
4416
  var import_random_access_storage = require("@dxos/random-access-storage");
4373
4417
  var import_util8 = require("@dxos/util");
@@ -4375,16 +4419,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4375
4419
  var createStorageObjects = (config) => {
4376
4420
  const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4377
4421
  if (persistent && storageType === StorageDriver.RAM) {
4378
- throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4422
+ throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4379
4423
  }
4380
4424
  if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4381
- throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4425
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4382
4426
  }
4383
4427
  if (persistent && keyStorage === StorageDriver.RAM) {
4384
- throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4428
+ throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4385
4429
  }
4386
4430
  if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4387
- throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4431
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4388
4432
  }
4389
4433
  return {
4390
4434
  storage: (0, import_random_access_storage.createStorage)({
@@ -4591,7 +4635,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4591
4635
  * Can only be called once.
4592
4636
  */
4593
4637
  initialize({ config, ...options }) {
4594
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4638
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4595
4639
  F: __dxlog_file17,
4596
4640
  L: 184,
4597
4641
  S: this,
@@ -4607,7 +4651,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4607
4651
  C: (f, a) => f(...a)
4608
4652
  });
4609
4653
  if (config) {
4610
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4654
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4611
4655
  F: __dxlog_file17,
4612
4656
  L: 188,
4613
4657
  S: this,
@@ -4625,7 +4669,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4625
4669
  iceServers: this._config?.get("runtime.services.ice")
4626
4670
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4627
4671
  this._signalManager = signalManager;
4628
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4672
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4629
4673
  F: __dxlog_file17,
4630
4674
  L: 204,
4631
4675
  S: this,
@@ -4651,7 +4695,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4651
4695
  return;
4652
4696
  }
4653
4697
  const traceId = import_keys12.PublicKey.random().toHex();
4654
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.begin({
4698
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4655
4699
  id: traceId
4656
4700
  }), {
4657
4701
  F: __dxlog_file17,
@@ -4659,7 +4703,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4659
4703
  S: this,
4660
4704
  C: (f, a) => f(...a)
4661
4705
  });
4662
- (0, import_invariant14.invariant)(this._config, "config not set", {
4706
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4663
4707
  F: __dxlog_file17,
4664
4708
  L: 224,
4665
4709
  S: this,
@@ -4668,7 +4712,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4668
4712
  "'config not set'"
4669
4713
  ]
4670
4714
  });
4671
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4715
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4672
4716
  F: __dxlog_file17,
4673
4717
  L: 225,
4674
4718
  S: this,
@@ -4677,7 +4721,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4677
4721
  "'storage not set'"
4678
4722
  ]
4679
4723
  });
4680
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4724
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4681
4725
  F: __dxlog_file17,
4682
4726
  L: 226,
4683
4727
  S: this,
@@ -4686,7 +4730,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4686
4730
  "'signal manager not set'"
4687
4731
  ]
4688
4732
  });
4689
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4733
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4690
4734
  F: __dxlog_file17,
4691
4735
  L: 227,
4692
4736
  S: this,
@@ -4716,7 +4760,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4716
4760
  await this._serviceContext.initialized.wait();
4717
4761
  return this._serviceContext.dataSpaceManager;
4718
4762
  }),
4719
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4763
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4720
4764
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4721
4765
  LoggingService: this._loggingService,
4722
4766
  TracingService: this._tracingService,
@@ -4750,7 +4794,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4750
4794
  S: this,
4751
4795
  C: (f, a) => f(...a)
4752
4796
  });
4753
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.end({
4797
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
4754
4798
  id: traceId
4755
4799
  }), {
4756
4800
  F: __dxlog_file17,
@@ -4791,7 +4835,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4791
4835
  }
4792
4836
  async reset() {
4793
4837
  const traceId = import_keys12.PublicKey.random().toHex();
4794
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.begin({
4838
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4795
4839
  id: traceId
4796
4840
  }), {
4797
4841
  F: __dxlog_file17,
@@ -4813,7 +4857,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4813
4857
  S: this,
4814
4858
  C: (f, a) => f(...a)
4815
4859
  });
4816
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.end({
4860
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
4817
4861
  id: traceId
4818
4862
  }), {
4819
4863
  F: __dxlog_file17,
@@ -4873,7 +4917,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4873
4917
  if (hooks?.guest?.onConnecting?.(guestObservable)) {
4874
4918
  break;
4875
4919
  }
4876
- (0, import_invariant15.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4920
+ (0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4877
4921
  F: __dxlog_file18,
4878
4922
  L: 84,
4879
4923
  S: void 0,
@@ -5006,7 +5050,7 @@ var createInvitation = (host, options) => {
5006
5050
  });
5007
5051
  return host.invitations.createInvitation(hostHandler, options);
5008
5052
  }
5009
- return host.createInvitation(options);
5053
+ return host.share(options);
5010
5054
  };
5011
5055
  var acceptInvitation = (guest, invitation) => {
5012
5056
  invitation = sanitizeInvitation(invitation);
@@ -5016,14 +5060,14 @@ var acceptInvitation = (guest, invitation) => {
5016
5060
  });
5017
5061
  return guest.invitations.acceptInvitation(guestHandler, invitation);
5018
5062
  }
5019
- return guest.acceptInvitation(invitation);
5063
+ return guest.join(invitation);
5020
5064
  };
5021
5065
 
5022
5066
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
5023
5067
  var import_context11 = require("@dxos/context");
5024
5068
  var import_credentials16 = require("@dxos/credentials");
5025
5069
  var import_debug8 = require("@dxos/debug");
5026
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
5070
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
5027
5071
  var import_testing = require("@dxos/echo-pipeline/testing");
5028
5072
  var import_feed_store5 = require("@dxos/feed-store");
5029
5073
  var import_keyring2 = require("@dxos/keyring");
@@ -5106,19 +5150,19 @@ var TestPeer = class {
5106
5150
  root: this.storage.createDirectory("feeds"),
5107
5151
  signer: this.keyring,
5108
5152
  hypercore: {
5109
- valueEncoding: import_echo_pipeline5.valueEncoding
5153
+ valueEncoding: import_echo_pipeline4.valueEncoding
5110
5154
  }
5111
5155
  })
5112
5156
  });
5113
5157
  }
5114
5158
  get metadataStore() {
5115
- return this._props.metadataStore ??= new import_echo_pipeline5.MetadataStore(this.storage.createDirectory("metadata"));
5159
+ return this._props.metadataStore ??= new import_echo_pipeline4.MetadataStore(this.storage.createDirectory("metadata"));
5116
5160
  }
5117
5161
  get blobStore() {
5118
5162
  return this._props.blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
5119
5163
  }
5120
5164
  get snapshotStore() {
5121
- return this._props.snapshotStore ??= new import_echo_pipeline5.SnapshotStore(this.storage.createDirectory("snapshots"));
5165
+ return this._props.snapshotStore ??= new import_echo_pipeline4.SnapshotStore(this.storage.createDirectory("snapshots"));
5122
5166
  }
5123
5167
  get networkManager() {
5124
5168
  return this._props.networkManager ??= new import_network_manager3.NetworkManager({
@@ -5127,7 +5171,7 @@ var TestPeer = class {
5127
5171
  });
5128
5172
  }
5129
5173
  get spaceManager() {
5130
- return this._props.spaceManager ??= new import_echo_pipeline5.SpaceManager({
5174
+ return this._props.spaceManager ??= new import_echo_pipeline4.SpaceManager({
5131
5175
  feedStore: this.feedStore,
5132
5176
  networkManager: this.networkManager,
5133
5177
  metadataStore: this.metadataStore,
@@ -5140,7 +5184,7 @@ var TestPeer = class {
5140
5184
  return this._props.signingContext ?? (0, import_debug8.failUndefined)();
5141
5185
  }
5142
5186
  get dataSpaceManager() {
5143
- return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline5.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
5187
+ return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline4.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
5144
5188
  }
5145
5189
  async createIdentity() {
5146
5190
  this._props.signingContext ??= await createSigningContext(this.keyring);