{"version":3,"file":"exceptions.cjs","names":[],"sources":["../../../../src/batteries/generation/transformers_js/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exception constructors for the transformers.js Generation (on-device text→image)\n * adapter.\n *\n * @module @nhtio/adk/batteries/generation/transformers_js/exceptions\n *\n * @remarks\n * Battery-scoped exception classes for the transformers.js (`@huggingface/transformers`) Generation\n * adapter, minted via `createException` from `@nhtio/adk/factories`. Categories mirror the\n * embeddings/caption transformers.js batteries' `E_INVALID_*`/`E_*_ENGINE_ERROR` pair, plus a third\n * `E_*_UNSUPPORTED_OPERATION` exception (mirroring\n * `@nhtio/adk/batteries/vector!E_VECTOR_STORE_UNSUPPORTED_OPERATION`'s `[operation, reason]` shape)\n * for `edit()`, which this engine cannot perform — Janus (DeepSeek `MultiModalityCausalLM`) only\n * exposes text-conditioned `generate_images`, no image-conditioned edit/inpaint entry point.\n */\n\nimport { createException } from '@nhtio/adk/factories'\n\n/**\n * Thrown when the resolved adapter options fail validation against\n * `transformersJsGenerationOptionsSchema` — e.g. a missing/empty `model` or an unknown option key.\n * Fatal: config bugs fail loud, not at generate time.\n */\nexport const E_INVALID_TRANSFORMERS_JS_GENERATION_OPTIONS = createException<[string]>(\n  'E_INVALID_TRANSFORMERS_JS_GENERATION_OPTIONS',\n  'Invalid transformers.js Generation adapter options: %s',\n  'E_INVALID_TRANSFORMERS_JS_GENERATION_OPTIONS',\n  529,\n  true\n)\n\n/**\n * Thrown when the transformers.js model/processor fail to load (e.g. the `@huggingface/transformers`\n * peer is not installed), the `generate_images` call throws, or the result is malformed/empty (no\n * images returned is an engine failure, not a valid empty result). Non-fatal. Printf arg: `[detail]`.\n */\nexport const E_TRANSFORMERS_JS_GENERATION_ENGINE_ERROR = createException<[string]>(\n  'E_TRANSFORMERS_JS_GENERATION_ENGINE_ERROR',\n  'transformers.js Generation engine error: %s',\n  'E_TRANSFORMERS_JS_GENERATION_ENGINE_ERROR',\n  502,\n  false\n)\n\n/**\n * Thrown when a caller invokes an operation this engine does not support — today, only `edit()`.\n * Janus (`MultiModalityCausalLM.generate_images`) is text-conditioned image generation only; there is\n * no image-conditioned edit/inpaint entry point in the installed `@huggingface/transformers` API\n * surface. Fatal: the caller must not retry an operation the engine structurally cannot perform.\n * Printf args: `[operation, reason]`.\n */\nexport const E_TRANSFORMERS_JS_GENERATION_UNSUPPORTED_OPERATION = createException<[string, string]>(\n  'E_TRANSFORMERS_JS_GENERATION_UNSUPPORTED_OPERATION',\n  'Operation \"%s\" is unsupported by the transformers.js Generation adapter: %s',\n  'E_TRANSFORMERS_JS_GENERATION_UNSUPPORTED_OPERATION',\n  501,\n  true\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,+CAA+C,mBAAA,gBAC1D,gDACA,0DACA,gDACA,KACA,IACF;;;;;;AAOA,IAAa,4CAA4C,mBAAA,gBACvD,6CACA,+CACA,6CACA,KACA,KACF;;;;;;;;AASA,IAAa,qDAAqD,mBAAA,gBAChE,sDACA,iFACA,sDACA,KACA,IACF"}