agent-sanitizer 2.34.6 → 2.34.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,10 @@ export function alertAcknowledged(): boolean;
26
26
  */
27
27
  export function acknowledgeAlert(): void;
28
28
  /**
29
+ * The blocking ask. The heading states only that the scan did not finish clean:
30
+ * the alert carries injection findings, unreadable targets, or a scanner fault,
31
+ * and each report names its own kind. A heading that asserted "injection
32
+ * detected" mislabelled the other two.
29
33
  * @param {string} findings
30
34
  * @returns {string}
31
35
  */
@@ -1,31 +1,17 @@
1
1
  /**
2
- * Scan every instruction file under the project, ACCOUNTING for every target
3
- * the finder returned: `scanned + skipped.length === targets.length`, always.
4
- *
5
- * The accounting is the point. This scan is the only thing standing between a
6
- * poisoned `CLAUDE.md` and a session that loads it as instructions, and its
7
- * caller announces "clean" on the trace channel — the channel that exists so a
8
- * MISSING announcement is loud. A per-file failure swallowed into an empty
9
- * findings list turns "we could not read this file" into "this file is fine",
10
- * which is the one lie this hook must never tell. So a file that cannot be read
11
- * is REPORTED as unscanned, not dropped.
12
- *
13
- * ANY errno is a skip; only a non-filesystem throw propagates. The split is
14
- * between "this file could not be read" (report it and keep scanning) and "this
15
- * code is broken" (a TypeError from an unloaded binding — nothing here can be
16
- * trusted, so it goes to the caller's declared failure posture). Catching only
17
- * ENOENT would invert the enforcement: one EACCES target would discard the
18
- * result for EVERY other instruction file, leaving them unscanned and
19
- * un-auto-cleaned, and under the shipped OPEN posture the hook fault arms
20
- * nothing — so the SUSPICIOUS failure would get weaker enforcement than the
21
- * benign glob race, which reaches `partial` and arms the gate. Same errno-vs-bug
22
- * split {@link autoCleanFindings} uses.
2
+ * Scan every instruction file under the project, bucketing each unreadable
3
+ * target through {@link classifyReadFailure}. `scanned` is DERIVED from the two
4
+ * failure buckets, so the accounting invariant — every target is scanned,
5
+ * skipped or absent — holds by construction and needs no comment restating it.
6
+ * A target lost from that accounting is an instruction file that reaches the
7
+ * model while the caller announces "clean".
23
8
  * @param {string} [dir] project root to scan (injectable for tests)
24
9
  * @returns {{
25
10
  * targets: string[],
26
11
  * scanned: number,
27
12
  * findings: Array<{file: string, findings: ReturnType<typeof scanFile>}>,
28
13
  * skipped: Array<{file: string, reason: string}>,
14
+ * absent: string[],
29
15
  * }}
30
16
  */
31
17
  export function scanProject(dir?: string): {
@@ -39,6 +25,7 @@ export function scanProject(dir?: string): {
39
25
  file: string;
40
26
  reason: string;
41
27
  }>;
28
+ absent: string[];
42
29
  };
43
30
  /**
44
31
  * The report for targets the scan could not read. Rendered into the alert the