@dxos/client-services 0.1.58-main.b605d47 → 0.1.58-main.ba8fa9e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/lib/browser/{chunk-GRLE5OOK.mjs → chunk-XT2TMICH.mjs} +271 -193
  2. package/dist/lib/browser/chunk-XT2TMICH.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11 -11
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +5 -5
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +313 -235
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +310 -232
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  15. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
  16. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
  19. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  20. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
  22. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  24. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  25. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  26. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  28. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
  29. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  30. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
  31. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  32. package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
  33. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  34. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  35. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  36. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  37. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
  38. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  39. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  40. package/dist/types/src/version.d.ts +1 -1
  41. package/package.json +35 -35
  42. package/src/packlets/devices/devices-service.test.ts +1 -1
  43. package/src/packlets/devtools/devtools.ts +1 -1
  44. package/src/packlets/identity/authenticator.ts +2 -5
  45. package/src/packlets/identity/identity-manager.test.ts +1 -1
  46. package/src/packlets/identity/identity-service.test.ts +1 -1
  47. package/src/packlets/identity/identity.test.ts +1 -1
  48. package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
  49. package/src/packlets/invitations/invitation-extension.ts +1 -2
  50. package/src/packlets/invitations/invitations-handler.ts +7 -8
  51. package/src/packlets/invitations/invitations-service.ts +11 -7
  52. package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
  53. package/src/packlets/network/network-service.test.ts +1 -1
  54. package/src/packlets/services/diagnostics.ts +2 -2
  55. package/src/packlets/services/service-context.ts +7 -13
  56. package/src/packlets/services/service-host.test.ts +3 -3
  57. package/src/packlets/services/service-host.ts +42 -6
  58. package/src/packlets/services/service-registry.test.ts +1 -1
  59. package/src/packlets/spaces/data-space-manager.test.ts +1 -1
  60. package/src/packlets/spaces/data-space-manager.ts +1 -1
  61. package/src/packlets/spaces/data-space.ts +11 -3
  62. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  63. package/src/packlets/spaces/spaces-service.ts +31 -10
  64. package/src/packlets/storage/storage.ts +10 -10
  65. package/src/packlets/testing/invitation-utils.ts +9 -9
  66. package/src/packlets/testing/test-builder.ts +3 -3
  67. package/src/packlets/vault/iframe-host-runtime.ts +1 -1
  68. package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
  69. package/src/packlets/vault/shell-runtime.ts +4 -4
  70. package/src/packlets/vault/worker-runtime.ts +9 -6
  71. package/src/version.ts +1 -1
  72. package/dist/lib/browser/chunk-GRLE5OOK.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
@@ -70,9 +70,6 @@ var import_log = require("@dxos/log");
70
70
  var import_protocols = require("@dxos/protocols");
71
71
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
72
72
 
73
- // packages/sdk/client-services/src/version.ts
74
- var DXOS_VERSION = "0.1.58-main.b605d47";
75
-
76
73
  // packages/sdk/client-services/src/packlets/services/platform.ts
77
74
  var getPlatform = () => {
78
75
  if (process.browser) {
@@ -101,6 +98,9 @@ var getPlatform = () => {
101
98
  }
102
99
  };
103
100
 
101
+ // packages/sdk/client-services/src/version.ts
102
+ var DXOS_VERSION = "0.1.58-main.ba8fa9e";
103
+
104
104
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
105
105
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
106
106
  var DEFAULT_TIMEOUT = 1e3;
@@ -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");
@@ -255,7 +255,6 @@ var createAuthProvider = (signer) => async (nonce) => {
255
255
  return Credential.encode(credential);
256
256
  };
257
257
  var TrustedKeySetAuthVerifier = class {
258
- // prettier-ignore
259
258
  constructor(_params) {
260
259
  this._params = _params;
261
260
  this._ctx = new import_context.Context();
@@ -270,7 +269,7 @@ var TrustedKeySetAuthVerifier = class {
270
269
  credential
271
270
  }, {
272
271
  F: __dxlog_file2,
273
- L: 59,
272
+ L: 56,
274
273
  S: this,
275
274
  C: (f, a) => f(...a)
276
275
  });
@@ -280,7 +279,7 @@ var TrustedKeySetAuthVerifier = class {
280
279
  result
281
280
  }, {
282
281
  F: __dxlog_file2,
283
- L: 63,
282
+ L: 60,
284
283
  S: this,
285
284
  C: (f, a) => f(...a)
286
285
  });
@@ -292,7 +291,7 @@ var TrustedKeySetAuthVerifier = class {
292
291
  credential
293
292
  }, {
294
293
  F: __dxlog_file2,
295
- L: 68,
294
+ L: 65,
296
295
  S: this,
297
296
  C: (f, a) => f(...a)
298
297
  });
@@ -303,7 +302,7 @@ var TrustedKeySetAuthVerifier = class {
303
302
  key: credential.issuer
304
303
  }, {
305
304
  F: __dxlog_file2,
306
- L: 73,
305
+ L: 70,
307
306
  S: this,
308
307
  C: (f, a) => f(...a)
309
308
  });
@@ -319,7 +318,7 @@ var TrustedKeySetAuthVerifier = class {
319
318
  key: credential.issuer
320
319
  }, {
321
320
  F: __dxlog_file2,
322
- L: 84,
321
+ L: 81,
323
322
  S: this,
324
323
  C: (f, a) => f(...a)
325
324
  });
@@ -329,7 +328,7 @@ var TrustedKeySetAuthVerifier = class {
329
328
  key: credential.issuer
330
329
  }, {
331
330
  F: __dxlog_file2,
332
- L: 87,
331
+ L: 84,
333
332
  S: this,
334
333
  C: (f, a) => f(...a)
335
334
  });
@@ -1059,7 +1058,6 @@ var import_async5 = require("@dxos/async");
1059
1058
  var import_client_protocol2 = require("@dxos/client-protocol");
1060
1059
  var import_context4 = require("@dxos/context");
1061
1060
  var import_credentials9 = require("@dxos/credentials");
1062
- var import_errors2 = require("@dxos/errors");
1063
1061
  var import_invariant7 = require("@dxos/invariant");
1064
1062
  var import_keys4 = require("@dxos/keys");
1065
1063
  var import_log6 = require("@dxos/log");
@@ -1071,7 +1069,6 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1071
1069
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1072
1070
  var import_async4 = require("@dxos/async");
1073
1071
  var import_context3 = require("@dxos/context");
1074
- var import_errors = require("@dxos/errors");
1075
1072
  var import_invariant6 = require("@dxos/invariant");
1076
1073
  var import_keys3 = require("@dxos/keys");
1077
1074
  var import_log5 = require("@dxos/log");
@@ -1109,7 +1106,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1109
1106
  options: async (options) => {
1110
1107
  (0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
1111
1108
  F: __dxlog_file7,
1112
- L: 88,
1109
+ L: 87,
1113
1110
  S: this,
1114
1111
  A: [
1115
1112
  "!this._remoteOptions",
@@ -1126,7 +1123,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1126
1123
  id: traceId
1127
1124
  }), {
1128
1125
  F: __dxlog_file7,
1129
- L: 97,
1126
+ L: 96,
1130
1127
  S: this,
1131
1128
  C: (f, a) => f(...a)
1132
1129
  });
@@ -1136,7 +1133,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1136
1133
  invitationId
1137
1134
  }, {
1138
1135
  F: __dxlog_file7,
1139
- L: 101,
1136
+ L: 100,
1140
1137
  S: this,
1141
1138
  C: (f, a) => f(...a)
1142
1139
  });
@@ -1150,7 +1147,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1150
1147
  guestProfile: profile
1151
1148
  }, {
1152
1149
  F: __dxlog_file7,
1153
- L: 110,
1150
+ L: 109,
1154
1151
  S: this,
1155
1152
  C: (f, a) => f(...a)
1156
1153
  });
@@ -1163,7 +1160,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1163
1160
  id: traceId
1164
1161
  }), {
1165
1162
  F: __dxlog_file7,
1166
- L: 117,
1163
+ L: 116,
1167
1164
  S: this,
1168
1165
  C: (f, a) => f(...a)
1169
1166
  });
@@ -1178,7 +1175,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1178
1175
  id: traceId
1179
1176
  }), {
1180
1177
  F: __dxlog_file7,
1181
- L: 126,
1178
+ L: 125,
1182
1179
  S: this,
1183
1180
  C: (f, a) => f(...a)
1184
1181
  });
@@ -1186,14 +1183,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1186
1183
  authCode: code
1187
1184
  }, {
1188
1185
  F: __dxlog_file7,
1189
- L: 127,
1186
+ L: 126,
1190
1187
  S: this,
1191
1188
  C: (f, a) => f(...a)
1192
1189
  });
1193
1190
  let status = import_invitations.AuthenticationResponse.Status.OK;
1194
1191
  (0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
1195
1192
  F: __dxlog_file7,
1196
- L: 130,
1193
+ L: 129,
1197
1194
  S: this,
1198
1195
  A: [
1199
1196
  "this.invitation",
@@ -1204,7 +1201,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1204
1201
  case import_services3.Invitation.AuthMethod.NONE: {
1205
1202
  (0, import_log5.log)("authentication not required", void 0, {
1206
1203
  F: __dxlog_file7,
1207
- L: 133,
1204
+ L: 132,
1208
1205
  S: this,
1209
1206
  C: (f, a) => f(...a)
1210
1207
  });
@@ -1229,7 +1226,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1229
1226
  authMethod: this.invitation.authMethod
1230
1227
  }, {
1231
1228
  F: __dxlog_file7,
1232
- L: 151,
1229
+ L: 150,
1233
1230
  S: this,
1234
1231
  C: (f, a) => f(...a)
1235
1232
  });
@@ -1244,7 +1241,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1244
1241
  }
1245
1242
  }), {
1246
1243
  F: __dxlog_file7,
1247
- L: 157,
1244
+ L: 156,
1248
1245
  S: this,
1249
1246
  C: (f, a) => f(...a)
1250
1247
  });
@@ -1258,14 +1255,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1258
1255
  id: traceId
1259
1256
  }), {
1260
1257
  F: __dxlog_file7,
1261
- L: 163,
1258
+ L: 162,
1262
1259
  S: this,
1263
1260
  C: (f, a) => f(...a)
1264
1261
  });
1265
1262
  try {
1266
1263
  (0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
1267
1264
  F: __dxlog_file7,
1268
- L: 166,
1265
+ L: 165,
1269
1266
  S: this,
1270
1267
  A: [
1271
1268
  "this.invitation",
@@ -1280,7 +1277,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1280
1277
  id: traceId
1281
1278
  }), {
1282
1279
  F: __dxlog_file7,
1283
- L: 174,
1280
+ L: 173,
1284
1281
  S: this,
1285
1282
  C: (f, a) => f(...a)
1286
1283
  });
@@ -1303,7 +1300,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1303
1300
  timeout: OPTIONS_TIMEOUT
1304
1301
  }));
1305
1302
  if (this._remoteOptions?.role !== import_invitations.Options.Role.GUEST) {
1306
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1303
+ throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
1307
1304
  expected: import_invitations.Options.Role.GUEST,
1308
1305
  remoteOptions: this._remoteOptions
1309
1306
  });
@@ -1337,7 +1334,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1337
1334
  options: async (options) => {
1338
1335
  (0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
1339
1336
  F: __dxlog_file7,
1340
- L: 241,
1337
+ L: 240,
1341
1338
  S: this,
1342
1339
  A: [
1343
1340
  "!this._remoteOptions",
@@ -1364,7 +1361,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1364
1361
  try {
1365
1362
  (0, import_log5.log)("begin options", void 0, {
1366
1363
  F: __dxlog_file7,
1367
- L: 262,
1364
+ L: 261,
1368
1365
  S: this,
1369
1366
  C: (f, a) => f(...a)
1370
1367
  });
@@ -1376,12 +1373,12 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1376
1373
  }));
1377
1374
  (0, import_log5.log)("end options", void 0, {
1378
1375
  F: __dxlog_file7,
1379
- L: 265,
1376
+ L: 264,
1380
1377
  S: this,
1381
1378
  C: (f, a) => f(...a)
1382
1379
  });
1383
1380
  if (this._remoteOptions?.role !== import_invitations.Options.Role.HOST) {
1384
- throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
1381
+ throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
1385
1382
  expected: import_invitations.Options.Role.HOST,
1386
1383
  remoteOptions: this._remoteOptions
1387
1384
  });
@@ -1390,7 +1387,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1390
1387
  } catch (err) {
1391
1388
  (0, import_log5.log)("openError", err, {
1392
1389
  F: __dxlog_file7,
1393
- L: 275,
1390
+ L: 274,
1394
1391
  S: this,
1395
1392
  C: (f, a) => f(...a)
1396
1393
  });
@@ -1400,7 +1397,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1400
1397
  async onClose() {
1401
1398
  (0, import_log5.log)("onClose", void 0, {
1402
1399
  F: __dxlog_file7,
1403
- L: 281,
1400
+ L: 280,
1404
1401
  S: this,
1405
1402
  C: (f, a) => f(...a)
1406
1403
  });
@@ -1423,7 +1420,7 @@ var InvitationsHandler = class {
1423
1420
  const authCode = options?.authCode ?? (authMethod === import_services4.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1424
1421
  (0, import_invariant7.invariant)(protocol, void 0, {
1425
1422
  F: __dxlog_file8,
1426
- L: 76,
1423
+ L: 75,
1427
1424
  S: this,
1428
1425
  A: [
1429
1426
  "protocol",
@@ -1452,7 +1449,7 @@ var InvitationsHandler = class {
1452
1449
  ...protocol.toJSON()
1453
1450
  }, {
1454
1451
  F: __dxlog_file8,
1455
- L: 98,
1452
+ L: 97,
1456
1453
  S: this,
1457
1454
  C: (f, a) => f(...a)
1458
1455
  });
@@ -1477,7 +1474,7 @@ var InvitationsHandler = class {
1477
1474
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1478
1475
  (0, import_invariant7.invariant)(deviceKey, void 0, {
1479
1476
  F: __dxlog_file8,
1480
- L: 119,
1477
+ L: 118,
1481
1478
  S: this,
1482
1479
  A: [
1483
1480
  "deviceKey",
@@ -1500,7 +1497,7 @@ var InvitationsHandler = class {
1500
1497
  id: traceId
1501
1498
  }), {
1502
1499
  F: __dxlog_file8,
1503
- L: 137,
1500
+ L: 136,
1504
1501
  S: this,
1505
1502
  C: (f, a) => f(...a)
1506
1503
  });
@@ -1508,7 +1505,7 @@ var InvitationsHandler = class {
1508
1505
  ...protocol.toJSON()
1509
1506
  }, {
1510
1507
  F: __dxlog_file8,
1511
- L: 138,
1508
+ L: 137,
1512
1509
  S: this,
1513
1510
  C: (f, a) => f(...a)
1514
1511
  });
@@ -1524,7 +1521,7 @@ var InvitationsHandler = class {
1524
1521
  ...protocol.toJSON()
1525
1522
  }, {
1526
1523
  F: __dxlog_file8,
1527
- L: 141,
1524
+ L: 140,
1528
1525
  S: this,
1529
1526
  C: (f, a) => f(...a)
1530
1527
  });
@@ -1536,7 +1533,7 @@ var InvitationsHandler = class {
1536
1533
  id: traceId
1537
1534
  }), {
1538
1535
  F: __dxlog_file8,
1539
- L: 143,
1536
+ L: 142,
1540
1537
  S: this,
1541
1538
  C: (f, a) => f(...a)
1542
1539
  });
@@ -1546,7 +1543,7 @@ var InvitationsHandler = class {
1546
1543
  ...protocol.toJSON()
1547
1544
  }, {
1548
1545
  F: __dxlog_file8,
1549
- L: 146,
1546
+ L: 145,
1550
1547
  S: this,
1551
1548
  C: (f, a) => f(...a)
1552
1549
  });
@@ -1557,7 +1554,7 @@ var InvitationsHandler = class {
1557
1554
  } else {
1558
1555
  import_log6.log.error("failed", err, {
1559
1556
  F: __dxlog_file8,
1560
- L: 149,
1557
+ L: 148,
1561
1558
  S: this,
1562
1559
  C: (f, a) => f(...a)
1563
1560
  });
@@ -1568,7 +1565,7 @@ var InvitationsHandler = class {
1568
1565
  error: err
1569
1566
  }), {
1570
1567
  F: __dxlog_file8,
1571
- L: 152,
1568
+ L: 151,
1572
1569
  S: this,
1573
1570
  C: (f, a) => f(...a)
1574
1571
  });
@@ -1581,7 +1578,7 @@ var InvitationsHandler = class {
1581
1578
  });
1582
1579
  },
1583
1580
  onError: (err) => {
1584
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1581
+ if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
1585
1582
  return;
1586
1583
  }
1587
1584
  if (err instanceof import_async5.TimeoutError) {
@@ -1589,7 +1586,7 @@ var InvitationsHandler = class {
1589
1586
  ...protocol.toJSON()
1590
1587
  }, {
1591
1588
  F: __dxlog_file8,
1592
- L: 167,
1589
+ L: 166,
1593
1590
  S: this,
1594
1591
  C: (f, a) => f(...a)
1595
1592
  });
@@ -1600,7 +1597,7 @@ var InvitationsHandler = class {
1600
1597
  } else {
1601
1598
  import_log6.log.error("failed", err, {
1602
1599
  F: __dxlog_file8,
1603
- L: 170,
1600
+ L: 169,
1604
1601
  S: this,
1605
1602
  C: (f, a) => f(...a)
1606
1603
  });
@@ -1628,7 +1625,7 @@ var InvitationsHandler = class {
1628
1625
  state: import_services4.Invitation.State.CONNECTING
1629
1626
  });
1630
1627
  });
1631
- const observable = new import_client_protocol2.CancellableInvitationObservable({
1628
+ const observable = new import_client_protocol2.CancellableInvitation({
1632
1629
  initialInvitation: invitation,
1633
1630
  subscriber: stream.observable,
1634
1631
  onCancel: async () => {
@@ -1645,7 +1642,7 @@ var InvitationsHandler = class {
1645
1642
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1646
1643
  (0, import_invariant7.invariant)(protocol, void 0, {
1647
1644
  F: __dxlog_file8,
1648
- L: 211,
1645
+ L: 210,
1649
1646
  S: this,
1650
1647
  A: [
1651
1648
  "protocol",
@@ -1659,7 +1656,7 @@ var InvitationsHandler = class {
1659
1656
  const setState = (newData) => {
1660
1657
  (0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
1661
1658
  F: __dxlog_file8,
1662
- L: 222,
1659
+ L: 221,
1663
1660
  S: this,
1664
1661
  A: [
1665
1662
  "newData.state !== undefined",
@@ -1679,7 +1676,7 @@ var InvitationsHandler = class {
1679
1676
  ...protocol.toJSON()
1680
1677
  }, {
1681
1678
  F: __dxlog_file8,
1682
- L: 230,
1679
+ L: 229,
1683
1680
  S: this,
1684
1681
  C: (f, a) => f(...a)
1685
1682
  });
@@ -1689,7 +1686,7 @@ var InvitationsHandler = class {
1689
1686
  } else {
1690
1687
  import_log6.log.warn("auth failed", err, {
1691
1688
  F: __dxlog_file8,
1692
- L: 233,
1689
+ L: 232,
1693
1690
  S: this,
1694
1691
  C: (f, a) => f(...a)
1695
1692
  });
@@ -1703,7 +1700,7 @@ var InvitationsHandler = class {
1703
1700
  ...protocol.toJSON()
1704
1701
  }, {
1705
1702
  F: __dxlog_file8,
1706
- L: 241,
1703
+ L: 240,
1707
1704
  S: this,
1708
1705
  C: (f, a) => f(...a)
1709
1706
  });
@@ -1718,7 +1715,7 @@ var InvitationsHandler = class {
1718
1715
  currentState
1719
1716
  }, {
1720
1717
  F: __dxlog_file8,
1721
- L: 251,
1718
+ L: 250,
1722
1719
  S: this,
1723
1720
  C: (f, a) => f(...a)
1724
1721
  });
@@ -1733,7 +1730,7 @@ var InvitationsHandler = class {
1733
1730
  id: traceId
1734
1731
  }), {
1735
1732
  F: __dxlog_file8,
1736
- L: 260,
1733
+ L: 259,
1737
1734
  S: this,
1738
1735
  C: (f, a) => f(...a)
1739
1736
  });
@@ -1745,7 +1742,7 @@ var InvitationsHandler = class {
1745
1742
  ...protocol.toJSON()
1746
1743
  }, {
1747
1744
  F: __dxlog_file8,
1748
- L: 268,
1745
+ L: 267,
1749
1746
  S: this,
1750
1747
  C: (f, a) => f(...a)
1751
1748
  });
@@ -1756,7 +1753,7 @@ var InvitationsHandler = class {
1756
1753
  ...protocol.toJSON()
1757
1754
  }, {
1758
1755
  F: __dxlog_file8,
1759
- L: 272,
1756
+ L: 271,
1760
1757
  S: this,
1761
1758
  C: (f, a) => f(...a)
1762
1759
  });
@@ -1766,7 +1763,7 @@ var InvitationsHandler = class {
1766
1763
  response: introductionResponse
1767
1764
  }, {
1768
1765
  F: __dxlog_file8,
1769
- L: 276,
1766
+ L: 275,
1770
1767
  S: this,
1771
1768
  C: (f, a) => f(...a)
1772
1769
  });
@@ -1778,7 +1775,7 @@ var InvitationsHandler = class {
1778
1775
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1779
1776
  (0, import_log6.log)("guest waiting for authentication code...", void 0, {
1780
1777
  F: __dxlog_file8,
1781
- L: 285,
1778
+ L: 284,
1782
1779
  S: this,
1783
1780
  C: (f, a) => f(...a)
1784
1781
  });
@@ -1790,7 +1787,7 @@ var InvitationsHandler = class {
1790
1787
  });
1791
1788
  (0, import_log6.log)("sending authentication request", void 0, {
1792
1789
  F: __dxlog_file8,
1793
- L: 289,
1790
+ L: 288,
1794
1791
  S: this,
1795
1792
  C: (f, a) => f(...a)
1796
1793
  });
@@ -1811,7 +1808,7 @@ var InvitationsHandler = class {
1811
1808
  attempt
1812
1809
  }, {
1813
1810
  F: __dxlog_file8,
1814
- L: 300,
1811
+ L: 299,
1815
1812
  S: this,
1816
1813
  C: (f, a) => f(...a)
1817
1814
  });
@@ -1828,7 +1825,7 @@ var InvitationsHandler = class {
1828
1825
  ...protocol.toJSON()
1829
1826
  }, {
1830
1827
  F: __dxlog_file8,
1831
- L: 311,
1828
+ L: 310,
1832
1829
  S: this,
1833
1830
  C: (f, a) => f(...a)
1834
1831
  });
@@ -1840,7 +1837,7 @@ var InvitationsHandler = class {
1840
1837
  ...protocol.toJSON()
1841
1838
  }, {
1842
1839
  F: __dxlog_file8,
1843
- L: 322,
1840
+ L: 321,
1844
1841
  S: this,
1845
1842
  C: (f, a) => f(...a)
1846
1843
  });
@@ -1852,7 +1849,7 @@ var InvitationsHandler = class {
1852
1849
  id: traceId
1853
1850
  }), {
1854
1851
  F: __dxlog_file8,
1855
- L: 324,
1852
+ L: 323,
1856
1853
  S: this,
1857
1854
  C: (f, a) => f(...a)
1858
1855
  });
@@ -1862,7 +1859,7 @@ var InvitationsHandler = class {
1862
1859
  ...protocol.toJSON()
1863
1860
  }, {
1864
1861
  F: __dxlog_file8,
1865
- L: 327,
1862
+ L: 326,
1866
1863
  S: this,
1867
1864
  C: (f, a) => f(...a)
1868
1865
  });
@@ -1872,7 +1869,7 @@ var InvitationsHandler = class {
1872
1869
  } else {
1873
1870
  (0, import_log6.log)("auth failed", err, {
1874
1871
  F: __dxlog_file8,
1875
- L: 330,
1872
+ L: 329,
1876
1873
  S: this,
1877
1874
  C: (f, a) => f(...a)
1878
1875
  });
@@ -1883,7 +1880,7 @@ var InvitationsHandler = class {
1883
1880
  error: err
1884
1881
  }), {
1885
1882
  F: __dxlog_file8,
1886
- L: 333,
1883
+ L: 332,
1887
1884
  S: this,
1888
1885
  C: (f, a) => f(...a)
1889
1886
  });
@@ -1893,7 +1890,7 @@ var InvitationsHandler = class {
1893
1890
  });
1894
1891
  },
1895
1892
  onError: (err) => {
1896
- if (err instanceof import_errors2.InvalidInvitationExtensionRoleError) {
1893
+ if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
1897
1894
  return;
1898
1895
  }
1899
1896
  if (err instanceof import_async5.TimeoutError) {
@@ -1901,7 +1898,7 @@ var InvitationsHandler = class {
1901
1898
  ...protocol.toJSON()
1902
1899
  }, {
1903
1900
  F: __dxlog_file8,
1904
- L: 344,
1901
+ L: 343,
1905
1902
  S: this,
1906
1903
  C: (f, a) => f(...a)
1907
1904
  });
@@ -1911,7 +1908,7 @@ var InvitationsHandler = class {
1911
1908
  } else {
1912
1909
  (0, import_log6.log)("auth failed", err, {
1913
1910
  F: __dxlog_file8,
1914
- L: 347,
1911
+ L: 346,
1915
1912
  S: this,
1916
1913
  C: (f, a) => f(...a)
1917
1914
  });
@@ -1924,7 +1921,7 @@ var InvitationsHandler = class {
1924
1921
  (0, import_async5.scheduleTask)(ctx, async () => {
1925
1922
  (0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
1926
1923
  F: __dxlog_file8,
1927
- L: 357,
1924
+ L: 356,
1928
1925
  S: this,
1929
1926
  A: [
1930
1927
  "invitation.swarmKey",
@@ -1946,7 +1943,7 @@ var InvitationsHandler = class {
1946
1943
  state: import_services4.Invitation.State.CONNECTING
1947
1944
  });
1948
1945
  });
1949
- const observable = new import_client_protocol2.AuthenticatingInvitationObservable({
1946
+ const observable = new import_client_protocol2.AuthenticatingInvitation({
1950
1947
  initialInvitation: invitation,
1951
1948
  subscriber: stream.observable,
1952
1949
  onCancel: async () => {
@@ -2004,7 +2001,9 @@ var InvitationsServiceImpl = class {
2004
2001
  }, () => {
2005
2002
  close();
2006
2003
  this._createInvitations.delete(invitation.get().invitationId);
2007
- this._removedCreated.emit(invitation.get());
2004
+ if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
2005
+ this._removedCreated.emit(invitation.get());
2006
+ }
2008
2007
  });
2009
2008
  });
2010
2009
  }
@@ -2027,20 +2026,22 @@ var InvitationsServiceImpl = class {
2027
2026
  }, () => {
2028
2027
  close();
2029
2028
  this._acceptInvitations.delete(invitation.get().invitationId);
2030
- this._removedAccepted.emit(invitation.get());
2029
+ if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
2030
+ this._removedAccepted.emit(invitation.get());
2031
+ }
2031
2032
  });
2032
2033
  });
2033
2034
  }
2034
2035
  async authenticate({ invitationId, authCode }) {
2035
2036
  (0, import_log7.log)("authenticating...", void 0, {
2036
2037
  F: __dxlog_file9,
2037
- L: 104,
2038
+ L: 108,
2038
2039
  S: this,
2039
2040
  C: (f, a) => f(...a)
2040
2041
  });
2041
2042
  (0, import_invariant8.invariant)(invitationId, void 0, {
2042
2043
  F: __dxlog_file9,
2043
- L: 105,
2044
+ L: 109,
2044
2045
  S: this,
2045
2046
  A: [
2046
2047
  "invitationId",
@@ -2053,7 +2054,7 @@ var InvitationsServiceImpl = class {
2053
2054
  invitationId
2054
2055
  }, {
2055
2056
  F: __dxlog_file9,
2056
- L: 108,
2057
+ L: 112,
2057
2058
  S: this,
2058
2059
  C: (f, a) => f(...a)
2059
2060
  });
@@ -2064,13 +2065,13 @@ var InvitationsServiceImpl = class {
2064
2065
  async cancelInvitation({ invitationId }) {
2065
2066
  (0, import_log7.log)("deleting...", void 0, {
2066
2067
  F: __dxlog_file9,
2067
- L: 115,
2068
+ L: 119,
2068
2069
  S: this,
2069
2070
  C: (f, a) => f(...a)
2070
2071
  });
2071
2072
  (0, import_invariant8.invariant)(invitationId, void 0, {
2072
2073
  F: __dxlog_file9,
2073
- L: 116,
2074
+ L: 120,
2074
2075
  S: this,
2075
2076
  A: [
2076
2077
  "invitationId",
@@ -2092,7 +2093,7 @@ var InvitationsServiceImpl = class {
2092
2093
  invitationId
2093
2094
  }, {
2094
2095
  F: __dxlog_file9,
2095
- L: 128,
2096
+ L: 132,
2096
2097
  S: this,
2097
2098
  C: (f, a) => f(...a)
2098
2099
  });
@@ -2311,7 +2312,7 @@ var import_credentials14 = require("@dxos/credentials");
2311
2312
  var import_invariant11 = require("@dxos/invariant");
2312
2313
  var import_keys7 = require("@dxos/keys");
2313
2314
  var import_log11 = require("@dxos/log");
2314
- var import_protocols7 = require("@dxos/protocols");
2315
+ var import_protocols8 = require("@dxos/protocols");
2315
2316
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2316
2317
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2317
2318
  var import_util4 = require("@dxos/util");
@@ -2322,9 +2323,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2322
2323
  var import_context6 = require("@dxos/context");
2323
2324
  var import_debug4 = require("@dxos/debug");
2324
2325
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2325
- var import_errors3 = require("@dxos/errors");
2326
2326
  var import_keys6 = require("@dxos/keys");
2327
2327
  var import_log10 = require("@dxos/log");
2328
+ var import_protocols7 = require("@dxos/protocols");
2328
2329
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2329
2330
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2330
2331
  var import_timeframe2 = require("@dxos/timeframe");
@@ -2633,7 +2634,7 @@ var DataSpace = class DataSpace2 {
2633
2634
  this._signingContext = params.signingContext;
2634
2635
  this._callbacks = params.callbacks ?? {};
2635
2636
  this.authVerifier = new TrustedKeySetAuthVerifier({
2636
- trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
2637
+ trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2637
2638
  update: this._inner.stateUpdate,
2638
2639
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2639
2640
  });
@@ -2643,7 +2644,7 @@ var DataSpace = class DataSpace2 {
2643
2644
  state: import_services7.SpaceState[this._state]
2644
2645
  }, {
2645
2646
  F: __dxlog_file12,
2646
- L: 112,
2647
+ L: 118,
2647
2648
  S: this,
2648
2649
  C: (f, a) => f(...a)
2649
2650
  });
@@ -2677,6 +2678,7 @@ var DataSpace = class DataSpace2 {
2677
2678
  await this._open();
2678
2679
  }
2679
2680
  async _open() {
2681
+ await this._gossip.open();
2680
2682
  await this._notarizationPlugin.open();
2681
2683
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2682
2684
  await this._inner.open(new import_context6.Context());
@@ -2685,7 +2687,7 @@ var DataSpace = class DataSpace2 {
2685
2687
  state: import_services7.SpaceState[this._state]
2686
2688
  }, {
2687
2689
  F: __dxlog_file12,
2688
- L: 158,
2690
+ L: 165,
2689
2691
  S: this,
2690
2692
  C: (f, a) => f(...a)
2691
2693
  });
@@ -2703,7 +2705,7 @@ var DataSpace = class DataSpace2 {
2703
2705
  state: import_services7.SpaceState[this._state]
2704
2706
  }, {
2705
2707
  F: __dxlog_file12,
2706
- L: 172,
2708
+ L: 179,
2707
2709
  S: this,
2708
2710
  C: (f, a) => f(...a)
2709
2711
  });
@@ -2714,6 +2716,7 @@ var DataSpace = class DataSpace2 {
2714
2716
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
2715
2717
  await this._notarizationPlugin.close();
2716
2718
  await this._presence.destroy();
2719
+ await this._gossip.close();
2717
2720
  }
2718
2721
  async postMessage(channel, message) {
2719
2722
  return this._gossip.postMessage(channel, message);
@@ -2730,10 +2733,10 @@ var DataSpace = class DataSpace2 {
2730
2733
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
2731
2734
  await this.initializeDataPipeline();
2732
2735
  } catch (err) {
2733
- if (err instanceof import_errors3.CancelledError) {
2736
+ if (err instanceof import_protocols7.CancelledError) {
2734
2737
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
2735
2738
  F: __dxlog_file12,
2736
- L: 203,
2739
+ L: 211,
2737
2740
  S: this,
2738
2741
  C: (f, a) => f(...a)
2739
2742
  });
@@ -2741,7 +2744,7 @@ var DataSpace = class DataSpace2 {
2741
2744
  }
2742
2745
  import_log10.log.error("Error initializing data pipeline", err, {
2743
2746
  F: __dxlog_file12,
2744
- L: 207,
2747
+ L: 215,
2745
2748
  S: this,
2746
2749
  C: (f, a) => f(...a)
2747
2750
  });
@@ -2750,7 +2753,7 @@ var DataSpace = class DataSpace2 {
2750
2753
  state: import_services7.SpaceState[this._state]
2751
2754
  }, {
2752
2755
  F: __dxlog_file12,
2753
- L: 209,
2756
+ L: 217,
2754
2757
  S: this,
2755
2758
  C: (f, a) => f(...a)
2756
2759
  });
@@ -2763,14 +2766,14 @@ var DataSpace = class DataSpace2 {
2763
2766
  }
2764
2767
  async initializeDataPipeline() {
2765
2768
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
2766
- throw new import_errors3.SystemError("Invalid operation");
2769
+ throw new import_protocols7.SystemError("Invalid operation");
2767
2770
  }
2768
2771
  this._state = import_services7.SpaceState.INITIALIZING;
2769
2772
  (0, import_log10.log)("new state", {
2770
2773
  state: import_services7.SpaceState[this._state]
2771
2774
  }, {
2772
2775
  F: __dxlog_file12,
2773
- L: 225,
2776
+ L: 233,
2774
2777
  S: this,
2775
2778
  C: (f, a) => f(...a)
2776
2779
  });
@@ -2781,7 +2784,7 @@ var DataSpace = class DataSpace2 {
2781
2784
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2782
2785
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
2783
2786
  F: __dxlog_file12,
2784
- L: 239,
2787
+ L: 247,
2785
2788
  S: this,
2786
2789
  C: (f, a) => f(...a)
2787
2790
  });
@@ -2792,7 +2795,7 @@ var DataSpace = class DataSpace2 {
2792
2795
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
2793
2796
  (0, import_log10.log)("data pipeline ready", void 0, {
2794
2797
  F: __dxlog_file12,
2795
- L: 248,
2798
+ L: 256,
2796
2799
  S: this,
2797
2800
  C: (f, a) => f(...a)
2798
2801
  });
@@ -2802,7 +2805,7 @@ var DataSpace = class DataSpace2 {
2802
2805
  state: import_services7.SpaceState[this._state]
2803
2806
  }, {
2804
2807
  F: __dxlog_file12,
2805
- L: 252,
2808
+ L: 260,
2806
2809
  S: this,
2807
2810
  C: (f, a) => f(...a)
2808
2811
  });
@@ -2818,7 +2821,7 @@ var DataSpace = class DataSpace2 {
2818
2821
  await this._createWritableFeeds();
2819
2822
  (0, import_log10.log)("writable feeds created", void 0, {
2820
2823
  F: __dxlog_file12,
2821
- L: 268,
2824
+ L: 276,
2822
2825
  S: this,
2823
2826
  C: (f, a) => f(...a)
2824
2827
  });
@@ -2923,7 +2926,7 @@ var DataSpace = class DataSpace2 {
2923
2926
  state: import_services7.SpaceState[this._state]
2924
2927
  }, {
2925
2928
  F: __dxlog_file12,
2926
- L: 384,
2929
+ L: 392,
2927
2930
  S: this,
2928
2931
  C: (f, a) => f(...a)
2929
2932
  });
@@ -3065,7 +3068,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3065
3068
  S: this,
3066
3069
  C: (f, a) => f(...a)
3067
3070
  });
3068
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.begin({
3071
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.begin({
3069
3072
  id: this._instanceId
3070
3073
  }), {
3071
3074
  F: __dxlog_file13,
@@ -3111,7 +3114,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3111
3114
  space.initializeDataPipelineAsync();
3112
3115
  }
3113
3116
  }
3114
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
3117
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.end({
3115
3118
  id: this._instanceId
3116
3119
  }), {
3117
3120
  F: __dxlog_file13,
@@ -3365,10 +3368,9 @@ DataSpaceManager = _ts_decorate4([
3365
3368
  var import_async10 = require("@dxos/async");
3366
3369
  var import_codec_protobuf5 = require("@dxos/codec-protobuf");
3367
3370
  var import_debug6 = require("@dxos/debug");
3368
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3369
- var import_errors4 = require("@dxos/errors");
3371
+ var import_invariant12 = require("@dxos/invariant");
3370
3372
  var import_log12 = require("@dxos/log");
3371
- var import_protocols8 = require("@dxos/protocols");
3373
+ var import_protocols9 = require("@dxos/protocols");
3372
3374
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3373
3375
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3374
3376
  var SpacesServiceImpl = class {
@@ -3388,7 +3390,7 @@ var SpacesServiceImpl = class {
3388
3390
  }
3389
3391
  async updateSpace({ spaceKey, state }) {
3390
3392
  const dataSpaceManager = await this._getDataSpaceManager();
3391
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3393
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3392
3394
  if (state) {
3393
3395
  switch (state) {
3394
3396
  case import_services9.SpaceState.ACTIVE:
@@ -3398,7 +3400,7 @@ var SpacesServiceImpl = class {
3398
3400
  await space.deactivate();
3399
3401
  break;
3400
3402
  default:
3401
- throw new import_errors4.ApiError("Invalid space state");
3403
+ throw new import_protocols9.ApiError("Invalid space state");
3402
3404
  }
3403
3405
  }
3404
3406
  }
@@ -3431,7 +3433,7 @@ var SpacesServiceImpl = class {
3431
3433
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3432
3434
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3433
3435
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3434
- space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
3436
+ subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3435
3437
  if (space.dataPipeline.pipelineState) {
3436
3438
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3437
3439
  }
@@ -3453,14 +3455,14 @@ var SpacesServiceImpl = class {
3453
3455
  }
3454
3456
  async postMessage({ spaceKey, channel, message }) {
3455
3457
  const dataSpaceManager = await this._getDataSpaceManager();
3456
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3458
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3457
3459
  await space.postMessage(getChannelId(channel), message);
3458
3460
  }
3459
3461
  subscribeMessages({ spaceKey, channel }) {
3460
3462
  return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3461
3463
  (0, import_async10.scheduleTask)(ctx, async () => {
3462
3464
  const dataSpaceManager = await this._getDataSpaceManager();
3463
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3465
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3464
3466
  const handle = space.listen(getChannelId(channel), (message) => {
3465
3467
  next(message);
3466
3468
  });
@@ -3468,38 +3470,83 @@ var SpacesServiceImpl = class {
3468
3470
  });
3469
3471
  });
3470
3472
  }
3471
- queryCredentials({ spaceKey }) {
3472
- return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3473
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3473
+ queryCredentials({ spaceKey, noTail }) {
3474
+ return new import_codec_protobuf5.Stream(({ ctx, next, close }) => {
3475
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3474
3476
  const processor = {
3475
3477
  processCredential: async (credential) => {
3476
3478
  next(credential);
3477
3479
  }
3478
3480
  };
3479
3481
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3480
- (0, import_async10.scheduleTask)(ctx, () => space.spaceState.addCredentialProcessor(processor));
3482
+ (0, import_async10.scheduleTask)(ctx, async () => {
3483
+ await space.spaceState.addCredentialProcessor(processor);
3484
+ if (noTail) {
3485
+ close();
3486
+ }
3487
+ });
3481
3488
  });
3482
3489
  }
3483
3490
  async writeCredentials({ spaceKey, credentials }) {
3484
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3491
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3485
3492
  for (const credential of credentials ?? []) {
3486
- await space.controlPipeline.writer.write({
3487
- credential: {
3488
- credential
3489
- }
3490
- });
3493
+ if (credential.proof) {
3494
+ await space.controlPipeline.writer.write({
3495
+ credential: {
3496
+ credential
3497
+ }
3498
+ });
3499
+ } else {
3500
+ (0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3501
+ F: __dxlog_file14,
3502
+ L: 168,
3503
+ S: this,
3504
+ A: [
3505
+ "!credential.id",
3506
+ "'Id on unsigned credentials is not allowed'"
3507
+ ]
3508
+ });
3509
+ (0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
3510
+ F: __dxlog_file14,
3511
+ L: 169,
3512
+ S: this,
3513
+ A: [
3514
+ "this._identityManager.identity",
3515
+ "'Identity is not available'"
3516
+ ]
3517
+ });
3518
+ const signer = this._identityManager.identity.getIdentityCredentialSigner();
3519
+ (0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3520
+ F: __dxlog_file14,
3521
+ L: 171,
3522
+ S: this,
3523
+ A: [
3524
+ "credential.issuer.equals(signer.getIssuer())",
3525
+ ""
3526
+ ]
3527
+ });
3528
+ const signedCredential = await signer.createCredential({
3529
+ subject: credential.subject.id,
3530
+ assertion: credential.subject.assertion
3531
+ });
3532
+ await space.controlPipeline.writer.write({
3533
+ credential: {
3534
+ credential: signedCredential
3535
+ }
3536
+ });
3537
+ }
3491
3538
  }
3492
3539
  }
3493
3540
  async createEpoch({ spaceKey }) {
3494
3541
  const dataSpaceManager = await this._getDataSpaceManager();
3495
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3542
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3496
3543
  await space.createEpoch();
3497
3544
  }
3498
3545
  _serializeSpace(space) {
3499
3546
  return {
3500
3547
  spaceKey: space.key,
3501
3548
  state: space.state,
3502
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3549
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3503
3550
  pipeline: {
3504
3551
  currentEpoch: space.dataPipeline.currentEpoch,
3505
3552
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3526,7 +3573,7 @@ var SpacesServiceImpl = class {
3526
3573
  displayName: member.assertion.profile?.displayName
3527
3574
  }
3528
3575
  },
3529
- presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3576
+ presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3530
3577
  peerStates: peers
3531
3578
  };
3532
3579
  }),
@@ -3551,18 +3598,17 @@ function _ts_decorate5(decorators, target, key, desc) {
3551
3598
  }
3552
3599
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3553
3600
  var ServiceContext = class ServiceContext2 {
3554
- // prettier-ignore
3555
3601
  constructor(storage, networkManager, signalManager, modelFactory) {
3556
3602
  this.storage = storage;
3557
3603
  this.networkManager = networkManager;
3558
3604
  this.signalManager = signalManager;
3559
3605
  this.modelFactory = modelFactory;
3560
3606
  this.initialized = new import_async11.Trigger();
3561
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3607
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3562
3608
  this._handlerFactories = /* @__PURE__ */ new Map();
3563
3609
  this._instanceId = import_keys8.PublicKey.random().toHex();
3564
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3565
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
3610
+ this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
3611
+ this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3566
3612
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3567
3613
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3568
3614
  this.feedStore = new import_feed_store3.FeedStore({
@@ -3570,12 +3616,12 @@ var ServiceContext = class ServiceContext2 {
3570
3616
  root: storage.createDirectory("feeds"),
3571
3617
  signer: this.keyring,
3572
3618
  hypercore: {
3573
- valueEncoding: import_echo_pipeline3.valueEncoding,
3619
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3574
3620
  stats: true
3575
3621
  }
3576
3622
  })
3577
3623
  });
3578
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
3624
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3579
3625
  feedStore: this.feedStore,
3580
3626
  networkManager: this.networkManager,
3581
3627
  blobStore: this.blobStore,
@@ -3591,15 +3637,15 @@ var ServiceContext = class ServiceContext2 {
3591
3637
  await this._checkStorageVersion();
3592
3638
  (0, import_log13.log)("opening...", void 0, {
3593
3639
  F: __dxlog_file15,
3594
- L: 135,
3640
+ L: 129,
3595
3641
  S: this,
3596
3642
  C: (f, a) => f(...a)
3597
3643
  });
3598
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.begin({
3644
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.begin({
3599
3645
  id: this._instanceId
3600
3646
  }), {
3601
3647
  F: __dxlog_file15,
3602
- L: 136,
3648
+ L: 130,
3603
3649
  S: this,
3604
3650
  C: (f, a) => f(...a)
3605
3651
  });
@@ -3611,17 +3657,17 @@ var ServiceContext = class ServiceContext2 {
3611
3657
  if (this.identityManager.identity) {
3612
3658
  await this._initialize(ctx);
3613
3659
  }
3614
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
3660
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.end({
3615
3661
  id: this._instanceId
3616
3662
  }), {
3617
3663
  F: __dxlog_file15,
3618
- L: 146,
3664
+ L: 140,
3619
3665
  S: this,
3620
3666
  C: (f, a) => f(...a)
3621
3667
  });
3622
3668
  (0, import_log13.log)("opened", void 0, {
3623
3669
  F: __dxlog_file15,
3624
- L: 147,
3670
+ L: 141,
3625
3671
  S: this,
3626
3672
  C: (f, a) => f(...a)
3627
3673
  });
@@ -3629,7 +3675,7 @@ var ServiceContext = class ServiceContext2 {
3629
3675
  async close() {
3630
3676
  (0, import_log13.log)("closing...", void 0, {
3631
3677
  F: __dxlog_file15,
3632
- L: 151,
3678
+ L: 145,
3633
3679
  S: this,
3634
3680
  C: (f, a) => f(...a)
3635
3681
  });
@@ -3646,7 +3692,7 @@ var ServiceContext = class ServiceContext2 {
3646
3692
  await this.metadataStore.close();
3647
3693
  (0, import_log13.log)("closed", void 0, {
3648
3694
  F: __dxlog_file15,
3649
- L: 163,
3695
+ L: 157,
3650
3696
  S: this,
3651
3697
  C: (f, a) => f(...a)
3652
3698
  });
@@ -3658,9 +3704,9 @@ var ServiceContext = class ServiceContext2 {
3658
3704
  }
3659
3705
  getInvitationHandler(invitation) {
3660
3706
  const factory = this._handlerFactories.get(invitation.kind);
3661
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3707
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3662
3708
  F: __dxlog_file15,
3663
- L: 174,
3709
+ L: 168,
3664
3710
  S: this,
3665
3711
  A: [
3666
3712
  "factory",
@@ -3676,15 +3722,15 @@ var ServiceContext = class ServiceContext2 {
3676
3722
  }
3677
3723
  async _checkStorageVersion() {
3678
3724
  await this.metadataStore.load();
3679
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
3680
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
3725
+ if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
3726
+ throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
3681
3727
  }
3682
3728
  }
3683
3729
  // Called when identity is created.
3684
3730
  async _initialize(ctx) {
3685
3731
  (0, import_log13.log)("initializing spaces...", void 0, {
3686
3732
  F: __dxlog_file15,
3687
- L: 195,
3733
+ L: 189,
3688
3734
  S: this,
3689
3735
  C: (f, a) => f(...a)
3690
3736
  });
@@ -3705,9 +3751,9 @@ var ServiceContext = class ServiceContext2 {
3705
3751
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3706
3752
  await this.dataSpaceManager.open();
3707
3753
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3708
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3754
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3709
3755
  F: __dxlog_file15,
3710
- L: 218,
3756
+ L: 212,
3711
3757
  S: this,
3712
3758
  A: [
3713
3759
  "this.dataSpaceManager",
@@ -3731,7 +3777,7 @@ var ServiceContext = class ServiceContext2 {
3731
3777
  details: assertion
3732
3778
  }, {
3733
3779
  F: __dxlog_file15,
3734
- L: 234,
3780
+ L: 228,
3735
3781
  S: this,
3736
3782
  C: (f, a) => f(...a)
3737
3783
  });
@@ -3742,7 +3788,7 @@ var ServiceContext = class ServiceContext2 {
3742
3788
  details: assertion
3743
3789
  }, {
3744
3790
  F: __dxlog_file15,
3745
- L: 238,
3791
+ L: 232,
3746
3792
  S: this,
3747
3793
  C: (f, a) => f(...a)
3748
3794
  });
@@ -3753,7 +3799,7 @@ var ServiceContext = class ServiceContext2 {
3753
3799
  details: assertion
3754
3800
  }, {
3755
3801
  F: __dxlog_file15,
3756
- L: 243,
3802
+ L: 237,
3757
3803
  S: this,
3758
3804
  C: (f, a) => f(...a)
3759
3805
  });
@@ -3764,7 +3810,7 @@ var ServiceContext = class ServiceContext2 {
3764
3810
  } catch (err) {
3765
3811
  import_log13.log.catch(err, void 0, {
3766
3812
  F: __dxlog_file15,
3767
- L: 249,
3813
+ L: 243,
3768
3814
  S: this,
3769
3815
  C: (f, a) => f(...a)
3770
3816
  });
@@ -3790,19 +3836,44 @@ var import_async17 = require("@dxos/async");
3790
3836
  var import_client_protocol5 = require("@dxos/client-protocol");
3791
3837
  var import_context10 = require("@dxos/context");
3792
3838
  var import_document_model2 = require("@dxos/document-model");
3793
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3794
- var import_invariant14 = require("@dxos/invariant");
3839
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3840
+ var import_echo_schema = require("@dxos/echo-schema");
3841
+ var import_invariant15 = require("@dxos/invariant");
3795
3842
  var import_keys12 = require("@dxos/keys");
3796
3843
  var import_log16 = require("@dxos/log");
3797
3844
  var import_messaging = require("@dxos/messaging");
3798
3845
  var import_model_factory = require("@dxos/model-factory");
3799
3846
  var import_network_manager2 = require("@dxos/network-manager");
3800
- var import_protocols10 = require("@dxos/protocols");
3847
+ var import_protocols12 = require("@dxos/protocols");
3801
3848
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3802
3849
  var import_text_model = require("@dxos/text-model");
3803
3850
  var import_tracing5 = require("@dxos/tracing");
3804
3851
  var import_websocket_rpc = require("@dxos/websocket-rpc");
3805
3852
 
3853
+ // packages/sdk/client-services/src/packlets/services/service-registry.ts
3854
+ var ServiceRegistry = class {
3855
+ // prettier-ignore
3856
+ constructor(_serviceBundle, _handlers = {}) {
3857
+ this._serviceBundle = _serviceBundle;
3858
+ this._handlers = _handlers;
3859
+ }
3860
+ get descriptors() {
3861
+ return this._serviceBundle;
3862
+ }
3863
+ get services() {
3864
+ return this._handlers;
3865
+ }
3866
+ setServices(services) {
3867
+ this._handlers = services;
3868
+ }
3869
+ addService(name, service) {
3870
+ this._handlers[name] = service;
3871
+ }
3872
+ removeService(name) {
3873
+ delete this._handlers[name];
3874
+ }
3875
+ };
3876
+
3806
3877
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3807
3878
  var import_async12 = require("@dxos/async");
3808
3879
  var import_codec_protobuf6 = require("@dxos/codec-protobuf");
@@ -4155,7 +4226,7 @@ var DevtoolsServiceImpl = class {
4155
4226
  };
4156
4227
 
4157
4228
  // packages/sdk/client-services/src/packlets/locks/node.ts
4158
- var import_invariant13 = require("@dxos/invariant");
4229
+ var import_invariant14 = require("@dxos/invariant");
4159
4230
  var import_lock_file = require("@dxos/lock-file");
4160
4231
  var import_log14 = require("@dxos/log");
4161
4232
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4196,7 +4267,7 @@ var Lock = class {
4196
4267
  }
4197
4268
  async release() {
4198
4269
  await this._onRelease?.();
4199
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4270
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4200
4271
  F: __dxlog_file16,
4201
4272
  L: 42,
4202
4273
  S: this,
@@ -4363,29 +4434,29 @@ var NetworkServiceImpl = class {
4363
4434
 
4364
4435
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4365
4436
  var import_client_protocol4 = require("@dxos/client-protocol");
4366
- var import_errors5 = require("@dxos/errors");
4437
+ var import_protocols11 = require("@dxos/protocols");
4367
4438
  var import_config = require("@dxos/protocols/proto/dxos/config");
4368
4439
  var import_random_access_storage = require("@dxos/random-access-storage");
4369
4440
  var import_util8 = require("@dxos/util");
4370
4441
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4371
4442
  var createStorageObjects = (config) => {
4372
- const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4373
- if (persistent && storageType === StorageDriver.RAM) {
4374
- throw new import_errors5.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4443
+ const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4444
+ if (persistent && dataStore === StorageDriver.RAM) {
4445
+ throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4375
4446
  }
4376
- if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4377
- throw new import_errors5.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4447
+ if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
4448
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4378
4449
  }
4379
- if (persistent && keyStorage === StorageDriver.RAM) {
4380
- throw new import_errors5.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4450
+ if (persistent && keyStore === StorageDriver.RAM) {
4451
+ throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4381
4452
  }
4382
- if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4383
- throw new import_errors5.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4453
+ if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
4454
+ throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4384
4455
  }
4385
4456
  return {
4386
4457
  storage: (0, import_random_access_storage.createStorage)({
4387
- type: persistent ? toStorageType(storageType) : import_random_access_storage.StorageType.RAM,
4388
- root: `${path}/`
4458
+ type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
4459
+ root: `${dataRoot}/`
4389
4460
  })
4390
4461
  };
4391
4462
  };
@@ -4464,30 +4535,6 @@ var SystemServiceImpl = class {
4464
4535
  }
4465
4536
  };
4466
4537
 
4467
- // packages/sdk/client-services/src/packlets/services/service-registry.ts
4468
- var ServiceRegistry = class {
4469
- // prettier-ignore
4470
- constructor(_serviceBundle, _handlers = {}) {
4471
- this._serviceBundle = _serviceBundle;
4472
- this._handlers = _handlers;
4473
- }
4474
- get descriptors() {
4475
- return this._serviceBundle;
4476
- }
4477
- get services() {
4478
- return this._handlers;
4479
- }
4480
- setServices(services) {
4481
- this._handlers = services;
4482
- }
4483
- addService(name, service) {
4484
- this._handlers[name] = service;
4485
- }
4486
- removeService(name) {
4487
- delete this._handlers[name];
4488
- }
4489
- };
4490
-
4491
4538
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4492
4539
  function _ts_decorate7(decorators, target, key, desc) {
4493
4540
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4503,6 +4550,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4503
4550
  var createDefaultModelFactory = () => {
4504
4551
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4505
4552
  };
4553
+ var createGenesisMutationFromTypedObject = (obj) => {
4554
+ const snapshot = obj[import_echo_schema.base]._createSnapshot();
4555
+ return {
4556
+ objectId: obj[import_echo_schema.base]._id,
4557
+ genesis: {
4558
+ modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
4559
+ },
4560
+ snapshot: {
4561
+ model: snapshot
4562
+ }
4563
+ };
4564
+ };
4506
4565
  var ClientServicesHost = class ClientServicesHost2 {
4507
4566
  constructor({
4508
4567
  config,
@@ -4587,9 +4646,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4587
4646
  * Can only be called once.
4588
4647
  */
4589
4648
  initialize({ config, ...options }) {
4590
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4649
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4591
4650
  F: __dxlog_file17,
4592
- L: 184,
4651
+ L: 201,
4593
4652
  S: this,
4594
4653
  A: [
4595
4654
  "!this._open",
@@ -4598,14 +4657,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4598
4657
  });
4599
4658
  (0, import_log16.log)("initializing...", void 0, {
4600
4659
  F: __dxlog_file17,
4601
- L: 185,
4660
+ L: 202,
4602
4661
  S: this,
4603
4662
  C: (f, a) => f(...a)
4604
4663
  });
4605
4664
  if (config) {
4606
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4665
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4607
4666
  F: __dxlog_file17,
4608
- L: 188,
4667
+ L: 205,
4609
4668
  S: this,
4610
4669
  A: [
4611
4670
  "!this._config",
@@ -4621,9 +4680,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4621
4680
  iceServers: this._config?.get("runtime.services.ice")
4622
4681
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4623
4682
  this._signalManager = signalManager;
4624
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4683
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4625
4684
  F: __dxlog_file17,
4626
- L: 204,
4685
+ L: 221,
4627
4686
  S: this,
4628
4687
  A: [
4629
4688
  "!this._networkManager",
@@ -4637,7 +4696,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4637
4696
  });
4638
4697
  (0, import_log16.log)("initialized", void 0, {
4639
4698
  F: __dxlog_file17,
4640
- L: 211,
4699
+ L: 228,
4641
4700
  S: this,
4642
4701
  C: (f, a) => f(...a)
4643
4702
  });
@@ -4647,44 +4706,44 @@ var ClientServicesHost = class ClientServicesHost2 {
4647
4706
  return;
4648
4707
  }
4649
4708
  const traceId = import_keys12.PublicKey.random().toHex();
4650
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.begin({
4709
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4651
4710
  id: traceId
4652
4711
  }), {
4653
4712
  F: __dxlog_file17,
4654
- L: 222,
4713
+ L: 239,
4655
4714
  S: this,
4656
4715
  C: (f, a) => f(...a)
4657
4716
  });
4658
- (0, import_invariant14.invariant)(this._config, "config not set", {
4717
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4659
4718
  F: __dxlog_file17,
4660
- L: 224,
4719
+ L: 241,
4661
4720
  S: this,
4662
4721
  A: [
4663
4722
  "this._config",
4664
4723
  "'config not set'"
4665
4724
  ]
4666
4725
  });
4667
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4726
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4668
4727
  F: __dxlog_file17,
4669
- L: 225,
4728
+ L: 242,
4670
4729
  S: this,
4671
4730
  A: [
4672
4731
  "this._storage",
4673
4732
  "'storage not set'"
4674
4733
  ]
4675
4734
  });
4676
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4735
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4677
4736
  F: __dxlog_file17,
4678
- L: 226,
4737
+ L: 243,
4679
4738
  S: this,
4680
4739
  A: [
4681
4740
  "this._signalManager",
4682
4741
  "'signal manager not set'"
4683
4742
  ]
4684
4743
  });
4685
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4744
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4686
4745
  F: __dxlog_file17,
4687
- L: 227,
4746
+ L: 244,
4688
4747
  S: this,
4689
4748
  A: [
4690
4749
  "this._networkManager",
@@ -4696,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4696
4755
  lockKey: this._resourceLock?.lockKey
4697
4756
  }, {
4698
4757
  F: __dxlog_file17,
4699
- L: 230,
4758
+ L: 247,
4700
4759
  S: this,
4701
4760
  C: (f, a) => f(...a)
4702
4761
  });
@@ -4705,14 +4764,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4705
4764
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4706
4765
  this._serviceRegistry.setServices({
4707
4766
  SystemService: this._systemService,
4708
- IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4767
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4709
4768
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4710
4769
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4711
4770
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
4712
4771
  await this._serviceContext.initialized.wait();
4713
4772
  return this._serviceContext.dataSpaceManager;
4714
4773
  }),
4715
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4774
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4716
4775
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4717
4776
  LoggingService: this._loggingService,
4718
4777
  TracingService: this._tracingService,
@@ -4742,15 +4801,15 @@ var ClientServicesHost = class ClientServicesHost2 {
4742
4801
  deviceKey
4743
4802
  }, {
4744
4803
  F: __dxlog_file17,
4745
- L: 299,
4804
+ L: 316,
4746
4805
  S: this,
4747
4806
  C: (f, a) => f(...a)
4748
4807
  });
4749
- import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.end({
4808
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
4750
4809
  id: traceId
4751
4810
  }), {
4752
4811
  F: __dxlog_file17,
4753
- L: 300,
4812
+ L: 317,
4754
4813
  S: this,
4755
4814
  C: (f, a) => f(...a)
4756
4815
  });
@@ -4764,7 +4823,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4764
4823
  deviceKey
4765
4824
  }, {
4766
4825
  F: __dxlog_file17,
4767
- L: 311,
4826
+ L: 328,
4768
4827
  S: this,
4769
4828
  C: (f, a) => f(...a)
4770
4829
  });
@@ -4780,24 +4839,24 @@ var ClientServicesHost = class ClientServicesHost2 {
4780
4839
  deviceKey
4781
4840
  }, {
4782
4841
  F: __dxlog_file17,
4783
- L: 318,
4842
+ L: 335,
4784
4843
  S: this,
4785
4844
  C: (f, a) => f(...a)
4786
4845
  });
4787
4846
  }
4788
4847
  async reset() {
4789
4848
  const traceId = import_keys12.PublicKey.random().toHex();
4790
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.begin({
4849
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4791
4850
  id: traceId
4792
4851
  }), {
4793
4852
  F: __dxlog_file17,
4794
- L: 323,
4853
+ L: 340,
4795
4854
  S: this,
4796
4855
  C: (f, a) => f(...a)
4797
4856
  });
4798
4857
  (0, import_log16.log)("resetting...", void 0, {
4799
4858
  F: __dxlog_file17,
4800
- L: 325,
4859
+ L: 342,
4801
4860
  S: this,
4802
4861
  C: (f, a) => f(...a)
4803
4862
  });
@@ -4805,20 +4864,39 @@ var ClientServicesHost = class ClientServicesHost2 {
4805
4864
  await this._storage.reset();
4806
4865
  (0, import_log16.log)("reset", void 0, {
4807
4866
  F: __dxlog_file17,
4808
- L: 328,
4867
+ L: 345,
4809
4868
  S: this,
4810
4869
  C: (f, a) => f(...a)
4811
4870
  });
4812
- import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.end({
4871
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
4813
4872
  id: traceId
4814
4873
  }), {
4815
4874
  F: __dxlog_file17,
4816
- L: 329,
4875
+ L: 346,
4817
4876
  S: this,
4818
4877
  C: (f, a) => f(...a)
4819
4878
  });
4820
4879
  await this._callbacks?.onReset?.();
4821
4880
  }
4881
+ async _createIdentity(params) {
4882
+ const identity = await this._serviceContext.createIdentity(params);
4883
+ await this._serviceContext.initialized.wait();
4884
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
4885
+ const obj = new import_client_protocol5.Properties();
4886
+ obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
4887
+ await this._serviceRegistry.services.DataService.write({
4888
+ spaceKey: space.key,
4889
+ batch: {
4890
+ objects: [
4891
+ createGenesisMutationFromTypedObject(obj)
4892
+ ]
4893
+ }
4894
+ });
4895
+ await this._serviceRegistry.services.DataService.flush({
4896
+ spaceKey: space.key
4897
+ });
4898
+ return identity;
4899
+ }
4822
4900
  };
4823
4901
  _ts_decorate7([
4824
4902
  import_tracing5.trace.info()
@@ -4869,7 +4947,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4869
4947
  if (hooks?.guest?.onConnecting?.(guestObservable)) {
4870
4948
  break;
4871
4949
  }
4872
- (0, import_invariant15.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4950
+ (0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4873
4951
  F: __dxlog_file18,
4874
4952
  L: 84,
4875
4953
  S: void 0,
@@ -5002,7 +5080,7 @@ var createInvitation = (host, options) => {
5002
5080
  });
5003
5081
  return host.invitations.createInvitation(hostHandler, options);
5004
5082
  }
5005
- return host.createInvitation(options);
5083
+ return host.share(options);
5006
5084
  };
5007
5085
  var acceptInvitation = (guest, invitation) => {
5008
5086
  invitation = sanitizeInvitation(invitation);
@@ -5012,14 +5090,14 @@ var acceptInvitation = (guest, invitation) => {
5012
5090
  });
5013
5091
  return guest.invitations.acceptInvitation(guestHandler, invitation);
5014
5092
  }
5015
- return guest.acceptInvitation(invitation);
5093
+ return guest.join(invitation);
5016
5094
  };
5017
5095
 
5018
5096
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
5019
5097
  var import_context11 = require("@dxos/context");
5020
5098
  var import_credentials16 = require("@dxos/credentials");
5021
5099
  var import_debug8 = require("@dxos/debug");
5022
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
5100
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
5023
5101
  var import_testing = require("@dxos/echo-pipeline/testing");
5024
5102
  var import_feed_store5 = require("@dxos/feed-store");
5025
5103
  var import_keyring2 = require("@dxos/keyring");
@@ -5079,7 +5157,7 @@ var TestBuilder = class {
5079
5157
  };
5080
5158
  var TestPeer = class {
5081
5159
  constructor(signalContext, opts = {
5082
- storageType: import_random_access_storage2.StorageType.RAM
5160
+ dataStore: import_random_access_storage2.StorageType.RAM
5083
5161
  }) {
5084
5162
  this.signalContext = signalContext;
5085
5163
  this.opts = opts;
@@ -5090,7 +5168,7 @@ var TestPeer = class {
5090
5168
  }
5091
5169
  get storage() {
5092
5170
  return this._props.storage ??= (0, import_random_access_storage2.createStorage)({
5093
- type: this.opts.storageType
5171
+ type: this.opts.dataStore
5094
5172
  });
5095
5173
  }
5096
5174
  get keyring() {
@@ -5102,19 +5180,19 @@ var TestPeer = class {
5102
5180
  root: this.storage.createDirectory("feeds"),
5103
5181
  signer: this.keyring,
5104
5182
  hypercore: {
5105
- valueEncoding: import_echo_pipeline5.valueEncoding
5183
+ valueEncoding: import_echo_pipeline4.valueEncoding
5106
5184
  }
5107
5185
  })
5108
5186
  });
5109
5187
  }
5110
5188
  get metadataStore() {
5111
- return this._props.metadataStore ??= new import_echo_pipeline5.MetadataStore(this.storage.createDirectory("metadata"));
5189
+ return this._props.metadataStore ??= new import_echo_pipeline4.MetadataStore(this.storage.createDirectory("metadata"));
5112
5190
  }
5113
5191
  get blobStore() {
5114
5192
  return this._props.blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
5115
5193
  }
5116
5194
  get snapshotStore() {
5117
- return this._props.snapshotStore ??= new import_echo_pipeline5.SnapshotStore(this.storage.createDirectory("snapshots"));
5195
+ return this._props.snapshotStore ??= new import_echo_pipeline4.SnapshotStore(this.storage.createDirectory("snapshots"));
5118
5196
  }
5119
5197
  get networkManager() {
5120
5198
  return this._props.networkManager ??= new import_network_manager3.NetworkManager({
@@ -5123,7 +5201,7 @@ var TestPeer = class {
5123
5201
  });
5124
5202
  }
5125
5203
  get spaceManager() {
5126
- return this._props.spaceManager ??= new import_echo_pipeline5.SpaceManager({
5204
+ return this._props.spaceManager ??= new import_echo_pipeline4.SpaceManager({
5127
5205
  feedStore: this.feedStore,
5128
5206
  networkManager: this.networkManager,
5129
5207
  metadataStore: this.metadataStore,
@@ -5136,7 +5214,7 @@ var TestPeer = class {
5136
5214
  return this._props.signingContext ?? (0, import_debug8.failUndefined)();
5137
5215
  }
5138
5216
  get dataSpaceManager() {
5139
- return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline5.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
5217
+ return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline4.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
5140
5218
  }
5141
5219
  async createIdentity() {
5142
5220
  this._props.signingContext ??= await createSigningContext(this.keyring);