claude-use 11.67.4 → 11.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.
package/dist/cli.cjs CHANGED
@@ -37387,7 +37387,7 @@ var init_package = __esm({
37387
37387
  "package.json"() {
37388
37388
  package_default = {
37389
37389
  name: "claude-use",
37390
- version: "11.67.4",
37390
+ version: "11.68.0",
37391
37391
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
37392
37392
  license: "MIT",
37393
37393
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -44849,7 +44849,7 @@ var require_util3 = __commonJS({
44849
44849
  "node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/web/fetch/util.js"(exports2, module2) {
44850
44850
  "use strict";
44851
44851
  var { Transform } = require("node:stream");
44852
- var zlib2 = require("node:zlib");
44852
+ var zlib3 = require("node:zlib");
44853
44853
  var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants4();
44854
44854
  var { getGlobalOrigin } = require_global();
44855
44855
  var { collectAnHTTPQuotedString, parseMIMEType } = require_data_url();
@@ -45452,7 +45452,7 @@ var require_util3 = __commonJS({
45452
45452
  callback();
45453
45453
  return;
45454
45454
  }
45455
- this._inflateStream = (chunk2[0] & 15) === 8 ? zlib2.createInflate(this.#zlibOptions) : zlib2.createInflateRaw(this.#zlibOptions);
45455
+ this._inflateStream = (chunk2[0] & 15) === 8 ? zlib3.createInflate(this.#zlibOptions) : zlib3.createInflateRaw(this.#zlibOptions);
45456
45456
  this._inflateStream.on("data", this.push.bind(this));
45457
45457
  this._inflateStream.on("end", () => this.push(null));
45458
45458
  this._inflateStream.on("error", (err) => this.destroy(err));
@@ -60658,7 +60658,7 @@ var require_fetch = __commonJS({
60658
60658
  } = require_response();
60659
60659
  var { HeadersList } = require_headers();
60660
60660
  var { Request: Request2, cloneRequest, getRequestDispatcher, getRequestState } = require_request2();
60661
- var zlib2 = require("node:zlib");
60661
+ var zlib3 = require("node:zlib");
60662
60662
  var {
60663
60663
  makePolicyContainer,
60664
60664
  clonePolicyContainer,
@@ -61659,28 +61659,28 @@ var require_fetch = __commonJS({
61659
61659
  for (let i10 = codings.length - 1; i10 >= 0; --i10) {
61660
61660
  const coding = codings[i10].trim();
61661
61661
  if (coding === "x-gzip" || coding === "gzip") {
61662
- decoders.push(zlib2.createGunzip({
61662
+ decoders.push(zlib3.createGunzip({
61663
61663
  // Be less strict when decoding compressed responses, since sometimes
61664
61664
  // servers send slightly invalid responses that are still accepted
61665
61665
  // by common browsers.
61666
61666
  // Always using Z_SYNC_FLUSH is what cURL does.
61667
- flush: zlib2.constants.Z_SYNC_FLUSH,
61668
- finishFlush: zlib2.constants.Z_SYNC_FLUSH
61667
+ flush: zlib3.constants.Z_SYNC_FLUSH,
61668
+ finishFlush: zlib3.constants.Z_SYNC_FLUSH
61669
61669
  }));
61670
61670
  } else if (coding === "deflate") {
61671
61671
  decoders.push(createInflate2({
61672
- flush: zlib2.constants.Z_SYNC_FLUSH,
61673
- finishFlush: zlib2.constants.Z_SYNC_FLUSH
61672
+ flush: zlib3.constants.Z_SYNC_FLUSH,
61673
+ finishFlush: zlib3.constants.Z_SYNC_FLUSH
61674
61674
  }));
61675
61675
  } else if (coding === "br") {
61676
- decoders.push(zlib2.createBrotliDecompress({
61677
- flush: zlib2.constants.BROTLI_OPERATION_FLUSH,
61678
- finishFlush: zlib2.constants.BROTLI_OPERATION_FLUSH
61676
+ decoders.push(zlib3.createBrotliDecompress({
61677
+ flush: zlib3.constants.BROTLI_OPERATION_FLUSH,
61678
+ finishFlush: zlib3.constants.BROTLI_OPERATION_FLUSH
61679
61679
  }));
61680
61680
  } else if (coding === "zstd" && hasZstd) {
61681
- decoders.push(zlib2.createZstdDecompress({
61682
- flush: zlib2.constants.ZSTD_e_continue,
61683
- finishFlush: zlib2.constants.ZSTD_e_end
61681
+ decoders.push(zlib3.createZstdDecompress({
61682
+ flush: zlib3.constants.ZSTD_e_continue,
61683
+ finishFlush: zlib3.constants.ZSTD_e_end
61684
61684
  }));
61685
61685
  } else {
61686
61686
  decoders.length = 0;
@@ -67945,6 +67945,99 @@ var init_engine = __esm({
67945
67945
  }
67946
67946
  });
67947
67947
 
67948
+ // src/usage/unifiedRefusal.ts
67949
+ function exhaustionHeaders(params) {
67950
+ return {
67951
+ [`${UNIFIED_PREFIX2}representative-claim`]: params.window,
67952
+ [`${UNIFIED_PREFIX2}reset`]: String(params.resetSec),
67953
+ "retry-after": String(Math.max(1, params.resetSec - params.nowSec)),
67954
+ "x-should-retry": "false"
67955
+ };
67956
+ }
67957
+ function decodedText(body, encoding) {
67958
+ try {
67959
+ switch (encoding?.trim().toLowerCase()) {
67960
+ case void 0:
67961
+ case "":
67962
+ case "identity":
67963
+ return new TextDecoder().decode(body);
67964
+ case "gzip":
67965
+ case "x-gzip":
67966
+ return new TextDecoder().decode(zlib2.gunzipSync(body));
67967
+ case "deflate":
67968
+ return new TextDecoder().decode(zlib2.inflateSync(body));
67969
+ case "br":
67970
+ return new TextDecoder().decode(zlib2.brotliDecompressSync(body));
67971
+ default:
67972
+ return void 0;
67973
+ }
67974
+ } catch {
67975
+ return void 0;
67976
+ }
67977
+ }
67978
+ function windowOfMessage(message) {
67979
+ if (/\b(?:5|five)[\s-]?hours?\b/i.test(message)) {
67980
+ return "five_hour";
67981
+ }
67982
+ if (/\bweek(?:ly)?\b|\b(?:7|seven)[\s-]?days?\b/i.test(message)) {
67983
+ return "seven_day";
67984
+ }
67985
+ return void 0;
67986
+ }
67987
+ function resetOfMessage(message) {
67988
+ const found = /reset at (\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2}:\d{2})/i.exec(message);
67989
+ if (found === null) {
67990
+ return void 0;
67991
+ }
67992
+ const instant = Date.parse(`${found[1] ?? ""}T${found[2] ?? ""}${MESSAGE_CLOCK_OFFSET}`);
67993
+ return Number.isNaN(instant) ? void 0 : Math.floor(instant / MS_PER_SECOND8);
67994
+ }
67995
+ function quotaRefusalHeaders(params) {
67996
+ const { status, headers, body, nowMs } = params;
67997
+ if (status !== TOO_MANY_REQUESTS2 || Object.keys(headers).some((name) => name.startsWith(UNIFIED_PREFIX2))) {
67998
+ return void 0;
67999
+ }
68000
+ const text5 = decodedText(body, headers["content-encoding"]);
68001
+ if (text5 === void 0) {
68002
+ return void 0;
68003
+ }
68004
+ const scanner = createJsonScanner();
68005
+ scanner.push(text5);
68006
+ const { error: error63 } = scanner.result();
68007
+ const limit = classifyLimit({ status, headers: rateLimitHeadersOf(headers) ?? {}, error: error63, nowMs });
68008
+ const window = error63?.message === void 0 ? void 0 : windowOfMessage(error63.message);
68009
+ if (limit?.kind !== "quota-exhausted" || error63?.message === void 0 || window === void 0) {
68010
+ return void 0;
68011
+ }
68012
+ const nowSec = Math.floor(nowMs / MS_PER_SECOND8);
68013
+ const resetSec = limit.retryAfterSeconds === void 0 ? resetOfMessage(error63.message) : nowSec + Math.ceil(limit.retryAfterSeconds);
68014
+ if (resetSec === void 0) {
68015
+ return void 0;
68016
+ }
68017
+ const infix = WINDOW_INFIX[window];
68018
+ return {
68019
+ [`${UNIFIED_PREFIX2}status`]: "rejected",
68020
+ [`${UNIFIED_PREFIX2}${infix}-status`]: "rejected",
68021
+ [`${UNIFIED_PREFIX2}${infix}-utilization`]: "1",
68022
+ [`${UNIFIED_PREFIX2}${infix}-reset`]: String(resetSec),
68023
+ ...exhaustionHeaders({ window, resetSec, nowSec })
68024
+ };
68025
+ }
68026
+ var zlib2, MS_PER_SECOND8, UNIFIED_PREFIX2, TOO_MANY_REQUESTS2, WINDOW_INFIX, MESSAGE_CLOCK_OFFSET;
68027
+ var init_unifiedRefusal = __esm({
68028
+ "src/usage/unifiedRefusal.ts"() {
68029
+ "use strict";
68030
+ zlib2 = __toESM(require("node:zlib"), 1);
68031
+ init_rateLimit();
68032
+ init_scan();
68033
+ MS_PER_SECOND8 = 1e3;
68034
+ UNIFIED_PREFIX2 = "anthropic-ratelimit-unified-";
68035
+ TOO_MANY_REQUESTS2 = 429;
68036
+ WINDOW_INFIX = { five_hour: "5h", seven_day: "7d" };
68037
+ MESSAGE_CLOCK_OFFSET = "+08:00";
68038
+ }
68039
+ });
68040
+
67948
68041
  // src/antigravity/cloudUpstream.ts
67949
68042
  function isCcpaEndpoint(endpoint) {
67950
68043
  return endpoint.includes("cloudcode-pa.googleapis.com");
@@ -68129,14 +68222,14 @@ function parseRetryAfterSeconds(raw, defaultSeconds = DEFAULT_RETRY_AFTER_SECOND
68129
68222
  }
68130
68223
  const parsedDate = Date.parse(raw);
68131
68224
  if (!Number.isNaN(parsedDate)) {
68132
- const diffSec = Math.ceil((parsedDate - Date.now()) / MS_PER_SECOND8);
68225
+ const diffSec = Math.ceil((parsedDate - Date.now()) / MS_PER_SECOND9);
68133
68226
  return Math.max(1, diffSec);
68134
68227
  }
68135
68228
  return defaultSeconds;
68136
68229
  }
68137
68230
  function unifiedAntigravityQuotaHeaders(params) {
68138
68231
  const rejected = params.rejected === true;
68139
- const nowSec = Math.floor(params.nowMs / MS_PER_SECOND8);
68232
+ const nowSec = Math.floor(params.nowMs / MS_PER_SECOND9);
68140
68233
  const { fiveHour: b5h, weekly: bWk } = selectAntigravityBuckets(params.quota ?? {}, params.model);
68141
68234
  const used5h = calculateUtilization(b5h?.remaining_fraction);
68142
68235
  const reset5h = calculateResetTimestamp(nowSec, b5h?.reset_in_seconds);
@@ -68171,11 +68264,7 @@ function unifiedAntigravityQuotaHeaders(params) {
68171
68264
  }
68172
68265
  }
68173
68266
  if (exhaustion !== void 0) {
68174
- headers["anthropic-ratelimit-unified-representative-claim"] = exhaustion.window;
68175
- headers["anthropic-ratelimit-unified-reset"] = String(exhaustion.resetSec);
68176
- headers["retry-after"] = String(Math.max(1, exhaustion.resetSec - nowSec));
68177
- headers["x-should-retry"] = "false";
68178
- return headers;
68267
+ return { ...headers, ...exhaustionHeaders({ window: exhaustion.window, resetSec: exhaustion.resetSec, nowSec }) };
68179
68268
  }
68180
68269
  if (earliestResetSec !== void 0) {
68181
68270
  headers["anthropic-ratelimit-unified-reset"] = String(earliestResetSec);
@@ -68184,7 +68273,7 @@ function unifiedAntigravityQuotaHeaders(params) {
68184
68273
  }
68185
68274
  function antigravityQuotaExhaustion(quota, model, nowMs) {
68186
68275
  const { fiveHour, weekly } = selectAntigravityBuckets(quota ?? {}, model);
68187
- const nowSec = Math.floor(nowMs / MS_PER_SECOND8);
68276
+ const nowSec = Math.floor(nowMs / MS_PER_SECOND9);
68188
68277
  const spent = [];
68189
68278
  for (const [window, bucket] of [["five_hour", fiveHour], ["seven_day", weekly]]) {
68190
68279
  const remaining = bucket?.remaining_fraction;
@@ -68205,7 +68294,7 @@ function bucketToEntry(bucket, nowMs) {
68205
68294
  }
68206
68295
  const remainingFraction = typeof bucket.remainingFraction === "number" && Number.isFinite(bucket.remainingFraction) ? bucket.remainingFraction : void 0;
68207
68296
  const resetMs = typeof bucket.resetTime === "string" ? Date.parse(bucket.resetTime) : Number.NaN;
68208
- const resetInSeconds = Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.ceil((resetMs - nowMs) / MS_PER_SECOND8));
68297
+ const resetInSeconds = Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.ceil((resetMs - nowMs) / MS_PER_SECOND9));
68209
68298
  if (remainingFraction === void 0 && resetInSeconds === void 0) {
68210
68299
  return void 0;
68211
68300
  }
@@ -68285,17 +68374,18 @@ function createCachedAntigravityQuotaSource(params) {
68285
68374
  };
68286
68375
  }
68287
68376
  function ageQuotaMap(quota, elapsedMs) {
68288
- const elapsedSec = elapsedMs / MS_PER_SECOND8;
68377
+ const elapsedSec = elapsedMs / MS_PER_SECOND9;
68289
68378
  return Object.fromEntries(
68290
68379
  Object.entries(quota).map(([key, bucket]) => [key, bucket?.reset_in_seconds === void 0 ? bucket : { ...bucket, reset_in_seconds: Math.max(0, bucket.reset_in_seconds - elapsedSec) }])
68291
68380
  );
68292
68381
  }
68293
- var MS_PER_SECOND8, DEFAULT_RETRY_AFTER_SECONDS, FRACTION_DIGITS, GEMINI_5H_KEYS, GEMINI_WEEKLY_KEYS, ARGON_WEEKLY_KEYS, THIRD_PARTY_5H_KEYS, THIRD_PARTY_WEEKLY_KEYS, QUOTA_FAMILY_WINDOWS, SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY3, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS, ANTIGRAVITY_QUOTA_REFRESH_MS;
68382
+ var MS_PER_SECOND9, DEFAULT_RETRY_AFTER_SECONDS, FRACTION_DIGITS, GEMINI_5H_KEYS, GEMINI_WEEKLY_KEYS, ARGON_WEEKLY_KEYS, THIRD_PARTY_5H_KEYS, THIRD_PARTY_WEEKLY_KEYS, QUOTA_FAMILY_WINDOWS, SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY3, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS, ANTIGRAVITY_QUOTA_REFRESH_MS;
68294
68383
  var init_quota = __esm({
68295
68384
  "src/antigravity/quota.ts"() {
68296
68385
  "use strict";
68386
+ init_unifiedRefusal();
68297
68387
  init_cloudUpstream();
68298
- MS_PER_SECOND8 = 1e3;
68388
+ MS_PER_SECOND9 = 1e3;
68299
68389
  DEFAULT_RETRY_AFTER_SECONDS = 60;
68300
68390
  FRACTION_DIGITS = 3;
68301
68391
  GEMINI_5H_KEYS = ["gemini-5h", "gemini_5h", "gemini"];
@@ -68985,7 +69075,7 @@ async function fetchCatalogue(params) {
68985
69075
  }
68986
69076
  throw new CatalogueFetchError(`no catalogue from ${outcomes.join("; ")}`);
68987
69077
  }
68988
- var import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
69078
+ var import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND10, SECONDS_PER_HOUR3, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
68989
69079
  var init_providerCatalogue = __esm({
68990
69080
  "src/providerCatalogue.ts"() {
68991
69081
  "use strict";
@@ -68993,17 +69083,17 @@ var init_providerCatalogue = __esm({
68993
69083
  init_zod();
68994
69084
  init_names();
68995
69085
  DEFAULT_CANDIDATE_URLS = 2;
68996
- MS_PER_SECOND9 = 1e3;
69086
+ MS_PER_SECOND10 = 1e3;
68997
69087
  SECONDS_PER_HOUR3 = 3600;
68998
69088
  HOURS_PER_DAY4 = 24;
68999
- MS_PER_HOUR3 = SECONDS_PER_HOUR3 * MS_PER_SECOND9;
69089
+ MS_PER_HOUR3 = SECONDS_PER_HOUR3 * MS_PER_SECOND10;
69000
69090
  HOURS_BETWEEN_RETRIES = 1;
69001
69091
  HTTP_OK = 200;
69002
69092
  HTTP_MULTIPLE_CHOICES = 300;
69003
69093
  CATALOGUE_MAX_AGE_MS = HOURS_PER_DAY4 * MS_PER_HOUR3;
69004
69094
  CATALOGUE_RETRY_MS = HOURS_BETWEEN_RETRIES * MS_PER_HOUR3;
69005
69095
  CATALOGUE_REQUEST_SECONDS = 10;
69006
- CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND9;
69096
+ CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND10;
69007
69097
  CATALOGUE_REFRESH_TIMEOUT_MS = DEFAULT_CANDIDATE_URLS * CATALOGUE_REQUEST_TIMEOUT_MS;
69008
69098
  CatalogueModelSchema = external_exports.strictObject({ id: external_exports.string().min(1), name: external_exports.string().min(1).optional() });
69009
69099
  CatalogueCacheSchema = external_exports.strictObject({ fetchedAt: external_exports.number(), url: external_exports.string().min(1), models: external_exports.array(CatalogueModelSchema) });
@@ -70293,7 +70383,7 @@ function quotaFreshnessMs(quota) {
70293
70383
  const lengths = quota.windows.flatMap((window) => window.periodMs === void 0 ? [] : [window.periodMs]);
70294
70384
  return lengths.length === 0 ? Number.POSITIVE_INFINITY : Math.min(...lengths) / PERCENT3;
70295
70385
  }
70296
- var ProviderQuotaError, MS_PER_SECOND10, SECONDS_PER_HOUR4, HOURS_PER_DAY5, DAYS_PER_MONTH, PERCENT3, HTTP_OK2, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
70386
+ var ProviderQuotaError, MS_PER_SECOND11, SECONDS_PER_HOUR4, HOURS_PER_DAY5, DAYS_PER_MONTH, PERCENT3, HTTP_OK2, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
70297
70387
  var init_providerQuota = __esm({
70298
70388
  "src/usage/providerQuota.ts"() {
70299
70389
  "use strict";
@@ -70306,7 +70396,7 @@ var init_providerQuota = __esm({
70306
70396
  this.name = "ProviderQuotaError";
70307
70397
  }
70308
70398
  };
70309
- MS_PER_SECOND10 = 1e3;
70399
+ MS_PER_SECOND11 = 1e3;
70310
70400
  SECONDS_PER_HOUR4 = 3600;
70311
70401
  HOURS_PER_DAY5 = 24;
70312
70402
  DAYS_PER_MONTH = 30;
@@ -70318,8 +70408,8 @@ var init_providerQuota = __esm({
70318
70408
  ZAI_UNIT_HOURS = 3;
70319
70409
  ZAI_UNIT_MONTHS = 5;
70320
70410
  ZAI_UNIT_MS = /* @__PURE__ */ new Map([
70321
- [ZAI_UNIT_HOURS, SECONDS_PER_HOUR4 * MS_PER_SECOND10],
70322
- [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND10]
70411
+ [ZAI_UNIT_HOURS, SECONDS_PER_HOUR4 * MS_PER_SECOND11],
70412
+ [ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND11]
70323
70413
  ]);
70324
70414
  ZAI_MEASURES = { TOKENS_LIMIT: "tokens", TIME_LIMIT: "tool-calls" };
70325
70415
  ZaiLimitSchema = external_exports.object({
@@ -70371,7 +70461,7 @@ var init_providerQuota = __esm({
70371
70461
  OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
70372
70462
  OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
70373
70463
  HTTP_FORBIDDEN = 403;
70374
- MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND10;
70464
+ MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND11;
70375
70465
  OpenRouterKeySchema = external_exports.object({
70376
70466
  data: external_exports.object({
70377
70467
  limit: external_exports.number().nonnegative().nullable(),
@@ -70419,8 +70509,8 @@ var init_providerQuota = __esm({
70419
70509
  GOOGLE_TOKENINFO_URL = "https://oauth2.googleapis.com/tokeninfo";
70420
70510
  FIVE_HOURS2 = 5;
70421
70511
  DAYS_PER_WEEK2 = 7;
70422
- FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR4 * MS_PER_SECOND10;
70423
- WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND10;
70512
+ FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR4 * MS_PER_SECOND11;
70513
+ WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR4 * MS_PER_SECOND11;
70424
70514
  AntigravityBucketSchema = external_exports.object({
70425
70515
  bucketId: external_exports.string(),
70426
70516
  remainingFraction: external_exports.number().optional(),
@@ -134592,9 +134682,9 @@ function unifiedQuotaHeaders(upstream, rejected, quotaError) {
134592
134682
  }
134593
134683
  return headers;
134594
134684
  }
134595
- var MS_PER_SECOND11 = 1e3;
134685
+ var MS_PER_SECOND12 = 1e3;
134596
134686
  function snapshotWindow(reading) {
134597
- return reading === void 0 ? void 0 : { used_percentage: reading.usedPercent, resets_at: new Date(Number(reading.resetAt) * MS_PER_SECOND11).toISOString() };
134687
+ return reading === void 0 ? void 0 : { used_percentage: reading.usedPercent, resets_at: new Date(Number(reading.resetAt) * MS_PER_SECOND12).toISOString() };
134598
134688
  }
134599
134689
  function buildUsageSnapshot(upstream, quotaError, nowMs) {
134600
134690
  const { fiveHour, sevenDay } = windowReadings(upstream, quotaError !== void 0, quotaError);
@@ -135387,11 +135477,11 @@ async function* callLocalAntigravity(params) {
135387
135477
 
135388
135478
  // src/antigravity/route.ts
135389
135479
  init_quota();
135390
- var MS_PER_SECOND12 = 1e3;
135480
+ var MS_PER_SECOND13 = 1e3;
135391
135481
  var ROUTING_MEMORY_SESSIONS = 256;
135392
135482
  function exhaustedMessage(exhaustion) {
135393
135483
  const window = exhaustion.window === "five_hour" ? "5-hour" : "weekly";
135394
- return `Antigravity ${window} limit reached; it resets at ${new Date(exhaustion.resetSec * MS_PER_SECOND12).toISOString()}.`;
135484
+ return `Antigravity ${window} limit reached; it resets at ${new Date(exhaustion.resetSec * MS_PER_SECOND13).toISOString()}.`;
135395
135485
  }
135396
135486
  function createAntigravityRoute(ports) {
135397
135487
  const fallbackId = ports.fallbackId ?? (() => (0, import_node_crypto23.randomUUID)());
@@ -135652,6 +135742,9 @@ init_connect();
135652
135742
  var http5 = __toESM(require("node:http"), 1);
135653
135743
  var https4 = __toESM(require("node:https"), 1);
135654
135744
  init_connect();
135745
+ init_unifiedRefusal();
135746
+ var TOO_MANY_REQUESTS3 = 429;
135747
+ var REFUSAL_BODY_LIMIT_BYTES = 16384;
135655
135748
  function responseHeaders2(headers) {
135656
135749
  const result = {};
135657
135750
  for (const [name, value2] of Object.entries(forwardableHeaders(headers))) {
@@ -135686,19 +135779,48 @@ function createPassthroughRoute(name, target) {
135686
135779
  agent
135687
135780
  };
135688
135781
  const onUpstreamResponse = (upstreamResponse) => {
135689
- response.start(upstreamResponse.statusCode ?? HTTP_STATUS.badGateway, responseHeaders2(upstreamResponse.headers));
135690
- response.flush();
135782
+ const status = upstreamResponse.statusCode ?? HTTP_STATUS.badGateway;
135783
+ const head = responseHeaders2(upstreamResponse.headers);
135784
+ const chunks = upstreamChunks(upstreamResponse);
135691
135785
  const stream = async () => {
135692
135786
  try {
135693
- for await (const chunk2 of upstreamChunks(upstreamResponse)) {
135694
- if (request7.signal.aborted) {
135695
- return;
135787
+ const held = [];
135788
+ let finished = false;
135789
+ if (status === TOO_MANY_REQUESTS3) {
135790
+ let heldBytes = 0;
135791
+ while (heldBytes <= REFUSAL_BODY_LIMIT_BYTES) {
135792
+ const next = await chunks.next();
135793
+ if (next.done === true) {
135794
+ finished = true;
135795
+ break;
135796
+ }
135797
+ held.push(next.value);
135798
+ heldBytes += next.value.length;
135696
135799
  }
135800
+ }
135801
+ const translated = finished ? quotaRefusalHeaders({ status, headers: head, body: Buffer.concat(held), nowMs: Date.now() }) : void 0;
135802
+ response.start(status, { ...head, ...translated });
135803
+ response.flush();
135804
+ for (const chunk2 of held) {
135697
135805
  await response.write(chunk2);
135698
135806
  }
135807
+ if (!finished) {
135808
+ for await (const chunk2 of chunks) {
135809
+ if (request7.signal.aborted) {
135810
+ return;
135811
+ }
135812
+ await response.write(chunk2);
135813
+ }
135814
+ }
135699
135815
  response.end();
135700
135816
  } catch {
135701
- response.destroy();
135817
+ if (response.headersSent) {
135818
+ response.destroy();
135819
+ } else {
135820
+ response.start(HTTP_STATUS.badGateway, { "Content-Type": "application/json" });
135821
+ await response.write(JSON.stringify({ type: "error", error: { type: "api_error", message: `upstream ${target.baseUrl} dropped the connection` } }));
135822
+ response.end();
135823
+ }
135702
135824
  }
135703
135825
  resolve3(void 0);
135704
135826
  };
@@ -136512,7 +136634,7 @@ init_account();
136512
136634
  var RC_SELF_HOST_OAUTH_HOST = "platform.claude.com";
136513
136635
  var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:claude_code", "user:mcp_servers", "user:file_upload"];
136514
136636
  var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
136515
- var MS_PER_SECOND13 = 1e3;
136637
+ var MS_PER_SECOND14 = 1e3;
136516
136638
  var HTTP_SERVICE_UNAVAILABLE = 503;
136517
136639
  function isRecord15(value2) {
136518
136640
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
@@ -136568,7 +136690,7 @@ function createRcSelfHostLocal(deps) {
136568
136690
  }
136569
136691
  if (method === "POST" && pathname.startsWith("/api/eval/")) {
136570
136692
  await deps.readBody(request7, CONTROL_BODY_CAP_BYTES);
136571
- answerServerJson(response, HTTP_STATUS.ok, { features: growthBookFeatures(), dateUpdated: Math.floor(deps.now() / MS_PER_SECOND13) });
136693
+ answerServerJson(response, HTTP_STATUS.ok, { features: growthBookFeatures(), dateUpdated: Math.floor(deps.now() / MS_PER_SECOND14) });
136572
136694
  return true;
136573
136695
  }
136574
136696
  if (method === "GET" && pathname === "/api/oauth/profile") {
@@ -136752,12 +136874,12 @@ function eventExcerpt(text5) {
136752
136874
  return text5.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text5 : `${text5.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
136753
136875
  }
136754
136876
  var PERCENT_SCALE = 100;
136755
- var MS_PER_SECOND14 = 1e3;
136877
+ var MS_PER_SECOND15 = 1e3;
136756
136878
  function percentOf(fraction) {
136757
136879
  return `${String(Math.round(fraction * PERCENT_SCALE))}%`;
136758
136880
  }
136759
136881
  function resetInstantOf(epochSeconds) {
136760
- return new Date(epochSeconds * MS_PER_SECOND14).toISOString();
136882
+ return new Date(epochSeconds * MS_PER_SECOND15).toISOString();
136761
136883
  }
136762
136884
  function formatRcRateLimitInfo(info) {
136763
136885
  const parts = [info.status];
@@ -138192,7 +138314,7 @@ var RC_COMPAT_SESSIONS_PATH = "/v1/sessions";
138192
138314
  var RC_SESSION_ID_PREFIX2 = "cse_";
138193
138315
  var RC_SELF_HOST_API_BASE_URL = "https://api.anthropic.com";
138194
138316
  var HTTP_CONFLICT = 409;
138195
- var MS_PER_SECOND15 = 1e3;
138317
+ var MS_PER_SECOND16 = 1e3;
138196
138318
  var HTTP_SERVICE_UNAVAILABLE2 = 503;
138197
138319
  var RC_SELF_HOST_WORKER_JWT_TTL_SECONDS = 46800;
138198
138320
  var RC_SELF_HOST_KEEPALIVE_MS = 15e3;
@@ -138292,7 +138414,7 @@ function parseJsonObject5(body) {
138292
138414
  function mintWorkerJwt(randomToken, issuedAt) {
138293
138415
  const encode3 = (value2) => Buffer.from(JSON.stringify(value2), "utf8").toString("base64url");
138294
138416
  const header = encode3({ alg: "HS256", typ: "JWT" });
138295
- const payload = encode3({ exp: Math.floor((issuedAt + RC_SELF_HOST_WORKER_JWT_TTL_SECONDS * MS_PER_SECOND15) / MS_PER_SECOND15), iat: Math.floor(issuedAt / MS_PER_SECOND15) });
138417
+ const payload = encode3({ exp: Math.floor((issuedAt + RC_SELF_HOST_WORKER_JWT_TTL_SECONDS * MS_PER_SECOND16) / MS_PER_SECOND16), iat: Math.floor(issuedAt / MS_PER_SECOND16) });
138296
138418
  return `${header}.${payload}.${Buffer.from(randomToken(), "utf8").toString("base64url")}`;
138297
138419
  }
138298
138420
  function createRcSelfHostSurface(deps) {
@@ -139540,7 +139662,7 @@ function createRealQuotaRefresher(params) {
139540
139662
  // src/frontdoor/commands.ts
139541
139663
  init_store2();
139542
139664
  var MACOS_SAMPLER = "/usr/bin/sample";
139543
- var MS_PER_SECOND16 = 1e3;
139665
+ var MS_PER_SECOND17 = 1e3;
139544
139666
  function readRespawnDelayMs() {
139545
139667
  const delay = Number(process.env[DOOR_RESPAWN_DELAY_ENV]);
139546
139668
  return Number.isInteger(delay) && delay > 0 ? delay : 0;
@@ -140053,7 +140175,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
140053
140175
  cooldownStepMs: DOOR_STALL_BOUND_MS,
140054
140176
  cooldownCapMs: DOOR_RESPAWN_COOLDOWN_CAP_MS,
140055
140177
  startLockFile: paths.frontdoorLockFile,
140056
- ...process.platform === "darwin" ? { nativeSample: { command: MACOS_SAMPLER, args: ["{pid}", "{seconds}", "-file", "{file}"], directory: import_node_path54.default.join(import_node_path54.default.dirname(paths.frontdoorLogPath), "stall-samples"), seconds: Math.max(1, Math.ceil(DOOR_WATCHDOG_CHECK_MS / MS_PER_SECOND16)), overheadMs: PROBE_TIMEOUT_MS, keep: DOOR_RESPAWN_MAX_GENERATIONS + 1 } } : {}
140178
+ ...process.platform === "darwin" ? { nativeSample: { command: MACOS_SAMPLER, args: ["{pid}", "{seconds}", "-file", "{file}"], directory: import_node_path54.default.join(import_node_path54.default.dirname(paths.frontdoorLogPath), "stall-samples"), seconds: Math.max(1, Math.ceil(DOOR_WATCHDOG_CHECK_MS / MS_PER_SECOND17)), overheadMs: PROBE_TIMEOUT_MS, keep: DOOR_RESPAWN_MAX_GENERATIONS + 1 } } : {}
140057
140179
  }),
140058
140180
  // The launch lifecycle publisher over the same backbone the typed API serves: the tick's registry facts go in here, and the door's own register, prune and end moments come out as source-tagged events.
140059
140181
  observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
@@ -140272,7 +140394,7 @@ var realHeadroomGet = async (target, requestPath, timeoutMs) => {
140272
140394
  // src/statusline/enrich.ts
140273
140395
  init_quota();
140274
140396
  var FULL_PERCENT2 = 100;
140275
- var MS_PER_SECOND17 = 1e3;
140397
+ var MS_PER_SECOND18 = 1e3;
140276
140398
  function identityOf(env) {
140277
140399
  const headers = env.ANTHROPIC_CUSTOM_HEADERS;
140278
140400
  if (headers !== void 0) {
@@ -140340,7 +140462,7 @@ function payloadWindow(rateLimits, key) {
140340
140462
  const resetsAt = window.resets_at;
140341
140463
  return {
140342
140464
  used: Math.min(FULL_PERCENT2, Math.max(0, window.used_percentage)),
140343
- resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? isoOf(resetsAt * MS_PER_SECOND17) : void 0
140465
+ resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? isoOf(resetsAt * MS_PER_SECOND18) : void 0
140344
140466
  };
140345
140467
  }
140346
140468
  function payloadWindowsOf(payload) {
@@ -140368,7 +140490,7 @@ function antigravityQuotaMapOf(payload) {
140368
140490
  function bucketView(bucket, nowMs) {
140369
140491
  return {
140370
140492
  used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT2,
140371
- resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : isoOf(nowMs + bucket.reset_in_seconds * MS_PER_SECOND17)
140493
+ resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : isoOf(nowMs + bucket.reset_in_seconds * MS_PER_SECOND18)
140372
140494
  };
140373
140495
  }
140374
140496
  function antigravityWindowsOf(payload, nowMs) {
@@ -140444,7 +140566,7 @@ function enrichStatuslinePayload(params) {
140444
140566
  window.measures,
140445
140567
  {
140446
140568
  remaining_fraction: 1 - window.utilization,
140447
- ...window.resetsAt === void 0 ? {} : { reset_in_seconds: (Date.parse(window.resetsAt) - params.nowMs) / MS_PER_SECOND17 }
140569
+ ...window.resetsAt === void 0 ? {} : { reset_in_seconds: (Date.parse(window.resetsAt) - params.nowMs) / MS_PER_SECOND18 }
140448
140570
  }
140449
140571
  ])
140450
140572
  );
@@ -141542,12 +141664,12 @@ function dailyCostSegment(context) {
141542
141664
  }
141543
141665
 
141544
141666
  // src/statusline/elements/sessionFormat.ts
141545
- var MS_PER_SECOND18 = 1e3;
141667
+ var MS_PER_SECOND19 = 1e3;
141546
141668
  var SECONDS_PER_MINUTE3 = 60;
141547
141669
  var MINUTES_PER_HOUR5 = 60;
141548
141670
  var HOURS_PER_DAY9 = 24;
141549
141671
  function formatElapsed(ms2) {
141550
- const minutes = Math.floor(ms2 / (MS_PER_SECOND18 * SECONDS_PER_MINUTE3));
141672
+ const minutes = Math.floor(ms2 / (MS_PER_SECOND19 * SECONDS_PER_MINUTE3));
141551
141673
  if (minutes < 1) {
141552
141674
  return "<1m";
141553
141675
  }
@@ -141557,10 +141679,10 @@ function formatElapsed(ms2) {
141557
141679
  return `${String(Math.floor(minutes / MINUTES_PER_HOUR5))}h ${String(minutes % MINUTES_PER_HOUR5)}m`;
141558
141680
  }
141559
141681
  function formatSpan(ms2) {
141560
- if (ms2 < MS_PER_SECOND18) {
141682
+ if (ms2 < MS_PER_SECOND19) {
141561
141683
  return "<1s";
141562
141684
  }
141563
- const seconds = Math.floor(ms2 / MS_PER_SECOND18);
141685
+ const seconds = Math.floor(ms2 / MS_PER_SECOND19);
141564
141686
  if (seconds < SECONDS_PER_MINUTE3) {
141565
141687
  return `${String(seconds)}s`;
141566
141688
  }
@@ -141577,7 +141699,7 @@ function formatAgo(ms2, t10) {
141577
141699
  if (ms2 < 0) {
141578
141700
  return t10("time.justNow");
141579
141701
  }
141580
- const seconds = Math.floor(ms2 / MS_PER_SECOND18);
141702
+ const seconds = Math.floor(ms2 / MS_PER_SECOND19);
141581
141703
  if (seconds < SECONDS_PER_MINUTE3) {
141582
141704
  return t10("time.ago", { value: `${String(seconds)}s` });
141583
141705
  }
@@ -141867,8 +141989,8 @@ var RETENTION_DAYS = 30;
141867
141989
  var HOURS_PER_DAY10 = 24;
141868
141990
  var MINUTES_PER_HOUR6 = 60;
141869
141991
  var SECONDS_PER_MINUTE4 = 60;
141870
- var MS_PER_SECOND19 = 1e3;
141871
- var CACHE_RETENTION_MS = RETENTION_DAYS * HOURS_PER_DAY10 * MINUTES_PER_HOUR6 * SECONDS_PER_MINUTE4 * MS_PER_SECOND19;
141992
+ var MS_PER_SECOND20 = 1e3;
141993
+ var CACHE_RETENTION_MS = RETENTION_DAYS * HOURS_PER_DAY10 * MINUTES_PER_HOUR6 * SECONDS_PER_MINUTE4 * MS_PER_SECOND20;
141872
141994
  function pruneCache(ports, cutoffMs) {
141873
141995
  const directory = cacheDirectory(ports);
141874
141996
  const names = ports.listDirectory(directory);
@@ -141911,7 +142033,7 @@ var MIN_SPEED_GAP_MS = 500;
141911
142033
  var TRANSCRIPT_BYTES_PER_TOKEN = 4;
141912
142034
  var SpeedSampleSchema = external_exports.strictObject({ at: external_exports.number(), outputTokens: external_exports.number().optional(), transcriptBytes: external_exports.number().optional() });
141913
142035
  var CACHE_KIND = "speed";
141914
- var MS_PER_SECOND20 = 1e3;
142036
+ var MS_PER_SECOND21 = 1e3;
141915
142037
  function tokensOf(sample, basis) {
141916
142038
  const value2 = sample[basis];
141917
142039
  return basis === "transcriptBytes" && value2 !== void 0 ? value2 / TRANSCRIPT_BYTES_PER_TOKEN : value2;
@@ -141933,7 +142055,7 @@ function speedBetween(previous, current) {
141933
142055
  if (gapMs < MIN_SPEED_GAP_MS) {
141934
142056
  return { tokensPerSecond: void 0, remember: false };
141935
142057
  }
141936
- return { tokensPerSecond: (now - before) / (gapMs / MS_PER_SECOND20), remember: true };
142058
+ return { tokensPerSecond: (now - before) / (gapMs / MS_PER_SECOND21), remember: true };
141937
142059
  }
141938
142060
  function trackSpeed(ports, transcriptPath, current) {
141939
142061
  const file2 = cacheFileFor(ports, CACHE_KIND, transcriptPath);
@@ -142728,7 +142850,7 @@ function formatWallClock(atMs, nowMs, clock, settings2) {
142728
142850
  }
142729
142851
 
142730
142852
  // src/statusline/elements/rows/promptCache.ts
142731
- var MS_PER_SECOND21 = 1e3;
142853
+ var MS_PER_SECOND22 = 1e3;
142732
142854
  var MIN_WARNING_SECONDS = 60;
142733
142855
  var WARNING_FRACTION_DENOMINATOR = 5;
142734
142856
  function warningSecondsOf(ttlSeconds) {
@@ -142741,13 +142863,13 @@ function promptCacheRow(context) {
142741
142863
  }
142742
142864
  const { palette, nowMs, settings: settings2, t: t10 } = context;
142743
142865
  const ttlSeconds = cache.ttlSeconds ?? settings2.promptCache.ttlSeconds;
142744
- const expiresAtMs = cache.anchorAtMs + ttlSeconds * MS_PER_SECOND21;
142866
+ const expiresAtMs = cache.anchorAtMs + ttlSeconds * MS_PER_SECOND22;
142745
142867
  const remainingMs = expiresAtMs - nowMs;
142746
142868
  const name = palette.paint("label", t10("promptCache.label"));
142747
142869
  if (remainingMs <= 0) {
142748
142870
  return { kind: "text", lines: [`${name} ${palette.paint("label", `\u23F1 ${t10("promptCache.expired")}`)}`] };
142749
142871
  }
142750
- const role = remainingMs <= warningSecondsOf(ttlSeconds) * MS_PER_SECOND21 ? "warning" : "context";
142872
+ const role = remainingMs <= warningSecondsOf(ttlSeconds) * MS_PER_SECOND22 ? "warning" : "context";
142751
142873
  return { kind: "text", lines: [`${name} ${palette.paint(role, `\u23F1 ${t10("promptCache.until", { time: formatWallClock(expiresAtMs, nowMs, context.ports.clock, settings2.clock) })}`)}`] };
142752
142874
  }
142753
142875
 
@@ -142991,7 +143113,7 @@ function toolsRow(context) {
142991
143113
 
142992
143114
  // src/statusline/transcript/tokens.ts
142993
143115
  init_zod();
142994
- var tokenCount = external_exports.number().nonnegative();
143116
+ var tokenCount = external_exports.number().int().nonnegative();
142995
143117
  var SessionTokensSchema = external_exports.strictObject({ inputTokens: tokenCount, outputTokens: tokenCount, cacheCreationTokens: tokenCount, cacheReadTokens: tokenCount });
142996
143118
  var TokenStateSchema = external_exports.strictObject({
142997
143119
  totals: SessionTokensSchema,
@@ -143026,16 +143148,19 @@ function larger(left, right) {
143026
143148
  cacheReadTokens: Math.max(left.cacheReadTokens, right.cacheReadTokens)
143027
143149
  };
143028
143150
  }
143151
+ function wholeTokens(count2) {
143152
+ return Math.trunc(count2 ?? 0);
143153
+ }
143029
143154
  function foldTokens(state, record2) {
143030
143155
  const usage = record2.message?.usage;
143031
143156
  if (record2.type !== "assistant" || usage === void 0) {
143032
143157
  return state;
143033
143158
  }
143034
143159
  const counts = {
143035
- inputTokens: usage.input_tokens ?? 0,
143036
- outputTokens: usage.output_tokens ?? 0,
143037
- cacheCreationTokens: usage.cache_creation_input_tokens ?? 0,
143038
- cacheReadTokens: usage.cache_read_input_tokens ?? 0
143160
+ inputTokens: wholeTokens(usage.input_tokens),
143161
+ outputTokens: wholeTokens(usage.output_tokens),
143162
+ cacheCreationTokens: wholeTokens(usage.cache_creation_input_tokens),
143163
+ cacheReadTokens: wholeTokens(usage.cache_read_input_tokens)
143039
143164
  };
143040
143165
  const key = record2.message?.id ?? `${String(counts.inputTokens)}|${String(counts.outputTokens)}|${String(counts.cacheCreationTokens)}|${String(counts.cacheReadTokens)}`;
143041
143166
  if (state.open?.key === key) {
@@ -143735,7 +143860,7 @@ var MAX_OLDER_SHARE = 0.5;
143735
143860
  var MAX_REMEMBERED_CALLS = callsRemembered(CALL_DIGEST_CHARS);
143736
143861
  var MAX_SKIPPED_CALLS = callsSkippedAtMost(CALL_DIGEST_CHARS);
143737
143862
  var MAX_COUNTED_NAMES = namesCounted(CALL_DIGEST_CHARS);
143738
- var MS_PER_SECOND22 = 1e3;
143863
+ var MS_PER_SECOND23 = 1e3;
143739
143864
  var SECONDS_PER_MINUTE5 = 60;
143740
143865
  var MINUTES_PER_HOUR7 = 60;
143741
143866
  var HOURS_PER_DAY11 = 24;
@@ -143748,7 +143873,7 @@ function timeoutFromEnv(env, name, fallback) {
143748
143873
  function bashLiveLimitMs(env) {
143749
143874
  return Math.max(timeoutFromEnv(env, "BASH_DEFAULT_TIMEOUT_MS", BASH_DEFAULT_TIMEOUT_MS), timeoutFromEnv(env, "BASH_MAX_TIMEOUT_MS", BASH_MAX_TIMEOUT_MS));
143750
143875
  }
143751
- var MAX_LIVE_AGENT_MS = HOURS_PER_DAY11 * MINUTES_PER_HOUR7 * SECONDS_PER_MINUTE5 * MS_PER_SECOND22;
143876
+ var MAX_LIVE_AGENT_MS = HOURS_PER_DAY11 * MINUTES_PER_HOUR7 * SECONDS_PER_MINUTE5 * MS_PER_SECOND23;
143752
143877
  var AGENT_TOOLS = ["Task", "Agent"];
143753
143878
  var TODO_WRITE_TOOL = "TodoWrite";
143754
143879
  var TASK_CREATE_TOOL = "TaskCreate";
package/dist/index.cjs CHANGED
@@ -4762,7 +4762,7 @@ var init_package = __esm({
4762
4762
  "package.json"() {
4763
4763
  package_default = {
4764
4764
  name: "claude-use",
4765
- version: "11.67.4",
4765
+ version: "11.68.0",
4766
4766
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
4767
4767
  license: "MIT",
4768
4768
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -9740,6 +9740,15 @@ var init_engine = __esm({
9740
9740
  }
9741
9741
  });
9742
9742
 
9743
+ // src/usage/unifiedRefusal.ts
9744
+ var init_unifiedRefusal = __esm({
9745
+ "src/usage/unifiedRefusal.ts"() {
9746
+ "use strict";
9747
+ init_rateLimit();
9748
+ init_scan();
9749
+ }
9750
+ });
9751
+
9743
9752
  // src/antigravity/cloudUpstream.ts
9744
9753
  var init_cloudUpstream = __esm({
9745
9754
  "src/antigravity/cloudUpstream.ts"() {
@@ -9752,6 +9761,7 @@ var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4,
9752
9761
  var init_quota = __esm({
9753
9762
  "src/antigravity/quota.ts"() {
9754
9763
  "use strict";
9764
+ init_unifiedRefusal();
9755
9765
  init_cloudUpstream();
9756
9766
  SECONDS_PER_HOUR = 3600;
9757
9767
  HOURS_PER_FIVE_HOUR_WINDOW = 5;
package/dist/index.mjs CHANGED
@@ -4738,7 +4738,7 @@ var init_package = __esm({
4738
4738
  "package.json"() {
4739
4739
  package_default = {
4740
4740
  name: "claude-use",
4741
- version: "11.67.4",
4741
+ version: "11.68.0",
4742
4742
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
4743
4743
  license: "MIT",
4744
4744
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -9713,6 +9713,15 @@ var init_engine = __esm({
9713
9713
  }
9714
9714
  });
9715
9715
 
9716
+ // src/usage/unifiedRefusal.ts
9717
+ var init_unifiedRefusal = __esm({
9718
+ "src/usage/unifiedRefusal.ts"() {
9719
+ "use strict";
9720
+ init_rateLimit();
9721
+ init_scan();
9722
+ }
9723
+ });
9724
+
9716
9725
  // src/antigravity/cloudUpstream.ts
9717
9726
  var init_cloudUpstream = __esm({
9718
9727
  "src/antigravity/cloudUpstream.ts"() {
@@ -9725,6 +9734,7 @@ var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4,
9725
9734
  var init_quota = __esm({
9726
9735
  "src/antigravity/quota.ts"() {
9727
9736
  "use strict";
9737
+ init_unifiedRefusal();
9728
9738
  init_cloudUpstream();
9729
9739
  SECONDS_PER_HOUR = 3600;
9730
9740
  HOURS_PER_FIVE_HOUR_WINDOW = 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.67.4",
3
+ "version": "11.68.0",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",