mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 11:53:10 +08:00
16e58b92c0
The context panel could say what was in the window but nothing about what the session had spent: no total token count, no cache hit rate, no generation speed. The numbers were already on the wire — translateCliUsage picked four token buckets out of the CLI's result message and dropped duration_ms, duration_api_ms and num_turns with them — and nothing anywhere accumulated how long the model spent emitting tokens rather than waiting on prefill. Measure that span where it happens: a decode span opens at the first generated delta and closes at message_stop, rides the stream_event up to QueryEngine, and accumulates in cost-tracker beside totalAPIDuration, including the project config restore path so it survives a CLI restart. Tokens/sec is output over that span, never over wall clock, which would divide by tool execution time. The totals needed fixing before they were worth showing. Claude Code persists one JSONL line per content block of a reply and repeats the whole usage object on every one, so summing lines overstated real transcripts by 2.2x — and chooseRicherUsage prefers the larger of two snapshots, so the inspector actively selected the inflated one. The transcript readers and the renderer's history summary now deduplicate on usageAccounting's key, the rule stats.ts and the activity index already use. The panel polls a usageOnly inspection mode while it is open and stops when it closes: one get_session_usage control, no skills-directory scan, no transcript re-read, and no request stacked behind one that has not answered.
Claude Code Haha Desktop
基于 Tauri 2 + React 的桌面客户端。
开发
bun install
bun run tauri dev
构建
# macOS (Apple Silicon)
./scripts/build-macos-arm64.sh
# Windows (x64, MSI only)
.\scripts\build-windows-x64.ps1
构建产物位于 build-artifacts/ 目录,文件名会显式包含平台、架构和包类型。
常见问题
macOS 提示"已损坏,无法打开"
xattr -cr /Applications/Claude\ Code\ Haha.app