v0.4.2 — desktop app cookies, a status line that tells the truth
The status line was lying, and now it isn't
statusline.shonly ever read an OAuth token from~/.claude/.credentials.jsonor theClaude Code-credentialsKeychain item. If you sign in through the Claude desktop app rather than the CLI, that token does not exist anywhere, so every refresh failed silently and the gauge served whatever was last cached. On the author's machine that was a file frozen since 24 May, showing a believable, permanent0%.- When no usable token is found, the status line now falls back to the session cookie through
fetch-usage.shand gets the same figures from the same usage endpoint. The cache records which path it used,"api"or"cookie". - A failed refresh can no longer damage a good cache.
The Claude desktop app is now a cookie source
- New
claude-app-cookie.pyreadssessionKey,cf_clearanceandlastActiveOrgfrom the desktop app's own cookie store, decrypting them with theClaude Safe StorageKeychain item. One-time approval of the macOS prompt is required, exactly like the Chrome path. - It is tried before Firefox and Chrome. It is the one client you are certainly signed into, and it refreshes its own session, whereas the browser paths quietly depend on claude.ai still being open and logged in somewhere. If it is unavailable, the chain falls through to the browsers unchanged.
- This fixes the queue and the status line from the same place.
Window times stop flickering between two minutes
- The reported
resets_atjitters about a second either side of the true boundary, and crosses it in both directions. One reset of12:10:00Zcame back as12:09:59.019,12:09:59.512,12:10:00.190and12:10:00.422on consecutive reads, from the meter and the API alike. .next_resetonly storesHH:MM, and every conversion truncated, so the displayed hour flipped between14:09and14:10at random. Real resets land on whole minutes, so the value is now snapped to the nearest minute at both places an epoch enters the system.- v0.4.1 fixed a real but different rounding bug in the
/usagetext fallback. It was not the cause of the flicker anyone actually saw; this is.
Notes
- 264 tests, up from 240. New: 21 for jitter and the desktop-app cookie source, plus a new
tests/test-statusline.shsuite. install.shlinks the new helper. Nothing on disk changes format, and existing queued tasks keep working.
🤖 Generated with Claude Code