agy-bar 0.9.4 → 1.0.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 +5 -6
- package/CHANGELOG.md +20 -0
- package/README.md +12 -10
- package/README.zh-CN.md +12 -10
- package/bin/agy-bar.mjs +34 -4
- package/package.json +1 -1
- package/skills/agy-bar/SKILL.md +1 -0
- package/src/telemetry.mjs +25 -2
- package/src/title.mjs +28 -30
package/AGENTS.md
CHANGED
|
@@ -7,7 +7,7 @@ If a user asks you to install **agy-bar** into their Antigravity CLI (`agy`), fo
|
|
|
7
7
|
- If Node.js is missing or older than 20, stop and inform the user; do **not** install or upgrade Node.js automatically.
|
|
8
8
|
|
|
9
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`.
|
|
10
|
+
- **Recommended (via npm, zero clone):** run `npx -y agy-bar@latest install --yes` (or `npx -y agy-bar@latest install --proxy-hook` if the user wants the shell hook below) and verify with `agy-bar doctor`.
|
|
11
11
|
- **Or from GitHub `main`:**
|
|
12
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
13
|
- Otherwise clone fresh into a clean directory (e.g. `~/agy-bar` on macOS/Linux/WSL or `%USERPROFILE%\agy-bar` on Windows):
|
|
@@ -17,15 +17,14 @@ If a user asks you to install **agy-bar** into their Antigravity CLI (`agy`), fo
|
|
|
17
17
|
|
|
18
18
|
3. **Ask about the optional no-TUN proxy shell hook, then run the installer & self-check**
|
|
19
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),
|
|
20
|
+
- If the user says **yes**, pass `--proxy-hook`; if **no** (or unsure), pass `--yes` (omitting `--proxy-hook`) so their shell rc stays completely untouched (they can still use `agy-bar run` anytime).
|
|
21
21
|
```sh
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
node bin/agy-bar.mjs doctor
|
|
22
|
+
npx -y agy-bar@latest install --yes # or: npx -y agy-bar@latest install --proxy-hook
|
|
23
|
+
agy-bar doctor
|
|
25
24
|
```
|
|
26
25
|
- Zero third-party dependencies: do **not** run `npm install`.
|
|
27
26
|
- 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).
|
|
27
|
+
- Installs the statusline runtime, official native AGY `title` hook (preserving any existing custom `settings.json.title`; pass `--no-title` to opt out), 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
28
|
|
|
30
29
|
4. **Strict safety boundaries**
|
|
31
30
|
- Never modify `agy-bar` source files, Antigravity binaries, or unrelated fields in `~/.gemini/antigravity-cli/settings.json`.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to **agy-bar** are documented here.
|
|
4
4
|
|
|
5
|
+
## [1.0.0] - 2026-11-27
|
|
6
|
+
|
|
7
|
+
First stable release of **agy-bar** — zero-dependency statusline HUD, native AGY window/tab title hook, no-TUN local proxy launcher, 52-week token heatmap, live 3-tier pricing cache, and multi-CLI monitor for Antigravity CLI (`agy`).
|
|
8
|
+
|
|
9
|
+
### Added & Improved
|
|
10
|
+
- **Multi-Tab Custom Title Targeting (`bin/agy-bar.mjs`, `src/telemetry.mjs`, `src/title.mjs`)**:
|
|
11
|
+
- `agy-bar title` now matches the invoking terminal's host `agy` PID (across both `lastTabHostPid` and native `.title` markers) before falling back to most-recent session, preventing accidental cross-tab renames when multiple `agy` sessions run concurrently.
|
|
12
|
+
- `agy-bar title` inspection output now reports `nativeTitleActive` and always displays the live computed `activeTabTitle`.
|
|
13
|
+
- **CI Native Title Smoke Verification (`.github/workflows/ci.yml`)**:
|
|
14
|
+
- Added cross-platform `src/title.mjs` smoke verification to the 9-job macOS / Linux / Windows × Node 20 / 22 / 24 CI matrix.
|
|
15
|
+
- **v1.0.0 Documentation & Showcase Polish (`README.md`, `README.zh-CN.md`, `AGENTS.md`, `skills/agy-bar/SKILL.md`, `assets/monitor-preview.svg`)**:
|
|
16
|
+
- Updated `monitor-preview.svg` to showcase live multi-state tracking (`working`, `sub:3`, `? confirm`, `idle`).
|
|
17
|
+
- Aligned Windows native title documentation, test counts (`87` tests), `npx -y agy-bar@latest install` guidance, Ghostty title tips, and npm Provenance badge across English & Chinese READMEs.
|
|
18
|
+
|
|
19
|
+
## [0.9.5] - 2026-11-26
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- **Automated Tokenless npm OIDC Trusted Publishing & Provenance (`.github/workflows/publish.yml`)**:
|
|
23
|
+
- Releases are now built, tested, and published automatically from GitHub Actions via short-lived OIDC Trusted Publishing with cryptographic Sigstore provenance attestations (`npm publish --provenance --access public`) and release-tag/package-version verification.
|
|
24
|
+
|
|
5
25
|
## [0.9.4] - 2026-11-26
|
|
6
26
|
|
|
7
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/xy-tuoren/agy-bar/actions/workflows/ci.yml)
|
|
10
10
|
[](https://www.npmjs.com/package/agy-bar)
|
|
11
|
+
[](https://www.npmjs.com/package/agy-bar)
|
|
11
12
|
[](https://nodejs.org/)
|
|
12
13
|
[](#)
|
|
13
14
|
[](./LICENSE)
|
|
@@ -16,13 +17,13 @@
|
|
|
16
17
|
|
|
17
18
|

|
|
18
19
|
|
|
19
|
-
<sub>Real Ghostty capture: 10 running subagents (
|
|
20
|
+
<sub>Real Ghostty capture: 10 running subagents (displayed as `SUB 10` in v1.0+), live Git diff (`+14.3K -803`), no-TUN proxy (`PX 7897`), 1.01B cumulative tokens, 99% prompt cache TTL, TTFT & speed, live conversation spend, and 5h/7d quotas.</sub>
|
|
20
21
|
|
|
21
22
|

|
|
22
23
|
|
|
23
24
|
```sh
|
|
24
25
|
# Install in one command (Node.js >= 20, zero dependencies)
|
|
25
|
-
npx agy-bar install
|
|
26
|
+
npx -y agy-bar@latest install
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
---
|
|
@@ -93,6 +94,7 @@ Replaces identical `agy --dangerously-skip-permissions` tabs across Ghostty, iTe
|
|
|
93
94
|
> ```text
|
|
94
95
|
> 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.
|
|
95
96
|
> ```
|
|
97
|
+
> *Ghostty tip*: prefer `agy-bar title "..."` over right-clicking **Change Title…** in Ghostty, which sets a manual `tabOverride` and blocks dynamic `●` / `✓` updates until cleared.
|
|
96
98
|
|
|
97
99
|
---
|
|
98
100
|
|
|
@@ -114,7 +116,7 @@ Requires **Node.js >= 20.0.0** and **Antigravity CLI (`agy`)**.
|
|
|
114
116
|
### Option 1: Via `npx` (Fastest)
|
|
115
117
|
|
|
116
118
|
```sh
|
|
117
|
-
npx agy-bar install
|
|
119
|
+
npx -y agy-bar@latest install
|
|
118
120
|
```
|
|
119
121
|
|
|
120
122
|
### Option 2: Let `agy` install it for you
|
|
@@ -133,7 +135,7 @@ cd ~/agy-bar
|
|
|
133
135
|
node bin/agy-bar.mjs install
|
|
134
136
|
```
|
|
135
137
|
|
|
136
|
-
Then **restart `agy`** to activate the statusline (in an existing session, run `/skills reload` to load `/agy-bar`). `install`
|
|
138
|
+
Then **restart `agy`** to activate the statusline and native `title` hook (in an existing session, run `/skills reload` to load `/agy-bar`). `install` places the global `agy-bar` command at `~/.local/bin/agy-bar`, safely backs up your previous `statusLine` / `title` settings (never overwriting unrelated custom `title` scripts), and leaves `~/.zshrc` untouched unless you opt into the proxy hook. Pass `--no-skill` or `--no-title` to opt out of either component.
|
|
137
139
|
|
|
138
140
|
---
|
|
139
141
|
|
|
@@ -202,18 +204,18 @@ agy-bar config reset
|
|
|
202
204
|
|
|
203
205
|
- **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`.
|
|
204
206
|
- **Light & Dark Themes**: Automatically adapts both statusline palettes and `agy-bar stats` heatmap ramps for light and dark backgrounds.
|
|
205
|
-
- **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
|
|
207
|
+
- **Windows Notes**: Supported on Windows Terminal, PowerShell 7 (`pwsh`), Windows PowerShell 5.1, and `cmd.exe` (including `.cmd` shims, native AGY `title` hook for Windows Terminal tabs, Windows system proxy detection, and 5-min cached dark/light theme detection; only the legacy OSC `/dev/tty` fallback is POSIX-only). On older ConHost fonts missing `▮`, switch with `agy-bar config bar-style squares` or `blocks`.
|
|
206
208
|
|
|
207
209
|
---
|
|
208
210
|
|
|
209
211
|
## Update & Uninstall
|
|
210
212
|
|
|
211
213
|
```sh
|
|
212
|
-
# Update (preserves config, ledger, pricing cache & original statusLine backup)
|
|
213
|
-
npx agy-bar@latest install
|
|
214
|
+
# Update (preserves config, ledger, pricing cache & original statusLine/title backup)
|
|
215
|
+
npx -y agy-bar@latest install
|
|
214
216
|
|
|
215
|
-
# Uninstall & restore previous statusLine + remove managed shell hook cleanly
|
|
216
|
-
npx agy-bar uninstall
|
|
217
|
+
# Uninstall & restore previous statusLine/title + remove managed shell hook cleanly
|
|
218
|
+
npx -y agy-bar@latest uninstall # or: agy-bar uninstall
|
|
217
219
|
|
|
218
220
|
# Complete cleanup including current terminal's proxy env vars & agy() function (zsh/bash):
|
|
219
221
|
eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"
|
|
@@ -224,7 +226,7 @@ eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"
|
|
|
224
226
|
## Development
|
|
225
227
|
|
|
226
228
|
```sh
|
|
227
|
-
npm test # Cross-platform Node.js built-in test suite (
|
|
229
|
+
npm test # Cross-platform Node.js built-in test suite (87 tests)
|
|
228
230
|
npm run preview # Render live terminal preview
|
|
229
231
|
npm run preview:svg # Regenerate all 5 showcase SVGs in assets/
|
|
230
232
|
npm run stats # Show local usage stats
|
package/README.zh-CN.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/xy-tuoren/agy-bar/actions/workflows/ci.yml)
|
|
10
10
|
[](https://www.npmjs.com/package/agy-bar)
|
|
11
|
+
[](https://www.npmjs.com/package/agy-bar)
|
|
11
12
|
[](https://nodejs.org/)
|
|
12
13
|
[](#)
|
|
13
14
|
[](./LICENSE)
|
|
@@ -16,13 +17,13 @@
|
|
|
16
17
|
|
|
17
18
|

|
|
18
19
|
|
|
19
|
-
<sub>Ghostty 真机实拍:10
|
|
20
|
+
<sub>Ghostty 真机实拍:10 并发子代理(`v1.0+` 已统一显示为 `SUB 10`)、实时代码增删(`+14.3K -803`)、免 TUN 本地代理(`PX 7897`)、1.01B 累计 Token、99% 缓存倒计时、TTFT/速率、本对话预估费用与 5h/7d 额度条。</sub>
|
|
20
21
|
|
|
21
22
|

|
|
22
23
|
|
|
23
24
|
```sh
|
|
24
25
|
# 一行命令安装(需 Node.js >= 20,零第三方依赖)
|
|
25
|
-
npx agy-bar install
|
|
26
|
+
npx -y agy-bar@latest install
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
---
|
|
@@ -93,6 +94,7 @@ CTX ▮▮▮▯▯▯▯▯ 42.6% (1.0M) │ CACHE 88%·3m42s │ TTFT 1.9s·15
|
|
|
93
94
|
> ```text
|
|
94
95
|
> 当用户在长对话中明显切换到新任务或新话题时,静默执行一次 `agy-bar title "<4~8字中文简短主题>"` 更新终端标签页标题。
|
|
95
96
|
> ```
|
|
97
|
+
> *Ghostty 小贴士*:自定义标签名请优先使用 `agy-bar title "..."`,不要用 Ghostty 右键 **Change Title…**(会写入 `tabOverride` 锁死标签并屏蔽后续 `●` / `✓` 自动更新,清空留空回车即可解锁)。
|
|
96
98
|
|
|
97
99
|
---
|
|
98
100
|
|
|
@@ -114,7 +116,7 @@ CTX ▮▮▮▯▯▯▯▯ 42.6% (1.0M) │ CACHE 88%·3m42s │ TTFT 1.9s·15
|
|
|
114
116
|
### 方式一:通过 `npx` 一键安装(推荐)
|
|
115
117
|
|
|
116
118
|
```sh
|
|
117
|
-
npx agy-bar install
|
|
119
|
+
npx -y agy-bar@latest install
|
|
118
120
|
```
|
|
119
121
|
|
|
120
122
|
### 方式二:让 `agy` 自动帮你装
|
|
@@ -133,7 +135,7 @@ cd ~/agy-bar
|
|
|
133
135
|
node bin/agy-bar.mjs install
|
|
134
136
|
```
|
|
135
137
|
|
|
136
|
-
安装完成后**重启 `agy`**
|
|
138
|
+
安装完成后**重启 `agy`** 即可激活状态栏与官方原生 `title` 接口(已有会话可先运行 `/skills reload` 加载 `/agy-bar`)。`install` 会自动安装全局命令 `~/.local/bin/agy-bar`、安全备份原有 `statusLine` / `title` 配置(不会覆盖用户已有的自定义 `title` 脚本),且默认不改动 `~/.zshrc`(按需启用代理 Hook)。如不需要配套 `/agy-bar` Skill 或原生 `title`,可加 `--no-skill` / `--no-title`。
|
|
137
139
|
|
|
138
140
|
---
|
|
139
141
|
|
|
@@ -202,18 +204,18 @@ agy-bar config reset
|
|
|
202
204
|
|
|
203
205
|
- **真彩与 256 色终端自动适配**:在 Ghostty、iTerm2、Kitty、WezTerm、Alacritty、Warp、VS Code、Windows Terminal 中输出 24-bit 真彩;在 macOS 自带 `Terminal.app`(`Apple_Terminal`)及未开真彩的 `tmux` / `screen` / SSH 下自动降级为最接近的 xterm-256 色;完整遵守 `NO_COLOR` 与 `TERM=dumb`。
|
|
204
206
|
- **深浅主题自适应**:状态栏配色与 `agy-bar stats` 52 周热力图均自动适配深色与浅色背景。
|
|
205
|
-
- **Windows 说明**:支持 Windows Terminal、PowerShell 7(`pwsh`)、Windows PowerShell 5.1 与 `cmd.exe`(兼容 `.cmd`
|
|
207
|
+
- **Windows 说明**:支持 Windows Terminal、PowerShell 7(`pwsh`)、Windows PowerShell 5.1 与 `cmd.exe`(兼容 `.cmd` 入口、原生 AGY `title` 标签页标题同步、Windows 系统代理检测、主题注册表 5 分钟缓存;仅旧会话的 OSC `/dev/tty` 旁路回退为 POSIX 专属)。如老版 ConHost 字体缺少 `▮`,可执行 `agy-bar config bar-style squares` 或 `blocks`。
|
|
206
208
|
|
|
207
209
|
---
|
|
208
210
|
|
|
209
211
|
## 更新与卸载
|
|
210
212
|
|
|
211
213
|
```sh
|
|
212
|
-
# 更新(保留个人配置、历史账本、定价缓存与原始 statusLine 备份)
|
|
213
|
-
npx agy-bar@latest install
|
|
214
|
+
# 更新(保留个人配置、历史账本、定价缓存与原始 statusLine/title 备份)
|
|
215
|
+
npx -y agy-bar@latest install
|
|
214
216
|
|
|
215
|
-
# 卸载并无损恢复原有 statusLine、移除托管 Shell Hook
|
|
216
|
-
npx agy-bar uninstall
|
|
217
|
+
# 卸载并无损恢复原有 statusLine/title、移除托管 Shell Hook
|
|
218
|
+
npx -y agy-bar@latest uninstall # 或:agy-bar uninstall
|
|
217
219
|
|
|
218
220
|
# 彻底清理(含 Skill、配置目录,并立即清掉当前终端内存中的 agy() 函数与代理环境变量)
|
|
219
221
|
eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"
|
|
@@ -224,7 +226,7 @@ eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"
|
|
|
224
226
|
## 本地开发
|
|
225
227
|
|
|
226
228
|
```sh
|
|
227
|
-
npm test # 运行内置单元测试(
|
|
229
|
+
npm test # 运行内置单元测试(87 项,macOS / Linux / Windows 三端 CI 验证)
|
|
228
230
|
npm run preview # 终端实时预览
|
|
229
231
|
npm run preview:svg # 重新生成 assets/ 下全部 5 张展示 SVG
|
|
230
232
|
npm run stats # 查看本机统计
|
package/bin/agy-bar.mjs
CHANGED
|
@@ -64,9 +64,17 @@ import {
|
|
|
64
64
|
} from '../src/shell-hook.mjs';
|
|
65
65
|
import { aggregateStats, formatStatsReport, HEATMAP_PALETTE_NAMES, PERIOD_NAMES, readLedger, SOURCE_NAMES } from '../src/stats.mjs';
|
|
66
66
|
import { runStatusline } from '../src/statusline.mjs';
|
|
67
|
-
import { buildTabTitle, writeOscTitle } from '../src/tab-title.mjs';
|
|
68
|
-
import {
|
|
67
|
+
import { buildTabTitle, resolveTerminalTarget, writeOscTitle } from '../src/tab-title.mjs';
|
|
68
|
+
import {
|
|
69
|
+
armPayloadCapture,
|
|
70
|
+
findSessionForHost,
|
|
71
|
+
listSessions,
|
|
72
|
+
readCapturedPayload,
|
|
73
|
+
setSessionCustomTitle,
|
|
74
|
+
updateSessionTabTitle,
|
|
75
|
+
} from '../src/telemetry.mjs';
|
|
69
76
|
import { THEME_NAMES } from '../src/themes.mjs';
|
|
77
|
+
import { isNativeTitleActive } from '../src/title.mjs';
|
|
70
78
|
|
|
71
79
|
const pkg = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8'));
|
|
72
80
|
|
|
@@ -432,22 +440,43 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
432
440
|
if (command === 'title') {
|
|
433
441
|
const { flags, positional } = parseFlags(rest);
|
|
434
442
|
const cfg = loadConfig();
|
|
443
|
+
const hostTarget = flags.session ? null : resolveTerminalTarget();
|
|
444
|
+
const hostPid = hostTarget?.hostPid ?? null;
|
|
435
445
|
if (!flags.clear && positional.length === 0) {
|
|
436
446
|
const recent = listSessions();
|
|
437
|
-
const target = flags.session
|
|
447
|
+
const target = flags.session
|
|
448
|
+
? recent.find((s) => s.sessionId === flags.session)
|
|
449
|
+
: findSessionForHost(recent, hostPid);
|
|
438
450
|
if (!target) {
|
|
439
451
|
console.log('No active agy-bar session found yet.');
|
|
440
452
|
return;
|
|
441
453
|
}
|
|
454
|
+
const nativeTitleActive = isNativeTitleActive(target.sessionId, { hostPid: hostPid ?? process.ppid });
|
|
455
|
+
const computedTitle = buildTabTitle(
|
|
456
|
+
{
|
|
457
|
+
agent_state: target.agentState,
|
|
458
|
+
subagents: target.runningSubagents || 0,
|
|
459
|
+
task_count: target.runningTasks || 0,
|
|
460
|
+
tool_confirmation_pending: Boolean(target.toolConfirmationPending),
|
|
461
|
+
conversation_title: target.conversationTitle,
|
|
462
|
+
cwd: target.cwd,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
config: cfg,
|
|
466
|
+
git: target.branch ? { branch: target.branch, dirty: target.dirty } : null,
|
|
467
|
+
customTitle: target.customTitle,
|
|
468
|
+
},
|
|
469
|
+
);
|
|
442
470
|
console.log(
|
|
443
471
|
JSON.stringify(
|
|
444
472
|
{
|
|
445
473
|
sessionId: target.sessionId,
|
|
446
474
|
tabTitleEnabled: cfg.tabTitle,
|
|
475
|
+
nativeTitleActive,
|
|
447
476
|
source: cfg.tabTitleSource,
|
|
448
477
|
customTitle: target.customTitle || null,
|
|
449
478
|
conversationTitle: target.conversationTitle || null,
|
|
450
|
-
activeTabTitle: target.lastTabTitle || null,
|
|
479
|
+
activeTabTitle: (nativeTitleActive ? computedTitle : target.lastTabTitle || computedTitle) || null,
|
|
451
480
|
},
|
|
452
481
|
null,
|
|
453
482
|
2,
|
|
@@ -459,6 +488,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
459
488
|
const rawText = positional.join(' ').trim();
|
|
460
489
|
const updated = setSessionCustomTitle(rawText, {
|
|
461
490
|
sessionId: flags.session || null,
|
|
491
|
+
hostPid,
|
|
462
492
|
clear: Boolean(flags.clear),
|
|
463
493
|
});
|
|
464
494
|
const renderedTitle = buildTabTitle(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-bar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Zero-dependency terminal statusline, no-TUN proxy launcher, exact TTFT & tok/s speed, 5-min cache TTL countdown, live pricing cache, automatic tab titles, 52-week token heatmap, and multi-CLI monitor for Antigravity CLI (agy).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/skills/agy-bar/SKILL.md
CHANGED
|
@@ -34,6 +34,7 @@ agy-bar <command> # installed at ~/.local/bin/agy-bar (or: node ~/.gemini/conf
|
|
|
34
34
|
| Multi-CLI live monitor | `agy-bar monitor [--once]` |
|
|
35
35
|
| Redacted payload debug | `agy-bar debug --capture` then `agy-bar debug` |
|
|
36
36
|
| Preview / Diagnostics | `agy-bar preview --scenario all` / `agy-bar doctor` |
|
|
37
|
+
| Full uninstall + live shell cleanup | `eval "$(agy-bar uninstall --remove-skill --purge --print-cleanup)"` |
|
|
37
38
|
|
|
38
39
|
## Toggleable Items
|
|
39
40
|
|
package/src/telemetry.mjs
CHANGED
|
@@ -512,16 +512,39 @@ export function updateSessionTabTitle(
|
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
+
function readNativeTitlePid(sessionId, baseDir) {
|
|
516
|
+
const markerPath = join(sessionsDir(baseDir), `${sessionId}.title`);
|
|
517
|
+
if (!existsSync(markerPath)) return null;
|
|
518
|
+
try {
|
|
519
|
+
const [, rawPid] = readFileSync(markerPath, 'utf8').trim().split(':');
|
|
520
|
+
const pid = Number(rawPid);
|
|
521
|
+
return Number.isFinite(pid) && pid > 1 ? pid : null;
|
|
522
|
+
} catch {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export function findSessionForHost(sessions, hostPid, { baseDir = configDir(homedir()) } = {}) {
|
|
528
|
+
if (!Array.isArray(sessions) || sessions.length === 0) return null;
|
|
529
|
+
if (typeof hostPid === 'number' && hostPid > 1) {
|
|
530
|
+
const byTabPid = sessions.find((s) => s.lastTabHostPid === hostPid);
|
|
531
|
+
if (byTabPid) return byTabPid;
|
|
532
|
+
const byNativeMarker = sessions.find((s) => readNativeTitlePid(s.sessionId, baseDir) === hostPid);
|
|
533
|
+
if (byNativeMarker) return byNativeMarker;
|
|
534
|
+
}
|
|
535
|
+
return sessions[0];
|
|
536
|
+
}
|
|
537
|
+
|
|
515
538
|
export function setSessionCustomTitle(
|
|
516
539
|
title,
|
|
517
|
-
{ sessionId = null, baseDir = configDir(homedir()), now = Date.now(), clear = false } = {},
|
|
540
|
+
{ sessionId = null, hostPid = null, baseDir = configDir(homedir()), now = Date.now(), clear = false } = {},
|
|
518
541
|
) {
|
|
519
542
|
const sDir = sessionsDir(baseDir);
|
|
520
543
|
let targetId = sessionId ? String(sessionId).trim().replace(/[^a-zA-Z0-9_-]/g, '') : null;
|
|
521
544
|
|
|
522
545
|
if (!targetId) {
|
|
523
546
|
const recent = listSessions({ baseDir, now });
|
|
524
|
-
targetId = recent
|
|
547
|
+
targetId = findSessionForHost(recent, hostPid, { baseDir })?.sessionId || 'default';
|
|
525
548
|
}
|
|
526
549
|
|
|
527
550
|
const sFile = join(sDir, `${targetId}.json`);
|
package/src/title.mjs
CHANGED
|
@@ -15,6 +15,21 @@ export function nativeTitleMarkerPath(sessionId, baseDir = configDir(homedir()))
|
|
|
15
15
|
return join(sessionsDir(baseDir), `${sessionId}.title`);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export function readNativeTitleMarker(sessionId, baseDir = configDir(homedir())) {
|
|
19
|
+
if (!sessionId) return null;
|
|
20
|
+
const markerPath = nativeTitleMarkerPath(sessionId, baseDir);
|
|
21
|
+
if (!existsSync(markerPath)) return null;
|
|
22
|
+
try {
|
|
23
|
+
const [rawTs, rawPid] = readFileSync(markerPath, 'utf8').trim().split(':');
|
|
24
|
+
const ts = Number(rawTs);
|
|
25
|
+
const pid = Number(rawPid);
|
|
26
|
+
if (!Number.isFinite(ts) || ts <= 0) return null;
|
|
27
|
+
return { ts, pid: Number.isFinite(pid) && pid > 1 ? pid : null };
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
export function touchNativeTitleMarker(
|
|
19
34
|
sessionId,
|
|
20
35
|
{ now = Date.now(), hostPid = process.ppid, baseDir = configDir(homedir()) } = {},
|
|
@@ -22,18 +37,9 @@ export function touchNativeTitleMarker(
|
|
|
22
37
|
if (!sessionId) return false;
|
|
23
38
|
const markerPath = nativeTitleMarkerPath(sessionId, baseDir);
|
|
24
39
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const prevPid = Number(rawPid);
|
|
29
|
-
if (
|
|
30
|
-
Number.isFinite(prevTs) &&
|
|
31
|
-
now - prevTs < NATIVE_TITLE_TOUCH_INTERVAL_MS &&
|
|
32
|
-
Number.isFinite(prevPid) &&
|
|
33
|
-
prevPid === hostPid
|
|
34
|
-
) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
40
|
+
const prev = readNativeTitleMarker(sessionId, baseDir);
|
|
41
|
+
if (prev && now - prev.ts < NATIVE_TITLE_TOUCH_INTERVAL_MS && prev.pid === hostPid) {
|
|
42
|
+
return true;
|
|
37
43
|
}
|
|
38
44
|
mkdirSync(dirname(markerPath), { recursive: true });
|
|
39
45
|
writeFileSync(markerPath, `${now}:${Number.isFinite(hostPid) ? hostPid : 0}\n`, 'utf8');
|
|
@@ -47,24 +53,14 @@ export function isNativeTitleActive(
|
|
|
47
53
|
sessionId,
|
|
48
54
|
{ now = Date.now(), hostPid = process.ppid, baseDir = configDir(homedir()) } = {},
|
|
49
55
|
) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const pid = Number(rawPid);
|
|
57
|
-
if (!Number.isFinite(ts) || ts <= 0) return false;
|
|
58
|
-
const ageMs = now - ts;
|
|
59
|
-
if (ageMs < 0) return true;
|
|
60
|
-
if (ageMs < NATIVE_TITLE_FRESH_MS) return true;
|
|
61
|
-
if (ageMs < 24 * 60 * 60 * 1000 && Number.isFinite(pid) && pid > 1 && typeof hostPid === 'number' && pid === hostPid) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
} catch {
|
|
66
|
-
return false;
|
|
56
|
+
const marker = readNativeTitleMarker(sessionId, baseDir);
|
|
57
|
+
if (!marker) return false;
|
|
58
|
+
const ageMs = now - marker.ts;
|
|
59
|
+
if (ageMs < 0 || ageMs < NATIVE_TITLE_FRESH_MS) return true;
|
|
60
|
+
if (ageMs < 24 * 60 * 60 * 1000 && marker.pid !== null && typeof hostPid === 'number' && marker.pid === hostPid) {
|
|
61
|
+
return true;
|
|
67
62
|
}
|
|
63
|
+
return false;
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
export function renderNativeTitle(
|
|
@@ -104,6 +100,8 @@ export async function runTitleCommand({
|
|
|
104
100
|
stdout = process.stdout,
|
|
105
101
|
baseDir = configDir(homedir()),
|
|
106
102
|
config = undefined,
|
|
103
|
+
now = Date.now(),
|
|
104
|
+
hostPid = process.ppid,
|
|
107
105
|
} = {}) {
|
|
108
106
|
let raw = '';
|
|
109
107
|
for await (const chunk of stdin) {
|
|
@@ -113,7 +111,7 @@ export async function runTitleCommand({
|
|
|
113
111
|
try {
|
|
114
112
|
const payload = raw.trim() ? JSON.parse(raw) : {};
|
|
115
113
|
const cfg = config ?? loadConfig();
|
|
116
|
-
const title = renderNativeTitle(payload, { config: cfg, baseDir });
|
|
114
|
+
const title = renderNativeTitle(payload, { config: cfg, baseDir, now, hostPid });
|
|
117
115
|
if (title) {
|
|
118
116
|
stdout.write(`${title}\n`);
|
|
119
117
|
}
|