agent-sanitizer 2.57.4 → 2.58.0
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.
- package/README.md +11 -1
- package/THREAT-MODEL.md +18 -0
- package/bin/sanitize-cli.mjs +14 -3
- package/claude-hooks/lib/invisible-alert.mjs +18 -13
- package/package.json +1 -1
- package/src/claude-context.mjs +10 -6
- package/src/instructions.mjs +47 -16
- package/src/repo-scope.mjs +240 -0
- package/types/claude-context.d.mts +9 -5
- package/types/instructions.d.mts +24 -5
- package/types/repo-scope.d.mts +58 -0
- package/types/src/ansi.d.mts +176 -0
- package/types/src/cf-charset.d.mts +14 -0
- package/types/src/claude-context.d.mts +9 -5
- package/types/src/instructions.d.mts +170 -0
- package/types/src/invisible.d.mts +217 -0
- package/types/src/joining-type.d.mts +32 -0
- package/types/src/repo-scope.d.mts +58 -0
- package/types/src/standardized-variants.d.mts +22 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Unicode Joining_Type of a code point: "C", "D", "R", "L", "T", or "U"
|
|
3
|
+
* (the non-joining default) for anything not in the cursive tables.
|
|
4
|
+
* @param {number} cp
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function joiningType(cp: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* True when `cp` is an Indic virama (the only position where a ZWNJ/ZWJ is
|
|
10
|
+
* linguistically meaningful in Brahmic scripts).
|
|
11
|
+
* @param {number} cp
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
*/
|
|
14
|
+
export function isVirama(cp: number): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True when `cp` is a Brahmic consonant — the only base a virama attaches to,
|
|
17
|
+
* and therefore the only base after which a ZWJ/ZWNJ is a real conjunct
|
|
18
|
+
* request rather than a zero-width payload.
|
|
19
|
+
* @param {number} cp
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
export function isBrahmicConsonant(cp: number): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* GENERATED by scripts/gen-joining-type.mjs from ucd-full@17.0.0 — DO NOT EDIT.
|
|
25
|
+
*
|
|
26
|
+
* Unicode Joining_Type, Indic virama and Brahmic consonant range tables backing
|
|
27
|
+
* the ZWNJ/ZWJ carve-out in invisible.mjs. Regenerate with `pnpm gen:joining-type`;
|
|
28
|
+
* test/joining-type.test.mjs fails if this drifts from the pinned UCD.
|
|
29
|
+
*/
|
|
30
|
+
export const UNICODE_VERSION: "17.0.0";
|
|
31
|
+
/** @type {ReadonlyArray<readonly [string, number, number]>} */
|
|
32
|
+
export const BRAHMIC_CONSONANT_RANGES: ReadonlyArray<readonly [string, number, number]>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The linked worktrees in a `git worktree list --porcelain -z` dump, main and
|
|
3
|
+
* bare ones excluded — those are not removable, so their state is never at risk
|
|
4
|
+
* from a teardown command, and the main one is the scan root a prune must never
|
|
5
|
+
* swallow.
|
|
6
|
+
* @param {string} porcelain
|
|
7
|
+
* @returns {string[]} absolute worktree paths
|
|
8
|
+
*/
|
|
9
|
+
export function parseWorktreeList(porcelain: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The linked worktrees of the repo at `cwd`. The guard on `git worktree remove`
|
|
12
|
+
* asks this the same way the prune below does, so one parser answers for both.
|
|
13
|
+
* @param {string} cwd
|
|
14
|
+
* @param {GitRun} run
|
|
15
|
+
* @returns {string[]} absolute worktree paths
|
|
16
|
+
*/
|
|
17
|
+
export function linkedWorktrees(cwd: string, run: GitRun): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Directory paths a context scan of `dir` must not walk, relative to it and
|
|
20
|
+
* `/`-separated: every wholly-ignored directory (unless `ignoredDirs` is off)
|
|
21
|
+
* and every linked worktree nested inside it.
|
|
22
|
+
* @param {string} dir
|
|
23
|
+
* @param {{ ignoredDirs?: boolean, run?: GitRun }} [options]
|
|
24
|
+
* @returns {Set<string>}
|
|
25
|
+
*/
|
|
26
|
+
export function repoPrunedDirs(dir: string, { ignoredDirs, run }?: {
|
|
27
|
+
ignoredDirs?: boolean;
|
|
28
|
+
run?: GitRun;
|
|
29
|
+
}): Set<string>;
|
|
30
|
+
/**
|
|
31
|
+
* The `exclude` predicate for an instruction-file walk of `dir`: the static
|
|
32
|
+
* context-scope prune, plus {@link repoPrunedDirs}.
|
|
33
|
+
*
|
|
34
|
+
* `ignoredDirs: false` is the LAUNCH scan's posture, and it is a security
|
|
35
|
+
* choice rather than a performance one: `.gitignore` is repo-controlled, so
|
|
36
|
+
* honouring it in the one scan that covers launch-time ingress would let a
|
|
37
|
+
* hostile repo hide a planted `.claude/skills/…/SKILL.md` from it by ignoring
|
|
38
|
+
* that directory. The whole-tree scan can honour it because anything it prunes
|
|
39
|
+
* is still scanned by scan-loaded-instructions at the moment the host loads it.
|
|
40
|
+
*
|
|
41
|
+
* The lookup is EXACT, so the walk must hand it the same spelling
|
|
42
|
+
* {@link repoPrunedDirs} uses — one root-relative, `/`-separated path per entry,
|
|
43
|
+
* which is what walkContextGlobs normalizes to. A predicate that accepted a bare
|
|
44
|
+
* name as well would prune a tracked `src/build/` for a top-level ignored
|
|
45
|
+
* `build/`, splicing real instruction files out of the scan.
|
|
46
|
+
* @param {string} dir
|
|
47
|
+
* @param {{ ignoredDirs?: boolean, run?: GitRun }} [options]
|
|
48
|
+
* @returns {(entry: string) => boolean}
|
|
49
|
+
*/
|
|
50
|
+
export function contextScanExclude(dir: string, options?: {
|
|
51
|
+
ignoredDirs?: boolean;
|
|
52
|
+
run?: GitRun;
|
|
53
|
+
}): (entry: string) => boolean;
|
|
54
|
+
/**
|
|
55
|
+
* How git is asked. Injectable so a test can drive the failure paths, which no
|
|
56
|
+
* filesystem state can force.
|
|
57
|
+
*/
|
|
58
|
+
export type GitRun = (file: string, args: string[], cwd: string) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when `base` followed by `selector` (a U+FE00–U+FE0D code point) is a
|
|
3
|
+
* registered standardized variation sequence.
|
|
4
|
+
* @param {number} base
|
|
5
|
+
* @param {number} selector
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
*/
|
|
8
|
+
export function isStandardizedVariant(base: number, selector: number): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* GENERATED by scripts/gen-standardized-variants.mjs from UCD
|
|
11
|
+
* StandardizedVariants.txt (Unicode 17.0.0) — DO NOT EDIT.
|
|
12
|
+
*
|
|
13
|
+
* Registered standardized variation sequences: a base code point followed by a
|
|
14
|
+
* variation selector in U+FE00–U+FE0D. invisible.mjs preserves such a selector
|
|
15
|
+
* only when the immediately preceding base appears here; every other FE00–FE0D
|
|
16
|
+
* selector is stripped as a hidden-payload byte. Regenerate with
|
|
17
|
+
* `node scripts/gen-standardized-variants.mjs`; test/invisible-charset.test.mjs
|
|
18
|
+
* fails if this drifts from the pinned UCD slice.
|
|
19
|
+
*/
|
|
20
|
+
export const UNICODE_VERSION: "17.0.0";
|
|
21
|
+
/** @type {Array<[number, number]>} [base, selector], sorted by base then selector. */
|
|
22
|
+
export const STANDARDIZED_VARIANTS: Array<[number, number]>;
|