ccstatusline-usage 2.4.3 → 2.4.5

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.
@@ -52319,6 +52319,7 @@ var init_Settings = __esm(() => {
52319
52319
  overrideBackgroundColor: exports_external.string().optional(),
52320
52320
  overrideForegroundColor: exports_external.string().optional(),
52321
52321
  globalBold: exports_external.boolean().default(false),
52322
+ gitCacheTtlSeconds: exports_external.number().min(0).max(60).default(5),
52322
52323
  minimalistMode: exports_external.boolean().default(false),
52323
52324
  powerline: PowerlineConfigSchema.default({
52324
52325
  enabled: false,
@@ -52795,6 +52796,175 @@ class OutputStyleWidget {
52795
52796
 
52796
52797
  // src/utils/git.ts
52797
52798
  import { execFileSync } from "child_process";
52799
+ import { createHash } from "node:crypto";
52800
+ import * as fs2 from "node:fs";
52801
+ import * as os3 from "node:os";
52802
+ import * as path from "node:path";
52803
+ function getCacheDir() {
52804
+ return path.join(os3.homedir(), ".cache", "ccstatusline");
52805
+ }
52806
+ function getCachePath(gitDir) {
52807
+ const repoHash = createHash("sha256").update(gitDir).digest("hex").slice(0, 16);
52808
+ return path.join(getCacheDir(), "git-cache", `git-${repoHash}.json`);
52809
+ }
52810
+ function getMtimeMs(filePath) {
52811
+ try {
52812
+ return fs2.statSync(filePath).mtimeMs;
52813
+ } catch {
52814
+ return null;
52815
+ }
52816
+ }
52817
+ function normalizeDirectory(candidate) {
52818
+ try {
52819
+ const resolved = path.resolve(candidate);
52820
+ const stats = fs2.statSync(resolved);
52821
+ return stats.isDirectory() ? resolved : path.dirname(resolved);
52822
+ } catch {
52823
+ return null;
52824
+ }
52825
+ }
52826
+ function readGitDirFile(gitFilePath) {
52827
+ try {
52828
+ const content = fs2.readFileSync(gitFilePath, "utf-8").trim();
52829
+ const match = /^gitdir:\s*(.+)$/i.exec(content);
52830
+ if (!match?.[1]) {
52831
+ return null;
52832
+ }
52833
+ return path.resolve(path.dirname(gitFilePath), match[1]);
52834
+ } catch {
52835
+ return null;
52836
+ }
52837
+ }
52838
+ function discoverGitDir(startDir) {
52839
+ let current = startDir;
52840
+ for (;; ) {
52841
+ const gitPath = path.join(current, ".git");
52842
+ try {
52843
+ const stats = fs2.statSync(gitPath);
52844
+ if (stats.isDirectory()) {
52845
+ return gitPath;
52846
+ }
52847
+ if (stats.isFile()) {
52848
+ return readGitDirFile(gitPath);
52849
+ }
52850
+ } catch {}
52851
+ const parent = path.dirname(current);
52852
+ if (parent === current) {
52853
+ return null;
52854
+ }
52855
+ current = parent;
52856
+ }
52857
+ }
52858
+ function getGitRepoMetadata(cwd2) {
52859
+ if (!cwd2) {
52860
+ return null;
52861
+ }
52862
+ const startDir = normalizeDirectory(cwd2);
52863
+ if (!startDir) {
52864
+ return null;
52865
+ }
52866
+ const gitDir = discoverGitDir(startDir);
52867
+ if (!gitDir) {
52868
+ return null;
52869
+ }
52870
+ return {
52871
+ cachePath: getCachePath(gitDir),
52872
+ headMtimeMs: getMtimeMs(path.join(gitDir, "HEAD")),
52873
+ indexMtimeMs: getMtimeMs(path.join(gitDir, "index"))
52874
+ };
52875
+ }
52876
+ function getGitCacheTtlMs(context) {
52877
+ const ttlSeconds = context.gitCacheTtlSeconds;
52878
+ if (typeof ttlSeconds !== "number" || !Number.isFinite(ttlSeconds)) {
52879
+ return DEFAULT_GIT_CACHE_TTL_SECONDS * 1000;
52880
+ }
52881
+ return Math.min(60, Math.max(0, ttlSeconds)) * 1000;
52882
+ }
52883
+ function isCacheEntry(value) {
52884
+ if (typeof value !== "object" || value === null) {
52885
+ return false;
52886
+ }
52887
+ const entry = value;
52888
+ return (typeof entry.output === "string" || entry.output === null) && typeof entry.createdAt === "number" && (typeof entry.headMtimeMs === "number" || entry.headMtimeMs === null) && (typeof entry.indexMtimeMs === "number" || entry.indexMtimeMs === null);
52889
+ }
52890
+ function isCacheEntryFresh(entry, metadata, ttlMs, now2) {
52891
+ if (metadata) {
52892
+ if (entry.headMtimeMs !== metadata.headMtimeMs || entry.indexMtimeMs !== metadata.indexMtimeMs) {
52893
+ return false;
52894
+ }
52895
+ }
52896
+ return ttlMs === 0 || now2 - entry.createdAt <= ttlMs;
52897
+ }
52898
+ function readPersistentCache(cachePath) {
52899
+ try {
52900
+ const parsed = JSON.parse(fs2.readFileSync(cachePath, "utf-8"));
52901
+ if (typeof parsed !== "object" || parsed === null) {
52902
+ return null;
52903
+ }
52904
+ const data = parsed;
52905
+ if (data.version !== GIT_CACHE_SCHEMA_VERSION || typeof data.cwd !== "string" && data.cwd !== null || typeof data.entries !== "object" || data.entries === null) {
52906
+ return null;
52907
+ }
52908
+ const entries = {};
52909
+ for (const [key, value] of Object.entries(data.entries)) {
52910
+ if (isCacheEntry(value)) {
52911
+ entries[key] = value;
52912
+ }
52913
+ }
52914
+ return {
52915
+ version: GIT_CACHE_SCHEMA_VERSION,
52916
+ cwd: data.cwd,
52917
+ entries
52918
+ };
52919
+ } catch {
52920
+ return null;
52921
+ }
52922
+ }
52923
+ function writePersistentCache(cachePath, cache3) {
52924
+ try {
52925
+ const cacheDir = path.dirname(cachePath);
52926
+ fs2.mkdirSync(cacheDir, { recursive: true });
52927
+ const tempPath = `${cachePath}.${process.pid}.${Date.now()}.tmp`;
52928
+ fs2.writeFileSync(tempPath, JSON.stringify(cache3), "utf-8");
52929
+ fs2.renameSync(tempPath, cachePath);
52930
+ } catch {}
52931
+ }
52932
+ function readPersistentCacheEntry(metadata, cacheKey, cwd2, ttlMs, now2) {
52933
+ if (!metadata) {
52934
+ return null;
52935
+ }
52936
+ const cache3 = readPersistentCache(metadata.cachePath);
52937
+ if (cache3?.cwd !== (cwd2 ?? null)) {
52938
+ return null;
52939
+ }
52940
+ const entry = cache3.entries[cacheKey];
52941
+ if (!entry || !isCacheEntryFresh(entry, metadata, ttlMs, now2)) {
52942
+ return null;
52943
+ }
52944
+ return entry;
52945
+ }
52946
+ function writePersistentCacheEntry(metadata, cacheKey, cwd2, entry) {
52947
+ if (!metadata) {
52948
+ return;
52949
+ }
52950
+ const cacheCwd = cwd2 ?? null;
52951
+ const existingCache = readPersistentCache(metadata.cachePath);
52952
+ const cache3 = existingCache?.cwd === cacheCwd ? existingCache : {
52953
+ version: GIT_CACHE_SCHEMA_VERSION,
52954
+ cwd: cacheCwd,
52955
+ entries: {}
52956
+ };
52957
+ cache3.entries[cacheKey] = entry;
52958
+ writePersistentCache(metadata.cachePath, cache3);
52959
+ }
52960
+ function createCacheEntry(output, metadata, now2) {
52961
+ return {
52962
+ output,
52963
+ createdAt: now2,
52964
+ headMtimeMs: metadata?.headMtimeMs ?? null,
52965
+ indexMtimeMs: metadata?.indexMtimeMs ?? null
52966
+ };
52967
+ }
52798
52968
  function resolveGitCwd(context) {
52799
52969
  const candidates = [
52800
52970
  context.data?.cwd,
@@ -52815,21 +52985,37 @@ function runGit(command, context) {
52815
52985
  function runGitArgs(args, context, cacheCommand) {
52816
52986
  const cwd2 = resolveGitCwd(context);
52817
52987
  const cacheToken = cacheCommand ?? args.join("\x00");
52818
- const cacheKey = `${cacheToken}|${cwd2 ?? ""}`;
52819
- if (gitCommandCache.has(cacheKey)) {
52820
- return gitCommandCache.get(cacheKey) ?? null;
52988
+ const memoryCacheKey = `${cacheToken}|${cwd2 ?? ""}`;
52989
+ const persistentCacheKey = cacheToken;
52990
+ const metadata = getGitRepoMetadata(cwd2);
52991
+ const ttlMs = getGitCacheTtlMs(context);
52992
+ const now2 = Date.now();
52993
+ const memoryEntry = gitCommandCache.get(memoryCacheKey);
52994
+ if (memoryEntry && isCacheEntryFresh(memoryEntry, metadata, ttlMs, now2)) {
52995
+ return memoryEntry.output;
52996
+ }
52997
+ const persistentEntry = readPersistentCacheEntry(metadata, persistentCacheKey, cwd2, ttlMs, now2);
52998
+ if (persistentEntry) {
52999
+ gitCommandCache.set(memoryCacheKey, persistentEntry);
53000
+ return persistentEntry.output;
52821
53001
  }
52822
53002
  try {
52823
53003
  const output = execFileSync("git", args, {
52824
53004
  encoding: "utf8",
52825
53005
  stdio: ["pipe", "pipe", "ignore"],
53006
+ env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" },
53007
+ windowsHide: true,
52826
53008
  ...cwd2 ? { cwd: cwd2 } : {}
52827
53009
  }).trimEnd();
52828
53010
  const result2 = output.length > 0 ? output : null;
52829
- gitCommandCache.set(cacheKey, result2);
53011
+ const entry = createCacheEntry(result2, metadata, now2);
53012
+ gitCommandCache.set(memoryCacheKey, entry);
53013
+ writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
52830
53014
  return result2;
52831
53015
  } catch {
52832
- gitCommandCache.set(cacheKey, null);
53016
+ const entry = createCacheEntry(null, metadata, now2);
53017
+ gitCommandCache.set(memoryCacheKey, entry);
53018
+ writePersistentCacheEntry(metadata, persistentCacheKey, cwd2, entry);
52833
53019
  return null;
52834
53020
  }
52835
53021
  }
@@ -52858,7 +53044,7 @@ function hasRenameOrCopyStatus(line) {
52858
53044
  return line.startsWith("R") || line.startsWith("C") || line[1] === "R" || line[1] === "C";
52859
53045
  }
52860
53046
  function getGitStatus(context) {
52861
- const output = runGit("--no-optional-locks status --porcelain -z", context);
53047
+ const output = runGit("status --porcelain -z", context);
52862
53048
  if (!output) {
52863
53049
  return { staged: false, unstaged: false, untracked: false, conflicts: false };
52864
53050
  }
@@ -52888,7 +53074,7 @@ function getGitStatus(context) {
52888
53074
  return { staged, unstaged, untracked, conflicts };
52889
53075
  }
52890
53076
  function getGitFileStatusCounts(context) {
52891
- const output = runGit("--no-optional-locks status --porcelain -z", context);
53077
+ const output = runGit("status --porcelain -z", context);
52892
53078
  if (!output) {
52893
53079
  return { staged: 0, unstaged: 0, untracked: 0 };
52894
53080
  }
@@ -52935,13 +53121,13 @@ function getGitConflictCount(context) {
52935
53121
  `).map((line) => {
52936
53122
  const parts = line.split(/\s+/).slice(3);
52937
53123
  return parts.join(" ");
52938
- }).filter((path) => path.length > 0));
53124
+ }).filter((path2) => path2.length > 0));
52939
53125
  return files.size;
52940
53126
  }
52941
53127
  function getGitShortSha(context) {
52942
53128
  return runGit("rev-parse --short HEAD", context);
52943
53129
  }
52944
- var gitCommandCache;
53130
+ var DEFAULT_GIT_CACHE_TTL_SECONDS = 5, GIT_CACHE_SCHEMA_VERSION = 1, gitCommandCache;
52945
53131
  var init_git = __esm(() => {
52946
53132
  gitCommandCache = new Map;
52947
53133
  });
@@ -53059,8 +53245,8 @@ function renderOsc8Link(url2, text) {
53059
53245
  function encodeGitRefForUrlPath(ref) {
53060
53246
  return ref.split("/").map((segment) => encodeURIComponent(segment)).join("/");
53061
53247
  }
53062
- function encodeFilePathForUri(path) {
53063
- return path.replace(/\\/g, "/").split("/").map((segment) => encodeURIComponent(segment)).join("/");
53248
+ function encodeFilePathForUri(path2) {
53249
+ return path2.replace(/\\/g, "/").split("/").map((segment) => encodeURIComponent(segment)).join("/");
53064
53250
  }
53065
53251
  function buildIdeFileUrl(filePath, ideLinkMode) {
53066
53252
  const normalizedPath = filePath.replace(/\\/g, "/");
@@ -53209,7 +53395,7 @@ class GitBranchWidget {
53209
53395
  return displayText;
53210
53396
  }
53211
53397
  getGitBranch(context) {
53212
- return runGit("branch --show-current", context);
53398
+ return runGit("symbolic-ref --short HEAD", context);
53213
53399
  }
53214
53400
  getCustomKeybinds() {
53215
53401
  return [
@@ -53715,19 +53901,19 @@ var init_GitRootDir = __esm(() => {
53715
53901
  import { execFileSync as execFileSync2 } from "child_process";
53716
53902
  import {
53717
53903
  existsSync as existsSync2,
53718
- mkdirSync,
53719
- readFileSync as readFileSync2,
53720
- statSync,
53721
- writeFileSync
53904
+ mkdirSync as mkdirSync2,
53905
+ readFileSync as readFileSync3,
53906
+ statSync as statSync2,
53907
+ writeFileSync as writeFileSync2
53722
53908
  } from "fs";
53723
- import { createHash } from "node:crypto";
53724
- import os3 from "node:os";
53725
- import path from "node:path";
53726
- function getCacheDir(deps) {
53727
- return path.join(deps.getHomedir(), ".cache", "ccstatusline");
53909
+ import { createHash as createHash2 } from "node:crypto";
53910
+ import os4 from "node:os";
53911
+ import path2 from "node:path";
53912
+ function getCacheDir2(deps) {
53913
+ return path2.join(deps.getHomedir(), ".cache", "ccstatusline");
53728
53914
  }
53729
53915
  function getGitReviewCacheDir(deps) {
53730
- return path.join(getCacheDir(deps), "git-review");
53916
+ return path2.join(getCacheDir2(deps), "git-review");
53731
53917
  }
53732
53918
  function runGitForCache(args, cwd2, deps) {
53733
53919
  try {
@@ -53735,14 +53921,15 @@ function runGitForCache(args, cwd2, deps) {
53735
53921
  encoding: "utf8",
53736
53922
  stdio: ["pipe", "pipe", "ignore"],
53737
53923
  cwd: cwd2,
53738
- timeout: CLI_TIMEOUT
53924
+ timeout: CLI_TIMEOUT,
53925
+ windowsHide: true
53739
53926
  }).trim();
53740
53927
  } catch {
53741
53928
  return "";
53742
53929
  }
53743
53930
  }
53744
53931
  function getCurrentBranch(cwd2, deps) {
53745
- const branch = runGitForCache(["branch", "--show-current"], cwd2, deps);
53932
+ const branch = runGitForCache(["symbolic-ref", "--short", "HEAD"], cwd2, deps);
53746
53933
  return branch.length > 0 ? branch : null;
53747
53934
  }
53748
53935
  function getCacheRef(cwd2, deps) {
@@ -53756,9 +53943,9 @@ function getCacheRef(cwd2, deps) {
53756
53943
  }
53757
53944
  return "unknown";
53758
53945
  }
53759
- function getCachePath(cwd2, ref, deps) {
53760
- const hash2 = createHash("sha256").update(cwd2).update("\x00").update(ref).digest("hex").slice(0, 16);
53761
- return path.join(getGitReviewCacheDir(deps), `git-review-${hash2}.json`);
53946
+ function getCachePath2(cwd2, ref, deps) {
53947
+ const hash2 = createHash2("sha256").update(cwd2).update("\x00").update(ref).digest("hex").slice(0, 16);
53948
+ return path2.join(getGitReviewCacheDir(deps), `git-review-${hash2}.json`);
53762
53949
  }
53763
53950
  function readCache(cachePath, deps) {
53764
53951
  try {
@@ -53838,7 +54025,8 @@ function isCliAvailable(cli, deps) {
53838
54025
  try {
53839
54026
  deps.execFileSync(cli, ["--version"], {
53840
54027
  stdio: ["pipe", "pipe", "ignore"],
53841
- timeout: CLI_TIMEOUT
54028
+ timeout: CLI_TIMEOUT,
54029
+ windowsHide: true
53842
54030
  });
53843
54031
  return true;
53844
54032
  } catch {
@@ -53849,7 +54037,8 @@ function isCliAuthedForHost(cli, host, deps) {
53849
54037
  try {
53850
54038
  deps.execFileSync(cli, ["auth", "status", "--hostname", host], {
53851
54039
  stdio: ["pipe", "pipe", "ignore"],
53852
- timeout: CLI_TIMEOUT
54040
+ timeout: CLI_TIMEOUT,
54041
+ windowsHide: true
53853
54042
  });
53854
54043
  return true;
53855
54044
  } catch {
@@ -53881,7 +54070,8 @@ function fetchFromGh(cwd2, repoRef, deps) {
53881
54070
  encoding: "utf8",
53882
54071
  stdio: ["pipe", "pipe", "ignore"],
53883
54072
  cwd: cwd2,
53884
- timeout: CLI_TIMEOUT
54073
+ timeout: CLI_TIMEOUT,
54074
+ windowsHide: true
53885
54075
  }).trim();
53886
54076
  if (output.length === 0) {
53887
54077
  return null;
@@ -53913,7 +54103,8 @@ function fetchFromGlab(cwd2, repoRef, deps) {
53913
54103
  encoding: "utf8",
53914
54104
  stdio: ["pipe", "pipe", "ignore"],
53915
54105
  cwd: cwd2,
53916
- timeout: CLI_TIMEOUT
54106
+ timeout: CLI_TIMEOUT,
54107
+ windowsHide: true
53917
54108
  }).trim();
53918
54109
  if (output.length === 0) {
53919
54110
  return null;
@@ -53945,7 +54136,7 @@ function fetchFromProvider(provider, cwd2, repoRef, deps) {
53945
54136
  return null;
53946
54137
  }
53947
54138
  function fetchGitReviewData(cwd2, deps = DEFAULT_GIT_REVIEW_CACHE_DEPS) {
53948
- const cachePath = getCachePath(cwd2, getCacheRef(cwd2, deps), deps);
54139
+ const cachePath = getCachePath2(cwd2, getCacheRef(cwd2, deps), deps);
53949
54140
  const cached2 = readCache(cachePath, deps);
53950
54141
  if (cached2 !== "miss") {
53951
54142
  return cached2;
@@ -53991,11 +54182,11 @@ var init_git_review_cache = __esm(() => {
53991
54182
  DEFAULT_GIT_REVIEW_CACHE_DEPS = {
53992
54183
  execFileSync: execFileSync2,
53993
54184
  existsSync: existsSync2,
53994
- mkdirSync,
53995
- readFileSync: readFileSync2,
53996
- statSync,
53997
- writeFileSync,
53998
- getHomedir: os3.homedir,
54185
+ mkdirSync: mkdirSync2,
54186
+ readFileSync: readFileSync3,
54187
+ statSync: statSync2,
54188
+ writeFileSync: writeFileSync2,
54189
+ getHomedir: os4.homedir,
53999
54190
  now: Date.now
54000
54191
  };
54001
54192
  });
@@ -55151,6 +55342,11 @@ function getContextWindowMetrics(data) {
55151
55342
  currentUsageTotalTokens = inputTokens + outputTokens + cacheCreationTokens + cacheReadTokens;
55152
55343
  contextLengthTokens = inputTokens + cacheCreationTokens + cacheReadTokens;
55153
55344
  cachedTokens = cacheCreationTokens + cacheReadTokens;
55345
+ if (currentUsageTotalTokens === 0) {
55346
+ currentUsageTotalTokens = null;
55347
+ contextLengthTokens = null;
55348
+ cachedTokens = null;
55349
+ }
55154
55350
  }
55155
55351
  const rawUsedPercentage = toFiniteNonNegativeNumber(contextWindow.used_percentage);
55156
55352
  const rawRemainingPercentage = toFiniteNonNegativeNumber(contextWindow.remaining_percentage);
@@ -56048,20 +56244,20 @@ var init_context_percentage = __esm(() => {
56048
56244
 
56049
56245
  // src/utils/terminal.ts
56050
56246
  import { execSync } from "child_process";
56051
- import * as fs2 from "fs";
56052
- import * as path2 from "path";
56247
+ import * as fs3 from "fs";
56248
+ import * as path3 from "path";
56053
56249
  function getPackageVersion() {
56054
56250
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
56055
56251
  return PACKAGE_VERSION;
56056
56252
  }
56057
56253
  const possiblePaths = [
56058
- path2.join(__dirname, "..", "..", "package.json"),
56059
- path2.join(__dirname, "..", "package.json")
56254
+ path3.join(__dirname, "..", "..", "package.json"),
56255
+ path3.join(__dirname, "..", "package.json")
56060
56256
  ];
56061
56257
  for (const packageJsonPath of possiblePaths) {
56062
56258
  try {
56063
- if (fs2.existsSync(packageJsonPath)) {
56064
- const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
56259
+ if (fs3.existsSync(packageJsonPath)) {
56260
+ const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
56065
56261
  return packageJson.version ?? "";
56066
56262
  }
56067
56263
  } catch {}
@@ -56077,6 +56273,13 @@ function probeTerminalWidth() {
56077
56273
  return parsed;
56078
56274
  } catch {}
56079
56275
  }
56276
+ const overrideRaw = process.env.CCSTATUSLINE_WIDTH;
56277
+ if (overrideRaw) {
56278
+ const override = parsePositiveInteger(overrideRaw);
56279
+ if (override !== null) {
56280
+ return override;
56281
+ }
56282
+ }
56080
56283
  if (process.platform === "win32") {
56081
56284
  return null;
56082
56285
  }
@@ -56099,7 +56302,8 @@ function probeTerminalWidth() {
56099
56302
  try {
56100
56303
  const width = execSync("tput cols 2>/dev/null", {
56101
56304
  encoding: "utf8",
56102
- stdio: ["pipe", "pipe", "ignore"]
56305
+ stdio: ["pipe", "pipe", "ignore"],
56306
+ windowsHide: true
56103
56307
  }).trim();
56104
56308
  return parsePositiveInteger(width);
56105
56309
  } catch {}
@@ -56117,7 +56321,8 @@ function getParentProcessId(pid) {
56117
56321
  const parentPidOutput = execSync(`ps -o ppid= -p ${pid}`, {
56118
56322
  encoding: "utf8",
56119
56323
  stdio: ["pipe", "pipe", "ignore"],
56120
- shell: "/bin/sh"
56324
+ shell: "/bin/sh",
56325
+ windowsHide: true
56121
56326
  }).trim();
56122
56327
  return parsePositiveInteger(parentPidOutput);
56123
56328
  } catch {
@@ -56129,7 +56334,8 @@ function getTTYForProcess(pid) {
56129
56334
  const tty2 = execSync(`ps -o tty= -p ${pid}`, {
56130
56335
  encoding: "utf8",
56131
56336
  stdio: ["pipe", "pipe", "ignore"],
56132
- shell: "/bin/sh"
56337
+ shell: "/bin/sh",
56338
+ windowsHide: true
56133
56339
  }).replace(/\s+/g, "");
56134
56340
  if (!tty2 || tty2 === "??" || tty2 === "?") {
56135
56341
  return null;
@@ -56140,16 +56346,27 @@ function getTTYForProcess(pid) {
56140
56346
  }
56141
56347
  }
56142
56348
  function getWidthForTTY(tty2) {
56143
- try {
56144
- const width = execSync(`stty size < /dev/${tty2} | awk '{print $2}'`, {
56145
- encoding: "utf8",
56146
- stdio: ["pipe", "pipe", "ignore"],
56147
- shell: "/bin/sh"
56148
- }).trim();
56149
- return parsePositiveInteger(width);
56150
- } catch {
56151
- return null;
56349
+ const devicePath = `/dev/${tty2}`;
56350
+ const attempts = [
56351
+ `stty -F ${devicePath} size`,
56352
+ `stty -f ${devicePath} size`,
56353
+ `stty size < ${devicePath}`
56354
+ ];
56355
+ for (const cmd of attempts) {
56356
+ try {
56357
+ const width = execSync(`${cmd} 2>/dev/null | awk '{print $2}'`, {
56358
+ encoding: "utf8",
56359
+ stdio: ["pipe", "pipe", "ignore"],
56360
+ shell: "/bin/sh",
56361
+ windowsHide: true
56362
+ }).trim();
56363
+ const parsed = parsePositiveInteger(width);
56364
+ if (parsed !== null) {
56365
+ return parsed;
56366
+ }
56367
+ } catch {}
56152
56368
  }
56369
+ return null;
56153
56370
  }
56154
56371
  function getTerminalWidth() {
56155
56372
  return probeTerminalWidth();
@@ -56157,7 +56374,7 @@ function getTerminalWidth() {
56157
56374
  function canDetectTerminalWidth() {
56158
56375
  return probeTerminalWidth() !== null;
56159
56376
  }
56160
- var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.4.3";
56377
+ var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils", PACKAGE_VERSION = "2.4.5";
56161
56378
  var init_terminal = () => {};
56162
56379
 
56163
56380
  // node_modules/ms/index.js
@@ -56617,7 +56834,7 @@ var require_has_flag = __commonJS((exports, module) => {
56617
56834
 
56618
56835
  // node_modules/supports-color/index.js
56619
56836
  var require_supports_color = __commonJS((exports, module) => {
56620
- var os4 = __require("os");
56837
+ var os5 = __require("os");
56621
56838
  var tty2 = __require("tty");
56622
56839
  var hasFlag2 = require_has_flag();
56623
56840
  var { env: env3 } = process;
@@ -56674,7 +56891,7 @@ var require_supports_color = __commonJS((exports, module) => {
56674
56891
  return min2;
56675
56892
  }
56676
56893
  if (process.platform === "win32") {
56677
- const osRelease = os4.release().split(".");
56894
+ const osRelease = os5.release().split(".");
56678
56895
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
56679
56896
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
56680
56897
  }
@@ -57022,7 +57239,7 @@ var init_dist4 = __esm(() => {
57022
57239
 
57023
57240
  // node_modules/https-proxy-agent/dist/parse-proxy-response.js
57024
57241
  function parseProxyResponse(socket) {
57025
- return new Promise((resolve, reject2) => {
57242
+ return new Promise((resolve2, reject2) => {
57026
57243
  let buffersLength = 0;
57027
57244
  const buffers = [];
57028
57245
  function read() {
@@ -57091,7 +57308,7 @@ function parseProxyResponse(socket) {
57091
57308
  }
57092
57309
  debug("got proxy server response: %o %o", firstLine, headers);
57093
57310
  cleanup();
57094
- resolve({
57311
+ resolve2({
57095
57312
  connect: {
57096
57313
  statusCode,
57097
57314
  statusText,
@@ -57231,10 +57448,13 @@ var init_usage_types = __esm(() => {
57231
57448
 
57232
57449
  // src/utils/usage-fetch.ts
57233
57450
  import { execFileSync as execFileSync3 } from "child_process";
57234
- import * as fs3 from "fs";
57451
+ import * as fs4 from "fs";
57235
57452
  import * as https from "https";
57236
- import * as os4 from "os";
57237
- import * as path3 from "path";
57453
+ import * as os5 from "os";
57454
+ import * as path4 from "path";
57455
+ function getUsageApiBucketUtilization(bucket) {
57456
+ return bucket === null ? 0 : bucket?.utilization ?? undefined;
57457
+ }
57238
57458
  function parseJsonWithSchema(rawJson, schema) {
57239
57459
  try {
57240
57460
  const parsed = schema.safeParse(JSON.parse(rawJson));
@@ -57275,13 +57495,13 @@ function parseUsageApiResponse(rawJson) {
57275
57495
  return null;
57276
57496
  }
57277
57497
  return {
57278
- sessionUsage: parsed.five_hour?.utilization ?? undefined,
57498
+ sessionUsage: getUsageApiBucketUtilization(parsed.five_hour),
57279
57499
  sessionResetAt: parsed.five_hour?.resets_at ?? undefined,
57280
- weeklyUsage: parsed.seven_day?.utilization ?? undefined,
57500
+ weeklyUsage: getUsageApiBucketUtilization(parsed.seven_day),
57281
57501
  weeklyResetAt: parsed.seven_day?.resets_at ?? undefined,
57282
- weeklySonnetUsage: parsed.seven_day_sonnet === null ? 0 : parsed.seven_day_sonnet?.utilization ?? undefined,
57502
+ weeklySonnetUsage: getUsageApiBucketUtilization(parsed.seven_day_sonnet),
57283
57503
  weeklySonnetResetAt: parsed.seven_day_sonnet?.resets_at ?? undefined,
57284
- weeklyOpusUsage: parsed.seven_day_opus === null ? 0 : parsed.seven_day_opus?.utilization ?? undefined,
57504
+ weeklyOpusUsage: getUsageApiBucketUtilization(parsed.seven_day_opus),
57285
57505
  weeklyOpusResetAt: parsed.seven_day_opus?.resets_at ?? undefined,
57286
57506
  extraUsageEnabled: parsed.extra_usage?.is_enabled ?? undefined,
57287
57507
  extraUsageLimit: parsed.extra_usage?.monthly_limit ?? undefined,
@@ -57290,8 +57510,8 @@ function parseUsageApiResponse(rawJson) {
57290
57510
  };
57291
57511
  }
57292
57512
  function ensureCacheDirExists() {
57293
- if (!fs3.existsSync(CACHE_DIR)) {
57294
- fs3.mkdirSync(CACHE_DIR, { recursive: true });
57513
+ if (!fs4.existsSync(CACHE_DIR)) {
57514
+ fs4.mkdirSync(CACHE_DIR, { recursive: true });
57295
57515
  }
57296
57516
  }
57297
57517
  function setCachedUsageError(error48, now2, maxAge = LOCK_MAX_AGE) {
@@ -57307,8 +57527,14 @@ function cacheUsageData(data, now2) {
57307
57527
  usageErrorCacheMaxAge = LOCK_MAX_AGE;
57308
57528
  return data;
57309
57529
  }
57530
+ function hasRequiredUsageField(data, field) {
57531
+ if (data[field] !== undefined) {
57532
+ return true;
57533
+ }
57534
+ return data.extraUsageEnabled === false && EXTRA_USAGE_DETAIL_FIELDS.has(field);
57535
+ }
57310
57536
  function hasRequiredUsageFields(data, requiredFields = []) {
57311
- return requiredFields.every((field) => data[field] !== undefined);
57537
+ return requiredFields.every((field) => hasRequiredUsageField(data, field));
57312
57538
  }
57313
57539
  function getStaleUsageOrError(error48, now2, errorCacheMaxAge = LOCK_MAX_AGE, requiredFields = []) {
57314
57540
  const stale = readStaleUsageCache();
@@ -57387,7 +57613,7 @@ function parseMacKeychainCredentialCandidates(rawDump, servicePrefix = MACOS_USA
57387
57613
  }
57388
57614
  function readMacKeychainSecret(service) {
57389
57615
  try {
57390
- return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
57616
+ return execFileSync3("security", ["find-generic-password", "-s", service, "-w"], { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"], windowsHide: true }).trim();
57391
57617
  } catch {
57392
57618
  return null;
57393
57619
  }
@@ -57401,7 +57627,8 @@ function listMacKeychainCredentialCandidates() {
57401
57627
  const rawDump = execFileSync3("security", ["dump-keychain"], {
57402
57628
  encoding: "utf8",
57403
57629
  maxBuffer: MACOS_SECURITY_DUMP_MAX_BUFFER,
57404
- stdio: ["pipe", "pipe", "ignore"]
57630
+ stdio: ["pipe", "pipe", "ignore"],
57631
+ windowsHide: true
57405
57632
  });
57406
57633
  return parseMacKeychainCredentialCandidates(rawDump);
57407
57634
  } catch {
@@ -57420,8 +57647,8 @@ function readUsageTokenFromMacKeychainCandidates() {
57420
57647
  }
57421
57648
  function readUsageTokenFromCredentialsFile() {
57422
57649
  try {
57423
- const credFile = path3.join(getClaudeConfigDir(), ".credentials.json");
57424
- return parseUsageAccessToken(fs3.readFileSync(credFile, "utf8"));
57650
+ const credFile = path4.join(getClaudeConfigDir(), ".credentials.json");
57651
+ return parseUsageAccessToken(fs4.readFileSync(credFile, "utf8"));
57425
57652
  } catch {
57426
57653
  return null;
57427
57654
  }
@@ -57434,7 +57661,7 @@ function getUsageToken() {
57434
57661
  }
57435
57662
  function readStaleUsageCache() {
57436
57663
  try {
57437
- return parseCachedUsageData(fs3.readFileSync(CACHE_FILE, "utf8"));
57664
+ return parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
57438
57665
  } catch {
57439
57666
  return null;
57440
57667
  }
@@ -57442,13 +57669,13 @@ function readStaleUsageCache() {
57442
57669
  function writeUsageLock(blockedUntil, error48) {
57443
57670
  try {
57444
57671
  ensureCacheDirExists();
57445
- fs3.writeFileSync(LOCK_FILE, JSON.stringify({ blockedUntil, error: error48 }));
57672
+ fs4.writeFileSync(LOCK_FILE, JSON.stringify({ blockedUntil, error: error48 }));
57446
57673
  } catch {}
57447
57674
  }
57448
57675
  function readActiveUsageLock(now2) {
57449
57676
  let hasValidJsonLock = false;
57450
57677
  try {
57451
- const parsed = parseJsonWithSchema(fs3.readFileSync(LOCK_FILE, "utf8"), UsageLockSchema);
57678
+ const parsed = parseJsonWithSchema(fs4.readFileSync(LOCK_FILE, "utf8"), UsageLockSchema);
57452
57679
  if (parsed) {
57453
57680
  hasValidJsonLock = true;
57454
57681
  if (parsed.blockedUntil > now2) {
@@ -57464,7 +57691,7 @@ function readActiveUsageLock(now2) {
57464
57691
  return null;
57465
57692
  }
57466
57693
  try {
57467
- const lockStat = fs3.statSync(LOCK_FILE);
57694
+ const lockStat = fs4.statSync(LOCK_FILE);
57468
57695
  const lockMtime = Math.floor(lockStat.mtimeMs / 1000);
57469
57696
  const blockedUntil = lockMtime + LOCK_MAX_AGE;
57470
57697
  if (blockedUntil > now2) {
@@ -57519,14 +57746,14 @@ function getUsageApiRequestOptions(token) {
57519
57746
  }
57520
57747
  }
57521
57748
  async function fetchFromUsageApi(token) {
57522
- return new Promise((resolve) => {
57749
+ return new Promise((resolve2) => {
57523
57750
  let settled = false;
57524
57751
  const finish = (value) => {
57525
57752
  if (settled) {
57526
57753
  return;
57527
57754
  }
57528
57755
  settled = true;
57529
- resolve(value);
57756
+ resolve2(value);
57530
57757
  };
57531
57758
  const requestOptions = getUsageApiRequestOptions(token);
57532
57759
  if (!requestOptions) {
@@ -57577,10 +57804,10 @@ async function fetchUsageData(options = {}) {
57577
57804
  }
57578
57805
  }
57579
57806
  try {
57580
- const stat = fs3.statSync(CACHE_FILE);
57807
+ const stat = fs4.statSync(CACHE_FILE);
57581
57808
  const fileAge = now2 - Math.floor(stat.mtimeMs / 1000);
57582
57809
  if (fileAge < CACHE_MAX_AGE) {
57583
- const fileData = parseCachedUsageData(fs3.readFileSync(CACHE_FILE, "utf8"));
57810
+ const fileData = parseCachedUsageData(fs4.readFileSync(CACHE_FILE, "utf8"));
57584
57811
  if (fileData && !fileData.error && hasRequiredUsageFields(fileData, requiredFields)) {
57585
57812
  return cacheUsageData(fileData, now2);
57586
57813
  }
@@ -57606,32 +57833,40 @@ async function fetchUsageData(options = {}) {
57606
57833
  }
57607
57834
  const usageData = parseUsageApiResponse(response.body);
57608
57835
  if (!usageData) {
57836
+ writeUsageLock(now2 + LOCK_MAX_AGE, "parse-error");
57609
57837
  return getStaleUsageOrError("parse-error", now2, LOCK_MAX_AGE, requiredFields);
57610
57838
  }
57611
57839
  if (usageData.sessionUsage === undefined && usageData.weeklyUsage === undefined) {
57840
+ writeUsageLock(now2 + LOCK_MAX_AGE, "parse-error");
57612
57841
  return getStaleUsageOrError("parse-error", now2, LOCK_MAX_AGE, requiredFields);
57613
57842
  }
57614
57843
  try {
57615
57844
  ensureCacheDirExists();
57616
- fs3.writeFileSync(CACHE_FILE, JSON.stringify(usageData));
57845
+ fs4.writeFileSync(CACHE_FILE, JSON.stringify(usageData));
57617
57846
  } catch {}
57618
57847
  return cacheUsageData(usageData, now2);
57619
57848
  } catch {
57849
+ writeUsageLock(now2 + LOCK_MAX_AGE, "parse-error");
57620
57850
  return getStaleUsageOrError("parse-error", now2, LOCK_MAX_AGE, requiredFields);
57621
57851
  }
57622
57852
  }
57623
- var CACHE_DIR, CACHE_FILE, LOCK_FILE, CACHE_MAX_AGE = 180, LOCK_MAX_AGE = 30, DEFAULT_RATE_LIMIT_BACKOFF = 300, MACOS_USAGE_CREDENTIALS_SERVICE = "Claude Code-credentials", MACOS_SECURITY_DUMP_MAX_BUFFER, UsageCredentialsSchema, UsageLockErrorSchema, UsageLockSchema, CachedUsageDataSchema, PerModelWeeklyBucketSchema, UsageApiResponseSchema, cachedUsageData = null, usageCacheTime = 0, usageErrorCacheMaxAge, USAGE_API_HOST = "api.anthropic.com", USAGE_API_PATH = "/api/oauth/usage", USAGE_API_TIMEOUT_MS = 5000;
57853
+ var CACHE_DIR, CACHE_FILE, LOCK_FILE, CACHE_MAX_AGE = 180, LOCK_MAX_AGE = 30, DEFAULT_RATE_LIMIT_BACKOFF = 300, MACOS_USAGE_CREDENTIALS_SERVICE = "Claude Code-credentials", MACOS_SECURITY_DUMP_MAX_BUFFER, EXTRA_USAGE_DETAIL_FIELDS, UsageCredentialsSchema, UsageLockErrorSchema, UsageLockSchema, CachedUsageDataSchema, UsageApiBucketSchema, UsageApiResponseSchema, cachedUsageData = null, usageCacheTime = 0, usageErrorCacheMaxAge, USAGE_API_HOST = "api.anthropic.com", USAGE_API_PATH = "/api/oauth/usage", USAGE_API_TIMEOUT_MS = 5000;
57624
57854
  var init_usage_fetch = __esm(async () => {
57625
57855
  init_dist5();
57626
57856
  init_zod();
57627
57857
  init_usage_types();
57628
57858
  await init_claude_settings();
57629
- CACHE_DIR = path3.join(os4.homedir(), ".cache", "ccstatusline");
57630
- CACHE_FILE = path3.join(CACHE_DIR, "usage.json");
57631
- LOCK_FILE = path3.join(CACHE_DIR, "usage.lock");
57859
+ CACHE_DIR = path4.join(os5.homedir(), ".cache", "ccstatusline");
57860
+ CACHE_FILE = path4.join(CACHE_DIR, "usage.json");
57861
+ LOCK_FILE = path4.join(CACHE_DIR, "usage.lock");
57632
57862
  MACOS_SECURITY_DUMP_MAX_BUFFER = 8 * 1024 * 1024;
57863
+ EXTRA_USAGE_DETAIL_FIELDS = new Set([
57864
+ "extraUsageLimit",
57865
+ "extraUsageUsed",
57866
+ "extraUsageUtilization"
57867
+ ]);
57633
57868
  UsageCredentialsSchema = exports_external.object({ claudeAiOauth: exports_external.object({ accessToken: exports_external.string().nullable().optional() }).optional() });
57634
- UsageLockErrorSchema = exports_external.enum(["timeout", "rate-limited"]);
57869
+ UsageLockErrorSchema = exports_external.enum(["timeout", "rate-limited", "parse-error"]);
57635
57870
  UsageLockSchema = exports_external.object({
57636
57871
  blockedUntil: exports_external.number(),
57637
57872
  error: UsageLockErrorSchema.optional()
@@ -57652,27 +57887,21 @@ var init_usage_fetch = __esm(async () => {
57652
57887
  error: exports_external.string().nullable().optional(),
57653
57888
  provider: exports_external.enum(["anthropic", "opencode"]).nullable().optional()
57654
57889
  });
57655
- PerModelWeeklyBucketSchema = exports_external.object({
57890
+ UsageApiBucketSchema = exports_external.looseObject({
57656
57891
  utilization: exports_external.number().nullable().optional(),
57657
57892
  resets_at: exports_external.string().nullable().optional()
57658
57893
  }).nullable().optional();
57659
- UsageApiResponseSchema = exports_external.object({
57660
- five_hour: exports_external.object({
57661
- utilization: exports_external.number().nullable().optional(),
57662
- resets_at: exports_external.string().nullable().optional()
57663
- }).optional(),
57664
- seven_day: exports_external.object({
57665
- utilization: exports_external.number().nullable().optional(),
57666
- resets_at: exports_external.string().nullable().optional()
57667
- }).optional(),
57668
- seven_day_sonnet: PerModelWeeklyBucketSchema,
57669
- seven_day_opus: PerModelWeeklyBucketSchema,
57670
- extra_usage: exports_external.object({
57894
+ UsageApiResponseSchema = exports_external.looseObject({
57895
+ five_hour: UsageApiBucketSchema,
57896
+ seven_day: UsageApiBucketSchema,
57897
+ seven_day_sonnet: UsageApiBucketSchema,
57898
+ seven_day_opus: UsageApiBucketSchema,
57899
+ extra_usage: exports_external.looseObject({
57671
57900
  is_enabled: exports_external.boolean().nullable().optional(),
57672
57901
  monthly_limit: exports_external.number().nullable().optional(),
57673
57902
  used_credits: exports_external.number().nullable().optional(),
57674
57903
  utilization: exports_external.number().nullable().optional()
57675
- }).optional()
57904
+ }).nullable().optional()
57676
57905
  });
57677
57906
  usageErrorCacheMaxAge = LOCK_MAX_AGE;
57678
57907
  });
@@ -58835,6 +59064,12 @@ function toggleUsageDateMode(item) {
58835
59064
  function toggleUsageHourFormat(item) {
58836
59065
  return toggleMetadataFlag(item, "hour12");
58837
59066
  }
59067
+ function isUsageWeekdayEnabled(item) {
59068
+ return isMetadataFlagEnabled(item, "weekday");
59069
+ }
59070
+ function toggleUsageWeekday(item) {
59071
+ return toggleMetadataFlag(item, "weekday");
59072
+ }
58838
59073
  function getUsageDisplayModifierText(item, options = {}) {
58839
59074
  const mode = getUsageDisplayMode(item);
58840
59075
  const modifiers = [];
@@ -58923,6 +59158,9 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
58923
59158
  if (options.includeHourFormat) {
58924
59159
  keybinds.push(HOUR_FORMAT_TOGGLE_KEYBIND);
58925
59160
  }
59161
+ if (options.includeWeekday) {
59162
+ keybinds.push(WEEKDAY_TOGGLE_KEYBIND);
59163
+ }
58926
59164
  if (options.includeTimezone) {
58927
59165
  keybinds.push(TIMEZONE_KEYBIND);
58928
59166
  }
@@ -58932,7 +59170,7 @@ function getUsageTimerCustomKeybinds(item, options = {}) {
58932
59170
  }
58933
59171
  return keybinds;
58934
59172
  }
58935
- var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
59173
+ var SLIDER_WIDTH = 10, PROGRESS_TOGGLE_KEYBIND, INVERT_TOGGLE_KEYBIND, COMPACT_TOGGLE_KEYBIND, CURSOR_TOGGLE_KEYBIND, DATE_TOGGLE_KEYBIND, HOUR_FORMAT_TOGGLE_KEYBIND, WEEKDAY_TOGGLE_KEYBIND, TIMEZONE_KEYBIND, LOCALE_KEYBIND;
58936
59174
  var init_usage_display = __esm(() => {
58937
59175
  init_locales2();
58938
59176
  PROGRESS_TOGGLE_KEYBIND = { key: "p", label: "(p)rogress toggle", action: "toggle-progress" };
@@ -58941,6 +59179,7 @@ var init_usage_display = __esm(() => {
58941
59179
  CURSOR_TOGGLE_KEYBIND = { key: "t", label: "(t)ime cursor", action: "toggle-cursor" };
58942
59180
  DATE_TOGGLE_KEYBIND = { key: "t", label: "(t)imestamp", action: "toggle-date" };
58943
59181
  HOUR_FORMAT_TOGGLE_KEYBIND = { key: "h", label: "12/24 (h)our", action: "toggle-hour-format" };
59182
+ WEEKDAY_TOGGLE_KEYBIND = { key: "w", label: "(w)eekday", action: "toggle-weekday" };
58944
59183
  TIMEZONE_KEYBIND = { key: "z", label: "time(z)one", action: "edit-timezone" };
58945
59184
  LOCALE_KEYBIND = { key: "l", label: "(l)ocale", action: "edit-locale" };
58946
59185
  });
@@ -59847,7 +60086,8 @@ class CustomCommandWidget {
59847
60086
  input: jsonInput,
59848
60087
  timeout,
59849
60088
  stdio: ["pipe", "pipe", "ignore"],
59850
- env: process.env
60089
+ env: process.env,
60090
+ windowsHide: true
59851
60091
  }).trim();
59852
60092
  if (!item.preserveColors) {
59853
60093
  output = getVisibleText(output);
@@ -60059,31 +60299,31 @@ var init_CustomCommand = __esm(async () => {
60059
60299
 
60060
60300
  // node_modules/fdir/dist/index.mjs
60061
60301
  import { createRequire as createRequire2 } from "module";
60062
- import { basename, dirname, normalize, relative, resolve, sep } from "path";
60302
+ import { basename, dirname as dirname2, normalize, relative, resolve as resolve2, sep } from "path";
60063
60303
  import * as nativeFs from "fs";
60064
- function cleanPath(path4) {
60065
- let normalized = normalize(path4);
60304
+ function cleanPath(path5) {
60305
+ let normalized = normalize(path5);
60066
60306
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
60067
60307
  normalized = normalized.substring(0, normalized.length - 1);
60068
60308
  return normalized;
60069
60309
  }
60070
- function convertSlashes(path4, separator) {
60071
- return path4.replace(SLASHES_REGEX, separator);
60310
+ function convertSlashes(path5, separator) {
60311
+ return path5.replace(SLASHES_REGEX, separator);
60072
60312
  }
60073
- function isRootDirectory(path4) {
60074
- return path4 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path4);
60313
+ function isRootDirectory(path5) {
60314
+ return path5 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path5);
60075
60315
  }
60076
- function normalizePath(path4, options) {
60316
+ function normalizePath(path5, options) {
60077
60317
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
60078
- const pathNeedsCleaning = process.platform === "win32" && path4.includes("/") || path4.startsWith(".");
60318
+ const pathNeedsCleaning = process.platform === "win32" && path5.includes("/") || path5.startsWith(".");
60079
60319
  if (resolvePaths)
60080
- path4 = resolve(path4);
60320
+ path5 = resolve2(path5);
60081
60321
  if (normalizePath$1 || pathNeedsCleaning)
60082
- path4 = cleanPath(path4);
60083
- if (path4 === ".")
60322
+ path5 = cleanPath(path5);
60323
+ if (path5 === ".")
60084
60324
  return "";
60085
- const needsSeperator = path4[path4.length - 1] !== pathSeparator;
60086
- return convertSlashes(needsSeperator ? path4 + pathSeparator : path4, pathSeparator);
60325
+ const needsSeperator = path5[path5.length - 1] !== pathSeparator;
60326
+ return convertSlashes(needsSeperator ? path5 + pathSeparator : path5, pathSeparator);
60087
60327
  }
60088
60328
  function joinPathWithBasePath(filename, directoryPath) {
60089
60329
  return directoryPath + filename;
@@ -60149,10 +60389,10 @@ function build$2(options, isSynchronous) {
60149
60389
  return null;
60150
60390
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
60151
60391
  }
60152
- function isRecursive(path4, resolved, state) {
60392
+ function isRecursive(path5, resolved, state) {
60153
60393
  if (state.options.useRealPaths)
60154
60394
  return isRecursiveUsingRealPaths(resolved, state);
60155
- let parent = dirname(path4);
60395
+ let parent = dirname2(path5);
60156
60396
  let depth = 1;
60157
60397
  while (parent !== state.root && depth < 2) {
60158
60398
  const resolvedPath = state.symlinks.get(parent);
@@ -60160,9 +60400,9 @@ function isRecursive(path4, resolved, state) {
60160
60400
  if (isSameRoot)
60161
60401
  depth++;
60162
60402
  else
60163
- parent = dirname(parent);
60403
+ parent = dirname2(parent);
60164
60404
  }
60165
- state.symlinks.set(path4, resolved);
60405
+ state.symlinks.set(path5, resolved);
60166
60406
  return depth > 1;
60167
60407
  }
60168
60408
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -60208,9 +60448,9 @@ function sync(root, options) {
60208
60448
  var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (directoryPath, paths) => {
60209
60449
  paths.push(directoryPath || ".");
60210
60450
  }, pushDirectoryFilter = (directoryPath, paths, filters) => {
60211
- const path4 = directoryPath || ".";
60212
- if (filters.every((filter2) => filter2(path4, true)))
60213
- paths.push(path4);
60451
+ const path5 = directoryPath || ".";
60452
+ if (filters.every((filter2) => filter2(path5, true)))
60453
+ paths.push(path5);
60214
60454
  }, empty$2 = () => {}, pushFileFilterAndCount = (filename, _paths, counts, filters) => {
60215
60455
  if (filters.every((filter2) => filter2(filename, false)))
60216
60456
  counts.files++;
@@ -60231,28 +60471,28 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60231
60471
  files,
60232
60472
  dir: directory
60233
60473
  });
60234
- }, empty = () => {}, resolveSymlinksAsync = function(path4, state, callback$1) {
60235
- const { queue, fs: fs4, options: { suppressErrors } } = state;
60474
+ }, empty = () => {}, resolveSymlinksAsync = function(path5, state, callback$1) {
60475
+ const { queue, fs: fs5, options: { suppressErrors } } = state;
60236
60476
  queue.enqueue();
60237
- fs4.realpath(path4, (error48, resolvedPath) => {
60477
+ fs5.realpath(path5, (error48, resolvedPath) => {
60238
60478
  if (error48)
60239
60479
  return queue.dequeue(suppressErrors ? null : error48, state);
60240
- fs4.stat(resolvedPath, (error$1, stat) => {
60480
+ fs5.stat(resolvedPath, (error$1, stat) => {
60241
60481
  if (error$1)
60242
60482
  return queue.dequeue(suppressErrors ? null : error$1, state);
60243
- if (stat.isDirectory() && isRecursive(path4, resolvedPath, state))
60483
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
60244
60484
  return queue.dequeue(null, state);
60245
60485
  callback$1(stat, resolvedPath);
60246
60486
  queue.dequeue(null, state);
60247
60487
  });
60248
60488
  });
60249
- }, resolveSymlinks = function(path4, state, callback$1) {
60250
- const { queue, fs: fs4, options: { suppressErrors } } = state;
60489
+ }, resolveSymlinks = function(path5, state, callback$1) {
60490
+ const { queue, fs: fs5, options: { suppressErrors } } = state;
60251
60491
  queue.enqueue();
60252
60492
  try {
60253
- const resolvedPath = fs4.realpathSync(path4);
60254
- const stat = fs4.statSync(resolvedPath);
60255
- if (stat.isDirectory() && isRecursive(path4, resolvedPath, state))
60493
+ const resolvedPath = fs5.realpathSync(path5);
60494
+ const stat = fs5.statSync(resolvedPath);
60495
+ if (stat.isDirectory() && isRecursive(path5, resolvedPath, state))
60256
60496
  return;
60257
60497
  callback$1(stat, resolvedPath);
60258
60498
  } catch (e) {
@@ -60283,22 +60523,22 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60283
60523
  state.queue.enqueue();
60284
60524
  if (currentDepth < 0)
60285
60525
  return state.queue.dequeue(null, state);
60286
- const { fs: fs4 } = state;
60526
+ const { fs: fs5 } = state;
60287
60527
  state.visited.push(crawlPath);
60288
60528
  state.counts.directories++;
60289
- fs4.readdir(crawlPath || ".", readdirOpts, (error48, entries = []) => {
60529
+ fs5.readdir(crawlPath || ".", readdirOpts, (error48, entries = []) => {
60290
60530
  callback$1(entries, directoryPath, currentDepth);
60291
60531
  state.queue.dequeue(state.options.suppressErrors ? null : error48, state);
60292
60532
  });
60293
60533
  }, walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
60294
- const { fs: fs4 } = state;
60534
+ const { fs: fs5 } = state;
60295
60535
  if (currentDepth < 0)
60296
60536
  return;
60297
60537
  state.visited.push(crawlPath);
60298
60538
  state.counts.directories++;
60299
60539
  let entries = [];
60300
60540
  try {
60301
- entries = fs4.readdirSync(crawlPath || ".", readdirOpts);
60541
+ entries = fs5.readdirSync(crawlPath || ".", readdirOpts);
60302
60542
  } catch (e) {
60303
60543
  if (!state.options.suppressErrors)
60304
60544
  throw e;
@@ -60397,23 +60637,23 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60397
60637
  const filename = this.joinPath(entry.name, directoryPath);
60398
60638
  this.pushFile(filename, files, this.state.counts, filters);
60399
60639
  } else if (entry.isDirectory()) {
60400
- let path4 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
60401
- if (exclude && exclude(entry.name, path4))
60640
+ let path5 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
60641
+ if (exclude && exclude(entry.name, path5))
60402
60642
  continue;
60403
- this.pushDirectory(path4, paths, filters);
60404
- this.walkDirectory(this.state, path4, path4, depth - 1, this.walk);
60643
+ this.pushDirectory(path5, paths, filters);
60644
+ this.walkDirectory(this.state, path5, path5, depth - 1, this.walk);
60405
60645
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
60406
- let path4 = joinPathWithBasePath(entry.name, directoryPath);
60407
- this.resolveSymlink(path4, this.state, (stat, resolvedPath) => {
60646
+ let path5 = joinPathWithBasePath(entry.name, directoryPath);
60647
+ this.resolveSymlink(path5, this.state, (stat, resolvedPath) => {
60408
60648
  if (stat.isDirectory()) {
60409
60649
  resolvedPath = normalizePath(resolvedPath, this.state.options);
60410
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path4 + pathSeparator))
60650
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path5 + pathSeparator))
60411
60651
  return;
60412
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path4 + pathSeparator, depth - 1, this.walk);
60652
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path5 + pathSeparator, depth - 1, this.walk);
60413
60653
  } else {
60414
- resolvedPath = useRealPaths ? resolvedPath : path4;
60654
+ resolvedPath = useRealPaths ? resolvedPath : path5;
60415
60655
  const filename = basename(resolvedPath);
60416
- const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
60656
+ const directoryPath$1 = normalizePath(dirname2(resolvedPath), this.state.options);
60417
60657
  resolvedPath = this.joinPath(filename, directoryPath$1);
60418
60658
  this.pushFile(resolvedPath, files, this.state.counts, filters);
60419
60659
  }
@@ -60547,7 +60787,7 @@ var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (director
60547
60787
  isMatch2 = globFn(patterns, ...options);
60548
60788
  this.globCache[patterns.join("\x00")] = isMatch2;
60549
60789
  }
60550
- this.options.filters.push((path4) => isMatch2(path4));
60790
+ this.options.filters.push((path5) => isMatch2(path5));
60551
60791
  return this;
60552
60792
  }
60553
60793
  };
@@ -60760,8 +61000,8 @@ var require_utils = __commonJS((exports) => {
60760
61000
  }
60761
61001
  return output;
60762
61002
  };
60763
- exports.basename = (path4, { windows } = {}) => {
60764
- const segs = path4.split(windows ? /[\\/]/ : "/");
61003
+ exports.basename = (path5, { windows } = {}) => {
61004
+ const segs = path5.split(windows ? /[\\/]/ : "/");
60765
61005
  const last2 = segs[segs.length - 1];
60766
61006
  if (last2 === "") {
60767
61007
  return segs[segs.length - 2];
@@ -62242,8 +62482,8 @@ var require_picomatch2 = __commonJS((exports, module) => {
62242
62482
  });
62243
62483
 
62244
62484
  // node_modules/tinyglobby/dist/index.mjs
62245
- import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync3 } from "fs";
62246
- import { isAbsolute, posix, resolve as resolve2 } from "path";
62485
+ import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync4 } from "fs";
62486
+ import { isAbsolute, posix, resolve as resolve3 } from "path";
62247
62487
  import { fileURLToPath } from "url";
62248
62488
  function getPartialMatcher(patterns, options = {}) {
62249
62489
  const patternsCount = patterns.length;
@@ -62315,10 +62555,10 @@ function buildRelative(cwd2, root) {
62315
62555
  return p[p.length - 1] === "/" && result2 !== "" ? `${result2}/` : result2 || ".";
62316
62556
  };
62317
62557
  }
62318
- function splitPattern(path4) {
62558
+ function splitPattern(path5) {
62319
62559
  var _result$parts;
62320
- const result2 = import_picomatch.default.scan(path4, splitPatternOptions);
62321
- return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [path4];
62560
+ const result2 = import_picomatch.default.scan(path5, splitPatternOptions);
62561
+ return ((_result$parts = result2.parts) === null || _result$parts === undefined ? undefined : _result$parts.length) ? result2.parts : [path5];
62322
62562
  }
62323
62563
  function isDynamicPattern(pattern, options) {
62324
62564
  if ((options === null || options === undefined ? undefined : options.caseSensitiveMatch) === false)
@@ -62434,14 +62674,14 @@ function buildCrawler(options, patterns) {
62434
62674
  maxDepth = Math.round(options.deep - props.depthOffset);
62435
62675
  const crawler = new Builder({
62436
62676
  filters: [debug3 ? (p, isDirectory) => {
62437
- const path4 = format(p, isDirectory);
62438
- const matches2 = matcher(path4) && !ignore(path4);
62677
+ const path5 = format(p, isDirectory);
62678
+ const matches2 = matcher(path5) && !ignore(path5);
62439
62679
  if (matches2)
62440
- log(`matched ${path4}`);
62680
+ log(`matched ${path5}`);
62441
62681
  return matches2;
62442
62682
  } : (p, isDirectory) => {
62443
- const path4 = format(p, isDirectory);
62444
- return matcher(path4) && !ignore(path4);
62683
+ const path5 = format(p, isDirectory);
62684
+ return matcher(path5) && !ignore(path5);
62445
62685
  }],
62446
62686
  exclude: debug3 ? (_, p) => {
62447
62687
  const skipped = excludePredicate(_, p);
@@ -62478,7 +62718,7 @@ function getOptions2(options) {
62478
62718
  ...defaultOptions,
62479
62719
  ...options
62480
62720
  };
62481
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve2(opts.cwd)).replace(BACKSLASHES, "/");
62721
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve3(opts.cwd)).replace(BACKSLASHES, "/");
62482
62722
  opts.ignore = ensureStringArray(opts.ignore);
62483
62723
  opts.fs && (opts.fs = {
62484
62724
  readdir: opts.fs.readdir || readdir,
@@ -62486,7 +62726,7 @@ function getOptions2(options) {
62486
62726
  realpath: opts.fs.realpath || realpath,
62487
62727
  realpathSync: opts.fs.realpathSync || realpathSync,
62488
62728
  stat: opts.fs.stat || stat,
62489
- statSync: opts.fs.statSync || statSync3
62729
+ statSync: opts.fs.statSync || statSync4
62490
62730
  });
62491
62731
  if (opts.debug)
62492
62732
  log("globbing with options:", opts);
@@ -62505,7 +62745,7 @@ function globSync(globInput, options) {
62505
62745
  const [crawler, relative2] = getCrawler(globInput, options);
62506
62746
  return crawler ? formatPaths(crawler.sync(), relative2) : [];
62507
62747
  }
62508
- var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path4) => path4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path4) => path4.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
62748
+ var import_picomatch, isReadonlyArray, BACKSLASHES, isWin, ONLY_PARENT_DIRECTORIES, WIN32_ROOT_DIR, isRoot, splitPatternOptions, POSIX_UNESCAPED_GLOB_SYMBOLS, WIN32_UNESCAPED_GLOB_SYMBOLS, escapePosixPath = (path5) => path5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapeWin32Path = (path5) => path5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), escapePath, PARENT_DIRECTORY, ESCAPING_BACKSLASHES, defaultOptions;
62509
62749
  var init_dist7 = __esm(() => {
62510
62750
  init_dist6();
62511
62751
  import_picomatch = __toESM(require_picomatch2(), 1);
@@ -62532,7 +62772,7 @@ var init_dist7 = __esm(() => {
62532
62772
  });
62533
62773
 
62534
62774
  // src/utils/jsonl-lines.ts
62535
- import * as fs4 from "fs";
62775
+ import * as fs5 from "fs";
62536
62776
  import { promisify } from "util";
62537
62777
  function splitJsonlContent(content) {
62538
62778
  return content.trim().split(`
@@ -62543,7 +62783,7 @@ async function readJsonlLines(filePath) {
62543
62783
  return splitJsonlContent(content);
62544
62784
  }
62545
62785
  function readJsonlLinesSync(filePath) {
62546
- const content = readFileSync6(filePath, "utf-8");
62786
+ const content = readFileSync7(filePath, "utf-8");
62547
62787
  return splitJsonlContent(content);
62548
62788
  }
62549
62789
  function parseJsonlLine(line) {
@@ -62553,15 +62793,15 @@ function parseJsonlLine(line) {
62553
62793
  return null;
62554
62794
  }
62555
62795
  }
62556
- var readFile2, readFileSync6;
62796
+ var readFile2, readFileSync7;
62557
62797
  var init_jsonl_lines = __esm(() => {
62558
- readFile2 = promisify(fs4.readFile);
62559
- readFileSync6 = fs4.readFileSync;
62798
+ readFile2 = promisify(fs5.readFile);
62799
+ readFileSync7 = fs5.readFileSync;
62560
62800
  });
62561
62801
 
62562
62802
  // src/utils/jsonl-blocks.ts
62563
- import * as fs5 from "fs";
62564
- import path4 from "node:path";
62803
+ import * as fs6 from "fs";
62804
+ import path5 from "node:path";
62565
62805
  function getBlockMetrics() {
62566
62806
  const claudeDir = getClaudeConfigDir();
62567
62807
  if (!claudeDir)
@@ -62575,7 +62815,7 @@ function getBlockMetrics() {
62575
62815
  function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
62576
62816
  const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
62577
62817
  const now2 = new Date;
62578
- const pattern = path4.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
62818
+ const pattern = path5.posix.join(rootDir.replace(/\\/g, "/"), "projects", "**", "*.jsonl");
62579
62819
  const files = globSync([pattern], {
62580
62820
  absolute: true,
62581
62821
  cwd: rootDir
@@ -62583,7 +62823,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
62583
62823
  if (files.length === 0)
62584
62824
  return null;
62585
62825
  const filesWithStats = files.map((file2) => {
62586
- const stats = statSync5(file2);
62826
+ const stats = statSync6(file2);
62587
62827
  return { file: file2, mtime: stats.mtime };
62588
62828
  });
62589
62829
  filesWithStats.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
@@ -62701,26 +62941,26 @@ function floorToHour(timestamp) {
62701
62941
  floored.setUTCMinutes(0, 0, 0);
62702
62942
  return floored;
62703
62943
  }
62704
- var statSync5;
62944
+ var statSync6;
62705
62945
  var init_jsonl_blocks = __esm(async () => {
62706
62946
  init_dist7();
62707
62947
  init_jsonl_lines();
62708
62948
  await init_claude_settings();
62709
- statSync5 = fs5.statSync;
62949
+ statSync6 = fs6.statSync;
62710
62950
  });
62711
62951
 
62712
62952
  // src/utils/jsonl-cache.ts
62713
- import * as fs6 from "fs";
62714
- import { createHash as createHash2 } from "node:crypto";
62715
- import os5 from "node:os";
62716
- import path5 from "node:path";
62953
+ import * as fs7 from "fs";
62954
+ import { createHash as createHash3 } from "node:crypto";
62955
+ import os6 from "node:os";
62956
+ import path6 from "node:path";
62717
62957
  function normalizeConfigDir(configDir) {
62718
- return path5.resolve(configDir);
62958
+ return path6.resolve(configDir);
62719
62959
  }
62720
62960
  function getBlockCachePath(configDir = getClaudeConfigDir()) {
62721
62961
  const normalizedConfigDir = normalizeConfigDir(configDir);
62722
- const configHash = createHash2("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
62723
- return path5.join(os5.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
62962
+ const configHash = createHash3("sha256").update(normalizedConfigDir).digest("hex").slice(0, 16);
62963
+ return path6.join(os6.homedir(), ".cache", "ccstatusline", `block-cache-${configHash}.json`);
62724
62964
  }
62725
62965
  function readBlockCache(expectedConfigDir) {
62726
62966
  try {
@@ -62729,7 +62969,7 @@ function readBlockCache(expectedConfigDir) {
62729
62969
  if (!existsSync6(cachePath)) {
62730
62970
  return null;
62731
62971
  }
62732
- const content = readFileSync8(cachePath, "utf-8");
62972
+ const content = readFileSync9(cachePath, "utf-8");
62733
62973
  const cache3 = JSON.parse(content);
62734
62974
  if (typeof cache3.startTime !== "string") {
62735
62975
  return null;
@@ -62755,15 +62995,15 @@ function writeBlockCache(startTime, configDir = getClaudeConfigDir()) {
62755
62995
  try {
62756
62996
  const normalizedConfigDir = normalizeConfigDir(configDir);
62757
62997
  const cachePath = getBlockCachePath(normalizedConfigDir);
62758
- const cacheDir = path5.dirname(cachePath);
62998
+ const cacheDir = path6.dirname(cachePath);
62759
62999
  if (!existsSync6(cacheDir)) {
62760
- mkdirSync4(cacheDir, { recursive: true });
63000
+ mkdirSync5(cacheDir, { recursive: true });
62761
63001
  }
62762
63002
  const cache3 = {
62763
63003
  startTime: startTime.toISOString(),
62764
63004
  configDir: normalizedConfigDir
62765
63005
  };
62766
- writeFileSync4(cachePath, JSON.stringify(cache3), "utf-8");
63006
+ writeFileSync5(cachePath, JSON.stringify(cache3), "utf-8");
62767
63007
  } catch {}
62768
63008
  }
62769
63009
  function getCachedBlockMetrics(sessionDurationHours = 5) {
@@ -62786,21 +63026,21 @@ function getCachedBlockMetrics(sessionDurationHours = 5) {
62786
63026
  }
62787
63027
  return metrics;
62788
63028
  }
62789
- var readFileSync8, writeFileSync4, mkdirSync4, existsSync6;
63029
+ var readFileSync9, writeFileSync5, mkdirSync5, existsSync6;
62790
63030
  var init_jsonl_cache = __esm(async () => {
62791
63031
  await __promiseAll([
62792
63032
  init_claude_settings(),
62793
63033
  init_jsonl_blocks()
62794
63034
  ]);
62795
- readFileSync8 = fs6.readFileSync;
62796
- writeFileSync4 = fs6.writeFileSync;
62797
- mkdirSync4 = fs6.mkdirSync;
62798
- existsSync6 = fs6.existsSync;
63035
+ readFileSync9 = fs7.readFileSync;
63036
+ writeFileSync5 = fs7.writeFileSync;
63037
+ mkdirSync5 = fs7.mkdirSync;
63038
+ existsSync6 = fs7.existsSync;
62799
63039
  });
62800
63040
 
62801
63041
  // src/utils/jsonl-metrics.ts
62802
- import * as fs7 from "fs";
62803
- import path6 from "node:path";
63042
+ import * as fs8 from "fs";
63043
+ import path7 from "node:path";
62804
63044
  function collectAgentIds(value, agentIds) {
62805
63045
  if (!value || typeof value !== "object") {
62806
63046
  return;
@@ -62832,7 +63072,7 @@ function getReferencedSubagentIds(lines) {
62832
63072
  }
62833
63073
  async function getSessionDuration(transcriptPath) {
62834
63074
  try {
62835
- if (!fs7.existsSync(transcriptPath)) {
63075
+ if (!fs8.existsSync(transcriptPath)) {
62836
63076
  return null;
62837
63077
  }
62838
63078
  const lines = await readJsonlLines(transcriptPath);
@@ -62882,7 +63122,7 @@ async function getSessionDuration(transcriptPath) {
62882
63122
  }
62883
63123
  async function getTokenMetrics(transcriptPath) {
62884
63124
  try {
62885
- if (!fs7.existsSync(transcriptPath)) {
63125
+ if (!fs8.existsSync(transcriptPath)) {
62886
63126
  return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, totalTokens: 0, contextLength: 0 };
62887
63127
  }
62888
63128
  const lines = await readJsonlLines(transcriptPath);
@@ -63096,20 +63336,20 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
63096
63336
  if (referencedAgentIds.size === 0) {
63097
63337
  return [];
63098
63338
  }
63099
- const transcriptDir = path6.dirname(transcriptPath);
63100
- const transcriptStem = path6.parse(transcriptPath).name;
63339
+ const transcriptDir = path7.dirname(transcriptPath);
63340
+ const transcriptStem = path7.parse(transcriptPath).name;
63101
63341
  const candidateDirs = [
63102
- path6.join(transcriptDir, "subagents"),
63103
- path6.join(transcriptDir, transcriptStem, "subagents")
63342
+ path7.join(transcriptDir, "subagents"),
63343
+ path7.join(transcriptDir, transcriptStem, "subagents")
63104
63344
  ];
63105
63345
  const seenPaths = new Set;
63106
63346
  const matchedPaths = [];
63107
63347
  for (const subagentsDir of candidateDirs) {
63108
- if (!fs7.existsSync(subagentsDir)) {
63348
+ if (!fs8.existsSync(subagentsDir)) {
63109
63349
  continue;
63110
63350
  }
63111
63351
  try {
63112
- const dirEntries = fs7.readdirSync(subagentsDir, { withFileTypes: true });
63352
+ const dirEntries = fs8.readdirSync(subagentsDir, { withFileTypes: true });
63113
63353
  for (const entry of dirEntries) {
63114
63354
  if (!entry.isFile()) {
63115
63355
  continue;
@@ -63121,7 +63361,7 @@ function getSubagentTranscriptPaths(transcriptPath, referencedAgentIds) {
63121
63361
  if (!referencedAgentIds.has(match[1])) {
63122
63362
  continue;
63123
63363
  }
63124
- const fullPath = path6.join(subagentsDir, entry.name);
63364
+ const fullPath = path7.join(subagentsDir, entry.name);
63125
63365
  if (seenPaths.has(fullPath)) {
63126
63366
  continue;
63127
63367
  }
@@ -63138,7 +63378,7 @@ async function getSpeedMetricsCollection(transcriptPath, options = {}) {
63138
63378
  const normalizedWindows = Array.from(new Set((options.windowSeconds ?? []).map((window2) => normalizeWindowSeconds(window2)).filter((window2) => window2 !== null)));
63139
63379
  const emptyWindowedMetrics = buildEmptyWindowedMetrics(normalizedWindows);
63140
63380
  try {
63141
- if (!fs7.existsSync(transcriptPath)) {
63381
+ if (!fs8.existsSync(transcriptPath)) {
63142
63382
  return {
63143
63383
  sessionAverage: createEmptySpeedMetrics(),
63144
63384
  windowed: emptyWindowedMetrics
@@ -63335,44 +63575,69 @@ function formatUsageDuration(durationMs, compact2 = false, useDays = true) {
63335
63575
  function pad2(value) {
63336
63576
  return value.toString().padStart(2, "0");
63337
63577
  }
63338
- function formatResetAtUtc(date5, compact2, hour12) {
63578
+ function formatResetAtUtc(date5, compact2, hour12, weekday = false) {
63339
63579
  const year = date5.getUTCFullYear();
63340
63580
  const month = pad2(date5.getUTCMonth() + 1);
63341
63581
  const day = pad2(date5.getUTCDate());
63342
63582
  const hours = pad2(date5.getUTCHours());
63343
63583
  const minutes = pad2(date5.getUTCMinutes());
63584
+ const weekdayName = weekday ? UTC_WEEKDAY_NAMES[date5.getUTCDay()] : "";
63344
63585
  if (hour12) {
63345
63586
  const hour = date5.getUTCHours();
63346
63587
  const displayHour = hour % 12 || 12;
63347
63588
  const period = hour >= 12 ? "PM" : "AM";
63589
+ if (weekday) {
63590
+ return compact2 ? `${weekdayName} ${displayHour}:${minutes} ${period}Z` : `${weekdayName} ${displayHour}:${minutes} ${period} UTC`;
63591
+ }
63348
63592
  return compact2 ? `${month}-${day} ${displayHour}:${minutes} ${period}Z` : `${year}-${month}-${day} ${displayHour}:${minutes} ${period} UTC`;
63349
63593
  }
63594
+ if (weekday) {
63595
+ return compact2 ? `${weekdayName} ${hours}:${minutes}Z` : `${weekdayName} ${hours}:${minutes} UTC`;
63596
+ }
63350
63597
  return compact2 ? `${month}-${day} ${hours}:${minutes}Z` : `${year}-${month}-${day} ${hours}:${minutes} UTC`;
63351
63598
  }
63352
63599
  function normalizeDayPeriod(dayPeriod) {
63353
63600
  return dayPeriod.replace(/\./g, "").toUpperCase();
63354
63601
  }
63355
- function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
63602
+ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12, weekday = false) {
63356
63603
  try {
63357
- const formatter = new Intl.DateTimeFormat(locale, {
63604
+ const options = {
63358
63605
  timeZone: timezone,
63359
- year: "numeric",
63360
- month: "2-digit",
63361
- day: "2-digit",
63362
63606
  hour: "2-digit",
63363
63607
  minute: "2-digit",
63364
63608
  hour12,
63365
63609
  timeZoneName: "short"
63366
- });
63610
+ };
63611
+ if (weekday) {
63612
+ options.weekday = "short";
63613
+ } else {
63614
+ options.year = "numeric";
63615
+ options.month = "2-digit";
63616
+ options.day = "2-digit";
63617
+ }
63618
+ const formatter = new Intl.DateTimeFormat(locale, options);
63367
63619
  const parts = formatter.formatToParts(date5);
63368
63620
  const get2 = (type) => parts.find((p) => p.type === type)?.value ?? "";
63369
- const year = get2("year");
63370
- const month = get2("month");
63371
- const day = get2("day");
63372
63621
  const hour = get2("hour");
63373
63622
  const minute = get2("minute");
63374
63623
  const dayPeriod = get2("dayPeriod");
63375
63624
  const tzName = get2("timeZoneName");
63625
+ if (weekday) {
63626
+ const weekdayName = get2("weekday");
63627
+ if (!weekdayName || !hour || !minute) {
63628
+ return null;
63629
+ }
63630
+ if (hour12) {
63631
+ const displayHour = hour.startsWith("0") ? hour.slice(1) : hour;
63632
+ const normalizedDayPeriod = dayPeriod ? normalizeDayPeriod(dayPeriod) : "";
63633
+ const time3 = `${displayHour}:${minute}${normalizedDayPeriod ? ` ${normalizedDayPeriod}` : ""}`;
63634
+ return compact2 ? `${weekdayName} ${time3}` : `${weekdayName} ${time3} ${tzName}`;
63635
+ }
63636
+ return compact2 ? `${weekdayName} ${hour}:${minute}` : `${weekdayName} ${hour}:${minute} ${tzName}`;
63637
+ }
63638
+ const year = get2("year");
63639
+ const month = get2("month");
63640
+ const day = get2("day");
63376
63641
  if (!year || !month || !day || !hour || !minute) {
63377
63642
  return null;
63378
63643
  }
@@ -63387,7 +63652,7 @@ function formatResetAtInTimezone(date5, compact2, timezone, locale, hour12) {
63387
63652
  return null;
63388
63653
  }
63389
63654
  }
63390
- function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false) {
63655
+ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12, hour12Arg = false, weekday = false) {
63391
63656
  if (!resetAt) {
63392
63657
  return null;
63393
63658
  }
@@ -63399,21 +63664,21 @@ function formatUsageResetAt(resetAt, compact2 = false, timezone, localeOrHour12,
63399
63664
  const locale = typeof localeOrHour12 === "string" ? localeOrHour12 : undefined;
63400
63665
  const hour12 = typeof localeOrHour12 === "boolean" ? localeOrHour12 : hour12Arg;
63401
63666
  if (!timezone || timezone === "UTC") {
63402
- return formatResetAtUtc(date5, compact2, hour12);
63667
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
63403
63668
  }
63404
63669
  const resolvedTimezone = timezone === "local" ? undefined : timezone;
63405
63670
  const resolvedLocale = locale && locale.length > 0 ? locale : DEFAULT_TZ_LOCALE;
63406
- const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12);
63671
+ const localized = formatResetAtInTimezone(date5, compact2, resolvedTimezone, resolvedLocale, hour12, weekday);
63407
63672
  if (localized) {
63408
63673
  return localized;
63409
63674
  }
63410
63675
  if (resolvedLocale !== DEFAULT_TZ_LOCALE) {
63411
- const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12);
63676
+ const fallback = formatResetAtInTimezone(date5, compact2, resolvedTimezone, DEFAULT_TZ_LOCALE, hour12, weekday);
63412
63677
  if (fallback) {
63413
63678
  return fallback;
63414
63679
  }
63415
63680
  }
63416
- return formatResetAtUtc(date5, compact2, hour12);
63681
+ return formatResetAtUtc(date5, compact2, hour12, weekday);
63417
63682
  }
63418
63683
  function getUsageErrorMessage(error48) {
63419
63684
  switch (error48) {
@@ -63444,10 +63709,11 @@ function makePendulumBar(delta, halfWidth = 7) {
63444
63709
  }
63445
63710
  return "[" + "░".repeat(halfWidth) + "|" + "█".repeat(fill2) + "░".repeat(halfWidth - fill2) + "]";
63446
63711
  }
63447
- var DEFAULT_TZ_LOCALE = "en-US", DARK_RED_OPEN = "\x1B[38;2;204;0;0m", DARK_RED_CLOSE = "\x1B[39m";
63712
+ var UTC_WEEKDAY_NAMES, DEFAULT_TZ_LOCALE = "en-US", DARK_RED_OPEN = "\x1B[38;2;204;0;0m", DARK_RED_CLOSE = "\x1B[39m";
63448
63713
  var init_usage_windows = __esm(async () => {
63449
63714
  init_usage_types();
63450
63715
  await init_jsonl();
63716
+ UTC_WEEKDAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
63451
63717
  });
63452
63718
 
63453
63719
  // src/utils/usage.ts
@@ -63563,7 +63829,7 @@ var init_BlockTimer = __esm(async () => {
63563
63829
  });
63564
63830
 
63565
63831
  // src/widgets/CurrentWorkingDir.tsx
63566
- import * as os6 from "node:os";
63832
+ import * as os7 from "node:os";
63567
63833
 
63568
63834
  class CurrentWorkingDirWidget {
63569
63835
  getDefaultColor() {
@@ -63708,27 +63974,27 @@ class CurrentWorkingDirWidget {
63708
63974
  supportsColors(item) {
63709
63975
  return true;
63710
63976
  }
63711
- abbreviateHomeDir(path7) {
63712
- const homeDir = os6.homedir();
63713
- if (path7 === homeDir) {
63977
+ abbreviateHomeDir(path8) {
63978
+ const homeDir = os7.homedir();
63979
+ if (path8 === homeDir) {
63714
63980
  return "~";
63715
63981
  }
63716
- if (path7.startsWith(homeDir)) {
63717
- const boundaryChar = path7[homeDir.length];
63982
+ if (path8.startsWith(homeDir)) {
63983
+ const boundaryChar = path8[homeDir.length];
63718
63984
  if (boundaryChar !== "/" && boundaryChar !== "\\") {
63719
- return path7;
63985
+ return path8;
63720
63986
  }
63721
- return "~" + path7.slice(homeDir.length);
63987
+ return "~" + path8.slice(homeDir.length);
63722
63988
  }
63723
- return path7;
63989
+ return path8;
63724
63990
  }
63725
- abbreviatePath(path7) {
63726
- const homeDir = os6.homedir();
63727
- const useBackslash = path7.includes("\\") && !path7.includes("/");
63991
+ abbreviatePath(path8) {
63992
+ const homeDir = os7.homedir();
63993
+ const useBackslash = path8.includes("\\") && !path8.includes("/");
63728
63994
  const sep2 = useBackslash ? "\\" : "/";
63729
- let normalizedPath = path7;
63730
- if (path7.startsWith(homeDir)) {
63731
- normalizedPath = "~" + path7.slice(homeDir.length);
63995
+ let normalizedPath = path8;
63996
+ if (path8.startsWith(homeDir)) {
63997
+ normalizedPath = "~" + path8.slice(homeDir.length);
63732
63998
  }
63733
63999
  const parts = normalizedPath.split(/[\\/]+/).filter((part) => part !== "");
63734
64000
  const abbreviated = parts.map((part, index) => {
@@ -63863,6 +64129,7 @@ function runJjArgs(args, context, allowEmpty = false) {
63863
64129
  const output = execFileSync4("jj", args, {
63864
64130
  encoding: "utf8",
63865
64131
  stdio: ["pipe", "pipe", "ignore"],
64132
+ windowsHide: true,
63866
64133
  ...cwd2 ? { cwd: cwd2 } : {}
63867
64134
  }).trimEnd();
63868
64135
  return allowEmpty || output.length > 0 ? output : null;
@@ -64500,7 +64767,7 @@ var init_JjRevision = __esm(() => {
64500
64767
  });
64501
64768
 
64502
64769
  // src/widgets/ClaudeAccountEmail.ts
64503
- import * as fs8 from "fs";
64770
+ import * as fs9 from "fs";
64504
64771
 
64505
64772
  class ClaudeAccountEmailWidget {
64506
64773
  getDefaultColor() {
@@ -64523,7 +64790,7 @@ class ClaudeAccountEmailWidget {
64523
64790
  return item.rawValue ? "you@example.com" : "Account: you@example.com";
64524
64791
  }
64525
64792
  try {
64526
- const content = fs8.readFileSync(getClaudeJsonPath(), "utf-8");
64793
+ const content = fs9.readFileSync(getClaudeJsonPath(), "utf-8");
64527
64794
  const data = JSON.parse(content);
64528
64795
  const email3 = data.oauthAccount?.emailAddress;
64529
64796
  if (typeof email3 !== "string" || email3.length === 0) {
@@ -64877,7 +65144,7 @@ var init_TotalSpeed = __esm(async () => {
64877
65144
 
64878
65145
  // src/widgets/FreeMemory.ts
64879
65146
  import { execSync as execSync3 } from "child_process";
64880
- import os7 from "os";
65147
+ import os8 from "os";
64881
65148
  function formatBytes(bytes) {
64882
65149
  const GB = 1024 ** 3;
64883
65150
  const MB = 1024 ** 2;
@@ -64892,7 +65159,7 @@ function formatBytes(bytes) {
64892
65159
  }
64893
65160
  function getUsedMemoryMacOS() {
64894
65161
  try {
64895
- const output = execSync3("vm_stat", { encoding: "utf8" });
65162
+ const output = execSync3("vm_stat", { encoding: "utf8", windowsHide: true });
64896
65163
  const lines = output.split(`
64897
65164
  `);
64898
65165
  const firstLine = lines[0];
@@ -64941,12 +65208,12 @@ class FreeMemoryWidget {
64941
65208
  if (context.isPreview) {
64942
65209
  return item.rawValue ? "12.4G/16.0G" : "Mem: 12.4G/16.0G";
64943
65210
  }
64944
- const total = os7.totalmem();
65211
+ const total = os8.totalmem();
64945
65212
  let used;
64946
- if (os7.platform() === "darwin") {
64947
- used = getUsedMemoryMacOS() ?? total - os7.freemem();
65213
+ if (os8.platform() === "darwin") {
65214
+ used = getUsedMemoryMacOS() ?? total - os8.freemem();
64948
65215
  } else {
64949
- used = total - os7.freemem();
65216
+ used = total - os8.freemem();
64950
65217
  }
64951
65218
  const value = `${formatBytes(used)}/${formatBytes(total)}`;
64952
65219
  return item.rawValue ? value : `Mem: ${value}`;
@@ -64961,7 +65228,7 @@ class FreeMemoryWidget {
64961
65228
  var init_FreeMemory = () => {};
64962
65229
 
64963
65230
  // src/widgets/SessionName.ts
64964
- import * as fs9 from "fs";
65231
+ import * as fs10 from "fs";
64965
65232
 
64966
65233
  class SessionNameWidget {
64967
65234
  getDefaultColor() {
@@ -64988,7 +65255,7 @@ class SessionNameWidget {
64988
65255
  return null;
64989
65256
  }
64990
65257
  try {
64991
- const content = fs9.readFileSync(transcriptPath, "utf-8");
65258
+ const content = fs10.readFileSync(transcriptPath, "utf-8");
64992
65259
  const lines = content.split(`
64993
65260
  `);
64994
65261
  for (let i = lines.length - 1;i >= 0; i--) {
@@ -65552,9 +65819,9 @@ class SessionUsageWidget {
65552
65819
  return null;
65553
65820
  const extraUsed = data.extraUsageUsed;
65554
65821
  const extraLimit = data.extraUsageLimit;
65555
- if (size2 !== "mobile" && data.extraUsageEnabled === true && extraUsed !== undefined && extraLimit !== undefined && data.sessionUsage >= 100 && (data.weeklyUsage === undefined || data.weeklyUsage < 100)) {
65822
+ if (data.extraUsageEnabled === true && extraUsed !== undefined && extraLimit !== undefined && data.sessionUsage >= 100 && (data.weeklyUsage === undefined || data.weeklyUsage < 100)) {
65556
65823
  const extraPercent = computeExtraPercent(extraUsed, extraLimit);
65557
- return formatSplitUsageBar("Session", "S", extraPercent, size2);
65824
+ return formatSplitUsageBar("Session", "S", extraPercent, size2, extraUsed, extraLimit);
65558
65825
  }
65559
65826
  return formatUsageBar("Session", "S", data.sessionUsage, size2);
65560
65827
  }
@@ -65728,6 +65995,9 @@ class ContextBarWidget {
65728
65995
  const u = cw.current_usage;
65729
65996
  used = (Number(u.input_tokens) || 0) + (Number(u.output_tokens) || 0) + (Number(u.cache_creation_input_tokens) || 0) + (Number(u.cache_read_input_tokens) || 0);
65730
65997
  }
65998
+ if (used === 0 && context.tokenMetrics && context.tokenMetrics.contextLength > 0) {
65999
+ used = context.tokenMetrics.contextLength;
66000
+ }
65731
66001
  if (isNaN(total) || isNaN(used))
65732
66002
  return null;
65733
66003
  const percent = total > 0 ? used / total * 100 : 0;
@@ -65746,7 +66016,7 @@ class ContextBarWidget {
65746
66016
  return true;
65747
66017
  }
65748
66018
  }
65749
- var DARK_RED_OPEN2 = "\x1B[38;2;204;0;0m", DARK_RED_CLOSE2 = "\x1B[39m", MOBILE_THRESHOLD = 134, MEDIUM_THRESHOLD2 = 178, MOBILE_BAR_WIDTH = 4, MEDIUM_BAR_WIDTH = 8, DEFAULT_BAR_WIDTH = 15;
66019
+ var DARK_RED_OPEN2 = "\x1B[38;2;204;0;0m", DARK_RED_CLOSE2 = "\x1B[39m", MOBILE_THRESHOLD = 134, MEDIUM_THRESHOLD2 = 178, MOBILE_BAR_WIDTH = 4, MEDIUM_BAR_WIDTH = 8, DEFAULT_BAR_WIDTH = 16;
65750
66020
  var init_ApiUsage = __esm(async () => {
65751
66021
  init_model_context2();
65752
66022
  init_usage_display();
@@ -65758,6 +66028,37 @@ var init_ApiUsage = __esm(async () => {
65758
66028
  ]);
65759
66029
  });
65760
66030
 
66031
+ // src/widgets/shared/extra-usage-disabled.ts
66032
+ function isHideExtraUsageDisabledEnabled(item) {
66033
+ return isMetadataFlagEnabled(item, HIDE_DISABLED_KEY);
66034
+ }
66035
+ function handleToggleExtraUsageDisabledAction(action, item) {
66036
+ if (action !== TOGGLE_HIDE_DISABLED_ACTION) {
66037
+ return null;
66038
+ }
66039
+ return toggleMetadataFlag(item, HIDE_DISABLED_KEY);
66040
+ }
66041
+ function getHideExtraUsageDisabledKeybind() {
66042
+ return HIDE_DISABLED_KEYBIND;
66043
+ }
66044
+ function appendHideDisabledModifier(modifierText, item) {
66045
+ if (!isHideExtraUsageDisabledEnabled(item)) {
66046
+ return modifierText;
66047
+ }
66048
+ if (!modifierText) {
66049
+ return "(hide if disabled)";
66050
+ }
66051
+ return `${modifierText.slice(0, -1)}, hide if disabled)`;
66052
+ }
66053
+ var HIDE_DISABLED_KEY = "hideIfDisabled", TOGGLE_HIDE_DISABLED_ACTION = "toggle-hide-disabled", HIDE_DISABLED_KEYBIND;
66054
+ var init_extra_usage_disabled = __esm(() => {
66055
+ HIDE_DISABLED_KEYBIND = {
66056
+ key: "h",
66057
+ label: "(h)ide if disabled",
66058
+ action: TOGGLE_HIDE_DISABLED_ACTION
66059
+ };
66060
+ });
66061
+
65761
66062
  // src/widgets/shared/progress-bar.ts
65762
66063
  function makeTimerProgressBar2(percent, width, options) {
65763
66064
  const clampedPercent = Math.max(0, Math.min(100, percent));
@@ -65776,16 +66077,16 @@ function makeTimerProgressBar2(percent, width, options) {
65776
66077
  return bar;
65777
66078
  }
65778
66079
 
65779
- // src/widgets/WeeklySonnetUsage.ts
65780
- class WeeklySonnetUsageWidget {
66080
+ // src/widgets/ExtraUsageUtilization.ts
66081
+ class ExtraUsageUtilizationWidget {
65781
66082
  getDefaultColor() {
65782
- return "brightBlue";
66083
+ return "green";
65783
66084
  }
65784
66085
  getDescription() {
65785
- return "Shows weekly Sonnet API usage percentage";
66086
+ return "Shows extra usage (pay-as-you-go) utilization percentage";
65786
66087
  }
65787
66088
  getDisplayName() {
65788
- return "Weekly Sonnet Usage";
66089
+ return "Extra Usage Utilization";
65789
66090
  }
65790
66091
  getCategory() {
65791
66092
  return "Usage";
@@ -65793,70 +66094,65 @@ class WeeklySonnetUsageWidget {
65793
66094
  getEditorDisplay(item) {
65794
66095
  return {
65795
66096
  displayText: this.getDisplayName(),
65796
- modifierText: getUsageDisplayModifierText(item)
66097
+ modifierText: appendHideDisabledModifier(getUsageDisplayModifierText(item), item)
65797
66098
  };
65798
66099
  }
65799
66100
  handleEditorAction(action, item) {
66101
+ const hideDisabledItem = handleToggleExtraUsageDisabledAction(action, item);
66102
+ if (hideDisabledItem) {
66103
+ return hideDisabledItem;
66104
+ }
65800
66105
  if (action === "toggle-progress") {
65801
66106
  return cycleUsageDisplayMode(item, [], true);
65802
66107
  }
65803
66108
  if (action === "toggle-invert") {
65804
66109
  return toggleUsageInverted(item);
65805
66110
  }
65806
- if (action === "toggle-cursor") {
65807
- return toggleUsageCursor(item);
65808
- }
65809
66111
  return null;
65810
66112
  }
65811
66113
  render(item, context, settings) {
65812
66114
  const displayMode = getUsageDisplayMode(item);
65813
66115
  const inverted = isUsageInverted(item);
65814
- const showCursor = isUsageCursorEnabled(item);
65815
66116
  if (context.isPreview) {
65816
- const previewPercent = 8;
66117
+ const previewPercent = 2.6;
65817
66118
  const renderedPercent2 = inverted ? 100 - previewPercent : previewPercent;
65818
66119
  if (isUsageProgressMode(displayMode)) {
65819
66120
  const width = getUsageProgressBarWidth(displayMode);
65820
- const progressBar = makeTimerProgressBar2(renderedPercent2, width, showCursor ? { cursorPercent: 50 } : undefined);
65821
- const progressDisplay = `[${progressBar}] ${renderedPercent2.toFixed(1)}%`;
65822
- return formatRawOrLabeledValue(item, LABEL, progressDisplay);
66121
+ const progressBar = makeTimerProgressBar2(renderedPercent2, width);
66122
+ return formatRawOrLabeledValue(item, "Overage: ", `[${progressBar}] ${renderedPercent2.toFixed(1)}%`);
65823
66123
  }
65824
66124
  if (isUsageSliderMode(displayMode)) {
65825
- const slider = makeSliderBar(renderedPercent2, undefined, showCursor ? { cursorPercent: 50 } : undefined);
66125
+ const slider = makeSliderBar(renderedPercent2);
65826
66126
  const sliderDisplay = displayMode === "slider" ? `${slider} ${renderedPercent2.toFixed(1)}%` : slider;
65827
- return formatRawOrLabeledValue(item, LABEL, sliderDisplay);
66127
+ return formatRawOrLabeledValue(item, "Overage: ", sliderDisplay);
65828
66128
  }
65829
- return formatRawOrLabeledValue(item, LABEL, `${previewPercent.toFixed(1)}%`);
66129
+ return formatRawOrLabeledValue(item, "Overage: ", `${previewPercent.toFixed(1)}%`);
65830
66130
  }
65831
66131
  const data = context.usageData ?? {};
65832
- if (data.error)
65833
- return getUsageErrorMessage(data.error);
65834
- if (data.weeklySonnetUsage === undefined)
66132
+ if (data.extraUsageEnabled === false) {
66133
+ return isHideExtraUsageDisabledEnabled(item) ? null : formatRawOrLabeledValue(item, "Overage: ", "n/a");
66134
+ }
66135
+ if (data.extraUsageEnabled !== true || data.extraUsageUtilization === undefined) {
66136
+ if (data.error)
66137
+ return getUsageErrorMessage(data.error);
65835
66138
  return null;
65836
- const percent = Math.max(0, Math.min(100, data.weeklySonnetUsage));
66139
+ }
66140
+ const percent = Math.max(0, Math.min(100, data.extraUsageUtilization));
65837
66141
  const renderedPercent = inverted ? 100 - percent : percent;
65838
- const getCursorOptions = () => {
65839
- if (!showCursor) {
65840
- return;
65841
- }
65842
- const window2 = resolveWeeklySonnetUsageWindow(data);
65843
- return window2 ? { cursorPercent: window2.elapsedPercent } : undefined;
65844
- };
65845
66142
  if (isUsageProgressMode(displayMode)) {
65846
66143
  const width = getUsageProgressBarWidth(displayMode);
65847
- const progressBar = makeTimerProgressBar2(renderedPercent, width, getCursorOptions());
65848
- const progressDisplay = `[${progressBar}] ${renderedPercent.toFixed(1)}%`;
65849
- return formatRawOrLabeledValue(item, LABEL, progressDisplay);
66144
+ const progressBar = makeTimerProgressBar2(renderedPercent, width);
66145
+ return formatRawOrLabeledValue(item, "Overage: ", `[${progressBar}] ${renderedPercent.toFixed(1)}%`);
65850
66146
  }
65851
66147
  if (isUsageSliderMode(displayMode)) {
65852
- const slider = makeSliderBar(renderedPercent, undefined, getCursorOptions());
66148
+ const slider = makeSliderBar(renderedPercent);
65853
66149
  const sliderDisplay = displayMode === "slider" ? `${slider} ${renderedPercent.toFixed(1)}%` : slider;
65854
- return formatRawOrLabeledValue(item, LABEL, sliderDisplay);
66150
+ return formatRawOrLabeledValue(item, "Overage: ", sliderDisplay);
65855
66151
  }
65856
- return formatRawOrLabeledValue(item, LABEL, `${percent.toFixed(1)}%`);
66152
+ return formatRawOrLabeledValue(item, "Overage: ", `${percent.toFixed(1)}%`);
65857
66153
  }
65858
66154
  getCustomKeybinds(item) {
65859
- return getUsagePercentCustomKeybinds(item);
66155
+ return [...getUsagePercentCustomKeybinds(item), getHideExtraUsageDisabledKeybind()];
65860
66156
  }
65861
66157
  supportsRawValue() {
65862
66158
  return true;
@@ -65865,22 +66161,79 @@ class WeeklySonnetUsageWidget {
65865
66161
  return true;
65866
66162
  }
65867
66163
  }
65868
- var LABEL = "Weekly Sonnet: ";
65869
- var init_WeeklySonnetUsage = __esm(async () => {
66164
+ var init_ExtraUsageUtilization = __esm(async () => {
66165
+ init_extra_usage_disabled();
65870
66166
  init_usage_display();
65871
66167
  await init_usage();
65872
66168
  });
65873
66169
 
65874
- // src/widgets/WeeklyOpusUsage.ts
65875
- class WeeklyOpusUsageWidget {
66170
+ // src/widgets/ExtraUsageRemaining.ts
66171
+ class ExtraUsageRemainingWidget {
66172
+ getDefaultColor() {
66173
+ return "green";
66174
+ }
66175
+ getDescription() {
66176
+ return "Shows remaining USD of your monthly extra usage limit";
66177
+ }
66178
+ getDisplayName() {
66179
+ return "Extra Usage Remaining";
66180
+ }
66181
+ getCategory() {
66182
+ return "Usage";
66183
+ }
66184
+ getEditorDisplay(item) {
66185
+ return {
66186
+ displayText: this.getDisplayName(),
66187
+ modifierText: appendHideDisabledModifier(undefined, item)
66188
+ };
66189
+ }
66190
+ handleEditorAction(action, item) {
66191
+ return handleToggleExtraUsageDisabledAction(action, item);
66192
+ }
66193
+ render(item, context, settings) {
66194
+ if (context.isPreview) {
66195
+ return formatRawOrLabeledValue(item, "Overage Left: ", "$3,894.00");
66196
+ }
66197
+ const data = context.usageData ?? {};
66198
+ if (data.extraUsageEnabled === false) {
66199
+ return isHideExtraUsageDisabledEnabled(item) ? null : formatRawOrLabeledValue(item, "Overage Left: ", "n/a");
66200
+ }
66201
+ if (data.extraUsageEnabled !== true || data.extraUsageLimit === undefined || data.extraUsageUsed === undefined) {
66202
+ if (data.error)
66203
+ return getUsageErrorMessage(data.error);
66204
+ return null;
66205
+ }
66206
+ const limitDollars = data.extraUsageLimit / 100;
66207
+ const usedDollars = data.extraUsageUsed / 100;
66208
+ const remaining = Math.max(0, limitDollars - usedDollars);
66209
+ const formatted = `$${remaining.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
66210
+ return formatRawOrLabeledValue(item, "Overage Left: ", formatted);
66211
+ }
66212
+ getCustomKeybinds() {
66213
+ return [getHideExtraUsageDisabledKeybind()];
66214
+ }
66215
+ supportsRawValue() {
66216
+ return true;
66217
+ }
66218
+ supportsColors(item) {
66219
+ return true;
66220
+ }
66221
+ }
66222
+ var init_ExtraUsageRemaining = __esm(async () => {
66223
+ init_extra_usage_disabled();
66224
+ await init_usage();
66225
+ });
66226
+
66227
+ // src/widgets/WeeklySonnetUsage.ts
66228
+ class WeeklySonnetUsageWidget {
65876
66229
  getDefaultColor() {
65877
66230
  return "brightBlue";
65878
66231
  }
65879
66232
  getDescription() {
65880
- return "Shows weekly Opus API usage percentage";
66233
+ return "Shows weekly Sonnet API usage percentage";
65881
66234
  }
65882
66235
  getDisplayName() {
65883
- return "Weekly Opus Usage";
66236
+ return "Weekly Sonnet Usage";
65884
66237
  }
65885
66238
  getCategory() {
65886
66239
  return "Usage";
@@ -65908,27 +66261,124 @@ class WeeklyOpusUsageWidget {
65908
66261
  const inverted = isUsageInverted(item);
65909
66262
  const showCursor = isUsageCursorEnabled(item);
65910
66263
  if (context.isPreview) {
65911
- const previewPercent = 4;
66264
+ const previewPercent = 8;
65912
66265
  const renderedPercent2 = inverted ? 100 - previewPercent : previewPercent;
65913
66266
  if (isUsageProgressMode(displayMode)) {
65914
66267
  const width = getUsageProgressBarWidth(displayMode);
65915
66268
  const progressBar = makeTimerProgressBar2(renderedPercent2, width, showCursor ? { cursorPercent: 50 } : undefined);
65916
66269
  const progressDisplay = `[${progressBar}] ${renderedPercent2.toFixed(1)}%`;
65917
- return formatRawOrLabeledValue(item, LABEL2, progressDisplay);
66270
+ return formatRawOrLabeledValue(item, LABEL, progressDisplay);
65918
66271
  }
65919
66272
  if (isUsageSliderMode(displayMode)) {
65920
66273
  const slider = makeSliderBar(renderedPercent2, undefined, showCursor ? { cursorPercent: 50 } : undefined);
65921
66274
  const sliderDisplay = displayMode === "slider" ? `${slider} ${renderedPercent2.toFixed(1)}%` : slider;
65922
- return formatRawOrLabeledValue(item, LABEL2, sliderDisplay);
66275
+ return formatRawOrLabeledValue(item, LABEL, sliderDisplay);
65923
66276
  }
65924
- return formatRawOrLabeledValue(item, LABEL2, `${previewPercent.toFixed(1)}%`);
66277
+ return formatRawOrLabeledValue(item, LABEL, `${previewPercent.toFixed(1)}%`);
65925
66278
  }
65926
66279
  const data = context.usageData ?? {};
65927
- if (data.error)
65928
- return getUsageErrorMessage(data.error);
65929
- if (data.weeklyOpusUsage === undefined)
66280
+ if (data.weeklySonnetUsage === undefined) {
66281
+ if (data.error)
66282
+ return getUsageErrorMessage(data.error);
65930
66283
  return null;
65931
- const percent = Math.max(0, Math.min(100, data.weeklyOpusUsage));
66284
+ }
66285
+ const percent = Math.max(0, Math.min(100, data.weeklySonnetUsage));
66286
+ const renderedPercent = inverted ? 100 - percent : percent;
66287
+ const getCursorOptions = () => {
66288
+ if (!showCursor) {
66289
+ return;
66290
+ }
66291
+ const window2 = resolveWeeklySonnetUsageWindow(data);
66292
+ return window2 ? { cursorPercent: window2.elapsedPercent } : undefined;
66293
+ };
66294
+ if (isUsageProgressMode(displayMode)) {
66295
+ const width = getUsageProgressBarWidth(displayMode);
66296
+ const progressBar = makeTimerProgressBar2(renderedPercent, width, getCursorOptions());
66297
+ const progressDisplay = `[${progressBar}] ${renderedPercent.toFixed(1)}%`;
66298
+ return formatRawOrLabeledValue(item, LABEL, progressDisplay);
66299
+ }
66300
+ if (isUsageSliderMode(displayMode)) {
66301
+ const slider = makeSliderBar(renderedPercent, undefined, getCursorOptions());
66302
+ const sliderDisplay = displayMode === "slider" ? `${slider} ${renderedPercent.toFixed(1)}%` : slider;
66303
+ return formatRawOrLabeledValue(item, LABEL, sliderDisplay);
66304
+ }
66305
+ return formatRawOrLabeledValue(item, LABEL, `${percent.toFixed(1)}%`);
66306
+ }
66307
+ getCustomKeybinds(item) {
66308
+ return getUsagePercentCustomKeybinds(item);
66309
+ }
66310
+ supportsRawValue() {
66311
+ return true;
66312
+ }
66313
+ supportsColors(item) {
66314
+ return true;
66315
+ }
66316
+ }
66317
+ var LABEL = "Weekly Sonnet: ";
66318
+ var init_WeeklySonnetUsage = __esm(async () => {
66319
+ init_usage_display();
66320
+ await init_usage();
66321
+ });
66322
+
66323
+ // src/widgets/WeeklyOpusUsage.ts
66324
+ class WeeklyOpusUsageWidget {
66325
+ getDefaultColor() {
66326
+ return "brightBlue";
66327
+ }
66328
+ getDescription() {
66329
+ return "Shows weekly Opus API usage percentage";
66330
+ }
66331
+ getDisplayName() {
66332
+ return "Weekly Opus Usage";
66333
+ }
66334
+ getCategory() {
66335
+ return "Usage";
66336
+ }
66337
+ getEditorDisplay(item) {
66338
+ return {
66339
+ displayText: this.getDisplayName(),
66340
+ modifierText: getUsageDisplayModifierText(item)
66341
+ };
66342
+ }
66343
+ handleEditorAction(action, item) {
66344
+ if (action === "toggle-progress") {
66345
+ return cycleUsageDisplayMode(item, [], true);
66346
+ }
66347
+ if (action === "toggle-invert") {
66348
+ return toggleUsageInverted(item);
66349
+ }
66350
+ if (action === "toggle-cursor") {
66351
+ return toggleUsageCursor(item);
66352
+ }
66353
+ return null;
66354
+ }
66355
+ render(item, context, settings) {
66356
+ const displayMode = getUsageDisplayMode(item);
66357
+ const inverted = isUsageInverted(item);
66358
+ const showCursor = isUsageCursorEnabled(item);
66359
+ if (context.isPreview) {
66360
+ const previewPercent = 4;
66361
+ const renderedPercent2 = inverted ? 100 - previewPercent : previewPercent;
66362
+ if (isUsageProgressMode(displayMode)) {
66363
+ const width = getUsageProgressBarWidth(displayMode);
66364
+ const progressBar = makeTimerProgressBar2(renderedPercent2, width, showCursor ? { cursorPercent: 50 } : undefined);
66365
+ const progressDisplay = `[${progressBar}] ${renderedPercent2.toFixed(1)}%`;
66366
+ return formatRawOrLabeledValue(item, LABEL2, progressDisplay);
66367
+ }
66368
+ if (isUsageSliderMode(displayMode)) {
66369
+ const slider = makeSliderBar(renderedPercent2, undefined, showCursor ? { cursorPercent: 50 } : undefined);
66370
+ const sliderDisplay = displayMode === "slider" ? `${slider} ${renderedPercent2.toFixed(1)}%` : slider;
66371
+ return formatRawOrLabeledValue(item, LABEL2, sliderDisplay);
66372
+ }
66373
+ return formatRawOrLabeledValue(item, LABEL2, `${previewPercent.toFixed(1)}%`);
66374
+ }
66375
+ const data = context.usageData ?? {};
66376
+ if (data.weeklyOpusUsage === undefined) {
66377
+ if (data.error)
66378
+ return getUsageErrorMessage(data.error);
66379
+ return null;
66380
+ }
66381
+ const percent = Math.max(0, Math.min(100, data.weeklyOpusUsage));
65932
66382
  const renderedPercent = inverted ? 100 - percent : percent;
65933
66383
  const getCursorOptions = () => {
65934
66384
  if (!showCursor) {
@@ -66005,6 +66455,9 @@ function getWeeklyResetModifierText(item) {
66005
66455
  if (isUsage12HourClock(item)) {
66006
66456
  modifiers.push("12hr");
66007
66457
  }
66458
+ if (isUsageWeekdayEnabled(item)) {
66459
+ modifiers.push("weekday");
66460
+ }
66008
66461
  } else if (isWeeklyResetHoursOnly(item)) {
66009
66462
  modifiers.push("hours only");
66010
66463
  }
@@ -66055,6 +66508,9 @@ class WeeklyResetTimerWidget {
66055
66508
  if (action === "toggle-hour-format") {
66056
66509
  return toggleUsageHourFormat(item);
66057
66510
  }
66511
+ if (action === "toggle-weekday") {
66512
+ return toggleUsageWeekday(item);
66513
+ }
66058
66514
  if (action === "toggle-hours") {
66059
66515
  return toggleWeeklyResetHoursOnly(item);
66060
66516
  }
@@ -66079,8 +66535,10 @@ class WeeklyResetTimerWidget {
66079
66535
  return formatRawOrLabeledValue(item, "Weekly Reset ", sliderDisplay);
66080
66536
  }
66081
66537
  if (dateMode) {
66082
- const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item));
66083
- return formatRawOrLabeledValue(item, "Weekly Reset: ", resetAt ?? (compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC"));
66538
+ const weekday = isUsageWeekdayEnabled(item);
66539
+ const resetAt = formatUsageResetAt(WEEKLY_RESET_PREVIEW_AT, compact2, getUsageTimezone(item), getUsageLocale(item), isUsage12HourClock(item), weekday);
66540
+ const fallback = weekday ? compact2 ? "Sun 08:30Z" : "Sun 08:30 UTC" : compact2 ? "03-15 08:30Z" : "2026-03-15 08:30 UTC";
66541
+ return formatRawOrLabeledValue(item, "Weekly Reset: ", resetAt ?? fallback);
66084
66542
  }
66085
66543
  return formatRawOrLabeledValue(item, "Weekly Reset: ", formatUsageDuration(WEEKLY_PREVIEW_DURATION_MS, compact2, useDays));
66086
66544
  }
@@ -66108,7 +66566,7 @@ class WeeklyResetTimerWidget {
66108
66566
  if (dateMode) {
66109
66567
  const timezone = getUsageTimezone(item);
66110
66568
  const locale = getUsageLocale(item);
66111
- const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item));
66569
+ const resetAt = formatUsageResetAt(usageData.weeklyResetAt, compact2, timezone, locale, isUsage12HourClock(item), isUsageWeekdayEnabled(item));
66112
66570
  if (resetAt) {
66113
66571
  return formatRawOrLabeledValue(item, "Weekly Reset: ", resetAt);
66114
66572
  }
@@ -66120,6 +66578,7 @@ class WeeklyResetTimerWidget {
66120
66578
  const keybinds = getUsageTimerCustomKeybinds(item, {
66121
66579
  includeDate: true,
66122
66580
  includeHourFormat: true,
66581
+ includeWeekday: true,
66123
66582
  includeLocale: true,
66124
66583
  includeTimezone: true
66125
66584
  });
@@ -66620,7 +67079,7 @@ var init_ThinkingEffort = __esm(async () => {
66620
67079
 
66621
67080
  // src/widgets/Battery.ts
66622
67081
  import { execSync as execSync4 } from "child_process";
66623
- import { readFileSync as readFileSync11 } from "fs";
67082
+ import { readFileSync as readFileSync12 } from "fs";
66624
67083
  function getMacBatteryInfo() {
66625
67084
  try {
66626
67085
  const output = execSync4("pmset -g batt", { encoding: "utf-8", timeout: 2000 });
@@ -66640,8 +67099,8 @@ function getMacBatteryInfo() {
66640
67099
  }
66641
67100
  function getLinuxBatteryInfo() {
66642
67101
  try {
66643
- const capacity = readFileSync11("/sys/class/power_supply/BAT0/capacity", "utf-8").trim();
66644
- const status = readFileSync11("/sys/class/power_supply/BAT0/status", "utf-8").trim().toLowerCase();
67102
+ const capacity = readFileSync12("/sys/class/power_supply/BAT0/capacity", "utf-8").trim();
67103
+ const status = readFileSync12("/sys/class/power_supply/BAT0/status", "utf-8").trim().toLowerCase();
66645
67104
  const percent = parseInt(capacity, 10);
66646
67105
  if (isNaN(percent)) {
66647
67106
  return null;
@@ -67570,6 +68029,137 @@ var init_VoiceStatus = __esm(async () => {
67570
68029
  FORMATS3 = ["icon", "icon-text", "text", "word"];
67571
68030
  });
67572
68031
 
68032
+ // src/widgets/RemoteControlStatus.ts
68033
+ function getFormat4(item) {
68034
+ const f = item.metadata?.format;
68035
+ return FORMATS4.includes(f ?? "") ? f : DEFAULT_FORMAT4;
68036
+ }
68037
+ function setFormat4(item, format) {
68038
+ if (format === DEFAULT_FORMAT4) {
68039
+ const { format: removedFormat, ...restMetadata } = item.metadata ?? {};
68040
+ return {
68041
+ ...item,
68042
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68043
+ };
68044
+ }
68045
+ return {
68046
+ ...item,
68047
+ metadata: {
68048
+ ...item.metadata ?? {},
68049
+ format
68050
+ }
68051
+ };
68052
+ }
68053
+ function isNerdFontEnabled4(item) {
68054
+ return item.metadata?.[NERD_FONT_METADATA_KEY4] === "true";
68055
+ }
68056
+ function toggleNerdFont4(item) {
68057
+ if (!isNerdFontEnabled4(item)) {
68058
+ return {
68059
+ ...item,
68060
+ metadata: {
68061
+ ...item.metadata ?? {},
68062
+ [NERD_FONT_METADATA_KEY4]: "true"
68063
+ }
68064
+ };
68065
+ }
68066
+ const { [NERD_FONT_METADATA_KEY4]: removedNerdFont, ...restMetadata } = item.metadata ?? {};
68067
+ return {
68068
+ ...item,
68069
+ metadata: Object.keys(restMetadata).length > 0 ? restMetadata : undefined
68070
+ };
68071
+ }
68072
+ function formatStatus2(enabled, format, nerdFont) {
68073
+ const stateText = enabled ? "on" : "off";
68074
+ const stateDot = enabled ? STATE_DOT_ON2 : STATE_DOT_OFF2;
68075
+ const icon = nerdFont ? enabled ? SATELLITE_NERD_FONT : SATELLITE_SLASH_NERD_FONT : SATELLITE_EMOJI;
68076
+ switch (format) {
68077
+ case "icon":
68078
+ return nerdFont ? icon : `${icon} ${stateDot}`;
68079
+ case "icon-text":
68080
+ return `${icon} ${stateText}`;
68081
+ case "text":
68082
+ return stateText;
68083
+ case "word":
68084
+ return `remote ${stateText}`;
68085
+ case "label-check":
68086
+ return `remote ${enabled ? CHECK_EMOJI : CROSS_EMOJI}`;
68087
+ case "label-mark":
68088
+ return `remote ${enabled ? CHECK_MARK : CROSS_MARK}`;
68089
+ }
68090
+ }
68091
+
68092
+ class RemoteControlStatusWidget {
68093
+ getDefaultColor() {
68094
+ return "blue";
68095
+ }
68096
+ getDescription() {
68097
+ return "Shows whether Claude Code remote control is attached to the current session";
68098
+ }
68099
+ getDisplayName() {
68100
+ return "Remote Control Status";
68101
+ }
68102
+ getCategory() {
68103
+ return "Core";
68104
+ }
68105
+ getEditorDisplay(item) {
68106
+ const modifiers = [getFormat4(item)];
68107
+ if (isNerdFontEnabled4(item)) {
68108
+ modifiers.push("nerd font");
68109
+ }
68110
+ return {
68111
+ displayText: this.getDisplayName(),
68112
+ modifierText: `(${modifiers.join(", ")})`
68113
+ };
68114
+ }
68115
+ handleEditorAction(action, item) {
68116
+ if (action === CYCLE_FORMAT_ACTION4) {
68117
+ const currentFormat = getFormat4(item);
68118
+ const nextFormat = FORMATS4[(FORMATS4.indexOf(currentFormat) + 1) % FORMATS4.length] ?? DEFAULT_FORMAT4;
68119
+ return setFormat4(item, nextFormat);
68120
+ }
68121
+ if (action === TOGGLE_NERD_FONT_ACTION4) {
68122
+ return toggleNerdFont4(item);
68123
+ }
68124
+ return null;
68125
+ }
68126
+ render(item, context, _settings) {
68127
+ const format = getFormat4(item);
68128
+ const nerdFont = isNerdFontEnabled4(item);
68129
+ if (context.isPreview) {
68130
+ if (item.rawValue) {
68131
+ return "on";
68132
+ }
68133
+ return formatStatus2(true, format, nerdFont);
68134
+ }
68135
+ const status = getRemoteControlStatus(context.data?.session_id);
68136
+ if (status === null) {
68137
+ return null;
68138
+ }
68139
+ if (item.rawValue) {
68140
+ return status.enabled ? "on" : "off";
68141
+ }
68142
+ return formatStatus2(status.enabled, format, nerdFont);
68143
+ }
68144
+ getCustomKeybinds() {
68145
+ return [
68146
+ { key: "f", label: "(f)ormat", action: CYCLE_FORMAT_ACTION4 },
68147
+ { key: "n", label: "(n)erd font", action: TOGGLE_NERD_FONT_ACTION4 }
68148
+ ];
68149
+ }
68150
+ supportsRawValue() {
68151
+ return true;
68152
+ }
68153
+ supportsColors(_item) {
68154
+ return true;
68155
+ }
68156
+ }
68157
+ var SATELLITE_EMOJI = "\uD83D\uDCE1", SATELLITE_NERD_FONT = "", SATELLITE_SLASH_NERD_FONT = "", STATE_DOT_OFF2 = "○", STATE_DOT_ON2 = "◉", FORMATS4, CHECK_EMOJI = "✅", CROSS_EMOJI = "❌", CHECK_MARK = "✓", CROSS_MARK = "✗", DEFAULT_FORMAT4 = "icon", CYCLE_FORMAT_ACTION4 = "cycle-format", TOGGLE_NERD_FONT_ACTION4 = "toggle-nerd-font", NERD_FONT_METADATA_KEY4 = "nerdFont";
68158
+ var init_RemoteControlStatus = __esm(async () => {
68159
+ await init_claude_settings();
68160
+ FORMATS4 = ["icon", "icon-text", "text", "word", "label-check", "label-mark"];
68161
+ });
68162
+
67573
68163
  // src/widgets/index.ts
67574
68164
  var init_widgets = __esm(async () => {
67575
68165
  init_GitBranch();
@@ -67630,6 +68220,8 @@ var init_widgets = __esm(async () => {
67630
68220
  init_OutputSpeed(),
67631
68221
  init_TotalSpeed(),
67632
68222
  init_ApiUsage(),
68223
+ init_ExtraUsageUtilization(),
68224
+ init_ExtraUsageRemaining(),
67633
68225
  init_WeeklySonnetUsage(),
67634
68226
  init_WeeklyOpusUsage(),
67635
68227
  init_WeeklyResetTimer(),
@@ -67637,7 +68229,8 @@ var init_widgets = __esm(async () => {
67637
68229
  init_Skills(),
67638
68230
  init_ThinkingEffort(),
67639
68231
  init_WeeklyPace(),
67640
- init_VoiceStatus()
68232
+ init_VoiceStatus(),
68233
+ init_RemoteControlStatus()
67641
68234
  ]);
67642
68235
  });
67643
68236
 
@@ -67709,6 +68302,8 @@ var init_widget_manifest = __esm(async () => {
67709
68302
  { type: "session-usage", create: () => new SessionUsageWidget },
67710
68303
  { type: "weekly-usage", create: () => new WeeklyUsageWidget },
67711
68304
  { type: "reset-timer", create: () => new ResetTimerWidget },
68305
+ { type: "extra-usage-utilization", create: () => new ExtraUsageUtilizationWidget },
68306
+ { type: "extra-usage-remaining", create: () => new ExtraUsageRemainingWidget },
67712
68307
  { type: "weekly-sonnet-usage", create: () => new WeeklySonnetUsageWidget },
67713
68308
  { type: "weekly-opus-usage", create: () => new WeeklyOpusUsageWidget },
67714
68309
  { type: "weekly-reset-timer", create: () => new WeeklyResetTimerWidget },
@@ -67720,6 +68315,7 @@ var init_widget_manifest = __esm(async () => {
67720
68315
  { type: "weekly-pace", create: () => new WeeklyPaceWidget },
67721
68316
  { type: "off-peak", create: () => new OffPeakWidget },
67722
68317
  { type: "voice-status", create: () => new VoiceStatusWidget },
68318
+ { type: "remote-control-status", create: () => new RemoteControlStatusWidget },
67723
68319
  { type: "worktree-mode", create: () => new GitWorktreeModeWidget },
67724
68320
  { type: "worktree-name", create: () => new GitWorktreeNameWidget },
67725
68321
  { type: "worktree-branch", create: () => new GitWorktreeBranchWidget },
@@ -67904,11 +68500,11 @@ var init_hooks = __esm(async () => {
67904
68500
  });
67905
68501
 
67906
68502
  // src/utils/config.ts
67907
- import * as fs10 from "fs";
67908
- import * as os8 from "os";
67909
- import * as path7 from "path";
68503
+ import * as fs11 from "fs";
68504
+ import * as os9 from "os";
68505
+ import * as path8 from "path";
67910
68506
  function initConfigPath(filePath) {
67911
- settingsPath = filePath ? path7.resolve(filePath) : DEFAULT_SETTINGS_PATH;
68507
+ settingsPath = filePath ? path8.resolve(filePath) : DEFAULT_SETTINGS_PATH;
67912
68508
  }
67913
68509
  function getConfigPath() {
67914
68510
  return settingsPath;
@@ -67917,13 +68513,13 @@ function isCustomConfigPath() {
67917
68513
  return settingsPath !== DEFAULT_SETTINGS_PATH;
67918
68514
  }
67919
68515
  function getSettingsPaths() {
67920
- const configDir = path7.dirname(settingsPath);
67921
- const parsedPath = path7.parse(settingsPath);
68516
+ const configDir = path8.dirname(settingsPath);
68517
+ const parsedPath = path8.parse(settingsPath);
67922
68518
  const backupBaseName = parsedPath.ext ? `${parsedPath.name}.bak` : `${parsedPath.base}.bak`;
67923
68519
  return {
67924
68520
  configDir,
67925
68521
  settingsPath,
67926
- settingsBackupPath: path7.join(configDir, backupBaseName)
68522
+ settingsBackupPath: path8.join(configDir, backupBaseName)
67927
68523
  };
67928
68524
  }
67929
68525
  async function ensureDir(dir) {
@@ -67940,7 +68536,7 @@ async function writeSettingsJson(settings, paths) {
67940
68536
  }
67941
68537
  async function backupBadSettings(paths) {
67942
68538
  try {
67943
- if (fs10.existsSync(paths.settingsPath)) {
68539
+ if (fs11.existsSync(paths.settingsPath)) {
67944
68540
  const content = await readFile3(paths.settingsPath, "utf-8");
67945
68541
  await writeFile(paths.settingsBackupPath, content, "utf-8");
67946
68542
  console.error(`Bad settings backed up to ${paths.settingsBackupPath}`);
@@ -67970,7 +68566,7 @@ async function recoverWithDefaults(paths) {
67970
68566
  async function loadSettings() {
67971
68567
  const paths = getSettingsPaths();
67972
68568
  try {
67973
- if (!fs10.existsSync(paths.settingsPath))
68569
+ if (!fs11.existsSync(paths.settingsPath))
67974
68570
  return await writeDefaultSettings(paths);
67975
68571
  const content = await readFile3(paths.settingsPath, "utf-8");
67976
68572
  let rawData;
@@ -68021,7 +68617,7 @@ async function saveSettings(settings) {
68021
68617
  }
68022
68618
  async function saveInstallationMetadata(metadata) {
68023
68619
  const paths = getSettingsPaths();
68024
- if (!metadata && !fs10.existsSync(paths.settingsPath)) {
68620
+ if (!metadata && !fs11.existsSync(paths.settingsPath)) {
68025
68621
  return;
68026
68622
  }
68027
68623
  const settings = await loadSettings();
@@ -68041,18 +68637,18 @@ var init_config = __esm(async () => {
68041
68637
  init_Settings();
68042
68638
  init_migrations();
68043
68639
  await init_widgets2();
68044
- readFile3 = fs10.promises.readFile;
68045
- writeFile = fs10.promises.writeFile;
68046
- mkdir = fs10.promises.mkdir;
68047
- DEFAULT_SETTINGS_PATH = path7.join(os8.homedir(), ".config", "ccstatusline", "settings.json");
68640
+ readFile3 = fs11.promises.readFile;
68641
+ writeFile = fs11.promises.writeFile;
68642
+ mkdir = fs11.promises.mkdir;
68643
+ DEFAULT_SETTINGS_PATH = path8.join(os9.homedir(), ".config", "ccstatusline", "settings.json");
68048
68644
  settingsPath = DEFAULT_SETTINGS_PATH;
68049
68645
  });
68050
68646
 
68051
68647
  // src/utils/claude-settings.ts
68052
68648
  import { execSync as execSync5 } from "child_process";
68053
- import * as fs11 from "fs";
68054
- import * as os9 from "os";
68055
- import * as path8 from "path";
68649
+ import * as fs12 from "fs";
68650
+ import * as os10 from "os";
68651
+ import * as path9 from "path";
68056
68652
  function isKnownCommand(command) {
68057
68653
  const prefixes = [CCSTATUSLINE_COMMANDS.AUTO_NPX, CCSTATUSLINE_COMMANDS.AUTO_BUNX, CCSTATUSLINE_COMMANDS.GLOBAL];
68058
68654
  return prefixes.some((prefix) => command === prefix || command.startsWith(`${prefix} --config `)) || /(?:^|[\s"'\\/])ccstatusline\.ts(?=$|[\s"'])/.test(command);
@@ -68076,9 +68672,9 @@ function getClaudeConfigDir() {
68076
68672
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
68077
68673
  if (envConfigDir) {
68078
68674
  try {
68079
- const resolvedPath = path8.resolve(envConfigDir);
68080
- if (fs11.existsSync(resolvedPath)) {
68081
- const stats = fs11.statSync(resolvedPath);
68675
+ const resolvedPath = path9.resolve(envConfigDir);
68676
+ if (fs12.existsSync(resolvedPath)) {
68677
+ const stats = fs12.statSync(resolvedPath);
68082
68678
  if (stats.isDirectory()) {
68083
68679
  return resolvedPath;
68084
68680
  }
@@ -68087,24 +68683,24 @@ function getClaudeConfigDir() {
68087
68683
  }
68088
68684
  } catch {}
68089
68685
  }
68090
- return path8.join(os9.homedir(), ".claude");
68686
+ return path9.join(os10.homedir(), ".claude");
68091
68687
  }
68092
68688
  function getClaudeJsonPath() {
68093
68689
  const configDir = getClaudeConfigDir();
68094
68690
  const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
68095
- if (envConfigDir && configDir === path8.resolve(envConfigDir)) {
68096
- return path8.join(configDir, ".claude.json");
68691
+ if (envConfigDir && configDir === path9.resolve(envConfigDir)) {
68692
+ return path9.join(configDir, ".claude.json");
68097
68693
  }
68098
- return path8.join(path8.dirname(configDir), ".claude.json");
68694
+ return path9.join(path9.dirname(configDir), ".claude.json");
68099
68695
  }
68100
68696
  function getClaudeSettingsPath() {
68101
- return path8.join(getClaudeConfigDir(), "settings.json");
68697
+ return path9.join(getClaudeConfigDir(), "settings.json");
68102
68698
  }
68103
68699
  async function backupClaudeSettings(suffix = ".bak") {
68104
68700
  const settingsPath2 = getClaudeSettingsPath();
68105
68701
  const backupPath = settingsPath2 + suffix;
68106
68702
  try {
68107
- if (fs11.existsSync(settingsPath2)) {
68703
+ if (fs12.existsSync(settingsPath2)) {
68108
68704
  const content = await readFile4(settingsPath2, "utf-8");
68109
68705
  await writeFile2(backupPath, content, "utf-8");
68110
68706
  return backupPath;
@@ -68117,11 +68713,11 @@ async function backupClaudeSettings(suffix = ".bak") {
68117
68713
  function loadClaudeSettingsSync(options = {}) {
68118
68714
  const { logErrors = true } = options;
68119
68715
  const settingsPath2 = getClaudeSettingsPath();
68120
- if (!fs11.existsSync(settingsPath2)) {
68716
+ if (!fs12.existsSync(settingsPath2)) {
68121
68717
  return {};
68122
68718
  }
68123
68719
  try {
68124
- const content = fs11.readFileSync(settingsPath2, "utf-8");
68720
+ const content = fs12.readFileSync(settingsPath2, "utf-8");
68125
68721
  return JSON.parse(content);
68126
68722
  } catch (error48) {
68127
68723
  if (logErrors) {
@@ -68133,7 +68729,7 @@ function loadClaudeSettingsSync(options = {}) {
68133
68729
  async function loadClaudeSettings(options = {}) {
68134
68730
  const { logErrors = true } = options;
68135
68731
  const settingsPath2 = getClaudeSettingsPath();
68136
- if (!fs11.existsSync(settingsPath2)) {
68732
+ if (!fs12.existsSync(settingsPath2)) {
68137
68733
  return {};
68138
68734
  }
68139
68735
  try {
@@ -68148,7 +68744,7 @@ async function loadClaudeSettings(options = {}) {
68148
68744
  }
68149
68745
  async function saveClaudeSettings(settings) {
68150
68746
  const settingsPath2 = getClaudeSettingsPath();
68151
- const dir = path8.dirname(settingsPath2);
68747
+ const dir = path9.dirname(settingsPath2);
68152
68748
  await backupClaudeSettings();
68153
68749
  await ensureDir(dir);
68154
68750
  await writeFile2(settingsPath2, JSON.stringify(settings, null, 2), "utf-8");
@@ -68166,7 +68762,7 @@ async function isInstalled() {
68166
68762
  function isExecutableAvailable(executable) {
68167
68763
  try {
68168
68764
  const command = process.platform === "win32" ? `where ${executable}` : `which ${executable}`;
68169
- execSync5(command, { stdio: "ignore" });
68765
+ execSync5(command, { stdio: "ignore", windowsHide: true });
68170
68766
  return true;
68171
68767
  } catch {
68172
68768
  return false;
@@ -68194,7 +68790,12 @@ function getPackageCommandAvailability() {
68194
68790
  }
68195
68791
  function getClaudeCodeVersion() {
68196
68792
  try {
68197
- const output = execSync5("claude --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"], timeout: 5000 }).trim();
68793
+ const output = execSync5("claude --version", {
68794
+ encoding: "utf-8",
68795
+ stdio: ["pipe", "pipe", "ignore"],
68796
+ timeout: 5000,
68797
+ windowsHide: true
68798
+ }).trim();
68198
68799
  const match = /^(\d+\.\d+\.\d+)/.exec(output);
68199
68800
  return match?.[1] ?? null;
68200
68801
  } catch {
@@ -68281,7 +68882,7 @@ function classifyInstallation(command, metadata) {
68281
68882
  }
68282
68883
  async function loadSavedSettingsForHookSync() {
68283
68884
  const configPath = getConfigPath();
68284
- if (!fs11.existsSync(configPath)) {
68885
+ if (!fs12.existsSync(configPath)) {
68285
68886
  return null;
68286
68887
  }
68287
68888
  try {
@@ -68382,19 +68983,19 @@ async function setRefreshInterval(interval) {
68382
68983
  }
68383
68984
  function getVoiceConfigCandidatePathsByPriority(cwd2) {
68384
68985
  const userDir = getClaudeConfigDir();
68385
- const projectDir = path8.join(cwd2, ".claude");
68986
+ const projectDir = path9.join(cwd2, ".claude");
68386
68987
  const candidates = [
68387
- path8.join(projectDir, "settings.local.json"),
68388
- path8.join(projectDir, "settings.json"),
68389
- path8.join(userDir, "settings.local.json"),
68390
- path8.join(userDir, "settings.json")
68988
+ path9.join(projectDir, "settings.local.json"),
68989
+ path9.join(projectDir, "settings.json"),
68990
+ path9.join(userDir, "settings.local.json"),
68991
+ path9.join(userDir, "settings.json")
68391
68992
  ];
68392
68993
  return Array.from(new Set(candidates));
68393
68994
  }
68394
68995
  function tryReadVoiceLayer(filePath) {
68395
68996
  let content;
68396
68997
  try {
68397
- content = fs11.readFileSync(filePath, "utf-8");
68998
+ content = fs12.readFileSync(filePath, "utf-8");
68398
68999
  } catch (error48) {
68399
69000
  const isMissing = error48.code === "ENOENT";
68400
69001
  return { fileExisted: !isMissing, enabled: undefined };
@@ -68424,13 +69025,49 @@ function getVoiceConfig(cwd2 = process.cwd()) {
68424
69025
  }
68425
69026
  return anyFileExisted ? { enabled: false } : null;
68426
69027
  }
68427
- var readFile4, writeFile2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema;
69028
+ function getRemoteControlStatus(sessionId) {
69029
+ if (!sessionId) {
69030
+ return null;
69031
+ }
69032
+ const sessionsDir = path9.join(getClaudeConfigDir(), "sessions");
69033
+ let entries;
69034
+ try {
69035
+ entries = fs12.readdirSync(sessionsDir);
69036
+ } catch {
69037
+ return null;
69038
+ }
69039
+ for (const entry of entries) {
69040
+ if (!entry.endsWith(".json")) {
69041
+ continue;
69042
+ }
69043
+ let content;
69044
+ try {
69045
+ content = fs12.readFileSync(path9.join(sessionsDir, entry), "utf-8");
69046
+ } catch {
69047
+ continue;
69048
+ }
69049
+ let parsed;
69050
+ try {
69051
+ parsed = JSON.parse(content);
69052
+ } catch {
69053
+ continue;
69054
+ }
69055
+ const result2 = RemoteSessionFileSchema.safeParse(parsed);
69056
+ if (!result2.success || result2.data.sessionId !== sessionId) {
69057
+ continue;
69058
+ }
69059
+ const bridge = result2.data.bridgeSessionId;
69060
+ return { enabled: typeof bridge === "string" && bridge.length > 0 };
69061
+ }
69062
+ return null;
69063
+ }
69064
+ var readFile4, writeFile2, CCSTATUSLINE_COMMANDS, PINNED_INSTALL_COMMANDS, VoiceConfigSchema, RemoteSessionFileSchema;
68428
69065
  var init_claude_settings = __esm(async () => {
68429
69066
  init_zod();
68430
69067
  init_Settings();
68431
69068
  await init_config();
68432
- readFile4 = fs11.promises.readFile;
68433
- writeFile2 = fs11.promises.writeFile;
69069
+ readFile4 = fs12.promises.readFile;
69070
+ writeFile2 = fs12.promises.writeFile;
68434
69071
  CCSTATUSLINE_COMMANDS = {
68435
69072
  AUTO_NPX: "npx -y ccstatusline-usage@latest",
68436
69073
  AUTO_BUNX: "bunx -y ccstatusline-usage@latest",
@@ -68444,6 +69081,10 @@ var init_claude_settings = __esm(async () => {
68444
69081
  BUN: (version2) => `bun add -g ccstatusline-usage@${version2}`
68445
69082
  };
68446
69083
  VoiceConfigSchema = exports_external.object({ enabled: exports_external.boolean().optional() });
69084
+ RemoteSessionFileSchema = exports_external.object({
69085
+ sessionId: exports_external.string().optional(),
69086
+ bridgeSessionId: exports_external.string().nullable().optional()
69087
+ });
68447
69088
  });
68448
69089
 
68449
69090
  // node_modules/pluralize/pluralize.js
@@ -69032,9 +69673,12 @@ await init_config();
69032
69673
 
69033
69674
  // src/utils/global-command-resolution.ts
69034
69675
  import { execFileSync as execFileSync5 } from "child_process";
69035
- import * as path9 from "path";
69676
+ import * as path10 from "path";
69036
69677
 
69037
69678
  // src/utils/package-manager-executable.ts
69679
+ function getPackageManagerShellOptions(executable, platform2 = process.platform) {
69680
+ return platform2 === "win32" && /\.(?:cmd|bat)$/i.test(executable) ? { shell: true } : {};
69681
+ }
69038
69682
  function getPackageManagerExecutable(packageManager, platform2 = process.platform) {
69039
69683
  return packageManager === "npm" && platform2 === "win32" ? "npm.cmd" : packageManager;
69040
69684
  }
@@ -69059,11 +69703,19 @@ function isTransientBunxStatusLinePath(filePath) {
69059
69703
  return /(?:^|\/)bunx-[^/]*ccstatusline-usage@[^/]+\/node_modules\/\.bin\/ccstatusline(?:\.(?:cmd|ps1))?$/i.test(normalized);
69060
69704
  }
69061
69705
  function getPersistentCommandResolutionPaths(paths) {
69062
- return paths.filter((path10) => !isTransientBunxStatusLinePath(path10));
69706
+ return paths.filter((path11) => !isTransientBunxStatusLinePath(path11));
69063
69707
  }
69064
69708
  function getCommandResolutionPaths(command, { platform: platform2 = process.platform } = {}) {
69065
69709
  try {
69066
- const output = platform2 === "win32" ? execFileSync5("where", [command], { encoding: "utf-8", timeout: COMMAND_LOOKUP_TIMEOUT_MS }) : execFileSync5("which", ["-a", command], { encoding: "utf-8", timeout: COMMAND_LOOKUP_TIMEOUT_MS });
69710
+ const output = platform2 === "win32" ? execFileSync5("where", [command], {
69711
+ encoding: "utf-8",
69712
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
69713
+ windowsHide: true
69714
+ }) : execFileSync5("which", ["-a", command], {
69715
+ encoding: "utf-8",
69716
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
69717
+ windowsHide: true
69718
+ });
69067
69719
  return splitCommandOutput(output);
69068
69720
  } catch {
69069
69721
  return [];
@@ -69071,14 +69723,17 @@ function getCommandResolutionPaths(command, { platform: platform2 = process.plat
69071
69723
  }
69072
69724
  function getNpmGlobalBinDir(platform2) {
69073
69725
  try {
69074
- const prefix = execFileSync5(getPackageManagerExecutable("npm", platform2), ["prefix", "-g"], {
69726
+ const executable = getPackageManagerExecutable("npm", platform2);
69727
+ const prefix = execFileSync5(executable, ["prefix", "-g"], {
69075
69728
  encoding: "utf-8",
69076
- timeout: COMMAND_LOOKUP_TIMEOUT_MS
69729
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
69730
+ windowsHide: true,
69731
+ ...getPackageManagerShellOptions(executable, platform2)
69077
69732
  }).trim();
69078
69733
  if (!prefix) {
69079
69734
  return null;
69080
69735
  }
69081
- return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix : path9.join(prefix, "bin");
69736
+ return platform2 === "win32" || /^[a-z]:[\\/]/i.test(prefix) ? prefix : path10.join(prefix, "bin");
69082
69737
  } catch {
69083
69738
  return null;
69084
69739
  }
@@ -69087,7 +69742,8 @@ function getBunGlobalBinDir() {
69087
69742
  try {
69088
69743
  const binDir = execFileSync5("bun", ["pm", "bin", "-g"], {
69089
69744
  encoding: "utf-8",
69090
- timeout: COMMAND_LOOKUP_TIMEOUT_MS
69745
+ timeout: COMMAND_LOOKUP_TIMEOUT_MS,
69746
+ windowsHide: true
69091
69747
  }).trim();
69092
69748
  return binDir || null;
69093
69749
  } catch {
@@ -69181,7 +69837,7 @@ import {
69181
69837
  execFile,
69182
69838
  execFileSync as execFileSync6
69183
69839
  } from "child_process";
69184
- import * as fs12 from "fs";
69840
+ import * as fs13 from "fs";
69185
69841
  var GLOBAL_PACKAGE_TIMEOUT_MS = 120000;
69186
69842
  var VERSION_LOOKUP_TIMEOUT_MS = 5000;
69187
69843
  var WINDOWS_SHIM_EXTENSIONS = [
@@ -69230,7 +69886,7 @@ function getBinaryPathCandidates(binDir, platform2) {
69230
69886
  return extensions.map((extension) => appendPathSegment(binDir, `ccstatusline${extension}`));
69231
69887
  }
69232
69888
  function hasBinaryOnDisk(binDir, platform2) {
69233
- return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) => fs12.existsSync(variant)));
69889
+ return getBinaryPathCandidates(binDir, platform2).some((candidate) => getFilesystemPathVariants(candidate).some((variant) => fs13.existsSync(variant)));
69234
69890
  }
69235
69891
  function hasResolvedBinaryInDir(resolvedPaths, binDir) {
69236
69892
  return resolvedPaths.some((resolvedPath) => isPathInsideDir(resolvedPath, binDir));
@@ -69263,10 +69919,10 @@ function formatPathList2(paths) {
69263
69919
  function readPackageVersion(packageJsonPath) {
69264
69920
  for (const variant of getFilesystemPathVariants(packageJsonPath)) {
69265
69921
  try {
69266
- if (!fs12.existsSync(variant)) {
69922
+ if (!fs13.existsSync(variant)) {
69267
69923
  continue;
69268
69924
  }
69269
- const packageJson = JSON.parse(fs12.readFileSync(variant, "utf-8"));
69925
+ const packageJson = JSON.parse(fs13.readFileSync(variant, "utf-8"));
69270
69926
  return typeof packageJson.version === "string" ? packageJson.version : null;
69271
69927
  } catch {
69272
69928
  return null;
@@ -69276,9 +69932,12 @@ function readPackageVersion(packageJsonPath) {
69276
69932
  }
69277
69933
  function getNpmGlobalPackageVersion(platform2) {
69278
69934
  try {
69279
- const rootDir = execFileSync6(getPackageManagerExecutable("npm", platform2), ["root", "-g"], {
69935
+ const executable = getPackageManagerExecutable("npm", platform2);
69936
+ const rootDir = execFileSync6(executable, ["root", "-g"], {
69280
69937
  encoding: "utf-8",
69281
- timeout: VERSION_LOOKUP_TIMEOUT_MS
69938
+ timeout: VERSION_LOOKUP_TIMEOUT_MS,
69939
+ windowsHide: true,
69940
+ ...getPackageManagerShellOptions(executable, platform2)
69282
69941
  }).trim();
69283
69942
  return rootDir ? readPackageVersion(appendPathSegment(appendPathSegment(rootDir, "ccstatusline"), "package.json")) : null;
69284
69943
  } catch {
@@ -69384,20 +70043,24 @@ function inspectGlobalPackageInstallations({
69384
70043
  function runGlobalPackageUninstall(packageManager, { platform: platform2 = process.platform } = {}) {
69385
70044
  const executable = getPackageManagerExecutable(packageManager, platform2);
69386
70045
  const args = packageManager === "npm" ? ["uninstall", "-g", "ccstatusline"] : ["remove", "-g", "ccstatusline"];
69387
- return new Promise((resolve5, reject2) => {
69388
- execFile(executable, args, { timeout: GLOBAL_PACKAGE_TIMEOUT_MS }, (error48) => {
70046
+ return new Promise((resolve6, reject2) => {
70047
+ execFile(executable, args, {
70048
+ timeout: GLOBAL_PACKAGE_TIMEOUT_MS,
70049
+ windowsHide: true,
70050
+ ...getPackageManagerShellOptions(executable, platform2)
70051
+ }, (error48) => {
69389
70052
  if (error48) {
69390
70053
  reject2(error48 instanceof Error ? error48 : new Error("Global uninstall command failed"));
69391
70054
  return;
69392
70055
  }
69393
- resolve5();
70056
+ resolve6();
69394
70057
  });
69395
70058
  });
69396
70059
  }
69397
70060
 
69398
70061
  // src/utils/open-url.ts
69399
70062
  import { spawnSync } from "child_process";
69400
- import * as os10 from "os";
70063
+ import * as os11 from "os";
69401
70064
  function runOpenCommand(command, args) {
69402
70065
  const result2 = spawnSync(command, args, {
69403
70066
  stdio: "ignore",
@@ -69456,7 +70119,7 @@ function openExternalUrl(url2) {
69456
70119
  error: "Only http(s) URLs are supported"
69457
70120
  };
69458
70121
  }
69459
- const platform3 = os10.platform();
70122
+ const platform3 = os11.platform();
69460
70123
  const plans = PLATFORM_OPEN_PLANS[platform3];
69461
70124
  if (!plans) {
69462
70125
  return {
@@ -69484,9 +70147,9 @@ function openExternalUrl(url2) {
69484
70147
 
69485
70148
  // src/utils/powerline.ts
69486
70149
  import { execSync as execSync6 } from "child_process";
69487
- import * as fs13 from "fs";
69488
- import * as os11 from "os";
69489
- import * as path10 from "path";
70150
+ import * as fs14 from "fs";
70151
+ import * as os12 from "os";
70152
+ import * as path11 from "path";
69490
70153
  var fontsInstalledThisSession = false;
69491
70154
  function checkPowerlineFonts() {
69492
70155
  if (process.env.DEBUG_FONT_INSTALL === "1" && !fontsInstalledThisSession) {
@@ -69502,24 +70165,24 @@ function checkPowerlineFonts() {
69502
70165
  leftArrow: "",
69503
70166
  leftThinArrow: ""
69504
70167
  };
69505
- const platform4 = os11.platform();
70168
+ const platform4 = os12.platform();
69506
70169
  let fontPaths = [];
69507
70170
  if (platform4 === "darwin") {
69508
70171
  fontPaths = [
69509
- path10.join(os11.homedir(), "Library", "Fonts"),
70172
+ path11.join(os12.homedir(), "Library", "Fonts"),
69510
70173
  "/Library/Fonts",
69511
70174
  "/System/Library/Fonts"
69512
70175
  ];
69513
70176
  } else if (platform4 === "linux") {
69514
70177
  fontPaths = [
69515
- path10.join(os11.homedir(), ".local", "share", "fonts"),
69516
- path10.join(os11.homedir(), ".fonts"),
70178
+ path11.join(os12.homedir(), ".local", "share", "fonts"),
70179
+ path11.join(os12.homedir(), ".fonts"),
69517
70180
  "/usr/share/fonts",
69518
70181
  "/usr/local/share/fonts"
69519
70182
  ];
69520
70183
  } else if (platform4 === "win32") {
69521
70184
  fontPaths = [
69522
- path10.join(os11.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts"),
70185
+ path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts"),
69523
70186
  "C:\\Windows\\Fonts"
69524
70187
  ];
69525
70188
  }
@@ -69535,9 +70198,9 @@ function checkPowerlineFonts() {
69535
70198
  /fira.*code.*nerd/i
69536
70199
  ];
69537
70200
  for (const fontPath of fontPaths) {
69538
- if (fs13.existsSync(fontPath)) {
70201
+ if (fs14.existsSync(fontPath)) {
69539
70202
  try {
69540
- const files = fs13.readdirSync(fontPath);
70203
+ const files = fs14.readdirSync(fontPath);
69541
70204
  for (const file2 of files) {
69542
70205
  for (const pattern of powerlineFontPatterns) {
69543
70206
  if (pattern.test(file2)) {
@@ -69572,13 +70235,16 @@ async function checkPowerlineFontsAsync() {
69572
70235
  if (quickCheck.installed) {
69573
70236
  return quickCheck;
69574
70237
  }
69575
- const platform4 = os11.platform();
70238
+ const platform4 = os12.platform();
69576
70239
  if (platform4 === "linux" || platform4 === "darwin") {
69577
70240
  try {
69578
70241
  const { exec: exec2 } = await import("child_process");
69579
70242
  const { promisify: promisify2 } = await import("util");
69580
70243
  const execAsync = promisify2(exec2);
69581
- const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", { encoding: "utf8" });
70244
+ const { stdout } = await execAsync("fc-list 2>/dev/null | grep -i powerline", {
70245
+ encoding: "utf8",
70246
+ windowsHide: true
70247
+ });
69582
70248
  if (stdout.trim()) {
69583
70249
  return {
69584
70250
  installed: true,
@@ -69595,46 +70261,49 @@ async function checkPowerlineFontsAsync() {
69595
70261
  async function installPowerlineFonts() {
69596
70262
  await Promise.resolve();
69597
70263
  try {
69598
- const platform4 = os11.platform();
70264
+ const platform4 = os12.platform();
69599
70265
  let fontDir;
69600
70266
  if (platform4 === "darwin") {
69601
- fontDir = path10.join(os11.homedir(), "Library", "Fonts");
70267
+ fontDir = path11.join(os12.homedir(), "Library", "Fonts");
69602
70268
  } else if (platform4 === "linux") {
69603
- fontDir = path10.join(os11.homedir(), ".local", "share", "fonts");
70269
+ fontDir = path11.join(os12.homedir(), ".local", "share", "fonts");
69604
70270
  } else if (platform4 === "win32") {
69605
- fontDir = path10.join(os11.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts");
70271
+ fontDir = path11.join(os12.homedir(), "AppData", "Local", "Microsoft", "Windows", "Fonts");
69606
70272
  } else {
69607
70273
  return {
69608
70274
  success: false,
69609
70275
  message: "Unsupported platform for font installation"
69610
70276
  };
69611
70277
  }
69612
- if (!fs13.existsSync(fontDir)) {
69613
- fs13.mkdirSync(fontDir, { recursive: true });
70278
+ if (!fs14.existsSync(fontDir)) {
70279
+ fs14.mkdirSync(fontDir, { recursive: true });
69614
70280
  }
69615
- const tempDir = path10.join(os11.tmpdir(), `ccstatusline-powerline-fonts-${Date.now()}`);
70281
+ const tempDir = path11.join(os12.tmpdir(), `ccstatusline-powerline-fonts-${Date.now()}`);
69616
70282
  try {
69617
- if (fs13.existsSync(tempDir)) {
69618
- fs13.rmSync(tempDir, { recursive: true, force: true });
70283
+ if (fs14.existsSync(tempDir)) {
70284
+ fs14.rmSync(tempDir, { recursive: true, force: true });
69619
70285
  }
69620
70286
  execSync6(`git clone --depth=1 https://github.com/powerline/fonts.git "${tempDir}"`, {
69621
70287
  stdio: "pipe",
69622
- encoding: "utf8"
70288
+ encoding: "utf8",
70289
+ windowsHide: true
69623
70290
  });
69624
70291
  if (platform4 === "darwin" || platform4 === "linux") {
69625
- const installScript = path10.join(tempDir, "install.sh");
69626
- if (fs13.existsSync(installScript)) {
69627
- fs13.chmodSync(installScript, 493);
70292
+ const installScript = path11.join(tempDir, "install.sh");
70293
+ if (fs14.existsSync(installScript)) {
70294
+ fs14.chmodSync(installScript, 493);
69628
70295
  execSync6(`cd "${tempDir}" && ./install.sh`, {
69629
70296
  stdio: "pipe",
69630
70297
  encoding: "utf8",
69631
- shell: "/bin/bash"
70298
+ shell: "/bin/bash",
70299
+ windowsHide: true
69632
70300
  });
69633
70301
  if (platform4 === "linux") {
69634
70302
  try {
69635
70303
  execSync6("fc-cache -f -v", {
69636
70304
  stdio: "pipe",
69637
- encoding: "utf8"
70305
+ encoding: "utf8",
70306
+ windowsHide: true
69638
70307
  });
69639
70308
  } catch {}
69640
70309
  }
@@ -69650,10 +70319,10 @@ async function installPowerlineFonts() {
69650
70319
  }
69651
70320
  } else {
69652
70321
  let findFontFiles = function(dir) {
69653
- const files = fs13.readdirSync(dir);
70322
+ const files = fs14.readdirSync(dir);
69654
70323
  for (const file2 of files) {
69655
- const filePath = path10.join(dir, file2);
69656
- const stat2 = fs13.statSync(filePath);
70324
+ const filePath = path11.join(dir, file2);
70325
+ const stat2 = fs14.statSync(filePath);
69657
70326
  if (stat2.isDirectory() && !file2.startsWith(".")) {
69658
70327
  findFontFiles(filePath);
69659
70328
  } else if (file2.endsWith(".ttf") || file2.endsWith(".otf")) {
@@ -69667,10 +70336,10 @@ async function installPowerlineFonts() {
69667
70336
  findFontFiles(tempDir);
69668
70337
  let installedCount = 0;
69669
70338
  for (const fontFile of fontFiles) {
69670
- const fileName = path10.basename(fontFile);
69671
- const destPath = path10.join(fontDir, fileName);
70339
+ const fileName = path11.basename(fontFile);
70340
+ const destPath = path11.join(fontDir, fileName);
69672
70341
  try {
69673
- fs13.copyFileSync(fontFile, destPath);
70342
+ fs14.copyFileSync(fontFile, destPath);
69674
70343
  installedCount++;
69675
70344
  } catch {}
69676
70345
  }
@@ -69688,9 +70357,9 @@ async function installPowerlineFonts() {
69688
70357
  message: "Platform-specific installation not implemented"
69689
70358
  };
69690
70359
  } finally {
69691
- if (fs13.existsSync(tempDir)) {
70360
+ if (fs14.existsSync(tempDir)) {
69692
70361
  try {
69693
- fs13.rmSync(tempDir, { recursive: true, force: true });
70362
+ fs14.rmSync(tempDir, { recursive: true, force: true });
69694
70363
  } catch {}
69695
70364
  }
69696
70365
  }
@@ -69856,7 +70525,7 @@ async function checkForUpdates({
69856
70525
  }
69857
70526
  }
69858
70527
  function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
69859
- return new Promise((resolve5, reject2) => {
70528
+ return new Promise((resolve6, reject2) => {
69860
70529
  const request3 = https2.request(NPM_REGISTRY_LATEST_URL, {
69861
70530
  headers: {
69862
70531
  Accept: "application/json",
@@ -69880,7 +70549,7 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
69880
70549
  reject2(new Error("npm registry response did not include a version"));
69881
70550
  return;
69882
70551
  }
69883
- resolve5(parsed.version);
70552
+ resolve6(parsed.version);
69884
70553
  } catch (error48) {
69885
70554
  reject2(error48 instanceof Error ? error48 : new Error(String(error48)));
69886
70555
  }
@@ -69896,13 +70565,17 @@ function fetchLatestNpmVersion(timeoutMs = DEFAULT_REGISTRY_TIMEOUT_MS) {
69896
70565
  function runGlobalPackageInstall(packageManager, version2, { platform: platform4 = process.platform } = {}) {
69897
70566
  const executable = getPackageManagerExecutable(packageManager, platform4);
69898
70567
  const args = packageManager === "npm" ? ["install", "-g", `ccstatusline-usage@${version2}`] : ["add", "-g", `ccstatusline-usage@${version2}`];
69899
- return new Promise((resolve5, reject2) => {
69900
- execFile2(executable, args, { timeout: GLOBAL_UPDATE_TIMEOUT_MS }, (error48) => {
70568
+ return new Promise((resolve6, reject2) => {
70569
+ execFile2(executable, args, {
70570
+ timeout: GLOBAL_UPDATE_TIMEOUT_MS,
70571
+ windowsHide: true,
70572
+ ...getPackageManagerShellOptions(executable, platform4)
70573
+ }, (error48) => {
69901
70574
  if (error48) {
69902
70575
  reject2(error48 instanceof Error ? error48 : new Error("Global update command failed"));
69903
70576
  return;
69904
70577
  }
69905
- resolve5();
70578
+ resolve6();
69906
70579
  });
69907
70580
  });
69908
70581
  }
@@ -71537,19 +72210,19 @@ var import_react41 = __toESM(require_react(), 1);
71537
72210
  var jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
71538
72211
  var AUTO_UPDATE_DESCRIPTION = "Runs `@latest` through npx/bunx. Stays current automatically, with a small startup cost when the package runner checks or resolves the package. Because it follows the latest published package, pinned install is available if you prefer explicit updates.";
71539
72212
  function getPinnedDescription(currentVersion) {
71540
- return `Installs \`ccstatusline-usage@${currentVersion}\` globally and Claude Code runs \`ccstatusline\`. Fast per-render and only changes when you update.`;
72213
+ return `Installs \`ccstatusline-usage@${currentVersion}\` globally and Claude Code runs \`ccstatusline\`. Fast on each render because Claude Code runs the installed ccstatusline binary directly. The version changes only when you update the global install.`;
71541
72214
  }
71542
72215
  function getStyleItems(currentVersion) {
71543
72216
  return [
71544
- {
71545
- label: "Auto-update",
71546
- value: "auto-update",
71547
- description: AUTO_UPDATE_DESCRIPTION
71548
- },
71549
72217
  {
71550
72218
  label: "Pinned global install",
71551
72219
  value: "pinned",
71552
72220
  description: getPinnedDescription(currentVersion)
72221
+ },
72222
+ {
72223
+ label: "Auto-update",
72224
+ value: "auto-update",
72225
+ description: AUTO_UPDATE_DESCRIPTION
71553
72226
  }
71554
72227
  ];
71555
72228
  }
@@ -71619,7 +72292,7 @@ var InstallMenu = ({
71619
72292
  initialPackageSelection = 0
71620
72293
  }) => {
71621
72294
  const [step, setStep] = import_react41.useState("style");
71622
- const [updateStyle, setUpdateStyle] = import_react41.useState("auto-update");
72295
+ const [updateStyle, setUpdateStyle] = import_react41.useState("pinned");
71623
72296
  use_input_default((_, key) => {
71624
72297
  if (key.escape) {
71625
72298
  if (step === "manager") {
@@ -73127,7 +73800,7 @@ function buildUninstallItems(installations) {
73127
73800
  items.push({
73128
73801
  label: `Remove Claude settings and ${packageManager} global package`,
73129
73802
  value: { packageManagers: [packageManager] },
73130
- description: `Runs ${packageManager === "npm" ? "npm uninstall -g ccstatusline" : "bun remove -g ccstatusline"} after removing Claude Code settings`
73803
+ description: `Runs ${packageManager === "npm" ? "npm uninstall -g ccstatusline-usage" : "bun remove -g ccstatusline-usage"} after removing Claude Code settings`
73131
73804
  });
73132
73805
  }
73133
73806
  if (removableManagers.length > 1) {
@@ -73491,7 +74164,7 @@ var OffHoursMenu = ({ settings, onUpdate, onBack }) => {
73491
74164
  // src/tui/components/PowerlineSetup.tsx
73492
74165
  await init_build2();
73493
74166
  var import_react47 = __toESM(require_react(), 1);
73494
- import * as os12 from "os";
74167
+ import * as os13 from "os";
73495
74168
 
73496
74169
  // src/utils/powerline-settings.ts
73497
74170
  init_colors();
@@ -74256,7 +74929,7 @@ var PowerlineSetup = ({
74256
74929
  }, undefined, false, undefined, this)
74257
74930
  ]
74258
74931
  }, undefined, true, undefined, this),
74259
- os12.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74932
+ os13.platform() === "darwin" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74260
74933
  children: [
74261
74934
  /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
74262
74935
  dimColor: true,
@@ -74272,7 +74945,7 @@ var PowerlineSetup = ({
74272
74945
  }, undefined, false, undefined, this)
74273
74946
  ]
74274
74947
  }, undefined, true, undefined, this),
74275
- os12.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74948
+ os13.platform() === "linux" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74276
74949
  children: [
74277
74950
  /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
74278
74951
  dimColor: true,
@@ -74288,7 +74961,7 @@ var PowerlineSetup = ({
74288
74961
  }, undefined, false, undefined, this)
74289
74962
  ]
74290
74963
  }, undefined, true, undefined, this),
74291
- os12.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74964
+ os13.platform() === "win32" && /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
74292
74965
  children: [
74293
74966
  /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
74294
74967
  dimColor: true,
@@ -74565,7 +75238,10 @@ function getRefreshIntervalSublabel(interval, supported) {
74565
75238
  }
74566
75239
  return `(${interval}s)`;
74567
75240
  }
74568
- function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval) {
75241
+ function getGitCacheTtlSublabel(ttlSeconds) {
75242
+ return ttlSeconds === 0 ? "(mtime only)" : `(${ttlSeconds}s)`;
75243
+ }
75244
+ function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval, gitCacheTtlSeconds) {
74569
75245
  return [
74570
75246
  {
74571
75247
  label: "\uD83D\uDD04 Refresh Interval",
@@ -74573,6 +75249,13 @@ function buildConfigureStatusLineItems(refreshInterval, supportsRefreshInterval)
74573
75249
  value: "refreshInterval",
74574
75250
  disabled: !supportsRefreshInterval,
74575
75251
  description: supportsRefreshInterval ? "How often Claude Code refreshes the status line by re-running the command. Enter value in seconds (1-60), or leave empty to remove." : "This setting requires Claude Code version 2.1.97 or later. Please update Claude Code to use this feature."
75252
+ },
75253
+ {
75254
+ label: "\uD83E\uDDEE Git Cache TTL",
75255
+ sublabel: getGitCacheTtlSublabel(gitCacheTtlSeconds),
75256
+ value: "gitCacheTtl",
75257
+ description: `How long git widget subprocess output can be reused while .git/HEAD and .git/index are unchanged. Enter 0-60 seconds;
75258
+ 0 disables age-based expiry, so cached output is reused until those git metadata mtimes change.`
74576
75259
  }
74577
75260
  ];
74578
75261
  }
@@ -74592,14 +75275,31 @@ function validateRefreshIntervalInput(value) {
74592
75275
  }
74593
75276
  return null;
74594
75277
  }
75278
+ function validateGitCacheTtlInput(value) {
75279
+ const parsed = parseInt(value, 10);
75280
+ if (value === "" || isNaN(parsed)) {
75281
+ return "Please enter a valid number";
75282
+ }
75283
+ if (parsed < 0) {
75284
+ return `Minimum Git cache TTL is 0s (you entered ${parsed}s)`;
75285
+ }
75286
+ if (parsed > 60) {
75287
+ return `Maximum Git cache TTL is 60s (you entered ${parsed}s)`;
75288
+ }
75289
+ return null;
75290
+ }
74595
75291
  var RefreshIntervalMenu = ({
74596
75292
  currentInterval,
74597
75293
  supportsRefreshInterval,
75294
+ gitCacheTtlSeconds,
74598
75295
  onUpdate,
75296
+ onGitCacheTtlUpdate,
74599
75297
  onBack
74600
75298
  }) => {
74601
75299
  const [editingRefreshInterval, setEditingRefreshInterval] = import_react48.useState(false);
75300
+ const [editingGitCacheTtl, setEditingGitCacheTtl] = import_react48.useState(false);
74602
75301
  const [refreshInput, setRefreshInput] = import_react48.useState(() => getRefreshInputValue(currentInterval));
75302
+ const [gitCacheTtlInput, setGitCacheTtlInput] = import_react48.useState(() => String(gitCacheTtlSeconds));
74603
75303
  const [validationError, setValidationError] = import_react48.useState(null);
74604
75304
  use_input_default((input, key) => {
74605
75305
  if (editingRefreshInterval) {
@@ -74635,6 +75335,33 @@ var RefreshIntervalMenu = ({
74635
75335
  }
74636
75336
  return;
74637
75337
  }
75338
+ if (editingGitCacheTtl) {
75339
+ if (key.return) {
75340
+ const error48 = validateGitCacheTtlInput(gitCacheTtlInput);
75341
+ if (error48) {
75342
+ setValidationError(error48);
75343
+ } else {
75344
+ const value = parseInt(gitCacheTtlInput, 10);
75345
+ onGitCacheTtlUpdate(value);
75346
+ setEditingGitCacheTtl(false);
75347
+ setValidationError(null);
75348
+ }
75349
+ } else if (key.escape) {
75350
+ setGitCacheTtlInput(String(gitCacheTtlSeconds));
75351
+ setEditingGitCacheTtl(false);
75352
+ setValidationError(null);
75353
+ } else if (key.backspace) {
75354
+ setGitCacheTtlInput(gitCacheTtlInput.slice(0, -1));
75355
+ setValidationError(null);
75356
+ } else if (key.delete) {} else if (shouldInsertInput(input, key) && /\d/.test(input)) {
75357
+ const newValue = gitCacheTtlInput + input;
75358
+ if (newValue.length <= 2) {
75359
+ setGitCacheTtlInput(newValue);
75360
+ setValidationError(null);
75361
+ }
75362
+ }
75363
+ return;
75364
+ }
74638
75365
  if (key.escape) {
74639
75366
  onBack();
74640
75367
  }
@@ -74670,16 +75397,53 @@ var RefreshIntervalMenu = ({
74670
75397
  children: "Press Enter to confirm, ESC to cancel. Leave empty to remove."
74671
75398
  }, undefined, false, undefined, this)
74672
75399
  ]
75400
+ }, undefined, true, undefined, this) : editingGitCacheTtl ? /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Box_default, {
75401
+ marginTop: 1,
75402
+ flexDirection: "column",
75403
+ children: [
75404
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75405
+ children: [
75406
+ "Enter Git cache TTL in seconds (0-60):",
75407
+ " ",
75408
+ gitCacheTtlInput,
75409
+ gitCacheTtlInput.length > 0 ? "s" : ""
75410
+ ]
75411
+ }, undefined, true, undefined, this),
75412
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75413
+ children: " "
75414
+ }, undefined, false, undefined, this),
75415
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75416
+ dimColor: true,
75417
+ wrap: "wrap",
75418
+ children: "This affects how quickly git widgets notice unstaged and untracked working-tree changes."
75419
+ }, undefined, false, undefined, this),
75420
+ validationError ? /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75421
+ color: "red",
75422
+ children: validationError
75423
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75424
+ dimColor: true,
75425
+ children: "0 disables age-based expiry; cache validity uses .git/HEAD and .git/index mtimes only."
75426
+ }, undefined, false, undefined, this),
75427
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
75428
+ dimColor: true,
75429
+ children: "Press Enter to confirm, ESC to cancel."
75430
+ }, undefined, false, undefined, this)
75431
+ ]
74673
75432
  }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(List, {
74674
75433
  marginTop: 1,
74675
- items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval),
75434
+ items: buildConfigureStatusLineItems(currentInterval, supportsRefreshInterval, gitCacheTtlSeconds),
74676
75435
  onSelect: (value) => {
74677
75436
  if (value === "back") {
74678
75437
  onBack();
74679
75438
  return;
74680
75439
  }
74681
- setRefreshInput(getRefreshInputValue(currentInterval));
74682
- setEditingRefreshInterval(true);
75440
+ if (value === "refreshInterval") {
75441
+ setRefreshInput(getRefreshInputValue(currentInterval));
75442
+ setEditingRefreshInterval(true);
75443
+ return;
75444
+ }
75445
+ setGitCacheTtlInput(String(gitCacheTtlSeconds));
75446
+ setEditingGitCacheTtl(true);
74683
75447
  },
74684
75448
  showBackButton: true
74685
75449
  }, undefined, false, undefined, this)
@@ -74730,6 +75494,7 @@ var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSepar
74730
75494
  terminalWidth,
74731
75495
  isPreview: true,
74732
75496
  minimalist: settings.minimalistMode,
75497
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
74733
75498
  lineIndex,
74734
75499
  globalSeparatorIndex,
74735
75500
  globalPowerlineThemeIndex
@@ -74746,7 +75511,12 @@ var StatusLinePreview = ({ lines, terminalWidth, settings, onTruncationChange })
74746
75511
  const { renderedLines, anyTruncated } = import_react49.default.useMemo(() => {
74747
75512
  if (!settings)
74748
75513
  return { renderedLines: [], anyTruncated: false };
74749
- const preRenderedLines = preRenderAllWidgets(lines, settings, { terminalWidth, isPreview: true, minimalist: settings.minimalistMode });
75514
+ const preRenderedLines = preRenderAllWidgets(lines, settings, {
75515
+ terminalWidth,
75516
+ isPreview: true,
75517
+ minimalist: settings.minimalistMode,
75518
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
75519
+ });
74750
75520
  const preCalculatedMaxWidths = calculateMaxWidthsFromPreRendered(preRenderedLines, settings);
74751
75521
  let globalSeparatorIndex = 0;
74752
75522
  let globalPowerlineThemeIndex = 0;
@@ -75375,7 +76145,7 @@ var UpdateCheckerMenu = ({
75375
76145
  };
75376
76146
  // src/tui/App.tsx
75377
76147
  var jsx_dev_runtime28 = __toESM(require_jsx_dev_runtime(), 1);
75378
- var GITHUB_REPO_URL = "https://github.com/sirmalloc/ccstatusline";
76148
+ var GITHUB_REPO_URL = "https://github.com/pcvelz/ccstatusline-usage";
75379
76149
  var NOTICE_ITEMS = [
75380
76150
  {
75381
76151
  label: "Continue",
@@ -75506,7 +76276,7 @@ var PinnedVersionMismatchScreen = ({
75506
76276
  }, undefined, true, undefined, this);
75507
76277
  };
75508
76278
  function getGlobalUninstallCommand(packageManager) {
75509
- return packageManager === "npm" ? "npm uninstall -g ccstatusline" : "bun remove -g ccstatusline";
76279
+ return packageManager === "npm" ? "npm uninstall -g ccstatusline-usage" : "bun remove -g ccstatusline-usage";
75510
76280
  }
75511
76281
  function buildUninstallConfirmMessage(selection) {
75512
76282
  if (selection.packageManagers.length === 0) {
@@ -76293,6 +77063,7 @@ ${GITHUB_REPO_URL}`,
76293
77063
  screen === "refreshInterval" && /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(RefreshIntervalMenu, {
76294
77064
  currentInterval: currentRefreshInterval,
76295
77065
  supportsRefreshInterval,
77066
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds,
76296
77067
  onUpdate: (interval) => {
76297
77068
  const previous = currentRefreshInterval;
76298
77069
  setCurrentRefreshInterval(interval);
@@ -76310,6 +77081,17 @@ ${GITHUB_REPO_URL}`,
76310
77081
  });
76311
77082
  setScreen("main");
76312
77083
  },
77084
+ onGitCacheTtlUpdate: (ttlSeconds) => {
77085
+ setSettings({
77086
+ ...settings,
77087
+ gitCacheTtlSeconds: ttlSeconds
77088
+ });
77089
+ setFlashMessage({
77090
+ text: "✓ Git cache TTL updated",
77091
+ color: "green"
77092
+ });
77093
+ setScreen("main");
77094
+ },
76313
77095
  onBack: () => {
76314
77096
  setScreen("main");
76315
77097
  }
@@ -76494,9 +77276,9 @@ function renderCompactOutput(preRenderedLines, settings, maxWidth) {
76494
77276
  // src/utils/compaction.ts
76495
77277
  init_zod();
76496
77278
  import * as crypto from "crypto";
76497
- import * as fs14 from "fs";
76498
- import * as os13 from "os";
76499
- import * as path11 from "path";
77279
+ import * as fs15 from "fs";
77280
+ import * as os14 from "os";
77281
+ import * as path12 from "path";
76500
77282
  var DEFAULT_DROP_THRESHOLD = 2;
76501
77283
  var FRESH_PREV_CTX_PCT = -1;
76502
77284
  var MAX_CACHE_FILE_BYTES = 4096;
@@ -76540,8 +77322,8 @@ function detectCompaction(currentCtxPct, state, options = DEFAULT_DROP_THRESHOLD
76540
77322
  ...currentWindowSize !== null ? { prevWindowSize: currentWindowSize } : {}
76541
77323
  };
76542
77324
  }
76543
- function getCacheDir2() {
76544
- return path11.join(os13.homedir(), ".cache", "ccstatusline", "compaction");
77325
+ function getCacheDir3() {
77326
+ return path12.join(os14.homedir(), ".cache", "ccstatusline", "compaction");
76545
77327
  }
76546
77328
  function sanitizeSessionId(sessionId) {
76547
77329
  const sanitized = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
@@ -76551,18 +77333,18 @@ function sanitizeSessionId(sessionId) {
76551
77333
  return sanitized;
76552
77334
  }
76553
77335
  function getStatePath(sessionId) {
76554
- return path11.join(getCacheDir2(), `compaction-${sanitizeSessionId(sessionId)}.json`);
77336
+ return path12.join(getCacheDir3(), `compaction-${sanitizeSessionId(sessionId)}.json`);
76555
77337
  }
76556
77338
  function loadCompactionState(sessionId) {
76557
77339
  const statePath = getStatePath(sessionId);
76558
77340
  let fd = null;
76559
77341
  try {
76560
- fd = fs14.openSync(statePath, fs14.constants.O_RDONLY | fs14.constants.O_NOFOLLOW);
76561
- const stats = fs14.fstatSync(fd);
77342
+ fd = fs15.openSync(statePath, fs15.constants.O_RDONLY | fs15.constants.O_NOFOLLOW);
77343
+ const stats = fs15.fstatSync(fd);
76562
77344
  if (!stats.isFile() || stats.size > MAX_CACHE_FILE_BYTES) {
76563
77345
  return FRESH;
76564
77346
  }
76565
- const raw = JSON.parse(fs14.readFileSync(fd, "utf-8"));
77347
+ const raw = JSON.parse(fs15.readFileSync(fd, "utf-8"));
76566
77348
  const result2 = CompactionStateSchema.safeParse(raw);
76567
77349
  return result2.success ? result2.data : FRESH;
76568
77350
  } catch {
@@ -76570,7 +77352,7 @@ function loadCompactionState(sessionId) {
76570
77352
  } finally {
76571
77353
  if (fd !== null) {
76572
77354
  try {
76573
- fs14.closeSync(fd);
77355
+ fs15.closeSync(fd);
76574
77356
  } catch {}
76575
77357
  }
76576
77358
  }
@@ -76578,20 +77360,20 @@ function loadCompactionState(sessionId) {
76578
77360
  function saveCompactionState(sessionId, state) {
76579
77361
  let tmpPath = null;
76580
77362
  try {
76581
- const dir = getCacheDir2();
76582
- if (!fs14.existsSync(dir)) {
76583
- fs14.mkdirSync(dir, { recursive: true });
77363
+ const dir = getCacheDir3();
77364
+ if (!fs15.existsSync(dir)) {
77365
+ fs15.mkdirSync(dir, { recursive: true });
76584
77366
  }
76585
77367
  const targetPath = getStatePath(sessionId);
76586
77368
  tmpPath = `${targetPath}.tmp.${process.pid}.${crypto.randomBytes(4).toString("hex")}`;
76587
- fs14.writeFileSync(tmpPath, JSON.stringify(state) + `
77369
+ fs15.writeFileSync(tmpPath, JSON.stringify(state) + `
76588
77370
  `);
76589
- fs14.renameSync(tmpPath, targetPath);
77371
+ fs15.renameSync(tmpPath, targetPath);
76590
77372
  tmpPath = null;
76591
77373
  } catch {
76592
77374
  if (tmpPath !== null) {
76593
77375
  try {
76594
- fs14.unlinkSync(tmpPath);
77376
+ fs15.unlinkSync(tmpPath);
76595
77377
  } catch {}
76596
77378
  }
76597
77379
  }
@@ -76602,27 +77384,27 @@ init_context_percentage();
76602
77384
  await init_config();
76603
77385
 
76604
77386
  // src/utils/hook-handler.ts
76605
- import * as fs16 from "fs";
76606
- import * as path13 from "path";
77387
+ import * as fs17 from "fs";
77388
+ import * as path14 from "path";
76607
77389
 
76608
77390
  // src/utils/skills.ts
76609
- import * as fs15 from "fs";
76610
- import * as os14 from "os";
76611
- import * as path12 from "path";
77391
+ import * as fs16 from "fs";
77392
+ import * as os15 from "os";
77393
+ import * as path13 from "path";
76612
77394
  var EMPTY = { totalInvocations: 0, uniqueSkills: [], lastSkill: null };
76613
77395
  function getSkillsDir() {
76614
- return path12.join(os14.homedir(), ".cache", "ccstatusline", "skills");
77396
+ return path13.join(os15.homedir(), ".cache", "ccstatusline", "skills");
76615
77397
  }
76616
77398
  function getSkillsFilePath(sessionId) {
76617
- return path12.join(getSkillsDir(), `skills-${sessionId}.jsonl`);
77399
+ return path13.join(getSkillsDir(), `skills-${sessionId}.jsonl`);
76618
77400
  }
76619
77401
  function getSkillsMetrics(sessionId) {
76620
77402
  const filePath = getSkillsFilePath(sessionId);
76621
- if (!fs15.existsSync(filePath)) {
77403
+ if (!fs16.existsSync(filePath)) {
76622
77404
  return EMPTY;
76623
77405
  }
76624
77406
  try {
76625
- const invocations = fs15.readFileSync(filePath, "utf-8").trim().split(`
77407
+ const invocations = fs16.readFileSync(filePath, "utf-8").trim().split(`
76626
77408
  `).filter((line) => line.trim()).map((line) => {
76627
77409
  try {
76628
77410
  return JSON.parse(line);
@@ -76676,14 +77458,14 @@ function handleHookInput(input) {
76676
77458
  return;
76677
77459
  }
76678
77460
  const filePath = getSkillsFilePath(sessionId);
76679
- fs16.mkdirSync(path13.dirname(filePath), { recursive: true });
77461
+ fs17.mkdirSync(path14.dirname(filePath), { recursive: true });
76680
77462
  const entry = JSON.stringify({
76681
77463
  timestamp: new Date().toISOString(),
76682
77464
  session_id: sessionId,
76683
77465
  skill: skillName,
76684
77466
  source: data.hook_event_name
76685
77467
  });
76686
- fs16.appendFileSync(filePath, entry + `
77468
+ fs17.appendFileSync(filePath, entry + `
76687
77469
  `);
76688
77470
  } catch {}
76689
77471
  }
@@ -76703,34 +77485,113 @@ var USAGE_WIDGET_TYPES = new Set([
76703
77485
  "block-timer",
76704
77486
  "reset-timer",
76705
77487
  "weekly-reset-timer",
76706
- "weekly-pace"
76707
- ]);
76708
- var PER_MODEL_USAGE_WIDGET_TYPES = new Set([
76709
- "weekly-sonnet-usage",
76710
- "weekly-opus-usage"
77488
+ "weekly-pace",
77489
+ "extra-usage-utilization",
77490
+ "extra-usage-remaining"
76711
77491
  ]);
77492
+ var USAGE_DATA_FIELDS = [
77493
+ "sessionUsage",
77494
+ "sessionResetAt",
77495
+ "weeklyUsage",
77496
+ "weeklyResetAt",
77497
+ "weeklySonnetUsage",
77498
+ "weeklySonnetResetAt",
77499
+ "weeklyOpusUsage",
77500
+ "weeklyOpusResetAt",
77501
+ "extraUsageEnabled",
77502
+ "extraUsageLimit",
77503
+ "extraUsageUsed",
77504
+ "extraUsageUtilization"
77505
+ ];
77506
+ var EMPTY_USAGE_REQUIREMENTS = [];
77507
+ var USAGE_WIDGET_REQUIREMENTS = {
77508
+ "session-usage": [{ field: "sessionUsage" }],
77509
+ "weekly-usage": [{ field: "weeklyUsage" }],
77510
+ "weekly-sonnet-usage": [{ field: "weeklySonnetUsage" }],
77511
+ "weekly-opus-usage": [{ field: "weeklyOpusUsage" }],
77512
+ "block-timer": [{ field: "sessionResetAt" }],
77513
+ "reset-timer": [{ field: "sessionResetAt" }],
77514
+ "weekly-reset-timer": [{ field: "weeklyResetAt" }],
77515
+ "weekly-pace": [{ field: "weeklyUsage" }, { field: "weeklyResetAt" }],
77516
+ "extra-usage-utilization": [
77517
+ { field: "extraUsageEnabled" },
77518
+ { field: "extraUsageUtilization" }
77519
+ ],
77520
+ "extra-usage-remaining": [
77521
+ { field: "extraUsageEnabled" },
77522
+ { field: "extraUsageLimit" },
77523
+ { field: "extraUsageUsed" }
77524
+ ]
77525
+ };
77526
+ var USAGE_CURSOR_REQUIREMENTS = {
77527
+ "session-usage": { field: "sessionResetAt" },
77528
+ "weekly-usage": { field: "weeklyResetAt" },
77529
+ "weekly-sonnet-usage": { field: "weeklySonnetResetAt", alternatives: ["weeklyResetAt"] },
77530
+ "weekly-opus-usage": { field: "weeklyOpusResetAt", alternatives: ["weeklyResetAt"] }
77531
+ };
76712
77532
  function hasUsageDependentWidgets(lines) {
76713
77533
  return lines.some((line) => line.some((item) => USAGE_WIDGET_TYPES.has(item.type)));
76714
77534
  }
76715
- function getPerModelUsageRequirements(lines) {
76716
- const requirements = {
76717
- opus: false,
76718
- sonnet: false
76719
- };
77535
+ function isUsageCursorEnabled2(item) {
77536
+ return item.metadata?.cursor === "true";
77537
+ }
77538
+ function getUsageFieldRequirements(lines) {
77539
+ const requirements = [];
76720
77540
  for (const line of lines) {
76721
77541
  for (const item of line) {
76722
- if (!PER_MODEL_USAGE_WIDGET_TYPES.has(item.type)) {
76723
- continue;
76724
- }
76725
- if (item.type === "weekly-sonnet-usage") {
76726
- requirements.sonnet = true;
76727
- } else if (item.type === "weekly-opus-usage") {
76728
- requirements.opus = true;
77542
+ requirements.push(...USAGE_WIDGET_REQUIREMENTS[item.type] ?? EMPTY_USAGE_REQUIREMENTS);
77543
+ const cursorRequirement = USAGE_CURSOR_REQUIREMENTS[item.type];
77544
+ if (cursorRequirement && isUsageCursorEnabled2(item)) {
77545
+ requirements.push(cursorRequirement);
76729
77546
  }
76730
77547
  }
76731
77548
  }
76732
77549
  return requirements;
76733
77550
  }
77551
+ function hasUsageDataField(data, field) {
77552
+ return data?.[field] !== undefined;
77553
+ }
77554
+ function isUsageRequirementSatisfied(data, requirement) {
77555
+ if (hasUsageDataField(data, requirement.field)) {
77556
+ return true;
77557
+ }
77558
+ return requirement.alternatives?.some((field) => hasUsageDataField(data, field)) ?? false;
77559
+ }
77560
+ function getMissingFetchFields(data, requirements) {
77561
+ const missing = new Set;
77562
+ for (const requirement of requirements) {
77563
+ if (!isUsageRequirementSatisfied(data, requirement)) {
77564
+ missing.add(requirement.field);
77565
+ }
77566
+ }
77567
+ return Array.from(missing);
77568
+ }
77569
+ function hasAnyUsageDataField(data) {
77570
+ return USAGE_DATA_FIELDS.some((field) => data?.[field] !== undefined);
77571
+ }
77572
+ function pickDefinedUsageFields(data) {
77573
+ return {
77574
+ ...data?.sessionUsage !== undefined ? { sessionUsage: data.sessionUsage } : {},
77575
+ ...data?.sessionResetAt !== undefined ? { sessionResetAt: data.sessionResetAt } : {},
77576
+ ...data?.weeklyUsage !== undefined ? { weeklyUsage: data.weeklyUsage } : {},
77577
+ ...data?.weeklyResetAt !== undefined ? { weeklyResetAt: data.weeklyResetAt } : {},
77578
+ ...data?.weeklySonnetUsage !== undefined ? { weeklySonnetUsage: data.weeklySonnetUsage } : {},
77579
+ ...data?.weeklySonnetResetAt !== undefined ? { weeklySonnetResetAt: data.weeklySonnetResetAt } : {},
77580
+ ...data?.weeklyOpusUsage !== undefined ? { weeklyOpusUsage: data.weeklyOpusUsage } : {},
77581
+ ...data?.weeklyOpusResetAt !== undefined ? { weeklyOpusResetAt: data.weeklyOpusResetAt } : {},
77582
+ ...data?.extraUsageEnabled !== undefined ? { extraUsageEnabled: data.extraUsageEnabled } : {},
77583
+ ...data?.extraUsageLimit !== undefined ? { extraUsageLimit: data.extraUsageLimit } : {},
77584
+ ...data?.extraUsageUsed !== undefined ? { extraUsageUsed: data.extraUsageUsed } : {},
77585
+ ...data?.extraUsageUtilization !== undefined ? { extraUsageUtilization: data.extraUsageUtilization } : {}
77586
+ };
77587
+ }
77588
+ function mergeUsageData(rateLimitsData, apiData) {
77589
+ return {
77590
+ ...pickDefinedUsageFields(apiData),
77591
+ ...pickDefinedUsageFields(rateLimitsData),
77592
+ ...apiData.error ? { error: apiData.error } : {}
77593
+ };
77594
+ }
76734
77595
  function epochSecondsToIsoString(epochSeconds) {
76735
77596
  if (epochSeconds === null || epochSeconds === undefined || !Number.isFinite(epochSeconds)) {
76736
77597
  return;
@@ -76749,10 +77610,7 @@ function extractUsageDataFromRateLimits(rateLimits) {
76749
77610
  const weeklySonnetResetAt = epochSecondsToIsoString(rateLimits.seven_day_sonnet?.resets_at);
76750
77611
  const weeklyOpusUsage = rateLimits.seven_day_opus === null ? 0 : rateLimits.seven_day_opus?.used_percentage ?? undefined;
76751
77612
  const weeklyOpusResetAt = epochSecondsToIsoString(rateLimits.seven_day_opus?.resets_at);
76752
- if (sessionUsage === undefined && weeklyUsage === undefined) {
76753
- return null;
76754
- }
76755
- return {
77613
+ const usageData = {
76756
77614
  sessionUsage,
76757
77615
  sessionResetAt,
76758
77616
  weeklyUsage,
@@ -76762,31 +77620,7 @@ function extractUsageDataFromRateLimits(rateLimits) {
76762
77620
  weeklyOpusUsage,
76763
77621
  weeklyOpusResetAt
76764
77622
  };
76765
- }
76766
- function hasCompleteRateLimitsUsageData(usageData, perModelRequirements) {
76767
- if (usageData?.sessionUsage === undefined || usageData.sessionResetAt === undefined || usageData.weeklyUsage === undefined || usageData.weeklyResetAt === undefined) {
76768
- return false;
76769
- }
76770
- if (perModelRequirements.sonnet && usageData.weeklySonnetUsage === undefined) {
76771
- return false;
76772
- }
76773
- if (perModelRequirements.opus && usageData.weeklyOpusUsage === undefined) {
76774
- return false;
76775
- }
76776
- return true;
76777
- }
76778
- function getRequiredUsageFields(perModelRequirements) {
76779
- const requiredFields = [];
76780
- if (perModelRequirements.sonnet) {
76781
- requiredFields.push("weeklySonnetUsage");
76782
- }
76783
- if (perModelRequirements.opus) {
76784
- requiredFields.push("weeklyOpusUsage");
76785
- }
76786
- return requiredFields;
76787
- }
76788
- function hasExtraUsageDependentWidgets(lines) {
76789
- return lines.some((line) => line.some((item) => item.type === "reset-timer"));
77623
+ return hasAnyUsageDataField(usageData) ? usageData : null;
76790
77624
  }
76791
77625
  async function prefetchUsageDataIfNeeded(lines, data) {
76792
77626
  if (!hasUsageDependentWidgets(lines)) {
@@ -76796,17 +77630,13 @@ async function prefetchUsageDataIfNeeded(lines, data) {
76796
77630
  const modelId = (typeof model === "string" ? model : model?.id) ?? "";
76797
77631
  const provider = resolveProvider(modelId);
76798
77632
  const rateLimitsData = extractUsageDataFromRateLimits(data?.rate_limits);
76799
- const perModelRequirements = getPerModelUsageRequirements(lines);
76800
- if (hasCompleteRateLimitsUsageData(rateLimitsData, perModelRequirements)) {
76801
- if (hasExtraUsageDependentWidgets(lines)) {
76802
- const apiData = await provider.fetchUsage({ requiredFields: getRequiredUsageFields(perModelRequirements) });
76803
- if (apiData.error === undefined) {
76804
- return { ...rateLimitsData, extraUsageEnabled: apiData.extraUsageEnabled, extraUsageLimit: apiData.extraUsageLimit, extraUsageUsed: apiData.extraUsageUsed, extraUsageUtilization: apiData.extraUsageUtilization };
76805
- }
76806
- }
77633
+ const requirements = getUsageFieldRequirements(lines);
77634
+ const missingFields = getMissingFetchFields(rateLimitsData, requirements);
77635
+ if (missingFields.length === 0) {
76807
77636
  return rateLimitsData;
76808
77637
  }
76809
- return provider.fetchUsage({ requiredFields: getRequiredUsageFields(perModelRequirements) });
77638
+ const apiData = await provider.fetchUsage({ requiredFields: missingFields });
77639
+ return mergeUsageData(rateLimitsData, apiData);
76810
77640
  }
76811
77641
 
76812
77642
  // src/ccstatusline.ts
@@ -76851,7 +77681,7 @@ async function ensureWindowsUtf8CodePage() {
76851
77681
  }
76852
77682
  try {
76853
77683
  const { execFileSync: execFileSync7 } = await import("child_process");
76854
- execFileSync7("chcp.com", ["65001"], { stdio: "ignore" });
77684
+ execFileSync7("chcp.com", ["65001"], { stdio: "ignore", windowsHide: true });
76855
77685
  } catch {}
76856
77686
  }
76857
77687
  async function renderMultipleLines(data) {
@@ -76922,7 +77752,8 @@ async function renderMultipleLines(data) {
76922
77752
  terminalWidth: effectiveWidth,
76923
77753
  compactionData: hasCompactionWidget ? { count: compactionCount } : null,
76924
77754
  isPreview: false,
76925
- minimalist: settings.minimalistMode
77755
+ minimalist: settings.minimalistMode,
77756
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
76926
77757
  };
76927
77758
  const preRenderedLines = preRenderAllWidgets(lines, settings, context);
76928
77759
  if (compact2 && compactWidth) {