@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
@@ -586,10 +586,11 @@ var IdentityManager = class {
586
586
  async open() {
587
587
  var _a;
588
588
  log3.trace("dxos.halo.identity-manager", trace.begin({
589
- id: this._instanceId
589
+ id: this._instanceId,
590
+ parentId: this._traceParent
590
591
  }), {
591
592
  file: "identity-manager.ts",
592
- line: 71,
593
+ line: 72,
593
594
  scope: this,
594
595
  callSite: (f, a) => f(...a)
595
596
  });
@@ -599,7 +600,7 @@ var IdentityManager = class {
599
600
  identityRecord
600
601
  }, {
601
602
  file: "identity-manager.ts",
602
- line: 75,
603
+ line: 76,
603
604
  scope: this,
604
605
  callSite: (f, a) => f(...a)
605
606
  });
@@ -612,7 +613,7 @@ var IdentityManager = class {
612
613
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
613
614
  }, {
614
615
  file: "identity-manager.ts",
615
- line: 80,
616
+ line: 81,
616
617
  scope: this,
617
618
  callSite: (f, a) => f(...a)
618
619
  });
@@ -626,7 +627,7 @@ var IdentityManager = class {
626
627
  id: this._instanceId
627
628
  }), {
628
629
  file: "identity-manager.ts",
629
- line: 90,
630
+ line: 91,
630
631
  scope: this,
631
632
  callSite: (f, a) => f(...a)
632
633
  });
@@ -636,7 +637,7 @@ var IdentityManager = class {
636
637
  assert2(!this._identity, "Identity already exists.");
637
638
  log3("creating identity...", {}, {
638
639
  file: "identity-manager.ts",
639
- line: 95,
640
+ line: 96,
640
641
  scope: this,
641
642
  callSite: (f, a) => f(...a)
642
643
  });
@@ -685,7 +686,7 @@ var IdentityManager = class {
685
686
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
686
687
  }, {
687
688
  file: "identity-manager.ts",
688
- line: 150,
689
+ line: 151,
689
690
  scope: this,
690
691
  callSite: (f, a) => f(...a)
691
692
  });
@@ -695,7 +696,7 @@ var IdentityManager = class {
695
696
  deviceKey: identity.deviceKey
696
697
  }, {
697
698
  file: "identity-manager.ts",
698
- line: 156,
699
+ line: 157,
699
700
  scope: this,
700
701
  callSite: (f, a) => f(...a)
701
702
  });
@@ -710,7 +711,7 @@ var IdentityManager = class {
710
711
  params
711
712
  }, {
712
713
  file: "identity-manager.ts",
713
- line: 164,
714
+ line: 165,
714
715
  scope: this,
715
716
  callSite: (f, a) => f(...a)
716
717
  });
@@ -736,7 +737,7 @@ var IdentityManager = class {
736
737
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
737
738
  }, {
738
739
  file: "identity-manager.ts",
739
- line: 184,
740
+ line: 185,
740
741
  scope: this,
741
742
  callSite: (f, a) => f(...a)
742
743
  });
@@ -746,7 +747,7 @@ var IdentityManager = class {
746
747
  deviceKey: identity.deviceKey
747
748
  }, {
748
749
  file: "identity-manager.ts",
749
- line: 190,
750
+ line: 191,
750
751
  scope: this,
751
752
  callSite: (f, a) => f(...a)
752
753
  });
@@ -758,7 +759,7 @@ var IdentityManager = class {
758
759
  identityRecord
759
760
  }, {
760
761
  file: "identity-manager.ts",
761
- line: 196,
762
+ line: 197,
762
763
  scope: this,
763
764
  callSite: (f, a) => f(...a)
764
765
  });
@@ -791,7 +792,7 @@ var IdentityManager = class {
791
792
  identityKey: identityRecord.identityKey
792
793
  }, {
793
794
  file: "identity-manager.ts",
794
- line: 224,
795
+ line: 225,
795
796
  scope: this,
796
797
  callSite: (f, a) => f(...a)
797
798
  });
@@ -935,7 +936,7 @@ import { generatePasscode } from "@dxos/credentials";
935
936
  import { PublicKey as PublicKey4 } from "@dxos/keys";
936
937
  import { log as log4 } from "@dxos/log";
937
938
  import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
938
- import { schema as schema2 } from "@dxos/protocols";
939
+ import { schema as schema2, trace as trace2 } from "@dxos/protocols";
939
940
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
940
941
  import { AuthenticationResponse } from "@dxos/protocols/proto/dxos/halo/invitations";
941
942
  import { RpcExtension } from "@dxos/teleport";
@@ -971,7 +972,7 @@ var InvitationsHandler = class {
971
972
  ...protocol.toJSON()
972
973
  }, {
973
974
  file: "invitations-handler.ts",
974
- line: 102,
975
+ line: 106,
975
976
  scope: this,
976
977
  callSite: (f, a) => f(...a)
977
978
  });
@@ -989,7 +990,7 @@ var InvitationsHandler = class {
989
990
  ...protocol.toJSON()
990
991
  }, {
991
992
  file: "invitations-handler.ts",
992
- line: 115,
993
+ line: 119,
993
994
  scope: this,
994
995
  callSite: (f, a) => f(...a)
995
996
  });
@@ -1008,7 +1009,7 @@ var InvitationsHandler = class {
1008
1009
  authCode: code
1009
1010
  }, {
1010
1011
  file: "invitations-handler.ts",
1011
- line: 134,
1012
+ line: 138,
1012
1013
  scope: this,
1013
1014
  callSite: (f, a) => f(...a)
1014
1015
  });
@@ -1017,7 +1018,7 @@ var InvitationsHandler = class {
1017
1018
  case Invitation2.AuthMethod.NONE: {
1018
1019
  log4("authentication not required", {}, {
1019
1020
  file: "invitations-handler.ts",
1020
- line: 139,
1021
+ line: 143,
1021
1022
  scope: this,
1022
1023
  callSite: (f, a) => f(...a)
1023
1024
  });
@@ -1042,7 +1043,7 @@ var InvitationsHandler = class {
1042
1043
  authMethod: invitation.authMethod
1043
1044
  }, {
1044
1045
  file: "invitations-handler.ts",
1045
- line: 157,
1046
+ line: 161,
1046
1047
  scope: this,
1047
1048
  callSite: (f, a) => f(...a)
1048
1049
  });
@@ -1072,12 +1073,22 @@ var InvitationsHandler = class {
1072
1073
  },
1073
1074
  onOpen: () => {
1074
1075
  scheduleTask(ctx, async () => {
1076
+ const traceId = PublicKey4.random().toHex();
1075
1077
  try {
1078
+ log4.trace("dxos.sdk.invitations-handler.host.onOpen", trace2.begin({
1079
+ id: traceId,
1080
+ parentId: this._traceParent
1081
+ }), {
1082
+ file: "invitations-handler.ts",
1083
+ line: 196,
1084
+ scope: this,
1085
+ callSite: (f, a) => f(...a)
1086
+ });
1076
1087
  log4("connected", {
1077
1088
  ...protocol.toJSON()
1078
1089
  }, {
1079
1090
  file: "invitations-handler.ts",
1080
- line: 191,
1091
+ line: 200,
1081
1092
  scope: this,
1082
1093
  callSite: (f, a) => f(...a)
1083
1094
  });
@@ -1093,7 +1104,7 @@ var InvitationsHandler = class {
1093
1104
  ...protocol.toJSON()
1094
1105
  }, {
1095
1106
  file: "invitations-handler.ts",
1096
- line: 194,
1107
+ line: 203,
1097
1108
  scope: this,
1098
1109
  callSite: (f, a) => f(...a)
1099
1110
  });
@@ -1101,13 +1112,21 @@ var InvitationsHandler = class {
1101
1112
  ...invitation,
1102
1113
  state: Invitation2.State.SUCCESS
1103
1114
  });
1115
+ log4.trace("dxos.sdk.invitations-handler.host.onOpen", trace2.end({
1116
+ id: traceId
1117
+ }), {
1118
+ file: "invitations-handler.ts",
1119
+ line: 205,
1120
+ scope: this,
1121
+ callSite: (f, a) => f(...a)
1122
+ });
1104
1123
  } catch (err) {
1105
1124
  if (err instanceof TimeoutError) {
1106
1125
  log4("timeout", {
1107
1126
  ...protocol.toJSON()
1108
1127
  }, {
1109
1128
  file: "invitations-handler.ts",
1110
- line: 198,
1129
+ line: 208,
1111
1130
  scope: this,
1112
1131
  callSite: (f, a) => f(...a)
1113
1132
  });
@@ -1118,12 +1137,21 @@ var InvitationsHandler = class {
1118
1137
  } else {
1119
1138
  log4.error("failed", err, {
1120
1139
  file: "invitations-handler.ts",
1121
- line: 201,
1140
+ line: 211,
1122
1141
  scope: this,
1123
1142
  callSite: (f, a) => f(...a)
1124
1143
  });
1125
1144
  stream.error(err);
1126
1145
  }
1146
+ log4.trace("dxos.sdk.invitations-handler.host.onOpen", trace2.error({
1147
+ id: traceId,
1148
+ error: err
1149
+ }), {
1150
+ file: "invitations-handler.ts",
1151
+ line: 214,
1152
+ scope: this,
1153
+ callSite: (f, a) => f(...a)
1154
+ });
1127
1155
  } finally {
1128
1156
  if (type !== Invitation2.Type.MULTIUSE) {
1129
1157
  await sleep(ON_CLOSE_DELAY);
@@ -1133,6 +1161,7 @@ var InvitationsHandler = class {
1133
1161
  });
1134
1162
  }
1135
1163
  });
1164
+ extension._traceParent = this._traceParent;
1136
1165
  return extension;
1137
1166
  };
1138
1167
  scheduleTask(ctx, async () => {
@@ -1176,7 +1205,7 @@ var InvitationsHandler = class {
1176
1205
  ...protocol.toJSON()
1177
1206
  }, {
1178
1207
  file: "invitations-handler.ts",
1179
- line: 255,
1208
+ line: 267,
1180
1209
  scope: this,
1181
1210
  callSite: (f, a) => f(...a)
1182
1211
  });
@@ -1187,7 +1216,7 @@ var InvitationsHandler = class {
1187
1216
  } else {
1188
1217
  log4.warn("auth failed", err, {
1189
1218
  file: "invitations-handler.ts",
1190
- line: 258,
1219
+ line: 270,
1191
1220
  scope: this,
1192
1221
  callSite: (f, a) => f(...a)
1193
1222
  });
@@ -1201,7 +1230,7 @@ var InvitationsHandler = class {
1201
1230
  ...protocol.toJSON()
1202
1231
  }, {
1203
1232
  file: "invitations-handler.ts",
1204
- line: 266,
1233
+ line: 278,
1205
1234
  scope: this,
1206
1235
  callSite: (f, a) => f(...a)
1207
1236
  });
@@ -1212,7 +1241,17 @@ var InvitationsHandler = class {
1212
1241
  const extension = new InvitationGuestExtension({
1213
1242
  onOpen: () => {
1214
1243
  scheduleTask(ctx, async () => {
1244
+ const traceId = PublicKey4.random().toHex();
1215
1245
  try {
1246
+ log4.trace("dxos.sdk.invitations-handler.guest.onOpen", trace2.begin({
1247
+ id: traceId,
1248
+ parentId: this._traceParent
1249
+ }), {
1250
+ file: "invitations-handler.ts",
1251
+ line: 290,
1252
+ scope: this,
1253
+ callSite: (f, a) => f(...a)
1254
+ });
1216
1255
  if (++connectionCount > 1) {
1217
1256
  throw new Error(`multiple connections detected: ${connectionCount}`);
1218
1257
  }
@@ -1221,7 +1260,7 @@ var InvitationsHandler = class {
1221
1260
  ...protocol.toJSON()
1222
1261
  }, {
1223
1262
  file: "invitations-handler.ts",
1224
- line: 284,
1263
+ line: 301,
1225
1264
  scope: this,
1226
1265
  callSite: (f, a) => f(...a)
1227
1266
  });
@@ -1233,7 +1272,7 @@ var InvitationsHandler = class {
1233
1272
  ...protocol.toJSON()
1234
1273
  }, {
1235
1274
  file: "invitations-handler.ts",
1236
- line: 288,
1275
+ line: 305,
1237
1276
  scope: this,
1238
1277
  callSite: (f, a) => f(...a)
1239
1278
  });
@@ -1243,7 +1282,7 @@ var InvitationsHandler = class {
1243
1282
  response: introductionResponse
1244
1283
  }, {
1245
1284
  file: "invitations-handler.ts",
1246
- line: 292,
1285
+ line: 309,
1247
1286
  scope: this,
1248
1287
  callSite: (f, a) => f(...a)
1249
1288
  });
@@ -1255,7 +1294,7 @@ var InvitationsHandler = class {
1255
1294
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1256
1295
  log4("guest waiting for authentication code...", {}, {
1257
1296
  file: "invitations-handler.ts",
1258
- line: 301,
1297
+ line: 318,
1259
1298
  scope: this,
1260
1299
  callSite: (f, a) => f(...a)
1261
1300
  });
@@ -1268,7 +1307,7 @@ var InvitationsHandler = class {
1268
1307
  });
1269
1308
  log4("sending authentication request", {}, {
1270
1309
  file: "invitations-handler.ts",
1271
- line: 305,
1310
+ line: 322,
1272
1311
  scope: this,
1273
1312
  callSite: (f, a) => f(...a)
1274
1313
  });
@@ -1290,7 +1329,7 @@ var InvitationsHandler = class {
1290
1329
  attempt
1291
1330
  }, {
1292
1331
  file: "invitations-handler.ts",
1293
- line: 316,
1332
+ line: 333,
1294
1333
  scope: this,
1295
1334
  callSite: (f, a) => f(...a)
1296
1335
  });
@@ -1308,7 +1347,7 @@ var InvitationsHandler = class {
1308
1347
  ...protocol.toJSON()
1309
1348
  }, {
1310
1349
  file: "invitations-handler.ts",
1311
- line: 327,
1350
+ line: 344,
1312
1351
  scope: this,
1313
1352
  callSite: (f, a) => f(...a)
1314
1353
  });
@@ -1319,7 +1358,7 @@ var InvitationsHandler = class {
1319
1358
  ...protocol.toJSON()
1320
1359
  }, {
1321
1360
  file: "invitations-handler.ts",
1322
- line: 335,
1361
+ line: 352,
1323
1362
  scope: this,
1324
1363
  callSite: (f, a) => f(...a)
1325
1364
  });
@@ -1328,13 +1367,21 @@ var InvitationsHandler = class {
1328
1367
  ...result,
1329
1368
  state: Invitation2.State.SUCCESS
1330
1369
  });
1370
+ log4.trace("dxos.sdk.invitations-handler.guest.onOpen", trace2.end({
1371
+ id: traceId
1372
+ }), {
1373
+ file: "invitations-handler.ts",
1374
+ line: 354,
1375
+ scope: this,
1376
+ callSite: (f, a) => f(...a)
1377
+ });
1331
1378
  } catch (err) {
1332
1379
  if (err instanceof TimeoutError) {
1333
1380
  log4("timeout", {
1334
1381
  ...protocol.toJSON()
1335
1382
  }, {
1336
1383
  file: "invitations-handler.ts",
1337
- line: 339,
1384
+ line: 357,
1338
1385
  scope: this,
1339
1386
  callSite: (f, a) => f(...a)
1340
1387
  });
@@ -1343,14 +1390,23 @@ var InvitationsHandler = class {
1343
1390
  state: Invitation2.State.TIMEOUT
1344
1391
  });
1345
1392
  } else {
1346
- log4.warn("auth failed", err, {
1393
+ log4("auth failed", err, {
1347
1394
  file: "invitations-handler.ts",
1348
- line: 342,
1395
+ line: 360,
1349
1396
  scope: this,
1350
1397
  callSite: (f, a) => f(...a)
1351
1398
  });
1352
1399
  stream.error(err);
1353
1400
  }
1401
+ log4.trace("dxos.sdk.invitations-handler.guest.onOpen", trace2.error({
1402
+ id: traceId,
1403
+ error: err
1404
+ }), {
1405
+ file: "invitations-handler.ts",
1406
+ line: 363,
1407
+ scope: this,
1408
+ callSite: (f, a) => f(...a)
1409
+ });
1354
1410
  } finally {
1355
1411
  await ctx.dispose();
1356
1412
  }
@@ -1409,13 +1465,73 @@ var InvitationHostExtension = class extends RpcExtension {
1409
1465
  // Perhaps in the future we will have more complex logic here.
1410
1466
  InvitationHostService: {
1411
1467
  introduce: async (request) => {
1412
- return this._callbacks.introduce(request);
1468
+ const traceId = PublicKey4.random().toHex();
1469
+ log4.trace("dxos.sdk.invitation-handler.host.introduce", trace2.begin({
1470
+ id: traceId,
1471
+ parentId: this._traceParent
1472
+ }), {
1473
+ file: "invitations-handler.ts",
1474
+ line: 442,
1475
+ scope: this,
1476
+ callSite: (f, a) => f(...a)
1477
+ });
1478
+ const response = await this._callbacks.introduce(request);
1479
+ log4.trace("dxos.sdk.invitation-handler.host.introduce", trace2.end({
1480
+ id: traceId
1481
+ }), {
1482
+ file: "invitations-handler.ts",
1483
+ line: 447,
1484
+ scope: this,
1485
+ callSite: (f, a) => f(...a)
1486
+ });
1487
+ return response;
1413
1488
  },
1414
1489
  authenticate: async (request) => {
1415
- return this._callbacks.authenticate(request);
1490
+ const traceId = PublicKey4.random().toHex();
1491
+ log4.trace("dxos.sdk.invitation-handler.host.authenticate", trace2.begin({
1492
+ id: traceId,
1493
+ parentId: this._traceParent
1494
+ }), {
1495
+ file: "invitations-handler.ts",
1496
+ line: 453,
1497
+ scope: this,
1498
+ callSite: (f, a) => f(...a)
1499
+ });
1500
+ const response = await this._callbacks.authenticate(request);
1501
+ log4.trace("dxos.sdk.invitation-handler.host.authenticate", trace2.end({
1502
+ id: traceId,
1503
+ data: {
1504
+ ...response
1505
+ }
1506
+ }), {
1507
+ file: "invitations-handler.ts",
1508
+ line: 458,
1509
+ scope: this,
1510
+ callSite: (f, a) => f(...a)
1511
+ });
1512
+ return response;
1416
1513
  },
1417
1514
  admit: async (request) => {
1418
- return this._callbacks.admit(request);
1515
+ const traceId = PublicKey4.random().toHex();
1516
+ log4.trace("dxos.sdk.invitation-handler.host.admit", trace2.begin({
1517
+ id: traceId,
1518
+ parentId: this._traceParent
1519
+ }), {
1520
+ file: "invitations-handler.ts",
1521
+ line: 464,
1522
+ scope: this,
1523
+ callSite: (f, a) => f(...a)
1524
+ });
1525
+ const response = await this._callbacks.admit(request);
1526
+ log4.trace("dxos.sdk.invitation-handler.host.admit", trace2.end({
1527
+ id: traceId
1528
+ }), {
1529
+ file: "invitations-handler.ts",
1530
+ line: 469,
1531
+ scope: this,
1532
+ callSite: (f, a) => f(...a)
1533
+ });
1534
+ return response;
1419
1535
  }
1420
1536
  }
1421
1537
  };
@@ -1813,6 +1929,8 @@ var toStorageType = (type) => {
1813
1929
  return StorageType.IDB;
1814
1930
  case StorageDriver.NODE:
1815
1931
  return StorageType.NODE;
1932
+ case StorageDriver.WEBFS:
1933
+ return StorageType.WEBFS;
1816
1934
  default:
1817
1935
  throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
1818
1936
  }
@@ -1920,7 +2038,7 @@ import { Event as Event7 } from "@dxos/async";
1920
2038
  import { clientServiceBundle, createDefaultModelFactory, PublicKey as PublicKey9 } from "@dxos/client";
1921
2039
  import { DataServiceImpl } from "@dxos/echo-pipeline";
1922
2040
  import { log as log15 } from "@dxos/log";
1923
- import { trace as trace3 } from "@dxos/protocols";
2041
+ import { trace as trace5 } from "@dxos/protocols";
1924
2042
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
1925
2043
 
1926
2044
  // packages/sdk/client-services/src/packlets/deprecated/tracing.ts
@@ -2014,6 +2132,7 @@ import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credent
2014
2132
  import { SnapshotManager, spaceGenesis } from "@dxos/echo-pipeline";
2015
2133
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2016
2134
  import { log as log9 } from "@dxos/log";
2135
+ import { trace as trace3 } from "@dxos/protocols";
2017
2136
  import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
2018
2137
  import { ComplexMap as ComplexMap3, deferFunction as deferFunction2 } from "@dxos/util";
2019
2138
 
@@ -2510,6 +2629,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2510
2629
  this.updated = new Event6();
2511
2630
  this._spaces = new ComplexMap3(PublicKey7.hash);
2512
2631
  this._isOpen = false;
2632
+ this._instanceId = PublicKey7.random().toHex();
2513
2633
  }
2514
2634
  // TODO(burdon): Remove.
2515
2635
  get spaces() {
@@ -2518,7 +2638,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2518
2638
  async open() {
2519
2639
  log9("open", {}, {
2520
2640
  file: "data-space-manager.ts",
2521
- line: 80,
2641
+ line: 83,
2642
+ scope: this,
2643
+ callSite: (f, a) => f(...a)
2644
+ });
2645
+ log9.trace("dxos.echo.data-space-manager", trace3.begin({
2646
+ id: this._instanceId,
2647
+ parentId: this._traceParent
2648
+ }), {
2649
+ file: "data-space-manager.ts",
2650
+ line: 84,
2522
2651
  scope: this,
2523
2652
  callSite: (f, a) => f(...a)
2524
2653
  });
@@ -2527,7 +2656,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2527
2656
  spaces: this._metadataStore.spaces.length
2528
2657
  }, {
2529
2658
  file: "data-space-manager.ts",
2530
- line: 82,
2659
+ line: 86,
2531
2660
  scope: this,
2532
2661
  callSite: (f, a) => f(...a)
2533
2662
  });
@@ -2536,7 +2665,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2536
2665
  spaceMetadata
2537
2666
  }, {
2538
2667
  file: "data-space-manager.ts",
2539
- line: 85,
2668
+ line: 89,
2540
2669
  scope: this,
2541
2670
  callSite: (f, a) => f(...a)
2542
2671
  });
@@ -2549,7 +2678,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2549
2678
  async close() {
2550
2679
  log9("close", {}, {
2551
2680
  file: "data-space-manager.ts",
2552
- line: 96,
2681
+ line: 100,
2553
2682
  scope: this,
2554
2683
  callSite: (f, a) => f(...a)
2555
2684
  });
@@ -2558,6 +2687,14 @@ var DataSpaceManager = class DataSpaceManager2 {
2558
2687
  for (const space of this._spaces.values()) {
2559
2688
  await space.close();
2560
2689
  }
2690
+ log9.trace("dxos.echo.data-space-manager", trace3.end({
2691
+ id: this._instanceId
2692
+ }), {
2693
+ file: "data-space-manager.ts",
2694
+ line: 106,
2695
+ scope: this,
2696
+ callSite: (f, a) => f(...a)
2697
+ });
2561
2698
  }
2562
2699
  /**
2563
2700
  * Creates a new space writing the genesis credentials to the control feed.
@@ -2577,7 +2714,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2577
2714
  spaceKey
2578
2715
  }, {
2579
2716
  file: "data-space-manager.ts",
2580
- line: 120,
2717
+ line: 125,
2581
2718
  scope: this,
2582
2719
  callSite: (f, a) => f(...a)
2583
2720
  });
@@ -2597,7 +2734,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2597
2734
  opts
2598
2735
  }, {
2599
2736
  file: "data-space-manager.ts",
2600
- line: 139,
2737
+ line: 144,
2601
2738
  scope: this,
2602
2739
  callSite: (f, a) => f(...a)
2603
2740
  });
@@ -2631,7 +2768,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2631
2768
  metadata
2632
2769
  }, {
2633
2770
  file: "data-space-manager.ts",
2634
- line: 175,
2771
+ line: 180,
2635
2772
  scope: this,
2636
2773
  callSite: (f, a) => f(...a)
2637
2774
  });
@@ -2686,7 +2823,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2686
2823
  space: space.key
2687
2824
  }, {
2688
2825
  file: "data-space-manager.ts",
2689
- line: 224,
2826
+ line: 229,
2690
2827
  scope: this,
2691
2828
  callSite: (f, a) => f(...a)
2692
2829
  });
@@ -2698,7 +2835,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2698
2835
  open: this._isOpen
2699
2836
  }, {
2700
2837
  file: "data-space-manager.ts",
2701
- line: 231,
2838
+ line: 236,
2702
2839
  scope: this,
2703
2840
  callSite: (f, a) => f(...a)
2704
2841
  });
@@ -3427,7 +3564,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
3427
3564
  import { Keyring } from "@dxos/keyring";
3428
3565
  import { PublicKey as PublicKey8 } from "@dxos/keys";
3429
3566
  import { log as log14 } from "@dxos/log";
3430
- import { trace as trace2 } from "@dxos/protocols";
3567
+ import { trace as trace4 } from "@dxos/protocols";
3431
3568
  var ServiceContext = class {
3432
3569
  // prettier-ignore
3433
3570
  constructor(storage, networkManager, modelFactory) {
@@ -3438,6 +3575,7 @@ var ServiceContext = class {
3438
3575
  this.dataServiceSubscriptions = new DataServiceSubscriptions();
3439
3576
  this._handlerFactories = /* @__PURE__ */ new Map();
3440
3577
  this._instanceId = PublicKey8.random().toHex();
3578
+ networkManager._traceParent = this._instanceId;
3441
3579
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
3442
3580
  this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
3443
3581
  this.keyring = new Keyring(storage.createDirectory("keyring"));
@@ -3454,25 +3592,28 @@ var ServiceContext = class {
3454
3592
  feedStore: this.feedStore,
3455
3593
  networkManager: this.networkManager
3456
3594
  });
3595
+ this.spaceManager._traceParent = this._instanceId;
3457
3596
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3597
+ this.identityManager._traceParent = this._instanceId;
3458
3598
  this.invitations = new InvitationsHandler(this.networkManager);
3599
+ this.invitations._traceParent = this._instanceId;
3459
3600
  this._handlerFactories.set(Invitation5.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3460
3601
  var _a;
3461
3602
  return (_a = this.identityManager.identity) != null ? _a : failUndefined2();
3462
3603
  }, this._acceptIdentity.bind(this)));
3463
3604
  }
3464
3605
  async open() {
3465
- log14.trace("dxos.sdk.client-services", trace2.begin({
3606
+ log14.trace("dxos.sdk.service-context", trace4.begin({
3466
3607
  id: this._instanceId
3467
3608
  }), {
3468
3609
  file: "service-context.ts",
3469
- line: 111,
3610
+ line: 115,
3470
3611
  scope: this,
3471
3612
  callSite: (f, a) => f(...a)
3472
3613
  });
3473
3614
  log14("opening...", {}, {
3474
3615
  file: "service-context.ts",
3475
- line: 113,
3616
+ line: 117,
3476
3617
  scope: this,
3477
3618
  callSite: (f, a) => f(...a)
3478
3619
  });
@@ -3484,7 +3625,7 @@ var ServiceContext = class {
3484
3625
  }
3485
3626
  log14("opened", {}, {
3486
3627
  file: "service-context.ts",
3487
- line: 120,
3628
+ line: 124,
3488
3629
  scope: this,
3489
3630
  callSite: (f, a) => f(...a)
3490
3631
  });
@@ -3493,7 +3634,7 @@ var ServiceContext = class {
3493
3634
  var _a, _b;
3494
3635
  log14("closing...", {}, {
3495
3636
  file: "service-context.ts",
3496
- line: 124,
3637
+ line: 128,
3497
3638
  scope: this,
3498
3639
  callSite: (f, a) => f(...a)
3499
3640
  });
@@ -3506,34 +3647,18 @@ var ServiceContext = class {
3506
3647
  this.dataServiceSubscriptions.clear();
3507
3648
  log14("closed", {}, {
3508
3649
  file: "service-context.ts",
3509
- line: 132,
3650
+ line: 136,
3510
3651
  scope: this,
3511
3652
  callSite: (f, a) => f(...a)
3512
3653
  });
3513
- log14.trace("dxos.sdk.client-services", trace2.end({
3654
+ log14.trace("dxos.sdk.service-context", trace4.end({
3514
3655
  id: this._instanceId
3515
3656
  }), {
3516
- file: "service-context.ts",
3517
- line: 134,
3518
- scope: this,
3519
- callSite: (f, a) => f(...a)
3520
- });
3521
- }
3522
- async reset() {
3523
- log14("resetting...", {}, {
3524
3657
  file: "service-context.ts",
3525
3658
  line: 138,
3526
3659
  scope: this,
3527
3660
  callSite: (f, a) => f(...a)
3528
3661
  });
3529
- await this.close();
3530
- await this.storage.reset();
3531
- log14("reset", {}, {
3532
- file: "service-context.ts",
3533
- line: 141,
3534
- scope: this,
3535
- callSite: (f, a) => f(...a)
3536
- });
3537
3662
  }
3538
3663
  async createIdentity(params = {}) {
3539
3664
  const identity = await this.identityManager.createIdentity(params);
@@ -3555,7 +3680,7 @@ var ServiceContext = class {
3555
3680
  var _a;
3556
3681
  log14("initializing spaces...", {}, {
3557
3682
  file: "service-context.ts",
3558
- line: 166,
3683
+ line: 163,
3559
3684
  scope: this,
3560
3685
  callSite: (f, a) => f(...a)
3561
3686
  });
@@ -3574,6 +3699,7 @@ var ServiceContext = class {
3574
3699
  }
3575
3700
  };
3576
3701
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.modelFactory, this.feedStore, this.snapshotStore);
3702
+ this.dataSpaceManager._traceParent = this._instanceId;
3577
3703
  await this.dataSpaceManager.open();
3578
3704
  this._handlerFactories.set(Invitation5.Kind.SPACE, (invitation) => {
3579
3705
  assert12(this.dataSpaceManager, "dataSpaceManager not initialized yet");
@@ -3594,7 +3720,7 @@ var ServiceContext = class {
3594
3720
  details: assertion
3595
3721
  }, {
3596
3722
  file: "service-context.ts",
3597
- line: 207,
3723
+ line: 205,
3598
3724
  scope: this,
3599
3725
  callSite: (f, a) => f(...a)
3600
3726
  });
@@ -3605,7 +3731,7 @@ var ServiceContext = class {
3605
3731
  details: assertion
3606
3732
  }, {
3607
3733
  file: "service-context.ts",
3608
- line: 211,
3734
+ line: 209,
3609
3735
  scope: this,
3610
3736
  callSite: (f, a) => f(...a)
3611
3737
  });
@@ -3616,7 +3742,7 @@ var ServiceContext = class {
3616
3742
  details: assertion
3617
3743
  }, {
3618
3744
  file: "service-context.ts",
3619
- line: 216,
3745
+ line: 214,
3620
3746
  scope: this,
3621
3747
  callSite: (f, a) => f(...a)
3622
3748
  });
@@ -3627,7 +3753,7 @@ var ServiceContext = class {
3627
3753
  } catch (err) {
3628
3754
  log14.catch(err, {}, {
3629
3755
  file: "service-context.ts",
3630
- line: 222,
3756
+ line: 220,
3631
3757
  scope: this,
3632
3758
  callSite: (f, a) => f(...a)
3633
3759
  });
@@ -3705,8 +3831,7 @@ var ClientServicesHost = class {
3705
3831
  }
3706
3832
  },
3707
3833
  onReset: async () => {
3708
- assert13(this._serviceContext, "service host is closed");
3709
- await this._serviceContext.reset();
3834
+ await this.reset();
3710
3835
  }
3711
3836
  });
3712
3837
  this._serviceRegistry = new ServiceRegistry(clientServiceBundle, {
@@ -3749,11 +3874,11 @@ var ClientServicesHost = class {
3749
3874
  if (this._open) {
3750
3875
  return;
3751
3876
  }
3752
- log15.trace("dxos.sdk.client-services-host", trace3.begin({
3877
+ log15.trace("dxos.sdk.client-services-host", trace5.begin({
3753
3878
  id: this._instanceId
3754
3879
  }), {
3755
3880
  file: "service-host.ts",
3756
- line: 167,
3881
+ line: 166,
3757
3882
  scope: this,
3758
3883
  callSite: (f, a) => f(...a)
3759
3884
  });
@@ -3765,7 +3890,7 @@ var ClientServicesHost = class {
3765
3890
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3766
3891
  }, {
3767
3892
  file: "service-host.ts",
3768
- line: 174,
3893
+ line: 173,
3769
3894
  scope: this,
3770
3895
  callSite: (f, a) => f(...a)
3771
3896
  });
@@ -3799,7 +3924,7 @@ var ClientServicesHost = class {
3799
3924
  deviceKey
3800
3925
  }, {
3801
3926
  file: "service-host.ts",
3802
- line: 221,
3927
+ line: 220,
3803
3928
  scope: this,
3804
3929
  callSite: (f, a) => f(...a)
3805
3930
  });
@@ -3814,7 +3939,7 @@ var ClientServicesHost = class {
3814
3939
  deviceKey
3815
3940
  }, {
3816
3941
  file: "service-host.ts",
3817
- line: 230,
3942
+ line: 229,
3818
3943
  scope: this,
3819
3944
  callSite: (f, a) => f(...a)
3820
3945
  });
@@ -3828,15 +3953,32 @@ var ClientServicesHost = class {
3828
3953
  deviceKey
3829
3954
  }, {
3830
3955
  file: "service-host.ts",
3831
- line: 235,
3956
+ line: 234,
3832
3957
  scope: this,
3833
3958
  callSite: (f, a) => f(...a)
3834
3959
  });
3835
- log15.trace("dxos.sdk.client-services-host", trace3.end({
3960
+ log15.trace("dxos.sdk.client-services-host", trace5.end({
3836
3961
  id: this._instanceId
3837
3962
  }), {
3838
3963
  file: "service-host.ts",
3839
- line: 237,
3964
+ line: 236,
3965
+ scope: this,
3966
+ callSite: (f, a) => f(...a)
3967
+ });
3968
+ }
3969
+ async reset() {
3970
+ var _a;
3971
+ log15("resetting...", {}, {
3972
+ file: "service-host.ts",
3973
+ line: 240,
3974
+ scope: this,
3975
+ callSite: (f, a) => f(...a)
3976
+ });
3977
+ await ((_a = this._serviceContext) == null ? void 0 : _a.close());
3978
+ await this._storage.reset();
3979
+ log15("reset", {}, {
3980
+ file: "service-host.ts",
3981
+ line: 243,
3840
3982
  scope: this,
3841
3983
  callSite: (f, a) => f(...a)
3842
3984
  });
@@ -4057,4 +4199,4 @@ export {
4057
4199
  LocalClientServices,
4058
4200
  fromHost
4059
4201
  };
4060
- //# sourceMappingURL=chunk-OINEQJWM.mjs.map
4202
+ //# sourceMappingURL=chunk-6PNXHM7C.mjs.map