Skip to content

Nanako0129/TokenBar-Windows

Repository files navigation

TokenBar for Windows

Windows port of TokenBar — the menu-bar/tray AI coding-agent token-usage monitor. Same Rust parsing core, a native WinUI 3 shell.

Status: pre-alpha, under active development. See the progress table below. The macOS app is the shipping reference implementation.

Architecture

Layer Path Notes
Rust core crates/tb_core_ffi + vendor/tokscale-core Copied from the macOS repo (single sync source — see vendor/tokscale-core/SYNC.md). C ABI, JSON envelope, built as cdylib for P/Invoke
C ABI contract include/ctb.h 10 entry points, {"ok":true,"data":…} / {"ok":false,"err":…}
Interop src/TokenBar.Interop net10.0, platform-neutral — P/Invoke facade + envelope decode
Logic src/TokenBar.Core net10.0, platform-neutral — C# port of the macOS TokenBarCore (in progress)
Shell src/TokenBar.App WinUI 3, unpackaged. Windows-only build (not in the slnx): dotnet build src/TokenBar.App -c Release -p:Platform=x64

Build

# macOS (inner loop — no Windows needed)
scripts/check.sh

# Windows
.\scripts\dev.ps1

Prereqs: Rust (stable), .NET 10 SDK; on Windows the MSVC toolchain.

Progress

Phase Scope Status
0 Repo bootstrap + P/Invoke smoke ✅ 2026-07-02 — C# ↔ Rust cdylib seam verified on macOS (tb_probe → 84k messages), CI on windows-latest
1 Rust Windows fixes (HOME→dirs, TLS, antigravity) ✅ 2026-07-02 — all 10 entry points verified on a real x64 Windows box against real session data (271 msgs parsed, pricing fetched over rustls, quota windows decoded)
2 3D contribution graph spike ✅ 2026-07-02 — GO (Vortice/D3D11 instancing verified on real hardware, ~0.2ms/frame; SwapChainPanel lifecycle rides with Phase 4). See spike/RESULTS.md
3 TokenBar.Core C# port + cross-check vs Swift ✅ 2026-07-16 — all modules ported (incl. the v1.4.0 delta: client tabs order/hide bookkeeping, saturating folds, Grok), 150 unit tests green; fixture cross-check vs Swift done (crosscheck/, 115 cases, zero material diff after it caught 4 real printf-rounding divergences in Format — pre-round deleted, .NET Core F-formats are IEEE-correct)
4 Tray skeleton + flyout window ✅ 2026-07-02 — tray icon + Open/Quit menu, borderless rounded Acrylic flyout (translucent while unfocused, topmost), PerMonitorV2 DPI, show/hide slide, single instance, taskbar-edge placement, polling engine. Deferred to polish backlog: SwapChainPanel lifecycle, compositor-native animation
5 Overview lens + polling engine ✅ 2026-07-02 — five cards (stacked chart + wrap legend, agent limits with live pace markers, trace, models, streaks), instant styled hover tooltips, WH_MOUSE_LL wheel path
6 Remaining five lenses ✅ 2026-07-02 — lens router with 160ms crossfade transitions; Models (full list + pricing hint), Daily (tap drill-down), Hourly (Timeline/Profile + show-more), Stats, Agents; lazy report loading. Verified by the user against the full synced history (5.6B tokens / 70 days). Cold first paint 11.1s → 3.8s (warm 3.2s) after the EcoQoS/priority fix + mac-parity slow lane: schtasks-launched processes inherit BELOW_NORMAL and Windows 11 throttles tray apps (EcoQoS) — the app now parses at normal QoS and returns to power-friendly throttling when idle; graph ∥ modelReport run concurrently and agentUsage no longer gates the first snapshot (both mirror the macOS DashboardModel)
7 Settings + tray extras 🔶 feature-complete (macOS parity) — settings store (%APPDATA%\TokenBar\settings.json, atomic, unit-tested) with the year filter, chart persistence, manual-refresh spinner; tray: seven modes with the value drawn into the icon (tooltip carries the full string), bars/ring/popsicle gauges (macOS geometry verbatim), cat/parrot animation (HICON-cached, ~0.5% of a core at idle), full context menu with live quota sources; Mica settings window (nine sections, live keys, autostart via HKCU Run honoring StartupApproved); flyout footer gear+Quit; in-flyout Ctrl-shortcut set. Global RegisterHotKey dropped: the macOS reference ships no global shortcut, so it's not a parity gap (parked as an optional Windows-only nicety in Phase 9). Verification: icon gallery + live tray screenshots + synthesized input on the x64 box; settings window interactive pass pending
8 3D integration 🔶 feature-complete 2026-07-16 — product card now renders the real contribution grid with macOS-parity colors/lighting (sRGB-correct opaque faces), 4× MSAA, render-on-demand orbit/pan/zoom, persisted tokenbar.orbit.v1, Fit/Reset, custom ray-picked tooltip, and a persisted 2D/3D toggle. Real x64 checks: pointer/DPI alignment corrected, 2D↔3D 6.7–20.1ms, 241-frame drag trace, idle no-present, and final --soak3d 50-cycle lifecycle pass created=50 released=50 removed=0 errors=0. Final gate: one-hour open/close soak.
9 Polish + parity + vendor re-sync 🔶 vendor re-sync done early (2026-07-16): crates+vendor at macOS v1.4.0 (2ed256ee), cache schema 29, SYNC.md patch table zeroed (rustls + cdylib upstreamed), Interop threads the new hourly/agents clients filter · queued next in an isolated worktree: macOS historical-pace-v2 source 80b0ee3 (nested quota history contract, pace semantics/presentation, fixtures/cross-check) · backlog: shell parity for the v1.4.0 client-tabs reorder/hide UI + demo mode (logic layer ready, App wiring pending); optional Windows-only global hotkey to toggle the flyout (no macOS equivalent — needs a key-binding UI)
10–12 Releases → Velopack → winget/Scoop

Credits

Parsing engine vendored from tokscale by junhoyeo. Original menu-bar concept by handlecusion's tokcat.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages