@dxos/client-services 0.1.58-main.cbf3753 → 0.1.58-main.d483d07

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-HBVO7V6N.mjs → chunk-MZTNVRVG.mjs} +253 -179
  2. package/dist/lib/browser/chunk-MZTNVRVG.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 +301 -227
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +298 -224
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  15. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
  16. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
  19. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  20. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
  22. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  24. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  25. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  26. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  28. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
  29. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  30. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
  31. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  32. package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
  33. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  34. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  35. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  36. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  37. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
  38. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  39. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  40. package/dist/types/src/version.d.ts +1 -1
  41. package/package.json +35 -35
  42. package/src/packlets/devices/devices-service.test.ts +1 -1
  43. package/src/packlets/devtools/devtools.ts +1 -1
  44. package/src/packlets/identity/authenticator.ts +2 -5
  45. package/src/packlets/identity/identity-manager.test.ts +1 -1
  46. package/src/packlets/identity/identity-service.test.ts +1 -1
  47. package/src/packlets/identity/identity.test.ts +1 -1
  48. package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
  49. package/src/packlets/invitations/invitation-extension.ts +1 -2
  50. package/src/packlets/invitations/invitations-handler.ts +7 -8
  51. package/src/packlets/invitations/invitations-service.ts +5 -5
  52. package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
  53. package/src/packlets/network/network-service.test.ts +1 -1
  54. package/src/packlets/services/diagnostics.ts +2 -2
  55. package/src/packlets/services/service-context.ts +7 -13
  56. package/src/packlets/services/service-host.test.ts +3 -3
  57. package/src/packlets/services/service-host.ts +42 -6
  58. package/src/packlets/services/service-registry.test.ts +1 -1
  59. package/src/packlets/spaces/data-space-manager.test.ts +1 -1
  60. package/src/packlets/spaces/data-space-manager.ts +1 -1
  61. package/src/packlets/spaces/data-space.ts +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-HBVO7V6N.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.cbf3753";
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.d483d07";
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 () => {
@@ -2315,7 +2312,7 @@ var import_credentials14 = require("@dxos/credentials");
2315
2312
  var import_invariant11 = require("@dxos/invariant");
2316
2313
  var import_keys7 = require("@dxos/keys");
2317
2314
  var import_log11 = require("@dxos/log");
2318
- var import_protocols7 = require("@dxos/protocols");
2315
+ var import_protocols8 = require("@dxos/protocols");
2319
2316
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2320
2317
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2321
2318
  var import_util4 = require("@dxos/util");
@@ -2326,9 +2323,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2326
2323
  var import_context6 = require("@dxos/context");
2327
2324
  var import_debug4 = require("@dxos/debug");
2328
2325
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2329
- var import_errors3 = require("@dxos/errors");
2330
2326
  var import_keys6 = require("@dxos/keys");
2331
2327
  var import_log10 = require("@dxos/log");
2328
+ var import_protocols7 = require("@dxos/protocols");
2332
2329
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2333
2330
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2334
2331
  var import_timeframe2 = require("@dxos/timeframe");
@@ -2637,7 +2634,7 @@ var DataSpace = class DataSpace2 {
2637
2634
  this._signingContext = params.signingContext;
2638
2635
  this._callbacks = params.callbacks ?? {};
2639
2636
  this.authVerifier = new TrustedKeySetAuthVerifier({
2640
- 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)),
2641
2638
  update: this._inner.stateUpdate,
2642
2639
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2643
2640
  });
@@ -2647,7 +2644,7 @@ var DataSpace = class DataSpace2 {
2647
2644
  state: import_services7.SpaceState[this._state]
2648
2645
  }, {
2649
2646
  F: __dxlog_file12,
2650
- L: 112,
2647
+ L: 118,
2651
2648
  S: this,
2652
2649
  C: (f, a) => f(...a)
2653
2650
  });
@@ -2681,6 +2678,7 @@ var DataSpace = class DataSpace2 {
2681
2678
  await this._open();
2682
2679
  }
2683
2680
  async _open() {
2681
+ await this._gossip.open();
2684
2682
  await this._notarizationPlugin.open();
2685
2683
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2686
2684
  await this._inner.open(new import_context6.Context());
@@ -2689,7 +2687,7 @@ var DataSpace = class DataSpace2 {
2689
2687
  state: import_services7.SpaceState[this._state]
2690
2688
  }, {
2691
2689
  F: __dxlog_file12,
2692
- L: 158,
2690
+ L: 165,
2693
2691
  S: this,
2694
2692
  C: (f, a) => f(...a)
2695
2693
  });
@@ -2707,7 +2705,7 @@ var DataSpace = class DataSpace2 {
2707
2705
  state: import_services7.SpaceState[this._state]
2708
2706
  }, {
2709
2707
  F: __dxlog_file12,
2710
- L: 172,
2708
+ L: 179,
2711
2709
  S: this,
2712
2710
  C: (f, a) => f(...a)
2713
2711
  });
@@ -2718,6 +2716,7 @@ var DataSpace = class DataSpace2 {
2718
2716
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
2719
2717
  await this._notarizationPlugin.close();
2720
2718
  await this._presence.destroy();
2719
+ await this._gossip.close();
2721
2720
  }
2722
2721
  async postMessage(channel, message) {
2723
2722
  return this._gossip.postMessage(channel, message);
@@ -2734,10 +2733,10 @@ var DataSpace = class DataSpace2 {
2734
2733
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
2735
2734
  await this.initializeDataPipeline();
2736
2735
  } catch (err) {
2737
- if (err instanceof import_errors3.CancelledError) {
2736
+ if (err instanceof import_protocols7.CancelledError) {
2738
2737
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
2739
2738
  F: __dxlog_file12,
2740
- L: 203,
2739
+ L: 211,
2741
2740
  S: this,
2742
2741
  C: (f, a) => f(...a)
2743
2742
  });
@@ -2745,7 +2744,7 @@ var DataSpace = class DataSpace2 {
2745
2744
  }
2746
2745
  import_log10.log.error("Error initializing data pipeline", err, {
2747
2746
  F: __dxlog_file12,
2748
- L: 207,
2747
+ L: 215,
2749
2748
  S: this,
2750
2749
  C: (f, a) => f(...a)
2751
2750
  });
@@ -2754,7 +2753,7 @@ var DataSpace = class DataSpace2 {
2754
2753
  state: import_services7.SpaceState[this._state]
2755
2754
  }, {
2756
2755
  F: __dxlog_file12,
2757
- L: 209,
2756
+ L: 217,
2758
2757
  S: this,
2759
2758
  C: (f, a) => f(...a)
2760
2759
  });
@@ -2767,14 +2766,14 @@ var DataSpace = class DataSpace2 {
2767
2766
  }
2768
2767
  async initializeDataPipeline() {
2769
2768
  if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
2770
- throw new import_errors3.SystemError("Invalid operation");
2769
+ throw new import_protocols7.SystemError("Invalid operation");
2771
2770
  }
2772
2771
  this._state = import_services7.SpaceState.INITIALIZING;
2773
2772
  (0, import_log10.log)("new state", {
2774
2773
  state: import_services7.SpaceState[this._state]
2775
2774
  }, {
2776
2775
  F: __dxlog_file12,
2777
- L: 225,
2776
+ L: 233,
2778
2777
  S: this,
2779
2778
  C: (f, a) => f(...a)
2780
2779
  });
@@ -2785,7 +2784,7 @@ var DataSpace = class DataSpace2 {
2785
2784
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2786
2785
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
2787
2786
  F: __dxlog_file12,
2788
- L: 239,
2787
+ L: 247,
2789
2788
  S: this,
2790
2789
  C: (f, a) => f(...a)
2791
2790
  });
@@ -2796,7 +2795,7 @@ var DataSpace = class DataSpace2 {
2796
2795
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
2797
2796
  (0, import_log10.log)("data pipeline ready", void 0, {
2798
2797
  F: __dxlog_file12,
2799
- L: 248,
2798
+ L: 256,
2800
2799
  S: this,
2801
2800
  C: (f, a) => f(...a)
2802
2801
  });
@@ -2806,7 +2805,7 @@ var DataSpace = class DataSpace2 {
2806
2805
  state: import_services7.SpaceState[this._state]
2807
2806
  }, {
2808
2807
  F: __dxlog_file12,
2809
- L: 252,
2808
+ L: 260,
2810
2809
  S: this,
2811
2810
  C: (f, a) => f(...a)
2812
2811
  });
@@ -2822,7 +2821,7 @@ var DataSpace = class DataSpace2 {
2822
2821
  await this._createWritableFeeds();
2823
2822
  (0, import_log10.log)("writable feeds created", void 0, {
2824
2823
  F: __dxlog_file12,
2825
- L: 268,
2824
+ L: 276,
2826
2825
  S: this,
2827
2826
  C: (f, a) => f(...a)
2828
2827
  });
@@ -2927,7 +2926,7 @@ var DataSpace = class DataSpace2 {
2927
2926
  state: import_services7.SpaceState[this._state]
2928
2927
  }, {
2929
2928
  F: __dxlog_file12,
2930
- L: 384,
2929
+ L: 392,
2931
2930
  S: this,
2932
2931
  C: (f, a) => f(...a)
2933
2932
  });
@@ -3069,7 +3068,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3069
3068
  S: this,
3070
3069
  C: (f, a) => f(...a)
3071
3070
  });
3072
- 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({
3073
3072
  id: this._instanceId
3074
3073
  }), {
3075
3074
  F: __dxlog_file13,
@@ -3115,7 +3114,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3115
3114
  space.initializeDataPipelineAsync();
3116
3115
  }
3117
3116
  }
3118
- 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({
3119
3118
  id: this._instanceId
3120
3119
  }), {
3121
3120
  F: __dxlog_file13,
@@ -3369,10 +3368,9 @@ DataSpaceManager = _ts_decorate4([
3369
3368
  var import_async10 = require("@dxos/async");
3370
3369
  var import_codec_protobuf5 = require("@dxos/codec-protobuf");
3371
3370
  var import_debug6 = require("@dxos/debug");
3372
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3373
- var import_errors4 = require("@dxos/errors");
3371
+ var import_invariant12 = require("@dxos/invariant");
3374
3372
  var import_log12 = require("@dxos/log");
3375
- var import_protocols8 = require("@dxos/protocols");
3373
+ var import_protocols9 = require("@dxos/protocols");
3376
3374
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3377
3375
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3378
3376
  var SpacesServiceImpl = class {
@@ -3392,7 +3390,7 @@ var SpacesServiceImpl = class {
3392
3390
  }
3393
3391
  async updateSpace({ spaceKey, state }) {
3394
3392
  const dataSpaceManager = await this._getDataSpaceManager();
3395
- 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));
3396
3394
  if (state) {
3397
3395
  switch (state) {
3398
3396
  case import_services9.SpaceState.ACTIVE:
@@ -3402,7 +3400,7 @@ var SpacesServiceImpl = class {
3402
3400
  await space.deactivate();
3403
3401
  break;
3404
3402
  default:
3405
- throw new import_errors4.ApiError("Invalid space state");
3403
+ throw new import_protocols9.ApiError("Invalid space state");
3406
3404
  }
3407
3405
  }
3408
3406
  }
@@ -3435,7 +3433,7 @@ var SpacesServiceImpl = class {
3435
3433
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
3436
3434
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
3437
3435
  subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
3438
- space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
3436
+ subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3439
3437
  if (space.dataPipeline.pipelineState) {
3440
3438
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
3441
3439
  }
@@ -3457,14 +3455,14 @@ var SpacesServiceImpl = class {
3457
3455
  }
3458
3456
  async postMessage({ spaceKey, channel, message }) {
3459
3457
  const dataSpaceManager = await this._getDataSpaceManager();
3460
- 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));
3461
3459
  await space.postMessage(getChannelId(channel), message);
3462
3460
  }
3463
3461
  subscribeMessages({ spaceKey, channel }) {
3464
3462
  return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3465
3463
  (0, import_async10.scheduleTask)(ctx, async () => {
3466
3464
  const dataSpaceManager = await this._getDataSpaceManager();
3467
- 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));
3468
3466
  const handle = space.listen(getChannelId(channel), (message) => {
3469
3467
  next(message);
3470
3468
  });
@@ -3472,38 +3470,83 @@ var SpacesServiceImpl = class {
3472
3470
  });
3473
3471
  });
3474
3472
  }
3475
- queryCredentials({ spaceKey }) {
3476
- return new import_codec_protobuf5.Stream(({ ctx, next }) => {
3477
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
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));
3478
3476
  const processor = {
3479
3477
  processCredential: async (credential) => {
3480
3478
  next(credential);
3481
3479
  }
3482
3480
  };
3483
3481
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3484
- (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
+ });
3485
3488
  });
3486
3489
  }
3487
3490
  async writeCredentials({ spaceKey, credentials }) {
3488
- 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));
3489
3492
  for (const credential of credentials ?? []) {
3490
- await space.controlPipeline.writer.write({
3491
- credential: {
3492
- credential
3493
- }
3494
- });
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
+ }
3495
3538
  }
3496
3539
  }
3497
3540
  async createEpoch({ spaceKey }) {
3498
3541
  const dataSpaceManager = await this._getDataSpaceManager();
3499
- 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));
3500
3543
  await space.createEpoch();
3501
3544
  }
3502
3545
  _serializeSpace(space) {
3503
3546
  return {
3504
3547
  spaceKey: space.key,
3505
3548
  state: space.state,
3506
- error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3549
+ error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
3507
3550
  pipeline: {
3508
3551
  currentEpoch: space.dataPipeline.currentEpoch,
3509
3552
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3530,7 +3573,7 @@ var SpacesServiceImpl = class {
3530
3573
  displayName: member.assertion.profile?.displayName
3531
3574
  }
3532
3575
  },
3533
- 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,
3534
3577
  peerStates: peers
3535
3578
  };
3536
3579
  }),
@@ -3555,18 +3598,17 @@ function _ts_decorate5(decorators, target, key, desc) {
3555
3598
  }
3556
3599
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3557
3600
  var ServiceContext = class ServiceContext2 {
3558
- // prettier-ignore
3559
3601
  constructor(storage, networkManager, signalManager, modelFactory) {
3560
3602
  this.storage = storage;
3561
3603
  this.networkManager = networkManager;
3562
3604
  this.signalManager = signalManager;
3563
3605
  this.modelFactory = modelFactory;
3564
3606
  this.initialized = new import_async11.Trigger();
3565
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
3607
+ this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3566
3608
  this._handlerFactories = /* @__PURE__ */ new Map();
3567
3609
  this._instanceId = import_keys8.PublicKey.random().toHex();
3568
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3569
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
3610
+ this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
3611
+ this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3570
3612
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3571
3613
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3572
3614
  this.feedStore = new import_feed_store3.FeedStore({
@@ -3574,12 +3616,12 @@ var ServiceContext = class ServiceContext2 {
3574
3616
  root: storage.createDirectory("feeds"),
3575
3617
  signer: this.keyring,
3576
3618
  hypercore: {
3577
- valueEncoding: import_echo_pipeline3.valueEncoding,
3619
+ valueEncoding: import_echo_pipeline2.valueEncoding,
3578
3620
  stats: true
3579
3621
  }
3580
3622
  })
3581
3623
  });
3582
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
3624
+ this.spaceManager = new import_echo_pipeline2.SpaceManager({
3583
3625
  feedStore: this.feedStore,
3584
3626
  networkManager: this.networkManager,
3585
3627
  blobStore: this.blobStore,
@@ -3595,15 +3637,15 @@ var ServiceContext = class ServiceContext2 {
3595
3637
  await this._checkStorageVersion();
3596
3638
  (0, import_log13.log)("opening...", void 0, {
3597
3639
  F: __dxlog_file15,
3598
- L: 135,
3640
+ L: 129,
3599
3641
  S: this,
3600
3642
  C: (f, a) => f(...a)
3601
3643
  });
3602
- 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({
3603
3645
  id: this._instanceId
3604
3646
  }), {
3605
3647
  F: __dxlog_file15,
3606
- L: 136,
3648
+ L: 130,
3607
3649
  S: this,
3608
3650
  C: (f, a) => f(...a)
3609
3651
  });
@@ -3615,17 +3657,17 @@ var ServiceContext = class ServiceContext2 {
3615
3657
  if (this.identityManager.identity) {
3616
3658
  await this._initialize(ctx);
3617
3659
  }
3618
- 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({
3619
3661
  id: this._instanceId
3620
3662
  }), {
3621
3663
  F: __dxlog_file15,
3622
- L: 146,
3664
+ L: 140,
3623
3665
  S: this,
3624
3666
  C: (f, a) => f(...a)
3625
3667
  });
3626
3668
  (0, import_log13.log)("opened", void 0, {
3627
3669
  F: __dxlog_file15,
3628
- L: 147,
3670
+ L: 141,
3629
3671
  S: this,
3630
3672
  C: (f, a) => f(...a)
3631
3673
  });
@@ -3633,7 +3675,7 @@ var ServiceContext = class ServiceContext2 {
3633
3675
  async close() {
3634
3676
  (0, import_log13.log)("closing...", void 0, {
3635
3677
  F: __dxlog_file15,
3636
- L: 151,
3678
+ L: 145,
3637
3679
  S: this,
3638
3680
  C: (f, a) => f(...a)
3639
3681
  });
@@ -3650,7 +3692,7 @@ var ServiceContext = class ServiceContext2 {
3650
3692
  await this.metadataStore.close();
3651
3693
  (0, import_log13.log)("closed", void 0, {
3652
3694
  F: __dxlog_file15,
3653
- L: 163,
3695
+ L: 157,
3654
3696
  S: this,
3655
3697
  C: (f, a) => f(...a)
3656
3698
  });
@@ -3662,9 +3704,9 @@ var ServiceContext = class ServiceContext2 {
3662
3704
  }
3663
3705
  getInvitationHandler(invitation) {
3664
3706
  const factory = this._handlerFactories.get(invitation.kind);
3665
- (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3707
+ (0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3666
3708
  F: __dxlog_file15,
3667
- L: 174,
3709
+ L: 168,
3668
3710
  S: this,
3669
3711
  A: [
3670
3712
  "factory",
@@ -3680,15 +3722,15 @@ var ServiceContext = class ServiceContext2 {
3680
3722
  }
3681
3723
  async _checkStorageVersion() {
3682
3724
  await this.metadataStore.load();
3683
- if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
3684
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
3725
+ if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
3726
+ throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
3685
3727
  }
3686
3728
  }
3687
3729
  // Called when identity is created.
3688
3730
  async _initialize(ctx) {
3689
3731
  (0, import_log13.log)("initializing spaces...", void 0, {
3690
3732
  F: __dxlog_file15,
3691
- L: 195,
3733
+ L: 189,
3692
3734
  S: this,
3693
3735
  C: (f, a) => f(...a)
3694
3736
  });
@@ -3709,9 +3751,9 @@ var ServiceContext = class ServiceContext2 {
3709
3751
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3710
3752
  await this.dataSpaceManager.open();
3711
3753
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3712
- (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3754
+ (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3713
3755
  F: __dxlog_file15,
3714
- L: 218,
3756
+ L: 212,
3715
3757
  S: this,
3716
3758
  A: [
3717
3759
  "this.dataSpaceManager",
@@ -3735,7 +3777,7 @@ var ServiceContext = class ServiceContext2 {
3735
3777
  details: assertion
3736
3778
  }, {
3737
3779
  F: __dxlog_file15,
3738
- L: 234,
3780
+ L: 228,
3739
3781
  S: this,
3740
3782
  C: (f, a) => f(...a)
3741
3783
  });
@@ -3746,7 +3788,7 @@ var ServiceContext = class ServiceContext2 {
3746
3788
  details: assertion
3747
3789
  }, {
3748
3790
  F: __dxlog_file15,
3749
- L: 238,
3791
+ L: 232,
3750
3792
  S: this,
3751
3793
  C: (f, a) => f(...a)
3752
3794
  });
@@ -3757,7 +3799,7 @@ var ServiceContext = class ServiceContext2 {
3757
3799
  details: assertion
3758
3800
  }, {
3759
3801
  F: __dxlog_file15,
3760
- L: 243,
3802
+ L: 237,
3761
3803
  S: this,
3762
3804
  C: (f, a) => f(...a)
3763
3805
  });
@@ -3768,7 +3810,7 @@ var ServiceContext = class ServiceContext2 {
3768
3810
  } catch (err) {
3769
3811
  import_log13.log.catch(err, void 0, {
3770
3812
  F: __dxlog_file15,
3771
- L: 249,
3813
+ L: 243,
3772
3814
  S: this,
3773
3815
  C: (f, a) => f(...a)
3774
3816
  });
@@ -3794,19 +3836,44 @@ var import_async17 = require("@dxos/async");
3794
3836
  var import_client_protocol5 = require("@dxos/client-protocol");
3795
3837
  var import_context10 = require("@dxos/context");
3796
3838
  var import_document_model2 = require("@dxos/document-model");
3797
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3798
- 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");
3799
3842
  var import_keys12 = require("@dxos/keys");
3800
3843
  var import_log16 = require("@dxos/log");
3801
3844
  var import_messaging = require("@dxos/messaging");
3802
3845
  var import_model_factory = require("@dxos/model-factory");
3803
3846
  var import_network_manager2 = require("@dxos/network-manager");
3804
- var import_protocols10 = require("@dxos/protocols");
3847
+ var import_protocols12 = require("@dxos/protocols");
3805
3848
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3806
3849
  var import_text_model = require("@dxos/text-model");
3807
3850
  var import_tracing5 = require("@dxos/tracing");
3808
3851
  var import_websocket_rpc = require("@dxos/websocket-rpc");
3809
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
+
3810
3877
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3811
3878
  var import_async12 = require("@dxos/async");
3812
3879
  var import_codec_protobuf6 = require("@dxos/codec-protobuf");
@@ -4159,7 +4226,7 @@ var DevtoolsServiceImpl = class {
4159
4226
  };
4160
4227
 
4161
4228
  // packages/sdk/client-services/src/packlets/locks/node.ts
4162
- var import_invariant13 = require("@dxos/invariant");
4229
+ var import_invariant14 = require("@dxos/invariant");
4163
4230
  var import_lock_file = require("@dxos/lock-file");
4164
4231
  var import_log14 = require("@dxos/log");
4165
4232
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4200,7 +4267,7 @@ var Lock = class {
4200
4267
  }
4201
4268
  async release() {
4202
4269
  await this._onRelease?.();
4203
- (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4270
+ (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4204
4271
  F: __dxlog_file16,
4205
4272
  L: 42,
4206
4273
  S: this,
@@ -4367,29 +4434,29 @@ var NetworkServiceImpl = class {
4367
4434
 
4368
4435
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4369
4436
  var import_client_protocol4 = require("@dxos/client-protocol");
4370
- var import_errors5 = require("@dxos/errors");
4437
+ var import_protocols11 = require("@dxos/protocols");
4371
4438
  var import_config = require("@dxos/protocols/proto/dxos/config");
4372
4439
  var import_random_access_storage = require("@dxos/random-access-storage");
4373
4440
  var import_util8 = require("@dxos/util");
4374
4441
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4375
4442
  var createStorageObjects = (config) => {
4376
- const { path = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage", storageType, keyStorage, persistent = false } = config ?? {};
4377
- if (persistent && storageType === StorageDriver.RAM) {
4378
- 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.");
4379
4446
  }
4380
- if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
4381
- 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.");
4382
4449
  }
4383
- if (persistent && keyStorage === StorageDriver.RAM) {
4384
- 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.");
4385
4452
  }
4386
- if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
4387
- 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.");
4388
4455
  }
4389
4456
  return {
4390
4457
  storage: (0, import_random_access_storage.createStorage)({
4391
- type: persistent ? toStorageType(storageType) : import_random_access_storage.StorageType.RAM,
4392
- root: `${path}/`
4458
+ type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
4459
+ root: `${dataRoot}/`
4393
4460
  })
4394
4461
  };
4395
4462
  };
@@ -4468,30 +4535,6 @@ var SystemServiceImpl = class {
4468
4535
  }
4469
4536
  };
4470
4537
 
4471
- // packages/sdk/client-services/src/packlets/services/service-registry.ts
4472
- var ServiceRegistry = class {
4473
- // prettier-ignore
4474
- constructor(_serviceBundle, _handlers = {}) {
4475
- this._serviceBundle = _serviceBundle;
4476
- this._handlers = _handlers;
4477
- }
4478
- get descriptors() {
4479
- return this._serviceBundle;
4480
- }
4481
- get services() {
4482
- return this._handlers;
4483
- }
4484
- setServices(services) {
4485
- this._handlers = services;
4486
- }
4487
- addService(name, service) {
4488
- this._handlers[name] = service;
4489
- }
4490
- removeService(name) {
4491
- delete this._handlers[name];
4492
- }
4493
- };
4494
-
4495
4538
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4496
4539
  function _ts_decorate7(decorators, target, key, desc) {
4497
4540
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4507,6 +4550,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4507
4550
  var createDefaultModelFactory = () => {
4508
4551
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4509
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
+ };
4510
4565
  var ClientServicesHost = class ClientServicesHost2 {
4511
4566
  constructor({
4512
4567
  config,
@@ -4591,9 +4646,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4591
4646
  * Can only be called once.
4592
4647
  */
4593
4648
  initialize({ config, ...options }) {
4594
- (0, import_invariant14.invariant)(!this._open, "service host is open", {
4649
+ (0, import_invariant15.invariant)(!this._open, "service host is open", {
4595
4650
  F: __dxlog_file17,
4596
- L: 184,
4651
+ L: 201,
4597
4652
  S: this,
4598
4653
  A: [
4599
4654
  "!this._open",
@@ -4602,14 +4657,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4602
4657
  });
4603
4658
  (0, import_log16.log)("initializing...", void 0, {
4604
4659
  F: __dxlog_file17,
4605
- L: 185,
4660
+ L: 202,
4606
4661
  S: this,
4607
4662
  C: (f, a) => f(...a)
4608
4663
  });
4609
4664
  if (config) {
4610
- (0, import_invariant14.invariant)(!this._config, "config already set", {
4665
+ (0, import_invariant15.invariant)(!this._config, "config already set", {
4611
4666
  F: __dxlog_file17,
4612
- L: 188,
4667
+ L: 205,
4613
4668
  S: this,
4614
4669
  A: [
4615
4670
  "!this._config",
@@ -4625,9 +4680,9 @@ var ClientServicesHost = class ClientServicesHost2 {
4625
4680
  iceServers: this._config?.get("runtime.services.ice")
4626
4681
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4627
4682
  this._signalManager = signalManager;
4628
- (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4683
+ (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4629
4684
  F: __dxlog_file17,
4630
- L: 204,
4685
+ L: 221,
4631
4686
  S: this,
4632
4687
  A: [
4633
4688
  "!this._networkManager",
@@ -4641,7 +4696,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4641
4696
  });
4642
4697
  (0, import_log16.log)("initialized", void 0, {
4643
4698
  F: __dxlog_file17,
4644
- L: 211,
4699
+ L: 228,
4645
4700
  S: this,
4646
4701
  C: (f, a) => f(...a)
4647
4702
  });
@@ -4651,44 +4706,44 @@ var ClientServicesHost = class ClientServicesHost2 {
4651
4706
  return;
4652
4707
  }
4653
4708
  const traceId = import_keys12.PublicKey.random().toHex();
4654
- 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({
4655
4710
  id: traceId
4656
4711
  }), {
4657
4712
  F: __dxlog_file17,
4658
- L: 222,
4713
+ L: 239,
4659
4714
  S: this,
4660
4715
  C: (f, a) => f(...a)
4661
4716
  });
4662
- (0, import_invariant14.invariant)(this._config, "config not set", {
4717
+ (0, import_invariant15.invariant)(this._config, "config not set", {
4663
4718
  F: __dxlog_file17,
4664
- L: 224,
4719
+ L: 241,
4665
4720
  S: this,
4666
4721
  A: [
4667
4722
  "this._config",
4668
4723
  "'config not set'"
4669
4724
  ]
4670
4725
  });
4671
- (0, import_invariant14.invariant)(this._storage, "storage not set", {
4726
+ (0, import_invariant15.invariant)(this._storage, "storage not set", {
4672
4727
  F: __dxlog_file17,
4673
- L: 225,
4728
+ L: 242,
4674
4729
  S: this,
4675
4730
  A: [
4676
4731
  "this._storage",
4677
4732
  "'storage not set'"
4678
4733
  ]
4679
4734
  });
4680
- (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4735
+ (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4681
4736
  F: __dxlog_file17,
4682
- L: 226,
4737
+ L: 243,
4683
4738
  S: this,
4684
4739
  A: [
4685
4740
  "this._signalManager",
4686
4741
  "'signal manager not set'"
4687
4742
  ]
4688
4743
  });
4689
- (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4744
+ (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4690
4745
  F: __dxlog_file17,
4691
- L: 227,
4746
+ L: 244,
4692
4747
  S: this,
4693
4748
  A: [
4694
4749
  "this._networkManager",
@@ -4700,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4700
4755
  lockKey: this._resourceLock?.lockKey
4701
4756
  }, {
4702
4757
  F: __dxlog_file17,
4703
- L: 230,
4758
+ L: 247,
4704
4759
  S: this,
4705
4760
  C: (f, a) => f(...a)
4706
4761
  });
@@ -4709,14 +4764,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4709
4764
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4710
4765
  this._serviceRegistry.setServices({
4711
4766
  SystemService: this._systemService,
4712
- 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),
4713
4768
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4714
4769
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4715
4770
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
4716
4771
  await this._serviceContext.initialized.wait();
4717
4772
  return this._serviceContext.dataSpaceManager;
4718
4773
  }),
4719
- DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4774
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4720
4775
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4721
4776
  LoggingService: this._loggingService,
4722
4777
  TracingService: this._tracingService,
@@ -4746,15 +4801,15 @@ var ClientServicesHost = class ClientServicesHost2 {
4746
4801
  deviceKey
4747
4802
  }, {
4748
4803
  F: __dxlog_file17,
4749
- L: 299,
4804
+ L: 316,
4750
4805
  S: this,
4751
4806
  C: (f, a) => f(...a)
4752
4807
  });
4753
- 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({
4754
4809
  id: traceId
4755
4810
  }), {
4756
4811
  F: __dxlog_file17,
4757
- L: 300,
4812
+ L: 317,
4758
4813
  S: this,
4759
4814
  C: (f, a) => f(...a)
4760
4815
  });
@@ -4768,7 +4823,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4768
4823
  deviceKey
4769
4824
  }, {
4770
4825
  F: __dxlog_file17,
4771
- L: 311,
4826
+ L: 328,
4772
4827
  S: this,
4773
4828
  C: (f, a) => f(...a)
4774
4829
  });
@@ -4784,24 +4839,24 @@ var ClientServicesHost = class ClientServicesHost2 {
4784
4839
  deviceKey
4785
4840
  }, {
4786
4841
  F: __dxlog_file17,
4787
- L: 318,
4842
+ L: 335,
4788
4843
  S: this,
4789
4844
  C: (f, a) => f(...a)
4790
4845
  });
4791
4846
  }
4792
4847
  async reset() {
4793
4848
  const traceId = import_keys12.PublicKey.random().toHex();
4794
- 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({
4795
4850
  id: traceId
4796
4851
  }), {
4797
4852
  F: __dxlog_file17,
4798
- L: 323,
4853
+ L: 340,
4799
4854
  S: this,
4800
4855
  C: (f, a) => f(...a)
4801
4856
  });
4802
4857
  (0, import_log16.log)("resetting...", void 0, {
4803
4858
  F: __dxlog_file17,
4804
- L: 325,
4859
+ L: 342,
4805
4860
  S: this,
4806
4861
  C: (f, a) => f(...a)
4807
4862
  });
@@ -4809,20 +4864,39 @@ var ClientServicesHost = class ClientServicesHost2 {
4809
4864
  await this._storage.reset();
4810
4865
  (0, import_log16.log)("reset", void 0, {
4811
4866
  F: __dxlog_file17,
4812
- L: 328,
4867
+ L: 345,
4813
4868
  S: this,
4814
4869
  C: (f, a) => f(...a)
4815
4870
  });
4816
- 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({
4817
4872
  id: traceId
4818
4873
  }), {
4819
4874
  F: __dxlog_file17,
4820
- L: 329,
4875
+ L: 346,
4821
4876
  S: this,
4822
4877
  C: (f, a) => f(...a)
4823
4878
  });
4824
4879
  await this._callbacks?.onReset?.();
4825
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
+ }
4826
4900
  };
4827
4901
  _ts_decorate7([
4828
4902
  import_tracing5.trace.info()
@@ -4873,7 +4947,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4873
4947
  if (hooks?.guest?.onConnecting?.(guestObservable)) {
4874
4948
  break;
4875
4949
  }
4876
- (0, import_invariant15.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4950
+ (0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4877
4951
  F: __dxlog_file18,
4878
4952
  L: 84,
4879
4953
  S: void 0,
@@ -5006,7 +5080,7 @@ var createInvitation = (host, options) => {
5006
5080
  });
5007
5081
  return host.invitations.createInvitation(hostHandler, options);
5008
5082
  }
5009
- return host.createInvitation(options);
5083
+ return host.share(options);
5010
5084
  };
5011
5085
  var acceptInvitation = (guest, invitation) => {
5012
5086
  invitation = sanitizeInvitation(invitation);
@@ -5016,14 +5090,14 @@ var acceptInvitation = (guest, invitation) => {
5016
5090
  });
5017
5091
  return guest.invitations.acceptInvitation(guestHandler, invitation);
5018
5092
  }
5019
- return guest.acceptInvitation(invitation);
5093
+ return guest.join(invitation);
5020
5094
  };
5021
5095
 
5022
5096
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
5023
5097
  var import_context11 = require("@dxos/context");
5024
5098
  var import_credentials16 = require("@dxos/credentials");
5025
5099
  var import_debug8 = require("@dxos/debug");
5026
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
5100
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
5027
5101
  var import_testing = require("@dxos/echo-pipeline/testing");
5028
5102
  var import_feed_store5 = require("@dxos/feed-store");
5029
5103
  var import_keyring2 = require("@dxos/keyring");
@@ -5083,7 +5157,7 @@ var TestBuilder = class {
5083
5157
  };
5084
5158
  var TestPeer = class {
5085
5159
  constructor(signalContext, opts = {
5086
- storageType: import_random_access_storage2.StorageType.RAM
5160
+ dataStore: import_random_access_storage2.StorageType.RAM
5087
5161
  }) {
5088
5162
  this.signalContext = signalContext;
5089
5163
  this.opts = opts;
@@ -5094,7 +5168,7 @@ var TestPeer = class {
5094
5168
  }
5095
5169
  get storage() {
5096
5170
  return this._props.storage ??= (0, import_random_access_storage2.createStorage)({
5097
- type: this.opts.storageType
5171
+ type: this.opts.dataStore
5098
5172
  });
5099
5173
  }
5100
5174
  get keyring() {
@@ -5106,19 +5180,19 @@ var TestPeer = class {
5106
5180
  root: this.storage.createDirectory("feeds"),
5107
5181
  signer: this.keyring,
5108
5182
  hypercore: {
5109
- valueEncoding: import_echo_pipeline5.valueEncoding
5183
+ valueEncoding: import_echo_pipeline4.valueEncoding
5110
5184
  }
5111
5185
  })
5112
5186
  });
5113
5187
  }
5114
5188
  get metadataStore() {
5115
- 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"));
5116
5190
  }
5117
5191
  get blobStore() {
5118
5192
  return this._props.blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
5119
5193
  }
5120
5194
  get snapshotStore() {
5121
- 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"));
5122
5196
  }
5123
5197
  get networkManager() {
5124
5198
  return this._props.networkManager ??= new import_network_manager3.NetworkManager({
@@ -5127,7 +5201,7 @@ var TestPeer = class {
5127
5201
  });
5128
5202
  }
5129
5203
  get spaceManager() {
5130
- return this._props.spaceManager ??= new import_echo_pipeline5.SpaceManager({
5204
+ return this._props.spaceManager ??= new import_echo_pipeline4.SpaceManager({
5131
5205
  feedStore: this.feedStore,
5132
5206
  networkManager: this.networkManager,
5133
5207
  metadataStore: this.metadataStore,
@@ -5140,7 +5214,7 @@ var TestPeer = class {
5140
5214
  return this._props.signingContext ?? (0, import_debug8.failUndefined)();
5141
5215
  }
5142
5216
  get dataSpaceManager() {
5143
- 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);
5144
5218
  }
5145
5219
  async createIdentity() {
5146
5220
  this._props.signingContext ??= await createSigningContext(this.keyring);