@nhtio/adk 0.1.0-master-2a4e1bd2 → 0.1.0-master-cd595e6f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/artifact_methods-CJDQ5Lv-.mjs +1 -0
  3. package/artifact_methods-D6k_82r3.js +1 -0
  4. package/batteries/artifacts/ecmascript.cjs +1 -1
  5. package/batteries/artifacts/ecmascript.mjs +1 -1
  6. package/batteries/artifacts/toon.cjs +1 -1
  7. package/batteries/artifacts/toon.mjs +1 -1
  8. package/batteries/artifacts/xml.cjs +1 -1
  9. package/batteries/artifacts/xml.mjs +1 -1
  10. package/batteries/artifacts/yaml.cjs +1 -1
  11. package/batteries/artifacts/yaml.mjs +1 -1
  12. package/batteries/artifacts.cjs +4 -4
  13. package/batteries/artifacts.mjs +4 -4
  14. package/batteries/dev-tools/forge.cjs +3 -3
  15. package/batteries/dev-tools/forge.mjs +3 -3
  16. package/batteries/dev-tools.cjs +2 -2
  17. package/batteries/dev-tools.mjs +2 -2
  18. package/batteries/encoding.cjs +7 -7
  19. package/batteries/encoding.mjs +7 -7
  20. package/batteries/generation/gemini/adapter.cjs +1 -1
  21. package/batteries/generation/gemini/adapter.mjs +1 -1
  22. package/batteries/generation/local_diffusion/adapter.cjs +1 -1
  23. package/batteries/generation/local_diffusion/adapter.mjs +1 -1
  24. package/batteries/generation/openai/adapter.cjs +1 -1
  25. package/batteries/generation/openai/adapter.mjs +1 -1
  26. package/batteries/isolation/browser.d.ts +1 -1
  27. package/batteries/isolation/child_process/transport.d.ts +2 -2
  28. package/batteries/isolation/child_process.cjs +4 -4
  29. package/batteries/isolation/child_process.cjs.map +1 -1
  30. package/batteries/isolation/child_process.mjs +4 -4
  31. package/batteries/isolation/child_process.mjs.map +1 -1
  32. package/batteries/isolation/codec.d.ts +2 -2
  33. package/batteries/isolation/crash_policy.d.ts +1 -1
  34. package/batteries/isolation/isolate_function.d.ts +2 -2
  35. package/batteries/isolation/protocol.d.ts +4 -4
  36. package/batteries/isolation/serve.d.ts +2 -2
  37. package/batteries/isolation/types.d.ts +4 -4
  38. package/batteries/isolation.cjs +1 -1
  39. package/batteries/isolation.mjs +1 -1
  40. package/batteries/llm/anthropic_messages/adapter.cjs +6 -6
  41. package/batteries/llm/anthropic_messages/adapter.cjs.map +1 -1
  42. package/batteries/llm/anthropic_messages/adapter.mjs +6 -6
  43. package/batteries/llm/anthropic_messages/adapter.mjs.map +1 -1
  44. package/batteries/llm/anthropic_messages/count_tokens.cjs +1 -1
  45. package/batteries/llm/anthropic_messages/count_tokens.mjs +1 -1
  46. package/batteries/llm/anthropic_messages/helpers.cjs +3 -3
  47. package/batteries/llm/anthropic_messages/helpers.mjs +3 -3
  48. package/batteries/llm/anthropic_messages/types.d.ts +2 -2
  49. package/batteries/llm/anthropic_messages/validation.cjs +3 -3
  50. package/batteries/llm/anthropic_messages/validation.cjs.map +1 -1
  51. package/batteries/llm/anthropic_messages/validation.mjs +3 -3
  52. package/batteries/llm/anthropic_messages/validation.mjs.map +1 -1
  53. package/batteries/llm/anthropic_messages.cjs +2 -2
  54. package/batteries/llm/anthropic_messages.mjs +2 -2
  55. package/batteries/llm/bedrock_converse/adapter.cjs +29 -7
  56. package/batteries/llm/bedrock_converse/adapter.cjs.map +1 -1
  57. package/batteries/llm/bedrock_converse/adapter.mjs +30 -8
  58. package/batteries/llm/bedrock_converse/adapter.mjs.map +1 -1
  59. package/batteries/llm/bedrock_converse/exceptions.cjs +3 -0
  60. package/batteries/llm/bedrock_converse/exceptions.cjs.map +1 -1
  61. package/batteries/llm/bedrock_converse/exceptions.d.ts +6 -0
  62. package/batteries/llm/bedrock_converse/exceptions.mjs +3 -1
  63. package/batteries/llm/bedrock_converse/exceptions.mjs.map +1 -1
  64. package/batteries/llm/bedrock_converse/helpers.cjs +1 -1
  65. package/batteries/llm/bedrock_converse/helpers.mjs +1 -1
  66. package/batteries/llm/bedrock_converse/types.d.ts +6 -2
  67. package/batteries/llm/bedrock_converse/validation.cjs +7 -1
  68. package/batteries/llm/bedrock_converse/validation.cjs.map +1 -1
  69. package/batteries/llm/bedrock_converse/validation.mjs +7 -1
  70. package/batteries/llm/bedrock_converse/validation.mjs.map +1 -1
  71. package/batteries/llm/bedrock_converse.cjs +2 -2
  72. package/batteries/llm/bedrock_converse.mjs +2 -2
  73. package/batteries/llm/claude_code_cli/adapter.cjs +6 -6
  74. package/batteries/llm/claude_code_cli/adapter.cjs.map +1 -1
  75. package/batteries/llm/claude_code_cli/adapter.mjs +6 -6
  76. package/batteries/llm/claude_code_cli/adapter.mjs.map +1 -1
  77. package/batteries/llm/claude_code_cli/helpers.cjs +3 -3
  78. package/batteries/llm/claude_code_cli/helpers.mjs +3 -3
  79. package/batteries/llm/claude_code_cli/types.d.ts +3 -2
  80. package/batteries/llm/claude_code_cli/validation.cjs +3 -3
  81. package/batteries/llm/claude_code_cli/validation.cjs.map +1 -1
  82. package/batteries/llm/claude_code_cli/validation.mjs +3 -3
  83. package/batteries/llm/claude_code_cli/validation.mjs.map +1 -1
  84. package/batteries/llm/claude_code_cli.cjs +1 -1
  85. package/batteries/llm/claude_code_cli.mjs +1 -1
  86. package/batteries/llm/gemini_generate_content/adapter.cjs +29 -7
  87. package/batteries/llm/gemini_generate_content/adapter.cjs.map +1 -1
  88. package/batteries/llm/gemini_generate_content/adapter.mjs +30 -8
  89. package/batteries/llm/gemini_generate_content/adapter.mjs.map +1 -1
  90. package/batteries/llm/gemini_generate_content/exceptions.cjs +3 -0
  91. package/batteries/llm/gemini_generate_content/exceptions.cjs.map +1 -1
  92. package/batteries/llm/gemini_generate_content/exceptions.d.ts +6 -0
  93. package/batteries/llm/gemini_generate_content/exceptions.mjs +3 -1
  94. package/batteries/llm/gemini_generate_content/exceptions.mjs.map +1 -1
  95. package/batteries/llm/gemini_generate_content/helpers.cjs +1 -1
  96. package/batteries/llm/gemini_generate_content/helpers.mjs +1 -1
  97. package/batteries/llm/gemini_generate_content/types.d.ts +7 -3
  98. package/batteries/llm/gemini_generate_content/validation.cjs +11 -2
  99. package/batteries/llm/gemini_generate_content/validation.cjs.map +1 -1
  100. package/batteries/llm/gemini_generate_content/validation.mjs +11 -2
  101. package/batteries/llm/gemini_generate_content/validation.mjs.map +1 -1
  102. package/batteries/llm/gemini_generate_content.cjs +1 -1
  103. package/batteries/llm/gemini_generate_content.mjs +1 -1
  104. package/batteries/llm/litert_lm/adapter.cjs +6 -6
  105. package/batteries/llm/litert_lm/adapter.cjs.map +1 -1
  106. package/batteries/llm/litert_lm/adapter.mjs +6 -6
  107. package/batteries/llm/litert_lm/adapter.mjs.map +1 -1
  108. package/batteries/llm/litert_lm/helpers.cjs +3 -3
  109. package/batteries/llm/litert_lm/helpers.mjs +3 -3
  110. package/batteries/llm/litert_lm/types.d.ts +2 -2
  111. package/batteries/llm/litert_lm/validation.cjs +3 -3
  112. package/batteries/llm/litert_lm/validation.cjs.map +1 -1
  113. package/batteries/llm/litert_lm/validation.mjs +3 -3
  114. package/batteries/llm/litert_lm/validation.mjs.map +1 -1
  115. package/batteries/llm/litert_lm.cjs +1 -1
  116. package/batteries/llm/litert_lm.mjs +1 -1
  117. package/batteries/llm/ollama/adapter.cjs +6 -6
  118. package/batteries/llm/ollama/adapter.cjs.map +1 -1
  119. package/batteries/llm/ollama/adapter.mjs +6 -6
  120. package/batteries/llm/ollama/adapter.mjs.map +1 -1
  121. package/batteries/llm/ollama/helpers.cjs +4 -4
  122. package/batteries/llm/ollama/helpers.mjs +4 -4
  123. package/batteries/llm/ollama/types.d.ts +2 -2
  124. package/batteries/llm/ollama/validation.cjs +3 -3
  125. package/batteries/llm/ollama/validation.cjs.map +1 -1
  126. package/batteries/llm/ollama/validation.mjs +3 -3
  127. package/batteries/llm/ollama/validation.mjs.map +1 -1
  128. package/batteries/llm/ollama.cjs +2 -2
  129. package/batteries/llm/ollama.mjs +2 -2
  130. package/batteries/llm/openai_chat_completions/adapter.cjs +6 -6
  131. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -1
  132. package/batteries/llm/openai_chat_completions/adapter.mjs +6 -6
  133. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -1
  134. package/batteries/llm/openai_chat_completions/helpers.cjs +4 -4
  135. package/batteries/llm/openai_chat_completions/helpers.mjs +4 -4
  136. package/batteries/llm/openai_chat_completions/types.d.ts +2 -2
  137. package/batteries/llm/openai_chat_completions/validation.cjs +3 -3
  138. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -1
  139. package/batteries/llm/openai_chat_completions/validation.mjs +3 -3
  140. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -1
  141. package/batteries/llm/openai_chat_completions.cjs +2 -2
  142. package/batteries/llm/openai_chat_completions.mjs +2 -2
  143. package/batteries/llm/openai_responses/adapter.cjs +6 -6
  144. package/batteries/llm/openai_responses/adapter.cjs.map +1 -1
  145. package/batteries/llm/openai_responses/adapter.mjs +6 -6
  146. package/batteries/llm/openai_responses/adapter.mjs.map +1 -1
  147. package/batteries/llm/openai_responses/helpers.cjs +3 -3
  148. package/batteries/llm/openai_responses/helpers.mjs +3 -3
  149. package/batteries/llm/openai_responses/types.d.ts +2 -2
  150. package/batteries/llm/openai_responses/validation.cjs +3 -3
  151. package/batteries/llm/openai_responses/validation.cjs.map +1 -1
  152. package/batteries/llm/openai_responses/validation.mjs +3 -3
  153. package/batteries/llm/openai_responses/validation.mjs.map +1 -1
  154. package/batteries/llm/openai_responses.cjs +2 -2
  155. package/batteries/llm/openai_responses.mjs +2 -2
  156. package/batteries/llm/transformers_js/adapter.cjs +6 -6
  157. package/batteries/llm/transformers_js/adapter.cjs.map +1 -1
  158. package/batteries/llm/transformers_js/adapter.mjs +6 -6
  159. package/batteries/llm/transformers_js/adapter.mjs.map +1 -1
  160. package/batteries/llm/transformers_js/helpers.cjs +3 -3
  161. package/batteries/llm/transformers_js/helpers.mjs +3 -3
  162. package/batteries/llm/transformers_js/types.d.ts +2 -2
  163. package/batteries/llm/transformers_js/validation.cjs +3 -3
  164. package/batteries/llm/transformers_js/validation.cjs.map +1 -1
  165. package/batteries/llm/transformers_js/validation.mjs +3 -3
  166. package/batteries/llm/transformers_js/validation.mjs.map +1 -1
  167. package/batteries/llm/transformers_js.cjs +1 -1
  168. package/batteries/llm/transformers_js.mjs +1 -1
  169. package/batteries/llm/webllm_chat_completions/adapter.cjs +6 -6
  170. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -1
  171. package/batteries/llm/webllm_chat_completions/adapter.mjs +6 -6
  172. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -1
  173. package/batteries/llm/webllm_chat_completions/helpers.cjs +1 -1
  174. package/batteries/llm/webllm_chat_completions/helpers.mjs +1 -1
  175. package/batteries/llm/webllm_chat_completions/validation.cjs +3 -3
  176. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -1
  177. package/batteries/llm/webllm_chat_completions/validation.mjs +3 -3
  178. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -1
  179. package/batteries/llm/webllm_chat_completions.cjs +2 -2
  180. package/batteries/llm/webllm_chat_completions.mjs +2 -2
  181. package/batteries/llm.cjs +2 -2
  182. package/batteries/llm.mjs +2 -2
  183. package/batteries/media/builder.d.ts +3 -0
  184. package/batteries/media/contracts.cjs.map +1 -1
  185. package/batteries/media/contracts.d.ts +40 -1
  186. package/batteries/media/contracts.mjs.map +1 -1
  187. package/batteries/media/engines/sharp.cjs +36 -2
  188. package/batteries/media/engines/sharp.cjs.map +1 -1
  189. package/batteries/media/engines/sharp.mjs +36 -2
  190. package/batteries/media/engines/sharp.mjs.map +1 -1
  191. package/batteries/media/forge.cjs +5 -5
  192. package/batteries/media/forge.mjs +5 -5
  193. package/batteries/media/index.d.ts +1 -1
  194. package/batteries/media/lint.cjs +3 -2
  195. package/batteries/media/lint.cjs.map +1 -1
  196. package/batteries/media/lint.mjs +3 -2
  197. package/batteries/media/lint.mjs.map +1 -1
  198. package/batteries/media.cjs +66 -2
  199. package/batteries/media.cjs.map +1 -1
  200. package/batteries/media.mjs +66 -2
  201. package/batteries/media.mjs.map +1 -1
  202. package/batteries/orchestration/conformance.cjs +123 -74
  203. package/batteries/orchestration/conformance.cjs.map +1 -1
  204. package/batteries/orchestration/conformance.d.ts +10 -8
  205. package/batteries/orchestration/conformance.mjs +54 -5
  206. package/batteries/orchestration/conformance.mjs.map +1 -1
  207. package/batteries/orchestration/dispatch_reasoner.cjs +4 -4
  208. package/batteries/orchestration/dispatch_reasoner.mjs +4 -4
  209. package/batteries/orchestration/executor.cjs +2 -2
  210. package/batteries/orchestration/executor.mjs +2 -2
  211. package/batteries/orchestration/forge.cjs +4 -4
  212. package/batteries/orchestration/forge.mjs +4 -4
  213. package/batteries/orchestration/validation.cjs +2 -2
  214. package/batteries/orchestration/validation.mjs +2 -2
  215. package/batteries/orchestration.cjs +4 -4
  216. package/batteries/orchestration.mjs +4 -4
  217. package/batteries/sandbox/contracts/policy_enforcer.d.ts +13 -1
  218. package/batteries/sandbox/js/compartment.d.ts +7 -2
  219. package/batteries/sandbox/js/exceptions.d.ts +4 -0
  220. package/batteries/sandbox/js/runner.d.ts +1 -1
  221. package/batteries/sandbox/js/service.d.ts +1 -1
  222. package/batteries/sandbox/js/ses_contracts.d.ts +4 -3
  223. package/batteries/sandbox/js.cjs +17 -8
  224. package/batteries/sandbox/js.cjs.map +1 -1
  225. package/batteries/sandbox/js.mjs +17 -9
  226. package/batteries/sandbox/js.mjs.map +1 -1
  227. package/batteries/sandbox/manager.d.ts +4 -3
  228. package/batteries/sandbox/node/srt_enforcer.d.ts +1 -1
  229. package/batteries/sandbox/node.cjs +36 -12
  230. package/batteries/sandbox/node.cjs.map +1 -1
  231. package/batteries/sandbox/node.mjs +36 -12
  232. package/batteries/sandbox/node.mjs.map +1 -1
  233. package/batteries/sandbox/tools.cjs +1 -1
  234. package/batteries/sandbox/tools.mjs +1 -1
  235. package/batteries/sandbox/types.d.ts +10 -1
  236. package/batteries/sandbox.cjs +27 -9
  237. package/batteries/sandbox.cjs.map +1 -1
  238. package/batteries/sandbox.mjs +28 -11
  239. package/batteries/sandbox.mjs.map +1 -1
  240. package/batteries/skills.cjs +9 -9
  241. package/batteries/skills.mjs +9 -9
  242. package/batteries/tools/_shared.cjs +1 -1
  243. package/batteries/tools/_shared.mjs +1 -1
  244. package/batteries/tools/color.cjs +2 -2
  245. package/batteries/tools/color.mjs +2 -2
  246. package/batteries/tools/comparison.cjs +2 -2
  247. package/batteries/tools/comparison.mjs +2 -2
  248. package/batteries/tools/data_structure.cjs +2 -2
  249. package/batteries/tools/data_structure.mjs +2 -2
  250. package/batteries/tools/datetime_extended.cjs +3 -3
  251. package/batteries/tools/datetime_extended.mjs +3 -3
  252. package/batteries/tools/datetime_math.cjs +3 -3
  253. package/batteries/tools/datetime_math.mjs +3 -3
  254. package/batteries/tools/encoding.cjs +2 -2
  255. package/batteries/tools/encoding.mjs +2 -2
  256. package/batteries/tools/formatting.cjs +2 -2
  257. package/batteries/tools/formatting.mjs +2 -2
  258. package/batteries/tools/geo_basics.cjs +2 -2
  259. package/batteries/tools/geo_basics.mjs +2 -2
  260. package/batteries/tools/math.cjs +2 -2
  261. package/batteries/tools/math.mjs +2 -2
  262. package/batteries/tools/memory.cjs +5 -5
  263. package/batteries/tools/memory.mjs +5 -5
  264. package/batteries/tools/parsing.cjs +3 -3
  265. package/batteries/tools/parsing.mjs +3 -3
  266. package/batteries/tools/retrievables.cjs +5 -5
  267. package/batteries/tools/retrievables.mjs +5 -5
  268. package/batteries/tools/scrapper.cjs +1 -1
  269. package/batteries/tools/scrapper.mjs +1 -1
  270. package/batteries/tools/searxng.cjs +1 -1
  271. package/batteries/tools/searxng.mjs +1 -1
  272. package/batteries/tools/standing_instructions.cjs +3 -3
  273. package/batteries/tools/standing_instructions.mjs +3 -3
  274. package/batteries/tools/statistics.cjs +3 -3
  275. package/batteries/tools/statistics.mjs +3 -3
  276. package/batteries/tools/string_processing.cjs +2 -2
  277. package/batteries/tools/string_processing.mjs +2 -2
  278. package/batteries/tools/structured_data.cjs +2 -2
  279. package/batteries/tools/structured_data.mjs +2 -2
  280. package/batteries/tools/text_analysis.cjs +3 -3
  281. package/batteries/tools/text_analysis.mjs +3 -3
  282. package/batteries/tools/text_comparison.cjs +2 -2
  283. package/batteries/tools/text_comparison.mjs +2 -2
  284. package/batteries/tools/time.cjs +3 -3
  285. package/batteries/tools/time.mjs +3 -3
  286. package/batteries/tools/unit_conversion.cjs +2 -2
  287. package/batteries/tools/unit_conversion.mjs +2 -2
  288. package/batteries/tools.cjs +2 -2
  289. package/batteries/tools.mjs +2 -2
  290. package/batteries/validation.cjs +5 -5
  291. package/batteries/validation.mjs +5 -5
  292. package/batteries/vector/conformance/index.d.ts +11 -16
  293. package/batteries/vector/conformance.cjs +107 -36
  294. package/batteries/vector/conformance.cjs.map +1 -1
  295. package/batteries/vector/conformance.mjs +84 -13
  296. package/batteries/vector/conformance.mjs.map +1 -1
  297. package/batteries/vector/retrievable.cjs +1 -1
  298. package/batteries/vector/retrievable.mjs +1 -1
  299. package/batteries.cjs +5 -5
  300. package/batteries.mjs +5 -5
  301. package/{chat_common-DbbIESdo.mjs → chat_common-CmKV5Dz4.mjs} +2 -2
  302. package/{chat_common-DbbIESdo.mjs.map → chat_common-CmKV5Dz4.mjs.map} +1 -1
  303. package/{chat_common-B3O3zz-i.js → chat_common-Dpan9moo.js} +2 -2
  304. package/{chat_common-B3O3zz-i.js.map → chat_common-Dpan9moo.js.map} +1 -1
  305. package/{common-v9Jo9M5k.mjs → common-BpdHIpQE.mjs} +7 -7
  306. package/{common-v9Jo9M5k.mjs.map → common-BpdHIpQE.mjs.map} +1 -1
  307. package/{common-BV3HGeLj.js → common-H44Ik9ou.js} +7 -7
  308. package/{common-BV3HGeLj.js.map → common-H44Ik9ou.js.map} +1 -1
  309. package/common.cjs +7 -7
  310. package/common.mjs +7 -7
  311. package/{dispatch_runner-CbNyqSMy.mjs → dispatch_runner-BZDXUe0G.mjs} +5 -5
  312. package/{dispatch_runner-CbNyqSMy.mjs.map → dispatch_runner-BZDXUe0G.mjs.map} +1 -1
  313. package/{dispatch_runner-Bl3Xwebu.js → dispatch_runner-CKhm-scw.js} +5 -5
  314. package/{dispatch_runner-Bl3Xwebu.js.map → dispatch_runner-CKhm-scw.js.map} +1 -1
  315. package/dispatch_runner.cjs +1 -1
  316. package/dispatch_runner.mjs +1 -1
  317. package/{ecmascript-BSnvyY8T.js → ecmascript-CCtgamDh.js} +3 -3
  318. package/{ecmascript-BSnvyY8T.js.map → ecmascript-CCtgamDh.js.map} +1 -1
  319. package/{ecmascript-CZ7_YKfZ.mjs → ecmascript-DcmUQ9Jx.mjs} +3 -3
  320. package/{ecmascript-CZ7_YKfZ.mjs.map → ecmascript-DcmUQ9Jx.mjs.map} +1 -1
  321. package/eslint.cjs +1 -1
  322. package/eslint.mjs +1 -1
  323. package/exceptions.cjs +1 -1
  324. package/exceptions.mjs +1 -1
  325. package/forge.cjs +2 -2
  326. package/forge.mjs +2 -2
  327. package/guards.cjs +7 -7
  328. package/guards.mjs +7 -7
  329. package/{helpers-CDmLDBq5.mjs → helpers-BH7HTtkD.mjs} +3 -3
  330. package/{helpers-CDmLDBq5.mjs.map → helpers-BH7HTtkD.mjs.map} +1 -1
  331. package/{helpers-Tvvwpx1M.js → helpers-CEjjkXso.js} +3 -3
  332. package/{helpers-Tvvwpx1M.js.map → helpers-CEjjkXso.js.map} +1 -1
  333. package/index.cjs +10 -10
  334. package/index.mjs +10 -10
  335. package/{isolation-BQCTQYZ_.js → isolation-7Jrcucgc.js} +11 -11
  336. package/isolation-7Jrcucgc.js.map +1 -0
  337. package/{isolation-7xbkc12r.mjs → isolation-CO0NiK8R.mjs} +11 -11
  338. package/isolation-CO0NiK8R.mjs.map +1 -0
  339. package/lib/classes/tokenizable.d.ts +2 -3
  340. package/mcp/adk-docs-corpus.json +2 -2
  341. package/package.json +469 -469
  342. package/{retrievable-C5dXuDhD.js → retrievable-BTwjmPnl.js} +3 -3
  343. package/{retrievable-C5dXuDhD.js.map → retrievable-BTwjmPnl.js.map} +1 -1
  344. package/{retrievable-gl_TIHnX.mjs → retrievable-CXTAUuuv.mjs} +3 -3
  345. package/{retrievable-gl_TIHnX.mjs.map → retrievable-CXTAUuuv.mjs.map} +1 -1
  346. package/{scrapper-DD6-_2u-.js → scrapper-CJexXXK-.js} +4 -4
  347. package/{scrapper-DD6-_2u-.js.map → scrapper-CJexXXK-.js.map} +1 -1
  348. package/{scrapper-u_orpxIB.mjs → scrapper-DiQ5FfDL.mjs} +4 -4
  349. package/{scrapper-u_orpxIB.mjs.map → scrapper-DiQ5FfDL.mjs.map} +1 -1
  350. package/{searxng-fVdJUCK2.mjs → searxng-BFTJ6rTE.mjs} +4 -4
  351. package/{searxng-fVdJUCK2.mjs.map → searxng-BFTJ6rTE.mjs.map} +1 -1
  352. package/{searxng-C7GK0Nrz.js → searxng-DzlGZG4V.js} +4 -4
  353. package/{searxng-C7GK0Nrz.js.map → searxng-DzlGZG4V.js.map} +1 -1
  354. package/server.json +2 -2
  355. package/skills/adk-assembly/SKILL.md +2 -2
  356. package/{spooled_artifact-DriNQRj7.js → spooled_artifact-BpcesRBv.js} +384 -384
  357. package/spooled_artifact-BpcesRBv.js.map +1 -0
  358. package/{spooled_artifact-BkueYJhR.mjs → spooled_artifact-Bw_7swIp.mjs} +385 -385
  359. package/spooled_artifact-Bw_7swIp.mjs.map +1 -0
  360. package/spooled_artifact.cjs +2 -2
  361. package/spooled_artifact.mjs +2 -2
  362. package/{spooled_markdown_artifact-CfHRZUkl.mjs → spooled_markdown_artifact-vd6eNtIP.mjs} +3 -3
  363. package/{spooled_markdown_artifact-CfHRZUkl.mjs.map → spooled_markdown_artifact-vd6eNtIP.mjs.map} +1 -1
  364. package/{spooled_markdown_artifact-C_VkCDhF.js → spooled_markdown_artifact-wJPnE8Ij.js} +3 -3
  365. package/{spooled_markdown_artifact-C_VkCDhF.js.map → spooled_markdown_artifact-wJPnE8Ij.js.map} +1 -1
  366. package/{thought-B8JAi3-W.mjs → thought-BE1KGEhV.mjs} +3 -3
  367. package/{thought-B8JAi3-W.mjs.map → thought-BE1KGEhV.mjs.map} +1 -1
  368. package/{thought--fRgOwTP.js → thought-bS7O9O5H.js} +3 -3
  369. package/{thought--fRgOwTP.js.map → thought-bS7O9O5H.js.map} +1 -1
  370. package/{tokenizable-CWW7iSrD.js → tokenizable-BMZuGWRd.js} +35 -29
  371. package/tokenizable-BMZuGWRd.js.map +1 -0
  372. package/{tokenizable-DLMP68ZV.mjs → tokenizable-VB4Av8GF.mjs} +36 -30
  373. package/tokenizable-VB4Av8GF.mjs.map +1 -0
  374. package/{tool_call-CPjyvkm4.mjs → tool_call-Cfaj-6zK.mjs} +4 -4
  375. package/{tool_call-CPjyvkm4.mjs.map → tool_call-Cfaj-6zK.mjs.map} +1 -1
  376. package/{tool_call-DgqVwL5n.js → tool_call-Fs_Uh5wQ.js} +4 -4
  377. package/{tool_call-DgqVwL5n.js.map → tool_call-Fs_Uh5wQ.js.map} +1 -1
  378. package/{tools-BmLzkvNr.mjs → tools-B3_8C78Q.mjs} +6 -6
  379. package/{tools-BmLzkvNr.mjs.map → tools-B3_8C78Q.mjs.map} +1 -1
  380. package/{tools-DmcIe2Cb.js → tools-CqOcmHR8.js} +6 -6
  381. package/{tools-DmcIe2Cb.js.map → tools-CqOcmHR8.js.map} +1 -1
  382. package/{toon-BvTQsKdN.mjs → toon-BSlr88px.mjs} +5 -5
  383. package/{toon-BvTQsKdN.mjs.map → toon-BSlr88px.mjs.map} +1 -1
  384. package/{toon-B05eKx-q.js → toon-D71tkyI3.js} +5 -5
  385. package/{toon-B05eKx-q.js.map → toon-D71tkyI3.js.map} +1 -1
  386. package/{turn_runner-DEGCvfVZ.mjs → turn_runner-BHHD6h77.mjs} +5 -5
  387. package/{turn_runner-DEGCvfVZ.mjs.map → turn_runner-BHHD6h77.mjs.map} +1 -1
  388. package/{turn_runner-DT8TseR4.js → turn_runner-DhLI7OTH.js} +5 -5
  389. package/{turn_runner-DT8TseR4.js.map → turn_runner-DhLI7OTH.js.map} +1 -1
  390. package/turn_runner.cjs +1 -1
  391. package/turn_runner.mjs +1 -1
  392. package/types-D6X_aUIb.mjs.map +1 -1
  393. package/types-DrSosVaM.js.map +1 -1
  394. package/{validate-lzy9nG_E.mjs → validate-Bi7FGjoq.mjs} +13 -1
  395. package/{validate-lzy9nG_E.mjs.map → validate-Bi7FGjoq.mjs.map} +1 -1
  396. package/{validate-CdOS7S2u.js → validate-CkQI-48O.js} +13 -1
  397. package/{validate-CdOS7S2u.js.map → validate-CkQI-48O.js.map} +1 -1
  398. package/{xml-DDTIMpY3.js → xml-BeNvlifb.js} +5 -5
  399. package/{xml-DDTIMpY3.js.map → xml-BeNvlifb.js.map} +1 -1
  400. package/{xml-VhJ4NrMB.mjs → xml-vyCZZiF_.mjs} +5 -5
  401. package/{xml-VhJ4NrMB.mjs.map → xml-vyCZZiF_.mjs.map} +1 -1
  402. package/{yaml-Cx16IYJq.js → yaml-DhLLa2cj.js} +5 -5
  403. package/{yaml-Cx16IYJq.js.map → yaml-DhLLa2cj.js.map} +1 -1
  404. package/{yaml-Du4wFGzL.mjs → yaml-Dtz0Bd7J.mjs} +5 -5
  405. package/{yaml-Du4wFGzL.mjs.map → yaml-Dtz0Bd7J.mjs.map} +1 -1
  406. package/artifact_methods-BMCahBLn.mjs +0 -1
  407. package/artifact_methods-f_bSy4kX.js +0 -1
  408. package/isolation-7xbkc12r.mjs.map +0 -1
  409. package/isolation-BQCTQYZ_.js.map +0 -1
  410. package/spooled_artifact-BkueYJhR.mjs.map +0 -1
  411. package/spooled_artifact-DriNQRj7.js.map +0 -1
  412. package/tokenizable-CWW7iSrD.js.map +0 -1
  413. package/tokenizable-DLMP68ZV.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.mjs","names":["#baseline"],"sources":["../../../../src/batteries/llm/bedrock_converse/adapter.ts"],"sourcesContent":["/**\n * Cross-environment executor adapter for AWS Bedrock's native Converse API.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/adapter\n *\n * @remarks\n * Targets `POST {baseURL}/model/{modelId}/converse` (and `/converse-stream` when `stream` is set)\n * over plain HTTPS with a Bedrock API key (`Authorization: Bearer ABSK…`). Deliberately NO AWS SDK\n * and no SigV4 signer: the battery must stay cross-environment and dependency-light, and a bearer\n * key removes the only reason to pull in a signer.\n *\n * Why a native battery rather than pointing `openai_chat_completions` at a Converse-backed gateway:\n * Converse is a content-BLOCK protocol with strict role alternation, a required `toolConfig`\n * whenever tool blocks appear, and tool results carried on `user` turns. A gateway must repair all\n * of that on your behalf — most notably by MERGING consecutive same-role turns — and that repair is\n * invisible in the response. For ordinary use it is fine; for anything that needs to know what the\n * VENDOR received it is fatal, because a gateway's fix is indistinguishable from vendor tolerance.\n * See the validation battery's \"Which API surface a rule applies to\" guide, and\n * {@link BedrockConverseAdapterOptions.alternationPolicy} for the `'reject'` escape hatch that lets\n * Converse's own error surface.\n *\n * Options layer as in every other battery: constructor baseline → `executor()` overrides →\n * per-iteration `ctx.stash.bedrockConverse`, re-validated each iteration.\n */\n\nimport { DateTime } from 'luxon'\nimport { sha256 } from 'js-sha256'\nimport { v6 as uuidv6 } from 'uuid'\nimport { validateOptions } from './validation'\nimport { normalizeToolName } from '../chat_common/helpers'\nimport { isError, isObject, isInstanceOf } from '@nhtio/adk/guards'\nimport { resolveToolCallParser } from '../chat_common/tool_parsers'\nimport { canonicalStringify } from '../../../lib/utils/canonical_json'\nimport { Media, Message, Thought, Tokenizable, ToolCall } from '@nhtio/adk/common'\nimport {\n DEFAULT_CONVERSE_BUCKET_ORDER,\n buildConverseRequest,\n extractConverseGeneration,\n mediaToConverseImage,\n renderConverseToolResult,\n toolsToConverseTools,\n} from './helpers'\nimport {\n E_CONVERSE_ALTERNATION_VIOLATION,\n E_CONVERSE_INVALID_TOOL_INPUT,\n E_CONVERSE_MISSING_TOOL_CONFIG,\n E_CONVERSE_REQUEST_FAILED,\n E_CONVERSE_STREAM_ERROR,\n} from './exceptions'\nimport {\n descriptionToChatCompletionsJsonSchema,\n filterThoughts,\n renderChatCompletionsSystemPrompt,\n renderFirstPartyRetrievables,\n renderMemories,\n renderRetrievableSafetyDirective,\n renderRetrievables,\n renderStandingInstructions,\n renderThirdPartyPrivateRetrievables,\n renderThirdPartyPublicRetrievables,\n renderThought,\n renderTrustedContent,\n renderUntrustedContent,\n} from '../chat_common/helpers'\nimport type { DispatchContext } from '@nhtio/adk/types'\nimport type { ArtifactTool, SpooledArtifact, Tool } from '@nhtio/adk/common'\nimport type { DispatchExecutorFn, DispatchExecutorHelpers } from '@nhtio/adk/types'\nimport type {\n BedrockConverseAdapterOptions,\n BedrockConverseHelpers,\n ConverseResponse,\n} from './types'\n\nconst nowIso = (): string => DateTime.now().toISO() ?? new Date().toISOString()\n\nconst DEFAULT_REGION = 'us-east-1'\n\nconst computeChecksum = (tool: string, args: Record<string, unknown>): string =>\n sha256(`${tool}:${canonicalStringify(args)}`)\n\n/** Merge the three option layers, later winning. */\nconst mergeOptions = (\n ...layers: Array<Partial<BedrockConverseAdapterOptions> | undefined>\n): Partial<BedrockConverseAdapterOptions> => {\n const out: Record<string, unknown> = {}\n for (const layer of layers) {\n if (!layer) continue\n for (const [k, v] of Object.entries(layer)) if (v !== undefined) out[k] = v\n }\n return out as Partial<BedrockConverseAdapterOptions>\n}\n\n/** Fill every injectable helper, preferring the caller's override. */\nconst resolveHelpers = (\n overrides: Partial<BedrockConverseHelpers> | undefined\n): BedrockConverseHelpers => {\n const src = (overrides ?? {}) as Record<string, unknown>\n const pick = <T>(key: string, fallback: T): T => (src[key] as T | undefined) ?? fallback\n return {\n descriptionToChatCompletionsJsonSchema: pick(\n 'descriptionToChatCompletionsJsonSchema',\n descriptionToChatCompletionsJsonSchema\n ),\n renderUntrustedContent: pick('renderUntrustedContent', renderUntrustedContent),\n renderTrustedContent: pick('renderTrustedContent', renderTrustedContent),\n renderStandingInstructions: pick('renderStandingInstructions', renderStandingInstructions),\n renderMemories: pick('renderMemories', renderMemories),\n renderRetrievables: pick('renderRetrievables', renderRetrievables),\n renderRetrievableSafetyDirective: pick(\n 'renderRetrievableSafetyDirective',\n renderRetrievableSafetyDirective\n ),\n renderFirstPartyRetrievables: pick(\n 'renderFirstPartyRetrievables',\n renderFirstPartyRetrievables\n ),\n renderThirdPartyPublicRetrievables: pick(\n 'renderThirdPartyPublicRetrievables',\n renderThirdPartyPublicRetrievables\n ),\n renderThirdPartyPrivateRetrievables: pick(\n 'renderThirdPartyPrivateRetrievables',\n renderThirdPartyPrivateRetrievables\n ),\n renderThought: pick('renderThought', renderThought),\n filterThoughts: pick('filterThoughts', filterThoughts),\n renderChatCompletionsSystemPrompt: pick(\n 'renderChatCompletionsSystemPrompt',\n renderChatCompletionsSystemPrompt\n ),\n toolsToConverseTools: pick('toolsToConverseTools', toolsToConverseTools),\n renderConverseToolResult: pick('renderConverseToolResult', renderConverseToolResult),\n buildConverseRequest: pick('buildConverseRequest', buildConverseRequest),\n } as BedrockConverseHelpers\n}\n\n/**\n * Native Bedrock Converse executor adapter.\n *\n * @example\n * ```ts\n * const adapter = new BedrockConverseAdapter({\n * model: 'us.amazon.nova-2-lite-v1:0',\n * apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK,\n * region: 'us-east-1',\n * })\n * const runner = new TurnRunner({ executorCallback: adapter.executor(), ... })\n * ```\n */\nexport class BedrockConverseAdapter {\n /** Per-iteration override key on `ctx.stash`. */\n public static readonly STASH_KEY = 'bedrockConverse' as const\n\n readonly #baseline: BedrockConverseAdapterOptions\n\n /**\n * @param options - Constructor-baseline options, re-validated each iteration after overrides merge.\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when `options` is invalid.\n */\n constructor(options: unknown) {\n this.#baseline = validateOptions(options)\n }\n\n /** Narrowing guard for cross-realm instances. */\n public static isBedrockConverseAdapter(value: unknown): value is BedrockConverseAdapter {\n return isInstanceOf(value, 'BedrockConverseAdapter', BedrockConverseAdapter)\n }\n\n /**\n * Build a {@link DispatchExecutorFn} bound to the baseline plus optional executor-scope overrides.\n *\n * @param overrides - Higher precedence than the baseline, lower than `ctx.stash`.\n */\n executor(overrides?: Partial<BedrockConverseAdapterOptions>): DispatchExecutorFn {\n const baseline = this.#baseline\n const adapterClass = BedrockConverseAdapter\n return async (ctx: DispatchContext, helpers: DispatchExecutorHelpers): Promise<void> => {\n const warn = (message: string): void => {\n helpers.log.warn({ kind: 'helper-warning', message })\n }\n\n const stashRaw = ctx.stash.get(adapterClass.STASH_KEY, {}) as unknown\n const stashOverrides = isObject(stashRaw)\n ? (stashRaw as Partial<BedrockConverseAdapterOptions>)\n : {}\n const merged = validateOptions(mergeOptions(baseline, overrides, stashOverrides))\n const resolved = resolveHelpers(merged.helpers)\n const selfIdentity = 'assistant'\n const dispatchStreamId = uuidv6()\n\n // Converse wants toolResult.content[] blocks, so results render ahead of assembly.\n const renderedToolCallResults = new Map<\n ToolCall,\n Array<{ text?: string; json?: Record<string, unknown> }>\n >()\n for (const tc of ctx.turnToolCalls) {\n renderedToolCallResults.set(\n tc,\n await resolved.renderConverseToolResult({\n toolCall: tc,\n results: tc.results as never,\n tool: ctx.tools.get(tc.tool) as Tool | ArtifactTool | undefined,\n renderUntrustedContent: resolved.renderUntrustedContent,\n renderTrustedContent: resolved.renderTrustedContent,\n unsupportedMediaPolicy: merged.unsupportedMediaPolicy ?? 'throw',\n warn,\n })\n )\n }\n\n const request = await resolved.buildConverseRequest({\n systemPrompt: ctx.systemPrompt,\n standingInstructions: ctx.standingInstructions,\n memories: ctx.turnMemories,\n retrievables: ctx.turnRetrievables,\n messages: ctx.turnMessages,\n thoughts: ctx.turnThoughts,\n toolCalls: ctx.turnToolCalls,\n tools: ctx.tools,\n renderedToolCallResults,\n bucketOrder: merged.bucketOrder ?? (DEFAULT_CONVERSE_BUCKET_ORDER as never),\n selfIdentity,\n thoughtSurfacing: merged.thoughtSurfacing ?? 'all-self',\n replayCompatibility: [],\n alternationPolicy: merged.alternationPolicy ?? 'merge',\n helpers: resolved,\n decodeMedia: mediaToConverseImage,\n unsupportedMediaPolicy: merged.unsupportedMediaPolicy,\n warn,\n })\n\n const inferenceConfig = {\n ...(merged.maxTokens !== undefined ? { maxTokens: merged.maxTokens } : {}),\n ...(merged.temperature !== undefined ? { temperature: merged.temperature } : {}),\n ...(merged.topP !== undefined ? { topP: merged.topP } : {}),\n ...(merged.stopSequences ? { stopSequences: merged.stopSequences } : {}),\n }\n const body = {\n ...request,\n ...(merged.toolChoice && request.toolConfig\n ? { toolConfig: { ...request.toolConfig, toolChoice: merged.toolChoice } }\n : {}),\n ...(Object.keys(inferenceConfig).length > 0 ? { inferenceConfig } : {}),\n ...(merged.additionalModelRequestFields\n ? { additionalModelRequestFields: merged.additionalModelRequestFields }\n : {}),\n }\n\n // The EXACT body about to be POSTed. An ADK-control key — stripped from the wire request.\n if (merged.onPromptAssembled) {\n try {\n merged.onPromptAssembled({\n battery: 'bedrock_converse',\n kind: 'request-body',\n messages: body.messages,\n tools: body.toolConfig?.tools,\n requestBody: body,\n streamed: merged.stream === true,\n streamId: dispatchStreamId,\n })\n } catch {\n /* observer errors are non-fatal */\n }\n }\n\n const base = (\n merged.baseURL ?? `https://bedrock-runtime.${merged.region ?? DEFAULT_REGION}.amazonaws.com`\n ).replace(/\\/$/, '')\n const action = merged.stream === true ? 'converse-stream' : 'converse'\n // The model id contains ':' and '.', both legal in a path segment but worth encoding so a\n // future id with a reserved character does not silently reshape the URL.\n const url = `${base}/model/${encodeURIComponent(merged.model)}/${action}`\n const headers: Record<string, string> = { 'Content-Type': 'application/json' }\n if (merged.apiKey) headers.Authorization = `Bearer ${merged.apiKey}`\n\n const doFetch = merged.fetch ?? globalThis.fetch\n let parsed: ConverseResponse\n try {\n const res = await doFetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n signal: merged.timeoutMs ? AbortSignal.timeout(merged.timeoutMs) : ctx.abortSignal,\n })\n const text = await res.text()\n if (!res.ok) {\n // Classify the two Converse-specific rejections: both are actionable, and both otherwise\n // arrive as an undifferentiated ValidationException.\n if (/toolConfig/i.test(text)) {\n ctx.nack(new E_CONVERSE_MISSING_TOOL_CONFIG([text.slice(0, 400)]))\n return\n }\n if (/alternat|consecutive|must alternate/i.test(text)) {\n ctx.nack(new E_CONVERSE_ALTERNATION_VIOLATION([text.slice(0, 400)]))\n return\n }\n ctx.nack(new E_CONVERSE_REQUEST_FAILED([res.status, text.slice(0, 400)]))\n return\n }\n parsed = JSON.parse(text) as ConverseResponse\n } catch (err) {\n ctx.nack(new E_CONVERSE_STREAM_ERROR([isError(err) ? err.message : String(err)]))\n return\n }\n\n const { text, reasoning, toolUses, stopReason } = extractConverseGeneration(parsed)\n const responseId = uuidv6()\n\n if (text.length > 0) {\n const messageId = `${responseId}:message`\n helpers.reportMessage(messageId, text, { isComplete: true })\n await ctx.storeMessage(\n new Message({\n id: messageId,\n role: 'assistant',\n content: text,\n identity: selfIdentity,\n createdAt: nowIso(),\n updatedAt: nowIso(),\n })\n )\n }\n if (reasoning.length > 0) {\n const thoughtId = `${responseId}:thought`\n helpers.reportThought(thoughtId, reasoning, { isComplete: true })\n await ctx.storeThought(\n new Thought({\n id: thoughtId,\n content: reasoning,\n identity: selfIdentity,\n createdAt: nowIso(),\n updatedAt: nowIso(),\n })\n )\n }\n\n // Fallback recovery is consulted ONLY when the provider returned no structured tool use, so\n // a native toolUse always wins over a parsed one.\n const calls = toolUses.map((t) => ({ id: t.toolUseId, name: t.name, args: t.input }))\n if (calls.length === 0 && merged.localToolCallParser !== undefined && text.length > 0) {\n const parser = resolveToolCallParser(merged.localToolCallParser)\n const recovered = parser(text, { toolNames: ctx.tools.all().map((t) => t.name) })\n for (const call of recovered.calls) {\n calls.push({\n id: uuidv6(),\n name: call.name,\n args: (call.arguments ?? {}) as Record<string, unknown>,\n })\n }\n }\n\n if (merged.onRawGeneration) {\n try {\n merged.onRawGeneration({\n rawText: text,\n cleanedText: text,\n reasoning: reasoning.length > 0 ? [reasoning] : [],\n toolCalls: calls.map((c) => ({ name: c.name, arguments: c.args as never })),\n streamed: merged.stream === true,\n streamId: dispatchStreamId,\n })\n } catch {\n /* observer errors are non-fatal */\n }\n }\n\n if (calls.length === 0) {\n helpers.log.trace({\n kind: 'converse-finish',\n message: `generation ended with stopReason=${stopReason ?? 'unknown'} and no tool use`,\n payload: { stopReason: stopReason ?? 'unknown' },\n })\n ctx.ack()\n return\n }\n\n for (const call of calls) {\n if (ctx.abortSignal.aborted) return\n // Resolve once at ingress; Converse sanitises only when rendering, so this preserves the\n // filtered id consistently for reporting, persistence, and any spool key.\n const callId = merged.toolCallIdFilter?.(call.id, ctx) ?? call.id\n const toolName = normalizeToolName(call.name)\n const tool = ctx.tools.get(toolName) as Tool | ArtifactTool | undefined\n const completedAt = nowIso()\n\n if (!isObject(call.args)) {\n const results = new Tokenizable(\n new E_CONVERSE_INVALID_TOOL_INPUT([JSON.stringify(call.args)]).message\n )\n helpers.reportToolCall(callId, { tool: toolName, args: {} })\n helpers.reportToolCall(callId, { results, isError: true, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: toolName,\n args: {},\n checksum: computeChecksum(toolName, {}),\n isComplete: true,\n isError: true,\n results,\n createdAt: completedAt,\n updatedAt: completedAt,\n completedAt,\n })\n )\n continue\n }\n\n if (!tool) {\n const available = ctx.tools\n .all()\n .map((t) => t.name)\n .sort()\n const results = new Tokenizable(\n available.length > 0\n ? `Tool not found: ${toolName}. Available tools: ${available.join(', ')}.`\n : `Tool not found: ${toolName}. No tools are available this turn.`\n )\n helpers.reportToolCall(callId, { tool: toolName, args: call.args })\n helpers.reportToolCall(callId, { results, isError: true, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: toolName,\n args: call.args,\n checksum: computeChecksum(toolName, call.args),\n isComplete: true,\n isError: true,\n results,\n createdAt: completedAt,\n updatedAt: completedAt,\n completedAt,\n })\n )\n continue\n }\n\n helpers.reportToolCall(callId, { tool: tool.name, args: call.args })\n let results: Tokenizable | SpooledArtifact | SpooledArtifact[] | Media | Media[] =\n new Tokenizable('')\n let isToolError = false\n try {\n const raw = await tool.executor(ctx)(call.args)\n results = Tokenizable.isTokenizable(raw)\n ? raw\n : new Tokenizable(typeof raw === 'string' ? raw : JSON.stringify(raw ?? ''))\n } catch (err) {\n isToolError = true\n results = new Tokenizable(isError(err) ? err.message : String(err))\n }\n const finishedAt = nowIso()\n helpers.reportToolCall(callId, { results, isError: isToolError, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: tool.name,\n args: call.args,\n checksum: computeChecksum(tool.name, call.args),\n isComplete: true,\n isError: isToolError,\n results,\n createdAt: finishedAt,\n updatedAt: finishedAt,\n completedAt: finishedAt,\n })\n )\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAM,eAAuB,SAAS,IAAI,EAAE,MAAM,sBAAK,IAAI,KAAK,GAAE,YAAY;AAE9E,IAAM,iBAAiB;AAEvB,IAAM,mBAAmB,MAAc,SACrC,OAAO,GAAG,KAAK,GAAG,mBAAmB,IAAI,GAAG;;AAG9C,IAAM,gBACJ,GAAG,WACwC;CAC3C,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,CAAC,OAAO;EACZ,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,KAAK,GAAG,IAAI,MAAM,KAAA,GAAW,IAAI,KAAK;CAC5E;CACA,OAAO;AACT;;AAGA,IAAM,kBACJ,cAC2B;CAC3B,MAAM,MAAO,aAAa,CAAC;CAC3B,MAAM,QAAW,KAAa,aAAoB,IAAI,QAA0B;CAChF,OAAO;EACL,wCAAwC,KACtC,0CACA,sCACF;EACA,wBAAwB,KAAK,0BAA0B,sBAAsB;EAC7E,sBAAsB,KAAK,wBAAwB,oBAAoB;EACvE,4BAA4B,KAAK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ACJ,MAAM;MACN,MAAM,KAAK;MACX,UAAU,gBAAgB,UAAU,KAAK,IAAI;MAC7C,YAAY;MACZ,SAAS;MACT;MACA,WAAW;MACX,WAAW;MACX;KACF,CAAC,CACH;KACA;IACF;IAEA,QAAQ,eAAe,QAAQ;KAAE,MAAM,KAAK;KAAM,MAAM,KAAK;IAAK,CAAC;IACnE,IAAI,UACF,IAAI,YAAY,EAAE;IACpB,IAAI,cAAc;IAClB,IAAI;KACF,MAAM,MAAM,MAAM,KAAK,SAAS,GAAG,EAAE,KAAK,IAAI;KAC9C,UAAU,YAAY,cAAc,GAAG,IACnC,MACA,IAAI,YAAY,OAAO,QAAQ,WAAW,MAAM,KAAK,UAAU,OAAO,EAAE,CAAC;IAC/E,SAAS,KAAK;KACZ,cAAc;KACd,UAAU,IAAI,YAAY,QAAQ,GAAG,IAAI,IAAI,UAAU,OAAO,GAAG,CAAC;IACpE;IACA,MAAM,aAAa,OAAO;IAC1B,QAAQ,eAAe,QAAQ;KAAE;KAAS,SAAS;KAAa,YAAY;IAAK,CAAC;IAClF,MAAM,IAAI,cACR,IAAI,SAAS;KACX,IAAI;KACJ,MAAM,KAAK;KACX,MAAM,KAAK;KACX,UAAU,gBAAgB,KAAK,MAAM,KAAK,IAAI;KAC9C,YAAY;KACZ,SAAS;KACT;KACA,WAAW;KACX,WAAW;KACX,aAAa;IACf,CAAC,CACH;GACF;EACF;CACF;AACF"}
1
+ {"version":3,"file":"adapter.mjs","names":["#baseline"],"sources":["../../../../src/batteries/llm/bedrock_converse/adapter.ts"],"sourcesContent":["/**\n * Cross-environment executor adapter for AWS Bedrock's native Converse API.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/adapter\n *\n * @remarks\n * Targets `POST {baseURL}/model/{modelId}/converse` (and `/converse-stream` when `stream` is set)\n * over plain HTTPS with a Bedrock API key (`Authorization: Bearer ABSK…`). Deliberately NO AWS SDK\n * and no SigV4 signer: the battery must stay cross-environment and dependency-light, and a bearer\n * key removes the only reason to pull in a signer.\n *\n * Why a native battery rather than pointing `openai_chat_completions` at a Converse-backed gateway:\n * Converse is a content-BLOCK protocol with strict role alternation, a required `toolConfig`\n * whenever tool blocks appear, and tool results carried on `user` turns. A gateway must repair all\n * of that on your behalf — most notably by MERGING consecutive same-role turns — and that repair is\n * invisible in the response. For ordinary use it is fine; for anything that needs to know what the\n * VENDOR received it is fatal, because a gateway's fix is indistinguishable from vendor tolerance.\n * See the validation battery's \"Which API surface a rule applies to\" guide, and\n * {@link BedrockConverseAdapterOptions.alternationPolicy} for the `'reject'` escape hatch that lets\n * Converse's own error surface.\n *\n * Options layer as in every other battery: constructor baseline → `executor()` overrides →\n * per-iteration `ctx.stash.bedrockConverse`, re-validated each iteration.\n */\n\nimport { DateTime } from 'luxon'\nimport { sha256 } from 'js-sha256'\nimport { v6 as uuidv6 } from 'uuid'\nimport { validateOptions } from './validation'\nimport { normalizeToolName } from '../chat_common/helpers'\nimport { isError, isObject, isInstanceOf } from '@nhtio/adk/guards'\nimport { resolveToolCallParser } from '../chat_common/tool_parsers'\nimport { canonicalStringify } from '../../../lib/utils/canonical_json'\nimport { Media, Message, Thought, Tokenizable, ToolCall } from '@nhtio/adk/common'\nimport {\n DEFAULT_CONVERSE_BUCKET_ORDER,\n buildConverseRequest,\n extractConverseGeneration,\n mediaToConverseImage,\n renderConverseToolResult,\n toolsToConverseTools,\n} from './helpers'\nimport {\n E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW,\n E_INVALID_BEDROCK_CONVERSE_OPTIONS,\n E_CONVERSE_ALTERNATION_VIOLATION,\n E_CONVERSE_INVALID_TOOL_INPUT,\n E_CONVERSE_MISSING_TOOL_CONFIG,\n E_CONVERSE_REQUEST_FAILED,\n E_CONVERSE_STREAM_ERROR,\n} from './exceptions'\nimport {\n descriptionToChatCompletionsJsonSchema,\n filterThoughts,\n renderChatCompletionsSystemPrompt,\n renderFirstPartyRetrievables,\n renderMemories,\n renderRetrievableSafetyDirective,\n renderRetrievables,\n renderStandingInstructions,\n renderThirdPartyPrivateRetrievables,\n renderThirdPartyPublicRetrievables,\n renderThought,\n renderTrustedContent,\n renderUntrustedContent,\n} from '../chat_common/helpers'\nimport type { DispatchContext } from '@nhtio/adk/types'\nimport type { TokenEncoding, TokenEncodingId } from '@nhtio/adk/types'\nimport type { DispatchExecutorFn, DispatchExecutorHelpers } from '@nhtio/adk/types'\nimport type { ArtifactTool, Memory, SpooledArtifact, Tool } from '@nhtio/adk/common'\nimport type {\n BedrockConverseAdapterOptions,\n BedrockConverseHelpers,\n ConverseResponse,\n} from './types'\n\nconst nowIso = (): string => DateTime.now().toISO() ?? new Date().toISOString()\n\nconst DEFAULT_REGION = 'us-east-1'\n\nconst estimateTokensOf = async (\n value: { estimateTokens: (encoding: TokenEncoding) => number | Promise<number> },\n encoding: TokenEncodingId\n): Promise<number> => Promise.resolve(value.estimateTokens(encoding as TokenEncoding))\n\nconst computeChecksum = (tool: string, args: Record<string, unknown>): string =>\n sha256(`${tool}:${canonicalStringify(args)}`)\n\n/** Merge the three option layers, later winning. */\nconst mergeOptions = (\n ...layers: Array<Partial<BedrockConverseAdapterOptions> | undefined>\n): Partial<BedrockConverseAdapterOptions> => {\n const out: Record<string, unknown> = {}\n for (const layer of layers) {\n if (!layer) continue\n for (const [k, v] of Object.entries(layer)) if (v !== undefined) out[k] = v\n }\n return out as Partial<BedrockConverseAdapterOptions>\n}\n\n/** Fill every injectable helper, preferring the caller's override. */\nconst resolveHelpers = (\n overrides: Partial<BedrockConverseHelpers> | undefined\n): BedrockConverseHelpers => {\n const src = (overrides ?? {}) as Record<string, unknown>\n const pick = <T>(key: string, fallback: T): T => (src[key] as T | undefined) ?? fallback\n return {\n descriptionToChatCompletionsJsonSchema: pick(\n 'descriptionToChatCompletionsJsonSchema',\n descriptionToChatCompletionsJsonSchema\n ),\n renderUntrustedContent: pick('renderUntrustedContent', renderUntrustedContent),\n renderTrustedContent: pick('renderTrustedContent', renderTrustedContent),\n renderStandingInstructions: pick('renderStandingInstructions', renderStandingInstructions),\n renderMemories: pick('renderMemories', renderMemories),\n renderRetrievables: pick('renderRetrievables', renderRetrievables),\n renderRetrievableSafetyDirective: pick(\n 'renderRetrievableSafetyDirective',\n renderRetrievableSafetyDirective\n ),\n renderFirstPartyRetrievables: pick(\n 'renderFirstPartyRetrievables',\n renderFirstPartyRetrievables\n ),\n renderThirdPartyPublicRetrievables: pick(\n 'renderThirdPartyPublicRetrievables',\n renderThirdPartyPublicRetrievables\n ),\n renderThirdPartyPrivateRetrievables: pick(\n 'renderThirdPartyPrivateRetrievables',\n renderThirdPartyPrivateRetrievables\n ),\n renderThought: pick('renderThought', renderThought),\n filterThoughts: pick('filterThoughts', filterThoughts),\n renderChatCompletionsSystemPrompt: pick(\n 'renderChatCompletionsSystemPrompt',\n renderChatCompletionsSystemPrompt\n ),\n toolsToConverseTools: pick('toolsToConverseTools', toolsToConverseTools),\n renderConverseToolResult: pick('renderConverseToolResult', renderConverseToolResult),\n buildConverseRequest: pick('buildConverseRequest', buildConverseRequest),\n } as BedrockConverseHelpers\n}\n\n/**\n * Native Bedrock Converse executor adapter.\n *\n * @example\n * ```ts\n * const adapter = new BedrockConverseAdapter({\n * model: 'us.amazon.nova-2-lite-v1:0',\n * apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK,\n * region: 'us-east-1',\n * })\n * const runner = new TurnRunner({ executorCallback: adapter.executor(), ... })\n * ```\n */\nexport class BedrockConverseAdapter {\n /** Per-iteration override key on `ctx.stash`. */\n public static readonly STASH_KEY = 'bedrockConverse' as const\n\n readonly #baseline: BedrockConverseAdapterOptions\n\n /**\n * @param options - Constructor-baseline options, re-validated each iteration after overrides merge.\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when `options` is invalid.\n */\n constructor(options: unknown) {\n this.#baseline = validateOptions(options)\n }\n\n /** Narrowing guard for cross-realm instances. */\n public static isBedrockConverseAdapter(value: unknown): value is BedrockConverseAdapter {\n return isInstanceOf(value, 'BedrockConverseAdapter', BedrockConverseAdapter)\n }\n\n /**\n * Build a {@link DispatchExecutorFn} bound to the baseline plus optional executor-scope overrides.\n *\n * @param overrides - Higher precedence than the baseline, lower than `ctx.stash`.\n */\n executor(overrides?: Partial<BedrockConverseAdapterOptions>): DispatchExecutorFn {\n const baseline = this.#baseline\n const adapterClass = BedrockConverseAdapter\n return async (ctx: DispatchContext, helpers: DispatchExecutorHelpers): Promise<void> => {\n const warn = (message: string): void => {\n helpers.log.warn({ kind: 'helper-warning', message })\n }\n\n const stashRaw = ctx.stash.get(adapterClass.STASH_KEY, {}) as unknown\n const stashOverrides = isObject(stashRaw)\n ? (stashRaw as Partial<BedrockConverseAdapterOptions>)\n : {}\n const merged = validateOptions(mergeOptions(baseline, overrides, stashOverrides))\n if (\n merged.tokenEncoding !== undefined &&\n merged.tokenEncoding !== null &&\n merged.contextWindow === undefined\n ) {\n throw new E_INVALID_BEDROCK_CONVERSE_OPTIONS([\n 'tokenEncoding is non-null but contextWindow is undefined',\n ])\n }\n const resolved = resolveHelpers(merged.helpers)\n const selfIdentity = 'assistant'\n const dispatchStreamId = uuidv6()\n\n // Converse wants toolResult.content[] blocks, so results render ahead of assembly.\n const renderedToolCallResults = new Map<\n ToolCall,\n Array<{ text?: string; json?: Record<string, unknown> }>\n >()\n for (const tc of ctx.turnToolCalls) {\n renderedToolCallResults.set(\n tc,\n await resolved.renderConverseToolResult({\n toolCall: tc,\n results: tc.results as never,\n tool: ctx.tools.get(tc.tool) as Tool | ArtifactTool | undefined,\n renderUntrustedContent: resolved.renderUntrustedContent,\n renderTrustedContent: resolved.renderTrustedContent,\n unsupportedMediaPolicy: merged.unsupportedMediaPolicy ?? 'throw',\n warn,\n })\n )\n }\n\n if (\n merged.tokenEncoding !== undefined &&\n merged.tokenEncoding !== null &&\n merged.contextWindow !== undefined\n ) {\n const encoding = merged.tokenEncoding\n let total = await estimateTokensOf(ctx.systemPrompt, encoding)\n for (const value of ctx.standingInstructions)\n total += await estimateTokensOf(value, encoding)\n for (const memory of ctx.turnMemories as Set<Memory>)\n total += await estimateTokensOf(memory.content, encoding)\n for (const retrievable of ctx.turnRetrievables)\n total += await estimateTokensOf(\n retrievable.inline\n ? (retrievable.content as any)\n : new Tokenizable(`[Reference available: ${retrievable.id}]`),\n encoding\n )\n for (const message of ctx.turnMessages) {\n if (message.content !== undefined)\n total += await estimateTokensOf(message.content, encoding)\n }\n for (const thought of ctx.turnThoughts)\n total += await estimateTokensOf(thought.content, encoding)\n for (const result of renderedToolCallResults.values()) {\n total += await estimateTokensOf(new Tokenizable(JSON.stringify(result)), encoding)\n }\n const tools = ctx.tools.visible()\n if (tools.length > 0) {\n // Tool DECLARATIONS: the Bedrock wire ships tools as an array, which the PROVIDER\n // serializes server-side into the model's own format. Tally the tokens of the wire\n // tools JSON (`JSON.stringify`) as an honest FLOOR — a truthful lower bound. We add\n // a safe 10% margin to cover JSON structural overhead and nested formatting.\n const toolTokens = await estimateTokensOf(\n new Tokenizable(JSON.stringify(resolved.toolsToConverseTools(tools))),\n encoding\n )\n total += Math.ceil(toolTokens * 1.1)\n }\n if (total + (merged.maxTokens ?? 0) > merged.contextWindow) {\n throw new E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW([\n total + (merged.maxTokens ?? 0),\n merged.contextWindow,\n encoding,\n ])\n }\n }\n\n const request = await resolved.buildConverseRequest({\n systemPrompt: ctx.systemPrompt,\n standingInstructions: ctx.standingInstructions,\n memories: ctx.turnMemories,\n retrievables: ctx.turnRetrievables,\n messages: ctx.turnMessages,\n thoughts: ctx.turnThoughts,\n toolCalls: ctx.turnToolCalls,\n tools: ctx.tools,\n renderedToolCallResults,\n bucketOrder: merged.bucketOrder ?? (DEFAULT_CONVERSE_BUCKET_ORDER as never),\n selfIdentity,\n thoughtSurfacing: merged.thoughtSurfacing ?? 'all-self',\n replayCompatibility: [],\n alternationPolicy: merged.alternationPolicy ?? 'merge',\n helpers: resolved,\n decodeMedia: mediaToConverseImage,\n unsupportedMediaPolicy: merged.unsupportedMediaPolicy,\n warn,\n })\n\n const inferenceConfig = {\n ...(merged.maxTokens !== undefined ? { maxTokens: merged.maxTokens } : {}),\n ...(merged.temperature !== undefined ? { temperature: merged.temperature } : {}),\n ...(merged.topP !== undefined ? { topP: merged.topP } : {}),\n ...(merged.stopSequences ? { stopSequences: merged.stopSequences } : {}),\n }\n const body = {\n ...request,\n ...(merged.toolChoice && request.toolConfig\n ? { toolConfig: { ...request.toolConfig, toolChoice: merged.toolChoice } }\n : {}),\n ...(Object.keys(inferenceConfig).length > 0 ? { inferenceConfig } : {}),\n ...(merged.additionalModelRequestFields\n ? { additionalModelRequestFields: merged.additionalModelRequestFields }\n : {}),\n }\n\n // The EXACT body about to be POSTed. An ADK-control key — stripped from the wire request.\n if (merged.onPromptAssembled) {\n try {\n merged.onPromptAssembled({\n battery: 'bedrock_converse',\n kind: 'request-body',\n messages: body.messages,\n tools: body.toolConfig?.tools,\n requestBody: body,\n streamed: merged.stream === true,\n streamId: dispatchStreamId,\n })\n } catch {\n /* observer errors are non-fatal */\n }\n }\n\n const base = (\n merged.baseURL ?? `https://bedrock-runtime.${merged.region ?? DEFAULT_REGION}.amazonaws.com`\n ).replace(/\\/$/, '')\n const action = merged.stream === true ? 'converse-stream' : 'converse'\n // The model id contains ':' and '.', both legal in a path segment but worth encoding so a\n // future id with a reserved character does not silently reshape the URL.\n const url = `${base}/model/${encodeURIComponent(merged.model)}/${action}`\n const headers: Record<string, string> = { 'Content-Type': 'application/json' }\n if (merged.apiKey) headers.Authorization = `Bearer ${merged.apiKey}`\n\n const doFetch = merged.fetch ?? globalThis.fetch\n let parsed: ConverseResponse\n try {\n const res = await doFetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n signal: merged.timeoutMs ? AbortSignal.timeout(merged.timeoutMs) : ctx.abortSignal,\n })\n const text = await res.text()\n if (!res.ok) {\n // Classify the two Converse-specific rejections: both are actionable, and both otherwise\n // arrive as an undifferentiated ValidationException.\n if (/toolConfig/i.test(text)) {\n ctx.nack(new E_CONVERSE_MISSING_TOOL_CONFIG([text.slice(0, 400)]))\n return\n }\n if (/alternat|consecutive|must alternate/i.test(text)) {\n ctx.nack(new E_CONVERSE_ALTERNATION_VIOLATION([text.slice(0, 400)]))\n return\n }\n ctx.nack(new E_CONVERSE_REQUEST_FAILED([res.status, text.slice(0, 400)]))\n return\n }\n parsed = JSON.parse(text) as ConverseResponse\n } catch (err) {\n ctx.nack(new E_CONVERSE_STREAM_ERROR([isError(err) ? err.message : String(err)]))\n return\n }\n\n const { text, reasoning, toolUses, stopReason } = extractConverseGeneration(parsed)\n const responseId = uuidv6()\n\n if (text.length > 0) {\n const messageId = `${responseId}:message`\n helpers.reportMessage(messageId, text, { isComplete: true })\n await ctx.storeMessage(\n new Message({\n id: messageId,\n role: 'assistant',\n content: text,\n identity: selfIdentity,\n createdAt: nowIso(),\n updatedAt: nowIso(),\n })\n )\n }\n if (reasoning.length > 0) {\n const thoughtId = `${responseId}:thought`\n helpers.reportThought(thoughtId, reasoning, { isComplete: true })\n await ctx.storeThought(\n new Thought({\n id: thoughtId,\n content: reasoning,\n identity: selfIdentity,\n createdAt: nowIso(),\n updatedAt: nowIso(),\n })\n )\n }\n\n // Fallback recovery is consulted ONLY when the provider returned no structured tool use, so\n // a native toolUse always wins over a parsed one.\n const calls = toolUses.map((t) => ({ id: t.toolUseId, name: t.name, args: t.input }))\n if (calls.length === 0 && merged.localToolCallParser !== undefined && text.length > 0) {\n const parser = resolveToolCallParser(merged.localToolCallParser)\n const recovered = parser(text, { toolNames: ctx.tools.all().map((t) => t.name) })\n for (const call of recovered.calls) {\n calls.push({\n id: uuidv6(),\n name: call.name,\n args: (call.arguments ?? {}) as Record<string, unknown>,\n })\n }\n }\n\n if (merged.onRawGeneration) {\n try {\n merged.onRawGeneration({\n rawText: text,\n cleanedText: text,\n reasoning: reasoning.length > 0 ? [reasoning] : [],\n toolCalls: calls.map((c) => ({ name: c.name, arguments: c.args as never })),\n streamed: merged.stream === true,\n streamId: dispatchStreamId,\n })\n } catch {\n /* observer errors are non-fatal */\n }\n }\n\n if (calls.length === 0) {\n helpers.log.trace({\n kind: 'converse-finish',\n message: `generation ended with stopReason=${stopReason ?? 'unknown'} and no tool use`,\n payload: { stopReason: stopReason ?? 'unknown' },\n })\n if (merged.autoAck) ctx.ack()\n return\n }\n\n for (const call of calls) {\n if (ctx.abortSignal.aborted) return\n // Resolve once at ingress; Converse sanitises only when rendering, so this preserves the\n // filtered id consistently for reporting, persistence, and any spool key.\n const callId = merged.toolCallIdFilter?.(call.id, ctx) ?? call.id\n const toolName = normalizeToolName(call.name)\n const tool = ctx.tools.get(toolName) as Tool | ArtifactTool | undefined\n const completedAt = nowIso()\n\n if (!isObject(call.args)) {\n const results = new Tokenizable(\n new E_CONVERSE_INVALID_TOOL_INPUT([JSON.stringify(call.args)]).message\n )\n helpers.reportToolCall(callId, { tool: toolName, args: {} })\n helpers.reportToolCall(callId, { results, isError: true, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: toolName,\n args: {},\n checksum: computeChecksum(toolName, {}),\n isComplete: true,\n isError: true,\n results,\n createdAt: completedAt,\n updatedAt: completedAt,\n completedAt,\n })\n )\n continue\n }\n\n if (!tool) {\n const available = ctx.tools\n .all()\n .map((t) => t.name)\n .sort()\n const results = new Tokenizable(\n available.length > 0\n ? `Tool not found: ${toolName}. Available tools: ${available.join(', ')}.`\n : `Tool not found: ${toolName}. No tools are available this turn.`\n )\n helpers.reportToolCall(callId, { tool: toolName, args: call.args })\n helpers.reportToolCall(callId, { results, isError: true, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: toolName,\n args: call.args,\n checksum: computeChecksum(toolName, call.args),\n isComplete: true,\n isError: true,\n results,\n createdAt: completedAt,\n updatedAt: completedAt,\n completedAt,\n })\n )\n continue\n }\n\n helpers.reportToolCall(callId, { tool: tool.name, args: call.args })\n let results: Tokenizable | SpooledArtifact | SpooledArtifact[] | Media | Media[] =\n new Tokenizable('')\n let isToolError = false\n try {\n const raw = await tool.executor(ctx)(call.args)\n results = Tokenizable.isTokenizable(raw)\n ? raw\n : new Tokenizable(typeof raw === 'string' ? raw : JSON.stringify(raw ?? ''))\n } catch (err) {\n isToolError = true\n results = new Tokenizable(isError(err) ? err.message : String(err))\n }\n const finishedAt = nowIso()\n helpers.reportToolCall(callId, { results, isError: isToolError, isComplete: true })\n await ctx.storeToolCall(\n new ToolCall({\n id: callId,\n tool: tool.name,\n args: call.args,\n checksum: computeChecksum(tool.name, call.args),\n isComplete: true,\n isError: isToolError,\n results,\n createdAt: finishedAt,\n updatedAt: finishedAt,\n completedAt: finishedAt,\n })\n )\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,IAAM,eAAuB,SAAS,IAAI,EAAE,MAAM,sBAAK,IAAI,KAAK,GAAE,YAAY;AAE9E,IAAM,iBAAiB;AAEvB,IAAM,mBAAmB,OACvB,OACA,aACoB,QAAQ,QAAQ,MAAM,eAAe,QAAyB,CAAC;AAErF,IAAM,mBAAmB,MAAc,SACrC,OAAO,GAAG,KAAK,GAAG,mBAAmB,IAAI,GAAG;;AAG9C,IAAM,gBACJ,GAAG,WACwC;CAC3C,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,CAAC,OAAO;EACZ,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,KAAK,GAAG,IAAI,MAAM,KAAA,GAAW,IAAI,KAAK;CAC5E;CACA,OAAO;AACT;;AAGA,IAAM,kBACJ,cAC2B;CAC3B,MAAM,MAAO,aAAa,CAAC;CAC3B,MAAM,QAAW,KAAa,aAAoB,IAAI,QAA0B;CAChF,OAAO;EACL,wCAAwC,KACtC,0CACA,sCACF;EACA,wBAAwB,KAAK,0BAA0B,sBAAsB;EAC7E,sBAAsB,KAAK,wBAAwB,oBAAoB;EACvE,4BAA4B,KAAK,8BAA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,MAAM,KAAK;MACX,UAAU,gBAAgB,UAAU,KAAK,IAAI;MAC7C,YAAY;MACZ,SAAS;MACT;MACA,WAAW;MACX,WAAW;MACX;KACF,CAAC,CACH;KACA;IACF;IAEA,QAAQ,eAAe,QAAQ;KAAE,MAAM,KAAK;KAAM,MAAM,KAAK;IAAK,CAAC;IACnE,IAAI,UACF,IAAI,YAAY,EAAE;IACpB,IAAI,cAAc;IAClB,IAAI;KACF,MAAM,MAAM,MAAM,KAAK,SAAS,GAAG,EAAE,KAAK,IAAI;KAC9C,UAAU,YAAY,cAAc,GAAG,IACnC,MACA,IAAI,YAAY,OAAO,QAAQ,WAAW,MAAM,KAAK,UAAU,OAAO,EAAE,CAAC;IAC/E,SAAS,KAAK;KACZ,cAAc;KACd,UAAU,IAAI,YAAY,QAAQ,GAAG,IAAI,IAAI,UAAU,OAAO,GAAG,CAAC;IACpE;IACA,MAAM,aAAa,OAAO;IAC1B,QAAQ,eAAe,QAAQ;KAAE;KAAS,SAAS;KAAa,YAAY;IAAK,CAAC;IAClF,MAAM,IAAI,cACR,IAAI,SAAS;KACX,IAAI;KACJ,MAAM,KAAK;KACX,MAAM,KAAK;KACX,UAAU,gBAAgB,KAAK,MAAM,KAAK,IAAI;KAC9C,YAAY;KACZ,SAAS;KACT;KACA,WAAW;KACX,WAAW;KACX,aAAa;IACf,CAAC,CACH;GACF;EACF;CACF;AACF"}
@@ -15,6 +15,8 @@ require("../../../factories.cjs");
15
15
  */
16
16
  /** Resolved options failed validation. */
17
17
  var E_INVALID_BEDROCK_CONVERSE_OPTIONS = require_exceptions.createException("E_INVALID_BEDROCK_CONVERSE_OPTIONS", "Invalid Bedrock Converse adapter options: %s", "E_INVALID_BEDROCK_CONVERSE_OPTIONS", 529, true);
18
+ /** Context token weight exceeded the configured window. */
19
+ var E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW = require_exceptions.createException("E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW", "Bedrock Converse request token weight (%d) exceeds context window (%d) under encoding %s", "E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW", 529, true);
18
20
  /** The provider returned a non-2xx status. */
19
21
  var E_CONVERSE_REQUEST_FAILED = require_exceptions.createException("E_CONVERSE_REQUEST_FAILED", "Bedrock Converse request failed with status %s: %s", "E_CONVERSE_REQUEST_FAILED", 502, false);
20
22
  /**
@@ -41,6 +43,7 @@ var E_CONVERSE_STREAM_ERROR = require_exceptions.createException("E_CONVERSE_STR
41
43
  /** A `toolUse` block carried an `input` value that is not a plain object. */
42
44
  var E_CONVERSE_INVALID_TOOL_INPUT = require_exceptions.createException("E_CONVERSE_INVALID_TOOL_INPUT", "Bedrock Converse toolUse input is not a plain object: %s", "E_CONVERSE_INVALID_TOOL_INPUT", 422, false);
43
45
  //#endregion
46
+ exports.E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW = E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW;
44
47
  exports.E_CONVERSE_ALTERNATION_VIOLATION = E_CONVERSE_ALTERNATION_VIOLATION;
45
48
  exports.E_CONVERSE_INVALID_TOOL_INPUT = E_CONVERSE_INVALID_TOOL_INPUT;
46
49
  exports.E_CONVERSE_MISSING_TOOL_CONFIG = E_CONVERSE_MISSING_TOOL_CONFIG;
@@ -1 +1 @@
1
- {"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/** 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,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"}
1
+ {"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"}
@@ -12,6 +12,12 @@
12
12
  export declare const E_INVALID_BEDROCK_CONVERSE_OPTIONS: import("../../../factories").CreatedException<[
13
13
  string
14
14
  ]>;
15
+ /** Context token weight exceeded the configured window. */
16
+ export declare const E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW: import("../../../factories").CreatedException<[
17
+ number,
18
+ number,
19
+ string
20
+ ]>;
15
21
  /** The provider returned a non-2xx status. */
16
22
  export declare const E_CONVERSE_REQUEST_FAILED: import("../../../factories").CreatedException<[
17
23
  number,
@@ -13,6 +13,8 @@ import "../../../factories.mjs";
13
13
  */
14
14
  /** Resolved options failed validation. */
15
15
  var E_INVALID_BEDROCK_CONVERSE_OPTIONS = createException("E_INVALID_BEDROCK_CONVERSE_OPTIONS", "Invalid Bedrock Converse adapter options: %s", "E_INVALID_BEDROCK_CONVERSE_OPTIONS", 529, true);
16
+ /** Context token weight exceeded the configured window. */
17
+ var E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW = createException("E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW", "Bedrock Converse request token weight (%d) exceeds context window (%d) under encoding %s", "E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW", 529, true);
16
18
  /** The provider returned a non-2xx status. */
17
19
  var E_CONVERSE_REQUEST_FAILED = createException("E_CONVERSE_REQUEST_FAILED", "Bedrock Converse request failed with status %s: %s", "E_CONVERSE_REQUEST_FAILED", 502, false);
18
20
  /**
@@ -39,6 +41,6 @@ var E_CONVERSE_STREAM_ERROR = createException("E_CONVERSE_STREAM_ERROR", "Bedroc
39
41
  /** A `toolUse` block carried an `input` value that is not a plain object. */
40
42
  var E_CONVERSE_INVALID_TOOL_INPUT = createException("E_CONVERSE_INVALID_TOOL_INPUT", "Bedrock Converse toolUse input is not a plain object: %s", "E_CONVERSE_INVALID_TOOL_INPUT", 422, false);
41
43
  //#endregion
42
- export { E_CONVERSE_ALTERNATION_VIOLATION, E_CONVERSE_INVALID_TOOL_INPUT, E_CONVERSE_MISSING_TOOL_CONFIG, E_CONVERSE_REQUEST_FAILED, E_CONVERSE_STREAM_ERROR, E_INVALID_BEDROCK_CONVERSE_OPTIONS };
44
+ export { E_BEDROCK_CONVERSE_CONTEXT_OVERFLOW, E_CONVERSE_ALTERNATION_VIOLATION, E_CONVERSE_INVALID_TOOL_INPUT, E_CONVERSE_MISSING_TOOL_CONFIG, E_CONVERSE_REQUEST_FAILED, E_CONVERSE_STREAM_ERROR, E_INVALID_BEDROCK_CONVERSE_OPTIONS };
43
45
 
44
46
  //# sourceMappingURL=exceptions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions.mjs","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/** 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,gBAChD,sCACA,gDACA,sCACA,KACA,IACF;;AAGA,IAAa,4BAA4B,gBACvC,6BACA,sDACA,6BACA,KACA,KACF;;;;;;;;;;AAWA,IAAa,iCAAiC,gBAC5C,kCACA,uFACA,kCACA,KACA,KACF;;;;;;;;;AAUA,IAAa,mCAAmC,gBAC9C,oCACA,uDACA,oCACA,KACA,KACF;;AAGA,IAAa,0BAA0B,gBACrC,2BACA,qCACA,2BACA,KACA,KACF;;AAGA,IAAa,gCAAgC,gBAC3C,iCACA,4DACA,iCACA,KACA,KACF"}
1
+ {"version":3,"file":"exceptions.mjs","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,gBAChD,sCACA,gDACA,sCACA,KACA,IACF;;AAGA,IAAa,sCAAsC,gBACjD,uCACA,4FACA,uCACA,KACA,IACF;;AAGA,IAAa,4BAA4B,gBACvC,6BACA,sDACA,6BACA,KACA,KACF;;;;;;;;;;AAWA,IAAa,iCAAiC,gBAC5C,kCACA,uFACA,kCACA,KACA,KACF;;;;;;;;;AAUA,IAAa,mCAAmC,gBAC9C,oCACA,uDACA,oCACA,KACA,KACF;;AAGA,IAAa,0BAA0B,gBACrC,2BACA,qCACA,2BACA,KACA,KACF;;AAGA,IAAa,gCAAgC,gBAC3C,iCACA,4DACA,iCACA,KACA,KACF"}
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../../chunk-Cek0wNdY.js");
3
3
  const require_guards = require("../../../guards-05Uq3J4M.js");
4
4
  require("../../../guards.cjs");
5
- const require_helpers = require("../../../helpers-Tvvwpx1M.js");
5
+ const require_helpers = require("../../../helpers-CEjjkXso.js");
6
6
  //#region src/batteries/llm/bedrock_converse/helpers.ts
7
7
  /**
8
8
  * Translation helpers for the native Bedrock Converse battery.
@@ -1,6 +1,6 @@
1
1
  import { r as isObject } from "../../../guards-BEpY7lBI.mjs";
2
2
  import "../../../guards.mjs";
3
- import { A as renderMemories, C as looksLikeSpooledArtifact, D as renderArtifactHandleBody, E as normalizeToolName, F as renderThirdPartyPrivateRetrievables, I as renderThirdPartyPublicRetrievables, L as renderThought, M as renderRetrievableSafetyDirective, N as renderRetrievables, O as renderChatCompletionsSystemPrompt, P as renderStandingInstructions, R as renderTrustedContent, T as neutraliseDeveloperRulesTag, _ as defaultRenderUntrustedContent, a as defaultRenderArtifactHandleBody, c as defaultRenderMemories, d as defaultRenderRetrievables, f as defaultRenderStandingInstructions, g as defaultRenderTrustedContent, h as defaultRenderThought, i as defaultFilterThoughts, j as renderRetrievableHandleBody, k as renderFirstPartyRetrievables, l as defaultRenderRetrievableHandleBody, m as defaultRenderThirdPartyPublicRetrievables, o as defaultRenderChatCompletionsSystemPrompt, p as defaultRenderThirdPartyPrivateRetrievables, r as defaultDescriptionToChatCompletionsJsonSchema, s as defaultRenderFirstPartyRetrievables, u as defaultRenderRetrievableSafetyDirective, x as filterThoughts, y as descriptionToChatCompletionsJsonSchema, z as renderUntrustedContent } from "../../../helpers-CDmLDBq5.mjs";
3
+ import { A as renderMemories, C as looksLikeSpooledArtifact, D as renderArtifactHandleBody, E as normalizeToolName, F as renderThirdPartyPrivateRetrievables, I as renderThirdPartyPublicRetrievables, L as renderThought, M as renderRetrievableSafetyDirective, N as renderRetrievables, O as renderChatCompletionsSystemPrompt, P as renderStandingInstructions, R as renderTrustedContent, T as neutraliseDeveloperRulesTag, _ as defaultRenderUntrustedContent, a as defaultRenderArtifactHandleBody, c as defaultRenderMemories, d as defaultRenderRetrievables, f as defaultRenderStandingInstructions, g as defaultRenderTrustedContent, h as defaultRenderThought, i as defaultFilterThoughts, j as renderRetrievableHandleBody, k as renderFirstPartyRetrievables, l as defaultRenderRetrievableHandleBody, m as defaultRenderThirdPartyPublicRetrievables, o as defaultRenderChatCompletionsSystemPrompt, p as defaultRenderThirdPartyPrivateRetrievables, r as defaultDescriptionToChatCompletionsJsonSchema, s as defaultRenderFirstPartyRetrievables, u as defaultRenderRetrievableSafetyDirective, x as filterThoughts, y as descriptionToChatCompletionsJsonSchema, z as renderUntrustedContent } from "../../../helpers-BH7HTtkD.mjs";
4
4
  //#region src/batteries/llm/bedrock_converse/helpers.ts
5
5
  /**
6
6
  * Translation helpers for the native Bedrock Converse battery.
@@ -24,7 +24,7 @@
24
24
  * `bedrock-runtime.<region>.amazonaws.com`, so no SigV4 signer or AWS SDK dependency is required —
25
25
  * deliberately, since this battery must stay cross-environment and dependency-light.
26
26
  */
27
- import type { TokenEncoding } from "../../../common";
27
+ import type { TokenEncodingId } from "../../../types";
28
28
  import type { DispatchContext } from "../../../types";
29
29
  import type { SpooledArtifact, Media, SpoolStore } from "../../../common";
30
30
  import type { ToolCallParserName, ToolCallParserFn } from "../chat_common/tool_parsers";
@@ -305,7 +305,11 @@ export interface BedrockConverseAdapterOptions {
305
305
  /** Injectable `fetch`, for tests or a custom transport. */
306
306
  fetch?: typeof globalThis.fetch;
307
307
  /** Encoding used for token accounting. */
308
- tokenEncoding?: TokenEncoding;
308
+ tokenEncoding?: TokenEncodingId | null;
309
+ /** Maximum token weight allowed for the assembled context. */
310
+ contextWindow?: number;
311
+ /** Whether to acknowledge tool-call-free generations; defaults to true. */
312
+ autoAck?: boolean;
309
313
  /** Spool store backing artifact-handle results. */
310
314
  spoolStore?: SpoolStore;
311
315
  /** Order of context buckets in the system blocks. */
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../../chunk-Cek0wNdY.js");
3
+ const require_tokenizable = require("../../../tokenizable-BMZuGWRd.js");
4
+ require("../../../common-H44Ik9ou.js");
3
5
  const require_batteries_llm_bedrock_converse_exceptions = require("./exceptions.cjs");
4
6
  let _nhtio_validation = require("@nhtio/validation");
5
7
  //#region src/batteries/llm/bedrock_converse/validation.ts
@@ -9,12 +11,16 @@ let _nhtio_validation = require("@nhtio/validation");
9
11
  * @module @nhtio/adk/batteries/llm/bedrock_converse/validation
10
12
  */
11
13
  /** Schema for {@link BedrockConverseAdapterOptions}. */
14
+ var tokenEncodingSchema = _nhtio_validation.validator.alternatives(_nhtio_validation.validator.string().min(1).description(`Known encodings: ${require_tokenizable.TokenEncoding.join(", ")}`), _nhtio_validation.validator.any().valid(null).optional()).default(null);
15
+ /** Schema for {@link BedrockConverseAdapterOptions}. */
12
16
  var bedrockConverseOptionsSchema = _nhtio_validation.validator.object({
13
17
  model: _nhtio_validation.validator.string().min(1).required(),
14
18
  apiKey: _nhtio_validation.validator.string().optional(),
15
19
  region: _nhtio_validation.validator.string().optional(),
16
20
  baseURL: _nhtio_validation.validator.string().optional(),
17
21
  stream: _nhtio_validation.validator.boolean().optional(),
22
+ contextWindow: _nhtio_validation.validator.number().integer().min(1).optional(),
23
+ autoAck: _nhtio_validation.validator.boolean().default(true),
18
24
  maxTokens: _nhtio_validation.validator.number().integer().positive().optional(),
19
25
  temperature: _nhtio_validation.validator.number().min(0).max(1).optional(),
20
26
  topP: _nhtio_validation.validator.number().min(0).max(1).optional(),
@@ -31,7 +37,7 @@ var bedrockConverseOptionsSchema = _nhtio_validation.validator.object({
31
37
  honorRetryAfter: _nhtio_validation.validator.boolean().optional()
32
38
  }).optional(),
33
39
  fetch: _nhtio_validation.validator.function().optional(),
34
- tokenEncoding: _nhtio_validation.validator.any().optional(),
40
+ tokenEncoding: tokenEncodingSchema,
35
41
  spoolStore: _nhtio_validation.validator.any().optional(),
36
42
  bucketOrder: _nhtio_validation.validator.any().optional(),
37
43
  thoughtSurfacing: _nhtio_validation.validator.string().valid("all-self", "latest-self", "all").optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"validation.cjs","names":[],"sources":["../../../../src/batteries/llm/bedrock_converse/validation.ts"],"sourcesContent":["/**\n * Runtime option validation for the native Bedrock Converse battery.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/validation\n */\n\nimport { validator } from '@nhtio/validation'\nimport { E_INVALID_BEDROCK_CONVERSE_OPTIONS } from './exceptions'\nimport type { BedrockConverseAdapterOptions } from './types'\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nexport const bedrockConverseOptionsSchema = validator.object({\n model: validator.string().min(1).required(),\n apiKey: validator.string().optional(),\n region: validator.string().optional(),\n baseURL: validator.string().optional(),\n stream: validator.boolean().optional(),\n maxTokens: validator.number().integer().positive().optional(),\n temperature: validator.number().min(0).max(1).optional(),\n topP: validator.number().min(0).max(1).optional(),\n stopSequences: validator.array().items(validator.string()).optional(),\n toolChoice: validator.object().unknown(true).optional(),\n additionalModelRequestFields: validator.object().unknown(true).optional(),\n alternationPolicy: validator.string().valid('merge', 'filler', 'reject').optional(),\n timeoutMs: validator.number().integer().positive().optional(),\n retry: validator\n .object({\n maxAttempts: validator.number().integer().positive().optional(),\n baseDelayMs: validator.number().integer().positive().optional(),\n maxDelayMs: validator.number().integer().positive().optional(),\n retriableStatuses: validator.array().items(validator.number()).optional(),\n honorRetryAfter: validator.boolean().optional(),\n })\n .optional(),\n fetch: validator.function().optional(),\n tokenEncoding: validator.any().optional(),\n spoolStore: validator.any().optional(),\n bucketOrder: validator.any().optional(),\n thoughtSurfacing: validator.string().valid('all-self', 'latest-self', 'all').optional(),\n unsupportedMediaPolicy: validator.string().optional(),\n localToolCallParser: validator.any().optional(),\n toolCallIdFilter: validator.function().optional(),\n onRawGeneration: validator.function().optional(),\n onPromptAssembled: validator.function().optional(),\n helpers: validator.object().unknown(true).optional(),\n forgeToolsFilter: validator.function().optional(),\n})\n\n/**\n * Validate and normalise adapter options.\n *\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when validation fails.\n */\nexport const validateOptions = (input: unknown): BedrockConverseAdapterOptions => {\n const { error, value } = bedrockConverseOptionsSchema.validate(input, {\n allowUnknown: false,\n stripUnknown: false,\n })\n if (error) {\n throw new E_INVALID_BEDROCK_CONVERSE_OPTIONS([\n error.details.map((detail: { message: string }) => detail.message).join(' '),\n ])\n }\n return value as BedrockConverseAdapterOptions\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,+BAA+B,kBAAA,UAAU,OAAO;CAC3D,OAAO,kBAAA,UAAU,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;CAC1C,QAAQ,kBAAA,UAAU,OAAO,EAAE,SAAS;CACpC,QAAQ,kBAAA,UAAU,OAAO,EAAE,SAAS;CACpC,SAAS,kBAAA,UAAU,OAAO,EAAE,SAAS;CACrC,QAAQ,kBAAA,UAAU,QAAQ,EAAE,SAAS;CACrC,WAAW,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A,UAAU,OAAO,EAAE,SAAS;CACpD,qBAAqB,kBAAA,UAAU,IAAI,EAAE,SAAS;CAC9C,kBAAkB,kBAAA,UAAU,SAAS,EAAE,SAAS;CAChD,iBAAiB,kBAAA,UAAU,SAAS,EAAE,SAAS;CAC/C,mBAAmB,kBAAA,UAAU,SAAS,EAAE,SAAS;CACjD,SAAS,kBAAA,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CACnD,kBAAkB,kBAAA,UAAU,SAAS,EAAE,SAAS;AAClD,CAAC;;;;;;AAOD,IAAa,mBAAmB,UAAkD;CAChF,MAAM,EAAE,OAAO,UAAU,6BAA6B,SAAS,OAAO;EACpE,cAAc;EACd,cAAc;CAChB,CAAC;CACD,IAAI,OACF,MAAM,IAAI,kDAAA,mCAAmC,CAC3C,MAAM,QAAQ,KAAK,WAAgC,OAAO,OAAO,EAAE,KAAK,GAAG,CAC7E,CAAC;CAEH,OAAO;AACT"}
1
+ {"version":3,"file":"validation.cjs","names":[],"sources":["../../../../src/batteries/llm/bedrock_converse/validation.ts"],"sourcesContent":["/**\n * Runtime option validation for the native Bedrock Converse battery.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/validation\n */\n\nimport { validator } from '@nhtio/validation'\nimport { TokenEncoding } from '@nhtio/adk/common'\nimport { E_INVALID_BEDROCK_CONVERSE_OPTIONS } from './exceptions'\nimport type { BedrockConverseAdapterOptions } from './types'\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nconst tokenEncodingSchema = validator\n .alternatives(\n // Known values are suggestions from the canonical list, not a whitelist: consumers may provide\n // a custom or newer tokenizer name. The field accepts any non-empty string, explicit null, or\n // absent (undefined = \"no token counting\"). `.optional()` preserves the null/undefined\n // disposition required by adk/require-validator-any-required.\n validator\n .string()\n .min(1)\n .description(`Known encodings: ${TokenEncoding.join(', ')}`),\n validator.any().valid(null).optional()\n )\n .default(null)\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nexport const bedrockConverseOptionsSchema = validator.object({\n model: validator.string().min(1).required(),\n apiKey: validator.string().optional(),\n region: validator.string().optional(),\n baseURL: validator.string().optional(),\n stream: validator.boolean().optional(),\n contextWindow: validator.number().integer().min(1).optional(),\n autoAck: validator.boolean().default(true),\n maxTokens: validator.number().integer().positive().optional(),\n temperature: validator.number().min(0).max(1).optional(),\n topP: validator.number().min(0).max(1).optional(),\n stopSequences: validator.array().items(validator.string()).optional(),\n toolChoice: validator.object().unknown(true).optional(),\n additionalModelRequestFields: validator.object().unknown(true).optional(),\n alternationPolicy: validator.string().valid('merge', 'filler', 'reject').optional(),\n timeoutMs: validator.number().integer().positive().optional(),\n retry: validator\n .object({\n maxAttempts: validator.number().integer().positive().optional(),\n baseDelayMs: validator.number().integer().positive().optional(),\n maxDelayMs: validator.number().integer().positive().optional(),\n retriableStatuses: validator.array().items(validator.number()).optional(),\n honorRetryAfter: validator.boolean().optional(),\n })\n .optional(),\n fetch: validator.function().optional(),\n tokenEncoding: tokenEncodingSchema,\n spoolStore: validator.any().optional(),\n bucketOrder: validator.any().optional(),\n thoughtSurfacing: validator.string().valid('all-self', 'latest-self', 'all').optional(),\n unsupportedMediaPolicy: validator.string().optional(),\n localToolCallParser: validator.any().optional(),\n toolCallIdFilter: validator.function().optional(),\n onRawGeneration: validator.function().optional(),\n onPromptAssembled: validator.function().optional(),\n helpers: validator.object().unknown(true).optional(),\n forgeToolsFilter: validator.function().optional(),\n})\n\n/**\n * Validate and normalise adapter options.\n *\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when validation fails.\n */\nexport const validateOptions = (input: unknown): BedrockConverseAdapterOptions => {\n const { error, value } = bedrockConverseOptionsSchema.validate(input, {\n allowUnknown: false,\n stripUnknown: false,\n })\n if (error) {\n throw new E_INVALID_BEDROCK_CONVERSE_OPTIONS([\n error.details.map((detail: { message: string }) => detail.message).join(' '),\n ])\n }\n return value as BedrockConverseAdapterOptions\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAM,sB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F.mjs";
2
+ import "../../../common-BpdHIpQE.mjs";
1
3
  import { E_INVALID_BEDROCK_CONVERSE_OPTIONS } from "./exceptions.mjs";
2
4
  import { validator } from "@nhtio/validation";
3
5
  //#region src/batteries/llm/bedrock_converse/validation.ts
@@ -7,12 +9,16 @@ import { validator } from "@nhtio/validation";
7
9
  * @module @nhtio/adk/batteries/llm/bedrock_converse/validation
8
10
  */
9
11
  /** Schema for {@link BedrockConverseAdapterOptions}. */
12
+ var tokenEncodingSchema = validator.alternatives(validator.string().min(1).description(`Known encodings: ${TokenEncoding.join(", ")}`), validator.any().valid(null).optional()).default(null);
13
+ /** Schema for {@link BedrockConverseAdapterOptions}. */
10
14
  var bedrockConverseOptionsSchema = validator.object({
11
15
  model: validator.string().min(1).required(),
12
16
  apiKey: validator.string().optional(),
13
17
  region: validator.string().optional(),
14
18
  baseURL: validator.string().optional(),
15
19
  stream: validator.boolean().optional(),
20
+ contextWindow: validator.number().integer().min(1).optional(),
21
+ autoAck: validator.boolean().default(true),
16
22
  maxTokens: validator.number().integer().positive().optional(),
17
23
  temperature: validator.number().min(0).max(1).optional(),
18
24
  topP: validator.number().min(0).max(1).optional(),
@@ -29,7 +35,7 @@ var bedrockConverseOptionsSchema = validator.object({
29
35
  honorRetryAfter: validator.boolean().optional()
30
36
  }).optional(),
31
37
  fetch: validator.function().optional(),
32
- tokenEncoding: validator.any().optional(),
38
+ tokenEncoding: tokenEncodingSchema,
33
39
  spoolStore: validator.any().optional(),
34
40
  bucketOrder: validator.any().optional(),
35
41
  thoughtSurfacing: validator.string().valid("all-self", "latest-self", "all").optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"validation.mjs","names":[],"sources":["../../../../src/batteries/llm/bedrock_converse/validation.ts"],"sourcesContent":["/**\n * Runtime option validation for the native Bedrock Converse battery.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/validation\n */\n\nimport { validator } from '@nhtio/validation'\nimport { E_INVALID_BEDROCK_CONVERSE_OPTIONS } from './exceptions'\nimport type { BedrockConverseAdapterOptions } from './types'\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nexport const bedrockConverseOptionsSchema = validator.object({\n model: validator.string().min(1).required(),\n apiKey: validator.string().optional(),\n region: validator.string().optional(),\n baseURL: validator.string().optional(),\n stream: validator.boolean().optional(),\n maxTokens: validator.number().integer().positive().optional(),\n temperature: validator.number().min(0).max(1).optional(),\n topP: validator.number().min(0).max(1).optional(),\n stopSequences: validator.array().items(validator.string()).optional(),\n toolChoice: validator.object().unknown(true).optional(),\n additionalModelRequestFields: validator.object().unknown(true).optional(),\n alternationPolicy: validator.string().valid('merge', 'filler', 'reject').optional(),\n timeoutMs: validator.number().integer().positive().optional(),\n retry: validator\n .object({\n maxAttempts: validator.number().integer().positive().optional(),\n baseDelayMs: validator.number().integer().positive().optional(),\n maxDelayMs: validator.number().integer().positive().optional(),\n retriableStatuses: validator.array().items(validator.number()).optional(),\n honorRetryAfter: validator.boolean().optional(),\n })\n .optional(),\n fetch: validator.function().optional(),\n tokenEncoding: validator.any().optional(),\n spoolStore: validator.any().optional(),\n bucketOrder: validator.any().optional(),\n thoughtSurfacing: validator.string().valid('all-self', 'latest-self', 'all').optional(),\n unsupportedMediaPolicy: validator.string().optional(),\n localToolCallParser: validator.any().optional(),\n toolCallIdFilter: validator.function().optional(),\n onRawGeneration: validator.function().optional(),\n onPromptAssembled: validator.function().optional(),\n helpers: validator.object().unknown(true).optional(),\n forgeToolsFilter: validator.function().optional(),\n})\n\n/**\n * Validate and normalise adapter options.\n *\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when validation fails.\n */\nexport const validateOptions = (input: unknown): BedrockConverseAdapterOptions => {\n const { error, value } = bedrockConverseOptionsSchema.validate(input, {\n allowUnknown: false,\n stripUnknown: false,\n })\n if (error) {\n throw new E_INVALID_BEDROCK_CONVERSE_OPTIONS([\n error.details.map((detail: { message: string }) => detail.message).join(' '),\n ])\n }\n return value as BedrockConverseAdapterOptions\n}\n"],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Aa,UAAU,IAAI,EAAE,SAAS;CACtC,kBAAkB,UAAU,OAAO,EAAE,MAAM,YAAY,eAAe,KAAK,EAAE,SAAS;CACtF,wBAAwB,UAAU,OAAO,EAAE,SAAS;CACpD,qBAAqB,UAAU,IAAI,EAAE,SAAS;CAC9C,kBAAkB,UAAU,SAAS,EAAE,SAAS;CAChD,iBAAiB,UAAU,SAAS,EAAE,SAAS;CAC/C,mBAAmB,UAAU,SAAS,EAAE,SAAS;CACjD,SAAS,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CACnD,kBAAkB,UAAU,SAAS,EAAE,SAAS;AAClD,CAAC;;;;;;AAOD,IAAa,mBAAmB,UAAkD;CAChF,MAAM,EAAE,OAAO,UAAU,6BAA6B,SAAS,OAAO;EACpE,cAAc;EACd,cAAc;CAChB,CAAC;CACD,IAAI,OACF,MAAM,IAAI,mCAAmC,CAC3C,MAAM,QAAQ,KAAK,WAAgC,OAAO,OAAO,EAAE,KAAK,GAAG,CAC7E,CAAC;CAEH,OAAO;AACT"}
1
+ {"version":3,"file":"validation.mjs","names":[],"sources":["../../../../src/batteries/llm/bedrock_converse/validation.ts"],"sourcesContent":["/**\n * Runtime option validation for the native Bedrock Converse battery.\n *\n * @module @nhtio/adk/batteries/llm/bedrock_converse/validation\n */\n\nimport { validator } from '@nhtio/validation'\nimport { TokenEncoding } from '@nhtio/adk/common'\nimport { E_INVALID_BEDROCK_CONVERSE_OPTIONS } from './exceptions'\nimport type { BedrockConverseAdapterOptions } from './types'\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nconst tokenEncodingSchema = validator\n .alternatives(\n // Known values are suggestions from the canonical list, not a whitelist: consumers may provide\n // a custom or newer tokenizer name. The field accepts any non-empty string, explicit null, or\n // absent (undefined = \"no token counting\"). `.optional()` preserves the null/undefined\n // disposition required by adk/require-validator-any-required.\n validator\n .string()\n .min(1)\n .description(`Known encodings: ${TokenEncoding.join(', ')}`),\n validator.any().valid(null).optional()\n )\n .default(null)\n\n/** Schema for {@link BedrockConverseAdapterOptions}. */\nexport const bedrockConverseOptionsSchema = validator.object({\n model: validator.string().min(1).required(),\n apiKey: validator.string().optional(),\n region: validator.string().optional(),\n baseURL: validator.string().optional(),\n stream: validator.boolean().optional(),\n contextWindow: validator.number().integer().min(1).optional(),\n autoAck: validator.boolean().default(true),\n maxTokens: validator.number().integer().positive().optional(),\n temperature: validator.number().min(0).max(1).optional(),\n topP: validator.number().min(0).max(1).optional(),\n stopSequences: validator.array().items(validator.string()).optional(),\n toolChoice: validator.object().unknown(true).optional(),\n additionalModelRequestFields: validator.object().unknown(true).optional(),\n alternationPolicy: validator.string().valid('merge', 'filler', 'reject').optional(),\n timeoutMs: validator.number().integer().positive().optional(),\n retry: validator\n .object({\n maxAttempts: validator.number().integer().positive().optional(),\n baseDelayMs: validator.number().integer().positive().optional(),\n maxDelayMs: validator.number().integer().positive().optional(),\n retriableStatuses: validator.array().items(validator.number()).optional(),\n honorRetryAfter: validator.boolean().optional(),\n })\n .optional(),\n fetch: validator.function().optional(),\n tokenEncoding: tokenEncodingSchema,\n spoolStore: validator.any().optional(),\n bucketOrder: validator.any().optional(),\n thoughtSurfacing: validator.string().valid('all-self', 'latest-self', 'all').optional(),\n unsupportedMediaPolicy: validator.string().optional(),\n localToolCallParser: validator.any().optional(),\n toolCallIdFilter: validator.function().optional(),\n onRawGeneration: validator.function().optional(),\n onPromptAssembled: validator.function().optional(),\n helpers: validator.object().unknown(true).optional(),\n forgeToolsFilter: validator.function().optional(),\n})\n\n/**\n * Validate and normalise adapter options.\n *\n * @throws {@link E_INVALID_BEDROCK_CONVERSE_OPTIONS} when validation fails.\n */\nexport const validateOptions = (input: unknown): BedrockConverseAdapterOptions => {\n const { error, value } = bedrockConverseOptionsSchema.validate(input, {\n allowUnknown: false,\n stripUnknown: false,\n })\n if (error) {\n throw new E_INVALID_BEDROCK_CONVERSE_OPTIONS([\n error.details.map((detail: { message: string }) => detail.message).join(' '),\n ])\n }\n return value as Bedr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AS;EAC9D,YAAY,UAAU,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS;EAC7D,mBAAmB,UAAU,MAAM,EAAE,MAAM,UAAU,OAAO,CAAC,EAAE,SAAS;EACxE,iBAAiB,UAAU,QAAQ,EAAE,SAAS;CAChD,CAAC,EACA,SAAS;CACZ,OAAO,UAAU,SAAS,EAAE,SAAS;CACrC,eAAe;CACf,YAAY,UAAU,IAAI,EAAE,SAAS;CACrC,aAAa,UAAU,IAAI,EAAE,SAAS;CACtC,kBAAkB,UAAU,OAAO,EAAE,MAAM,YAAY,eAAe,KAAK,EAAE,SAAS;CACtF,wBAAwB,UAAU,OAAO,EAAE,SAAS;CACpD,qBAAqB,UAAU,IAAI,EAAE,SAAS;CAC9C,kBAAkB,UAAU,SAAS,EAAE,SAAS;CAChD,iBAAiB,UAAU,SAAS,EAAE,SAAS;CAC/C,mBAAmB,UAAU,SAAS,EAAE,SAAS;CACjD,SAAS,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CACnD,kBAAkB,UAAU,SAAS,EAAE,SAAS;AAClD,CAAC;;;;;;AAOD,IAAa,mBAAmB,UAAkD;CAChF,MAAM,EAAE,OAAO,UAAU,6BAA6B,SAAS,OAAO;EACpE,cAAc;EACd,cAAc;CAChB,CAAC;CACD,IAAI,OACF,MAAM,IAAI,mCAAmC,CAC3C,MAAM,QAAQ,KAAK,WAAgC,OAAO,OAAO,EAAE,KAAK,GAAG,CAC7E,CAAC;CAEH,OAAO;AACT"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_helpers = require("../../helpers-Tvvwpx1M.js");
4
- const require_chat_common = require("../../chat_common-B3O3zz-i.js");
3
+ const require_helpers = require("../../helpers-CEjjkXso.js");
4
+ const require_chat_common = require("../../chat_common-Dpan9moo.js");
5
5
  const require_batteries_llm_bedrock_converse_exceptions = require("./bedrock_converse/exceptions.cjs");
6
6
  const require_batteries_llm_bedrock_converse_validation = require("./bedrock_converse/validation.cjs");
7
7
  const require_batteries_llm_bedrock_converse_helpers = require("./bedrock_converse/helpers.cjs");
@@ -1,5 +1,5 @@
1
- import { A as renderMemories, D as renderArtifactHandleBody, F as renderThirdPartyPrivateRetrievables, I as renderThirdPartyPublicRetrievables, L as renderThought, M as renderRetrievableSafetyDirective, N as renderRetrievables, O as renderChatCompletionsSystemPrompt, P as renderStandingInstructions, R as renderTrustedContent, _ as defaultRenderUntrustedContent, a as defaultRenderArtifactHandleBody, c as defaultRenderMemories, d as defaultRenderRetrievables, f as defaultRenderStandingInstructions, g as defaultRenderTrustedContent, h as defaultRenderThought, i as defaultFilterThoughts, j as renderRetrievableHandleBody, k as renderFirstPartyRetrievables, l as defaultRenderRetrievableHandleBody, m as defaultRenderThirdPartyPublicRetrievables, o as defaultRenderChatCompletionsSystemPrompt, p as defaultRenderThirdPartyPrivateRetrievables, r as defaultDescriptionToChatCompletionsJsonSchema, s as defaultRenderFirstPartyRetrievables, u as defaultRenderRetrievableSafetyDirective, x as filterThoughts, y as descriptionToChatCompletionsJsonSchema, z as renderUntrustedContent } from "../../helpers-CDmLDBq5.mjs";
2
- import { t as deCollideToolCallIds } from "../../chat_common-DbbIESdo.mjs";
1
+ import { A as renderMemories, D as renderArtifactHandleBody, F as renderThirdPartyPrivateRetrievables, I as renderThirdPartyPublicRetrievables, L as renderThought, M as renderRetrievableSafetyDirective, N as renderRetrievables, O as renderChatCompletionsSystemPrompt, P as renderStandingInstructions, R as renderTrustedContent, _ as defaultRenderUntrustedContent, a as defaultRenderArtifactHandleBody, c as defaultRenderMemories, d as defaultRenderRetrievables, f as defaultRenderStandingInstructions, g as defaultRenderTrustedContent, h as defaultRenderThought, i as defaultFilterThoughts, j as renderRetrievableHandleBody, k as renderFirstPartyRetrievables, l as defaultRenderRetrievableHandleBody, m as defaultRenderThirdPartyPublicRetrievables, o as defaultRenderChatCompletionsSystemPrompt, p as defaultRenderThirdPartyPrivateRetrievables, r as defaultDescriptionToChatCompletionsJsonSchema, s as defaultRenderFirstPartyRetrievables, u as defaultRenderRetrievableSafetyDirective, x as filterThoughts, y as descriptionToChatCompletionsJsonSchema, z as renderUntrustedContent } from "../../helpers-BH7HTtkD.mjs";
2
+ import { t as deCollideToolCallIds } from "../../chat_common-CmKV5Dz4.mjs";
3
3
  import { E_CONVERSE_ALTERNATION_VIOLATION, E_CONVERSE_INVALID_TOOL_INPUT, E_CONVERSE_MISSING_TOOL_CONFIG, E_CONVERSE_REQUEST_FAILED, E_CONVERSE_STREAM_ERROR, E_INVALID_BEDROCK_CONVERSE_OPTIONS } from "./bedrock_converse/exceptions.mjs";
4
4
  import { bedrockConverseOptionsSchema, validateOptions } from "./bedrock_converse/validation.mjs";
5
5
  import { DEFAULT_CONVERSE_BUCKET_ORDER, buildConverseRequest, defaultBuildConverseRequest, defaultEnforceConverseAlternation, defaultExtractConverseGeneration, defaultMediaToConverseImage, defaultRenderConverseToolResult, defaultSanitizeConverseSchema, defaultSanitizeToolUseId, defaultToolsToConverseTools, enforceConverseAlternation, extractConverseGeneration, mediaToConverseImage, renderConverseToolResult, sanitizeConverseSchema, sanitizeToolUseId, toolsToConverseTools } from "./bedrock_converse/helpers.mjs";
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../../chunk-Cek0wNdY.js");
3
3
  const require_guards = require("../../../guards-05Uq3J4M.js");
4
- const require_tokenizable = require("../../../tokenizable-CWW7iSrD.js");
5
- const require_spooled_artifact = require("../../../spooled_artifact-DriNQRj7.js");
6
- const require_thought = require("../../../thought--fRgOwTP.js");
7
- const require_tool_call = require("../../../tool_call-DgqVwL5n.js");
8
- require("../../../common-BV3HGeLj.js");
4
+ const require_tokenizable = require("../../../tokenizable-BMZuGWRd.js");
5
+ const require_spooled_artifact = require("../../../spooled_artifact-BpcesRBv.js");
6
+ const require_thought = require("../../../thought-bS7O9O5H.js");
7
+ const require_tool_call = require("../../../tool_call-Fs_Uh5wQ.js");
8
+ require("../../../common-H44Ik9ou.js");
9
9
  require("../../../guards.cjs");
10
10
  const require_batteries_storage_in_memory = require("../../storage/in_memory.cjs");
11
- const require_helpers = require("../../../helpers-Tvvwpx1M.js");
11
+ const require_helpers = require("../../../helpers-CEjjkXso.js");
12
12
  const require_batteries_llm_claude_code_cli_exceptions = require("./exceptions.cjs");
13
13
  const require_batteries_llm_claude_code_cli_validation = require("./validation.cjs");
14
14
  const require_batteries_llm_claude_code_cli_wire = require("./wire.cjs");