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

+14 -4
View File
@@ -222,9 +222,9 @@ POST /sessions/:id/answer {question_id, answer} (questions and per
POST /sessions/:id/interrupt
POST /sessions/:id/model {model}
POST /sessions/:id/compact (llama sessions)
POST /sessions/:id/attachments multipart upload → id (referenced by /message)
GET /sessions/:id/files/:ref images the session produced or was sent
DELETE /sessions/:id kill process, release llama-server, delete transcript+files
POST /attachments multipart upload → id (referenced by /message)
GET /files/:session/:id images/files the session produced
GET /usage cached usage windows
GET/PUT /hosts, /models config editing from the phone
```
@@ -395,9 +395,19 @@ window just fills.
numbers, delete); the app on the `tdep` emulator against the real
server (QR-style enrollment via deep link, spawn, streamed echo turn,
question answer, tool card).
2. **Claude local** — ClaudeDriver: spawn, stream text/tools, mid-run send,
interrupt, permission questions, AskUserQuestion, images both ways, delete.
2. **Claude local** — *done 2026-08-24.* ClaudeDriver: spawn, stream
text/tools, mid-run send, interrupt, permission questions,
AskUserQuestion, images both ways, delete.
*Milestone: daily-drivable Claude replacement on localhost.*
Wire-format notes live in `session/claude.rs`'s module doc (pinned
against CLI 2.1.237): permissions need the hidden
`--permission-prompt-tool stdio` flag; AskUserQuestion answers ride
`updatedInput.answers` keyed by question text; `set_model`/`interrupt`
are control requests; 2.x permission modes are acceptEdits / auto /
bypassPermissions / manual / dontAsk / plan (no more "default").
Attachments/files were re-homed under `/sessions/:id/…` (table above)
so their lifecycle is the session directory's — delete stays the
complete path out.
3. **Usage screen.**
4. **llama.cpp** — LlamaServerManager (local), PiDriver, model change,
compaction controls.