Commit 63a36fd
feat(parsers): add agent-trace.dev v1 sidecar parser
Adds support for the open, vendor-neutral agent-trace.dev v1 spec
(https://agent-trace.dev/) as a third parser alongside the existing
Claude Code and Codex/Copilot native log parsers.
Why
---
ai-blame previously had to grow one bespoke parser per agent. The
agent-trace.dev v1 spec is an open, agent-agnostic JSON sidecar format
designed exactly for this attribution use case, and any producer of
the spec (first-party emitter or third-party exporter from native
logs) is unlocked at once.
What
----
- New `src/parsers/agent_trace.rs` reads `.agent-trace/*.json` records
conforming to the v1 schema and emits one `EditRecord` per
`files[].conversations[].ranges[]` entry.
- Registered in `ParserRegistry::new()` first so the unambiguous
`.json` + spec-shaped discriminator wins before the `.jsonl`
parsers see the file.
- `get_agent_trace_dirs()` discovers `<cwd>/.agent-trace/` and
`~/.agent-trace/` automatically and feeds them into
`get_all_trace_dirs()`.
- Smoke-tested end-to-end against 21 real spec records: 126 edits
across 41 files extracted via `ai-blame stats` / `report`.
Limitations
-----------
agent-trace.dev records carry attribution ranges + `content_hash`
(spec §6.3) rather than raw `old_string` / `new_string` patches, so
`stats` / `timeline` / `report` / `transcript` work fully but
`blame` / `annotate` cannot perform the same patch-walk
reconstruction as the native parsers. Documented in the parser module
docstring and in the README.
Tests
-----
7 new unit tests in `parsers::agent_trace::tests` covering parse,
filter, fallback, can_parse acceptance/rejection, and
`collect_trace_files` extension filtering. Full `cargo test` is
green (22 passing); `cargo fmt --check` and `cargo clippy` clean.
Amp-Thread-ID: https://ampcode.com/threads/T-019e0ee7-99b6-72e7-a9eb-e71bba013ceb
Co-authored-by: Amp <amp@ampcode.com>1 parent 3892e20 commit 63a36fd
4 files changed
Lines changed: 537 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
223 | 242 | | |
224 | 243 | | |
225 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
158 | 181 | | |
159 | 182 | | |
160 | 183 | | |
| 184 | + | |
161 | 185 | | |
162 | 186 | | |
163 | 187 | | |
| |||
0 commit comments