@dxos/client-services 0.1.56-main.a25bb93 → 0.1.56-main.ad054df

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 (45) hide show
  1. package/dist/lib/browser/{chunk-MAHWP5I6.mjs → chunk-U5CCSPX6.mjs} +215 -140
  2. package/dist/lib/browser/chunk-U5CCSPX6.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 +210 -133
  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 +197 -122
  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/vault/iframe-host-runtime.d.ts.map +1 -1
  23. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/package.json +34 -33
  26. package/src/packlets/devices/devices-service.test.ts +2 -1
  27. package/src/packlets/identity/identity-manager.test.ts +4 -3
  28. package/src/packlets/identity/identity-manager.ts +9 -5
  29. package/src/packlets/identity/identity-service.test.ts +2 -1
  30. package/src/packlets/identity/identity.test.ts +7 -6
  31. package/src/packlets/identity/identity.ts +8 -3
  32. package/src/packlets/invitations/device-invitation-protocol.test.ts +2 -1
  33. package/src/packlets/network/network-service.test.ts +2 -1
  34. package/src/packlets/services/client-rpc-server.ts +4 -4
  35. package/src/packlets/services/service-context.ts +11 -6
  36. package/src/packlets/services/service-host.test.ts +6 -5
  37. package/src/packlets/services/service-host.ts +15 -3
  38. package/src/packlets/services/service-registry.test.ts +2 -1
  39. package/src/packlets/spaces/data-space.ts +1 -1
  40. package/src/packlets/spaces/spaces-service.test.ts +2 -1
  41. package/src/packlets/testing/test-builder.ts +1 -1
  42. package/src/packlets/vault/iframe-host-runtime.ts +2 -1
  43. package/src/packlets/vault/worker-runtime.ts +2 -1
  44. package/src/version.ts +1 -1
  45. package/dist/lib/browser/chunk-MAHWP5I6.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.a25bb93";
2495
+ var DXOS_VERSION = "0.1.56-main.ad054df";
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);
@@ -2934,7 +2974,7 @@ function _ts_decorate(decorators, target, key, desc) {
2934
2974
  var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2935
2975
  var DataSpace = class DataSpace2 {
2936
2976
  constructor(params) {
2937
- this._ctx = new import_context6.Context();
2977
+ this._ctx = new import_context7.Context();
2938
2978
  this._notarizationPlugin = new NotarizationPlugin();
2939
2979
  this._state = import_services7.SpaceState.CLOSED;
2940
2980
  /**
@@ -2992,7 +3032,7 @@ var DataSpace = class DataSpace2 {
2992
3032
  async _open() {
2993
3033
  await this._notarizationPlugin.open();
2994
3034
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2995
- await this._inner.open();
3035
+ await this._inner.open(new import_context7.Context());
2996
3036
  this._state = import_services7.SpaceState.CONTROL_ONLY;
2997
3037
  this.stateUpdate.emit();
2998
3038
  this.metrics = {};
@@ -3006,7 +3046,7 @@ var DataSpace = class DataSpace2 {
3006
3046
  await ((_b = (_a = this._callbacks).beforeClose) == null ? void 0 : _b.call(_a));
3007
3047
  this._state = import_services7.SpaceState.CLOSED;
3008
3048
  await this._ctx.dispose();
3009
- this._ctx = new import_context6.Context();
3049
+ this._ctx = new import_context7.Context();
3010
3050
  await this.authVerifier.close();
3011
3051
  await this._inner.close();
3012
3052
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
@@ -3079,7 +3119,7 @@ var DataSpace = class DataSpace2 {
3079
3119
  }
3080
3120
  await this._inner.initializeDataPipeline();
3081
3121
  this.metrics.dataPipelineOpen = new Date();
3082
- await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3122
+ await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3083
3123
  (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3084
3124
  F: __dxlog_file12,
3085
3125
  L: 242,
@@ -3191,22 +3231,22 @@ var DataSpace = class DataSpace2 {
3191
3231
  this.stateUpdate.emit();
3192
3232
  }
3193
3233
  };
3194
- _ts_decorate([
3234
+ _ts_decorate3([
3195
3235
  import_async11.synchronized
3196
3236
  ], DataSpace.prototype, "open", null);
3197
- _ts_decorate([
3237
+ _ts_decorate3([
3198
3238
  import_async11.synchronized
3199
3239
  ], DataSpace.prototype, "close", null);
3200
- _ts_decorate([
3240
+ _ts_decorate3([
3201
3241
  (0, import_debug4.timed)(1e4)
3202
3242
  ], DataSpace.prototype, "_createWritableFeeds", null);
3203
- _ts_decorate([
3243
+ _ts_decorate3([
3204
3244
  import_async11.synchronized
3205
3245
  ], DataSpace.prototype, "activate", null);
3206
- _ts_decorate([
3246
+ _ts_decorate3([
3207
3247
  import_async11.synchronized
3208
3248
  ], DataSpace.prototype, "deactivate", null);
3209
- DataSpace = _ts_decorate([
3249
+ DataSpace = _ts_decorate3([
3210
3250
  (0, import_async11.trackLeaks)("open", "close")
3211
3251
  ], DataSpace);
3212
3252
 
@@ -3281,7 +3321,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
3281
3321
  };
3282
3322
 
3283
3323
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
3284
- function _ts_decorate2(decorators, target, key, desc) {
3324
+ function _ts_decorate4(decorators, target, key, desc) {
3285
3325
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3286
3326
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3287
3327
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3300,7 +3340,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3300
3340
  this._keyring = _keyring;
3301
3341
  this._signingContext = _signingContext;
3302
3342
  this._feedStore = _feedStore;
3303
- this._ctx = new import_context7.Context();
3343
+ this._ctx = new import_context8.Context();
3304
3344
  this.updated = new import_async12.Event();
3305
3345
  this._spaces = new import_util5.ComplexMap(import_keys9.PublicKey.hash);
3306
3346
  this._isOpen = false;
@@ -3479,7 +3519,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3479
3519
  * TODO(dmaretskyi): Consider removing.
3480
3520
  */
3481
3521
  async waitUntilSpaceReady(spaceKey) {
3482
- await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3522
+ await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3483
3523
  const space = this._spaces.get(spaceKey);
3484
3524
  return !!space && space.state === import_services8.SpaceState.READY;
3485
3525
  }));
@@ -3596,19 +3636,19 @@ var DataSpaceManager = class DataSpaceManager2 {
3596
3636
  return dataSpace;
3597
3637
  }
3598
3638
  };
3599
- _ts_decorate2([
3639
+ _ts_decorate4([
3600
3640
  import_async12.synchronized
3601
3641
  ], DataSpaceManager.prototype, "open", null);
3602
- _ts_decorate2([
3642
+ _ts_decorate4([
3603
3643
  import_async12.synchronized
3604
3644
  ], DataSpaceManager.prototype, "close", null);
3605
- _ts_decorate2([
3645
+ _ts_decorate4([
3606
3646
  import_async12.synchronized
3607
3647
  ], DataSpaceManager.prototype, "createSpace", null);
3608
- _ts_decorate2([
3648
+ _ts_decorate4([
3609
3649
  import_async12.synchronized
3610
3650
  ], DataSpaceManager.prototype, "acceptSpace", null);
3611
- DataSpaceManager = _ts_decorate2([
3651
+ DataSpaceManager = _ts_decorate4([
3612
3652
  (0, import_async12.trackLeaks)("open", "close")
3613
3653
  ], DataSpaceManager);
3614
3654
 
@@ -3799,8 +3839,18 @@ var SpacesServiceImpl = class {
3799
3839
  var getChannelId = (channel) => `user-channel/${channel}`;
3800
3840
 
3801
3841
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3842
+ function _ts_decorate5(decorators, target, key, desc) {
3843
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3844
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3845
+ r = Reflect.decorate(decorators, target, key, desc);
3846
+ else
3847
+ for (var i = decorators.length - 1; i >= 0; i--)
3848
+ if (d = decorators[i])
3849
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3850
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3851
+ }
3802
3852
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3803
- var ServiceContext = class {
3853
+ var ServiceContext = class ServiceContext2 {
3804
3854
  // prettier-ignore
3805
3855
  constructor(storage, networkManager, signalManager, modelFactory) {
3806
3856
  this.storage = storage;
@@ -3839,11 +3889,11 @@ var ServiceContext = class {
3839
3889
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
3840
3890
  }, this._acceptIdentity.bind(this)));
3841
3891
  }
3842
- async open() {
3892
+ async open(ctx) {
3843
3893
  await this._checkStorageVersion();
3844
3894
  (0, import_log13.log)("opening...", void 0, {
3845
3895
  F: __dxlog_file15,
3846
- L: 127,
3896
+ L: 131,
3847
3897
  S: this,
3848
3898
  C: (f, a) => f(...a)
3849
3899
  });
@@ -3851,28 +3901,28 @@ var ServiceContext = class {
3851
3901
  id: this._instanceId
3852
3902
  }), {
3853
3903
  F: __dxlog_file15,
3854
- L: 128,
3904
+ L: 132,
3855
3905
  S: this,
3856
3906
  C: (f, a) => f(...a)
3857
3907
  });
3858
3908
  await this.signalManager.open();
3859
3909
  await this.networkManager.open();
3860
3910
  await this.spaceManager.open();
3861
- await this.identityManager.open();
3911
+ await this.identityManager.open(ctx);
3862
3912
  if (this.identityManager.identity) {
3863
- await this._initialize();
3913
+ await this._initialize(ctx);
3864
3914
  }
3865
3915
  import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
3866
3916
  id: this._instanceId
3867
3917
  }), {
3868
3918
  F: __dxlog_file15,
3869
- L: 136,
3919
+ L: 140,
3870
3920
  S: this,
3871
3921
  C: (f, a) => f(...a)
3872
3922
  });
3873
3923
  (0, import_log13.log)("opened", void 0, {
3874
3924
  F: __dxlog_file15,
3875
- L: 137,
3925
+ L: 141,
3876
3926
  S: this,
3877
3927
  C: (f, a) => f(...a)
3878
3928
  });
@@ -3881,7 +3931,7 @@ var ServiceContext = class {
3881
3931
  var _a;
3882
3932
  (0, import_log13.log)("closing...", void 0, {
3883
3933
  F: __dxlog_file15,
3884
- L: 141,
3934
+ L: 145,
3885
3935
  S: this,
3886
3936
  C: (f, a) => f(...a)
3887
3937
  });
@@ -3897,21 +3947,21 @@ var ServiceContext = class {
3897
3947
  this.dataServiceSubscriptions.clear();
3898
3948
  (0, import_log13.log)("closed", void 0, {
3899
3949
  F: __dxlog_file15,
3900
- L: 152,
3950
+ L: 156,
3901
3951
  S: this,
3902
3952
  C: (f, a) => f(...a)
3903
3953
  });
3904
3954
  }
3905
3955
  async createIdentity(params = {}) {
3906
3956
  const identity = await this.identityManager.createIdentity(params);
3907
- await this._initialize();
3957
+ await this._initialize(new import_context9.Context());
3908
3958
  return identity;
3909
3959
  }
3910
3960
  getInvitationHandler(invitation) {
3911
3961
  const factory = this._handlerFactories.get(invitation.kind);
3912
3962
  (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3913
3963
  F: __dxlog_file15,
3914
- L: 164,
3964
+ L: 168,
3915
3965
  S: this,
3916
3966
  A: [
3917
3967
  "factory",
@@ -3922,7 +3972,7 @@ var ServiceContext = class {
3922
3972
  }
3923
3973
  async _acceptIdentity(params) {
3924
3974
  const identity = await this.identityManager.acceptIdentity(params);
3925
- await this._initialize();
3975
+ await this._initialize(new import_context9.Context());
3926
3976
  return identity;
3927
3977
  }
3928
3978
  async _checkStorageVersion() {
@@ -3932,11 +3982,11 @@ var ServiceContext = class {
3932
3982
  }
3933
3983
  }
3934
3984
  // Called when identity is created.
3935
- async _initialize() {
3985
+ async _initialize(ctx) {
3936
3986
  var _a;
3937
3987
  (0, import_log13.log)("initializing spaces...", void 0, {
3938
3988
  F: __dxlog_file15,
3939
- L: 185,
3989
+ L: 190,
3940
3990
  S: this,
3941
3991
  C: (f, a) => f(...a)
3942
3992
  });
@@ -3959,7 +4009,7 @@ var ServiceContext = class {
3959
4009
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3960
4010
  (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3961
4011
  F: __dxlog_file15,
3962
- L: 208,
4012
+ L: 213,
3963
4013
  S: this,
3964
4014
  A: [
3965
4015
  "this.dataSpaceManager",
@@ -3983,7 +4033,7 @@ var ServiceContext = class {
3983
4033
  details: assertion
3984
4034
  }, {
3985
4035
  F: __dxlog_file15,
3986
- L: 224,
4036
+ L: 229,
3987
4037
  S: this,
3988
4038
  C: (f, a) => f(...a)
3989
4039
  });
@@ -3994,7 +4044,7 @@ var ServiceContext = class {
3994
4044
  details: assertion
3995
4045
  }, {
3996
4046
  F: __dxlog_file15,
3997
- L: 228,
4047
+ L: 233,
3998
4048
  S: this,
3999
4049
  C: (f, a) => f(...a)
4000
4050
  });
@@ -4005,7 +4055,7 @@ var ServiceContext = class {
4005
4055
  details: assertion
4006
4056
  }, {
4007
4057
  F: __dxlog_file15,
4008
- L: 233,
4058
+ L: 238,
4009
4059
  S: this,
4010
4060
  C: (f, a) => f(...a)
4011
4061
  });
@@ -4016,7 +4066,7 @@ var ServiceContext = class {
4016
4066
  } catch (err) {
4017
4067
  import_log13.log.catch(err, void 0, {
4018
4068
  F: __dxlog_file15,
4019
- L: 239,
4069
+ L: 244,
4020
4070
  S: this,
4021
4071
  C: (f, a) => f(...a)
4022
4072
  });
@@ -4026,10 +4076,20 @@ var ServiceContext = class {
4026
4076
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
4027
4077
  }
4028
4078
  };
4079
+ _ts_decorate5([
4080
+ import_tracing3.trace.span()
4081
+ ], ServiceContext.prototype, "open", null);
4082
+ _ts_decorate5([
4083
+ import_tracing3.trace.span()
4084
+ ], ServiceContext.prototype, "_initialize", null);
4085
+ ServiceContext = _ts_decorate5([
4086
+ import_tracing3.trace.resource()
4087
+ ], ServiceContext);
4029
4088
 
4030
4089
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4031
4090
  var import_async17 = require("@dxos/async");
4032
4091
  var import_client_protocol5 = require("@dxos/client-protocol");
4092
+ var import_context10 = require("@dxos/context");
4033
4093
  var import_document_model2 = require("@dxos/document-model");
4034
4094
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4035
4095
  var import_invariant14 = require("@dxos/invariant");
@@ -4041,6 +4101,7 @@ var import_network_manager2 = require("@dxos/network-manager");
4041
4101
  var import_protocols10 = require("@dxos/protocols");
4042
4102
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4043
4103
  var import_text_model = require("@dxos/text-model");
4104
+ var import_tracing4 = require("@dxos/tracing");
4044
4105
 
4045
4106
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4046
4107
  var import_async15 = require("@dxos/async");
@@ -4093,7 +4154,7 @@ var DevicesServiceImpl = class {
4093
4154
  var import_invariant13 = require("@dxos/invariant");
4094
4155
  var import_lock_file = require("@dxos/lock-file");
4095
4156
  var import_log14 = require("@dxos/log");
4096
- function _ts_decorate3(decorators, target, key, desc) {
4157
+ function _ts_decorate6(decorators, target, key, desc) {
4097
4158
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4098
4159
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4099
4160
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4145,7 +4206,7 @@ var Lock = class {
4145
4206
  await import_lock_file.LockFile.release(this._fileHandle);
4146
4207
  }
4147
4208
  };
4148
- _ts_decorate3([
4209
+ _ts_decorate6([
4149
4210
  import_log14.logInfo
4150
4211
  ], Lock.prototype, "lockKey", null);
4151
4212
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
@@ -4434,7 +4495,7 @@ var ServiceRegistry = class {
4434
4495
  };
4435
4496
 
4436
4497
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4437
- function _ts_decorate4(decorators, target, key, desc) {
4498
+ function _ts_decorate7(decorators, target, key, desc) {
4438
4499
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4439
4500
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4440
4501
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4448,7 +4509,7 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4448
4509
  var createDefaultModelFactory = () => {
4449
4510
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4450
4511
  };
4451
- var ClientServicesHost = class {
4512
+ var ClientServicesHost = class ClientServicesHost2 {
4452
4513
  constructor({
4453
4514
  config,
4454
4515
  modelFactory = createDefaultModelFactory(),
@@ -4459,6 +4520,7 @@ var ClientServicesHost = class {
4459
4520
  lockKey,
4460
4521
  callbacks
4461
4522
  } = {}) {
4523
+ this._tracingService = import_tracing4.TRACE_PROCESSOR.createTraceSender();
4462
4524
  this._statusUpdate = new import_async17.Event();
4463
4525
  this._opening = false;
4464
4526
  this._open = false;
@@ -4477,7 +4539,7 @@ var ClientServicesHost = class {
4477
4539
  lockKey,
4478
4540
  onAcquire: () => {
4479
4541
  if (!this._opening) {
4480
- void this.open();
4542
+ void this.open(new import_context10.Context());
4481
4543
  }
4482
4544
  },
4483
4545
  onRelease: () => this.close()
@@ -4504,7 +4566,8 @@ var ClientServicesHost = class {
4504
4566
  });
4505
4567
  this._loggingService = new LoggingServiceImpl();
4506
4568
  this._serviceRegistry = new ServiceRegistry(import_client_protocol5.clientServiceBundle, {
4507
- SystemService: this._systemService
4569
+ SystemService: this._systemService,
4570
+ TracingService: this._tracingService
4508
4571
  });
4509
4572
  }
4510
4573
  get isOpen() {
@@ -4534,7 +4597,7 @@ var ClientServicesHost = class {
4534
4597
  var _a, _b, _c;
4535
4598
  (0, import_invariant14.invariant)(!this._open, "service host is open", {
4536
4599
  F: __dxlog_file17,
4537
- L: 172,
4600
+ L: 181,
4538
4601
  S: this,
4539
4602
  A: [
4540
4603
  "!this._open",
@@ -4543,14 +4606,14 @@ var ClientServicesHost = class {
4543
4606
  });
4544
4607
  import_log16.log.info("initializing...", void 0, {
4545
4608
  F: __dxlog_file17,
4546
- L: 173,
4609
+ L: 182,
4547
4610
  S: this,
4548
4611
  C: (f, a) => f(...a)
4549
4612
  });
4550
4613
  if (config) {
4551
4614
  (0, import_invariant14.invariant)(!this._config, "config already set", {
4552
4615
  F: __dxlog_file17,
4553
- L: 176,
4616
+ L: 185,
4554
4617
  S: this,
4555
4618
  A: [
4556
4619
  "!this._config",
@@ -4568,7 +4631,7 @@ var ClientServicesHost = class {
4568
4631
  this._signalManager = signalManager;
4569
4632
  (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4570
4633
  F: __dxlog_file17,
4571
- L: 192,
4634
+ L: 201,
4572
4635
  S: this,
4573
4636
  A: [
4574
4637
  "!this._networkManager",
@@ -4582,12 +4645,12 @@ var ClientServicesHost = class {
4582
4645
  });
4583
4646
  import_log16.log.info("initialized", void 0, {
4584
4647
  F: __dxlog_file17,
4585
- L: 199,
4648
+ L: 208,
4586
4649
  S: this,
4587
4650
  C: (f, a) => f(...a)
4588
4651
  });
4589
4652
  }
4590
- async open() {
4653
+ async open(ctx) {
4591
4654
  var _a, _b, _c;
4592
4655
  if (this._open) {
4593
4656
  return;
@@ -4597,13 +4660,13 @@ var ClientServicesHost = class {
4597
4660
  id: traceId
4598
4661
  }), {
4599
4662
  F: __dxlog_file17,
4600
- L: 209,
4663
+ L: 219,
4601
4664
  S: this,
4602
4665
  C: (f, a) => f(...a)
4603
4666
  });
4604
4667
  (0, import_invariant14.invariant)(this._config, "config not set", {
4605
4668
  F: __dxlog_file17,
4606
- L: 211,
4669
+ L: 221,
4607
4670
  S: this,
4608
4671
  A: [
4609
4672
  "this._config",
@@ -4612,7 +4675,7 @@ var ClientServicesHost = class {
4612
4675
  });
4613
4676
  (0, import_invariant14.invariant)(this._storage, "storage not set", {
4614
4677
  F: __dxlog_file17,
4615
- L: 212,
4678
+ L: 222,
4616
4679
  S: this,
4617
4680
  A: [
4618
4681
  "this._storage",
@@ -4621,7 +4684,7 @@ var ClientServicesHost = class {
4621
4684
  });
4622
4685
  (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4623
4686
  F: __dxlog_file17,
4624
- L: 213,
4687
+ L: 223,
4625
4688
  S: this,
4626
4689
  A: [
4627
4690
  "this._signalManager",
@@ -4630,7 +4693,7 @@ var ClientServicesHost = class {
4630
4693
  });
4631
4694
  (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4632
4695
  F: __dxlog_file17,
4633
- L: 214,
4696
+ L: 224,
4634
4697
  S: this,
4635
4698
  A: [
4636
4699
  "this._networkManager",
@@ -4642,7 +4705,7 @@ var ClientServicesHost = class {
4642
4705
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
4643
4706
  }, {
4644
4707
  F: __dxlog_file17,
4645
- L: 217,
4708
+ L: 227,
4646
4709
  S: this,
4647
4710
  C: (f, a) => f(...a)
4648
4711
  });
@@ -4661,6 +4724,7 @@ var ClientServicesHost = class {
4661
4724
  DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
4662
4725
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
4663
4726
  LoggingService: this._loggingService,
4727
+ TracingService: this._tracingService,
4664
4728
  // TODO(burdon): Move to new protobuf definitions.
4665
4729
  DevtoolsHost: new DevtoolsServiceImpl({
4666
4730
  events: new DevtoolsHostEvents(),
@@ -4668,7 +4732,7 @@ var ClientServicesHost = class {
4668
4732
  context: this._serviceContext
4669
4733
  })
4670
4734
  });
4671
- await this._serviceContext.open();
4735
+ await this._serviceContext.open(ctx);
4672
4736
  this._opening = false;
4673
4737
  this._open = true;
4674
4738
  this._statusUpdate.emit();
@@ -4677,7 +4741,7 @@ var ClientServicesHost = class {
4677
4741
  deviceKey
4678
4742
  }, {
4679
4743
  F: __dxlog_file17,
4680
- L: 269,
4744
+ L: 280,
4681
4745
  S: this,
4682
4746
  C: (f, a) => f(...a)
4683
4747
  });
@@ -4685,7 +4749,7 @@ var ClientServicesHost = class {
4685
4749
  id: traceId
4686
4750
  }), {
4687
4751
  F: __dxlog_file17,
4688
- L: 270,
4752
+ L: 281,
4689
4753
  S: this,
4690
4754
  C: (f, a) => f(...a)
4691
4755
  });
@@ -4700,7 +4764,7 @@ var ClientServicesHost = class {
4700
4764
  deviceKey
4701
4765
  }, {
4702
4766
  F: __dxlog_file17,
4703
- L: 280,
4767
+ L: 292,
4704
4768
  S: this,
4705
4769
  C: (f, a) => f(...a)
4706
4770
  });
@@ -4715,7 +4779,7 @@ var ClientServicesHost = class {
4715
4779
  deviceKey
4716
4780
  }, {
4717
4781
  F: __dxlog_file17,
4718
- L: 286,
4782
+ L: 298,
4719
4783
  S: this,
4720
4784
  C: (f, a) => f(...a)
4721
4785
  });
@@ -4727,13 +4791,13 @@ var ClientServicesHost = class {
4727
4791
  id: traceId
4728
4792
  }), {
4729
4793
  F: __dxlog_file17,
4730
- L: 291,
4794
+ L: 303,
4731
4795
  S: this,
4732
4796
  C: (f, a) => f(...a)
4733
4797
  });
4734
4798
  (0, import_log16.log)("resetting...", void 0, {
4735
4799
  F: __dxlog_file17,
4736
- L: 293,
4800
+ L: 305,
4737
4801
  S: this,
4738
4802
  C: (f, a) => f(...a)
4739
4803
  });
@@ -4741,7 +4805,7 @@ var ClientServicesHost = class {
4741
4805
  await this._storage.reset();
4742
4806
  (0, import_log16.log)("reset", void 0, {
4743
4807
  F: __dxlog_file17,
4744
- L: 296,
4808
+ L: 308,
4745
4809
  S: this,
4746
4810
  C: (f, a) => f(...a)
4747
4811
  });
@@ -4749,23 +4813,35 @@ var ClientServicesHost = class {
4749
4813
  id: traceId
4750
4814
  }), {
4751
4815
  F: __dxlog_file17,
4752
- L: 297,
4816
+ L: 309,
4753
4817
  S: this,
4754
4818
  C: (f, a) => f(...a)
4755
4819
  });
4756
4820
  await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
4757
4821
  }
4758
4822
  };
4759
- _ts_decorate4([
4760
- import_async17.synchronized
4823
+ _ts_decorate7([
4824
+ import_tracing4.trace.info()
4825
+ ], ClientServicesHost.prototype, "_opening", void 0);
4826
+ _ts_decorate7([
4827
+ import_tracing4.trace.info()
4828
+ ], ClientServicesHost.prototype, "_open", void 0);
4829
+ _ts_decorate7([
4830
+ import_async17.synchronized,
4831
+ import_tracing4.trace.span()
4761
4832
  ], ClientServicesHost.prototype, "open", null);
4762
- _ts_decorate4([
4763
- import_async17.synchronized
4833
+ _ts_decorate7([
4834
+ import_async17.synchronized,
4835
+ import_tracing4.trace.span()
4764
4836
  ], ClientServicesHost.prototype, "close", null);
4837
+ ClientServicesHost = _ts_decorate7([
4838
+ import_tracing4.trace.resource()
4839
+ ], ClientServicesHost);
4765
4840
 
4766
4841
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4767
4842
  var import_async19 = require("@dxos/async");
4768
4843
  var import_client_protocol7 = require("@dxos/client-protocol");
4844
+ var import_context11 = require("@dxos/context");
4769
4845
  var import_log17 = require("@dxos/log");
4770
4846
  var import_messaging2 = require("@dxos/messaging");
4771
4847
  var import_network_manager3 = require("@dxos/network-manager");
@@ -4840,7 +4916,7 @@ var ShellRuntimeImpl = class {
4840
4916
  };
4841
4917
 
4842
4918
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4843
- function _ts_decorate5(decorators, target, key, desc) {
4919
+ function _ts_decorate8(decorators, target, key, desc) {
4844
4920
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4845
4921
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4846
4922
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4873,7 +4949,7 @@ var IFrameHostRuntime = class {
4873
4949
  var _a;
4874
4950
  (0, import_log17.log)("starting...", void 0, {
4875
4951
  F: __dxlog_file19,
4876
- L: 70,
4952
+ L: 71,
4877
4953
  S: this,
4878
4954
  C: (f, a) => f(...a)
4879
4955
  });
@@ -4915,14 +4991,14 @@ var IFrameHostRuntime = class {
4915
4991
  ...middleware
4916
4992
  });
4917
4993
  await Promise.all([
4918
- this._clientServices.open(),
4994
+ this._clientServices.open(new import_context11.Context()),
4919
4995
  this._clientRpc.open(),
4920
4996
  (_a = this._shellRuntime) == null ? void 0 : _a.open()
4921
4997
  ]);
4922
4998
  this._ready.wake(void 0);
4923
4999
  (0, import_log17.log)("started", void 0, {
4924
5000
  F: __dxlog_file19,
4925
- L: 113,
5001
+ L: 114,
4926
5002
  S: this,
4927
5003
  C: (f, a) => f(...a)
4928
5004
  });
@@ -4930,7 +5006,7 @@ var IFrameHostRuntime = class {
4930
5006
  this._ready.wake(err);
4931
5007
  import_log17.log.catch(err, void 0, {
4932
5008
  F: __dxlog_file19,
4933
- L: 116,
5009
+ L: 117,
4934
5010
  S: this,
4935
5011
  C: (f, a) => f(...a)
4936
5012
  });
@@ -4940,7 +5016,7 @@ var IFrameHostRuntime = class {
4940
5016
  var _a;
4941
5017
  (0, import_log17.log)("stopping...", void 0, {
4942
5018
  F: __dxlog_file19,
4943
- L: 121,
5019
+ L: 122,
4944
5020
  S: this,
4945
5021
  C: (f, a) => f(...a)
4946
5022
  });
@@ -4949,13 +5025,13 @@ var IFrameHostRuntime = class {
4949
5025
  await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
4950
5026
  (0, import_log17.log)("stopped", void 0, {
4951
5027
  F: __dxlog_file19,
4952
- L: 125,
5028
+ L: 126,
4953
5029
  S: this,
4954
5030
  C: (f, a) => f(...a)
4955
5031
  });
4956
5032
  }
4957
5033
  };
4958
- _ts_decorate5([
5034
+ _ts_decorate8([
4959
5035
  import_log17.logInfo
4960
5036
  ], IFrameHostRuntime.prototype, "origin", void 0);
4961
5037
 
@@ -5039,6 +5115,7 @@ var IFrameProxyRuntime = class {
5039
5115
 
5040
5116
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
5041
5117
  var import_async22 = require("@dxos/async");
5118
+ var import_context12 = require("@dxos/context");
5042
5119
  var import_log20 = require("@dxos/log");
5043
5120
  var import_messaging3 = require("@dxos/messaging");
5044
5121
  var import_network_manager5 = require("@dxos/network-manager");
@@ -5050,7 +5127,7 @@ var import_invariant16 = require("@dxos/invariant");
5050
5127
  var import_log19 = require("@dxos/log");
5051
5128
  var import_rpc4 = require("@dxos/rpc");
5052
5129
  var import_util12 = require("@dxos/util");
5053
- function _ts_decorate6(decorators, target, key, desc) {
5130
+ function _ts_decorate9(decorators, target, key, desc) {
5054
5131
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5055
5132
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5056
5133
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5206,10 +5283,10 @@ var WorkerSession = class {
5206
5283
  }).then(callback);
5207
5284
  }
5208
5285
  };
5209
- _ts_decorate6([
5286
+ _ts_decorate9([
5210
5287
  import_log19.logInfo
5211
5288
  ], WorkerSession.prototype, "origin", void 0);
5212
- _ts_decorate6([
5289
+ _ts_decorate9([
5213
5290
  import_log19.logInfo
5214
5291
  ], WorkerSession.prototype, "lockKey", void 0);
5215
5292
 
@@ -5236,7 +5313,7 @@ var WorkerRuntime = class {
5236
5313
  async start() {
5237
5314
  (0, import_log20.log)("starting...", void 0, {
5238
5315
  F: __dxlog_file22,
5239
- L: 48,
5316
+ L: 49,
5240
5317
  S: this,
5241
5318
  C: (f, a) => f(...a)
5242
5319
  });
@@ -5248,11 +5325,11 @@ var WorkerRuntime = class {
5248
5325
  signalManager: signals ? new import_messaging3.WebsocketSignalManager(signals) : new import_messaging3.MemorySignalManager(new import_messaging3.MemorySignalManagerContext()),
5249
5326
  transportFactory: this._transportFactory
5250
5327
  });
5251
- await this._clientServices.open();
5328
+ await this._clientServices.open(new import_context12.Context());
5252
5329
  this._ready.wake(void 0);
5253
5330
  (0, import_log20.log)("started", void 0, {
5254
5331
  F: __dxlog_file22,
5255
- L: 62,
5332
+ L: 63,
5256
5333
  S: this,
5257
5334
  C: (f, a) => f(...a)
5258
5335
  });
@@ -5260,7 +5337,7 @@ var WorkerRuntime = class {
5260
5337
  this._ready.wake(err);
5261
5338
  import_log20.log.catch(err, void 0, {
5262
5339
  F: __dxlog_file22,
5263
- L: 65,
5340
+ L: 66,
5264
5341
  S: this,
5265
5342
  C: (f, a) => f(...a)
5266
5343
  });
@@ -5294,7 +5371,7 @@ var WorkerRuntime = class {
5294
5371
  _reconnectWebrtc() {
5295
5372
  (0, import_log20.log)("reconnecting webrtc...", void 0, {
5296
5373
  F: __dxlog_file22,
5297
- L: 102,
5374
+ L: 103,
5298
5375
  S: this,
5299
5376
  C: (f, a) => f(...a)
5300
5377
  });