import { type GraphDoc, type GraphDocInput, type Lens } from "@coldtea/pr-lens-schema"; import type { JsonCompletion } from "./providers/index.js"; /** * The fields the repository already knows the answer to. They are written * over whatever the model emitted rather than merged with it: a commit sha, a * line count or the lens set that was asked for is a fact, and a fact the * model is free to restate is a fact that eventually disagrees with itself. */ export type KnownFields = { provenance: GraphDocInput["provenance"]; stats: { filesChanged: number; additions: number; deletions: number; }; lenses: readonly Lens[]; generatedAt: string; }; /** * Stamping the lens set is what makes `--lens` a request rather than a * suggestion: a document whose flows or views need a lens that was not asked * for now fails validation, and the correction round removes them. */ export declare const applyKnownFields: (body: Record, known: KnownFields) => unknown; export type JsonObjectRead = { ok: true; value: Record; } | { ok: false; reason: string; }; /** * Providers asked for JSON still fence it now and then, and some prepend a * line of prose. Both are recoverable, and a run that already spent the tokens * should not fail on packaging. * * A failure is returned rather than thrown, because truncated or malformed * JSON is a weak model's most common answer and deserves the same correction * round a structurally wrong document gets. */ export declare const readJsonObject: (text: string) => JsonObjectRead; export type Complete = (request: JsonCompletion) => Promise; export type Extraction = { document: GraphDoc; attempts: number; }; export declare const extractGraph: (options: { system: string; user: string; maxOutputTokens: number; temperature: number | undefined; known: KnownFields; onAttempt?: (attempt: number) => void; }, complete: Complete) => Promise; //# sourceMappingURL=extract.d.ts.map