1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! `files` subcommand - which files/dirs a session modified, and when.
//!
//! Extracts file mutations from a session's transcript (spanning subagents by
//! default), attributes each to its genuine-user turn (the same ยง6.4 delimiter
//! `search` uses, via [`crate::model::group_turn_indices`]), then aggregates at the
//! requested detail level (summary / by-dir / by-file / timeline) into text or JSON.
//!
//! ## Extraction split (AUTHORITATIVE vs HEURISTIC)
//!
//! - **Authoritative** - `Write`/`Edit`/`MultiEdit` (`input.file_path`) +
//! `NotebookEdit` (`input.notebook_path`). create-vs-edit is resolved by JOINING the
//! structured tool_use to its paired tool_result carrier
//! (`toolUseResult.type == "create"`) by `tool_use_id` within the turn (see
//! [`crate::model::Record::carrier_create_paths`]).
//! - **Heuristic** - Bash file mutations, parsed lexically from `input.command` by
//! [`crate::bash_mutations`] (Bash carries no path field in its result). These are
//! ALWAYS labelled `(heuristic)` and their `is_create` is itself a heuristic guess.
//!
//! ## Performance shape (the 200 MB+ contract)
//!
//! Like `search`, `files` does a SINGLE forward pass per file (mmap, SIMD newline
//! scan, a pre-JSON mutation byte-prefilter), with full `serde_json` parse only on
//! candidate lines. It must NOT retain large blobs - it extracts a few small owned
//! strings per mutation ([`crate::model::FileMutation`]) and drops the record, never
//! holding `originalFile`/`content`/`structuredPatch` bodies from `toolUseResult`.
//!
//! Per-file fan-out uses the default `rayon` pool, which sizes to
//! `std::thread::available_parallelism()` (= CPU count) - the same pool `search` and
//! `agents` use. No explicit `available_parallelism()` call is added: rayon already
//! consults it implicitly, so an explicit call would be dead code (stated here so a
//! future reader does not "fix" it by adding one).
use BTreeMap;
use Path;
use ;
use ;
use memmem;
use *;
use Regex;
use crateparse_bash_mutations;
use crate;
use crate;
use cratemmap_bytes;
use cratepath;
use crateTimeWindow;
use crate;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;