Skip to content

feat: parse Pi and Antigravity sessions (fixes #46)#172

Open
felipetruman wants to merge 1 commit into
microsoft:mainfrom
felipetruman:feat/pi-antigravity-parsers
Open

feat: parse Pi and Antigravity sessions (fixes #46)#172
felipetruman wants to merge 1 commit into
microsoft:mainfrom
felipetruman:feat/pi-antigravity-parsers

Conversation

@felipetruman

Copy link
Copy Markdown

Description

Adds session parsers for two more agents, registered as external-harness collectors alongside Claude Code, Codex, and OpenCode:

Pi (badlogic/pi-mono)

  • Reads JSONL sessions from ~/.pi/agent/sessions/<encoded-cwd>/<timestamp>_<uuid>.jsonl
  • Full fidelity: user/assistant turns, per-turn token usage summed across agentic steps (including cacheRead/cacheWrite, same convention as the Claude Code parser), model ids, tool calls, edited/referenced file paths, elapsed time, and workspace root from the session header's cwd

Antigravity (Google)

  • Reads per-conversation SQLite databases from ~/.gemini/antigravity-cli/conversations/*.db via the node:sqlite builtin (Node >= 22.5, skipped gracefully when unavailable — same approach as fix: parse OpenCode sessions from SQLite storage (opencode.db) #170)
  • Step payloads are undocumented protobuf blobs; a minimal wire-format decoder (~70 lines, no dependencies) reads the reverse-engineered fields: prompt text, response/thinking text, tool calls with JSON arguments, token usage, and timestamps. The field map is documented in the module header. Every access is best-effort, so schema drift degrades to missing data instead of a crash
  • Workspace roots resolved from the sibling cache/last_conversations.json map

Both harnesses are added to EXTERNAL_HARNESS_SET, hasExternalHarnessSources(), and the extension's marketplace description.

Related Issues

Fixes #46 — together with #170 (OpenCode SQLite storage), all three requested agents (antigravity, pi, opencode) now load.

Checklist

  • npm run check passes (typecheck + lint + spellcheck + knip + tests) — 1218 tests, tsc --noEmit clean, ESLint 0 errors and 0 new warnings in the parser files, cspell 0 issues, knip clean
  • Changes are covered by tests (parser-pi.test.ts: turn assembly, usage summing, no-request/no-usage sessions; parser-antigravity.test.ts: synthetic conversation db with hand-encoded protobuf payloads, plus a no-user-message db)
  • Documentation updated (module headers document both layouts incl. the reverse-engineered protobuf field map; marketplace description lists the new harnesses)

Verification against real data

  • Pi: 66 sessions / 379 requests parsed from a real ~/.pi install; 377 requests carry token data; models, tools (bash, read, edit, write), and file paths resolve
  • Antigravity: 164 conversations / 232 requests parsed from a real ~/.gemini/antigravity-cli install; 212 requests carry token data, 200 carry response text; workspace roots resolve via last_conversations.json; locked/empty databases are skipped without error

Adds two external-harness collectors:

- Pi (badlogic/pi-mono): JSONL sessions under ~/.pi/agent/sessions.
  Full fidelity — per-turn summed token usage incl. cache, model ids,
  tool calls, and edited/referenced file paths.
- Antigravity (Google): per-conversation SQLite dbs under
  ~/.gemini/antigravity-cli/conversations, with step payloads stored as
  undocumented protobuf blobs. A minimal wire-format decoder reads the
  reverse-engineered fields (prompt/response text, tool calls, token
  usage, timestamps) defensively, so schema drift degrades to missing
  data instead of a crash. Workspace roots come from the sibling
  cache/last_conversations.json map. Requires node:sqlite (Node >= 22.5),
  skipped gracefully when unavailable.
Copilot AI review requested due to automatic review settings July 2, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add support for more agents/clis

2 participants