agy-bar 0.0.0-stage → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,33 @@
1
+ # AGENTS.md — AI-Assisted Installation Guide for `agy-bar`
2
+
3
+ If a user asks you to install **agy-bar** into their Antigravity CLI (`agy`), follow these exact steps:
4
+
5
+ 1. **Verify prerequisites**
6
+ - Run `node -v` and confirm Node.js is **20.0.0 or newer**.
7
+ - If Node.js is missing or older than 20, stop and inform the user; do **not** install or upgrade Node.js automatically.
8
+
9
+ 2. **Choose installation method**
10
+ - **Recommended (via npm, zero clone):** run `npx -y agy-bar install` (or `npx -y agy-bar install --proxy-hook` if the user wants the shell hook below) and verify with `agy-bar doctor`.
11
+ - **Or from GitHub `main`:**
12
+ - If you are already inside a clean `agy-bar` clone on `main` pointing to `xy-tuoren/agy-bar` with an empty `git status --porcelain`, run `git pull --ff-only origin main`.
13
+ - Otherwise clone fresh into a clean directory (e.g. `~/agy-bar` on macOS/Linux/WSL or `%USERPROFILE%\agy-bar` on Windows):
14
+ ```sh
15
+ git clone https://github.com/xy-tuoren/agy-bar.git ~/agy-bar
16
+ ```
17
+
18
+ 3. **Ask about the optional no-TUN proxy shell hook, then run the installer & self-check**
19
+ - Before running `install`, briefly ask the user whether they also want `agy-bar` to add a 7-line managed `agy()` function to their shell rc (`~/.zshrc` / `~/.bashrc` / `config.fish`) so typing plain `agy` automatically uses their local proxy (Clash/Surge/v2ray) without TUN mode (removable anytime via `agy-bar proxy unhook` or `uninstall`).
20
+ - If the user says **yes**, pass `--proxy-hook`; if **no** (or unsure), omit it so their shell rc stays completely untouched (they can still use `agy-bar run` anytime).
21
+ ```sh
22
+ cd ~/agy-bar
23
+ node bin/agy-bar.mjs install # or: node bin/agy-bar.mjs install --proxy-hook
24
+ node bin/agy-bar.mjs doctor
25
+ ```
26
+ - Zero third-party dependencies: do **not** run `npm install`.
27
+ - Non-interactive `install` leaves `~/.zshrc` untouched by default unless `--proxy-hook` is passed (or an existing managed hook is already present).
28
+ - Installs the statusline runtime, global `~/.local/bin/agy-bar` command, and companion `/agy-bar` skill by default. Pass `--no-skill` only if the user explicitly opts out or if an unrelated `agy-bar` skill already exists (never overwrite unrelated skills).
29
+
30
+ 4. **Strict safety boundaries**
31
+ - Never modify `agy-bar` source files, Antigravity binaries, or unrelated fields in `~/.gemini/antigravity-cli/settings.json`.
32
+ - Never kill or restart the user's running `agy` process.
33
+ - After confirming `doctor` passes, inform the user in their language to **restart `agy`** (and optionally run `/skills reload` in existing sessions to load `/agy-bar`).
package/CHANGELOG.md ADDED
@@ -0,0 +1,163 @@
1
+ # Changelog
2
+
3
+ All notable changes to **agy-bar** are documented here.
4
+
5
+ ## [0.9.0] - 2026-11-26
6
+
7
+ ### Added
8
+ - **Live Dynamic Pricing Cache & 24h Background SWR Sync (`src/pricing.mjs`, `src/pricing-sync.mjs`, `agy-bar pricing`)**:
9
+ - Calibrated built-in fallback rates to real public API pricing for **Gemini 4 Neon** (`$3/$15/$0.15`), **Carbon / Argon** (`$2/$10/$0.10`), **Hydrogen** (`$1.5/$7.5/$0.075`), **Gemini 3.8 Flash** (`$0.75/$3.75`), and **Claude Opus 4.5–4.8** (`$5/$25/$0.50`), **Sonnet** (`$3/$15`), **Haiku 4.5** (`$1/$5`).
10
+ - Added 3-tier `< 0.1ms` local pricing lookup (`config.customPricing` → synced `~/.gemini/config/agy-bar/pricing-cache.json` → built-in calibrated rates), memoized by file `mtimeMs`.
11
+ - Added zero-dependency proxy-aware HTTPS sync (`models.dev/api.json` primary with automatic `LiteLLM` fallback, `gzip`, `ETag` `304`, sanity bounds, and atomic writes; works without TUN via local HTTP CONNECT proxy).
12
+ - Enabled non-blocking 24h background Stale-While-Revalidate (`pricingAutoSync: true`, single-flight 6h failure backoff; opt out anytime via `agy-bar config set pricingAutoSync off`).
13
+ - Added `agy-bar pricing show | sync | set | reset` CLI commands.
14
+ - **Subagent Cost Rollup & Complete Uninstall Env Cleanup (`src/history-scan.mjs`, `src/proxy.mjs`, `src/installer.mjs`)**:
15
+ - Rolls up spawned subagent (and nested descendant) token spend into the parent conversation's live `~$...` cost via read-only `conversation_summaries.db` parent ID links (zero chat text read, zero double-counting of daily totals), automatically tightening usage summary refresh to `20s` while subagents are running (`⚡N`).
16
+ - Made `agy-bar uninstall` clean orphan shell hooks/shims even when backup metadata is absent, print exact shell-specific unset commands for the active terminal, and support `eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"` for one-shot disk + live-shell env cleanup.
17
+ - **Compact `~` Workspace Paths & Live Git Diff Line Counts (`dirStyle`, `show.gitDiff`)**:
18
+ - Top-left workspace display now defaults to a clean home-abbreviated path (`~/code`, `~/code/agy-bar`, or `~/…/client/agy-bar` for deep directories), automatically falling back to folder name on narrow split panes.
19
+ - Displays live green/red workspace diff stats (`+142 -38`) right beside the Git branch (covering tracked staged/unstaged changes via `git diff --numstat HEAD` plus new untracked non-binary text files, sharing the 3s session cache and hidden automatically when clean).
20
+ - **Automatic Cross-Terminal 256-Color & Light-Theme Adaptation (`src/ansi.mjs`, `src/stats.mjs`, `src/monitor.mjs`)**:
21
+ - Automatically downscales 24-bit RGB colors to nearest xterm-256 palette (`\x1b[38;5;Nm`) in macOS `Terminal.app` (`Apple_Terminal`) and `tmux` / `screen` / SSH terminals without `COLORTERM=truecolor`, and honors `NO_COLOR` and `TERM=dumb`.
22
+ - Added dedicated light-mode heatmap palettes when using `slate-light`, and shrunk `agy-bar stats` card grid width to `77` cols so it fits cleanly inside standard 80-column terminals without wrapping.
23
+
24
+ ### Improved
25
+ - **Cleaner Two-Line Information Architecture & Calmer Palette (`src/render.mjs`)**:
26
+ - **Line 1 (Identity + Cumulative Overview)**: Removed idle `? for shortcuts` clutter so compact workspace path, Git branch, and `PX 7897` lead cleanly; busy state lights up a compact `● 30s · esc` indicator. Merged daily tokens and daily cost into one cohesive `DAY 136M/$13.2 · WK 810M · MO 875M · ALL 906M` strip with a calm neutral palette so green/amber/red stay reserved for live health signals.
27
+ - **Line 2 (Live Session Left, Account Quotas Right)**: Placed the current conversation's estimated spend (`~$0.18`) alongside `CTX`, `CACHE`, and `TTFT·t/s` on the left, keeping the right side dedicated exclusively to steady `5h` / `7d` quota gauges even on 116-column split panes.
28
+ - **Zero-Subprocess Statusline Hot Path & Atomic Writes (`src/fs-atomic.mjs`, `tab-title.mjs`, `git.mjs`, `step-timing.mjs`, `themes.mjs`)**:
29
+ - Added `process.ppid === prevTabHostPid` fast path in `syncTabTitle`, 3-second `git status` cache, SQLite `.db`/`.db-wal` `mtime` stamp skip, 5-minute Windows Registry theme cache, and temp-file + `renameSync` atomic writes across all state files.
30
+ - Deduplicated protobuf decoder across `step-timing.mjs` and `history-scan.mjs`.
31
+ - **`agy-bar monitor` Polish & Visual Showcase**: Fixed CJK column width alignment, aligned context bar colors with `config.colorMode`, replaced raw quota keys with friendly labels (`5h`, `7d`, `Claude 5h`), added a live `Cost` column, and added `assets/stats-preview.svg`.
32
+
33
+ ### Fixed
34
+ - **Self-Reinstall Guard (`src/installer.mjs`)**: Prevented `agy-bar install` invoked from the installed global shim from wiping its own runtime directory; bundled `skills/agy-bar/SKILL.md` inside `app/`.
35
+ - **Windows Compatibility Hardening (`src/installer.mjs`, `src/proxy.mjs`, `src/shell-hook.mjs`, `src/render.mjs`, `src/telemetry.mjs`)**:
36
+ - Fixed `agy-bar doctor` recognizing Windows Base64-encoded `statusLine.command`.
37
+ - Fixed `agy-bar run` launching `.cmd`/`.bat` `agy` shims on Windows via `PATHEXT` resolution and added `windowsHide: true` to `reg` calls.
38
+ - Fixed PowerShell shell hook quoting `'--'` so PowerShell doesn't strip the argument separator, and added Windows PowerShell 5.1 profile detection/cleanup.
39
+ - Fixed case-insensitive Windows home path shortening/redaction, Windows `PATH` comparison, and BMP emoji (`⚡`) 2-column display width calculation.
40
+
41
+ ## [0.8.2] - 2026-11-26
42
+
43
+ ### Added
44
+ - **Live Conversation & Daily Estimated Cost Strip (`show.cost`, `show.todayCost`)**:
45
+ - Displays **`CHAT ~$1.24 · DAY $13.18`** on line 2 immediately to the left of the `5h` quota gauge (enabled by default in `dashboard`, gracefully compacting to `~$1.24 · DAY $13.18` → `~$1.24` → hidden on narrower terminals).
46
+ - Powered by `< 1ms` cached `usage-summary.json` (`todayCostUsd` + `recentSessionCosts` for resumed `agy -c` conversations) with live per-turn increments (`turnCostDeltaUsd`) so resumed multi-turn chats reflect their full conversation spend.
47
+
48
+ ## [0.8.1] - 2026-11-26
49
+
50
+ ### Changed
51
+ - **Refined Active Proxy Badge (`PX 7897` / `PX on`)**: Updated line 1's active proxy micro-badge from `↗7897` to `PX 7897` (muted `PX` + healthy green port) so it matches the minimalist `DAY` / `WK` / `MO` / `CTX` typography consistently.
52
+
53
+ ## [0.8.0] - 2026-11-26
54
+
55
+ ### Added
56
+ - **Active Proxy Micro-Badge (`show.proxy`, e.g. `↗7897`)**: Reads `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY` directly from process memory (`0ms`, zero network, credentials never exposed) and shows a compact green-arrow port badge (`↗7897`) on line 1 whenever a session is running through a proxy — hidden automatically when running direct.
57
+ - **Zero-Clutter On-Demand Work-State Badges (hidden when idle)**:
58
+ - **Live Turn Elapsed Timer (`show.turnTimer`)**: Shows elapsed time right next to `esc to cancel` while the agent is busy (`24s`, `1m15s`), shifting amber at `>= 30s` and bold red at `>= 90s`.
59
+ - **Running Subagents Counter (`show.subagents`)**: Displays `⚡N` on line 1 whenever background subagents are actively running (`payload.subagents`).
60
+ - **Special Execution Mode Badges (`show.mode`)**: Lights up `PLAN` (amber) or `SANDBOX` (purple) on line 1 only when active so you never lose track of non-default modes.
61
+
62
+ ## [0.7.3] - 2026-11-26
63
+
64
+ ### Added
65
+ - **Crisp Segmented Gauge Styles (`segments`, `squares`, `pills`, `dots`)**:
66
+ - Added 4 distinct cell-separated progress bar styles that render with clean gaps between every cell even in GPU terminals like Ghostty (where full-block `█`/`░` glyphs merge seamlessly):
67
+ - `segments` (`▮▮▮▮▯▯`, new default — bright filled `▮` + muted track `▮` in color, `▯` in plain/mono)
68
+ - `squares` (`■■■■□□`, matches `agy-bar stats` heatmap squares)
69
+ - `pills` (`▰▰▰▰▱▱`, slanted capsules)
70
+ - `dots` (`●●●●○○`, circular dots)
71
+ - Existing `smooth`, `blocks`, `line`, and `ascii` styles remain available via `agy-bar config bar-style <style>`.
72
+
73
+ ## [0.7.2] - 2026-11-26
74
+
75
+ ### Changed
76
+ - **Transparent opt-in prompt for the `~/.zshrc` shell hook**:
77
+ - Interactive `agy-bar install` now clearly explains the optional 7-line managed `agy()` shell hook (what file it touches, that `agy` binaries are never modified, and how to remove it via `agy-bar proxy unhook`) and asks `[y/N]` before touching `~/.zshrc` / `~/.bashrc` / `config.fish`.
78
+ - Non-interactive installs (scripts, CI, `-y`) default to leaving shell rc files completely untouched unless `--proxy-hook` is explicitly passed (while seamlessly preserving an already-installed managed hook across upgrades).
79
+ - Updated `AGENTS.md` so AI installers ask the user before enabling `--proxy-hook`.
80
+
81
+ ## [0.7.1] - 2026-11-26
82
+
83
+ ### Added
84
+ - **Seamless Shell Hook for Plain `agy` (`src/shell-hook.mjs`, `agy-bar proxy hook` / `unhook`)**:
85
+ - `agy-bar install` now adds a clean, reversible managed `agy()` function block (`# >>> agy-bar proxy >>> ... # <<< agy-bar proxy <<<`) to `~/.zshrc` / `~/.bashrc` / `~/.config/fish/config.fish` / PowerShell `$PROFILE` (opt out via `--no-shell-hook`, remove anytime via `agy-bar proxy unhook` or `agy-bar uninstall`).
86
+ - Once loaded (open a new terminal or `source ~/.zshrc`), simply typing **`agy`** (including `agy -c`, `agy --dangerously-skip-permissions`, `agy update`) automatically routes through your local Clash/Surge/v2ray proxy without enabling TUN mode — and stays completely silent with zero noise if no local proxy is running.
87
+ - Passes `--from-hook -- "$@"` to avoid any flag collision with `agy`, falls back gracefully to `command agy` if `agy-bar` is removed, and supports one-shot direct bypass via `command agy ...` or `AGY_BAR_NO_PROXY=1 agy ...`.
88
+
89
+ ## [0.7.0] - 2026-11-26
90
+
91
+ ### Added
92
+ - **No-TUN Proxy Launcher (`agy-bar run` & `agy-bar proxy`)**:
93
+ - Launch `agy` directly through your local Clash / Clash Verge / Surge / v2ray proxy **without enabling TUN mode** (`agy-bar run [agy args...]`), injecting standard `HTTP_PROXY`/`HTTPS_PROXY`/`ALL_PROXY` (uppercase + lowercase) and loopback-safe `NO_PROXY` environment variables into the spawned `agy` process.
94
+ - **Zero-config auto-detection (`mode: auto`)**: Automatically detects macOS system proxy (`scutil --proxy`), Windows system proxy (`HKCU\...\Internet Settings`), or live localhost proxy ports (`7897`, `7890`, `6152`, `10809`, `1087`, `20171`, `20172`, `10808`, `1080`) even when both TUN and System Proxy are turned off.
95
+ - **Proxy management CLI (`agy-bar proxy`)**: `status`/`check` (live TCP reachability + latency), `auto`, `set <url>`, `on`/`off`, `mode <auto|manual|off>`, `bypass <list|reset>`, `env [--sh|--fish|--pwsh]`, and `clear`, with automatic credential redaction (`user:pass@` → `***@`) and Go/gRPC HTTP CONNECT guidance.
96
+ - **Interactive TUI signal safety & `--no-proxy` / `--proxy <url>` overrides**: Forwards all `agy` flags verbatim (including `-c`, `--dangerously-skip-permissions`, `--help`), prints launch notices on `stderr` so piped `stdout` stays clean, and guards against recursive wrappers.
97
+ - **Global `~/.local/bin/agy-bar` CLI Shim**: Automatically installed alongside `agy` during `agy-bar install` (with unrelated-file collision protection and clean removal on `uninstall`) so `agy-bar run`, `agy-bar proxy`, `agy-bar stats`, `agy-bar monitor`, and `agy-bar title` work directly from any terminal.
98
+
99
+ ## [0.6.2] - 2026-11-26
100
+
101
+ ### Added
102
+ - **Weekly (`WK`) & Monthly (`MO`) Token Totals in Bottom Statusbar (`show.weekTokens`, `show.monthTokens`)**: Extends line 1's minimal token strip to `DAY · WK · MO · ALL`, color-matched to `agy-bar stats`, with graceful progressive shedding (`DAY·WK·MO·ALL` → `DAY·WK·ALL` → `DAY·ALL` → `DAY` → hidden) on narrower terminals.
103
+
104
+ ## [0.6.1] - 2026-11-26
105
+
106
+ ### Added
107
+ - **Minimal Always-On Token Summary in Bottom Statusbar (`show.todayTokens`, `show.totalTokens`)**: Displays `DAY 133.6M · ALL 903.9M` right beside the model name on line 1 (with automatic narrow-width degradation: `DAY + ALL` → `DAY` → hidden), backed by a `< 1ms` cached `usage-summary.json` snapshot that increments live on every turn and auto-syncs every 5 minutes without slowing down the statusline.
108
+
109
+ ## [0.6.0] - 2026-11-26
110
+
111
+ ### Added
112
+ - **Full-History Token Activity Dashboard & Terminal Heatmap (`agy-bar stats`)**:
113
+ - Incremental read-only SQLite scanner (`src/history-scan.mjs`) covering both Antigravity CLI (`~/.gemini/antigravity-cli/conversations/*.db`) and Desktop (`~/.gemini/antigravity/conversations/*.db`) history without reading chat text, backed by an `mtime/size` incremental cache (`scan-cache.json`) for sub-20ms repeat runs.
114
+ - **4-Card Overview Strip** in the terminal: `ALL-TIME TOTAL`, `TODAY`, `THIS MONTH`, and `YEAR` (with sessions, active days, daily averages, and current/longest streaks).
115
+ - **True-Color Terminal Activity Heatmap** (`52w` / `32w` / `20w` auto-sized to terminal width) with 4 selectable ramps (`--palette purple|green|cyan|amber`), log-compressed intensity, month labels, and peak day callout.
116
+ - Source filtering (`--source all|cli|desktop|ledger`), CLI vs Desktop split, thinking-token totals, per-model Avg TTFT + speed + estimated API cost & cache savings, and graceful Node 20 fallback to `ledger.jsonl`.
117
+
118
+ ## [0.5.1] - 2026-11-26
119
+
120
+ ### Fixed
121
+ - **Re-sync terminal tab title after `agy -c` restart**: Track the hosting `agy` process PID (`lastTabHostPid`) alongside `lastTabTitle` so restarting `agy` (when shell `preexec` resets the tab title) always re-emits the tab title.
122
+ - **Emit both OSC 0 & OSC 2**: Ensures both window/surface title and tab title update cleanly across Ghostty, iTerm2, Kitty, WezTerm, and macOS Terminal.
123
+
124
+ ## [0.5.0] - 2026-11-26
125
+
126
+ ### Added
127
+ - **Automatic Terminal Tab Title Sync (`src/tab-title.mjs`)**: Automatically updates Ghostty / iTerm2 / Kitty / WezTerm / macOS Terminal tab titles via standard OSC 0 (`\x1b]0;...\x07`) with live status indicators (`●` working / `✓` idle) and `conversation_title` (zero extra tokens, auto-deduped, falls back to workspace/Git dir).
128
+ - **Ultra-low-token Agent Tab Summarization (`agy-bar title`)**: Run `agy-bar title "<short topic>"` (or `--clear`) to set a concise custom tab title immediately from the Agent's existing context (~10 tokens, zero extra API calls). Automatically resets if the user renames the chat via `/rename`.
129
+ - **Configurable tab title options**: `tabTitle` (`on|off`), `tabTitleSource` (`auto|title|dir|title+dir`), and `tabTitleMaxLen` (`10..60`).
130
+
131
+ ## [0.4.0] - 2026-11-26
132
+
133
+ ### Added
134
+ - **Time-To-First-Token (`TTFT`) display (`show.ttft`)**: Displays exact first-token latency alongside decode speed (`TTFT 1.9s·158t/s`), with configurable `ttftWarnSec` (default `8s`) and `ttftDangerSec` (default `15s`) color thresholds.
135
+ - **Exact streaming decode speed & cache completion time (`src/step-timing.mjs`)**: On Node `>= 22.13`, reads only numeric step timing metadata from the local AGY conversation SQLite database in `readOnly: true` mode (never reads prompts or replies; opt-out via `config set dbTiming off`), cleanly separating TTFT wait time from pure streaming `tok/s` and restoring accurate 5-min cache countdowns even after `agy -c` restarts. Gracefully falls back to pure `stdin` timing on Node 20.
136
+ - **`Avg TTFT` in `agy-bar stats` & live `TTFT` column in `agy-bar monitor`**.
137
+
138
+ ## [0.3.0] - 2026-11-26
139
+
140
+ ### Added
141
+ - **Unified health color mode (`colorMode: "health" | "distinct"`)**: Context (`CTX`) and Quota (`5h` / `7d`) gauges now share one cohesive `healthy green -> warning amber -> danger red` color system by default (`distinct` preserves blue/green separation).
142
+ - **Smooth 8-level sub-character progress bars (`barStyle: "smooth"`)**: Uses Unicode 1/8 block elements (`▏▎▍▌▋▊▉█`) as the new default gauge style for 48-step visual precision across 6 cells.
143
+ - **Workspace directory + Git display (`show.dir`)**: Shows `project (main*)` on line 1 so concurrent terminals across repositories are immediately distinguishable.
144
+ - **Actionable `/compact` warning badge (`show.compactHint`)**: Displays `→/compact` next to context usage once the model's danger threshold is reached.
145
+ - **Optional live session cost & duration/turns (`show.cost`, `show.session`)**: Displays `~$0.42` and `12m·8t` when enabled.
146
+ - **Automatic Vim mode badge (`show.vim`)**: Renders `[NORMAL]` / `[INSERT]` / `[VISUAL]` when `vim.mode` is provided by Antigravity CLI.
147
+ - **PII-redacted payload debugger (`agy-bar debug --capture`)**: One-shot sanitized capture of AGY's live `stdin` payload for troubleshooting and issue reports.
148
+ - **True-color SVG preview (`assets/preview.svg`)**: Auto-generated directly from `renderStatusline()` for dark and light themes.
149
+
150
+ ## [0.2.0] - 2026-11-26
151
+
152
+ ### Added
153
+ - **5-minute Prompt Cache TTL countdown** (`CACHE 88%·3m42s`) with amber (`<= 90s`) and red (`<= 30s` / `exp`) alerts.
154
+ - **Live turn output speed (`tok/s`)** and opt-in **context delta (`+12.4K`)** tracking via per-session state files.
155
+ - **Local usage & estimated API cost ledger (`agy-bar stats`)** with `today` / `7d` / `30d` / `all` views, cache savings, daily bar chart, and net observed quota delta.
156
+ - **Multi-CLI live HUD (`agy-bar monitor`)** for monitoring concurrent `agy` terminals without the desktop app.
157
+ - **Per-model context warning thresholds** (`modelThresholds`) and **Gemini 4 Neon** support.
158
+ - **`AGENTS.md`** for one-sentence AI-assisted installation.
159
+
160
+ ## [0.1.0] - 2026-11-26
161
+
162
+ ### Added
163
+ - Initial zero-dependency Antigravity CLI (`agy`) statusline with `dashboard`, `compact`, and `minimal` presets, 6 themes, Git branch/dirty indicator, responsive narrow-width degradation, safe backup/restore installer, companion `/agy-bar` skill, and cross-platform CI.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xy-tuoren
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,235 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # agy-bar
4
+
5
+ **Zero-dependency statusline, no-TUN proxy launcher, 52-week token heatmap & multi-CLI HUD for Antigravity CLI (`agy`)**
6
+
7
+ **English** | [简体中文](./README.zh-CN.md)
8
+
9
+ [![CI](https://github.com/xy-tuoren/agy-bar/actions/workflows/ci.yml/badge.svg)](https://github.com/xy-tuoren/agy-bar/actions/workflows/ci.yml)
10
+ [![npm](https://img.shields.io/npm/v/agy-bar.svg)](https://www.npmjs.com/package/agy-bar)
11
+ [![Node >= 20](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org/)
12
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-blue.svg)](#)
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
14
+
15
+ </div>
16
+
17
+ ![agy-bar true-color statusline preview](https://raw.githubusercontent.com/xy-tuoren/agy-bar/main/assets/preview.svg)
18
+
19
+ ```sh
20
+ # Install in one command (Node.js >= 20, zero dependencies)
21
+ npx agy-bar install
22
+ ```
23
+
24
+ ---
25
+
26
+ ## At a Glance — Two-Line Anatomy
27
+
28
+ `agy-bar` keeps idle terminals calm and high-signal, separating **workspace identity & cumulative overview (Line 1)** from **live session metrics & account quotas (Line 2)**:
29
+
30
+ ```text
31
+ ~/code/agy-bar (main* +142 -38) · PX 7897 DAY 136M/$13.2 · WK 810M · MO 875M · ALL 906M │ Gemini 4 Neon · xhigh
32
+ CTX ▮▮▮▯▯▯▯▯ 42.6% (1.0M) │ CACHE 88%·3m42s │ TTFT 1.9s·158t/s │ ~$0.18 5h ▮▮▮▮▮▯ 85% (2h30m) │ 7d ▮▮▮▮▯▯ 64% (3d)
33
+ ```
34
+
35
+ | Zone | What It Shows | Smart Behavior |
36
+ | --- | --- | --- |
37
+ | **Line 1 · Left** | `~/code/agy-bar (main* +142 -38) · PX 7897` | Compact `~` path (`dirStyle`), live Git diff lines (tracked + untracked text, 3s cache), active proxy port badge, plus on-demand busy badges (`● 34s · esc`, `⚡2` subagents, `PLAN` / `SANDBOX`, Vim `[NORMAL]`) |
38
+ | **Line 1 · Right** | `DAY 136M/$13.2 · WK 810M · MO 875M · ALL 906M │ Model` | Calm neutral cumulative token/spend strip + active model & reasoning effort; sheds gracefully on narrow split panes |
39
+ | **Line 2 · Left** | `CTX ▮▮▮▯▯▯▯▯ 42.6% (1.0M) │ CACHE 88%·3m42s │ TTFT 1.9s·158t/s │ ~$0.18` | Unified health context gauge (`→/compact` at danger), 5-min prompt cache TTL countdown, exact first-token latency + streaming decode speed, and live conversation spend (rolls up nested subagent costs automatically, refreshing every 20s while subagents run) |
40
+ | **Line 2 · Right** | `5h ▮▮▮▮▮▯ 85% (2h30m) │ 7d ▮▮▮▮▯▯ 64% (3d)` | Active model pool quotas (**Gemini 4 Neon / Carbon / Hydrogen / Argon** & **Claude 3p**) with reset countdowns |
41
+
42
+ ---
43
+
44
+ ## Feature Showcase
45
+
46
+ ### 1. Crisp Segmented Gauges, 8 Bar Styles & 6 Themes
47
+
48
+ Choose from **8 gauge styles** (`segments` default `▮▮▮▯▯▯`, `squares`, `pills`, `dots`, `smooth`, `blocks`, `line`, `ascii`), **6 themes** (`auto`, `slate-dark`, `slate-light`, `ocean`, `nord`, `mono`), and **2 color modes** (`health` unified green→amber→red, or `distinct` cyan CTX vs green quota). Every preference takes effect on the next refresh with zero restart.
49
+
50
+ ![agy-bar 8 gauge styles and themes preview](https://raw.githubusercontent.com/xy-tuoren/agy-bar/main/assets/styles-preview.svg)
51
+
52
+ ---
53
+
54
+ ### 2. Full-History Token Dashboard & 52-Week Heatmap (`agy-bar stats`)
55
+
56
+ Incrementally scans local Antigravity CLI & Desktop conversation DBs in **read-only mode** (never reads prompt/reply text; `< 20ms` cached) to render an 80-col-safe 4-card overview (`All-Time / Today / Month / Year`), a **52-week terminal activity heatmap** (`purple` / `green` / `cyan` / `amber`, auto-adapted for dark & light themes), active streaks, CLI vs Desktop breakdown, per-model TTFT/speed table, and **estimated API cost + cache savings**.
57
+
58
+ ![agy-bar 52-week terminal token heatmap preview](https://raw.githubusercontent.com/xy-tuoren/agy-bar/main/assets/stats-preview.svg)
59
+
60
+ ---
61
+
62
+ ### 3. Multi-CLI Live Monitor (`agy-bar monitor`)
63
+
64
+ Running 3–5 `agy` sessions across different repos? Open `agy-bar monitor` in a side pane to watch every active terminal live — working/idle status, workspace & branch, model, context bar, 5-min cache TTL, TTFT, decode speed, session spend, and global quotas.
65
+
66
+ ![agy-bar multi-CLI monitor preview](https://raw.githubusercontent.com/xy-tuoren/agy-bar/main/assets/monitor-preview.svg)
67
+
68
+ ---
69
+
70
+ ### 4. No-TUN Local Proxy Launcher & Live Pricing Cache (`agy-bar proxy` & `agy-bar pricing`)
71
+
72
+ - **No-TUN Proxy (`agy` / `agy-bar run` / `agy-bar proxy`)**: Auto-detects macOS/Windows system proxies or local Clash Verge / Clash / Surge / v2ray ports (`7897`, `7890`, `6152`, `10809`, `1087`, ...) and injects standard `HTTP_PROXY`/`HTTPS_PROXY`/`ALL_PROXY` + loopback-safe `NO_PROXY` without enabling TUN mode or patching binaries. Opt into the reversible 7-line `agy()` shell hook during `install` (or anytime via `agy-bar proxy hook`) to just type plain `agy`.
73
+ - **3-Tier Dynamic Pricing (`agy-bar pricing`)**: Resolves rates in `< 0.1ms` (`custom override` → `24h background SWR cache from models.dev / LiteLLM` → `built-in calibrated rates`). Proxy-aware, ETag `304`, zero auth, disable anytime with `agy-bar config set pricingAutoSync off`.
74
+
75
+ ![agy-bar no-TUN proxy and dynamic pricing cache preview](https://raw.githubusercontent.com/xy-tuoren/agy-bar/main/assets/proxy-pricing-preview.svg)
76
+
77
+ ---
78
+
79
+ ### 5. Automatic Terminal Tab Titles (`●` / `✓`) & Agent Summarization (`agy-bar title`)
80
+
81
+ Replaces identical `agy --dangerously-skip-permissions` tabs across Ghostty, iTerm2, Kitty, WezTerm, macOS Terminal, and VS Code with live state + conversation title via standard OSC 0/2 (zero extra tokens; safely skipped on native Windows):
82
+
83
+ ```text
84
+ Before: agy --dangerously-skip-permissions │ agy --dangerously-skip-permissions │ agy --dangerously-skip-permissions
85
+ After: ● Fix Windows doctor check │ ✓ agy-bar (main*) │ ● Add 52-week stats heatmap
86
+ ```
87
+
88
+ > **Pro Tip — Auto-summarize tab titles on topic shifts (~10 tokens, zero extra API calls)**
89
+ > Add this one line to your global `~/.gemini/antigravity-cli/AGENTS.md`:
90
+ > ```text
91
+ > When the user starts a clearly new task/topic in a long session, silently run `agy-bar title "<4-8 word concise topic>"` once to keep the terminal tab title up to date.
92
+ > ```
93
+
94
+ ---
95
+
96
+ ## Why `agy-bar`? (Safety, Privacy & Performance)
97
+
98
+ | Guarantee | How It Works |
99
+ | --- | --- |
100
+ | **100% Official `statusLine` Hook** | Zero binary patching, zero Electron injection, zero Google/AGY private API calls, zero account credential access. Survives every AGY update cleanly. |
101
+ | **Read-Only Local Telemetry** | SQLite conversation scans (`Node >= 22.13`) open DBs in `readOnly: true` mode and extract **only numeric timestamps & token counts** — never prompts or replies. |
102
+ | **Transparent Network Policy** | Statusline rendering itself **never touches the network**. Only an optional 24-hour background sync fetches public unauthenticated pricing JSON (`models.dev` / `LiteLLM`); run `agy-bar config set pricingAutoSync off` for strict offline mode. |
103
+ | **Zero-Dep Fast Hot Path** | `0` runtime dependencies, zero-subprocess idle refreshes (PID fast-path + 3s Git cache + SQLite `mtime` skip + 5-min Windows theme cache), and atomic file writes across concurrent terminals. |
104
+
105
+ ---
106
+
107
+ ## Quick Start
108
+
109
+ Requires **Node.js >= 20.0.0** and **Antigravity CLI (`agy`)**.
110
+
111
+ ### Option 1: Via `npx` (Fastest)
112
+
113
+ ```sh
114
+ npx agy-bar install
115
+ ```
116
+
117
+ ### Option 2: Let `agy` install it for you
118
+
119
+ Paste this into an `agy` chat:
120
+
121
+ ```text
122
+ Please follow https://github.com/xy-tuoren/agy-bar/blob/main/AGENTS.md to install agy-bar for me.
123
+ ```
124
+
125
+ ### Option 3: Manual install (GitHub)
126
+
127
+ ```sh
128
+ git clone https://github.com/xy-tuoren/agy-bar.git ~/agy-bar
129
+ cd ~/agy-bar
130
+ node bin/agy-bar.mjs install
131
+ ```
132
+
133
+ Then **restart `agy`** to activate the statusline (in an existing session, run `/skills reload` to load `/agy-bar`). `install` also places the global `agy-bar` command at `~/.local/bin/agy-bar` and safely backs up your previous `statusLine`. Pass `--no-skill` to skip installing the companion `/agy-bar` skill.
134
+
135
+ ---
136
+
137
+ ## Common Commands
138
+
139
+ ```sh
140
+ # No-TUN proxy launcher
141
+ agy-bar proxy status # Inspect effective proxy, shell hook & live latency
142
+ agy-bar proxy hook # Opt in so plain `agy` auto-uses local proxy (removable via `unhook`)
143
+ agy-bar run -c # Launch `agy -c` through local proxy without modifying ~/.zshrc
144
+ agy-bar proxy set 127.0.0.1:7897
145
+
146
+ # Stats, pricing, monitor, tab title & debug
147
+ agy-bar stats [today|7d|30d|all] [--palette purple|green|cyan|amber] [--source all|cli|desktop|ledger]
148
+ agy-bar pricing show | sync | set <model> <in> <out> [cacheRead] | reset
149
+ agy-bar monitor [--once]
150
+ agy-bar title "short topic" # Or: agy-bar title --clear
151
+ agy-bar debug --capture # Capture a PII-redacted AGY payload snapshot
152
+ agy-bar preview --scenario all
153
+ agy-bar doctor
154
+ ```
155
+
156
+ <details>
157
+ <summary><strong>Full Configuration Reference (presets, themes, bar styles, toggles & thresholds)</strong></summary>
158
+
159
+ Changes apply immediately on the next statusline refresh — no restart needed:
160
+
161
+ ```sh
162
+ # Layout presets: dashboard | compact | minimal
163
+ agy-bar config preset compact
164
+
165
+ # Themes: auto | slate-dark | slate-light | ocean | nord | mono
166
+ agy-bar config theme ocean
167
+
168
+ # Gauge styles: segments (default) | squares | pills | dots | smooth | blocks | line | ascii
169
+ agy-bar config bar-style squares
170
+
171
+ # Workspace path style: short (~/code/agy-bar, default) | parent (code/agy-bar) | name (agy-bar)
172
+ agy-bar config set dirStyle short
173
+
174
+ # Color mode: health (unified green->amber->red) | distinct (blue CTX vs green quota)
175
+ agy-bar config set colorMode health
176
+
177
+ # Toggle individual items:
178
+ # hint, vim, mode, subagents, turnTimer, proxy, dir, model, effort, git, gitDirty, gitDiff,
179
+ # context, contextBar, contextDelta, compactHint, capacity, cache, cacheTtl, ttft, speed,
180
+ # cost, todayCost, session, todayTokens, weekTokens, monthTokens, totalTokens,
181
+ # quota, quotaBar, quota5h, quotaWeekly, reset
182
+ agy-bar config enable session contextDelta
183
+ agy-bar config disable turnTimer gitDiff
184
+
185
+ # Per-model thresholds, cache TTL, timing & offline mode
186
+ agy-bar config set modelThreshold.claude.warn 65 modelThreshold.claude.danger 85
187
+ agy-bar config set cacheTtlSec 300 dbTiming on pricingAutoSync off
188
+
189
+ # Inspect or reset all preferences
190
+ agy-bar config show
191
+ agy-bar config reset
192
+ ```
193
+
194
+ </details>
195
+
196
+ ---
197
+
198
+ ## Terminal & OS Compatibility
199
+
200
+ - **Truecolor & 256-Color Auto-Adaptation**: Emits 24-bit Truecolor in Ghostty, iTerm2, Kitty, WezTerm, Alacritty, Warp, VS Code, and Windows Terminal; automatically downscales to nearest xterm-256 colors in macOS `Terminal.app` (`Apple_Terminal`) and `tmux` / `screen` / SSH without `COLORTERM=truecolor`; honors `NO_COLOR` and `TERM=dumb`.
201
+ - **Light & Dark Themes**: Automatically adapts both statusline palettes and `agy-bar stats` heatmap ramps for light and dark backgrounds.
202
+ - **Windows Notes**: Supported on Windows Terminal, PowerShell 7 (`pwsh`), Windows PowerShell 5.1, and `cmd.exe` (including `.cmd` shims, Windows system proxy detection, and 5-min cached dark/light theme detection). Automatic OSC tab title sync is macOS/Linux/WSL only and is safely skipped on native Windows. On older ConHost fonts missing `▮`, switch with `agy-bar config bar-style squares` or `blocks`.
203
+
204
+ ---
205
+
206
+ ## Update & Uninstall
207
+
208
+ ```sh
209
+ # Update (preserves config, ledger, pricing cache & original statusLine backup)
210
+ npx agy-bar@latest install
211
+
212
+ # Uninstall & restore previous statusLine + remove managed shell hook cleanly
213
+ npx agy-bar uninstall # or: agy-bar uninstall
214
+
215
+ # Complete cleanup including current terminal's proxy env vars & agy() function (zsh/bash):
216
+ eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"
217
+ # (fish: agy-bar uninstall --remove-skill --purge --print-cleanup --fish | source)
218
+ # (pwsh: agy-bar uninstall --remove-skill --purge --print-cleanup --pwsh | Invoke-Expression)
219
+ ```
220
+
221
+ ## Development
222
+
223
+ ```sh
224
+ npm test # Cross-platform Node.js built-in test suite (75 tests)
225
+ npm run preview # Render live terminal preview
226
+ npm run preview:svg # Regenerate all 5 showcase SVGs in assets/
227
+ npm run stats # Show local usage stats
228
+ npm run pricing # Inspect or sync model pricing cache
229
+ npm run monitor # Launch multi-CLI HUD
230
+ npm run doctor # Verify local installation
231
+ ```
232
+
233
+ ## License
234
+
235
+ [MIT](./LICENSE) © [xy-tuoren](https://github.com/xy-tuoren)