UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

39 lines • 2.3 kB
export declare const KEPT_TEXT_MAX = 8192; /** * The searches whose hits together hold every mounted record `text` may * match, or null when a provider's search cannot say. * * A mounted message is the provider's record as JSON, which holds more than * its search reads: key names, ids, counts, timestamps and flags, spelled * with JSON escapes. `text` is searched only when it is ASCII letters and * spaces, so no digit, quote or backslash can match outside the text the * search reads, and when none of its words is one of `keys` (the record's * key names and fixed values, lowercase) or a run of hex letters, which an * id can hold. Without whole-word matching a text inside a key is refused * too. A text starting with a letter an escape ends with may start inside * one, so the rest of it is searched as well (alone without whole-word * matching, where it is the wider search); such a letter alone is refused. */ export declare function recordQueries(text: string, keys: ReadonlySet<string>, wholeWord: boolean): string[] | null; /** * The words of `text` a provider's search may split otherwise than grep -w: a * link, an address, markup, an entity, a hyphenated or non-ASCII word. Words * split at ASCII whitespace only, so both hosts split alike and a non-ASCII * space stays inside its word. */ export declare function nonPlainWords(text: string): string[]; /** The normalized fields and words a provider's search does not read. */ export declare function unsearchedText(fields: Iterable<readonly [string, unknown]>, searched: ReadonlySet<string>): string; /** * Whether a record may hold one of the asked texts (each searched text's * lowercase words): each word of one is named for the record by the * provider's search, asked word by word, or held by the text the listing kept. */ export declare function mayHold(asked: readonly (readonly string[])[], named: ReadonlyMap<string, ReadonlySet<string>>, recordId: string, kept: string): boolean; /** * A listing entry's `extra` keeping its file's rendered text, lowercased, so * grep can check the file without reading it; empty past `KEPT_TEXT_MAX` * bytes, where the file is read as usual. */ export declare function keptText(rendered: Uint8Array): Record<string, string>; //# sourceMappingURL=record_search.d.ts.map