Commit graph

13 commits

Author SHA1 Message Date
AgentSeal
475ab0da61 fix: case-insensitive Codex originator check
Codex Desktop on Windows uses "Codex Desktop" as the originator
string instead of "codex_cli" or "codex_vscode". The startsWith
check was case-sensitive, rejecting these sessions silently.

Fixes #1 (comment by @JiglioNero).
2026-04-15 16:06:28 -07:00
AgentSeal
2d114d9393 feat: add OpenCode provider
Reads session data from OpenCode's SQLite databases at
~/.local/share/opencode/. Reuses the existing better-sqlite3
adapter (same as Cursor), lazy-loaded so users without OpenCode
see no difference. Adds bashCommands to the provider interface
so shell command breakdowns work across all providers.

31 tests, schema validation, diagnostic stderr on failures.
Also fixes a pre-existing tsc error in currency.ts.
2026-04-15 14:24:37 -07:00
AgentSeal
2afab5f71a fix: final review cleanup
- Remove unused vi import from cursor test
- Move LANG_DISPLAY_NAMES to module scope (was re-created per render)
- Remove redundant 'script' regex (scrip?t already covers it)
- Unexport getDbFingerprint (internal to cache module)
- Move beforeEach inside describe block (only cursor tests need it)
2026-04-15 05:35:11 -07:00
AgentSeal
94762ca1f4 fix: address review findings before merge
- getProvider() now async, eliminates race condition with cursor loading
- cursor:edit pseudo-tool prevents inflating Claude's Edit count in --provider all
- Tightened SCRIPT_PATTERNS to avoid false positives (run requires file context)
- Removed duplicated LANG_NAMES from cursor.ts (dashboard handles display)
- Test no longer assumes cursor always loads (CI-safe)
- Removed unnecessary type assertion and setTimeout yield
2026-04-15 05:31:51 -07:00
AgentSeal
3fabc105d8 perf: file-based result cache for Cursor DB
First run parses the 21GB DB (slow, ~40-80s). Writes parsed
results to ~/.cache/codeburn/cursor-results.json. Subsequent
runs check DB mtime+size -- if unchanged, load from cache
(instant). Cache auto-invalidates when Cursor modifies the DB.
2026-04-15 05:11:30 -07:00
AgentSeal
b7b7b2c7d6 perf: lazy-load cursor provider to eliminate startup overhead
Cursor module (sqlite.ts, better-sqlite3) now only loads when
cursor provider is actually requested. Claude/Codex startup
is unaffected -- cursor import never happens unless needed.
2026-04-15 03:59:49 -07:00
AgentSeal
70931b7269 feat: add Cursor IDE provider with SQLite adapter
Reads token usage from Cursor's local state.vscdb database.
Supports per-request input/output tokens, model tracking,
and incremental caching for large databases.

- better-sqlite3 as optionalDependency (lazy-loaded, no impact on Claude/Codex)
- Parameterized SQL queries, read-only mode, per-row error handling
- Schema detection with clear error on format changes
- Cache layer with timestamp watermark for incremental reads
- Provider colors and [p] key cycling in dashboard
- 39 tests passing, zero regressions
2026-04-15 03:44:43 -07:00
AgentSeal
51c56d0726 fix: include agent/subagent sessions, fix Codex cache hit and cost calculation
- Remove agent-*.jsonl exclusion filter that was dropping ~46% of API calls
- Scan subagents/ directories for subagent session files
- Normalize Codex token semantics: OpenAI includes cached tokens inside
  input_tokens, subtract them to match Anthropic's separate reporting
- Fixes cost double-counting and 100% cache hit display for Codex users
2026-04-14 10:18:14 -07:00
AgentSeal
9ab7f37f6f Fix CSV formula injection in exports 2026-04-14 11:04:10 -04:00
AgentSeal
391a235d1d feat: multi-provider support (Codex + provider plugin system)
Add Codex (OpenAI) as a second provider alongside Claude Code. Provider
plugin architecture makes adding future providers (Pi, OpenCode, Amp) a
single-file addition.

- Provider interface: types, session discovery, stateful JSONL parsing
- Codex parser: token_count dedup, tool normalization, model resolution
- TUI: press p to cycle All/Claude/Codex with 1-min cache for instant switching
- CLI: --provider flag on report, today, month, status, export commands
- Pricing: Codex model fallbacks, fixed fuzzy matching for gpt-5.4-mini
- Menubar: per-provider cost breakdown when multiple providers detected
- 27 tests (10 new: Codex parser, provider registry, tool/model mapping)
2026-04-14 04:32:09 -07:00
Rafael Calleja
a5696362f2 refactor: share BASH_TOOLS from classifier, remove comments
- Export BASH_TOOLS from classifier.ts instead of duplicating in bash-utils.ts
- Remove isBashTool helper (use BASH_TOOLS.has() directly)
- Strip unnecessary comments per codebase conventions
2026-04-14 10:24:38 +02:00
Rafael Calleja
45ce697eea fix: correct quote-handling alignment in extractBashCommands
Replace quoted strings with same-length spaces in stripQuotedStrings so
separator indices in the stripped string map correctly to the original.
Add test coverage for quoted separators and isBashTool.
2026-04-14 10:24:24 +02:00
Rafael Calleja
b75c2663b4 feat: add extractBashCommands with TDD tests
Implements bash command parsing utility that splits on &&, ;, and |
separators while respecting quoted strings. Includes isBashTool helper.
All 12 vitest tests pass.
2026-04-14 10:24:24 +02:00