import type { AssetType, BrandBundle, ValidationResult } from "../types.js"; export interface ValidateInput { image: Buffer; format?: string; asset_type: AssetType; brand_bundle?: BrandBundle; intended_text?: string; expected_width?: number; expected_height?: number; transparency_required?: boolean; } /** * Tier-0 deterministic validator. No network, no VLM. Never mutates the buffer. * * Checks (from SYNTHESIS.md § Evaluation — Tier 0): * - Dimensions exact * - Alpha channel presence * - Checkerboard pattern detection (tile-luma heuristic on the RGB-checkerboard * artifact produced by non-RGBA diffusion models like Imagen/Gemini; requires * alternation between light/dark tiles to fire) * - Subject tight-bbox inside safe zone (for app_icon, favicon, icon_pack) * - File-size budget per asset type * - Palette ΔE2000 against brand palette (if provided) * - WCAG contrast of brand primary vs #FFFFFF and #0F172A (for favicon, app_icon, logo) * - OCR Levenshtein against intended_text (if provided and tesseract.js installed) */ export declare function tier0(input: ValidateInput): Promise; export declare function hexToRgb(hex: string): { r: number; g: number; b: number; }; export declare function rgbToLab({ r, g, b }: { r: number; g: number; b: number; }): { L: number; a: number; b: number; }; export declare function deltaE2000(l1: { L: number; a: number; b: number; }, l2: { L: number; a: number; b: number; }): number; export declare function levenshtein(a: string, b: string): number; /** * WCAG 2.1 relative luminance of an sRGB color. Formula: WCAG 2.1 § 1.4.11. * https://www.w3.org/TR/WCAG21/#dfn-relative-luminance */ export declare function relativeLuminance(hex: string): number; /** * WCAG 2.1 contrast ratio. Always returns >= 1.0. * Range 1 (no contrast) to 21 (black on white). */ export declare function contrastRatio(a: string, b: string): number; /** * Tier-2 VLM-as-judge. Optional, network-bound. Enabled when the caller sets * `PROMPT_TO_BUNDLE_VLM_URL`. The endpoint is expected to accept a POST with a * JSON body `{ image_base64, asset_type, intended_text?, brand_primary? }` and * return `{ pass: boolean, score?: number, notes?: string[] }`. * * We deliberately do NOT bundle a specific VLM provider — swap your own LLaVA, * Qwen-VL, or Claude Vision wrapper behind the URL. */ export declare function tier2Vlm(image: Buffer, asset_type: AssetType, extras: { intended_text?: string; brand_primary?: string; }): Promise<{ ran: boolean; pass?: boolean; score?: number; notes?: string[]; error?: string; }>; /** * Tier-1 alignment score via a VQAScore-shaped endpoint. * * What VQAScore does: given (image, prompt), ask a VLM "does this image * satisfy the prompt?" and score it 0..1. Research shows VQAScore * outperforms CLIPScore by 2-3× on compositional prompts * (docs/research/27-agent-evaluation-frameworks/27b-image-generation-eval-pipelines.md). * * We don't bundle a model — point PROMPT_TO_BUNDLE_VQA_URL at a service * that accepts `{ image_base64, prompt, asset_type }` and returns * `{ score: 0..1, notes?: string[] }`. Reference implementations: * - t2v-metrics (arXiv 2404.01291) — CLIP-FlanT5, can expose a minimal * HTTP wrapper. * - Qwen2.5-VL-3B-Instruct — cheap, hostable on Modal/Replicate with a * 5-line scoring prompt. * - Claude Vision + rubric — send the image + a 1-5 Likert prompt; map * Likert → 0..1 on the client. * * Graceful no-op when the URL isn't set; tier-0 and tier-2 continue to * run normally. Fails open on HTTP/timeout errors — we don't want a flaky * VQA service to tank the whole pipeline. */ export declare function tier1Alignment(image: Buffer, asset_type: AssetType, prompt: string): Promise<{ ran: boolean; score?: number; notes?: string[]; error?: string; }>; //# sourceMappingURL=validate.d.ts.map