@glyphteck/veyl 0.67.0 → 0.68.0

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.
@@ -115,6 +115,7 @@ var CHAT_MANIFEST_MAX_BYTES = 256 * KIB_BYTES;
115
115
  var CHAT_RECEIPT_MAX_MEMBERS = 32;
116
116
  var CHAT_ORDINARY_DELIVERY_MAX_MEMBERS = 128;
117
117
  var CHAT_MAX_MEMBERS = 256;
118
+ var CHAT_LARGE_GROUP_MENTION_MAX_TARGETS = 16;
118
119
  var CHAT_MAX_TEXT_CHARS = 2048;
119
120
  var CHAT_TITLE_INPUT_MAX_CHARS = 16;
120
121
  var CHAT_MAX_REACTIONS = CHAT_MAX_MEMBERS;
@@ -563,6 +564,71 @@ function deselectAccountProfile(value, profileId) {
563
564
  return freezeRegistry({ ...registry, selectedProfileId: null });
564
565
  }
565
566
 
567
+ // ../../core/account/scope.js
568
+ var ACCOUNT_SCOPE_STALE_CODE = "account-scope/stale";
569
+ var PROFILE_ID_RE2 = /^[0-9a-f]{32}$/;
570
+ var ACCOUNT_SCOPE_CAPABILITIES = new WeakSet;
571
+ function requireGeneration(value) {
572
+ const generation = Number(value);
573
+ if (!Number.isSafeInteger(generation) || generation < 0) {
574
+ throw new Error("account scope generation required");
575
+ }
576
+ return generation;
577
+ }
578
+ function requireProfileId(value) {
579
+ const profileId = lowerText(value);
580
+ if (!PROFILE_ID_RE2.test(profileId))
581
+ throw new Error("account scope profile id required");
582
+ return profileId;
583
+ }
584
+ function requireText(value, label) {
585
+ const text = cleanText(value);
586
+ if (!text)
587
+ throw new Error(`${label} required`);
588
+ return text;
589
+ }
590
+ function staleAccountScopeError(scope = null) {
591
+ const error = new Error("account scope is no longer active");
592
+ error.code = ACCOUNT_SCOPE_STALE_CODE;
593
+ error.profileId = scope?.profileId || null;
594
+ error.generation = Number.isSafeInteger(scope?.generation) ? scope.generation : null;
595
+ return error;
596
+ }
597
+ function createAccountScope({
598
+ environment,
599
+ generation,
600
+ isCurrent,
601
+ profileId,
602
+ uid
603
+ } = {}) {
604
+ if (typeof isCurrent !== "function")
605
+ throw new Error("account scope current-state port required");
606
+ const normalizedEnvironment = lowerText(requireText(environment, "account scope environment"));
607
+ const normalizedGeneration = requireGeneration(generation);
608
+ const normalizedProfileId = requireProfileId(profileId);
609
+ const normalizedUid = requireText(uid, "account scope uid");
610
+ const accountOwnerKey = `${normalizedEnvironment}:${normalizedProfileId}:${normalizedUid}`;
611
+ const scope = {
612
+ accountOwnerKey,
613
+ environment: normalizedEnvironment,
614
+ generation: normalizedGeneration,
615
+ key: `${accountOwnerKey}:${normalizedGeneration}`,
616
+ profileId: normalizedProfileId,
617
+ uid: normalizedUid,
618
+ isCurrent: () => isCurrent() === true,
619
+ assertCurrent() {
620
+ if (!scope.isCurrent())
621
+ throw staleAccountScopeError(scope);
622
+ return scope;
623
+ }
624
+ };
625
+ ACCOUNT_SCOPE_CAPABILITIES.add(scope);
626
+ return Object.freeze(scope);
627
+ }
628
+ function isAccountScope(value) {
629
+ return !!value && typeof value === "object" && ACCOUNT_SCOPE_CAPABILITIES.has(value);
630
+ }
631
+
566
632
  // src/accountprofiles.js
567
633
  var ACCOUNT_PROFILE_STALE_CODE = "account-profiles/stale";
568
634
  var ACCOUNT_PROFILE_AUTH_REQUIRED_CODE = "account-profiles/auth-required";
@@ -678,12 +744,16 @@ async function resolveAuthenticatedProfile(owner, generation, reason, details =
678
744
  return profile;
679
745
  }
680
746
  function publicSnapshot(owner) {
747
+ const activeBinding = owner.active?.lease.valid === true && owner.active.scope?.isCurrent() === true ? owner.active.binding : null;
681
748
  return Object.freeze({
682
749
  ready: owner.ready,
683
750
  environment: owner.registry.environment,
684
751
  profiles: accountProfilesByRecency(owner.registry),
685
752
  selectedProfileId: owner.registry.selectedProfileId,
686
- activeProfileId: owner.active?.profile.profileId || null,
753
+ activeBinding,
754
+ activeProfileId: activeBinding ? owner.active.profile.profileId : null,
755
+ activeScope: activeBinding?.scope || null,
756
+ activeScopeKey: activeBinding?.scope.key || null,
687
757
  status: owner.status,
688
758
  generation: owner.generation,
689
759
  error: owner.error
@@ -745,12 +815,23 @@ function ensureRequested(owner, generation, profileId) {
745
815
  throw staleTransitionError();
746
816
  }
747
817
  function transitionContext(owner, lease, reason, details = {}) {
818
+ const profile = lease.profileId ? owner.registry.profiles.find((item) => item.profileId === lease.profileId) || null : null;
819
+ const isCurrent = () => !owner.closing && !owner.closed && lease.valid;
748
820
  return Object.freeze({
821
+ environment: owner.registry.environment,
749
822
  generation: lease.generation,
750
823
  profileId: lease.profileId,
824
+ uid: profile?.uid || null,
751
825
  reason,
752
826
  ...details,
753
- isCurrent: () => !owner.closing && !owner.closed && lease.valid
827
+ scope: profile ? createAccountScope({
828
+ environment: owner.registry.environment,
829
+ generation: lease.generation,
830
+ profileId: lease.profileId,
831
+ uid: profile.uid,
832
+ isCurrent
833
+ }) : null,
834
+ isCurrent
754
835
  });
755
836
  }
756
837
  function report(owner, operation, error, profile = null) {
@@ -773,7 +854,13 @@ async function cleanupBinding(owner, binding, context) {
773
854
  binding.lease.valid = false;
774
855
  await attempt("lock", () => binding.runtime.lock());
775
856
  }
776
- await attempt("clearNotification", () => owner.ports.clearNotification(profile, context));
857
+ if (binding?.scope?.key && binding.scope.accountOwnerKey) {
858
+ await attempt("clearNotification", () => owner.ports.clearNotification(Object.freeze({
859
+ owner: binding.scope,
860
+ profile,
861
+ context
862
+ })));
863
+ }
777
864
  if (binding) {
778
865
  try {
779
866
  await owner.ports.dropPush(profile, binding.runtime, context);
@@ -873,7 +960,13 @@ async function openTarget(owner, profile, generation, reason, options = {}) {
873
960
  return discardCandidate(owner, profile, runtime, lease, "stale", null);
874
961
  }
875
962
  owner.openingLease = null;
876
- owner.active = { profile, runtime, lease };
963
+ owner.active = {
964
+ profile,
965
+ runtime,
966
+ lease,
967
+ scope: context.scope,
968
+ binding: Object.freeze({ runtime, scope: context.scope })
969
+ };
877
970
  publish(owner, "idle", null);
878
971
  return runtime;
879
972
  }
@@ -1414,7 +1507,7 @@ function createAccountProfiles(options = {}) {
1414
1507
  refresh: () => requestProfileRefresh(owner),
1415
1508
  signOut: (profileId) => requestProfileSignOut(owner, profileId),
1416
1509
  remove: (profileId) => requestProfileRemoval(owner, profileId),
1417
- getActiveRuntime: () => owner.active?.runtime || null,
1510
+ getActiveBinding: () => owner.snapshot.activeBinding,
1418
1511
  close: () => closeProfiles(owner)
1419
1512
  });
1420
1513
  }
package/dist/auth.js CHANGED
@@ -95,7 +95,7 @@ function normalizePasskeyRegisterError(error, options = {}) {
95
95
  }
96
96
 
97
97
  // ../../core/agreement.js
98
- var TERMS_VERSION = "2026-08-22.4";
98
+ var TERMS_VERSION = "2026-09-01.1";
99
99
  var CURRENT_AGREEMENT = Object.freeze({
100
100
  termsVersion: TERMS_VERSION
101
101
  });