usage

usage 0.11.16

工具與目錄
在這頁

修正 2 項

01

解決 Codex 區塊破圖與專案名稱解析錯誤

你的 Codex 面板現在不會因為幾次中斷的對話就整塊變成空白了。以前如果你連續跑了幾個極短的對話(例如剛跑就按 Ctrl-C 取消),系統往前找資料時會被這幾個「空包彈」洗版,找不到額度資料就直接罷工顯示「--」;現在它會往回翻找更久的紀錄,確實把你該有的配額顯示出來。此外,以前專案資料夾名稱裡如果有連字號(例如 my-awesome-project),系統會自作聰明把它切碎,讓你認不出自己的專案;現在它學會了正確拼湊連字號,你的專案終於能用原本的名字見人了。就像你去超商查點數,以前店員只要看到你最近五筆消費都是 0 元,就會直接告訴你查不到資料,而且還會把你的名字念錯;現在他會往前多翻幾頁找出你真正的餘額,而且終於把你的名字念對了。

官方原文

**Codex usage panel no longer falls back to -- after a burst of short sessions**: codex_loader.load_rate_limits() only scanned the 5 most recent jsonl files via _recent_jsonl_files() to find rate_limits. Codex CLI (observed on 0.134.0) writes payload.rate_limits == null for short or interrupted sessions (a quick codex exec run, Ctrl-C, etc.); when the latest 5 sessions all fall into that bucket, the genuinely-valid prior session gets evicted from the lookup window and the entire Codex block in the popover / TUI renders as --. The scan window is widened from 5 to 30 (covers a typical 1–2 day usage range); the first non-null result still early-returns, and the primary.used_percent / secondary.used_percent parsing path is unchanged. The new Codex CLI 0.134.0 schema fields (limit_id, limit_name, credits, plan_type, rate_limit_reached_type) are deliberately not parsed — UI doesn't use them. Three new tests cover the "5 null then 6th valid", "all 30 null returns None", and "pick most recent valid" scenarios.

**Dashed Claude Code project names now decode correctly**: history_loader._project_from_path previously replaced every - in the encoded directory name with /, so Desktop-claude-tutorial-video would become /Desktop/claude/tutorial/video — a non-existent path. resolve_project_name's fallback then took the last segment, mis-labeling the project as "video" instead of "claude-tutorial-video". The decoder now tries the all-slash candidate first; on miss, it DFS-walks the segments, joining adjacent ones with - and preferring whichever variant actually exists on disk. When nothing matches, the encoded name (minus the leading -) is kept as-is so dashes round-trip (plain-project stays plain-project). For most users, the JSONL cwd field already overrides the project name, so this primarily fixes older entries that lack cwd.

02

終端介面語系同步,背景常駐不再狂吃記憶體

現在你用終端機打開用量表時,它的語言會跟選單列完全一致。以前終端機有自己的小脾氣,只認得繁體中文跟英文,如果你用日文或韓文介面,它還是會硬塞英文給你;現在它們終於說同一種語言了。同時,我們解決了常駐程式越跑越吃資源的問題。以前系統會把你看過的所有歷史紀錄都永遠塞在記憶體裡,對話越多,它佔用的記憶體就越肥;現在我們幫它裝了個「只能記 512 筆」的腦袋,塞滿了就會自動忘掉最舊的。就像圖書館以前把所有借回來的書都堆在櫃檯不還回去,導致櫃檯被塞爆;現在櫃檯規定只能放 512 本書,有新的書進來,就會把最舊的書乖乖放回書架上。

官方原文

**TUI language detection routed through usage_lang.detect_lang**: tui.py had its own detector that only returned zh-TW or en (treating simplified Chinese, Japanese, and Korean as English), and ignored USAGE_LANG / TT_LANG / LANG entirely. The menubar already used usage_lang.detect_lang(), so the same machine could show Japanese in the menubar and English in the TUI. The TUI now shares the same detector — all five languages render consistently.

**LRU cap on history / codex loader caches**: _file_cache and _jsonl_cache were unbounded module-level dicts. As ~/.claude/projects/ and ~/.codex/sessions/ accumulated more jsonl files over time, the menubar's resident memory grew without bound — parsed UsageEntry lists never got released. Both caches are now OrderedDicts with a 512-entry ceiling: cache hits move_to_end to mark MRU, inserts on a full cache popitem(last=False) the oldest. The mtime/size invalidation logic and codex_loader's entry.model rebind on cache hit are unchanged.