@adhdev/daemon-standalone 1.0.49-rc.5 → 1.0.49-rc.6

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.
package/dist/index.js CHANGED
@@ -37056,10 +37056,10 @@ var require_dist3 = __commonJS({
37056
37056
  }
37057
37057
  function getDaemonBuildInfo() {
37058
37058
  if (cached2) return cached2;
37059
- const commit = readInjected(true ? "0b3c203b7ae08f860c52a4dd7ee88edddd48d8cb" : void 0) ?? "unknown";
37060
- const commitShort = readInjected(true ? "0b3c203b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
37061
- const version2 = readInjected(true ? "1.0.49-rc.5" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
37062
- const builtAt = readInjected(true ? "2026-08-14T13:19:52.123Z" : void 0);
37059
+ const commit = readInjected(true ? "21db9be61179f54103c284dc170a085b6ae3537e" : void 0) ?? "unknown";
37060
+ const commitShort = readInjected(true ? "21db9be6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
37061
+ const version2 = readInjected(true ? "1.0.49-rc.6" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
37062
+ const builtAt = readInjected(true ? "2026-08-14T14:46:33.356Z" : void 0);
37063
37063
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
37064
37064
  return cached2;
37065
37065
  }
@@ -57767,10 +57767,23 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
57767
57767
  const reporterNowMs = Number(quota.updatedAt) + ageMs2;
57768
57768
  return resetsAt - reporterNowMs < imminentMs;
57769
57769
  }
57770
+ function isRetainedWindowTrustworthy(window, facts, quota, policy, now) {
57771
+ const resetsAt = Number(window?.resetsAt);
57772
+ if (!Number.isFinite(resetsAt) || resetsAt <= 0) {
57773
+ return isQuotaSnapshotFresh(facts, quota, policy, now);
57774
+ }
57775
+ const ageMs2 = quotaSnapshotAgeMs(facts, quota, now);
57776
+ if (!Number.isFinite(ageMs2)) return false;
57777
+ const reporterNowMs = Number(quota.updatedAt) + ageMs2;
57778
+ if (!Number.isFinite(reporterNowMs)) return false;
57779
+ return resetsAt > reporterNowMs;
57780
+ }
57770
57781
  function evaluateProviderQuotaGate(node, providerType, policy, now = Date.now(), context) {
57771
57782
  const entry = quotaEntryFor(node, providerType, context);
57772
57783
  if (!entry) return null;
57773
57784
  const { facts, quota } = entry;
57785
+ let sessionTrustworthy = true;
57786
+ let weeklyTrustworthy = true;
57774
57787
  if (quota.status !== "ok") {
57775
57788
  if (quota.status === "error" && quota.metadata?.failureKind === "quota-exhausted" && isQuotaSnapshotFresh(facts, quota, policy, now)) {
57776
57789
  return {
@@ -57780,15 +57793,15 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
57780
57793
  thresholdPercent: 0
57781
57794
  };
57782
57795
  }
57783
- if (quota.metadata?.lastGoodWindows !== true || !isQuotaSnapshotFresh(facts, quota, policy, now)) {
57784
- return null;
57785
- }
57796
+ if (quota.metadata?.lastGoodWindows !== true) return null;
57797
+ sessionTrustworthy = isRetainedWindowTrustworthy(quota.session, facts, quota, policy, now);
57798
+ weeklyTrustworthy = isRetainedWindowTrustworthy(quota.weekly, facts, quota, policy, now);
57786
57799
  } else if (!isQuotaSnapshotFresh(facts, quota, policy, now)) {
57787
57800
  return null;
57788
57801
  }
57789
57802
  const resolved = resolveQuotaRoutingPolicy(policy);
57790
57803
  const session = remainingPercent(quota.session);
57791
- if (session !== void 0 && session < resolved.sessionMinRemainingPercent && !isSessionResetImminent(quota.session, facts, quota, resolved.sessionResetImminentMs, now)) {
57804
+ if (sessionTrustworthy && session !== void 0 && session < resolved.sessionMinRemainingPercent && !isSessionResetImminent(quota.session, facts, quota, resolved.sessionResetImminentMs, now)) {
57792
57805
  return {
57793
57806
  reason: PROVIDER_QUOTA_SESSION_LOW_SKIP_REASON,
57794
57807
  window: "session",
@@ -57797,7 +57810,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
57797
57810
  };
57798
57811
  }
57799
57812
  const weekly = remainingPercent(quota.weekly);
57800
- if (weekly !== void 0 && weekly < resolved.weeklyMinRemainingPercent) {
57813
+ if (weeklyTrustworthy && weekly !== void 0 && weekly < resolved.weeklyMinRemainingPercent) {
57801
57814
  return {
57802
57815
  reason: PROVIDER_QUOTA_WEEKLY_LOW_SKIP_REASON,
57803
57816
  window: "weekly",