@dxos/client-services 0.1.56-main.be59a09 → 0.1.56-main.c19b7cd

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 (47) hide show
  1. package/dist/lib/browser/{chunk-K67JOICT.mjs → chunk-ZOTHWLK5.mjs} +228 -149
  2. package/dist/lib/browser/chunk-ZOTHWLK5.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +14 -12
  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 +2 -2
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +223 -142
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +210 -131
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts +2 -1
  14. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts +3 -2
  16. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  18. package/dist/types/src/packlets/services/service-context.d.ts +2 -1
  19. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  20. package/dist/types/src/packlets/services/service-host.d.ts +3 -1
  21. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  23. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  24. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  25. package/dist/types/src/version.d.ts +1 -1
  26. package/package.json +34 -33
  27. package/src/packlets/devices/devices-service.test.ts +2 -1
  28. package/src/packlets/identity/identity-manager.test.ts +4 -3
  29. package/src/packlets/identity/identity-manager.ts +9 -5
  30. package/src/packlets/identity/identity-service.test.ts +2 -1
  31. package/src/packlets/identity/identity.test.ts +7 -6
  32. package/src/packlets/identity/identity.ts +8 -3
  33. package/src/packlets/invitations/device-invitation-protocol.test.ts +2 -1
  34. package/src/packlets/network/network-service.test.ts +2 -1
  35. package/src/packlets/services/client-rpc-server.ts +4 -4
  36. package/src/packlets/services/service-context.test.ts +59 -0
  37. package/src/packlets/services/service-context.ts +11 -6
  38. package/src/packlets/services/service-host.test.ts +6 -5
  39. package/src/packlets/services/service-host.ts +15 -3
  40. package/src/packlets/services/service-registry.test.ts +2 -1
  41. package/src/packlets/spaces/data-space.ts +17 -5
  42. package/src/packlets/spaces/spaces-service.test.ts +2 -1
  43. package/src/packlets/testing/test-builder.ts +1 -1
  44. package/src/packlets/vault/iframe-host-runtime.ts +2 -1
  45. package/src/packlets/vault/worker-runtime.ts +2 -1
  46. package/src/version.ts +1 -1
  47. package/dist/lib/browser/chunk-K67JOICT.mjs.map +0 -7
@@ -530,8 +530,19 @@ var import_feed_store2 = require("@dxos/feed-store");
530
530
  var import_invariant = require("@dxos/invariant");
531
531
  var import_log2 = require("@dxos/log");
532
532
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
533
+ var import_tracing = require("@dxos/tracing");
534
+ function _ts_decorate(decorators, target, key, desc) {
535
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
536
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
537
+ r = Reflect.decorate(decorators, target, key, desc);
538
+ else
539
+ for (var i = decorators.length - 1; i >= 0; i--)
540
+ if (d = decorators[i])
541
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
542
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
543
+ }
533
544
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
534
- var Identity = class {
545
+ var Identity = class Identity2 {
535
546
  constructor({ space, signer, identityKey, deviceKey }) {
536
547
  this.stateUpdate = new import_async5.Event();
537
548
  this.space = space;
@@ -557,12 +568,12 @@ var Identity = class {
557
568
  get authorizedDeviceKeys() {
558
569
  return this._deviceStateMachine.authorizedDeviceKeys;
559
570
  }
560
- async open() {
571
+ async open(ctx) {
561
572
  await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
562
573
  await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
563
- await this.space.open();
574
+ await this.space.open(ctx);
564
575
  }
565
- async close() {
576
+ async close(ctx) {
566
577
  await this.authVerifier.close();
567
578
  await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
568
579
  await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
@@ -607,7 +618,7 @@ var Identity = class {
607
618
  getIdentityCredentialSigner() {
608
619
  (0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
609
620
  F: __dxlog_file2,
610
- L: 134,
621
+ L: 139,
611
622
  S: this,
612
623
  A: [
613
624
  "this._deviceStateMachine.deviceCredentialChain",
@@ -631,7 +642,7 @@ var Identity = class {
631
642
  dataFeedKey
632
643
  }, {
633
644
  F: __dxlog_file2,
634
- L: 150,
645
+ L: 155,
635
646
  S: this,
636
647
  C: (f, a) => f(...a)
637
648
  });
@@ -672,18 +683,39 @@ var Identity = class {
672
683
  })));
673
684
  }
674
685
  };
686
+ _ts_decorate([
687
+ import_tracing.trace.span()
688
+ ], Identity.prototype, "open", null);
689
+ _ts_decorate([
690
+ import_tracing.trace.span()
691
+ ], Identity.prototype, "close", null);
692
+ Identity = _ts_decorate([
693
+ import_tracing.trace.resource()
694
+ ], Identity);
675
695
 
676
696
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
677
697
  var import_async6 = require("@dxos/async");
698
+ var import_context3 = require("@dxos/context");
678
699
  var import_credentials4 = require("@dxos/credentials");
679
700
  var import_invariant2 = require("@dxos/invariant");
680
701
  var import_keys4 = require("@dxos/keys");
681
702
  var import_log3 = require("@dxos/log");
682
703
  var import_protocols2 = require("@dxos/protocols");
683
704
  var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
705
+ var import_tracing2 = require("@dxos/tracing");
684
706
  var import_util2 = require("@dxos/util");
707
+ function _ts_decorate2(decorators, target, key, desc) {
708
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
709
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
710
+ r = Reflect.decorate(decorators, target, key, desc);
711
+ else
712
+ for (var i = decorators.length - 1; i >= 0; i--)
713
+ if (d = decorators[i])
714
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
715
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
716
+ }
685
717
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
686
- var IdentityManager = class {
718
+ var IdentityManager = class IdentityManager2 {
687
719
  // TODO(burdon): IdentityManagerParams.
688
720
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
689
721
  constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
@@ -696,14 +728,14 @@ var IdentityManager = class {
696
728
  get identity() {
697
729
  return this._identity;
698
730
  }
699
- async open() {
731
+ async open(ctx) {
700
732
  var _a;
701
733
  const traceId = import_keys4.PublicKey.random().toHex();
702
734
  import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
703
735
  id: traceId
704
736
  }), {
705
737
  F: __dxlog_file3,
706
- L: 69,
738
+ L: 73,
707
739
  S: this,
708
740
  C: (f, a) => f(...a)
709
741
  });
@@ -713,20 +745,20 @@ var IdentityManager = class {
713
745
  identityRecord
714
746
  }, {
715
747
  F: __dxlog_file3,
716
- L: 73,
748
+ L: 77,
717
749
  S: this,
718
750
  C: (f, a) => f(...a)
719
751
  });
720
752
  if (identityRecord) {
721
753
  this._identity = await this._constructIdentity(identityRecord);
722
- await this._identity.open();
754
+ await this._identity.open(ctx);
723
755
  await this._identity.ready();
724
756
  import_log3.log.trace("dxos.halo.identity", {
725
757
  identityKey: identityRecord.identityKey,
726
758
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
727
759
  }, {
728
760
  F: __dxlog_file3,
729
- L: 78,
761
+ L: 82,
730
762
  S: this,
731
763
  C: (f, a) => f(...a)
732
764
  });
@@ -736,20 +768,20 @@ var IdentityManager = class {
736
768
  id: traceId
737
769
  }), {
738
770
  F: __dxlog_file3,
739
- L: 84,
771
+ L: 88,
740
772
  S: this,
741
773
  C: (f, a) => f(...a)
742
774
  });
743
775
  }
744
776
  async close() {
745
777
  var _a;
746
- await ((_a = this._identity) == null ? void 0 : _a.close());
778
+ await ((_a = this._identity) == null ? void 0 : _a.close(new import_context3.Context()));
747
779
  }
748
780
  async createIdentity({ displayName } = {}) {
749
781
  var _a;
750
782
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
751
783
  F: __dxlog_file3,
752
- L: 92,
784
+ L: 96,
753
785
  S: this,
754
786
  A: [
755
787
  "!this._identity",
@@ -758,7 +790,7 @@ var IdentityManager = class {
758
790
  });
759
791
  (0, import_log3.log)("creating identity...", void 0, {
760
792
  F: __dxlog_file3,
761
- L: 93,
793
+ L: 97,
762
794
  S: this,
763
795
  C: (f, a) => f(...a)
764
796
  });
@@ -774,12 +806,12 @@ var IdentityManager = class {
774
806
  }
775
807
  };
776
808
  const identity = await this._constructIdentity(identityRecord);
777
- await identity.open();
809
+ await identity.open(new import_context3.Context());
778
810
  {
779
811
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
780
812
  (0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
781
813
  F: __dxlog_file3,
782
- L: 112,
814
+ L: 116,
783
815
  S: this,
784
816
  A: [
785
817
  "identityRecord.haloSpace.genesisFeedKey",
@@ -788,7 +820,7 @@ var IdentityManager = class {
788
820
  });
789
821
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
790
822
  F: __dxlog_file3,
791
- L: 113,
823
+ L: 117,
792
824
  S: this,
793
825
  A: [
794
826
  "identityRecord.haloSpace.dataFeedKey",
@@ -823,7 +855,7 @@ var IdentityManager = class {
823
855
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
824
856
  }, {
825
857
  F: __dxlog_file3,
826
- L: 148,
858
+ L: 152,
827
859
  S: this,
828
860
  C: (f, a) => f(...a)
829
861
  });
@@ -833,7 +865,7 @@ var IdentityManager = class {
833
865
  deviceKey: identity.deviceKey
834
866
  }, {
835
867
  F: __dxlog_file3,
836
- L: 154,
868
+ L: 158,
837
869
  S: this,
838
870
  C: (f, a) => f(...a)
839
871
  });
@@ -848,13 +880,13 @@ var IdentityManager = class {
848
880
  params
849
881
  }, {
850
882
  F: __dxlog_file3,
851
- L: 162,
883
+ L: 166,
852
884
  S: this,
853
885
  C: (f, a) => f(...a)
854
886
  });
855
887
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
856
888
  F: __dxlog_file3,
857
- L: 163,
889
+ L: 167,
858
890
  S: this,
859
891
  A: [
860
892
  "!this._identity",
@@ -873,7 +905,7 @@ var IdentityManager = class {
873
905
  }
874
906
  };
875
907
  const identity = await this._constructIdentity(identityRecord);
876
- await identity.open();
908
+ await identity.open(new import_context3.Context());
877
909
  this._identity = identity;
878
910
  await this._metadataStore.setIdentityRecord(identityRecord);
879
911
  await this._identity.ready();
@@ -882,7 +914,7 @@ var IdentityManager = class {
882
914
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
883
915
  }, {
884
916
  F: __dxlog_file3,
885
- L: 182,
917
+ L: 186,
886
918
  S: this,
887
919
  C: (f, a) => f(...a)
888
920
  });
@@ -892,7 +924,7 @@ var IdentityManager = class {
892
924
  deviceKey: identity.deviceKey
893
925
  }, {
894
926
  F: __dxlog_file3,
895
- L: 188,
927
+ L: 192,
896
928
  S: this,
897
929
  C: (f, a) => f(...a)
898
930
  });
@@ -901,7 +933,7 @@ var IdentityManager = class {
901
933
  async _constructIdentity(identityRecord) {
902
934
  (0, import_invariant2.invariant)(!this._identity, void 0, {
903
935
  F: __dxlog_file3,
904
- L: 193,
936
+ L: 197,
905
937
  S: this,
906
938
  A: [
907
939
  "!this._identity",
@@ -912,13 +944,13 @@ var IdentityManager = class {
912
944
  identityRecord
913
945
  }, {
914
946
  F: __dxlog_file3,
915
- L: 194,
947
+ L: 198,
916
948
  S: this,
917
949
  C: (f, a) => f(...a)
918
950
  });
919
951
  (0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
920
952
  F: __dxlog_file3,
921
- L: 197,
953
+ L: 201,
922
954
  S: this,
923
955
  A: [
924
956
  "identityRecord.haloSpace.controlFeedKey",
@@ -930,7 +962,7 @@ var IdentityManager = class {
930
962
  });
931
963
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
932
964
  F: __dxlog_file3,
933
- L: 201,
965
+ L: 205,
934
966
  S: this,
935
967
  A: [
936
968
  "identityRecord.haloSpace.dataFeedKey",
@@ -962,7 +994,7 @@ var IdentityManager = class {
962
994
  identityKey: identityRecord.identityKey
963
995
  }, {
964
996
  F: __dxlog_file3,
965
- L: 225,
997
+ L: 229,
966
998
  S: this,
967
999
  C: (f, a) => f(...a)
968
1000
  });
@@ -983,7 +1015,7 @@ var IdentityManager = class {
983
1015
  onAuthFailure: () => {
984
1016
  import_log3.log.warn("auth failure", void 0, {
985
1017
  F: __dxlog_file3,
986
- L: 244,
1018
+ L: 248,
987
1019
  S: this,
988
1020
  C: (f, a) => f(...a)
989
1021
  });
@@ -992,6 +1024,12 @@ var IdentityManager = class {
992
1024
  });
993
1025
  }
994
1026
  };
1027
+ _ts_decorate2([
1028
+ import_tracing2.trace.span()
1029
+ ], IdentityManager.prototype, "open", null);
1030
+ IdentityManager = _ts_decorate2([
1031
+ import_tracing2.trace.resource()
1032
+ ], IdentityManager);
995
1033
 
996
1034
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
997
1035
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
@@ -1143,7 +1181,7 @@ var DeviceInvitationProtocol = class {
1143
1181
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1144
1182
  var import_async8 = require("@dxos/async");
1145
1183
  var import_client_protocol2 = require("@dxos/client-protocol");
1146
- var import_context4 = require("@dxos/context");
1184
+ var import_context5 = require("@dxos/context");
1147
1185
  var import_credentials7 = require("@dxos/credentials");
1148
1186
  var import_errors2 = require("@dxos/errors");
1149
1187
  var import_invariant6 = require("@dxos/invariant");
@@ -1156,7 +1194,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1156
1194
 
1157
1195
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1158
1196
  var import_async7 = require("@dxos/async");
1159
- var import_context3 = require("@dxos/context");
1197
+ var import_context4 = require("@dxos/context");
1160
1198
  var import_errors = require("@dxos/errors");
1161
1199
  var import_invariant5 = require("@dxos/invariant");
1162
1200
  var import_keys5 = require("@dxos/keys");
@@ -1179,7 +1217,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1179
1217
  }
1180
1218
  });
1181
1219
  this._callbacks = _callbacks;
1182
- this._ctx = new import_context3.Context();
1220
+ this._ctx = new import_context4.Context();
1183
1221
  this._remoteOptionsTrigger = new import_async7.Trigger();
1184
1222
  this.invitation = void 0;
1185
1223
  this.guestProfile = void 0;
@@ -1386,7 +1424,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1386
1424
  await this.rpc.InvitationHostService.options({
1387
1425
  role: import_invitations.Options.Role.HOST
1388
1426
  });
1389
- await (0, import_context3.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1427
+ await (0, import_context4.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1390
1428
  timeout: OPTIONS_TIMEOUT
1391
1429
  }));
1392
1430
  if (((_a = this._remoteOptions) == null ? void 0 : _a.role) !== import_invitations.Options.Role.GUEST) {
@@ -1415,7 +1453,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1415
1453
  }
1416
1454
  });
1417
1455
  this._callbacks = _callbacks;
1418
- this._ctx = new import_context3.Context();
1456
+ this._ctx = new import_context4.Context();
1419
1457
  this._remoteOptionsTrigger = new import_async7.Trigger();
1420
1458
  }
1421
1459
  async getHandlers() {
@@ -1456,10 +1494,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1456
1494
  S: this,
1457
1495
  C: (f, a) => f(...a)
1458
1496
  });
1459
- await (0, import_context3.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
1497
+ await (0, import_context4.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
1460
1498
  role: import_invitations.Options.Role.GUEST
1461
1499
  }));
1462
- await (0, import_context3.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1500
+ await (0, import_context4.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1463
1501
  timeout: OPTIONS_TIMEOUT
1464
1502
  }));
1465
1503
  (0, import_log4.log)("end options", void 0, {
@@ -1530,7 +1568,7 @@ var InvitationsHandler = class {
1530
1568
  ...protocol.getInvitationContext()
1531
1569
  };
1532
1570
  const stream = new import_async8.PushStream();
1533
- const ctx = new import_context4.Context({
1571
+ const ctx = new import_context5.Context({
1534
1572
  onError: (err) => {
1535
1573
  void ctx.dispose();
1536
1574
  stream.error(err);
@@ -1761,7 +1799,7 @@ var InvitationsHandler = class {
1761
1799
  ...newData
1762
1800
  });
1763
1801
  };
1764
- const ctx = new import_context4.Context({
1802
+ const ctx = new import_context5.Context({
1765
1803
  onError: (err) => {
1766
1804
  if (err instanceof import_async8.TimeoutError) {
1767
1805
  (0, import_log5.log)("timeout", {
@@ -2454,7 +2492,7 @@ var import_protocols5 = require("@dxos/protocols");
2454
2492
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2455
2493
 
2456
2494
  // packages/sdk/client-services/src/version.ts
2457
- var DXOS_VERSION = "0.1.56-main.be59a09";
2495
+ var DXOS_VERSION = "0.1.56-main.c19b7cd";
2458
2496
 
2459
2497
  // packages/sdk/client-services/src/packlets/services/platform.ts
2460
2498
  var getPlatform = () => {
@@ -2612,6 +2650,7 @@ var getSpaceStats = async (space) => {
2612
2650
 
2613
2651
  // packages/sdk/client-services/src/packlets/services/service-context.ts
2614
2652
  var import_async14 = require("@dxos/async");
2653
+ var import_context9 = require("@dxos/context");
2615
2654
  var import_credentials14 = require("@dxos/credentials");
2616
2655
  var import_debug7 = require("@dxos/debug");
2617
2656
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
@@ -2623,10 +2662,11 @@ var import_log13 = require("@dxos/log");
2623
2662
  var import_protocols9 = require("@dxos/protocols");
2624
2663
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2625
2664
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2665
+ var import_tracing3 = require("@dxos/tracing");
2626
2666
 
2627
2667
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2628
2668
  var import_async12 = require("@dxos/async");
2629
- var import_context7 = require("@dxos/context");
2669
+ var import_context8 = require("@dxos/context");
2630
2670
  var import_credentials13 = require("@dxos/credentials");
2631
2671
  var import_invariant11 = require("@dxos/invariant");
2632
2672
  var import_keys9 = require("@dxos/keys");
@@ -2639,7 +2679,7 @@ var import_util5 = require("@dxos/util");
2639
2679
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2640
2680
  var import_async11 = require("@dxos/async");
2641
2681
  var import_client_protocol3 = require("@dxos/client-protocol");
2642
- var import_context6 = require("@dxos/context");
2682
+ var import_context7 = require("@dxos/context");
2643
2683
  var import_debug4 = require("@dxos/debug");
2644
2684
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2645
2685
  var import_errors3 = require("@dxos/errors");
@@ -2652,7 +2692,7 @@ var import_util4 = require("@dxos/util");
2652
2692
 
2653
2693
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2654
2694
  var import_async10 = require("@dxos/async");
2655
- var import_context5 = require("@dxos/context");
2695
+ var import_context6 = require("@dxos/context");
2656
2696
  var import_invariant10 = require("@dxos/invariant");
2657
2697
  var import_keys7 = require("@dxos/keys");
2658
2698
  var import_log9 = require("@dxos/log");
@@ -2666,7 +2706,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
2666
2706
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
2667
2707
  var NotarizationPlugin = class {
2668
2708
  constructor() {
2669
- this._ctx = new import_context5.Context();
2709
+ this._ctx = new import_context6.Context();
2670
2710
  this._extensionOpened = new import_async10.Event();
2671
2711
  this._extensions = /* @__PURE__ */ new Set();
2672
2712
  this._processedCredentials = new import_util3.ComplexSet(import_keys7.PublicKey.hash);
@@ -2791,7 +2831,7 @@ var NotarizationPlugin = class {
2791
2831
  this._extensionOpened.on(ctx, () => notarizeTask.schedule());
2792
2832
  try {
2793
2833
  await Promise.race([
2794
- (0, import_context5.rejectOnDispose)(ctx),
2834
+ (0, import_context6.rejectOnDispose)(ctx),
2795
2835
  allNotarized,
2796
2836
  errors.wait()
2797
2837
  ]);
@@ -2921,7 +2961,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
2921
2961
  };
2922
2962
 
2923
2963
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2924
- function _ts_decorate(decorators, target, key, desc) {
2964
+ function _ts_decorate3(decorators, target, key, desc) {
2925
2965
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2926
2966
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2927
2967
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2932,9 +2972,10 @@ function _ts_decorate(decorators, target, key, desc) {
2932
2972
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2933
2973
  }
2934
2974
  var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2975
+ var ENABLE_FEED_PURGE = false;
2935
2976
  var DataSpace = class DataSpace2 {
2936
2977
  constructor(params) {
2937
- this._ctx = new import_context6.Context();
2978
+ this._ctx = new import_context7.Context();
2938
2979
  this._notarizationPlugin = new NotarizationPlugin();
2939
2980
  this._state = import_services7.SpaceState.CLOSED;
2940
2981
  /**
@@ -2992,7 +3033,7 @@ var DataSpace = class DataSpace2 {
2992
3033
  async _open() {
2993
3034
  await this._notarizationPlugin.open();
2994
3035
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2995
- await this._inner.open();
3036
+ await this._inner.open(new import_context7.Context());
2996
3037
  this._state = import_services7.SpaceState.CONTROL_ONLY;
2997
3038
  this.stateUpdate.emit();
2998
3039
  this.metrics = {};
@@ -3006,7 +3047,7 @@ var DataSpace = class DataSpace2 {
3006
3047
  await ((_b = (_a = this._callbacks).beforeClose) == null ? void 0 : _b.call(_a));
3007
3048
  this._state = import_services7.SpaceState.CLOSED;
3008
3049
  await this._ctx.dispose();
3009
- this._ctx = new import_context6.Context();
3050
+ this._ctx = new import_context7.Context();
3010
3051
  await this.authVerifier.close();
3011
3052
  await this._inner.close();
3012
3053
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
@@ -3031,7 +3072,7 @@ var DataSpace = class DataSpace2 {
3031
3072
  if (err instanceof import_errors3.CancelledError) {
3032
3073
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3033
3074
  F: __dxlog_file12,
3034
- L: 193,
3075
+ L: 199,
3035
3076
  S: this,
3036
3077
  C: (f, a) => f(...a)
3037
3078
  });
@@ -3039,7 +3080,7 @@ var DataSpace = class DataSpace2 {
3039
3080
  }
3040
3081
  import_log10.log.error("Error initializing data pipeline", err, {
3041
3082
  F: __dxlog_file12,
3042
- L: 197,
3083
+ L: 203,
3043
3084
  S: this,
3044
3085
  C: (f, a) => f(...a)
3045
3086
  });
@@ -3065,7 +3106,7 @@ var DataSpace = class DataSpace2 {
3065
3106
  await this._createWritableFeeds();
3066
3107
  (0, import_log10.log)("writable feeds created", void 0, {
3067
3108
  F: __dxlog_file12,
3068
- L: 221,
3109
+ L: 227,
3069
3110
  S: this,
3070
3111
  C: (f, a) => f(...a)
3071
3112
  });
@@ -3079,10 +3120,10 @@ var DataSpace = class DataSpace2 {
3079
3120
  }
3080
3121
  await this._inner.initializeDataPipeline();
3081
3122
  this.metrics.dataPipelineOpen = new Date();
3082
- await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3123
+ await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3083
3124
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3084
3125
  F: __dxlog_file12,
3085
- L: 242,
3126
+ L: 248,
3086
3127
  S: this,
3087
3128
  C: (f, a) => f(...a)
3088
3129
  });
@@ -3093,7 +3134,7 @@ var DataSpace = class DataSpace2 {
3093
3134
  this.metrics.dataPipelineReady = new Date();
3094
3135
  (0, import_log10.log)("data pipeline ready", void 0, {
3095
3136
  F: __dxlog_file12,
3096
- L: 251,
3137
+ L: 257,
3097
3138
  S: this,
3098
3139
  C: (f, a) => f(...a)
3099
3140
  });
@@ -3166,10 +3207,13 @@ var DataSpace = class DataSpace2 {
3166
3207
  receipt.seq
3167
3208
  ]
3168
3209
  ]));
3169
- for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
3170
- const indexBeforeEpoch = epoch.timeframe.get(feed.key);
3171
- if (indexBeforeEpoch) {
3172
- await feed.clear(0, indexBeforeEpoch + 1);
3210
+ if (ENABLE_FEED_PURGE) {
3211
+ for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
3212
+ const indexBeforeEpoch = epoch.timeframe.get(feed.key);
3213
+ if (indexBeforeEpoch === void 0) {
3214
+ continue;
3215
+ }
3216
+ await feed.safeClear(0, indexBeforeEpoch + 1);
3173
3217
  }
3174
3218
  }
3175
3219
  }
@@ -3191,22 +3235,22 @@ var DataSpace = class DataSpace2 {
3191
3235
  this.stateUpdate.emit();
3192
3236
  }
3193
3237
  };
3194
- _ts_decorate([
3238
+ _ts_decorate3([
3195
3239
  import_async11.synchronized
3196
3240
  ], DataSpace.prototype, "open", null);
3197
- _ts_decorate([
3241
+ _ts_decorate3([
3198
3242
  import_async11.synchronized
3199
3243
  ], DataSpace.prototype, "close", null);
3200
- _ts_decorate([
3244
+ _ts_decorate3([
3201
3245
  (0, import_debug4.timed)(1e4)
3202
3246
  ], DataSpace.prototype, "_createWritableFeeds", null);
3203
- _ts_decorate([
3247
+ _ts_decorate3([
3204
3248
  import_async11.synchronized
3205
3249
  ], DataSpace.prototype, "activate", null);
3206
- _ts_decorate([
3250
+ _ts_decorate3([
3207
3251
  import_async11.synchronized
3208
3252
  ], DataSpace.prototype, "deactivate", null);
3209
- DataSpace = _ts_decorate([
3253
+ DataSpace = _ts_decorate3([
3210
3254
  (0, import_async11.trackLeaks)("open", "close")
3211
3255
  ], DataSpace);
3212
3256
 
@@ -3281,7 +3325,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
3281
3325
  };
3282
3326
 
3283
3327
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
3284
- function _ts_decorate2(decorators, target, key, desc) {
3328
+ function _ts_decorate4(decorators, target, key, desc) {
3285
3329
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3286
3330
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3287
3331
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3300,7 +3344,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3300
3344
  this._keyring = _keyring;
3301
3345
  this._signingContext = _signingContext;
3302
3346
  this._feedStore = _feedStore;
3303
- this._ctx = new import_context7.Context();
3347
+ this._ctx = new import_context8.Context();
3304
3348
  this.updated = new import_async12.Event();
3305
3349
  this._spaces = new import_util5.ComplexMap(import_keys9.PublicKey.hash);
3306
3350
  this._isOpen = false;
@@ -3479,7 +3523,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3479
3523
  * TODO(dmaretskyi): Consider removing.
3480
3524
  */
3481
3525
  async waitUntilSpaceReady(spaceKey) {
3482
- await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3526
+ await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3483
3527
  const space = this._spaces.get(spaceKey);
3484
3528
  return !!space && space.state === import_services8.SpaceState.READY;
3485
3529
  }));
@@ -3596,19 +3640,19 @@ var DataSpaceManager = class DataSpaceManager2 {
3596
3640
  return dataSpace;
3597
3641
  }
3598
3642
  };
3599
- _ts_decorate2([
3643
+ _ts_decorate4([
3600
3644
  import_async12.synchronized
3601
3645
  ], DataSpaceManager.prototype, "open", null);
3602
- _ts_decorate2([
3646
+ _ts_decorate4([
3603
3647
  import_async12.synchronized
3604
3648
  ], DataSpaceManager.prototype, "close", null);
3605
- _ts_decorate2([
3649
+ _ts_decorate4([
3606
3650
  import_async12.synchronized
3607
3651
  ], DataSpaceManager.prototype, "createSpace", null);
3608
- _ts_decorate2([
3652
+ _ts_decorate4([
3609
3653
  import_async12.synchronized
3610
3654
  ], DataSpaceManager.prototype, "acceptSpace", null);
3611
- DataSpaceManager = _ts_decorate2([
3655
+ DataSpaceManager = _ts_decorate4([
3612
3656
  (0, import_async12.trackLeaks)("open", "close")
3613
3657
  ], DataSpaceManager);
3614
3658
 
@@ -3799,8 +3843,18 @@ var SpacesServiceImpl = class {
3799
3843
  var getChannelId = (channel) => `user-channel/${channel}`;
3800
3844
 
3801
3845
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3846
+ function _ts_decorate5(decorators, target, key, desc) {
3847
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3848
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3849
+ r = Reflect.decorate(decorators, target, key, desc);
3850
+ else
3851
+ for (var i = decorators.length - 1; i >= 0; i--)
3852
+ if (d = decorators[i])
3853
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3854
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3855
+ }
3802
3856
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3803
- var ServiceContext = class {
3857
+ var ServiceContext = class ServiceContext2 {
3804
3858
  // prettier-ignore
3805
3859
  constructor(storage, networkManager, signalManager, modelFactory) {
3806
3860
  this.storage = storage;
@@ -3839,11 +3893,11 @@ var ServiceContext = class {
3839
3893
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
3840
3894
  }, this._acceptIdentity.bind(this)));
3841
3895
  }
3842
- async open() {
3896
+ async open(ctx) {
3843
3897
  await this._checkStorageVersion();
3844
3898
  (0, import_log13.log)("opening...", void 0, {
3845
3899
  F: __dxlog_file15,
3846
- L: 127,
3900
+ L: 131,
3847
3901
  S: this,
3848
3902
  C: (f, a) => f(...a)
3849
3903
  });
@@ -3851,28 +3905,28 @@ var ServiceContext = class {
3851
3905
  id: this._instanceId
3852
3906
  }), {
3853
3907
  F: __dxlog_file15,
3854
- L: 128,
3908
+ L: 132,
3855
3909
  S: this,
3856
3910
  C: (f, a) => f(...a)
3857
3911
  });
3858
3912
  await this.signalManager.open();
3859
3913
  await this.networkManager.open();
3860
3914
  await this.spaceManager.open();
3861
- await this.identityManager.open();
3915
+ await this.identityManager.open(ctx);
3862
3916
  if (this.identityManager.identity) {
3863
- await this._initialize();
3917
+ await this._initialize(ctx);
3864
3918
  }
3865
3919
  import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
3866
3920
  id: this._instanceId
3867
3921
  }), {
3868
3922
  F: __dxlog_file15,
3869
- L: 136,
3923
+ L: 140,
3870
3924
  S: this,
3871
3925
  C: (f, a) => f(...a)
3872
3926
  });
3873
3927
  (0, import_log13.log)("opened", void 0, {
3874
3928
  F: __dxlog_file15,
3875
- L: 137,
3929
+ L: 141,
3876
3930
  S: this,
3877
3931
  C: (f, a) => f(...a)
3878
3932
  });
@@ -3881,7 +3935,7 @@ var ServiceContext = class {
3881
3935
  var _a;
3882
3936
  (0, import_log13.log)("closing...", void 0, {
3883
3937
  F: __dxlog_file15,
3884
- L: 141,
3938
+ L: 145,
3885
3939
  S: this,
3886
3940
  C: (f, a) => f(...a)
3887
3941
  });
@@ -3897,21 +3951,21 @@ var ServiceContext = class {
3897
3951
  this.dataServiceSubscriptions.clear();
3898
3952
  (0, import_log13.log)("closed", void 0, {
3899
3953
  F: __dxlog_file15,
3900
- L: 152,
3954
+ L: 156,
3901
3955
  S: this,
3902
3956
  C: (f, a) => f(...a)
3903
3957
  });
3904
3958
  }
3905
3959
  async createIdentity(params = {}) {
3906
3960
  const identity = await this.identityManager.createIdentity(params);
3907
- await this._initialize();
3961
+ await this._initialize(new import_context9.Context());
3908
3962
  return identity;
3909
3963
  }
3910
3964
  getInvitationHandler(invitation) {
3911
3965
  const factory = this._handlerFactories.get(invitation.kind);
3912
3966
  (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3913
3967
  F: __dxlog_file15,
3914
- L: 164,
3968
+ L: 168,
3915
3969
  S: this,
3916
3970
  A: [
3917
3971
  "factory",
@@ -3922,7 +3976,7 @@ var ServiceContext = class {
3922
3976
  }
3923
3977
  async _acceptIdentity(params) {
3924
3978
  const identity = await this.identityManager.acceptIdentity(params);
3925
- await this._initialize();
3979
+ await this._initialize(new import_context9.Context());
3926
3980
  return identity;
3927
3981
  }
3928
3982
  async _checkStorageVersion() {
@@ -3932,11 +3986,11 @@ var ServiceContext = class {
3932
3986
  }
3933
3987
  }
3934
3988
  // Called when identity is created.
3935
- async _initialize() {
3989
+ async _initialize(ctx) {
3936
3990
  var _a;
3937
3991
  (0, import_log13.log)("initializing spaces...", void 0, {
3938
3992
  F: __dxlog_file15,
3939
- L: 185,
3993
+ L: 190,
3940
3994
  S: this,
3941
3995
  C: (f, a) => f(...a)
3942
3996
  });
@@ -3959,7 +4013,7 @@ var ServiceContext = class {
3959
4013
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3960
4014
  (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3961
4015
  F: __dxlog_file15,
3962
- L: 208,
4016
+ L: 213,
3963
4017
  S: this,
3964
4018
  A: [
3965
4019
  "this.dataSpaceManager",
@@ -3983,7 +4037,7 @@ var ServiceContext = class {
3983
4037
  details: assertion
3984
4038
  }, {
3985
4039
  F: __dxlog_file15,
3986
- L: 224,
4040
+ L: 229,
3987
4041
  S: this,
3988
4042
  C: (f, a) => f(...a)
3989
4043
  });
@@ -3994,7 +4048,7 @@ var ServiceContext = class {
3994
4048
  details: assertion
3995
4049
  }, {
3996
4050
  F: __dxlog_file15,
3997
- L: 228,
4051
+ L: 233,
3998
4052
  S: this,
3999
4053
  C: (f, a) => f(...a)
4000
4054
  });
@@ -4005,7 +4059,7 @@ var ServiceContext = class {
4005
4059
  details: assertion
4006
4060
  }, {
4007
4061
  F: __dxlog_file15,
4008
- L: 233,
4062
+ L: 238,
4009
4063
  S: this,
4010
4064
  C: (f, a) => f(...a)
4011
4065
  });
@@ -4016,7 +4070,7 @@ var ServiceContext = class {
4016
4070
  } catch (err) {
4017
4071
  import_log13.log.catch(err, void 0, {
4018
4072
  F: __dxlog_file15,
4019
- L: 239,
4073
+ L: 244,
4020
4074
  S: this,
4021
4075
  C: (f, a) => f(...a)
4022
4076
  });
@@ -4026,10 +4080,20 @@ var ServiceContext = class {
4026
4080
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
4027
4081
  }
4028
4082
  };
4083
+ _ts_decorate5([
4084
+ import_tracing3.trace.span()
4085
+ ], ServiceContext.prototype, "open", null);
4086
+ _ts_decorate5([
4087
+ import_tracing3.trace.span()
4088
+ ], ServiceContext.prototype, "_initialize", null);
4089
+ ServiceContext = _ts_decorate5([
4090
+ import_tracing3.trace.resource()
4091
+ ], ServiceContext);
4029
4092
 
4030
4093
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4031
4094
  var import_async17 = require("@dxos/async");
4032
4095
  var import_client_protocol5 = require("@dxos/client-protocol");
4096
+ var import_context10 = require("@dxos/context");
4033
4097
  var import_document_model2 = require("@dxos/document-model");
4034
4098
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4035
4099
  var import_invariant14 = require("@dxos/invariant");
@@ -4041,6 +4105,7 @@ var import_network_manager2 = require("@dxos/network-manager");
4041
4105
  var import_protocols10 = require("@dxos/protocols");
4042
4106
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4043
4107
  var import_text_model = require("@dxos/text-model");
4108
+ var import_tracing4 = require("@dxos/tracing");
4044
4109
 
4045
4110
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4046
4111
  var import_async15 = require("@dxos/async");
@@ -4093,7 +4158,7 @@ var DevicesServiceImpl = class {
4093
4158
  var import_invariant13 = require("@dxos/invariant");
4094
4159
  var import_lock_file = require("@dxos/lock-file");
4095
4160
  var import_log14 = require("@dxos/log");
4096
- function _ts_decorate3(decorators, target, key, desc) {
4161
+ function _ts_decorate6(decorators, target, key, desc) {
4097
4162
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4098
4163
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4099
4164
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4145,7 +4210,7 @@ var Lock = class {
4145
4210
  await import_lock_file.LockFile.release(this._fileHandle);
4146
4211
  }
4147
4212
  };
4148
- _ts_decorate3([
4213
+ _ts_decorate6([
4149
4214
  import_log14.logInfo
4150
4215
  ], Lock.prototype, "lockKey", null);
4151
4216
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
@@ -4434,7 +4499,7 @@ var ServiceRegistry = class {
4434
4499
  };
4435
4500
 
4436
4501
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4437
- function _ts_decorate4(decorators, target, key, desc) {
4502
+ function _ts_decorate7(decorators, target, key, desc) {
4438
4503
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4439
4504
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4440
4505
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4448,7 +4513,7 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4448
4513
  var createDefaultModelFactory = () => {
4449
4514
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4450
4515
  };
4451
- var ClientServicesHost = class {
4516
+ var ClientServicesHost = class ClientServicesHost2 {
4452
4517
  constructor({
4453
4518
  config,
4454
4519
  modelFactory = createDefaultModelFactory(),
@@ -4459,6 +4524,7 @@ var ClientServicesHost = class {
4459
4524
  lockKey,
4460
4525
  callbacks
4461
4526
  } = {}) {
4527
+ this._tracingService = import_tracing4.TRACE_PROCESSOR.createTraceSender();
4462
4528
  this._statusUpdate = new import_async17.Event();
4463
4529
  this._opening = false;
4464
4530
  this._open = false;
@@ -4477,7 +4543,7 @@ var ClientServicesHost = class {
4477
4543
  lockKey,
4478
4544
  onAcquire: () => {
4479
4545
  if (!this._opening) {
4480
- void this.open();
4546
+ void this.open(new import_context10.Context());
4481
4547
  }
4482
4548
  },
4483
4549
  onRelease: () => this.close()
@@ -4504,7 +4570,8 @@ var ClientServicesHost = class {
4504
4570
  });
4505
4571
  this._loggingService = new LoggingServiceImpl();
4506
4572
  this._serviceRegistry = new ServiceRegistry(import_client_protocol5.clientServiceBundle, {
4507
- SystemService: this._systemService
4573
+ SystemService: this._systemService,
4574
+ TracingService: this._tracingService
4508
4575
  });
4509
4576
  }
4510
4577
  get isOpen() {
@@ -4534,7 +4601,7 @@ var ClientServicesHost = class {
4534
4601
  var _a, _b, _c;
4535
4602
  (0, import_invariant14.invariant)(!this._open, "service host is open", {
4536
4603
  F: __dxlog_file17,
4537
- L: 172,
4604
+ L: 181,
4538
4605
  S: this,
4539
4606
  A: [
4540
4607
  "!this._open",
@@ -4543,14 +4610,14 @@ var ClientServicesHost = class {
4543
4610
  });
4544
4611
  import_log16.log.info("initializing...", void 0, {
4545
4612
  F: __dxlog_file17,
4546
- L: 173,
4613
+ L: 182,
4547
4614
  S: this,
4548
4615
  C: (f, a) => f(...a)
4549
4616
  });
4550
4617
  if (config) {
4551
4618
  (0, import_invariant14.invariant)(!this._config, "config already set", {
4552
4619
  F: __dxlog_file17,
4553
- L: 176,
4620
+ L: 185,
4554
4621
  S: this,
4555
4622
  A: [
4556
4623
  "!this._config",
@@ -4568,7 +4635,7 @@ var ClientServicesHost = class {
4568
4635
  this._signalManager = signalManager;
4569
4636
  (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4570
4637
  F: __dxlog_file17,
4571
- L: 192,
4638
+ L: 201,
4572
4639
  S: this,
4573
4640
  A: [
4574
4641
  "!this._networkManager",
@@ -4582,12 +4649,12 @@ var ClientServicesHost = class {
4582
4649
  });
4583
4650
  import_log16.log.info("initialized", void 0, {
4584
4651
  F: __dxlog_file17,
4585
- L: 199,
4652
+ L: 208,
4586
4653
  S: this,
4587
4654
  C: (f, a) => f(...a)
4588
4655
  });
4589
4656
  }
4590
- async open() {
4657
+ async open(ctx) {
4591
4658
  var _a, _b, _c;
4592
4659
  if (this._open) {
4593
4660
  return;
@@ -4597,13 +4664,13 @@ var ClientServicesHost = class {
4597
4664
  id: traceId
4598
4665
  }), {
4599
4666
  F: __dxlog_file17,
4600
- L: 209,
4667
+ L: 219,
4601
4668
  S: this,
4602
4669
  C: (f, a) => f(...a)
4603
4670
  });
4604
4671
  (0, import_invariant14.invariant)(this._config, "config not set", {
4605
4672
  F: __dxlog_file17,
4606
- L: 211,
4673
+ L: 221,
4607
4674
  S: this,
4608
4675
  A: [
4609
4676
  "this._config",
@@ -4612,7 +4679,7 @@ var ClientServicesHost = class {
4612
4679
  });
4613
4680
  (0, import_invariant14.invariant)(this._storage, "storage not set", {
4614
4681
  F: __dxlog_file17,
4615
- L: 212,
4682
+ L: 222,
4616
4683
  S: this,
4617
4684
  A: [
4618
4685
  "this._storage",
@@ -4621,7 +4688,7 @@ var ClientServicesHost = class {
4621
4688
  });
4622
4689
  (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4623
4690
  F: __dxlog_file17,
4624
- L: 213,
4691
+ L: 223,
4625
4692
  S: this,
4626
4693
  A: [
4627
4694
  "this._signalManager",
@@ -4630,7 +4697,7 @@ var ClientServicesHost = class {
4630
4697
  });
4631
4698
  (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4632
4699
  F: __dxlog_file17,
4633
- L: 214,
4700
+ L: 224,
4634
4701
  S: this,
4635
4702
  A: [
4636
4703
  "this._networkManager",
@@ -4642,7 +4709,7 @@ var ClientServicesHost = class {
4642
4709
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
4643
4710
  }, {
4644
4711
  F: __dxlog_file17,
4645
- L: 217,
4712
+ L: 227,
4646
4713
  S: this,
4647
4714
  C: (f, a) => f(...a)
4648
4715
  });
@@ -4661,6 +4728,7 @@ var ClientServicesHost = class {
4661
4728
  DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4662
4729
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4663
4730
  LoggingService: this._loggingService,
4731
+ TracingService: this._tracingService,
4664
4732
  // TODO(burdon): Move to new protobuf definitions.
4665
4733
  DevtoolsHost: new DevtoolsServiceImpl({
4666
4734
  events: new DevtoolsHostEvents(),
@@ -4668,7 +4736,7 @@ var ClientServicesHost = class {
4668
4736
  context: this._serviceContext
4669
4737
  })
4670
4738
  });
4671
- await this._serviceContext.open();
4739
+ await this._serviceContext.open(ctx);
4672
4740
  this._opening = false;
4673
4741
  this._open = true;
4674
4742
  this._statusUpdate.emit();
@@ -4677,7 +4745,7 @@ var ClientServicesHost = class {
4677
4745
  deviceKey
4678
4746
  }, {
4679
4747
  F: __dxlog_file17,
4680
- L: 269,
4748
+ L: 280,
4681
4749
  S: this,
4682
4750
  C: (f, a) => f(...a)
4683
4751
  });
@@ -4685,7 +4753,7 @@ var ClientServicesHost = class {
4685
4753
  id: traceId
4686
4754
  }), {
4687
4755
  F: __dxlog_file17,
4688
- L: 270,
4756
+ L: 281,
4689
4757
  S: this,
4690
4758
  C: (f, a) => f(...a)
4691
4759
  });
@@ -4700,7 +4768,7 @@ var ClientServicesHost = class {
4700
4768
  deviceKey
4701
4769
  }, {
4702
4770
  F: __dxlog_file17,
4703
- L: 280,
4771
+ L: 292,
4704
4772
  S: this,
4705
4773
  C: (f, a) => f(...a)
4706
4774
  });
@@ -4715,7 +4783,7 @@ var ClientServicesHost = class {
4715
4783
  deviceKey
4716
4784
  }, {
4717
4785
  F: __dxlog_file17,
4718
- L: 286,
4786
+ L: 298,
4719
4787
  S: this,
4720
4788
  C: (f, a) => f(...a)
4721
4789
  });
@@ -4727,13 +4795,13 @@ var ClientServicesHost = class {
4727
4795
  id: traceId
4728
4796
  }), {
4729
4797
  F: __dxlog_file17,
4730
- L: 291,
4798
+ L: 303,
4731
4799
  S: this,
4732
4800
  C: (f, a) => f(...a)
4733
4801
  });
4734
4802
  (0, import_log16.log)("resetting...", void 0, {
4735
4803
  F: __dxlog_file17,
4736
- L: 293,
4804
+ L: 305,
4737
4805
  S: this,
4738
4806
  C: (f, a) => f(...a)
4739
4807
  });
@@ -4741,7 +4809,7 @@ var ClientServicesHost = class {
4741
4809
  await this._storage.reset();
4742
4810
  (0, import_log16.log)("reset", void 0, {
4743
4811
  F: __dxlog_file17,
4744
- L: 296,
4812
+ L: 308,
4745
4813
  S: this,
4746
4814
  C: (f, a) => f(...a)
4747
4815
  });
@@ -4749,23 +4817,35 @@ var ClientServicesHost = class {
4749
4817
  id: traceId
4750
4818
  }), {
4751
4819
  F: __dxlog_file17,
4752
- L: 297,
4820
+ L: 309,
4753
4821
  S: this,
4754
4822
  C: (f, a) => f(...a)
4755
4823
  });
4756
4824
  await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
4757
4825
  }
4758
4826
  };
4759
- _ts_decorate4([
4760
- import_async17.synchronized
4827
+ _ts_decorate7([
4828
+ import_tracing4.trace.info()
4829
+ ], ClientServicesHost.prototype, "_opening", void 0);
4830
+ _ts_decorate7([
4831
+ import_tracing4.trace.info()
4832
+ ], ClientServicesHost.prototype, "_open", void 0);
4833
+ _ts_decorate7([
4834
+ import_async17.synchronized,
4835
+ import_tracing4.trace.span()
4761
4836
  ], ClientServicesHost.prototype, "open", null);
4762
- _ts_decorate4([
4763
- import_async17.synchronized
4837
+ _ts_decorate7([
4838
+ import_async17.synchronized,
4839
+ import_tracing4.trace.span()
4764
4840
  ], ClientServicesHost.prototype, "close", null);
4841
+ ClientServicesHost = _ts_decorate7([
4842
+ import_tracing4.trace.resource()
4843
+ ], ClientServicesHost);
4765
4844
 
4766
4845
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4767
4846
  var import_async19 = require("@dxos/async");
4768
4847
  var import_client_protocol7 = require("@dxos/client-protocol");
4848
+ var import_context11 = require("@dxos/context");
4769
4849
  var import_log17 = require("@dxos/log");
4770
4850
  var import_messaging2 = require("@dxos/messaging");
4771
4851
  var import_network_manager3 = require("@dxos/network-manager");
@@ -4840,7 +4920,7 @@ var ShellRuntimeImpl = class {
4840
4920
  };
4841
4921
 
4842
4922
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4843
- function _ts_decorate5(decorators, target, key, desc) {
4923
+ function _ts_decorate8(decorators, target, key, desc) {
4844
4924
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4845
4925
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4846
4926
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4873,7 +4953,7 @@ var IFrameHostRuntime = class {
4873
4953
  var _a;
4874
4954
  (0, import_log17.log)("starting...", void 0, {
4875
4955
  F: __dxlog_file19,
4876
- L: 70,
4956
+ L: 71,
4877
4957
  S: this,
4878
4958
  C: (f, a) => f(...a)
4879
4959
  });
@@ -4915,14 +4995,14 @@ var IFrameHostRuntime = class {
4915
4995
  ...middleware
4916
4996
  });
4917
4997
  await Promise.all([
4918
- this._clientServices.open(),
4998
+ this._clientServices.open(new import_context11.Context()),
4919
4999
  this._clientRpc.open(),
4920
5000
  (_a = this._shellRuntime) == null ? void 0 : _a.open()
4921
5001
  ]);
4922
5002
  this._ready.wake(void 0);
4923
5003
  (0, import_log17.log)("started", void 0, {
4924
5004
  F: __dxlog_file19,
4925
- L: 113,
5005
+ L: 114,
4926
5006
  S: this,
4927
5007
  C: (f, a) => f(...a)
4928
5008
  });
@@ -4930,7 +5010,7 @@ var IFrameHostRuntime = class {
4930
5010
  this._ready.wake(err);
4931
5011
  import_log17.log.catch(err, void 0, {
4932
5012
  F: __dxlog_file19,
4933
- L: 116,
5013
+ L: 117,
4934
5014
  S: this,
4935
5015
  C: (f, a) => f(...a)
4936
5016
  });
@@ -4940,7 +5020,7 @@ var IFrameHostRuntime = class {
4940
5020
  var _a;
4941
5021
  (0, import_log17.log)("stopping...", void 0, {
4942
5022
  F: __dxlog_file19,
4943
- L: 121,
5023
+ L: 122,
4944
5024
  S: this,
4945
5025
  C: (f, a) => f(...a)
4946
5026
  });
@@ -4949,13 +5029,13 @@ var IFrameHostRuntime = class {
4949
5029
  await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
4950
5030
  (0, import_log17.log)("stopped", void 0, {
4951
5031
  F: __dxlog_file19,
4952
- L: 125,
5032
+ L: 126,
4953
5033
  S: this,
4954
5034
  C: (f, a) => f(...a)
4955
5035
  });
4956
5036
  }
4957
5037
  };
4958
- _ts_decorate5([
5038
+ _ts_decorate8([
4959
5039
  import_log17.logInfo
4960
5040
  ], IFrameHostRuntime.prototype, "origin", void 0);
4961
5041
 
@@ -5039,6 +5119,7 @@ var IFrameProxyRuntime = class {
5039
5119
 
5040
5120
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
5041
5121
  var import_async22 = require("@dxos/async");
5122
+ var import_context12 = require("@dxos/context");
5042
5123
  var import_log20 = require("@dxos/log");
5043
5124
  var import_messaging3 = require("@dxos/messaging");
5044
5125
  var import_network_manager5 = require("@dxos/network-manager");
@@ -5050,7 +5131,7 @@ var import_invariant16 = require("@dxos/invariant");
5050
5131
  var import_log19 = require("@dxos/log");
5051
5132
  var import_rpc4 = require("@dxos/rpc");
5052
5133
  var import_util12 = require("@dxos/util");
5053
- function _ts_decorate6(decorators, target, key, desc) {
5134
+ function _ts_decorate9(decorators, target, key, desc) {
5054
5135
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5055
5136
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5056
5137
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5206,10 +5287,10 @@ var WorkerSession = class {
5206
5287
  }).then(callback);
5207
5288
  }
5208
5289
  };
5209
- _ts_decorate6([
5290
+ _ts_decorate9([
5210
5291
  import_log19.logInfo
5211
5292
  ], WorkerSession.prototype, "origin", void 0);
5212
- _ts_decorate6([
5293
+ _ts_decorate9([
5213
5294
  import_log19.logInfo
5214
5295
  ], WorkerSession.prototype, "lockKey", void 0);
5215
5296
 
@@ -5236,7 +5317,7 @@ var WorkerRuntime = class {
5236
5317
  async start() {
5237
5318
  (0, import_log20.log)("starting...", void 0, {
5238
5319
  F: __dxlog_file22,
5239
- L: 48,
5320
+ L: 49,
5240
5321
  S: this,
5241
5322
  C: (f, a) => f(...a)
5242
5323
  });
@@ -5248,11 +5329,11 @@ var WorkerRuntime = class {
5248
5329
  signalManager: signals ? new import_messaging3.WebsocketSignalManager(signals) : new import_messaging3.MemorySignalManager(new import_messaging3.MemorySignalManagerContext()),
5249
5330
  transportFactory: this._transportFactory
5250
5331
  });
5251
- await this._clientServices.open();
5332
+ await this._clientServices.open(new import_context12.Context());
5252
5333
  this._ready.wake(void 0);
5253
5334
  (0, import_log20.log)("started", void 0, {
5254
5335
  F: __dxlog_file22,
5255
- L: 62,
5336
+ L: 63,
5256
5337
  S: this,
5257
5338
  C: (f, a) => f(...a)
5258
5339
  });
@@ -5260,7 +5341,7 @@ var WorkerRuntime = class {
5260
5341
  this._ready.wake(err);
5261
5342
  import_log20.log.catch(err, void 0, {
5262
5343
  F: __dxlog_file22,
5263
- L: 65,
5344
+ L: 66,
5264
5345
  S: this,
5265
5346
  C: (f, a) => f(...a)
5266
5347
  });
@@ -5294,7 +5375,7 @@ var WorkerRuntime = class {
5294
5375
  _reconnectWebrtc() {
5295
5376
  (0, import_log20.log)("reconnecting webrtc...", void 0, {
5296
5377
  F: __dxlog_file22,
5297
- L: 102,
5378
+ L: 103,
5298
5379
  S: this,
5299
5380
  C: (f, a) => f(...a)
5300
5381
  });