/** * Shared load path for a single RIS document. * * `ris_dokument` and `ris_dokument_abschnitt` both need the full text of a * document, and they need the *same* text: the chunk tool hands out character * offsets into it, and the two resolution strategies below produce different * metadata headers, so a document loaded one way is several thousand characters * offset against the same document loaded the other way. Sharing the path is * what keeps a chunk pointing at what the reader was shown. * * Everything here — the validation, both SSRF checks, the direct/search * strategy and the German error prose — was lifted out of `tools/dokument.ts` * unchanged; the strings are part of that tool's response contract. */ import { type DocumentMetadata } from './formatting.js'; export interface LoadedDocument { /** Markdown (or JSON) rendering, before truncation. */ text: string; /** RIS source HTML — needed for the outline; callers may drop it. */ html: string; /** URL the HTML came from; feeds `source_url` and the document cache key. */ contentUrl: string; metadata: DocumentMetadata; } export type LoadDocumentResult = { success: true; document: LoadedDocument; } | { success: false; error: string; }; export interface LoadDocumentArgs { dokumentnummer?: string; url?: string; responseFormat: 'markdown' | 'json'; } /** * Resolve, fetch and format a document. * * Returns a German error string for every condition the user can fix. Throws on * cancellation and on unexpected upstream failures — callers keep the abort and * `formatErrorResponse` handling they already have. */ export declare function loadDocument(args: LoadDocumentArgs, signal: AbortSignal): Promise; //# sourceMappingURL=document-loader.d.ts.map