/** * GLU-07 — reading a capture as an MCP resource. * * A read has one job beyond handing over the text: make the text QUOTABLE. * A model that receives 8kB of markdown with no idea where it came from will * paraphrase it as its own; the same markdown with the url, the title, the * capture time and the version in front of it gets cited. So every read is * two parts — * * contents[0] text/markdown provenance front matter, then the page * contents[1] application/json the same provenance, structured, plus * chunk spans and citation anchors * * — and `textStartsAt` says where the front matter ends, so the character * offsets in the chunk list still line up with the document itself. * * `?chunk=` / `?anchor=` read ONE PASSAGE instead, straight through * `resolveCitation` (RCL-10): same offsets, same anchor, same W3C text * fragment link, and the same `stale: true` when the anchor was cut against a * version this page no longer is. This module deliberately owns none of that * logic — a second implementation of "which passage is this" is how a citation * and its quote drift apart. * * @module v1/cli/mcp-tools/capture-resource-read */ import { type CaptureStoreOptions } from './capture-resources.js'; export interface CaptureChunkRef { chunkIndex: number; startChar: number; endChar: number; /** `#-` — bound to the version it was measured against. */ anchor: string; uri: string; } export interface CaptureVersionRef { version: number; uri: string; indexedAt: string; contentHash: string; filePath: string; } export interface CaptureInfo { uri: string; scope: string; filePath: string; title?: string; url?: string; site?: string; capturedAt?: string; indexedAt: string; publishedAt?: string; byline?: string; httpStatus?: number; note?: string; source?: string; collection?: string; tags: string[]; version?: number; versions?: CaptureVersionRef[]; /** Hash of the text as it is NOW. */ contentHash: string; /** Hash recorded when the document was indexed. */ indexedContentHash: string; /** The file changed after it was indexed, or the anchor names another * version — quote it knowing that, or re-ingest. */ stale?: boolean; chunkCount: number; size: number; textChars: number; truncated?: boolean; /** Offset in `markdown` where the document itself starts. */ textStartsAt: number; chunks: CaptureChunkRef[]; chunksTruncated?: boolean; chunkIndex?: number; startChar?: number; endChar?: number; anchor?: string; passage?: string; quote?: string; /** `url` with a text fragment: the link that lands on the passage. */ citeUrl?: string; } export interface CaptureReadResult { uri: string; markdown: string; info: CaptureInfo; } export interface CaptureReadOptions extends CaptureStoreOptions { maxChars?: number; } /** * Read a capture: the whole page, one stored version, or one passage. * * Throws with a message meant for a human — an unknown page, a file that has * been deleted since it was indexed and a chunk that does not exist are all * things a caller must see, not silently get an empty document for. */ export declare function readCapture(uri: string, opts?: CaptureReadOptions): Promise; /** * MCP `resources/read` contents for any `capture://` uri: the scope's library * index as JSON, or a document as markdown plus its provenance. */ export declare function captureResourceContents(uri: string, opts?: CaptureReadOptions): Promise<{ contents: Array<{ uri: string; mimeType: string; text: string; }>; }>; /** The uri for a page a caller names by url or path, searching both stores — * captures live in the global brain, so a project-only lookup would deny * knowing a page the user saved minutes ago. */ export declare function resolveCaptureUri(target: string, opts?: CaptureStoreOptions): Promise; //# sourceMappingURL=capture-resource-read.d.ts.map