/** * The negative cache's query identity and certifiability gates (FR-12, * Story 4.3) — shared verbatim by the capture flush (which records) and the * search ledger (which answers), and living at the capture layer because * layer direction forbids `capture/` importing `query/` while the reverse is * established precedent (`read-ledger` → `capture/digest`). */ /** * A pattern is certifiable only when it cannot be an invalid regex — plain * word-ish literals. This is not cosmetic: Claude Code < 2.1.208 answers an * INVALID regex with a zero-shaped "no matches" response (changelog: "Grep * silently returning 'No files found' for invalid regex patterns"), and the * reference platform runs 2.1.170 — so without this gate, a typo'd regex * records a negative for a search that never ran (SM-C3). Characters that can * never fail to parse: word characters plus punctuation no regex dialect * treats as structural — and `.`, which is always valid and only WIDENS * matching, so a zero result under it implies a zero for the literal reading * and the record (keyed on the pattern string) stays correct. `$`, `^`, and * every bracketing/quantifier character stay out: some of them can fail to * parse, and the allowlist must be verifiable at a glance rather than a * dialect argument. */ export declare const CERTIFIABLE_PATTERN: RegExp; /** Globs that cannot error: no braces (rg rejects unbalanced `{`), no `!`, no escapes. */ export declare const CERTIFIABLE_GLOB: RegExp; /** * ripgrep built-in type names this cache will certify against. Deliberately a * short allowlist of types that exist in every rg version this could meet: an * unknown `--type` makes rg error, which pre-2.1.208 is zero-shaped (same bug * class as the pattern gate). Unlisted type → the search is simply never * certified; a miss, never a wrong answer. */ export declare const CERTIFIABLE_TYPES: ReadonlySet; /** The matching-relevant parameters. Output shaping (mode, limits, context) is excluded by design. */ export interface SearchQuery { pattern: string; /** Search root, scope-relative or absolute; '' or undefined = the scope root itself. */ root?: string; glob?: string; type?: string; caseInsensitive?: boolean; multiline?: boolean; } /** * Stable, versioned serialization. The key hashes the RAW pattern — hashing * the redacted form would merge distinct secret-bearing searches — and the * hash is one-way, so the secret itself never persists. Root is normalized to * its stored (scope-relative, forward-slashed) form by the caller before this * runs; `canonicalSearchQuery` is deliberately dumb about paths. */ export declare function canonicalSearchQuery(q: SearchQuery): string; export declare function searchQueryKey(q: SearchQuery): string; /** * The stored form of a search root, shared verbatim by capture and query — one * function so the two sides cannot disagree on a key. `toScopeRelativeKey` * leaves an input equal to the scope root ABSOLUTE (its file callers never hit * that case); a search rooted at the scope root is the common default, and * without this fold the same semantic search would key two ways ('' when the * hook saw no path, the absolute root when a caller passed one). */ export declare function normalizeSearchRoot(root: string | undefined, scopeRoot: string | null): string; /** * Whether a search's parameters are in the class this cache will assert about. * Anything outside degrades to a miss at capture time — never a wrong answer. */ export declare function isCertifiableSearch(q: SearchQuery): boolean; //# sourceMappingURL=search-query.d.ts.map