@dxos/client-services 0.1.53-main.e7b89d1 → 0.1.53-main.f5aedb7

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 (48) hide show
  1. package/dist/lib/browser/{chunk-BSRQYPXL.mjs → chunk-PWZ2J6KS.mjs} +650 -626
  2. package/dist/lib/browser/chunk-PWZ2J6KS.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +101 -120
  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 +6 -6
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +720 -717
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +624 -602
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/services/service-host.d.ts +7 -1
  14. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  15. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  16. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +1 -1
  17. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  18. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +1 -1
  19. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
  20. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -21
  21. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  22. package/package.json +33 -32
  23. package/src/packlets/identity/identity-manager.test.ts +1 -1
  24. package/src/packlets/identity/identity-manager.ts +8 -8
  25. package/src/packlets/identity/identity-service.ts +2 -2
  26. package/src/packlets/identity/identity.test.ts +1 -1
  27. package/src/packlets/identity/identity.ts +2 -2
  28. package/src/packlets/invitations/device-invitation-protocol.ts +4 -4
  29. package/src/packlets/invitations/invitation-extension.ts +5 -5
  30. package/src/packlets/invitations/invitations-handler.ts +6 -6
  31. package/src/packlets/invitations/invitations-service.ts +3 -3
  32. package/src/packlets/invitations/space-invitation-protocol.ts +9 -9
  33. package/src/packlets/locks/node.ts +2 -2
  34. package/src/packlets/logging/logging-service.ts +4 -4
  35. package/src/packlets/services/service-context.test.ts +1 -1
  36. package/src/packlets/services/service-context.ts +3 -3
  37. package/src/packlets/services/service-host.test.ts +50 -2
  38. package/src/packlets/services/service-host.ts +25 -9
  39. package/src/packlets/spaces/data-space-manager.ts +5 -5
  40. package/src/packlets/spaces/notarization-plugin.ts +4 -4
  41. package/src/packlets/testing/invitation-utils.ts +2 -2
  42. package/src/packlets/testing/test-builder.ts +1 -2
  43. package/src/packlets/vault/iframe-host-runtime.ts +2 -2
  44. package/src/packlets/vault/iframe-proxy-runtime.ts +2 -2
  45. package/src/packlets/vault/shell-runtime.ts +3 -49
  46. package/src/packlets/vault/worker-runtime.ts +1 -1
  47. package/src/packlets/vault/worker-session.ts +2 -2
  48. package/dist/lib/browser/chunk-BSRQYPXL.mjs.map +0 -7
@@ -44,7 +44,6 @@ __export(src_exports, {
44
44
  InvitationsHandler: () => InvitationsHandler,
45
45
  InvitationsServiceImpl: () => InvitationsServiceImpl,
46
46
  Lock: () => Lock,
47
- MemoryShellRuntime: () => MemoryShellRuntime,
48
47
  ServiceContext: () => ServiceContext,
49
48
  ServiceRegistry: () => ServiceRegistry,
50
49
  ShellRuntimeImpl: () => ShellRuntimeImpl,
@@ -54,6 +53,7 @@ __export(src_exports, {
54
53
  WorkerRuntime: () => WorkerRuntime,
55
54
  WorkerSession: () => WorkerSession,
56
55
  createAuthProvider: () => createAuthProvider,
56
+ createDefaultModelFactory: () => createDefaultModelFactory,
57
57
  createStorageObjects: () => createStorageObjects,
58
58
  getNetworkPeers: () => getNetworkPeers,
59
59
  isLocked: () => isLocked,
@@ -419,6 +419,7 @@ var import_context2 = require("@dxos/context");
419
419
  var import_credentials = require("@dxos/credentials");
420
420
  var import_log = require("@dxos/log");
421
421
  var import_protocols = require("@dxos/protocols");
422
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
422
423
  var createAuthProvider = (signer) => async (nonce) => {
423
424
  const credential = await signer.createCredential({
424
425
  assertion: {
@@ -444,20 +445,20 @@ var TrustedKeySetAuthVerifier = class {
444
445
  (0, import_log.log)("authenticating...", {
445
446
  credential
446
447
  }, {
447
- file: "authenticator.ts",
448
- line: 57,
449
- scope: this,
450
- callSite: (f, a) => f(...a)
448
+ F: __dxlog_file,
449
+ L: 57,
450
+ S: this,
451
+ C: (f, a) => f(...a)
451
452
  });
452
453
  const result = await (0, import_credentials.verifyCredential)(credential);
453
454
  if (result.kind === "fail") {
454
455
  (0, import_log.log)("Invalid credential", {
455
456
  result
456
457
  }, {
457
- file: "authenticator.ts",
458
- line: 61,
459
- scope: this,
460
- callSite: (f, a) => f(...a)
458
+ F: __dxlog_file,
459
+ L: 61,
460
+ S: this,
461
+ C: (f, a) => f(...a)
461
462
  });
462
463
  return false;
463
464
  }
@@ -466,10 +467,10 @@ var TrustedKeySetAuthVerifier = class {
466
467
  nonce,
467
468
  credential
468
469
  }, {
469
- file: "authenticator.ts",
470
- line: 66,
471
- scope: this,
472
- callSite: (f, a) => f(...a)
470
+ F: __dxlog_file,
471
+ L: 66,
472
+ S: this,
473
+ C: (f, a) => f(...a)
473
474
  });
474
475
  return false;
475
476
  }
@@ -477,10 +478,10 @@ var TrustedKeySetAuthVerifier = class {
477
478
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
478
479
  key: credential.issuer
479
480
  }, {
480
- file: "authenticator.ts",
481
- line: 71,
482
- scope: this,
483
- callSite: (f, a) => f(...a)
481
+ F: __dxlog_file,
482
+ L: 71,
483
+ S: this,
484
+ C: (f, a) => f(...a)
484
485
  });
485
486
  return true;
486
487
  }
@@ -493,20 +494,20 @@ var TrustedKeySetAuthVerifier = class {
493
494
  (0, import_log.log)("auth success", {
494
495
  key: credential.issuer
495
496
  }, {
496
- file: "authenticator.ts",
497
- line: 82,
498
- scope: this,
499
- callSite: (f, a) => f(...a)
497
+ F: __dxlog_file,
498
+ L: 82,
499
+ S: this,
500
+ C: (f, a) => f(...a)
500
501
  });
501
502
  trigger.wake(true);
502
503
  } else {
503
504
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
504
505
  key: credential.issuer
505
506
  }, {
506
- file: "authenticator.ts",
507
- line: 85,
508
- scope: this,
509
- callSite: (f, a) => f(...a)
507
+ F: __dxlog_file,
508
+ L: 85,
509
+ S: this,
510
+ C: (f, a) => f(...a)
510
511
  });
511
512
  }
512
513
  });
@@ -528,7 +529,7 @@ var TrustedKeySetAuthVerifier = class {
528
529
  };
529
530
 
530
531
  // packages/sdk/client-services/src/packlets/identity/identity.ts
531
- var import_node_assert = __toESM(require("node:assert"));
532
+ var import_tiny_invariant = __toESM(require("tiny-invariant"));
532
533
  var import_async5 = require("@dxos/async");
533
534
  var import_client_protocol = require("@dxos/client-protocol");
534
535
  var import_credentials2 = require("@dxos/credentials");
@@ -536,6 +537,7 @@ var import_debug = require("@dxos/debug");
536
537
  var import_feed_store2 = require("@dxos/feed-store");
537
538
  var import_log2 = require("@dxos/log");
538
539
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
540
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
539
541
  var Identity = class {
540
542
  constructor({ space, signer, identityKey, deviceKey }) {
541
543
  this.stateUpdate = new import_async5.Event();
@@ -610,7 +612,7 @@ var Identity = class {
610
612
  * Requires identity to be ready.
611
613
  */
612
614
  getIdentityCredentialSigner() {
613
- (0, import_node_assert.default)(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
615
+ (0, import_tiny_invariant.default)(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
614
616
  return (0, import_credentials2.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.processor.deviceCredentialChain, this.deviceKey);
615
617
  }
616
618
  /**
@@ -627,10 +629,10 @@ var Identity = class {
627
629
  controlFeedKey,
628
630
  dataFeedKey
629
631
  }, {
630
- file: "identity.ts",
631
- line: 156,
632
- scope: this,
633
- callSite: (f, a) => f(...a)
632
+ F: __dxlog_file2,
633
+ L: 156,
634
+ S: this,
635
+ C: (f, a) => f(...a)
634
636
  });
635
637
  const signer = this.getIdentityCredentialSigner();
636
638
  await (0, import_feed_store2.writeMessages)(this.controlPipeline.writer, [
@@ -671,7 +673,7 @@ var Identity = class {
671
673
  };
672
674
 
673
675
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
674
- var import_node_assert2 = __toESM(require("node:assert"));
676
+ var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
675
677
  var import_async6 = require("@dxos/async");
676
678
  var import_credentials4 = require("@dxos/credentials");
677
679
  var import_keys4 = require("@dxos/keys");
@@ -679,6 +681,7 @@ var import_log3 = require("@dxos/log");
679
681
  var import_protocols2 = require("@dxos/protocols");
680
682
  var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
681
683
  var import_util2 = require("@dxos/util");
684
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
682
685
  var IdentityManager = class {
683
686
  // TODO(burdon): IdentityManagerParams.
684
687
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
@@ -698,20 +701,20 @@ var IdentityManager = class {
698
701
  import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
699
702
  id: traceId
700
703
  }), {
701
- file: "identity-manager.ts",
702
- line: 70,
703
- scope: this,
704
- callSite: (f, a) => f(...a)
704
+ F: __dxlog_file3,
705
+ L: 70,
706
+ S: this,
707
+ C: (f, a) => f(...a)
705
708
  });
706
709
  await this._metadataStore.load();
707
710
  const identityRecord = this._metadataStore.getIdentityRecord();
708
711
  (0, import_log3.log)("identity record", {
709
712
  identityRecord
710
713
  }, {
711
- file: "identity-manager.ts",
712
- line: 74,
713
- scope: this,
714
- callSite: (f, a) => f(...a)
714
+ F: __dxlog_file3,
715
+ L: 74,
716
+ S: this,
717
+ C: (f, a) => f(...a)
715
718
  });
716
719
  if (identityRecord) {
717
720
  this._identity = await this._constructIdentity(identityRecord);
@@ -721,20 +724,20 @@ var IdentityManager = class {
721
724
  identityKey: identityRecord.identityKey,
722
725
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
723
726
  }, {
724
- file: "identity-manager.ts",
725
- line: 79,
726
- scope: this,
727
- callSite: (f, a) => f(...a)
727
+ F: __dxlog_file3,
728
+ L: 79,
729
+ S: this,
730
+ C: (f, a) => f(...a)
728
731
  });
729
732
  this.stateUpdate.emit();
730
733
  }
731
734
  import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.end({
732
735
  id: traceId
733
736
  }), {
734
- file: "identity-manager.ts",
735
- line: 85,
736
- scope: this,
737
- callSite: (f, a) => f(...a)
737
+ F: __dxlog_file3,
738
+ L: 85,
739
+ S: this,
740
+ C: (f, a) => f(...a)
738
741
  });
739
742
  }
740
743
  async close() {
@@ -743,12 +746,12 @@ var IdentityManager = class {
743
746
  }
744
747
  async createIdentity({ displayName } = {}) {
745
748
  var _a;
746
- (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
747
- (0, import_log3.log)("creating identity...", {}, {
748
- file: "identity-manager.ts",
749
- line: 94,
750
- scope: this,
751
- callSite: (f, a) => f(...a)
749
+ (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
750
+ (0, import_log3.log)("creating identity...", void 0, {
751
+ F: __dxlog_file3,
752
+ L: 94,
753
+ S: this,
754
+ C: (f, a) => f(...a)
752
755
  });
753
756
  const controlFeedKey = await this._keyring.createKey();
754
757
  const identityRecord = {
@@ -765,8 +768,8 @@ var IdentityManager = class {
765
768
  await identity.open();
766
769
  {
767
770
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
768
- (0, import_node_assert2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
769
- (0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
771
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
772
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
770
773
  const credentials = [
771
774
  // Space genesis.
772
775
  ...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
@@ -794,20 +797,20 @@ var IdentityManager = class {
794
797
  identityKey: identityRecord.identityKey,
795
798
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
796
799
  }, {
797
- file: "identity-manager.ts",
798
- line: 149,
799
- scope: this,
800
- callSite: (f, a) => f(...a)
800
+ F: __dxlog_file3,
801
+ L: 149,
802
+ S: this,
803
+ C: (f, a) => f(...a)
801
804
  });
802
805
  this.stateUpdate.emit();
803
806
  (0, import_log3.log)("created identity", {
804
807
  identityKey: identity.identityKey,
805
808
  deviceKey: identity.deviceKey
806
809
  }, {
807
- file: "identity-manager.ts",
808
- line: 155,
809
- scope: this,
810
- callSite: (f, a) => f(...a)
810
+ F: __dxlog_file3,
811
+ L: 155,
812
+ S: this,
813
+ C: (f, a) => f(...a)
811
814
  });
812
815
  return identity;
813
816
  }
@@ -819,12 +822,12 @@ var IdentityManager = class {
819
822
  (0, import_log3.log)("accepting identity", {
820
823
  params
821
824
  }, {
822
- file: "identity-manager.ts",
823
- line: 163,
824
- scope: this,
825
- callSite: (f, a) => f(...a)
825
+ F: __dxlog_file3,
826
+ L: 163,
827
+ S: this,
828
+ C: (f, a) => f(...a)
826
829
  });
827
- (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
830
+ (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
828
831
  const identityRecord = {
829
832
  identityKey: params.identityKey,
830
833
  deviceKey: params.deviceKey,
@@ -845,38 +848,38 @@ var IdentityManager = class {
845
848
  identityKey: identityRecord.identityKey,
846
849
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
847
850
  }, {
848
- file: "identity-manager.ts",
849
- line: 183,
850
- scope: this,
851
- callSite: (f, a) => f(...a)
851
+ F: __dxlog_file3,
852
+ L: 183,
853
+ S: this,
854
+ C: (f, a) => f(...a)
852
855
  });
853
856
  this.stateUpdate.emit();
854
857
  (0, import_log3.log)("accepted identity", {
855
858
  identityKey: identity.identityKey,
856
859
  deviceKey: identity.deviceKey
857
860
  }, {
858
- file: "identity-manager.ts",
859
- line: 189,
860
- scope: this,
861
- callSite: (f, a) => f(...a)
861
+ F: __dxlog_file3,
862
+ L: 189,
863
+ S: this,
864
+ C: (f, a) => f(...a)
862
865
  });
863
866
  return identity;
864
867
  }
865
868
  async _constructIdentity(identityRecord) {
866
- (0, import_node_assert2.default)(!this._identity);
869
+ (0, import_tiny_invariant2.default)(!this._identity);
867
870
  (0, import_log3.log)("constructing identity", {
868
871
  identityRecord
869
872
  }, {
870
- file: "identity-manager.ts",
871
- line: 195,
872
- scope: this,
873
- callSite: (f, a) => f(...a)
873
+ F: __dxlog_file3,
874
+ L: 195,
875
+ S: this,
876
+ C: (f, a) => f(...a)
874
877
  });
875
- (0, import_node_assert2.default)(identityRecord.haloSpace.controlFeedKey);
878
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.controlFeedKey);
876
879
  const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
877
880
  writable: true
878
881
  });
879
- (0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey);
882
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey);
880
883
  const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
881
884
  writable: true,
882
885
  sparse: true
@@ -901,10 +904,10 @@ var IdentityManager = class {
901
904
  (0, import_log3.log)("done", {
902
905
  identityKey: identityRecord.identityKey
903
906
  }, {
904
- file: "identity-manager.ts",
905
- line: 226,
906
- scope: this,
907
- callSite: (f, a) => f(...a)
907
+ F: __dxlog_file3,
908
+ L: 226,
909
+ S: this,
910
+ C: (f, a) => f(...a)
908
911
  });
909
912
  if (identityRecord.haloSpace.controlTimeframe) {
910
913
  identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
@@ -921,11 +924,11 @@ var IdentityManager = class {
921
924
  onNetworkConnection: () => {
922
925
  },
923
926
  onAuthFailure: () => {
924
- import_log3.log.warn("auth failure", {}, {
925
- file: "identity-manager.ts",
926
- line: 245,
927
- scope: this,
928
- callSite: (f, a) => f(...a)
927
+ import_log3.log.warn("auth failure", void 0, {
928
+ F: __dxlog_file3,
929
+ L: 245,
930
+ S: this,
931
+ C: (f, a) => f(...a)
929
932
  });
930
933
  },
931
934
  memberKey: identityKey
@@ -934,7 +937,7 @@ var IdentityManager = class {
934
937
  };
935
938
 
936
939
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
937
- var import_node_assert3 = __toESM(require("node:assert"));
940
+ var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
938
941
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
939
942
  var import_credentials6 = require("@dxos/credentials");
940
943
  var import_debug2 = require("@dxos/debug");
@@ -970,7 +973,7 @@ var IdentityServiceImpl = class {
970
973
  };
971
974
  }
972
975
  async signPresentation({ presentation, nonce }) {
973
- (0, import_node_assert3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
976
+ (0, import_tiny_invariant3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
974
977
  return await (0, import_credentials6.signPresentation)({
975
978
  presentation,
976
979
  signer: this._serviceContext.keyring,
@@ -982,7 +985,7 @@ var IdentityServiceImpl = class {
982
985
  };
983
986
 
984
987
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
985
- var import_node_assert4 = __toESM(require("node:assert"));
988
+ var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
986
989
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
987
990
  var DeviceInvitationProtocol = class {
988
991
  constructor(_keyring, _getIdentity, _acceptIdentity) {
@@ -999,7 +1002,7 @@ var DeviceInvitationProtocol = class {
999
1002
  };
1000
1003
  }
1001
1004
  async admit(request) {
1002
- (0, import_node_assert4.default)(request.device);
1005
+ (0, import_tiny_invariant4.default)(request.device);
1003
1006
  const identity = this._getIdentity();
1004
1007
  await identity.admitDevice(request.device);
1005
1008
  return {
@@ -1027,9 +1030,9 @@ var DeviceInvitationProtocol = class {
1027
1030
  };
1028
1031
  }
1029
1032
  async accept(response, request) {
1030
- (0, import_node_assert4.default)(response.device);
1033
+ (0, import_tiny_invariant4.default)(response.device);
1031
1034
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1032
- (0, import_node_assert4.default)(request.device);
1035
+ (0, import_tiny_invariant4.default)(request.device);
1033
1036
  const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
1034
1037
  await this._acceptIdentity({
1035
1038
  identityKey,
@@ -1047,7 +1050,7 @@ var DeviceInvitationProtocol = class {
1047
1050
  };
1048
1051
 
1049
1052
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1050
- var import_node_assert6 = __toESM(require("node:assert"));
1053
+ var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
1051
1054
  var import_async8 = require("@dxos/async");
1052
1055
  var import_client_protocol2 = require("@dxos/client-protocol");
1053
1056
  var import_context4 = require("@dxos/context");
@@ -1061,7 +1064,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
1061
1064
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
1062
1065
 
1063
1066
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1064
- var import_node_assert5 = __toESM(require("node:assert"));
1067
+ var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
1065
1068
  var import_async7 = require("@dxos/async");
1066
1069
  var import_context3 = require("@dxos/context");
1067
1070
  var import_errors = require("@dxos/errors");
@@ -1071,6 +1074,7 @@ var import_protocols3 = require("@dxos/protocols");
1071
1074
  var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
1072
1075
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
1073
1076
  var import_teleport = require("@dxos/teleport");
1077
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1074
1078
  var OPTIONS_TIMEOUT = 1e4;
1075
1079
  var MAX_OTP_ATTEMPTS = 3;
1076
1080
  var InvitationHostExtension = class extends import_teleport.RpcExtension {
@@ -1098,7 +1102,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1098
1102
  // Perhaps in the future we will have more complex logic here.
1099
1103
  InvitationHostService: {
1100
1104
  options: async (options) => {
1101
- (0, import_node_assert5.default)(!this._remoteOptions, "Remote options already set.");
1105
+ (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
1102
1106
  this._remoteOptions = options;
1103
1107
  this._remoteOptionsTrigger.wake();
1104
1108
  },
@@ -1108,20 +1112,20 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1108
1112
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
1109
1113
  id: traceId
1110
1114
  }), {
1111
- file: "invitation-extension.ts",
1112
- line: 98,
1113
- scope: this,
1114
- callSite: (f, a) => f(...a)
1115
+ F: __dxlog_file4,
1116
+ L: 98,
1117
+ S: this,
1118
+ C: (f, a) => f(...a)
1115
1119
  });
1116
1120
  const invitation = await this._callbacks.resolveInvitation(request);
1117
1121
  if (!invitation) {
1118
1122
  import_log4.log.warn("invitation not found", {
1119
1123
  invitationId
1120
1124
  }, {
1121
- file: "invitation-extension.ts",
1122
- line: 102,
1123
- scope: this,
1124
- callSite: (f, a) => f(...a)
1125
+ F: __dxlog_file4,
1126
+ L: 102,
1127
+ S: this,
1128
+ C: (f, a) => f(...a)
1125
1129
  });
1126
1130
  this._callbacks.onError(new Error("Invitation not found."));
1127
1131
  return {
@@ -1132,10 +1136,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1132
1136
  (0, import_log4.log)("guest introduced itself", {
1133
1137
  guestProfile: profile
1134
1138
  }, {
1135
- file: "invitation-extension.ts",
1136
- line: 111,
1137
- scope: this,
1138
- callSite: (f, a) => f(...a)
1139
+ F: __dxlog_file4,
1140
+ L: 111,
1141
+ S: this,
1142
+ C: (f, a) => f(...a)
1139
1143
  });
1140
1144
  this.guestProfile = profile;
1141
1145
  this._callbacks.onStateUpdate({
@@ -1145,10 +1149,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1145
1149
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
1146
1150
  id: traceId
1147
1151
  }), {
1148
- file: "invitation-extension.ts",
1149
- line: 118,
1150
- scope: this,
1151
- callSite: (f, a) => f(...a)
1152
+ F: __dxlog_file4,
1153
+ L: 118,
1154
+ S: this,
1155
+ C: (f, a) => f(...a)
1152
1156
  });
1153
1157
  return {
1154
1158
  spaceKey: this.invitation.authMethod === import_services2.Invitation.AuthMethod.NONE ? this.invitation.spaceKey : void 0,
@@ -1160,28 +1164,28 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1160
1164
  import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
1161
1165
  id: traceId
1162
1166
  }), {
1163
- file: "invitation-extension.ts",
1164
- line: 127,
1165
- scope: this,
1166
- callSite: (f, a) => f(...a)
1167
+ F: __dxlog_file4,
1168
+ L: 127,
1169
+ S: this,
1170
+ C: (f, a) => f(...a)
1167
1171
  });
1168
1172
  (0, import_log4.log)("received authentication request", {
1169
1173
  authCode: code
1170
1174
  }, {
1171
- file: "invitation-extension.ts",
1172
- line: 128,
1173
- scope: this,
1174
- callSite: (f, a) => f(...a)
1175
+ F: __dxlog_file4,
1176
+ L: 128,
1177
+ S: this,
1178
+ C: (f, a) => f(...a)
1175
1179
  });
1176
1180
  let status = import_invitations.AuthenticationResponse.Status.OK;
1177
- (0, import_node_assert5.default)(this.invitation, "Invitation is not set.");
1181
+ (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
1178
1182
  switch (this.invitation.authMethod) {
1179
1183
  case import_services2.Invitation.AuthMethod.NONE: {
1180
- (0, import_log4.log)("authentication not required", {}, {
1181
- file: "invitation-extension.ts",
1182
- line: 134,
1183
- scope: this,
1184
- callSite: (f, a) => f(...a)
1184
+ (0, import_log4.log)("authentication not required", void 0, {
1185
+ F: __dxlog_file4,
1186
+ L: 134,
1187
+ S: this,
1188
+ C: (f, a) => f(...a)
1185
1189
  });
1186
1190
  return {
1187
1191
  status: import_invitations.AuthenticationResponse.Status.OK
@@ -1203,10 +1207,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1203
1207
  import_log4.log.error("invalid authentication method", {
1204
1208
  authMethod: this.invitation.authMethod
1205
1209
  }, {
1206
- file: "invitation-extension.ts",
1207
- line: 152,
1208
- scope: this,
1209
- callSite: (f, a) => f(...a)
1210
+ F: __dxlog_file4,
1211
+ L: 152,
1212
+ S: this,
1213
+ C: (f, a) => f(...a)
1210
1214
  });
1211
1215
  status = import_invitations.AuthenticationResponse.Status.INTERNAL_ERROR;
1212
1216
  break;
@@ -1218,10 +1222,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1218
1222
  status
1219
1223
  }
1220
1224
  }), {
1221
- file: "invitation-extension.ts",
1222
- line: 158,
1223
- scope: this,
1224
- callSite: (f, a) => f(...a)
1225
+ F: __dxlog_file4,
1226
+ L: 158,
1227
+ S: this,
1228
+ C: (f, a) => f(...a)
1225
1229
  });
1226
1230
  return {
1227
1231
  status
@@ -1232,13 +1236,13 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1232
1236
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
1233
1237
  id: traceId
1234
1238
  }), {
1235
- file: "invitation-extension.ts",
1236
- line: 164,
1237
- scope: this,
1238
- callSite: (f, a) => f(...a)
1239
+ F: __dxlog_file4,
1240
+ L: 164,
1241
+ S: this,
1242
+ C: (f, a) => f(...a)
1239
1243
  });
1240
1244
  try {
1241
- (0, import_node_assert5.default)(this.invitation, "Invitation is not set.");
1245
+ (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
1242
1246
  if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
1243
1247
  throw new Error("Not authenticated");
1244
1248
  }
@@ -1246,10 +1250,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1246
1250
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
1247
1251
  id: traceId
1248
1252
  }), {
1249
- file: "invitation-extension.ts",
1250
- line: 175,
1251
- scope: this,
1252
- callSite: (f, a) => f(...a)
1253
+ F: __dxlog_file4,
1254
+ L: 175,
1255
+ S: this,
1256
+ C: (f, a) => f(...a)
1253
1257
  });
1254
1258
  return response;
1255
1259
  } catch (err) {
@@ -1303,7 +1307,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1303
1307
  return {
1304
1308
  InvitationHostService: {
1305
1309
  options: async (options) => {
1306
- (0, import_node_assert5.default)(!this._remoteOptions, "Remote options already set.");
1310
+ (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
1307
1311
  this._remoteOptions = options;
1308
1312
  this._remoteOptionsTrigger.wake();
1309
1313
  },
@@ -1323,11 +1327,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1323
1327
  var _a;
1324
1328
  await super.onOpen(context);
1325
1329
  try {
1326
- (0, import_log4.log)("begin options", {}, {
1327
- file: "invitation-extension.ts",
1328
- line: 263,
1329
- scope: this,
1330
- callSite: (f, a) => f(...a)
1330
+ (0, import_log4.log)("begin options", void 0, {
1331
+ F: __dxlog_file4,
1332
+ L: 263,
1333
+ S: this,
1334
+ C: (f, a) => f(...a)
1331
1335
  });
1332
1336
  await (0, import_context3.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
1333
1337
  role: import_invitations.Options.Role.GUEST
@@ -1335,11 +1339,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1335
1339
  await (0, import_context3.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1336
1340
  timeout: OPTIONS_TIMEOUT
1337
1341
  }));
1338
- (0, import_log4.log)("end options", {}, {
1339
- file: "invitation-extension.ts",
1340
- line: 266,
1341
- scope: this,
1342
- callSite: (f, a) => f(...a)
1342
+ (0, import_log4.log)("end options", void 0, {
1343
+ F: __dxlog_file4,
1344
+ L: 266,
1345
+ S: this,
1346
+ C: (f, a) => f(...a)
1343
1347
  });
1344
1348
  if (((_a = this._remoteOptions) == null ? void 0 : _a.role) !== import_invitations.Options.Role.HOST) {
1345
1349
  throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
@@ -1350,20 +1354,20 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1350
1354
  this._callbacks.onOpen(this._ctx);
1351
1355
  } catch (err) {
1352
1356
  (0, import_log4.log)("openError", err, {
1353
- file: "invitation-extension.ts",
1354
- line: 276,
1355
- scope: this,
1356
- callSite: (f, a) => f(...a)
1357
+ F: __dxlog_file4,
1358
+ L: 276,
1359
+ S: this,
1360
+ C: (f, a) => f(...a)
1357
1361
  });
1358
1362
  this._callbacks.onError(err);
1359
1363
  }
1360
1364
  }
1361
1365
  async onClose() {
1362
- (0, import_log4.log)("onClose", {}, {
1363
- file: "invitation-extension.ts",
1364
- line: 282,
1365
- scope: this,
1366
- callSite: (f, a) => f(...a)
1366
+ (0, import_log4.log)("onClose", void 0, {
1367
+ F: __dxlog_file4,
1368
+ L: 282,
1369
+ S: this,
1370
+ C: (f, a) => f(...a)
1367
1371
  });
1368
1372
  await this._ctx.dispose();
1369
1373
  }
@@ -1371,6 +1375,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1371
1375
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
1372
1376
 
1373
1377
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1378
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1374
1379
  var InvitationsHandler = class {
1375
1380
  /**
1376
1381
  * @internal
@@ -1382,7 +1387,7 @@ var InvitationsHandler = class {
1382
1387
  var _a;
1383
1388
  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 : {};
1384
1389
  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;
1385
- (0, import_node_assert6.default)(protocol);
1390
+ (0, import_tiny_invariant6.default)(protocol);
1386
1391
  const invitation = {
1387
1392
  invitationId,
1388
1393
  type,
@@ -1404,10 +1409,10 @@ var InvitationsHandler = class {
1404
1409
  (0, import_log5.log)("complete", {
1405
1410
  ...protocol.toJSON()
1406
1411
  }, {
1407
- file: "invitations-handler.ts",
1408
- line: 99,
1409
- scope: this,
1410
- callSite: (f, a) => f(...a)
1412
+ F: __dxlog_file5,
1413
+ L: 99,
1414
+ S: this,
1415
+ C: (f, a) => f(...a)
1411
1416
  });
1412
1417
  stream.complete();
1413
1418
  });
@@ -1429,7 +1434,7 @@ var InvitationsHandler = class {
1429
1434
  var _a2, _b, _c;
1430
1435
  try {
1431
1436
  const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
1432
- (0, import_node_assert6.default)(deviceKey);
1437
+ (0, import_tiny_invariant6.default)(deviceKey);
1433
1438
  const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
1434
1439
  extension.completedTrigger.wake(deviceKey);
1435
1440
  return admissionResponse;
@@ -1445,18 +1450,18 @@ var InvitationsHandler = class {
1445
1450
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
1446
1451
  id: traceId
1447
1452
  }), {
1448
- file: "invitations-handler.ts",
1449
- line: 138,
1450
- scope: this,
1451
- callSite: (f, a) => f(...a)
1453
+ F: __dxlog_file5,
1454
+ L: 138,
1455
+ S: this,
1456
+ C: (f, a) => f(...a)
1452
1457
  });
1453
1458
  (0, import_log5.log)("connected", {
1454
1459
  ...protocol.toJSON()
1455
1460
  }, {
1456
- file: "invitations-handler.ts",
1457
- line: 139,
1458
- scope: this,
1459
- callSite: (f, a) => f(...a)
1461
+ F: __dxlog_file5,
1462
+ L: 139,
1463
+ S: this,
1464
+ C: (f, a) => f(...a)
1460
1465
  });
1461
1466
  stream.next({
1462
1467
  ...invitation,
@@ -1469,10 +1474,10 @@ var InvitationsHandler = class {
1469
1474
  guest: deviceKey,
1470
1475
  ...protocol.toJSON()
1471
1476
  }, {
1472
- file: "invitations-handler.ts",
1473
- line: 142,
1474
- scope: this,
1475
- callSite: (f, a) => f(...a)
1477
+ F: __dxlog_file5,
1478
+ L: 142,
1479
+ S: this,
1480
+ C: (f, a) => f(...a)
1476
1481
  });
1477
1482
  stream.next({
1478
1483
  ...invitation,
@@ -1481,20 +1486,20 @@ var InvitationsHandler = class {
1481
1486
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
1482
1487
  id: traceId
1483
1488
  }), {
1484
- file: "invitations-handler.ts",
1485
- line: 144,
1486
- scope: this,
1487
- callSite: (f, a) => f(...a)
1489
+ F: __dxlog_file5,
1490
+ L: 144,
1491
+ S: this,
1492
+ C: (f, a) => f(...a)
1488
1493
  });
1489
1494
  } catch (err) {
1490
1495
  if (err instanceof import_async8.TimeoutError) {
1491
1496
  (0, import_log5.log)("timeout", {
1492
1497
  ...protocol.toJSON()
1493
1498
  }, {
1494
- file: "invitations-handler.ts",
1495
- line: 147,
1496
- scope: this,
1497
- callSite: (f, a) => f(...a)
1499
+ F: __dxlog_file5,
1500
+ L: 147,
1501
+ S: this,
1502
+ C: (f, a) => f(...a)
1498
1503
  });
1499
1504
  stream.next({
1500
1505
  ...invitation,
@@ -1502,10 +1507,10 @@ var InvitationsHandler = class {
1502
1507
  });
1503
1508
  } else {
1504
1509
  import_log5.log.error("failed", err, {
1505
- file: "invitations-handler.ts",
1506
- line: 150,
1507
- scope: this,
1508
- callSite: (f, a) => f(...a)
1510
+ F: __dxlog_file5,
1511
+ L: 150,
1512
+ S: this,
1513
+ C: (f, a) => f(...a)
1509
1514
  });
1510
1515
  stream.error(err);
1511
1516
  }
@@ -1513,10 +1518,10 @@ var InvitationsHandler = class {
1513
1518
  id: traceId,
1514
1519
  error: err
1515
1520
  }), {
1516
- file: "invitations-handler.ts",
1517
- line: 153,
1518
- scope: this,
1519
- callSite: (f, a) => f(...a)
1521
+ F: __dxlog_file5,
1522
+ L: 153,
1523
+ S: this,
1524
+ C: (f, a) => f(...a)
1520
1525
  });
1521
1526
  } finally {
1522
1527
  if (type !== import_services3.Invitation.Type.MULTIUSE) {
@@ -1534,10 +1539,10 @@ var InvitationsHandler = class {
1534
1539
  (0, import_log5.log)("timeout", {
1535
1540
  ...protocol.toJSON()
1536
1541
  }, {
1537
- file: "invitations-handler.ts",
1538
- line: 168,
1539
- scope: this,
1540
- callSite: (f, a) => f(...a)
1542
+ F: __dxlog_file5,
1543
+ L: 168,
1544
+ S: this,
1545
+ C: (f, a) => f(...a)
1541
1546
  });
1542
1547
  stream.next({
1543
1548
  ...invitation,
@@ -1545,10 +1550,10 @@ var InvitationsHandler = class {
1545
1550
  });
1546
1551
  } else {
1547
1552
  import_log5.log.error("failed", err, {
1548
- file: "invitations-handler.ts",
1549
- line: 171,
1550
- scope: this,
1551
- callSite: (f, a) => f(...a)
1553
+ F: __dxlog_file5,
1554
+ L: 171,
1555
+ S: this,
1556
+ C: (f, a) => f(...a)
1552
1557
  });
1553
1558
  stream.error(err);
1554
1559
  }
@@ -1588,13 +1593,13 @@ var InvitationsHandler = class {
1588
1593
  }
1589
1594
  acceptInvitation(protocol, invitation) {
1590
1595
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1591
- (0, import_node_assert6.default)(protocol);
1596
+ (0, import_tiny_invariant6.default)(protocol);
1592
1597
  const authenticated = new import_async8.Trigger();
1593
1598
  let admitted = false;
1594
1599
  let currentState;
1595
1600
  const stream = new import_async8.PushStream();
1596
1601
  const setState = (newData) => {
1597
- (0, import_node_assert6.default)(newData.state !== void 0);
1602
+ (0, import_tiny_invariant6.default)(newData.state !== void 0);
1598
1603
  currentState = newData.state;
1599
1604
  stream.next({
1600
1605
  ...invitation,
@@ -1607,20 +1612,20 @@ var InvitationsHandler = class {
1607
1612
  (0, import_log5.log)("timeout", {
1608
1613
  ...protocol.toJSON()
1609
1614
  }, {
1610
- file: "invitations-handler.ts",
1611
- line: 230,
1612
- scope: this,
1613
- callSite: (f, a) => f(...a)
1615
+ F: __dxlog_file5,
1616
+ L: 230,
1617
+ S: this,
1618
+ C: (f, a) => f(...a)
1614
1619
  });
1615
1620
  setState({
1616
1621
  state: import_services3.Invitation.State.TIMEOUT
1617
1622
  });
1618
1623
  } else {
1619
1624
  import_log5.log.warn("auth failed", err, {
1620
- file: "invitations-handler.ts",
1621
- line: 233,
1622
- scope: this,
1623
- callSite: (f, a) => f(...a)
1625
+ F: __dxlog_file5,
1626
+ L: 233,
1627
+ S: this,
1628
+ C: (f, a) => f(...a)
1624
1629
  });
1625
1630
  stream.error(err);
1626
1631
  }
@@ -1631,10 +1636,10 @@ var InvitationsHandler = class {
1631
1636
  (0, import_log5.log)("complete", {
1632
1637
  ...protocol.toJSON()
1633
1638
  }, {
1634
- file: "invitations-handler.ts",
1635
- line: 241,
1636
- scope: this,
1637
- callSite: (f, a) => f(...a)
1639
+ F: __dxlog_file5,
1640
+ L: 241,
1641
+ S: this,
1642
+ C: (f, a) => f(...a)
1638
1643
  });
1639
1644
  stream.complete();
1640
1645
  });
@@ -1646,10 +1651,10 @@ var InvitationsHandler = class {
1646
1651
  (0, import_log5.log)("extension disposed", {
1647
1652
  currentState
1648
1653
  }, {
1649
- file: "invitations-handler.ts",
1650
- line: 251,
1651
- scope: this,
1652
- callSite: (f, a) => f(...a)
1654
+ F: __dxlog_file5,
1655
+ L: 251,
1656
+ S: this,
1657
+ C: (f, a) => f(...a)
1653
1658
  });
1654
1659
  if (!admitted) {
1655
1660
  stream.error(new Error("Remote peer disconnected."));
@@ -1661,10 +1666,10 @@ var InvitationsHandler = class {
1661
1666
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
1662
1667
  id: traceId
1663
1668
  }), {
1664
- file: "invitations-handler.ts",
1665
- line: 260,
1666
- scope: this,
1667
- callSite: (f, a) => f(...a)
1669
+ F: __dxlog_file5,
1670
+ L: 260,
1671
+ S: this,
1672
+ C: (f, a) => f(...a)
1668
1673
  });
1669
1674
  if (++connectionCount > 1) {
1670
1675
  throw new Error(`multiple connections detected: ${connectionCount}`);
@@ -1673,10 +1678,10 @@ var InvitationsHandler = class {
1673
1678
  (0, import_log5.log)("connected", {
1674
1679
  ...protocol.toJSON()
1675
1680
  }, {
1676
- file: "invitations-handler.ts",
1677
- line: 268,
1678
- scope: this,
1679
- callSite: (f, a) => f(...a)
1681
+ F: __dxlog_file5,
1682
+ L: 268,
1683
+ S: this,
1684
+ C: (f, a) => f(...a)
1680
1685
  });
1681
1686
  setState({
1682
1687
  state: import_services3.Invitation.State.CONNECTED
@@ -1684,20 +1689,20 @@ var InvitationsHandler = class {
1684
1689
  (0, import_log5.log)("introduce", {
1685
1690
  ...protocol.toJSON()
1686
1691
  }, {
1687
- file: "invitations-handler.ts",
1688
- line: 272,
1689
- scope: this,
1690
- callSite: (f, a) => f(...a)
1692
+ F: __dxlog_file5,
1693
+ L: 272,
1694
+ S: this,
1695
+ C: (f, a) => f(...a)
1691
1696
  });
1692
1697
  const introductionResponse = await extension.rpc.InvitationHostService.introduce(protocol.createIntroduction());
1693
1698
  (0, import_log5.log)("introduce response", {
1694
1699
  ...protocol.toJSON(),
1695
1700
  response: introductionResponse
1696
1701
  }, {
1697
- file: "invitations-handler.ts",
1698
- line: 276,
1699
- scope: this,
1700
- callSite: (f, a) => f(...a)
1702
+ F: __dxlog_file5,
1703
+ L: 276,
1704
+ S: this,
1705
+ C: (f, a) => f(...a)
1701
1706
  });
1702
1707
  invitation.authMethod = introductionResponse.authMethod;
1703
1708
  if (introductionResponse.spaceKey) {
@@ -1705,11 +1710,11 @@ var InvitationsHandler = class {
1705
1710
  }
1706
1711
  if (isAuthenticationRequired(invitation)) {
1707
1712
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1708
- (0, import_log5.log)("guest waiting for authentication code...", {}, {
1709
- file: "invitations-handler.ts",
1710
- line: 285,
1711
- scope: this,
1712
- callSite: (f, a) => f(...a)
1713
+ (0, import_log5.log)("guest waiting for authentication code...", void 0, {
1714
+ F: __dxlog_file5,
1715
+ L: 285,
1716
+ S: this,
1717
+ C: (f, a) => f(...a)
1713
1718
  });
1714
1719
  setState({
1715
1720
  state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
@@ -1717,11 +1722,11 @@ var InvitationsHandler = class {
1717
1722
  const authCode = await authenticated.wait({
1718
1723
  timeout
1719
1724
  });
1720
- (0, import_log5.log)("sending authentication request", {}, {
1721
- file: "invitations-handler.ts",
1722
- line: 289,
1723
- scope: this,
1724
- callSite: (f, a) => f(...a)
1725
+ (0, import_log5.log)("sending authentication request", void 0, {
1726
+ F: __dxlog_file5,
1727
+ L: 289,
1728
+ S: this,
1729
+ C: (f, a) => f(...a)
1725
1730
  });
1726
1731
  setState({
1727
1732
  state: import_services3.Invitation.State.AUTHENTICATING
@@ -1739,10 +1744,10 @@ var InvitationsHandler = class {
1739
1744
  (0, import_log5.log)("retrying invalid code", {
1740
1745
  attempt
1741
1746
  }, {
1742
- file: "invitations-handler.ts",
1743
- line: 300,
1744
- scope: this,
1745
- callSite: (f, a) => f(...a)
1747
+ F: __dxlog_file5,
1748
+ L: 300,
1749
+ S: this,
1750
+ C: (f, a) => f(...a)
1746
1751
  });
1747
1752
  authenticated.reset();
1748
1753
  }
@@ -1756,10 +1761,10 @@ var InvitationsHandler = class {
1756
1761
  (0, import_log5.log)("request admission", {
1757
1762
  ...protocol.toJSON()
1758
1763
  }, {
1759
- file: "invitations-handler.ts",
1760
- line: 311,
1761
- scope: this,
1762
- callSite: (f, a) => f(...a)
1764
+ F: __dxlog_file5,
1765
+ L: 311,
1766
+ S: this,
1767
+ C: (f, a) => f(...a)
1763
1768
  });
1764
1769
  const admissionRequest = await protocol.createAdmissionRequest();
1765
1770
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
@@ -1768,10 +1773,10 @@ var InvitationsHandler = class {
1768
1773
  (0, import_log5.log)("admitted by host", {
1769
1774
  ...protocol.toJSON()
1770
1775
  }, {
1771
- file: "invitations-handler.ts",
1772
- line: 322,
1773
- scope: this,
1774
- callSite: (f, a) => f(...a)
1776
+ F: __dxlog_file5,
1777
+ L: 322,
1778
+ S: this,
1779
+ C: (f, a) => f(...a)
1775
1780
  });
1776
1781
  setState({
1777
1782
  ...result,
@@ -1780,30 +1785,30 @@ var InvitationsHandler = class {
1780
1785
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
1781
1786
  id: traceId
1782
1787
  }), {
1783
- file: "invitations-handler.ts",
1784
- line: 324,
1785
- scope: this,
1786
- callSite: (f, a) => f(...a)
1788
+ F: __dxlog_file5,
1789
+ L: 324,
1790
+ S: this,
1791
+ C: (f, a) => f(...a)
1787
1792
  });
1788
1793
  } catch (err) {
1789
1794
  if (err instanceof import_async8.TimeoutError) {
1790
1795
  (0, import_log5.log)("timeout", {
1791
1796
  ...protocol.toJSON()
1792
1797
  }, {
1793
- file: "invitations-handler.ts",
1794
- line: 327,
1795
- scope: this,
1796
- callSite: (f, a) => f(...a)
1798
+ F: __dxlog_file5,
1799
+ L: 327,
1800
+ S: this,
1801
+ C: (f, a) => f(...a)
1797
1802
  });
1798
1803
  setState({
1799
1804
  state: import_services3.Invitation.State.TIMEOUT
1800
1805
  });
1801
1806
  } else {
1802
1807
  (0, import_log5.log)("auth failed", err, {
1803
- file: "invitations-handler.ts",
1804
- line: 330,
1805
- scope: this,
1806
- callSite: (f, a) => f(...a)
1808
+ F: __dxlog_file5,
1809
+ L: 330,
1810
+ S: this,
1811
+ C: (f, a) => f(...a)
1807
1812
  });
1808
1813
  stream.error(err);
1809
1814
  }
@@ -1811,10 +1816,10 @@ var InvitationsHandler = class {
1811
1816
  id: traceId,
1812
1817
  error: err
1813
1818
  }), {
1814
- file: "invitations-handler.ts",
1815
- line: 333,
1816
- scope: this,
1817
- callSite: (f, a) => f(...a)
1819
+ F: __dxlog_file5,
1820
+ L: 333,
1821
+ S: this,
1822
+ C: (f, a) => f(...a)
1818
1823
  });
1819
1824
  } finally {
1820
1825
  await ctx.dispose();
@@ -1829,20 +1834,20 @@ var InvitationsHandler = class {
1829
1834
  (0, import_log5.log)("timeout", {
1830
1835
  ...protocol.toJSON()
1831
1836
  }, {
1832
- file: "invitations-handler.ts",
1833
- line: 344,
1834
- scope: this,
1835
- callSite: (f, a) => f(...a)
1837
+ F: __dxlog_file5,
1838
+ L: 344,
1839
+ S: this,
1840
+ C: (f, a) => f(...a)
1836
1841
  });
1837
1842
  setState({
1838
1843
  state: import_services3.Invitation.State.TIMEOUT
1839
1844
  });
1840
1845
  } else {
1841
1846
  (0, import_log5.log)("auth failed", err, {
1842
- file: "invitations-handler.ts",
1843
- line: 347,
1844
- scope: this,
1845
- callSite: (f, a) => f(...a)
1847
+ F: __dxlog_file5,
1848
+ L: 347,
1849
+ S: this,
1850
+ C: (f, a) => f(...a)
1846
1851
  });
1847
1852
  stream.error(err);
1848
1853
  }
@@ -1851,7 +1856,7 @@ var InvitationsHandler = class {
1851
1856
  return extension;
1852
1857
  };
1853
1858
  (0, import_async8.scheduleTask)(ctx, async () => {
1854
- (0, import_node_assert6.default)(invitation.swarmKey);
1859
+ (0, import_tiny_invariant6.default)(invitation.swarmKey);
1855
1860
  const topic = invitation.swarmKey;
1856
1861
  const swarmConnection = await this._networkManager.joinSwarm({
1857
1862
  topic,
@@ -1884,11 +1889,12 @@ var InvitationsHandler = class {
1884
1889
  };
1885
1890
 
1886
1891
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
1887
- var import_node_assert7 = __toESM(require("node:assert"));
1892
+ var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1888
1893
  var import_async9 = require("@dxos/async");
1889
1894
  var import_codec_protobuf8 = require("@dxos/codec-protobuf");
1890
1895
  var import_log6 = require("@dxos/log");
1891
1896
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
1897
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1892
1898
  var InvitationsServiceImpl = class {
1893
1899
  constructor(_invitationsHandler, _getHandler) {
1894
1900
  this._invitationsHandler = _invitationsHandler;
@@ -1949,35 +1955,35 @@ var InvitationsServiceImpl = class {
1949
1955
  });
1950
1956
  }
1951
1957
  async authenticate({ invitationId, authCode }) {
1952
- (0, import_log6.log)("authenticating...", {}, {
1953
- file: "invitations-service.ts",
1954
- line: 103,
1955
- scope: this,
1956
- callSite: (f, a) => f(...a)
1958
+ (0, import_log6.log)("authenticating...", void 0, {
1959
+ F: __dxlog_file6,
1960
+ L: 103,
1961
+ S: this,
1962
+ C: (f, a) => f(...a)
1957
1963
  });
1958
- (0, import_node_assert7.default)(invitationId);
1964
+ (0, import_tiny_invariant7.default)(invitationId);
1959
1965
  const observable = this._acceptInvitations.get(invitationId);
1960
1966
  if (!observable) {
1961
1967
  import_log6.log.warn("invalid invitation", {
1962
1968
  invitationId
1963
1969
  }, {
1964
- file: "invitations-service.ts",
1965
- line: 107,
1966
- scope: this,
1967
- callSite: (f, a) => f(...a)
1970
+ F: __dxlog_file6,
1971
+ L: 107,
1972
+ S: this,
1973
+ C: (f, a) => f(...a)
1968
1974
  });
1969
1975
  } else {
1970
1976
  await observable.authenticate(authCode);
1971
1977
  }
1972
1978
  }
1973
1979
  async cancelInvitation({ invitationId }) {
1974
- (0, import_log6.log)("deleting...", {}, {
1975
- file: "invitations-service.ts",
1976
- line: 114,
1977
- scope: this,
1978
- callSite: (f, a) => f(...a)
1980
+ (0, import_log6.log)("deleting...", void 0, {
1981
+ F: __dxlog_file6,
1982
+ L: 114,
1983
+ S: this,
1984
+ C: (f, a) => f(...a)
1979
1985
  });
1980
- (0, import_node_assert7.default)(invitationId);
1986
+ (0, import_tiny_invariant7.default)(invitationId);
1981
1987
  const created = this._createInvitations.get(invitationId);
1982
1988
  const accepted = this._acceptInvitations.get(invitationId);
1983
1989
  if (created) {
@@ -1992,10 +1998,10 @@ var InvitationsServiceImpl = class {
1992
1998
  import_log6.log.warn("invalid invitation", {
1993
1999
  invitationId
1994
2000
  }, {
1995
- file: "invitations-service.ts",
1996
- line: 127,
1997
- scope: this,
1998
- callSite: (f, a) => f(...a)
2001
+ F: __dxlog_file6,
2002
+ L: 127,
2003
+ S: this,
2004
+ C: (f, a) => f(...a)
1999
2005
  });
2000
2006
  }
2001
2007
  }
@@ -2052,11 +2058,12 @@ var InvitationsServiceImpl = class {
2052
2058
  };
2053
2059
 
2054
2060
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
2055
- var import_node_assert8 = __toESM(require("node:assert"));
2061
+ var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
2056
2062
  var import_credentials8 = require("@dxos/credentials");
2057
2063
  var import_feed_store3 = require("@dxos/feed-store");
2058
2064
  var import_log7 = require("@dxos/log");
2059
2065
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
2066
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2060
2067
  var SpaceInvitationProtocol = class {
2061
2068
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
2062
2069
  this._spaceManager = _spaceManager;
@@ -2078,24 +2085,24 @@ var SpaceInvitationProtocol = class {
2078
2085
  }
2079
2086
  async admit(request, guestProfile) {
2080
2087
  var _a;
2081
- (0, import_node_assert8.default)(this._spaceKey);
2088
+ (0, import_tiny_invariant8.default)(this._spaceKey);
2082
2089
  const space = await this._spaceManager.spaces.get(this._spaceKey);
2083
- (0, import_node_assert8.default)(space);
2084
- (0, import_node_assert8.default)(request.space);
2090
+ (0, import_tiny_invariant8.default)(space);
2091
+ (0, import_tiny_invariant8.default)(request.space);
2085
2092
  const { identityKey, deviceKey } = request.space;
2086
2093
  (0, import_log7.log)("writing guest credentials", {
2087
2094
  host: this._signingContext.deviceKey,
2088
2095
  guest: deviceKey
2089
2096
  }, {
2090
- file: "space-invitation-protocol.ts",
2091
- line: 50,
2092
- scope: this,
2093
- callSite: (f, a) => f(...a)
2097
+ F: __dxlog_file7,
2098
+ L: 50,
2099
+ S: this,
2100
+ C: (f, a) => f(...a)
2094
2101
  });
2095
2102
  const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
2096
- (0, import_node_assert8.default)(credentials[0].credential);
2103
+ (0, import_tiny_invariant8.default)(credentials[0].credential);
2097
2104
  const spaceMemberCredential = credentials[0].credential.credential;
2098
- (0, import_node_assert8.default)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2105
+ (0, import_tiny_invariant8.default)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2099
2106
  await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
2100
2107
  return {
2101
2108
  space: {
@@ -2123,11 +2130,11 @@ var SpaceInvitationProtocol = class {
2123
2130
  };
2124
2131
  }
2125
2132
  async accept(response) {
2126
- (0, import_node_assert8.default)(response.space);
2133
+ (0, import_tiny_invariant8.default)(response.space);
2127
2134
  const { credential, controlTimeframe, dataTimeframe } = response.space;
2128
2135
  const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
2129
- (0, import_node_assert8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
2130
- (0, import_node_assert8.default)(credential.subject.id.equals(this._signingContext.identityKey));
2136
+ (0, import_tiny_invariant8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
2137
+ (0, import_tiny_invariant8.default)(credential.subject.id.equals(this._signingContext.identityKey));
2131
2138
  await this._spaceManager.acceptSpace({
2132
2139
  spaceKey: assertion.spaceKey,
2133
2140
  genesisFeedKey: assertion.genesisFeedKey,
@@ -2142,7 +2149,7 @@ var SpaceInvitationProtocol = class {
2142
2149
  };
2143
2150
 
2144
2151
  // packages/sdk/client-services/src/packlets/services/service-context.ts
2145
- var import_node_assert11 = __toESM(require("node:assert"));
2152
+ var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
2146
2153
  var import_async14 = require("@dxos/async");
2147
2154
  var import_credentials13 = require("@dxos/credentials");
2148
2155
  var import_debug6 = require("@dxos/debug");
@@ -2156,7 +2163,7 @@ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
2156
2163
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2157
2164
 
2158
2165
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2159
- var import_node_assert10 = __toESM(require("node:assert"));
2166
+ var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
2160
2167
  var import_async12 = require("@dxos/async");
2161
2168
  var import_context7 = require("@dxos/context");
2162
2169
  var import_credentials12 = require("@dxos/credentials");
@@ -2182,7 +2189,7 @@ var import_timeframe = require("@dxos/timeframe");
2182
2189
  var import_util4 = require("@dxos/util");
2183
2190
 
2184
2191
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2185
- var import_node_assert9 = __toESM(require("node:assert"));
2192
+ var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
2186
2193
  var import_async10 = require("@dxos/async");
2187
2194
  var import_context5 = require("@dxos/context");
2188
2195
  var import_keys7 = require("@dxos/keys");
@@ -2190,6 +2197,7 @@ var import_log8 = require("@dxos/log");
2190
2197
  var import_protocols5 = require("@dxos/protocols");
2191
2198
  var import_teleport2 = require("@dxos/teleport");
2192
2199
  var import_util3 = require("@dxos/util");
2200
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2193
2201
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2194
2202
  var DEFAULT_SUCCESS_DELAY = 1e3;
2195
2203
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2214,22 +2222,22 @@ var NotarizationPlugin = class {
2214
2222
  (0, import_log8.log)("notarize", {
2215
2223
  credentials
2216
2224
  }, {
2217
- file: "notarization-plugin.ts",
2218
- line: 87,
2219
- scope: this,
2220
- callSite: (f, a) => f(...a)
2225
+ F: __dxlog_file8,
2226
+ L: 87,
2227
+ S: this,
2228
+ C: (f, a) => f(...a)
2221
2229
  });
2222
- (0, import_node_assert9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
2230
+ (0, import_tiny_invariant9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
2223
2231
  const errors = new import_async10.Trigger();
2224
2232
  const ctx = this._ctx.derive({
2225
2233
  onError: (err) => {
2226
2234
  import_log8.log.warn("Notarization error", {
2227
2235
  err
2228
2236
  }, {
2229
- file: "notarization-plugin.ts",
2230
- line: 96,
2231
- scope: this,
2232
- callSite: (f, a) => f(...a)
2237
+ F: __dxlog_file8,
2238
+ L: 96,
2239
+ S: this,
2240
+ C: (f, a) => f(...a)
2233
2241
  });
2234
2242
  void ctx.dispose();
2235
2243
  errors.throw(err);
@@ -2242,10 +2250,10 @@ var NotarizationPlugin = class {
2242
2250
  timeout,
2243
2251
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
2244
2252
  }, {
2245
- file: "notarization-plugin.ts",
2246
- line: 108,
2247
- scope: this,
2248
- callSite: (f, a) => f(...a)
2253
+ F: __dxlog_file8,
2254
+ L: 108,
2255
+ S: this,
2256
+ C: (f, a) => f(...a)
2249
2257
  });
2250
2258
  void ctx.dispose();
2251
2259
  errors.throw(new import_async10.TimeoutError(timeout, "Notarization timed out"));
@@ -2265,10 +2273,10 @@ var NotarizationPlugin = class {
2265
2273
  import_log8.log.warn("Exhausted all peers to notarize with", {
2266
2274
  retryIn: retryTimeout
2267
2275
  }, {
2268
- file: "notarization-plugin.ts",
2269
- line: 133,
2270
- scope: this,
2271
- callSite: (f, a) => f(...a)
2276
+ F: __dxlog_file8,
2277
+ L: 133,
2278
+ S: this,
2279
+ C: (f, a) => f(...a)
2272
2280
  });
2273
2281
  peersTried.clear();
2274
2282
  (0, import_async10.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
@@ -2279,28 +2287,28 @@ var NotarizationPlugin = class {
2279
2287
  peer: peer.localPeerId,
2280
2288
  credentialId: credentials.map((credential) => credential.id)
2281
2289
  }, {
2282
- file: "notarization-plugin.ts",
2283
- line: 140,
2284
- scope: this,
2285
- callSite: (f, a) => f(...a)
2290
+ F: __dxlog_file8,
2291
+ L: 140,
2292
+ S: this,
2293
+ C: (f, a) => f(...a)
2286
2294
  });
2287
2295
  await peer.rpc.NotarizationService.notarize({
2288
2296
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
2289
2297
  });
2290
- (0, import_log8.log)("success", {}, {
2291
- file: "notarization-plugin.ts",
2292
- line: 144,
2293
- scope: this,
2294
- callSite: (f, a) => f(...a)
2298
+ (0, import_log8.log)("success", void 0, {
2299
+ F: __dxlog_file8,
2300
+ L: 144,
2301
+ S: this,
2302
+ C: (f, a) => f(...a)
2295
2303
  });
2296
2304
  await (0, import_async10.sleep)(successDelay);
2297
2305
  } catch (err) {
2298
2306
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
2299
2307
  import_log8.log.warn("error notarizing (recoverable)", err, {
2300
- file: "notarization-plugin.ts",
2301
- line: 148,
2302
- scope: this,
2303
- callSite: (f, a) => f(...a)
2308
+ F: __dxlog_file8,
2309
+ L: 148,
2310
+ S: this,
2311
+ C: (f, a) => f(...a)
2304
2312
  });
2305
2313
  }
2306
2314
  notarizeTask.schedule();
@@ -2314,11 +2322,11 @@ var NotarizationPlugin = class {
2314
2322
  allNotarized,
2315
2323
  errors.wait()
2316
2324
  ]);
2317
- (0, import_log8.log)("done", {}, {
2318
- file: "notarization-plugin.ts",
2319
- line: 159,
2320
- scope: this,
2321
- callSite: (f, a) => f(...a)
2325
+ (0, import_log8.log)("done", void 0, {
2326
+ F: __dxlog_file8,
2327
+ L: 159,
2328
+ S: this,
2329
+ C: (f, a) => f(...a)
2322
2330
  });
2323
2331
  } finally {
2324
2332
  await ctx.dispose();
@@ -2337,7 +2345,7 @@ var NotarizationPlugin = class {
2337
2345
  this._processCredentialsTriggers.delete(credential.id);
2338
2346
  }
2339
2347
  setWriter(writer) {
2340
- (0, import_node_assert9.default)(!this._writer, "Writer already set.");
2348
+ (0, import_tiny_invariant9.default)(!this._writer, "Writer already set.");
2341
2349
  this._writer = writer;
2342
2350
  }
2343
2351
  async _waitUntilProcessed(id) {
@@ -2355,7 +2363,7 @@ var NotarizationPlugin = class {
2355
2363
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
2356
2364
  }
2357
2365
  for (const credential of (_a = request.credentials) != null ? _a : []) {
2358
- (0, import_node_assert9.default)(credential.id, "Credential must have an id");
2366
+ (0, import_tiny_invariant9.default)(credential.id, "Credential must have an id");
2359
2367
  if (this._processedCredentials.has(credential.id)) {
2360
2368
  continue;
2361
2369
  }
@@ -2368,10 +2376,10 @@ var NotarizationPlugin = class {
2368
2376
  (0, import_log8.log)("extension opened", {
2369
2377
  peer: extension.localPeerId
2370
2378
  }, {
2371
- file: "notarization-plugin.ts",
2372
- line: 208,
2373
- scope: this,
2374
- callSite: (f, a) => f(...a)
2379
+ F: __dxlog_file8,
2380
+ L: 208,
2381
+ S: this,
2382
+ C: (f, a) => f(...a)
2375
2383
  });
2376
2384
  this._extensions.add(extension);
2377
2385
  this._extensionOpened.emit();
@@ -2380,10 +2388,10 @@ var NotarizationPlugin = class {
2380
2388
  (0, import_log8.log)("extension closed", {
2381
2389
  peer: extension.localPeerId
2382
2390
  }, {
2383
- file: "notarization-plugin.ts",
2384
- line: 213,
2385
- scope: this,
2386
- callSite: (f, a) => f(...a)
2391
+ F: __dxlog_file8,
2392
+ L: 213,
2393
+ S: this,
2394
+ C: (f, a) => f(...a)
2387
2395
  });
2388
2396
  this._extensions.delete(extension);
2389
2397
  },
@@ -2424,7 +2432,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
2424
2432
  };
2425
2433
 
2426
2434
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2427
- var __decorate = function(decorators, target, key, desc) {
2435
+ function _ts_decorate(decorators, target, key, desc) {
2428
2436
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2429
2437
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2430
2438
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2433,7 +2441,8 @@ var __decorate = function(decorators, target, key, desc) {
2433
2441
  if (d = decorators[i])
2434
2442
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2435
2443
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2436
- };
2444
+ }
2445
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2437
2446
  var DataSpace = class DataSpace2 {
2438
2447
  constructor(params) {
2439
2448
  this._ctx = new import_context6.Context();
@@ -2520,18 +2529,18 @@ var DataSpace = class DataSpace2 {
2520
2529
  } catch (err) {
2521
2530
  if (err instanceof import_errors3.CancelledError) {
2522
2531
  (0, import_log9.log)("Data pipeline initialization cancelled", err, {
2523
- file: "data-space.ts",
2524
- line: 173,
2525
- scope: this,
2526
- callSite: (f, a) => f(...a)
2532
+ F: __dxlog_file9,
2533
+ L: 173,
2534
+ S: this,
2535
+ C: (f, a) => f(...a)
2527
2536
  });
2528
2537
  return;
2529
2538
  }
2530
2539
  import_log9.log.error("Error initializing data pipeline", err, {
2531
- file: "data-space.ts",
2532
- line: 177,
2533
- scope: this,
2534
- callSite: (f, a) => f(...a)
2540
+ F: __dxlog_file9,
2541
+ L: 177,
2542
+ S: this,
2543
+ C: (f, a) => f(...a)
2535
2544
  });
2536
2545
  this._state = import_services6.SpaceState.ERROR;
2537
2546
  this.error = err;
@@ -2553,11 +2562,11 @@ var DataSpace = class DataSpace2 {
2553
2562
  });
2554
2563
  this.metrics.controlPipelineReady = new Date();
2555
2564
  await this._createWritableFeeds();
2556
- (0, import_log9.log)("Writable feeds created", {}, {
2557
- file: "data-space.ts",
2558
- line: 201,
2559
- scope: this,
2560
- callSite: (f, a) => f(...a)
2565
+ (0, import_log9.log)("Writable feeds created", void 0, {
2566
+ F: __dxlog_file9,
2567
+ L: 201,
2568
+ S: this,
2569
+ C: (f, a) => f(...a)
2561
2570
  });
2562
2571
  this.stateUpdate.emit();
2563
2572
  this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
@@ -2568,22 +2577,22 @@ var DataSpace = class DataSpace2 {
2568
2577
  await this._inner.initializeDataPipeline();
2569
2578
  this.metrics.dataPipelineOpen = new Date();
2570
2579
  await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2571
- (0, import_log9.log)("waiting for data pipeline to reach target timeframe", {}, {
2572
- file: "data-space.ts",
2573
- line: 220,
2574
- scope: this,
2575
- callSite: (f, a) => f(...a)
2580
+ (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
2581
+ F: __dxlog_file9,
2582
+ L: 220,
2583
+ S: this,
2584
+ C: (f, a) => f(...a)
2576
2585
  });
2577
2586
  await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
2578
2587
  ctx: this._ctx,
2579
2588
  breakOnStall: false
2580
2589
  });
2581
2590
  this.metrics.dataPipelineReady = new Date();
2582
- (0, import_log9.log)("data pipeline ready", {}, {
2583
- file: "data-space.ts",
2584
- line: 229,
2585
- scope: this,
2586
- callSite: (f, a) => f(...a)
2591
+ (0, import_log9.log)("data pipeline ready", void 0, {
2592
+ F: __dxlog_file9,
2593
+ L: 229,
2594
+ S: this,
2595
+ C: (f, a) => f(...a)
2587
2596
  });
2588
2597
  await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
2589
2598
  this._state = import_services6.SpaceState.READY;
@@ -2662,10 +2671,10 @@ var DataSpace = class DataSpace2 {
2662
2671
  }
2663
2672
  }
2664
2673
  };
2665
- __decorate([
2674
+ _ts_decorate([
2666
2675
  (0, import_debug3.timed)(1e4)
2667
2676
  ], DataSpace.prototype, "_createWritableFeeds", null);
2668
- DataSpace = __decorate([
2677
+ DataSpace = _ts_decorate([
2669
2678
  (0, import_async11.trackLeaks)("open", "close")
2670
2679
  ], DataSpace);
2671
2680
 
@@ -2740,7 +2749,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2740
2749
  };
2741
2750
 
2742
2751
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2743
- var __decorate2 = function(decorators, target, key, desc) {
2752
+ function _ts_decorate2(decorators, target, key, desc) {
2744
2753
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2745
2754
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2746
2755
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2749,7 +2758,8 @@ var __decorate2 = function(decorators, target, key, desc) {
2749
2758
  if (d = decorators[i])
2750
2759
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2751
2760
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2752
- };
2761
+ }
2762
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
2753
2763
  var DataSpaceManager = class DataSpaceManager2 {
2754
2764
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
2755
2765
  this._spaceManager = _spaceManager;
@@ -2769,38 +2779,38 @@ var DataSpaceManager = class DataSpaceManager2 {
2769
2779
  return this._spaces;
2770
2780
  }
2771
2781
  async open() {
2772
- (0, import_log10.log)("open", {}, {
2773
- file: "data-space-manager.ts",
2774
- line: 80,
2775
- scope: this,
2776
- callSite: (f, a) => f(...a)
2782
+ (0, import_log10.log)("open", void 0, {
2783
+ F: __dxlog_file10,
2784
+ L: 80,
2785
+ S: this,
2786
+ C: (f, a) => f(...a)
2777
2787
  });
2778
2788
  import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
2779
2789
  id: this._instanceId
2780
2790
  }), {
2781
- file: "data-space-manager.ts",
2782
- line: 81,
2783
- scope: this,
2784
- callSite: (f, a) => f(...a)
2791
+ F: __dxlog_file10,
2792
+ L: 81,
2793
+ S: this,
2794
+ C: (f, a) => f(...a)
2785
2795
  });
2786
2796
  await this._metadataStore.load();
2787
2797
  (0, import_log10.log)("metadata loaded", {
2788
2798
  spaces: this._metadataStore.spaces.length
2789
2799
  }, {
2790
- file: "data-space-manager.ts",
2791
- line: 83,
2792
- scope: this,
2793
- callSite: (f, a) => f(...a)
2800
+ F: __dxlog_file10,
2801
+ L: 83,
2802
+ S: this,
2803
+ C: (f, a) => f(...a)
2794
2804
  });
2795
2805
  for (const spaceMetadata of this._metadataStore.spaces) {
2796
2806
  try {
2797
2807
  (0, import_log10.log)("load space", {
2798
2808
  spaceMetadata
2799
2809
  }, {
2800
- file: "data-space-manager.ts",
2801
- line: 87,
2802
- scope: this,
2803
- callSite: (f, a) => f(...a)
2810
+ F: __dxlog_file10,
2811
+ L: 87,
2812
+ S: this,
2813
+ C: (f, a) => f(...a)
2804
2814
  });
2805
2815
  const space = await this._constructSpace(spaceMetadata);
2806
2816
  space.initializeDataPipelineAsync();
@@ -2809,10 +2819,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2809
2819
  spaceMetadata,
2810
2820
  err
2811
2821
  }, {
2812
- file: "data-space-manager.ts",
2813
- line: 91,
2814
- scope: this,
2815
- callSite: (f, a) => f(...a)
2822
+ F: __dxlog_file10,
2823
+ L: 91,
2824
+ S: this,
2825
+ C: (f, a) => f(...a)
2816
2826
  });
2817
2827
  }
2818
2828
  }
@@ -2821,18 +2831,18 @@ var DataSpaceManager = class DataSpaceManager2 {
2821
2831
  import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
2822
2832
  id: this._instanceId
2823
2833
  }), {
2824
- file: "data-space-manager.ts",
2825
- line: 97,
2826
- scope: this,
2827
- callSite: (f, a) => f(...a)
2834
+ F: __dxlog_file10,
2835
+ L: 97,
2836
+ S: this,
2837
+ C: (f, a) => f(...a)
2828
2838
  });
2829
2839
  }
2830
2840
  async close() {
2831
- (0, import_log10.log)("close", {}, {
2832
- file: "data-space-manager.ts",
2833
- line: 102,
2834
- scope: this,
2835
- callSite: (f, a) => f(...a)
2841
+ (0, import_log10.log)("close", void 0, {
2842
+ F: __dxlog_file10,
2843
+ L: 102,
2844
+ S: this,
2845
+ C: (f, a) => f(...a)
2836
2846
  });
2837
2847
  this._isOpen = false;
2838
2848
  await this._ctx.dispose();
@@ -2844,7 +2854,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2844
2854
  * Creates a new space writing the genesis credentials to the control feed.
2845
2855
  */
2846
2856
  async createSpace() {
2847
- (0, import_node_assert10.default)(this._isOpen, "Not open.");
2857
+ (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
2848
2858
  const spaceKey = await this._keyring.createKey();
2849
2859
  const controlFeedKey = await this._keyring.createKey();
2850
2860
  const dataFeedKey = await this._keyring.createKey();
@@ -2857,16 +2867,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2857
2867
  (0, import_log10.log)("creating space...", {
2858
2868
  spaceKey
2859
2869
  }, {
2860
- file: "data-space-manager.ts",
2861
- line: 126,
2862
- scope: this,
2863
- callSite: (f, a) => f(...a)
2870
+ F: __dxlog_file10,
2871
+ L: 126,
2872
+ S: this,
2873
+ C: (f, a) => f(...a)
2864
2874
  });
2865
2875
  const space = await this._constructSpace(metadata);
2866
2876
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
2867
2877
  await this._metadataStore.addSpace(metadata);
2868
2878
  const memberCredential = credentials[1];
2869
- (0, import_node_assert10.default)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2879
+ (0, import_tiny_invariant10.default)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2870
2880
  await this._signingContext.recordCredential(memberCredential);
2871
2881
  await space.initializeDataPipeline();
2872
2882
  this.updated.emit();
@@ -2877,13 +2887,13 @@ var DataSpaceManager = class DataSpaceManager2 {
2877
2887
  (0, import_log10.log)("accept space", {
2878
2888
  opts
2879
2889
  }, {
2880
- file: "data-space-manager.ts",
2881
- line: 145,
2882
- scope: this,
2883
- callSite: (f, a) => f(...a)
2890
+ F: __dxlog_file10,
2891
+ L: 145,
2892
+ S: this,
2893
+ C: (f, a) => f(...a)
2884
2894
  });
2885
- (0, import_node_assert10.default)(this._isOpen, "Not open.");
2886
- (0, import_node_assert10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
2895
+ (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
2896
+ (0, import_tiny_invariant10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
2887
2897
  const metadata = {
2888
2898
  key: opts.spaceKey,
2889
2899
  genesisFeedKey: opts.genesisFeedKey,
@@ -2911,10 +2921,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2911
2921
  (0, import_log10.log)("construct space", {
2912
2922
  metadata
2913
2923
  }, {
2914
- file: "data-space-manager.ts",
2915
- line: 180,
2916
- scope: this,
2917
- callSite: (f, a) => f(...a)
2924
+ F: __dxlog_file10,
2925
+ L: 180,
2926
+ S: this,
2927
+ C: (f, a) => f(...a)
2918
2928
  });
2919
2929
  const gossip = new import_teleport_extension_gossip.Gossip({
2920
2930
  localPeerId: this._signingContext.deviceKey
@@ -2946,11 +2956,11 @@ var DataSpaceManager = class DataSpaceManager2 {
2946
2956
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
2947
2957
  },
2948
2958
  onAuthFailure: () => {
2949
- import_log10.log.warn("auth failure", {}, {
2950
- file: "data-space-manager.ts",
2951
- line: 211,
2952
- scope: this,
2953
- callSite: (f, a) => f(...a)
2959
+ import_log10.log.warn("auth failure", void 0, {
2960
+ F: __dxlog_file10,
2961
+ L: 211,
2962
+ S: this,
2963
+ C: (f, a) => f(...a)
2954
2964
  });
2955
2965
  },
2956
2966
  memberKey: this._signingContext.identityKey
@@ -2970,10 +2980,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2970
2980
  (0, import_log10.log)("before space ready", {
2971
2981
  space: space.key
2972
2982
  }, {
2973
- file: "data-space-manager.ts",
2974
- line: 228,
2975
- scope: this,
2976
- callSite: (f, a) => f(...a)
2983
+ F: __dxlog_file10,
2984
+ L: 228,
2985
+ S: this,
2986
+ C: (f, a) => f(...a)
2977
2987
  });
2978
2988
  this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
2979
2989
  },
@@ -2982,10 +2992,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2982
2992
  space: space.key,
2983
2993
  open: this._isOpen
2984
2994
  }, {
2985
- file: "data-space-manager.ts",
2986
- line: 235,
2987
- scope: this,
2988
- callSite: (f, a) => f(...a)
2995
+ F: __dxlog_file10,
2996
+ L: 235,
2997
+ S: this,
2998
+ C: (f, a) => f(...a)
2989
2999
  });
2990
3000
  if (this._isOpen) {
2991
3001
  this.updated.emit();
@@ -3005,19 +3015,19 @@ var DataSpaceManager = class DataSpaceManager2 {
3005
3015
  return dataSpace;
3006
3016
  }
3007
3017
  };
3008
- __decorate2([
3018
+ _ts_decorate2([
3009
3019
  import_async12.synchronized
3010
3020
  ], DataSpaceManager.prototype, "open", null);
3011
- __decorate2([
3021
+ _ts_decorate2([
3012
3022
  import_async12.synchronized
3013
3023
  ], DataSpaceManager.prototype, "close", null);
3014
- __decorate2([
3024
+ _ts_decorate2([
3015
3025
  import_async12.synchronized
3016
3026
  ], DataSpaceManager.prototype, "createSpace", null);
3017
- __decorate2([
3027
+ _ts_decorate2([
3018
3028
  import_async12.synchronized
3019
3029
  ], DataSpaceManager.prototype, "acceptSpace", null);
3020
- DataSpaceManager = __decorate2([
3030
+ DataSpaceManager = _ts_decorate2([
3021
3031
  (0, import_async12.trackLeaks)("open", "close")
3022
3032
  ], DataSpaceManager);
3023
3033
 
@@ -3030,6 +3040,7 @@ var import_log11 = require("@dxos/log");
3030
3040
  var import_protocols7 = require("@dxos/protocols");
3031
3041
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
3032
3042
  var import_util6 = require("@dxos/util");
3043
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
3033
3044
  var SpacesServiceImpl = class {
3034
3045
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
3035
3046
  this._identityManager = _identityManager;
@@ -3056,10 +3067,10 @@ var SpacesServiceImpl = class {
3056
3067
  (0, import_log11.log)("update", {
3057
3068
  spaces
3058
3069
  }, {
3059
- file: "spaces-service.ts",
3060
- line: 60,
3061
- scope: this,
3062
- callSite: (f, a) => f(...a)
3070
+ F: __dxlog_file11,
3071
+ L: 60,
3072
+ S: this,
3073
+ C: (f, a) => f(...a)
3063
3074
  });
3064
3075
  next({
3065
3076
  spaces
@@ -3186,6 +3197,7 @@ var SpacesServiceImpl = class {
3186
3197
  var getChannelId = (channel) => `user-channel/${channel}`;
3187
3198
 
3188
3199
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3200
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3189
3201
  var ServiceContext = class {
3190
3202
  // prettier-ignore
3191
3203
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3229,17 +3241,17 @@ var ServiceContext = class {
3229
3241
  import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
3230
3242
  id: this._instanceId
3231
3243
  }), {
3232
- file: "service-context.ts",
3233
- line: 126,
3234
- scope: this,
3235
- callSite: (f, a) => f(...a)
3244
+ F: __dxlog_file12,
3245
+ L: 126,
3246
+ S: this,
3247
+ C: (f, a) => f(...a)
3236
3248
  });
3237
3249
  await this._checkStorageVersion();
3238
- (0, import_log12.log)("opening...", {}, {
3239
- file: "service-context.ts",
3240
- line: 130,
3241
- scope: this,
3242
- callSite: (f, a) => f(...a)
3250
+ (0, import_log12.log)("opening...", void 0, {
3251
+ F: __dxlog_file12,
3252
+ L: 130,
3253
+ S: this,
3254
+ C: (f, a) => f(...a)
3243
3255
  });
3244
3256
  await this.signalManager.open();
3245
3257
  await this.networkManager.open();
@@ -3248,28 +3260,28 @@ var ServiceContext = class {
3248
3260
  if (this.identityManager.identity) {
3249
3261
  await this._initialize();
3250
3262
  }
3251
- (0, import_log12.log)("opened", {}, {
3252
- file: "service-context.ts",
3253
- line: 138,
3254
- scope: this,
3255
- callSite: (f, a) => f(...a)
3263
+ (0, import_log12.log)("opened", void 0, {
3264
+ F: __dxlog_file12,
3265
+ L: 138,
3266
+ S: this,
3267
+ C: (f, a) => f(...a)
3256
3268
  });
3257
3269
  import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
3258
3270
  id: this._instanceId
3259
3271
  }), {
3260
- file: "service-context.ts",
3261
- line: 139,
3262
- scope: this,
3263
- callSite: (f, a) => f(...a)
3272
+ F: __dxlog_file12,
3273
+ L: 139,
3274
+ S: this,
3275
+ C: (f, a) => f(...a)
3264
3276
  });
3265
3277
  }
3266
3278
  async close() {
3267
3279
  var _a, _b;
3268
- (0, import_log12.log)("closing...", {}, {
3269
- file: "service-context.ts",
3270
- line: 143,
3271
- scope: this,
3272
- callSite: (f, a) => f(...a)
3280
+ (0, import_log12.log)("closing...", void 0, {
3281
+ F: __dxlog_file12,
3282
+ L: 143,
3283
+ S: this,
3284
+ C: (f, a) => f(...a)
3273
3285
  });
3274
3286
  await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
3275
3287
  await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
@@ -3279,11 +3291,11 @@ var ServiceContext = class {
3279
3291
  await this.networkManager.close();
3280
3292
  await this.signalManager.close();
3281
3293
  this.dataServiceSubscriptions.clear();
3282
- (0, import_log12.log)("closed", {}, {
3283
- file: "service-context.ts",
3284
- line: 152,
3285
- scope: this,
3286
- callSite: (f, a) => f(...a)
3294
+ (0, import_log12.log)("closed", void 0, {
3295
+ F: __dxlog_file12,
3296
+ L: 152,
3297
+ S: this,
3298
+ C: (f, a) => f(...a)
3287
3299
  });
3288
3300
  }
3289
3301
  async createIdentity(params = {}) {
@@ -3293,7 +3305,7 @@ var ServiceContext = class {
3293
3305
  }
3294
3306
  getInvitationHandler(invitation) {
3295
3307
  const factory = this._handlerFactories.get(invitation.kind);
3296
- (0, import_node_assert11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
3308
+ (0, import_tiny_invariant11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
3297
3309
  return factory(invitation);
3298
3310
  }
3299
3311
  async _acceptIdentity(params) {
@@ -3310,11 +3322,11 @@ var ServiceContext = class {
3310
3322
  // Called when identity is created.
3311
3323
  async _initialize() {
3312
3324
  var _a;
3313
- (0, import_log12.log)("initializing spaces...", {}, {
3314
- file: "service-context.ts",
3315
- line: 185,
3316
- scope: this,
3317
- callSite: (f, a) => f(...a)
3325
+ (0, import_log12.log)("initializing spaces...", void 0, {
3326
+ F: __dxlog_file12,
3327
+ L: 185,
3328
+ S: this,
3329
+ C: (f, a) => f(...a)
3318
3330
  });
3319
3331
  const identity = (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
3320
3332
  const signingContext = {
@@ -3333,7 +3345,7 @@ var ServiceContext = class {
3333
3345
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3334
3346
  await this.dataSpaceManager.open();
3335
3347
  this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
3336
- (0, import_node_assert11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3348
+ (0, import_tiny_invariant11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3337
3349
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
3338
3350
  });
3339
3351
  this.initialized.wake();
@@ -3350,10 +3362,10 @@ var ServiceContext = class {
3350
3362
  (0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
3351
3363
  details: assertion
3352
3364
  }, {
3353
- file: "service-context.ts",
3354
- line: 224,
3355
- scope: this,
3356
- callSite: (f, a) => f(...a)
3365
+ F: __dxlog_file12,
3366
+ L: 224,
3367
+ S: this,
3368
+ C: (f, a) => f(...a)
3357
3369
  });
3358
3370
  return;
3359
3371
  }
@@ -3361,10 +3373,10 @@ var ServiceContext = class {
3361
3373
  (0, import_log12.log)("space already exists, ignoring space admission", {
3362
3374
  details: assertion
3363
3375
  }, {
3364
- file: "service-context.ts",
3365
- line: 228,
3366
- scope: this,
3367
- callSite: (f, a) => f(...a)
3376
+ F: __dxlog_file12,
3377
+ L: 228,
3378
+ S: this,
3379
+ C: (f, a) => f(...a)
3368
3380
  });
3369
3381
  return;
3370
3382
  }
@@ -3372,21 +3384,21 @@ var ServiceContext = class {
3372
3384
  (0, import_log12.log)("accepting space recorded in halo", {
3373
3385
  details: assertion
3374
3386
  }, {
3375
- file: "service-context.ts",
3376
- line: 233,
3377
- scope: this,
3378
- callSite: (f, a) => f(...a)
3387
+ F: __dxlog_file12,
3388
+ L: 233,
3389
+ S: this,
3390
+ C: (f, a) => f(...a)
3379
3391
  });
3380
3392
  await this.dataSpaceManager.acceptSpace({
3381
3393
  spaceKey: assertion.spaceKey,
3382
3394
  genesisFeedKey: assertion.genesisFeedKey
3383
3395
  });
3384
3396
  } catch (err) {
3385
- import_log12.log.catch(err, {}, {
3386
- file: "service-context.ts",
3387
- line: 239,
3388
- scope: this,
3389
- callSite: (f, a) => f(...a)
3397
+ import_log12.log.catch(err, void 0, {
3398
+ F: __dxlog_file12,
3399
+ L: 239,
3400
+ S: this,
3401
+ C: (f, a) => f(...a)
3390
3402
  });
3391
3403
  }
3392
3404
  }
@@ -3396,16 +3408,19 @@ var ServiceContext = class {
3396
3408
  };
3397
3409
 
3398
3410
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3399
- var import_node_assert13 = __toESM(require("node:assert"));
3411
+ var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
3400
3412
  var import_async17 = require("@dxos/async");
3401
3413
  var import_client_protocol5 = require("@dxos/client-protocol");
3414
+ var import_document_model = require("@dxos/document-model");
3402
3415
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3403
3416
  var import_keys11 = require("@dxos/keys");
3404
3417
  var import_log15 = require("@dxos/log");
3405
3418
  var import_messaging = require("@dxos/messaging");
3419
+ var import_model_factory = require("@dxos/model-factory");
3406
3420
  var import_network_manager2 = require("@dxos/network-manager");
3407
3421
  var import_protocols9 = require("@dxos/protocols");
3408
3422
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
3423
+ var import_text_model = require("@dxos/text-model");
3409
3424
 
3410
3425
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3411
3426
  var import_async15 = require("@dxos/async");
@@ -3455,10 +3470,10 @@ var DevicesServiceImpl = class {
3455
3470
  };
3456
3471
 
3457
3472
  // packages/sdk/client-services/src/packlets/locks/node.ts
3458
- var import_node_assert12 = __toESM(require("node:assert"));
3473
+ var import_tiny_invariant12 = __toESM(require("tiny-invariant"));
3459
3474
  var import_lock_file = require("@dxos/lock-file");
3460
3475
  var import_log13 = require("@dxos/log");
3461
- var __decorate3 = function(decorators, target, key, desc) {
3476
+ function _ts_decorate3(decorators, target, key, desc) {
3462
3477
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3463
3478
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3464
3479
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3467,7 +3482,8 @@ var __decorate3 = function(decorators, target, key, desc) {
3467
3482
  if (d = decorators[i])
3468
3483
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3469
3484
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3470
- };
3485
+ }
3486
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
3471
3487
  var Lock = class {
3472
3488
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
3473
3489
  this._lockPath = lockPath;
@@ -3479,29 +3495,29 @@ var Lock = class {
3479
3495
  }
3480
3496
  async acquire() {
3481
3497
  var _a;
3482
- (0, import_log13.log)("acquiring lock...", {}, {
3483
- file: "node.ts",
3484
- line: 32,
3485
- scope: this,
3486
- callSite: (f, a) => f(...a)
3498
+ (0, import_log13.log)("acquiring lock...", void 0, {
3499
+ F: __dxlog_file13,
3500
+ L: 32,
3501
+ S: this,
3502
+ C: (f, a) => f(...a)
3487
3503
  });
3488
3504
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
3489
3505
  await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
3490
- (0, import_log13.log)("acquired lock", {}, {
3491
- file: "node.ts",
3492
- line: 37,
3493
- scope: this,
3494
- callSite: (f, a) => f(...a)
3506
+ (0, import_log13.log)("acquired lock", void 0, {
3507
+ F: __dxlog_file13,
3508
+ L: 37,
3509
+ S: this,
3510
+ C: (f, a) => f(...a)
3495
3511
  });
3496
3512
  }
3497
3513
  async release() {
3498
3514
  var _a;
3499
3515
  await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
3500
- (0, import_node_assert12.default)(this._fileHandle, "Lock is not acquired");
3516
+ (0, import_tiny_invariant12.default)(this._fileHandle, "Lock is not acquired");
3501
3517
  await import_lock_file.LockFile.release(this._fileHandle);
3502
3518
  }
3503
3519
  };
3504
- __decorate3([
3520
+ _ts_decorate3([
3505
3521
  import_log13.logInfo
3506
3522
  ], Lock.prototype, "lockKey", null);
3507
3523
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
@@ -3533,7 +3549,7 @@ var LoggingServiceImpl = class {
3533
3549
  if (LOG_PROCESSING > 0) {
3534
3550
  return;
3535
3551
  }
3536
- if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3552
+ if (((_a = entry2.meta) == null ? void 0 : _a.F.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3537
3553
  return;
3538
3554
  }
3539
3555
  if (!shouldLog(entry2, request)) {
@@ -3545,8 +3561,8 @@ var LoggingServiceImpl = class {
3545
3561
  timestamp: new Date(),
3546
3562
  meta: {
3547
3563
  // TODO(dmaretskyi): Fix proto.
3548
- file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
3549
- line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
3564
+ file: (_c = (_b = entry2.meta) == null ? void 0 : _b.F) != null ? _c : "",
3565
+ line: (_e = (_d = entry2.meta) == null ? void 0 : _d.L) != null ? _e : 0
3550
3566
  }
3551
3567
  };
3552
3568
  try {
@@ -3576,7 +3592,7 @@ var shouldLog = (entry2, request) => {
3576
3592
  } else {
3577
3593
  return request.filters.some((filter) => {
3578
3594
  var _a2, _b;
3579
- return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
3595
+ return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.F) != null ? _b : "", options);
3580
3596
  });
3581
3597
  }
3582
3598
  };
@@ -3726,7 +3742,7 @@ var ServiceRegistry = class {
3726
3742
  };
3727
3743
 
3728
3744
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3729
- var __decorate4 = function(decorators, target, key, desc) {
3745
+ function _ts_decorate4(decorators, target, key, desc) {
3730
3746
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3731
3747
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3732
3748
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3735,24 +3751,30 @@ var __decorate4 = function(decorators, target, key, desc) {
3735
3751
  if (d = decorators[i])
3736
3752
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3737
3753
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3754
+ }
3755
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
3756
+ var createDefaultModelFactory = () => {
3757
+ return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
3738
3758
  };
3739
3759
  var ClientServicesHost = class {
3740
3760
  constructor({
3741
3761
  config,
3742
- modelFactory = (0, import_client_protocol5.createDefaultModelFactory)(),
3762
+ modelFactory = createDefaultModelFactory(),
3743
3763
  // TODO(burdon): Create ApolloLink abstraction (see Client).
3744
3764
  transportFactory,
3745
3765
  signalManager,
3746
3766
  connectionLog,
3747
3767
  storage,
3748
3768
  // TODO(wittjosiah): Turn this on by default.
3749
- lockKey
3769
+ lockKey,
3770
+ callbacks
3750
3771
  } = {}) {
3751
3772
  this._statusUpdate = new import_async17.Event();
3752
3773
  this._opening = false;
3753
3774
  this._open = false;
3754
3775
  this._storage = storage;
3755
3776
  this._modelFactory = modelFactory;
3777
+ this._callbacks = callbacks;
3756
3778
  if (config) {
3757
3779
  this.initialize({
3758
3780
  config,
@@ -3811,9 +3833,9 @@ var ClientServicesHost = class {
3811
3833
  */
3812
3834
  initialize({ config, ...options }) {
3813
3835
  var _a, _b, _c;
3814
- (0, import_node_assert13.default)(!this._open, "service host is open");
3836
+ (0, import_tiny_invariant13.default)(!this._open, "service host is open");
3815
3837
  if (config) {
3816
- (0, import_node_assert13.default)(!this._config, "config already set");
3838
+ (0, import_tiny_invariant13.default)(!this._config, "config already set");
3817
3839
  this._config = config;
3818
3840
  if (!this._storage) {
3819
3841
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
@@ -3823,7 +3845,7 @@ var ClientServicesHost = class {
3823
3845
  iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
3824
3846
  }), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
3825
3847
  this._signalManager = signalManager;
3826
- (0, import_node_assert13.default)(!this._networkManager, "network manager already set");
3848
+ (0, import_tiny_invariant13.default)(!this._networkManager, "network manager already set");
3827
3849
  this._networkManager = new import_network_manager2.NetworkManager({
3828
3850
  log: connectionLog,
3829
3851
  transportFactory,
@@ -3839,23 +3861,23 @@ var ClientServicesHost = class {
3839
3861
  import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
3840
3862
  id: traceId
3841
3863
  }), {
3842
- file: "service-host.ts",
3843
- line: 188,
3844
- scope: this,
3845
- callSite: (f, a) => f(...a)
3846
- });
3847
- (0, import_node_assert13.default)(this._config, "config not set");
3848
- (0, import_node_assert13.default)(this._storage, "storage not set");
3849
- (0, import_node_assert13.default)(this._signalManager, "signal manager not set");
3850
- (0, import_node_assert13.default)(this._networkManager, "network manager not set");
3864
+ F: __dxlog_file14,
3865
+ L: 203,
3866
+ S: this,
3867
+ C: (f, a) => f(...a)
3868
+ });
3869
+ (0, import_tiny_invariant13.default)(this._config, "config not set");
3870
+ (0, import_tiny_invariant13.default)(this._storage, "storage not set");
3871
+ (0, import_tiny_invariant13.default)(this._signalManager, "signal manager not set");
3872
+ (0, import_tiny_invariant13.default)(this._networkManager, "network manager not set");
3851
3873
  this._opening = true;
3852
3874
  (0, import_log15.log)("opening...", {
3853
3875
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3854
3876
  }, {
3855
- file: "service-host.ts",
3856
- line: 196,
3857
- scope: this,
3858
- callSite: (f, a) => f(...a)
3877
+ F: __dxlog_file14,
3878
+ L: 211,
3879
+ S: this,
3880
+ C: (f, a) => f(...a)
3859
3881
  });
3860
3882
  await ((_b = this._resourceLock) == null ? void 0 : _b.acquire());
3861
3883
  await this._loggingService.open();
@@ -3887,18 +3909,18 @@ var ClientServicesHost = class {
3887
3909
  (0, import_log15.log)("opened", {
3888
3910
  deviceKey
3889
3911
  }, {
3890
- file: "service-host.ts",
3891
- line: 251,
3892
- scope: this,
3893
- callSite: (f, a) => f(...a)
3912
+ F: __dxlog_file14,
3913
+ L: 266,
3914
+ S: this,
3915
+ C: (f, a) => f(...a)
3894
3916
  });
3895
3917
  import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
3896
3918
  id: traceId
3897
3919
  }), {
3898
- file: "service-host.ts",
3899
- line: 252,
3900
- scope: this,
3901
- callSite: (f, a) => f(...a)
3920
+ F: __dxlog_file14,
3921
+ L: 267,
3922
+ S: this,
3923
+ C: (f, a) => f(...a)
3902
3924
  });
3903
3925
  }
3904
3926
  async close() {
@@ -3910,10 +3932,10 @@ var ClientServicesHost = class {
3910
3932
  (0, import_log15.log)("closing...", {
3911
3933
  deviceKey
3912
3934
  }, {
3913
- file: "service-host.ts",
3914
- line: 262,
3915
- scope: this,
3916
- callSite: (f, a) => f(...a)
3935
+ F: __dxlog_file14,
3936
+ L: 277,
3937
+ S: this,
3938
+ C: (f, a) => f(...a)
3917
3939
  });
3918
3940
  this._serviceRegistry.setServices({
3919
3941
  SystemService: this._systemService
@@ -3925,51 +3947,52 @@ var ClientServicesHost = class {
3925
3947
  (0, import_log15.log)("closed", {
3926
3948
  deviceKey
3927
3949
  }, {
3928
- file: "service-host.ts",
3929
- line: 268,
3930
- scope: this,
3931
- callSite: (f, a) => f(...a)
3950
+ F: __dxlog_file14,
3951
+ L: 283,
3952
+ S: this,
3953
+ C: (f, a) => f(...a)
3932
3954
  });
3933
3955
  }
3934
3956
  async reset() {
3935
- var _a;
3957
+ var _a, _b, _c;
3936
3958
  const traceId = import_keys11.PublicKey.random().toHex();
3937
3959
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
3938
3960
  id: traceId
3939
3961
  }), {
3940
- file: "service-host.ts",
3941
- line: 273,
3942
- scope: this,
3943
- callSite: (f, a) => f(...a)
3962
+ F: __dxlog_file14,
3963
+ L: 288,
3964
+ S: this,
3965
+ C: (f, a) => f(...a)
3944
3966
  });
3945
- (0, import_log15.log)("resetting...", {}, {
3946
- file: "service-host.ts",
3947
- line: 275,
3948
- scope: this,
3949
- callSite: (f, a) => f(...a)
3967
+ (0, import_log15.log)("resetting...", void 0, {
3968
+ F: __dxlog_file14,
3969
+ L: 290,
3970
+ S: this,
3971
+ C: (f, a) => f(...a)
3950
3972
  });
3951
3973
  await ((_a = this._serviceContext) == null ? void 0 : _a.close());
3952
3974
  await this._storage.reset();
3953
- (0, import_log15.log)("reset", {}, {
3954
- file: "service-host.ts",
3955
- line: 278,
3956
- scope: this,
3957
- callSite: (f, a) => f(...a)
3975
+ (0, import_log15.log)("reset", void 0, {
3976
+ F: __dxlog_file14,
3977
+ L: 293,
3978
+ S: this,
3979
+ C: (f, a) => f(...a)
3958
3980
  });
3959
3981
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
3960
3982
  id: traceId
3961
3983
  }), {
3962
- file: "service-host.ts",
3963
- line: 279,
3964
- scope: this,
3965
- callSite: (f, a) => f(...a)
3984
+ F: __dxlog_file14,
3985
+ L: 294,
3986
+ S: this,
3987
+ C: (f, a) => f(...a)
3966
3988
  });
3989
+ await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
3967
3990
  }
3968
3991
  };
3969
- __decorate4([
3992
+ _ts_decorate4([
3970
3993
  import_async17.synchronized
3971
3994
  ], ClientServicesHost.prototype, "open", null);
3972
- __decorate4([
3995
+ _ts_decorate4([
3973
3996
  import_async17.synchronized
3974
3997
  ], ClientServicesHost.prototype, "close", null);
3975
3998
 
@@ -4035,7 +4058,7 @@ var ClientRpcServer = class {
4035
4058
  };
4036
4059
 
4037
4060
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
4038
- var import_node_assert14 = __toESM(require("node:assert"));
4061
+ var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
4039
4062
  var import_async18 = require("@dxos/async");
4040
4063
  var import_client_protocol6 = require("@dxos/client-protocol");
4041
4064
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
@@ -4065,7 +4088,7 @@ var ShellRuntimeImpl = class {
4065
4088
  });
4066
4089
  }
4067
4090
  async setAppContext(context) {
4068
- (0, import_node_assert14.default)(this._appRpc, "runtime not open");
4091
+ (0, import_tiny_invariant14.default)(this._appRpc, "runtime not open");
4069
4092
  await this._appRpc.rpc.AppService.setContext(context);
4070
4093
  }
4071
4094
  async open() {
@@ -4092,39 +4115,9 @@ var ShellRuntimeImpl = class {
4092
4115
  this._appRpc = void 0;
4093
4116
  }
4094
4117
  };
4095
- var MemoryShellRuntime = class {
4096
- constructor({ layout, invitationCode, spaceKey } = {}) {
4097
- this.layoutUpdate = new import_async18.Event();
4098
- this.contextUpdate = new import_async18.Event();
4099
- this._layout = layout != null ? layout : import_iframe.ShellLayout.DEFAULT;
4100
- this._invitationCode = invitationCode;
4101
- this._spaceKey = spaceKey;
4102
- }
4103
- get layout() {
4104
- return this._layout;
4105
- }
4106
- get invitationCode() {
4107
- return this._invitationCode;
4108
- }
4109
- get spaceKey() {
4110
- return this._spaceKey;
4111
- }
4112
- setLayout(layout, options = {}) {
4113
- this._layout = layout;
4114
- this._invitationCode = options.invitationCode;
4115
- this._spaceKey = options.spaceKey;
4116
- this.layoutUpdate.emit({
4117
- layout,
4118
- ...options
4119
- });
4120
- }
4121
- async setAppContext(context) {
4122
- this.contextUpdate.emit(context);
4123
- }
4124
- };
4125
4118
 
4126
4119
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
4127
- var __decorate5 = function(decorators, target, key, desc) {
4120
+ function _ts_decorate5(decorators, target, key, desc) {
4128
4121
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4129
4122
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4130
4123
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4133,7 +4126,8 @@ var __decorate5 = function(decorators, target, key, desc) {
4133
4126
  if (d = decorators[i])
4134
4127
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4135
4128
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4136
- };
4129
+ }
4130
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
4137
4131
  var LOCK_KEY = "DXOS_RESOURCE_LOCK";
4138
4132
  var IFrameHostRuntime = class {
4139
4133
  constructor({ config, origin, appPort, shellPort }) {
@@ -4154,11 +4148,11 @@ var IFrameHostRuntime = class {
4154
4148
  }
4155
4149
  async start() {
4156
4150
  var _a;
4157
- (0, import_log16.log)("starting...", {}, {
4158
- file: "iframe-host-runtime.ts",
4159
- line: 70,
4160
- scope: this,
4161
- callSite: (f, a) => f(...a)
4151
+ (0, import_log16.log)("starting...", void 0, {
4152
+ F: __dxlog_file15,
4153
+ L: 70,
4154
+ S: this,
4155
+ C: (f, a) => f(...a)
4162
4156
  });
4163
4157
  try {
4164
4158
  this._config = await (0, import_util9.getAsyncValue)(this._configProvider);
@@ -4203,42 +4197,42 @@ var IFrameHostRuntime = class {
4203
4197
  (_a = this._shellRuntime) == null ? void 0 : _a.open()
4204
4198
  ]);
4205
4199
  this._ready.wake(void 0);
4206
- (0, import_log16.log)("started", {}, {
4207
- file: "iframe-host-runtime.ts",
4208
- line: 113,
4209
- scope: this,
4210
- callSite: (f, a) => f(...a)
4200
+ (0, import_log16.log)("started", void 0, {
4201
+ F: __dxlog_file15,
4202
+ L: 113,
4203
+ S: this,
4204
+ C: (f, a) => f(...a)
4211
4205
  });
4212
4206
  } catch (err) {
4213
4207
  this._ready.wake(err);
4214
- import_log16.log.catch(err, {}, {
4215
- file: "iframe-host-runtime.ts",
4216
- line: 116,
4217
- scope: this,
4218
- callSite: (f, a) => f(...a)
4208
+ import_log16.log.catch(err, void 0, {
4209
+ F: __dxlog_file15,
4210
+ L: 116,
4211
+ S: this,
4212
+ C: (f, a) => f(...a)
4219
4213
  });
4220
4214
  }
4221
4215
  }
4222
4216
  async stop() {
4223
4217
  var _a;
4224
- (0, import_log16.log)("stopping...", {}, {
4225
- file: "iframe-host-runtime.ts",
4226
- line: 121,
4227
- scope: this,
4228
- callSite: (f, a) => f(...a)
4218
+ (0, import_log16.log)("stopping...", void 0, {
4219
+ F: __dxlog_file15,
4220
+ L: 121,
4221
+ S: this,
4222
+ C: (f, a) => f(...a)
4229
4223
  });
4230
4224
  await this._clientRpc.close();
4231
4225
  await this._clientServices.close();
4232
4226
  await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
4233
- (0, import_log16.log)("stopped", {}, {
4234
- file: "iframe-host-runtime.ts",
4235
- line: 125,
4236
- scope: this,
4237
- callSite: (f, a) => f(...a)
4227
+ (0, import_log16.log)("stopped", void 0, {
4228
+ F: __dxlog_file15,
4229
+ L: 125,
4230
+ S: this,
4231
+ C: (f, a) => f(...a)
4238
4232
  });
4239
4233
  }
4240
4234
  };
4241
- __decorate5([
4235
+ _ts_decorate5([
4242
4236
  import_log16.logInfo
4243
4237
  ], IFrameHostRuntime.prototype, "origin", void 0);
4244
4238
 
@@ -4250,6 +4244,7 @@ var import_log17 = require("@dxos/log");
4250
4244
  var import_network_manager4 = require("@dxos/network-manager");
4251
4245
  var import_rpc3 = require("@dxos/rpc");
4252
4246
  var import_util10 = require("@dxos/util");
4247
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
4253
4248
  var IFrameProxyRuntime = class {
4254
4249
  constructor({ config, systemPort, shellPort }) {
4255
4250
  this._id = String(Math.floor(Math.random() * 1e6));
@@ -4297,11 +4292,11 @@ var IFrameProxyRuntime = class {
4297
4292
  lockKey
4298
4293
  });
4299
4294
  } catch (err) {
4300
- import_log17.log.catch(err, {}, {
4301
- file: "iframe-proxy-runtime.ts",
4302
- line: 85,
4303
- scope: this,
4304
- callSite: (f, a) => f(...a)
4295
+ import_log17.log.catch(err, void 0, {
4296
+ F: __dxlog_file16,
4297
+ L: 85,
4298
+ S: this,
4299
+ C: (f, a) => f(...a)
4305
4300
  });
4306
4301
  throw new import_errors5.RemoteServiceConnectionError("Failed to connect to worker");
4307
4302
  }
@@ -4326,13 +4321,13 @@ var import_messaging3 = require("@dxos/messaging");
4326
4321
  var import_network_manager5 = require("@dxos/network-manager");
4327
4322
 
4328
4323
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
4329
- var import_node_assert15 = __toESM(require("node:assert"));
4324
+ var import_tiny_invariant15 = __toESM(require("tiny-invariant"));
4330
4325
  var import_async21 = require("@dxos/async");
4331
4326
  var import_client_protocol9 = require("@dxos/client-protocol");
4332
4327
  var import_log18 = require("@dxos/log");
4333
4328
  var import_rpc4 = require("@dxos/rpc");
4334
4329
  var import_util11 = require("@dxos/util");
4335
- var __decorate6 = function(decorators, target, key, desc) {
4330
+ function _ts_decorate6(decorators, target, key, desc) {
4336
4331
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4337
4332
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4338
4333
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4341,12 +4336,13 @@ var __decorate6 = function(decorators, target, key, desc) {
4341
4336
  if (d = decorators[i])
4342
4337
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4343
4338
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4344
- };
4339
+ }
4340
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
4345
4341
  var WorkerSession = class {
4346
4342
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
4347
4343
  this._startTrigger = new import_async21.Trigger();
4348
4344
  this.onClose = new import_util11.Callback();
4349
- (0, import_node_assert15.default)(serviceHost);
4345
+ (0, import_tiny_invariant15.default)(serviceHost);
4350
4346
  this._serviceHost = serviceHost;
4351
4347
  const middleware = {
4352
4348
  handleCall: async (method, params, handler) => {
@@ -4393,11 +4389,11 @@ var WorkerSession = class {
4393
4389
  try {
4394
4390
  await this.close();
4395
4391
  } catch (err) {
4396
- import_log18.log.catch(err, {}, {
4397
- file: "worker-session.ts",
4398
- line: 100,
4399
- scope: this,
4400
- callSite: (f, a) => f(...a)
4392
+ import_log18.log.catch(err, void 0, {
4393
+ F: __dxlog_file17,
4394
+ L: 100,
4395
+ S: this,
4396
+ C: (f, a) => f(...a)
4401
4397
  });
4402
4398
  }
4403
4399
  });
@@ -4410,11 +4406,11 @@ var WorkerSession = class {
4410
4406
  this.bridgeService = this._iframeRpc.rpc.BridgeService;
4411
4407
  }
4412
4408
  async open() {
4413
- import_log18.log.info("opening..", {}, {
4414
- file: "worker-session.ts",
4415
- line: 114,
4416
- scope: this,
4417
- callSite: (f, a) => f(...a)
4409
+ import_log18.log.info("opening..", void 0, {
4410
+ F: __dxlog_file17,
4411
+ L: 114,
4412
+ S: this,
4413
+ C: (f, a) => f(...a)
4418
4414
  });
4419
4415
  await Promise.all([
4420
4416
  this._clientRpc.open(),
@@ -4429,20 +4425,20 @@ var WorkerSession = class {
4429
4425
  }
4430
4426
  }
4431
4427
  async close() {
4432
- import_log18.log.info("closing..", {}, {
4433
- file: "worker-session.ts",
4434
- line: 124,
4435
- scope: this,
4436
- callSite: (f, a) => f(...a)
4428
+ import_log18.log.info("closing..", void 0, {
4429
+ F: __dxlog_file17,
4430
+ L: 124,
4431
+ S: this,
4432
+ C: (f, a) => f(...a)
4437
4433
  });
4438
4434
  try {
4439
4435
  await this.onClose.callIfSet();
4440
4436
  } catch (err) {
4441
- import_log18.log.catch(err, {}, {
4442
- file: "worker-session.ts",
4443
- line: 128,
4444
- scope: this,
4445
- callSite: (f, a) => f(...a)
4437
+ import_log18.log.catch(err, void 0, {
4438
+ F: __dxlog_file17,
4439
+ L: 128,
4440
+ S: this,
4441
+ C: (f, a) => f(...a)
4446
4442
  });
4447
4443
  }
4448
4444
  await Promise.all([
@@ -4454,11 +4450,11 @@ var WorkerSession = class {
4454
4450
  try {
4455
4451
  await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
4456
4452
  } catch (e) {
4457
- import_log18.log.info("No shell connected.", {}, {
4458
- file: "worker-session.ts",
4459
- line: 138,
4460
- scope: this,
4461
- callSite: (f, a) => f(...a)
4453
+ import_log18.log.info("No shell connected.", void 0, {
4454
+ F: __dxlog_file17,
4455
+ L: 138,
4456
+ S: this,
4457
+ C: (f, a) => f(...a)
4462
4458
  });
4463
4459
  }
4464
4460
  }
@@ -4467,14 +4463,15 @@ var WorkerSession = class {
4467
4463
  }).then(callback);
4468
4464
  }
4469
4465
  };
4470
- __decorate6([
4466
+ _ts_decorate6([
4471
4467
  import_log18.logInfo
4472
4468
  ], WorkerSession.prototype, "origin", void 0);
4473
- __decorate6([
4469
+ _ts_decorate6([
4474
4470
  import_log18.logInfo
4475
4471
  ], WorkerSession.prototype, "lockKey", void 0);
4476
4472
 
4477
4473
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
4474
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
4478
4475
  var WorkerRuntime = class {
4479
4476
  // prettier-ignore
4480
4477
  constructor(_configProvider) {
@@ -4482,17 +4479,23 @@ var WorkerRuntime = class {
4482
4479
  this._transportFactory = new import_network_manager5.WebRTCTransportProxyFactory();
4483
4480
  this._ready = new import_async22.Trigger();
4484
4481
  this.sessions = /* @__PURE__ */ new Set();
4485
- this._clientServices = new ClientServicesHost();
4482
+ this._clientServices = new ClientServicesHost({
4483
+ callbacks: {
4484
+ onReset: async () => {
4485
+ self.close();
4486
+ }
4487
+ }
4488
+ });
4486
4489
  }
4487
4490
  get host() {
4488
4491
  return this._clientServices;
4489
4492
  }
4490
4493
  async start() {
4491
- (0, import_log19.log)("starting...", {}, {
4492
- file: "worker-runtime.ts",
4493
- line: 48,
4494
- scope: this,
4495
- callSite: (f, a) => f(...a)
4494
+ (0, import_log19.log)("starting...", void 0, {
4495
+ F: __dxlog_file18,
4496
+ L: 48,
4497
+ S: this,
4498
+ C: (f, a) => f(...a)
4496
4499
  });
4497
4500
  try {
4498
4501
  this._config = await this._configProvider();
@@ -4504,19 +4507,19 @@ var WorkerRuntime = class {
4504
4507
  });
4505
4508
  await this._clientServices.open();
4506
4509
  this._ready.wake(void 0);
4507
- (0, import_log19.log)("started", {}, {
4508
- file: "worker-runtime.ts",
4509
- line: 62,
4510
- scope: this,
4511
- callSite: (f, a) => f(...a)
4510
+ (0, import_log19.log)("started", void 0, {
4511
+ F: __dxlog_file18,
4512
+ L: 62,
4513
+ S: this,
4514
+ C: (f, a) => f(...a)
4512
4515
  });
4513
4516
  } catch (err) {
4514
4517
  this._ready.wake(err);
4515
- import_log19.log.catch(err, {}, {
4516
- file: "worker-runtime.ts",
4517
- line: 65,
4518
- scope: this,
4519
- callSite: (f, a) => f(...a)
4518
+ import_log19.log.catch(err, void 0, {
4519
+ F: __dxlog_file18,
4520
+ L: 65,
4521
+ S: this,
4522
+ C: (f, a) => f(...a)
4520
4523
  });
4521
4524
  }
4522
4525
  }
@@ -4546,11 +4549,11 @@ var WorkerRuntime = class {
4546
4549
  * Selects one of the existing session fro WebRTC networking.
4547
4550
  */
4548
4551
  _reconnectWebrtc() {
4549
- (0, import_log19.log)("reconnecting webrtc...", {}, {
4550
- file: "worker-runtime.ts",
4551
- line: 102,
4552
- scope: this,
4553
- callSite: (f, a) => f(...a)
4552
+ (0, import_log19.log)("reconnecting webrtc...", void 0, {
4553
+ F: __dxlog_file18,
4554
+ L: 102,
4555
+ S: this,
4556
+ C: (f, a) => f(...a)
4554
4557
  });
4555
4558
  if (this._sessionForNetworking) {
4556
4559
  if (!this.sessions.has(this._sessionForNetworking)) {
@@ -4584,7 +4587,6 @@ var WorkerRuntime = class {
4584
4587
  InvitationsHandler,
4585
4588
  InvitationsServiceImpl,
4586
4589
  Lock,
4587
- MemoryShellRuntime,
4588
4590
  ServiceContext,
4589
4591
  ServiceRegistry,
4590
4592
  ShellRuntimeImpl,
@@ -4594,6 +4596,7 @@ var WorkerRuntime = class {
4594
4596
  WorkerRuntime,
4595
4597
  WorkerSession,
4596
4598
  createAuthProvider,
4599
+ createDefaultModelFactory,
4597
4600
  createStorageObjects,
4598
4601
  getNetworkPeers,
4599
4602
  isLocked,