{"version":3,"file":"exceptions-7Kh_BCpv.mjs","names":[],"sources":["../src/batteries/media/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exceptions for the media pipeline battery.\n *\n * @remarks\n * Internal sibling of the `@nhtio/adk/batteries/media` entry — re-exported from the battery's\n * own barrel per the battery-scoped-exceptions rule. These are the typed errors the\n * implementor-facing API throws; the agent-facing forge catches them and renders readable\n * failure strings the model can act on.\n *\n * Error layering (see the design doc, frozen section 0):\n *\n * - Config errors (`E_INVALID_MEDIA_PIPELINE_CONFIG`) throw at pipeline construction or first\n *   engine-resolver resolution. Fatal — a programmer mistake, not a runtime condition.\n * - Syntactic pipe errors (`E_MEDIA_PIPE_SYNTAX`) carry line/col position plus a\n *   \"write it like:\" exemplar, because models repair from instructions, not carets.\n * - Semantic plan errors (`E_MEDIA_UNKNOWN_VERB`, `E_MEDIA_UNKNOWN_ARG`, `E_MEDIA_BAD_ARG`,\n *   `E_MEDIA_MISSING_ARG`, `E_MEDIA_UNSUPPORTED_OP`, `E_MEDIA_ENGINE_REQUIRED`) are produced by\n *   the plan validator walking the AST against the full verb table and the configured engines.\n * - Render errors (`E_MEDIA_NOT_PIPE_EXPRESSIBLE`) come from `toPipe()` on plans containing\n *   builder-only constructs.\n * - Execution errors (`E_MEDIA_STEP_FAILED`, `E_MEDIA_STEP_UNAVAILABLE`) surface step-runtime\n *   failures with the original error as `cause`.\n */\n\nimport { createException } from '@nhtio/adk/factories'\n\n/**\n * Thrown when `createMediaPipeline` receives an invalid configuration — a malformed engine,\n * a resolver that resolved to a value failing its contract guard, or an invalid option shape.\n */\nexport const E_INVALID_MEDIA_PIPELINE_CONFIG = createException<[string]>(\n  'E_INVALID_MEDIA_PIPELINE_CONFIG',\n  'Invalid media pipeline config: %s',\n  'E_INVALID_MEDIA_PIPELINE_CONFIG',\n  529,\n  true\n)\n\n/**\n * Thrown by `parsePipe` when the pipe expression fails to tokenize or parse. The message carries\n * line/col position and a corrective exemplar.\n */\nexport const E_MEDIA_PIPE_SYNTAX = createException<[string]>(\n  'E_MEDIA_PIPE_SYNTAX',\n  'pipe parse error: %s',\n  'E_MEDIA_PIPE_SYNTAX',\n  422,\n  false\n)\n\n/**\n * Thrown when a statement names a verb that does not exist in the verb table. The message\n * includes a did-you-mean suggestion (Levenshtein over folded verb forms, including suffix-word\n * matches) and the list of verbs available in this deployment.\n */\nexport const E_MEDIA_UNKNOWN_VERB = createException<[string]>(\n  'E_MEDIA_UNKNOWN_VERB',\n  '%s',\n  'E_MEDIA_UNKNOWN_VERB',\n  422,\n  false\n)\n\n/**\n * Thrown when a statement passes an arg a verb does not declare. The message includes a\n * did-you-mean suggestion and the verb's declared args.\n */\nexport const E_MEDIA_UNKNOWN_ARG = createException<[string]>(\n  'E_MEDIA_UNKNOWN_ARG',\n  '%s',\n  'E_MEDIA_UNKNOWN_ARG',\n  422,\n  false\n)\n\n/**\n * Thrown when an arg value fails its declared type/enum/constraint — including descending\n * ranges, invalid regex sources, malformed embedded JSON, and out-of-enum values.\n */\nexport const E_MEDIA_BAD_ARG = createException<[string]>(\n  'E_MEDIA_BAD_ARG',\n  '%s',\n  'E_MEDIA_BAD_ARG',\n  422,\n  false\n)\n\n/** Thrown when a verb's required arg is absent from the statement. */\nexport const E_MEDIA_MISSING_ARG = createException<[string]>(\n  'E_MEDIA_MISSING_ARG',\n  '%s',\n  'E_MEDIA_MISSING_ARG',\n  422,\n  false\n)\n\n/**\n * Thrown at plan validation when a verb cannot apply to the input's format family (e.g. a\n * `sheet.*` verb on a PDF), or a namespace verb is used on the wrong media kind.\n */\nexport const E_MEDIA_UNSUPPORTED_OP = createException<[string]>(\n  'E_MEDIA_UNSUPPORTED_OP',\n  '%s',\n  'E_MEDIA_UNSUPPORTED_OP',\n  422,\n  false\n)\n\n/**\n * Thrown at plan validation when a verb (or the specific input it is applied to) requires an\n * engine that is not configured on this pipeline. The message states which engine slot is\n * missing and — when the failure is input-specific — that the verb should not be retried on\n * this media in this deployment.\n */\nexport const E_MEDIA_ENGINE_REQUIRED = createException<[string]>(\n  'E_MEDIA_ENGINE_REQUIRED',\n  '%s',\n  'E_MEDIA_ENGINE_REQUIRED',\n  422,\n  false\n)\n\n/**\n * Thrown by `toPipe()` when the plan contains constructs the flat pipe grammar cannot express —\n * currently only nested-builder media refs. Quoted-JSON structured args DO render; use `toOps()`\n * for a total serialization.\n */\nexport const E_MEDIA_NOT_PIPE_EXPRESSIBLE = createException<[string]>(\n  'E_MEDIA_NOT_PIPE_EXPRESSIBLE',\n  'plan is not expressible as a pipe string: %s',\n  'E_MEDIA_NOT_PIPE_EXPRESSIBLE',\n  422,\n  false\n)\n\n/**\n * Thrown by the step runtime when a step implementation fails mid-execution (corrupt input,\n * engine error). Carries the underlying error as `cause`.\n */\nexport const E_MEDIA_STEP_FAILED = createException<[string, string]>(\n  'E_MEDIA_STEP_FAILED',\n  'step \"%s\" failed: %s',\n  'E_MEDIA_STEP_FAILED',\n  500,\n  false\n)\n\n/**\n * Thrown by the step runtime when a plan step has no registered implementation. Distinct from\n * `E_MEDIA_ENGINE_REQUIRED`: this indicates the battery itself does not (yet) implement the\n * verb, not that the consumer omitted an engine.\n */\nexport const E_MEDIA_STEP_UNAVAILABLE = createException<[string]>(\n  'E_MEDIA_STEP_UNAVAILABLE',\n  'no step implementation is registered for verb \"%s\"',\n  'E_MEDIA_STEP_UNAVAILABLE',\n  501,\n  false\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,kCAAkC,gBAC7C,mCACA,qCACA,mCACA,KACA,IACF;;;;;AAMA,IAAa,sBAAsB,gBACjC,uBACA,wBACA,uBACA,KACA,KACF;;;;;;AAOA,IAAa,uBAAuB,gBAClC,wBACA,MACA,wBACA,KACA,KACF;;;;;AAMA,IAAa,sBAAsB,gBACjC,uBACA,MACA,uBACA,KACA,KACF;;;;;AAMA,IAAa,kBAAkB,gBAC7B,mBACA,MACA,mBACA,KACA,KACF;;AAGA,IAAa,sBAAsB,gBACjC,uBACA,MACA,uBACA,KACA,KACF;;;;;AAMA,IAAa,yBAAyB,gBACpC,0BACA,MACA,0BACA,KACA,KACF;;;;;;;AAQA,IAAa,0BAA0B,gBACrC,2BACA,MACA,2BACA,KACA,KACF;;;;;;AAOA,IAAa,+BAA+B,gBAC1C,gCACA,gDACA,gCACA,KACA,KACF;;;;;AAMA,IAAa,sBAAsB,gBACjC,uBACA,0BACA,uBACA,KACA,KACF;;;;;;AAOA,IAAa,2BAA2B,gBACtC,4BACA,wDACA,4BACA,KACA,KACF"}