/** * Related-at-save (RCL-03) — "3 things in your brain relate to this". * * The extension calls this on EVERY capture, while the user watches. That * single fact sets every design decision here: * * - it never throws. An empty store, a missing embedder, a URL that was * never captured — all of them are an empty list, because a capture must * not fail because the sidebar had nothing to say; * - it is bounded. The vector pass races a timeout (default 2s) and the * cheap signals — same URL, same site, read straight off the metadata log — * are computed first, so a slow or absent embedder degrades to a fast * answer instead of no answer; * - the target itself is never in its own results, by path AND by canonical * URL, so a re-capture does not "relate" to the version it replaced. * * Three signals, combined: exact URL (the same page, captured before), * same site, and vector similarity over the chunks already embedded. * * @module v1/cli/knowledge/related */ export type RelatedReason = 'same-url' | 'same-site' | 'similar'; export interface RelatedDocument { filePath: string; scope: string; title: string; url?: string; site?: string; /** 0–1. Exact-URL matches lead; similarity and site agreement compound. */ score: number; reasons: RelatedReason[]; capturedAt?: string; /** The most similar passage, when similarity is one of the reasons. */ excerpt?: string; chunkIndex?: number; anchor?: string; } export interface RelatedOptions { rootDir?: string; scope?: string; limit?: number; /** Budget for the vector pass. The metadata signals ignore it: they are * synchronous file reads. */ timeoutMs?: number; minScore?: number; store?: 'project' | 'global' | 'all'; /** Text to compare against, when the caller already has it (a capture that * has not been ingested yet). */ text?: string; } /** * The documents most related to `target` (a URL, a docId, or an indexed path). * * Safe to call on every capture: bounded, and empty rather than thrown on any * failure. */ export declare function relatedDocuments(target: string, opts?: RelatedOptions): Promise; //# sourceMappingURL=related.d.ts.map