@adhdev/daemon-standalone 1.0.56-rc.14 → 1.0.56-rc.16

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
@@ -36620,10 +36620,10 @@ var require_dist3 = __commonJS({
36620
36620
  }
36621
36621
  function getDaemonBuildInfo() {
36622
36622
  if (cached2) return cached2;
36623
- const commit = readInjected(true ? "c3be352610b5c15a99497e20665e383360c4a84e" : void 0) ?? "unknown";
36624
- const commitShort = readInjected(true ? "c3be3526" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36625
- const version2 = readInjected(true ? "1.0.56-rc.14" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36626
- const builtAt = readInjected(true ? "2026-08-20T06:12:08.076Z" : void 0);
36623
+ const commit = readInjected(true ? "c852fab0cc75bb87987f691208882a171351755d" : void 0) ?? "unknown";
36624
+ const commitShort = readInjected(true ? "c852fab0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36625
+ const version2 = readInjected(true ? "1.0.56-rc.16" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36626
+ const builtAt = readInjected(true ? "2026-08-20T09:06:05.030Z" : void 0);
36627
36627
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36628
36628
  return cached2;
36629
36629
  }
@@ -38245,6 +38245,9 @@ var require_dist3 = __commonJS({
38245
38245
  interceptorInstalled = false;
38246
38246
  }
38247
38247
  });
38248
+ function defaultRetryDelayMs(kind) {
38249
+ return kind === "rate-limited" ? QUOTA_RATE_LIMIT_RETRY_DELAY_MS : QUOTA_TRANSIENT_RETRY_DELAY_MS;
38250
+ }
38248
38251
  function clampPercent(value) {
38249
38252
  if (Number.isNaN(value)) {
38250
38253
  return 0;
@@ -38268,7 +38271,7 @@ var require_dist3 = __commonJS({
38268
38271
  }
38269
38272
  function quotaFailure(provider, status, error48, metadata) {
38270
38273
  const now = Date.now();
38271
- const resolvedMetadata = metadata && metadata.failureKind && TRANSIENT_QUOTA_FAILURE_KINDS.has(metadata.failureKind) && metadata.retryAtMs === void 0 ? { ...metadata, retryAtMs: now + QUOTA_TRANSIENT_RETRY_DELAY_MS } : metadata;
38274
+ const resolvedMetadata = metadata && metadata.failureKind && TRANSIENT_QUOTA_FAILURE_KINDS.has(metadata.failureKind) && metadata.retryAtMs === void 0 ? { ...metadata, retryAtMs: now + defaultRetryDelayMs(metadata.failureKind) } : metadata;
38272
38275
  return {
38273
38276
  provider,
38274
38277
  session: null,
@@ -38281,6 +38284,7 @@ var require_dist3 = __commonJS({
38281
38284
  }
38282
38285
  var TRANSIENT_QUOTA_FAILURE_KINDS;
38283
38286
  var QUOTA_TRANSIENT_RETRY_DELAY_MS;
38287
+ var QUOTA_RATE_LIMIT_RETRY_DELAY_MS;
38284
38288
  var SESSION_WINDOW_MINUTES;
38285
38289
  var WEEKLY_WINDOW_MINUTES;
38286
38290
  var init_types = __esm2({
@@ -38294,6 +38298,7 @@ var require_dist3 = __commonJS({
38294
38298
  "rate-limited"
38295
38299
  ]);
38296
38300
  QUOTA_TRANSIENT_RETRY_DELAY_MS = 2 * 60 * 1e3;
38301
+ QUOTA_RATE_LIMIT_RETRY_DELAY_MS = 7 * 60 * 1e3;
38297
38302
  SESSION_WINDOW_MINUTES = 300;
38298
38303
  WEEKLY_WINDOW_MINUTES = 10080;
38299
38304
  }
@@ -38617,6 +38622,11 @@ var require_dist3 = __commonJS({
38617
38622
  init_config();
38618
38623
  }
38619
38624
  });
38625
+ function antigravityUserAgent() {
38626
+ const os31 = process.platform === "win32" ? "windows" : process.platform;
38627
+ const arch2 = process.arch === "x64" ? "amd64" : process.arch;
38628
+ return `antigravity/${ANTIGRAVITY_USER_AGENT_VERSION} ${os31}/${arch2}`;
38629
+ }
38620
38630
  function baseUrl(env2) {
38621
38631
  const override = env2.ANTIGRAVITY_CLOUDCODE_BASE_URL?.trim();
38622
38632
  return (override ? override : DEFAULT_BASE_URL).replace(/\/+$/, "");
@@ -38970,7 +38980,8 @@ var require_dist3 = __commonJS({
38970
38980
  headers: {
38971
38981
  Authorization: `Bearer ${credentials.accessToken}`,
38972
38982
  "Content-Type": "application/json",
38973
- Accept: "application/json"
38983
+ Accept: "application/json",
38984
+ "User-Agent": antigravityUserAgent()
38974
38985
  },
38975
38986
  // ★MUST stay `{}` — verified live that sending `project` or
38976
38987
  // `metadata` makes the server answer 429/400.
@@ -39010,6 +39021,7 @@ var require_dist3 = __commonJS({
39010
39021
  }
39011
39022
  }
39012
39023
  var DEFAULT_BASE_URL;
39024
+ var ANTIGRAVITY_USER_AGENT_VERSION;
39013
39025
  var REQUEST_TIMEOUT_MS;
39014
39026
  var EXPIRY_SKEW_MS;
39015
39027
  var CRED_STORE_TIMEOUT_MS;
@@ -39023,7 +39035,8 @@ var require_dist3 = __commonJS({
39023
39035
  "use strict";
39024
39036
  init_types();
39025
39037
  init_deps();
39026
- DEFAULT_BASE_URL = "https://cloudcode-pa.googleapis.com/v1internal";
39038
+ DEFAULT_BASE_URL = "https://daily-cloudcode-pa.googleapis.com/v1internal";
39039
+ ANTIGRAVITY_USER_AGENT_VERSION = "1.1.16";
39027
39040
  REQUEST_TIMEOUT_MS = 1e4;
39028
39041
  EXPIRY_SKEW_MS = 5e3;
39029
39042
  CRED_STORE_TIMEOUT_MS = 5e3;
@@ -40709,8 +40722,16 @@ child.on('exit', () => process.exit(0));
40709
40722
  if (count > 0) LOG2.info("Quota", `Restored ${count} provider quota snapshot(s) from the on-disk cache`);
40710
40723
  return count;
40711
40724
  }
40725
+ function isRateLimitedSnapshot(entry) {
40726
+ return !!entry && entry.status !== "ok" && entry.metadata?.failureKind === "rate-limited";
40727
+ }
40728
+ function isRateLimitedCooldownActive(entry, now = Date.now()) {
40729
+ if (!isRateLimitedSnapshot(entry)) return false;
40730
+ const retryAtMs = entry.metadata?.retryAtMs;
40731
+ return typeof retryAtMs === "number" && retryAtMs > now;
40732
+ }
40712
40733
  async function refreshQuotaCacheOnce(fetchers = REFRESHERS, isEnabled) {
40713
- const active = isEnabled ? fetchers.filter(({ provider }) => isEnabled(provider)) : fetchers;
40734
+ const enabled = isEnabled ? fetchers.filter(({ provider }) => isEnabled(provider)) : fetchers;
40714
40735
  if (isEnabled) {
40715
40736
  for (const { provider } of fetchers) {
40716
40737
  if (!isEnabled(provider)) {
@@ -40720,6 +40741,7 @@ child.on('exit', () => process.exit(0));
40720
40741
  }
40721
40742
  }
40722
40743
  }
40744
+ const active = enabled.filter(({ provider }) => !isRateLimitedCooldownActive(cache.get(provider)));
40723
40745
  await Promise.all(
40724
40746
  active.map(async ({ provider, fetch: fetch2 }) => {
40725
40747
  try {
@@ -40840,7 +40862,8 @@ child.on('exit', () => process.exit(0));
40840
40862
  function refreshQuotaCacheOnBoot(isEnabled) {
40841
40863
  if (bootRefreshInFlight || hasFreshlyMeasuredQuota()) return;
40842
40864
  bootRefreshInFlight = true;
40843
- void refreshQuotaCacheOnce(REFRESHERS, isEnabled).catch((e) => LOG2.warn("Quota", `Boot quota refresh failed: ${e?.message || e}`)).finally(() => {
40865
+ const fetchers = REFRESHERS.filter(({ provider }) => !isRateLimitedSnapshot(cache.get(provider)));
40866
+ void refreshQuotaCacheOnce(fetchers, isEnabled).catch((e) => LOG2.warn("Quota", `Boot quota refresh failed: ${e?.message || e}`)).finally(() => {
40844
40867
  bootRefreshInFlight = false;
40845
40868
  });
40846
40869
  }
@@ -40856,6 +40879,7 @@ child.on('exit', () => process.exit(0));
40856
40879
  const refresher = typeof event.providerType === "string" ? REFRESHERS.find(({ provider }) => provider === event.providerType) : void 0;
40857
40880
  if (!refresher) return;
40858
40881
  if (isEnabled && !isEnabled(refresher.provider)) return;
40882
+ if (isRateLimitedSnapshot(cache.get(refresher.provider))) return;
40859
40883
  const at = now();
40860
40884
  if (at - (lastRefreshAt.get(refresher.provider) ?? -Infinity) < debounceMs) return;
40861
40885
  lastRefreshAt.set(refresher.provider, at);