// ONE SEARCH PIPELINE — the caps, named and passed. // // These were private constants of `mcp/src/search.ts`. They are not "the" // limits of searching an archive; they are the limits ONE CALLER chose, and // the viewer chose differently. Naming them is what lets both callers share // one scanner: the MCP server passes `MCP_POLICY`, a human scrolling a page // passes `VIEWER_POLICY`, and neither re-derives a number the other owns. // // The bench's structural read/byte counters are unchanged by construction // BECAUSE these are passed rather than re-derived — `MCP_POLICY` holds exactly // the four values the MCP scanner used before the move. export type SearchPolicy = { // A hard ceiling on shard pages fetched per query, so a rare term over a // large (or hub-wide) corpus cannot run away. Reaching it sets `truncated`. // Was `MAX_PAGES` (search.ts:259). maxPages: number; // A ceiling on matched videos collected before counting stops, so `total` // stays bounded and stable for a very common term. Reaching it also sets // `truncated` (the true total is higher than reported). Was // `HARD_VIDEO_CAP` (search.ts:263). hardVideoCap: number; // Cap on merged windowed excerpt lines emitted per video, so a video with // hundreds of matches cannot blow a batch's token budget. Was // `WINDOW_LINE_CAP` (search.ts:268). windowLineCap: number; // Snippet truncation width. Was the `max = 240` default of `truncate` // (search.ts:456). snippetChars: number; }; // What the MCP server passes — the four values verbatim. export const MCP_POLICY: SearchPolicy = { maxPages: 400, hardVideoCap: 2000, windowLineCap: 200, snippetChars: 240, }; // What the viewer passes: UNCAPPED. A human scrolling a page is not spending // an agent's token budget, and the browser pipeline has always had its own // per-run hit limit (`DEFAULT_MAX_HITS`, raised by "show more") rather than a // fixed page or video ceiling. Infinity is load-bearing here, not decorative: // `truncate(t, Infinity)` is the identity, and `pagesScanned >= Infinity` is // never true. export const VIEWER_POLICY: SearchPolicy = { maxPages: Number.POSITIVE_INFINITY, hardVideoCap: Number.POSITIVE_INFINITY, windowLineCap: Number.POSITIVE_INFINITY, snippetChars: Number.POSITIVE_INFINITY, };