/** * Pure converters from multimodal content parts into native Anthropic * Messages-API content blocks (image / document). * * Two input shapes reach the native Anthropic surface: * * 1. NeuroLink/V3 multimodal parts — `{ type: "image", image }` produced by * the multimodal message builder (base64, data URL, https URL, or bytes). * * 2. AI-SDK LanguageModel prompt parts — `{ type: "file", mediaType, data }`. * This is how `ai@6` encodes BOTH images and PDFs in the prompt that the * provider's `doGenerate(options.prompt)` receives. Before this module the * converter only handled `type:"image"`, so on the tool-using generate * path (which always normalises images to `type:"file"`) the image part * was silently dropped — the model never saw the image ("no image * detected"). Gemini/Vertex are immune because they read `input.images` * directly in their own builders instead of going through this conversion. * * Media type is taken from the AI-SDK-provided `mediaType` when present, then * sniffed from magic bytes, and only then defaulted — a hardcoded `image/png` * default silently corrupts JPEG/GIF/WebP uploads (the Anthropic API rejects a * mislabeled base64 image with HTTP 400 and the image vanishes). */ import type Anthropic from "@anthropic-ai/sdk"; /** * Detect a supported image media type from a buffer's magic bytes. Returns * undefined when the bytes are not one of the four Anthropic-supported formats. */ export declare function sniffImageMediaType(bytes: Uint8Array): Anthropic.Messages.Base64ImageSource["media_type"] | undefined; /** * Convert an image part (data URL, bare base64, https URL, byte array, or * ArrayBuffer) into an Anthropic image block. Honors `mediaTypeHint` (the * AI-SDK `mediaType`), falls back to magic-byte sniffing, then to image/png. * Returns undefined for unusable inputs. */ export declare function toAnthropicImageBlock(data: unknown, mediaTypeHint?: string): Anthropic.Messages.ImageBlockParam | undefined; /** * Convert an AI-SDK `{ type: "file", mediaType, data }` content part into the * matching Anthropic content block: image/* → image block (media type honored, * not hardcoded), application/pdf → document block. Returns undefined for * unsupported media types (so the caller simply omits them rather than 400ing). * When `mediaType` is absent, image bytes are still salvaged via sniffing. */ export declare function fileToAnthropicBlock(part: { mediaType?: string; data?: unknown; }): Anthropic.Messages.ContentBlockParam | undefined;