/** @file Ad-hoc extraction types. */ import type { ScrapeResult } from "../../scrape/pipeline.ts"; import type { ExtractSourceResolution } from "../../tools/infra/extract-source.ts"; import type { CommonScrapeOptions } from "../../types.ts"; import type { ModelUsage } from "../adhoc/model.ts"; import type { GroundedField } from "../grounding.ts"; export interface AdHocExtractOptions extends CommonScrapeOptions { url?: string; content?: string; responseId?: string; prompt?: string; schema?: unknown; } export interface AdHocExtractResult { input: { url?: string; source: "provided" | "scrape" | "stored"; scrape?: ScrapeResult; responseId?: string; }; data: T; /** Source spans for verifiable extracted fields (post-hoc grounding). */ grounded?: GroundedField[]; raw?: unknown; usage?: ModelUsage; resolution?: ExtractSourceResolution; } export class MissingExtractInputError extends Error { constructor() { super("extractAdHoc requires url, content, or responseId"); this.name = "MissingExtractInputError"; } }