usage

usage 0.11.12

工具與目錄
在這頁

新功能 2 項

01

系統學會自己修復連線,與其他工具和平共存不擾人

以前如果 Claude 的連線程式(hook,負責把用量傳出來的小程式)不小心被刪掉或過期了,你得自己打指令重裝。現在每次開啟 usage,它都會默默幫你檢查;如果是單純的檔案不見或版本太舊,它會一秒內自己修好,你完全不會發現。如果你同時有安裝別人的連線工具,它也不會偷偷蓋掉別人的設定,只會跳一次簡單的視窗問你要不要「共存」,點過一次以後就永遠不會再煩你。就像家裡的水管工,以前管子稍微鬆了還要你打電話叫他來,現在他會定期巡邏默默鎖緊;如果看到有別的師傅在施工,他也會禮貌地問一聲要不要配合,而且只問一次。

官方原文

**Hook self-heal: broken installs fix themselves, silently**: every startup now runs setup_hook.self_heal(), which silently repairs three clearly-safe scenarios: (1) first-run (is_setup()==False and no statusLine key in settings) → invokes setup(); (2) hook script version is out of date (needs_update()==True) → update_hook(); (3) settings points to a missing hook file with state us-direct/us-forwarder → re-runs _copy_hook_script() + _copy_forwarder_script(). When state is external/legacy-tt, all three skip (no silent override of third-party tools). Each action appends to settings["usage"]["selfHealLog"] (FIFO, 20 entries). Failures are swallowed; stderr is printed only when USAGE_DEBUG=1.

**Coexistence prompt consolidated**: when an external statusLine tool is detected, usage shows a single NSAlert with two buttons ("Enable Coexistence Mode" / "Keep Current Setup"). Either button sets settings["usage"]["forwarderModePromptDismissed"]=True and the prompt never appears again. Replaces the previous three-button repair dialog in main.py:health_check(); the "remind me later (24h cooldown)" path is removed. Users who previously chose "Do Not Ask Again" on the old dialog will be re-prompted once (one click resolves it).

02

隱藏診斷指令上線,額度用盡警告不再一驚一乍

現在如果遇到疑難雜症,你可以用一個隱藏的 --doctor 指令來印出英文診斷報告,方便上網抓藥。更棒的是,介面上的「每週額度燃燒警告」變穩重了。以前只要你連續十分鐘狂問問題,系統就會嚇得推算出「剩下 8 小時就會把整週額度用光」的誇張數字;現在它會觀察整整半小時,確定你真的是持續高用量才會發出警告,而且五種語言的警告文字都會明確加上「按目前速度」的免責聲明。就像車子的油表預測,以前你只是踩了一腳油門超車,它就警告你油只夠開三公里;現在它會看你這半小時的平均車速再來估計,還會老實告訴你「這是用你現在猛踩油門的速度算的」。

官方原文

**--doctor hidden CLI flag**: python3 main.py --doctor prints a plain-text diagnostic report (English-only for easier GitHub issue searches) covering hook state, version, script file status, status file mtime, external hook detection (recognizes ccusage / lord-kali keywords), forwarder prompt ack state, last 5 self-heal log entries, and Codex sessions scan count. Hidden from --help via argparse.SUPPRESS so it doesn't distract typical users. New doctor.py renderer module.

**Weekly burn warning no longer over-reacts to short bursts**: previously the weekly warning extrapolated from the most recent 10-minute sample window, so a single large prompt could trigger a scary "8 hours until empty" warning that vanished once the user took a break. The weekly warning now uses a 30-minute sample window with a 30-minute minimum span, requiring sustained high usage for at least half an hour before triggering. Session warnings keep the 10-minute window (session resets are frequent, can't be too strict). burn_rate.ROLLING_WINDOW_SECONDS was raised from 15 to 60 minutes so the longer window has enough history.

**Burn warning text now says "at current pace"**: all 5 languages' burn warning strings now explicitly include "按目前速度 / At current pace / 現在のペース / 현재 속도", making it clear that this is a momentary extrapolation rather than a stable prediction.