stevengonsalvez/agents-in-a-box · Pull Request #240

abtop (top-for-agents): native-key TUI embed + ainb abtop CLI

SG
Steven Gonsalvez
branch feat/abtop · 5 commits
feat/abtop main
+2462 / −6 27 files

What this PR does

The journey, recorded

ainb home → t → rate-limit setup consent → "Just open abtop" → real abtop monitor full-screen → q returns. Recorded with vhs driving the real ainb + abtop binaries.

Frame-truth verification

Not "the screen shows something" — each frame was extracted and read to assert the exact user-visible outcome.

ainb home with abtop sidebar item and the rate-limit consent dialog
Sidebar carries 📡 abtop [t]; first launch raises the "Enable abtop rate-limit tracking?" consent — [ Enable ] [ Just open abtop ] [ Don't ask again ].
real abtop monitor rendered full-screen inside the ainb embed
The real abtop v0.4.7 monitor, full-screen inside the embed — quota / tokens / projects / ports / mcp / sessions panels with live agent rows. Native keys, no re-implementation.

How it works — two paths (the witr pattern)

PATH A — plugin crate `ainb-plugin-abtop` (discoverable) detect (which abtop?) · install-hint empty-state · `abtop --once` CLI seam no data-render: abtop has no JSON / no lib crate PATH B — host embed in ainb-core (the live menu UX) press `t` / select sidebar │ ▼ AppEvent::GoToAbtop ──▶ first launch? ──▶ consent: run `abtop --setup`? │ │ Enable / Just open / Dismiss ▼ ▼ AsyncAction::AttachAbtop │ ▼ tmux new-session -A -d -s ainb-abtop "abtop --exit-on-jump" + attach ainb SUSPENDS ──▶ real abtop full-screen ──▶ quit ──▶ ainb resumes

abtop has no machine-readable mode, so re-rendering its data inside ainb isn't possible — the full-screen attach is the only way to get native keys, and it's what witr does too.

Verification

tripwire_abtop.rs — green (tmux e2e J6→J1) ainb-plugin-abtop — 42 tests host — 896 lib tests ainb abtop absent → hint + exit 1 CLI count test 23 → 24 stable rustfmt clean 9 docker tests — no daemon (environmental)
passing pre-existing / environmental

Locked decisions

Code-review findings (no blockers — both fixed)

Files

ainb-plugin-abtop/ (new crate · 16 files) ainb-core/app/{events,state}.rs ainb-core/main.rs (tmux attach) ainb-core/cli/registry.rs (AbtopCommand) components/sidebar.rs · screens/{mod,builtin}.rs tests/tripwire_abtop.rs Cargo.toml · scripts/build-plugins.sh