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

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