import type { SessionRecord } from '../../types/session/records.js'; /** * Evidence search over the session logs: which text a record contributes, * and what counts as a match. * * The text sources and the match rules are today's evidence search * (`store/evidence`): a tool result, an assistant message's text, and the * messages a compaction shed; literal substring or whole-token matching, * case-sensitive by default, no regex operators, no ranking. `evidence_fts` * (FTS5, trigram tokenizer) only narrows the candidates. Every candidate is * checked here, so the SQLite index and the scan index return the same hits. */ /** One searchable text part of one record. */ export interface EvidenceText { /** The part's position among the record's text parts. */ readonly part: number; /** `tool_completed`, `message_completed`, or `compaction_shed:`. */ readonly source: string; readonly text: string; readonly toolName?: string; readonly isError?: boolean; } /** The searchable text parts of one record; empty for a record that carries none. */ export declare function evidenceTexts(record: SessionRecord): EvidenceText[]; /** What to look for. Exactly today's evidence-search options. */ export interface EvidenceQuery { /** A literal string. An empty query (or none) matches every part. */ readonly query?: string; /** One to sixteen literal terms, matched as alternatives. Exclusive with `query`. */ readonly terms?: readonly string[]; /** `literal` (the default) matches substrings; `token` matches whole letter/number/underscore tokens. */ readonly matchMode?: 'literal' | 'token'; /** Defaults to true. */ readonly caseSensitive?: boolean; } /** Where the first match in a text is, and the excerpt around it (UTF-16 positions). */ export interface EvidenceMatch { readonly hit: number; readonly start: number; readonly end: number; } export declare class EvidenceQueryError extends Error { readonly name = "EvidenceQueryError"; } /** * The matcher for a query: the first hit in a text and the excerpt a result * shows for it (up to 120 characters before the hit, 512 in all, never * splitting a surrogate pair), or `undefined` when the text does not match. */ export declare function evidenceMatcher(query: EvidenceQuery): (text: string) => EvidenceMatch | undefined; /** * The FTS5 `MATCH` expression that narrows the candidates for a query, or * `undefined` when narrowing could drop a hit and every part must be checked. * * The trigram tokenizer folds ASCII case and matches a quoted string as a * substring, so for printable-ASCII terms of three or more characters its * result is a superset of the literal and token matches. */ export declare function ftsMatchExpression(query: EvidenceQuery): string | undefined; //# sourceMappingURL=fts.d.ts.map