@dxos/client-services 0.1.56-main.83e9b8a → 0.1.56-main.a25bb93

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 (71) hide show
  1. package/dist/lib/browser/{chunk-P26UKXYR.mjs → chunk-MAHWP5I6.mjs} +970 -383
  2. package/dist/lib/browser/chunk-MAHWP5I6.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +50 -31
  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 +12 -3
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +1113 -510
  9. package/dist/lib/node/index.cjs.map +4 -4
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +1260 -667
  12. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  16. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  19. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  20. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  21. package/dist/types/src/packlets/logging/logging-service.d.ts +6 -2
  22. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/diagnostics.d.ts +46 -0
  24. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -0
  25. package/dist/types/src/packlets/services/index.d.ts +1 -0
  26. package/dist/types/src/packlets/services/index.d.ts.map +1 -1
  27. package/dist/types/src/packlets/services/platform.d.ts +16 -0
  28. package/dist/types/src/packlets/services/platform.d.ts.map +1 -0
  29. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  30. package/dist/types/src/packlets/services/service-host.d.ts +4 -2
  31. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  32. package/dist/types/src/packlets/services/util.d.ts +6 -0
  33. package/dist/types/src/packlets/services/util.d.ts.map +1 -0
  34. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  35. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  36. package/dist/types/src/packlets/system/system-service.d.ts +12 -2
  37. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  38. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  39. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  40. package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
  41. package/dist/types/src/version.d.ts +2 -0
  42. package/dist/types/src/version.d.ts.map +1 -0
  43. package/package.json +33 -33
  44. package/src/packlets/identity/authenticator.test.ts +2 -2
  45. package/src/packlets/identity/identity-manager.ts +1 -2
  46. package/src/packlets/identity/identity-service.ts +1 -2
  47. package/src/packlets/identity/identity.ts +1 -2
  48. package/src/packlets/invitations/device-invitation-protocol.ts +1 -2
  49. package/src/packlets/invitations/invitation-extension.ts +1 -2
  50. package/src/packlets/invitations/invitations-handler.ts +1 -2
  51. package/src/packlets/invitations/invitations-service.ts +1 -2
  52. package/src/packlets/invitations/space-invitation-protocol.ts +1 -2
  53. package/src/packlets/locks/node.ts +1 -1
  54. package/src/packlets/logging/logging-service.ts +17 -9
  55. package/src/packlets/services/diagnostics.ts +211 -0
  56. package/src/packlets/services/index.ts +1 -0
  57. package/src/packlets/services/platform.ts +48 -0
  58. package/src/packlets/services/service-context.ts +3 -5
  59. package/src/packlets/services/service-host.test.ts +5 -5
  60. package/src/packlets/services/service-host.ts +23 -20
  61. package/src/packlets/services/service-registry.test.ts +1 -0
  62. package/src/packlets/services/util.ts +33 -0
  63. package/src/packlets/spaces/data-space-manager.ts +1 -2
  64. package/src/packlets/spaces/notarization-plugin.ts +1 -2
  65. package/src/packlets/system/system-service.test.ts +1 -0
  66. package/src/packlets/system/system-service.ts +34 -2
  67. package/src/packlets/testing/invitation-utils.ts +1 -2
  68. package/src/packlets/vault/shell-runtime.ts +1 -2
  69. package/src/packlets/vault/worker-session.ts +7 -3
  70. package/src/version.ts +1 -0
  71. package/dist/lib/browser/chunk-P26UKXYR.mjs.map +0 -7
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // packages/sdk/client-services/src/index.ts
@@ -55,6 +45,7 @@ __export(src_exports, {
55
45
  WorkerSession: () => WorkerSession,
56
46
  createAuthProvider: () => createAuthProvider,
57
47
  createDefaultModelFactory: () => createDefaultModelFactory,
48
+ createDiagnostics: () => createDiagnostics,
58
49
  createStorageObjects: () => createStorageObjects,
59
50
  getNetworkPeers: () => getNetworkPeers,
60
51
  isLocked: () => isLocked,
@@ -531,12 +522,12 @@ var TrustedKeySetAuthVerifier = class {
531
522
  };
532
523
 
533
524
  // packages/sdk/client-services/src/packlets/identity/identity.ts
534
- var import_tiny_invariant = __toESM(require("tiny-invariant"));
535
525
  var import_async5 = require("@dxos/async");
536
526
  var import_client_protocol = require("@dxos/client-protocol");
537
527
  var import_credentials2 = require("@dxos/credentials");
538
528
  var import_debug = require("@dxos/debug");
539
529
  var import_feed_store2 = require("@dxos/feed-store");
530
+ var import_invariant = require("@dxos/invariant");
540
531
  var import_log2 = require("@dxos/log");
541
532
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
542
533
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
@@ -614,7 +605,15 @@ var Identity = class {
614
605
  * Requires identity to be ready.
615
606
  */
616
607
  getIdentityCredentialSigner() {
617
- (0, import_tiny_invariant.default)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.");
608
+ (0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
609
+ F: __dxlog_file2,
610
+ L: 134,
611
+ S: this,
612
+ A: [
613
+ "this._deviceStateMachine.deviceCredentialChain",
614
+ "'Device credential chain is not ready.'"
615
+ ]
616
+ });
618
617
  return (0, import_credentials2.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.deviceCredentialChain, this.deviceKey);
619
618
  }
620
619
  /**
@@ -632,7 +631,7 @@ var Identity = class {
632
631
  dataFeedKey
633
632
  }, {
634
633
  F: __dxlog_file2,
635
- L: 151,
634
+ L: 150,
636
635
  S: this,
637
636
  C: (f, a) => f(...a)
638
637
  });
@@ -675,9 +674,9 @@ var Identity = class {
675
674
  };
676
675
 
677
676
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
678
- var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
679
677
  var import_async6 = require("@dxos/async");
680
678
  var import_credentials4 = require("@dxos/credentials");
679
+ var import_invariant2 = require("@dxos/invariant");
681
680
  var import_keys4 = require("@dxos/keys");
682
681
  var import_log3 = require("@dxos/log");
683
682
  var import_protocols2 = require("@dxos/protocols");
@@ -704,7 +703,7 @@ var IdentityManager = class {
704
703
  id: traceId
705
704
  }), {
706
705
  F: __dxlog_file3,
707
- L: 70,
706
+ L: 69,
708
707
  S: this,
709
708
  C: (f, a) => f(...a)
710
709
  });
@@ -714,7 +713,7 @@ var IdentityManager = class {
714
713
  identityRecord
715
714
  }, {
716
715
  F: __dxlog_file3,
717
- L: 74,
716
+ L: 73,
718
717
  S: this,
719
718
  C: (f, a) => f(...a)
720
719
  });
@@ -727,7 +726,7 @@ var IdentityManager = class {
727
726
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
728
727
  }, {
729
728
  F: __dxlog_file3,
730
- L: 79,
729
+ L: 78,
731
730
  S: this,
732
731
  C: (f, a) => f(...a)
733
732
  });
@@ -737,7 +736,7 @@ var IdentityManager = class {
737
736
  id: traceId
738
737
  }), {
739
738
  F: __dxlog_file3,
740
- L: 85,
739
+ L: 84,
741
740
  S: this,
742
741
  C: (f, a) => f(...a)
743
742
  });
@@ -748,10 +747,18 @@ var IdentityManager = class {
748
747
  }
749
748
  async createIdentity({ displayName } = {}) {
750
749
  var _a;
751
- (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
750
+ (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
751
+ F: __dxlog_file3,
752
+ L: 92,
753
+ S: this,
754
+ A: [
755
+ "!this._identity",
756
+ "'Identity already exists.'"
757
+ ]
758
+ });
752
759
  (0, import_log3.log)("creating identity...", void 0, {
753
760
  F: __dxlog_file3,
754
- L: 94,
761
+ L: 93,
755
762
  S: this,
756
763
  C: (f, a) => f(...a)
757
764
  });
@@ -770,8 +777,24 @@ var IdentityManager = class {
770
777
  await identity.open();
771
778
  {
772
779
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
773
- (0, import_tiny_invariant2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
774
- (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
780
+ (0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
781
+ F: __dxlog_file3,
782
+ L: 112,
783
+ S: this,
784
+ A: [
785
+ "identityRecord.haloSpace.genesisFeedKey",
786
+ "'Genesis feed key is required.'"
787
+ ]
788
+ });
789
+ (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
790
+ F: __dxlog_file3,
791
+ L: 113,
792
+ S: this,
793
+ A: [
794
+ "identityRecord.haloSpace.dataFeedKey",
795
+ "'Data feed key is required.'"
796
+ ]
797
+ });
775
798
  const credentials = [
776
799
  // Space genesis.
777
800
  ...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
@@ -800,7 +823,7 @@ var IdentityManager = class {
800
823
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
801
824
  }, {
802
825
  F: __dxlog_file3,
803
- L: 149,
826
+ L: 148,
804
827
  S: this,
805
828
  C: (f, a) => f(...a)
806
829
  });
@@ -810,7 +833,7 @@ var IdentityManager = class {
810
833
  deviceKey: identity.deviceKey
811
834
  }, {
812
835
  F: __dxlog_file3,
813
- L: 155,
836
+ L: 154,
814
837
  S: this,
815
838
  C: (f, a) => f(...a)
816
839
  });
@@ -825,11 +848,19 @@ var IdentityManager = class {
825
848
  params
826
849
  }, {
827
850
  F: __dxlog_file3,
828
- L: 163,
851
+ L: 162,
829
852
  S: this,
830
853
  C: (f, a) => f(...a)
831
854
  });
832
- (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
855
+ (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
856
+ F: __dxlog_file3,
857
+ L: 163,
858
+ S: this,
859
+ A: [
860
+ "!this._identity",
861
+ "'Identity already exists.'"
862
+ ]
863
+ });
833
864
  const identityRecord = {
834
865
  identityKey: params.identityKey,
835
866
  deviceKey: params.deviceKey,
@@ -851,7 +882,7 @@ var IdentityManager = class {
851
882
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
852
883
  }, {
853
884
  F: __dxlog_file3,
854
- L: 183,
885
+ L: 182,
855
886
  S: this,
856
887
  C: (f, a) => f(...a)
857
888
  });
@@ -861,27 +892,51 @@ var IdentityManager = class {
861
892
  deviceKey: identity.deviceKey
862
893
  }, {
863
894
  F: __dxlog_file3,
864
- L: 189,
895
+ L: 188,
865
896
  S: this,
866
897
  C: (f, a) => f(...a)
867
898
  });
868
899
  return identity;
869
900
  }
870
901
  async _constructIdentity(identityRecord) {
871
- (0, import_tiny_invariant2.default)(!this._identity);
902
+ (0, import_invariant2.invariant)(!this._identity, void 0, {
903
+ F: __dxlog_file3,
904
+ L: 193,
905
+ S: this,
906
+ A: [
907
+ "!this._identity",
908
+ ""
909
+ ]
910
+ });
872
911
  (0, import_log3.log)("constructing identity", {
873
912
  identityRecord
874
913
  }, {
875
914
  F: __dxlog_file3,
876
- L: 195,
915
+ L: 194,
877
916
  S: this,
878
917
  C: (f, a) => f(...a)
879
918
  });
880
- (0, import_tiny_invariant2.default)(identityRecord.haloSpace.controlFeedKey);
919
+ (0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
920
+ F: __dxlog_file3,
921
+ L: 197,
922
+ S: this,
923
+ A: [
924
+ "identityRecord.haloSpace.controlFeedKey",
925
+ ""
926
+ ]
927
+ });
881
928
  const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
882
929
  writable: true
883
930
  });
884
- (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey);
931
+ (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
932
+ F: __dxlog_file3,
933
+ L: 201,
934
+ S: this,
935
+ A: [
936
+ "identityRecord.haloSpace.dataFeedKey",
937
+ ""
938
+ ]
939
+ });
885
940
  const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
886
941
  writable: true,
887
942
  sparse: true
@@ -907,7 +962,7 @@ var IdentityManager = class {
907
962
  identityKey: identityRecord.identityKey
908
963
  }, {
909
964
  F: __dxlog_file3,
910
- L: 226,
965
+ L: 225,
911
966
  S: this,
912
967
  C: (f, a) => f(...a)
913
968
  });
@@ -928,7 +983,7 @@ var IdentityManager = class {
928
983
  onAuthFailure: () => {
929
984
  import_log3.log.warn("auth failure", void 0, {
930
985
  F: __dxlog_file3,
931
- L: 245,
986
+ L: 244,
932
987
  S: this,
933
988
  C: (f, a) => f(...a)
934
989
  });
@@ -939,10 +994,11 @@ var IdentityManager = class {
939
994
  };
940
995
 
941
996
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
942
- var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
943
997
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
944
998
  var import_credentials6 = require("@dxos/credentials");
945
999
  var import_debug2 = require("@dxos/debug");
1000
+ var import_invariant3 = require("@dxos/invariant");
1001
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
946
1002
  var IdentityServiceImpl = class {
947
1003
  // TODO(wittjosiah): Remove dependency on service context.
948
1004
  constructor(_serviceContext) {
@@ -975,7 +1031,15 @@ var IdentityServiceImpl = class {
975
1031
  };
976
1032
  }
977
1033
  async signPresentation({ presentation, nonce }) {
978
- (0, import_tiny_invariant3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
1034
+ (0, import_invariant3.invariant)(this._serviceContext.identityManager.identity, "Identity not initialized.", {
1035
+ F: __dxlog_file4,
1036
+ L: 56,
1037
+ S: this,
1038
+ A: [
1039
+ "this._serviceContext.identityManager.identity",
1040
+ "'Identity not initialized.'"
1041
+ ]
1042
+ });
979
1043
  return await (0, import_credentials6.signPresentation)({
980
1044
  presentation,
981
1045
  signer: this._serviceContext.keyring,
@@ -987,8 +1051,9 @@ var IdentityServiceImpl = class {
987
1051
  };
988
1052
 
989
1053
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
990
- var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
1054
+ var import_invariant4 = require("@dxos/invariant");
991
1055
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
1056
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
992
1057
  var DeviceInvitationProtocol = class {
993
1058
  constructor(_keyring, _getIdentity, _acceptIdentity) {
994
1059
  this._keyring = _keyring;
@@ -1004,7 +1069,15 @@ var DeviceInvitationProtocol = class {
1004
1069
  };
1005
1070
  }
1006
1071
  async admit(request) {
1007
- (0, import_tiny_invariant4.default)(request.device);
1072
+ (0, import_invariant4.invariant)(request.device, void 0, {
1073
+ F: __dxlog_file5,
1074
+ L: 31,
1075
+ S: this,
1076
+ A: [
1077
+ "request.device",
1078
+ ""
1079
+ ]
1080
+ });
1008
1081
  const identity = this._getIdentity();
1009
1082
  await identity.admitDevice(request.device);
1010
1083
  return {
@@ -1032,9 +1105,25 @@ var DeviceInvitationProtocol = class {
1032
1105
  };
1033
1106
  }
1034
1107
  async accept(response, request) {
1035
- (0, import_tiny_invariant4.default)(response.device);
1108
+ (0, import_invariant4.invariant)(response.device, void 0, {
1109
+ F: __dxlog_file5,
1110
+ L: 64,
1111
+ S: this,
1112
+ A: [
1113
+ "response.device",
1114
+ ""
1115
+ ]
1116
+ });
1036
1117
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1037
- (0, import_tiny_invariant4.default)(request.device);
1118
+ (0, import_invariant4.invariant)(request.device, void 0, {
1119
+ F: __dxlog_file5,
1120
+ L: 67,
1121
+ S: this,
1122
+ A: [
1123
+ "request.device",
1124
+ ""
1125
+ ]
1126
+ });
1038
1127
  const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
1039
1128
  await this._acceptIdentity({
1040
1129
  identityKey,
@@ -1052,12 +1141,12 @@ var DeviceInvitationProtocol = class {
1052
1141
  };
1053
1142
 
1054
1143
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1055
- var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
1056
1144
  var import_async8 = require("@dxos/async");
1057
1145
  var import_client_protocol2 = require("@dxos/client-protocol");
1058
1146
  var import_context4 = require("@dxos/context");
1059
1147
  var import_credentials7 = require("@dxos/credentials");
1060
1148
  var import_errors2 = require("@dxos/errors");
1149
+ var import_invariant6 = require("@dxos/invariant");
1061
1150
  var import_keys6 = require("@dxos/keys");
1062
1151
  var import_log5 = require("@dxos/log");
1063
1152
  var import_network_manager = require("@dxos/network-manager");
@@ -1066,17 +1155,17 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
1066
1155
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
1067
1156
 
1068
1157
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1069
- var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
1070
1158
  var import_async7 = require("@dxos/async");
1071
1159
  var import_context3 = require("@dxos/context");
1072
1160
  var import_errors = require("@dxos/errors");
1161
+ var import_invariant5 = require("@dxos/invariant");
1073
1162
  var import_keys5 = require("@dxos/keys");
1074
1163
  var import_log4 = require("@dxos/log");
1075
1164
  var import_protocols3 = require("@dxos/protocols");
1076
1165
  var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
1077
1166
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
1078
1167
  var import_teleport = require("@dxos/teleport");
1079
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1168
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1080
1169
  var OPTIONS_TIMEOUT = 1e4;
1081
1170
  var MAX_OTP_ATTEMPTS = 3;
1082
1171
  var InvitationHostExtension = class extends import_teleport.RpcExtension {
@@ -1104,7 +1193,15 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1104
1193
  // Perhaps in the future we will have more complex logic here.
1105
1194
  InvitationHostService: {
1106
1195
  options: async (options) => {
1107
- (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
1196
+ (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1197
+ F: __dxlog_file6,
1198
+ L: 88,
1199
+ S: this,
1200
+ A: [
1201
+ "!this._remoteOptions",
1202
+ "'Remote options already set.'"
1203
+ ]
1204
+ });
1108
1205
  this._remoteOptions = options;
1109
1206
  this._remoteOptionsTrigger.wake();
1110
1207
  },
@@ -1114,8 +1211,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1114
1211
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
1115
1212
  id: traceId
1116
1213
  }), {
1117
- F: __dxlog_file4,
1118
- L: 98,
1214
+ F: __dxlog_file6,
1215
+ L: 97,
1119
1216
  S: this,
1120
1217
  C: (f, a) => f(...a)
1121
1218
  });
@@ -1124,8 +1221,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1124
1221
  import_log4.log.warn("invitation not found", {
1125
1222
  invitationId
1126
1223
  }, {
1127
- F: __dxlog_file4,
1128
- L: 102,
1224
+ F: __dxlog_file6,
1225
+ L: 101,
1129
1226
  S: this,
1130
1227
  C: (f, a) => f(...a)
1131
1228
  });
@@ -1138,8 +1235,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1138
1235
  (0, import_log4.log)("guest introduced itself", {
1139
1236
  guestProfile: profile
1140
1237
  }, {
1141
- F: __dxlog_file4,
1142
- L: 111,
1238
+ F: __dxlog_file6,
1239
+ L: 110,
1143
1240
  S: this,
1144
1241
  C: (f, a) => f(...a)
1145
1242
  });
@@ -1151,8 +1248,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1151
1248
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
1152
1249
  id: traceId
1153
1250
  }), {
1154
- F: __dxlog_file4,
1155
- L: 118,
1251
+ F: __dxlog_file6,
1252
+ L: 117,
1156
1253
  S: this,
1157
1254
  C: (f, a) => f(...a)
1158
1255
  });
@@ -1166,26 +1263,34 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1166
1263
  import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
1167
1264
  id: traceId
1168
1265
  }), {
1169
- F: __dxlog_file4,
1170
- L: 127,
1266
+ F: __dxlog_file6,
1267
+ L: 126,
1171
1268
  S: this,
1172
1269
  C: (f, a) => f(...a)
1173
1270
  });
1174
1271
  (0, import_log4.log)("received authentication request", {
1175
1272
  authCode: code
1176
1273
  }, {
1177
- F: __dxlog_file4,
1178
- L: 128,
1274
+ F: __dxlog_file6,
1275
+ L: 127,
1179
1276
  S: this,
1180
1277
  C: (f, a) => f(...a)
1181
1278
  });
1182
1279
  let status = import_invitations.AuthenticationResponse.Status.OK;
1183
- (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
1280
+ (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1281
+ F: __dxlog_file6,
1282
+ L: 130,
1283
+ S: this,
1284
+ A: [
1285
+ "this.invitation",
1286
+ "'Invitation is not set.'"
1287
+ ]
1288
+ });
1184
1289
  switch (this.invitation.authMethod) {
1185
1290
  case import_services2.Invitation.AuthMethod.NONE: {
1186
1291
  (0, import_log4.log)("authentication not required", void 0, {
1187
- F: __dxlog_file4,
1188
- L: 134,
1292
+ F: __dxlog_file6,
1293
+ L: 133,
1189
1294
  S: this,
1190
1295
  C: (f, a) => f(...a)
1191
1296
  });
@@ -1209,8 +1314,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1209
1314
  import_log4.log.error("invalid authentication method", {
1210
1315
  authMethod: this.invitation.authMethod
1211
1316
  }, {
1212
- F: __dxlog_file4,
1213
- L: 152,
1317
+ F: __dxlog_file6,
1318
+ L: 151,
1214
1319
  S: this,
1215
1320
  C: (f, a) => f(...a)
1216
1321
  });
@@ -1224,8 +1329,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1224
1329
  status
1225
1330
  }
1226
1331
  }), {
1227
- F: __dxlog_file4,
1228
- L: 158,
1332
+ F: __dxlog_file6,
1333
+ L: 157,
1229
1334
  S: this,
1230
1335
  C: (f, a) => f(...a)
1231
1336
  });
@@ -1238,13 +1343,21 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1238
1343
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
1239
1344
  id: traceId
1240
1345
  }), {
1241
- F: __dxlog_file4,
1242
- L: 164,
1346
+ F: __dxlog_file6,
1347
+ L: 163,
1243
1348
  S: this,
1244
1349
  C: (f, a) => f(...a)
1245
1350
  });
1246
1351
  try {
1247
- (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
1352
+ (0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
1353
+ F: __dxlog_file6,
1354
+ L: 166,
1355
+ S: this,
1356
+ A: [
1357
+ "this.invitation",
1358
+ "'Invitation is not set.'"
1359
+ ]
1360
+ });
1248
1361
  if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
1249
1362
  throw new Error("Not authenticated");
1250
1363
  }
@@ -1252,8 +1365,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1252
1365
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
1253
1366
  id: traceId
1254
1367
  }), {
1255
- F: __dxlog_file4,
1256
- L: 175,
1368
+ F: __dxlog_file6,
1369
+ L: 174,
1257
1370
  S: this,
1258
1371
  C: (f, a) => f(...a)
1259
1372
  });
@@ -1309,7 +1422,15 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1309
1422
  return {
1310
1423
  InvitationHostService: {
1311
1424
  options: async (options) => {
1312
- (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
1425
+ (0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
1426
+ F: __dxlog_file6,
1427
+ L: 241,
1428
+ S: this,
1429
+ A: [
1430
+ "!this._remoteOptions",
1431
+ "'Remote options already set.'"
1432
+ ]
1433
+ });
1313
1434
  this._remoteOptions = options;
1314
1435
  this._remoteOptionsTrigger.wake();
1315
1436
  },
@@ -1330,8 +1451,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1330
1451
  await super.onOpen(context);
1331
1452
  try {
1332
1453
  (0, import_log4.log)("begin options", void 0, {
1333
- F: __dxlog_file4,
1334
- L: 263,
1454
+ F: __dxlog_file6,
1455
+ L: 262,
1335
1456
  S: this,
1336
1457
  C: (f, a) => f(...a)
1337
1458
  });
@@ -1342,8 +1463,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1342
1463
  timeout: OPTIONS_TIMEOUT
1343
1464
  }));
1344
1465
  (0, import_log4.log)("end options", void 0, {
1345
- F: __dxlog_file4,
1346
- L: 266,
1466
+ F: __dxlog_file6,
1467
+ L: 265,
1347
1468
  S: this,
1348
1469
  C: (f, a) => f(...a)
1349
1470
  });
@@ -1356,8 +1477,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1356
1477
  this._callbacks.onOpen(this._ctx);
1357
1478
  } catch (err) {
1358
1479
  (0, import_log4.log)("openError", err, {
1359
- F: __dxlog_file4,
1360
- L: 276,
1480
+ F: __dxlog_file6,
1481
+ L: 275,
1361
1482
  S: this,
1362
1483
  C: (f, a) => f(...a)
1363
1484
  });
@@ -1366,8 +1487,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1366
1487
  }
1367
1488
  async onClose() {
1368
1489
  (0, import_log4.log)("onClose", void 0, {
1369
- F: __dxlog_file4,
1370
- L: 282,
1490
+ F: __dxlog_file6,
1491
+ L: 281,
1371
1492
  S: this,
1372
1493
  C: (f, a) => f(...a)
1373
1494
  });
@@ -1377,7 +1498,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1377
1498
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
1378
1499
 
1379
1500
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1380
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1501
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1381
1502
  var InvitationsHandler = class {
1382
1503
  /**
1383
1504
  * @internal
@@ -1389,7 +1510,15 @@ var InvitationsHandler = class {
1389
1510
  var _a;
1390
1511
  const { invitationId = import_keys6.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys6.PublicKey.random() } = options != null ? options : {};
1391
1512
  const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0;
1392
- (0, import_tiny_invariant6.default)(protocol);
1513
+ (0, import_invariant6.invariant)(protocol, void 0, {
1514
+ F: __dxlog_file7,
1515
+ L: 76,
1516
+ S: this,
1517
+ A: [
1518
+ "protocol",
1519
+ ""
1520
+ ]
1521
+ });
1393
1522
  const invitation = {
1394
1523
  invitationId,
1395
1524
  type,
@@ -1411,8 +1540,8 @@ var InvitationsHandler = class {
1411
1540
  (0, import_log5.log)("complete", {
1412
1541
  ...protocol.toJSON()
1413
1542
  }, {
1414
- F: __dxlog_file5,
1415
- L: 99,
1543
+ F: __dxlog_file7,
1544
+ L: 98,
1416
1545
  S: this,
1417
1546
  C: (f, a) => f(...a)
1418
1547
  });
@@ -1436,7 +1565,15 @@ var InvitationsHandler = class {
1436
1565
  var _a2, _b, _c;
1437
1566
  try {
1438
1567
  const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
1439
- (0, import_tiny_invariant6.default)(deviceKey);
1568
+ (0, import_invariant6.invariant)(deviceKey, void 0, {
1569
+ F: __dxlog_file7,
1570
+ L: 119,
1571
+ S: this,
1572
+ A: [
1573
+ "deviceKey",
1574
+ ""
1575
+ ]
1576
+ });
1440
1577
  const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
1441
1578
  extension.completedTrigger.wake(deviceKey);
1442
1579
  return admissionResponse;
@@ -1452,16 +1589,16 @@ var InvitationsHandler = class {
1452
1589
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
1453
1590
  id: traceId
1454
1591
  }), {
1455
- F: __dxlog_file5,
1456
- L: 138,
1592
+ F: __dxlog_file7,
1593
+ L: 137,
1457
1594
  S: this,
1458
1595
  C: (f, a) => f(...a)
1459
1596
  });
1460
1597
  (0, import_log5.log)("connected", {
1461
1598
  ...protocol.toJSON()
1462
1599
  }, {
1463
- F: __dxlog_file5,
1464
- L: 139,
1600
+ F: __dxlog_file7,
1601
+ L: 138,
1465
1602
  S: this,
1466
1603
  C: (f, a) => f(...a)
1467
1604
  });
@@ -1476,8 +1613,8 @@ var InvitationsHandler = class {
1476
1613
  guest: deviceKey,
1477
1614
  ...protocol.toJSON()
1478
1615
  }, {
1479
- F: __dxlog_file5,
1480
- L: 142,
1616
+ F: __dxlog_file7,
1617
+ L: 141,
1481
1618
  S: this,
1482
1619
  C: (f, a) => f(...a)
1483
1620
  });
@@ -1488,8 +1625,8 @@ var InvitationsHandler = class {
1488
1625
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
1489
1626
  id: traceId
1490
1627
  }), {
1491
- F: __dxlog_file5,
1492
- L: 144,
1628
+ F: __dxlog_file7,
1629
+ L: 143,
1493
1630
  S: this,
1494
1631
  C: (f, a) => f(...a)
1495
1632
  });
@@ -1498,8 +1635,8 @@ var InvitationsHandler = class {
1498
1635
  (0, import_log5.log)("timeout", {
1499
1636
  ...protocol.toJSON()
1500
1637
  }, {
1501
- F: __dxlog_file5,
1502
- L: 147,
1638
+ F: __dxlog_file7,
1639
+ L: 146,
1503
1640
  S: this,
1504
1641
  C: (f, a) => f(...a)
1505
1642
  });
@@ -1509,8 +1646,8 @@ var InvitationsHandler = class {
1509
1646
  });
1510
1647
  } else {
1511
1648
  import_log5.log.error("failed", err, {
1512
- F: __dxlog_file5,
1513
- L: 150,
1649
+ F: __dxlog_file7,
1650
+ L: 149,
1514
1651
  S: this,
1515
1652
  C: (f, a) => f(...a)
1516
1653
  });
@@ -1520,8 +1657,8 @@ var InvitationsHandler = class {
1520
1657
  id: traceId,
1521
1658
  error: err
1522
1659
  }), {
1523
- F: __dxlog_file5,
1524
- L: 153,
1660
+ F: __dxlog_file7,
1661
+ L: 152,
1525
1662
  S: this,
1526
1663
  C: (f, a) => f(...a)
1527
1664
  });
@@ -1541,8 +1678,8 @@ var InvitationsHandler = class {
1541
1678
  (0, import_log5.log)("timeout", {
1542
1679
  ...protocol.toJSON()
1543
1680
  }, {
1544
- F: __dxlog_file5,
1545
- L: 168,
1681
+ F: __dxlog_file7,
1682
+ L: 167,
1546
1683
  S: this,
1547
1684
  C: (f, a) => f(...a)
1548
1685
  });
@@ -1552,8 +1689,8 @@ var InvitationsHandler = class {
1552
1689
  });
1553
1690
  } else {
1554
1691
  import_log5.log.error("failed", err, {
1555
- F: __dxlog_file5,
1556
- L: 171,
1692
+ F: __dxlog_file7,
1693
+ L: 170,
1557
1694
  S: this,
1558
1695
  C: (f, a) => f(...a)
1559
1696
  });
@@ -1595,13 +1732,29 @@ var InvitationsHandler = class {
1595
1732
  }
1596
1733
  acceptInvitation(protocol, invitation) {
1597
1734
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1598
- (0, import_tiny_invariant6.default)(protocol);
1735
+ (0, import_invariant6.invariant)(protocol, void 0, {
1736
+ F: __dxlog_file7,
1737
+ L: 210,
1738
+ S: this,
1739
+ A: [
1740
+ "protocol",
1741
+ ""
1742
+ ]
1743
+ });
1599
1744
  const authenticated = new import_async8.Trigger();
1600
1745
  let admitted = false;
1601
1746
  let currentState;
1602
1747
  const stream = new import_async8.PushStream();
1603
1748
  const setState = (newData) => {
1604
- (0, import_tiny_invariant6.default)(newData.state !== void 0);
1749
+ (0, import_invariant6.invariant)(newData.state !== void 0, void 0, {
1750
+ F: __dxlog_file7,
1751
+ L: 221,
1752
+ S: this,
1753
+ A: [
1754
+ "newData.state !== undefined",
1755
+ ""
1756
+ ]
1757
+ });
1605
1758
  currentState = newData.state;
1606
1759
  stream.next({
1607
1760
  ...invitation,
@@ -1614,8 +1767,8 @@ var InvitationsHandler = class {
1614
1767
  (0, import_log5.log)("timeout", {
1615
1768
  ...protocol.toJSON()
1616
1769
  }, {
1617
- F: __dxlog_file5,
1618
- L: 230,
1770
+ F: __dxlog_file7,
1771
+ L: 229,
1619
1772
  S: this,
1620
1773
  C: (f, a) => f(...a)
1621
1774
  });
@@ -1624,8 +1777,8 @@ var InvitationsHandler = class {
1624
1777
  });
1625
1778
  } else {
1626
1779
  import_log5.log.warn("auth failed", err, {
1627
- F: __dxlog_file5,
1628
- L: 233,
1780
+ F: __dxlog_file7,
1781
+ L: 232,
1629
1782
  S: this,
1630
1783
  C: (f, a) => f(...a)
1631
1784
  });
@@ -1638,8 +1791,8 @@ var InvitationsHandler = class {
1638
1791
  (0, import_log5.log)("complete", {
1639
1792
  ...protocol.toJSON()
1640
1793
  }, {
1641
- F: __dxlog_file5,
1642
- L: 241,
1794
+ F: __dxlog_file7,
1795
+ L: 240,
1643
1796
  S: this,
1644
1797
  C: (f, a) => f(...a)
1645
1798
  });
@@ -1653,8 +1806,8 @@ var InvitationsHandler = class {
1653
1806
  (0, import_log5.log)("extension disposed", {
1654
1807
  currentState
1655
1808
  }, {
1656
- F: __dxlog_file5,
1657
- L: 251,
1809
+ F: __dxlog_file7,
1810
+ L: 250,
1658
1811
  S: this,
1659
1812
  C: (f, a) => f(...a)
1660
1813
  });
@@ -1668,8 +1821,8 @@ var InvitationsHandler = class {
1668
1821
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
1669
1822
  id: traceId
1670
1823
  }), {
1671
- F: __dxlog_file5,
1672
- L: 260,
1824
+ F: __dxlog_file7,
1825
+ L: 259,
1673
1826
  S: this,
1674
1827
  C: (f, a) => f(...a)
1675
1828
  });
@@ -1680,8 +1833,8 @@ var InvitationsHandler = class {
1680
1833
  (0, import_log5.log)("connected", {
1681
1834
  ...protocol.toJSON()
1682
1835
  }, {
1683
- F: __dxlog_file5,
1684
- L: 268,
1836
+ F: __dxlog_file7,
1837
+ L: 267,
1685
1838
  S: this,
1686
1839
  C: (f, a) => f(...a)
1687
1840
  });
@@ -1691,8 +1844,8 @@ var InvitationsHandler = class {
1691
1844
  (0, import_log5.log)("introduce", {
1692
1845
  ...protocol.toJSON()
1693
1846
  }, {
1694
- F: __dxlog_file5,
1695
- L: 272,
1847
+ F: __dxlog_file7,
1848
+ L: 271,
1696
1849
  S: this,
1697
1850
  C: (f, a) => f(...a)
1698
1851
  });
@@ -1701,8 +1854,8 @@ var InvitationsHandler = class {
1701
1854
  ...protocol.toJSON(),
1702
1855
  response: introductionResponse
1703
1856
  }, {
1704
- F: __dxlog_file5,
1705
- L: 276,
1857
+ F: __dxlog_file7,
1858
+ L: 275,
1706
1859
  S: this,
1707
1860
  C: (f, a) => f(...a)
1708
1861
  });
@@ -1713,8 +1866,8 @@ var InvitationsHandler = class {
1713
1866
  if (isAuthenticationRequired(invitation)) {
1714
1867
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1715
1868
  (0, import_log5.log)("guest waiting for authentication code...", void 0, {
1716
- F: __dxlog_file5,
1717
- L: 285,
1869
+ F: __dxlog_file7,
1870
+ L: 284,
1718
1871
  S: this,
1719
1872
  C: (f, a) => f(...a)
1720
1873
  });
@@ -1725,8 +1878,8 @@ var InvitationsHandler = class {
1725
1878
  timeout
1726
1879
  });
1727
1880
  (0, import_log5.log)("sending authentication request", void 0, {
1728
- F: __dxlog_file5,
1729
- L: 289,
1881
+ F: __dxlog_file7,
1882
+ L: 288,
1730
1883
  S: this,
1731
1884
  C: (f, a) => f(...a)
1732
1885
  });
@@ -1746,8 +1899,8 @@ var InvitationsHandler = class {
1746
1899
  (0, import_log5.log)("retrying invalid code", {
1747
1900
  attempt
1748
1901
  }, {
1749
- F: __dxlog_file5,
1750
- L: 300,
1902
+ F: __dxlog_file7,
1903
+ L: 299,
1751
1904
  S: this,
1752
1905
  C: (f, a) => f(...a)
1753
1906
  });
@@ -1763,8 +1916,8 @@ var InvitationsHandler = class {
1763
1916
  (0, import_log5.log)("request admission", {
1764
1917
  ...protocol.toJSON()
1765
1918
  }, {
1766
- F: __dxlog_file5,
1767
- L: 311,
1919
+ F: __dxlog_file7,
1920
+ L: 310,
1768
1921
  S: this,
1769
1922
  C: (f, a) => f(...a)
1770
1923
  });
@@ -1775,8 +1928,8 @@ var InvitationsHandler = class {
1775
1928
  (0, import_log5.log)("admitted by host", {
1776
1929
  ...protocol.toJSON()
1777
1930
  }, {
1778
- F: __dxlog_file5,
1779
- L: 322,
1931
+ F: __dxlog_file7,
1932
+ L: 321,
1780
1933
  S: this,
1781
1934
  C: (f, a) => f(...a)
1782
1935
  });
@@ -1787,8 +1940,8 @@ var InvitationsHandler = class {
1787
1940
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
1788
1941
  id: traceId
1789
1942
  }), {
1790
- F: __dxlog_file5,
1791
- L: 324,
1943
+ F: __dxlog_file7,
1944
+ L: 323,
1792
1945
  S: this,
1793
1946
  C: (f, a) => f(...a)
1794
1947
  });
@@ -1797,8 +1950,8 @@ var InvitationsHandler = class {
1797
1950
  (0, import_log5.log)("timeout", {
1798
1951
  ...protocol.toJSON()
1799
1952
  }, {
1800
- F: __dxlog_file5,
1801
- L: 327,
1953
+ F: __dxlog_file7,
1954
+ L: 326,
1802
1955
  S: this,
1803
1956
  C: (f, a) => f(...a)
1804
1957
  });
@@ -1807,8 +1960,8 @@ var InvitationsHandler = class {
1807
1960
  });
1808
1961
  } else {
1809
1962
  (0, import_log5.log)("auth failed", err, {
1810
- F: __dxlog_file5,
1811
- L: 330,
1963
+ F: __dxlog_file7,
1964
+ L: 329,
1812
1965
  S: this,
1813
1966
  C: (f, a) => f(...a)
1814
1967
  });
@@ -1818,8 +1971,8 @@ var InvitationsHandler = class {
1818
1971
  id: traceId,
1819
1972
  error: err
1820
1973
  }), {
1821
- F: __dxlog_file5,
1822
- L: 333,
1974
+ F: __dxlog_file7,
1975
+ L: 332,
1823
1976
  S: this,
1824
1977
  C: (f, a) => f(...a)
1825
1978
  });
@@ -1836,8 +1989,8 @@ var InvitationsHandler = class {
1836
1989
  (0, import_log5.log)("timeout", {
1837
1990
  ...protocol.toJSON()
1838
1991
  }, {
1839
- F: __dxlog_file5,
1840
- L: 344,
1992
+ F: __dxlog_file7,
1993
+ L: 343,
1841
1994
  S: this,
1842
1995
  C: (f, a) => f(...a)
1843
1996
  });
@@ -1846,8 +1999,8 @@ var InvitationsHandler = class {
1846
1999
  });
1847
2000
  } else {
1848
2001
  (0, import_log5.log)("auth failed", err, {
1849
- F: __dxlog_file5,
1850
- L: 347,
2002
+ F: __dxlog_file7,
2003
+ L: 346,
1851
2004
  S: this,
1852
2005
  C: (f, a) => f(...a)
1853
2006
  });
@@ -1858,7 +2011,15 @@ var InvitationsHandler = class {
1858
2011
  return extension;
1859
2012
  };
1860
2013
  (0, import_async8.scheduleTask)(ctx, async () => {
1861
- (0, import_tiny_invariant6.default)(invitation.swarmKey);
2014
+ (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2015
+ F: __dxlog_file7,
2016
+ L: 356,
2017
+ S: this,
2018
+ A: [
2019
+ "invitation.swarmKey",
2020
+ ""
2021
+ ]
2022
+ });
1862
2023
  const topic = invitation.swarmKey;
1863
2024
  const swarmConnection = await this._networkManager.joinSwarm({
1864
2025
  topic,
@@ -1891,12 +2052,12 @@ var InvitationsHandler = class {
1891
2052
  };
1892
2053
 
1893
2054
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
1894
- var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1895
2055
  var import_async9 = require("@dxos/async");
1896
2056
  var import_codec_protobuf8 = require("@dxos/codec-protobuf");
2057
+ var import_invariant7 = require("@dxos/invariant");
1897
2058
  var import_log6 = require("@dxos/log");
1898
2059
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
1899
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
2060
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1900
2061
  var InvitationsServiceImpl = class {
1901
2062
  constructor(_invitationsHandler, _getHandler) {
1902
2063
  this._invitationsHandler = _invitationsHandler;
@@ -1958,19 +2119,27 @@ var InvitationsServiceImpl = class {
1958
2119
  }
1959
2120
  async authenticate({ invitationId, authCode }) {
1960
2121
  (0, import_log6.log)("authenticating...", void 0, {
1961
- F: __dxlog_file6,
1962
- L: 103,
2122
+ F: __dxlog_file8,
2123
+ L: 102,
1963
2124
  S: this,
1964
2125
  C: (f, a) => f(...a)
1965
2126
  });
1966
- (0, import_tiny_invariant7.default)(invitationId);
2127
+ (0, import_invariant7.invariant)(invitationId, void 0, {
2128
+ F: __dxlog_file8,
2129
+ L: 103,
2130
+ S: this,
2131
+ A: [
2132
+ "invitationId",
2133
+ ""
2134
+ ]
2135
+ });
1967
2136
  const observable = this._acceptInvitations.get(invitationId);
1968
2137
  if (!observable) {
1969
2138
  import_log6.log.warn("invalid invitation", {
1970
2139
  invitationId
1971
2140
  }, {
1972
- F: __dxlog_file6,
1973
- L: 107,
2141
+ F: __dxlog_file8,
2142
+ L: 106,
1974
2143
  S: this,
1975
2144
  C: (f, a) => f(...a)
1976
2145
  });
@@ -1980,12 +2149,20 @@ var InvitationsServiceImpl = class {
1980
2149
  }
1981
2150
  async cancelInvitation({ invitationId }) {
1982
2151
  (0, import_log6.log)("deleting...", void 0, {
1983
- F: __dxlog_file6,
1984
- L: 114,
2152
+ F: __dxlog_file8,
2153
+ L: 113,
1985
2154
  S: this,
1986
2155
  C: (f, a) => f(...a)
1987
2156
  });
1988
- (0, import_tiny_invariant7.default)(invitationId);
2157
+ (0, import_invariant7.invariant)(invitationId, void 0, {
2158
+ F: __dxlog_file8,
2159
+ L: 114,
2160
+ S: this,
2161
+ A: [
2162
+ "invitationId",
2163
+ ""
2164
+ ]
2165
+ });
1989
2166
  const created = this._createInvitations.get(invitationId);
1990
2167
  const accepted = this._acceptInvitations.get(invitationId);
1991
2168
  if (created) {
@@ -2000,8 +2177,8 @@ var InvitationsServiceImpl = class {
2000
2177
  import_log6.log.warn("invalid invitation", {
2001
2178
  invitationId
2002
2179
  }, {
2003
- F: __dxlog_file6,
2004
- L: 127,
2180
+ F: __dxlog_file8,
2181
+ L: 126,
2005
2182
  S: this,
2006
2183
  C: (f, a) => f(...a)
2007
2184
  });
@@ -2060,12 +2237,12 @@ var InvitationsServiceImpl = class {
2060
2237
  };
2061
2238
 
2062
2239
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
2063
- var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
2064
2240
  var import_credentials8 = require("@dxos/credentials");
2065
2241
  var import_feed_store3 = require("@dxos/feed-store");
2242
+ var import_invariant8 = require("@dxos/invariant");
2066
2243
  var import_log7 = require("@dxos/log");
2067
2244
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
2068
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2245
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2069
2246
  var SpaceInvitationProtocol = class {
2070
2247
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
2071
2248
  this._spaceManager = _spaceManager;
@@ -2087,24 +2264,64 @@ var SpaceInvitationProtocol = class {
2087
2264
  }
2088
2265
  async admit(request, guestProfile) {
2089
2266
  var _a;
2090
- (0, import_tiny_invariant8.default)(this._spaceKey);
2267
+ (0, import_invariant8.invariant)(this._spaceKey, void 0, {
2268
+ F: __dxlog_file9,
2269
+ L: 42,
2270
+ S: this,
2271
+ A: [
2272
+ "this._spaceKey",
2273
+ ""
2274
+ ]
2275
+ });
2091
2276
  const space = await this._spaceManager.spaces.get(this._spaceKey);
2092
- (0, import_tiny_invariant8.default)(space);
2093
- (0, import_tiny_invariant8.default)(request.space);
2277
+ (0, import_invariant8.invariant)(space, void 0, {
2278
+ F: __dxlog_file9,
2279
+ L: 44,
2280
+ S: this,
2281
+ A: [
2282
+ "space",
2283
+ ""
2284
+ ]
2285
+ });
2286
+ (0, import_invariant8.invariant)(request.space, void 0, {
2287
+ F: __dxlog_file9,
2288
+ L: 46,
2289
+ S: this,
2290
+ A: [
2291
+ "request.space",
2292
+ ""
2293
+ ]
2294
+ });
2094
2295
  const { identityKey, deviceKey } = request.space;
2095
2296
  (0, import_log7.log)("writing guest credentials", {
2096
2297
  host: this._signingContext.deviceKey,
2097
2298
  guest: deviceKey
2098
2299
  }, {
2099
- F: __dxlog_file7,
2100
- L: 50,
2300
+ F: __dxlog_file9,
2301
+ L: 49,
2101
2302
  S: this,
2102
2303
  C: (f, a) => f(...a)
2103
2304
  });
2104
2305
  const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
2105
- (0, import_tiny_invariant8.default)(credentials[0].credential);
2306
+ (0, import_invariant8.invariant)(credentials[0].credential, void 0, {
2307
+ F: __dxlog_file9,
2308
+ L: 60,
2309
+ S: this,
2310
+ A: [
2311
+ "credentials[0].credential",
2312
+ ""
2313
+ ]
2314
+ });
2106
2315
  const spaceMemberCredential = credentials[0].credential.credential;
2107
- (0, import_tiny_invariant8.default)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2316
+ (0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2317
+ F: __dxlog_file9,
2318
+ L: 62,
2319
+ S: this,
2320
+ A: [
2321
+ "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
2322
+ ""
2323
+ ]
2324
+ });
2108
2325
  await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
2109
2326
  return {
2110
2327
  space: {
@@ -2132,11 +2349,35 @@ var SpaceInvitationProtocol = class {
2132
2349
  };
2133
2350
  }
2134
2351
  async accept(response) {
2135
- (0, import_tiny_invariant8.default)(response.space);
2352
+ (0, import_invariant8.invariant)(response.space, void 0, {
2353
+ F: __dxlog_file9,
2354
+ L: 97,
2355
+ S: this,
2356
+ A: [
2357
+ "response.space",
2358
+ ""
2359
+ ]
2360
+ });
2136
2361
  const { credential, controlTimeframe, dataTimeframe } = response.space;
2137
2362
  const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
2138
- (0, import_tiny_invariant8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
2139
- (0, import_tiny_invariant8.default)(credential.subject.id.equals(this._signingContext.identityKey));
2363
+ (0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
2364
+ F: __dxlog_file9,
2365
+ L: 100,
2366
+ S: this,
2367
+ A: [
2368
+ "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
2369
+ "'Invalid credential'"
2370
+ ]
2371
+ });
2372
+ (0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
2373
+ F: __dxlog_file9,
2374
+ L: 101,
2375
+ S: this,
2376
+ A: [
2377
+ "credential.subject.id.equals(this._signingContext.identityKey)",
2378
+ ""
2379
+ ]
2380
+ });
2140
2381
  await this._spaceManager.acceptSpace({
2141
2382
  spaceKey: assertion.spaceKey,
2142
2383
  genesisFeedKey: assertion.genesisFeedKey,
@@ -2203,29 +2444,195 @@ var ClientRpcServer = class {
2203
2444
  }
2204
2445
  };
2205
2446
 
2447
+ // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2448
+ var import_codec_protobuf10 = require("@dxos/codec-protobuf");
2449
+ var import_credentials9 = require("@dxos/credentials");
2450
+ var import_document_model = require("@dxos/document-model");
2451
+ var import_invariant9 = require("@dxos/invariant");
2452
+ var import_log8 = require("@dxos/log");
2453
+ var import_protocols5 = require("@dxos/protocols");
2454
+ var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2455
+
2456
+ // packages/sdk/client-services/src/version.ts
2457
+ var DXOS_VERSION = "0.1.56-main.a25bb93";
2458
+
2459
+ // packages/sdk/client-services/src/packlets/services/platform.ts
2460
+ var getPlatform = () => {
2461
+ if (process.browser) {
2462
+ if (typeof window !== "undefined") {
2463
+ const { userAgent } = window.navigator;
2464
+ return {
2465
+ type: "browser",
2466
+ userAgent,
2467
+ uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
2468
+ };
2469
+ } else {
2470
+ return {
2471
+ type: "shared-worker",
2472
+ uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
2473
+ };
2474
+ }
2475
+ } else {
2476
+ const { platform, version, arch } = process;
2477
+ return {
2478
+ type: "node",
2479
+ platform: `${platform} ${version} ${arch}`,
2480
+ runtime: process.version,
2481
+ uptime: Math.floor(process.uptime()),
2482
+ memory: process.memoryUsage()
2483
+ };
2484
+ }
2485
+ };
2486
+
2487
+ // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2488
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2489
+ var DEFAULT_TIMEOUT = 1e3;
2490
+ var createDiagnostics = async (clientServices, serviceContext, config) => {
2491
+ var _a, _b, _c;
2492
+ const diagnostics = {
2493
+ created: new Date().toISOString(),
2494
+ platform: getPlatform(),
2495
+ client: {
2496
+ version: DXOS_VERSION,
2497
+ storage: {
2498
+ version: import_protocols5.STORAGE_VERSION
2499
+ }
2500
+ }
2501
+ };
2502
+ {
2503
+ (0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
2504
+ F: __dxlog_file10,
2505
+ L: 87,
2506
+ S: void 0,
2507
+ A: [
2508
+ "clientServices.LoggingService",
2509
+ "'SystemService is not available.'"
2510
+ ]
2511
+ });
2512
+ diagnostics.metrics = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
2513
+ timeout: DEFAULT_TIMEOUT
2514
+ }).catch(() => void 0);
2515
+ }
2516
+ const identity = serviceContext.identityManager.identity;
2517
+ if (identity) {
2518
+ diagnostics.identity = {
2519
+ identityKey: identity.identityKey,
2520
+ spaceKey: identity.space.key,
2521
+ profile: identity.profileDocument
2522
+ };
2523
+ const { devices } = (_a = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
2524
+ timeout: DEFAULT_TIMEOUT
2525
+ }).catch(() => void 0)) != null ? _a : {};
2526
+ diagnostics.devices = devices;
2527
+ if (serviceContext.dataSpaceManager) {
2528
+ diagnostics.spaces = await Promise.all((_b = Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space))) != null ? _b : []);
2529
+ }
2530
+ const { feeds = [] } = (_c = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
2531
+ timeout: DEFAULT_TIMEOUT
2532
+ }).catch(() => void 0)) != null ? _c : {};
2533
+ diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
2534
+ feedKey,
2535
+ bytes,
2536
+ length
2537
+ }));
2538
+ }
2539
+ diagnostics.config = config.values;
2540
+ return diagnostics;
2541
+ };
2542
+ var getProperties = (space) => {
2543
+ let properties = {};
2544
+ try {
2545
+ const propertiesItem = space.dataPipeline.itemManager.items.find((item) => {
2546
+ var _a, _b;
2547
+ return ((_a = item.modelMeta) == null ? void 0 : _a.type) === import_document_model.DocumentModel.meta.type && ((_b = item.state) == null ? void 0 : _b.type) === "dxos.sdk.client.Properties";
2548
+ });
2549
+ const state = propertiesItem == null ? void 0 : propertiesItem.state;
2550
+ properties = state == null ? void 0 : state.data;
2551
+ } catch (err) {
2552
+ import_log8.log.warn(err.message, void 0, {
2553
+ F: __dxlog_file10,
2554
+ L: 144,
2555
+ S: void 0,
2556
+ C: (f, a) => f(...a)
2557
+ });
2558
+ }
2559
+ return properties;
2560
+ };
2561
+ var getSpaceStats = async (space) => {
2562
+ var _a, _b, _c, _d, _e, _f;
2563
+ const stats = {
2564
+ key: space.key,
2565
+ metrics: space.metrics,
2566
+ epochs: space.inner.spaceState.credentials.filter((0, import_credentials9.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
2567
+ ...credential.subject.assertion,
2568
+ id: credential.id
2569
+ })),
2570
+ members: Array.from(space.inner.spaceState.members.values()).map((member) => {
2571
+ var _a2;
2572
+ return {
2573
+ identity: {
2574
+ identityKey: member.key,
2575
+ profile: {
2576
+ displayName: (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName
2577
+ }
2578
+ },
2579
+ presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services6.SpaceMember.PresenceState.ONLINE : import_services6.SpaceMember.PresenceState.OFFLINE
2580
+ };
2581
+ }),
2582
+ pipeline: {
2583
+ // TODO(burdon): Pick properties from credentials if needed.
2584
+ // currentEpoch: space.dataPipeline.currentEpoch,
2585
+ // appliedEpoch: space.dataPipeline.appliedEpoch,
2586
+ controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
2587
+ currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
2588
+ targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
2589
+ totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
2590
+ // TODO(burdon): Empty?
2591
+ dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
2592
+ startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
2593
+ currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
2594
+ targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
2595
+ totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
2596
+ }
2597
+ };
2598
+ if (space.dataPipeline.itemManager) {
2599
+ Object.assign(stats, {
2600
+ properties: getProperties(space),
2601
+ db: {
2602
+ objects: space.dataPipeline.itemManager.entities.size
2603
+ }
2604
+ });
2605
+ }
2606
+ if (stats.metrics) {
2607
+ const { open, ready } = stats.metrics;
2608
+ stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
2609
+ }
2610
+ return stats;
2611
+ };
2612
+
2206
2613
  // packages/sdk/client-services/src/packlets/services/service-context.ts
2207
- var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
2208
2614
  var import_async14 = require("@dxos/async");
2209
- var import_credentials13 = require("@dxos/credentials");
2615
+ var import_credentials14 = require("@dxos/credentials");
2210
2616
  var import_debug7 = require("@dxos/debug");
2211
2617
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
2212
2618
  var import_feed_store4 = require("@dxos/feed-store");
2619
+ var import_invariant12 = require("@dxos/invariant");
2213
2620
  var import_keyring = require("@dxos/keyring");
2214
2621
  var import_keys10 = require("@dxos/keys");
2215
- var import_log12 = require("@dxos/log");
2216
- var import_protocols8 = require("@dxos/protocols");
2217
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
2622
+ var import_log13 = require("@dxos/log");
2623
+ var import_protocols9 = require("@dxos/protocols");
2624
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2218
2625
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2219
2626
 
2220
2627
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2221
- var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
2222
2628
  var import_async12 = require("@dxos/async");
2223
2629
  var import_context7 = require("@dxos/context");
2224
- var import_credentials12 = require("@dxos/credentials");
2630
+ var import_credentials13 = require("@dxos/credentials");
2631
+ var import_invariant11 = require("@dxos/invariant");
2225
2632
  var import_keys9 = require("@dxos/keys");
2226
- var import_log10 = require("@dxos/log");
2227
- var import_protocols6 = require("@dxos/protocols");
2228
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2633
+ var import_log11 = require("@dxos/log");
2634
+ var import_protocols7 = require("@dxos/protocols");
2635
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2229
2636
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2230
2637
  var import_util5 = require("@dxos/util");
2231
2638
 
@@ -2237,22 +2644,22 @@ var import_debug4 = require("@dxos/debug");
2237
2644
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2238
2645
  var import_errors3 = require("@dxos/errors");
2239
2646
  var import_keys8 = require("@dxos/keys");
2240
- var import_log9 = require("@dxos/log");
2241
- var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
2242
- var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
2647
+ var import_log10 = require("@dxos/log");
2648
+ var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2649
+ var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2243
2650
  var import_timeframe = require("@dxos/timeframe");
2244
2651
  var import_util4 = require("@dxos/util");
2245
2652
 
2246
2653
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2247
- var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
2248
2654
  var import_async10 = require("@dxos/async");
2249
2655
  var import_context5 = require("@dxos/context");
2656
+ var import_invariant10 = require("@dxos/invariant");
2250
2657
  var import_keys7 = require("@dxos/keys");
2251
- var import_log8 = require("@dxos/log");
2252
- var import_protocols5 = require("@dxos/protocols");
2658
+ var import_log9 = require("@dxos/log");
2659
+ var import_protocols6 = require("@dxos/protocols");
2253
2660
  var import_teleport2 = require("@dxos/teleport");
2254
2661
  var import_util3 = require("@dxos/util");
2255
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2662
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2256
2663
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2257
2664
  var DEFAULT_SUCCESS_DELAY = 1e3;
2258
2665
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2277,23 +2684,31 @@ var NotarizationPlugin = class {
2277
2684
  * Request credentials to be notarized.
2278
2685
  */
2279
2686
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
2280
- (0, import_log8.log)("notarize", {
2687
+ (0, import_log9.log)("notarize", {
2281
2688
  credentials
2282
2689
  }, {
2283
- F: __dxlog_file8,
2284
- L: 91,
2690
+ F: __dxlog_file11,
2691
+ L: 90,
2285
2692
  S: this,
2286
2693
  C: (f, a) => f(...a)
2287
2694
  });
2288
- (0, import_tiny_invariant9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
2695
+ (0, import_invariant10.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
2696
+ F: __dxlog_file11,
2697
+ L: 91,
2698
+ S: this,
2699
+ A: [
2700
+ "credentials.every((credential) => credential.id)",
2701
+ "'Credentials must have an id'"
2702
+ ]
2703
+ });
2289
2704
  const errors = new import_async10.Trigger();
2290
2705
  const ctx = this._ctx.derive({
2291
2706
  onError: (err) => {
2292
- import_log8.log.warn("Notarization error", {
2707
+ import_log9.log.warn("Notarization error", {
2293
2708
  err
2294
2709
  }, {
2295
- F: __dxlog_file8,
2296
- L: 100,
2710
+ F: __dxlog_file11,
2711
+ L: 99,
2297
2712
  S: this,
2298
2713
  C: (f, a) => f(...a)
2299
2714
  });
@@ -2304,12 +2719,12 @@ var NotarizationPlugin = class {
2304
2719
  opCtx == null ? void 0 : opCtx.onDispose(() => ctx.dispose());
2305
2720
  if (timeout !== 0) {
2306
2721
  (0, import_async10.scheduleTask)(ctx, () => {
2307
- import_log8.log.warn("Notarization timeout", {
2722
+ import_log9.log.warn("Notarization timeout", {
2308
2723
  timeout,
2309
2724
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
2310
2725
  }, {
2311
- F: __dxlog_file8,
2312
- L: 112,
2726
+ F: __dxlog_file11,
2727
+ L: 111,
2313
2728
  S: this,
2314
2729
  C: (f, a) => f(...a)
2315
2730
  });
@@ -2328,11 +2743,11 @@ var NotarizationPlugin = class {
2328
2743
  ...this._extensions
2329
2744
  ].find((peer2) => !peersTried.has(peer2));
2330
2745
  if (!peer) {
2331
- import_log8.log.warn("Exhausted all peers to notarize with", {
2746
+ import_log9.log.warn("Exhausted all peers to notarize with", {
2332
2747
  retryIn: retryTimeout
2333
2748
  }, {
2334
- F: __dxlog_file8,
2335
- L: 137,
2749
+ F: __dxlog_file11,
2750
+ L: 136,
2336
2751
  S: this,
2337
2752
  C: (f, a) => f(...a)
2338
2753
  });
@@ -2341,30 +2756,30 @@ var NotarizationPlugin = class {
2341
2756
  return;
2342
2757
  }
2343
2758
  peersTried.add(peer);
2344
- (0, import_log8.log)("try notarizing", {
2759
+ (0, import_log9.log)("try notarizing", {
2345
2760
  peer: peer.localPeerId,
2346
2761
  credentialId: credentials.map((credential) => credential.id)
2347
2762
  }, {
2348
- F: __dxlog_file8,
2349
- L: 144,
2763
+ F: __dxlog_file11,
2764
+ L: 143,
2350
2765
  S: this,
2351
2766
  C: (f, a) => f(...a)
2352
2767
  });
2353
2768
  await peer.rpc.NotarizationService.notarize({
2354
2769
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
2355
2770
  });
2356
- (0, import_log8.log)("success", void 0, {
2357
- F: __dxlog_file8,
2358
- L: 148,
2771
+ (0, import_log9.log)("success", void 0, {
2772
+ F: __dxlog_file11,
2773
+ L: 147,
2359
2774
  S: this,
2360
2775
  C: (f, a) => f(...a)
2361
2776
  });
2362
2777
  await (0, import_async10.sleep)(successDelay);
2363
2778
  } catch (err) {
2364
2779
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
2365
- import_log8.log.warn("error notarizing (recoverable)", err, {
2366
- F: __dxlog_file8,
2367
- L: 152,
2780
+ import_log9.log.warn("error notarizing (recoverable)", err, {
2781
+ F: __dxlog_file11,
2782
+ L: 151,
2368
2783
  S: this,
2369
2784
  C: (f, a) => f(...a)
2370
2785
  });
@@ -2380,9 +2795,9 @@ var NotarizationPlugin = class {
2380
2795
  allNotarized,
2381
2796
  errors.wait()
2382
2797
  ]);
2383
- (0, import_log8.log)("done", void 0, {
2384
- F: __dxlog_file8,
2385
- L: 163,
2798
+ (0, import_log9.log)("done", void 0, {
2799
+ F: __dxlog_file11,
2800
+ L: 162,
2386
2801
  S: this,
2387
2802
  C: (f, a) => f(...a)
2388
2803
  });
@@ -2403,7 +2818,15 @@ var NotarizationPlugin = class {
2403
2818
  this._processCredentialsTriggers.delete(credential.id);
2404
2819
  }
2405
2820
  setWriter(writer) {
2406
- (0, import_tiny_invariant9.default)(!this._writer, "Writer already set.");
2821
+ (0, import_invariant10.invariant)(!this._writer, "Writer already set.", {
2822
+ F: __dxlog_file11,
2823
+ L: 181,
2824
+ S: this,
2825
+ A: [
2826
+ "!this._writer",
2827
+ "'Writer already set.'"
2828
+ ]
2829
+ });
2407
2830
  this._writer = writer;
2408
2831
  }
2409
2832
  async _waitUntilProcessed(id) {
@@ -2421,7 +2844,15 @@ var NotarizationPlugin = class {
2421
2844
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
2422
2845
  }
2423
2846
  for (const credential of (_a = request.credentials) != null ? _a : []) {
2424
- (0, import_tiny_invariant9.default)(credential.id, "Credential must have an id");
2847
+ (0, import_invariant10.invariant)(credential.id, "Credential must have an id", {
2848
+ F: __dxlog_file11,
2849
+ L: 200,
2850
+ S: this,
2851
+ A: [
2852
+ "credential.id",
2853
+ "'Credential must have an id'"
2854
+ ]
2855
+ });
2425
2856
  if (this._processedCredentials.has(credential.id)) {
2426
2857
  continue;
2427
2858
  }
@@ -2431,11 +2862,11 @@ var NotarizationPlugin = class {
2431
2862
  createExtension() {
2432
2863
  const extension = new NotarizationTeleportExtension({
2433
2864
  onOpen: async () => {
2434
- (0, import_log8.log)("extension opened", {
2865
+ (0, import_log9.log)("extension opened", {
2435
2866
  peer: extension.localPeerId
2436
2867
  }, {
2437
- F: __dxlog_file8,
2438
- L: 212,
2868
+ F: __dxlog_file11,
2869
+ L: 211,
2439
2870
  S: this,
2440
2871
  C: (f, a) => f(...a)
2441
2872
  });
@@ -2443,11 +2874,11 @@ var NotarizationPlugin = class {
2443
2874
  this._extensionOpened.emit();
2444
2875
  },
2445
2876
  onClose: async () => {
2446
- (0, import_log8.log)("extension closed", {
2877
+ (0, import_log9.log)("extension closed", {
2447
2878
  peer: extension.localPeerId
2448
2879
  }, {
2449
- F: __dxlog_file8,
2450
- L: 217,
2880
+ F: __dxlog_file11,
2881
+ L: 216,
2451
2882
  S: this,
2452
2883
  C: (f, a) => f(...a)
2453
2884
  });
@@ -2462,10 +2893,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
2462
2893
  constructor(_params) {
2463
2894
  super({
2464
2895
  requested: {
2465
- NotarizationService: import_protocols5.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
2896
+ NotarizationService: import_protocols6.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
2466
2897
  },
2467
2898
  exposed: {
2468
- NotarizationService: import_protocols5.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
2899
+ NotarizationService: import_protocols6.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
2469
2900
  }
2470
2901
  });
2471
2902
  this._params = _params;
@@ -2500,12 +2931,12 @@ function _ts_decorate(decorators, target, key, desc) {
2500
2931
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2501
2932
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2502
2933
  }
2503
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2934
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2504
2935
  var DataSpace = class DataSpace2 {
2505
2936
  constructor(params) {
2506
2937
  this._ctx = new import_context6.Context();
2507
2938
  this._notarizationPlugin = new NotarizationPlugin();
2508
- this._state = import_services6.SpaceState.CLOSED;
2939
+ this._state = import_services7.SpaceState.CLOSED;
2509
2940
  /**
2510
2941
  * Error for _state === SpaceState.ERROR.
2511
2942
  */
@@ -2562,7 +2993,7 @@ var DataSpace = class DataSpace2 {
2562
2993
  await this._notarizationPlugin.open();
2563
2994
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
2564
2995
  await this._inner.open();
2565
- this._state = import_services6.SpaceState.CONTROL_ONLY;
2996
+ this._state = import_services7.SpaceState.CONTROL_ONLY;
2566
2997
  this.stateUpdate.emit();
2567
2998
  this.metrics = {};
2568
2999
  this.metrics.open = new Date();
@@ -2573,7 +3004,7 @@ var DataSpace = class DataSpace2 {
2573
3004
  async _close() {
2574
3005
  var _a, _b;
2575
3006
  await ((_b = (_a = this._callbacks).beforeClose) == null ? void 0 : _b.call(_a));
2576
- this._state = import_services6.SpaceState.CLOSED;
3007
+ this._state = import_services7.SpaceState.CLOSED;
2577
3008
  await this._ctx.dispose();
2578
3009
  this._ctx = new import_context6.Context();
2579
3010
  await this.authVerifier.close();
@@ -2598,21 +3029,21 @@ var DataSpace = class DataSpace2 {
2598
3029
  await this.initializeDataPipeline();
2599
3030
  } catch (err) {
2600
3031
  if (err instanceof import_errors3.CancelledError) {
2601
- (0, import_log9.log)("data pipeline initialization cancelled", err, {
2602
- F: __dxlog_file9,
3032
+ (0, import_log10.log)("data pipeline initialization cancelled", err, {
3033
+ F: __dxlog_file12,
2603
3034
  L: 193,
2604
3035
  S: this,
2605
3036
  C: (f, a) => f(...a)
2606
3037
  });
2607
3038
  return;
2608
3039
  }
2609
- import_log9.log.error("Error initializing data pipeline", err, {
2610
- F: __dxlog_file9,
3040
+ import_log10.log.error("Error initializing data pipeline", err, {
3041
+ F: __dxlog_file12,
2611
3042
  L: 197,
2612
3043
  S: this,
2613
3044
  C: (f, a) => f(...a)
2614
3045
  });
2615
- this._state = import_services6.SpaceState.ERROR;
3046
+ this._state = import_services7.SpaceState.ERROR;
2616
3047
  this.error = err;
2617
3048
  this.stateUpdate.emit();
2618
3049
  } finally {
@@ -2622,18 +3053,18 @@ var DataSpace = class DataSpace2 {
2622
3053
  }
2623
3054
  async initializeDataPipeline() {
2624
3055
  var _a, _b, _c, _d;
2625
- if (this._state !== import_services6.SpaceState.CONTROL_ONLY) {
3056
+ if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
2626
3057
  throw new import_errors3.SystemError("Invalid operation");
2627
3058
  }
2628
- this._state = import_services6.SpaceState.INITIALIZING;
3059
+ this._state = import_services7.SpaceState.INITIALIZING;
2629
3060
  await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
2630
3061
  ctx: this._ctx,
2631
3062
  breakOnStall: false
2632
3063
  });
2633
3064
  this.metrics.controlPipelineReady = new Date();
2634
3065
  await this._createWritableFeeds();
2635
- (0, import_log9.log)("writable feeds created", void 0, {
2636
- F: __dxlog_file9,
3066
+ (0, import_log10.log)("writable feeds created", void 0, {
3067
+ F: __dxlog_file12,
2637
3068
  L: 221,
2638
3069
  S: this,
2639
3070
  C: (f, a) => f(...a)
@@ -2649,8 +3080,8 @@ var DataSpace = class DataSpace2 {
2649
3080
  await this._inner.initializeDataPipeline();
2650
3081
  this.metrics.dataPipelineOpen = new Date();
2651
3082
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2652
- (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
2653
- F: __dxlog_file9,
3083
+ (0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
3084
+ F: __dxlog_file12,
2654
3085
  L: 242,
2655
3086
  S: this,
2656
3087
  C: (f, a) => f(...a)
@@ -2660,14 +3091,14 @@ var DataSpace = class DataSpace2 {
2660
3091
  breakOnStall: false
2661
3092
  });
2662
3093
  this.metrics.dataPipelineReady = new Date();
2663
- (0, import_log9.log)("data pipeline ready", void 0, {
2664
- F: __dxlog_file9,
3094
+ (0, import_log10.log)("data pipeline ready", void 0, {
3095
+ F: __dxlog_file12,
2665
3096
  L: 251,
2666
3097
  S: this,
2667
3098
  C: (f, a) => f(...a)
2668
3099
  });
2669
3100
  await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
2670
- this._state = import_services6.SpaceState.READY;
3101
+ this._state = import_services7.SpaceState.READY;
2671
3102
  this.stateUpdate.emit();
2672
3103
  await ((_d = (_c = this._callbacks).afterReady) == null ? void 0 : _d.call(_c));
2673
3104
  }
@@ -2685,7 +3116,7 @@ var DataSpace = class DataSpace2 {
2685
3116
  spaceKey: this.key,
2686
3117
  deviceKey: this._signingContext.deviceKey,
2687
3118
  identityKey: this._signingContext.identityKey,
2688
- designation: import_credentials9.AdmittedFeed.Designation.CONTROL
3119
+ designation: import_credentials10.AdmittedFeed.Designation.CONTROL
2689
3120
  }
2690
3121
  }));
2691
3122
  }
@@ -2702,7 +3133,7 @@ var DataSpace = class DataSpace2 {
2702
3133
  spaceKey: this.key,
2703
3134
  deviceKey: this._signingContext.deviceKey,
2704
3135
  identityKey: this._signingContext.identityKey,
2705
- designation: import_credentials9.AdmittedFeed.Designation.DATA
3136
+ designation: import_credentials10.AdmittedFeed.Designation.DATA
2706
3137
  }
2707
3138
  }));
2708
3139
  }
@@ -2743,20 +3174,20 @@ var DataSpace = class DataSpace2 {
2743
3174
  }
2744
3175
  }
2745
3176
  async activate() {
2746
- if (this._state !== import_services6.SpaceState.INACTIVE) {
3177
+ if (this._state !== import_services7.SpaceState.INACTIVE) {
2747
3178
  return;
2748
3179
  }
2749
- await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.ACTIVE);
3180
+ await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.ACTIVE);
2750
3181
  await this._open();
2751
3182
  this.initializeDataPipelineAsync();
2752
3183
  }
2753
3184
  async deactivate() {
2754
- if (this._state === import_services6.SpaceState.INACTIVE) {
3185
+ if (this._state === import_services7.SpaceState.INACTIVE) {
2755
3186
  return;
2756
3187
  }
2757
- await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.INACTIVE);
3188
+ await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
2758
3189
  await this._close();
2759
- this._state = import_services6.SpaceState.INACTIVE;
3190
+ this._state = import_services7.SpaceState.INACTIVE;
2760
3191
  this.stateUpdate.emit();
2761
3192
  }
2762
3193
  };
@@ -2780,14 +3211,14 @@ DataSpace = _ts_decorate([
2780
3211
  ], DataSpace);
2781
3212
 
2782
3213
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
2783
- var import_credentials10 = require("@dxos/credentials");
3214
+ var import_credentials11 = require("@dxos/credentials");
2784
3215
  var import_debug5 = require("@dxos/debug");
2785
- var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
3216
+ var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
2786
3217
  var import_timeframe2 = require("@dxos/timeframe");
2787
3218
  var spaceGenesis = async (keyring, signingContext, space) => {
2788
3219
  var _a, _b, _c, _d;
2789
3220
  const credentials = [
2790
- await (0, import_credentials10.createCredential)({
3221
+ await (0, import_credentials11.createCredential)({
2791
3222
  signer: keyring,
2792
3223
  issuer: space.key,
2793
3224
  subject: space.key,
@@ -2796,14 +3227,14 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2796
3227
  spaceKey: space.key
2797
3228
  }
2798
3229
  }),
2799
- await (0, import_credentials10.createCredential)({
3230
+ await (0, import_credentials11.createCredential)({
2800
3231
  signer: keyring,
2801
3232
  issuer: space.key,
2802
3233
  subject: signingContext.identityKey,
2803
3234
  assertion: {
2804
3235
  "@type": "dxos.halo.credentials.SpaceMember",
2805
3236
  spaceKey: space.key,
2806
- role: import_credentials11.SpaceMember.Role.ADMIN,
3237
+ role: import_credentials12.SpaceMember.Role.ADMIN,
2807
3238
  profile: signingContext.profile,
2808
3239
  genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : (0, import_debug5.failUndefined)()
2809
3240
  }
@@ -2815,7 +3246,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2815
3246
  spaceKey: space.key,
2816
3247
  identityKey: signingContext.identityKey,
2817
3248
  deviceKey: signingContext.deviceKey,
2818
- designation: import_credentials11.AdmittedFeed.Designation.CONTROL
3249
+ designation: import_credentials12.AdmittedFeed.Designation.CONTROL
2819
3250
  }
2820
3251
  }),
2821
3252
  await signingContext.credentialSigner.createCredential({
@@ -2825,7 +3256,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2825
3256
  spaceKey: space.key,
2826
3257
  identityKey: signingContext.identityKey,
2827
3258
  deviceKey: signingContext.deviceKey,
2828
- designation: import_credentials11.AdmittedFeed.Designation.DATA
3259
+ designation: import_credentials12.AdmittedFeed.Designation.DATA
2829
3260
  }
2830
3261
  }),
2831
3262
  await signingContext.credentialSigner.createCredential({
@@ -2860,7 +3291,7 @@ function _ts_decorate2(decorators, target, key, desc) {
2860
3291
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2861
3292
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2862
3293
  }
2863
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3294
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
2864
3295
  var DataSpaceManager = class DataSpaceManager2 {
2865
3296
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
2866
3297
  this._spaceManager = _spaceManager;
@@ -2880,50 +3311,50 @@ var DataSpaceManager = class DataSpaceManager2 {
2880
3311
  return this._spaces;
2881
3312
  }
2882
3313
  async open() {
2883
- (0, import_log10.log)("open", void 0, {
2884
- F: __dxlog_file10,
2885
- L: 80,
3314
+ (0, import_log11.log)("open", void 0, {
3315
+ F: __dxlog_file13,
3316
+ L: 79,
2886
3317
  S: this,
2887
3318
  C: (f, a) => f(...a)
2888
3319
  });
2889
- import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
3320
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.begin({
2890
3321
  id: this._instanceId
2891
3322
  }), {
2892
- F: __dxlog_file10,
2893
- L: 81,
3323
+ F: __dxlog_file13,
3324
+ L: 80,
2894
3325
  S: this,
2895
3326
  C: (f, a) => f(...a)
2896
3327
  });
2897
3328
  await this._metadataStore.load();
2898
- (0, import_log10.log)("metadata loaded", {
3329
+ (0, import_log11.log)("metadata loaded", {
2899
3330
  spaces: this._metadataStore.spaces.length
2900
3331
  }, {
2901
- F: __dxlog_file10,
2902
- L: 83,
3332
+ F: __dxlog_file13,
3333
+ L: 82,
2903
3334
  S: this,
2904
3335
  C: (f, a) => f(...a)
2905
3336
  });
2906
3337
  for (const spaceMetadata of this._metadataStore.spaces) {
2907
3338
  try {
2908
- (0, import_log10.log)("load space", {
3339
+ (0, import_log11.log)("load space", {
2909
3340
  spaceMetadata
2910
3341
  }, {
2911
- F: __dxlog_file10,
2912
- L: 87,
3342
+ F: __dxlog_file13,
3343
+ L: 86,
2913
3344
  S: this,
2914
3345
  C: (f, a) => f(...a)
2915
3346
  });
2916
3347
  const space = await this._constructSpace(spaceMetadata);
2917
- if (spaceMetadata.state !== import_services7.SpaceState.INACTIVE) {
3348
+ if (spaceMetadata.state !== import_services8.SpaceState.INACTIVE) {
2918
3349
  space.initializeDataPipelineAsync();
2919
3350
  }
2920
3351
  } catch (err) {
2921
- import_log10.log.error("Error loading space", {
3352
+ import_log11.log.error("Error loading space", {
2922
3353
  spaceMetadata,
2923
3354
  err
2924
3355
  }, {
2925
- F: __dxlog_file10,
2926
- L: 93,
3356
+ F: __dxlog_file13,
3357
+ L: 92,
2927
3358
  S: this,
2928
3359
  C: (f, a) => f(...a)
2929
3360
  });
@@ -2931,19 +3362,19 @@ var DataSpaceManager = class DataSpaceManager2 {
2931
3362
  }
2932
3363
  this._isOpen = true;
2933
3364
  this.updated.emit();
2934
- import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
3365
+ import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols7.trace.end({
2935
3366
  id: this._instanceId
2936
3367
  }), {
2937
- F: __dxlog_file10,
2938
- L: 99,
3368
+ F: __dxlog_file13,
3369
+ L: 98,
2939
3370
  S: this,
2940
3371
  C: (f, a) => f(...a)
2941
3372
  });
2942
3373
  }
2943
3374
  async close() {
2944
- (0, import_log10.log)("close", void 0, {
2945
- F: __dxlog_file10,
2946
- L: 104,
3375
+ (0, import_log11.log)("close", void 0, {
3376
+ F: __dxlog_file13,
3377
+ L: 103,
2947
3378
  S: this,
2948
3379
  C: (f, a) => f(...a)
2949
3380
  });
@@ -2957,7 +3388,15 @@ var DataSpaceManager = class DataSpaceManager2 {
2957
3388
  * Creates a new space writing the genesis credentials to the control feed.
2958
3389
  */
2959
3390
  async createSpace() {
2960
- (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
3391
+ (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3392
+ F: __dxlog_file13,
3393
+ L: 116,
3394
+ S: this,
3395
+ A: [
3396
+ "this._isOpen",
3397
+ "'Not open.'"
3398
+ ]
3399
+ });
2961
3400
  const spaceKey = await this._keyring.createKey();
2962
3401
  const controlFeedKey = await this._keyring.createKey();
2963
3402
  const dataFeedKey = await this._keyring.createKey();
@@ -2966,13 +3405,13 @@ var DataSpaceManager = class DataSpaceManager2 {
2966
3405
  genesisFeedKey: controlFeedKey,
2967
3406
  controlFeedKey,
2968
3407
  dataFeedKey,
2969
- state: import_services7.SpaceState.ACTIVE
3408
+ state: import_services8.SpaceState.ACTIVE
2970
3409
  };
2971
- (0, import_log10.log)("creating space...", {
3410
+ (0, import_log11.log)("creating space...", {
2972
3411
  spaceKey
2973
3412
  }, {
2974
- F: __dxlog_file10,
2975
- L: 129,
3413
+ F: __dxlog_file13,
3414
+ L: 128,
2976
3415
  S: this,
2977
3416
  C: (f, a) => f(...a)
2978
3417
  });
@@ -2980,7 +3419,15 @@ var DataSpaceManager = class DataSpaceManager2 {
2980
3419
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
2981
3420
  await this._metadataStore.addSpace(metadata);
2982
3421
  const memberCredential = credentials[1];
2983
- (0, import_tiny_invariant10.default)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
3422
+ (0, import_invariant11.invariant)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3423
+ F: __dxlog_file13,
3424
+ L: 135,
3425
+ S: this,
3426
+ A: [
3427
+ "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
3428
+ ""
3429
+ ]
3430
+ });
2984
3431
  await this._signingContext.recordCredential(memberCredential);
2985
3432
  await space.initializeDataPipeline();
2986
3433
  this.updated.emit();
@@ -2988,16 +3435,32 @@ var DataSpaceManager = class DataSpaceManager2 {
2988
3435
  }
2989
3436
  // TODO(burdon): Rename join space.
2990
3437
  async acceptSpace(opts) {
2991
- (0, import_log10.log)("accept space", {
3438
+ (0, import_log11.log)("accept space", {
2992
3439
  opts
2993
3440
  }, {
2994
- F: __dxlog_file10,
2995
- L: 148,
3441
+ F: __dxlog_file13,
3442
+ L: 147,
2996
3443
  S: this,
2997
3444
  C: (f, a) => f(...a)
2998
3445
  });
2999
- (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
3000
- (0, import_tiny_invariant10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
3446
+ (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3447
+ F: __dxlog_file13,
3448
+ L: 148,
3449
+ S: this,
3450
+ A: [
3451
+ "this._isOpen",
3452
+ "'Not open.'"
3453
+ ]
3454
+ });
3455
+ (0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3456
+ F: __dxlog_file13,
3457
+ L: 149,
3458
+ S: this,
3459
+ A: [
3460
+ "!this._spaces.has(opts.spaceKey)",
3461
+ "'Space already exists.'"
3462
+ ]
3463
+ });
3001
3464
  const metadata = {
3002
3465
  key: opts.spaceKey,
3003
3466
  genesisFeedKey: opts.genesisFeedKey,
@@ -3018,15 +3481,15 @@ var DataSpaceManager = class DataSpaceManager2 {
3018
3481
  async waitUntilSpaceReady(spaceKey) {
3019
3482
  await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3020
3483
  const space = this._spaces.get(spaceKey);
3021
- return !!space && space.state === import_services7.SpaceState.READY;
3484
+ return !!space && space.state === import_services8.SpaceState.READY;
3022
3485
  }));
3023
3486
  }
3024
3487
  async _constructSpace(metadata) {
3025
- (0, import_log10.log)("construct space", {
3488
+ (0, import_log11.log)("construct space", {
3026
3489
  metadata
3027
3490
  }, {
3028
- F: __dxlog_file10,
3029
- L: 183,
3491
+ F: __dxlog_file13,
3492
+ L: 182,
3030
3493
  S: this,
3031
3494
  C: (f, a) => f(...a)
3032
3495
  });
@@ -3060,9 +3523,9 @@ var DataSpaceManager = class DataSpaceManager2 {
3060
3523
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
3061
3524
  },
3062
3525
  onAuthFailure: () => {
3063
- import_log10.log.warn("auth failure", void 0, {
3064
- F: __dxlog_file10,
3065
- L: 214,
3526
+ import_log11.log.warn("auth failure", void 0, {
3527
+ F: __dxlog_file13,
3528
+ L: 213,
3066
3529
  S: this,
3067
3530
  C: (f, a) => f(...a)
3068
3531
  });
@@ -3073,7 +3536,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3073
3536
  dataFeed && space.setDataFeed(dataFeed);
3074
3537
  const dataSpace = new DataSpace({
3075
3538
  inner: space,
3076
- initialState: metadata.state === import_services7.SpaceState.INACTIVE ? import_services7.SpaceState.INACTIVE : import_services7.SpaceState.CLOSED,
3539
+ initialState: metadata.state === import_services8.SpaceState.INACTIVE ? import_services8.SpaceState.INACTIVE : import_services8.SpaceState.CLOSED,
3077
3540
  metadataStore: this._metadataStore,
3078
3541
  gossip,
3079
3542
  presence,
@@ -3082,23 +3545,23 @@ var DataSpaceManager = class DataSpaceManager2 {
3082
3545
  signingContext: this._signingContext,
3083
3546
  callbacks: {
3084
3547
  beforeReady: async () => {
3085
- (0, import_log10.log)("before space ready", {
3548
+ (0, import_log11.log)("before space ready", {
3086
3549
  space: space.key
3087
3550
  }, {
3088
- F: __dxlog_file10,
3089
- L: 232,
3551
+ F: __dxlog_file13,
3552
+ L: 231,
3090
3553
  S: this,
3091
3554
  C: (f, a) => f(...a)
3092
3555
  });
3093
3556
  await this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
3094
3557
  },
3095
3558
  afterReady: async () => {
3096
- (0, import_log10.log)("after space ready", {
3559
+ (0, import_log11.log)("after space ready", {
3097
3560
  space: space.key,
3098
3561
  open: this._isOpen
3099
3562
  }, {
3100
- F: __dxlog_file10,
3101
- L: 239,
3563
+ F: __dxlog_file13,
3564
+ L: 238,
3102
3565
  S: this,
3103
3566
  C: (f, a) => f(...a)
3104
3567
  });
@@ -3107,11 +3570,11 @@ var DataSpaceManager = class DataSpaceManager2 {
3107
3570
  }
3108
3571
  },
3109
3572
  beforeClose: async () => {
3110
- (0, import_log10.log)("before space close", {
3573
+ (0, import_log11.log)("before space close", {
3111
3574
  space: space.key
3112
3575
  }, {
3113
- F: __dxlog_file10,
3114
- L: 245,
3576
+ F: __dxlog_file13,
3577
+ L: 244,
3115
3578
  S: this,
3116
3579
  C: (f, a) => f(...a)
3117
3580
  });
@@ -3120,7 +3583,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3120
3583
  },
3121
3584
  cache: metadata.cache
3122
3585
  });
3123
- if (metadata.state !== import_services7.SpaceState.INACTIVE) {
3586
+ if (metadata.state !== import_services8.SpaceState.INACTIVE) {
3124
3587
  await dataSpace.open();
3125
3588
  }
3126
3589
  if (metadata.controlTimeframe) {
@@ -3151,15 +3614,15 @@ DataSpaceManager = _ts_decorate2([
3151
3614
 
3152
3615
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
3153
3616
  var import_async13 = require("@dxos/async");
3154
- var import_codec_protobuf10 = require("@dxos/codec-protobuf");
3617
+ var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3155
3618
  var import_debug6 = require("@dxos/debug");
3156
3619
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3157
3620
  var import_errors4 = require("@dxos/errors");
3158
- var import_log11 = require("@dxos/log");
3159
- var import_protocols7 = require("@dxos/protocols");
3160
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
3621
+ var import_log12 = require("@dxos/log");
3622
+ var import_protocols8 = require("@dxos/protocols");
3623
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3161
3624
  var import_util6 = require("@dxos/util");
3162
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3625
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3163
3626
  var SpacesServiceImpl = class {
3164
3627
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
3165
3628
  this._identityManager = _identityManager;
@@ -3181,10 +3644,10 @@ var SpacesServiceImpl = class {
3181
3644
  const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3182
3645
  if (state) {
3183
3646
  switch (state) {
3184
- case import_services8.SpaceState.ACTIVE:
3647
+ case import_services9.SpaceState.ACTIVE:
3185
3648
  await space.activate();
3186
3649
  break;
3187
- case import_services8.SpaceState.INACTIVE:
3650
+ case import_services9.SpaceState.INACTIVE:
3188
3651
  await space.deactivate();
3189
3652
  break;
3190
3653
  default:
@@ -3193,14 +3656,14 @@ var SpacesServiceImpl = class {
3193
3656
  }
3194
3657
  }
3195
3658
  querySpaces() {
3196
- return new import_codec_protobuf10.Stream(({ next, ctx }) => {
3659
+ return new import_codec_protobuf11.Stream(({ next, ctx }) => {
3197
3660
  const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
3198
3661
  const dataSpaceManager = await this._getDataSpaceManager();
3199
3662
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
3200
- (0, import_log11.log)("update", {
3663
+ (0, import_log12.log)("update", {
3201
3664
  spaces
3202
3665
  }, {
3203
- F: __dxlog_file11,
3666
+ F: __dxlog_file14,
3204
3667
  L: 78,
3205
3668
  S: this,
3206
3669
  C: (f, a) => f(...a)
@@ -3248,7 +3711,7 @@ var SpacesServiceImpl = class {
3248
3711
  await space.postMessage(getChannelId(channel), message);
3249
3712
  }
3250
3713
  subscribeMessages({ spaceKey, channel }) {
3251
- return new import_codec_protobuf10.Stream(({ ctx, next }) => {
3714
+ return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3252
3715
  (0, import_async13.scheduleTask)(ctx, async () => {
3253
3716
  var _a;
3254
3717
  const dataSpaceManager = await this._getDataSpaceManager();
@@ -3261,7 +3724,7 @@ var SpacesServiceImpl = class {
3261
3724
  });
3262
3725
  }
3263
3726
  queryCredentials({ spaceKey }) {
3264
- return new import_codec_protobuf10.Stream(({ ctx, next }) => {
3727
+ return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3265
3728
  var _a;
3266
3729
  const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
3267
3730
  const processor = {
@@ -3295,7 +3758,7 @@ var SpacesServiceImpl = class {
3295
3758
  return {
3296
3759
  spaceKey: space.key,
3297
3760
  state: space.state,
3298
- error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
3761
+ error: space.error ? (0, import_protocols8.encodeError)(space.error) : void 0,
3299
3762
  pipeline: {
3300
3763
  currentEpoch: space.dataPipeline.currentEpoch,
3301
3764
  appliedEpoch: space.dataPipeline.appliedEpoch,
@@ -3323,7 +3786,7 @@ var SpacesServiceImpl = class {
3323
3786
  displayName: (_c2 = (_b2 = member.assertion.profile) == null ? void 0 : _b2.displayName) != null ? _c2 : (0, import_util6.humanize)(member.key)
3324
3787
  }
3325
3788
  },
3326
- presence: isMe || peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
3789
+ presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
3327
3790
  peerStates: peers
3328
3791
  };
3329
3792
  }),
@@ -3336,7 +3799,7 @@ var SpacesServiceImpl = class {
3336
3799
  var getChannelId = (channel) => `user-channel/${channel}`;
3337
3800
 
3338
3801
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3339
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3802
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3340
3803
  var ServiceContext = class {
3341
3804
  // prettier-ignore
3342
3805
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3371,24 +3834,24 @@ var ServiceContext = class {
3371
3834
  });
3372
3835
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3373
3836
  this.invitations = new InvitationsHandler(this.networkManager);
3374
- this._handlerFactories.set(import_services9.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3837
+ this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3375
3838
  var _a;
3376
3839
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug7.failUndefined)();
3377
3840
  }, this._acceptIdentity.bind(this)));
3378
3841
  }
3379
3842
  async open() {
3380
- import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
3381
- id: this._instanceId
3382
- }), {
3383
- F: __dxlog_file12,
3384
- L: 126,
3843
+ await this._checkStorageVersion();
3844
+ (0, import_log13.log)("opening...", void 0, {
3845
+ F: __dxlog_file15,
3846
+ L: 127,
3385
3847
  S: this,
3386
3848
  C: (f, a) => f(...a)
3387
3849
  });
3388
- await this._checkStorageVersion();
3389
- (0, import_log12.log)("opening...", void 0, {
3390
- F: __dxlog_file12,
3391
- L: 130,
3850
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.begin({
3851
+ id: this._instanceId
3852
+ }), {
3853
+ F: __dxlog_file15,
3854
+ L: 128,
3392
3855
  S: this,
3393
3856
  C: (f, a) => f(...a)
3394
3857
  });
@@ -3399,26 +3862,26 @@ var ServiceContext = class {
3399
3862
  if (this.identityManager.identity) {
3400
3863
  await this._initialize();
3401
3864
  }
3402
- (0, import_log12.log)("opened", void 0, {
3403
- F: __dxlog_file12,
3404
- L: 138,
3865
+ import_log13.log.trace("dxos.sdk.service-context.open", import_protocols9.trace.end({
3866
+ id: this._instanceId
3867
+ }), {
3868
+ F: __dxlog_file15,
3869
+ L: 136,
3405
3870
  S: this,
3406
3871
  C: (f, a) => f(...a)
3407
3872
  });
3408
- import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
3409
- id: this._instanceId
3410
- }), {
3411
- F: __dxlog_file12,
3412
- L: 139,
3873
+ (0, import_log13.log)("opened", void 0, {
3874
+ F: __dxlog_file15,
3875
+ L: 137,
3413
3876
  S: this,
3414
3877
  C: (f, a) => f(...a)
3415
3878
  });
3416
3879
  }
3417
3880
  async close() {
3418
3881
  var _a;
3419
- (0, import_log12.log)("closing...", void 0, {
3420
- F: __dxlog_file12,
3421
- L: 143,
3882
+ (0, import_log13.log)("closing...", void 0, {
3883
+ F: __dxlog_file15,
3884
+ L: 141,
3422
3885
  S: this,
3423
3886
  C: (f, a) => f(...a)
3424
3887
  });
@@ -3432,9 +3895,9 @@ var ServiceContext = class {
3432
3895
  await this.networkManager.close();
3433
3896
  await this.signalManager.close();
3434
3897
  this.dataServiceSubscriptions.clear();
3435
- (0, import_log12.log)("closed", void 0, {
3436
- F: __dxlog_file12,
3437
- L: 154,
3898
+ (0, import_log13.log)("closed", void 0, {
3899
+ F: __dxlog_file15,
3900
+ L: 152,
3438
3901
  S: this,
3439
3902
  C: (f, a) => f(...a)
3440
3903
  });
@@ -3446,7 +3909,15 @@ var ServiceContext = class {
3446
3909
  }
3447
3910
  getInvitationHandler(invitation) {
3448
3911
  const factory = this._handlerFactories.get(invitation.kind);
3449
- (0, import_tiny_invariant11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
3912
+ (0, import_invariant12.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
3913
+ F: __dxlog_file15,
3914
+ L: 164,
3915
+ S: this,
3916
+ A: [
3917
+ "factory",
3918
+ "`Unknown invitation kind: ${invitation.kind}`"
3919
+ ]
3920
+ });
3450
3921
  return factory(invitation);
3451
3922
  }
3452
3923
  async _acceptIdentity(params) {
@@ -3456,16 +3927,16 @@ var ServiceContext = class {
3456
3927
  }
3457
3928
  async _checkStorageVersion() {
3458
3929
  await this.metadataStore.load();
3459
- if (this.metadataStore.version !== import_protocols8.STORAGE_VERSION) {
3460
- throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols8.STORAGE_VERSION}`);
3930
+ if (this.metadataStore.version !== import_protocols9.STORAGE_VERSION) {
3931
+ throw new Error(`Invalid storage version: current=${this.metadataStore.version}, expected=${import_protocols9.STORAGE_VERSION}`);
3461
3932
  }
3462
3933
  }
3463
3934
  // Called when identity is created.
3464
3935
  async _initialize() {
3465
3936
  var _a;
3466
- (0, import_log12.log)("initializing spaces...", void 0, {
3467
- F: __dxlog_file12,
3468
- L: 187,
3937
+ (0, import_log13.log)("initializing spaces...", void 0, {
3938
+ F: __dxlog_file15,
3939
+ L: 185,
3469
3940
  S: this,
3470
3941
  C: (f, a) => f(...a)
3471
3942
  });
@@ -3485,14 +3956,22 @@ var ServiceContext = class {
3485
3956
  };
3486
3957
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3487
3958
  await this.dataSpaceManager.open();
3488
- this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
3489
- (0, import_tiny_invariant11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3959
+ this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3960
+ (0, import_invariant12.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3961
+ F: __dxlog_file15,
3962
+ L: 208,
3963
+ S: this,
3964
+ A: [
3965
+ "this.dataSpaceManager",
3966
+ "'dataSpaceManager not initialized yet'"
3967
+ ]
3968
+ });
3490
3969
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
3491
3970
  });
3492
3971
  this.initialized.wake();
3493
3972
  this._deviceSpaceSync = {
3494
3973
  processCredential: async (credential) => {
3495
- const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
3974
+ const assertion = (0, import_credentials14.getCredentialAssertion)(credential);
3496
3975
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
3497
3976
  return;
3498
3977
  }
@@ -3500,33 +3979,33 @@ var ServiceContext = class {
3500
3979
  return;
3501
3980
  }
3502
3981
  if (!this.dataSpaceManager) {
3503
- (0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
3982
+ (0, import_log13.log)("dataSpaceManager not initialized yet, ignoring space admission", {
3504
3983
  details: assertion
3505
3984
  }, {
3506
- F: __dxlog_file12,
3507
- L: 226,
3985
+ F: __dxlog_file15,
3986
+ L: 224,
3508
3987
  S: this,
3509
3988
  C: (f, a) => f(...a)
3510
3989
  });
3511
3990
  return;
3512
3991
  }
3513
3992
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
3514
- (0, import_log12.log)("space already exists, ignoring space admission", {
3993
+ (0, import_log13.log)("space already exists, ignoring space admission", {
3515
3994
  details: assertion
3516
3995
  }, {
3517
- F: __dxlog_file12,
3518
- L: 230,
3996
+ F: __dxlog_file15,
3997
+ L: 228,
3519
3998
  S: this,
3520
3999
  C: (f, a) => f(...a)
3521
4000
  });
3522
4001
  return;
3523
4002
  }
3524
4003
  try {
3525
- (0, import_log12.log)("accepting space recorded in halo", {
4004
+ (0, import_log13.log)("accepting space recorded in halo", {
3526
4005
  details: assertion
3527
4006
  }, {
3528
- F: __dxlog_file12,
3529
- L: 235,
4007
+ F: __dxlog_file15,
4008
+ L: 233,
3530
4009
  S: this,
3531
4010
  C: (f, a) => f(...a)
3532
4011
  });
@@ -3535,9 +4014,9 @@ var ServiceContext = class {
3535
4014
  genesisFeedKey: assertion.genesisFeedKey
3536
4015
  });
3537
4016
  } catch (err) {
3538
- import_log12.log.catch(err, void 0, {
3539
- F: __dxlog_file12,
3540
- L: 241,
4017
+ import_log13.log.catch(err, void 0, {
4018
+ F: __dxlog_file15,
4019
+ L: 239,
3541
4020
  S: this,
3542
4021
  C: (f, a) => f(...a)
3543
4022
  });
@@ -3549,24 +4028,24 @@ var ServiceContext = class {
3549
4028
  };
3550
4029
 
3551
4030
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3552
- var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
3553
4031
  var import_async17 = require("@dxos/async");
3554
4032
  var import_client_protocol5 = require("@dxos/client-protocol");
3555
- var import_document_model = require("@dxos/document-model");
4033
+ var import_document_model2 = require("@dxos/document-model");
3556
4034
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
4035
+ var import_invariant14 = require("@dxos/invariant");
3557
4036
  var import_keys11 = require("@dxos/keys");
3558
- var import_log15 = require("@dxos/log");
4037
+ var import_log16 = require("@dxos/log");
3559
4038
  var import_messaging = require("@dxos/messaging");
3560
4039
  var import_model_factory = require("@dxos/model-factory");
3561
4040
  var import_network_manager2 = require("@dxos/network-manager");
3562
- var import_protocols9 = require("@dxos/protocols");
3563
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4041
+ var import_protocols10 = require("@dxos/protocols");
4042
+ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3564
4043
  var import_text_model = require("@dxos/text-model");
3565
4044
 
3566
4045
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3567
4046
  var import_async15 = require("@dxos/async");
3568
- var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3569
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
4047
+ var import_codec_protobuf12 = require("@dxos/codec-protobuf");
4048
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
3570
4049
  var DevicesServiceImpl = class {
3571
4050
  constructor(_identityManager) {
3572
4051
  this._identityManager = _identityManager;
@@ -3575,7 +4054,7 @@ var DevicesServiceImpl = class {
3575
4054
  throw new Error("Method not implemented.");
3576
4055
  }
3577
4056
  queryDevices() {
3578
- return new import_codec_protobuf11.Stream(({ next }) => {
4057
+ return new import_codec_protobuf12.Stream(({ next }) => {
3579
4058
  const update = () => {
3580
4059
  var _a;
3581
4060
  const deviceKeys = (_a = this._identityManager.identity) == null ? void 0 : _a.authorizedDeviceKeys;
@@ -3589,7 +4068,7 @@ var DevicesServiceImpl = class {
3589
4068
  var _a2;
3590
4069
  return {
3591
4070
  deviceKey: key,
3592
- kind: ((_a2 = this._identityManager.identity) == null ? void 0 : _a2.deviceKey.equals(key)) ? import_services10.DeviceKind.CURRENT : import_services10.DeviceKind.TRUSTED
4071
+ kind: ((_a2 = this._identityManager.identity) == null ? void 0 : _a2.deviceKey.equals(key)) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
3593
4072
  };
3594
4073
  })
3595
4074
  });
@@ -3611,9 +4090,9 @@ var DevicesServiceImpl = class {
3611
4090
  };
3612
4091
 
3613
4092
  // packages/sdk/client-services/src/packlets/locks/node.ts
3614
- var import_tiny_invariant12 = __toESM(require("tiny-invariant"));
4093
+ var import_invariant13 = require("@dxos/invariant");
3615
4094
  var import_lock_file = require("@dxos/lock-file");
3616
- var import_log13 = require("@dxos/log");
4095
+ var import_log14 = require("@dxos/log");
3617
4096
  function _ts_decorate3(decorators, target, key, desc) {
3618
4097
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3619
4098
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3624,7 +4103,7 @@ function _ts_decorate3(decorators, target, key, desc) {
3624
4103
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3625
4104
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3626
4105
  }
3627
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
4106
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
3628
4107
  var Lock = class {
3629
4108
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
3630
4109
  this._lockPath = lockPath;
@@ -3636,16 +4115,16 @@ var Lock = class {
3636
4115
  }
3637
4116
  async acquire() {
3638
4117
  var _a;
3639
- (0, import_log13.log)("acquiring lock...", void 0, {
3640
- F: __dxlog_file13,
4118
+ (0, import_log14.log)("acquiring lock...", void 0, {
4119
+ F: __dxlog_file16,
3641
4120
  L: 32,
3642
4121
  S: this,
3643
4122
  C: (f, a) => f(...a)
3644
4123
  });
3645
4124
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
3646
4125
  await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
3647
- (0, import_log13.log)("acquired lock", void 0, {
3648
- F: __dxlog_file13,
4126
+ (0, import_log14.log)("acquired lock", void 0, {
4127
+ F: __dxlog_file16,
3649
4128
  L: 37,
3650
4129
  S: this,
3651
4130
  C: (f, a) => f(...a)
@@ -3654,34 +4133,43 @@ var Lock = class {
3654
4133
  async release() {
3655
4134
  var _a;
3656
4135
  await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
3657
- (0, import_tiny_invariant12.default)(this._fileHandle, "Lock is not acquired");
4136
+ (0, import_invariant13.invariant)(this._fileHandle, "Lock is not acquired", {
4137
+ F: __dxlog_file16,
4138
+ L: 42,
4139
+ S: this,
4140
+ A: [
4141
+ "this._fileHandle",
4142
+ "'Lock is not acquired'"
4143
+ ]
4144
+ });
3658
4145
  await import_lock_file.LockFile.release(this._fileHandle);
3659
4146
  }
3660
4147
  };
3661
4148
  _ts_decorate3([
3662
- import_log13.logInfo
4149
+ import_log14.logInfo
3663
4150
  ], Lock.prototype, "lockKey", null);
3664
4151
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
3665
4152
 
3666
4153
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
3667
4154
  var import_async16 = require("@dxos/async");
3668
- var import_codec_protobuf12 = require("@dxos/codec-protobuf");
3669
- var import_log14 = require("@dxos/log");
3670
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
4155
+ var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4156
+ var import_log15 = require("@dxos/log");
4157
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
3671
4158
  var import_util7 = require("@dxos/util");
3672
4159
  var LoggingServiceImpl = class {
3673
4160
  constructor() {
3674
4161
  this._logs = new import_async16.Event();
4162
+ this._started = new Date();
3675
4163
  this._logProcessor = (_config, entry2) => {
3676
4164
  this._logs.emit(entry2);
3677
4165
  };
3678
4166
  }
3679
4167
  async open() {
3680
- import_log14.log.runtimeConfig.processors.push(this._logProcessor);
4168
+ import_log15.log.runtimeConfig.processors.push(this._logProcessor);
3681
4169
  }
3682
4170
  async close() {
3683
- const index = import_log14.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
3684
- import_log14.log.runtimeConfig.processors.splice(index, 1);
4171
+ const index = import_log15.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
4172
+ import_log15.log.runtimeConfig.processors.splice(index, 1);
3685
4173
  }
3686
4174
  async controlMetrics({ reset, record }) {
3687
4175
  if (reset) {
@@ -3696,35 +4184,41 @@ var LoggingServiceImpl = class {
3696
4184
  recording: import_util7.tracer.recording
3697
4185
  };
3698
4186
  }
3699
- queryMetrics({ interval }) {
3700
- const createNumericalValues = (key) => {
4187
+ /**
4188
+ * @deprecated (Move to diagnostics).
4189
+ */
4190
+ queryMetrics({ interval = 5e3 }) {
4191
+ const getNumericalValues = (key) => {
3701
4192
  var _a;
3702
- const consume = (_a = import_util7.tracer.get(key)) != null ? _a : [];
4193
+ const events = (_a = import_util7.tracer.get(key)) != null ? _a : [];
3703
4194
  return {
3704
4195
  key,
3705
- stats: (0, import_util7.numericalValues)(consume, "duration")
4196
+ stats: (0, import_util7.numericalValues)(events, "duration")
3706
4197
  };
3707
4198
  };
3708
- return new import_codec_protobuf12.Stream(({ next }) => {
4199
+ return new import_codec_protobuf13.Stream(({ next }) => {
3709
4200
  const update = () => {
3710
4201
  const metrics = {
3711
4202
  timestamp: new Date(),
3712
4203
  values: [
3713
- createNumericalValues("dxos.echo.pipeline.control"),
3714
- createNumericalValues("dxos.echo.pipeline.data")
3715
- ]
4204
+ getNumericalValues("dxos.echo.pipeline.control"),
4205
+ getNumericalValues("dxos.echo.pipeline.data")
4206
+ ].filter(Boolean)
3716
4207
  };
3717
- next(metrics);
4208
+ next({
4209
+ timestamp: new Date(),
4210
+ metrics
4211
+ });
3718
4212
  };
3719
4213
  update();
3720
- const i = setInterval(update, interval);
4214
+ const i = setInterval(update, Math.max(interval, 1e3));
3721
4215
  return () => {
3722
4216
  clearInterval(i);
3723
4217
  };
3724
4218
  });
3725
4219
  }
3726
4220
  queryLogs(request) {
3727
- return new import_codec_protobuf12.Stream(({ ctx, next }) => {
4221
+ return new import_codec_protobuf13.Stream(({ ctx, next }) => {
3728
4222
  const handler = (entry2) => {
3729
4223
  var _a, _b, _c, _d, _e;
3730
4224
  if (LOG_PROCESSING > 0) {
@@ -3738,7 +4232,7 @@ var LoggingServiceImpl = class {
3738
4232
  }
3739
4233
  const record = {
3740
4234
  ...entry2,
3741
- context: (0, import_util7.jsonify)((0, import_log14.getContextFromEntry)(entry2)),
4235
+ context: (0, import_util7.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
3742
4236
  timestamp: new Date(),
3743
4237
  meta: {
3744
4238
  // TODO(dmaretskyi): Fix proto.
@@ -3759,17 +4253,17 @@ var LoggingServiceImpl = class {
3759
4253
  };
3760
4254
  var matchFilter = (filter, level, path, options) => {
3761
4255
  switch (options) {
3762
- case import_services11.QueryLogsRequest.MatchingOptions.INCLUSIVE:
4256
+ case import_services12.QueryLogsRequest.MatchingOptions.INCLUSIVE:
3763
4257
  return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
3764
- case import_services11.QueryLogsRequest.MatchingOptions.EXPLICIT:
4258
+ case import_services12.QueryLogsRequest.MatchingOptions.EXPLICIT:
3765
4259
  return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
3766
4260
  }
3767
4261
  };
3768
4262
  var shouldLog = (entry2, request) => {
3769
4263
  var _a;
3770
- const options = (_a = request.options) != null ? _a : import_services11.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4264
+ const options = (_a = request.options) != null ? _a : import_services12.QueryLogsRequest.MatchingOptions.INCLUSIVE;
3771
4265
  if (request.filters === void 0) {
3772
- return options === import_services11.QueryLogsRequest.MatchingOptions.INCLUSIVE;
4266
+ return options === import_services12.QueryLogsRequest.MatchingOptions.INCLUSIVE;
3773
4267
  } else {
3774
4268
  return request.filters.some((filter) => {
3775
4269
  var _a2, _b;
@@ -3780,14 +4274,14 @@ var shouldLog = (entry2, request) => {
3780
4274
  var LOG_PROCESSING = 0;
3781
4275
 
3782
4276
  // packages/sdk/client-services/src/packlets/network/network-service.ts
3783
- var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4277
+ var import_codec_protobuf14 = require("@dxos/codec-protobuf");
3784
4278
  var NetworkServiceImpl = class {
3785
4279
  constructor(networkManager, signalManager) {
3786
4280
  this.networkManager = networkManager;
3787
4281
  this.signalManager = signalManager;
3788
4282
  }
3789
4283
  queryStatus() {
3790
- return new import_codec_protobuf13.Stream(({ next }) => {
4284
+ return new import_codec_protobuf14.Stream(({ next }) => {
3791
4285
  const update = () => {
3792
4286
  next({
3793
4287
  swarm: this.networkManager.connectionState,
@@ -3861,12 +4355,15 @@ var toStorageType = (type) => {
3861
4355
  };
3862
4356
 
3863
4357
  // packages/sdk/client-services/src/packlets/system/system-service.ts
3864
- var import_codec_protobuf14 = require("@dxos/codec-protobuf");
4358
+ var import_codec_protobuf15 = require("@dxos/codec-protobuf");
4359
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
4360
+ var import_util9 = require("@dxos/util");
3865
4361
  var SystemServiceImpl = class {
3866
- constructor({ config, statusUpdate, onUpdateStatus, getCurrentStatus, onReset }) {
4362
+ constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
3867
4363
  this._config = config;
3868
4364
  this._statusUpdate = statusUpdate;
3869
4365
  this._getCurrentStatus = getCurrentStatus;
4366
+ this._getDiagnostics = getDiagnostics;
3870
4367
  this._onUpdateStatus = onUpdateStatus;
3871
4368
  this._onReset = onReset;
3872
4369
  }
@@ -3874,12 +4371,25 @@ var SystemServiceImpl = class {
3874
4371
  var _a, _b;
3875
4372
  return (_b = (_a = this._config) == null ? void 0 : _a.values) != null ? _b : {};
3876
4373
  }
4374
+ /**
4375
+ * NOTE: Since this is serialized as a JSON object, we allow the option to serialize keys.
4376
+ */
4377
+ async getDiagnostics({ keys } = {}) {
4378
+ const diagnostics = await this._getDiagnostics();
4379
+ return {
4380
+ timestamp: new Date(),
4381
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util9.jsonKeyReplacer)({
4382
+ truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4383
+ humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4384
+ })))
4385
+ };
4386
+ }
3877
4387
  async updateStatus({ status }) {
3878
4388
  await this._onUpdateStatus(status);
3879
4389
  }
3880
4390
  // TODO(burdon): Standardize interval option in stream request?
3881
4391
  queryStatus({ interval = 3e3 } = {}) {
3882
- return new import_codec_protobuf14.Stream(({ next }) => {
4392
+ return new import_codec_protobuf15.Stream(({ next }) => {
3883
4393
  const update = () => {
3884
4394
  next({
3885
4395
  status: this._getCurrentStatus()
@@ -3934,18 +4444,16 @@ function _ts_decorate4(decorators, target, key, desc) {
3934
4444
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3935
4445
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3936
4446
  }
3937
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4447
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
3938
4448
  var createDefaultModelFactory = () => {
3939
- return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
4449
+ return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
3940
4450
  };
3941
4451
  var ClientServicesHost = class {
3942
4452
  constructor({
3943
4453
  config,
3944
4454
  modelFactory = createDefaultModelFactory(),
3945
- // TODO(burdon): Create ApolloLink abstraction (see Client).
3946
4455
  transportFactory,
3947
4456
  signalManager,
3948
- connectionLog,
3949
4457
  storage,
3950
4458
  // TODO(wittjosiah): Turn this on by default.
3951
4459
  lockKey,
@@ -3978,12 +4486,15 @@ var ClientServicesHost = class {
3978
4486
  this._systemService = new SystemServiceImpl({
3979
4487
  config: this._config,
3980
4488
  statusUpdate: this._statusUpdate,
3981
- getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
4489
+ getCurrentStatus: () => this.isOpen ? import_services14.SystemStatus.ACTIVE : import_services14.SystemStatus.INACTIVE,
4490
+ getDiagnostics: () => {
4491
+ return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
4492
+ },
3982
4493
  onUpdateStatus: async (status) => {
3983
4494
  var _a, _b;
3984
- if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
4495
+ if (!this.isOpen && status === import_services14.SystemStatus.ACTIVE) {
3985
4496
  await ((_a = this._resourceLock) == null ? void 0 : _a.acquire());
3986
- } else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
4497
+ } else if (this.isOpen && status === import_services14.SystemStatus.INACTIVE) {
3987
4498
  await ((_b = this._resourceLock) == null ? void 0 : _b.release());
3988
4499
  }
3989
4500
  },
@@ -3999,6 +4510,12 @@ var ClientServicesHost = class {
3999
4510
  get isOpen() {
4000
4511
  return this._open;
4001
4512
  }
4513
+ get config() {
4514
+ return this._config;
4515
+ }
4516
+ get context() {
4517
+ return this._serviceContext;
4518
+ }
4002
4519
  get serviceRegistry() {
4003
4520
  return this._serviceRegistry;
4004
4521
  }
@@ -4015,9 +4532,31 @@ var ClientServicesHost = class {
4015
4532
  */
4016
4533
  initialize({ config, ...options }) {
4017
4534
  var _a, _b, _c;
4018
- (0, import_tiny_invariant13.default)(!this._open, "service host is open");
4535
+ (0, import_invariant14.invariant)(!this._open, "service host is open", {
4536
+ F: __dxlog_file17,
4537
+ L: 172,
4538
+ S: this,
4539
+ A: [
4540
+ "!this._open",
4541
+ "'service host is open'"
4542
+ ]
4543
+ });
4544
+ import_log16.log.info("initializing...", void 0, {
4545
+ F: __dxlog_file17,
4546
+ L: 173,
4547
+ S: this,
4548
+ C: (f, a) => f(...a)
4549
+ });
4019
4550
  if (config) {
4020
- (0, import_tiny_invariant13.default)(!this._config, "config already set");
4551
+ (0, import_invariant14.invariant)(!this._config, "config already set", {
4552
+ F: __dxlog_file17,
4553
+ L: 176,
4554
+ S: this,
4555
+ A: [
4556
+ "!this._config",
4557
+ "'config already set'"
4558
+ ]
4559
+ });
4021
4560
  this._config = config;
4022
4561
  if (!this._storage) {
4023
4562
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
@@ -4027,12 +4566,26 @@ var ClientServicesHost = class {
4027
4566
  iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
4028
4567
  }), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
4029
4568
  this._signalManager = signalManager;
4030
- (0, import_tiny_invariant13.default)(!this._networkManager, "network manager already set");
4569
+ (0, import_invariant14.invariant)(!this._networkManager, "network manager already set", {
4570
+ F: __dxlog_file17,
4571
+ L: 192,
4572
+ S: this,
4573
+ A: [
4574
+ "!this._networkManager",
4575
+ "'network manager already set'"
4576
+ ]
4577
+ });
4031
4578
  this._networkManager = new import_network_manager2.NetworkManager({
4032
4579
  log: connectionLog,
4033
4580
  transportFactory,
4034
4581
  signalManager
4035
4582
  });
4583
+ import_log16.log.info("initialized", void 0, {
4584
+ F: __dxlog_file17,
4585
+ L: 199,
4586
+ S: this,
4587
+ C: (f, a) => f(...a)
4588
+ });
4036
4589
  }
4037
4590
  async open() {
4038
4591
  var _a, _b, _c;
@@ -4040,24 +4593,56 @@ var ClientServicesHost = class {
4040
4593
  return;
4041
4594
  }
4042
4595
  const traceId = import_keys11.PublicKey.random().toHex();
4043
- import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
4596
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.begin({
4044
4597
  id: traceId
4045
4598
  }), {
4046
- F: __dxlog_file14,
4047
- L: 203,
4599
+ F: __dxlog_file17,
4600
+ L: 209,
4048
4601
  S: this,
4049
4602
  C: (f, a) => f(...a)
4050
4603
  });
4051
- (0, import_tiny_invariant13.default)(this._config, "config not set");
4052
- (0, import_tiny_invariant13.default)(this._storage, "storage not set");
4053
- (0, import_tiny_invariant13.default)(this._signalManager, "signal manager not set");
4054
- (0, import_tiny_invariant13.default)(this._networkManager, "network manager not set");
4604
+ (0, import_invariant14.invariant)(this._config, "config not set", {
4605
+ F: __dxlog_file17,
4606
+ L: 211,
4607
+ S: this,
4608
+ A: [
4609
+ "this._config",
4610
+ "'config not set'"
4611
+ ]
4612
+ });
4613
+ (0, import_invariant14.invariant)(this._storage, "storage not set", {
4614
+ F: __dxlog_file17,
4615
+ L: 212,
4616
+ S: this,
4617
+ A: [
4618
+ "this._storage",
4619
+ "'storage not set'"
4620
+ ]
4621
+ });
4622
+ (0, import_invariant14.invariant)(this._signalManager, "signal manager not set", {
4623
+ F: __dxlog_file17,
4624
+ L: 213,
4625
+ S: this,
4626
+ A: [
4627
+ "this._signalManager",
4628
+ "'signal manager not set'"
4629
+ ]
4630
+ });
4631
+ (0, import_invariant14.invariant)(this._networkManager, "network manager not set", {
4632
+ F: __dxlog_file17,
4633
+ L: 214,
4634
+ S: this,
4635
+ A: [
4636
+ "this._networkManager",
4637
+ "'network manager not set'"
4638
+ ]
4639
+ });
4055
4640
  this._opening = true;
4056
- (0, import_log15.log)("opening...", {
4641
+ import_log16.log.info("opening...", {
4057
4642
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
4058
4643
  }, {
4059
- F: __dxlog_file14,
4060
- L: 211,
4644
+ F: __dxlog_file17,
4645
+ L: 217,
4061
4646
  S: this,
4062
4647
  C: (f, a) => f(...a)
4063
4648
  });
@@ -4088,19 +4673,19 @@ var ClientServicesHost = class {
4088
4673
  this._open = true;
4089
4674
  this._statusUpdate.emit();
4090
4675
  const deviceKey = (_c = this._serviceContext.identityManager.identity) == null ? void 0 : _c.deviceKey;
4091
- (0, import_log15.log)("opened", {
4676
+ import_log16.log.info("opened", {
4092
4677
  deviceKey
4093
4678
  }, {
4094
- F: __dxlog_file14,
4095
- L: 266,
4679
+ F: __dxlog_file17,
4680
+ L: 269,
4096
4681
  S: this,
4097
4682
  C: (f, a) => f(...a)
4098
4683
  });
4099
- import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
4684
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols10.trace.end({
4100
4685
  id: traceId
4101
4686
  }), {
4102
- F: __dxlog_file14,
4103
- L: 267,
4687
+ F: __dxlog_file17,
4688
+ L: 270,
4104
4689
  S: this,
4105
4690
  C: (f, a) => f(...a)
4106
4691
  });
@@ -4111,11 +4696,11 @@ var ClientServicesHost = class {
4111
4696
  return;
4112
4697
  }
4113
4698
  const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
4114
- (0, import_log15.log)("closing...", {
4699
+ import_log16.log.info("closing...", {
4115
4700
  deviceKey
4116
4701
  }, {
4117
- F: __dxlog_file14,
4118
- L: 277,
4702
+ F: __dxlog_file17,
4703
+ L: 280,
4119
4704
  S: this,
4120
4705
  C: (f, a) => f(...a)
4121
4706
  });
@@ -4126,11 +4711,11 @@ var ClientServicesHost = class {
4126
4711
  await this._serviceContext.close();
4127
4712
  this._open = false;
4128
4713
  this._statusUpdate.emit();
4129
- (0, import_log15.log)("closed", {
4714
+ import_log16.log.info("closed", {
4130
4715
  deviceKey
4131
4716
  }, {
4132
- F: __dxlog_file14,
4133
- L: 283,
4717
+ F: __dxlog_file17,
4718
+ L: 286,
4134
4719
  S: this,
4135
4720
  C: (f, a) => f(...a)
4136
4721
  });
@@ -4138,33 +4723,33 @@ var ClientServicesHost = class {
4138
4723
  async reset() {
4139
4724
  var _a, _b, _c;
4140
4725
  const traceId = import_keys11.PublicKey.random().toHex();
4141
- import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
4726
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.begin({
4142
4727
  id: traceId
4143
4728
  }), {
4144
- F: __dxlog_file14,
4145
- L: 288,
4729
+ F: __dxlog_file17,
4730
+ L: 291,
4146
4731
  S: this,
4147
4732
  C: (f, a) => f(...a)
4148
4733
  });
4149
- (0, import_log15.log)("resetting...", void 0, {
4150
- F: __dxlog_file14,
4151
- L: 290,
4734
+ (0, import_log16.log)("resetting...", void 0, {
4735
+ F: __dxlog_file17,
4736
+ L: 293,
4152
4737
  S: this,
4153
4738
  C: (f, a) => f(...a)
4154
4739
  });
4155
4740
  await ((_a = this._serviceContext) == null ? void 0 : _a.close());
4156
4741
  await this._storage.reset();
4157
- (0, import_log15.log)("reset", void 0, {
4158
- F: __dxlog_file14,
4159
- L: 293,
4742
+ (0, import_log16.log)("reset", void 0, {
4743
+ F: __dxlog_file17,
4744
+ L: 296,
4160
4745
  S: this,
4161
4746
  C: (f, a) => f(...a)
4162
4747
  });
4163
- import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
4748
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols10.trace.end({
4164
4749
  id: traceId
4165
4750
  }), {
4166
- F: __dxlog_file14,
4167
- L: 294,
4751
+ F: __dxlog_file17,
4752
+ L: 297,
4168
4753
  S: this,
4169
4754
  C: (f, a) => f(...a)
4170
4755
  });
@@ -4181,17 +4766,18 @@ _ts_decorate4([
4181
4766
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4182
4767
  var import_async19 = require("@dxos/async");
4183
4768
  var import_client_protocol7 = require("@dxos/client-protocol");
4184
- var import_log16 = require("@dxos/log");
4769
+ var import_log17 = require("@dxos/log");
4185
4770
  var import_messaging2 = require("@dxos/messaging");
4186
4771
  var import_network_manager3 = require("@dxos/network-manager");
4187
- var import_util9 = require("@dxos/util");
4772
+ var import_util10 = require("@dxos/util");
4188
4773
 
4189
4774
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4190
- var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
4191
4775
  var import_async18 = require("@dxos/async");
4192
4776
  var import_client_protocol6 = require("@dxos/client-protocol");
4777
+ var import_invariant15 = require("@dxos/invariant");
4193
4778
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
4194
4779
  var import_rpc2 = require("@dxos/rpc");
4780
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
4195
4781
  var ShellRuntimeImpl = class {
4196
4782
  constructor(_port) {
4197
4783
  this._port = _port;
@@ -4217,7 +4803,15 @@ var ShellRuntimeImpl = class {
4217
4803
  });
4218
4804
  }
4219
4805
  async setAppContext(context) {
4220
- (0, import_tiny_invariant14.default)(this._appRpc, "runtime not open");
4806
+ (0, import_invariant15.invariant)(this._appRpc, "runtime not open", {
4807
+ F: __dxlog_file18,
4808
+ L: 44,
4809
+ S: this,
4810
+ A: [
4811
+ "this._appRpc",
4812
+ "'runtime not open'"
4813
+ ]
4814
+ });
4221
4815
  await this._appRpc.rpc.AppService.setContext(context);
4222
4816
  }
4223
4817
  async open() {
@@ -4256,7 +4850,7 @@ function _ts_decorate5(decorators, target, key, desc) {
4256
4850
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4257
4851
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4258
4852
  }
4259
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
4853
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
4260
4854
  var LOCK_KEY = "DXOS_RESOURCE_LOCK";
4261
4855
  var IFrameHostRuntime = class {
4262
4856
  constructor({ config, origin, appPort, shellPort }) {
@@ -4277,14 +4871,14 @@ var IFrameHostRuntime = class {
4277
4871
  }
4278
4872
  async start() {
4279
4873
  var _a;
4280
- (0, import_log16.log)("starting...", void 0, {
4281
- F: __dxlog_file15,
4874
+ (0, import_log17.log)("starting...", void 0, {
4875
+ F: __dxlog_file19,
4282
4876
  L: 70,
4283
4877
  S: this,
4284
4878
  C: (f, a) => f(...a)
4285
4879
  });
4286
4880
  try {
4287
- this._config = await (0, import_util9.getAsyncValue)(this._configProvider);
4881
+ this._config = await (0, import_util10.getAsyncValue)(this._configProvider);
4288
4882
  this._transportFactory = (0, import_network_manager3.createWebRTCTransportFactory)({
4289
4883
  iceServers: this._config.get("runtime.services.ice")
4290
4884
  });
@@ -4326,16 +4920,16 @@ var IFrameHostRuntime = class {
4326
4920
  (_a = this._shellRuntime) == null ? void 0 : _a.open()
4327
4921
  ]);
4328
4922
  this._ready.wake(void 0);
4329
- (0, import_log16.log)("started", void 0, {
4330
- F: __dxlog_file15,
4923
+ (0, import_log17.log)("started", void 0, {
4924
+ F: __dxlog_file19,
4331
4925
  L: 113,
4332
4926
  S: this,
4333
4927
  C: (f, a) => f(...a)
4334
4928
  });
4335
4929
  } catch (err) {
4336
4930
  this._ready.wake(err);
4337
- import_log16.log.catch(err, void 0, {
4338
- F: __dxlog_file15,
4931
+ import_log17.log.catch(err, void 0, {
4932
+ F: __dxlog_file19,
4339
4933
  L: 116,
4340
4934
  S: this,
4341
4935
  C: (f, a) => f(...a)
@@ -4344,8 +4938,8 @@ var IFrameHostRuntime = class {
4344
4938
  }
4345
4939
  async stop() {
4346
4940
  var _a;
4347
- (0, import_log16.log)("stopping...", void 0, {
4348
- F: __dxlog_file15,
4941
+ (0, import_log17.log)("stopping...", void 0, {
4942
+ F: __dxlog_file19,
4349
4943
  L: 121,
4350
4944
  S: this,
4351
4945
  C: (f, a) => f(...a)
@@ -4353,8 +4947,8 @@ var IFrameHostRuntime = class {
4353
4947
  await this._clientRpc.close();
4354
4948
  await this._clientServices.close();
4355
4949
  await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
4356
- (0, import_log16.log)("stopped", void 0, {
4357
- F: __dxlog_file15,
4950
+ (0, import_log17.log)("stopped", void 0, {
4951
+ F: __dxlog_file19,
4358
4952
  L: 125,
4359
4953
  S: this,
4360
4954
  C: (f, a) => f(...a)
@@ -4362,18 +4956,18 @@ var IFrameHostRuntime = class {
4362
4956
  }
4363
4957
  };
4364
4958
  _ts_decorate5([
4365
- import_log16.logInfo
4959
+ import_log17.logInfo
4366
4960
  ], IFrameHostRuntime.prototype, "origin", void 0);
4367
4961
 
4368
4962
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
4369
4963
  var import_async20 = require("@dxos/async");
4370
4964
  var import_client_protocol8 = require("@dxos/client-protocol");
4371
4965
  var import_errors6 = require("@dxos/errors");
4372
- var import_log17 = require("@dxos/log");
4966
+ var import_log18 = require("@dxos/log");
4373
4967
  var import_network_manager4 = require("@dxos/network-manager");
4374
4968
  var import_rpc3 = require("@dxos/rpc");
4375
- var import_util10 = require("@dxos/util");
4376
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
4969
+ var import_util11 = require("@dxos/util");
4970
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
4377
4971
  var IFrameProxyRuntime = class {
4378
4972
  constructor({ config, systemPort, shellPort }) {
4379
4973
  this._id = String(Math.floor(Math.random() * 1e6));
@@ -4390,7 +4984,7 @@ var IFrameProxyRuntime = class {
4390
4984
  }
4391
4985
  async open(origin) {
4392
4986
  var _a;
4393
- this._config = await (0, import_util10.getAsyncValue)(this._configProvider);
4987
+ this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
4394
4988
  this._transportService = new import_network_manager4.WebRTCTransportService({
4395
4989
  iceServers: this._config.get("runtime.services.ice")
4396
4990
  });
@@ -4421,8 +5015,8 @@ var IFrameProxyRuntime = class {
4421
5015
  lockKey
4422
5016
  });
4423
5017
  } catch (err) {
4424
- import_log17.log.catch(err, void 0, {
4425
- F: __dxlog_file16,
5018
+ import_log18.log.catch(err, void 0, {
5019
+ F: __dxlog_file20,
4426
5020
  L: 85,
4427
5021
  S: this,
4428
5022
  C: (f, a) => f(...a)
@@ -4445,17 +5039,17 @@ var IFrameProxyRuntime = class {
4445
5039
 
4446
5040
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
4447
5041
  var import_async22 = require("@dxos/async");
4448
- var import_log19 = require("@dxos/log");
5042
+ var import_log20 = require("@dxos/log");
4449
5043
  var import_messaging3 = require("@dxos/messaging");
4450
5044
  var import_network_manager5 = require("@dxos/network-manager");
4451
5045
 
4452
5046
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
4453
- var import_tiny_invariant15 = __toESM(require("tiny-invariant"));
4454
5047
  var import_async21 = require("@dxos/async");
4455
5048
  var import_client_protocol9 = require("@dxos/client-protocol");
4456
- var import_log18 = require("@dxos/log");
5049
+ var import_invariant16 = require("@dxos/invariant");
5050
+ var import_log19 = require("@dxos/log");
4457
5051
  var import_rpc4 = require("@dxos/rpc");
4458
- var import_util11 = require("@dxos/util");
5052
+ var import_util12 = require("@dxos/util");
4459
5053
  function _ts_decorate6(decorators, target, key, desc) {
4460
5054
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4461
5055
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -4466,12 +5060,20 @@ function _ts_decorate6(decorators, target, key, desc) {
4466
5060
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4467
5061
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4468
5062
  }
4469
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
5063
+ var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
4470
5064
  var WorkerSession = class {
4471
5065
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
4472
5066
  this._startTrigger = new import_async21.Trigger();
4473
- this.onClose = new import_util11.Callback();
4474
- (0, import_tiny_invariant15.default)(serviceHost);
5067
+ this.onClose = new import_util12.Callback();
5068
+ (0, import_invariant16.invariant)(serviceHost, void 0, {
5069
+ F: __dxlog_file21,
5070
+ L: 49,
5071
+ S: this,
5072
+ A: [
5073
+ "serviceHost",
5074
+ ""
5075
+ ]
5076
+ });
4475
5077
  this._serviceHost = serviceHost;
4476
5078
  const middleware = {
4477
5079
  handleCall: async (method, params, handler) => {
@@ -4518,8 +5120,8 @@ var WorkerSession = class {
4518
5120
  try {
4519
5121
  await this.close();
4520
5122
  } catch (err) {
4521
- import_log18.log.catch(err, void 0, {
4522
- F: __dxlog_file17,
5123
+ import_log19.log.catch(err, void 0, {
5124
+ F: __dxlog_file21,
4523
5125
  L: 99,
4524
5126
  S: this,
4525
5127
  C: (f, a) => f(...a)
@@ -4535,8 +5137,8 @@ var WorkerSession = class {
4535
5137
  this.bridgeService = this._iframeRpc.rpc.BridgeService;
4536
5138
  }
4537
5139
  async open() {
4538
- import_log18.log.info("opening...", void 0, {
4539
- F: __dxlog_file17,
5140
+ import_log19.log.info("opening...", void 0, {
5141
+ F: __dxlog_file21,
4540
5142
  L: 113,
4541
5143
  S: this,
4542
5144
  C: (f, a) => f(...a)
@@ -4552,26 +5154,26 @@ var WorkerSession = class {
4552
5154
  if (this.lockKey) {
4553
5155
  void this._afterLockReleases(this.lockKey, () => this.close());
4554
5156
  }
4555
- import_log18.log.info("opened", void 0, {
4556
- F: __dxlog_file17,
4557
- L: 120,
5157
+ import_log19.log.info("opened", void 0, {
5158
+ F: __dxlog_file21,
5159
+ L: 124,
4558
5160
  S: this,
4559
5161
  C: (f, a) => f(...a)
4560
5162
  });
4561
5163
  }
4562
5164
  async close() {
4563
- import_log18.log.info("closing...", void 0, {
4564
- F: __dxlog_file17,
4565
- L: 124,
5165
+ import_log19.log.info("closing...", void 0, {
5166
+ F: __dxlog_file21,
5167
+ L: 128,
4566
5168
  S: this,
4567
5169
  C: (f, a) => f(...a)
4568
5170
  });
4569
5171
  try {
4570
5172
  await this.onClose.callIfSet();
4571
5173
  } catch (err) {
4572
- import_log18.log.catch(err, void 0, {
4573
- F: __dxlog_file17,
4574
- L: 128,
5174
+ import_log19.log.catch(err, void 0, {
5175
+ F: __dxlog_file21,
5176
+ L: 132,
4575
5177
  S: this,
4576
5178
  C: (f, a) => f(...a)
4577
5179
  });
@@ -4580,9 +5182,9 @@ var WorkerSession = class {
4580
5182
  this._clientRpc.close(),
4581
5183
  this._iframeRpc.close()
4582
5184
  ]);
4583
- import_log18.log.info("closed", void 0, {
4584
- F: __dxlog_file17,
4585
- L: 132,
5185
+ import_log19.log.info("closed", void 0, {
5186
+ F: __dxlog_file21,
5187
+ L: 136,
4586
5188
  S: this,
4587
5189
  C: (f, a) => f(...a)
4588
5190
  });
@@ -4591,9 +5193,9 @@ var WorkerSession = class {
4591
5193
  try {
4592
5194
  await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
4593
5195
  } catch (e) {
4594
- import_log18.log.info("No shell connected.", void 0, {
4595
- F: __dxlog_file17,
4596
- L: 139,
5196
+ import_log19.log.info("No shell connected.", void 0, {
5197
+ F: __dxlog_file21,
5198
+ L: 143,
4597
5199
  S: this,
4598
5200
  C: (f, a) => f(...a)
4599
5201
  });
@@ -4605,14 +5207,14 @@ var WorkerSession = class {
4605
5207
  }
4606
5208
  };
4607
5209
  _ts_decorate6([
4608
- import_log18.logInfo
5210
+ import_log19.logInfo
4609
5211
  ], WorkerSession.prototype, "origin", void 0);
4610
5212
  _ts_decorate6([
4611
- import_log18.logInfo
5213
+ import_log19.logInfo
4612
5214
  ], WorkerSession.prototype, "lockKey", void 0);
4613
5215
 
4614
5216
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
4615
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
5217
+ var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
4616
5218
  var WorkerRuntime = class {
4617
5219
  // prettier-ignore
4618
5220
  constructor(_configProvider) {
@@ -4632,8 +5234,8 @@ var WorkerRuntime = class {
4632
5234
  return this._clientServices;
4633
5235
  }
4634
5236
  async start() {
4635
- (0, import_log19.log)("starting...", void 0, {
4636
- F: __dxlog_file18,
5237
+ (0, import_log20.log)("starting...", void 0, {
5238
+ F: __dxlog_file22,
4637
5239
  L: 48,
4638
5240
  S: this,
4639
5241
  C: (f, a) => f(...a)
@@ -4648,16 +5250,16 @@ var WorkerRuntime = class {
4648
5250
  });
4649
5251
  await this._clientServices.open();
4650
5252
  this._ready.wake(void 0);
4651
- (0, import_log19.log)("started", void 0, {
4652
- F: __dxlog_file18,
5253
+ (0, import_log20.log)("started", void 0, {
5254
+ F: __dxlog_file22,
4653
5255
  L: 62,
4654
5256
  S: this,
4655
5257
  C: (f, a) => f(...a)
4656
5258
  });
4657
5259
  } catch (err) {
4658
5260
  this._ready.wake(err);
4659
- import_log19.log.catch(err, void 0, {
4660
- F: __dxlog_file18,
5261
+ import_log20.log.catch(err, void 0, {
5262
+ F: __dxlog_file22,
4661
5263
  L: 65,
4662
5264
  S: this,
4663
5265
  C: (f, a) => f(...a)
@@ -4690,8 +5292,8 @@ var WorkerRuntime = class {
4690
5292
  * Selects one of the existing session fro WebRTC networking.
4691
5293
  */
4692
5294
  _reconnectWebrtc() {
4693
- (0, import_log19.log)("reconnecting webrtc...", void 0, {
4694
- F: __dxlog_file18,
5295
+ (0, import_log20.log)("reconnecting webrtc...", void 0, {
5296
+ F: __dxlog_file22,
4695
5297
  L: 102,
4696
5298
  S: this,
4697
5299
  C: (f, a) => f(...a)
@@ -4739,6 +5341,7 @@ var WorkerRuntime = class {
4739
5341
  WorkerSession,
4740
5342
  createAuthProvider,
4741
5343
  createDefaultModelFactory,
5344
+ createDiagnostics,
4742
5345
  createStorageObjects,
4743
5346
  getNetworkPeers,
4744
5347
  isLocked,