@dxos/client-services 0.1.53-main.032dce6 → 0.1.53-main.0778f22

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 (49) hide show
  1. package/dist/lib/browser/{chunk-6ITWCQIT.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/spaces/data-space-manager.d.ts.map +1 -1
  16. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  17. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +1 -1
  18. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  19. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +1 -1
  20. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
  21. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -21
  22. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  23. package/package.json +33 -32
  24. package/src/packlets/identity/identity-manager.test.ts +1 -1
  25. package/src/packlets/identity/identity-manager.ts +8 -8
  26. package/src/packlets/identity/identity-service.ts +2 -2
  27. package/src/packlets/identity/identity.test.ts +1 -1
  28. package/src/packlets/identity/identity.ts +2 -2
  29. package/src/packlets/invitations/device-invitation-protocol.ts +4 -4
  30. package/src/packlets/invitations/invitation-extension.ts +5 -5
  31. package/src/packlets/invitations/invitations-handler.ts +6 -6
  32. package/src/packlets/invitations/invitations-service.ts +3 -3
  33. package/src/packlets/invitations/space-invitation-protocol.ts +9 -9
  34. package/src/packlets/locks/node.ts +2 -2
  35. package/src/packlets/logging/logging-service.ts +4 -4
  36. package/src/packlets/services/service-context.test.ts +1 -1
  37. package/src/packlets/services/service-context.ts +3 -3
  38. package/src/packlets/services/service-host.test.ts +50 -2
  39. package/src/packlets/services/service-host.ts +25 -9
  40. package/src/packlets/spaces/data-space-manager.ts +5 -6
  41. package/src/packlets/spaces/notarization-plugin.ts +4 -4
  42. package/src/packlets/testing/invitation-utils.ts +2 -2
  43. package/src/packlets/testing/test-builder.ts +1 -2
  44. package/src/packlets/vault/iframe-host-runtime.ts +2 -2
  45. package/src/packlets/vault/iframe-proxy-runtime.ts +2 -2
  46. package/src/packlets/vault/shell-runtime.ts +3 -49
  47. package/src/packlets/vault/worker-runtime.ts +1 -1
  48. package/src/packlets/vault/worker-session.ts +2 -2
  49. package/dist/lib/browser/chunk-6ITWCQIT.mjs.map +0 -7
@@ -1,4 +1,4 @@
1
- import "@dxos/node-std/globals"
1
+ import "@dxos/node-std/globals";
2
2
 
3
3
  // packages/sdk/client-services/src/packlets/devtools/feeds.ts
4
4
  import { EventSubscriptions } from "@dxos/async";
@@ -352,6 +352,7 @@ import { Context as Context2 } from "@dxos/context";
352
352
  import { verifyCredential } from "@dxos/credentials";
353
353
  import { log } from "@dxos/log";
354
354
  import { schema } from "@dxos/protocols";
355
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
355
356
  var createAuthProvider = (signer) => async (nonce) => {
356
357
  const credential = await signer.createCredential({
357
358
  assertion: {
@@ -377,20 +378,20 @@ var TrustedKeySetAuthVerifier = class {
377
378
  log("authenticating...", {
378
379
  credential
379
380
  }, {
380
- file: "authenticator.ts",
381
- line: 57,
382
- scope: this,
383
- callSite: (f, a) => f(...a)
381
+ F: __dxlog_file,
382
+ L: 57,
383
+ S: this,
384
+ C: (f, a) => f(...a)
384
385
  });
385
386
  const result = await verifyCredential(credential);
386
387
  if (result.kind === "fail") {
387
388
  log("Invalid credential", {
388
389
  result
389
390
  }, {
390
- file: "authenticator.ts",
391
- line: 61,
392
- scope: this,
393
- callSite: (f, a) => f(...a)
391
+ F: __dxlog_file,
392
+ L: 61,
393
+ S: this,
394
+ C: (f, a) => f(...a)
394
395
  });
395
396
  return false;
396
397
  }
@@ -399,10 +400,10 @@ var TrustedKeySetAuthVerifier = class {
399
400
  nonce,
400
401
  credential
401
402
  }, {
402
- file: "authenticator.ts",
403
- line: 66,
404
- scope: this,
405
- callSite: (f, a) => f(...a)
403
+ F: __dxlog_file,
404
+ L: 66,
405
+ S: this,
406
+ C: (f, a) => f(...a)
406
407
  });
407
408
  return false;
408
409
  }
@@ -410,10 +411,10 @@ var TrustedKeySetAuthVerifier = class {
410
411
  log("key is not currently in trusted set, waiting...", {
411
412
  key: credential.issuer
412
413
  }, {
413
- file: "authenticator.ts",
414
- line: 71,
415
- scope: this,
416
- callSite: (f, a) => f(...a)
414
+ F: __dxlog_file,
415
+ L: 71,
416
+ S: this,
417
+ C: (f, a) => f(...a)
417
418
  });
418
419
  return true;
419
420
  }
@@ -426,20 +427,20 @@ var TrustedKeySetAuthVerifier = class {
426
427
  log("auth success", {
427
428
  key: credential.issuer
428
429
  }, {
429
- file: "authenticator.ts",
430
- line: 82,
431
- scope: this,
432
- callSite: (f, a) => f(...a)
430
+ F: __dxlog_file,
431
+ L: 82,
432
+ S: this,
433
+ C: (f, a) => f(...a)
433
434
  });
434
435
  trigger.wake(true);
435
436
  } else {
436
437
  log("key is not currently in trusted set, waiting...", {
437
438
  key: credential.issuer
438
439
  }, {
439
- file: "authenticator.ts",
440
- line: 85,
441
- scope: this,
442
- callSite: (f, a) => f(...a)
440
+ F: __dxlog_file,
441
+ L: 85,
442
+ S: this,
443
+ C: (f, a) => f(...a)
443
444
  });
444
445
  }
445
446
  });
@@ -461,7 +462,7 @@ var TrustedKeySetAuthVerifier = class {
461
462
  };
462
463
 
463
464
  // packages/sdk/client-services/src/packlets/identity/identity.ts
464
- import assert from "@dxos/node-std/assert";
465
+ import invariant from "tiny-invariant";
465
466
  import { Event } from "@dxos/async";
466
467
  import { AUTH_TIMEOUT, LOAD_CONTROL_FEEDS_TIMEOUT } from "@dxos/client-protocol";
467
468
  import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSignerWithChain, ProfileStateMachine } from "@dxos/credentials";
@@ -469,6 +470,7 @@ import { failUndefined } from "@dxos/debug";
469
470
  import { writeMessages } from "@dxos/feed-store";
470
471
  import { log as log2 } from "@dxos/log";
471
472
  import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
473
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
472
474
  var Identity = class {
473
475
  constructor({ space, signer, identityKey, deviceKey }) {
474
476
  this.stateUpdate = new Event();
@@ -543,7 +545,7 @@ var Identity = class {
543
545
  * Requires identity to be ready.
544
546
  */
545
547
  getIdentityCredentialSigner() {
546
- assert(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
548
+ invariant(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
547
549
  return createCredentialSignerWithChain(this._signer, this._deviceStateMachine.processor.deviceCredentialChain, this.deviceKey);
548
550
  }
549
551
  /**
@@ -560,10 +562,10 @@ var Identity = class {
560
562
  controlFeedKey,
561
563
  dataFeedKey
562
564
  }, {
563
- file: "identity.ts",
564
- line: 156,
565
- scope: this,
566
- callSite: (f, a) => f(...a)
565
+ F: __dxlog_file2,
566
+ L: 156,
567
+ S: this,
568
+ C: (f, a) => f(...a)
567
569
  });
568
570
  const signer = this.getIdentityCredentialSigner();
569
571
  await writeMessages(this.controlPipeline.writer, [
@@ -604,7 +606,7 @@ var Identity = class {
604
606
  };
605
607
 
606
608
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
607
- import assert2 from "@dxos/node-std/assert";
609
+ import invariant2 from "tiny-invariant";
608
610
  import { Event as Event2 } from "@dxos/async";
609
611
  import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
610
612
  import { PublicKey as PublicKey3 } from "@dxos/keys";
@@ -612,6 +614,7 @@ import { log as log3 } from "@dxos/log";
612
614
  import { trace } from "@dxos/protocols";
613
615
  import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
614
616
  import { deferFunction } from "@dxos/util";
617
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
615
618
  var IdentityManager = class {
616
619
  // TODO(burdon): IdentityManagerParams.
617
620
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
@@ -631,20 +634,20 @@ var IdentityManager = class {
631
634
  log3.trace("dxos.halo.identity-manager.open", trace.begin({
632
635
  id: traceId
633
636
  }), {
634
- file: "identity-manager.ts",
635
- line: 70,
636
- scope: this,
637
- callSite: (f, a) => f(...a)
637
+ F: __dxlog_file3,
638
+ L: 70,
639
+ S: this,
640
+ C: (f, a) => f(...a)
638
641
  });
639
642
  await this._metadataStore.load();
640
643
  const identityRecord = this._metadataStore.getIdentityRecord();
641
644
  log3("identity record", {
642
645
  identityRecord
643
646
  }, {
644
- file: "identity-manager.ts",
645
- line: 74,
646
- scope: this,
647
- callSite: (f, a) => f(...a)
647
+ F: __dxlog_file3,
648
+ L: 74,
649
+ S: this,
650
+ C: (f, a) => f(...a)
648
651
  });
649
652
  if (identityRecord) {
650
653
  this._identity = await this._constructIdentity(identityRecord);
@@ -654,20 +657,20 @@ var IdentityManager = class {
654
657
  identityKey: identityRecord.identityKey,
655
658
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
656
659
  }, {
657
- file: "identity-manager.ts",
658
- line: 79,
659
- scope: this,
660
- callSite: (f, a) => f(...a)
660
+ F: __dxlog_file3,
661
+ L: 79,
662
+ S: this,
663
+ C: (f, a) => f(...a)
661
664
  });
662
665
  this.stateUpdate.emit();
663
666
  }
664
667
  log3.trace("dxos.halo.identity-manager.open", trace.end({
665
668
  id: traceId
666
669
  }), {
667
- file: "identity-manager.ts",
668
- line: 85,
669
- scope: this,
670
- callSite: (f, a) => f(...a)
670
+ F: __dxlog_file3,
671
+ L: 85,
672
+ S: this,
673
+ C: (f, a) => f(...a)
671
674
  });
672
675
  }
673
676
  async close() {
@@ -676,12 +679,12 @@ var IdentityManager = class {
676
679
  }
677
680
  async createIdentity({ displayName } = {}) {
678
681
  var _a;
679
- assert2(!this._identity, "Identity already exists.");
680
- log3("creating identity...", {}, {
681
- file: "identity-manager.ts",
682
- line: 94,
683
- scope: this,
684
- callSite: (f, a) => f(...a)
682
+ invariant2(!this._identity, "Identity already exists.");
683
+ log3("creating identity...", void 0, {
684
+ F: __dxlog_file3,
685
+ L: 94,
686
+ S: this,
687
+ C: (f, a) => f(...a)
685
688
  });
686
689
  const controlFeedKey = await this._keyring.createKey();
687
690
  const identityRecord = {
@@ -698,8 +701,8 @@ var IdentityManager = class {
698
701
  await identity.open();
699
702
  {
700
703
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
701
- assert2(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
702
- assert2(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
704
+ invariant2(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
705
+ invariant2(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
703
706
  const credentials = [
704
707
  // Space genesis.
705
708
  ...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
@@ -727,20 +730,20 @@ var IdentityManager = class {
727
730
  identityKey: identityRecord.identityKey,
728
731
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
729
732
  }, {
730
- file: "identity-manager.ts",
731
- line: 149,
732
- scope: this,
733
- callSite: (f, a) => f(...a)
733
+ F: __dxlog_file3,
734
+ L: 149,
735
+ S: this,
736
+ C: (f, a) => f(...a)
734
737
  });
735
738
  this.stateUpdate.emit();
736
739
  log3("created identity", {
737
740
  identityKey: identity.identityKey,
738
741
  deviceKey: identity.deviceKey
739
742
  }, {
740
- file: "identity-manager.ts",
741
- line: 155,
742
- scope: this,
743
- callSite: (f, a) => f(...a)
743
+ F: __dxlog_file3,
744
+ L: 155,
745
+ S: this,
746
+ C: (f, a) => f(...a)
744
747
  });
745
748
  return identity;
746
749
  }
@@ -752,12 +755,12 @@ var IdentityManager = class {
752
755
  log3("accepting identity", {
753
756
  params
754
757
  }, {
755
- file: "identity-manager.ts",
756
- line: 163,
757
- scope: this,
758
- callSite: (f, a) => f(...a)
758
+ F: __dxlog_file3,
759
+ L: 163,
760
+ S: this,
761
+ C: (f, a) => f(...a)
759
762
  });
760
- assert2(!this._identity, "Identity already exists.");
763
+ invariant2(!this._identity, "Identity already exists.");
761
764
  const identityRecord = {
762
765
  identityKey: params.identityKey,
763
766
  deviceKey: params.deviceKey,
@@ -778,38 +781,38 @@ var IdentityManager = class {
778
781
  identityKey: identityRecord.identityKey,
779
782
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
780
783
  }, {
781
- file: "identity-manager.ts",
782
- line: 183,
783
- scope: this,
784
- callSite: (f, a) => f(...a)
784
+ F: __dxlog_file3,
785
+ L: 183,
786
+ S: this,
787
+ C: (f, a) => f(...a)
785
788
  });
786
789
  this.stateUpdate.emit();
787
790
  log3("accepted identity", {
788
791
  identityKey: identity.identityKey,
789
792
  deviceKey: identity.deviceKey
790
793
  }, {
791
- file: "identity-manager.ts",
792
- line: 189,
793
- scope: this,
794
- callSite: (f, a) => f(...a)
794
+ F: __dxlog_file3,
795
+ L: 189,
796
+ S: this,
797
+ C: (f, a) => f(...a)
795
798
  });
796
799
  return identity;
797
800
  }
798
801
  async _constructIdentity(identityRecord) {
799
- assert2(!this._identity);
802
+ invariant2(!this._identity);
800
803
  log3("constructing identity", {
801
804
  identityRecord
802
805
  }, {
803
- file: "identity-manager.ts",
804
- line: 195,
805
- scope: this,
806
- callSite: (f, a) => f(...a)
806
+ F: __dxlog_file3,
807
+ L: 195,
808
+ S: this,
809
+ C: (f, a) => f(...a)
807
810
  });
808
- assert2(identityRecord.haloSpace.controlFeedKey);
811
+ invariant2(identityRecord.haloSpace.controlFeedKey);
809
812
  const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
810
813
  writable: true
811
814
  });
812
- assert2(identityRecord.haloSpace.dataFeedKey);
815
+ invariant2(identityRecord.haloSpace.dataFeedKey);
813
816
  const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
814
817
  writable: true,
815
818
  sparse: true
@@ -834,10 +837,10 @@ var IdentityManager = class {
834
837
  log3("done", {
835
838
  identityKey: identityRecord.identityKey
836
839
  }, {
837
- file: "identity-manager.ts",
838
- line: 226,
839
- scope: this,
840
- callSite: (f, a) => f(...a)
840
+ F: __dxlog_file3,
841
+ L: 226,
842
+ S: this,
843
+ C: (f, a) => f(...a)
841
844
  });
842
845
  if (identityRecord.haloSpace.controlTimeframe) {
843
846
  identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
@@ -854,11 +857,11 @@ var IdentityManager = class {
854
857
  onNetworkConnection: () => {
855
858
  },
856
859
  onAuthFailure: () => {
857
- log3.warn("auth failure", {}, {
858
- file: "identity-manager.ts",
859
- line: 245,
860
- scope: this,
861
- callSite: (f, a) => f(...a)
860
+ log3.warn("auth failure", void 0, {
861
+ F: __dxlog_file3,
862
+ L: 245,
863
+ S: this,
864
+ C: (f, a) => f(...a)
862
865
  });
863
866
  },
864
867
  memberKey: identityKey
@@ -867,7 +870,7 @@ var IdentityManager = class {
867
870
  };
868
871
 
869
872
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
870
- import assert3 from "@dxos/node-std/assert";
873
+ import invariant3 from "tiny-invariant";
871
874
  import { Stream as Stream7 } from "@dxos/codec-protobuf";
872
875
  import { signPresentation } from "@dxos/credentials";
873
876
  import { todo } from "@dxos/debug";
@@ -903,7 +906,7 @@ var IdentityServiceImpl = class {
903
906
  };
904
907
  }
905
908
  async signPresentation({ presentation, nonce }) {
906
- assert3(this._serviceContext.identityManager.identity, "Identity not initialized.");
909
+ invariant3(this._serviceContext.identityManager.identity, "Identity not initialized.");
907
910
  return await signPresentation({
908
911
  presentation,
909
912
  signer: this._serviceContext.keyring,
@@ -915,7 +918,7 @@ var IdentityServiceImpl = class {
915
918
  };
916
919
 
917
920
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
918
- import assert4 from "@dxos/node-std/assert";
921
+ import invariant4 from "tiny-invariant";
919
922
  import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
920
923
  var DeviceInvitationProtocol = class {
921
924
  constructor(_keyring, _getIdentity, _acceptIdentity) {
@@ -932,7 +935,7 @@ var DeviceInvitationProtocol = class {
932
935
  };
933
936
  }
934
937
  async admit(request) {
935
- assert4(request.device);
938
+ invariant4(request.device);
936
939
  const identity = this._getIdentity();
937
940
  await identity.admitDevice(request.device);
938
941
  return {
@@ -960,9 +963,9 @@ var DeviceInvitationProtocol = class {
960
963
  };
961
964
  }
962
965
  async accept(response, request) {
963
- assert4(response.device);
966
+ invariant4(response.device);
964
967
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
965
- assert4(request.device);
968
+ invariant4(request.device);
966
969
  const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
967
970
  await this._acceptIdentity({
968
971
  identityKey,
@@ -980,7 +983,7 @@ var DeviceInvitationProtocol = class {
980
983
  };
981
984
 
982
985
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
983
- import assert6 from "@dxos/node-std/assert";
986
+ import invariant6 from "tiny-invariant";
984
987
  import { PushStream, scheduleTask as scheduleTask2, TimeoutError, Trigger as Trigger3 } from "@dxos/async";
985
988
  import { AuthenticatingInvitationObservable, AUTHENTICATION_CODE_LENGTH, CancellableInvitationObservable, INVITATION_TIMEOUT } from "@dxos/client-protocol";
986
989
  import { Context as Context4 } from "@dxos/context";
@@ -994,7 +997,7 @@ import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/ser
994
997
  import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
995
998
 
996
999
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
997
- import assert5 from "@dxos/node-std/assert";
1000
+ import invariant5 from "tiny-invariant";
998
1001
  import { Trigger as Trigger2 } from "@dxos/async";
999
1002
  import { cancelWithContext, Context as Context3 } from "@dxos/context";
1000
1003
  import { InvalidInvitationExtensionRoleError } from "@dxos/errors";
@@ -1004,6 +1007,7 @@ import { schema as schema2, trace as trace2 } from "@dxos/protocols";
1004
1007
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
1005
1008
  import { AuthenticationResponse, Options } from "@dxos/protocols/proto/dxos/halo/invitations";
1006
1009
  import { RpcExtension } from "@dxos/teleport";
1010
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
1007
1011
  var OPTIONS_TIMEOUT = 1e4;
1008
1012
  var MAX_OTP_ATTEMPTS = 3;
1009
1013
  var InvitationHostExtension = class extends RpcExtension {
@@ -1031,7 +1035,7 @@ var InvitationHostExtension = class extends RpcExtension {
1031
1035
  // Perhaps in the future we will have more complex logic here.
1032
1036
  InvitationHostService: {
1033
1037
  options: async (options) => {
1034
- assert5(!this._remoteOptions, "Remote options already set.");
1038
+ invariant5(!this._remoteOptions, "Remote options already set.");
1035
1039
  this._remoteOptions = options;
1036
1040
  this._remoteOptionsTrigger.wake();
1037
1041
  },
@@ -1041,20 +1045,20 @@ var InvitationHostExtension = class extends RpcExtension {
1041
1045
  log4.trace("dxos.sdk.invitation-handler.host.introduce", trace2.begin({
1042
1046
  id: traceId
1043
1047
  }), {
1044
- file: "invitation-extension.ts",
1045
- line: 98,
1046
- scope: this,
1047
- callSite: (f, a) => f(...a)
1048
+ F: __dxlog_file4,
1049
+ L: 98,
1050
+ S: this,
1051
+ C: (f, a) => f(...a)
1048
1052
  });
1049
1053
  const invitation = await this._callbacks.resolveInvitation(request);
1050
1054
  if (!invitation) {
1051
1055
  log4.warn("invitation not found", {
1052
1056
  invitationId
1053
1057
  }, {
1054
- file: "invitation-extension.ts",
1055
- line: 102,
1056
- scope: this,
1057
- callSite: (f, a) => f(...a)
1058
+ F: __dxlog_file4,
1059
+ L: 102,
1060
+ S: this,
1061
+ C: (f, a) => f(...a)
1058
1062
  });
1059
1063
  this._callbacks.onError(new Error("Invitation not found."));
1060
1064
  return {
@@ -1065,10 +1069,10 @@ var InvitationHostExtension = class extends RpcExtension {
1065
1069
  log4("guest introduced itself", {
1066
1070
  guestProfile: profile
1067
1071
  }, {
1068
- file: "invitation-extension.ts",
1069
- line: 111,
1070
- scope: this,
1071
- callSite: (f, a) => f(...a)
1072
+ F: __dxlog_file4,
1073
+ L: 111,
1074
+ S: this,
1075
+ C: (f, a) => f(...a)
1072
1076
  });
1073
1077
  this.guestProfile = profile;
1074
1078
  this._callbacks.onStateUpdate({
@@ -1078,10 +1082,10 @@ var InvitationHostExtension = class extends RpcExtension {
1078
1082
  log4.trace("dxos.sdk.invitation-handler.host.introduce", trace2.end({
1079
1083
  id: traceId
1080
1084
  }), {
1081
- file: "invitation-extension.ts",
1082
- line: 118,
1083
- scope: this,
1084
- callSite: (f, a) => f(...a)
1085
+ F: __dxlog_file4,
1086
+ L: 118,
1087
+ S: this,
1088
+ C: (f, a) => f(...a)
1085
1089
  });
1086
1090
  return {
1087
1091
  spaceKey: this.invitation.authMethod === Invitation2.AuthMethod.NONE ? this.invitation.spaceKey : void 0,
@@ -1093,28 +1097,28 @@ var InvitationHostExtension = class extends RpcExtension {
1093
1097
  log4.trace("dxos.sdk.invitation-handler.host.authenticate", trace2.begin({
1094
1098
  id: traceId
1095
1099
  }), {
1096
- file: "invitation-extension.ts",
1097
- line: 127,
1098
- scope: this,
1099
- callSite: (f, a) => f(...a)
1100
+ F: __dxlog_file4,
1101
+ L: 127,
1102
+ S: this,
1103
+ C: (f, a) => f(...a)
1100
1104
  });
1101
1105
  log4("received authentication request", {
1102
1106
  authCode: code
1103
1107
  }, {
1104
- file: "invitation-extension.ts",
1105
- line: 128,
1106
- scope: this,
1107
- callSite: (f, a) => f(...a)
1108
+ F: __dxlog_file4,
1109
+ L: 128,
1110
+ S: this,
1111
+ C: (f, a) => f(...a)
1108
1112
  });
1109
1113
  let status = AuthenticationResponse.Status.OK;
1110
- assert5(this.invitation, "Invitation is not set.");
1114
+ invariant5(this.invitation, "Invitation is not set.");
1111
1115
  switch (this.invitation.authMethod) {
1112
1116
  case Invitation2.AuthMethod.NONE: {
1113
- log4("authentication not required", {}, {
1114
- file: "invitation-extension.ts",
1115
- line: 134,
1116
- scope: this,
1117
- callSite: (f, a) => f(...a)
1117
+ log4("authentication not required", void 0, {
1118
+ F: __dxlog_file4,
1119
+ L: 134,
1120
+ S: this,
1121
+ C: (f, a) => f(...a)
1118
1122
  });
1119
1123
  return {
1120
1124
  status: AuthenticationResponse.Status.OK
@@ -1136,10 +1140,10 @@ var InvitationHostExtension = class extends RpcExtension {
1136
1140
  log4.error("invalid authentication method", {
1137
1141
  authMethod: this.invitation.authMethod
1138
1142
  }, {
1139
- file: "invitation-extension.ts",
1140
- line: 152,
1141
- scope: this,
1142
- callSite: (f, a) => f(...a)
1143
+ F: __dxlog_file4,
1144
+ L: 152,
1145
+ S: this,
1146
+ C: (f, a) => f(...a)
1143
1147
  });
1144
1148
  status = AuthenticationResponse.Status.INTERNAL_ERROR;
1145
1149
  break;
@@ -1151,10 +1155,10 @@ var InvitationHostExtension = class extends RpcExtension {
1151
1155
  status
1152
1156
  }
1153
1157
  }), {
1154
- file: "invitation-extension.ts",
1155
- line: 158,
1156
- scope: this,
1157
- callSite: (f, a) => f(...a)
1158
+ F: __dxlog_file4,
1159
+ L: 158,
1160
+ S: this,
1161
+ C: (f, a) => f(...a)
1158
1162
  });
1159
1163
  return {
1160
1164
  status
@@ -1165,13 +1169,13 @@ var InvitationHostExtension = class extends RpcExtension {
1165
1169
  log4.trace("dxos.sdk.invitation-handler.host.admit", trace2.begin({
1166
1170
  id: traceId
1167
1171
  }), {
1168
- file: "invitation-extension.ts",
1169
- line: 164,
1170
- scope: this,
1171
- callSite: (f, a) => f(...a)
1172
+ F: __dxlog_file4,
1173
+ L: 164,
1174
+ S: this,
1175
+ C: (f, a) => f(...a)
1172
1176
  });
1173
1177
  try {
1174
- assert5(this.invitation, "Invitation is not set.");
1178
+ invariant5(this.invitation, "Invitation is not set.");
1175
1179
  if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
1176
1180
  throw new Error("Not authenticated");
1177
1181
  }
@@ -1179,10 +1183,10 @@ var InvitationHostExtension = class extends RpcExtension {
1179
1183
  log4.trace("dxos.sdk.invitation-handler.host.admit", trace2.end({
1180
1184
  id: traceId
1181
1185
  }), {
1182
- file: "invitation-extension.ts",
1183
- line: 175,
1184
- scope: this,
1185
- callSite: (f, a) => f(...a)
1186
+ F: __dxlog_file4,
1187
+ L: 175,
1188
+ S: this,
1189
+ C: (f, a) => f(...a)
1186
1190
  });
1187
1191
  return response;
1188
1192
  } catch (err) {
@@ -1236,7 +1240,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1236
1240
  return {
1237
1241
  InvitationHostService: {
1238
1242
  options: async (options) => {
1239
- assert5(!this._remoteOptions, "Remote options already set.");
1243
+ invariant5(!this._remoteOptions, "Remote options already set.");
1240
1244
  this._remoteOptions = options;
1241
1245
  this._remoteOptionsTrigger.wake();
1242
1246
  },
@@ -1256,11 +1260,11 @@ var InvitationGuestExtension = class extends RpcExtension {
1256
1260
  var _a;
1257
1261
  await super.onOpen(context);
1258
1262
  try {
1259
- log4("begin options", {}, {
1260
- file: "invitation-extension.ts",
1261
- line: 263,
1262
- scope: this,
1263
- callSite: (f, a) => f(...a)
1263
+ log4("begin options", void 0, {
1264
+ F: __dxlog_file4,
1265
+ L: 263,
1266
+ S: this,
1267
+ C: (f, a) => f(...a)
1264
1268
  });
1265
1269
  await cancelWithContext(this._ctx, this.rpc.InvitationHostService.options({
1266
1270
  role: Options.Role.GUEST
@@ -1268,11 +1272,11 @@ var InvitationGuestExtension = class extends RpcExtension {
1268
1272
  await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({
1269
1273
  timeout: OPTIONS_TIMEOUT
1270
1274
  }));
1271
- log4("end options", {}, {
1272
- file: "invitation-extension.ts",
1273
- line: 266,
1274
- scope: this,
1275
- callSite: (f, a) => f(...a)
1275
+ log4("end options", void 0, {
1276
+ F: __dxlog_file4,
1277
+ L: 266,
1278
+ S: this,
1279
+ C: (f, a) => f(...a)
1276
1280
  });
1277
1281
  if (((_a = this._remoteOptions) == null ? void 0 : _a.role) !== Options.Role.HOST) {
1278
1282
  throw new InvalidInvitationExtensionRoleError(void 0, {
@@ -1283,20 +1287,20 @@ var InvitationGuestExtension = class extends RpcExtension {
1283
1287
  this._callbacks.onOpen(this._ctx);
1284
1288
  } catch (err) {
1285
1289
  log4("openError", err, {
1286
- file: "invitation-extension.ts",
1287
- line: 276,
1288
- scope: this,
1289
- callSite: (f, a) => f(...a)
1290
+ F: __dxlog_file4,
1291
+ L: 276,
1292
+ S: this,
1293
+ C: (f, a) => f(...a)
1290
1294
  });
1291
1295
  this._callbacks.onError(err);
1292
1296
  }
1293
1297
  }
1294
1298
  async onClose() {
1295
- log4("onClose", {}, {
1296
- file: "invitation-extension.ts",
1297
- line: 282,
1298
- scope: this,
1299
- callSite: (f, a) => f(...a)
1299
+ log4("onClose", void 0, {
1300
+ F: __dxlog_file4,
1301
+ L: 282,
1302
+ S: this,
1303
+ C: (f, a) => f(...a)
1300
1304
  });
1301
1305
  await this._ctx.dispose();
1302
1306
  }
@@ -1304,6 +1308,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1304
1308
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitation2.AuthMethod.NONE;
1305
1309
 
1306
1310
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1311
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1307
1312
  var InvitationsHandler = class {
1308
1313
  /**
1309
1314
  * @internal
@@ -1315,7 +1320,7 @@ var InvitationsHandler = class {
1315
1320
  var _a;
1316
1321
  const { invitationId = PublicKey5.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey5.random() } = options != null ? options : {};
1317
1322
  const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0;
1318
- assert6(protocol);
1323
+ invariant6(protocol);
1319
1324
  const invitation = {
1320
1325
  invitationId,
1321
1326
  type,
@@ -1337,10 +1342,10 @@ var InvitationsHandler = class {
1337
1342
  log5("complete", {
1338
1343
  ...protocol.toJSON()
1339
1344
  }, {
1340
- file: "invitations-handler.ts",
1341
- line: 99,
1342
- scope: this,
1343
- callSite: (f, a) => f(...a)
1345
+ F: __dxlog_file5,
1346
+ L: 99,
1347
+ S: this,
1348
+ C: (f, a) => f(...a)
1344
1349
  });
1345
1350
  stream.complete();
1346
1351
  });
@@ -1362,7 +1367,7 @@ var InvitationsHandler = class {
1362
1367
  var _a2, _b, _c;
1363
1368
  try {
1364
1369
  const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
1365
- assert6(deviceKey);
1370
+ invariant6(deviceKey);
1366
1371
  const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
1367
1372
  extension.completedTrigger.wake(deviceKey);
1368
1373
  return admissionResponse;
@@ -1378,18 +1383,18 @@ var InvitationsHandler = class {
1378
1383
  log5.trace("dxos.sdk.invitations-handler.host.onOpen", trace3.begin({
1379
1384
  id: traceId
1380
1385
  }), {
1381
- file: "invitations-handler.ts",
1382
- line: 138,
1383
- scope: this,
1384
- callSite: (f, a) => f(...a)
1386
+ F: __dxlog_file5,
1387
+ L: 138,
1388
+ S: this,
1389
+ C: (f, a) => f(...a)
1385
1390
  });
1386
1391
  log5("connected", {
1387
1392
  ...protocol.toJSON()
1388
1393
  }, {
1389
- file: "invitations-handler.ts",
1390
- line: 139,
1391
- scope: this,
1392
- callSite: (f, a) => f(...a)
1394
+ F: __dxlog_file5,
1395
+ L: 139,
1396
+ S: this,
1397
+ C: (f, a) => f(...a)
1393
1398
  });
1394
1399
  stream.next({
1395
1400
  ...invitation,
@@ -1402,10 +1407,10 @@ var InvitationsHandler = class {
1402
1407
  guest: deviceKey,
1403
1408
  ...protocol.toJSON()
1404
1409
  }, {
1405
- file: "invitations-handler.ts",
1406
- line: 142,
1407
- scope: this,
1408
- callSite: (f, a) => f(...a)
1410
+ F: __dxlog_file5,
1411
+ L: 142,
1412
+ S: this,
1413
+ C: (f, a) => f(...a)
1409
1414
  });
1410
1415
  stream.next({
1411
1416
  ...invitation,
@@ -1414,20 +1419,20 @@ var InvitationsHandler = class {
1414
1419
  log5.trace("dxos.sdk.invitations-handler.host.onOpen", trace3.end({
1415
1420
  id: traceId
1416
1421
  }), {
1417
- file: "invitations-handler.ts",
1418
- line: 144,
1419
- scope: this,
1420
- callSite: (f, a) => f(...a)
1422
+ F: __dxlog_file5,
1423
+ L: 144,
1424
+ S: this,
1425
+ C: (f, a) => f(...a)
1421
1426
  });
1422
1427
  } catch (err) {
1423
1428
  if (err instanceof TimeoutError) {
1424
1429
  log5("timeout", {
1425
1430
  ...protocol.toJSON()
1426
1431
  }, {
1427
- file: "invitations-handler.ts",
1428
- line: 147,
1429
- scope: this,
1430
- callSite: (f, a) => f(...a)
1432
+ F: __dxlog_file5,
1433
+ L: 147,
1434
+ S: this,
1435
+ C: (f, a) => f(...a)
1431
1436
  });
1432
1437
  stream.next({
1433
1438
  ...invitation,
@@ -1435,10 +1440,10 @@ var InvitationsHandler = class {
1435
1440
  });
1436
1441
  } else {
1437
1442
  log5.error("failed", err, {
1438
- file: "invitations-handler.ts",
1439
- line: 150,
1440
- scope: this,
1441
- callSite: (f, a) => f(...a)
1443
+ F: __dxlog_file5,
1444
+ L: 150,
1445
+ S: this,
1446
+ C: (f, a) => f(...a)
1442
1447
  });
1443
1448
  stream.error(err);
1444
1449
  }
@@ -1446,10 +1451,10 @@ var InvitationsHandler = class {
1446
1451
  id: traceId,
1447
1452
  error: err
1448
1453
  }), {
1449
- file: "invitations-handler.ts",
1450
- line: 153,
1451
- scope: this,
1452
- callSite: (f, a) => f(...a)
1454
+ F: __dxlog_file5,
1455
+ L: 153,
1456
+ S: this,
1457
+ C: (f, a) => f(...a)
1453
1458
  });
1454
1459
  } finally {
1455
1460
  if (type !== Invitation3.Type.MULTIUSE) {
@@ -1467,10 +1472,10 @@ var InvitationsHandler = class {
1467
1472
  log5("timeout", {
1468
1473
  ...protocol.toJSON()
1469
1474
  }, {
1470
- file: "invitations-handler.ts",
1471
- line: 168,
1472
- scope: this,
1473
- callSite: (f, a) => f(...a)
1475
+ F: __dxlog_file5,
1476
+ L: 168,
1477
+ S: this,
1478
+ C: (f, a) => f(...a)
1474
1479
  });
1475
1480
  stream.next({
1476
1481
  ...invitation,
@@ -1478,10 +1483,10 @@ var InvitationsHandler = class {
1478
1483
  });
1479
1484
  } else {
1480
1485
  log5.error("failed", err, {
1481
- file: "invitations-handler.ts",
1482
- line: 171,
1483
- scope: this,
1484
- callSite: (f, a) => f(...a)
1486
+ F: __dxlog_file5,
1487
+ L: 171,
1488
+ S: this,
1489
+ C: (f, a) => f(...a)
1485
1490
  });
1486
1491
  stream.error(err);
1487
1492
  }
@@ -1521,13 +1526,13 @@ var InvitationsHandler = class {
1521
1526
  }
1522
1527
  acceptInvitation(protocol, invitation) {
1523
1528
  const { timeout = INVITATION_TIMEOUT } = invitation;
1524
- assert6(protocol);
1529
+ invariant6(protocol);
1525
1530
  const authenticated = new Trigger3();
1526
1531
  let admitted = false;
1527
1532
  let currentState;
1528
1533
  const stream = new PushStream();
1529
1534
  const setState = (newData) => {
1530
- assert6(newData.state !== void 0);
1535
+ invariant6(newData.state !== void 0);
1531
1536
  currentState = newData.state;
1532
1537
  stream.next({
1533
1538
  ...invitation,
@@ -1540,20 +1545,20 @@ var InvitationsHandler = class {
1540
1545
  log5("timeout", {
1541
1546
  ...protocol.toJSON()
1542
1547
  }, {
1543
- file: "invitations-handler.ts",
1544
- line: 230,
1545
- scope: this,
1546
- callSite: (f, a) => f(...a)
1548
+ F: __dxlog_file5,
1549
+ L: 230,
1550
+ S: this,
1551
+ C: (f, a) => f(...a)
1547
1552
  });
1548
1553
  setState({
1549
1554
  state: Invitation3.State.TIMEOUT
1550
1555
  });
1551
1556
  } else {
1552
1557
  log5.warn("auth failed", err, {
1553
- file: "invitations-handler.ts",
1554
- line: 233,
1555
- scope: this,
1556
- callSite: (f, a) => f(...a)
1558
+ F: __dxlog_file5,
1559
+ L: 233,
1560
+ S: this,
1561
+ C: (f, a) => f(...a)
1557
1562
  });
1558
1563
  stream.error(err);
1559
1564
  }
@@ -1564,10 +1569,10 @@ var InvitationsHandler = class {
1564
1569
  log5("complete", {
1565
1570
  ...protocol.toJSON()
1566
1571
  }, {
1567
- file: "invitations-handler.ts",
1568
- line: 241,
1569
- scope: this,
1570
- callSite: (f, a) => f(...a)
1572
+ F: __dxlog_file5,
1573
+ L: 241,
1574
+ S: this,
1575
+ C: (f, a) => f(...a)
1571
1576
  });
1572
1577
  stream.complete();
1573
1578
  });
@@ -1579,10 +1584,10 @@ var InvitationsHandler = class {
1579
1584
  log5("extension disposed", {
1580
1585
  currentState
1581
1586
  }, {
1582
- file: "invitations-handler.ts",
1583
- line: 251,
1584
- scope: this,
1585
- callSite: (f, a) => f(...a)
1587
+ F: __dxlog_file5,
1588
+ L: 251,
1589
+ S: this,
1590
+ C: (f, a) => f(...a)
1586
1591
  });
1587
1592
  if (!admitted) {
1588
1593
  stream.error(new Error("Remote peer disconnected."));
@@ -1594,10 +1599,10 @@ var InvitationsHandler = class {
1594
1599
  log5.trace("dxos.sdk.invitations-handler.guest.onOpen", trace3.begin({
1595
1600
  id: traceId
1596
1601
  }), {
1597
- file: "invitations-handler.ts",
1598
- line: 260,
1599
- scope: this,
1600
- callSite: (f, a) => f(...a)
1602
+ F: __dxlog_file5,
1603
+ L: 260,
1604
+ S: this,
1605
+ C: (f, a) => f(...a)
1601
1606
  });
1602
1607
  if (++connectionCount > 1) {
1603
1608
  throw new Error(`multiple connections detected: ${connectionCount}`);
@@ -1606,10 +1611,10 @@ var InvitationsHandler = class {
1606
1611
  log5("connected", {
1607
1612
  ...protocol.toJSON()
1608
1613
  }, {
1609
- file: "invitations-handler.ts",
1610
- line: 268,
1611
- scope: this,
1612
- callSite: (f, a) => f(...a)
1614
+ F: __dxlog_file5,
1615
+ L: 268,
1616
+ S: this,
1617
+ C: (f, a) => f(...a)
1613
1618
  });
1614
1619
  setState({
1615
1620
  state: Invitation3.State.CONNECTED
@@ -1617,20 +1622,20 @@ var InvitationsHandler = class {
1617
1622
  log5("introduce", {
1618
1623
  ...protocol.toJSON()
1619
1624
  }, {
1620
- file: "invitations-handler.ts",
1621
- line: 272,
1622
- scope: this,
1623
- callSite: (f, a) => f(...a)
1625
+ F: __dxlog_file5,
1626
+ L: 272,
1627
+ S: this,
1628
+ C: (f, a) => f(...a)
1624
1629
  });
1625
1630
  const introductionResponse = await extension.rpc.InvitationHostService.introduce(protocol.createIntroduction());
1626
1631
  log5("introduce response", {
1627
1632
  ...protocol.toJSON(),
1628
1633
  response: introductionResponse
1629
1634
  }, {
1630
- file: "invitations-handler.ts",
1631
- line: 276,
1632
- scope: this,
1633
- callSite: (f, a) => f(...a)
1635
+ F: __dxlog_file5,
1636
+ L: 276,
1637
+ S: this,
1638
+ C: (f, a) => f(...a)
1634
1639
  });
1635
1640
  invitation.authMethod = introductionResponse.authMethod;
1636
1641
  if (introductionResponse.spaceKey) {
@@ -1638,11 +1643,11 @@ var InvitationsHandler = class {
1638
1643
  }
1639
1644
  if (isAuthenticationRequired(invitation)) {
1640
1645
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1641
- log5("guest waiting for authentication code...", {}, {
1642
- file: "invitations-handler.ts",
1643
- line: 285,
1644
- scope: this,
1645
- callSite: (f, a) => f(...a)
1646
+ log5("guest waiting for authentication code...", void 0, {
1647
+ F: __dxlog_file5,
1648
+ L: 285,
1649
+ S: this,
1650
+ C: (f, a) => f(...a)
1646
1651
  });
1647
1652
  setState({
1648
1653
  state: Invitation3.State.READY_FOR_AUTHENTICATION
@@ -1650,11 +1655,11 @@ var InvitationsHandler = class {
1650
1655
  const authCode = await authenticated.wait({
1651
1656
  timeout
1652
1657
  });
1653
- log5("sending authentication request", {}, {
1654
- file: "invitations-handler.ts",
1655
- line: 289,
1656
- scope: this,
1657
- callSite: (f, a) => f(...a)
1658
+ log5("sending authentication request", void 0, {
1659
+ F: __dxlog_file5,
1660
+ L: 289,
1661
+ S: this,
1662
+ C: (f, a) => f(...a)
1658
1663
  });
1659
1664
  setState({
1660
1665
  state: Invitation3.State.AUTHENTICATING
@@ -1672,10 +1677,10 @@ var InvitationsHandler = class {
1672
1677
  log5("retrying invalid code", {
1673
1678
  attempt
1674
1679
  }, {
1675
- file: "invitations-handler.ts",
1676
- line: 300,
1677
- scope: this,
1678
- callSite: (f, a) => f(...a)
1680
+ F: __dxlog_file5,
1681
+ L: 300,
1682
+ S: this,
1683
+ C: (f, a) => f(...a)
1679
1684
  });
1680
1685
  authenticated.reset();
1681
1686
  }
@@ -1689,10 +1694,10 @@ var InvitationsHandler = class {
1689
1694
  log5("request admission", {
1690
1695
  ...protocol.toJSON()
1691
1696
  }, {
1692
- file: "invitations-handler.ts",
1693
- line: 311,
1694
- scope: this,
1695
- callSite: (f, a) => f(...a)
1697
+ F: __dxlog_file5,
1698
+ L: 311,
1699
+ S: this,
1700
+ C: (f, a) => f(...a)
1696
1701
  });
1697
1702
  const admissionRequest = await protocol.createAdmissionRequest();
1698
1703
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
@@ -1701,10 +1706,10 @@ var InvitationsHandler = class {
1701
1706
  log5("admitted by host", {
1702
1707
  ...protocol.toJSON()
1703
1708
  }, {
1704
- file: "invitations-handler.ts",
1705
- line: 322,
1706
- scope: this,
1707
- callSite: (f, a) => f(...a)
1709
+ F: __dxlog_file5,
1710
+ L: 322,
1711
+ S: this,
1712
+ C: (f, a) => f(...a)
1708
1713
  });
1709
1714
  setState({
1710
1715
  ...result,
@@ -1713,30 +1718,30 @@ var InvitationsHandler = class {
1713
1718
  log5.trace("dxos.sdk.invitations-handler.guest.onOpen", trace3.end({
1714
1719
  id: traceId
1715
1720
  }), {
1716
- file: "invitations-handler.ts",
1717
- line: 324,
1718
- scope: this,
1719
- callSite: (f, a) => f(...a)
1721
+ F: __dxlog_file5,
1722
+ L: 324,
1723
+ S: this,
1724
+ C: (f, a) => f(...a)
1720
1725
  });
1721
1726
  } catch (err) {
1722
1727
  if (err instanceof TimeoutError) {
1723
1728
  log5("timeout", {
1724
1729
  ...protocol.toJSON()
1725
1730
  }, {
1726
- file: "invitations-handler.ts",
1727
- line: 327,
1728
- scope: this,
1729
- callSite: (f, a) => f(...a)
1731
+ F: __dxlog_file5,
1732
+ L: 327,
1733
+ S: this,
1734
+ C: (f, a) => f(...a)
1730
1735
  });
1731
1736
  setState({
1732
1737
  state: Invitation3.State.TIMEOUT
1733
1738
  });
1734
1739
  } else {
1735
1740
  log5("auth failed", err, {
1736
- file: "invitations-handler.ts",
1737
- line: 330,
1738
- scope: this,
1739
- callSite: (f, a) => f(...a)
1741
+ F: __dxlog_file5,
1742
+ L: 330,
1743
+ S: this,
1744
+ C: (f, a) => f(...a)
1740
1745
  });
1741
1746
  stream.error(err);
1742
1747
  }
@@ -1744,10 +1749,10 @@ var InvitationsHandler = class {
1744
1749
  id: traceId,
1745
1750
  error: err
1746
1751
  }), {
1747
- file: "invitations-handler.ts",
1748
- line: 333,
1749
- scope: this,
1750
- callSite: (f, a) => f(...a)
1752
+ F: __dxlog_file5,
1753
+ L: 333,
1754
+ S: this,
1755
+ C: (f, a) => f(...a)
1751
1756
  });
1752
1757
  } finally {
1753
1758
  await ctx.dispose();
@@ -1762,20 +1767,20 @@ var InvitationsHandler = class {
1762
1767
  log5("timeout", {
1763
1768
  ...protocol.toJSON()
1764
1769
  }, {
1765
- file: "invitations-handler.ts",
1766
- line: 344,
1767
- scope: this,
1768
- callSite: (f, a) => f(...a)
1770
+ F: __dxlog_file5,
1771
+ L: 344,
1772
+ S: this,
1773
+ C: (f, a) => f(...a)
1769
1774
  });
1770
1775
  setState({
1771
1776
  state: Invitation3.State.TIMEOUT
1772
1777
  });
1773
1778
  } else {
1774
1779
  log5("auth failed", err, {
1775
- file: "invitations-handler.ts",
1776
- line: 347,
1777
- scope: this,
1778
- callSite: (f, a) => f(...a)
1780
+ F: __dxlog_file5,
1781
+ L: 347,
1782
+ S: this,
1783
+ C: (f, a) => f(...a)
1779
1784
  });
1780
1785
  stream.error(err);
1781
1786
  }
@@ -1784,7 +1789,7 @@ var InvitationsHandler = class {
1784
1789
  return extension;
1785
1790
  };
1786
1791
  scheduleTask2(ctx, async () => {
1787
- assert6(invitation.swarmKey);
1792
+ invariant6(invitation.swarmKey);
1788
1793
  const topic = invitation.swarmKey;
1789
1794
  const swarmConnection = await this._networkManager.joinSwarm({
1790
1795
  topic,
@@ -1817,11 +1822,12 @@ var InvitationsHandler = class {
1817
1822
  };
1818
1823
 
1819
1824
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
1820
- import assert7 from "@dxos/node-std/assert";
1825
+ import invariant7 from "tiny-invariant";
1821
1826
  import { Event as Event3 } from "@dxos/async";
1822
1827
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
1823
1828
  import { log as log6 } from "@dxos/log";
1824
1829
  import { QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
1830
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1825
1831
  var InvitationsServiceImpl = class {
1826
1832
  constructor(_invitationsHandler, _getHandler) {
1827
1833
  this._invitationsHandler = _invitationsHandler;
@@ -1882,35 +1888,35 @@ var InvitationsServiceImpl = class {
1882
1888
  });
1883
1889
  }
1884
1890
  async authenticate({ invitationId, authCode }) {
1885
- log6("authenticating...", {}, {
1886
- file: "invitations-service.ts",
1887
- line: 103,
1888
- scope: this,
1889
- callSite: (f, a) => f(...a)
1891
+ log6("authenticating...", void 0, {
1892
+ F: __dxlog_file6,
1893
+ L: 103,
1894
+ S: this,
1895
+ C: (f, a) => f(...a)
1890
1896
  });
1891
- assert7(invitationId);
1897
+ invariant7(invitationId);
1892
1898
  const observable = this._acceptInvitations.get(invitationId);
1893
1899
  if (!observable) {
1894
1900
  log6.warn("invalid invitation", {
1895
1901
  invitationId
1896
1902
  }, {
1897
- file: "invitations-service.ts",
1898
- line: 107,
1899
- scope: this,
1900
- callSite: (f, a) => f(...a)
1903
+ F: __dxlog_file6,
1904
+ L: 107,
1905
+ S: this,
1906
+ C: (f, a) => f(...a)
1901
1907
  });
1902
1908
  } else {
1903
1909
  await observable.authenticate(authCode);
1904
1910
  }
1905
1911
  }
1906
1912
  async cancelInvitation({ invitationId }) {
1907
- log6("deleting...", {}, {
1908
- file: "invitations-service.ts",
1909
- line: 114,
1910
- scope: this,
1911
- callSite: (f, a) => f(...a)
1913
+ log6("deleting...", void 0, {
1914
+ F: __dxlog_file6,
1915
+ L: 114,
1916
+ S: this,
1917
+ C: (f, a) => f(...a)
1912
1918
  });
1913
- assert7(invitationId);
1919
+ invariant7(invitationId);
1914
1920
  const created = this._createInvitations.get(invitationId);
1915
1921
  const accepted = this._acceptInvitations.get(invitationId);
1916
1922
  if (created) {
@@ -1925,10 +1931,10 @@ var InvitationsServiceImpl = class {
1925
1931
  log6.warn("invalid invitation", {
1926
1932
  invitationId
1927
1933
  }, {
1928
- file: "invitations-service.ts",
1929
- line: 127,
1930
- scope: this,
1931
- callSite: (f, a) => f(...a)
1934
+ F: __dxlog_file6,
1935
+ L: 127,
1936
+ S: this,
1937
+ C: (f, a) => f(...a)
1932
1938
  });
1933
1939
  }
1934
1940
  }
@@ -1985,11 +1991,12 @@ var InvitationsServiceImpl = class {
1985
1991
  };
1986
1992
 
1987
1993
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
1988
- import assert8 from "@dxos/node-std/assert";
1994
+ import invariant8 from "tiny-invariant";
1989
1995
  import { createAdmissionCredentials, getCredentialAssertion } from "@dxos/credentials";
1990
1996
  import { writeMessages as writeMessages2 } from "@dxos/feed-store";
1991
1997
  import { log as log7 } from "@dxos/log";
1992
1998
  import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
1999
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
1993
2000
  var SpaceInvitationProtocol = class {
1994
2001
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
1995
2002
  this._spaceManager = _spaceManager;
@@ -2011,24 +2018,24 @@ var SpaceInvitationProtocol = class {
2011
2018
  }
2012
2019
  async admit(request, guestProfile) {
2013
2020
  var _a;
2014
- assert8(this._spaceKey);
2021
+ invariant8(this._spaceKey);
2015
2022
  const space = await this._spaceManager.spaces.get(this._spaceKey);
2016
- assert8(space);
2017
- assert8(request.space);
2023
+ invariant8(space);
2024
+ invariant8(request.space);
2018
2025
  const { identityKey, deviceKey } = request.space;
2019
2026
  log7("writing guest credentials", {
2020
2027
  host: this._signingContext.deviceKey,
2021
2028
  guest: deviceKey
2022
2029
  }, {
2023
- file: "space-invitation-protocol.ts",
2024
- line: 50,
2025
- scope: this,
2026
- callSite: (f, a) => f(...a)
2030
+ F: __dxlog_file7,
2031
+ L: 50,
2032
+ S: this,
2033
+ C: (f, a) => f(...a)
2027
2034
  });
2028
2035
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
2029
- assert8(credentials[0].credential);
2036
+ invariant8(credentials[0].credential);
2030
2037
  const spaceMemberCredential = credentials[0].credential.credential;
2031
- assert8(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2038
+ invariant8(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2032
2039
  await writeMessages2(space.inner.controlPipeline.writer, credentials);
2033
2040
  return {
2034
2041
  space: {
@@ -2056,11 +2063,11 @@ var SpaceInvitationProtocol = class {
2056
2063
  };
2057
2064
  }
2058
2065
  async accept(response) {
2059
- assert8(response.space);
2066
+ invariant8(response.space);
2060
2067
  const { credential, controlTimeframe, dataTimeframe } = response.space;
2061
2068
  const assertion = getCredentialAssertion(credential);
2062
- assert8(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
2063
- assert8(credential.subject.id.equals(this._signingContext.identityKey));
2069
+ invariant8(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
2070
+ invariant8(credential.subject.id.equals(this._signingContext.identityKey));
2064
2071
  await this._spaceManager.acceptSpace({
2065
2072
  spaceKey: assertion.spaceKey,
2066
2073
  genesisFeedKey: assertion.genesisFeedKey,
@@ -2089,7 +2096,7 @@ import { Timeframe } from "@dxos/timeframe";
2089
2096
  import { ComplexSet as ComplexSet2 } from "@dxos/util";
2090
2097
 
2091
2098
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2092
- import assert9 from "@dxos/node-std/assert";
2099
+ import invariant9 from "tiny-invariant";
2093
2100
  import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
2094
2101
  import { Context as Context5, rejectOnDispose } from "@dxos/context";
2095
2102
  import { PublicKey as PublicKey6 } from "@dxos/keys";
@@ -2097,6 +2104,7 @@ import { log as log8 } from "@dxos/log";
2097
2104
  import { schema as schema3 } from "@dxos/protocols";
2098
2105
  import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
2099
2106
  import { ComplexMap as ComplexMap2, ComplexSet, entry } from "@dxos/util";
2107
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2100
2108
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2101
2109
  var DEFAULT_SUCCESS_DELAY = 1e3;
2102
2110
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2121,22 +2129,22 @@ var NotarizationPlugin = class {
2121
2129
  log8("notarize", {
2122
2130
  credentials
2123
2131
  }, {
2124
- file: "notarization-plugin.ts",
2125
- line: 87,
2126
- scope: this,
2127
- callSite: (f, a) => f(...a)
2132
+ F: __dxlog_file8,
2133
+ L: 87,
2134
+ S: this,
2135
+ C: (f, a) => f(...a)
2128
2136
  });
2129
- assert9(credentials.every((credential) => credential.id), "Credentials must have an id");
2137
+ invariant9(credentials.every((credential) => credential.id), "Credentials must have an id");
2130
2138
  const errors = new Trigger4();
2131
2139
  const ctx = this._ctx.derive({
2132
2140
  onError: (err) => {
2133
2141
  log8.warn("Notarization error", {
2134
2142
  err
2135
2143
  }, {
2136
- file: "notarization-plugin.ts",
2137
- line: 96,
2138
- scope: this,
2139
- callSite: (f, a) => f(...a)
2144
+ F: __dxlog_file8,
2145
+ L: 96,
2146
+ S: this,
2147
+ C: (f, a) => f(...a)
2140
2148
  });
2141
2149
  void ctx.dispose();
2142
2150
  errors.throw(err);
@@ -2149,10 +2157,10 @@ var NotarizationPlugin = class {
2149
2157
  timeout,
2150
2158
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
2151
2159
  }, {
2152
- file: "notarization-plugin.ts",
2153
- line: 108,
2154
- scope: this,
2155
- callSite: (f, a) => f(...a)
2160
+ F: __dxlog_file8,
2161
+ L: 108,
2162
+ S: this,
2163
+ C: (f, a) => f(...a)
2156
2164
  });
2157
2165
  void ctx.dispose();
2158
2166
  errors.throw(new TimeoutError2(timeout, "Notarization timed out"));
@@ -2172,10 +2180,10 @@ var NotarizationPlugin = class {
2172
2180
  log8.warn("Exhausted all peers to notarize with", {
2173
2181
  retryIn: retryTimeout
2174
2182
  }, {
2175
- file: "notarization-plugin.ts",
2176
- line: 133,
2177
- scope: this,
2178
- callSite: (f, a) => f(...a)
2183
+ F: __dxlog_file8,
2184
+ L: 133,
2185
+ S: this,
2186
+ C: (f, a) => f(...a)
2179
2187
  });
2180
2188
  peersTried.clear();
2181
2189
  scheduleTask3(ctx, () => notarizeTask.schedule(), retryTimeout);
@@ -2186,28 +2194,28 @@ var NotarizationPlugin = class {
2186
2194
  peer: peer.localPeerId,
2187
2195
  credentialId: credentials.map((credential) => credential.id)
2188
2196
  }, {
2189
- file: "notarization-plugin.ts",
2190
- line: 140,
2191
- scope: this,
2192
- callSite: (f, a) => f(...a)
2197
+ F: __dxlog_file8,
2198
+ L: 140,
2199
+ S: this,
2200
+ C: (f, a) => f(...a)
2193
2201
  });
2194
2202
  await peer.rpc.NotarizationService.notarize({
2195
2203
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
2196
2204
  });
2197
- log8("success", {}, {
2198
- file: "notarization-plugin.ts",
2199
- line: 144,
2200
- scope: this,
2201
- callSite: (f, a) => f(...a)
2205
+ log8("success", void 0, {
2206
+ F: __dxlog_file8,
2207
+ L: 144,
2208
+ S: this,
2209
+ C: (f, a) => f(...a)
2202
2210
  });
2203
2211
  await sleep(successDelay);
2204
2212
  } catch (err) {
2205
2213
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
2206
2214
  log8.warn("error notarizing (recoverable)", err, {
2207
- file: "notarization-plugin.ts",
2208
- line: 148,
2209
- scope: this,
2210
- callSite: (f, a) => f(...a)
2215
+ F: __dxlog_file8,
2216
+ L: 148,
2217
+ S: this,
2218
+ C: (f, a) => f(...a)
2211
2219
  });
2212
2220
  }
2213
2221
  notarizeTask.schedule();
@@ -2221,11 +2229,11 @@ var NotarizationPlugin = class {
2221
2229
  allNotarized,
2222
2230
  errors.wait()
2223
2231
  ]);
2224
- log8("done", {}, {
2225
- file: "notarization-plugin.ts",
2226
- line: 159,
2227
- scope: this,
2228
- callSite: (f, a) => f(...a)
2232
+ log8("done", void 0, {
2233
+ F: __dxlog_file8,
2234
+ L: 159,
2235
+ S: this,
2236
+ C: (f, a) => f(...a)
2229
2237
  });
2230
2238
  } finally {
2231
2239
  await ctx.dispose();
@@ -2244,7 +2252,7 @@ var NotarizationPlugin = class {
2244
2252
  this._processCredentialsTriggers.delete(credential.id);
2245
2253
  }
2246
2254
  setWriter(writer) {
2247
- assert9(!this._writer, "Writer already set.");
2255
+ invariant9(!this._writer, "Writer already set.");
2248
2256
  this._writer = writer;
2249
2257
  }
2250
2258
  async _waitUntilProcessed(id) {
@@ -2262,7 +2270,7 @@ var NotarizationPlugin = class {
2262
2270
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
2263
2271
  }
2264
2272
  for (const credential of (_a = request.credentials) != null ? _a : []) {
2265
- assert9(credential.id, "Credential must have an id");
2273
+ invariant9(credential.id, "Credential must have an id");
2266
2274
  if (this._processedCredentials.has(credential.id)) {
2267
2275
  continue;
2268
2276
  }
@@ -2275,10 +2283,10 @@ var NotarizationPlugin = class {
2275
2283
  log8("extension opened", {
2276
2284
  peer: extension.localPeerId
2277
2285
  }, {
2278
- file: "notarization-plugin.ts",
2279
- line: 208,
2280
- scope: this,
2281
- callSite: (f, a) => f(...a)
2286
+ F: __dxlog_file8,
2287
+ L: 208,
2288
+ S: this,
2289
+ C: (f, a) => f(...a)
2282
2290
  });
2283
2291
  this._extensions.add(extension);
2284
2292
  this._extensionOpened.emit();
@@ -2287,10 +2295,10 @@ var NotarizationPlugin = class {
2287
2295
  log8("extension closed", {
2288
2296
  peer: extension.localPeerId
2289
2297
  }, {
2290
- file: "notarization-plugin.ts",
2291
- line: 213,
2292
- scope: this,
2293
- callSite: (f, a) => f(...a)
2298
+ F: __dxlog_file8,
2299
+ L: 213,
2300
+ S: this,
2301
+ C: (f, a) => f(...a)
2294
2302
  });
2295
2303
  this._extensions.delete(extension);
2296
2304
  },
@@ -2331,7 +2339,7 @@ var NotarizationTeleportExtension = class extends RpcExtension2 {
2331
2339
  };
2332
2340
 
2333
2341
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2334
- var __decorate = function(decorators, target, key, desc) {
2342
+ function _ts_decorate(decorators, target, key, desc) {
2335
2343
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2336
2344
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2337
2345
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2340,7 +2348,8 @@ var __decorate = function(decorators, target, key, desc) {
2340
2348
  if (d = decorators[i])
2341
2349
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2342
2350
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2343
- };
2351
+ }
2352
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2344
2353
  var DataSpace = class DataSpace2 {
2345
2354
  constructor(params) {
2346
2355
  this._ctx = new Context6();
@@ -2427,18 +2436,18 @@ var DataSpace = class DataSpace2 {
2427
2436
  } catch (err) {
2428
2437
  if (err instanceof CancelledError) {
2429
2438
  log9("Data pipeline initialization cancelled", err, {
2430
- file: "data-space.ts",
2431
- line: 173,
2432
- scope: this,
2433
- callSite: (f, a) => f(...a)
2439
+ F: __dxlog_file9,
2440
+ L: 173,
2441
+ S: this,
2442
+ C: (f, a) => f(...a)
2434
2443
  });
2435
2444
  return;
2436
2445
  }
2437
2446
  log9.error("Error initializing data pipeline", err, {
2438
- file: "data-space.ts",
2439
- line: 177,
2440
- scope: this,
2441
- callSite: (f, a) => f(...a)
2447
+ F: __dxlog_file9,
2448
+ L: 177,
2449
+ S: this,
2450
+ C: (f, a) => f(...a)
2442
2451
  });
2443
2452
  this._state = SpaceState.ERROR;
2444
2453
  this.error = err;
@@ -2460,11 +2469,11 @@ var DataSpace = class DataSpace2 {
2460
2469
  });
2461
2470
  this.metrics.controlPipelineReady = new Date();
2462
2471
  await this._createWritableFeeds();
2463
- log9("Writable feeds created", {}, {
2464
- file: "data-space.ts",
2465
- line: 201,
2466
- scope: this,
2467
- callSite: (f, a) => f(...a)
2472
+ log9("Writable feeds created", void 0, {
2473
+ F: __dxlog_file9,
2474
+ L: 201,
2475
+ S: this,
2476
+ C: (f, a) => f(...a)
2468
2477
  });
2469
2478
  this.stateUpdate.emit();
2470
2479
  this.notarizationPlugin.setWriter(createMappedFeedWriter((credential) => ({
@@ -2475,22 +2484,22 @@ var DataSpace = class DataSpace2 {
2475
2484
  await this._inner.initializeDataPipeline();
2476
2485
  this.metrics.dataPipelineOpen = new Date();
2477
2486
  await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2478
- log9("waiting for data pipeline to reach target timeframe", {}, {
2479
- file: "data-space.ts",
2480
- line: 220,
2481
- scope: this,
2482
- callSite: (f, a) => f(...a)
2487
+ log9("waiting for data pipeline to reach target timeframe", void 0, {
2488
+ F: __dxlog_file9,
2489
+ L: 220,
2490
+ S: this,
2491
+ C: (f, a) => f(...a)
2483
2492
  });
2484
2493
  await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
2485
2494
  ctx: this._ctx,
2486
2495
  breakOnStall: false
2487
2496
  });
2488
2497
  this.metrics.dataPipelineReady = new Date();
2489
- log9("data pipeline ready", {}, {
2490
- file: "data-space.ts",
2491
- line: 229,
2492
- scope: this,
2493
- callSite: (f, a) => f(...a)
2498
+ log9("data pipeline ready", void 0, {
2499
+ F: __dxlog_file9,
2500
+ L: 229,
2501
+ S: this,
2502
+ C: (f, a) => f(...a)
2494
2503
  });
2495
2504
  await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
2496
2505
  this._state = SpaceState.READY;
@@ -2569,15 +2578,15 @@ var DataSpace = class DataSpace2 {
2569
2578
  }
2570
2579
  }
2571
2580
  };
2572
- __decorate([
2581
+ _ts_decorate([
2573
2582
  timed(1e4)
2574
2583
  ], DataSpace.prototype, "_createWritableFeeds", null);
2575
- DataSpace = __decorate([
2584
+ DataSpace = _ts_decorate([
2576
2585
  trackLeaks("open", "close")
2577
2586
  ], DataSpace);
2578
2587
 
2579
2588
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2580
- import assert10 from "@dxos/node-std/assert";
2589
+ import invariant10 from "tiny-invariant";
2581
2590
  import { Event as Event6, synchronized, trackLeaks as trackLeaks2 } from "@dxos/async";
2582
2591
  import { cancelWithContext as cancelWithContext3, Context as Context7 } from "@dxos/context";
2583
2592
  import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
@@ -2659,7 +2668,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2659
2668
  };
2660
2669
 
2661
2670
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2662
- var __decorate2 = function(decorators, target, key, desc) {
2671
+ function _ts_decorate2(decorators, target, key, desc) {
2663
2672
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2664
2673
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2665
2674
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2668,7 +2677,8 @@ var __decorate2 = function(decorators, target, key, desc) {
2668
2677
  if (d = decorators[i])
2669
2678
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2670
2679
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2671
- };
2680
+ }
2681
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
2672
2682
  var DataSpaceManager = class DataSpaceManager2 {
2673
2683
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
2674
2684
  this._spaceManager = _spaceManager;
@@ -2688,38 +2698,38 @@ var DataSpaceManager = class DataSpaceManager2 {
2688
2698
  return this._spaces;
2689
2699
  }
2690
2700
  async open() {
2691
- log10("open", {}, {
2692
- file: "data-space-manager.ts",
2693
- line: 80,
2694
- scope: this,
2695
- callSite: (f, a) => f(...a)
2701
+ log10("open", void 0, {
2702
+ F: __dxlog_file10,
2703
+ L: 80,
2704
+ S: this,
2705
+ C: (f, a) => f(...a)
2696
2706
  });
2697
2707
  log10.trace("dxos.echo.data-space-manager.open", trace4.begin({
2698
2708
  id: this._instanceId
2699
2709
  }), {
2700
- file: "data-space-manager.ts",
2701
- line: 81,
2702
- scope: this,
2703
- callSite: (f, a) => f(...a)
2710
+ F: __dxlog_file10,
2711
+ L: 81,
2712
+ S: this,
2713
+ C: (f, a) => f(...a)
2704
2714
  });
2705
2715
  await this._metadataStore.load();
2706
2716
  log10("metadata loaded", {
2707
2717
  spaces: this._metadataStore.spaces.length
2708
2718
  }, {
2709
- file: "data-space-manager.ts",
2710
- line: 83,
2711
- scope: this,
2712
- callSite: (f, a) => f(...a)
2719
+ F: __dxlog_file10,
2720
+ L: 83,
2721
+ S: this,
2722
+ C: (f, a) => f(...a)
2713
2723
  });
2714
2724
  for (const spaceMetadata of this._metadataStore.spaces) {
2715
2725
  try {
2716
2726
  log10("load space", {
2717
2727
  spaceMetadata
2718
2728
  }, {
2719
- file: "data-space-manager.ts",
2720
- line: 87,
2721
- scope: this,
2722
- callSite: (f, a) => f(...a)
2729
+ F: __dxlog_file10,
2730
+ L: 87,
2731
+ S: this,
2732
+ C: (f, a) => f(...a)
2723
2733
  });
2724
2734
  const space = await this._constructSpace(spaceMetadata);
2725
2735
  space.initializeDataPipelineAsync();
@@ -2728,10 +2738,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2728
2738
  spaceMetadata,
2729
2739
  err
2730
2740
  }, {
2731
- file: "data-space-manager.ts",
2732
- line: 91,
2733
- scope: this,
2734
- callSite: (f, a) => f(...a)
2741
+ F: __dxlog_file10,
2742
+ L: 91,
2743
+ S: this,
2744
+ C: (f, a) => f(...a)
2735
2745
  });
2736
2746
  }
2737
2747
  }
@@ -2740,18 +2750,18 @@ var DataSpaceManager = class DataSpaceManager2 {
2740
2750
  log10.trace("dxos.echo.data-space-manager.open", trace4.end({
2741
2751
  id: this._instanceId
2742
2752
  }), {
2743
- file: "data-space-manager.ts",
2744
- line: 97,
2745
- scope: this,
2746
- callSite: (f, a) => f(...a)
2753
+ F: __dxlog_file10,
2754
+ L: 97,
2755
+ S: this,
2756
+ C: (f, a) => f(...a)
2747
2757
  });
2748
2758
  }
2749
2759
  async close() {
2750
- log10("close", {}, {
2751
- file: "data-space-manager.ts",
2752
- line: 102,
2753
- scope: this,
2754
- callSite: (f, a) => f(...a)
2760
+ log10("close", void 0, {
2761
+ F: __dxlog_file10,
2762
+ L: 102,
2763
+ S: this,
2764
+ C: (f, a) => f(...a)
2755
2765
  });
2756
2766
  this._isOpen = false;
2757
2767
  await this._ctx.dispose();
@@ -2763,7 +2773,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2763
2773
  * Creates a new space writing the genesis credentials to the control feed.
2764
2774
  */
2765
2775
  async createSpace() {
2766
- assert10(this._isOpen, "Not open.");
2776
+ invariant10(this._isOpen, "Not open.");
2767
2777
  const spaceKey = await this._keyring.createKey();
2768
2778
  const controlFeedKey = await this._keyring.createKey();
2769
2779
  const dataFeedKey = await this._keyring.createKey();
@@ -2776,16 +2786,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2776
2786
  log10("creating space...", {
2777
2787
  spaceKey
2778
2788
  }, {
2779
- file: "data-space-manager.ts",
2780
- line: 126,
2781
- scope: this,
2782
- callSite: (f, a) => f(...a)
2789
+ F: __dxlog_file10,
2790
+ L: 126,
2791
+ S: this,
2792
+ C: (f, a) => f(...a)
2783
2793
  });
2784
2794
  const space = await this._constructSpace(metadata);
2785
2795
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
2786
2796
  await this._metadataStore.addSpace(metadata);
2787
2797
  const memberCredential = credentials[1];
2788
- assert10(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2798
+ invariant10(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2789
2799
  await this._signingContext.recordCredential(memberCredential);
2790
2800
  await space.initializeDataPipeline();
2791
2801
  this.updated.emit();
@@ -2796,13 +2806,13 @@ var DataSpaceManager = class DataSpaceManager2 {
2796
2806
  log10("accept space", {
2797
2807
  opts
2798
2808
  }, {
2799
- file: "data-space-manager.ts",
2800
- line: 145,
2801
- scope: this,
2802
- callSite: (f, a) => f(...a)
2809
+ F: __dxlog_file10,
2810
+ L: 145,
2811
+ S: this,
2812
+ C: (f, a) => f(...a)
2803
2813
  });
2804
- assert10(this._isOpen, "Not open.");
2805
- assert10(!this._spaces.has(opts.spaceKey), "Space already exists.");
2814
+ invariant10(this._isOpen, "Not open.");
2815
+ invariant10(!this._spaces.has(opts.spaceKey), "Space already exists.");
2806
2816
  const metadata = {
2807
2817
  key: opts.spaceKey,
2808
2818
  genesisFeedKey: opts.genesisFeedKey,
@@ -2830,10 +2840,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2830
2840
  log10("construct space", {
2831
2841
  metadata
2832
2842
  }, {
2833
- file: "data-space-manager.ts",
2834
- line: 181,
2835
- scope: this,
2836
- callSite: (f, a) => f(...a)
2843
+ F: __dxlog_file10,
2844
+ L: 180,
2845
+ S: this,
2846
+ C: (f, a) => f(...a)
2837
2847
  });
2838
2848
  const gossip = new Gossip({
2839
2849
  localPeerId: this._signingContext.deviceKey
@@ -2865,11 +2875,11 @@ var DataSpaceManager = class DataSpaceManager2 {
2865
2875
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
2866
2876
  },
2867
2877
  onAuthFailure: () => {
2868
- log10.warn("auth failure", {}, {
2869
- file: "data-space-manager.ts",
2870
- line: 212,
2871
- scope: this,
2872
- callSite: (f, a) => f(...a)
2878
+ log10.warn("auth failure", void 0, {
2879
+ F: __dxlog_file10,
2880
+ L: 211,
2881
+ S: this,
2882
+ C: (f, a) => f(...a)
2873
2883
  });
2874
2884
  },
2875
2885
  memberKey: this._signingContext.identityKey
@@ -2889,10 +2899,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2889
2899
  log10("before space ready", {
2890
2900
  space: space.key
2891
2901
  }, {
2892
- file: "data-space-manager.ts",
2893
- line: 229,
2894
- scope: this,
2895
- callSite: (f, a) => f(...a)
2902
+ F: __dxlog_file10,
2903
+ L: 228,
2904
+ S: this,
2905
+ C: (f, a) => f(...a)
2896
2906
  });
2897
2907
  this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
2898
2908
  },
@@ -2901,10 +2911,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2901
2911
  space: space.key,
2902
2912
  open: this._isOpen
2903
2913
  }, {
2904
- file: "data-space-manager.ts",
2905
- line: 236,
2906
- scope: this,
2907
- callSite: (f, a) => f(...a)
2914
+ F: __dxlog_file10,
2915
+ L: 235,
2916
+ S: this,
2917
+ C: (f, a) => f(...a)
2908
2918
  });
2909
2919
  if (this._isOpen) {
2910
2920
  this.updated.emit();
@@ -2924,19 +2934,19 @@ var DataSpaceManager = class DataSpaceManager2 {
2924
2934
  return dataSpace;
2925
2935
  }
2926
2936
  };
2927
- __decorate2([
2937
+ _ts_decorate2([
2928
2938
  synchronized
2929
2939
  ], DataSpaceManager.prototype, "open", null);
2930
- __decorate2([
2940
+ _ts_decorate2([
2931
2941
  synchronized
2932
2942
  ], DataSpaceManager.prototype, "close", null);
2933
- __decorate2([
2943
+ _ts_decorate2([
2934
2944
  synchronized
2935
2945
  ], DataSpaceManager.prototype, "createSpace", null);
2936
- __decorate2([
2946
+ _ts_decorate2([
2937
2947
  synchronized
2938
2948
  ], DataSpaceManager.prototype, "acceptSpace", null);
2939
- DataSpaceManager = __decorate2([
2949
+ DataSpaceManager = _ts_decorate2([
2940
2950
  trackLeaks2("open", "close")
2941
2951
  ], DataSpaceManager);
2942
2952
 
@@ -2949,6 +2959,7 @@ import { log as log11 } from "@dxos/log";
2949
2959
  import { encodeError } from "@dxos/protocols";
2950
2960
  import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/client/services";
2951
2961
  import { humanize } from "@dxos/util";
2962
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
2952
2963
  var SpacesServiceImpl = class {
2953
2964
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
2954
2965
  this._identityManager = _identityManager;
@@ -2975,10 +2986,10 @@ var SpacesServiceImpl = class {
2975
2986
  log11("update", {
2976
2987
  spaces
2977
2988
  }, {
2978
- file: "spaces-service.ts",
2979
- line: 60,
2980
- scope: this,
2981
- callSite: (f, a) => f(...a)
2989
+ F: __dxlog_file11,
2990
+ L: 60,
2991
+ S: this,
2992
+ C: (f, a) => f(...a)
2982
2993
  });
2983
2994
  next({
2984
2995
  spaces
@@ -3105,7 +3116,7 @@ var SpacesServiceImpl = class {
3105
3116
  var getChannelId = (channel) => `user-channel/${channel}`;
3106
3117
 
3107
3118
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3108
- import assert11 from "@dxos/node-std/assert";
3119
+ import invariant11 from "tiny-invariant";
3109
3120
  import { Trigger as Trigger5 } from "@dxos/async";
3110
3121
  import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
3111
3122
  import { failUndefined as failUndefined3 } from "@dxos/debug";
@@ -3117,6 +3128,7 @@ import { log as log12 } from "@dxos/log";
3117
3128
  import { STORAGE_VERSION, trace as trace5 } from "@dxos/protocols";
3118
3129
  import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
3119
3130
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
3131
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
3120
3132
  var ServiceContext = class {
3121
3133
  // prettier-ignore
3122
3134
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3160,17 +3172,17 @@ var ServiceContext = class {
3160
3172
  log12.trace("dxos.sdk.service-context.open", trace5.begin({
3161
3173
  id: this._instanceId
3162
3174
  }), {
3163
- file: "service-context.ts",
3164
- line: 126,
3165
- scope: this,
3166
- callSite: (f, a) => f(...a)
3175
+ F: __dxlog_file12,
3176
+ L: 126,
3177
+ S: this,
3178
+ C: (f, a) => f(...a)
3167
3179
  });
3168
3180
  await this._checkStorageVersion();
3169
- log12("opening...", {}, {
3170
- file: "service-context.ts",
3171
- line: 130,
3172
- scope: this,
3173
- callSite: (f, a) => f(...a)
3181
+ log12("opening...", void 0, {
3182
+ F: __dxlog_file12,
3183
+ L: 130,
3184
+ S: this,
3185
+ C: (f, a) => f(...a)
3174
3186
  });
3175
3187
  await this.signalManager.open();
3176
3188
  await this.networkManager.open();
@@ -3179,28 +3191,28 @@ var ServiceContext = class {
3179
3191
  if (this.identityManager.identity) {
3180
3192
  await this._initialize();
3181
3193
  }
3182
- log12("opened", {}, {
3183
- file: "service-context.ts",
3184
- line: 138,
3185
- scope: this,
3186
- callSite: (f, a) => f(...a)
3194
+ log12("opened", void 0, {
3195
+ F: __dxlog_file12,
3196
+ L: 138,
3197
+ S: this,
3198
+ C: (f, a) => f(...a)
3187
3199
  });
3188
3200
  log12.trace("dxos.sdk.service-context.open", trace5.end({
3189
3201
  id: this._instanceId
3190
3202
  }), {
3191
- file: "service-context.ts",
3192
- line: 139,
3193
- scope: this,
3194
- callSite: (f, a) => f(...a)
3203
+ F: __dxlog_file12,
3204
+ L: 139,
3205
+ S: this,
3206
+ C: (f, a) => f(...a)
3195
3207
  });
3196
3208
  }
3197
3209
  async close() {
3198
3210
  var _a, _b;
3199
- log12("closing...", {}, {
3200
- file: "service-context.ts",
3201
- line: 143,
3202
- scope: this,
3203
- callSite: (f, a) => f(...a)
3211
+ log12("closing...", void 0, {
3212
+ F: __dxlog_file12,
3213
+ L: 143,
3214
+ S: this,
3215
+ C: (f, a) => f(...a)
3204
3216
  });
3205
3217
  await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
3206
3218
  await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
@@ -3210,11 +3222,11 @@ var ServiceContext = class {
3210
3222
  await this.networkManager.close();
3211
3223
  await this.signalManager.close();
3212
3224
  this.dataServiceSubscriptions.clear();
3213
- log12("closed", {}, {
3214
- file: "service-context.ts",
3215
- line: 152,
3216
- scope: this,
3217
- callSite: (f, a) => f(...a)
3225
+ log12("closed", void 0, {
3226
+ F: __dxlog_file12,
3227
+ L: 152,
3228
+ S: this,
3229
+ C: (f, a) => f(...a)
3218
3230
  });
3219
3231
  }
3220
3232
  async createIdentity(params = {}) {
@@ -3224,7 +3236,7 @@ var ServiceContext = class {
3224
3236
  }
3225
3237
  getInvitationHandler(invitation) {
3226
3238
  const factory = this._handlerFactories.get(invitation.kind);
3227
- assert11(factory, `Unknown invitation kind: ${invitation.kind}`);
3239
+ invariant11(factory, `Unknown invitation kind: ${invitation.kind}`);
3228
3240
  return factory(invitation);
3229
3241
  }
3230
3242
  async _acceptIdentity(params) {
@@ -3241,11 +3253,11 @@ var ServiceContext = class {
3241
3253
  // Called when identity is created.
3242
3254
  async _initialize() {
3243
3255
  var _a;
3244
- log12("initializing spaces...", {}, {
3245
- file: "service-context.ts",
3246
- line: 185,
3247
- scope: this,
3248
- callSite: (f, a) => f(...a)
3256
+ log12("initializing spaces...", void 0, {
3257
+ F: __dxlog_file12,
3258
+ L: 185,
3259
+ S: this,
3260
+ C: (f, a) => f(...a)
3249
3261
  });
3250
3262
  const identity = (_a = this.identityManager.identity) != null ? _a : failUndefined3();
3251
3263
  const signingContext = {
@@ -3264,7 +3276,7 @@ var ServiceContext = class {
3264
3276
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3265
3277
  await this.dataSpaceManager.open();
3266
3278
  this._handlerFactories.set(Invitation5.Kind.SPACE, (invitation) => {
3267
- assert11(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3279
+ invariant11(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3268
3280
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
3269
3281
  });
3270
3282
  this.initialized.wake();
@@ -3281,10 +3293,10 @@ var ServiceContext = class {
3281
3293
  log12("dataSpaceManager not initialized yet, ignoring space admission", {
3282
3294
  details: assertion
3283
3295
  }, {
3284
- file: "service-context.ts",
3285
- line: 224,
3286
- scope: this,
3287
- callSite: (f, a) => f(...a)
3296
+ F: __dxlog_file12,
3297
+ L: 224,
3298
+ S: this,
3299
+ C: (f, a) => f(...a)
3288
3300
  });
3289
3301
  return;
3290
3302
  }
@@ -3292,10 +3304,10 @@ var ServiceContext = class {
3292
3304
  log12("space already exists, ignoring space admission", {
3293
3305
  details: assertion
3294
3306
  }, {
3295
- file: "service-context.ts",
3296
- line: 228,
3297
- scope: this,
3298
- callSite: (f, a) => f(...a)
3307
+ F: __dxlog_file12,
3308
+ L: 228,
3309
+ S: this,
3310
+ C: (f, a) => f(...a)
3299
3311
  });
3300
3312
  return;
3301
3313
  }
@@ -3303,21 +3315,21 @@ var ServiceContext = class {
3303
3315
  log12("accepting space recorded in halo", {
3304
3316
  details: assertion
3305
3317
  }, {
3306
- file: "service-context.ts",
3307
- line: 233,
3308
- scope: this,
3309
- callSite: (f, a) => f(...a)
3318
+ F: __dxlog_file12,
3319
+ L: 233,
3320
+ S: this,
3321
+ C: (f, a) => f(...a)
3310
3322
  });
3311
3323
  await this.dataSpaceManager.acceptSpace({
3312
3324
  spaceKey: assertion.spaceKey,
3313
3325
  genesisFeedKey: assertion.genesisFeedKey
3314
3326
  });
3315
3327
  } catch (err) {
3316
- log12.catch(err, {}, {
3317
- file: "service-context.ts",
3318
- line: 239,
3319
- scope: this,
3320
- callSite: (f, a) => f(...a)
3328
+ log12.catch(err, void 0, {
3329
+ F: __dxlog_file12,
3330
+ L: 239,
3331
+ S: this,
3332
+ C: (f, a) => f(...a)
3321
3333
  });
3322
3334
  }
3323
3335
  }
@@ -3330,7 +3342,7 @@ var ServiceContext = class {
3330
3342
  import { asyncTimeout, Trigger as Trigger6 } from "@dxos/async";
3331
3343
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
3332
3344
  import { log as log13, logInfo } from "@dxos/log";
3333
- var __decorate3 = function(decorators, target, key, desc) {
3345
+ function _ts_decorate3(decorators, target, key, desc) {
3334
3346
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3335
3347
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3336
3348
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3339,7 +3351,8 @@ var __decorate3 = function(decorators, target, key, desc) {
3339
3351
  if (d = decorators[i])
3340
3352
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3341
3353
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3342
- };
3354
+ }
3355
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
3343
3356
  var Message;
3344
3357
  (function(Message2) {
3345
3358
  Message2["ACQUIRING"] = "acquiring";
@@ -3361,32 +3374,32 @@ var Lock = class {
3361
3374
  message: Message.ACQUIRING
3362
3375
  });
3363
3376
  try {
3364
- log13("aquiring lock...", {}, {
3365
- file: "browser.ts",
3366
- line: 42,
3367
- scope: this,
3368
- callSite: (f, a) => f(...a)
3377
+ log13("aquiring lock...", void 0, {
3378
+ F: __dxlog_file13,
3379
+ L: 42,
3380
+ S: this,
3381
+ C: (f, a) => f(...a)
3369
3382
  });
3370
3383
  await asyncTimeout(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
3371
- log13("acquired lock", {}, {
3372
- file: "browser.ts",
3373
- line: 44,
3374
- scope: this,
3375
- callSite: (f, a) => f(...a)
3384
+ log13("acquired lock", void 0, {
3385
+ F: __dxlog_file13,
3386
+ L: 44,
3387
+ S: this,
3388
+ C: (f, a) => f(...a)
3376
3389
  });
3377
3390
  } catch (e) {
3378
- log13("stealing lock...", {}, {
3379
- file: "browser.ts",
3380
- line: 46,
3381
- scope: this,
3382
- callSite: (f, a) => f(...a)
3391
+ log13("stealing lock...", void 0, {
3392
+ F: __dxlog_file13,
3393
+ L: 46,
3394
+ S: this,
3395
+ C: (f, a) => f(...a)
3383
3396
  });
3384
3397
  await this._requestLock(true);
3385
- log13("stolen lock", {}, {
3386
- file: "browser.ts",
3387
- line: 48,
3388
- scope: this,
3389
- callSite: (f, a) => f(...a)
3398
+ log13("stolen lock", void 0, {
3399
+ F: __dxlog_file13,
3400
+ L: 48,
3401
+ S: this,
3402
+ C: (f, a) => f(...a)
3390
3403
  });
3391
3404
  }
3392
3405
  }
@@ -3402,10 +3415,10 @@ var Lock = class {
3402
3415
  log13("requesting lock...", {
3403
3416
  steal
3404
3417
  }, {
3405
- file: "browser.ts",
3406
- line: 63,
3407
- scope: this,
3408
- callSite: (f, a) => f(...a)
3418
+ F: __dxlog_file13,
3419
+ L: 63,
3420
+ S: this,
3421
+ C: (f, a) => f(...a)
3409
3422
  });
3410
3423
  const acquired = new Trigger6();
3411
3424
  void navigator.locks.request(this._lockKey, {
@@ -3416,18 +3429,18 @@ var Lock = class {
3416
3429
  acquired.wake();
3417
3430
  this._releaseTrigger = new Trigger6();
3418
3431
  await this._releaseTrigger.wait();
3419
- log13("releasing lock...", {}, {
3420
- file: "browser.ts",
3421
- line: 72,
3422
- scope: this,
3423
- callSite: (f, a) => f(...a)
3432
+ log13("releasing lock...", void 0, {
3433
+ F: __dxlog_file13,
3434
+ L: 72,
3435
+ S: this,
3436
+ C: (f, a) => f(...a)
3424
3437
  });
3425
3438
  await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
3426
- log13("released lock", {}, {
3427
- file: "browser.ts",
3428
- line: 74,
3429
- scope: this,
3430
- callSite: (f, a) => f(...a)
3439
+ log13("released lock", void 0, {
3440
+ F: __dxlog_file13,
3441
+ L: 74,
3442
+ S: this,
3443
+ C: (f, a) => f(...a)
3431
3444
  });
3432
3445
  }).catch(async () => {
3433
3446
  var _a;
@@ -3437,14 +3450,14 @@ var Lock = class {
3437
3450
  log13("recieved lock", {
3438
3451
  steal
3439
3452
  }, {
3440
- file: "browser.ts",
3441
- line: 81,
3442
- scope: this,
3443
- callSite: (f, a) => f(...a)
3453
+ F: __dxlog_file13,
3454
+ L: 81,
3455
+ S: this,
3456
+ C: (f, a) => f(...a)
3444
3457
  });
3445
3458
  }
3446
3459
  };
3447
- __decorate3([
3460
+ _ts_decorate3([
3448
3461
  logInfo
3449
3462
  ], Lock.prototype, "lockKey", null);
3450
3463
  var isLocked = (lockPath) => {
@@ -3525,16 +3538,19 @@ var ServiceRegistry = class {
3525
3538
  };
3526
3539
 
3527
3540
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3528
- import assert12 from "@dxos/node-std/assert";
3541
+ import invariant12 from "tiny-invariant";
3529
3542
  import { Event as Event8, synchronized as synchronized2 } from "@dxos/async";
3530
- import { clientServiceBundle, createDefaultModelFactory } from "@dxos/client-protocol";
3543
+ import { clientServiceBundle } from "@dxos/client-protocol";
3544
+ import { DocumentModel } from "@dxos/document-model";
3531
3545
  import { DataServiceImpl } from "@dxos/echo-pipeline";
3532
3546
  import { PublicKey as PublicKey10 } from "@dxos/keys";
3533
3547
  import { log as log15 } from "@dxos/log";
3534
3548
  import { WebsocketSignalManager } from "@dxos/messaging";
3549
+ import { ModelFactory } from "@dxos/model-factory";
3535
3550
  import { createWebRTCTransportFactory, NetworkManager } from "@dxos/network-manager";
3536
3551
  import { trace as trace6 } from "@dxos/protocols";
3537
3552
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
3553
+ import { TextModel } from "@dxos/text-model";
3538
3554
 
3539
3555
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3540
3556
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
@@ -3610,7 +3626,7 @@ var LoggingServiceImpl = class {
3610
3626
  if (LOG_PROCESSING > 0) {
3611
3627
  return;
3612
3628
  }
3613
- 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"))) {
3629
+ 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"))) {
3614
3630
  return;
3615
3631
  }
3616
3632
  if (!shouldLog(entry2, request)) {
@@ -3622,8 +3638,8 @@ var LoggingServiceImpl = class {
3622
3638
  timestamp: new Date(),
3623
3639
  meta: {
3624
3640
  // TODO(dmaretskyi): Fix proto.
3625
- file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
3626
- line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
3641
+ file: (_c = (_b = entry2.meta) == null ? void 0 : _b.F) != null ? _c : "",
3642
+ line: (_e = (_d = entry2.meta) == null ? void 0 : _d.L) != null ? _e : 0
3627
3643
  }
3628
3644
  };
3629
3645
  try {
@@ -3653,7 +3669,7 @@ var shouldLog = (entry2, request) => {
3653
3669
  } else {
3654
3670
  return request.filters.some((filter) => {
3655
3671
  var _a2, _b;
3656
- return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
3672
+ return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.F) != null ? _b : "", options);
3657
3673
  });
3658
3674
  }
3659
3675
  };
@@ -3730,7 +3746,7 @@ var SystemServiceImpl = class {
3730
3746
  };
3731
3747
 
3732
3748
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3733
- var __decorate4 = function(decorators, target, key, desc) {
3749
+ function _ts_decorate4(decorators, target, key, desc) {
3734
3750
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3735
3751
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3736
3752
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3739,6 +3755,10 @@ var __decorate4 = function(decorators, target, key, desc) {
3739
3755
  if (d = decorators[i])
3740
3756
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3741
3757
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3758
+ }
3759
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
3760
+ var createDefaultModelFactory = () => {
3761
+ return new ModelFactory().registerModel(DocumentModel).registerModel(TextModel);
3742
3762
  };
3743
3763
  var ClientServicesHost = class {
3744
3764
  constructor({
@@ -3750,13 +3770,15 @@ var ClientServicesHost = class {
3750
3770
  connectionLog,
3751
3771
  storage,
3752
3772
  // TODO(wittjosiah): Turn this on by default.
3753
- lockKey
3773
+ lockKey,
3774
+ callbacks
3754
3775
  } = {}) {
3755
3776
  this._statusUpdate = new Event8();
3756
3777
  this._opening = false;
3757
3778
  this._open = false;
3758
3779
  this._storage = storage;
3759
3780
  this._modelFactory = modelFactory;
3781
+ this._callbacks = callbacks;
3760
3782
  if (config) {
3761
3783
  this.initialize({
3762
3784
  config,
@@ -3815,9 +3837,9 @@ var ClientServicesHost = class {
3815
3837
  */
3816
3838
  initialize({ config, ...options }) {
3817
3839
  var _a, _b, _c;
3818
- assert12(!this._open, "service host is open");
3840
+ invariant12(!this._open, "service host is open");
3819
3841
  if (config) {
3820
- assert12(!this._config, "config already set");
3842
+ invariant12(!this._config, "config already set");
3821
3843
  this._config = config;
3822
3844
  if (!this._storage) {
3823
3845
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
@@ -3827,7 +3849,7 @@ var ClientServicesHost = class {
3827
3849
  iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
3828
3850
  }), signalManager = new WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
3829
3851
  this._signalManager = signalManager;
3830
- assert12(!this._networkManager, "network manager already set");
3852
+ invariant12(!this._networkManager, "network manager already set");
3831
3853
  this._networkManager = new NetworkManager({
3832
3854
  log: connectionLog,
3833
3855
  transportFactory,
@@ -3843,23 +3865,23 @@ var ClientServicesHost = class {
3843
3865
  log15.trace("dxos.sdk.client-services-host.open", trace6.begin({
3844
3866
  id: traceId
3845
3867
  }), {
3846
- file: "service-host.ts",
3847
- line: 188,
3848
- scope: this,
3849
- callSite: (f, a) => f(...a)
3850
- });
3851
- assert12(this._config, "config not set");
3852
- assert12(this._storage, "storage not set");
3853
- assert12(this._signalManager, "signal manager not set");
3854
- assert12(this._networkManager, "network manager not set");
3868
+ F: __dxlog_file14,
3869
+ L: 203,
3870
+ S: this,
3871
+ C: (f, a) => f(...a)
3872
+ });
3873
+ invariant12(this._config, "config not set");
3874
+ invariant12(this._storage, "storage not set");
3875
+ invariant12(this._signalManager, "signal manager not set");
3876
+ invariant12(this._networkManager, "network manager not set");
3855
3877
  this._opening = true;
3856
3878
  log15("opening...", {
3857
3879
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3858
3880
  }, {
3859
- file: "service-host.ts",
3860
- line: 196,
3861
- scope: this,
3862
- callSite: (f, a) => f(...a)
3881
+ F: __dxlog_file14,
3882
+ L: 211,
3883
+ S: this,
3884
+ C: (f, a) => f(...a)
3863
3885
  });
3864
3886
  await ((_b = this._resourceLock) == null ? void 0 : _b.acquire());
3865
3887
  await this._loggingService.open();
@@ -3891,18 +3913,18 @@ var ClientServicesHost = class {
3891
3913
  log15("opened", {
3892
3914
  deviceKey
3893
3915
  }, {
3894
- file: "service-host.ts",
3895
- line: 251,
3896
- scope: this,
3897
- callSite: (f, a) => f(...a)
3916
+ F: __dxlog_file14,
3917
+ L: 266,
3918
+ S: this,
3919
+ C: (f, a) => f(...a)
3898
3920
  });
3899
3921
  log15.trace("dxos.sdk.client-services-host.open", trace6.end({
3900
3922
  id: traceId
3901
3923
  }), {
3902
- file: "service-host.ts",
3903
- line: 252,
3904
- scope: this,
3905
- callSite: (f, a) => f(...a)
3924
+ F: __dxlog_file14,
3925
+ L: 267,
3926
+ S: this,
3927
+ C: (f, a) => f(...a)
3906
3928
  });
3907
3929
  }
3908
3930
  async close() {
@@ -3914,10 +3936,10 @@ var ClientServicesHost = class {
3914
3936
  log15("closing...", {
3915
3937
  deviceKey
3916
3938
  }, {
3917
- file: "service-host.ts",
3918
- line: 262,
3919
- scope: this,
3920
- callSite: (f, a) => f(...a)
3939
+ F: __dxlog_file14,
3940
+ L: 277,
3941
+ S: this,
3942
+ C: (f, a) => f(...a)
3921
3943
  });
3922
3944
  this._serviceRegistry.setServices({
3923
3945
  SystemService: this._systemService
@@ -3929,51 +3951,52 @@ var ClientServicesHost = class {
3929
3951
  log15("closed", {
3930
3952
  deviceKey
3931
3953
  }, {
3932
- file: "service-host.ts",
3933
- line: 268,
3934
- scope: this,
3935
- callSite: (f, a) => f(...a)
3954
+ F: __dxlog_file14,
3955
+ L: 283,
3956
+ S: this,
3957
+ C: (f, a) => f(...a)
3936
3958
  });
3937
3959
  }
3938
3960
  async reset() {
3939
- var _a;
3961
+ var _a, _b, _c;
3940
3962
  const traceId = PublicKey10.random().toHex();
3941
3963
  log15.trace("dxos.sdk.client-services-host.reset", trace6.begin({
3942
3964
  id: traceId
3943
3965
  }), {
3944
- file: "service-host.ts",
3945
- line: 273,
3946
- scope: this,
3947
- callSite: (f, a) => f(...a)
3966
+ F: __dxlog_file14,
3967
+ L: 288,
3968
+ S: this,
3969
+ C: (f, a) => f(...a)
3948
3970
  });
3949
- log15("resetting...", {}, {
3950
- file: "service-host.ts",
3951
- line: 275,
3952
- scope: this,
3953
- callSite: (f, a) => f(...a)
3971
+ log15("resetting...", void 0, {
3972
+ F: __dxlog_file14,
3973
+ L: 290,
3974
+ S: this,
3975
+ C: (f, a) => f(...a)
3954
3976
  });
3955
3977
  await ((_a = this._serviceContext) == null ? void 0 : _a.close());
3956
3978
  await this._storage.reset();
3957
- log15("reset", {}, {
3958
- file: "service-host.ts",
3959
- line: 278,
3960
- scope: this,
3961
- callSite: (f, a) => f(...a)
3979
+ log15("reset", void 0, {
3980
+ F: __dxlog_file14,
3981
+ L: 293,
3982
+ S: this,
3983
+ C: (f, a) => f(...a)
3962
3984
  });
3963
3985
  log15.trace("dxos.sdk.client-services-host.reset", trace6.end({
3964
3986
  id: traceId
3965
3987
  }), {
3966
- file: "service-host.ts",
3967
- line: 279,
3968
- scope: this,
3969
- callSite: (f, a) => f(...a)
3988
+ F: __dxlog_file14,
3989
+ L: 294,
3990
+ S: this,
3991
+ C: (f, a) => f(...a)
3970
3992
  });
3993
+ await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
3971
3994
  }
3972
3995
  };
3973
- __decorate4([
3996
+ _ts_decorate4([
3974
3997
  synchronized2
3975
3998
  ], ClientServicesHost.prototype, "open", null);
3976
- __decorate4([
3999
+ _ts_decorate4([
3977
4000
  synchronized2
3978
4001
  ], ClientServicesHost.prototype, "close", null);
3979
4002
 
@@ -4005,6 +4028,7 @@ export {
4005
4028
  isLocked,
4006
4029
  createStorageObjects,
4007
4030
  ServiceRegistry,
4031
+ createDefaultModelFactory,
4008
4032
  ClientServicesHost
4009
4033
  };
4010
- //# sourceMappingURL=chunk-6ITWCQIT.mjs.map
4034
+ //# sourceMappingURL=chunk-PWZ2J6KS.mjs.map