claude-use 11.49.0 → 11.49.2

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
@@ -35927,7 +35927,7 @@ var init_package = __esm({
35927
35927
  "package.json"() {
35928
35928
  package_default = {
35929
35929
  name: "claude-use",
35930
- version: "11.49.0",
35930
+ version: "11.49.2",
35931
35931
  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.",
35932
35932
  license: "MIT",
35933
35933
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -64666,16 +64666,22 @@ function channelRefusalMessage(channel) {
64666
64666
  function underBrewPrefix(executableRealPath) {
64667
64667
  return BREW_PREFIXES.some((prefix) => executableRealPath === prefix || executableRealPath.startsWith(`${prefix}/`));
64668
64668
  }
64669
+ function inHomebrewKeg(executableRealPath) {
64670
+ return underBrewPrefix(executableRealPath) && executableRealPath.split(/[\\/]/).includes("Cellar");
64671
+ }
64669
64672
  function detectChannel(env) {
64670
64673
  if (env.platform === "win32") {
64671
64674
  return { kind: "scoop" };
64672
64675
  }
64673
- if (underBrewPrefix(env.executableRealPath)) {
64676
+ if (inHomebrewKeg(env.executableRealPath)) {
64674
64677
  return { kind: "brew" };
64675
64678
  }
64676
64679
  if (env.executableRealPath.split(/[\\/]/).includes("node_modules")) {
64677
64680
  return { kind: "npm", reason: "node_modules" };
64678
64681
  }
64682
+ if (underBrewPrefix(env.executableRealPath)) {
64683
+ return { kind: "brew" };
64684
+ }
64679
64685
  if ((env.fileHead ?? "").startsWith("#!")) {
64680
64686
  return { kind: "npm", reason: "script" };
64681
64687
  }
@@ -131106,50 +131112,70 @@ function quotaHeaders(upstream) {
131106
131112
  }
131107
131113
  return headers;
131108
131114
  }
131109
- var EXHAUSTED_PERCENT = "100";
131115
+ var EXHAUSTED_PERCENT = 100;
131116
+ var FULL_PERCENT = 100;
131117
+ var MINUTES_PER_HOUR3 = 60;
131118
+ var FIVE_HOUR_WINDOW_HOURS2 = 5;
131119
+ var HOURS_PER_DAY7 = 24;
131120
+ var DAYS_PER_WEEK3 = 7;
131121
+ var FIVE_HOUR_MINUTES = FIVE_HOUR_WINDOW_HOURS2 * MINUTES_PER_HOUR3;
131122
+ var SEVEN_DAY_MINUTES = DAYS_PER_WEEK3 * HOURS_PER_DAY7 * MINUTES_PER_HOUR3;
131123
+ function windowReadings(upstream, exhausted, quotaError) {
131124
+ let fiveHour;
131125
+ let sevenDay;
131126
+ for (const slot of ["primary", "secondary"]) {
131127
+ const minutes = Number(upstream.get(`x-codex-${slot}-window-minutes`));
131128
+ const used = upstream.get(`x-codex-${slot}-used-percent`);
131129
+ const reset = upstream.get(`x-codex-${slot}-reset-at`);
131130
+ if (used === null || used === "" || reset === null || reset === "") {
131131
+ continue;
131132
+ }
131133
+ const reading = { usedPercent: Number(used), resetAt: reset };
131134
+ if (minutes === FIVE_HOUR_MINUTES) {
131135
+ fiveHour = reading;
131136
+ } else if (minutes === SEVEN_DAY_MINUTES) {
131137
+ sevenDay = reading;
131138
+ }
131139
+ }
131140
+ if (fiveHour === void 0 && sevenDay === void 0 && exhausted) {
131141
+ const reset = upstream.get("x-codex-primary-reset-at") ?? (quotaError?.resets_at === void 0 ? null : String(quotaError.resets_at));
131142
+ if (reset !== null && reset !== "") {
131143
+ sevenDay = { usedPercent: EXHAUSTED_PERCENT, resetAt: reset };
131144
+ }
131145
+ }
131146
+ return { fiveHour, sevenDay };
131147
+ }
131110
131148
  function unifiedQuotaHeaders(upstream, rejected, quotaError) {
131111
131149
  const headers = { "anthropic-ratelimit-unified-status": rejected ? "rejected" : "allowed" };
131112
- const used7d = upstream.get("x-codex-primary-used-percent") ?? (rejected ? EXHAUSTED_PERCENT : null);
131113
- const reset7d = upstream.get("x-codex-primary-reset-at") ?? (quotaError?.resets_at === void 0 ? null : String(quotaError.resets_at));
131114
- if (used7d !== null && reset7d !== null) {
131115
- headers["anthropic-ratelimit-unified-7d-utilization"] = used7d;
131116
- headers["anthropic-ratelimit-unified-7d-reset"] = reset7d;
131117
- headers["anthropic-ratelimit-unified-reset"] = reset7d;
131118
- }
131119
- if (Number(upstream.get("x-codex-secondary-window-minutes")) > 0) {
131120
- const used5h = upstream.get("x-codex-secondary-used-percent");
131121
- const reset5h = upstream.get("x-codex-secondary-reset-at");
131122
- if (used5h !== null && used5h !== "" && reset5h !== null && reset5h !== "") {
131123
- headers["anthropic-ratelimit-unified-5h-utilization"] = used5h;
131124
- headers["anthropic-ratelimit-unified-5h-reset"] = reset5h;
131125
- const overall = headers["anthropic-ratelimit-unified-reset"];
131126
- if (overall !== void 0) {
131127
- headers["anthropic-ratelimit-unified-reset"] = String(Math.min(Number(overall), Number(reset5h)));
131128
- }
131150
+ const { fiveHour, sevenDay } = windowReadings(upstream, rejected, quotaError);
131151
+ const resets = [];
131152
+ for (const [name, reading] of [["7d", sevenDay], ["5h", fiveHour]]) {
131153
+ if (reading !== void 0) {
131154
+ headers[`anthropic-ratelimit-unified-${name}-utilization`] = String(reading.usedPercent / FULL_PERCENT);
131155
+ headers[`anthropic-ratelimit-unified-${name}-reset`] = reading.resetAt;
131156
+ resets.push(Number(reading.resetAt));
131129
131157
  }
131130
131158
  }
131159
+ if (resets.length > 0) {
131160
+ headers["anthropic-ratelimit-unified-reset"] = String(Math.min(...resets));
131161
+ }
131131
131162
  return headers;
131132
131163
  }
131133
131164
  var MS_PER_SECOND11 = 1e3;
131165
+ function snapshotWindow(reading) {
131166
+ return reading === void 0 ? void 0 : { used_percentage: reading.usedPercent, resets_at: new Date(Number(reading.resetAt) * MS_PER_SECOND11).toISOString() };
131167
+ }
131134
131168
  function buildUsageSnapshot(upstream, quotaError, nowMs) {
131135
- const used7 = upstream.get("x-codex-primary-used-percent") ?? (quotaError === void 0 ? null : EXHAUSTED_PERCENT);
131136
- const reset7 = upstream.get("x-codex-primary-reset-at") ?? (quotaError?.resets_at === void 0 ? null : String(quotaError.resets_at));
131137
- const sevenDay = used7 !== null && reset7 !== null ? { used_percentage: Number(used7), resets_at: new Date(Number(reset7) * MS_PER_SECOND11).toISOString() } : void 0;
131138
- let fiveHour;
131139
- if (Number(upstream.get("x-codex-secondary-window-minutes")) > 0) {
131140
- const used5 = upstream.get("x-codex-secondary-used-percent");
131141
- const reset5 = upstream.get("x-codex-secondary-reset-at");
131142
- if (used5 !== null && reset5 !== null) {
131143
- fiveHour = { used_percentage: Number(used5), resets_at: new Date(Number(reset5) * MS_PER_SECOND11).toISOString() };
131144
- }
131145
- }
131146
- if (sevenDay === void 0 && fiveHour === void 0) {
131169
+ const { fiveHour, sevenDay } = windowReadings(upstream, quotaError !== void 0, quotaError);
131170
+ const fiveHourWindow = snapshotWindow(fiveHour);
131171
+ const sevenDayWindow = snapshotWindow(sevenDay);
131172
+ if (sevenDayWindow === void 0 && fiveHourWindow === void 0) {
131147
131173
  return void 0;
131148
131174
  }
131149
131175
  return {
131150
131176
  updated_at: new Date(nowMs).toISOString(),
131151
- ...sevenDay === void 0 ? {} : { seven_day: sevenDay },
131152
- ...fiveHour === void 0 ? {} : { five_hour: fiveHour }
131177
+ ...sevenDayWindow === void 0 ? {} : { seven_day: sevenDayWindow },
131178
+ ...fiveHourWindow === void 0 ? {} : { five_hour: fiveHourWindow }
131153
131179
  };
131154
131180
  }
131155
131181
  function retryAfterSeconds2(upstream, quotaError) {
@@ -136469,7 +136495,7 @@ var realHeadroomGet = async (target, requestPath, timeoutMs) => {
136469
136495
 
136470
136496
  // src/statusline/enrich.ts
136471
136497
  init_quota();
136472
- var FULL_PERCENT = 100;
136498
+ var FULL_PERCENT2 = 100;
136473
136499
  var MS_PER_SECOND16 = 1e3;
136474
136500
  function identityOf(env) {
136475
136501
  const headers = env.ANTHROPIC_CUSTOM_HEADERS;
@@ -136491,7 +136517,16 @@ function identityOf(env) {
136491
136517
  }
136492
136518
  return void 0;
136493
136519
  }
136494
- function windowsOf(states) {
136520
+ function livePercentOf(window, nowMs) {
136521
+ if (window?.utilization === void 0 || !Number.isFinite(window.utilization)) {
136522
+ return void 0;
136523
+ }
136524
+ if (window.resetsAt !== void 0 && Date.parse(window.resetsAt) <= nowMs) {
136525
+ return void 0;
136526
+ }
136527
+ return Math.round(Math.min(1, Math.max(0, window.utilization)) * FULL_PERCENT2);
136528
+ }
136529
+ function windowsOf(states, nowMs) {
136495
136530
  let fiveHourUsed;
136496
136531
  let fiveHourResetAt;
136497
136532
  let sevenDayUsed;
@@ -136501,14 +136536,12 @@ function windowsOf(states) {
136501
136536
  if (unified === void 0) {
136502
136537
  continue;
136503
136538
  }
136504
- const fiveWindow = unified.fiveHour === void 0 ? void 0 : unified.fiveHour.utilization;
136505
- const five = typeof fiveWindow === "number" && Number.isFinite(fiveWindow) ? Math.round(Math.min(1, Math.max(0, fiveWindow)) * FULL_PERCENT) : void 0;
136539
+ const five = livePercentOf(unified.fiveHour, nowMs);
136506
136540
  if (five !== void 0 && (fiveHourUsed === void 0 || five > fiveHourUsed)) {
136507
136541
  fiveHourUsed = five;
136508
136542
  fiveHourResetAt = unified.fiveHour?.resetsAt;
136509
136543
  }
136510
- const sevenWindow = unified.sevenDay === void 0 ? void 0 : unified.sevenDay.utilization;
136511
- const seven = typeof sevenWindow === "number" && Number.isFinite(sevenWindow) ? Math.round(Math.min(1, Math.max(0, sevenWindow)) * FULL_PERCENT) : void 0;
136544
+ const seven = livePercentOf(unified.sevenDay, nowMs);
136512
136545
  if (seven !== void 0 && (sevenDayUsed === void 0 || seven > sevenDayUsed)) {
136513
136546
  sevenDayUsed = seven;
136514
136547
  sevenDayResetAt = unified.sevenDay?.resetsAt;
@@ -136526,7 +136559,7 @@ function payloadWindow(rateLimits, key) {
136526
136559
  }
136527
136560
  const resetsAt = window.resets_at;
136528
136561
  return {
136529
- used: Math.min(FULL_PERCENT, Math.max(0, window.used_percentage)),
136562
+ used: Math.min(FULL_PERCENT2, Math.max(0, window.used_percentage)),
136530
136563
  resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? new Date(resetsAt * MS_PER_SECOND16).toISOString() : void 0
136531
136564
  };
136532
136565
  }
@@ -136554,7 +136587,7 @@ function antigravityQuotaMapOf(payload) {
136554
136587
  }
136555
136588
  function bucketView(bucket, nowMs) {
136556
136589
  return {
136557
- used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT,
136590
+ 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,
136558
136591
  resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : new Date(nowMs + bucket.reset_in_seconds * MS_PER_SECOND16).toISOString()
136559
136592
  };
136560
136593
  }
@@ -136572,7 +136605,7 @@ function antigravityWindowsOf(payload, nowMs) {
136572
136605
  function quotaFamiliesOf(buckets, nowMs) {
136573
136606
  return antigravityFamilyBuckets(buckets).flatMap(({ label, bucket }) => {
136574
136607
  const { used, resetAt } = bucketView(bucket, nowMs);
136575
- return used === void 0 ? [] : [{ measures: label, utilization: used / FULL_PERCENT, resetsAt: resetAt }];
136608
+ return used === void 0 ? [] : [{ measures: label, utilization: used / FULL_PERCENT2, resetsAt: resetAt }];
136576
136609
  });
136577
136610
  }
136578
136611
  function enrichStatuslinePayload(params) {
@@ -136634,7 +136667,7 @@ function enrichStatuslinePayload(params) {
136634
136667
  }
136635
136668
  ])
136636
136669
  );
136637
- summary = { ...summary, ...windowsOf(states), providerAccountEmail: email3, providerAccountSub: sub, providerPlan: plan, providerQuotaWindows, quotaFamilies: quotaFamiliesOf(providerBuckets, params.nowMs) };
136670
+ summary = { ...summary, ...windowsOf(states, params.nowMs), providerAccountEmail: email3, providerAccountSub: sub, providerPlan: plan, providerQuotaWindows, quotaFamilies: quotaFamiliesOf(providerBuckets, params.nowMs) };
136638
136671
  }
136639
136672
  if (summary.provider === void 0) {
136640
136673
  const agyBuckets = antigravityQuotaMapOf(params.payload);
@@ -136758,7 +136791,7 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
136758
136791
  // src/statusline/render.ts
136759
136792
  var BAR_WIDTH = 10;
136760
136793
  var SECONDS_PER_MINUTE2 = 60;
136761
- var MINUTES_PER_HOUR3 = 60;
136794
+ var MINUTES_PER_HOUR4 = 60;
136762
136795
  var SECONDS_PER_DAY = 86400;
136763
136796
  var THOUSAND = 1e3;
136764
136797
  var MILLION = 1e6;
@@ -136766,7 +136799,7 @@ var TEN = 10;
136766
136799
  var TWENTY = 20;
136767
136800
  var RESERVED_COLUMNS = 4;
136768
136801
  var SEPARATOR2 = " | ";
136769
- var FULL_PERCENT2 = 100;
136802
+ var FULL_PERCENT3 = 100;
136770
136803
  var ONE_PERCENT = 1;
136771
136804
  var USED_RED_AT = 0.9;
136772
136805
  var USED_YELLOW_AT = 0.7;
@@ -136809,8 +136842,8 @@ function formatDuration(seconds) {
136809
136842
  return "available";
136810
136843
  }
136811
136844
  const days = Math.floor(seconds / SECONDS_PER_DAY);
136812
- const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR3 * SECONDS_PER_MINUTE2));
136813
- const minutes = Math.floor(seconds % (MINUTES_PER_HOUR3 * SECONDS_PER_MINUTE2) / SECONDS_PER_MINUTE2);
136845
+ const hours = Math.floor(seconds % SECONDS_PER_DAY / (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2));
136846
+ const minutes = Math.floor(seconds % (MINUTES_PER_HOUR4 * SECONDS_PER_MINUTE2) / SECONDS_PER_MINUTE2);
136814
136847
  if (days > 0) {
136815
136848
  return `${String(days)}d ${String(hours)}h`;
136816
136849
  }
@@ -136833,7 +136866,7 @@ function headroomText(stats) {
136833
136866
  }
136834
136867
  function cacheHitText(hitFraction) {
136835
136868
  const clamped = Math.max(0, Math.min(1, hitFraction));
136836
- return ` (Cache: ${statusColor(clamped, false)}${(clamped * FULL_PERCENT2).toFixed(0)}%${RESET})`;
136869
+ return ` (Cache: ${statusColor(clamped, false)}${(clamped * FULL_PERCENT3).toFixed(0)}%${RESET})`;
136837
136870
  }
136838
136871
  function cacheShareText(view) {
136839
136872
  const hitRatio = view.cacheHitRatio;
@@ -136990,7 +137023,7 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
136990
137023
  }
136991
137024
  const contextGroup = [];
136992
137025
  if (view.contextUsedPercentage !== void 0) {
136993
- const fraction = Math.max(0, Math.min(1, view.contextUsedPercentage / FULL_PERCENT2));
137026
+ const fraction = Math.max(0, Math.min(1, view.contextUsedPercentage / FULL_PERCENT3));
136994
137027
  const color = statusColor(fraction, true);
136995
137028
  const percent2 = `${color}${view.contextUsedPercentage.toFixed(1)}%${RESET}`;
136996
137029
  const tokens = view.contextTotalTokens !== void 0 && view.contextWindowTokens !== void 0 ? `${formatTokens(view.contextTotalTokens)}/${formatTokens(view.contextWindowTokens)} ` : "";
@@ -137001,7 +137034,7 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
137001
137034
  const drawWindow = (label, fraction, resetsAt) => {
137002
137035
  const clamped = Math.max(0, Math.min(1, fraction));
137003
137036
  const color = statusColor(clamped, true);
137004
- quotaGroup.push(barCell(`${label} `, ` ${color}${(fraction * FULL_PERCENT2).toFixed(1)}%${RESET} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped));
137037
+ quotaGroup.push(barCell(`${label} `, ` ${color}${(fraction * FULL_PERCENT3).toFixed(1)}%${RESET} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped));
137005
137038
  };
137006
137039
  if (summary.quotaFamilies.length > 0) {
137007
137040
  for (const window of summary.quotaFamilies) {
@@ -137009,10 +137042,10 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
137009
137042
  }
137010
137043
  } else {
137011
137044
  if (summary.fiveHourUsed !== void 0) {
137012
- drawWindow("5h", summary.fiveHourUsed / FULL_PERCENT2, summary.fiveHourResetAt);
137045
+ drawWindow("5h", summary.fiveHourUsed / FULL_PERCENT3, summary.fiveHourResetAt);
137013
137046
  }
137014
137047
  if (summary.sevenDayUsed !== void 0) {
137015
- drawWindow("Wk", summary.sevenDayUsed / FULL_PERCENT2, summary.sevenDayResetAt);
137048
+ drawWindow("Wk", summary.sevenDayUsed / FULL_PERCENT3, summary.sevenDayResetAt);
137016
137049
  }
137017
137050
  if (summary.fiveHourUsed === void 0 && summary.sevenDayUsed === void 0) {
137018
137051
  for (const window of summary.providerQuotaWindows) {
package/dist/index.cjs CHANGED
@@ -4191,7 +4191,7 @@ var init_package = __esm({
4191
4191
  "package.json"() {
4192
4192
  package_default = {
4193
4193
  name: "claude-use",
4194
- version: "11.49.0",
4194
+ version: "11.49.2",
4195
4195
  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.",
4196
4196
  license: "MIT",
4197
4197
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/dist/index.mjs CHANGED
@@ -4167,7 +4167,7 @@ var init_package = __esm({
4167
4167
  "package.json"() {
4168
4168
  package_default = {
4169
4169
  name: "claude-use",
4170
- version: "11.49.0",
4170
+ version: "11.49.2",
4171
4171
  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.",
4172
4172
  license: "MIT",
4173
4173
  author: "Joseph Mearman <joseph@mearman.co.uk>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "11.49.0",
3
+ "version": "11.49.2",
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>",