/** * Claude Vision-driven OCR for expense receipts. PR1 stub: types and the * service contract. The actual API call wires up in PR9 with prompt * caching on the system text and Haiku 4.5 by default. */ export interface OcrLineItem { description: string; quantity?: number; unitPrice?: number; amount: number; } export interface OcrResult { vendor: string | null; amount: number | null; currency: string | null; /** ISO date YYYY-MM-DD. */ date: string | null; lineItems: OcrLineItem[]; /** 0..1; below 0.6 surfaces "verify mode" UI. */ confidence: number; } export interface OcrContext { fileId: string; fileUrl: string; /** Optional MIME hint; the service still detects from bytes. */ mimeType?: string; } /** Cost ceiling per call (Haiku 4.5 + cached system prompt). PR9 enforces. */ export const OCR_MAX_TOKENS = 1024; export const OCR_LOW_CONFIDENCE_THRESHOLD = 0.6; /** Stub — returns "pending" shape so callers can wire UI in PR1 without * Anthropic credentials. */ export async function ocrReceipt(_ctx: OcrContext): Promise { return { vendor: null, amount: null, currency: null, date: null, lineItems: [], confidence: 0, }; }