{"version":3,"file":"exceptions.cjs","names":[],"sources":["../../../../src/batteries/llm/bedrock_converse/exceptions.ts"],"sourcesContent":["/**\n * Battery-scoped exception constructors for the native Bedrock Converse adapter.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/exceptions\n *\n * @remarks\n * Two Converse-specific classifications earn their own exceptions because both are ACTIONABLE and\n * both arrive as a generic validation error otherwise:\n * {@link E_CONVERSE_MISSING_TOOL_CONFIG} and {@link E_CONVERSE_ALTERNATION_VIOLATION}.\n */\n\nimport { createException } from '@nhtio/adk/factories'\n\n/** Resolved options failed validation. */\nexport const E_INVALID_BEDROCK_CONVERSE_OPTIONS = createException<[string]>(\n  'E_INVALID_BEDROCK_CONVERSE_OPTIONS',\n  'Invalid Bedrock Converse adapter options: %s',\n  'E_INVALID_BEDROCK_CONVERSE_OPTIONS',\n  529,\n  true\n)\n\n/** Context token weight exceeded the configured window. */\nexport const E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW = createException<[number, number, string]>(\n  'E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW',\n  'Bedrock Converse request token weight (%d) exceeds context window (%d) under encoding %s',\n  'E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW',\n  529,\n  true\n)\n\n/** The provider returned a non-2xx status. */\nexport const E_CONVERSE_REQUEST_FAILED = createException<[number, string]>(\n  'E_CONVERSE_REQUEST_FAILED',\n  'Bedrock Converse request failed with status %s: %s',\n  'E_CONVERSE_REQUEST_FAILED',\n  502,\n  false\n)\n\n/**\n * Converse rejected the request because `toolUse`/`toolResult` blocks appeared with no `toolConfig`.\n *\n * @remarks\n * Classified separately because the fix is specific and non-obvious: `toolConfig` must be present\n * whenever the TRANSCRIPT contains a tool block, even when no tools are offered for this turn and\n * the calls are pure history. The battery declares it automatically; this fires when a custom\n * `buildConverseRequest` omits it.\n */\nexport const E_CONVERSE_MISSING_TOOL_CONFIG = createException<[string]>(\n  'E_CONVERSE_MISSING_TOOL_CONFIG',\n  'Bedrock Converse requires toolConfig when toolUse/toolResult blocks are present: %s',\n  'E_CONVERSE_MISSING_TOOL_CONFIG',\n  400,\n  false\n)\n\n/**\n * Converse rejected the request for non-alternating roles.\n *\n * @remarks\n * Only reachable under `alternationPolicy: 'reject'`, which exists precisely so this error can be\n * OBSERVED rather than silently repaired — a repair applied before dispatch is invisible in the\n * response, which makes a client-side fix indistinguishable from vendor tolerance.\n */\nexport const E_CONVERSE_ALTERNATION_VIOLATION = createException<[string]>(\n  'E_CONVERSE_ALTERNATION_VIOLATION',\n  'Bedrock Converse rejected non-alternating roles: %s',\n  'E_CONVERSE_ALTERNATION_VIOLATION',\n  400,\n  false\n)\n\n/** A transport error or malformed frame killed the stream. */\nexport const E_CONVERSE_STREAM_ERROR = createException<[string]>(\n  'E_CONVERSE_STREAM_ERROR',\n  'Bedrock Converse stream error: %s',\n  'E_CONVERSE_STREAM_ERROR',\n  502,\n  false\n)\n\n/** A `toolUse` block carried an `input` value that is not a plain object. */\nexport const E_CONVERSE_INVALID_TOOL_INPUT = createException<[string]>(\n  'E_CONVERSE_INVALID_TOOL_INPUT',\n  'Bedrock Converse toolUse input is not a plain object: %s',\n  'E_CONVERSE_INVALID_TOOL_INPUT',\n  422,\n  false\n)\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,IAAa,qCAAqC,mBAAA,gBAChD,sCACA,gDACA,sCACA,KACA,IACF;;AAGA,IAAa,sCAAsC,mBAAA,gBACjD,uCACA,4FACA,uCACA,KACA,IACF;;AAGA,IAAa,4BAA4B,mBAAA,gBACvC,6BACA,sDACA,6BACA,KACA,KACF;;;;;;;;;;AAWA,IAAa,iCAAiC,mBAAA,gBAC5C,kCACA,uFACA,kCACA,KACA,KACF;;;;;;;;;AAUA,IAAa,mCAAmC,mBAAA,gBAC9C,oCACA,uDACA,oCACA,KACA,KACF;;AAGA,IAAa,0BAA0B,mBAAA,gBACrC,2BACA,qCACA,2BACA,KACA,KACF;;AAGA,IAAa,gCAAgC,mBAAA,gBAC3C,iCACA,4DACA,iCACA,KACA,KACF"}