Skip to content

Conversation

@CSRessel
Copy link
Collaborator

No description provided.

- Add session_parser module to codex-acp crate
- Implement agent-specific parsers for three transcript formats:
  - Codex: Parse JSONL with cumulative token_count events
  - Gemini: Parse JSON with messages array and aggregate tokens
  - Claude: Parse JSONL with per-message usage objects
- Reuse TokenUsage struct from codex-protocol
- Create TokenUsageReport struct with agent type, session ID, and path
- Parse JSONL line-by-line with resilient error handling
- Extract session IDs from metadata (Claude/Gemini) or derive from filename (Codex)
- Use checked arithmetic for overflow safety
- Map agent-specific token fields:
  - Codex: cached_input_tokens, reasoning_output_tokens
  - Gemini: cached (thoughts → reasoning_output_tokens)
  - Claude: cache_read_input_tokens → cached_input_tokens
- Add comprehensive tests with real session files
- Add error handling tests (empty files, malformed JSON, missing IDs)
- Include model_context_window when available in transcripts

Session discovery logic deferred for future TUI integration.
- Add section describing session transcript parsing functionality
- Document parser functions for Claude, Codex, and Gemini formats
- Explain agent-specific token field mappings
- Note deferred session discovery logic
- Add session_parser module to codex-acp crate with support for parsing
  session transcripts from Claude, Codex, and Gemini agents
- Extract token usage metrics (input, output, cached, reasoning tokens)
  from different session file formats (JSONL and JSON)
- Use checked arithmetic to prevent token count overflow
- Implement resilient line-by-line JSONL parsing with error recovery
- Add comprehensive integration tests for all three agent formats
- Add error handling tests for edge cases (empty file, missing session ID)

Fixes:
- fix(tui-pty-e2e): Move normalize_for_input_snapshot before test module
  to resolve clippy::items_after_test_module warning
- fix(tui): Use inline format args in assert to resolve clippy warning
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.

2 participants