/** * The Retriever `search` grammar, checked before a query is sent. * * `search` is not free text. The engine parses it when the query starts * (pipeline-extensions `QueryFilterEvaluator.parse`, called from * `IndexQueryReader.createReaders`) and accepts only: * * clause := field '==' "value" | includes '(' field ',' "value" ')' * field := ident ( '.' ident )? ident := [letters digits _]+ * expr := clause, '&&' binds tighter than '||', parentheses group * * Strings have no escapes. Anything else throws inside the query Lambda before * the coordinator runs, so no `_DONE.json` is ever written and the caller used * to wait out its whole timer. Measured 2026-11-13 on the hosted demo: the * search `react hooks` took 202.5 s (180 s marker wait + 20 s quiet window) and * came back "0 events, NO_MARKER, poll again"; an outside agent retried that * shape for six minutes. The engine's own parser, run on the same string, * throws "Expected operator '==' but found 'ID:hooks' at token position 1". * * This module is a faithful port of that parser (validation only, no * evaluation) plus one convenience: plain words, which no valid expression can * contain, are rewritten to `includes(text, "...")` clauses and the caller is * told the original text and what ran instead. */ export declare const INVALID_SEARCH_PREFIX = "Invalid search expression:"; /** * Parse `input` with the engine's grammar. Returns the constants (field, * value) in order, or throws an Error whose message names the first problem. */ export declare function parseRetrieverSearch(input: string): Array<{ field: string; value: string; }>; export interface NormalizedSearch { /** The expression to send to the engine. */ search: string; /** Set when `search` differs from what the caller sent. */ rewrittenFrom?: string; } /** * Validate a caller's `search` against the engine grammar. * - a valid expression passes through unchanged; * - plain words (no grammar operators) become includes(text, "...") clauses, * with `rewrittenFrom` carrying the original so the agent can tell its user * what was searched; * - anything else throws `Invalid search expression: ...` before dispatch. */ export declare function normalizeRetrieverSearch(raw: string): NormalizedSearch;