@dxos/client-services 0.1.36-next.ef27157 → 0.1.37-next.41339e7

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 (32) hide show
  1. package/dist/lib/browser/{chunk-OINEQJWM.mjs → chunk-6PNXHM7C.mjs} +232 -90
  2. package/dist/lib/browser/chunk-6PNXHM7C.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +2 -2
  7. package/dist/lib/node/index.cjs +230 -88
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +230 -88
  11. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  12. package/dist/types/src/packlets/identity/identity-manager.d.ts +1 -0
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  14. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  15. package/dist/types/src/packlets/services/service-context.d.ts +0 -1
  16. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  18. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -0
  20. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  21. package/dist/types/src/packlets/testing/test-builder.d.ts +3 -3
  22. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  23. package/package.json +30 -30
  24. package/src/packlets/identity/identity-manager.ts +2 -1
  25. package/src/packlets/invitations/invitations-handler.ts +50 -5
  26. package/src/packlets/services/service-context.ts +7 -9
  27. package/src/packlets/services/service-host.ts +8 -2
  28. package/src/packlets/spaces/data-space-manager.ts +5 -0
  29. package/src/packlets/storage/storage.ts +2 -0
  30. package/src/packlets/testing/test-builder.ts +3 -3
  31. package/src/packlets/tests/spaces.test.ts +24 -0
  32. package/dist/lib/browser/chunk-OINEQJWM.mjs.map +0 -7
@@ -651,10 +651,11 @@ var IdentityManager = class {
651
651
  async open() {
652
652
  var _a;
653
653
  import_log3.log.trace("dxos.halo.identity-manager", import_protocols2.trace.begin({
654
- id: this._instanceId
654
+ id: this._instanceId,
655
+ parentId: this._traceParent
655
656
  }), {
656
657
  file: "identity-manager.ts",
657
- line: 71,
658
+ line: 72,
658
659
  scope: this,
659
660
  callSite: (f, a) => f(...a)
660
661
  });
@@ -664,7 +665,7 @@ var IdentityManager = class {
664
665
  identityRecord
665
666
  }, {
666
667
  file: "identity-manager.ts",
667
- line: 75,
668
+ line: 76,
668
669
  scope: this,
669
670
  callSite: (f, a) => f(...a)
670
671
  });
@@ -677,7 +678,7 @@ var IdentityManager = class {
677
678
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
678
679
  }, {
679
680
  file: "identity-manager.ts",
680
- line: 80,
681
+ line: 81,
681
682
  scope: this,
682
683
  callSite: (f, a) => f(...a)
683
684
  });
@@ -691,7 +692,7 @@ var IdentityManager = class {
691
692
  id: this._instanceId
692
693
  }), {
693
694
  file: "identity-manager.ts",
694
- line: 90,
695
+ line: 91,
695
696
  scope: this,
696
697
  callSite: (f, a) => f(...a)
697
698
  });
@@ -701,7 +702,7 @@ var IdentityManager = class {
701
702
  (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
702
703
  (0, import_log3.log)("creating identity...", {}, {
703
704
  file: "identity-manager.ts",
704
- line: 95,
705
+ line: 96,
705
706
  scope: this,
706
707
  callSite: (f, a) => f(...a)
707
708
  });
@@ -750,7 +751,7 @@ var IdentityManager = class {
750
751
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
751
752
  }, {
752
753
  file: "identity-manager.ts",
753
- line: 150,
754
+ line: 151,
754
755
  scope: this,
755
756
  callSite: (f, a) => f(...a)
756
757
  });
@@ -760,7 +761,7 @@ var IdentityManager = class {
760
761
  deviceKey: identity.deviceKey
761
762
  }, {
762
763
  file: "identity-manager.ts",
763
- line: 156,
764
+ line: 157,
764
765
  scope: this,
765
766
  callSite: (f, a) => f(...a)
766
767
  });
@@ -775,7 +776,7 @@ var IdentityManager = class {
775
776
  params
776
777
  }, {
777
778
  file: "identity-manager.ts",
778
- line: 164,
779
+ line: 165,
779
780
  scope: this,
780
781
  callSite: (f, a) => f(...a)
781
782
  });
@@ -801,7 +802,7 @@ var IdentityManager = class {
801
802
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
802
803
  }, {
803
804
  file: "identity-manager.ts",
804
- line: 184,
805
+ line: 185,
805
806
  scope: this,
806
807
  callSite: (f, a) => f(...a)
807
808
  });
@@ -811,7 +812,7 @@ var IdentityManager = class {
811
812
  deviceKey: identity.deviceKey
812
813
  }, {
813
814
  file: "identity-manager.ts",
814
- line: 190,
815
+ line: 191,
815
816
  scope: this,
816
817
  callSite: (f, a) => f(...a)
817
818
  });
@@ -823,7 +824,7 @@ var IdentityManager = class {
823
824
  identityRecord
824
825
  }, {
825
826
  file: "identity-manager.ts",
826
- line: 196,
827
+ line: 197,
827
828
  scope: this,
828
829
  callSite: (f, a) => f(...a)
829
830
  });
@@ -856,7 +857,7 @@ var IdentityManager = class {
856
857
  identityKey: identityRecord.identityKey
857
858
  }, {
858
859
  file: "identity-manager.ts",
859
- line: 224,
860
+ line: 225,
860
861
  scope: this,
861
862
  callSite: (f, a) => f(...a)
862
863
  });
@@ -1036,7 +1037,7 @@ var InvitationsHandler = class {
1036
1037
  ...protocol.toJSON()
1037
1038
  }, {
1038
1039
  file: "invitations-handler.ts",
1039
- line: 102,
1040
+ line: 106,
1040
1041
  scope: this,
1041
1042
  callSite: (f, a) => f(...a)
1042
1043
  });
@@ -1054,7 +1055,7 @@ var InvitationsHandler = class {
1054
1055
  ...protocol.toJSON()
1055
1056
  }, {
1056
1057
  file: "invitations-handler.ts",
1057
- line: 115,
1058
+ line: 119,
1058
1059
  scope: this,
1059
1060
  callSite: (f, a) => f(...a)
1060
1061
  });
@@ -1073,7 +1074,7 @@ var InvitationsHandler = class {
1073
1074
  authCode: code
1074
1075
  }, {
1075
1076
  file: "invitations-handler.ts",
1076
- line: 134,
1077
+ line: 138,
1077
1078
  scope: this,
1078
1079
  callSite: (f, a) => f(...a)
1079
1080
  });
@@ -1082,7 +1083,7 @@ var InvitationsHandler = class {
1082
1083
  case import_services2.Invitation.AuthMethod.NONE: {
1083
1084
  (0, import_log4.log)("authentication not required", {}, {
1084
1085
  file: "invitations-handler.ts",
1085
- line: 139,
1086
+ line: 143,
1086
1087
  scope: this,
1087
1088
  callSite: (f, a) => f(...a)
1088
1089
  });
@@ -1107,7 +1108,7 @@ var InvitationsHandler = class {
1107
1108
  authMethod: invitation.authMethod
1108
1109
  }, {
1109
1110
  file: "invitations-handler.ts",
1110
- line: 157,
1111
+ line: 161,
1111
1112
  scope: this,
1112
1113
  callSite: (f, a) => f(...a)
1113
1114
  });
@@ -1137,12 +1138,22 @@ var InvitationsHandler = class {
1137
1138
  },
1138
1139
  onOpen: () => {
1139
1140
  (0, import_async6.scheduleTask)(ctx, async () => {
1141
+ const traceId = import_keys5.PublicKey.random().toHex();
1140
1142
  try {
1143
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.begin({
1144
+ id: traceId,
1145
+ parentId: this._traceParent
1146
+ }), {
1147
+ file: "invitations-handler.ts",
1148
+ line: 196,
1149
+ scope: this,
1150
+ callSite: (f, a) => f(...a)
1151
+ });
1141
1152
  (0, import_log4.log)("connected", {
1142
1153
  ...protocol.toJSON()
1143
1154
  }, {
1144
1155
  file: "invitations-handler.ts",
1145
- line: 191,
1156
+ line: 200,
1146
1157
  scope: this,
1147
1158
  callSite: (f, a) => f(...a)
1148
1159
  });
@@ -1158,7 +1169,7 @@ var InvitationsHandler = class {
1158
1169
  ...protocol.toJSON()
1159
1170
  }, {
1160
1171
  file: "invitations-handler.ts",
1161
- line: 194,
1172
+ line: 203,
1162
1173
  scope: this,
1163
1174
  callSite: (f, a) => f(...a)
1164
1175
  });
@@ -1166,13 +1177,21 @@ var InvitationsHandler = class {
1166
1177
  ...invitation,
1167
1178
  state: import_services2.Invitation.State.SUCCESS
1168
1179
  });
1180
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.end({
1181
+ id: traceId
1182
+ }), {
1183
+ file: "invitations-handler.ts",
1184
+ line: 205,
1185
+ scope: this,
1186
+ callSite: (f, a) => f(...a)
1187
+ });
1169
1188
  } catch (err) {
1170
1189
  if (err instanceof import_async6.TimeoutError) {
1171
1190
  (0, import_log4.log)("timeout", {
1172
1191
  ...protocol.toJSON()
1173
1192
  }, {
1174
1193
  file: "invitations-handler.ts",
1175
- line: 198,
1194
+ line: 208,
1176
1195
  scope: this,
1177
1196
  callSite: (f, a) => f(...a)
1178
1197
  });
@@ -1183,12 +1202,21 @@ var InvitationsHandler = class {
1183
1202
  } else {
1184
1203
  import_log4.log.error("failed", err, {
1185
1204
  file: "invitations-handler.ts",
1186
- line: 201,
1205
+ line: 211,
1187
1206
  scope: this,
1188
1207
  callSite: (f, a) => f(...a)
1189
1208
  });
1190
1209
  stream.error(err);
1191
1210
  }
1211
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.error({
1212
+ id: traceId,
1213
+ error: err
1214
+ }), {
1215
+ file: "invitations-handler.ts",
1216
+ line: 214,
1217
+ scope: this,
1218
+ callSite: (f, a) => f(...a)
1219
+ });
1192
1220
  } finally {
1193
1221
  if (type !== import_services2.Invitation.Type.MULTIUSE) {
1194
1222
  await (0, import_async6.sleep)(import_client.ON_CLOSE_DELAY);
@@ -1198,6 +1226,7 @@ var InvitationsHandler = class {
1198
1226
  });
1199
1227
  }
1200
1228
  });
1229
+ extension._traceParent = this._traceParent;
1201
1230
  return extension;
1202
1231
  };
1203
1232
  (0, import_async6.scheduleTask)(ctx, async () => {
@@ -1241,7 +1270,7 @@ var InvitationsHandler = class {
1241
1270
  ...protocol.toJSON()
1242
1271
  }, {
1243
1272
  file: "invitations-handler.ts",
1244
- line: 255,
1273
+ line: 267,
1245
1274
  scope: this,
1246
1275
  callSite: (f, a) => f(...a)
1247
1276
  });
@@ -1252,7 +1281,7 @@ var InvitationsHandler = class {
1252
1281
  } else {
1253
1282
  import_log4.log.warn("auth failed", err, {
1254
1283
  file: "invitations-handler.ts",
1255
- line: 258,
1284
+ line: 270,
1256
1285
  scope: this,
1257
1286
  callSite: (f, a) => f(...a)
1258
1287
  });
@@ -1266,7 +1295,7 @@ var InvitationsHandler = class {
1266
1295
  ...protocol.toJSON()
1267
1296
  }, {
1268
1297
  file: "invitations-handler.ts",
1269
- line: 266,
1298
+ line: 278,
1270
1299
  scope: this,
1271
1300
  callSite: (f, a) => f(...a)
1272
1301
  });
@@ -1277,7 +1306,17 @@ var InvitationsHandler = class {
1277
1306
  const extension = new InvitationGuestExtension({
1278
1307
  onOpen: () => {
1279
1308
  (0, import_async6.scheduleTask)(ctx, async () => {
1309
+ const traceId = import_keys5.PublicKey.random().toHex();
1280
1310
  try {
1311
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.begin({
1312
+ id: traceId,
1313
+ parentId: this._traceParent
1314
+ }), {
1315
+ file: "invitations-handler.ts",
1316
+ line: 290,
1317
+ scope: this,
1318
+ callSite: (f, a) => f(...a)
1319
+ });
1281
1320
  if (++connectionCount > 1) {
1282
1321
  throw new Error(`multiple connections detected: ${connectionCount}`);
1283
1322
  }
@@ -1286,7 +1325,7 @@ var InvitationsHandler = class {
1286
1325
  ...protocol.toJSON()
1287
1326
  }, {
1288
1327
  file: "invitations-handler.ts",
1289
- line: 284,
1328
+ line: 301,
1290
1329
  scope: this,
1291
1330
  callSite: (f, a) => f(...a)
1292
1331
  });
@@ -1298,7 +1337,7 @@ var InvitationsHandler = class {
1298
1337
  ...protocol.toJSON()
1299
1338
  }, {
1300
1339
  file: "invitations-handler.ts",
1301
- line: 288,
1340
+ line: 305,
1302
1341
  scope: this,
1303
1342
  callSite: (f, a) => f(...a)
1304
1343
  });
@@ -1308,7 +1347,7 @@ var InvitationsHandler = class {
1308
1347
  response: introductionResponse
1309
1348
  }, {
1310
1349
  file: "invitations-handler.ts",
1311
- line: 292,
1350
+ line: 309,
1312
1351
  scope: this,
1313
1352
  callSite: (f, a) => f(...a)
1314
1353
  });
@@ -1320,7 +1359,7 @@ var InvitationsHandler = class {
1320
1359
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1321
1360
  (0, import_log4.log)("guest waiting for authentication code...", {}, {
1322
1361
  file: "invitations-handler.ts",
1323
- line: 301,
1362
+ line: 318,
1324
1363
  scope: this,
1325
1364
  callSite: (f, a) => f(...a)
1326
1365
  });
@@ -1333,7 +1372,7 @@ var InvitationsHandler = class {
1333
1372
  });
1334
1373
  (0, import_log4.log)("sending authentication request", {}, {
1335
1374
  file: "invitations-handler.ts",
1336
- line: 305,
1375
+ line: 322,
1337
1376
  scope: this,
1338
1377
  callSite: (f, a) => f(...a)
1339
1378
  });
@@ -1355,7 +1394,7 @@ var InvitationsHandler = class {
1355
1394
  attempt
1356
1395
  }, {
1357
1396
  file: "invitations-handler.ts",
1358
- line: 316,
1397
+ line: 333,
1359
1398
  scope: this,
1360
1399
  callSite: (f, a) => f(...a)
1361
1400
  });
@@ -1373,7 +1412,7 @@ var InvitationsHandler = class {
1373
1412
  ...protocol.toJSON()
1374
1413
  }, {
1375
1414
  file: "invitations-handler.ts",
1376
- line: 327,
1415
+ line: 344,
1377
1416
  scope: this,
1378
1417
  callSite: (f, a) => f(...a)
1379
1418
  });
@@ -1384,7 +1423,7 @@ var InvitationsHandler = class {
1384
1423
  ...protocol.toJSON()
1385
1424
  }, {
1386
1425
  file: "invitations-handler.ts",
1387
- line: 335,
1426
+ line: 352,
1388
1427
  scope: this,
1389
1428
  callSite: (f, a) => f(...a)
1390
1429
  });
@@ -1393,13 +1432,21 @@ var InvitationsHandler = class {
1393
1432
  ...result,
1394
1433
  state: import_services2.Invitation.State.SUCCESS
1395
1434
  });
1435
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.end({
1436
+ id: traceId
1437
+ }), {
1438
+ file: "invitations-handler.ts",
1439
+ line: 354,
1440
+ scope: this,
1441
+ callSite: (f, a) => f(...a)
1442
+ });
1396
1443
  } catch (err) {
1397
1444
  if (err instanceof import_async6.TimeoutError) {
1398
1445
  (0, import_log4.log)("timeout", {
1399
1446
  ...protocol.toJSON()
1400
1447
  }, {
1401
1448
  file: "invitations-handler.ts",
1402
- line: 339,
1449
+ line: 357,
1403
1450
  scope: this,
1404
1451
  callSite: (f, a) => f(...a)
1405
1452
  });
@@ -1408,14 +1455,23 @@ var InvitationsHandler = class {
1408
1455
  state: import_services2.Invitation.State.TIMEOUT
1409
1456
  });
1410
1457
  } else {
1411
- import_log4.log.warn("auth failed", err, {
1458
+ (0, import_log4.log)("auth failed", err, {
1412
1459
  file: "invitations-handler.ts",
1413
- line: 342,
1460
+ line: 360,
1414
1461
  scope: this,
1415
1462
  callSite: (f, a) => f(...a)
1416
1463
  });
1417
1464
  stream.error(err);
1418
1465
  }
1466
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.error({
1467
+ id: traceId,
1468
+ error: err
1469
+ }), {
1470
+ file: "invitations-handler.ts",
1471
+ line: 363,
1472
+ scope: this,
1473
+ callSite: (f, a) => f(...a)
1474
+ });
1419
1475
  } finally {
1420
1476
  await ctx.dispose();
1421
1477
  }
@@ -1474,13 +1530,73 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1474
1530
  // Perhaps in the future we will have more complex logic here.
1475
1531
  InvitationHostService: {
1476
1532
  introduce: async (request) => {
1477
- return this._callbacks.introduce(request);
1533
+ const traceId = import_keys5.PublicKey.random().toHex();
1534
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
1535
+ id: traceId,
1536
+ parentId: this._traceParent
1537
+ }), {
1538
+ file: "invitations-handler.ts",
1539
+ line: 442,
1540
+ scope: this,
1541
+ callSite: (f, a) => f(...a)
1542
+ });
1543
+ const response = await this._callbacks.introduce(request);
1544
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
1545
+ id: traceId
1546
+ }), {
1547
+ file: "invitations-handler.ts",
1548
+ line: 447,
1549
+ scope: this,
1550
+ callSite: (f, a) => f(...a)
1551
+ });
1552
+ return response;
1478
1553
  },
1479
1554
  authenticate: async (request) => {
1480
- return this._callbacks.authenticate(request);
1555
+ const traceId = import_keys5.PublicKey.random().toHex();
1556
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
1557
+ id: traceId,
1558
+ parentId: this._traceParent
1559
+ }), {
1560
+ file: "invitations-handler.ts",
1561
+ line: 453,
1562
+ scope: this,
1563
+ callSite: (f, a) => f(...a)
1564
+ });
1565
+ const response = await this._callbacks.authenticate(request);
1566
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.end({
1567
+ id: traceId,
1568
+ data: {
1569
+ ...response
1570
+ }
1571
+ }), {
1572
+ file: "invitations-handler.ts",
1573
+ line: 458,
1574
+ scope: this,
1575
+ callSite: (f, a) => f(...a)
1576
+ });
1577
+ return response;
1481
1578
  },
1482
1579
  admit: async (request) => {
1483
- return this._callbacks.admit(request);
1580
+ const traceId = import_keys5.PublicKey.random().toHex();
1581
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
1582
+ id: traceId,
1583
+ parentId: this._traceParent
1584
+ }), {
1585
+ file: "invitations-handler.ts",
1586
+ line: 464,
1587
+ scope: this,
1588
+ callSite: (f, a) => f(...a)
1589
+ });
1590
+ const response = await this._callbacks.admit(request);
1591
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
1592
+ id: traceId
1593
+ }), {
1594
+ file: "invitations-handler.ts",
1595
+ line: 469,
1596
+ scope: this,
1597
+ callSite: (f, a) => f(...a)
1598
+ });
1599
+ return response;
1484
1600
  }
1485
1601
  }
1486
1602
  };
@@ -1844,7 +1960,7 @@ var import_async18 = require("@dxos/async");
1844
1960
  var import_client8 = require("@dxos/client");
1845
1961
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
1846
1962
  var import_log16 = require("@dxos/log");
1847
- var import_protocols6 = require("@dxos/protocols");
1963
+ var import_protocols7 = require("@dxos/protocols");
1848
1964
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
1849
1965
 
1850
1966
  // packages/sdk/client-services/src/packlets/deprecated/tracing.ts
@@ -1938,6 +2054,7 @@ var import_credentials10 = require("@dxos/credentials");
1938
2054
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
1939
2055
  var import_keys8 = require("@dxos/keys");
1940
2056
  var import_log9 = require("@dxos/log");
2057
+ var import_protocols5 = require("@dxos/protocols");
1941
2058
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
1942
2059
  var import_util5 = require("@dxos/util");
1943
2060
 
@@ -2434,6 +2551,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2434
2551
  this.updated = new import_async10.Event();
2435
2552
  this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
2436
2553
  this._isOpen = false;
2554
+ this._instanceId = import_keys8.PublicKey.random().toHex();
2437
2555
  }
2438
2556
  // TODO(burdon): Remove.
2439
2557
  get spaces() {
@@ -2442,7 +2560,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2442
2560
  async open() {
2443
2561
  (0, import_log9.log)("open", {}, {
2444
2562
  file: "data-space-manager.ts",
2445
- line: 80,
2563
+ line: 83,
2564
+ scope: this,
2565
+ callSite: (f, a) => f(...a)
2566
+ });
2567
+ import_log9.log.trace("dxos.echo.data-space-manager", import_protocols5.trace.begin({
2568
+ id: this._instanceId,
2569
+ parentId: this._traceParent
2570
+ }), {
2571
+ file: "data-space-manager.ts",
2572
+ line: 84,
2446
2573
  scope: this,
2447
2574
  callSite: (f, a) => f(...a)
2448
2575
  });
@@ -2451,7 +2578,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2451
2578
  spaces: this._metadataStore.spaces.length
2452
2579
  }, {
2453
2580
  file: "data-space-manager.ts",
2454
- line: 82,
2581
+ line: 86,
2455
2582
  scope: this,
2456
2583
  callSite: (f, a) => f(...a)
2457
2584
  });
@@ -2460,7 +2587,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2460
2587
  spaceMetadata
2461
2588
  }, {
2462
2589
  file: "data-space-manager.ts",
2463
- line: 85,
2590
+ line: 89,
2464
2591
  scope: this,
2465
2592
  callSite: (f, a) => f(...a)
2466
2593
  });
@@ -2473,7 +2600,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2473
2600
  async close() {
2474
2601
  (0, import_log9.log)("close", {}, {
2475
2602
  file: "data-space-manager.ts",
2476
- line: 96,
2603
+ line: 100,
2477
2604
  scope: this,
2478
2605
  callSite: (f, a) => f(...a)
2479
2606
  });
@@ -2482,6 +2609,14 @@ var DataSpaceManager = class DataSpaceManager2 {
2482
2609
  for (const space of this._spaces.values()) {
2483
2610
  await space.close();
2484
2611
  }
2612
+ import_log9.log.trace("dxos.echo.data-space-manager", import_protocols5.trace.end({
2613
+ id: this._instanceId
2614
+ }), {
2615
+ file: "data-space-manager.ts",
2616
+ line: 106,
2617
+ scope: this,
2618
+ callSite: (f, a) => f(...a)
2619
+ });
2485
2620
  }
2486
2621
  /**
2487
2622
  * Creates a new space writing the genesis credentials to the control feed.
@@ -2501,7 +2636,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2501
2636
  spaceKey
2502
2637
  }, {
2503
2638
  file: "data-space-manager.ts",
2504
- line: 120,
2639
+ line: 125,
2505
2640
  scope: this,
2506
2641
  callSite: (f, a) => f(...a)
2507
2642
  });
@@ -2521,7 +2656,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2521
2656
  opts
2522
2657
  }, {
2523
2658
  file: "data-space-manager.ts",
2524
- line: 139,
2659
+ line: 144,
2525
2660
  scope: this,
2526
2661
  callSite: (f, a) => f(...a)
2527
2662
  });
@@ -2555,7 +2690,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2555
2690
  metadata
2556
2691
  }, {
2557
2692
  file: "data-space-manager.ts",
2558
- line: 175,
2693
+ line: 180,
2559
2694
  scope: this,
2560
2695
  callSite: (f, a) => f(...a)
2561
2696
  });
@@ -2610,7 +2745,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2610
2745
  space: space.key
2611
2746
  }, {
2612
2747
  file: "data-space-manager.ts",
2613
- line: 224,
2748
+ line: 229,
2614
2749
  scope: this,
2615
2750
  callSite: (f, a) => f(...a)
2616
2751
  });
@@ -2622,7 +2757,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2622
2757
  open: this._isOpen
2623
2758
  }, {
2624
2759
  file: "data-space-manager.ts",
2625
- line: 231,
2760
+ line: 236,
2626
2761
  scope: this,
2627
2762
  callSite: (f, a) => f(...a)
2628
2763
  });
@@ -2847,6 +2982,8 @@ var toStorageType = (type) => {
2847
2982
  return import_random_access_storage.StorageType.IDB;
2848
2983
  case StorageDriver.NODE:
2849
2984
  return import_random_access_storage.StorageType.NODE;
2985
+ case StorageDriver.WEBFS:
2986
+ return import_random_access_storage.StorageType.WEBFS;
2850
2987
  default:
2851
2988
  throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
2852
2989
  }
@@ -3611,7 +3748,7 @@ var import_feed_store4 = require("@dxos/feed-store");
3611
3748
  var import_keyring = require("@dxos/keyring");
3612
3749
  var import_keys9 = require("@dxos/keys");
3613
3750
  var import_log15 = require("@dxos/log");
3614
- var import_protocols5 = require("@dxos/protocols");
3751
+ var import_protocols6 = require("@dxos/protocols");
3615
3752
  var ServiceContext = class {
3616
3753
  // prettier-ignore
3617
3754
  constructor(storage, networkManager, modelFactory) {
@@ -3622,6 +3759,7 @@ var ServiceContext = class {
3622
3759
  this.dataServiceSubscriptions = new import_echo_pipeline4.DataServiceSubscriptions();
3623
3760
  this._handlerFactories = /* @__PURE__ */ new Map();
3624
3761
  this._instanceId = import_keys9.PublicKey.random().toHex();
3762
+ networkManager._traceParent = this._instanceId;
3625
3763
  this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
3626
3764
  this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
3627
3765
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
@@ -3638,25 +3776,28 @@ var ServiceContext = class {
3638
3776
  feedStore: this.feedStore,
3639
3777
  networkManager: this.networkManager
3640
3778
  });
3779
+ this.spaceManager._traceParent = this._instanceId;
3641
3780
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3781
+ this.identityManager._traceParent = this._instanceId;
3642
3782
  this.invitations = new InvitationsHandler(this.networkManager);
3783
+ this.invitations._traceParent = this._instanceId;
3643
3784
  this._handlerFactories.set(import_client7.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3644
3785
  var _a;
3645
3786
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
3646
3787
  }, this._acceptIdentity.bind(this)));
3647
3788
  }
3648
3789
  async open() {
3649
- import_log15.log.trace("dxos.sdk.client-services", import_protocols5.trace.begin({
3790
+ import_log15.log.trace("dxos.sdk.service-context", import_protocols6.trace.begin({
3650
3791
  id: this._instanceId
3651
3792
  }), {
3652
3793
  file: "service-context.ts",
3653
- line: 111,
3794
+ line: 115,
3654
3795
  scope: this,
3655
3796
  callSite: (f, a) => f(...a)
3656
3797
  });
3657
3798
  (0, import_log15.log)("opening...", {}, {
3658
3799
  file: "service-context.ts",
3659
- line: 113,
3800
+ line: 117,
3660
3801
  scope: this,
3661
3802
  callSite: (f, a) => f(...a)
3662
3803
  });
@@ -3668,7 +3809,7 @@ var ServiceContext = class {
3668
3809
  }
3669
3810
  (0, import_log15.log)("opened", {}, {
3670
3811
  file: "service-context.ts",
3671
- line: 120,
3812
+ line: 124,
3672
3813
  scope: this,
3673
3814
  callSite: (f, a) => f(...a)
3674
3815
  });
@@ -3677,7 +3818,7 @@ var ServiceContext = class {
3677
3818
  var _a, _b;
3678
3819
  (0, import_log15.log)("closing...", {}, {
3679
3820
  file: "service-context.ts",
3680
- line: 124,
3821
+ line: 128,
3681
3822
  scope: this,
3682
3823
  callSite: (f, a) => f(...a)
3683
3824
  });
@@ -3690,34 +3831,18 @@ var ServiceContext = class {
3690
3831
  this.dataServiceSubscriptions.clear();
3691
3832
  (0, import_log15.log)("closed", {}, {
3692
3833
  file: "service-context.ts",
3693
- line: 132,
3834
+ line: 136,
3694
3835
  scope: this,
3695
3836
  callSite: (f, a) => f(...a)
3696
3837
  });
3697
- import_log15.log.trace("dxos.sdk.client-services", import_protocols5.trace.end({
3838
+ import_log15.log.trace("dxos.sdk.service-context", import_protocols6.trace.end({
3698
3839
  id: this._instanceId
3699
3840
  }), {
3700
- file: "service-context.ts",
3701
- line: 134,
3702
- scope: this,
3703
- callSite: (f, a) => f(...a)
3704
- });
3705
- }
3706
- async reset() {
3707
- (0, import_log15.log)("resetting...", {}, {
3708
3841
  file: "service-context.ts",
3709
3842
  line: 138,
3710
3843
  scope: this,
3711
3844
  callSite: (f, a) => f(...a)
3712
3845
  });
3713
- await this.close();
3714
- await this.storage.reset();
3715
- (0, import_log15.log)("reset", {}, {
3716
- file: "service-context.ts",
3717
- line: 141,
3718
- scope: this,
3719
- callSite: (f, a) => f(...a)
3720
- });
3721
3846
  }
3722
3847
  async createIdentity(params = {}) {
3723
3848
  const identity = await this.identityManager.createIdentity(params);
@@ -3739,7 +3864,7 @@ var ServiceContext = class {
3739
3864
  var _a;
3740
3865
  (0, import_log15.log)("initializing spaces...", {}, {
3741
3866
  file: "service-context.ts",
3742
- line: 166,
3867
+ line: 163,
3743
3868
  scope: this,
3744
3869
  callSite: (f, a) => f(...a)
3745
3870
  });
@@ -3758,6 +3883,7 @@ var ServiceContext = class {
3758
3883
  }
3759
3884
  };
3760
3885
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.modelFactory, this.feedStore, this.snapshotStore);
3886
+ this.dataSpaceManager._traceParent = this._instanceId;
3761
3887
  await this.dataSpaceManager.open();
3762
3888
  this._handlerFactories.set(import_client7.Invitation.Kind.SPACE, (invitation) => {
3763
3889
  (0, import_node_assert12.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
@@ -3778,7 +3904,7 @@ var ServiceContext = class {
3778
3904
  details: assertion
3779
3905
  }, {
3780
3906
  file: "service-context.ts",
3781
- line: 207,
3907
+ line: 205,
3782
3908
  scope: this,
3783
3909
  callSite: (f, a) => f(...a)
3784
3910
  });
@@ -3789,7 +3915,7 @@ var ServiceContext = class {
3789
3915
  details: assertion
3790
3916
  }, {
3791
3917
  file: "service-context.ts",
3792
- line: 211,
3918
+ line: 209,
3793
3919
  scope: this,
3794
3920
  callSite: (f, a) => f(...a)
3795
3921
  });
@@ -3800,7 +3926,7 @@ var ServiceContext = class {
3800
3926
  details: assertion
3801
3927
  }, {
3802
3928
  file: "service-context.ts",
3803
- line: 216,
3929
+ line: 214,
3804
3930
  scope: this,
3805
3931
  callSite: (f, a) => f(...a)
3806
3932
  });
@@ -3811,7 +3937,7 @@ var ServiceContext = class {
3811
3937
  } catch (err) {
3812
3938
  import_log15.log.catch(err, {}, {
3813
3939
  file: "service-context.ts",
3814
- line: 222,
3940
+ line: 220,
3815
3941
  scope: this,
3816
3942
  callSite: (f, a) => f(...a)
3817
3943
  });
@@ -3889,8 +4015,7 @@ var ClientServicesHost = class {
3889
4015
  }
3890
4016
  },
3891
4017
  onReset: async () => {
3892
- (0, import_node_assert13.default)(this._serviceContext, "service host is closed");
3893
- await this._serviceContext.reset();
4018
+ await this.reset();
3894
4019
  }
3895
4020
  });
3896
4021
  this._serviceRegistry = new ServiceRegistry(import_client8.clientServiceBundle, {
@@ -3933,11 +4058,11 @@ var ClientServicesHost = class {
3933
4058
  if (this._open) {
3934
4059
  return;
3935
4060
  }
3936
- import_log16.log.trace("dxos.sdk.client-services-host", import_protocols6.trace.begin({
4061
+ import_log16.log.trace("dxos.sdk.client-services-host", import_protocols7.trace.begin({
3937
4062
  id: this._instanceId
3938
4063
  }), {
3939
4064
  file: "service-host.ts",
3940
- line: 167,
4065
+ line: 166,
3941
4066
  scope: this,
3942
4067
  callSite: (f, a) => f(...a)
3943
4068
  });
@@ -3949,7 +4074,7 @@ var ClientServicesHost = class {
3949
4074
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3950
4075
  }, {
3951
4076
  file: "service-host.ts",
3952
- line: 174,
4077
+ line: 173,
3953
4078
  scope: this,
3954
4079
  callSite: (f, a) => f(...a)
3955
4080
  });
@@ -3983,7 +4108,7 @@ var ClientServicesHost = class {
3983
4108
  deviceKey
3984
4109
  }, {
3985
4110
  file: "service-host.ts",
3986
- line: 221,
4111
+ line: 220,
3987
4112
  scope: this,
3988
4113
  callSite: (f, a) => f(...a)
3989
4114
  });
@@ -3998,7 +4123,7 @@ var ClientServicesHost = class {
3998
4123
  deviceKey
3999
4124
  }, {
4000
4125
  file: "service-host.ts",
4001
- line: 230,
4126
+ line: 229,
4002
4127
  scope: this,
4003
4128
  callSite: (f, a) => f(...a)
4004
4129
  });
@@ -4012,15 +4137,32 @@ var ClientServicesHost = class {
4012
4137
  deviceKey
4013
4138
  }, {
4014
4139
  file: "service-host.ts",
4015
- line: 235,
4140
+ line: 234,
4016
4141
  scope: this,
4017
4142
  callSite: (f, a) => f(...a)
4018
4143
  });
4019
- import_log16.log.trace("dxos.sdk.client-services-host", import_protocols6.trace.end({
4144
+ import_log16.log.trace("dxos.sdk.client-services-host", import_protocols7.trace.end({
4020
4145
  id: this._instanceId
4021
4146
  }), {
4022
4147
  file: "service-host.ts",
4023
- line: 237,
4148
+ line: 236,
4149
+ scope: this,
4150
+ callSite: (f, a) => f(...a)
4151
+ });
4152
+ }
4153
+ async reset() {
4154
+ var _a;
4155
+ (0, import_log16.log)("resetting...", {}, {
4156
+ file: "service-host.ts",
4157
+ line: 240,
4158
+ scope: this,
4159
+ callSite: (f, a) => f(...a)
4160
+ });
4161
+ await ((_a = this._serviceContext) == null ? void 0 : _a.close());
4162
+ await this._storage.reset();
4163
+ (0, import_log16.log)("reset", {}, {
4164
+ file: "service-host.ts",
4165
+ line: 243,
4024
4166
  scope: this,
4025
4167
  callSite: (f, a) => f(...a)
4026
4168
  });