/** MedlineSource — the ONLY medical file allowed network imports (ADR-6 exception). S7 adds the real call. */ import type { EgressGuard } from "../egress.js"; /** * A single retrieved passage from MedlinePlus. * title + url form the citation; text is the passage body for synthesis grounding. */ export interface Passage { title: string; url: string; text: string; source: "medlineplus"; } /** * Discriminated union for retrieval outcomes. * disabled — the egress axis is off; no attempt was made. * abstain — the axis is on but the source could not produce passages (error or empty). * grounded — passages retrieved from MedlinePlus (Sprint 7). */ export type RetrievalOutcome = { kind: "disabled"; } | { kind: "abstain"; reason: string; } | { kind: "grounded"; passages: Passage[]; }; /** * Injectable transport type — a minimal fetch-like function. * Tests pass a fake returning recorded fixture data; production defaults to the global fetch. * Using a plain duck-typed return rather than the global Response to stay testable * without the global fetch in test files (global fetch is banned in other medical files). * No AbortSignal in the signature — tests inject synchronous fakes that don't need it. */ export type FetchLike = (url: string) => Promise<{ ok: boolean; status: number; json(): Promise; }>; /** * MedlinePlus retrieval source. * * This is the ONE file the ESLint no-restricted-imports exception permits to hold * network imports (src/medical/retrieval/medline-source.ts — ADR-6). * * assertAllowed("literature-retrieval") is called BEFORE any fetch attempt — this * is the runtime defense-in-depth that backs the static ESLint boundary. * * The injectable fetchImpl transport means tests NEVER reach the live MedlinePlus * endpoint — they pass a fake FetchLike returning committed fixture data. * * bober: single source (MedlinePlus/NIH, no-auth); add PubMed in a future sprint * if multi-source support is needed — keep each source in its own file. */ export declare class MedlineSource { private readonly egress; private readonly fetchImpl; constructor(egress: EgressGuard, fetchImpl?: FetchLike); /** * Fetch passages from MedlinePlus for the given query. * * Order: * 1. assertAllowed — throws (and is caught below) if the axis is off. * 2. fetchImpl(url) — injectable transport; default = global fetch. * 3. Parse response into Passage[]. * 4. Return grounded | abstain{no-passages} | abstain{source-error}. * * NEVER throws out of this method — all errors map to abstain{source-error}. */ fetchPassages(query: string): Promise; } //# sourceMappingURL=medline-source.d.ts.map