Phase 3: usage screen

GET /usage serves the numbers behind Claude Code's /usage, read with the
CLI's own stored OAuth credentials (nothing to configure). The endpoint
is undocumented, so parsing is defensive -- the generic limits[] array
becomes labeled window bars, unknown kinds surface under their raw name,
and any failure degrades to an 'unavailable' snapshot with the reason.
One UsageProvider per paid service behind a caching monitor that
enforces the >=180s minimum poll regardless of phone refreshes; no
background polling at all. ureq (rustls) does the outbound call, with
the process-level CryptoProvider now chosen explicitly in main -- ureq
brings ring while axum-server brings aws-lc-rs, and with both in the
graph rustls refuses to guess.

App: a Usage screen off the session list -- per-window bars colored by
utilization with relative reset times. Verified live: 74%/26%/16%
windows rendered against the real endpoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw
This commit is contained in:
irisandClaude Fable 5 committed 2026-08-24 21:47:51 -04:00
1 parent f2430671a2
commit 3c97a5ef28
10 files changed
+606 -10

No files matched your search

@@ -16,6 +16,7 @@ private sealed class Screen {
data object SessionList : Screen()
data class Session(val summary: SessionSummary) : Screen()
data object Spawn : Screen()
data object Usage : Screen()
data object Settings : Screen()
}
@@ -54,6 +55,7 @@ fun AppRoot(settingsVersion: Int) {
reloadToken = reloadToken,
onOpen = { screen = Screen.Session(it) },
onSpawn = { screen = Screen.Spawn },
onUsage = { screen = Screen.Usage },
onSettings = { screen = Screen.Settings },
)
is Screen.Session -> {
@@ -81,6 +83,10 @@ fun AppRoot(settingsVersion: Int) {
onBack = { screen = Screen.SessionList },
)
}
is Screen.Usage -> {
BackHandler { screen = Screen.SessionList }
UsageScreen(settings = current, onBack = { screen = Screen.SessionList })
}
is Screen.Settings -> {
BackHandler { screen = Screen.SessionList }
SettingsScreen(