@daniel156161/prism 0.2.59 → 0.2.76

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 (1292) hide show
  1. package/README.md +26 -0
  2. package/dist/cli.js +0 -0
  3. package/dist/pi/pi-env.d.ts +1 -1
  4. package/dist/pi/pi-env.js +1 -1
  5. package/dist/pi/pi-extensions.js +2 -0
  6. package/dist/pi/pi-extensions.js.map +1 -1
  7. package/dist/pi/pi-patch-extension-loader.js +1 -0
  8. package/dist/pi/pi-patch-extension-loader.js.map +1 -1
  9. package/dist/pi/pi-patch-interactive.d.ts +1 -0
  10. package/dist/pi/pi-patch-interactive.js +11 -2
  11. package/dist/pi/pi-patch-interactive.js.map +1 -1
  12. package/dist/prism-extensions/integrations/ai-memory-system.d.ts +7 -0
  13. package/dist/prism-extensions/integrations/ai-memory-system.js +316 -0
  14. package/dist/prism-extensions/integrations/ai-memory-system.js.map +1 -0
  15. package/dist/prism-extensions/integrations/obsidian-formatting.d.ts +3 -0
  16. package/dist/prism-extensions/integrations/obsidian-formatting.js +53 -0
  17. package/dist/prism-extensions/integrations/obsidian-formatting.js.map +1 -0
  18. package/dist/prism-extensions/integrations/obsidian-memory.d.ts +3 -1
  19. package/dist/prism-extensions/integrations/obsidian-memory.js +102 -49
  20. package/dist/prism-extensions/integrations/obsidian-memory.js.map +1 -1
  21. package/dist/prism-extensions/providers/manifest-provider.d.ts +1 -0
  22. package/dist/prism-extensions/providers/manifest-provider.js +29 -2
  23. package/dist/prism-extensions/providers/manifest-provider.js.map +1 -1
  24. package/dist/prism-extensions/tools/builtin-tools.js +2 -157
  25. package/dist/prism-extensions/tools/builtin-tools.js.map +1 -1
  26. package/dist/prism-extensions/tools/prism-diagnostic-tools.d.ts +2 -0
  27. package/dist/prism-extensions/tools/prism-diagnostic-tools.js +155 -0
  28. package/dist/prism-extensions/tools/prism-diagnostic-tools.js.map +1 -0
  29. package/dist/prism-extensions/tools/toolbox.d.ts +1 -0
  30. package/dist/prism-extensions/tools/toolbox.js +81 -3
  31. package/dist/prism-extensions/tools/toolbox.js.map +1 -1
  32. package/dist/prism-extensions/ui/toolbar.js +33 -16
  33. package/dist/prism-extensions/ui/toolbar.js.map +1 -1
  34. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  35. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
  36. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  37. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/compile/validator.d.mts +3 -11
  38. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/compile/validator.mjs +6 -36
  39. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/error/errors.d.mts +1 -7
  40. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/_idna.mjs +36 -6
  41. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/_puny.mjs +4 -1
  42. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/uuid.d.mts +2 -2
  43. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/uuid.mjs +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/emit.d.mts +0 -4
  45. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/emit.mjs +0 -8
  46. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/guard.d.mts +5 -9
  47. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/guard.mjs +10 -15
  48. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/string.mjs +16 -4
  49. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  50. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  51. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  52. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  53. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  54. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  55. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  56. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  57. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  58. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/index.mjs +0 -1
  59. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  60. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  61. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  62. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  63. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  64. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  65. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  66. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  67. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  68. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  69. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  70. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  71. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  72. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  73. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  74. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  75. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  76. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  77. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  78. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  79. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  80. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  81. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  82. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  83. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  84. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  85. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  86. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  87. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  88. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  89. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  90. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  91. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  92. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  93. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  94. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  95. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  96. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  97. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  98. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  99. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  100. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  101. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  102. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  103. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  104. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  105. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  106. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  107. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  108. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  109. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  110. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  111. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  112. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  113. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  114. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  115. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  116. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  117. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/index.d.mts +7 -4
  118. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/index.mjs +7 -4
  119. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  120. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  121. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/module.d.mts +8 -7
  122. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/module.mjs +7 -6
  123. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  124. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/with.d.mts +11 -0
  125. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/with.mjs +11 -0
  126. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  127. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  128. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  129. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  130. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  131. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  132. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  133. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  134. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  135. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  136. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  137. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  138. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  139. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  140. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  141. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  142. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  143. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  144. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  145. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  146. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  147. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  148. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  149. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  150. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  151. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  152. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  153. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  154. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  155. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  156. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  157. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  158. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  159. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  160. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  161. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/index.mjs +2 -2
  162. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  163. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  164. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  165. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  166. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  167. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  168. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  169. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  170. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  171. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  172. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  173. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  174. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  175. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  176. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  177. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  178. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  179. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  180. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  181. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  182. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  183. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  184. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  185. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  186. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  187. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  188. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  189. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  190. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  191. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  192. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  193. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  194. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  195. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  196. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  197. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  198. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  199. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  200. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  201. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  202. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  203. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  204. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  205. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  206. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  207. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  208. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  209. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  210. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  211. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  212. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  213. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  214. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  215. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  216. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  217. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  218. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  219. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  220. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  221. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  222. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  223. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  224. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  225. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  226. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  227. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  228. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  229. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  230. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  231. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  232. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  233. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  234. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  235. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  236. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  237. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  238. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  239. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  240. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  241. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  242. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  243. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  244. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  245. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  246. package/node_modules/@earendil-works/{pi-coding-agent/node_modules/typebox/build/type/engine/options → pi-agent-core/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  247. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  248. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  249. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  250. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  251. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  252. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  253. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  254. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  255. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  256. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  257. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/object.mjs +25 -3
  258. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  259. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  260. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/record.mjs +23 -0
  261. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  262. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  263. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  264. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  265. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/union.mjs +2 -2
  266. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  267. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  268. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  269. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/parser.mjs +23 -22
  270. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/script.d.mts +3 -4
  271. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/script.mjs +3 -2
  272. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  273. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  274. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  275. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  276. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  277. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  278. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  279. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  280. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  281. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  282. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  283. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  284. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  285. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  286. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/call.d.mts +3 -3
  287. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/call.mjs +3 -2
  288. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  289. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  290. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  291. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  292. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  293. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/enum.mjs +5 -0
  294. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/index.d.mts +1 -4
  295. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/index.mjs +1 -4
  296. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/number.d.mts +1 -1
  297. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/number.mjs +1 -1
  298. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/record.d.mts +13 -7
  299. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/record.mjs +15 -9
  300. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/static.d.mts +2 -5
  301. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/typebox.d.mts +3 -7
  302. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/typebox.mjs +3 -7
  303. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  304. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  305. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  306. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  307. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  308. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  309. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  310. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  311. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  312. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  313. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  314. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  315. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  316. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  317. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  318. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  319. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  320. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  321. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  322. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  323. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  324. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  325. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  326. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/index.d.mts +0 -1
  327. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/index.mjs +0 -1
  328. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  329. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  330. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  331. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  332. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/value.d.mts +0 -1
  333. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/value.mjs +0 -1
  334. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/package.json +33 -33
  335. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/readme.md +117 -103
  336. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  337. package/node_modules/@earendil-works/pi-ai/README.md +2 -1
  338. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  339. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +11 -4
  340. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  341. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  342. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +5 -1
  343. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  344. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  345. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +16 -4
  346. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  347. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  348. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +12 -2
  349. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  350. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  351. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
  352. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  353. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  354. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +19 -10
  355. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  356. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  357. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +12 -2
  358. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  359. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  360. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +21 -9
  361. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  362. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  363. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -1
  364. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  365. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  366. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -3
  367. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  368. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts.map +1 -1
  369. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +3 -2
  370. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
  371. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  372. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
  373. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  374. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
  375. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +3 -1
  378. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +81 -26
  380. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  383. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +16 -8
  384. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  385. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  386. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  387. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  388. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  389. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  390. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  391. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  392. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  393. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  394. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  395. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  396. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  397. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  398. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  399. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  400. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +4 -1
  401. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  402. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +11 -1
  403. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  404. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  405. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/compile/validator.d.mts +3 -11
  406. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/compile/validator.mjs +6 -36
  407. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/error/errors.d.mts +1 -7
  408. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/_idna.mjs +36 -6
  409. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/_puny.mjs +4 -1
  410. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/uuid.d.mts +2 -2
  411. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/uuid.mjs +3 -3
  412. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/emit.d.mts +0 -4
  413. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/emit.mjs +0 -8
  414. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/guard.d.mts +5 -9
  415. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/guard.mjs +10 -15
  416. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/string.mjs +16 -4
  417. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  418. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  419. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  420. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  421. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  422. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  423. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  424. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  425. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  426. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/index.mjs +0 -1
  427. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  428. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  429. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  430. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  431. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  432. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  433. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  434. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  435. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  436. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  437. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  438. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  439. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  440. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  441. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  442. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  443. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  444. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  445. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  446. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  447. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  448. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  449. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  450. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  451. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  452. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  453. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  454. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  455. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  456. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  457. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  458. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  459. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  460. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  461. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  462. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  463. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  464. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  465. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  466. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  467. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  468. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  469. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  470. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  471. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  472. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  473. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  474. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  475. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  476. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  477. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  478. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  479. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  480. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  481. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  482. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  483. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  484. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  485. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/index.d.mts +7 -4
  486. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/index.mjs +7 -4
  487. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  488. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  489. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/module.d.mts +8 -7
  490. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/module.mjs +7 -6
  491. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  492. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/with.d.mts +11 -0
  493. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/with.mjs +11 -0
  494. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  495. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  496. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  497. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  498. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  499. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  500. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  501. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  502. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  503. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  504. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  505. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  506. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  507. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  508. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  509. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  510. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  511. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  512. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  513. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  514. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  515. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  516. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  517. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  518. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  519. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  520. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  521. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  522. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  523. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  524. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  525. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  526. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  527. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  528. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  529. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/index.mjs +2 -2
  530. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  531. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  532. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  533. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  534. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  535. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  536. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  537. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  538. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  539. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  540. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  541. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  542. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  543. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  544. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  545. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  546. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  547. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  548. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  549. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  550. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  551. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  552. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  553. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  554. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  555. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  556. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  557. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  558. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  559. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  560. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  561. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  562. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  563. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  564. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  565. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  566. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  567. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  568. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  569. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  570. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  571. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  572. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  573. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  574. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  575. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  576. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  577. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  578. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  579. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  580. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  581. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  582. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  583. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  584. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  585. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  586. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  587. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  588. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  589. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  590. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  591. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  592. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  593. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  594. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  595. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  596. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  597. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  598. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  599. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  600. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  601. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  602. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  603. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  604. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  605. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  606. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  607. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  608. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  609. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  610. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  611. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  612. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  613. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  614. package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  615. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  616. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  617. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  618. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  619. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  620. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  621. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  622. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  623. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  624. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  625. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/object.mjs +25 -3
  626. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  627. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  628. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/record.mjs +23 -0
  629. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  630. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  631. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  632. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  633. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/union.mjs +2 -2
  634. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  635. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  636. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  637. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/parser.mjs +23 -22
  638. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/script.d.mts +3 -4
  639. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/script.mjs +3 -2
  640. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  641. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  642. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  643. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  644. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  645. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  646. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  647. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  648. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  649. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  650. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  651. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  652. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  653. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  654. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/call.d.mts +3 -3
  655. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/call.mjs +3 -2
  656. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  657. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  658. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  659. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  660. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  661. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/enum.mjs +5 -0
  662. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/index.d.mts +1 -4
  663. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/index.mjs +1 -4
  664. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/number.d.mts +1 -1
  665. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/number.mjs +1 -1
  666. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/record.d.mts +13 -7
  667. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/record.mjs +15 -9
  668. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/static.d.mts +2 -5
  669. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/typebox.d.mts +3 -7
  670. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/typebox.mjs +3 -7
  671. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  672. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  673. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  674. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  675. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  676. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  677. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  678. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  679. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  680. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  681. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  682. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  683. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  684. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  685. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  686. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  687. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  688. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  689. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  690. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  691. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  692. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  693. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  694. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/index.d.mts +0 -1
  695. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/index.mjs +0 -1
  696. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  697. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  698. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  699. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  700. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/value.d.mts +0 -1
  701. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/value.mjs +0 -1
  702. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/package.json +33 -33
  703. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/readme.md +117 -103
  704. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  705. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +45 -0
  706. package/node_modules/@earendil-works/pi-coding-agent/README.md +1 -1
  707. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  708. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +8 -1
  709. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  710. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts +23 -0
  711. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts.map +1 -0
  712. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js +116 -0
  713. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js.map +1 -0
  714. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -1
  715. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +3 -0
  716. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js.map +1 -1
  717. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +1 -1
  718. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  719. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +13 -6
  720. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  721. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +1 -1
  722. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -0
  723. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  724. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +7 -0
  725. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  726. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +7 -0
  727. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  728. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  729. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts +10 -0
  730. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js +1 -1
  732. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -1
  733. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +2 -0
  734. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  735. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  736. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  737. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +13 -6
  738. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  739. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +15 -0
  740. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  741. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +63 -9
  742. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  743. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +0 -267
  744. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.d.ts.map +1 -1
  745. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +1 -1
  746. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js.map +1 -1
  747. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  748. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +43 -0
  749. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  750. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  751. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +4 -1
  752. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  753. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  754. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +32 -17
  755. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  756. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  757. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +13 -0
  758. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  759. package/node_modules/@earendil-works/pi-coding-agent/docs/custom-provider.md +9 -3
  760. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +3 -1
  761. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +1 -0
  762. package/node_modules/@earendil-works/pi-coding-agent/docs/session-format.md +2 -0
  763. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/index.ts +8 -2
  764. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  765. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  766. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  767. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  768. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  769. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  770. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  771. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  772. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  773. package/node_modules/@earendil-works/pi-coding-agent/examples/sdk/12-full-control.ts +2 -0
  774. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/compile/validator.d.mts +3 -11
  775. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/compile/validator.mjs +6 -36
  776. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/error/errors.d.mts +1 -7
  777. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/_idna.mjs +36 -6
  778. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/_puny.mjs +4 -1
  779. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/uuid.d.mts +2 -2
  780. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/uuid.mjs +3 -3
  781. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/emit.d.mts +0 -4
  782. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/emit.mjs +0 -8
  783. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/guard.d.mts +5 -9
  784. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/guard.mjs +10 -15
  785. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/string.mjs +16 -4
  786. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  787. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  788. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  789. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  790. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  791. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  792. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  793. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  794. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  795. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/index.mjs +0 -1
  796. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  797. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  798. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  799. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  800. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  801. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  802. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  803. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  804. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  805. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  806. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  807. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  808. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  809. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  810. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  811. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  812. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  813. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  814. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  815. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  816. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  817. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  818. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  819. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  820. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  821. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  822. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  823. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  824. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  825. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  826. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  827. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  828. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  829. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  830. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  831. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  832. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  833. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  834. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  835. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  836. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  837. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  838. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  839. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  840. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  841. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  842. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  843. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  844. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  845. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  846. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  847. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  848. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  849. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  850. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  851. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  852. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  853. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  854. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/index.d.mts +7 -4
  855. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/index.mjs +7 -4
  856. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  857. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  858. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/module.d.mts +8 -7
  859. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/module.mjs +7 -6
  860. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  861. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/with.d.mts +11 -0
  862. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/with.mjs +11 -0
  863. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  864. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  865. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  866. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  867. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  868. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  869. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  870. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  871. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  872. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  873. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  874. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  875. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  876. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  877. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  878. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  879. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  880. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  881. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  882. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  883. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  884. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  885. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  886. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  887. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  888. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  889. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  890. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  891. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  892. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  893. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  894. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  895. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  896. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  897. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  898. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/index.mjs +2 -2
  899. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  900. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  901. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  902. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  903. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  904. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  905. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  906. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  907. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  908. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  909. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  910. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  911. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  912. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  913. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  914. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  915. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  916. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  917. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  918. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  919. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  920. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  921. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  922. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  923. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  924. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  925. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  926. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  927. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  928. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  929. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  930. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  931. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  932. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  933. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  934. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  935. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  936. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  937. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  938. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  939. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  940. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  941. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  942. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  943. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  944. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  945. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  946. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  947. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  948. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  949. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  950. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  951. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  952. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  953. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  954. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  955. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  956. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  957. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  958. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  959. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  960. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  961. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  962. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  963. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  964. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  965. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  966. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  967. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  968. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  969. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  970. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  971. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  972. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  973. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  974. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  975. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  976. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  977. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  978. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  979. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  980. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  981. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  982. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  983. package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/options → pi-coding-agent/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  984. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  985. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  986. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  987. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  988. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  989. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  990. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  991. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  992. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  993. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  994. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/object.mjs +25 -3
  995. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  996. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  997. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/record.mjs +23 -0
  998. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  999. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  1000. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  1001. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  1002. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/union.mjs +2 -2
  1003. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  1004. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  1005. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  1006. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/parser.mjs +23 -22
  1007. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/script.d.mts +3 -4
  1008. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/script.mjs +3 -2
  1009. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  1010. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  1011. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  1012. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  1013. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  1014. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  1015. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  1016. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  1017. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  1018. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  1019. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  1020. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  1021. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  1022. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  1023. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/call.d.mts +3 -3
  1024. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/call.mjs +3 -2
  1025. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  1026. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  1027. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  1028. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  1029. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  1030. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/enum.mjs +5 -0
  1031. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/index.d.mts +1 -4
  1032. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/index.mjs +1 -4
  1033. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/number.d.mts +1 -1
  1034. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/number.mjs +1 -1
  1035. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/record.d.mts +13 -7
  1036. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/record.mjs +15 -9
  1037. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/static.d.mts +2 -5
  1038. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/typebox.d.mts +3 -7
  1039. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/typebox.mjs +3 -7
  1040. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  1041. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  1042. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  1043. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  1044. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  1045. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  1046. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  1047. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  1048. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  1049. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  1050. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  1051. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  1052. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  1053. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  1054. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  1055. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  1056. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  1057. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  1058. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  1059. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  1060. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  1061. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  1062. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  1063. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/index.d.mts +0 -1
  1064. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/index.mjs +0 -1
  1065. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  1066. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  1067. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  1068. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  1069. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/value.d.mts +0 -1
  1070. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/value.mjs +0 -1
  1071. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/package.json +33 -33
  1072. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/readme.md +117 -103
  1073. package/node_modules/@earendil-works/pi-coding-agent/package.json +5 -5
  1074. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  1075. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +3 -2
  1076. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  1077. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +5 -0
  1078. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1079. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +25 -2
  1080. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1081. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1082. package/node_modules/@types/node/README.md +1 -1
  1083. package/node_modules/@types/node/crypto.d.ts +1 -1
  1084. package/node_modules/@types/node/package.json +2 -2
  1085. package/package.json +5 -5
  1086. package/src/prism-extensions/README.md +1 -1
  1087. package/src/prism-extensions/integrations/ai-memory-system.ts +332 -0
  1088. package/src/prism-extensions/integrations/obsidian-formatting.ts +55 -0
  1089. package/src/prism-extensions/integrations/obsidian-memory.ts +90 -47
  1090. package/src/prism-extensions/providers/manifest-provider.ts +29 -2
  1091. package/src/prism-extensions/tools/builtin-tools.ts +2 -150
  1092. package/src/prism-extensions/tools/prism-diagnostic-tools.ts +160 -0
  1093. package/src/prism-extensions/tools/toolbox.ts +87 -3
  1094. package/src/prism-extensions/ui/toolbar.ts +31 -12
  1095. package/dist/prism-extensions/integrations/mcp-adapter.d.ts +0 -3
  1096. package/dist/prism-extensions/integrations/mcp-adapter.js +0 -21
  1097. package/dist/prism-extensions/integrations/mcp-adapter.js.map +0 -1
  1098. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1099. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1100. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1101. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1102. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1103. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1104. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1105. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1106. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1107. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1108. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1109. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/options.mjs +0 -11
  1110. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1111. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1112. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1113. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1114. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1115. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1116. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1117. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1118. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1119. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1120. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1121. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1122. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1123. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1124. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/base.mjs +0 -84
  1125. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1126. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1127. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1128. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1129. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1130. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1131. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1132. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1133. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1134. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1135. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1136. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1137. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1138. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1139. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1140. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1141. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1142. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1143. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1144. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1145. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1146. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1147. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1148. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1149. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1150. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1151. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1152. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1153. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1154. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1155. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1156. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1157. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1158. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1159. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1160. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1161. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1162. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1163. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1164. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1165. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1166. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1167. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1168. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1169. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1170. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/options.mjs +0 -11
  1171. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1172. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1173. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1174. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1175. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1176. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1177. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1178. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1179. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1180. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1181. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1182. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1183. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1184. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1185. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1186. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1187. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/base.mjs +0 -84
  1188. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1189. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1190. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1191. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1192. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1193. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1194. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1195. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1196. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1197. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1198. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1199. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1200. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1201. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1202. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1203. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1204. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1205. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1206. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1207. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1208. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1209. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1210. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1211. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1212. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1213. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1214. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1215. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1216. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1217. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1218. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1219. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1220. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1221. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1222. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1223. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1224. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1225. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1226. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1227. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1228. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1229. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1230. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1231. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1232. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1233. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/options.mjs +0 -11
  1234. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
  1235. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
  1236. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1237. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1238. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1239. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1240. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1241. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1242. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1243. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1244. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1245. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1246. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1247. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1248. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1249. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1250. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1251. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1252. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/base.mjs +0 -84
  1253. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1254. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1255. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1256. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1257. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1258. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1259. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1260. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1261. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1262. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1263. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1264. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1265. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1266. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1267. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1268. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1269. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1270. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1271. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1272. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1273. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1274. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1275. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1276. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1277. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1278. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1279. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1280. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1281. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1282. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1283. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1284. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1285. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1286. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1287. /package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  1288. /package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
  1289. /package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/index.d.mts +0 -0
  1290. /package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/index.mjs +0 -0
  1291. /package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/awaited → pi-coding-agent/node_modules/typebox/build/type/engine/with}/index.d.mts +0 -0
  1292. /package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/awaited → pi-coding-agent/node_modules/typebox/build/type/engine/with}/index.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"bedrock-converse-stream.js","s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AC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC;AAAA,CACrC","sourcesContent":["import type { Agent as HttpsAgent } from \"node:https\";\nimport {\n\tBedrockRuntimeClient,\n\ttype BedrockRuntimeClientConfig,\n\tBedrockRuntimeServiceException,\n\tStopReason as BedrockStopReason,\n\ttype Tool as BedrockTool,\n\tCachePointType,\n\tCacheTTL,\n\ttype ContentBlock,\n\ttype ContentBlockDeltaEvent,\n\ttype ContentBlockStartEvent,\n\ttype ContentBlockStopEvent,\n\tConversationRole,\n\tConverseStreamCommand,\n\ttype ConverseStreamMetadataEvent,\n\tImageFormat,\n\ttype Message,\n\ttype SystemContentBlock,\n\ttype ToolChoice,\n\ttype ToolConfiguration,\n\ttype ToolResultContentBlock,\n\tToolResultStatus,\n} from \"@aws-sdk/client-bedrock-runtime\";\nimport { NodeHttpHandler } from \"@smithy/node-http-handler\";\nimport type { BuildMiddleware, DocumentType, MetadataBearer } from \"@smithy/types\";\nimport { HttpProxyAgent } from \"http-proxy-agent\";\nimport { HttpsProxyAgent } from \"https-proxy-agent\";\nimport { calculateCost } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tContext,\n\tImageContent,\n\tModel,\n\tProviderEnv,\n\tSimpleStreamOptions,\n\tStopReason,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tThinkingContent,\n\tThinkingLevel,\n\tTool,\n\tToolCall,\n\tToolResultMessage,\n} from \"../types.ts\";\nimport { normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { providerHeadersToRecord } from \"../utils/headers.ts\";\nimport { parseStreamingJson } from \"../utils/json-parse.ts\";\nimport { resolveHttpProxyUrlForTarget } from \"../utils/node-http-proxy.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.ts\";\nimport { resolveJsonSchemaStrictSampling } from \"./constrained-sampling.ts\";\nimport {\n\tadjustMaxTokensForThinking,\n\tbuildBaseOptions,\n\tclampMaxTokensToContext,\n\tclampReasoning,\n} from \"./simple-options.ts\";\nimport { transformMessages } from \"./transform-messages.ts\";\n\nexport type BedrockThinkingDisplay = \"summarized\" | \"omitted\";\n\nexport interface BedrockOptions extends StreamOptions {\n\tregion?: string;\n\tprofile?: string;\n\ttoolChoice?: \"auto\" | \"any\" | \"none\" | { type: \"tool\"; name: string };\n\t/* See https://docs.aws.amazon.com/bedrock/latest/userguide/inference-reasoning.html for supported models. */\n\treasoning?: ThinkingLevel;\n\t/* Custom token budgets per thinking level. Overrides default budgets. */\n\tthinkingBudgets?: ThinkingBudgets;\n\t/* Only supported by Claude 4.x models, see https://docs.aws.amazon.com/bedrock/latest/userguide/claude-messages-extended-thinking.html#claude-messages-extended-thinking-tool-use-interleaved */\n\tinterleavedThinking?: boolean;\n\t/**\n\t * Controls how Claude's thinking content is returned in responses.\n\t * - \"summarized\": Thinking blocks contain summarized thinking text (default here).\n\t * - \"omitted\": Thinking content is redacted but the signature still travels back\n\t * for multi-turn continuity, reducing time-to-first-text-token.\n\t *\n\t * Note: Anthropic's API default for Claude Opus 4.8 and Mythos Preview is\n\t * \"omitted\". We default to \"summarized\" here to keep behavior consistent with\n\t * older Claude 4 models. Only applies to Claude models on Bedrock.\n\t */\n\tthinkingDisplay?: BedrockThinkingDisplay;\n\t/** Key-value pairs attached to the inference request for cost allocation tagging.\n\t * Keys: max 64 chars, no `aws:` prefix. Values: max 256 chars. Max 50 pairs.\n\t * Tags appear in AWS Cost Explorer split cost allocation data.\n\t * @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html */\n\trequestMetadata?: Record<string, string>;\n\t/** Bearer token for Bedrock API key authentication.\n\t * When set, bypasses SigV4 signing and sends Authorization: Bearer <token> instead.\n\t * Requires `bedrock:CallWithBearerToken` IAM permission on the token's identity.\n\t * Set via AWS_BEARER_TOKEN_BEDROCK env var or pass directly.\n\t * @see https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonbedrock.html */\n\tbearerToken?: string;\n}\n\ntype Block = (TextContent | ThinkingContent | ToolCall) & { index?: number; partialJson?: string };\n\nconst EMPTY_TEXT_PLACEHOLDER = \"<empty>\";\n\nexport const stream: StreamFunction<\"bedrock-converse-stream\", BedrockOptions> = (\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcontext: Context,\n\toptions: BedrockOptions = {},\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"bedrock-converse-stream\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"stop\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\tconst blocks = output.content as Block[];\n\n\t\tconst config: BedrockRuntimeClientConfig = {\n\t\t\tprofile: options.profile || getProviderEnvValue(\"AWS_PROFILE\", options.env),\n\t\t};\n\t\tconst configuredRegion = getConfiguredBedrockRegion(options);\n\t\tconst hasAmbientConfiguredProfile = Boolean(getProviderEnvValue(\"AWS_PROFILE\"));\n\t\tconst endpointRegion = getStandardBedrockEndpointRegion(model.baseUrl);\n\t\tconst useExplicitEndpoint = shouldUseExplicitBedrockEndpoint(\n\t\t\tmodel.baseUrl,\n\t\t\tconfiguredRegion,\n\t\t\thasAmbientConfiguredProfile,\n\t\t);\n\n\t\t// Only pin standard AWS Bedrock runtime endpoints when no region or ambient AWS_PROFILE is configured.\n\t\t// This preserves custom endpoints (VPC/proxy) from #3402 without forcing built-in\n\t\t// catalog defaults such as us-east-1 to override AWS_REGION/AWS_PROFILE.\n\t\tif (useExplicitEndpoint) {\n\t\t\tconfig.endpoint = model.baseUrl;\n\t\t}\n\n\t\t// Resolve bearer token for Bedrock API key auth.\n\t\tconst skipAuth = getProviderEnvValue(\"AWS_BEDROCK_SKIP_AUTH\", options.env) === \"1\";\n\t\tconst bearerToken =\n\t\t\toptions.bearerToken ||\n\t\t\toptions.apiKey ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", options.env) ||\n\t\t\tundefined;\n\t\tconst useBearerToken = bearerToken !== undefined && !skipAuth;\n\n\t\t// in Node.js/Bun environment only\n\t\tif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\t\t\t// Region resolution: ARN-embedded > explicit option > env vars > SDK default chain.\n\t\t\t// When the model ID is an inference profile ARN, extract the region from it.\n\t\t\t// This avoids conflicts with AWS_REGION set for other services.\n\t\t\tconst arnRegionMatch = model.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);\n\t\t\tif (arnRegionMatch) {\n\t\t\t\tconfig.region = arnRegionMatch[1];\n\t\t\t} else if (configuredRegion) {\n\t\t\t\tconfig.region = configuredRegion;\n\t\t\t} else if (endpointRegion && useExplicitEndpoint) {\n\t\t\t\tconfig.region = endpointRegion;\n\t\t\t} else if (!hasAmbientConfiguredProfile) {\n\t\t\t\tconfig.region = \"us-east-1\";\n\t\t\t}\n\n\t\t\t// Support proxies that don't need authentication\n\t\t\tif (skipAuth) {\n\t\t\t\tconfig.credentials = {\n\t\t\t\t\taccessKeyId: \"dummy-access-key\",\n\t\t\t\t\tsecretAccessKey: \"dummy-secret-key\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst credentials = getConfiguredBedrockCredentials(options.env);\n\t\t\tif (!skipAuth && credentials) {\n\t\t\t\tconfig.credentials = credentials;\n\t\t\t}\n\n\t\t\tconst proxyUrl = resolveHttpProxyUrlForTarget(model.baseUrl, options.env);\n\t\t\tif (proxyUrl) {\n\t\t\t\t// Bedrock runtime uses NodeHttp2Handler by default since v3.798.0, which is based\n\t\t\t\t// on `http2` module and has no support for http agent.\n\t\t\t\t// Use NodeHttpHandler to support HTTP(S) proxy agents.\n\t\t\t\tconfig.requestHandler = new NodeHttpHandler({\n\t\t\t\t\thttpAgent: new HttpProxyAgent(proxyUrl),\n\t\t\t\t\thttpsAgent: new HttpsProxyAgent(proxyUrl) as unknown as HttpsAgent,\n\t\t\t\t});\n\t\t\t} else if (getProviderEnvValue(\"AWS_BEDROCK_FORCE_HTTP1\", options.env) === \"1\") {\n\t\t\t\t// Some custom endpoints require HTTP/1.1 instead of HTTP/2\n\t\t\t\tconfig.requestHandler = new NodeHttpHandler();\n\t\t\t}\n\t\t} else {\n\t\t\t// Non-Node environment (browser): fall back to us-east-1 since\n\t\t\t// there's no config file resolution available.\n\t\t\tconfig.region =\n\t\t\t\tconfiguredRegion || (endpointRegion && useExplicitEndpoint ? endpointRegion : undefined) || \"us-east-1\";\n\t\t}\n\n\t\tif (useBearerToken) {\n\t\t\tconfig.token = { token: bearerToken };\n\t\t\tconfig.authSchemePreference = [\"httpBearerAuth\"];\n\t\t}\n\n\t\ttry {\n\t\t\tconst client = new BedrockRuntimeClient(config);\n\t\t\tconst customHeaders = providerHeadersToRecord(options.headers);\n\t\t\tif (customHeaders) {\n\t\t\t\taddCustomHeadersMiddleware(client, customHeaders);\n\t\t\t}\n\t\t\tconst cacheRetention = resolveCacheRetention(options.cacheRetention, options.env);\n\t\t\tconst inferenceMaxTokens = options.maxTokens ?? (isAnthropicClaudeModel(model) ? model.maxTokens : undefined);\n\t\t\tlet commandInput = {\n\t\t\t\tmodelId: model.id,\n\t\t\t\tmessages: convertMessages(context, model, cacheRetention, options.env),\n\t\t\t\tsystem: buildSystemPrompt(context.systemPrompt, model, cacheRetention, options.env),\n\t\t\t\tinferenceConfig: {\n\t\t\t\t\t...(inferenceMaxTokens !== undefined && { maxTokens: inferenceMaxTokens }),\n\t\t\t\t\t...(options.temperature !== undefined && { temperature: options.temperature }),\n\t\t\t\t},\n\t\t\t\ttoolConfig: convertToolConfig(context.tools, options.toolChoice, model.compat?.supportsStrictMode ?? false),\n\t\t\t\tadditionalModelRequestFields: buildAdditionalModelRequestFields(model, options),\n\t\t\t\t...(options.requestMetadata !== undefined && { requestMetadata: options.requestMetadata }),\n\t\t\t};\n\t\t\tconst nextCommandInput = await options?.onPayload?.(commandInput, model);\n\t\t\tif (nextCommandInput !== undefined) {\n\t\t\t\tcommandInput = nextCommandInput as typeof commandInput;\n\t\t\t}\n\t\t\tconst command = new ConverseStreamCommand(commandInput);\n\n\t\t\tconst response = await client.send(command, { abortSignal: options.signal });\n\t\t\tif (response.$metadata.httpStatusCode !== undefined) {\n\t\t\t\tconst responseHeaders: Record<string, string> = {};\n\t\t\t\tif (response.$metadata.requestId) {\n\t\t\t\t\tresponseHeaders[\"x-amzn-requestid\"] = response.$metadata.requestId;\n\t\t\t\t}\n\t\t\t\tawait options?.onResponse?.({ status: response.$metadata.httpStatusCode, headers: responseHeaders }, model);\n\t\t\t}\n\n\t\t\tfor await (const item of response.stream!) {\n\t\t\t\tif (item.messageStart) {\n\t\t\t\t\tif (item.messageStart.role !== ConversationRole.ASSISTANT) {\n\t\t\t\t\t\tthrow new Error(\"Unexpected assistant message start but got user message start instead\");\n\t\t\t\t\t}\n\t\t\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\t\t} else if (item.contentBlockStart) {\n\t\t\t\t\thandleContentBlockStart(item.contentBlockStart, blocks, output, stream);\n\t\t\t\t} else if (item.contentBlockDelta) {\n\t\t\t\t\thandleContentBlockDelta(item.contentBlockDelta, blocks, output, stream);\n\t\t\t\t} else if (item.contentBlockStop) {\n\t\t\t\t\thandleContentBlockStop(item.contentBlockStop, blocks, output, stream);\n\t\t\t\t} else if (item.messageStop) {\n\t\t\t\t\tconst { stopReason, errorMessage } = mapStopReason(item.messageStop.stopReason);\n\t\t\t\t\toutput.stopReason = stopReason;\n\t\t\t\t\tif (errorMessage) {\n\t\t\t\t\t\toutput.errorMessage = errorMessage;\n\t\t\t\t\t}\n\t\t\t\t} else if (item.metadata) {\n\t\t\t\t\thandleMetadata(item.metadata, model, output);\n\t\t\t\t} else if (item.internalServerException) {\n\t\t\t\t\tthrow item.internalServerException;\n\t\t\t\t} else if (item.modelStreamErrorException) {\n\t\t\t\t\tthrow item.modelStreamErrorException;\n\t\t\t\t} else if (item.validationException) {\n\t\t\t\t\tthrow item.validationException;\n\t\t\t\t} else if (item.throttlingException) {\n\t\t\t\t\tthrow item.throttlingException;\n\t\t\t\t} else if (item.serviceUnavailableException) {\n\t\t\t\t\tthrow item.serviceUnavailableException;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"error\" || output.stopReason === \"aborted\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as Block).index;\n\t\t\t\t// partialJson is only a streaming scratch buffer; never persist it.\n\t\t\t\tdelete (block as Block).partialJson;\n\t\t\t}\n\t\t\toutput.stopReason = options.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatBedrockError(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\n/**\n * Human-readable prefixes for Bedrock SDK exception names.\n * The downstream retry logic in agent-session matches patterns like\n * `server.?error` and `service.?unavailable`, so we preserve the legacy\n * prefix format rather than using the raw SDK exception name.\n */\nconst BEDROCK_ERROR_PREFIXES: Record<string, string> = {\n\tInternalServerException: \"Internal server error\",\n\tModelStreamErrorException: \"Model stream error\",\n\tValidationException: \"Validation error\",\n\tThrottlingException: \"Throttling error\",\n\tServiceUnavailableException: \"Service unavailable\",\n};\n\n/**\n * Some models reject the account/profile's configured Bedrock data retention mode\n * (e.g. \"data retention mode 'default' is not available for this model\"). Point\n * users at the AWS docs explaining how to configure a supported mode.\n */\nconst BEDROCK_DATA_RETENTION_DOCS_URL = \"https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html\";\n\n/**\n * Format a Bedrock error with a human-readable prefix.\n * AWS SDK exceptions (both from `client.send()` and from stream event items)\n * extend BedrockRuntimeServiceException. We map the `.name` to a stable\n * human-readable prefix so downstream consumers (retry logic, context-overflow\n * detection) can distinguish error categories via simple string matching.\n */\nfunction formatBedrockError(error: unknown): string {\n\tconst norm = normalizeProviderError(error);\n\t// Surface the raw HTTP body (with status) when the SDK did not fold it into\n\t// the message; otherwise fall back to the message. This is what stops a\n\t// gateway 403 from collapsing to `Unknown: UnknownError`.\n\tconst core =\n\t\t!norm.messageCarriesBody && norm.status !== undefined && norm.body !== undefined\n\t\t\t? `${norm.status}: ${norm.body}`\n\t\t\t: norm.message;\n\tconst dataRetentionHint = /data retention mode/i.test(core)\n\t\t? ` See ${BEDROCK_DATA_RETENTION_DOCS_URL} for supported data retention modes.`\n\t\t: \"\";\n\tif (error instanceof BedrockRuntimeServiceException) {\n\t\tconst prefix = BEDROCK_ERROR_PREFIXES[error.name] ?? error.name;\n\t\treturn `${prefix}: ${core}${dataRetentionHint}`;\n\t}\n\treturn `${core}${dataRetentionHint}`;\n}\n\n/**\n * Header keys that must never be overwritten by caller-supplied headers.\n * `host` and `x-amz-*` participate in the SigV4 canonical request; `authorization`\n * is owned by SigV4 or the bearer-token path (config.token + authSchemePreference).\n * Compared case-insensitively (caller key is lower-cased before lookup).\n */\nconst RESERVED_HEADER_EXACT = new Set([\"authorization\", \"host\"]);\n\nfunction isReservedHeader(key: string): boolean {\n\tconst lower = key.toLowerCase();\n\treturn lower.startsWith(\"x-amz-\") || RESERVED_HEADER_EXACT.has(lower);\n}\n\n/**\n * Attach caller-supplied headers to the outgoing Bedrock request via a Smithy\n * `build`-step middleware. The `build` step runs after request serialisation but\n * before SigV4 signing, so injected headers are covered by the signature. Reserved\n * SigV4 / auth headers (`x-amz-*`, `authorization`, `host`) are silently skipped;\n * all other caller headers override any existing same-named header on the request.\n */\nfunction addCustomHeadersMiddleware(client: BedrockRuntimeClient, headers: Record<string, string>): void {\n\tconst middleware: BuildMiddleware<object, MetadataBearer> = (next) => async (args) => {\n\t\tconst request = args.request;\n\t\tif (request && typeof request === \"object\" && \"headers\" in request) {\n\t\t\tconst requestHeaders = (request as { headers: Record<string, string> }).headers;\n\t\t\tfor (const [key, value] of Object.entries(headers)) {\n\t\t\t\tif (!isReservedHeader(key)) {\n\t\t\t\t\trequestHeaders[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn next(args);\n\t};\n\tclient.middlewareStack.add(middleware, { step: \"build\", name: \"pi-ai-custom-headers\", priority: \"low\" });\n}\n\nexport const streamSimple: StreamFunction<\"bedrock-converse-stream\", SimpleStreamOptions> = (\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst base = buildBaseOptions(model, context, options, undefined);\n\tif (!options?.reasoning) {\n\t\treturn stream(model, context, { ...base, reasoning: undefined } satisfies BedrockOptions);\n\t}\n\n\tif (isAnthropicClaudeModel(model)) {\n\t\tif (supportsAdaptiveThinking(model.id, model.name)) {\n\t\t\treturn stream(model, context, {\n\t\t\t\t...base,\n\t\t\t\treasoning: options.reasoning,\n\t\t\t\tthinkingBudgets: options.thinkingBudgets,\n\t\t\t} satisfies BedrockOptions);\n\t\t}\n\n\t\t// Undefined means the caller did not request an output cap; let the helper use the model cap.\n\t\t// Do not coerce to 0 here, or the thinking budget would become the entire maxTokens value.\n\t\tconst adjusted = adjustMaxTokensForThinking(\n\t\t\tbase.maxTokens,\n\t\t\tmodel.maxTokens,\n\t\t\toptions.reasoning,\n\t\t\toptions.thinkingBudgets,\n\t\t);\n\n\t\tconst maxTokens = clampMaxTokensToContext(model, context, adjusted.maxTokens);\n\n\t\treturn stream(model, context, {\n\t\t\t...base,\n\t\t\tmaxTokens,\n\t\t\treasoning: options.reasoning,\n\t\t\tthinkingBudgets: {\n\t\t\t\t...(options.thinkingBudgets || {}),\n\t\t\t\t[clampReasoning(options.reasoning)!]: Math.min(adjusted.thinkingBudget, Math.max(0, maxTokens - 1024)),\n\t\t\t},\n\t\t} satisfies BedrockOptions);\n\t}\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoning: options.reasoning,\n\t\tthinkingBudgets: options.thinkingBudgets,\n\t} satisfies BedrockOptions);\n};\n\nfunction handleContentBlockStart(\n\tevent: ContentBlockStartEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst index = event.contentBlockIndex!;\n\tconst start = event.start;\n\n\tif (start?.toolUse) {\n\t\tconst block: Block = {\n\t\t\ttype: \"toolCall\",\n\t\t\tid: start.toolUse.toolUseId || \"\",\n\t\t\tname: start.toolUse.name || \"\",\n\t\t\targuments: {},\n\t\t\tpartialJson: \"\",\n\t\t\tindex,\n\t\t};\n\t\toutput.content.push(block);\n\t\tstream.push({ type: \"toolcall_start\", contentIndex: blocks.length - 1, partial: output });\n\t}\n}\n\nfunction handleContentBlockDelta(\n\tevent: ContentBlockDeltaEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst contentBlockIndex = event.contentBlockIndex!;\n\tconst delta = event.delta;\n\tlet index = blocks.findIndex((b) => b.index === contentBlockIndex);\n\tlet block = blocks[index];\n\n\tif (delta?.text !== undefined) {\n\t\t// If no text block exists yet, create one, as `handleContentBlockStart` is not sent for text blocks\n\t\tif (!block) {\n\t\t\tconst newBlock: Block = { type: \"text\", text: \"\", index: contentBlockIndex };\n\t\t\toutput.content.push(newBlock);\n\t\t\tindex = blocks.length - 1;\n\t\t\tblock = blocks[index];\n\t\t\tstream.push({ type: \"text_start\", contentIndex: index, partial: output });\n\t\t}\n\t\tif (block.type === \"text\") {\n\t\t\tblock.text += delta.text;\n\t\t\tstream.push({ type: \"text_delta\", contentIndex: index, delta: delta.text, partial: output });\n\t\t}\n\t} else if (delta?.toolUse && block?.type === \"toolCall\") {\n\t\tblock.partialJson = (block.partialJson || \"\") + (delta.toolUse.input || \"\");\n\t\tblock.arguments = parseStreamingJson(block.partialJson);\n\t\tstream.push({ type: \"toolcall_delta\", contentIndex: index, delta: delta.toolUse.input || \"\", partial: output });\n\t} else if (delta?.reasoningContent) {\n\t\tlet thinkingBlock = block;\n\t\tlet thinkingIndex = index;\n\n\t\tif (!thinkingBlock) {\n\t\t\tconst newBlock: Block = { type: \"thinking\", thinking: \"\", thinkingSignature: \"\", index: contentBlockIndex };\n\t\t\toutput.content.push(newBlock);\n\t\t\tthinkingIndex = blocks.length - 1;\n\t\t\tthinkingBlock = blocks[thinkingIndex];\n\t\t\tstream.push({ type: \"thinking_start\", contentIndex: thinkingIndex, partial: output });\n\t\t}\n\n\t\tif (thinkingBlock?.type === \"thinking\") {\n\t\t\tif (delta.reasoningContent.text) {\n\t\t\t\tthinkingBlock.thinking += delta.reasoningContent.text;\n\t\t\t\tstream.push({\n\t\t\t\t\ttype: \"thinking_delta\",\n\t\t\t\t\tcontentIndex: thinkingIndex,\n\t\t\t\t\tdelta: delta.reasoningContent.text,\n\t\t\t\t\tpartial: output,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (delta.reasoningContent.signature) {\n\t\t\t\tthinkingBlock.thinkingSignature =\n\t\t\t\t\t(thinkingBlock.thinkingSignature || \"\") + delta.reasoningContent.signature;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction handleMetadata(\n\tevent: ConverseStreamMetadataEvent,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\toutput: AssistantMessage,\n): void {\n\tif (event.usage) {\n\t\toutput.usage.input = event.usage.inputTokens || 0;\n\t\toutput.usage.output = event.usage.outputTokens || 0;\n\t\toutput.usage.cacheRead = event.usage.cacheReadInputTokens || 0;\n\t\toutput.usage.cacheWrite = event.usage.cacheWriteInputTokens || 0;\n\t\toutput.usage.totalTokens = event.usage.totalTokens || output.usage.input + output.usage.output;\n\t\tcalculateCost(model, output.usage);\n\t}\n}\n\nfunction handleContentBlockStop(\n\tevent: ContentBlockStopEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst index = blocks.findIndex((b) => b.index === event.contentBlockIndex);\n\tconst block = blocks[index];\n\tif (!block) return;\n\tdelete (block as Block).index;\n\n\tswitch (block.type) {\n\t\tcase \"text\":\n\t\t\tstream.push({ type: \"text_end\", contentIndex: index, content: block.text, partial: output });\n\t\t\tbreak;\n\t\tcase \"thinking\":\n\t\t\tstream.push({ type: \"thinking_end\", contentIndex: index, content: block.thinking, partial: output });\n\t\t\tbreak;\n\t\tcase \"toolCall\":\n\t\t\tblock.arguments = parseStreamingJson(block.partialJson);\n\t\t\t// Finalize in-place and strip the scratch buffer so replay only\n\t\t\t// carries parsed arguments.\n\t\t\tdelete (block as Block).partialJson;\n\t\t\tstream.push({ type: \"toolcall_end\", contentIndex: index, toolCall: block, partial: output });\n\t\t\tbreak;\n\t}\n}\n\n/**\n * Check if the model supports adaptive thinking (Opus 4.6+, Sonnet 4.6).\n * Checks both model ID and model name to support application inference profiles\n * whose ARNs don't contain the model name.\n */\nfunction getModelMatchCandidates(modelId: string, modelName?: string): string[] {\n\tconst values = modelName ? [modelId, modelName] : [modelId];\n\treturn values.flatMap((value) => {\n\t\tconst lower = value.toLowerCase();\n\t\treturn [lower, lower.replace(/[\\s_.:]+/g, \"-\")];\n\t});\n}\n\nfunction supportsAdaptiveThinking(modelId: string, modelName?: string): boolean {\n\tconst candidates = getModelMatchCandidates(modelId, modelName);\n\treturn candidates.some(\n\t\t(s) =>\n\t\t\ts.includes(\"opus-4-6\") ||\n\t\t\ts.includes(\"opus-4-7\") ||\n\t\t\ts.includes(\"opus-4-8\") ||\n\t\t\ts.includes(\"opus-5\") ||\n\t\t\ts.includes(\"sonnet-4-6\") ||\n\t\t\ts.includes(\"sonnet-5\") ||\n\t\t\ts.includes(\"fable-5\"),\n\t);\n}\n\nfunction supportsNativeXhighEffort(model: Model<\"bedrock-converse-stream\">): boolean {\n\tconst candidates = getModelMatchCandidates(model.id, model.name);\n\treturn candidates.some(\n\t\t(s) =>\n\t\t\ts.includes(\"opus-4-7\") ||\n\t\t\ts.includes(\"opus-4-8\") ||\n\t\t\ts.includes(\"opus-5\") ||\n\t\t\ts.includes(\"sonnet-5\") ||\n\t\t\ts.includes(\"fable-5\"),\n\t);\n}\n\nfunction mapThinkingLevelToEffort(\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tlevel: SimpleStreamOptions[\"reasoning\"],\n): \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" {\n\tif (level === \"xhigh\" && supportsNativeXhighEffort(model)) return \"xhigh\";\n\n\tconst mapped = level ? model.thinkingLevelMap?.[level] : undefined;\n\tif (typeof mapped === \"string\") return mapped as \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n\tswitch (level) {\n\t\tcase \"minimal\":\n\t\tcase \"low\":\n\t\t\treturn \"low\";\n\t\tcase \"medium\":\n\t\t\treturn \"medium\";\n\t\tcase \"high\":\n\t\t\treturn \"high\";\n\t\tdefault:\n\t\t\treturn \"high\";\n\t}\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\n/**\n * Check if the model is an Anthropic Claude model on Bedrock.\n * Checks both model ID and model name to support application inference profiles\n * whose ARNs don't contain the model name.\n */\nfunction isAnthropicClaudeModel(model: Model<\"bedrock-converse-stream\">): boolean {\n\tconst id = model.id.toLowerCase();\n\tconst name = model.name?.toLowerCase() ?? \"\";\n\treturn (\n\t\tid.includes(\"anthropic.claude\") ||\n\t\tid.includes(\"anthropic/claude\") ||\n\t\tname.includes(\"anthropic.claude\") ||\n\t\tname.includes(\"anthropic/claude\") ||\n\t\tname.includes(\"claude\")\n\t);\n}\n\n/**\n * Check if the model supports prompt caching.\n * Supported: Claude 3.5 Haiku, Claude 3.7 Sonnet, Claude 4.x models, Claude 5 models\n *\n * For base models and system-defined inference profiles the model ID / ARN\n * contains the model name, so we can decide locally.\n *\n * For application inference profiles (whose ARNs don't contain the model name),\n * also checks model.name which is user-controlled via models.json or registerProvider.\n * As a last resort, set AWS_BEDROCK_FORCE_CACHE=1 to enable cache points.\n * Amazon Nova models have automatic caching and don't need explicit cache points.\n */\nfunction supportsPromptCaching(model: Model<\"bedrock-converse-stream\">, env?: ProviderEnv): boolean {\n\tconst candidates = getModelMatchCandidates(model.id, model.name);\n\n\tconst hasClaudeRef = candidates.some((s) => s.includes(\"claude\"));\n\tif (!hasClaudeRef) {\n\t\t// Application inference profiles don't contain the model name in the ARN.\n\t\t// Allow users to force cache points via environment variable.\n\t\tif (getProviderEnvValue(\"AWS_BEDROCK_FORCE_CACHE\", env) === \"1\") return true;\n\t\treturn false;\n\t}\n\t// Claude 5 models (fable-5, opus-5, sonnet-5)\n\tif (candidates.some((s) => s.includes(\"fable-5\") || s.includes(\"opus-5\") || s.includes(\"sonnet-5\"))) return true;\n\t// Claude 4.x models (opus-4, sonnet-4, haiku-4)\n\tif (candidates.some((s) => s.includes(\"-4-\"))) return true;\n\t// Claude 3.7 Sonnet\n\tif (candidates.some((s) => s.includes(\"claude-3-7-sonnet\"))) return true;\n\t// Claude 3.5 Haiku\n\tif (candidates.some((s) => s.includes(\"claude-3-5-haiku\"))) return true;\n\treturn false;\n}\n\n/**\n * Check if the model supports thinking signatures in reasoningContent.\n * Only Anthropic Claude models support the signature field.\n * Other models (OpenAI, Qwen, Minimax, Moonshot, etc.) reject it with:\n * \"This model doesn't support the reasoningContent.reasoningText.signature field\"\n *\n * Checks both model ID and model name to support application inference profiles.\n */\nfunction supportsThinkingSignature(model: Model<\"bedrock-converse-stream\">): boolean {\n\treturn isAnthropicClaudeModel(model);\n}\n\nfunction buildSystemPrompt(\n\tsystemPrompt: string | undefined,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcacheRetention: CacheRetention,\n\tenv?: ProviderEnv,\n): SystemContentBlock[] | undefined {\n\tif (!systemPrompt) return undefined;\n\n\tconst blocks: SystemContentBlock[] = [{ text: sanitizeSurrogates(systemPrompt) }];\n\n\t// Add cache point for supported Claude models when caching is enabled\n\tif (cacheRetention !== \"none\" && supportsPromptCaching(model, env)) {\n\t\tblocks.push({\n\t\t\tcachePoint: { type: CachePointType.DEFAULT, ...(cacheRetention === \"long\" ? { ttl: CacheTTL.ONE_HOUR } : {}) },\n\t\t});\n\t}\n\n\treturn blocks;\n}\n\nfunction normalizeToolCallId(id: string): string {\n\tconst sanitized = id.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n\treturn sanitized.length > 64 ? sanitized.slice(0, 64) : sanitized;\n}\n\nfunction createNonBlankTextBlock(text: string): ContentBlock.TextMember | undefined {\n\tconst sanitized = sanitizeSurrogates(text);\n\treturn sanitized.trim().length === 0 ? undefined : { text: sanitized };\n}\n\nfunction createRequiredTextBlock(text: string): ContentBlock.TextMember {\n\treturn createNonBlankTextBlock(text) ?? { text: EMPTY_TEXT_PLACEHOLDER };\n}\n\nfunction convertToolResultContent(content: (TextContent | ImageContent)[]): ToolResultContentBlock[] {\n\tconst result: ToolResultContentBlock[] = [];\n\tfor (const c of content) {\n\t\tif (c.type === \"image\") {\n\t\t\tresult.push({ image: createImageBlock(c.mimeType, c.data) });\n\t\t} else {\n\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\tif (textBlock) result.push(textBlock);\n\t\t}\n\t}\n\tif (result.length === 0) result.push({ text: EMPTY_TEXT_PLACEHOLDER });\n\treturn result;\n}\n\nfunction convertMessages(\n\tcontext: Context,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcacheRetention: CacheRetention,\n\tenv?: ProviderEnv,\n): Message[] {\n\tconst result: Message[] = [];\n\tconst transformedMessages = transformMessages(context.messages, model, normalizeToolCallId);\n\n\tfor (let i = 0; i < transformedMessages.length; i++) {\n\t\tconst m = transformedMessages[i];\n\n\t\tswitch (m.role) {\n\t\t\tcase \"user\": {\n\t\t\t\tconst content: ContentBlock[] = [];\n\t\t\t\tif (typeof m.content === \"string\") {\n\t\t\t\t\tcontent.push(createRequiredTextBlock(m.content));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const c of m.content) {\n\t\t\t\t\t\tswitch (c.type) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\t\t\t\t\t\tif (textBlock) content.push(textBlock);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"image\":\n\t\t\t\t\t\t\t\tcontent.push({ image: createImageBlock(c.mimeType, c.data) });\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (content.length === 0) content.push({ text: EMPTY_TEXT_PLACEHOLDER });\n\t\t\t\t}\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.USER,\n\t\t\t\t\tcontent,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"assistant\": {\n\t\t\t\t// Skip assistant messages with empty content (e.g., from aborted requests)\n\t\t\t\t// Bedrock rejects messages with empty content arrays\n\t\t\t\tif (m.content.length === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst contentBlocks: ContentBlock[] = [];\n\t\t\t\tfor (const c of m.content) {\n\t\t\t\t\tswitch (c.type) {\n\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t// Skip empty text blocks\n\t\t\t\t\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\t\t\t\t\tif (!textBlock) continue;\n\t\t\t\t\t\t\tcontentBlocks.push(textBlock);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"toolCall\":\n\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\ttoolUse: { toolUseId: c.id, name: c.name, input: c.arguments },\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"thinking\": {\n\t\t\t\t\t\t\t// Skip empty thinking blocks\n\t\t\t\t\t\t\tconst thinking = sanitizeSurrogates(c.thinking);\n\t\t\t\t\t\t\tif (thinking.trim().length === 0) continue;\n\t\t\t\t\t\t\t// Only Anthropic models support the signature field in reasoningText.\n\t\t\t\t\t\t\t// For other models, we omit the signature to avoid errors like:\n\t\t\t\t\t\t\t// \"This model doesn't support the reasoningContent.reasoningText.signature field\"\n\t\t\t\t\t\t\tif (supportsThinkingSignature(model)) {\n\t\t\t\t\t\t\t\t// Signatures arrive after thinking deltas. If a partial or externally\n\t\t\t\t\t\t\t\t// persisted message lacks a signature, Bedrock rejects the replayed\n\t\t\t\t\t\t\t\t// reasoning block. Fall back to plain text, matching Anthropic.\n\t\t\t\t\t\t\t\tif (!c.thinkingSignature || c.thinkingSignature.trim().length === 0) {\n\t\t\t\t\t\t\t\t\tcontentBlocks.push({ text: thinking });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\t\t\treasoningContent: {\n\t\t\t\t\t\t\t\t\t\t\treasoningText: {\n\t\t\t\t\t\t\t\t\t\t\t\ttext: thinking,\n\t\t\t\t\t\t\t\t\t\t\t\tsignature: c.thinkingSignature,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\t\treasoningContent: {\n\t\t\t\t\t\t\t\t\t\treasoningText: { text: thinking },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Skip if all content blocks were filtered out\n\t\t\t\tif (contentBlocks.length === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.ASSISTANT,\n\t\t\t\t\tcontent: contentBlocks,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"toolResult\": {\n\t\t\t\t// Collect all consecutive toolResult messages into a single user message\n\t\t\t\t// Bedrock requires all tool results to be in one message\n\t\t\t\tconst toolResults: ContentBlock.ToolResultMember[] = [];\n\n\t\t\t\t// Add current tool result with all content blocks combined\n\t\t\t\ttoolResults.push({\n\t\t\t\t\ttoolResult: {\n\t\t\t\t\t\ttoolUseId: m.toolCallId,\n\t\t\t\t\t\tcontent: convertToolResultContent(m.content),\n\t\t\t\t\t\tstatus: m.isError ? ToolResultStatus.ERROR : ToolResultStatus.SUCCESS,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t// Look ahead for consecutive toolResult messages\n\t\t\t\tlet j = i + 1;\n\t\t\t\twhile (j < transformedMessages.length && transformedMessages[j].role === \"toolResult\") {\n\t\t\t\t\tconst nextMsg = transformedMessages[j] as ToolResultMessage;\n\t\t\t\t\ttoolResults.push({\n\t\t\t\t\t\ttoolResult: {\n\t\t\t\t\t\t\ttoolUseId: nextMsg.toolCallId,\n\t\t\t\t\t\t\tcontent: convertToolResultContent(nextMsg.content),\n\t\t\t\t\t\t\tstatus: nextMsg.isError ? ToolResultStatus.ERROR : ToolResultStatus.SUCCESS,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t\t// Skip the messages we've already processed\n\t\t\t\ti = j - 1;\n\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.USER,\n\t\t\t\t\tcontent: toolResults,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t}\n\n\t// Add cache point to the last user message for supported Claude models when caching is enabled\n\tif (cacheRetention !== \"none\" && supportsPromptCaching(model, env) && result.length > 0) {\n\t\tconst lastMessage = result[result.length - 1];\n\t\tif (lastMessage.role === ConversationRole.USER && lastMessage.content) {\n\t\t\t(lastMessage.content as ContentBlock[]).push({\n\t\t\t\tcachePoint: {\n\t\t\t\t\ttype: CachePointType.DEFAULT,\n\t\t\t\t\t...(cacheRetention === \"long\" ? { ttl: CacheTTL.ONE_HOUR } : {}),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction convertToolConfig(\n\ttools: Tool[] | undefined,\n\ttoolChoice: BedrockOptions[\"toolChoice\"],\n\tsupportsStrictMode: boolean,\n): ToolConfiguration | undefined {\n\tif (!tools?.length) return undefined;\n\tif (toolChoice === \"none\") return undefined;\n\n\tconst bedrockTools: BedrockTool[] = tools.map((tool) => {\n\t\tconst strict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode);\n\t\treturn {\n\t\t\ttoolSpec: {\n\t\t\t\tname: tool.name,\n\t\t\t\tdescription: tool.description,\n\t\t\t\tinputSchema: { json: tool.parameters as unknown as DocumentType },\n\t\t\t\t...(strict === true ? { strict: true } : {}),\n\t\t\t},\n\t\t};\n\t});\n\n\tlet bedrockToolChoice: ToolChoice | undefined;\n\tswitch (toolChoice) {\n\t\tcase \"auto\":\n\t\t\tbedrockToolChoice = { auto: {} };\n\t\t\tbreak;\n\t\tcase \"any\":\n\t\t\tbedrockToolChoice = { any: {} };\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (toolChoice?.type === \"tool\") {\n\t\t\t\tbedrockToolChoice = { tool: { name: toolChoice.name } };\n\t\t\t}\n\t}\n\n\treturn { tools: bedrockTools, toolChoice: bedrockToolChoice };\n}\n\nfunction mapStopReason(reason: string | undefined): { stopReason: StopReason; errorMessage?: string } {\n\tswitch (reason) {\n\t\tcase BedrockStopReason.END_TURN:\n\t\tcase BedrockStopReason.STOP_SEQUENCE:\n\t\t\treturn { stopReason: \"stop\" };\n\t\tcase BedrockStopReason.MAX_TOKENS:\n\t\tcase BedrockStopReason.MODEL_CONTEXT_WINDOW_EXCEEDED:\n\t\t\treturn { stopReason: \"length\" };\n\t\tcase BedrockStopReason.TOOL_USE:\n\t\t\treturn { stopReason: \"toolUse\" };\n\t\tdefault:\n\t\t\treturn reason ? { stopReason: \"error\", errorMessage: reason } : { stopReason: \"error\" };\n\t}\n}\n\nfunction getConfiguredBedrockRegion(options: BedrockOptions): string | undefined {\n\treturn (\n\t\toptions.region ||\n\t\tgetProviderEnvValue(\"AWS_REGION\", options.env) ||\n\t\tgetProviderEnvValue(\"AWS_DEFAULT_REGION\", options.env) ||\n\t\tundefined\n\t);\n}\n\nfunction getConfiguredBedrockCredentials(env?: ProviderEnv): BedrockRuntimeClientConfig[\"credentials\"] | undefined {\n\tconst accessKeyId = getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env);\n\tconst secretAccessKey = getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env);\n\tif (!accessKeyId || !secretAccessKey) {\n\t\treturn undefined;\n\t}\n\tconst sessionToken = getProviderEnvValue(\"AWS_SESSION_TOKEN\", env);\n\treturn {\n\t\taccessKeyId,\n\t\tsecretAccessKey,\n\t\t...(sessionToken ? { sessionToken } : {}),\n\t};\n}\n\nfunction getStandardBedrockEndpointRegion(baseUrl: string | undefined): string | undefined {\n\tif (!baseUrl) {\n\t\treturn undefined;\n\t}\n\n\ttry {\n\t\tconst { hostname } = new URL(baseUrl);\n\t\tconst match = hostname.toLowerCase().match(/^bedrock-runtime(?:-fips)?\\.([a-z0-9-]+)\\.amazonaws\\.com(?:\\.cn)?$/);\n\t\treturn match?.[1];\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction shouldUseExplicitBedrockEndpoint(\n\tbaseUrl: string,\n\tconfiguredRegion: string | undefined,\n\thasAmbientConfiguredProfile: boolean,\n): boolean {\n\tconst endpointRegion = getStandardBedrockEndpointRegion(baseUrl);\n\tif (!endpointRegion) {\n\t\treturn true;\n\t}\n\n\treturn !configuredRegion && !hasAmbientConfiguredProfile;\n}\n\nfunction isGovCloudBedrockTarget(model: Model<\"bedrock-converse-stream\">, options: BedrockOptions): boolean {\n\tconst region = getConfiguredBedrockRegion(options);\n\tif (region?.toLowerCase().startsWith(\"us-gov-\")) {\n\t\treturn true;\n\t}\n\n\tconst modelId = model.id.toLowerCase();\n\treturn modelId.startsWith(\"us-gov.\") || modelId.startsWith(\"arn:aws-us-gov:\");\n}\n\nfunction buildAdditionalModelRequestFields(\n\tmodel: Model<\"bedrock-converse-stream\">,\n\toptions: BedrockOptions,\n): Record<string, any> | undefined {\n\tif (!options.reasoning || !model.reasoning) {\n\t\treturn undefined;\n\t}\n\n\tif (isAnthropicClaudeModel(model)) {\n\t\t// GovCloud Bedrock currently rejects the Claude thinking.display field.\n\t\t// Omit it there until the GovCloud Converse schema catches up.\n\t\tconst display = isGovCloudBedrockTarget(model, options) ? undefined : (options.thinkingDisplay ?? \"summarized\");\n\t\tconst result: Record<string, any> = supportsAdaptiveThinking(model.id, model.name)\n\t\t\t? {\n\t\t\t\t\tthinking: { type: \"adaptive\", ...(display !== undefined ? { display } : {}) },\n\t\t\t\t\toutput_config: { effort: mapThinkingLevelToEffort(model, options.reasoning) },\n\t\t\t\t}\n\t\t\t: (() => {\n\t\t\t\t\tconst defaultBudgets: Record<ThinkingLevel, number> = {\n\t\t\t\t\t\tminimal: 1024,\n\t\t\t\t\t\tlow: 2048,\n\t\t\t\t\t\tmedium: 8192,\n\t\t\t\t\t\thigh: 16384,\n\t\t\t\t\t\txhigh: 16384, // Budget-based Claude clamps extended levels to high\n\t\t\t\t\t\tmax: 16384,\n\t\t\t\t\t};\n\n\t\t\t\t\t// Custom budgets only cover token-based levels through high.\n\t\t\t\t\tconst level = options.reasoning === \"xhigh\" || options.reasoning === \"max\" ? \"high\" : options.reasoning;\n\t\t\t\t\tconst budget = options.thinkingBudgets?.[level] ?? defaultBudgets[options.reasoning];\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tthinking: {\n\t\t\t\t\t\t\ttype: \"enabled\",\n\t\t\t\t\t\t\tbudget_tokens: budget,\n\t\t\t\t\t\t\t...(display !== undefined ? { display } : {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t})();\n\n\t\tif (!supportsAdaptiveThinking(model.id, model.name) && (options.interleavedThinking ?? true)) {\n\t\t\tresult.anthropic_beta = [\"interleaved-thinking-2025-05-14\"];\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn undefined;\n}\n\nfunction createImageBlock(mimeType: string, data: string) {\n\tlet format: ImageFormat;\n\tswitch (mimeType) {\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t\t\tformat = ImageFormat.JPEG;\n\t\t\tbreak;\n\t\tcase \"image/png\":\n\t\t\tformat = ImageFormat.PNG;\n\t\t\tbreak;\n\t\tcase \"image/gif\":\n\t\t\tformat = ImageFormat.GIF;\n\t\t\tbreak;\n\t\tcase \"image/webp\":\n\t\t\tformat = ImageFormat.WEBP;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown image type: ${mimeType}`);\n\t}\n\n\tconst binaryString = atob(data);\n\tconst bytes = new Uint8Array(binaryString.length);\n\tfor (let i = 0; i < binaryString.length; i++) {\n\t\tbytes[i] = binaryString.charCodeAt(i);\n\t}\n\n\treturn { source: { bytes }, format };\n}\n"]}
1
+ {"version":3,"file":"bedrock-converse-stream.js","sourceRoot":"","sources":["../../src/api/bedrock-converse-stream.ts"],"names":[],"mappings":"AACA,OAAO,EACN,oBAAoB,EAEpB,8BAA8B,EAC9B,UAAU,IAAI,iBAAiB,EAE/B,cAAc,EACd,QAAQ,EAKR,gBAAgB,EAChB,qBAAqB,EAErB,WAAW,EAMX,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EACN,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,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QAClB,KAAK,YAAY,CAAC;QAClB,KAAK,WAAW;YACf,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC;YAC1B,MAAM;QACP,KAAK,WAAW;YACf,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC;YACzB,MAAM;QACP,KAAK,WAAW;YACf,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC;YACzB,MAAM;QACP,KAAK,YAAY;YAChB,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC;YAC1B,MAAM;QACP;YACC,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC;AAAA,CACrC","sourcesContent":["import type { Agent as HttpsAgent } from \"node:https\";\nimport {\n\tBedrockRuntimeClient,\n\ttype BedrockRuntimeClientConfig,\n\tBedrockRuntimeServiceException,\n\tStopReason as BedrockStopReason,\n\ttype Tool as BedrockTool,\n\tCachePointType,\n\tCacheTTL,\n\ttype ContentBlock,\n\ttype ContentBlockDeltaEvent,\n\ttype ContentBlockStartEvent,\n\ttype ContentBlockStopEvent,\n\tConversationRole,\n\tConverseStreamCommand,\n\ttype ConverseStreamMetadataEvent,\n\tImageFormat,\n\ttype Message,\n\ttype SystemContentBlock,\n\ttype ToolChoice,\n\ttype ToolConfiguration,\n\ttype ToolResultContentBlock,\n\tToolResultStatus,\n} from \"@aws-sdk/client-bedrock-runtime\";\nimport { NodeHttpHandler } from \"@smithy/node-http-handler\";\nimport type { BuildMiddleware, DocumentType, MetadataBearer } from \"@smithy/types\";\nimport { HttpProxyAgent } from \"http-proxy-agent\";\nimport { HttpsProxyAgent } from \"https-proxy-agent\";\nimport { calculateCost } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tContext,\n\tImageContent,\n\tModel,\n\tProviderEnv,\n\tSimpleStreamOptions,\n\tStopReason,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tThinkingContent,\n\tThinkingLevel,\n\tTool,\n\tToolCall,\n\tToolResultMessage,\n} from \"../types.ts\";\nimport { normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { providerHeadersToRecord } from \"../utils/headers.ts\";\nimport { parseStreamingJson } from \"../utils/json-parse.ts\";\nimport { resolveHttpProxyUrlForTarget } from \"../utils/node-http-proxy.ts\";\nimport { getProviderEnvValue } from \"../utils/provider-env.ts\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.ts\";\nimport { resolveJsonSchemaStrictSampling } from \"./constrained-sampling.ts\";\nimport {\n\tadjustMaxTokensForThinking,\n\tbuildBaseOptions,\n\tclampMaxTokensToContext,\n\tclampReasoning,\n} from \"./simple-options.ts\";\nimport { transformMessages } from \"./transform-messages.ts\";\n\nexport type BedrockThinkingDisplay = \"summarized\" | \"omitted\";\n\nexport interface BedrockOptions extends StreamOptions {\n\tregion?: string;\n\tprofile?: string;\n\ttoolChoice?: \"auto\" | \"any\" | \"none\" | { type: \"tool\"; name: string };\n\t/* See https://docs.aws.amazon.com/bedrock/latest/userguide/inference-reasoning.html for supported models. */\n\treasoning?: ThinkingLevel;\n\t/* Custom token budgets per thinking level. Overrides default budgets. */\n\tthinkingBudgets?: ThinkingBudgets;\n\t/* Only supported by Claude 4.x models, see https://docs.aws.amazon.com/bedrock/latest/userguide/claude-messages-extended-thinking.html#claude-messages-extended-thinking-tool-use-interleaved */\n\tinterleavedThinking?: boolean;\n\t/**\n\t * Controls how Claude's thinking content is returned in responses.\n\t * - \"summarized\": Thinking blocks contain summarized thinking text (default here).\n\t * - \"omitted\": Thinking content is redacted but the signature still travels back\n\t * for multi-turn continuity, reducing time-to-first-text-token.\n\t *\n\t * Note: Anthropic's API default for Claude Opus 4.8 and Mythos Preview is\n\t * \"omitted\". We default to \"summarized\" here to keep behavior consistent with\n\t * older Claude 4 models. Only applies to Claude models on Bedrock.\n\t */\n\tthinkingDisplay?: BedrockThinkingDisplay;\n\t/** Key-value pairs attached to the inference request for cost allocation tagging.\n\t * Keys: max 64 chars, no `aws:` prefix. Values: max 256 chars. Max 50 pairs.\n\t * Tags appear in AWS Cost Explorer split cost allocation data.\n\t * @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html */\n\trequestMetadata?: Record<string, string>;\n\t/** Bearer token for Bedrock API key authentication.\n\t * When set, bypasses SigV4 signing and sends Authorization: Bearer <token> instead.\n\t * Requires `bedrock:CallWithBearerToken` IAM permission on the token's identity.\n\t * Set via AWS_BEARER_TOKEN_BEDROCK env var or pass directly.\n\t * @see https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonbedrock.html */\n\tbearerToken?: string;\n}\n\ntype Block = (TextContent | ThinkingContent | ToolCall) & { index?: number; partialJson?: string };\n\nconst EMPTY_TEXT_PLACEHOLDER = \"<empty>\";\n\nexport const stream: StreamFunction<\"bedrock-converse-stream\", BedrockOptions> = (\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcontext: Context,\n\toptions: BedrockOptions = {},\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"bedrock-converse-stream\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\tconst blocks = output.content as Block[];\n\n\t\t// A profile explicitly configured through pi's auth flow (the `profile`\n\t\t// option or scoped `AWS_PROFILE` on the stored credential's env) must win\n\t\t// over ambient AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY. The SDK default\n\t\t// chain already prefers a configured profile over env keys, but only when\n\t\t// `credentials` is not set on the client config. See #6957.\n\t\tconst optionsProfile = options.profile || options.env?.AWS_PROFILE;\n\t\tconst config: BedrockRuntimeClientConfig = {\n\t\t\tprofile: optionsProfile || getProviderEnvValue(\"AWS_PROFILE\", options.env),\n\t\t};\n\t\tconst configuredRegion = getConfiguredBedrockRegion(options);\n\t\tconst hasAmbientConfiguredProfile = Boolean(getProviderEnvValue(\"AWS_PROFILE\"));\n\t\tconst endpointRegion = getStandardBedrockEndpointRegion(model.baseUrl);\n\t\tconst useExplicitEndpoint = shouldUseExplicitBedrockEndpoint(\n\t\t\tmodel.baseUrl,\n\t\t\tconfiguredRegion,\n\t\t\thasAmbientConfiguredProfile,\n\t\t);\n\n\t\t// Only pin standard AWS Bedrock runtime endpoints when no region or ambient AWS_PROFILE is configured.\n\t\t// This preserves custom endpoints (VPC/proxy) from #3402 without forcing built-in\n\t\t// catalog defaults such as us-east-1 to override AWS_REGION/AWS_PROFILE.\n\t\tif (useExplicitEndpoint) {\n\t\t\tconfig.endpoint = model.baseUrl;\n\t\t}\n\n\t\t// Resolve bearer token for Bedrock API key auth.\n\t\tconst skipAuth = getProviderEnvValue(\"AWS_BEDROCK_SKIP_AUTH\", options.env) === \"1\";\n\t\tconst bearerToken =\n\t\t\toptions.bearerToken ||\n\t\t\toptions.apiKey ||\n\t\t\tgetProviderEnvValue(\"AWS_BEARER_TOKEN_BEDROCK\", options.env) ||\n\t\t\tundefined;\n\t\tconst useBearerToken = bearerToken !== undefined && !skipAuth;\n\n\t\t// in Node.js/Bun environment only\n\t\tif (typeof process !== \"undefined\" && (process.versions?.node || process.versions?.bun)) {\n\t\t\t// Region resolution: ARN-embedded > explicit option > env vars > SDK default chain.\n\t\t\t// When the model ID is an inference profile ARN, extract the region from it.\n\t\t\t// This avoids conflicts with AWS_REGION set for other services.\n\t\t\tconst arnRegionMatch = model.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);\n\t\t\tif (arnRegionMatch) {\n\t\t\t\tconfig.region = arnRegionMatch[1];\n\t\t\t} else if (configuredRegion) {\n\t\t\t\tconfig.region = configuredRegion;\n\t\t\t} else if (endpointRegion && useExplicitEndpoint) {\n\t\t\t\tconfig.region = endpointRegion;\n\t\t\t} else if (!hasAmbientConfiguredProfile) {\n\t\t\t\tconfig.region = \"us-east-1\";\n\t\t\t}\n\n\t\t\t// Support proxies that don't need authentication\n\t\t\tif (skipAuth) {\n\t\t\t\tconfig.credentials = {\n\t\t\t\t\taccessKeyId: \"dummy-access-key\",\n\t\t\t\t\tsecretAccessKey: \"dummy-secret-key\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst credentials = getConfiguredBedrockCredentials(options.env);\n\t\t\tif (!skipAuth && credentials && !optionsProfile) {\n\t\t\t\tconfig.credentials = credentials;\n\t\t\t}\n\n\t\t\tconst proxyUrl = resolveHttpProxyUrlForTarget(model.baseUrl, options.env);\n\t\t\tif (proxyUrl) {\n\t\t\t\t// Bedrock runtime uses NodeHttp2Handler by default since v3.798.0, which is based\n\t\t\t\t// on `http2` module and has no support for http agent.\n\t\t\t\t// Use NodeHttpHandler to support HTTP(S) proxy agents.\n\t\t\t\tconfig.requestHandler = new NodeHttpHandler({\n\t\t\t\t\thttpAgent: new HttpProxyAgent(proxyUrl),\n\t\t\t\t\thttpsAgent: new HttpsProxyAgent(proxyUrl) as unknown as HttpsAgent,\n\t\t\t\t});\n\t\t\t} else if (getProviderEnvValue(\"AWS_BEDROCK_FORCE_HTTP1\", options.env) === \"1\") {\n\t\t\t\t// Some custom endpoints require HTTP/1.1 instead of HTTP/2\n\t\t\t\tconfig.requestHandler = new NodeHttpHandler();\n\t\t\t}\n\t\t} else {\n\t\t\t// Non-Node environment (browser): fall back to us-east-1 since\n\t\t\t// there's no config file resolution available.\n\t\t\tconfig.region =\n\t\t\t\tconfiguredRegion || (endpointRegion && useExplicitEndpoint ? endpointRegion : undefined) || \"us-east-1\";\n\t\t}\n\n\t\tif (useBearerToken) {\n\t\t\tconfig.token = { token: bearerToken };\n\t\t\tconfig.authSchemePreference = [\"httpBearerAuth\"];\n\t\t}\n\n\t\ttry {\n\t\t\tconst client = new BedrockRuntimeClient(config);\n\t\t\tconst customHeaders = providerHeadersToRecord(options.headers);\n\t\t\tif (customHeaders) {\n\t\t\t\taddCustomHeadersMiddleware(client, customHeaders);\n\t\t\t}\n\t\t\tconst cacheRetention = resolveCacheRetention(options.cacheRetention, options.env);\n\t\t\tconst inferenceMaxTokens = options.maxTokens ?? (isAnthropicClaudeModel(model) ? model.maxTokens : undefined);\n\t\t\tlet commandInput = {\n\t\t\t\tmodelId: model.id,\n\t\t\t\tmessages: convertMessages(context, model, cacheRetention, options.env),\n\t\t\t\tsystem: buildSystemPrompt(context.systemPrompt, model, cacheRetention, options.env),\n\t\t\t\tinferenceConfig: {\n\t\t\t\t\t...(inferenceMaxTokens !== undefined && { maxTokens: inferenceMaxTokens }),\n\t\t\t\t\t...(options.temperature !== undefined && { temperature: options.temperature }),\n\t\t\t\t},\n\t\t\t\ttoolConfig: convertToolConfig(context.tools, options.toolChoice, model.compat?.supportsStrictMode ?? false),\n\t\t\t\tadditionalModelRequestFields: buildAdditionalModelRequestFields(model, options),\n\t\t\t\t...(options.requestMetadata !== undefined && { requestMetadata: options.requestMetadata }),\n\t\t\t};\n\t\t\tconst nextCommandInput = await options?.onPayload?.(commandInput, model);\n\t\t\tif (nextCommandInput !== undefined) {\n\t\t\t\tcommandInput = nextCommandInput as typeof commandInput;\n\t\t\t}\n\t\t\tconst command = new ConverseStreamCommand(commandInput);\n\n\t\t\tconst response = await client.send(command, { abortSignal: options.signal });\n\t\t\tif (response.$metadata.httpStatusCode !== undefined) {\n\t\t\t\tconst responseHeaders: Record<string, string> = {};\n\t\t\t\tif (response.$metadata.requestId) {\n\t\t\t\t\tresponseHeaders[\"x-amzn-requestid\"] = response.$metadata.requestId;\n\t\t\t\t}\n\t\t\t\tawait options?.onResponse?.({ status: response.$metadata.httpStatusCode, headers: responseHeaders }, model);\n\t\t\t}\n\n\t\t\tfor await (const item of response.stream!) {\n\t\t\t\tif (item.messageStart) {\n\t\t\t\t\tif (item.messageStart.role !== ConversationRole.ASSISTANT) {\n\t\t\t\t\t\tthrow new Error(\"Unexpected assistant message start but got user message start instead\");\n\t\t\t\t\t}\n\t\t\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\t\t} else if (item.contentBlockStart) {\n\t\t\t\t\thandleContentBlockStart(item.contentBlockStart, blocks, output, stream);\n\t\t\t\t} else if (item.contentBlockDelta) {\n\t\t\t\t\thandleContentBlockDelta(item.contentBlockDelta, blocks, output, stream);\n\t\t\t\t} else if (item.contentBlockStop) {\n\t\t\t\t\thandleContentBlockStop(item.contentBlockStop, blocks, output, stream);\n\t\t\t\t} else if (item.messageStop) {\n\t\t\t\t\toutput.rawStopReason = item.messageStop.stopReason;\n\t\t\t\t\tconst { stopReason, errorMessage } = mapStopReason(item.messageStop.stopReason);\n\t\t\t\t\toutput.stopReason = stopReason;\n\t\t\t\t\tif (errorMessage) {\n\t\t\t\t\t\toutput.errorMessage = errorMessage;\n\t\t\t\t\t}\n\t\t\t\t} else if (item.metadata) {\n\t\t\t\t\thandleMetadata(item.metadata, model, output);\n\t\t\t\t} else if (item.internalServerException) {\n\t\t\t\t\tthrow item.internalServerException;\n\t\t\t\t} else if (item.modelStreamErrorException) {\n\t\t\t\t\tthrow item.modelStreamErrorException;\n\t\t\t\t} else if (item.validationException) {\n\t\t\t\t\tthrow item.validationException;\n\t\t\t\t} else if (item.throttlingException) {\n\t\t\t\t\tthrow item.throttlingException;\n\t\t\t\t} else if (item.serviceUnavailableException) {\n\t\t\t\t\tthrow item.serviceUnavailableException;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"Bedrock stream ended without a stop reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"error\" || output.stopReason === \"aborted\") {\n\t\t\t\tthrow new Error(output.errorMessage || \"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\tfor (const block of output.content) {\n\t\t\t\tdelete (block as Block).index;\n\t\t\t\t// partialJson is only a streaming scratch buffer; never persist it.\n\t\t\t\tdelete (block as Block).partialJson;\n\t\t\t}\n\t\t\toutput.stopReason = options.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatBedrockError(error);\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\n/**\n * Human-readable prefixes for Bedrock SDK exception names.\n * The downstream retry logic in agent-session matches patterns like\n * `server.?error` and `service.?unavailable`, so we preserve the legacy\n * prefix format rather than using the raw SDK exception name.\n */\nconst BEDROCK_ERROR_PREFIXES: Record<string, string> = {\n\tInternalServerException: \"Internal server error\",\n\tModelStreamErrorException: \"Model stream error\",\n\tValidationException: \"Validation error\",\n\tThrottlingException: \"Throttling error\",\n\tServiceUnavailableException: \"Service unavailable\",\n};\n\n/**\n * Some models reject the account/profile's configured Bedrock data retention mode\n * (e.g. \"data retention mode 'default' is not available for this model\"). Point\n * users at the AWS docs explaining how to configure a supported mode.\n */\nconst BEDROCK_DATA_RETENTION_DOCS_URL = \"https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html\";\n\n/**\n * Format a Bedrock error with a human-readable prefix.\n * AWS SDK exceptions (both from `client.send()` and from stream event items)\n * extend BedrockRuntimeServiceException. We map the `.name` to a stable\n * human-readable prefix so downstream consumers (retry logic, context-overflow\n * detection) can distinguish error categories via simple string matching.\n */\nfunction formatBedrockError(error: unknown): string {\n\tconst norm = normalizeProviderError(error);\n\t// Surface the raw HTTP body (with status) when the SDK did not fold it into\n\t// the message; otherwise fall back to the message. This is what stops a\n\t// gateway 403 from collapsing to `Unknown: UnknownError`.\n\tconst core =\n\t\t!norm.messageCarriesBody && norm.status !== undefined && norm.body !== undefined\n\t\t\t? `${norm.status}: ${norm.body}`\n\t\t\t: norm.message;\n\tconst dataRetentionHint = /data retention mode/i.test(core)\n\t\t? ` See ${BEDROCK_DATA_RETENTION_DOCS_URL} for supported data retention modes.`\n\t\t: \"\";\n\tif (error instanceof BedrockRuntimeServiceException) {\n\t\tconst prefix = BEDROCK_ERROR_PREFIXES[error.name] ?? error.name;\n\t\treturn `${prefix}: ${core}${dataRetentionHint}`;\n\t}\n\treturn `${core}${dataRetentionHint}`;\n}\n\n/**\n * Header keys that must never be overwritten by caller-supplied headers.\n * `host` and `x-amz-*` participate in the SigV4 canonical request; `authorization`\n * is owned by SigV4 or the bearer-token path (config.token + authSchemePreference).\n * Compared case-insensitively (caller key is lower-cased before lookup).\n */\nconst RESERVED_HEADER_EXACT = new Set([\"authorization\", \"host\"]);\n\nfunction isReservedHeader(key: string): boolean {\n\tconst lower = key.toLowerCase();\n\treturn lower.startsWith(\"x-amz-\") || RESERVED_HEADER_EXACT.has(lower);\n}\n\n/**\n * Attach caller-supplied headers to the outgoing Bedrock request via a Smithy\n * `build`-step middleware. The `build` step runs after request serialisation but\n * before SigV4 signing, so injected headers are covered by the signature. Reserved\n * SigV4 / auth headers (`x-amz-*`, `authorization`, `host`) are silently skipped;\n * all other caller headers override any existing same-named header on the request.\n */\nfunction addCustomHeadersMiddleware(client: BedrockRuntimeClient, headers: Record<string, string>): void {\n\tconst middleware: BuildMiddleware<object, MetadataBearer> = (next) => async (args) => {\n\t\tconst request = args.request;\n\t\tif (request && typeof request === \"object\" && \"headers\" in request) {\n\t\t\tconst requestHeaders = (request as { headers: Record<string, string> }).headers;\n\t\t\tfor (const [key, value] of Object.entries(headers)) {\n\t\t\t\tif (!isReservedHeader(key)) {\n\t\t\t\t\trequestHeaders[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn next(args);\n\t};\n\tclient.middlewareStack.add(middleware, { step: \"build\", name: \"pi-ai-custom-headers\", priority: \"low\" });\n}\n\nexport const streamSimple: StreamFunction<\"bedrock-converse-stream\", SimpleStreamOptions> = (\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst base = buildBaseOptions(model, context, options, undefined);\n\tif (!options?.reasoning) {\n\t\treturn stream(model, context, { ...base, reasoning: undefined } satisfies BedrockOptions);\n\t}\n\n\tif (isAnthropicClaudeModel(model)) {\n\t\tif (supportsAdaptiveThinking(model.id, model.name)) {\n\t\t\treturn stream(model, context, {\n\t\t\t\t...base,\n\t\t\t\treasoning: options.reasoning,\n\t\t\t\tthinkingBudgets: options.thinkingBudgets,\n\t\t\t} satisfies BedrockOptions);\n\t\t}\n\n\t\t// Undefined means the caller did not request an output cap; let the helper use the model cap.\n\t\t// Do not coerce to 0 here, or the thinking budget would become the entire maxTokens value.\n\t\tconst adjusted = adjustMaxTokensForThinking(\n\t\t\tbase.maxTokens,\n\t\t\tmodel.maxTokens,\n\t\t\toptions.reasoning,\n\t\t\toptions.thinkingBudgets,\n\t\t);\n\n\t\tconst maxTokens = clampMaxTokensToContext(model, context, adjusted.maxTokens);\n\n\t\treturn stream(model, context, {\n\t\t\t...base,\n\t\t\tmaxTokens,\n\t\t\treasoning: options.reasoning,\n\t\t\tthinkingBudgets: {\n\t\t\t\t...(options.thinkingBudgets || {}),\n\t\t\t\t[clampReasoning(options.reasoning)!]: Math.min(adjusted.thinkingBudget, Math.max(0, maxTokens - 1024)),\n\t\t\t},\n\t\t} satisfies BedrockOptions);\n\t}\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoning: options.reasoning,\n\t\tthinkingBudgets: options.thinkingBudgets,\n\t} satisfies BedrockOptions);\n};\n\nfunction handleContentBlockStart(\n\tevent: ContentBlockStartEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst index = event.contentBlockIndex!;\n\tconst start = event.start;\n\n\tif (start?.toolUse) {\n\t\tconst block: Block = {\n\t\t\ttype: \"toolCall\",\n\t\t\tid: start.toolUse.toolUseId || \"\",\n\t\t\tname: start.toolUse.name || \"\",\n\t\t\targuments: {},\n\t\t\tpartialJson: \"\",\n\t\t\tindex,\n\t\t};\n\t\toutput.content.push(block);\n\t\tstream.push({ type: \"toolcall_start\", contentIndex: blocks.length - 1, partial: output });\n\t}\n}\n\nfunction handleContentBlockDelta(\n\tevent: ContentBlockDeltaEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst contentBlockIndex = event.contentBlockIndex!;\n\tconst delta = event.delta;\n\tlet index = blocks.findIndex((b) => b.index === contentBlockIndex);\n\tlet block = blocks[index];\n\n\tif (delta?.text !== undefined) {\n\t\t// If no text block exists yet, create one, as `handleContentBlockStart` is not sent for text blocks\n\t\tif (!block) {\n\t\t\tconst newBlock: Block = { type: \"text\", text: \"\", index: contentBlockIndex };\n\t\t\toutput.content.push(newBlock);\n\t\t\tindex = blocks.length - 1;\n\t\t\tblock = blocks[index];\n\t\t\tstream.push({ type: \"text_start\", contentIndex: index, partial: output });\n\t\t}\n\t\tif (block.type === \"text\") {\n\t\t\tblock.text += delta.text;\n\t\t\tstream.push({ type: \"text_delta\", contentIndex: index, delta: delta.text, partial: output });\n\t\t}\n\t} else if (delta?.toolUse && block?.type === \"toolCall\") {\n\t\tblock.partialJson = (block.partialJson || \"\") + (delta.toolUse.input || \"\");\n\t\tblock.arguments = parseStreamingJson(block.partialJson);\n\t\tstream.push({ type: \"toolcall_delta\", contentIndex: index, delta: delta.toolUse.input || \"\", partial: output });\n\t} else if (delta?.reasoningContent) {\n\t\tlet thinkingBlock = block;\n\t\tlet thinkingIndex = index;\n\n\t\tif (!thinkingBlock) {\n\t\t\tconst newBlock: Block = { type: \"thinking\", thinking: \"\", thinkingSignature: \"\", index: contentBlockIndex };\n\t\t\toutput.content.push(newBlock);\n\t\t\tthinkingIndex = blocks.length - 1;\n\t\t\tthinkingBlock = blocks[thinkingIndex];\n\t\t\tstream.push({ type: \"thinking_start\", contentIndex: thinkingIndex, partial: output });\n\t\t}\n\n\t\tif (thinkingBlock?.type === \"thinking\") {\n\t\t\tif (delta.reasoningContent.text) {\n\t\t\t\tthinkingBlock.thinking += delta.reasoningContent.text;\n\t\t\t\tstream.push({\n\t\t\t\t\ttype: \"thinking_delta\",\n\t\t\t\t\tcontentIndex: thinkingIndex,\n\t\t\t\t\tdelta: delta.reasoningContent.text,\n\t\t\t\t\tpartial: output,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (delta.reasoningContent.signature) {\n\t\t\t\tthinkingBlock.thinkingSignature =\n\t\t\t\t\t(thinkingBlock.thinkingSignature || \"\") + delta.reasoningContent.signature;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction handleMetadata(\n\tevent: ConverseStreamMetadataEvent,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\toutput: AssistantMessage,\n): void {\n\tif (event.usage) {\n\t\toutput.usage.input = event.usage.inputTokens || 0;\n\t\toutput.usage.output = event.usage.outputTokens || 0;\n\t\toutput.usage.cacheRead = event.usage.cacheReadInputTokens || 0;\n\t\toutput.usage.cacheWrite = event.usage.cacheWriteInputTokens || 0;\n\t\toutput.usage.totalTokens = event.usage.totalTokens || output.usage.input + output.usage.output;\n\t\tcalculateCost(model, output.usage);\n\t}\n}\n\nfunction handleContentBlockStop(\n\tevent: ContentBlockStopEvent,\n\tblocks: Block[],\n\toutput: AssistantMessage,\n\tstream: AssistantMessageEventStream,\n): void {\n\tconst index = blocks.findIndex((b) => b.index === event.contentBlockIndex);\n\tconst block = blocks[index];\n\tif (!block) return;\n\tdelete (block as Block).index;\n\n\tswitch (block.type) {\n\t\tcase \"text\":\n\t\t\tstream.push({ type: \"text_end\", contentIndex: index, content: block.text, partial: output });\n\t\t\tbreak;\n\t\tcase \"thinking\":\n\t\t\tstream.push({ type: \"thinking_end\", contentIndex: index, content: block.thinking, partial: output });\n\t\t\tbreak;\n\t\tcase \"toolCall\":\n\t\t\tblock.arguments = parseStreamingJson(block.partialJson);\n\t\t\t// Finalize in-place and strip the scratch buffer so replay only\n\t\t\t// carries parsed arguments.\n\t\t\tdelete (block as Block).partialJson;\n\t\t\tstream.push({ type: \"toolcall_end\", contentIndex: index, toolCall: block, partial: output });\n\t\t\tbreak;\n\t}\n}\n\n/**\n * Check if the model supports adaptive thinking (Opus 4.6+, Sonnet 4.6).\n * Checks both model ID and model name to support application inference profiles\n * whose ARNs don't contain the model name.\n */\nfunction getModelMatchCandidates(modelId: string, modelName?: string): string[] {\n\tconst values = modelName ? [modelId, modelName] : [modelId];\n\treturn values.flatMap((value) => {\n\t\tconst lower = value.toLowerCase();\n\t\treturn [lower, lower.replace(/[\\s_.:]+/g, \"-\")];\n\t});\n}\n\nfunction supportsAdaptiveThinking(modelId: string, modelName?: string): boolean {\n\tconst candidates = getModelMatchCandidates(modelId, modelName);\n\treturn candidates.some(\n\t\t(s) =>\n\t\t\ts.includes(\"opus-4-6\") ||\n\t\t\ts.includes(\"opus-4-7\") ||\n\t\t\ts.includes(\"opus-4-8\") ||\n\t\t\ts.includes(\"opus-5\") ||\n\t\t\ts.includes(\"sonnet-4-6\") ||\n\t\t\ts.includes(\"sonnet-5\") ||\n\t\t\ts.includes(\"fable-5\"),\n\t);\n}\n\nfunction supportsNativeXhighEffort(model: Model<\"bedrock-converse-stream\">): boolean {\n\tconst candidates = getModelMatchCandidates(model.id, model.name);\n\treturn candidates.some(\n\t\t(s) =>\n\t\t\ts.includes(\"opus-4-7\") ||\n\t\t\ts.includes(\"opus-4-8\") ||\n\t\t\ts.includes(\"opus-5\") ||\n\t\t\ts.includes(\"sonnet-5\") ||\n\t\t\ts.includes(\"fable-5\"),\n\t);\n}\n\nfunction mapThinkingLevelToEffort(\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tlevel: SimpleStreamOptions[\"reasoning\"],\n): \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\" {\n\tif (level === \"xhigh\" && supportsNativeXhighEffort(model)) return \"xhigh\";\n\n\tconst mapped = level ? model.thinkingLevelMap?.[level] : undefined;\n\tif (typeof mapped === \"string\") return mapped as \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n\tswitch (level) {\n\t\tcase \"minimal\":\n\t\tcase \"low\":\n\t\t\treturn \"low\";\n\t\tcase \"medium\":\n\t\t\treturn \"medium\";\n\t\tcase \"high\":\n\t\t\treturn \"high\";\n\t\tdefault:\n\t\t\treturn \"high\";\n\t}\n}\n\n/**\n * Resolve cache retention preference.\n * Defaults to \"short\" and uses PI_CACHE_RETENTION for backward compatibility.\n */\nfunction resolveCacheRetention(cacheRetention?: CacheRetention, env?: ProviderEnv): CacheRetention {\n\tif (cacheRetention) {\n\t\treturn cacheRetention;\n\t}\n\tif (getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\") {\n\t\treturn \"long\";\n\t}\n\treturn \"short\";\n}\n\n/**\n * Check if the model is an Anthropic Claude model on Bedrock.\n * Checks both model ID and model name to support application inference profiles\n * whose ARNs don't contain the model name.\n */\nfunction isAnthropicClaudeModel(model: Model<\"bedrock-converse-stream\">): boolean {\n\tconst id = model.id.toLowerCase();\n\tconst name = model.name?.toLowerCase() ?? \"\";\n\treturn (\n\t\tid.includes(\"anthropic.claude\") ||\n\t\tid.includes(\"anthropic/claude\") ||\n\t\tname.includes(\"anthropic.claude\") ||\n\t\tname.includes(\"anthropic/claude\") ||\n\t\tname.includes(\"claude\")\n\t);\n}\n\n/**\n * Check if the model supports prompt caching.\n * Supported: Claude 3.5 Haiku, Claude 3.7 Sonnet, Claude 4.x models, Claude 5 models\n *\n * For base models and system-defined inference profiles the model ID / ARN\n * contains the model name, so we can decide locally.\n *\n * For application inference profiles (whose ARNs don't contain the model name),\n * also checks model.name which is user-controlled via models.json or registerProvider.\n * As a last resort, set AWS_BEDROCK_FORCE_CACHE=1 to enable cache points.\n * Amazon Nova models have automatic caching and don't need explicit cache points.\n */\nfunction supportsPromptCaching(model: Model<\"bedrock-converse-stream\">, env?: ProviderEnv): boolean {\n\tconst candidates = getModelMatchCandidates(model.id, model.name);\n\n\tconst hasClaudeRef = candidates.some((s) => s.includes(\"claude\"));\n\tif (!hasClaudeRef) {\n\t\t// Application inference profiles don't contain the model name in the ARN.\n\t\t// Allow users to force cache points via environment variable.\n\t\tif (getProviderEnvValue(\"AWS_BEDROCK_FORCE_CACHE\", env) === \"1\") return true;\n\t\treturn false;\n\t}\n\t// Claude 5 models (fable-5, opus-5, sonnet-5)\n\tif (candidates.some((s) => s.includes(\"fable-5\") || s.includes(\"opus-5\") || s.includes(\"sonnet-5\"))) return true;\n\t// Claude 4.x models (opus-4, sonnet-4, haiku-4)\n\tif (candidates.some((s) => s.includes(\"-4-\"))) return true;\n\t// Claude 3.7 Sonnet\n\tif (candidates.some((s) => s.includes(\"claude-3-7-sonnet\"))) return true;\n\t// Claude 3.5 Haiku\n\tif (candidates.some((s) => s.includes(\"claude-3-5-haiku\"))) return true;\n\treturn false;\n}\n\n/**\n * Check if the model supports thinking signatures in reasoningContent.\n * Only Anthropic Claude models support the signature field.\n * Other models (OpenAI, Qwen, Minimax, Moonshot, etc.) reject it with:\n * \"This model doesn't support the reasoningContent.reasoningText.signature field\"\n *\n * Checks both model ID and model name to support application inference profiles.\n */\nfunction supportsThinkingSignature(model: Model<\"bedrock-converse-stream\">): boolean {\n\treturn isAnthropicClaudeModel(model);\n}\n\nfunction buildSystemPrompt(\n\tsystemPrompt: string | undefined,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcacheRetention: CacheRetention,\n\tenv?: ProviderEnv,\n): SystemContentBlock[] | undefined {\n\tif (!systemPrompt) return undefined;\n\n\tconst blocks: SystemContentBlock[] = [{ text: sanitizeSurrogates(systemPrompt) }];\n\n\t// Add cache point for supported Claude models when caching is enabled\n\tif (cacheRetention !== \"none\" && supportsPromptCaching(model, env)) {\n\t\tblocks.push({\n\t\t\tcachePoint: { type: CachePointType.DEFAULT, ...(cacheRetention === \"long\" ? { ttl: CacheTTL.ONE_HOUR } : {}) },\n\t\t});\n\t}\n\n\treturn blocks;\n}\n\nfunction normalizeToolCallId(id: string): string {\n\tconst sanitized = id.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n\treturn sanitized.length > 64 ? sanitized.slice(0, 64) : sanitized;\n}\n\nfunction createNonBlankTextBlock(text: string): ContentBlock.TextMember | undefined {\n\tconst sanitized = sanitizeSurrogates(text);\n\treturn sanitized.trim().length === 0 ? undefined : { text: sanitized };\n}\n\nfunction createRequiredTextBlock(text: string): ContentBlock.TextMember {\n\treturn createNonBlankTextBlock(text) ?? { text: EMPTY_TEXT_PLACEHOLDER };\n}\n\nfunction convertToolResultContent(content: (TextContent | ImageContent)[]): ToolResultContentBlock[] {\n\tconst result: ToolResultContentBlock[] = [];\n\tfor (const c of content) {\n\t\tif (c.type === \"image\") {\n\t\t\tresult.push({ image: createImageBlock(c.mimeType, c.data) });\n\t\t} else {\n\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\tif (textBlock) result.push(textBlock);\n\t\t}\n\t}\n\tif (result.length === 0) result.push({ text: EMPTY_TEXT_PLACEHOLDER });\n\treturn result;\n}\n\nfunction convertMessages(\n\tcontext: Context,\n\tmodel: Model<\"bedrock-converse-stream\">,\n\tcacheRetention: CacheRetention,\n\tenv?: ProviderEnv,\n): Message[] {\n\tconst result: Message[] = [];\n\tconst transformedMessages = transformMessages(context.messages, model, normalizeToolCallId);\n\n\tfor (let i = 0; i < transformedMessages.length; i++) {\n\t\tconst m = transformedMessages[i];\n\n\t\tswitch (m.role) {\n\t\t\tcase \"user\": {\n\t\t\t\tconst content: ContentBlock[] = [];\n\t\t\t\tif (typeof m.content === \"string\") {\n\t\t\t\t\tcontent.push(createRequiredTextBlock(m.content));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const c of m.content) {\n\t\t\t\t\t\tswitch (c.type) {\n\t\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\t\t\t\t\t\tif (textBlock) content.push(textBlock);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"image\":\n\t\t\t\t\t\t\t\tcontent.push({ image: createImageBlock(c.mimeType, c.data) });\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (content.length === 0) content.push({ text: EMPTY_TEXT_PLACEHOLDER });\n\t\t\t\t}\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.USER,\n\t\t\t\t\tcontent,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"assistant\": {\n\t\t\t\t// Skip assistant messages with empty content (e.g., from aborted requests)\n\t\t\t\t// Bedrock rejects messages with empty content arrays\n\t\t\t\tif (m.content.length === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst contentBlocks: ContentBlock[] = [];\n\t\t\t\tfor (const c of m.content) {\n\t\t\t\t\tswitch (c.type) {\n\t\t\t\t\t\tcase \"text\": {\n\t\t\t\t\t\t\t// Skip empty text blocks\n\t\t\t\t\t\t\tconst textBlock = createNonBlankTextBlock(c.text);\n\t\t\t\t\t\t\tif (!textBlock) continue;\n\t\t\t\t\t\t\tcontentBlocks.push(textBlock);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"toolCall\":\n\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\ttoolUse: { toolUseId: c.id, name: c.name, input: c.arguments },\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"thinking\": {\n\t\t\t\t\t\t\t// Skip empty thinking blocks\n\t\t\t\t\t\t\tconst thinking = sanitizeSurrogates(c.thinking);\n\t\t\t\t\t\t\tif (thinking.trim().length === 0) continue;\n\t\t\t\t\t\t\t// Only Anthropic models support the signature field in reasoningText.\n\t\t\t\t\t\t\t// For other models, we omit the signature to avoid errors like:\n\t\t\t\t\t\t\t// \"This model doesn't support the reasoningContent.reasoningText.signature field\"\n\t\t\t\t\t\t\tif (supportsThinkingSignature(model)) {\n\t\t\t\t\t\t\t\t// Signatures arrive after thinking deltas. If a partial or externally\n\t\t\t\t\t\t\t\t// persisted message lacks a signature, Bedrock rejects the replayed\n\t\t\t\t\t\t\t\t// reasoning block. Fall back to plain text, matching Anthropic.\n\t\t\t\t\t\t\t\tif (!c.thinkingSignature || c.thinkingSignature.trim().length === 0) {\n\t\t\t\t\t\t\t\t\tcontentBlocks.push({ text: thinking });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\t\t\treasoningContent: {\n\t\t\t\t\t\t\t\t\t\t\treasoningText: {\n\t\t\t\t\t\t\t\t\t\t\t\ttext: thinking,\n\t\t\t\t\t\t\t\t\t\t\t\tsignature: c.thinkingSignature,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcontentBlocks.push({\n\t\t\t\t\t\t\t\t\treasoningContent: {\n\t\t\t\t\t\t\t\t\t\treasoningText: { text: thinking },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Skip if all content blocks were filtered out\n\t\t\t\tif (contentBlocks.length === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.ASSISTANT,\n\t\t\t\t\tcontent: contentBlocks,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"toolResult\": {\n\t\t\t\t// Collect all consecutive toolResult messages into a single user message\n\t\t\t\t// Bedrock requires all tool results to be in one message\n\t\t\t\tconst toolResults: ContentBlock.ToolResultMember[] = [];\n\n\t\t\t\t// Add current tool result with all content blocks combined\n\t\t\t\ttoolResults.push({\n\t\t\t\t\ttoolResult: {\n\t\t\t\t\t\ttoolUseId: m.toolCallId,\n\t\t\t\t\t\tcontent: convertToolResultContent(m.content),\n\t\t\t\t\t\tstatus: m.isError ? ToolResultStatus.ERROR : ToolResultStatus.SUCCESS,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\t// Look ahead for consecutive toolResult messages\n\t\t\t\tlet j = i + 1;\n\t\t\t\twhile (j < transformedMessages.length && transformedMessages[j].role === \"toolResult\") {\n\t\t\t\t\tconst nextMsg = transformedMessages[j] as ToolResultMessage;\n\t\t\t\t\ttoolResults.push({\n\t\t\t\t\t\ttoolResult: {\n\t\t\t\t\t\t\ttoolUseId: nextMsg.toolCallId,\n\t\t\t\t\t\t\tcontent: convertToolResultContent(nextMsg.content),\n\t\t\t\t\t\t\tstatus: nextMsg.isError ? ToolResultStatus.ERROR : ToolResultStatus.SUCCESS,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t\t// Skip the messages we've already processed\n\t\t\t\ti = j - 1;\n\n\t\t\t\tresult.push({\n\t\t\t\t\trole: ConversationRole.USER,\n\t\t\t\t\tcontent: toolResults,\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t}\n\n\t// Add cache point to the last user message for supported Claude models when caching is enabled\n\tif (cacheRetention !== \"none\" && supportsPromptCaching(model, env) && result.length > 0) {\n\t\tconst lastMessage = result[result.length - 1];\n\t\tif (lastMessage.role === ConversationRole.USER && lastMessage.content) {\n\t\t\t(lastMessage.content as ContentBlock[]).push({\n\t\t\t\tcachePoint: {\n\t\t\t\t\ttype: CachePointType.DEFAULT,\n\t\t\t\t\t...(cacheRetention === \"long\" ? { ttl: CacheTTL.ONE_HOUR } : {}),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction convertToolConfig(\n\ttools: Tool[] | undefined,\n\ttoolChoice: BedrockOptions[\"toolChoice\"],\n\tsupportsStrictMode: boolean,\n): ToolConfiguration | undefined {\n\tif (!tools?.length) return undefined;\n\tif (toolChoice === \"none\") return undefined;\n\n\tconst bedrockTools: BedrockTool[] = tools.map((tool) => {\n\t\tconst strict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode);\n\t\treturn {\n\t\t\ttoolSpec: {\n\t\t\t\tname: tool.name,\n\t\t\t\tdescription: tool.description,\n\t\t\t\tinputSchema: { json: tool.parameters as unknown as DocumentType },\n\t\t\t\t...(strict === true ? { strict: true } : {}),\n\t\t\t},\n\t\t};\n\t});\n\n\tlet bedrockToolChoice: ToolChoice | undefined;\n\tswitch (toolChoice) {\n\t\tcase \"auto\":\n\t\t\tbedrockToolChoice = { auto: {} };\n\t\t\tbreak;\n\t\tcase \"any\":\n\t\t\tbedrockToolChoice = { any: {} };\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (toolChoice?.type === \"tool\") {\n\t\t\t\tbedrockToolChoice = { tool: { name: toolChoice.name } };\n\t\t\t}\n\t}\n\n\treturn { tools: bedrockTools, toolChoice: bedrockToolChoice };\n}\n\nfunction mapStopReason(reason: string | undefined): { stopReason: StopReason; errorMessage?: string } {\n\tswitch (reason) {\n\t\tcase BedrockStopReason.END_TURN:\n\t\tcase BedrockStopReason.STOP_SEQUENCE:\n\t\t\treturn { stopReason: \"stop\" };\n\t\tcase BedrockStopReason.MAX_TOKENS:\n\t\tcase BedrockStopReason.MODEL_CONTEXT_WINDOW_EXCEEDED:\n\t\t\treturn { stopReason: \"length\" };\n\t\tcase BedrockStopReason.TOOL_USE:\n\t\t\treturn { stopReason: \"toolUse\" };\n\t\tdefault:\n\t\t\treturn reason\n\t\t\t\t? { stopReason: \"error\", errorMessage: `Provider stopped with: ${reason}` }\n\t\t\t\t: { stopReason: \"error\" };\n\t}\n}\n\nfunction getConfiguredBedrockRegion(options: BedrockOptions): string | undefined {\n\treturn (\n\t\toptions.region ||\n\t\tgetProviderEnvValue(\"AWS_REGION\", options.env) ||\n\t\tgetProviderEnvValue(\"AWS_DEFAULT_REGION\", options.env) ||\n\t\tundefined\n\t);\n}\n\nfunction getConfiguredBedrockCredentials(env?: ProviderEnv): BedrockRuntimeClientConfig[\"credentials\"] | undefined {\n\tconst accessKeyId = getProviderEnvValue(\"AWS_ACCESS_KEY_ID\", env);\n\tconst secretAccessKey = getProviderEnvValue(\"AWS_SECRET_ACCESS_KEY\", env);\n\tif (!accessKeyId || !secretAccessKey) {\n\t\treturn undefined;\n\t}\n\tconst sessionToken = getProviderEnvValue(\"AWS_SESSION_TOKEN\", env);\n\treturn {\n\t\taccessKeyId,\n\t\tsecretAccessKey,\n\t\t...(sessionToken ? { sessionToken } : {}),\n\t};\n}\n\nfunction getStandardBedrockEndpointRegion(baseUrl: string | undefined): string | undefined {\n\tif (!baseUrl) {\n\t\treturn undefined;\n\t}\n\n\ttry {\n\t\tconst { hostname } = new URL(baseUrl);\n\t\tconst match = hostname.toLowerCase().match(/^bedrock-runtime(?:-fips)?\\.([a-z0-9-]+)\\.amazonaws\\.com(?:\\.cn)?$/);\n\t\treturn match?.[1];\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction shouldUseExplicitBedrockEndpoint(\n\tbaseUrl: string,\n\tconfiguredRegion: string | undefined,\n\thasAmbientConfiguredProfile: boolean,\n): boolean {\n\tconst endpointRegion = getStandardBedrockEndpointRegion(baseUrl);\n\tif (!endpointRegion) {\n\t\treturn true;\n\t}\n\n\treturn !configuredRegion && !hasAmbientConfiguredProfile;\n}\n\nfunction isGovCloudBedrockTarget(model: Model<\"bedrock-converse-stream\">, options: BedrockOptions): boolean {\n\tconst region = getConfiguredBedrockRegion(options);\n\tif (region?.toLowerCase().startsWith(\"us-gov-\")) {\n\t\treturn true;\n\t}\n\n\tconst modelId = model.id.toLowerCase();\n\treturn modelId.startsWith(\"us-gov.\") || modelId.startsWith(\"arn:aws-us-gov:\");\n}\n\nfunction buildAdditionalModelRequestFields(\n\tmodel: Model<\"bedrock-converse-stream\">,\n\toptions: BedrockOptions,\n): Record<string, any> | undefined {\n\tif (!options.reasoning || !model.reasoning) {\n\t\treturn undefined;\n\t}\n\n\tif (isAnthropicClaudeModel(model)) {\n\t\t// GovCloud Bedrock currently rejects the Claude thinking.display field.\n\t\t// Omit it there until the GovCloud Converse schema catches up.\n\t\tconst display = isGovCloudBedrockTarget(model, options) ? undefined : (options.thinkingDisplay ?? \"summarized\");\n\t\tconst result: Record<string, any> = supportsAdaptiveThinking(model.id, model.name)\n\t\t\t? {\n\t\t\t\t\tthinking: { type: \"adaptive\", ...(display !== undefined ? { display } : {}) },\n\t\t\t\t\toutput_config: { effort: mapThinkingLevelToEffort(model, options.reasoning) },\n\t\t\t\t}\n\t\t\t: (() => {\n\t\t\t\t\tconst defaultBudgets: Record<ThinkingLevel, number> = {\n\t\t\t\t\t\tminimal: 1024,\n\t\t\t\t\t\tlow: 2048,\n\t\t\t\t\t\tmedium: 8192,\n\t\t\t\t\t\thigh: 16384,\n\t\t\t\t\t\txhigh: 16384, // Budget-based Claude clamps extended levels to high\n\t\t\t\t\t\tmax: 16384,\n\t\t\t\t\t};\n\n\t\t\t\t\t// Custom budgets only cover token-based levels through high.\n\t\t\t\t\tconst level = options.reasoning === \"xhigh\" || options.reasoning === \"max\" ? \"high\" : options.reasoning;\n\t\t\t\t\tconst budget = options.thinkingBudgets?.[level] ?? defaultBudgets[options.reasoning];\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tthinking: {\n\t\t\t\t\t\t\ttype: \"enabled\",\n\t\t\t\t\t\t\tbudget_tokens: budget,\n\t\t\t\t\t\t\t...(display !== undefined ? { display } : {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t})();\n\n\t\tif (!supportsAdaptiveThinking(model.id, model.name) && (options.interleavedThinking ?? true)) {\n\t\t\tresult.anthropic_beta = [\"interleaved-thinking-2025-05-14\"];\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn undefined;\n}\n\nfunction createImageBlock(mimeType: string, data: string) {\n\tlet format: ImageFormat;\n\tswitch (mimeType) {\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t\t\tformat = ImageFormat.JPEG;\n\t\t\tbreak;\n\t\tcase \"image/png\":\n\t\t\tformat = ImageFormat.PNG;\n\t\t\tbreak;\n\t\tcase \"image/gif\":\n\t\t\tformat = ImageFormat.GIF;\n\t\t\tbreak;\n\t\tcase \"image/webp\":\n\t\t\tformat = ImageFormat.WEBP;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown image type: ${mimeType}`);\n\t}\n\n\tconst binaryString = atob(data);\n\tconst bytes = new Uint8Array(binaryString.length);\n\tfor (let i = 0; i < binaryString.length; i++) {\n\t\tbytes[i] = binaryString.charCodeAt(i);\n\t}\n\n\treturn { source: { bytes }, format };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"google-generative-ai.d.ts","sourceRoot":"","sources":["../../src/api/google-generative-ai.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAMX,mBAAmB,EACnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAY9D,MAAM,WAAW,aAAc,SAAQ,aAAa;IACnD,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACrC,QAAQ,CAAC,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,mBAAmB,CAAC;KAC5B,CAAC;CACF;AAKD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,sBAAsB,EAAE,aAAa,CAwOxE,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,sBAAsB,EAAE,mBAAmB,CAoCpF,CAAC","sourcesContent":["import {\n\ttype GenerateContentConfig,\n\ttype GenerateContentParameters,\n\tGoogleGenAI,\n\ttype ThinkingConfig,\n} from \"@google/genai\";\nimport { calculateCost, clampThinkingLevel } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tContext,\n\tModel,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tThinkingContent,\n\tThinkingLevel,\n\tToolCall,\n} from \"../types.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { providerHeadersToRecord } from \"../utils/headers.ts\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.ts\";\nimport type { GoogleThinkingLevel } from \"./google-shared.ts\";\nimport {\n\tconvertMessages,\n\tconvertTools,\n\tisThinkingPart,\n\tmapStopReason,\n\tresolveGoogleFunctionCallingMode,\n\tretainThoughtSignature,\n\tsupportsGoogleStrictToolSampling,\n} from \"./google-shared.ts\";\nimport { buildBaseOptions } from \"./simple-options.ts\";\n\nexport interface GoogleOptions extends StreamOptions {\n\ttoolChoice?: \"auto\" | \"none\" | \"any\";\n\tthinking?: {\n\t\tenabled: boolean;\n\t\tbudgetTokens?: number; // -1 for dynamic, 0 to disable\n\t\tlevel?: GoogleThinkingLevel;\n\t};\n}\n\n// Counter for generating unique tool call IDs\nlet toolCallCounter = 0;\n\nexport const stream: StreamFunction<\"google-generative-ai\", GoogleOptions> = (\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions?: GoogleOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"google-generative-ai\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"stop\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tconst apiKey = options?.apiKey;\n\t\t\tif (!apiKey) {\n\t\t\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t\t\t}\n\t\t\tconst client = createClient(model, apiKey, options?.headers);\n\t\t\tlet params = buildParams(model, context, options);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as GenerateContentParameters;\n\t\t\t}\n\t\t\tconst googleStream = await client.models.generateContentStream(params);\n\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\tlet currentBlock: TextContent | ThinkingContent | null = null;\n\t\t\tconst blocks = output.content;\n\t\t\tconst blockIndex = () => blocks.length - 1;\n\t\t\tfor await (const chunk of googleStream) {\n\t\t\t\t// @google/genai documents GenerateContentResponse.responseId as an output-only field\n\t\t\t\t// used to identify each response. Keep the first non-empty one from the stream.\n\t\t\t\toutput.responseId ||= chunk.responseId;\n\t\t\t\tconst candidate = chunk.candidates?.[0];\n\t\t\t\tif (candidate?.content?.parts) {\n\t\t\t\t\tfor (const part of candidate.content.parts) {\n\t\t\t\t\t\tif (part.text !== undefined) {\n\t\t\t\t\t\t\tconst isThinking = isThinkingPart(part);\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!currentBlock ||\n\t\t\t\t\t\t\t\t(isThinking && currentBlock.type !== \"thinking\") ||\n\t\t\t\t\t\t\t\t(!isThinking && currentBlock.type !== \"text\")\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tif (currentBlock) {\n\t\t\t\t\t\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\t\t\t\t\t\tcontentIndex: blocks.length - 1,\n\t\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (isThinking) {\n\t\t\t\t\t\t\t\t\tcurrentBlock = { type: \"thinking\", thinking: \"\", thinkingSignature: undefined };\n\t\t\t\t\t\t\t\t\toutput.content.push(currentBlock);\n\t\t\t\t\t\t\t\t\tstream.push({ type: \"thinking_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcurrentBlock = { type: \"text\", text: \"\" };\n\t\t\t\t\t\t\t\t\toutput.content.push(currentBlock);\n\t\t\t\t\t\t\t\t\tstream.push({ type: \"text_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (currentBlock.type === \"thinking\") {\n\t\t\t\t\t\t\t\tcurrentBlock.thinking += part.text;\n\t\t\t\t\t\t\t\tcurrentBlock.thinkingSignature = retainThoughtSignature(\n\t\t\t\t\t\t\t\t\tcurrentBlock.thinkingSignature,\n\t\t\t\t\t\t\t\t\tpart.thoughtSignature,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\ttype: \"thinking_delta\",\n\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\tdelta: part.text,\n\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrentBlock.text += part.text;\n\t\t\t\t\t\t\t\tcurrentBlock.textSignature = retainThoughtSignature(\n\t\t\t\t\t\t\t\t\tcurrentBlock.textSignature,\n\t\t\t\t\t\t\t\t\tpart.thoughtSignature,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\ttype: \"text_delta\",\n\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\tdelta: part.text,\n\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (part.functionCall) {\n\t\t\t\t\t\t\tif (currentBlock) {\n\t\t\t\t\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcurrentBlock = null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Generate unique ID if not provided or if it's a duplicate\n\t\t\t\t\t\t\tconst providedId = part.functionCall.id;\n\t\t\t\t\t\t\tconst needsNewId =\n\t\t\t\t\t\t\t\t!providedId || output.content.some((b) => b.type === \"toolCall\" && b.id === providedId);\n\t\t\t\t\t\t\tconst toolCallId = needsNewId\n\t\t\t\t\t\t\t\t? `${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`\n\t\t\t\t\t\t\t\t: providedId;\n\n\t\t\t\t\t\t\tconst toolCall: ToolCall = {\n\t\t\t\t\t\t\t\ttype: \"toolCall\",\n\t\t\t\t\t\t\t\tid: toolCallId,\n\t\t\t\t\t\t\t\tname: part.functionCall.name || \"\",\n\t\t\t\t\t\t\t\targuments: (part.functionCall.args as Record<string, any>) ?? {},\n\t\t\t\t\t\t\t\t...(part.thoughtSignature && { thoughtSignature: part.thoughtSignature }),\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\toutput.content.push(toolCall);\n\t\t\t\t\t\t\tstream.push({ type: \"toolcall_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\ttype: \"toolcall_delta\",\n\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\tdelta: JSON.stringify(toolCall.arguments),\n\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tstream.push({ type: \"toolcall_end\", contentIndex: blockIndex(), toolCall, partial: output });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (candidate?.finishReason) {\n\t\t\t\t\toutput.stopReason = mapStopReason(candidate.finishReason);\n\t\t\t\t\tif (output.content.some((b) => b.type === \"toolCall\")) {\n\t\t\t\t\t\toutput.stopReason = \"toolUse\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (chunk.usageMetadata) {\n\t\t\t\t\toutput.usage = {\n\t\t\t\t\t\tinput:\n\t\t\t\t\t\t\t(chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),\n\t\t\t\t\t\toutput:\n\t\t\t\t\t\t\t(chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),\n\t\t\t\t\t\tcacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,\n\t\t\t\t\t\tcacheWrite: 0,\n\t\t\t\t\t\treasoning: chunk.usageMetadata.thoughtsTokenCount || 0,\n\t\t\t\t\t\ttotalTokens: chunk.usageMetadata.totalTokenCount || 0,\n\t\t\t\t\t\tcost: {\n\t\t\t\t\t\t\tinput: 0,\n\t\t\t\t\t\t\toutput: 0,\n\t\t\t\t\t\t\tcacheRead: 0,\n\t\t\t\t\t\t\tcacheWrite: 0,\n\t\t\t\t\t\t\ttotal: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tcalculateCost(model, output.usage);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentBlock) {\n\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tthrow new Error(\"An unknown error occurred\");\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\t// Remove internal index property used during streaming\n\t\t\tfor (const block of output.content) {\n\t\t\t\tif (\"index\" in block) {\n\t\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatProviderError(normalizeProviderError(error));\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimple: StreamFunction<\"google-generative-ai\", SimpleStreamOptions> = (\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst apiKey = options?.apiKey;\n\tif (!apiKey) {\n\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t}\n\n\tconst base = buildBaseOptions(model, context, options, apiKey);\n\tif (!options?.reasoning) {\n\t\treturn stream(model, context, { ...base, thinking: { enabled: false } } satisfies GoogleOptions);\n\t}\n\n\tconst clampedReasoning = clampThinkingLevel(model, options.reasoning);\n\tconst effort = (clampedReasoning === \"off\" ? \"high\" : clampedReasoning) as ClampedThinkingLevel;\n\tconst googleModel = model as Model<\"google-generative-ai\">;\n\n\tif (isGemini3ProModel(googleModel) || isGemini3FlashModel(googleModel) || isGemma4Model(googleModel)) {\n\t\treturn stream(model, context, {\n\t\t\t...base,\n\t\t\tthinking: {\n\t\t\t\tenabled: true,\n\t\t\t\tlevel: getThinkingLevel(effort, googleModel),\n\t\t\t},\n\t\t} satisfies GoogleOptions);\n\t}\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\tthinking: {\n\t\t\tenabled: true,\n\t\t\tbudgetTokens: getGoogleBudget(googleModel, effort, options.thinkingBudgets),\n\t\t},\n\t} satisfies GoogleOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"google-generative-ai\">,\n\tapiKey?: string,\n\toptionsHeaders?: ProviderHeaders,\n): GoogleGenAI {\n\tconst httpOptions: { baseUrl?: string; apiVersion?: string; headers?: Record<string, string> } = {};\n\tif (model.baseUrl) {\n\t\thttpOptions.baseUrl = model.baseUrl;\n\t\thttpOptions.apiVersion = \"\"; // baseUrl already includes version path, don't append\n\t}\n\tconst headers = providerHeadersToRecord({ ...model.headers, ...optionsHeaders });\n\tif (headers) {\n\t\thttpOptions.headers = headers;\n\t}\n\n\treturn new GoogleGenAI({\n\t\tapiKey,\n\t\thttpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : undefined,\n\t});\n}\n\nfunction buildParams(\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions: GoogleOptions = {},\n): GenerateContentParameters {\n\tconst contents = convertMessages(model, context);\n\n\tconst generationConfig: GenerateContentConfig = {};\n\tif (options.temperature !== undefined) {\n\t\tgenerationConfig.temperature = options.temperature;\n\t}\n\tif (options.maxTokens !== undefined) {\n\t\tgenerationConfig.maxOutputTokens = options.maxTokens;\n\t}\n\n\tconst functionCallingMode = context.tools?.length\n\t\t? resolveGoogleFunctionCallingMode(context.tools, options.toolChoice, supportsGoogleStrictToolSampling(model.id))\n\t\t: undefined;\n\tconst config: GenerateContentConfig = {\n\t\t...(Object.keys(generationConfig).length > 0 && generationConfig),\n\t\t...(context.systemPrompt && { systemInstruction: sanitizeSurrogates(context.systemPrompt) }),\n\t\t...(context.tools && context.tools.length > 0 && { tools: convertTools(context.tools) }),\n\t\t...(functionCallingMode !== undefined && {\n\t\t\ttoolConfig: { functionCallingConfig: { mode: functionCallingMode } },\n\t\t}),\n\t};\n\n\tif (options.thinking?.enabled && model.reasoning) {\n\t\tconst thinkingConfig: ThinkingConfig = { includeThoughts: true };\n\t\tif (options.thinking.level !== undefined) {\n\t\t\t// Cast to any since our GoogleThinkingLevel mirrors Google's ThinkingLevel enum values\n\t\t\tthinkingConfig.thinkingLevel = options.thinking.level as any;\n\t\t} else if (options.thinking.budgetTokens !== undefined) {\n\t\t\tthinkingConfig.thinkingBudget = options.thinking.budgetTokens;\n\t\t}\n\t\tconfig.thinkingConfig = thinkingConfig;\n\t} else if (model.reasoning && options.thinking && !options.thinking.enabled) {\n\t\tconfig.thinkingConfig = getDisabledThinkingConfig(model);\n\t}\n\n\tif (options.signal) {\n\t\tif (options.signal.aborted) {\n\t\t\tthrow new Error(\"Request aborted\");\n\t\t}\n\t\tconfig.abortSignal = options.signal;\n\t}\n\n\tconst params: GenerateContentParameters = {\n\t\tmodel: model.id,\n\t\tcontents,\n\t\tconfig,\n\t};\n\n\treturn params;\n}\n\ntype ClampedThinkingLevel = Exclude<ThinkingLevel, \"xhigh\" | \"max\">;\n\nfunction isGemma4Model(model: Model<\"google-generative-ai\">): boolean {\n\treturn /gemma-?4/.test(model.id.toLowerCase());\n}\n\nfunction isGemini3ProModel(model: Model<\"google-generative-ai\">): boolean {\n\treturn /gemini-3(?:\\.\\d+)?-pro/.test(model.id.toLowerCase());\n}\n\nfunction isGemini3FlashModel(model: Model<\"google-generative-ai\">): boolean {\n\tconst id = model.id.toLowerCase();\n\treturn /gemini-3(?:\\.\\d+)?-flash/.test(id) || id === \"gemini-flash-latest\" || id === \"gemini-flash-lite-latest\";\n}\n\nfunction getDisabledThinkingConfig(model: Model<\"google-generative-ai\">): ThinkingConfig {\n\t// Google docs: Gemini 3.1 Pro cannot disable thinking, and Gemini 3 Flash / Flash-Lite\n\t// do not support full thinking-off either. For Gemini 3 models, use the lowest supported\n\t// thinkingLevel without includeThoughts so hidden thinking remains invisible to pi.\n\tif (isGemini3ProModel(model)) {\n\t\treturn { thinkingLevel: \"LOW\" as any };\n\t}\n\tif (isGemini3FlashModel(model)) {\n\t\treturn { thinkingLevel: \"MINIMAL\" as any };\n\t}\n\tif (isGemma4Model(model)) {\n\t\treturn { thinkingLevel: \"MINIMAL\" as any };\n\t}\n\n\t// Gemini 2.x supports disabling via thinkingBudget = 0.\n\treturn { thinkingBudget: 0 };\n}\n\nfunction getThinkingLevel(effort: ClampedThinkingLevel, model: Model<\"google-generative-ai\">): GoogleThinkingLevel {\n\tif (isGemini3ProModel(model)) {\n\t\tswitch (effort) {\n\t\t\tcase \"minimal\":\n\t\t\tcase \"low\":\n\t\t\t\treturn \"LOW\";\n\t\t\tcase \"medium\":\n\t\t\tcase \"high\":\n\t\t\t\treturn \"HIGH\";\n\t\t}\n\t}\n\tif (isGemma4Model(model)) {\n\t\tswitch (effort) {\n\t\t\tcase \"minimal\":\n\t\t\tcase \"low\":\n\t\t\t\treturn \"MINIMAL\";\n\t\t\tcase \"medium\":\n\t\t\tcase \"high\":\n\t\t\t\treturn \"HIGH\";\n\t\t}\n\t}\n\tswitch (effort) {\n\t\tcase \"minimal\":\n\t\t\treturn \"MINIMAL\";\n\t\tcase \"low\":\n\t\t\treturn \"LOW\";\n\t\tcase \"medium\":\n\t\t\treturn \"MEDIUM\";\n\t\tcase \"high\":\n\t\t\treturn \"HIGH\";\n\t}\n}\n\nfunction getGoogleBudget(\n\tmodel: Model<\"google-generative-ai\">,\n\teffort: ClampedThinkingLevel,\n\tcustomBudgets?: ThinkingBudgets,\n): number {\n\tif (customBudgets?.[effort] !== undefined) {\n\t\treturn customBudgets[effort]!;\n\t}\n\n\tif (model.id.includes(\"2.5-pro\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 128,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 32768,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\tif (model.id.includes(\"2.5-flash-lite\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 512,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 24576,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\tif (model.id.includes(\"2.5-flash\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 128,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 24576,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\treturn -1;\n}\n"]}
1
+ {"version":3,"file":"google-generative-ai.d.ts","sourceRoot":"","sources":["../../src/api/google-generative-ai.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAMX,mBAAmB,EACnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAY9D,MAAM,WAAW,aAAc,SAAQ,aAAa;IACnD,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACrC,QAAQ,CAAC,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,mBAAmB,CAAC;KAC5B,CAAC;CACF;AAKD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,sBAAsB,EAAE,aAAa,CAkPxE,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,sBAAsB,EAAE,mBAAmB,CAoCpF,CAAC","sourcesContent":["import {\n\ttype GenerateContentConfig,\n\ttype GenerateContentParameters,\n\tGoogleGenAI,\n\ttype ThinkingConfig,\n} from \"@google/genai\";\nimport { calculateCost, clampThinkingLevel } from \"../models.ts\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tContext,\n\tModel,\n\tProviderHeaders,\n\tSimpleStreamOptions,\n\tStreamFunction,\n\tStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tThinkingContent,\n\tThinkingLevel,\n\tToolCall,\n} from \"../types.ts\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.ts\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.ts\";\nimport { providerHeadersToRecord } from \"../utils/headers.ts\";\nimport { sanitizeSurrogates } from \"../utils/sanitize-unicode.ts\";\nimport type { GoogleThinkingLevel } from \"./google-shared.ts\";\nimport {\n\tconvertMessages,\n\tconvertTools,\n\tisThinkingPart,\n\tmapStopReason,\n\tresolveGoogleFunctionCallingMode,\n\tretainThoughtSignature,\n\tsupportsGoogleStrictToolSampling,\n} from \"./google-shared.ts\";\nimport { buildBaseOptions } from \"./simple-options.ts\";\n\nexport interface GoogleOptions extends StreamOptions {\n\ttoolChoice?: \"auto\" | \"none\" | \"any\";\n\tthinking?: {\n\t\tenabled: boolean;\n\t\tbudgetTokens?: number; // -1 for dynamic, 0 to disable\n\t\tlevel?: GoogleThinkingLevel;\n\t};\n}\n\n// Counter for generating unique tool call IDs\nlet toolCallCounter = 0;\n\nexport const stream: StreamFunction<\"google-generative-ai\", GoogleOptions> = (\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions?: GoogleOptions,\n): AssistantMessageEventStream => {\n\tconst stream = new AssistantMessageEventStream();\n\n\t(async () => {\n\t\tconst output: AssistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [],\n\t\t\tapi: \"google-generative-ai\" as Api,\n\t\t\tprovider: model.provider,\n\t\t\tmodel: model.id,\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\ttotalTokens: 0,\n\t\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n\t\t\t},\n\t\t\tstopReason: \"pending\",\n\t\t\ttimestamp: Date.now(),\n\t\t};\n\n\t\ttry {\n\t\t\tif (options?.fetch && options.fetch !== globalThis.fetch) {\n\t\t\t\tthrow new Error(\"Custom fetch is not supported by the Google Generative AI adapter\");\n\t\t\t}\n\t\t\tconst apiKey = options?.apiKey;\n\t\t\tif (!apiKey) {\n\t\t\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t\t\t}\n\t\t\tconst client = createClient(model, apiKey, options?.headers);\n\t\t\tlet params = buildParams(model, context, options);\n\t\t\tconst nextParams = await options?.onPayload?.(params, model);\n\t\t\tif (nextParams !== undefined) {\n\t\t\t\tparams = nextParams as GenerateContentParameters;\n\t\t\t}\n\t\t\tconst googleStream = await client.models.generateContentStream(params);\n\n\t\t\tstream.push({ type: \"start\", partial: output });\n\t\t\tlet currentBlock: TextContent | ThinkingContent | null = null;\n\t\t\tconst blocks = output.content;\n\t\t\tconst blockIndex = () => blocks.length - 1;\n\t\t\tfor await (const chunk of googleStream) {\n\t\t\t\t// @google/genai documents GenerateContentResponse.responseId as an output-only field\n\t\t\t\t// used to identify each response. Keep the first non-empty one from the stream.\n\t\t\t\toutput.responseId ||= chunk.responseId;\n\t\t\t\tconst candidate = chunk.candidates?.[0];\n\t\t\t\tif (candidate?.content?.parts) {\n\t\t\t\t\tfor (const part of candidate.content.parts) {\n\t\t\t\t\t\tif (part.text !== undefined) {\n\t\t\t\t\t\t\tconst isThinking = isThinkingPart(part);\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!currentBlock ||\n\t\t\t\t\t\t\t\t(isThinking && currentBlock.type !== \"thinking\") ||\n\t\t\t\t\t\t\t\t(!isThinking && currentBlock.type !== \"text\")\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tif (currentBlock) {\n\t\t\t\t\t\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\t\t\t\t\t\tcontentIndex: blocks.length - 1,\n\t\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (isThinking) {\n\t\t\t\t\t\t\t\t\tcurrentBlock = { type: \"thinking\", thinking: \"\", thinkingSignature: undefined };\n\t\t\t\t\t\t\t\t\toutput.content.push(currentBlock);\n\t\t\t\t\t\t\t\t\tstream.push({ type: \"thinking_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcurrentBlock = { type: \"text\", text: \"\" };\n\t\t\t\t\t\t\t\t\toutput.content.push(currentBlock);\n\t\t\t\t\t\t\t\t\tstream.push({ type: \"text_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (currentBlock.type === \"thinking\") {\n\t\t\t\t\t\t\t\tcurrentBlock.thinking += part.text;\n\t\t\t\t\t\t\t\tcurrentBlock.thinkingSignature = retainThoughtSignature(\n\t\t\t\t\t\t\t\t\tcurrentBlock.thinkingSignature,\n\t\t\t\t\t\t\t\t\tpart.thoughtSignature,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\ttype: \"thinking_delta\",\n\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\tdelta: part.text,\n\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrentBlock.text += part.text;\n\t\t\t\t\t\t\t\tcurrentBlock.textSignature = retainThoughtSignature(\n\t\t\t\t\t\t\t\t\tcurrentBlock.textSignature,\n\t\t\t\t\t\t\t\t\tpart.thoughtSignature,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\ttype: \"text_delta\",\n\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\tdelta: part.text,\n\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (part.functionCall) {\n\t\t\t\t\t\t\tif (currentBlock) {\n\t\t\t\t\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcurrentBlock = null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Generate unique ID if not provided or if it's a duplicate\n\t\t\t\t\t\t\tconst providedId = part.functionCall.id;\n\t\t\t\t\t\t\tconst needsNewId =\n\t\t\t\t\t\t\t\t!providedId || output.content.some((b) => b.type === \"toolCall\" && b.id === providedId);\n\t\t\t\t\t\t\tconst toolCallId = needsNewId\n\t\t\t\t\t\t\t\t? `${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`\n\t\t\t\t\t\t\t\t: providedId;\n\n\t\t\t\t\t\t\tconst toolCall: ToolCall = {\n\t\t\t\t\t\t\t\ttype: \"toolCall\",\n\t\t\t\t\t\t\t\tid: toolCallId,\n\t\t\t\t\t\t\t\tname: part.functionCall.name || \"\",\n\t\t\t\t\t\t\t\targuments: (part.functionCall.args as Record<string, any>) ?? {},\n\t\t\t\t\t\t\t\t...(part.thoughtSignature && { thoughtSignature: part.thoughtSignature }),\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\toutput.content.push(toolCall);\n\t\t\t\t\t\t\tstream.push({ type: \"toolcall_start\", contentIndex: blockIndex(), partial: output });\n\t\t\t\t\t\t\tstream.push({\n\t\t\t\t\t\t\t\ttype: \"toolcall_delta\",\n\t\t\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\t\t\tdelta: JSON.stringify(toolCall.arguments),\n\t\t\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tstream.push({ type: \"toolcall_end\", contentIndex: blockIndex(), toolCall, partial: output });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (candidate?.finishReason) {\n\t\t\t\t\toutput.rawStopReason = candidate.finishReason;\n\t\t\t\t\toutput.stopReason = mapStopReason(candidate.finishReason);\n\t\t\t\t\tif (output.content.some((b) => b.type === \"toolCall\")) {\n\t\t\t\t\t\toutput.stopReason = \"toolUse\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (chunk.usageMetadata) {\n\t\t\t\t\toutput.usage = {\n\t\t\t\t\t\tinput:\n\t\t\t\t\t\t\t(chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),\n\t\t\t\t\t\toutput:\n\t\t\t\t\t\t\t(chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),\n\t\t\t\t\t\tcacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,\n\t\t\t\t\t\tcacheWrite: 0,\n\t\t\t\t\t\treasoning: chunk.usageMetadata.thoughtsTokenCount || 0,\n\t\t\t\t\t\ttotalTokens: chunk.usageMetadata.totalTokenCount || 0,\n\t\t\t\t\t\tcost: {\n\t\t\t\t\t\t\tinput: 0,\n\t\t\t\t\t\t\toutput: 0,\n\t\t\t\t\t\t\tcacheRead: 0,\n\t\t\t\t\t\t\tcacheWrite: 0,\n\t\t\t\t\t\t\ttotal: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tcalculateCost(model, output.usage);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentBlock) {\n\t\t\t\tif (currentBlock.type === \"text\") {\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"text_end\",\n\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\tcontent: currentBlock.text,\n\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tstream.push({\n\t\t\t\t\t\ttype: \"thinking_end\",\n\t\t\t\t\t\tcontentIndex: blockIndex(),\n\t\t\t\t\t\tcontent: currentBlock.thinking,\n\t\t\t\t\t\tpartial: output,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options?.signal?.aborted) {\n\t\t\t\tthrow new Error(\"Request was aborted\");\n\t\t\t}\n\n\t\t\tif (output.stopReason === \"pending\") {\n\t\t\t\tthrow new Error(\"Google stream ended without a finish reason\");\n\t\t\t}\n\t\t\tif (output.stopReason === \"aborted\" || output.stopReason === \"error\") {\n\t\t\t\tconst errorMessage = output.rawStopReason\n\t\t\t\t\t? `Provider stopped with: ${output.rawStopReason}`\n\t\t\t\t\t: \"An unknown error occurred\";\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\n\t\t\tstream.push({ type: \"done\", reason: output.stopReason, message: output });\n\t\t\tstream.end();\n\t\t} catch (error) {\n\t\t\t// Remove internal index property used during streaming\n\t\t\tfor (const block of output.content) {\n\t\t\t\tif (\"index\" in block) {\n\t\t\t\t\tdelete (block as { index?: number }).index;\n\t\t\t\t}\n\t\t\t}\n\t\t\toutput.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n\t\t\toutput.errorMessage = formatProviderError(normalizeProviderError(error));\n\t\t\tstream.push({ type: \"error\", reason: output.stopReason, error: output });\n\t\t\tstream.end();\n\t\t}\n\t})();\n\n\treturn stream;\n};\n\nexport const streamSimple: StreamFunction<\"google-generative-ai\", SimpleStreamOptions> = (\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n): AssistantMessageEventStream => {\n\tconst apiKey = options?.apiKey;\n\tif (!apiKey) {\n\t\tthrow new Error(`No API key for provider: ${model.provider}`);\n\t}\n\n\tconst base = buildBaseOptions(model, context, options, apiKey);\n\tif (!options?.reasoning) {\n\t\treturn stream(model, context, { ...base, thinking: { enabled: false } } satisfies GoogleOptions);\n\t}\n\n\tconst clampedReasoning = clampThinkingLevel(model, options.reasoning);\n\tconst effort = (clampedReasoning === \"off\" ? \"high\" : clampedReasoning) as ClampedThinkingLevel;\n\tconst googleModel = model as Model<\"google-generative-ai\">;\n\n\tif (isGemini3ProModel(googleModel) || isGemini3FlashModel(googleModel) || isGemma4Model(googleModel)) {\n\t\treturn stream(model, context, {\n\t\t\t...base,\n\t\t\tthinking: {\n\t\t\t\tenabled: true,\n\t\t\t\tlevel: getThinkingLevel(effort, googleModel),\n\t\t\t},\n\t\t} satisfies GoogleOptions);\n\t}\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\tthinking: {\n\t\t\tenabled: true,\n\t\t\tbudgetTokens: getGoogleBudget(googleModel, effort, options.thinkingBudgets),\n\t\t},\n\t} satisfies GoogleOptions);\n};\n\nfunction createClient(\n\tmodel: Model<\"google-generative-ai\">,\n\tapiKey?: string,\n\toptionsHeaders?: ProviderHeaders,\n): GoogleGenAI {\n\tconst httpOptions: { baseUrl?: string; apiVersion?: string; headers?: Record<string, string> } = {};\n\tif (model.baseUrl) {\n\t\thttpOptions.baseUrl = model.baseUrl;\n\t\thttpOptions.apiVersion = \"\"; // baseUrl already includes version path, don't append\n\t}\n\tconst headers = providerHeadersToRecord({ ...model.headers, ...optionsHeaders });\n\tif (headers) {\n\t\thttpOptions.headers = headers;\n\t}\n\n\treturn new GoogleGenAI({\n\t\tapiKey,\n\t\thttpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : undefined,\n\t});\n}\n\nfunction buildParams(\n\tmodel: Model<\"google-generative-ai\">,\n\tcontext: Context,\n\toptions: GoogleOptions = {},\n): GenerateContentParameters {\n\tconst contents = convertMessages(model, context);\n\n\tconst generationConfig: GenerateContentConfig = {};\n\tif (options.temperature !== undefined) {\n\t\tgenerationConfig.temperature = options.temperature;\n\t}\n\tif (options.maxTokens !== undefined) {\n\t\tgenerationConfig.maxOutputTokens = options.maxTokens;\n\t}\n\n\tconst functionCallingMode = context.tools?.length\n\t\t? resolveGoogleFunctionCallingMode(context.tools, options.toolChoice, supportsGoogleStrictToolSampling(model.id))\n\t\t: undefined;\n\tconst config: GenerateContentConfig = {\n\t\t...(Object.keys(generationConfig).length > 0 && generationConfig),\n\t\t...(context.systemPrompt && { systemInstruction: sanitizeSurrogates(context.systemPrompt) }),\n\t\t...(context.tools && context.tools.length > 0 && { tools: convertTools(context.tools) }),\n\t\t...(functionCallingMode !== undefined && {\n\t\t\ttoolConfig: { functionCallingConfig: { mode: functionCallingMode } },\n\t\t}),\n\t};\n\n\tif (options.thinking?.enabled && model.reasoning) {\n\t\tconst thinkingConfig: ThinkingConfig = { includeThoughts: true };\n\t\tif (options.thinking.level !== undefined) {\n\t\t\t// Cast to any since our GoogleThinkingLevel mirrors Google's ThinkingLevel enum values\n\t\t\tthinkingConfig.thinkingLevel = options.thinking.level as any;\n\t\t} else if (options.thinking.budgetTokens !== undefined) {\n\t\t\tthinkingConfig.thinkingBudget = options.thinking.budgetTokens;\n\t\t}\n\t\tconfig.thinkingConfig = thinkingConfig;\n\t} else if (model.reasoning && options.thinking && !options.thinking.enabled) {\n\t\tconfig.thinkingConfig = getDisabledThinkingConfig(model);\n\t}\n\n\tif (options.signal) {\n\t\tif (options.signal.aborted) {\n\t\t\tthrow new Error(\"Request aborted\");\n\t\t}\n\t\tconfig.abortSignal = options.signal;\n\t}\n\n\tconst params: GenerateContentParameters = {\n\t\tmodel: model.id,\n\t\tcontents,\n\t\tconfig,\n\t};\n\n\treturn params;\n}\n\ntype ClampedThinkingLevel = Exclude<ThinkingLevel, \"xhigh\" | \"max\">;\n\nfunction isGemma4Model(model: Model<\"google-generative-ai\">): boolean {\n\treturn /gemma-?4/.test(model.id.toLowerCase());\n}\n\nfunction isGemini3ProModel(model: Model<\"google-generative-ai\">): boolean {\n\treturn /gemini-3(?:\\.\\d+)?-pro/.test(model.id.toLowerCase());\n}\n\nfunction isGemini3FlashModel(model: Model<\"google-generative-ai\">): boolean {\n\tconst id = model.id.toLowerCase();\n\treturn /gemini-3(?:\\.\\d+)?-flash/.test(id) || id === \"gemini-flash-latest\" || id === \"gemini-flash-lite-latest\";\n}\n\nfunction getDisabledThinkingConfig(model: Model<\"google-generative-ai\">): ThinkingConfig {\n\t// Google docs: Gemini 3.1 Pro cannot disable thinking, and Gemini 3 Flash / Flash-Lite\n\t// do not support full thinking-off either. For Gemini 3 models, use the lowest supported\n\t// thinkingLevel without includeThoughts so hidden thinking remains invisible to pi.\n\tif (isGemini3ProModel(model)) {\n\t\treturn { thinkingLevel: \"LOW\" as any };\n\t}\n\tif (isGemini3FlashModel(model)) {\n\t\treturn { thinkingLevel: \"MINIMAL\" as any };\n\t}\n\tif (isGemma4Model(model)) {\n\t\treturn { thinkingLevel: \"MINIMAL\" as any };\n\t}\n\n\t// Gemini 2.x supports disabling via thinkingBudget = 0.\n\treturn { thinkingBudget: 0 };\n}\n\nfunction getThinkingLevel(effort: ClampedThinkingLevel, model: Model<\"google-generative-ai\">): GoogleThinkingLevel {\n\tif (isGemini3ProModel(model)) {\n\t\tswitch (effort) {\n\t\t\tcase \"minimal\":\n\t\t\tcase \"low\":\n\t\t\t\treturn \"LOW\";\n\t\t\tcase \"medium\":\n\t\t\tcase \"high\":\n\t\t\t\treturn \"HIGH\";\n\t\t}\n\t}\n\tif (isGemma4Model(model)) {\n\t\tswitch (effort) {\n\t\t\tcase \"minimal\":\n\t\t\tcase \"low\":\n\t\t\t\treturn \"MINIMAL\";\n\t\t\tcase \"medium\":\n\t\t\tcase \"high\":\n\t\t\t\treturn \"HIGH\";\n\t\t}\n\t}\n\tswitch (effort) {\n\t\tcase \"minimal\":\n\t\t\treturn \"MINIMAL\";\n\t\tcase \"low\":\n\t\t\treturn \"LOW\";\n\t\tcase \"medium\":\n\t\t\treturn \"MEDIUM\";\n\t\tcase \"high\":\n\t\t\treturn \"HIGH\";\n\t}\n}\n\nfunction getGoogleBudget(\n\tmodel: Model<\"google-generative-ai\">,\n\teffort: ClampedThinkingLevel,\n\tcustomBudgets?: ThinkingBudgets,\n): number {\n\tif (customBudgets?.[effort] !== undefined) {\n\t\treturn customBudgets[effort]!;\n\t}\n\n\tif (model.id.includes(\"2.5-pro\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 128,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 32768,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\tif (model.id.includes(\"2.5-flash-lite\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 512,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 24576,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\tif (model.id.includes(\"2.5-flash\")) {\n\t\tconst budgets: Record<ClampedThinkingLevel, number> = {\n\t\t\tminimal: 128,\n\t\t\tlow: 2048,\n\t\t\tmedium: 8192,\n\t\t\thigh: 24576,\n\t\t};\n\t\treturn budgets[effort];\n\t}\n\n\treturn -1;\n}\n"]}
@@ -25,10 +25,13 @@ export const stream = (model, context, options) => {
25
25
  totalTokens: 0,
26
26
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
27
27
  },
28
- stopReason: "stop",
28
+ stopReason: "pending",
29
29
  timestamp: Date.now(),
30
30
  };
31
31
  try {
32
+ if (options?.fetch && options.fetch !== globalThis.fetch) {
33
+ throw new Error("Custom fetch is not supported by the Google Generative AI adapter");
34
+ }
32
35
  const apiKey = options?.apiKey;
33
36
  if (!apiKey) {
34
37
  throw new Error(`No API key for provider: ${model.provider}`);
@@ -152,6 +155,7 @@ export const stream = (model, context, options) => {
152
155
  }
153
156
  }
154
157
  if (candidate?.finishReason) {
158
+ output.rawStopReason = candidate.finishReason;
155
159
  output.stopReason = mapStopReason(candidate.finishReason);
156
160
  if (output.content.some((b) => b.type === "toolCall")) {
157
161
  output.stopReason = "toolUse";
@@ -197,8 +201,14 @@ export const stream = (model, context, options) => {
197
201
  if (options?.signal?.aborted) {
198
202
  throw new Error("Request was aborted");
199
203
  }
204
+ if (output.stopReason === "pending") {
205
+ throw new Error("Google stream ended without a finish reason");
206
+ }
200
207
  if (output.stopReason === "aborted" || output.stopReason === "error") {
201
- throw new Error("An unknown error occurred");
208
+ const errorMessage = output.rawStopReason
209
+ ? `Provider stopped with: ${output.rawStopReason}`
210
+ : "An unknown error occurred";
211
+ throw new Error(errorMessage);
202
212
  }
203
213
  stream.push({ type: "done", reason: output.stopReason, message: output });
204
214
  stream.end();