/** * "Have I already saved this?" (RCL-02) — one URL in, one answer out. * * The browser extension asks this on every navigation. That is the only * thing that shapes this module: * * - it NEVER throws. An empty store, a store that has never been written, * a URL that is not a URL — all of them are `{saved: false}`, because a * page load must not be able to fail on a badge; * - it is a pure read. No embedder, no subprocess, no index write. The * answer comes off the metadata log, which is a file read; * - it answers the WHOLE question in one call. `doc list` can already say * that a URL is present, but not what note was written at save time — * and "you saved this, and here is why you said you were saving it" is * the entire value of the badge over a bookmark. * * Identity is `captureIdentityUrl`'s rule and nothing else: canonical URL * when the capturer resolved one, fragment stripped, nothing else rewritten. * Matching more loosely than the ingest side would make the badge claim * pages are saved that cannot actually be found again. * * @module v1/cli/knowledge/lookup */ /** What the badge and the "already saved" panel render. */ export interface UrlLookup { saved: boolean; /** The identity URL the lookup was performed against. */ url: string; title?: string; site?: string; /** When the page was captured (not when it was indexed). */ capturedAt?: string; /** RCL-06: 1 for a first save, +1 per stored revision. 0 when unsaved. */ versions: number; /** The note written at save time (CLIP-07) — the reason it was kept. */ note?: string; tags: string[]; collection?: string; source?: string; /** The indexed file (`…/readable.md`). */ filePath?: string; /** The capture envelope directory holding it — what "open the archived * copy" opens. Absent when the document is an ordinary file on disk. */ envelope?: string; scope?: string; contentHash?: string; /** RCL-04: how many highlight notes were saved on this page. */ highlights?: number; } export interface LookupOptions { rootDir?: string; scope?: string; /** Skip the `highlights.json` read. The badge path does not need it. */ withHighlights?: boolean; } /** * identityUrl mirrors `captureIdentityUrl` for a raw URL rather than a * provenance record: drop the fragment, trim, rewrite nothing else. * * Duplicated deliberately rather than reshaping the URL into a fake * `CaptureProvenance` to borrow that function — the two callers mean * different things ("the URL a tab is on" vs. "what this capture is of") * and only happen to agree on the rule. */ export declare function identityUrl(raw: string | undefined): string; /** The envelope directory for an indexed file, or undefined when the file * is not inside one. */ export declare function envelopeFor(filePath: string | undefined): string | undefined; /** * lookupUrl answers whether this URL is in the store, and what is known * about it. `rootDir` is the store to look in; pass the global brain's root * to ask the personal store. */ export declare function lookupUrl(rawUrl: string, opts?: LookupOptions): UrlLookup; /** * lookupUrls answers a batch in one pass over the metadata, for a caller * with several tabs to ask about. Same rules, same guarantees. */ export declare function lookupUrls(urls: readonly string[], opts?: LookupOptions): UrlLookup[]; //# sourceMappingURL=lookup.d.ts.map