Add per-session claude token/cost usage panel (WSL, v1)
Reads ~/.claude/projects/*.jsonl transcripts from the open WSL panes'
distros and shows per-session token counts + estimated USD cost, with a
running total in the titlebar.
Backend (src-tauri/src/usage.rs): new get_claude_usage command. For each
distro it probes $HOME once via wsl.exe, reaches the transcripts over the
\\wsl.localhost UNC share, and tallies message.usage per model per
session (summed by each line's model, since a session can switch models).
Results cached by (path,size,mtime) so polling only re-parses the file
that grew; recency-capped (30d / 50 sessions) to bound scan cost.
Windows-only; returns [] elsewhere. quiet_command made pub(crate).
Frontend: src/lib/usage.ts holds the pricing table (per-MTok rates,
matched by model-family substring) + cost/format helpers, so rates are
editable without recompiling Rust. UsagePanel.tsx mirrors the MCP panel
modal; rows whose transcript cwd matches an open pane are highlighted
with a [pane: label] tag. App polls every 20s (visible windows) for the
titlebar 💰 total and every 5s while the panel is open. Ctrl+Shift+U
opens it; added to shortcuts.ts + regenerated README.
tsc clean. Rust builds on the Windows host; needs runtime verification.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a6d3f8a9f9
commit
1df8c3181b
10 changed files with 813 additions and 2 deletions
14
README.md
14
README.md
|
|
@ -61,7 +61,10 @@ A Windows desktop app for running and arranging many WSL terminals at once. Buil
|
|||
| Key | Action |
|
||||
|---|---|
|
||||
| `Ctrl+K` | Open jump-to-pane palette |
|
||||
| `Ctrl+Shift+← / → / ↑ / ↓` | Focus neighbour pane in that direction |
|
||||
| `Ctrl+Shift+← / → / ↑ / ↓` | Focus neighbour pane in that direction (window-level — works even when no terminal is focused) |
|
||||
| `Ctrl+Alt+← / → / ↑ / ↓` | Focus neighbour pane in that direction (from inside the terminal — intercepted before the PTY sees it) |
|
||||
| `Ctrl+Alt+H / J / K / L` | Same as Ctrl+Alt+Arrow but in Vim-style HJKL order (left / down / up / right) |
|
||||
| `Alt+1 … Alt+9` | Focus the Nth pane in layout order (DFS: left-to-right, top-to-bottom); clamped to pane count. Note: swallows bare Alt+digit — shells using readline digit-argument or vim buffer-jump may conflict. |
|
||||
|
||||
**Broadcast**
|
||||
|
||||
|
|
@ -82,6 +85,15 @@ A Windows desktop app for running and arranging many WSL terminals at once. Buil
|
|||
| Key | Action |
|
||||
|---|---|
|
||||
| `Ctrl+Shift+C / Ctrl+Shift+V` | Copy selection / paste in terminal |
|
||||
| `Ctrl+Shift+F` | Open find-in-scrollback bar for the focused pane |
|
||||
| `Enter / Shift+Enter` | Next / previous match (while search bar is focused) |
|
||||
| `Escape` | Close find bar and return focus to terminal |
|
||||
|
||||
**Panels**
|
||||
|
||||
| Key | Action |
|
||||
|---|---|
|
||||
| `Ctrl+Shift+U` | Open the usage panel — per-session claude token counts + estimated cost for the open WSL panes |
|
||||
|
||||
**Help**
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue