Feat: pi agent support
Summary
Add pi-coding-agent as a first-class session source in abtop.
This PR adds end-to-end Pi support:
- discover and parse persisted Pi sessions
- show Pi rows in the sessions UI
- include Pi demo data and docs
- recover idle Pi sessions when the session JSONL fd is closed
- show temporary pending Pi sessions before the first assistant response is persisted
- align Pi summary inputs with the existing Claude/Codex summary pipeline
Problem
abtop supported Claude Code and Codex CLI, but not pi-coding-agent.
In practice that meant:
- Pi sessions were invisible
- idle Pi sessions could disappear because Pi does not always keep the JSONL file open
- new Pi sessions could be missing until the first assistant response was written
- Pi summary metadata was weaker than Claude/Codex because it did not populate
first_assistant_text
Solution
Baseline Pi support
- add
src/collector/pi.rs - register
PiCollectorinMultiCollector - parse Pi session JSONL under
~/.pi/agent/sessions/... - extract:
- session id
- cwd / project
- model
- thinking level / effort
- token totals
- token history
- current task
- child processes / ports
Idle-session recovery
If Pi is running but no longer has the JSONL file open:
- inspect process cwd via
lsof - infer the Pi session dir from cwd
- select the newest matching JSONL in that dir
- validate the header cwd
Pending-session support
If the per-cwd Pi session dir exists but no JSONL exists yet:
- synthesize a temporary
pending-pi-{pid}session - show process-derived metadata until the real JSONL appears
Summary alignment
Populate first_assistant_text for Pi so the shared summary-generation path has the same inputs Claude/Codex already use.
UI / docs
- add Pi labels/colors in the session table
- include Pi in demo data
- document Pi support and pending-session behavior in
README.mdandCLAUDE.md
Files
src/collector/mod.rssrc/collector/pi.rssrc/collector/process.rssrc/ui/sessions.rssrc/demo.rsREADME.mdCLAUDE.md
Validation
cargo test
cargo clippy -- -D warnings
cargo run -- --once
Thanks for the PR! This falls under the agent coverage strategy discussion in #45 — we're currently deciding the inclusion bar for new agents (and whether core vs. plugin is the right path) before merging additional collectors. Will loop back here once that's resolved.
Is there an update on this PR? Also, will this automatically enable other Pi-based coding agents?