@dxos/client-services 0.1.58-main.e4cedde → 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-FIKNAQOZ.mjs → chunk-L426VUEE.mjs} +144 -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 +190 -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 +189 -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 +8 -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-FIKNAQOZ.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.e4cedde";
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
  });
@@ -2690,7 +2688,7 @@ var DataSpace = class DataSpace2 {
2690
2688
  state: import_services7.SpaceState[this._state]
2691
2689
  }, {
2692
2690
  F: __dxlog_file12,
2693
- L: 159,
2691
+ L: 165,
2694
2692
  S: this,
2695
2693
  C: (f, a) => f(...a)
2696
2694
  });
@@ -2708,7 +2706,7 @@ var DataSpace = class DataSpace2 {
2708
2706
  state: import_services7.SpaceState[this._state]
2709
2707
  }, {
2710
2708
  F: __dxlog_file12,
2711
- L: 173,
2709
+ L: 179,
2712
2710
  S: this,
2713
2711
  C: (f, a) => f(...a)
2714
2712
  });
@@ -2736,10 +2734,10 @@ var DataSpace = class DataSpace2 {
2736
2734
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
2737
2735
  await this.initializeDataPipeline();
2738
2736
  } catch (err) {
2739
- if (err instanceof import_errors3.CancelledError) {
2737
+ if (err instanceof import_protocols7.CancelledError) {
2740
2738
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
2741
2739
  F: __dxlog_file12,
2742
- L: 205,
2740
+ L: 211,
2743
2741
  S: this,
2744
2742
  C: (f, a) => f(...a)
2745
2743
  });
@@ -2747,7 +2745,7 @@ var DataSpace = class DataSpace2 {
2747
2745
  }
2748
2746
  import_log10.log.error("Error initializing data pipeline", err, {
2749
2747
  F: __dxlog_file12,
2750
- L: 209,
2748
+ L: 215,
2751
2749
  S: this,
2752
2750
  C: (f, a) => f(...a)
2753
2751
  });
@@ -2756,7 +2754,7 @@ var DataSpace = class DataSpace2 {
2756
2754
  state: import_services7.SpaceState[this._state]
2757
2755
  }, {
2758
2756
  F: __dxlog_file12,
2759
- L: 211,
2757
+ L: 217,
2760
2758
  S: this,
2761
2759
  C: (f, a) => f(...a)
2762
2760
  });
@@ -2769,14 +2767,14 @@ var DataSpace = class DataSpace2 {
2769
2767
  }
2770
2768
  async initializeDataPipeline() {
2771
2769
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
2772
- throw new import_errors3.SystemError("Invalid operation");
2770
+ throw new import_protocols7.SystemError("Invalid operation");
2773
2771
  }
2774
2772
  this._state = import_services7.SpaceState.INITIALIZING;
2775
2773
  (0, import_log10.log)("new state", {
2776
2774
  state: import_services7.SpaceState[this._state]
2777
2775
  }, {
2778
2776
  F: __dxlog_file12,
2779
- L: 227,
2777
+ L: 233,
2780
2778
  S: this,
2781
2779
  C: (f, a) => f(...a)
2782
2780
  });
@@ -2787,7 +2785,7 @@ var DataSpace = class DataSpace2 {
2787
2785
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2788
2786
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
2789
2787
  F: __dxlog_file12,
2790
- L: 241,
2788
+ L: 247,
2791
2789
  S: this,
2792
2790
  C: (f, a) => f(...a)
2793
2791
  });
@@ -2798,7 +2796,7 @@ var DataSpace = class DataSpace2 {
2798
2796
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
2799
2797
  (0, import_log10.log)("data pipeline ready", void 0, {
2800
2798
  F: __dxlog_file12,
2801
- L: 250,
2799
+ L: 256,
2802
2800
  S: this,
2803
2801
  C: (f, a) => f(...a)
2804
2802
  });
@@ -2808,7 +2806,7 @@ var DataSpace = class DataSpace2 {
2808
2806
  state: import_services7.SpaceState[this._state]
2809
2807
  }, {
2810
2808
  F: __dxlog_file12,
2811
- L: 254,
2809
+ L: 260,
2812
2810
  S: this,
2813
2811
  C: (f, a) => f(...a)
2814
2812
  });
@@ -2824,7 +2822,7 @@ var DataSpace = class DataSpace2 {
2824
2822
  await this._createWritableFeeds();
2825
2823
  (0, import_log10.log)("writable feeds created", void 0, {
2826
2824
  F: __dxlog_file12,
2827
- L: 270,
2825
+ L: 276,
2828
2826
  S: this,
2829
2827
  C: (f, a) => f(...a)
2830
2828
  });
@@ -2929,7 +2927,7 @@ var DataSpace = class DataSpace2 {
2929
2927
  state: import_services7.SpaceState[this._state]
2930
2928
  }, {
2931
2929
  F: __dxlog_file12,
2932
- L: 386,
2930
+ L: 392,
2933
2931
  S: this,
2934
2932
  C: (f, a) => f(...a)
2935
2933
  });
@@ -3071,7 +3069,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3071
3069
  S: this,
3072
3070
  C: (f, a) => f(...a)
3073
3071
  });
3074
- 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({
3075
3073
  id: this._instanceId
3076
3074
  }), {
3077
3075
  F: __dxlog_file13,
@@ -3117,7 +3115,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3117
3115
  space.initializeDataPipelineAsync();
3118
3116
  }
3119
3117
  }
3120
- 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({
3121
3119
  id: this._instanceId
3122
3120
  }), {
3123
3121
  F: __dxlog_file13,
@@ -3371,10 +3369,9 @@ DataSpaceManager = _ts_decorate4([
3371
3369
  var import_async10 = require("@dxos/async");
3372
3370
  var import_codec_protobuf5 = require("@dxos/codec-protobuf");
3373
3371
  var import_debug6 = require("@dxos/debug");
3374
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3375
- var import_errors4 = require("@dxos/errors");
3372
+ var import_invariant12 = require("@dxos/invariant");
3376
3373
  var import_log12 = require("@dxos/log");
3377
- var import_protocols8 = require("@dxos/protocols");
3374
+ var import_protocols9 = require("@dxos/protocols");
3378
3375
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3379
3376
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3380
3377
  var SpacesServiceImpl = class {
@@ -3394,7 +3391,7 @@ var SpacesServiceImpl = class {
3394
3391
  }
3395
3392
  async updateSpace({ spaceKey, state }) {
3396
3393
  const dataSpaceManager = await this._getDataSpaceManager();
3397
- 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));
3398
3395
  if (state) {
3399
3396
  switch (state) {
3400
3397
  case import_services9.SpaceState.ACTIVE:
@@ -3404,7 +3401,7 @@ var SpacesServiceImpl = class {
3404
3401
  await space.deactivate();
3405
3402
  break;
3406
3403
  default:
3407
- throw new import_errors4.ApiError("Invalid space state");
3404
+ throw new import_protocols9.ApiError("Invalid space state");
3408
3405
  }
3409
3406
  }
3410
3407
  }
@@ -3459,14 +3456,14 @@ var SpacesServiceImpl = class {
3459
3456
  }
3460
3457
  async postMessage({ spaceKey, channel, message }) {
3461
3458
  const dataSpaceManager = await this._getDataSpaceManager();
3462
- 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));
3463
3460
  await space.postMessage(getChannelId(channel), message);
3464
3461
  }
3465
3462
  subscribeMessages({ spaceKey, channel }) {
3466
3463
  return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3467
3464
  (0, import_async10.scheduleTask)(ctx, async () => {
3468
3465
  const dataSpaceManager = await this._getDataSpaceManager();
3469
- 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));
3470
3467
  const handle = space.listen(getChannelId(channel), (message) => {
3471
3468
  next(message);
3472
3469
  });
@@ -3474,38 +3471,83 @@ var SpacesServiceImpl = class {
3474
3471
  });
3475
3472
  });
3476
3473
  }
3477
- queryCredentials({ spaceKey }) {
3478
- return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3479
- 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));
3480
3477
  const processor = {
3481
3478
  processCredential: async (credential) => {
3482
3479
  next(credential);
3483
3480
  }
3484
3481
  };
3485
3482
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3486
- (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
+ });
3487
3489
  });
3488
3490
  }
3489
3491
  async writeCredentials({ spaceKey, credentials }) {
3490
- 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));
3491
3493
  for (const credential of credentials ?? []) {
3492
- await space.controlPipeline.writer.write({
3493
- credential: {
3494
- credential
3495
- }
3496
- });
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
+ }
3497
3539
  }
3498
3540
  }
3499
3541
  async createEpoch({ spaceKey }) {
3500
3542
  const dataSpaceManager = await this._getDataSpaceManager();
3501
- 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));
3502
3544
  await space.createEpoch();
3503
3545
  }
3504
3546
  _serializeSpace(space) {
3505
3547
  return {
3506
3548
  spaceKey: space.key,
3507
3549
  state: space.state,
3508
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3550
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3509
3551
  pipeline: {
3510
3552
  currentEpoch: space.dataPipeline.currentEpoch,
3511
3553
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3532,7 +3574,7 @@ var SpacesServiceImpl = class {
3532
3574
  displayName: member.assertion.profile?.displayName
3533
3575
  }
3534
3576
  },
3535
- 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,
3536
3578
  peerStates: peers
3537
3579
  };
3538
3580
  }),
@@ -3564,11 +3606,11 @@ var ServiceContext = class ServiceContext2 {
3564
3606
  this.signalManager = signalManager;
3565
3607
  this.modelFactory = modelFactory;
3566
3608
  this.initialized = new import_async11.Trigger();
3567
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3609
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3568
3610
  this._handlerFactories = /* @__PURE__ */ new Map();
3569
3611
  this._instanceId = import_keys8.PublicKey.random().toHex();
3570
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3571
- 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"));
3572
3614
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3573
3615
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3574
3616
  this.feedStore = new import_feed_store3.FeedStore({
@@ -3576,12 +3618,12 @@ var ServiceContext = class ServiceContext2 {
3576
3618
  root: storage.createDirectory("feeds"),
3577
3619
  signer: this.keyring,
3578
3620
  hypercore: {
3579
- valueEncoding: import_echo_pipeline3.valueEncoding,
3621
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3580
3622
  stats: true
3581
3623
  }
3582
3624
  })
3583
3625
  });
3584
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
3626
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3585
3627
  feedStore: this.feedStore,
3586
3628
  networkManager: this.networkManager,
3587
3629
  blobStore: this.blobStore,
@@ -3601,7 +3643,7 @@ var ServiceContext = class ServiceContext2 {
3601
3643
  S: this,
3602
3644
  C: (f, a) => f(...a)
3603
3645
  });
3604
- 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({
3605
3647
  id: this._instanceId
3606
3648
  }), {
3607
3649
  F: __dxlog_file15,
@@ -3617,7 +3659,7 @@ var ServiceContext = class ServiceContext2 {
3617
3659
  if (this.identityManager.identity) {
3618
3660
  await this._initialize(ctx);
3619
3661
  }
3620
- 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({
3621
3663
  id: this._instanceId
3622
3664
  }), {
3623
3665
  F: __dxlog_file15,
@@ -3664,7 +3706,7 @@ var ServiceContext = class ServiceContext2 {
3664
3706
  }
3665
3707
  getInvitationHandler(invitation) {
3666
3708
  const factory = this._handlerFactories.get(invitation.kind);
3667
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3709
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3668
3710
  F: __dxlog_file15,
3669
3711
  L: 174,
3670
3712
  S: this,
@@ -3682,8 +3724,8 @@ var ServiceContext = class ServiceContext2 {
3682
3724
  }
3683
3725
  async _checkStorageVersion() {
3684
3726
  await this.metadataStore.load();
3685
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
3686
- 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);
3687
3729
  }
3688
3730
  }
3689
3731
  // Called when identity is created.
@@ -3711,7 +3753,7 @@ var ServiceContext = class ServiceContext2 {
3711
3753
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3712
3754
  await this.dataSpaceManager.open();
3713
3755
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3714
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3756
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3715
3757
  F: __dxlog_file15,
3716
3758
  L: 218,
3717
3759
  S: this,
@@ -3796,14 +3838,14 @@ var import_async17 = require("@dxos/async");
3796
3838
  var import_client_protocol5 = require("@dxos/client-protocol");
3797
3839
  var import_context10 = require("@dxos/context");
3798
3840
  var import_document_model2 = require("@dxos/document-model");
3799
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3800
- var import_invariant14 = require("@dxos/invariant");
3841
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3842
+ var import_invariant15 = require("@dxos/invariant");
3801
3843
  var import_keys12 = require("@dxos/keys");
3802
3844
  var import_log16 = require("@dxos/log");
3803
3845
  var import_messaging = require("@dxos/messaging");
3804
3846
  var import_model_factory = require("@dxos/model-factory");
3805
3847
  var import_network_manager2 = require("@dxos/network-manager");
3806
- var import_protocols10 = require("@dxos/protocols");
3848
+ var import_protocols12 = require("@dxos/protocols");
3807
3849
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3808
3850
  var import_text_model = require("@dxos/text-model");
3809
3851
  var import_tracing5 = require("@dxos/tracing");
@@ -4161,7 +4203,7 @@ var DevtoolsServiceImpl = class {
4161
4203
  };
4162
4204
 
4163
4205
  // packages/sdk/client-services/src/packlets/locks/node.ts
4164
- var import_invariant13 = require("@dxos/invariant");
4206
+ var import_invariant14 = require("@dxos/invariant");
4165
4207
  var import_lock_file = require("@dxos/lock-file");
4166
4208
  var import_log14 = require("@dxos/log");
4167
4209
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4202,7 +4244,7 @@ var Lock = class {
4202
4244
  }
4203
4245
  async release() {
4204
4246
  await this._onRelease?.();
4205
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4247
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4206
4248
  F: __dxlog_file16,
4207
4249
  L: 42,
4208
4250
  S: this,
@@ -4369,7 +4411,7 @@ var NetworkServiceImpl = class {
4369
4411
 
4370
4412
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4371
4413
  var import_client_protocol4 = require("@dxos/client-protocol");
4372
- var import_errors5 = require("@dxos/errors");
4414
+ var import_protocols11 = require("@dxos/protocols");
4373
4415
  var import_config = require("@dxos/protocols/proto/dxos/config");
4374
4416
  var import_random_access_storage = require("@dxos/random-access-storage");
4375
4417
  var import_util8 = require("@dxos/util");
@@ -4377,16 +4419,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4377
4419
  var createStorageObjects = (config) => {
4378
4420
  const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4379
4421
  if (persistent && storageType === StorageDriver.RAM) {
4380
- 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.");
4381
4423
  }
4382
4424
  if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4383
- 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.");
4384
4426
  }
4385
4427
  if (persistent && keyStorage === StorageDriver.RAM) {
4386
- 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.");
4387
4429
  }
4388
4430
  if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4389
- 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.");
4390
4432
  }
4391
4433
  return {
4392
4434
  storage: (0, import_random_access_storage.createStorage)({
@@ -4593,7 +4635,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4593
4635
  * Can only be called once.
4594
4636
  */
4595
4637
  initialize({ config, ...options }) {
4596
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4638
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4597
4639
  F: __dxlog_file17,
4598
4640
  L: 184,
4599
4641
  S: this,
@@ -4609,7 +4651,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4609
4651
  C: (f, a) => f(...a)
4610
4652
  });
4611
4653
  if (config) {
4612
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4654
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4613
4655
  F: __dxlog_file17,
4614
4656
  L: 188,
4615
4657
  S: this,
@@ -4627,7 +4669,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4627
4669
  iceServers: this._config?.get("runtime.services.ice")
4628
4670
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4629
4671
  this._signalManager = signalManager;
4630
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4672
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4631
4673
  F: __dxlog_file17,
4632
4674
  L: 204,
4633
4675
  S: this,
@@ -4653,7 +4695,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4653
4695
  return;
4654
4696
  }
4655
4697
  const traceId = import_keys12.PublicKey.random().toHex();
4656
- 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({
4657
4699
  id: traceId
4658
4700
  }), {
4659
4701
  F: __dxlog_file17,
@@ -4661,7 +4703,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4661
4703
  S: this,
4662
4704
  C: (f, a) => f(...a)
4663
4705
  });
4664
- (0, import_invariant14.invariant)(this._config, "config not set", {
4706
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4665
4707
  F: __dxlog_file17,
4666
4708
  L: 224,
4667
4709
  S: this,
@@ -4670,7 +4712,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4670
4712
  "'config not set'"
4671
4713
  ]
4672
4714
  });
4673
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4715
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4674
4716
  F: __dxlog_file17,
4675
4717
  L: 225,
4676
4718
  S: this,
@@ -4679,7 +4721,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4679
4721
  "'storage not set'"
4680
4722
  ]
4681
4723
  });
4682
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4724
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4683
4725
  F: __dxlog_file17,
4684
4726
  L: 226,
4685
4727
  S: this,
@@ -4688,7 +4730,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4688
4730
  "'signal manager not set'"
4689
4731
  ]
4690
4732
  });
4691
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4733
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4692
4734
  F: __dxlog_file17,
4693
4735
  L: 227,
4694
4736
  S: this,
@@ -4718,7 +4760,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4718
4760
  await this._serviceContext.initialized.wait();
4719
4761
  return this._serviceContext.dataSpaceManager;
4720
4762
  }),
4721
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4763
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4722
4764
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4723
4765
  LoggingService: this._loggingService,
4724
4766
  TracingService: this._tracingService,
@@ -4752,7 +4794,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4752
4794
  S: this,
4753
4795
  C: (f, a) => f(...a)
4754
4796
  });
4755
- 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({
4756
4798
  id: traceId
4757
4799
  }), {
4758
4800
  F: __dxlog_file17,
@@ -4793,7 +4835,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4793
4835
  }
4794
4836
  async reset() {
4795
4837
  const traceId = import_keys12.PublicKey.random().toHex();
4796
- 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({
4797
4839
  id: traceId
4798
4840
  }), {
4799
4841
  F: __dxlog_file17,
@@ -4815,7 +4857,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4815
4857
  S: this,
4816
4858
  C: (f, a) => f(...a)
4817
4859
  });
4818
- 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({
4819
4861
  id: traceId
4820
4862
  }), {
4821
4863
  F: __dxlog_file17,
@@ -4875,7 +4917,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4875
4917
  if (hooks?.guest?.onConnecting?.(guestObservable)) {
4876
4918
  break;
4877
4919
  }
4878
- (0, import_invariant15.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4920
+ (0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4879
4921
  F: __dxlog_file18,
4880
4922
  L: 84,
4881
4923
  S: void 0,
@@ -5008,7 +5050,7 @@ var createInvitation = (host, options) => {
5008
5050
  });
5009
5051
  return host.invitations.createInvitation(hostHandler, options);
5010
5052
  }
5011
- return host.createInvitation(options);
5053
+ return host.share(options);
5012
5054
  };
5013
5055
  var acceptInvitation = (guest, invitation) => {
5014
5056
  invitation = sanitizeInvitation(invitation);
@@ -5018,14 +5060,14 @@ var acceptInvitation = (guest, invitation) => {
5018
5060
  });
5019
5061
  return guest.invitations.acceptInvitation(guestHandler, invitation);
5020
5062
  }
5021
- return guest.acceptInvitation(invitation);
5063
+ return guest.join(invitation);
5022
5064
  };
5023
5065
 
5024
5066
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
5025
5067
  var import_context11 = require("@dxos/context");
5026
5068
  var import_credentials16 = require("@dxos/credentials");
5027
5069
  var import_debug8 = require("@dxos/debug");
5028
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
5070
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
5029
5071
  var import_testing = require("@dxos/echo-pipeline/testing");
5030
5072
  var import_feed_store5 = require("@dxos/feed-store");
5031
5073
  var import_keyring2 = require("@dxos/keyring");
@@ -5108,19 +5150,19 @@ var TestPeer = class {
5108
5150
  root: this.storage.createDirectory("feeds"),
5109
5151
  signer: this.keyring,
5110
5152
  hypercore: {
5111
- valueEncoding: import_echo_pipeline5.valueEncoding
5153
+ valueEncoding: import_echo_pipeline4.valueEncoding
5112
5154
  }
5113
5155
  })
5114
5156
  });
5115
5157
  }
5116
5158
  get metadataStore() {
5117
- 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"));
5118
5160
  }
5119
5161
  get blobStore() {
5120
5162
  return this._props.blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
5121
5163
  }
5122
5164
  get snapshotStore() {
5123
- 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"));
5124
5166
  }
5125
5167
  get networkManager() {
5126
5168
  return this._props.networkManager ??= new import_network_manager3.NetworkManager({
@@ -5129,7 +5171,7 @@ var TestPeer = class {
5129
5171
  });
5130
5172
  }
5131
5173
  get spaceManager() {
5132
- return this._props.spaceManager ??= new import_echo_pipeline5.SpaceManager({
5174
+ return this._props.spaceManager ??= new import_echo_pipeline4.SpaceManager({
5133
5175
  feedStore: this.feedStore,
5134
5176
  networkManager: this.networkManager,
5135
5177
  metadataStore: this.metadataStore,
@@ -5142,7 +5184,7 @@ var TestPeer = class {
5142
5184
  return this._props.signingContext ?? (0, import_debug8.failUndefined)();
5143
5185
  }
5144
5186
  get dataSpaceManager() {
5145
- 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);
5146
5188
  }
5147
5189
  async createIdentity() {
5148
5190
  this._props.signingContext ??= await createSigningContext(this.keyring);