import { Attachment, ResolvedAttachment } from "../contracts/attachment.type.mjs"; //#region ../ai/src/utils/resolve-attachment.d.ts /** * Normalize a user-supplied `Attachment` (or bare `AttachmentSource`) * into a `ResolvedAttachment` the agent can hand to file-reading code * without re-discriminating the input variant. * * Resolution rules: * - `{ base64, mediaType }` → `{ type: "base64", value, mediaType }`. * - `StorageFileShape` (`{ url?, absolutePath? }`) → `absolutePath` wins * over `url` when both are present (prefer the local file over an extra * remote hop). Absolute path becomes `{ type: "path" }`; url becomes * `{ type: "url" }`. * - String starting with `http://` / `https://` → `{ type: "url" }`. * - Any other string → `{ type: "path" }`. * - Tagged `{ type: "image" | "text", source }` → recurses into `source`. * * Throws `InvalidRequestError` on obviously invalid input (empty * string, storage object with neither url nor absolutePath, missing * source field). * * @example * resolveAttachment("https://cdn.example.com/doc.pdf"); * // → { type: "url", value: "https://cdn.example.com/doc.pdf" } * * @example * resolveAttachment({ type: "image", source: "/tmp/x.png" }); * // → { type: "path", value: "/tmp/x.png" } */ declare function resolveAttachment(attachment: Attachment): ResolvedAttachment; //#endregion export { resolveAttachment }; //# sourceMappingURL=resolve-attachment.d.mts.map