@langchain/core 1.2.4 → 1.2.5

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 (1246) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/agents.d.cts.map +1 -1
  3. package/dist/agents.d.ts.map +1 -1
  4. package/dist/caches/index.cjs.map +1 -1
  5. package/dist/caches/index.d.cts +0 -1
  6. package/dist/caches/index.d.cts.map +1 -1
  7. package/dist/caches/index.d.ts +0 -1
  8. package/dist/caches/index.d.ts.map +1 -1
  9. package/dist/caches/index.js.map +1 -1
  10. package/dist/callbacks/base.cjs.map +1 -1
  11. package/dist/callbacks/base.d.cts +68 -36
  12. package/dist/callbacks/base.d.cts.map +1 -1
  13. package/dist/callbacks/base.d.ts +68 -36
  14. package/dist/callbacks/base.d.ts.map +1 -1
  15. package/dist/callbacks/base.js.map +1 -1
  16. package/dist/callbacks/dispatch/index.cjs +0 -1
  17. package/dist/callbacks/dispatch/index.cjs.map +1 -1
  18. package/dist/callbacks/dispatch/index.d.cts +1 -0
  19. package/dist/callbacks/dispatch/index.d.cts.map +1 -1
  20. package/dist/callbacks/dispatch/index.d.ts +1 -0
  21. package/dist/callbacks/dispatch/index.d.ts.map +1 -1
  22. package/dist/callbacks/dispatch/index.js.map +1 -1
  23. package/dist/callbacks/dispatch/web.cjs.map +1 -1
  24. package/dist/callbacks/dispatch/web.d.cts +1 -0
  25. package/dist/callbacks/dispatch/web.d.cts.map +1 -1
  26. package/dist/callbacks/dispatch/web.d.ts +1 -0
  27. package/dist/callbacks/dispatch/web.d.ts.map +1 -1
  28. package/dist/callbacks/dispatch/web.js.map +1 -1
  29. package/dist/callbacks/manager.cjs +8 -0
  30. package/dist/callbacks/manager.cjs.map +1 -1
  31. package/dist/callbacks/manager.d.cts +1 -2
  32. package/dist/callbacks/manager.d.cts.map +1 -1
  33. package/dist/callbacks/manager.d.ts +1 -2
  34. package/dist/callbacks/manager.d.ts.map +1 -1
  35. package/dist/callbacks/manager.js +8 -0
  36. package/dist/callbacks/manager.js.map +1 -1
  37. package/dist/chat_history.cjs.map +1 -1
  38. package/dist/chat_history.d.cts +1 -0
  39. package/dist/chat_history.d.cts.map +1 -1
  40. package/dist/chat_history.d.ts +1 -0
  41. package/dist/chat_history.d.ts.map +1 -1
  42. package/dist/chat_history.js.map +1 -1
  43. package/dist/context.cjs +0 -1
  44. package/dist/context.cjs.map +1 -1
  45. package/dist/context.d.cts +0 -1
  46. package/dist/context.d.cts.map +1 -1
  47. package/dist/context.d.ts +0 -1
  48. package/dist/context.d.ts.map +1 -1
  49. package/dist/context.js.map +1 -1
  50. package/dist/document_loaders/base.cjs.map +1 -1
  51. package/dist/document_loaders/base.d.cts +0 -1
  52. package/dist/document_loaders/base.d.cts.map +1 -1
  53. package/dist/document_loaders/base.d.ts +0 -1
  54. package/dist/document_loaders/base.d.ts.map +1 -1
  55. package/dist/document_loaders/base.js.map +1 -1
  56. package/dist/document_loaders/langsmith.cjs.map +1 -1
  57. package/dist/document_loaders/langsmith.d.cts +0 -1
  58. package/dist/document_loaders/langsmith.d.cts.map +1 -1
  59. package/dist/document_loaders/langsmith.d.ts +0 -1
  60. package/dist/document_loaders/langsmith.d.ts.map +1 -1
  61. package/dist/document_loaders/langsmith.js.map +1 -1
  62. package/dist/documents/document.cjs.map +1 -1
  63. package/dist/documents/document.d.cts.map +1 -1
  64. package/dist/documents/document.d.ts.map +1 -1
  65. package/dist/documents/document.js.map +1 -1
  66. package/dist/documents/transformers.cjs.map +1 -1
  67. package/dist/documents/transformers.d.cts +0 -1
  68. package/dist/documents/transformers.d.cts.map +1 -1
  69. package/dist/documents/transformers.d.ts +0 -1
  70. package/dist/documents/transformers.d.ts.map +1 -1
  71. package/dist/documents/transformers.js.map +1 -1
  72. package/dist/embeddings.cjs.map +1 -1
  73. package/dist/embeddings.d.cts +0 -1
  74. package/dist/embeddings.d.cts.map +1 -1
  75. package/dist/embeddings.d.ts +0 -1
  76. package/dist/embeddings.d.ts.map +1 -1
  77. package/dist/embeddings.js.map +1 -1
  78. package/dist/errors/index.cjs.map +1 -1
  79. package/dist/errors/index.d.cts +0 -1
  80. package/dist/errors/index.d.cts.map +1 -1
  81. package/dist/errors/index.d.ts +0 -1
  82. package/dist/errors/index.d.ts.map +1 -1
  83. package/dist/errors/index.js.map +1 -1
  84. package/dist/example_selectors/base.cjs.map +1 -1
  85. package/dist/example_selectors/base.d.cts +0 -1
  86. package/dist/example_selectors/base.d.cts.map +1 -1
  87. package/dist/example_selectors/base.d.ts +0 -1
  88. package/dist/example_selectors/base.d.ts.map +1 -1
  89. package/dist/example_selectors/base.js.map +1 -1
  90. package/dist/example_selectors/conditional.cjs.map +1 -1
  91. package/dist/example_selectors/conditional.d.cts +0 -1
  92. package/dist/example_selectors/conditional.d.cts.map +1 -1
  93. package/dist/example_selectors/conditional.d.ts +0 -1
  94. package/dist/example_selectors/conditional.d.ts.map +1 -1
  95. package/dist/example_selectors/conditional.js.map +1 -1
  96. package/dist/example_selectors/length_based.cjs.map +1 -1
  97. package/dist/example_selectors/length_based.d.cts +0 -1
  98. package/dist/example_selectors/length_based.d.cts.map +1 -1
  99. package/dist/example_selectors/length_based.d.ts +0 -1
  100. package/dist/example_selectors/length_based.d.ts.map +1 -1
  101. package/dist/example_selectors/length_based.js.map +1 -1
  102. package/dist/example_selectors/semantic_similarity.cjs +2 -1
  103. package/dist/example_selectors/semantic_similarity.cjs.map +1 -1
  104. package/dist/example_selectors/semantic_similarity.d.cts +0 -1
  105. package/dist/example_selectors/semantic_similarity.d.cts.map +1 -1
  106. package/dist/example_selectors/semantic_similarity.d.ts +0 -1
  107. package/dist/example_selectors/semantic_similarity.d.ts.map +1 -1
  108. package/dist/example_selectors/semantic_similarity.js +2 -1
  109. package/dist/example_selectors/semantic_similarity.js.map +1 -1
  110. package/dist/index.d.cts +1 -1
  111. package/dist/index.d.ts +1 -1
  112. package/dist/indexing/base.cjs.map +1 -1
  113. package/dist/indexing/base.d.cts +0 -1
  114. package/dist/indexing/base.d.cts.map +1 -1
  115. package/dist/indexing/base.d.ts +0 -1
  116. package/dist/indexing/base.d.ts.map +1 -1
  117. package/dist/indexing/base.js.map +1 -1
  118. package/dist/indexing/record_manager.cjs.map +1 -1
  119. package/dist/indexing/record_manager.d.cts +0 -1
  120. package/dist/indexing/record_manager.d.cts.map +1 -1
  121. package/dist/indexing/record_manager.d.ts +0 -1
  122. package/dist/indexing/record_manager.d.ts.map +1 -1
  123. package/dist/indexing/record_manager.js.map +1 -1
  124. package/dist/language_models/base.cjs +1 -1
  125. package/dist/language_models/base.cjs.map +1 -1
  126. package/dist/language_models/base.d.cts +9 -16
  127. package/dist/language_models/base.d.cts.map +1 -1
  128. package/dist/language_models/base.d.ts +9 -16
  129. package/dist/language_models/base.d.ts.map +1 -1
  130. package/dist/language_models/base.js +1 -1
  131. package/dist/language_models/base.js.map +1 -1
  132. package/dist/language_models/chat_models.cjs +12 -6
  133. package/dist/language_models/chat_models.cjs.map +1 -1
  134. package/dist/language_models/chat_models.d.cts +6 -8
  135. package/dist/language_models/chat_models.d.cts.map +1 -1
  136. package/dist/language_models/chat_models.d.ts +6 -8
  137. package/dist/language_models/chat_models.d.ts.map +1 -1
  138. package/dist/language_models/chat_models.js +12 -6
  139. package/dist/language_models/chat_models.js.map +1 -1
  140. package/dist/language_models/compat.cjs.map +1 -1
  141. package/dist/language_models/compat.d.cts +0 -1
  142. package/dist/language_models/compat.d.cts.map +1 -1
  143. package/dist/language_models/compat.d.ts +0 -1
  144. package/dist/language_models/compat.d.ts.map +1 -1
  145. package/dist/language_models/compat.js.map +1 -1
  146. package/dist/language_models/event.d.cts +0 -1
  147. package/dist/language_models/event.d.cts.map +1 -1
  148. package/dist/language_models/event.d.ts +0 -1
  149. package/dist/language_models/event.d.ts.map +1 -1
  150. package/dist/language_models/llms.cjs.map +1 -1
  151. package/dist/language_models/llms.d.cts +2 -9
  152. package/dist/language_models/llms.d.cts.map +1 -1
  153. package/dist/language_models/llms.d.ts +2 -9
  154. package/dist/language_models/llms.d.ts.map +1 -1
  155. package/dist/language_models/llms.js.map +1 -1
  156. package/dist/language_models/openai_completions_stream.cjs.map +1 -1
  157. package/dist/language_models/openai_completions_stream.d.cts +0 -1
  158. package/dist/language_models/openai_completions_stream.d.cts.map +1 -1
  159. package/dist/language_models/openai_completions_stream.d.ts +0 -1
  160. package/dist/language_models/openai_completions_stream.d.ts.map +1 -1
  161. package/dist/language_models/openai_completions_stream.js.map +1 -1
  162. package/dist/language_models/profile.d.cts.map +1 -1
  163. package/dist/language_models/profile.d.ts.map +1 -1
  164. package/dist/language_models/stream.cjs.map +1 -1
  165. package/dist/language_models/stream.d.cts +2 -1
  166. package/dist/language_models/stream.d.cts.map +1 -1
  167. package/dist/language_models/stream.d.ts +2 -1
  168. package/dist/language_models/stream.d.ts.map +1 -1
  169. package/dist/language_models/stream.js.map +1 -1
  170. package/dist/language_models/structured_output.cjs.map +1 -1
  171. package/dist/language_models/structured_output.d.cts +4 -0
  172. package/dist/language_models/structured_output.d.cts.map +1 -1
  173. package/dist/language_models/structured_output.d.ts +4 -0
  174. package/dist/language_models/structured_output.d.ts.map +1 -1
  175. package/dist/language_models/structured_output.js.map +1 -1
  176. package/dist/language_models/utils.cjs.map +1 -1
  177. package/dist/language_models/utils.js.map +1 -1
  178. package/dist/load/import_constants.cjs.map +1 -1
  179. package/dist/load/import_constants.js.map +1 -1
  180. package/dist/load/import_map.cjs +410 -0
  181. package/dist/load/import_map.cjs.map +1 -1
  182. package/dist/load/import_map.js +3 -1
  183. package/dist/load/import_map.js.map +1 -1
  184. package/dist/load/import_type.d.cts.map +1 -1
  185. package/dist/load/import_type.d.ts.map +1 -1
  186. package/dist/load/index.cjs.map +1 -1
  187. package/dist/load/index.d.cts +0 -1
  188. package/dist/load/index.d.cts.map +1 -1
  189. package/dist/load/index.d.ts +0 -1
  190. package/dist/load/index.d.ts.map +1 -1
  191. package/dist/load/index.js.map +1 -1
  192. package/dist/load/map_keys.cjs.map +1 -1
  193. package/dist/load/map_keys.d.cts.map +1 -1
  194. package/dist/load/map_keys.d.ts.map +1 -1
  195. package/dist/load/map_keys.js.map +1 -1
  196. package/dist/load/serializable.cjs.map +1 -1
  197. package/dist/load/serializable.d.cts +0 -1
  198. package/dist/load/serializable.d.cts.map +1 -1
  199. package/dist/load/serializable.d.ts +0 -1
  200. package/dist/load/serializable.d.ts.map +1 -1
  201. package/dist/load/serializable.js.map +1 -1
  202. package/dist/load/validation.cjs +3 -0
  203. package/dist/load/validation.cjs.map +1 -1
  204. package/dist/load/validation.js +1 -1
  205. package/dist/load/validation.js.map +1 -1
  206. package/dist/memory.cjs +8 -2
  207. package/dist/memory.cjs.map +1 -1
  208. package/dist/memory.d.cts.map +1 -1
  209. package/dist/memory.d.ts.map +1 -1
  210. package/dist/memory.js +8 -2
  211. package/dist/memory.js.map +1 -1
  212. package/dist/messages/ai.cjs.map +1 -1
  213. package/dist/messages/ai.d.cts +0 -1
  214. package/dist/messages/ai.d.cts.map +1 -1
  215. package/dist/messages/ai.d.ts +0 -1
  216. package/dist/messages/ai.d.ts.map +1 -1
  217. package/dist/messages/ai.js.map +1 -1
  218. package/dist/messages/base.cjs.map +1 -1
  219. package/dist/messages/base.d.cts +6 -9
  220. package/dist/messages/base.d.cts.map +1 -1
  221. package/dist/messages/base.d.ts +6 -9
  222. package/dist/messages/base.d.ts.map +1 -1
  223. package/dist/messages/base.js.map +1 -1
  224. package/dist/messages/block_translators/anthropic.cjs +2 -0
  225. package/dist/messages/block_translators/anthropic.cjs.map +1 -1
  226. package/dist/messages/block_translators/anthropic.js +1 -1
  227. package/dist/messages/block_translators/anthropic.js.map +1 -1
  228. package/dist/messages/block_translators/bedrock_converse.cjs.map +1 -1
  229. package/dist/messages/block_translators/bedrock_converse.js.map +1 -1
  230. package/dist/messages/block_translators/data.cjs +1 -0
  231. package/dist/messages/block_translators/data.cjs.map +1 -1
  232. package/dist/messages/block_translators/data.js +1 -1
  233. package/dist/messages/block_translators/data.js.map +1 -1
  234. package/dist/messages/block_translators/deepseek.cjs +1 -0
  235. package/dist/messages/block_translators/deepseek.cjs.map +1 -1
  236. package/dist/messages/block_translators/deepseek.js +1 -1
  237. package/dist/messages/block_translators/deepseek.js.map +1 -1
  238. package/dist/messages/block_translators/google.cjs.map +1 -1
  239. package/dist/messages/block_translators/google.js.map +1 -1
  240. package/dist/messages/block_translators/google_genai.cjs.map +1 -1
  241. package/dist/messages/block_translators/google_genai.js.map +1 -1
  242. package/dist/messages/block_translators/google_vertexai.cjs.map +1 -1
  243. package/dist/messages/block_translators/google_vertexai.js.map +1 -1
  244. package/dist/messages/block_translators/groq.cjs +1 -0
  245. package/dist/messages/block_translators/groq.cjs.map +1 -1
  246. package/dist/messages/block_translators/groq.js +1 -1
  247. package/dist/messages/block_translators/groq.js.map +1 -1
  248. package/dist/messages/block_translators/index.cjs +1 -1
  249. package/dist/messages/block_translators/index.cjs.map +1 -1
  250. package/dist/messages/block_translators/index.js +1 -1
  251. package/dist/messages/block_translators/index.js.map +1 -1
  252. package/dist/messages/block_translators/ollama.cjs +1 -0
  253. package/dist/messages/block_translators/ollama.cjs.map +1 -1
  254. package/dist/messages/block_translators/ollama.js +1 -1
  255. package/dist/messages/block_translators/ollama.js.map +1 -1
  256. package/dist/messages/block_translators/openai.cjs +4 -0
  257. package/dist/messages/block_translators/openai.cjs.map +1 -1
  258. package/dist/messages/block_translators/openai.js +1 -1
  259. package/dist/messages/block_translators/openai.js.map +1 -1
  260. package/dist/messages/block_translators/openrouter.cjs +1 -0
  261. package/dist/messages/block_translators/openrouter.cjs.map +1 -1
  262. package/dist/messages/block_translators/openrouter.js +1 -1
  263. package/dist/messages/block_translators/openrouter.js.map +1 -1
  264. package/dist/messages/block_translators/utils.cjs.map +1 -1
  265. package/dist/messages/block_translators/utils.js.map +1 -1
  266. package/dist/messages/block_translators/xai.cjs +1 -0
  267. package/dist/messages/block_translators/xai.cjs.map +1 -1
  268. package/dist/messages/block_translators/xai.js +1 -1
  269. package/dist/messages/block_translators/xai.js.map +1 -1
  270. package/dist/messages/chat.cjs.map +1 -1
  271. package/dist/messages/chat.d.cts +0 -1
  272. package/dist/messages/chat.d.cts.map +1 -1
  273. package/dist/messages/chat.d.ts +0 -1
  274. package/dist/messages/chat.d.ts.map +1 -1
  275. package/dist/messages/chat.js.map +1 -1
  276. package/dist/messages/content/base.d.cts.map +1 -1
  277. package/dist/messages/content/base.d.ts.map +1 -1
  278. package/dist/messages/content/data.cjs.map +1 -1
  279. package/dist/messages/content/data.d.cts +2 -9
  280. package/dist/messages/content/data.d.cts.map +1 -1
  281. package/dist/messages/content/data.d.ts +2 -9
  282. package/dist/messages/content/data.d.ts.map +1 -1
  283. package/dist/messages/content/data.js.map +1 -1
  284. package/dist/messages/content/index.cjs.map +1 -1
  285. package/dist/messages/content/index.d.cts +0 -1
  286. package/dist/messages/content/index.d.cts.map +1 -1
  287. package/dist/messages/content/index.d.ts +0 -1
  288. package/dist/messages/content/index.d.ts.map +1 -1
  289. package/dist/messages/content/index.js.map +1 -1
  290. package/dist/messages/content/multimodal.cjs.map +1 -1
  291. package/dist/messages/content/multimodal.d.cts +8 -5
  292. package/dist/messages/content/multimodal.d.cts.map +1 -1
  293. package/dist/messages/content/multimodal.d.ts +8 -5
  294. package/dist/messages/content/multimodal.d.ts.map +1 -1
  295. package/dist/messages/content/multimodal.js.map +1 -1
  296. package/dist/messages/content/tools.cjs.map +1 -1
  297. package/dist/messages/content/tools.d.cts +0 -1
  298. package/dist/messages/content/tools.d.cts.map +1 -1
  299. package/dist/messages/content/tools.d.ts +0 -1
  300. package/dist/messages/content/tools.d.ts.map +1 -1
  301. package/dist/messages/content/tools.js.map +1 -1
  302. package/dist/messages/format.cjs.map +1 -1
  303. package/dist/messages/format.d.cts.map +1 -1
  304. package/dist/messages/format.d.ts.map +1 -1
  305. package/dist/messages/format.js.map +1 -1
  306. package/dist/messages/function.cjs.map +1 -1
  307. package/dist/messages/function.d.cts +0 -1
  308. package/dist/messages/function.d.cts.map +1 -1
  309. package/dist/messages/function.d.ts +0 -1
  310. package/dist/messages/function.d.ts.map +1 -1
  311. package/dist/messages/function.js.map +1 -1
  312. package/dist/messages/human.cjs.map +1 -1
  313. package/dist/messages/human.d.cts +0 -1
  314. package/dist/messages/human.d.cts.map +1 -1
  315. package/dist/messages/human.d.ts +0 -1
  316. package/dist/messages/human.d.ts.map +1 -1
  317. package/dist/messages/human.js.map +1 -1
  318. package/dist/messages/message.cjs.map +1 -1
  319. package/dist/messages/message.d.cts +31 -22
  320. package/dist/messages/message.d.cts.map +1 -1
  321. package/dist/messages/message.d.ts +31 -22
  322. package/dist/messages/message.d.ts.map +1 -1
  323. package/dist/messages/message.js.map +1 -1
  324. package/dist/messages/metadata.cjs.map +1 -1
  325. package/dist/messages/metadata.d.cts +0 -1
  326. package/dist/messages/metadata.d.cts.map +1 -1
  327. package/dist/messages/metadata.d.ts +0 -1
  328. package/dist/messages/metadata.d.ts.map +1 -1
  329. package/dist/messages/metadata.js.map +1 -1
  330. package/dist/messages/modifier.cjs.map +1 -1
  331. package/dist/messages/modifier.d.cts +0 -1
  332. package/dist/messages/modifier.d.cts.map +1 -1
  333. package/dist/messages/modifier.d.ts +0 -1
  334. package/dist/messages/modifier.d.ts.map +1 -1
  335. package/dist/messages/modifier.js.map +1 -1
  336. package/dist/messages/system.cjs.map +1 -1
  337. package/dist/messages/system.d.cts +0 -1
  338. package/dist/messages/system.d.cts.map +1 -1
  339. package/dist/messages/system.d.ts +0 -1
  340. package/dist/messages/system.d.ts.map +1 -1
  341. package/dist/messages/system.js.map +1 -1
  342. package/dist/messages/tool.cjs.map +1 -1
  343. package/dist/messages/tool.d.cts +3 -4
  344. package/dist/messages/tool.d.cts.map +1 -1
  345. package/dist/messages/tool.d.ts +3 -4
  346. package/dist/messages/tool.d.ts.map +1 -1
  347. package/dist/messages/tool.js.map +1 -1
  348. package/dist/messages/transformers.cjs.map +1 -1
  349. package/dist/messages/transformers.d.cts +0 -1
  350. package/dist/messages/transformers.d.cts.map +1 -1
  351. package/dist/messages/transformers.d.ts +0 -1
  352. package/dist/messages/transformers.d.ts.map +1 -1
  353. package/dist/messages/transformers.js.map +1 -1
  354. package/dist/messages/utils.cjs.map +1 -1
  355. package/dist/messages/utils.d.cts +4 -5
  356. package/dist/messages/utils.d.cts.map +1 -1
  357. package/dist/messages/utils.d.ts +4 -5
  358. package/dist/messages/utils.d.ts.map +1 -1
  359. package/dist/messages/utils.js.map +1 -1
  360. package/dist/output_parsers/base.cjs.map +1 -1
  361. package/dist/output_parsers/base.d.cts +3 -0
  362. package/dist/output_parsers/base.d.cts.map +1 -1
  363. package/dist/output_parsers/base.d.ts +3 -0
  364. package/dist/output_parsers/base.d.ts.map +1 -1
  365. package/dist/output_parsers/base.js.map +1 -1
  366. package/dist/output_parsers/bytes.cjs.map +1 -1
  367. package/dist/output_parsers/bytes.d.cts +0 -1
  368. package/dist/output_parsers/bytes.d.cts.map +1 -1
  369. package/dist/output_parsers/bytes.d.ts +0 -1
  370. package/dist/output_parsers/bytes.d.ts.map +1 -1
  371. package/dist/output_parsers/bytes.js.map +1 -1
  372. package/dist/output_parsers/json.cjs +2 -0
  373. package/dist/output_parsers/json.cjs.map +1 -1
  374. package/dist/output_parsers/json.d.cts +2 -2
  375. package/dist/output_parsers/json.d.cts.map +1 -1
  376. package/dist/output_parsers/json.d.ts +2 -2
  377. package/dist/output_parsers/json.d.ts.map +1 -1
  378. package/dist/output_parsers/json.js +2 -2
  379. package/dist/output_parsers/json.js.map +1 -1
  380. package/dist/output_parsers/list.cjs.map +1 -1
  381. package/dist/output_parsers/list.d.cts +2 -5
  382. package/dist/output_parsers/list.d.cts.map +1 -1
  383. package/dist/output_parsers/list.d.ts +2 -5
  384. package/dist/output_parsers/list.d.ts.map +1 -1
  385. package/dist/output_parsers/list.js.map +1 -1
  386. package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs.map +1 -1
  387. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +1 -1
  388. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -1
  389. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +1 -1
  390. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -1
  391. package/dist/output_parsers/openai_functions/json_output_functions_parsers.js.map +1 -1
  392. package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
  393. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +2 -2
  394. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -1
  395. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +2 -2
  396. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -1
  397. package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
  398. package/dist/output_parsers/standard_schema.cjs.map +1 -1
  399. package/dist/output_parsers/standard_schema.d.cts +1 -1
  400. package/dist/output_parsers/standard_schema.d.cts.map +1 -1
  401. package/dist/output_parsers/standard_schema.d.ts +1 -1
  402. package/dist/output_parsers/standard_schema.d.ts.map +1 -1
  403. package/dist/output_parsers/standard_schema.js.map +1 -1
  404. package/dist/output_parsers/string.cjs.map +1 -1
  405. package/dist/output_parsers/string.d.cts +1 -1
  406. package/dist/output_parsers/string.d.cts.map +1 -1
  407. package/dist/output_parsers/string.d.ts +1 -1
  408. package/dist/output_parsers/string.d.ts.map +1 -1
  409. package/dist/output_parsers/string.js.map +1 -1
  410. package/dist/output_parsers/structured.cjs +1 -1
  411. package/dist/output_parsers/structured.cjs.map +1 -1
  412. package/dist/output_parsers/structured.d.cts +2 -4
  413. package/dist/output_parsers/structured.d.cts.map +1 -1
  414. package/dist/output_parsers/structured.d.ts +2 -4
  415. package/dist/output_parsers/structured.d.ts.map +1 -1
  416. package/dist/output_parsers/structured.js +1 -0
  417. package/dist/output_parsers/structured.js.map +1 -1
  418. package/dist/output_parsers/transform.cjs +0 -1
  419. package/dist/output_parsers/transform.cjs.map +1 -1
  420. package/dist/output_parsers/transform.d.cts +0 -1
  421. package/dist/output_parsers/transform.d.cts.map +1 -1
  422. package/dist/output_parsers/transform.d.ts +0 -1
  423. package/dist/output_parsers/transform.d.ts.map +1 -1
  424. package/dist/output_parsers/transform.js.map +1 -1
  425. package/dist/output_parsers/xml.cjs.map +1 -1
  426. package/dist/output_parsers/xml.d.cts +0 -1
  427. package/dist/output_parsers/xml.d.cts.map +1 -1
  428. package/dist/output_parsers/xml.d.ts +0 -1
  429. package/dist/output_parsers/xml.d.ts.map +1 -1
  430. package/dist/output_parsers/xml.js.map +1 -1
  431. package/dist/outputs.cjs.map +1 -1
  432. package/dist/outputs.d.cts +0 -1
  433. package/dist/outputs.d.cts.map +1 -1
  434. package/dist/outputs.d.ts +0 -1
  435. package/dist/outputs.d.ts.map +1 -1
  436. package/dist/outputs.js.map +1 -1
  437. package/dist/prompt_values.cjs.map +1 -1
  438. package/dist/prompt_values.d.cts +3 -2
  439. package/dist/prompt_values.d.cts.map +1 -1
  440. package/dist/prompt_values.d.ts +3 -2
  441. package/dist/prompt_values.d.ts.map +1 -1
  442. package/dist/prompt_values.js.map +1 -1
  443. package/dist/prompts/base.cjs.map +1 -1
  444. package/dist/prompts/base.d.cts +1 -0
  445. package/dist/prompts/base.d.cts.map +1 -1
  446. package/dist/prompts/base.d.ts +1 -0
  447. package/dist/prompts/base.d.ts.map +1 -1
  448. package/dist/prompts/base.js.map +1 -1
  449. package/dist/prompts/chat.cjs +3 -2
  450. package/dist/prompts/chat.cjs.map +1 -1
  451. package/dist/prompts/chat.d.cts +3 -3
  452. package/dist/prompts/chat.d.cts.map +1 -1
  453. package/dist/prompts/chat.d.ts +3 -3
  454. package/dist/prompts/chat.d.ts.map +1 -1
  455. package/dist/prompts/chat.js +3 -2
  456. package/dist/prompts/chat.js.map +1 -1
  457. package/dist/prompts/dict.cjs.map +1 -1
  458. package/dist/prompts/dict.d.cts +0 -1
  459. package/dist/prompts/dict.d.cts.map +1 -1
  460. package/dist/prompts/dict.d.ts +0 -1
  461. package/dist/prompts/dict.d.ts.map +1 -1
  462. package/dist/prompts/dict.js.map +1 -1
  463. package/dist/prompts/few_shot.cjs +6 -4
  464. package/dist/prompts/few_shot.cjs.map +1 -1
  465. package/dist/prompts/few_shot.d.cts +1 -1
  466. package/dist/prompts/few_shot.d.cts.map +1 -1
  467. package/dist/prompts/few_shot.d.ts +1 -1
  468. package/dist/prompts/few_shot.d.ts.map +1 -1
  469. package/dist/prompts/few_shot.js +6 -4
  470. package/dist/prompts/few_shot.js.map +1 -1
  471. package/dist/prompts/image.cjs +3 -2
  472. package/dist/prompts/image.cjs.map +1 -1
  473. package/dist/prompts/image.d.cts +1 -1
  474. package/dist/prompts/image.d.cts.map +1 -1
  475. package/dist/prompts/image.d.ts +1 -1
  476. package/dist/prompts/image.d.ts.map +1 -1
  477. package/dist/prompts/image.js +3 -2
  478. package/dist/prompts/image.js.map +1 -1
  479. package/dist/prompts/pipeline.cjs.map +1 -1
  480. package/dist/prompts/pipeline.d.cts +0 -1
  481. package/dist/prompts/pipeline.d.cts.map +1 -1
  482. package/dist/prompts/pipeline.d.ts +0 -1
  483. package/dist/prompts/pipeline.d.ts.map +1 -1
  484. package/dist/prompts/pipeline.js.map +1 -1
  485. package/dist/prompts/prompt.cjs +9 -7
  486. package/dist/prompts/prompt.cjs.map +1 -1
  487. package/dist/prompts/prompt.d.cts +2 -2
  488. package/dist/prompts/prompt.d.cts.map +1 -1
  489. package/dist/prompts/prompt.d.ts +2 -2
  490. package/dist/prompts/prompt.d.ts.map +1 -1
  491. package/dist/prompts/prompt.js +9 -7
  492. package/dist/prompts/prompt.js.map +1 -1
  493. package/dist/prompts/serde.d.cts +1 -1
  494. package/dist/prompts/serde.d.cts.map +1 -1
  495. package/dist/prompts/serde.d.ts +1 -1
  496. package/dist/prompts/serde.d.ts.map +1 -1
  497. package/dist/prompts/string.cjs.map +1 -1
  498. package/dist/prompts/string.d.cts +0 -1
  499. package/dist/prompts/string.d.cts.map +1 -1
  500. package/dist/prompts/string.d.ts +0 -1
  501. package/dist/prompts/string.d.ts.map +1 -1
  502. package/dist/prompts/string.js.map +1 -1
  503. package/dist/prompts/structured.cjs.map +1 -1
  504. package/dist/prompts/structured.d.cts +1 -1
  505. package/dist/prompts/structured.d.cts.map +1 -1
  506. package/dist/prompts/structured.d.ts +1 -1
  507. package/dist/prompts/structured.d.ts.map +1 -1
  508. package/dist/prompts/structured.js.map +1 -1
  509. package/dist/prompts/template.cjs +9 -9
  510. package/dist/prompts/template.cjs.map +1 -1
  511. package/dist/prompts/template.d.cts +1 -0
  512. package/dist/prompts/template.d.cts.map +1 -1
  513. package/dist/prompts/template.d.ts +1 -0
  514. package/dist/prompts/template.d.ts.map +1 -1
  515. package/dist/prompts/template.js +9 -9
  516. package/dist/prompts/template.js.map +1 -1
  517. package/dist/retrievers/document_compressors/index.cjs.map +1 -1
  518. package/dist/retrievers/document_compressors/index.d.cts +0 -1
  519. package/dist/retrievers/document_compressors/index.d.cts.map +1 -1
  520. package/dist/retrievers/document_compressors/index.d.ts +0 -1
  521. package/dist/retrievers/document_compressors/index.d.ts.map +1 -1
  522. package/dist/retrievers/document_compressors/index.js.map +1 -1
  523. package/dist/retrievers/index.cjs.map +1 -1
  524. package/dist/retrievers/index.d.cts +1 -1
  525. package/dist/retrievers/index.d.cts.map +1 -1
  526. package/dist/retrievers/index.d.ts +1 -1
  527. package/dist/retrievers/index.d.ts.map +1 -1
  528. package/dist/retrievers/index.js.map +1 -1
  529. package/dist/runnables/base.cjs +2 -1
  530. package/dist/runnables/base.cjs.map +1 -1
  531. package/dist/runnables/base.d.cts +7 -19
  532. package/dist/runnables/base.d.cts.map +1 -1
  533. package/dist/runnables/base.d.ts +7 -19
  534. package/dist/runnables/base.d.ts.map +1 -1
  535. package/dist/runnables/base.js +1 -1
  536. package/dist/runnables/base.js.map +1 -1
  537. package/dist/runnables/branch.cjs.map +1 -1
  538. package/dist/runnables/branch.d.cts +1 -1
  539. package/dist/runnables/branch.d.cts.map +1 -1
  540. package/dist/runnables/branch.d.ts +1 -1
  541. package/dist/runnables/branch.d.ts.map +1 -1
  542. package/dist/runnables/branch.js.map +1 -1
  543. package/dist/runnables/config.cjs +3 -2
  544. package/dist/runnables/config.cjs.map +1 -1
  545. package/dist/runnables/config.d.cts +2 -10
  546. package/dist/runnables/config.d.cts.map +1 -1
  547. package/dist/runnables/config.d.ts +2 -10
  548. package/dist/runnables/config.d.ts.map +1 -1
  549. package/dist/runnables/config.js +3 -3
  550. package/dist/runnables/config.js.map +1 -1
  551. package/dist/runnables/graph.cjs.map +1 -1
  552. package/dist/runnables/graph.d.cts +1 -2
  553. package/dist/runnables/graph.d.cts.map +1 -1
  554. package/dist/runnables/graph.d.ts +1 -2
  555. package/dist/runnables/graph.d.ts.map +1 -1
  556. package/dist/runnables/graph.js.map +1 -1
  557. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  558. package/dist/runnables/graph_mermaid.js.map +1 -1
  559. package/dist/runnables/history.cjs.map +1 -1
  560. package/dist/runnables/history.d.cts +2 -1
  561. package/dist/runnables/history.d.cts.map +1 -1
  562. package/dist/runnables/history.d.ts +2 -1
  563. package/dist/runnables/history.d.ts.map +1 -1
  564. package/dist/runnables/history.js.map +1 -1
  565. package/dist/runnables/iter.cjs.map +1 -1
  566. package/dist/runnables/iter.js.map +1 -1
  567. package/dist/runnables/passthrough.cjs.map +1 -1
  568. package/dist/runnables/passthrough.d.cts +1 -1
  569. package/dist/runnables/passthrough.d.cts.map +1 -1
  570. package/dist/runnables/passthrough.d.ts +1 -1
  571. package/dist/runnables/passthrough.d.ts.map +1 -1
  572. package/dist/runnables/passthrough.js.map +1 -1
  573. package/dist/runnables/router.cjs.map +1 -1
  574. package/dist/runnables/router.d.cts +1 -1
  575. package/dist/runnables/router.d.cts.map +1 -1
  576. package/dist/runnables/router.d.ts +1 -1
  577. package/dist/runnables/router.d.ts.map +1 -1
  578. package/dist/runnables/router.js.map +1 -1
  579. package/dist/runnables/types.d.cts +2 -2
  580. package/dist/runnables/types.d.cts.map +1 -1
  581. package/dist/runnables/types.d.ts +2 -2
  582. package/dist/runnables/types.d.ts.map +1 -1
  583. package/dist/runnables/utils.cjs.map +1 -1
  584. package/dist/runnables/utils.js.map +1 -1
  585. package/dist/runnables/wrappers.cjs.map +1 -1
  586. package/dist/runnables/wrappers.js.map +1 -1
  587. package/dist/singletons/async_local_storage/context.cjs +0 -1
  588. package/dist/singletons/async_local_storage/context.cjs.map +1 -1
  589. package/dist/singletons/async_local_storage/context.d.cts +0 -1
  590. package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
  591. package/dist/singletons/async_local_storage/context.d.ts +0 -1
  592. package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
  593. package/dist/singletons/async_local_storage/context.js.map +1 -1
  594. package/dist/singletons/async_local_storage/globals.cjs +1 -0
  595. package/dist/singletons/async_local_storage/globals.cjs.map +1 -1
  596. package/dist/singletons/async_local_storage/globals.d.cts.map +1 -1
  597. package/dist/singletons/async_local_storage/globals.d.ts.map +1 -1
  598. package/dist/singletons/async_local_storage/globals.js +1 -1
  599. package/dist/singletons/async_local_storage/globals.js.map +1 -1
  600. package/dist/singletons/async_local_storage/index.cjs +0 -1
  601. package/dist/singletons/async_local_storage/index.cjs.map +1 -1
  602. package/dist/singletons/async_local_storage/index.d.cts +1 -2
  603. package/dist/singletons/async_local_storage/index.d.cts.map +1 -1
  604. package/dist/singletons/async_local_storage/index.d.ts +1 -2
  605. package/dist/singletons/async_local_storage/index.d.ts.map +1 -1
  606. package/dist/singletons/async_local_storage/index.js.map +1 -1
  607. package/dist/singletons/callbacks.cjs +1 -0
  608. package/dist/singletons/callbacks.cjs.map +1 -1
  609. package/dist/singletons/callbacks.d.cts +1 -0
  610. package/dist/singletons/callbacks.d.cts.map +1 -1
  611. package/dist/singletons/callbacks.d.ts +0 -1
  612. package/dist/singletons/callbacks.d.ts.map +1 -1
  613. package/dist/singletons/callbacks.js +1 -1
  614. package/dist/singletons/callbacks.js.map +1 -1
  615. package/dist/singletons/tracer.cjs +0 -1
  616. package/dist/singletons/tracer.cjs.map +1 -1
  617. package/dist/singletons/tracer.js.map +1 -1
  618. package/dist/stores.cjs.map +1 -1
  619. package/dist/stores.d.cts +0 -1
  620. package/dist/stores.d.cts.map +1 -1
  621. package/dist/stores.d.ts +0 -1
  622. package/dist/stores.d.ts.map +1 -1
  623. package/dist/stores.js.map +1 -1
  624. package/dist/structured_query/base.cjs.map +1 -1
  625. package/dist/structured_query/base.d.cts +0 -1
  626. package/dist/structured_query/base.d.cts.map +1 -1
  627. package/dist/structured_query/base.d.ts +0 -1
  628. package/dist/structured_query/base.d.ts.map +1 -1
  629. package/dist/structured_query/base.js.map +1 -1
  630. package/dist/structured_query/functional.cjs.map +1 -1
  631. package/dist/structured_query/functional.d.cts +0 -1
  632. package/dist/structured_query/functional.d.cts.map +1 -1
  633. package/dist/structured_query/functional.d.ts +0 -1
  634. package/dist/structured_query/functional.d.ts.map +1 -1
  635. package/dist/structured_query/functional.js.map +1 -1
  636. package/dist/structured_query/ir.cjs +7 -0
  637. package/dist/structured_query/ir.cjs.map +1 -1
  638. package/dist/structured_query/ir.d.cts +0 -1
  639. package/dist/structured_query/ir.d.cts.map +1 -1
  640. package/dist/structured_query/ir.d.ts +0 -1
  641. package/dist/structured_query/ir.d.ts.map +1 -1
  642. package/dist/structured_query/ir.js +7 -0
  643. package/dist/structured_query/ir.js.map +1 -1
  644. package/dist/structured_query/utils.cjs.map +1 -1
  645. package/dist/structured_query/utils.d.cts.map +1 -1
  646. package/dist/structured_query/utils.d.ts.map +1 -1
  647. package/dist/structured_query/utils.js.map +1 -1
  648. package/dist/testing/fake_model_builder.cjs.map +1 -1
  649. package/dist/testing/fake_model_builder.d.cts +1 -1
  650. package/dist/testing/fake_model_builder.d.cts.map +1 -1
  651. package/dist/testing/fake_model_builder.d.ts +1 -1
  652. package/dist/testing/fake_model_builder.d.ts.map +1 -1
  653. package/dist/testing/fake_model_builder.js.map +1 -1
  654. package/dist/testing/matchers.cjs.map +1 -1
  655. package/dist/testing/matchers.d.cts +0 -1
  656. package/dist/testing/matchers.d.cts.map +1 -1
  657. package/dist/testing/matchers.d.ts +0 -1
  658. package/dist/testing/matchers.d.ts.map +1 -1
  659. package/dist/testing/matchers.js.map +1 -1
  660. package/dist/tools/index.cjs.map +1 -1
  661. package/dist/tools/index.d.cts +8 -7
  662. package/dist/tools/index.d.cts.map +1 -1
  663. package/dist/tools/index.d.ts +8 -7
  664. package/dist/tools/index.d.ts.map +1 -1
  665. package/dist/tools/index.js.map +1 -1
  666. package/dist/tools/types.cjs.map +1 -1
  667. package/dist/tools/types.d.cts +4 -3
  668. package/dist/tools/types.d.cts.map +1 -1
  669. package/dist/tools/types.d.ts +4 -3
  670. package/dist/tools/types.d.ts.map +1 -1
  671. package/dist/tools/types.js.map +1 -1
  672. package/dist/tools/utils.cjs.map +1 -1
  673. package/dist/tools/utils.d.cts.map +1 -1
  674. package/dist/tools/utils.d.ts.map +1 -1
  675. package/dist/tools/utils.js.map +1 -1
  676. package/dist/tracers/base.cjs.map +1 -1
  677. package/dist/tracers/base.d.cts +18 -14
  678. package/dist/tracers/base.d.cts.map +1 -1
  679. package/dist/tracers/base.d.ts +18 -14
  680. package/dist/tracers/base.d.ts.map +1 -1
  681. package/dist/tracers/base.js.map +1 -1
  682. package/dist/tracers/console.cjs.map +1 -1
  683. package/dist/tracers/console.d.cts +0 -1
  684. package/dist/tracers/console.d.cts.map +1 -1
  685. package/dist/tracers/console.d.ts +0 -1
  686. package/dist/tracers/console.d.ts.map +1 -1
  687. package/dist/tracers/console.js.map +1 -1
  688. package/dist/tracers/event_stream.cjs.map +1 -1
  689. package/dist/tracers/event_stream.d.cts +5 -2
  690. package/dist/tracers/event_stream.d.cts.map +1 -1
  691. package/dist/tracers/event_stream.d.ts +5 -2
  692. package/dist/tracers/event_stream.d.ts.map +1 -1
  693. package/dist/tracers/event_stream.js.map +1 -1
  694. package/dist/tracers/log_stream.cjs.map +1 -1
  695. package/dist/tracers/log_stream.d.cts +30 -15
  696. package/dist/tracers/log_stream.d.cts.map +1 -1
  697. package/dist/tracers/log_stream.d.ts +30 -15
  698. package/dist/tracers/log_stream.d.ts.map +1 -1
  699. package/dist/tracers/log_stream.js.map +1 -1
  700. package/dist/tracers/root_listener.cjs.map +1 -1
  701. package/dist/tracers/root_listener.js.map +1 -1
  702. package/dist/tracers/run_collector.cjs.map +1 -1
  703. package/dist/tracers/run_collector.d.cts +1 -4
  704. package/dist/tracers/run_collector.d.cts.map +1 -1
  705. package/dist/tracers/run_collector.d.ts +1 -4
  706. package/dist/tracers/run_collector.d.ts.map +1 -1
  707. package/dist/tracers/run_collector.js.map +1 -1
  708. package/dist/tracers/tracer_langchain.cjs +4 -3
  709. package/dist/tracers/tracer_langchain.cjs.map +1 -1
  710. package/dist/tracers/tracer_langchain.d.cts +1 -5
  711. package/dist/tracers/tracer_langchain.d.cts.map +1 -1
  712. package/dist/tracers/tracer_langchain.d.ts +1 -5
  713. package/dist/tracers/tracer_langchain.d.ts.map +1 -1
  714. package/dist/tracers/tracer_langchain.js +4 -3
  715. package/dist/tracers/tracer_langchain.js.map +1 -1
  716. package/dist/types/_internal.d.cts.map +1 -1
  717. package/dist/types/_internal.d.ts.map +1 -1
  718. package/dist/types/stream.d.cts +1 -1
  719. package/dist/types/stream.d.ts +1 -1
  720. package/dist/types/type-utils.d.cts +1 -1
  721. package/dist/types/type-utils.d.cts.map +1 -1
  722. package/dist/types/type-utils.d.ts +1 -1
  723. package/dist/types/type-utils.d.ts.map +1 -1
  724. package/dist/utils/async_caller.cjs.map +1 -1
  725. package/dist/utils/async_caller.d.cts.map +1 -1
  726. package/dist/utils/async_caller.d.ts.map +1 -1
  727. package/dist/utils/async_caller.js.map +1 -1
  728. package/dist/utils/callbacks.cjs.map +1 -1
  729. package/dist/utils/callbacks.js.map +1 -1
  730. package/dist/utils/chunk_array.cjs.map +1 -1
  731. package/dist/utils/chunk_array.d.cts.map +1 -1
  732. package/dist/utils/chunk_array.d.ts.map +1 -1
  733. package/dist/utils/chunk_array.js.map +1 -1
  734. package/dist/utils/context.cjs.map +1 -1
  735. package/dist/utils/context.d.cts.map +1 -1
  736. package/dist/utils/context.d.ts.map +1 -1
  737. package/dist/utils/context.js.map +1 -1
  738. package/dist/utils/env.cjs.map +1 -1
  739. package/dist/utils/env.d.cts.map +1 -1
  740. package/dist/utils/env.d.ts.map +1 -1
  741. package/dist/utils/env.js.map +1 -1
  742. package/dist/utils/event_source_parse.cjs +2 -2
  743. package/dist/utils/event_source_parse.cjs.map +1 -1
  744. package/dist/utils/event_source_parse.d.cts +0 -1
  745. package/dist/utils/event_source_parse.d.cts.map +1 -1
  746. package/dist/utils/event_source_parse.d.ts +0 -1
  747. package/dist/utils/event_source_parse.d.ts.map +1 -1
  748. package/dist/utils/event_source_parse.js +2 -2
  749. package/dist/utils/event_source_parse.js.map +1 -1
  750. package/dist/utils/fast-json-patch/index.cjs +9 -1
  751. package/dist/utils/fast-json-patch/index.cjs.map +1 -1
  752. package/dist/utils/fast-json-patch/index.js +3 -3
  753. package/dist/utils/fast-json-patch/index.js.map +1 -1
  754. package/dist/utils/fast-json-patch/src/core.cjs +7 -0
  755. package/dist/utils/fast-json-patch/src/core.cjs.map +1 -1
  756. package/dist/utils/fast-json-patch/src/core.d.cts +1 -1
  757. package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -1
  758. package/dist/utils/fast-json-patch/src/core.d.ts +1 -1
  759. package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -1
  760. package/dist/utils/fast-json-patch/src/core.js +6 -1
  761. package/dist/utils/fast-json-patch/src/core.js.map +1 -1
  762. package/dist/utils/fast-json-patch/src/duplex.cjs.map +1 -1
  763. package/dist/utils/fast-json-patch/src/duplex.d.cts +0 -1
  764. package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -1
  765. package/dist/utils/fast-json-patch/src/duplex.d.ts +0 -1
  766. package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -1
  767. package/dist/utils/fast-json-patch/src/duplex.js.map +1 -1
  768. package/dist/utils/fast-json-patch/src/helpers.cjs +4 -0
  769. package/dist/utils/fast-json-patch/src/helpers.cjs.map +1 -1
  770. package/dist/utils/fast-json-patch/src/helpers.js +4 -0
  771. package/dist/utils/fast-json-patch/src/helpers.js.map +1 -1
  772. package/dist/utils/format.d.cts.map +1 -1
  773. package/dist/utils/format.d.ts.map +1 -1
  774. package/dist/utils/function_calling.cjs.map +1 -1
  775. package/dist/utils/function_calling.d.cts +0 -1
  776. package/dist/utils/function_calling.d.cts.map +1 -1
  777. package/dist/utils/function_calling.d.ts +0 -1
  778. package/dist/utils/function_calling.d.ts.map +1 -1
  779. package/dist/utils/function_calling.js.map +1 -1
  780. package/dist/utils/gateway.cjs +43 -0
  781. package/dist/utils/gateway.cjs.map +1 -0
  782. package/dist/utils/gateway.d.cts +13 -0
  783. package/dist/utils/gateway.d.cts.map +1 -0
  784. package/dist/utils/gateway.d.ts +13 -0
  785. package/dist/utils/gateway.d.ts.map +1 -0
  786. package/dist/utils/gateway.js +36 -0
  787. package/dist/utils/gateway.js.map +1 -0
  788. package/dist/utils/hash.d.cts +0 -1
  789. package/dist/utils/hash.d.cts.map +1 -1
  790. package/dist/utils/hash.d.ts +0 -1
  791. package/dist/utils/hash.d.ts.map +1 -1
  792. package/dist/utils/is-network-error/index.cjs +1 -1
  793. package/dist/utils/is-network-error/index.cjs.map +1 -1
  794. package/dist/utils/is-network-error/index.js +1 -1
  795. package/dist/utils/is-network-error/index.js.map +1 -1
  796. package/dist/utils/js-sha256/hash.cjs.map +1 -1
  797. package/dist/utils/js-sha256/hash.d.cts.map +1 -1
  798. package/dist/utils/js-sha256/hash.d.ts.map +1 -1
  799. package/dist/utils/js-sha256/hash.js.map +1 -1
  800. package/dist/utils/json.cjs +1 -0
  801. package/dist/utils/json.cjs.map +1 -1
  802. package/dist/utils/json.d.cts.map +1 -1
  803. package/dist/utils/json.d.ts.map +1 -1
  804. package/dist/utils/json.js +1 -1
  805. package/dist/utils/json.js.map +1 -1
  806. package/dist/utils/json_schema.cjs.map +1 -1
  807. package/dist/utils/json_schema.d.cts +1 -1
  808. package/dist/utils/json_schema.d.cts.map +1 -1
  809. package/dist/utils/json_schema.d.ts +1 -1
  810. package/dist/utils/json_schema.d.ts.map +1 -1
  811. package/dist/utils/json_schema.js.map +1 -1
  812. package/dist/utils/math.cjs.map +1 -1
  813. package/dist/utils/math.d.cts.map +1 -1
  814. package/dist/utils/math.d.ts.map +1 -1
  815. package/dist/utils/math.js.map +1 -1
  816. package/dist/utils/ml-distance/distances.cjs.map +1 -1
  817. package/dist/utils/ml-distance/distances.js.map +1 -1
  818. package/dist/utils/ml-distance/similarities.cjs.map +1 -1
  819. package/dist/utils/ml-distance/similarities.d.cts.map +1 -1
  820. package/dist/utils/ml-distance/similarities.d.ts.map +1 -1
  821. package/dist/utils/ml-distance/similarities.js.map +1 -1
  822. package/dist/utils/ml-distance-euclidean/euclidean.cjs +1 -0
  823. package/dist/utils/ml-distance-euclidean/euclidean.cjs.map +1 -1
  824. package/dist/utils/ml-distance-euclidean/euclidean.js +1 -1
  825. package/dist/utils/ml-distance-euclidean/euclidean.js.map +1 -1
  826. package/dist/utils/namespace.cjs +1 -0
  827. package/dist/utils/namespace.cjs.map +1 -1
  828. package/dist/utils/namespace.d.cts.map +1 -1
  829. package/dist/utils/namespace.d.ts.map +1 -1
  830. package/dist/utils/namespace.js +1 -1
  831. package/dist/utils/namespace.js.map +1 -1
  832. package/dist/utils/p-retry/index.cjs +1 -0
  833. package/dist/utils/p-retry/index.cjs.map +1 -1
  834. package/dist/utils/p-retry/index.js +1 -1
  835. package/dist/utils/p-retry/index.js.map +1 -1
  836. package/dist/utils/sax-js/sax.cjs.map +1 -1
  837. package/dist/utils/sax-js/sax.js.map +1 -1
  838. package/dist/utils/signal.cjs.map +1 -1
  839. package/dist/utils/signal.d.cts.map +1 -1
  840. package/dist/utils/signal.d.ts.map +1 -1
  841. package/dist/utils/signal.js.map +1 -1
  842. package/dist/utils/ssrf.cjs.map +1 -1
  843. package/dist/utils/ssrf.d.cts.map +1 -1
  844. package/dist/utils/ssrf.d.ts.map +1 -1
  845. package/dist/utils/ssrf.js.map +1 -1
  846. package/dist/utils/standard_schema.cjs.map +1 -1
  847. package/dist/utils/standard_schema.d.cts +0 -1
  848. package/dist/utils/standard_schema.d.cts.map +1 -1
  849. package/dist/utils/standard_schema.d.ts +0 -1
  850. package/dist/utils/standard_schema.d.ts.map +1 -1
  851. package/dist/utils/standard_schema.js.map +1 -1
  852. package/dist/utils/stream.cjs.map +1 -1
  853. package/dist/utils/stream.d.cts +0 -1
  854. package/dist/utils/stream.d.cts.map +1 -1
  855. package/dist/utils/stream.d.ts +0 -1
  856. package/dist/utils/stream.d.ts.map +1 -1
  857. package/dist/utils/stream.js.map +1 -1
  858. package/dist/utils/testing/chat_models.cjs.map +1 -1
  859. package/dist/utils/testing/chat_models.d.cts +2 -9
  860. package/dist/utils/testing/chat_models.d.cts.map +1 -1
  861. package/dist/utils/testing/chat_models.d.ts +2 -9
  862. package/dist/utils/testing/chat_models.d.ts.map +1 -1
  863. package/dist/utils/testing/chat_models.js.map +1 -1
  864. package/dist/utils/testing/embeddings.cjs.map +1 -1
  865. package/dist/utils/testing/embeddings.d.cts +0 -1
  866. package/dist/utils/testing/embeddings.d.cts.map +1 -1
  867. package/dist/utils/testing/embeddings.d.ts +0 -1
  868. package/dist/utils/testing/embeddings.d.ts.map +1 -1
  869. package/dist/utils/testing/embeddings.js.map +1 -1
  870. package/dist/utils/testing/llms.cjs.map +1 -1
  871. package/dist/utils/testing/llms.d.cts +0 -1
  872. package/dist/utils/testing/llms.d.cts.map +1 -1
  873. package/dist/utils/testing/llms.d.ts +0 -1
  874. package/dist/utils/testing/llms.d.ts.map +1 -1
  875. package/dist/utils/testing/llms.js.map +1 -1
  876. package/dist/utils/testing/message_history.cjs.map +1 -1
  877. package/dist/utils/testing/message_history.d.cts +1 -1
  878. package/dist/utils/testing/message_history.d.cts.map +1 -1
  879. package/dist/utils/testing/message_history.d.ts +1 -1
  880. package/dist/utils/testing/message_history.d.ts.map +1 -1
  881. package/dist/utils/testing/message_history.js.map +1 -1
  882. package/dist/utils/testing/openai_stream_fixtures.cjs.map +1 -1
  883. package/dist/utils/testing/openai_stream_fixtures.d.cts +0 -1
  884. package/dist/utils/testing/openai_stream_fixtures.d.cts.map +1 -1
  885. package/dist/utils/testing/openai_stream_fixtures.d.ts +0 -1
  886. package/dist/utils/testing/openai_stream_fixtures.d.ts.map +1 -1
  887. package/dist/utils/testing/openai_stream_fixtures.js.map +1 -1
  888. package/dist/utils/testing/output_parsers.cjs.map +1 -1
  889. package/dist/utils/testing/output_parsers.d.cts +0 -1
  890. package/dist/utils/testing/output_parsers.d.cts.map +1 -1
  891. package/dist/utils/testing/output_parsers.d.ts +0 -1
  892. package/dist/utils/testing/output_parsers.d.ts.map +1 -1
  893. package/dist/utils/testing/output_parsers.js.map +1 -1
  894. package/dist/utils/testing/retrievers.cjs.map +1 -1
  895. package/dist/utils/testing/retrievers.d.cts +0 -1
  896. package/dist/utils/testing/retrievers.d.cts.map +1 -1
  897. package/dist/utils/testing/retrievers.d.ts +0 -1
  898. package/dist/utils/testing/retrievers.d.ts.map +1 -1
  899. package/dist/utils/testing/retrievers.js.map +1 -1
  900. package/dist/utils/testing/runnables.cjs.map +1 -1
  901. package/dist/utils/testing/runnables.d.cts +0 -1
  902. package/dist/utils/testing/runnables.d.cts.map +1 -1
  903. package/dist/utils/testing/runnables.d.ts +0 -1
  904. package/dist/utils/testing/runnables.d.ts.map +1 -1
  905. package/dist/utils/testing/runnables.js.map +1 -1
  906. package/dist/utils/testing/stream.cjs +5 -0
  907. package/dist/utils/testing/stream.cjs.map +1 -1
  908. package/dist/utils/testing/stream.d.cts.map +1 -1
  909. package/dist/utils/testing/stream.d.ts.map +1 -1
  910. package/dist/utils/testing/stream.js +1 -1
  911. package/dist/utils/testing/stream.js.map +1 -1
  912. package/dist/utils/testing/tools.cjs.map +1 -1
  913. package/dist/utils/testing/tools.d.cts +0 -1
  914. package/dist/utils/testing/tools.d.cts.map +1 -1
  915. package/dist/utils/testing/tools.d.ts +0 -1
  916. package/dist/utils/testing/tools.d.ts.map +1 -1
  917. package/dist/utils/testing/tools.js.map +1 -1
  918. package/dist/utils/testing/tracers.cjs.map +1 -1
  919. package/dist/utils/testing/tracers.d.cts +0 -1
  920. package/dist/utils/testing/tracers.d.cts.map +1 -1
  921. package/dist/utils/testing/tracers.d.ts +0 -1
  922. package/dist/utils/testing/tracers.d.ts.map +1 -1
  923. package/dist/utils/testing/tracers.js.map +1 -1
  924. package/dist/utils/testing/vectorstores.cjs.map +1 -1
  925. package/dist/utils/testing/vectorstores.d.cts +1 -5
  926. package/dist/utils/testing/vectorstores.d.cts.map +1 -1
  927. package/dist/utils/testing/vectorstores.d.ts +1 -5
  928. package/dist/utils/testing/vectorstores.d.ts.map +1 -1
  929. package/dist/utils/testing/vectorstores.js.map +1 -1
  930. package/dist/utils/tiktoken.cjs +1 -1
  931. package/dist/utils/tiktoken.cjs.map +1 -1
  932. package/dist/utils/tiktoken.d.cts +0 -1
  933. package/dist/utils/tiktoken.d.cts.map +1 -1
  934. package/dist/utils/tiktoken.d.ts +0 -1
  935. package/dist/utils/tiktoken.d.ts.map +1 -1
  936. package/dist/utils/tiktoken.js +1 -1
  937. package/dist/utils/tiktoken.js.map +1 -1
  938. package/dist/utils/types/index.d.cts +0 -1
  939. package/dist/utils/types/index.d.cts.map +1 -1
  940. package/dist/utils/types/index.d.ts +0 -1
  941. package/dist/utils/types/index.d.ts.map +1 -1
  942. package/dist/utils/types/zod.cjs +0 -1
  943. package/dist/utils/types/zod.cjs.map +1 -1
  944. package/dist/utils/types/zod.d.cts +2 -3
  945. package/dist/utils/types/zod.d.cts.map +1 -1
  946. package/dist/utils/types/zod.d.ts +2 -3
  947. package/dist/utils/types/zod.d.ts.map +1 -1
  948. package/dist/utils/types/zod.js.map +1 -1
  949. package/dist/utils/uuid/index.d.cts +10 -11
  950. package/dist/utils/uuid/index.d.cts.map +1 -1
  951. package/dist/utils/uuid/index.d.ts +10 -11
  952. package/dist/utils/uuid/index.d.ts.map +1 -1
  953. package/dist/utils/uuid/parse.cjs.map +1 -1
  954. package/dist/utils/uuid/parse.d.cts +1 -3
  955. package/dist/utils/uuid/parse.d.cts.map +1 -1
  956. package/dist/utils/uuid/parse.d.ts +1 -2
  957. package/dist/utils/uuid/parse.d.ts.map +1 -1
  958. package/dist/utils/uuid/parse.js.map +1 -1
  959. package/dist/utils/uuid/rng.cjs +1 -1
  960. package/dist/utils/uuid/rng.cjs.map +1 -1
  961. package/dist/utils/uuid/rng.js +1 -1
  962. package/dist/utils/uuid/rng.js.map +1 -1
  963. package/dist/utils/uuid/sha1.cjs +2 -2
  964. package/dist/utils/uuid/sha1.cjs.map +1 -1
  965. package/dist/utils/uuid/sha1.js +2 -2
  966. package/dist/utils/uuid/sha1.js.map +1 -1
  967. package/dist/utils/uuid/stringify.cjs.map +1 -1
  968. package/dist/utils/uuid/stringify.d.cts +1 -2
  969. package/dist/utils/uuid/stringify.d.cts.map +1 -1
  970. package/dist/utils/uuid/stringify.d.ts +1 -1
  971. package/dist/utils/uuid/stringify.d.ts.map +1 -1
  972. package/dist/utils/uuid/stringify.js.map +1 -1
  973. package/dist/utils/uuid/types.d.cts.map +1 -1
  974. package/dist/utils/uuid/types.d.ts.map +1 -1
  975. package/dist/utils/uuid/v1.cjs +2 -1
  976. package/dist/utils/uuid/v1.cjs.map +1 -1
  977. package/dist/utils/uuid/v1.d.cts +1 -3
  978. package/dist/utils/uuid/v1.d.cts.map +1 -1
  979. package/dist/utils/uuid/v1.d.ts +1 -2
  980. package/dist/utils/uuid/v1.d.ts.map +1 -1
  981. package/dist/utils/uuid/v1.js +2 -2
  982. package/dist/utils/uuid/v1.js.map +1 -1
  983. package/dist/utils/uuid/v1ToV6.cjs.map +1 -1
  984. package/dist/utils/uuid/v1ToV6.js.map +1 -1
  985. package/dist/utils/uuid/v35.cjs +1 -0
  986. package/dist/utils/uuid/v35.cjs.map +1 -1
  987. package/dist/utils/uuid/v35.d.cts +6 -0
  988. package/dist/utils/uuid/v35.d.cts.map +1 -0
  989. package/dist/utils/uuid/v35.d.ts +6 -0
  990. package/dist/utils/uuid/v35.d.ts.map +1 -0
  991. package/dist/utils/uuid/v35.js +1 -1
  992. package/dist/utils/uuid/v35.js.map +1 -1
  993. package/dist/utils/uuid/v4.cjs.map +1 -1
  994. package/dist/utils/uuid/v4.d.cts +1 -3
  995. package/dist/utils/uuid/v4.d.cts.map +1 -1
  996. package/dist/utils/uuid/v4.d.ts +1 -2
  997. package/dist/utils/uuid/v4.d.ts.map +1 -1
  998. package/dist/utils/uuid/v4.js.map +1 -1
  999. package/dist/utils/uuid/v5.cjs.map +1 -1
  1000. package/dist/utils/uuid/v5.d.cts +5 -8
  1001. package/dist/utils/uuid/v5.d.cts.map +1 -1
  1002. package/dist/utils/uuid/v5.d.ts +5 -7
  1003. package/dist/utils/uuid/v5.d.ts.map +1 -1
  1004. package/dist/utils/uuid/v5.js.map +1 -1
  1005. package/dist/utils/uuid/v6.cjs +1 -1
  1006. package/dist/utils/uuid/v6.cjs.map +1 -1
  1007. package/dist/utils/uuid/v6.d.cts +1 -3
  1008. package/dist/utils/uuid/v6.d.cts.map +1 -1
  1009. package/dist/utils/uuid/v6.d.ts +1 -2
  1010. package/dist/utils/uuid/v6.d.ts.map +1 -1
  1011. package/dist/utils/uuid/v6.js +1 -1
  1012. package/dist/utils/uuid/v6.js.map +1 -1
  1013. package/dist/utils/uuid/v7.cjs +2 -1
  1014. package/dist/utils/uuid/v7.cjs.map +1 -1
  1015. package/dist/utils/uuid/v7.d.cts +1 -3
  1016. package/dist/utils/uuid/v7.d.cts.map +1 -1
  1017. package/dist/utils/uuid/v7.d.ts +1 -2
  1018. package/dist/utils/uuid/v7.d.ts.map +1 -1
  1019. package/dist/utils/uuid/v7.js +2 -2
  1020. package/dist/utils/uuid/v7.js.map +1 -1
  1021. package/dist/utils/uuid/validate.cjs.map +1 -1
  1022. package/dist/utils/uuid/validate.d.cts +1 -2
  1023. package/dist/utils/uuid/validate.d.cts.map +1 -1
  1024. package/dist/utils/uuid/validate.d.ts +1 -1
  1025. package/dist/utils/uuid/validate.d.ts.map +1 -1
  1026. package/dist/utils/uuid/validate.js.map +1 -1
  1027. package/dist/utils/uuid/version.cjs.map +1 -1
  1028. package/dist/utils/uuid/version.d.cts +1 -2
  1029. package/dist/utils/uuid/version.d.cts.map +1 -1
  1030. package/dist/utils/uuid/version.d.ts +1 -1
  1031. package/dist/utils/uuid/version.d.ts.map +1 -1
  1032. package/dist/utils/uuid/version.js.map +1 -1
  1033. package/dist/utils/zod-to-json-schema/Options.cjs.map +1 -1
  1034. package/dist/utils/zod-to-json-schema/Options.d.cts +3 -1
  1035. package/dist/utils/zod-to-json-schema/Options.d.ts +3 -1
  1036. package/dist/utils/zod-to-json-schema/Options.js.map +1 -1
  1037. package/dist/utils/zod-to-json-schema/Refs.cjs.map +1 -1
  1038. package/dist/utils/zod-to-json-schema/Refs.d.cts +3 -1
  1039. package/dist/utils/zod-to-json-schema/Refs.d.ts +3 -1
  1040. package/dist/utils/zod-to-json-schema/Refs.js.map +1 -1
  1041. package/dist/utils/zod-to-json-schema/errorMessages.cjs.map +1 -1
  1042. package/dist/utils/zod-to-json-schema/errorMessages.d.cts +2 -1
  1043. package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -1
  1044. package/dist/utils/zod-to-json-schema/errorMessages.d.ts +2 -1
  1045. package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -1
  1046. package/dist/utils/zod-to-json-schema/errorMessages.js.map +1 -1
  1047. package/dist/utils/zod-to-json-schema/getRelativePath.cjs.map +1 -1
  1048. package/dist/utils/zod-to-json-schema/getRelativePath.js.map +1 -1
  1049. package/dist/utils/zod-to-json-schema/index.cjs +79 -37
  1050. package/dist/utils/zod-to-json-schema/index.d.cts +15 -1
  1051. package/dist/utils/zod-to-json-schema/index.d.ts +15 -1
  1052. package/dist/utils/zod-to-json-schema/index.js +38 -38
  1053. package/dist/utils/zod-to-json-schema/parseDef.cjs.map +1 -1
  1054. package/dist/utils/zod-to-json-schema/parseDef.d.cts +3 -1
  1055. package/dist/utils/zod-to-json-schema/parseDef.d.ts +3 -1
  1056. package/dist/utils/zod-to-json-schema/parseDef.js.map +1 -1
  1057. package/dist/utils/zod-to-json-schema/parseTypes.d.cts +0 -1
  1058. package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -1
  1059. package/dist/utils/zod-to-json-schema/parseTypes.d.ts +0 -1
  1060. package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -1
  1061. package/dist/utils/zod-to-json-schema/parsers/any.cjs.map +1 -1
  1062. package/dist/utils/zod-to-json-schema/parsers/any.d.cts +1 -0
  1063. package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -1
  1064. package/dist/utils/zod-to-json-schema/parsers/any.d.ts +1 -0
  1065. package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -1
  1066. package/dist/utils/zod-to-json-schema/parsers/any.js.map +1 -1
  1067. package/dist/utils/zod-to-json-schema/parsers/array.cjs +0 -1
  1068. package/dist/utils/zod-to-json-schema/parsers/array.cjs.map +1 -1
  1069. package/dist/utils/zod-to-json-schema/parsers/array.d.cts +2 -0
  1070. package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -1
  1071. package/dist/utils/zod-to-json-schema/parsers/array.d.ts +2 -0
  1072. package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -1
  1073. package/dist/utils/zod-to-json-schema/parsers/array.js.map +1 -1
  1074. package/dist/utils/zod-to-json-schema/parsers/bigint.cjs.map +1 -1
  1075. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts +2 -0
  1076. package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -1
  1077. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts +2 -0
  1078. package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -1
  1079. package/dist/utils/zod-to-json-schema/parsers/bigint.js.map +1 -1
  1080. package/dist/utils/zod-to-json-schema/parsers/boolean.cjs.map +1 -1
  1081. package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -1
  1082. package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -1
  1083. package/dist/utils/zod-to-json-schema/parsers/boolean.js.map +1 -1
  1084. package/dist/utils/zod-to-json-schema/parsers/branded.cjs.map +1 -1
  1085. package/dist/utils/zod-to-json-schema/parsers/branded.d.cts +3 -1
  1086. package/dist/utils/zod-to-json-schema/parsers/branded.d.ts +3 -1
  1087. package/dist/utils/zod-to-json-schema/parsers/branded.js.map +1 -1
  1088. package/dist/utils/zod-to-json-schema/parsers/catch.cjs.map +1 -1
  1089. package/dist/utils/zod-to-json-schema/parsers/catch.d.cts +3 -1
  1090. package/dist/utils/zod-to-json-schema/parsers/catch.d.ts +3 -1
  1091. package/dist/utils/zod-to-json-schema/parsers/catch.js.map +1 -1
  1092. package/dist/utils/zod-to-json-schema/parsers/date.cjs.map +1 -1
  1093. package/dist/utils/zod-to-json-schema/parsers/date.d.cts +3 -0
  1094. package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -1
  1095. package/dist/utils/zod-to-json-schema/parsers/date.d.ts +3 -0
  1096. package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -1
  1097. package/dist/utils/zod-to-json-schema/parsers/date.js.map +1 -1
  1098. package/dist/utils/zod-to-json-schema/parsers/default.cjs.map +1 -1
  1099. package/dist/utils/zod-to-json-schema/parsers/default.d.cts +3 -1
  1100. package/dist/utils/zod-to-json-schema/parsers/default.d.ts +3 -1
  1101. package/dist/utils/zod-to-json-schema/parsers/default.js.map +1 -1
  1102. package/dist/utils/zod-to-json-schema/parsers/effects.cjs.map +1 -1
  1103. package/dist/utils/zod-to-json-schema/parsers/effects.d.cts +3 -1
  1104. package/dist/utils/zod-to-json-schema/parsers/effects.d.ts +3 -1
  1105. package/dist/utils/zod-to-json-schema/parsers/effects.js.map +1 -1
  1106. package/dist/utils/zod-to-json-schema/parsers/enum.cjs.map +1 -1
  1107. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts +1 -0
  1108. package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -1
  1109. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts +1 -0
  1110. package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -1
  1111. package/dist/utils/zod-to-json-schema/parsers/enum.js.map +1 -1
  1112. package/dist/utils/zod-to-json-schema/parsers/intersection.cjs.map +1 -1
  1113. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts +2 -0
  1114. package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -1
  1115. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts +2 -0
  1116. package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -1
  1117. package/dist/utils/zod-to-json-schema/parsers/intersection.js.map +1 -1
  1118. package/dist/utils/zod-to-json-schema/parsers/literal.cjs.map +1 -1
  1119. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts +2 -0
  1120. package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -1
  1121. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts +2 -0
  1122. package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -1
  1123. package/dist/utils/zod-to-json-schema/parsers/literal.js.map +1 -1
  1124. package/dist/utils/zod-to-json-schema/parsers/map.cjs.map +1 -1
  1125. package/dist/utils/zod-to-json-schema/parsers/map.d.cts +3 -0
  1126. package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -1
  1127. package/dist/utils/zod-to-json-schema/parsers/map.d.ts +3 -0
  1128. package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -1
  1129. package/dist/utils/zod-to-json-schema/parsers/map.js.map +1 -1
  1130. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs.map +1 -1
  1131. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts +1 -0
  1132. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -1
  1133. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts +1 -0
  1134. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -1
  1135. package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js.map +1 -1
  1136. package/dist/utils/zod-to-json-schema/parsers/never.cjs.map +1 -1
  1137. package/dist/utils/zod-to-json-schema/parsers/never.d.cts +1 -0
  1138. package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -1
  1139. package/dist/utils/zod-to-json-schema/parsers/never.d.ts +1 -0
  1140. package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -1
  1141. package/dist/utils/zod-to-json-schema/parsers/never.js.map +1 -1
  1142. package/dist/utils/zod-to-json-schema/parsers/null.cjs.map +1 -1
  1143. package/dist/utils/zod-to-json-schema/parsers/null.d.cts +1 -0
  1144. package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -1
  1145. package/dist/utils/zod-to-json-schema/parsers/null.d.ts +1 -0
  1146. package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -1
  1147. package/dist/utils/zod-to-json-schema/parsers/null.js.map +1 -1
  1148. package/dist/utils/zod-to-json-schema/parsers/nullable.cjs.map +1 -1
  1149. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts +2 -0
  1150. package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -1
  1151. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts +2 -0
  1152. package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -1
  1153. package/dist/utils/zod-to-json-schema/parsers/nullable.js.map +1 -1
  1154. package/dist/utils/zod-to-json-schema/parsers/number.cjs.map +1 -1
  1155. package/dist/utils/zod-to-json-schema/parsers/number.d.cts +2 -0
  1156. package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -1
  1157. package/dist/utils/zod-to-json-schema/parsers/number.d.ts +2 -0
  1158. package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -1
  1159. package/dist/utils/zod-to-json-schema/parsers/number.js.map +1 -1
  1160. package/dist/utils/zod-to-json-schema/parsers/object.cjs.map +1 -1
  1161. package/dist/utils/zod-to-json-schema/parsers/object.d.cts +2 -0
  1162. package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -1
  1163. package/dist/utils/zod-to-json-schema/parsers/object.d.ts +2 -0
  1164. package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -1
  1165. package/dist/utils/zod-to-json-schema/parsers/object.js.map +1 -1
  1166. package/dist/utils/zod-to-json-schema/parsers/optional.cjs.map +1 -1
  1167. package/dist/utils/zod-to-json-schema/parsers/optional.d.cts +3 -1
  1168. package/dist/utils/zod-to-json-schema/parsers/optional.d.ts +3 -1
  1169. package/dist/utils/zod-to-json-schema/parsers/optional.js.map +1 -1
  1170. package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs.map +1 -1
  1171. package/dist/utils/zod-to-json-schema/parsers/pipeline.d.cts +4 -1
  1172. package/dist/utils/zod-to-json-schema/parsers/pipeline.d.ts +4 -1
  1173. package/dist/utils/zod-to-json-schema/parsers/pipeline.js.map +1 -1
  1174. package/dist/utils/zod-to-json-schema/parsers/promise.cjs.map +1 -1
  1175. package/dist/utils/zod-to-json-schema/parsers/promise.d.cts +3 -1
  1176. package/dist/utils/zod-to-json-schema/parsers/promise.d.ts +3 -1
  1177. package/dist/utils/zod-to-json-schema/parsers/promise.js.map +1 -1
  1178. package/dist/utils/zod-to-json-schema/parsers/readonly.cjs.map +1 -1
  1179. package/dist/utils/zod-to-json-schema/parsers/readonly.d.cts +3 -1
  1180. package/dist/utils/zod-to-json-schema/parsers/readonly.d.ts +3 -1
  1181. package/dist/utils/zod-to-json-schema/parsers/readonly.js.map +1 -1
  1182. package/dist/utils/zod-to-json-schema/parsers/record.cjs +0 -1
  1183. package/dist/utils/zod-to-json-schema/parsers/record.cjs.map +1 -1
  1184. package/dist/utils/zod-to-json-schema/parsers/record.d.cts +2 -0
  1185. package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -1
  1186. package/dist/utils/zod-to-json-schema/parsers/record.d.ts +2 -0
  1187. package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -1
  1188. package/dist/utils/zod-to-json-schema/parsers/record.js.map +1 -1
  1189. package/dist/utils/zod-to-json-schema/parsers/set.cjs.map +1 -1
  1190. package/dist/utils/zod-to-json-schema/parsers/set.d.cts +2 -0
  1191. package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -1
  1192. package/dist/utils/zod-to-json-schema/parsers/set.d.ts +2 -0
  1193. package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -1
  1194. package/dist/utils/zod-to-json-schema/parsers/set.js.map +1 -1
  1195. package/dist/utils/zod-to-json-schema/parsers/string.cjs +0 -2
  1196. package/dist/utils/zod-to-json-schema/parsers/string.cjs.map +1 -1
  1197. package/dist/utils/zod-to-json-schema/parsers/string.d.cts +2 -0
  1198. package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -1
  1199. package/dist/utils/zod-to-json-schema/parsers/string.d.ts +2 -0
  1200. package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -1
  1201. package/dist/utils/zod-to-json-schema/parsers/string.js +0 -2
  1202. package/dist/utils/zod-to-json-schema/parsers/string.js.map +1 -1
  1203. package/dist/utils/zod-to-json-schema/parsers/tuple.cjs.map +1 -1
  1204. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts +2 -0
  1205. package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -1
  1206. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts +2 -0
  1207. package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -1
  1208. package/dist/utils/zod-to-json-schema/parsers/tuple.js.map +1 -1
  1209. package/dist/utils/zod-to-json-schema/parsers/undefined.cjs.map +1 -1
  1210. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts +1 -0
  1211. package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -1
  1212. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts +1 -0
  1213. package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -1
  1214. package/dist/utils/zod-to-json-schema/parsers/undefined.js.map +1 -1
  1215. package/dist/utils/zod-to-json-schema/parsers/union.cjs.map +1 -1
  1216. package/dist/utils/zod-to-json-schema/parsers/union.d.cts +2 -0
  1217. package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -1
  1218. package/dist/utils/zod-to-json-schema/parsers/union.d.ts +2 -0
  1219. package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -1
  1220. package/dist/utils/zod-to-json-schema/parsers/union.js.map +1 -1
  1221. package/dist/utils/zod-to-json-schema/parsers/unknown.cjs.map +1 -1
  1222. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts +1 -0
  1223. package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -1
  1224. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts +1 -0
  1225. package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -1
  1226. package/dist/utils/zod-to-json-schema/parsers/unknown.js.map +1 -1
  1227. package/dist/utils/zod-to-json-schema/selectParser.cjs +0 -1
  1228. package/dist/utils/zod-to-json-schema/selectParser.cjs.map +1 -1
  1229. package/dist/utils/zod-to-json-schema/selectParser.d.cts +3 -1
  1230. package/dist/utils/zod-to-json-schema/selectParser.d.ts +2 -0
  1231. package/dist/utils/zod-to-json-schema/selectParser.js.map +1 -1
  1232. package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs.map +1 -1
  1233. package/dist/utils/zod-to-json-schema/zodToJsonSchema.d.cts +3 -1
  1234. package/dist/utils/zod-to-json-schema/zodToJsonSchema.d.ts +3 -1
  1235. package/dist/utils/zod-to-json-schema/zodToJsonSchema.js.map +1 -1
  1236. package/dist/vectorstores.cjs.map +1 -1
  1237. package/dist/vectorstores.d.cts +0 -1
  1238. package/dist/vectorstores.d.cts.map +1 -1
  1239. package/dist/vectorstores.d.ts +0 -1
  1240. package/dist/vectorstores.d.ts.map +1 -1
  1241. package/dist/vectorstores.js.map +1 -1
  1242. package/package.json +15 -4
  1243. package/utils/gateway.cjs +1 -0
  1244. package/utils/gateway.d.cts +1 -0
  1245. package/utils/gateway.d.ts +1 -0
  1246. package/utils/gateway.js +1 -0
@@ -1,7 +1,6 @@
1
1
  import { ContentBlock } from "./content/index.js";
2
2
  import { ResponseMetadata, UsageMetadata } from "./metadata.js";
3
3
  import { $MergeDiscriminatedUnion, $MergeObjects } from "./utils.js";
4
-
5
4
  //#region src/messages/message.d.ts
6
5
  /**
7
6
  * Represents the possible types of messages in the system.
@@ -113,7 +112,7 @@ interface MessageToolSet {
113
112
  * // }
114
113
  * ```
115
114
  */
116
- type $MessageToolCallBlock<TStructure extends MessageStructure> = TStructure["tools"] extends MessageToolSet ? { [K in keyof TStructure["tools"]]: K extends string ? TStructure["tools"][K] extends MessageToolDefinition ? ContentBlock.Tools.ToolCall<K, TStructure["tools"][K]["input"]> : never : never }[keyof TStructure["tools"]] : never;
115
+ type $MessageToolCallBlock<TStructure extends MessageStructure> = TStructure["tools"] extends MessageToolSet ? { [K in keyof TStructure["tools"]]: K extends string ? TStructure["tools"][K] extends MessageToolDefinition ? ContentBlock.Tools.ToolCall<K, TStructure["tools"][K]["input"]> : never : never; }[keyof TStructure["tools"]] : never;
117
116
  /**
118
117
  * Helper type to infer a union of ToolCall types from the tools defined in a MessageStructure.
119
118
  * This is used to type the `tool_calls` array in AIMessage based on the available tools.
@@ -137,12 +136,12 @@ type $MessageToolCallBlock<TStructure extends MessageStructure> = TStructure["to
137
136
  * // | { type?: "tool_call"; id?: string; name: "search"; args: { query: string } }
138
137
  * ```
139
138
  */
140
- type $InferToolCalls<TStructure extends MessageStructure> = NonNullable<TStructure["tools"]> extends MessageToolSet ? NonNullable<TStructure["tools"]> extends infer TTools extends MessageToolSet ? { [K in keyof TTools]: K extends string ? TTools[K] extends MessageToolDefinition ? {
139
+ type $InferToolCalls<TStructure extends MessageStructure> = NonNullable<TStructure["tools"]> extends MessageToolSet ? NonNullable<TStructure["tools"]> extends (infer TTools extends MessageToolSet) ? { [K in keyof TTools]: K extends string ? TTools[K] extends MessageToolDefinition ? {
141
140
  readonly type?: "tool_call";
142
141
  id?: string;
143
142
  name: K;
144
143
  args: [unknown] extends [TTools[K]["input"]] ? Record<string, any> : TTools[K]["input"];
145
- } : never : never }[keyof TTools] : never : {
144
+ } : never : never; }[keyof TTools] : never : {
146
145
  readonly type?: "tool_call";
147
146
  id?: string;
148
147
  name: string;
@@ -169,7 +168,7 @@ type $InferToolCalls<TStructure extends MessageStructure> = NonNullable<TStructu
169
168
  * // Resolves to: number | string[]
170
169
  * ```
171
170
  */
172
- type $InferToolOutputs<TStructure extends MessageStructure> = NonNullable<TStructure["tools"]> extends MessageToolSet ? NonNullable<TStructure["tools"]> extends infer TTools extends MessageToolSet ? { [K in keyof TTools]: TTools[K] extends MessageToolDefinition ? TTools[K]["output"] : never }[keyof TTools] : unknown : unknown;
171
+ type $InferToolOutputs<TStructure extends MessageStructure> = NonNullable<TStructure["tools"]> extends MessageToolSet ? NonNullable<TStructure["tools"]> extends (infer TTools extends MessageToolSet) ? { [K in keyof TTools]: TTools[K] extends MessageToolDefinition ? TTools[K]["output"] : never; }[keyof TTools] : unknown : unknown;
173
172
  /**
174
173
  * Core interface that defines the structure of messages.
175
174
  *
@@ -246,12 +245,12 @@ interface MessageStructure<TTools extends MessageToolSet = MessageToolSet> {
246
245
  * Optional mapping of message types to their allowed content blocks.
247
246
  * Each message type can specify what content block types it supports (text, images, etc).
248
247
  */
249
- readonly content?: Partial<{ [key in MessageType]: ContentBlock }>;
248
+ readonly content?: Partial<{ [key in MessageType]: ContentBlock; }>;
250
249
  /**
251
250
  * Optional mapping of message types to arbitrary property objects.
252
251
  * Allows attaching custom metadata or other information to specific message types.
253
252
  */
254
- readonly properties?: Partial<{ [key in MessageType]: Record<string, unknown> }>;
253
+ readonly properties?: Partial<{ [key in MessageType]: Record<string, unknown>; }>;
255
254
  }
256
255
  /**
257
256
  * Normalizes an arbitrary type to a message output version or undefined.
@@ -285,7 +284,7 @@ type $NormalizeMessageOutputVersion<T> = Extract<T, MessageOutputVersion> | unde
285
284
  * type Result4 = $MergeOutputVersion<"v0", "v1">; // "v1"
286
285
  * ```
287
286
  */
288
- type $MergeOutputVersion<T, U> = $NormalizeMessageOutputVersion<T> extends infer TV ? $NormalizeMessageOutputVersion<U> extends infer UV ? [TV, UV] extends [undefined, undefined] ? "v0" : [TV] extends [undefined] ? Exclude<UV, undefined> : [UV] extends [undefined] ? Exclude<TV, undefined> : UV : never : never;
287
+ type $MergeOutputVersion<T, U> = $NormalizeMessageOutputVersion<T> extends (infer TV) ? $NormalizeMessageOutputVersion<U> extends (infer UV) ? [TV, UV] extends [undefined, undefined] ? "v0" : [TV] extends [undefined] ? Exclude<UV, undefined> : [UV] extends [undefined] ? Exclude<TV, undefined> : UV : never : never;
289
288
  /**
290
289
  * Merges two content definition objects from message structures.
291
290
  *
@@ -323,7 +322,7 @@ type $MergeOutputVersion<T, U> = $NormalizeMessageOutputVersion<T> extends infer
323
322
  * // }
324
323
  * ```
325
324
  */
326
- type $MergeContentDefinition<T, U> = { [K in keyof T | keyof U as Extract<(K extends keyof T ? T[K] : never) | (K extends keyof U ? U[K] : never), ContentBlock> extends never ? never : K]: K extends keyof T ? K extends keyof U ? $MergeDiscriminatedUnion<Extract<T[K], ContentBlock>, Extract<U[K], ContentBlock>, "type"> : Extract<T[K], ContentBlock> : K extends keyof U ? Extract<U[K], ContentBlock> : never };
325
+ type $MergeContentDefinition<T, U> = { [K in keyof T | keyof U as Extract<(K extends keyof T ? T[K] : never) | (K extends keyof U ? U[K] : never), ContentBlock> extends never ? never : K]: K extends keyof T ? K extends keyof U ? $MergeDiscriminatedUnion<Extract<T[K], ContentBlock>, Extract<U[K], ContentBlock>, "type"> : Extract<T[K], ContentBlock> : K extends keyof U ? Extract<U[K], ContentBlock> : never; };
327
326
  /**
328
327
  * Merges two message structures A and B into a combined structure.
329
328
  * This is a type utility that handles merging of tools, content blocks, and properties
@@ -373,24 +372,34 @@ type $MergeMessageStructure<T extends MessageStructure, U extends MessageStructu
373
372
  */
374
373
  interface StandardMessageStructure extends MessageStructure {
375
374
  content: {
376
- /** Text content for AI messages */ai: ContentBlock.Text; /** Text content for human messages */
377
- human: ContentBlock.Text; /** Text content for system messages */
378
- system: ContentBlock.Text; /** Text content for tool messages */
375
+ /** Text content for AI messages */
376
+ ai: ContentBlock.Text;
377
+ /** Text content for human messages */
378
+ human: ContentBlock.Text;
379
+ /** Text content for system messages */
380
+ system: ContentBlock.Text;
381
+ /** Text content for tool messages */
379
382
  tool: ContentBlock.Text;
380
383
  };
381
384
  properties: {
382
- /** Properties specific to AI messages */ai: {
383
- /** Metadata about the AI model response */response_metadata: ResponseMetadata; /** Usage statistics for the AI response */
385
+ /** Properties specific to AI messages */
386
+ ai: {
387
+ /** Metadata about the AI model response */
388
+ response_metadata: ResponseMetadata;
389
+ /** Usage statistics for the AI response */
384
390
  usage_metadata: UsageMetadata;
385
391
  };
386
392
  human: {
387
- /** Metadata about the human message */response_metadata: Record<string, unknown>;
393
+ /** Metadata about the human message */
394
+ response_metadata: Record<string, unknown>;
388
395
  };
389
396
  system: {
390
- /** Metadata about the system message */response_metadata: Record<string, unknown>;
397
+ /** Metadata about the system message */
398
+ response_metadata: Record<string, unknown>;
391
399
  };
392
400
  tool: {
393
- /** Metadata about the tool message */response_metadata: Record<string, unknown>;
401
+ /** Metadata about the tool message */
402
+ response_metadata: Record<string, unknown>;
394
403
  };
395
404
  };
396
405
  }
@@ -431,7 +440,7 @@ type $NormalizedMessageStructure<T extends MessageStructure> = T extends Standar
431
440
  * // AIContent = ContentBlock.Text | ContentBlock.ToolCall
432
441
  * ```
433
442
  */
434
- type $InferMessageContentBlocks<TStructure extends MessageStructure, TRole extends MessageType> = $NormalizedMessageStructure<TStructure> extends infer S ? S extends MessageStructure ? S["content"] extends infer C ? C extends Record<PropertyKey, ContentBlock> ? TRole extends keyof C ? [$MessageToolCallBlock<TStructure>] extends [never] ? C[TRole] : $MergeDiscriminatedUnion<NonNullable<C[TRole]>, $MessageToolCallBlock<TStructure>, "type"> : never : never : never : never : never;
443
+ type $InferMessageContentBlocks<TStructure extends MessageStructure, TRole extends MessageType> = $NormalizedMessageStructure<TStructure> extends (infer S) ? S extends MessageStructure ? S["content"] extends (infer C) ? C extends Record<PropertyKey, ContentBlock> ? TRole extends keyof C ? [$MessageToolCallBlock<TStructure>] extends [never] ? C[TRole] : $MergeDiscriminatedUnion<NonNullable<C[TRole]>, $MessageToolCallBlock<TStructure>, "type"> : never : never : never : never : never;
435
444
  /**
436
445
  * Infers the content type for a specific message type from a message structure.
437
446
  *
@@ -471,8 +480,8 @@ type $InferMessageContentBlocks<TStructure extends MessageStructure, TRole exten
471
480
  * // AIContentV1 = ContentBlock.Text | ContentBlock.Reasoning
472
481
  * ```
473
482
  */
474
- type $InferMessageContent<TStructure extends MessageStructure, TRole extends MessageType> = TRole extends "tool" ? $InferToolOutputs<TStructure> extends infer TOutput ? [TOutput] extends [never] ? string | Array<ContentBlock | ContentBlock.Text> : [unknown] extends [TOutput] ? // Fallback to default when TOutput is unknown (no specific tools defined)
475
- string | Array<ContentBlock | ContentBlock.Text> : TOutput | string | Array<ContentBlock | ContentBlock.Text> : string | Array<ContentBlock | ContentBlock.Text> : TStructure["outputVersion"] extends "v1" ? Array<$InferMessageContentBlocks<TStructure, TRole>> : string | Array<ContentBlock | ContentBlock.Text>;
483
+ type $InferMessageContent<TStructure extends MessageStructure, TRole extends MessageType> = TRole extends "tool" ? $InferToolOutputs<TStructure> extends (infer TOutput) ? [TOutput] extends [never] ? string | Array<ContentBlock | ContentBlock.Text> : [unknown] extends [TOutput] // Fallback to default when TOutput is unknown (no specific tools defined)
484
+ ? string | Array<ContentBlock | ContentBlock.Text> : TOutput | string | Array<ContentBlock | ContentBlock.Text> : string | Array<ContentBlock | ContentBlock.Text> : TStructure["outputVersion"] extends "v1" ? Array<$InferMessageContentBlocks<TStructure, TRole>> : string | Array<ContentBlock | ContentBlock.Text>;
476
485
  /**
477
486
  * Infers the properties for a specific message type from a message structure.
478
487
  *
@@ -511,7 +520,7 @@ string | Array<ContentBlock | ContentBlock.Text> : TOutput | string | Array<Cont
511
520
  * // SystemProperties = Record<string, unknown> (fallback for undefined role)
512
521
  * ```
513
522
  */
514
- type $InferMessageProperties<TStructure extends MessageStructure, TRole extends MessageType> = $NormalizedMessageStructure<TStructure> extends infer S ? S extends MessageStructure ? S["properties"] extends (infer P) | undefined ? P extends Record<PropertyKey, unknown> ? TRole extends keyof P ? Omit<P[TRole], "content" | "type"> : Record<string, unknown> : Record<string, unknown> : Record<string, unknown> : never : never;
523
+ type $InferMessageProperties<TStructure extends MessageStructure, TRole extends MessageType> = $NormalizedMessageStructure<TStructure> extends (infer S) ? S extends MessageStructure ? S["properties"] extends (infer P) | undefined ? P extends Record<PropertyKey, unknown> ? TRole extends keyof P ? Omit<P[TRole], "content" | "type"> : Record<string, unknown> : Record<string, unknown> : Record<string, unknown> : never : never;
515
524
  /**
516
525
  * Infers the type of a specific property for a message type from a message structure.
517
526
  *
@@ -577,7 +586,7 @@ type $InferMessageProperty<TStructure extends MessageStructure, TRole extends Me
577
586
  * // HumanResponseMetadata = Record<string, unknown> (fallback since not defined)
578
587
  * ```
579
588
  */
580
- type $InferResponseMetadata<TStructure extends MessageStructure, TRole extends MessageType> = $InferMessageProperty<TStructure, TRole, "response_metadata"> extends infer P ? [P] extends [never] ? Record<string, unknown> : P : never;
589
+ type $InferResponseMetadata<TStructure extends MessageStructure, TRole extends MessageType> = $InferMessageProperty<TStructure, TRole, "response_metadata"> extends (infer P) ? [P] extends [never] ? Record<string, unknown> : P : never;
581
590
  /**
582
591
  * Represents a message object that organizes context for an LLM.
583
592
  *
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","names":[],"sources":["../../src/messages/message.ts"],"mappings":";;;;;;;AAmBA;;;;;AAkCA;;;;;AAiBA;;;KAnDY,WAAA,kDAKE,WAAA;;;;;;;;;AAqEd;;;;;AA8BA;;;;;;;;;;;;;;KAtEY,oBAAA;;;;;;;;;;;;;;;;UAiBK,qBAAA;EACf,KAAA,EAAO,MAAA;EACP,MAAA,EAAQ,OAAA;AAAA;;;;AAqFV;;;;;;;;;;;;;;;UAhEiB,cAAA;EAAA,CACd,GAAA,WAAc,qBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BL,qBAAA,oBAAyC,gBAAA,IACnD,UAAA,kBAA4B,cAAA,iBAEV,UAAA,YAAsB,CAAA,kBAC9B,UAAA,UAAoB,CAAA,UAAW,qBAAA,GAC7B,YAAA,CAAa,KAAA,CAAM,QAAA,CAAS,CAAA,EAAG,UAAA,UAAoB,CAAA,oCAGnD,UAAA;;;;;;;;;;;;AA4Ed;;;;;;;;;;;;KAlDY,eAAA,oBAAmC,gBAAA,IAC7C,WAAA,CAAY,UAAA,mBAA6B,cAAA,GACrC,WAAA,CAAY,UAAA,wCACV,cAAA,iBAEc,MAAA,GAAS,CAAA,kBACjB,MAAA,CAAO,CAAA,UAAW,qBAAA;EAAA,SAEL,IAAA;EACT,EAAA;EACA,IAAA,EAAM,CAAA;EAEN,IAAA,qBAAyB,MAAA,CAAO,CAAA,cAE5B,MAAA,gBACA,MAAA,CAAO,CAAA;AAAA,0BAIb,MAAA;EAAA,SAGC,IAAA;EACT,EAAA;EACA,IAAA;EAEA,IAAA,EAAM,MAAA;AAAA;;;;;;;;;;;;;;AAiGd;;;;;;;;KAzEY,iBAAA,oBAAqC,gBAAA,IAC/C,WAAA,CAAY,UAAA,mBAA6B,cAAA,GACrC,WAAA,CAAY,UAAA,wCACV,cAAA,iBAEc,MAAA,GAAS,MAAA,CAAO,CAAA,UAAW,qBAAA,GACnC,MAAA,CAAO,CAAA,4BAEL,MAAA;;;;;;;;;;;;;;;;;;;;;;;;AA4Ff;;;;;;;;;;;;;;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;UAhEiB,gBAAA,gBACA,cAAA,GAAiB,cAAA;EAkEzB;;;;EAAA,SA5DE,aAAA,GAAgB,oBAAA;EAgEd;;;;EAAA,SA3DF,KAAA,GAAQ,MAAA;EA6DH;AAyChB;;;EAzCgB,SAxDL,OAAA,GAAU,OAAA,WACT,WAAA,GAAc,YAAA;EAkGL;;;;EAAA,SA5FV,UAAA,GAAa,OAAA,WACZ,WAAA,GAAc,MAAA;AAAA;;;;;KAQrB,8BAAA,MACD,OAAA,CAAQ,CAAA,EAAG,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BH,mBAAA,SACV,8BAAA,CAA+B,CAAA,qBAC3B,8BAAA,CAA+B,CAAA,sBAC5B,EAAA,EAAI,EAAA,2CAEF,EAAA,wBACC,OAAA,CAAQ,EAAA,gBACP,EAAA,wBACC,OAAA,CAAQ,EAAA,eACR,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Fd;;KAtDY,uBAAA,uBACE,CAAA,SAAU,CAAA,IAAK,OAAA,EACxB,CAAA,eAAgB,CAAA,GAAI,CAAA,CAAE,CAAA,cAAe,CAAA,eAAgB,CAAA,GAAI,CAAA,CAAE,CAAA,YAC5D,YAAA,0BAGE,CAAA,GAAI,CAAA,eAAgB,CAAA,GACpB,CAAA,eAAgB,CAAA,GACd,wBAAA,CACE,OAAA,CAAQ,CAAA,CAAE,CAAA,GAAI,YAAA,GACd,OAAA,CAAQ,CAAA,CAAE,CAAA,GAAI,YAAA,aAGhB,OAAA,CAAQ,CAAA,CAAE,CAAA,GAAI,YAAA,IAChB,CAAA,eAAgB,CAAA,GACd,OAAA,CAAQ,CAAA,CAAE,CAAA,GAAI,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCV,sBAAA,WACA,gBAAA,YACA,gBAAA;EAEV,aAAA,EAAe,mBAAA,CAAoB,CAAA,mBAAoB,CAAA;EACvD,KAAA,EAAO,aAAA,CAAc,CAAA,WAAY,CAAA;EACjC,OAAA,EAAS,uBAAA,CAAwB,CAAA,aAAc,CAAA;EAC/C,UAAA,EAAY,aAAA,CAAc,CAAA,gBAAiB,CAAA;AAAA;;;;;;;UAS5B,wBAAA,SAAiC,gBAAA;EAChD,OAAA;IADgE,mCAG9D,EAAA,EAAI,YAAA,CAAa,IAAA,EAH6B;IAK9C,KAAA,EAAO,YAAA,CAAa,IAAA,EAFpB;IAIA,MAAA,EAAQ,YAAA,CAAa,IAAA,EAJJ;IAMjB,IAAA,EAAM,YAAA,CAAa,IAAA;EAAA;EAErB,UAAA;IAJE,yCAMA,EAAA;MANqB,2CAQnB,iBAAA,EAAmB,gBAAA,EANf;MAQJ,cAAA,EAAgB,aAAA;IAAA;IAElB,KAAA;MAJE,uCAMA,iBAAA,EAAmB,MAAA;IAAA;IAErB,MAAA;MAJA,wCAME,iBAAA,EAAmB,MAAA;IAAA;IAErB,IAAA;MAFE,sCAIA,iBAAA,EAAmB,MAAA;IAAA;EAAA;AAAA;;;AAezB;;;;;;;;KAAY,2BAAA,WAAsC,gBAAA,IAChD,CAAA,SAAU,wBAAA,GACN,CAAA,GACA,sBAAA,CAAuB,wBAAA,EAA0B,CAAA;;;;;;;;;;;;;;AA4BvD;;;;;;;;;;;;;KAAY,0BAAA,oBACS,gBAAA,gBACL,WAAA,IAEd,2BAAA,CAA4B,UAAA,oBACxB,CAAA,SAAU,gBAAA,GACR,CAAA,8BACE,CAAA,SAAU,MAAA,CAAO,WAAA,EAAa,YAAA,IAC5B,KAAA,eAAoB,CAAA,IACjB,qBAAA,CAAsB,UAAA,qBACrB,CAAA,CAAE,KAAA,IACF,wBAAA,CACE,WAAA,CAAY,CAAA,CAAE,KAAA,IACd,qBAAA,CAAsB,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgD5B,oBAAA,oBACS,gBAAA,gBACL,WAAA,IACZ,KAAA,kBAEA,iBAAA,CAAkB,UAAA,2BACf,OAAA,6BACU,KAAA,CAAM,YAAA,GAAe,YAAA,CAAa,IAAA,uBACxB,OAAA;AAAA,SAEN,KAAA,CAAM,YAAA,GAAe,YAAA,CAAa,IAAA,IAC7C,OAAA,YAAmB,KAAA,CAAM,YAAA,GAAe,YAAA,CAAa,IAAA,aAChD,KAAA,CAAM,YAAA,GAAe,YAAA,CAAa,IAAA,IAC7C,UAAA,iCACE,KAAA,CAAM,0BAAA,CAA2B,UAAA,EAAY,KAAA,cACpC,KAAA,CAAM,YAAA,GAAe,YAAA,CAAa,IAAA;AAfjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,KAuDY,uBAAA,oBACS,gBAAA,gBACL,WAAA,IAEd,2BAAA,CAA4B,UAAA,oBACxB,CAAA,SAAU,gBAAA,GACR,CAAA,+CACE,CAAA,SAAU,MAAA,CAAO,WAAA,aACf,KAAA,eAAoB,CAAA,GAClB,IAAA,CAAK,CAAA,CAAE,KAAA,yBACP,MAAA,oBACF,MAAA,oBACF,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAZV;;;;;KAqDY,qBAAA,oBACS,gBAAA,gBACL,WAAA,sBAEZ,CAAA,eAAgB,uBAAA,CAAwB,UAAA,EAAY,KAAA,IACpD,uBAAA,CAAwB,UAAA,EAAY,KAAA,EAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnC,sBAAA,oBACS,gBAAA,gBACL,WAAA,IAEd,qBAAA,CAAsB,UAAA,EAAY,KAAA,0CAC7B,CAAA,oBACC,MAAA,oBACA,CAAA;;;;;;;;;;;;AA1CR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA;UAoDiB,OAAA,oBACI,gBAAA,GAAmB,wBAAA,gBACxB,WAAA,GAAc,WAAA;EAtDI;EAAA,SAyDvB,IAAA,EAAM,KAAA;EAvDD;EAyDd,EAAA;EAvDkC;;;;;;;;;;;;;;;;;;;AAgDpC;;;;;;;;;;;;;;;EA0CE,IAAA;EAI2B;EAF3B,OAAA,EAAS,oBAAA,CAAqB,UAAA,EAAY,KAAA;EA3CvB;EA6CnB,iBAAA,GAAoB,OAAA,CAAQ,sBAAA,CAAuB,UAAA,EAAY,KAAA;AAAA;;;;;;;iBASjD,SAAA,CAAU,OAAA,YAAmB,OAAA,IAAW,OAAA"}
1
+ {"version":3,"file":"message.d.ts","names":[],"sources":["../../src/messages/message.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAmBY,6DAKE;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BF;;;;;;;;;;;;;;;;UAiBK,sBAAsB,kBAAkB;EACvD,OAAO;EACP,QAAQ;;;;;;;;;;;;;;;;;;;;UAqBO;GACd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BL,sBAAsB,mBAAmB,oBACnD,4BAA4B,oBAErB,WAAW,sBAAsB,mBAC9B,oBAAoB,WAAW,wBAC7B,aAAa,MAAM,SAAS,GAAG,oBAAoB,sCAGnD;;;;;;;;;;;;;;;;;;;;;;;;KA0BF,gBAAgB,mBAAmB,oBAC7C,YAAY,6BAA6B,iBACrC,YAAY,oCAAmC,eAC7C,qBAEG,WAAW,SAAS,mBACjB,OAAO,WAAW;WAEL;EACT;EACA,MAAM;EAEN,yBAAyB,OAAO,eAE5B,sBACA,OAAO;2BAIb;WAGC;EACT;EACA;EAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;KAwBF,kBAAkB,mBAAmB,oBAC/C,YAAY,6BAA6B,iBACrC,YAAY,oCAAmC,eAC7C,qBAEG,WAAW,SAAS,OAAO,WAAW,wBACnC,OAAO,8BAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiEC,iBACf,eAAe,iBAAiB;;;;;WAMvB,gBAAgB;;;;;WAKhB,QAAQ;;;;;WAKR,UAAU,WAChB,OAAO,cAAc;;;;;WAMf,aAAa,WACnB,OAAO,cAAc;;;;;;KAQrB,+BAA+B,KAChC,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BH,oBAAoB,GAAG,KACjC,+BAA+B,kBAAiB,MAC5C,+BAA+B,kBAAiB,OAC7C,IAAI,6CAEF,0BACC,QAAQ,kBACP,0BACC,QAAQ,iBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCF,wBAAwB,GAAG,QACpC,WAAW,UAAU,KAAK,SACxB,gBAAgB,IAAI,EAAE,eAAe,gBAAgB,IAAI,EAAE,aAC5D,sCAGE,IAAI,gBAAgB,IACpB,gBAAgB,IACd,yBACE,QAAQ,EAAE,IAAI,eACd,QAAQ,EAAE,IAAI,yBAGhB,QAAQ,EAAE,IAAI,gBAChB,gBAAgB,IACd,QAAQ,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCV,uBACV,UAAU,kBACV,UAAU;EAEV,eAAe,oBAAoB,oBAAoB;EACvD,OAAO,cAAc,YAAY;EACjC,SAAS,wBAAwB,cAAc;EAC/C,YAAY,cAAc,iBAAiB;;;;;;;;UAS5B,iCAAiC;EAChD;;IAEE,IAAI,aAAa;;IAEjB,OAAO,aAAa;;IAEpB,QAAQ,aAAa;;IAErB,MAAM,aAAa;;EAErB;;IAEE;;MAEE,mBAAmB;;MAEnB,gBAAgB;;IAElB;;MAEE,mBAAmB;;IAErB;;MAEE,mBAAmB;;IAErB;;MAEE,mBAAmB;;;;;;;;;;;;;;KAeb,4BAA4B,UAAU,oBAChD,UAAU,2BACN,IACA,uBAAuB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4B3C,2BACV,mBAAmB,kBACnB,cAAc,eAEd,4BAA4B,2BAA0B,KAClD,UAAU,mBACR,4BAA2B,KACzB,UAAU,OAAO,aAAa,gBAC5B,oBAAoB,KACjB,sBAAsB,+BACrB,EAAE,SACF,yBACE,YAAY,EAAE,SACd,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgD5B,qBACV,mBAAmB,kBACnB,cAAc,eACZ,uBAEA,kBAAkB,2BAA0B,YACzC,oCACU,MAAM,eAAe,aAAa,2BACxB;YAEN,MAAM,eAAe,aAAa,QAC7C,mBAAmB,MAAM,eAAe,aAAa,iBAChD,MAAM,eAAe,aAAa,QAC7C,2CACE,MAAM,2BAA2B,YAAY,mBACpC,MAAM,eAAe,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCrC,wBACV,mBAAmB,kBACnB,cAAc,eAEd,4BAA4B,2BAA0B,KAClD,UAAU,mBACR,+BAA+B,iBAC7B,UAAU,OAAO,wBACf,oBAAoB,IAClB,KAAK,EAAE,8BACP,0BACF,0BACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCE,sBACV,mBAAmB,kBACnB,cAAc,aACd,oBACE,gBAAgB,wBAAwB,YAAY,SACpD,wBAAwB,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BnC,uBACV,mBAAmB,kBACnB,cAAc,eAEd,sBAAsB,YAAY,2CAA0C,MACvE,qBACC,0BACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6CS,QACf,mBAAmB,mBAAmB,0BACtC,cAAc,cAAc;;WAGnB,MAAM;;EAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA;;EAEA,SAAS,qBAAqB,YAAY;;EAE1C,oBAAoB,QAAQ,uBAAuB,YAAY;;;;;;;;iBASjD,UAAU,mBAAmB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","names":[],"sources":["../../src/messages/message.ts"],"sourcesContent":["import type { ContentBlock } from \"./content/index.js\";\nimport type { ResponseMetadata, UsageMetadata } from \"./metadata.js\";\nimport type { $MergeDiscriminatedUnion, $MergeObjects } from \"./utils.js\";\n\n/**\n * Represents the possible types of messages in the system.\n * Includes standard message types (\"ai\", \"human\", \"tool\", \"system\")\n * and allows for custom string types that are non-null.\n *\n * @example\n * ```ts\n * // Standard message types\n * const messageType1: MessageType = \"ai\";\n * const messageType2: MessageType = \"human\";\n *\n * // Custom message type\n * const messageType3: MessageType = \"custom_type\";\n * ```\n */\nexport type MessageType =\n | \"ai\"\n | \"human\"\n | \"tool\"\n | \"system\"\n | (string & NonNullable<unknown>);\n\n/**\n * Represents the output version format for message content.\n *\n * This type determines how the content field is structured in a message:\n * - \"v0\": Content is represented as a simple string or array of content blocks\n * - provides backward compatibility with simpler content representations\n * - \"v1\": Content follows the structured ContentBlock format with typed discriminated unions\n * - enables full type safety and structured content block handling\n *\n * @example\n * ```ts\n * // v0 format - simple content representation\n * const v0Message: Message<{ outputVersion: \"v0\", content: ... }> = {\n * type: \"human\",\n * content: \"Hello world\" // string | Array<ContentBlock | ContentBlock.Text>\n * };\n *\n * // v1 format - structured content blocks\n * const v1Message: Message<{ outputVersion: \"v1\", content: ... }> = {\n * type: \"human\",\n * content: [\n * { type: \"text\", text: \"Hello world\" },\n * { type: \"image\", image_url: \"...\" }\n * ] // Array<ContentBlock | ...> (determined by the structure)\n * };\n * ```\n */\nexport type MessageOutputVersion = \"v0\" | \"v1\";\n\n/**\n * Represents the input and output types of a tool that can be used in messages.\n *\n * @template TInput - The type of input the tool accepts.\n * @template TOutput - The type of output the tool produces.\n *\n * @example\n * ```ts\n * // Tool that takes a string input and returns a number\n * interface StringToNumberTool extends MessageToolDefinition<string, number> {\n * input: string;\n * output: number;\n * }\n * ```\n */\nexport interface MessageToolDefinition<TInput = unknown, TOutput = unknown> {\n input: TInput;\n output: TOutput;\n}\n\n/**\n * Represents a structured set of tools by mapping tool names to definitions\n * that can be used in messages.\n *\n * @example\n * ```ts\n * interface MyToolSet extends MessageToolSet {\n * calculator: MessageToolDefinition<\n * { operation: string; numbers: number[] },\n * number\n * >;\n * translator: MessageToolDefinition<\n * { text: string; targetLanguage: string },\n * string\n * >;\n * }\n * ```\n */\nexport interface MessageToolSet {\n [key: string]: MessageToolDefinition;\n}\n\n/**\n * Represents a tool call block within a message structure by mapping tool names to their\n * corresponding tool call formats, including the input arguments and an optional identifier.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with a calculator tool:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ operation: string, numbers: number[] }, number>\n * }\n * }\n *\n * // The tool call block would be:\n * type CalcToolCall = $MessageToolCallBlock<MyStructure>;\n * // Resolves to:\n * // {\n * // type: \"tool_call\";\n * // name: \"calculator\";\n * // args: { operation: string, numbers: number[] };\n * // id?: string;\n * // }\n * ```\n */\nexport type $MessageToolCallBlock<TStructure extends MessageStructure> =\n TStructure[\"tools\"] extends MessageToolSet\n ? {\n [K in keyof TStructure[\"tools\"]]: K extends string\n ? TStructure[\"tools\"][K] extends MessageToolDefinition\n ? ContentBlock.Tools.ToolCall<K, TStructure[\"tools\"][K][\"input\"]>\n : never\n : never;\n }[keyof TStructure[\"tools\"]]\n : never;\n\n/**\n * Helper type to infer a union of ToolCall types from the tools defined in a MessageStructure.\n * This is used to type the `tool_calls` array in AIMessage based on the available tools.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with tools:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ a: number, b: number }, number>;\n * search: MessageToolDefinition<{ query: string }, string[]>;\n * }\n * }\n *\n * // The inferred tool calls would be:\n * type ToolCalls = $InferToolCalls<MyStructure>;\n * // Resolves to:\n * // | { type?: \"tool_call\"; id?: string; name: \"calculator\"; args: { a: number, b: number } }\n * // | { type?: \"tool_call\"; id?: string; name: \"search\"; args: { query: string } }\n * ```\n */\nexport type $InferToolCalls<TStructure extends MessageStructure> =\n NonNullable<TStructure[\"tools\"]> extends MessageToolSet\n ? NonNullable<TStructure[\"tools\"]> extends infer TTools extends\n MessageToolSet\n ? {\n [K in keyof TTools]: K extends string\n ? TTools[K] extends MessageToolDefinition\n ? {\n readonly type?: \"tool_call\";\n id?: string;\n name: K;\n // Fallback to Record<string, any> when input is unknown\n args: [unknown] extends [TTools[K][\"input\"]]\n ? // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Record<string, any>\n : TTools[K][\"input\"];\n }\n : never\n : never;\n }[keyof TTools]\n : never\n : {\n readonly type?: \"tool_call\";\n id?: string;\n name: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n args: Record<string, any>;\n };\n\n/**\n * Helper type to infer a union of tool output types from the tools defined in a MessageStructure.\n * This is used to type the `content` of ToolMessage based on the available tool outputs.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with tools:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ a: number, b: number }, number>;\n * search: MessageToolDefinition<{ query: string }, string[]>;\n * }\n * }\n *\n * // The inferred tool outputs would be:\n * type ToolOutputs = $InferToolOutputs<MyStructure>;\n * // Resolves to: number | string[]\n * ```\n */\nexport type $InferToolOutputs<TStructure extends MessageStructure> =\n NonNullable<TStructure[\"tools\"]> extends MessageToolSet\n ? NonNullable<TStructure[\"tools\"]> extends infer TTools extends\n MessageToolSet\n ? {\n [K in keyof TTools]: TTools[K] extends MessageToolDefinition\n ? TTools[K][\"output\"]\n : never;\n }[keyof TTools]\n : unknown\n : unknown;\n\n/**\n * Core interface that defines the structure of messages.\n *\n * @example\n * ```ts\n * // Basic message structure with just content blocks\n * interface SimpleMessageStructure extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * // allows for text + reasoning blocks in ai messages\n * ai: ContentBlock.Text | ContentBlock.Reasoning;\n * }\n * }\n *\n * // Message structure with tools and properties\n * interface AdvancedMessageStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<\n * { operation: string; numbers: number[] },\n * number\n * >;\n * };\n * content: {\n * // allows for text + image blocks in human messages\n * human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * // only allows for text blocks in ai messages\n * ai: ContentBlock.Text;\n * };\n * properties: {\n * // pins properties to ai messages\n * ai: {\n * response_metadata: {\n * confidence: number;\n * model: string;\n * };\n * };\n * }\n * }\n *\n * // Using with $MergeMessageStructure to combine structures\n * // The resulting type when passed into BaseMessage will have a calculator tool,\n * // allow for text + image blocks in human messages,\n * // and text + reasoning blocks + additional arbitrary properties in ai messages.\n * type CombinedStructure = $MergeMessageStructure<\n * SimpleMessageStructure,\n * AdvancedMessageStructure\n * >;\n *\n * // Using in a Message object\n * const message: Message<CombinedStructure> = {\n * id: \"msg-123\",\n * type: \"human\",\n * content: [\n * { type: \"text\", text: \"Hello!\" }\n * { type: \"image\", mimeType: \"image/jpeg\", url: \"https://example.com/image.jpg\" }\n * // this block will throw an error because it's not defined in the structure\n * { type: \"reasoning\", reasoning: \"The answer is 42\" }\n * ]\n * };\n * ```\n */\nexport interface MessageStructure<\n TTools extends MessageToolSet = MessageToolSet,\n> {\n /**\n * Optional output version for the message structure.\n * If not provided, defaults to \"v0\".\n */\n readonly outputVersion?: MessageOutputVersion;\n /**\n * Optional set of tool definitions that can be used in messages.\n * Each tool is defined with input/output types and can be referenced in tool messages.\n */\n readonly tools?: TTools;\n /**\n * Optional mapping of message types to their allowed content blocks.\n * Each message type can specify what content block types it supports (text, images, etc).\n */\n readonly content?: Partial<{\n [key in MessageType]: ContentBlock;\n }>;\n /**\n * Optional mapping of message types to arbitrary property objects.\n * Allows attaching custom metadata or other information to specific message types.\n */\n readonly properties?: Partial<{\n [key in MessageType]: Record<string, unknown>;\n }>;\n}\n\n/**\n * Normalizes an arbitrary type to a message output version or undefined.\n * Accepts unknown and narrows to a valid MessageOutputVersion if present.\n */\ntype $NormalizeMessageOutputVersion<T> =\n | Extract<T, MessageOutputVersion>\n | undefined;\n\n/**\n * Merges two output version types from message structures.\n *\n * This utility type determines the resulting output version when combining two message structures.\n * The merge logic follows these rules:\n *\n * - If both T and U are undefined, defaults to \"v0\" for backwards compatibility\n * - If T is undefined but U is defined, uses U's version\n * - If U is undefined but T is defined, uses T's version\n * - If both T and U are defined, U takes precedence (later structure wins)\n *\n * @template T - The output version from the first message structure\n * @template U - The output version from the second message structure\n *\n * @example\n * ```ts\n * // Both undefined - defaults to \"v0\"\n * type Result1 = $MergeOutputVersion<undefined, undefined>; // \"v0\"\n *\n * // One defined - uses the defined version\n * type Result2 = $MergeOutputVersion<undefined, \"v1\">; // \"v1\"\n * type Result3 = $MergeOutputVersion<\"v0\", undefined>; // \"v0\"\n *\n * // Both defined - second takes precedence\n * type Result4 = $MergeOutputVersion<\"v0\", \"v1\">; // \"v1\"\n * ```\n */\nexport type $MergeOutputVersion<T, U> =\n $NormalizeMessageOutputVersion<T> extends infer TV\n ? $NormalizeMessageOutputVersion<U> extends infer UV\n ? [TV, UV] extends [undefined, undefined]\n ? \"v0\"\n : [TV] extends [undefined]\n ? Exclude<UV, undefined>\n : [UV] extends [undefined]\n ? Exclude<TV, undefined>\n : UV\n : never\n : never;\n\n/**\n * Merges two content definition objects from message structures.\n *\n * This utility type combines content definitions from two message structures, handling\n * the merging of content block types for each message type. The merge logic follows\n * these rules:\n *\n * - For keys that exist in both T and U: Merges the content blocks using discriminated\n * union merging based on the \"type\" property. This allows combining different content\n * block types (e.g., text + image) for the same message type.\n * - For keys that exist only in T: Uses T's content definition as-is\n * - For keys that exist only in U: Uses U's content definition as-is\n *\n * @template T - The content definition from the first message structure\n * @template U - The content definition from the second message structure\n *\n * @example\n * ```ts\n * // T allows text content for human messages\n * type ContentA = {\n * human: ContentBlock.Text;\n * };\n *\n * // U allows image content for human messages and text for AI messages\n * type ContentB = {\n * human: ContentBlock.Multimodal.Image;\n * ai: ContentBlock.Text;\n * };\n *\n * // Merged result allows both text and images for human messages, text for AI\n * type Merged = $MergeContentDefinition<ContentA, ContentB>;\n * // Result: {\n * // human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * // ai: ContentBlock.Text;\n * // }\n * ```\n */\nexport type $MergeContentDefinition<T, U> = {\n [K in keyof T | keyof U as Extract<\n (K extends keyof T ? T[K] : never) | (K extends keyof U ? U[K] : never),\n ContentBlock\n > extends never\n ? never\n : K]: K extends keyof T\n ? K extends keyof U\n ? $MergeDiscriminatedUnion<\n Extract<T[K], ContentBlock>,\n Extract<U[K], ContentBlock>,\n \"type\"\n >\n : Extract<T[K], ContentBlock>\n : K extends keyof U\n ? Extract<U[K], ContentBlock>\n : never;\n};\n\n/**\n * Merges two message structures A and B into a combined structure.\n * This is a type utility that handles merging of tools, content blocks, and properties\n * from two message structures. The resulting type is usable as its own message structure.\n *\n * @example\n * ```ts\n * // Structure A allows text in human messages and has a confidence property on AI messages\n * interface StructureA extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * };\n * properties: {\n * ai: { confidence: number };\n * }\n * }\n *\n * // Structure B allows images in human messages and has a model property on AI messages\n * interface StructureB extends MessageStructure {\n * content: {\n * human: ContentBlock.Multimodal.Image;\n * };\n * properties: {\n * ai: { model: string };\n * }\n * }\n *\n * // Merged structure allows both text and images in human messages\n * // AI messages have both confidence and model properties\n * type Merged = $MergeMessageStructure<StructureA, StructureB>;\n * ```\n *\n * @template A - First message structure to merge\n * @template B - Second message structure to merge (takes precedence over A)\n */\nexport type $MergeMessageStructure<\n T extends MessageStructure,\n U extends MessageStructure,\n> = {\n outputVersion: $MergeOutputVersion<T[\"outputVersion\"], U[\"outputVersion\"]>;\n tools: $MergeObjects<T[\"tools\"], U[\"tools\"]>;\n content: $MergeContentDefinition<T[\"content\"], U[\"content\"]>;\n properties: $MergeObjects<T[\"properties\"], U[\"properties\"]>;\n};\n\n/**\n * Standard message structured used to define the most basic message structure that's\n * used throughout the library.\n *\n * This is also the message structure that's used when a message structure is not provided.\n */\nexport interface StandardMessageStructure extends MessageStructure {\n content: {\n /** Text content for AI messages */\n ai: ContentBlock.Text;\n /** Text content for human messages */\n human: ContentBlock.Text;\n /** Text content for system messages */\n system: ContentBlock.Text;\n /** Text content for tool messages */\n tool: ContentBlock.Text;\n };\n properties: {\n /** Properties specific to AI messages */\n ai: {\n /** Metadata about the AI model response */\n response_metadata: ResponseMetadata;\n /** Usage statistics for the AI response */\n usage_metadata: UsageMetadata;\n };\n human: {\n /** Metadata about the human message */\n response_metadata: Record<string, unknown>;\n };\n system: {\n /** Metadata about the system message */\n response_metadata: Record<string, unknown>;\n };\n tool: {\n /** Metadata about the tool message */\n response_metadata: Record<string, unknown>;\n };\n };\n}\n\n/**\n * Takes a message structure type T and normalizes it by merging it with the standard message structure.\n * If T is already a standard message structure, returns T unchanged.\n *\n * This ensures that any custom message structure includes all the standard message structure fields\n * by default while allowing overrides and extensions.\n *\n * @template T - The message structure type to normalize, must extend MessageStructure\n * @returns Either T if it's already a standard structure, or the merged result of T with standard structure\n */\nexport type $NormalizedMessageStructure<T extends MessageStructure> =\n T extends StandardMessageStructure\n ? T\n : $MergeMessageStructure<StandardMessageStructure, T>;\n\n/**\n * Infers the content blocks for a specific message type in a message structure.\n *\n * This utility type extracts the content block type that corresponds to a given message type\n * from the message structure's content definition.\n *\n * @template TStructure - The message structure to infer content from\n * @template TRole - The message role/type to get content for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The content block type for the specified type, or never if its not defined in the structure\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.ToolCall;\n * };\n * }\n *\n * type HumanContent = $InferMessageContentBlocks<MyStructure, \"human\">;\n * // HumanContent = ContentBlock.Text\n *\n * type AIContent = $InferMessageContentBlocks<MyStructure, \"ai\">;\n * // AIContent = ContentBlock.Text | ContentBlock.ToolCall\n * ```\n */\nexport type $InferMessageContentBlocks<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $NormalizedMessageStructure<TStructure> extends infer S\n ? S extends MessageStructure\n ? S[\"content\"] extends infer C\n ? C extends Record<PropertyKey, ContentBlock>\n ? TRole extends keyof C\n ? [$MessageToolCallBlock<TStructure>] extends [never]\n ? C[TRole]\n : $MergeDiscriminatedUnion<\n NonNullable<C[TRole]>,\n $MessageToolCallBlock<TStructure>,\n \"type\"\n >\n : never\n : never\n : never\n : never\n : never;\n\n/**\n * Infers the content type for a specific message type from a message structure.\n *\n * This utility type determines the appropriate content type based on the message structure's\n * output version and the specified message type. The content type varies depending on the\n * output version (see {@link MessageOutputVersion})\n *\n * @template TStructure - The message structure to infer content from\n * @template TRole - The message role/type to get content for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The content type for the specified role based on the output version\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * outputVersion: \"v0\";\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.ToolCall;\n * };\n * }\n *\n * type HumanContentV0 = $InferMessageContent<MyStructure, \"human\">;\n * // HumanContentV0 = string | Array<ContentBlock | ContentBlock.Text>\n *\n * interface MyStructureV1 extends MessageStructure {\n * outputVersion: \"v1\";\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.Reasoning;\n * };\n * }\n *\n * type HumanContentV1 = $InferMessageContent<MyStructureV1, \"human\">;\n * // HumanContentV1 = ContentBlock.Text\n *\n * type AIContentV1 = $InferMessageContent<MyStructureV1, \"ai\">;\n * // AIContentV1 = ContentBlock.Text | ContentBlock.Reasoning\n * ```\n */\nexport type $InferMessageContent<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> = TRole extends \"tool\"\n ? // For tool messages, infer content from tool output types if available\n $InferToolOutputs<TStructure> extends infer TOutput\n ? [TOutput] extends [never]\n ? string | Array<ContentBlock | ContentBlock.Text>\n : [unknown] extends [TOutput]\n ? // Fallback to default when TOutput is unknown (no specific tools defined)\n string | Array<ContentBlock | ContentBlock.Text>\n : TOutput | string | Array<ContentBlock | ContentBlock.Text>\n : string | Array<ContentBlock | ContentBlock.Text>\n : TStructure[\"outputVersion\"] extends \"v1\"\n ? Array<$InferMessageContentBlocks<TStructure, TRole>>\n : string | Array<ContentBlock | ContentBlock.Text>;\n\n/**\n * Infers the properties for a specific message type from a message structure.\n *\n * This utility type extracts the properties object that corresponds to a given message type\n * from the message structure's properties definition, and excludes the reserved\n * \"content\" and \"type\" properties to avoid conflicts with the core message structure.\n *\n * If the specified type is not defined in the message structure's properties, it returns\n * a generic Record<string, unknown> type to allow for arbitrary properties.\n *\n * @template TStructure - The message structure to infer properties from\n * @template TRole - The message type/role to get properties for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The properties object type for the specified type, excluding \"content\" and \"type\"\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string };\n * usage_metadata: { tokens: number };\n * content: string; // This will be omitted\n * type: string; // This will be omitted\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type AIProperties = $InferMessageProperties<MyStructure, \"ai\">;\n * // AIProperties = { response_metadata: { model: string }; usage_metadata: { tokens: number } }\n *\n * type HumanProperties = $InferMessageProperties<MyStructure, \"human\">;\n * // HumanProperties = { metadata: Record<string, unknown> }\n *\n * type SystemProperties = $InferMessageProperties<MyStructure, \"system\">;\n * // SystemProperties = Record<string, unknown> (fallback for undefined role)\n * ```\n */\nexport type $InferMessageProperties<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $NormalizedMessageStructure<TStructure> extends infer S\n ? S extends MessageStructure\n ? S[\"properties\"] extends (infer P) | undefined\n ? P extends Record<PropertyKey, unknown>\n ? TRole extends keyof P\n ? Omit<P[TRole], \"content\" | \"type\">\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>\n : never\n : never;\n\n/**\n * Infers the type of a specific property for a message type from a message structure.\n *\n * This utility type extracts the type of a single property by name from the properties\n * object that corresponds to a given message type. If the specified property key does\n * not exist in the type's properties, it returns `never`.\n *\n * @template TStructure - The message structure to infer the property from\n * @template TRole - The message type/role to get the property for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @template K - The property key to extract the type for\n * @returns The type of the specified property, or `never` if the property doesn't exist\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string; temperature: number };\n * usage_metadata: { input_tokens: number; output_tokens: number };\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type ResponseMetadata = $InferMessageProperty<MyStructure, \"ai\", \"response_metadata\">;\n * // ResponseMetadata = { model: string; temperature: number }\n *\n * type UsageMetadata = $InferMessageProperty<MyStructure, \"ai\", \"usage_metadata\">;\n * // UsageMetadata = { input_tokens: number; output_tokens: number }\n *\n * type NonExistentProperty = $InferMessageProperty<MyStructure, \"ai\", \"nonExistent\">;\n * // NonExistentProperty = Record<string, unknown>\n *\n * type HumanMetadata = $InferMessageProperty<MyStructure, \"human\", \"metadata\">;\n * // HumanMetadata = Record<string, unknown>\n * ```\n */\nexport type $InferMessageProperty<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n K extends string,\n> = K extends keyof $InferMessageProperties<TStructure, TRole>\n ? $InferMessageProperties<TStructure, TRole>[K]\n : never;\n\n/**\n * Infers the response metadata type for a specific message type from a message structure.\n *\n * This utility type extracts the `response_metadata` property type for a given message type.\n *\n * @template TStructure - The message structure to infer the response metadata from\n * @template TRole - The message type/role to get the response metadata for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The type of the response_metadata property, or `Record<string, unknown>` as fallback\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string; temperature: number; tokens: number };\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type AIResponseMetadata = $InferResponseMetadata<MyStructure, \"ai\">;\n * // AIResponseMetadata = { model: string; temperature: number; tokens: number }\n *\n * type HumanResponseMetadata = $InferResponseMetadata<MyStructure, \"human\">;\n * // HumanResponseMetadata = Record<string, unknown> (fallback since not defined)\n * ```\n */\nexport type $InferResponseMetadata<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $InferMessageProperty<TStructure, TRole, \"response_metadata\"> extends infer P\n ? [P] extends [never]\n ? Record<string, unknown>\n : P\n : never;\n\n/**\n * Represents a message object that organizes context for an LLM.\n *\n * @example\n * ```ts\n * // Basic message with text content\n * const message: Message = {\n * id: \"msg-123\",\n * name: \"user\",\n * type: \"human\",\n * content: [{ type: \"text\", text: \"Hello!\" }]\n * };\n *\n * // Basic ai message interface extension\n * interface MyMessage extends Message<StandardMessageStructure, \"ai\"> {\n * // Additional AI-specific properties can be added here\n * }\n *`\n * // Custom message structure\n * interface CustomStructure extends MessageStructure {\n * content: {\n * ai: ContentBlock.Text | ContentBlock.ToolCall<\"search\", { query: string }>;\n * human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * };\n * }\n *\n * // Create a message with custom structure\n * const message: Message<CustomStructure> = {\n * id: \"msg-123\",\n * name: \"user\",\n * type: \"ai\",\n * content: [\n * { type: \"text\", text: \"Hello!\" },\n * {\n * type: \"tool_call\",\n * name: \"search\",\n * args: { query: \"What is the capital of France?\" }\n * }\n * ]\n * };\n * ```\n */\nexport interface Message<\n TStructure extends MessageStructure = StandardMessageStructure,\n TRole extends MessageType = MessageType,\n> {\n /** The message type/role */\n readonly type: TRole;\n /** Unique identifier for this message */\n id?: string;\n /**\n * An optional name for the message participant.\n *\n * This property is primarily used to:\n *\n * 1. **Identify agent roles in multi-agent systems**: When multiple agents\n * collaborate, setting `name` helps distinguish which agent produced a\n * message, preventing confusion about who said what.\n *\n * 2. **Pass participant names to model providers**: Some providers (notably\n * OpenAI, e.g. see {@link https://platform.openai.com/docs/api-reference/chat/create | OpenAI Chat Completions API})\n * use this field to differentiate between participants with the\n * same role. For example, when using OpenAI's Chat Completions API, the\n * `name` is included in the message payload sent to the model.\n *\n * @example\n * ```typescript\n * // Setting name on an AIMessage to identify the agent\n * const message = new AIMessage({\n * content: \"I'll handle the calendar scheduling.\",\n * name: \"calendar_agent\"\n * });\n *\n * // In a multi-agent system, this helps track message origins\n * const researcherMessage = new AIMessage({\n * content: \"Here are the findings...\",\n * name: \"researcher\"\n * });\n * const writerMessage = new AIMessage({\n * content: \"I've drafted the report.\",\n * name: \"writer\"\n * });\n * ```\n */\n name?: string;\n /** Array of content blocks that make up the message content */\n content: $InferMessageContent<TStructure, TRole>;\n /** Metadata about the message */\n response_metadata?: Partial<$InferResponseMetadata<TStructure, TRole>>;\n}\n\n/**\n * Type guard to check if a value is a valid Message object.\n *\n * @param message - The value to check\n * @returns true if the value is a valid Message object, false otherwise\n */\nexport function isMessage(message: unknown): message is Message {\n return (\n typeof message === \"object\" &&\n message !== null &&\n \"type\" in message &&\n \"content\" in message &&\n (typeof message.content === \"string\" || Array.isArray(message.content))\n );\n}\n"],"mappings":";;;;;;;AAk1BA,SAAgB,UAAU,SAAsC;AAC9D,QACE,OAAO,YAAY,YACnB,YAAY,QACZ,UAAU,WACV,aAAa,YACZ,OAAO,QAAQ,YAAY,YAAY,MAAM,QAAQ,QAAQ,QAAQ"}
1
+ {"version":3,"file":"message.js","names":[],"sources":["../../src/messages/message.ts"],"sourcesContent":["import type { ContentBlock } from \"./content/index.js\";\nimport type { ResponseMetadata, UsageMetadata } from \"./metadata.js\";\nimport type { $MergeDiscriminatedUnion, $MergeObjects } from \"./utils.js\";\n\n/**\n * Represents the possible types of messages in the system.\n * Includes standard message types (\"ai\", \"human\", \"tool\", \"system\")\n * and allows for custom string types that are non-null.\n *\n * @example\n * ```ts\n * // Standard message types\n * const messageType1: MessageType = \"ai\";\n * const messageType2: MessageType = \"human\";\n *\n * // Custom message type\n * const messageType3: MessageType = \"custom_type\";\n * ```\n */\nexport type MessageType =\n | \"ai\"\n | \"human\"\n | \"tool\"\n | \"system\"\n | (string & NonNullable<unknown>);\n\n/**\n * Represents the output version format for message content.\n *\n * This type determines how the content field is structured in a message:\n * - \"v0\": Content is represented as a simple string or array of content blocks\n * - provides backward compatibility with simpler content representations\n * - \"v1\": Content follows the structured ContentBlock format with typed discriminated unions\n * - enables full type safety and structured content block handling\n *\n * @example\n * ```ts\n * // v0 format - simple content representation\n * const v0Message: Message<{ outputVersion: \"v0\", content: ... }> = {\n * type: \"human\",\n * content: \"Hello world\" // string | Array<ContentBlock | ContentBlock.Text>\n * };\n *\n * // v1 format - structured content blocks\n * const v1Message: Message<{ outputVersion: \"v1\", content: ... }> = {\n * type: \"human\",\n * content: [\n * { type: \"text\", text: \"Hello world\" },\n * { type: \"image\", image_url: \"...\" }\n * ] // Array<ContentBlock | ...> (determined by the structure)\n * };\n * ```\n */\nexport type MessageOutputVersion = \"v0\" | \"v1\";\n\n/**\n * Represents the input and output types of a tool that can be used in messages.\n *\n * @template TInput - The type of input the tool accepts.\n * @template TOutput - The type of output the tool produces.\n *\n * @example\n * ```ts\n * // Tool that takes a string input and returns a number\n * interface StringToNumberTool extends MessageToolDefinition<string, number> {\n * input: string;\n * output: number;\n * }\n * ```\n */\nexport interface MessageToolDefinition<TInput = unknown, TOutput = unknown> {\n input: TInput;\n output: TOutput;\n}\n\n/**\n * Represents a structured set of tools by mapping tool names to definitions\n * that can be used in messages.\n *\n * @example\n * ```ts\n * interface MyToolSet extends MessageToolSet {\n * calculator: MessageToolDefinition<\n * { operation: string; numbers: number[] },\n * number\n * >;\n * translator: MessageToolDefinition<\n * { text: string; targetLanguage: string },\n * string\n * >;\n * }\n * ```\n */\nexport interface MessageToolSet {\n [key: string]: MessageToolDefinition;\n}\n\n/**\n * Represents a tool call block within a message structure by mapping tool names to their\n * corresponding tool call formats, including the input arguments and an optional identifier.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with a calculator tool:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ operation: string, numbers: number[] }, number>\n * }\n * }\n *\n * // The tool call block would be:\n * type CalcToolCall = $MessageToolCallBlock<MyStructure>;\n * // Resolves to:\n * // {\n * // type: \"tool_call\";\n * // name: \"calculator\";\n * // args: { operation: string, numbers: number[] };\n * // id?: string;\n * // }\n * ```\n */\nexport type $MessageToolCallBlock<TStructure extends MessageStructure> =\n TStructure[\"tools\"] extends MessageToolSet\n ? {\n [K in keyof TStructure[\"tools\"]]: K extends string\n ? TStructure[\"tools\"][K] extends MessageToolDefinition\n ? ContentBlock.Tools.ToolCall<K, TStructure[\"tools\"][K][\"input\"]>\n : never\n : never;\n }[keyof TStructure[\"tools\"]]\n : never;\n\n/**\n * Helper type to infer a union of ToolCall types from the tools defined in a MessageStructure.\n * This is used to type the `tool_calls` array in AIMessage based on the available tools.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with tools:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ a: number, b: number }, number>;\n * search: MessageToolDefinition<{ query: string }, string[]>;\n * }\n * }\n *\n * // The inferred tool calls would be:\n * type ToolCalls = $InferToolCalls<MyStructure>;\n * // Resolves to:\n * // | { type?: \"tool_call\"; id?: string; name: \"calculator\"; args: { a: number, b: number } }\n * // | { type?: \"tool_call\"; id?: string; name: \"search\"; args: { query: string } }\n * ```\n */\nexport type $InferToolCalls<TStructure extends MessageStructure> =\n NonNullable<TStructure[\"tools\"]> extends MessageToolSet\n ? NonNullable<TStructure[\"tools\"]> extends infer TTools extends\n MessageToolSet\n ? {\n [K in keyof TTools]: K extends string\n ? TTools[K] extends MessageToolDefinition\n ? {\n readonly type?: \"tool_call\";\n id?: string;\n name: K;\n // Fallback to Record<string, any> when input is unknown\n args: [unknown] extends [TTools[K][\"input\"]]\n ? // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n Record<string, any>\n : TTools[K][\"input\"];\n }\n : never\n : never;\n }[keyof TTools]\n : never\n : {\n readonly type?: \"tool_call\";\n id?: string;\n name: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n args: Record<string, any>;\n };\n\n/**\n * Helper type to infer a union of tool output types from the tools defined in a MessageStructure.\n * This is used to type the `content` of ToolMessage based on the available tool outputs.\n *\n * @template TStructure - A message structure type that may contain tool definitions\n *\n * @example\n * ```ts\n * // Given a message structure with tools:\n * interface MyStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<{ a: number, b: number }, number>;\n * search: MessageToolDefinition<{ query: string }, string[]>;\n * }\n * }\n *\n * // The inferred tool outputs would be:\n * type ToolOutputs = $InferToolOutputs<MyStructure>;\n * // Resolves to: number | string[]\n * ```\n */\nexport type $InferToolOutputs<TStructure extends MessageStructure> =\n NonNullable<TStructure[\"tools\"]> extends MessageToolSet\n ? NonNullable<TStructure[\"tools\"]> extends infer TTools extends\n MessageToolSet\n ? {\n [K in keyof TTools]: TTools[K] extends MessageToolDefinition\n ? TTools[K][\"output\"]\n : never;\n }[keyof TTools]\n : unknown\n : unknown;\n\n/**\n * Core interface that defines the structure of messages.\n *\n * @example\n * ```ts\n * // Basic message structure with just content blocks\n * interface SimpleMessageStructure extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * // allows for text + reasoning blocks in ai messages\n * ai: ContentBlock.Text | ContentBlock.Reasoning;\n * }\n * }\n *\n * // Message structure with tools and properties\n * interface AdvancedMessageStructure extends MessageStructure {\n * tools: {\n * calculator: MessageToolDefinition<\n * { operation: string; numbers: number[] },\n * number\n * >;\n * };\n * content: {\n * // allows for text + image blocks in human messages\n * human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * // only allows for text blocks in ai messages\n * ai: ContentBlock.Text;\n * };\n * properties: {\n * // pins properties to ai messages\n * ai: {\n * response_metadata: {\n * confidence: number;\n * model: string;\n * };\n * };\n * }\n * }\n *\n * // Using with $MergeMessageStructure to combine structures\n * // The resulting type when passed into BaseMessage will have a calculator tool,\n * // allow for text + image blocks in human messages,\n * // and text + reasoning blocks + additional arbitrary properties in ai messages.\n * type CombinedStructure = $MergeMessageStructure<\n * SimpleMessageStructure,\n * AdvancedMessageStructure\n * >;\n *\n * // Using in a Message object\n * const message: Message<CombinedStructure> = {\n * id: \"msg-123\",\n * type: \"human\",\n * content: [\n * { type: \"text\", text: \"Hello!\" }\n * { type: \"image\", mimeType: \"image/jpeg\", url: \"https://example.com/image.jpg\" }\n * // this block will throw an error because it's not defined in the structure\n * { type: \"reasoning\", reasoning: \"The answer is 42\" }\n * ]\n * };\n * ```\n */\nexport interface MessageStructure<\n TTools extends MessageToolSet = MessageToolSet,\n> {\n /**\n * Optional output version for the message structure.\n * If not provided, defaults to \"v0\".\n */\n readonly outputVersion?: MessageOutputVersion;\n /**\n * Optional set of tool definitions that can be used in messages.\n * Each tool is defined with input/output types and can be referenced in tool messages.\n */\n readonly tools?: TTools;\n /**\n * Optional mapping of message types to their allowed content blocks.\n * Each message type can specify what content block types it supports (text, images, etc).\n */\n readonly content?: Partial<{\n [key in MessageType]: ContentBlock;\n }>;\n /**\n * Optional mapping of message types to arbitrary property objects.\n * Allows attaching custom metadata or other information to specific message types.\n */\n readonly properties?: Partial<{\n [key in MessageType]: Record<string, unknown>;\n }>;\n}\n\n/**\n * Normalizes an arbitrary type to a message output version or undefined.\n * Accepts unknown and narrows to a valid MessageOutputVersion if present.\n */\ntype $NormalizeMessageOutputVersion<T> =\n | Extract<T, MessageOutputVersion>\n | undefined;\n\n/**\n * Merges two output version types from message structures.\n *\n * This utility type determines the resulting output version when combining two message structures.\n * The merge logic follows these rules:\n *\n * - If both T and U are undefined, defaults to \"v0\" for backwards compatibility\n * - If T is undefined but U is defined, uses U's version\n * - If U is undefined but T is defined, uses T's version\n * - If both T and U are defined, U takes precedence (later structure wins)\n *\n * @template T - The output version from the first message structure\n * @template U - The output version from the second message structure\n *\n * @example\n * ```ts\n * // Both undefined - defaults to \"v0\"\n * type Result1 = $MergeOutputVersion<undefined, undefined>; // \"v0\"\n *\n * // One defined - uses the defined version\n * type Result2 = $MergeOutputVersion<undefined, \"v1\">; // \"v1\"\n * type Result3 = $MergeOutputVersion<\"v0\", undefined>; // \"v0\"\n *\n * // Both defined - second takes precedence\n * type Result4 = $MergeOutputVersion<\"v0\", \"v1\">; // \"v1\"\n * ```\n */\nexport type $MergeOutputVersion<T, U> =\n $NormalizeMessageOutputVersion<T> extends infer TV\n ? $NormalizeMessageOutputVersion<U> extends infer UV\n ? [TV, UV] extends [undefined, undefined]\n ? \"v0\"\n : [TV] extends [undefined]\n ? Exclude<UV, undefined>\n : [UV] extends [undefined]\n ? Exclude<TV, undefined>\n : UV\n : never\n : never;\n\n/**\n * Merges two content definition objects from message structures.\n *\n * This utility type combines content definitions from two message structures, handling\n * the merging of content block types for each message type. The merge logic follows\n * these rules:\n *\n * - For keys that exist in both T and U: Merges the content blocks using discriminated\n * union merging based on the \"type\" property. This allows combining different content\n * block types (e.g., text + image) for the same message type.\n * - For keys that exist only in T: Uses T's content definition as-is\n * - For keys that exist only in U: Uses U's content definition as-is\n *\n * @template T - The content definition from the first message structure\n * @template U - The content definition from the second message structure\n *\n * @example\n * ```ts\n * // T allows text content for human messages\n * type ContentA = {\n * human: ContentBlock.Text;\n * };\n *\n * // U allows image content for human messages and text for AI messages\n * type ContentB = {\n * human: ContentBlock.Multimodal.Image;\n * ai: ContentBlock.Text;\n * };\n *\n * // Merged result allows both text and images for human messages, text for AI\n * type Merged = $MergeContentDefinition<ContentA, ContentB>;\n * // Result: {\n * // human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * // ai: ContentBlock.Text;\n * // }\n * ```\n */\nexport type $MergeContentDefinition<T, U> = {\n [K in keyof T | keyof U as Extract<\n (K extends keyof T ? T[K] : never) | (K extends keyof U ? U[K] : never),\n ContentBlock\n > extends never\n ? never\n : K]: K extends keyof T\n ? K extends keyof U\n ? $MergeDiscriminatedUnion<\n Extract<T[K], ContentBlock>,\n Extract<U[K], ContentBlock>,\n \"type\"\n >\n : Extract<T[K], ContentBlock>\n : K extends keyof U\n ? Extract<U[K], ContentBlock>\n : never;\n};\n\n/**\n * Merges two message structures A and B into a combined structure.\n * This is a type utility that handles merging of tools, content blocks, and properties\n * from two message structures. The resulting type is usable as its own message structure.\n *\n * @example\n * ```ts\n * // Structure A allows text in human messages and has a confidence property on AI messages\n * interface StructureA extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * };\n * properties: {\n * ai: { confidence: number };\n * }\n * }\n *\n * // Structure B allows images in human messages and has a model property on AI messages\n * interface StructureB extends MessageStructure {\n * content: {\n * human: ContentBlock.Multimodal.Image;\n * };\n * properties: {\n * ai: { model: string };\n * }\n * }\n *\n * // Merged structure allows both text and images in human messages\n * // AI messages have both confidence and model properties\n * type Merged = $MergeMessageStructure<StructureA, StructureB>;\n * ```\n *\n * @template A - First message structure to merge\n * @template B - Second message structure to merge (takes precedence over A)\n */\nexport type $MergeMessageStructure<\n T extends MessageStructure,\n U extends MessageStructure,\n> = {\n outputVersion: $MergeOutputVersion<T[\"outputVersion\"], U[\"outputVersion\"]>;\n tools: $MergeObjects<T[\"tools\"], U[\"tools\"]>;\n content: $MergeContentDefinition<T[\"content\"], U[\"content\"]>;\n properties: $MergeObjects<T[\"properties\"], U[\"properties\"]>;\n};\n\n/**\n * Standard message structured used to define the most basic message structure that's\n * used throughout the library.\n *\n * This is also the message structure that's used when a message structure is not provided.\n */\nexport interface StandardMessageStructure extends MessageStructure {\n content: {\n /** Text content for AI messages */\n ai: ContentBlock.Text;\n /** Text content for human messages */\n human: ContentBlock.Text;\n /** Text content for system messages */\n system: ContentBlock.Text;\n /** Text content for tool messages */\n tool: ContentBlock.Text;\n };\n properties: {\n /** Properties specific to AI messages */\n ai: {\n /** Metadata about the AI model response */\n response_metadata: ResponseMetadata;\n /** Usage statistics for the AI response */\n usage_metadata: UsageMetadata;\n };\n human: {\n /** Metadata about the human message */\n response_metadata: Record<string, unknown>;\n };\n system: {\n /** Metadata about the system message */\n response_metadata: Record<string, unknown>;\n };\n tool: {\n /** Metadata about the tool message */\n response_metadata: Record<string, unknown>;\n };\n };\n}\n\n/**\n * Takes a message structure type T and normalizes it by merging it with the standard message structure.\n * If T is already a standard message structure, returns T unchanged.\n *\n * This ensures that any custom message structure includes all the standard message structure fields\n * by default while allowing overrides and extensions.\n *\n * @template T - The message structure type to normalize, must extend MessageStructure\n * @returns Either T if it's already a standard structure, or the merged result of T with standard structure\n */\nexport type $NormalizedMessageStructure<T extends MessageStructure> =\n T extends StandardMessageStructure\n ? T\n : $MergeMessageStructure<StandardMessageStructure, T>;\n\n/**\n * Infers the content blocks for a specific message type in a message structure.\n *\n * This utility type extracts the content block type that corresponds to a given message type\n * from the message structure's content definition.\n *\n * @template TStructure - The message structure to infer content from\n * @template TRole - The message role/type to get content for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The content block type for the specified type, or never if its not defined in the structure\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.ToolCall;\n * };\n * }\n *\n * type HumanContent = $InferMessageContentBlocks<MyStructure, \"human\">;\n * // HumanContent = ContentBlock.Text\n *\n * type AIContent = $InferMessageContentBlocks<MyStructure, \"ai\">;\n * // AIContent = ContentBlock.Text | ContentBlock.ToolCall\n * ```\n */\nexport type $InferMessageContentBlocks<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $NormalizedMessageStructure<TStructure> extends infer S\n ? S extends MessageStructure\n ? S[\"content\"] extends infer C\n ? C extends Record<PropertyKey, ContentBlock>\n ? TRole extends keyof C\n ? [$MessageToolCallBlock<TStructure>] extends [never]\n ? C[TRole]\n : $MergeDiscriminatedUnion<\n NonNullable<C[TRole]>,\n $MessageToolCallBlock<TStructure>,\n \"type\"\n >\n : never\n : never\n : never\n : never\n : never;\n\n/**\n * Infers the content type for a specific message type from a message structure.\n *\n * This utility type determines the appropriate content type based on the message structure's\n * output version and the specified message type. The content type varies depending on the\n * output version (see {@link MessageOutputVersion})\n *\n * @template TStructure - The message structure to infer content from\n * @template TRole - The message role/type to get content for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The content type for the specified role based on the output version\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * outputVersion: \"v0\";\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.ToolCall;\n * };\n * }\n *\n * type HumanContentV0 = $InferMessageContent<MyStructure, \"human\">;\n * // HumanContentV0 = string | Array<ContentBlock | ContentBlock.Text>\n *\n * interface MyStructureV1 extends MessageStructure {\n * outputVersion: \"v1\";\n * content: {\n * human: ContentBlock.Text;\n * ai: ContentBlock.Text | ContentBlock.Reasoning;\n * };\n * }\n *\n * type HumanContentV1 = $InferMessageContent<MyStructureV1, \"human\">;\n * // HumanContentV1 = ContentBlock.Text\n *\n * type AIContentV1 = $InferMessageContent<MyStructureV1, \"ai\">;\n * // AIContentV1 = ContentBlock.Text | ContentBlock.Reasoning\n * ```\n */\nexport type $InferMessageContent<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> = TRole extends \"tool\"\n ? // For tool messages, infer content from tool output types if available\n $InferToolOutputs<TStructure> extends infer TOutput\n ? [TOutput] extends [never]\n ? string | Array<ContentBlock | ContentBlock.Text>\n : [unknown] extends [TOutput]\n ? // Fallback to default when TOutput is unknown (no specific tools defined)\n string | Array<ContentBlock | ContentBlock.Text>\n : TOutput | string | Array<ContentBlock | ContentBlock.Text>\n : string | Array<ContentBlock | ContentBlock.Text>\n : TStructure[\"outputVersion\"] extends \"v1\"\n ? Array<$InferMessageContentBlocks<TStructure, TRole>>\n : string | Array<ContentBlock | ContentBlock.Text>;\n\n/**\n * Infers the properties for a specific message type from a message structure.\n *\n * This utility type extracts the properties object that corresponds to a given message type\n * from the message structure's properties definition, and excludes the reserved\n * \"content\" and \"type\" properties to avoid conflicts with the core message structure.\n *\n * If the specified type is not defined in the message structure's properties, it returns\n * a generic Record<string, unknown> type to allow for arbitrary properties.\n *\n * @template TStructure - The message structure to infer properties from\n * @template TRole - The message type/role to get properties for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The properties object type for the specified type, excluding \"content\" and \"type\"\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string };\n * usage_metadata: { tokens: number };\n * content: string; // This will be omitted\n * type: string; // This will be omitted\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type AIProperties = $InferMessageProperties<MyStructure, \"ai\">;\n * // AIProperties = { response_metadata: { model: string }; usage_metadata: { tokens: number } }\n *\n * type HumanProperties = $InferMessageProperties<MyStructure, \"human\">;\n * // HumanProperties = { metadata: Record<string, unknown> }\n *\n * type SystemProperties = $InferMessageProperties<MyStructure, \"system\">;\n * // SystemProperties = Record<string, unknown> (fallback for undefined role)\n * ```\n */\nexport type $InferMessageProperties<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $NormalizedMessageStructure<TStructure> extends infer S\n ? S extends MessageStructure\n ? S[\"properties\"] extends (infer P) | undefined\n ? P extends Record<PropertyKey, unknown>\n ? TRole extends keyof P\n ? Omit<P[TRole], \"content\" | \"type\">\n : Record<string, unknown>\n : Record<string, unknown>\n : Record<string, unknown>\n : never\n : never;\n\n/**\n * Infers the type of a specific property for a message type from a message structure.\n *\n * This utility type extracts the type of a single property by name from the properties\n * object that corresponds to a given message type. If the specified property key does\n * not exist in the type's properties, it returns `never`.\n *\n * @template TStructure - The message structure to infer the property from\n * @template TRole - The message type/role to get the property for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @template K - The property key to extract the type for\n * @returns The type of the specified property, or `never` if the property doesn't exist\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string; temperature: number };\n * usage_metadata: { input_tokens: number; output_tokens: number };\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type ResponseMetadata = $InferMessageProperty<MyStructure, \"ai\", \"response_metadata\">;\n * // ResponseMetadata = { model: string; temperature: number }\n *\n * type UsageMetadata = $InferMessageProperty<MyStructure, \"ai\", \"usage_metadata\">;\n * // UsageMetadata = { input_tokens: number; output_tokens: number }\n *\n * type NonExistentProperty = $InferMessageProperty<MyStructure, \"ai\", \"nonExistent\">;\n * // NonExistentProperty = Record<string, unknown>\n *\n * type HumanMetadata = $InferMessageProperty<MyStructure, \"human\", \"metadata\">;\n * // HumanMetadata = Record<string, unknown>\n * ```\n */\nexport type $InferMessageProperty<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n K extends string,\n> = K extends keyof $InferMessageProperties<TStructure, TRole>\n ? $InferMessageProperties<TStructure, TRole>[K]\n : never;\n\n/**\n * Infers the response metadata type for a specific message type from a message structure.\n *\n * This utility type extracts the `response_metadata` property type for a given message type.\n *\n * @template TStructure - The message structure to infer the response metadata from\n * @template TRole - The message type/role to get the response metadata for (e.g., \"ai\", \"human\", \"system\", \"tool\")\n * @returns The type of the response_metadata property, or `Record<string, unknown>` as fallback\n *\n * @example\n * ```ts\n * interface MyStructure extends MessageStructure {\n * properties: {\n * ai: {\n * response_metadata: { model: string; temperature: number; tokens: number };\n * };\n * human: { metadata: Record<string, unknown> };\n * };\n * }\n *\n * type AIResponseMetadata = $InferResponseMetadata<MyStructure, \"ai\">;\n * // AIResponseMetadata = { model: string; temperature: number; tokens: number }\n *\n * type HumanResponseMetadata = $InferResponseMetadata<MyStructure, \"human\">;\n * // HumanResponseMetadata = Record<string, unknown> (fallback since not defined)\n * ```\n */\nexport type $InferResponseMetadata<\n TStructure extends MessageStructure,\n TRole extends MessageType,\n> =\n $InferMessageProperty<TStructure, TRole, \"response_metadata\"> extends infer P\n ? [P] extends [never]\n ? Record<string, unknown>\n : P\n : never;\n\n/**\n * Represents a message object that organizes context for an LLM.\n *\n * @example\n * ```ts\n * // Basic message with text content\n * const message: Message = {\n * id: \"msg-123\",\n * name: \"user\",\n * type: \"human\",\n * content: [{ type: \"text\", text: \"Hello!\" }]\n * };\n *\n * // Basic ai message interface extension\n * interface MyMessage extends Message<StandardMessageStructure, \"ai\"> {\n * // Additional AI-specific properties can be added here\n * }\n *`\n * // Custom message structure\n * interface CustomStructure extends MessageStructure {\n * content: {\n * ai: ContentBlock.Text | ContentBlock.ToolCall<\"search\", { query: string }>;\n * human: ContentBlock.Text | ContentBlock.Multimodal.Image;\n * };\n * }\n *\n * // Create a message with custom structure\n * const message: Message<CustomStructure> = {\n * id: \"msg-123\",\n * name: \"user\",\n * type: \"ai\",\n * content: [\n * { type: \"text\", text: \"Hello!\" },\n * {\n * type: \"tool_call\",\n * name: \"search\",\n * args: { query: \"What is the capital of France?\" }\n * }\n * ]\n * };\n * ```\n */\nexport interface Message<\n TStructure extends MessageStructure = StandardMessageStructure,\n TRole extends MessageType = MessageType,\n> {\n /** The message type/role */\n readonly type: TRole;\n /** Unique identifier for this message */\n id?: string;\n /**\n * An optional name for the message participant.\n *\n * This property is primarily used to:\n *\n * 1. **Identify agent roles in multi-agent systems**: When multiple agents\n * collaborate, setting `name` helps distinguish which agent produced a\n * message, preventing confusion about who said what.\n *\n * 2. **Pass participant names to model providers**: Some providers (notably\n * OpenAI, e.g. see {@link https://platform.openai.com/docs/api-reference/chat/create | OpenAI Chat Completions API})\n * use this field to differentiate between participants with the\n * same role. For example, when using OpenAI's Chat Completions API, the\n * `name` is included in the message payload sent to the model.\n *\n * @example\n * ```typescript\n * // Setting name on an AIMessage to identify the agent\n * const message = new AIMessage({\n * content: \"I'll handle the calendar scheduling.\",\n * name: \"calendar_agent\"\n * });\n *\n * // In a multi-agent system, this helps track message origins\n * const researcherMessage = new AIMessage({\n * content: \"Here are the findings...\",\n * name: \"researcher\"\n * });\n * const writerMessage = new AIMessage({\n * content: \"I've drafted the report.\",\n * name: \"writer\"\n * });\n * ```\n */\n name?: string;\n /** Array of content blocks that make up the message content */\n content: $InferMessageContent<TStructure, TRole>;\n /** Metadata about the message */\n response_metadata?: Partial<$InferResponseMetadata<TStructure, TRole>>;\n}\n\n/**\n * Type guard to check if a value is a valid Message object.\n *\n * @param message - The value to check\n * @returns true if the value is a valid Message object, false otherwise\n */\nexport function isMessage(message: unknown): message is Message {\n return (\n typeof message === \"object\" &&\n message !== null &&\n \"type\" in message &&\n \"content\" in message &&\n (typeof message.content === \"string\" || Array.isArray(message.content))\n );\n}\n"],"mappings":";;;;;;;AAk1BA,SAAgB,UAAU,SAAsC;CAC9D,OACE,OAAO,YAAY,YACnB,YAAY,QACZ,UAAU,WACV,aAAa,YACZ,OAAO,QAAQ,YAAY,YAAY,MAAM,QAAQ,QAAQ,OAAO;AAEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.cjs","names":["_mergeDicts"],"sources":["../../src/messages/metadata.ts"],"sourcesContent":["import { _mergeDicts } from \"./base.js\";\nimport type { MessageOutputVersion } from \"./message.js\";\n\nexport type ResponseMetadata = {\n model_provider?: string;\n model_name?: string;\n output_version?: MessageOutputVersion;\n [key: string]: unknown;\n};\n\nexport function mergeResponseMetadata(\n a?: ResponseMetadata,\n b?: ResponseMetadata\n): ResponseMetadata {\n const output: ResponseMetadata = _mergeDicts(a, b) ?? {};\n return output;\n}\n\nexport type ModalitiesTokenDetails = {\n /**\n * Text tokens.\n * Does not need to be reported, but some models will do so.\n */\n text?: number;\n\n /**\n * Image (non-video) tokens.\n */\n image?: number;\n\n /**\n * Audio tokens.\n */\n audio?: number;\n\n /**\n * Video tokens.\n */\n video?: number;\n\n /**\n * Document tokens.\n * e.g. PDF\n */\n document?: number;\n};\n\nfunction mergeModalitiesTokenDetails(\n a?: ModalitiesTokenDetails,\n b?: ModalitiesTokenDetails\n): ModalitiesTokenDetails {\n const output: ModalitiesTokenDetails = {};\n if (a?.audio !== undefined || b?.audio !== undefined) {\n output.audio = (a?.audio ?? 0) + (b?.audio ?? 0);\n }\n if (a?.image !== undefined || b?.image !== undefined) {\n output.image = (a?.image ?? 0) + (b?.image ?? 0);\n }\n if (a?.video !== undefined || b?.video !== undefined) {\n output.video = (a?.video ?? 0) + (b?.video ?? 0);\n }\n if (a?.document !== undefined || b?.document !== undefined) {\n output.document = (a?.document ?? 0) + (b?.document ?? 0);\n }\n if (a?.text !== undefined || b?.text !== undefined) {\n output.text = (a?.text ?? 0) + (b?.text ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of input token counts.\n *\n * Does not *need* to sum to full input token count. Does *not* need to have all keys.\n */\nexport type InputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Input tokens that were cached and there was a cache hit.\n *\n * Since there was a cache hit, the tokens were read from the cache.\n * More precisely, the model state given these tokens was read from the cache.\n */\n cache_read?: number;\n\n /**\n * Input tokens that were cached and there was a cache miss.\n *\n * Since there was a cache miss, the cache was created from these tokens.\n */\n cache_creation?: number;\n};\n\nfunction mergeInputTokenDetails(\n a?: InputTokenDetails,\n b?: InputTokenDetails\n): InputTokenDetails {\n const output: InputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.cache_read !== undefined || b?.cache_read !== undefined) {\n output.cache_read = (a?.cache_read ?? 0) + (b?.cache_read ?? 0);\n }\n if (a?.cache_creation !== undefined || b?.cache_creation !== undefined) {\n output.cache_creation = (a?.cache_creation ?? 0) + (b?.cache_creation ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\nexport type OutputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Reasoning output tokens.\n *\n * Tokens generated by the model in a chain of thought process (i.e. by\n * OpenAI's o1 models) that are not returned as part of model output.\n */\n reasoning?: number;\n};\n\nfunction mergeOutputTokenDetails(\n a?: OutputTokenDetails,\n b?: OutputTokenDetails\n): OutputTokenDetails {\n const output: OutputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.reasoning !== undefined || b?.reasoning !== undefined) {\n output.reasoning = (a?.reasoning ?? 0) + (b?.reasoning ?? 0);\n }\n return output;\n}\n\n/**\n * Usage metadata for a message, such as token counts.\n */\nexport type UsageMetadata = {\n /**\n * Count of input (or prompt) tokens. Sum of all input token types.\n */\n input_tokens: number;\n /**\n * Count of output (or completion) tokens. Sum of all output token types.\n */\n output_tokens: number;\n /**\n * Total token count. Sum of input_tokens + output_tokens.\n */\n total_tokens: number;\n\n /**\n * Breakdown of input token counts.\n *\n * Does *not* need to sum to full input token count. Does *not* need to have all keys.\n */\n input_token_details?: InputTokenDetails;\n\n /**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\n output_token_details?: OutputTokenDetails;\n};\n\nexport function mergeUsageMetadata(\n a?: UsageMetadata,\n b?: UsageMetadata\n): UsageMetadata {\n return {\n input_tokens: (a?.input_tokens ?? 0) + (b?.input_tokens ?? 0),\n output_tokens: (a?.output_tokens ?? 0) + (b?.output_tokens ?? 0),\n total_tokens: (a?.total_tokens ?? 0) + (b?.total_tokens ?? 0),\n input_token_details: mergeInputTokenDetails(\n a?.input_token_details,\n b?.input_token_details\n ),\n output_token_details: mergeOutputTokenDetails(\n a?.output_token_details,\n b?.output_token_details\n ),\n };\n}\n"],"mappings":";;AAUA,SAAgB,sBACd,GACA,GACkB;AAElB,QADiCA,aAAAA,YAAY,GAAG,EAAE,IAAI,EAAE;;AAiC1D,SAAS,4BACP,GACA,GACwB;CACxB,MAAM,SAAiC,EAAE;AACzC,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,aAAa,KAAA,KAAa,GAAG,aAAa,KAAA,EAC/C,QAAO,YAAY,GAAG,YAAY,MAAM,GAAG,YAAY;AAEzD,KAAI,GAAG,SAAS,KAAA,KAAa,GAAG,SAAS,KAAA,EACvC,QAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG,QAAQ;AAE7C,QAAO;;AAyBT,SAAS,uBACP,GACA,GACmB;CACnB,MAAM,SAA4B,EAChC,GAAG,4BAA4B,GAAG,EAAE,EACrC;AACD,KAAI,GAAG,eAAe,KAAA,KAAa,GAAG,eAAe,KAAA,EACnD,QAAO,cAAc,GAAG,cAAc,MAAM,GAAG,cAAc;AAE/D,KAAI,GAAG,mBAAmB,KAAA,KAAa,GAAG,mBAAmB,KAAA,EAC3D,QAAO,kBAAkB,GAAG,kBAAkB,MAAM,GAAG,kBAAkB;AAE3E,QAAO;;AAkBT,SAAS,wBACP,GACA,GACoB;CACpB,MAAM,SAA6B,EACjC,GAAG,4BAA4B,GAAG,EAAE,EACrC;AACD,KAAI,GAAG,cAAc,KAAA,KAAa,GAAG,cAAc,KAAA,EACjD,QAAO,aAAa,GAAG,aAAa,MAAM,GAAG,aAAa;AAE5D,QAAO;;AAmCT,SAAgB,mBACd,GACA,GACe;AACf,QAAO;EACL,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,gBAAgB,GAAG,iBAAiB,MAAM,GAAG,iBAAiB;EAC9D,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,qBAAqB,uBACnB,GAAG,qBACH,GAAG,oBACJ;EACD,sBAAsB,wBACpB,GAAG,sBACH,GAAG,qBACJ;EACF"}
1
+ {"version":3,"file":"metadata.cjs","names":["_mergeDicts"],"sources":["../../src/messages/metadata.ts"],"sourcesContent":["import { _mergeDicts } from \"./base.js\";\nimport type { MessageOutputVersion } from \"./message.js\";\n\nexport type ResponseMetadata = {\n model_provider?: string;\n model_name?: string;\n output_version?: MessageOutputVersion;\n [key: string]: unknown;\n};\n\nexport function mergeResponseMetadata(\n a?: ResponseMetadata,\n b?: ResponseMetadata\n): ResponseMetadata {\n const output: ResponseMetadata = _mergeDicts(a, b) ?? {};\n return output;\n}\n\nexport type ModalitiesTokenDetails = {\n /**\n * Text tokens.\n * Does not need to be reported, but some models will do so.\n */\n text?: number;\n\n /**\n * Image (non-video) tokens.\n */\n image?: number;\n\n /**\n * Audio tokens.\n */\n audio?: number;\n\n /**\n * Video tokens.\n */\n video?: number;\n\n /**\n * Document tokens.\n * e.g. PDF\n */\n document?: number;\n};\n\nfunction mergeModalitiesTokenDetails(\n a?: ModalitiesTokenDetails,\n b?: ModalitiesTokenDetails\n): ModalitiesTokenDetails {\n const output: ModalitiesTokenDetails = {};\n if (a?.audio !== undefined || b?.audio !== undefined) {\n output.audio = (a?.audio ?? 0) + (b?.audio ?? 0);\n }\n if (a?.image !== undefined || b?.image !== undefined) {\n output.image = (a?.image ?? 0) + (b?.image ?? 0);\n }\n if (a?.video !== undefined || b?.video !== undefined) {\n output.video = (a?.video ?? 0) + (b?.video ?? 0);\n }\n if (a?.document !== undefined || b?.document !== undefined) {\n output.document = (a?.document ?? 0) + (b?.document ?? 0);\n }\n if (a?.text !== undefined || b?.text !== undefined) {\n output.text = (a?.text ?? 0) + (b?.text ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of input token counts.\n *\n * Does not *need* to sum to full input token count. Does *not* need to have all keys.\n */\nexport type InputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Input tokens that were cached and there was a cache hit.\n *\n * Since there was a cache hit, the tokens were read from the cache.\n * More precisely, the model state given these tokens was read from the cache.\n */\n cache_read?: number;\n\n /**\n * Input tokens that were cached and there was a cache miss.\n *\n * Since there was a cache miss, the cache was created from these tokens.\n */\n cache_creation?: number;\n};\n\nfunction mergeInputTokenDetails(\n a?: InputTokenDetails,\n b?: InputTokenDetails\n): InputTokenDetails {\n const output: InputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.cache_read !== undefined || b?.cache_read !== undefined) {\n output.cache_read = (a?.cache_read ?? 0) + (b?.cache_read ?? 0);\n }\n if (a?.cache_creation !== undefined || b?.cache_creation !== undefined) {\n output.cache_creation = (a?.cache_creation ?? 0) + (b?.cache_creation ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\nexport type OutputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Reasoning output tokens.\n *\n * Tokens generated by the model in a chain of thought process (i.e. by\n * OpenAI's o1 models) that are not returned as part of model output.\n */\n reasoning?: number;\n};\n\nfunction mergeOutputTokenDetails(\n a?: OutputTokenDetails,\n b?: OutputTokenDetails\n): OutputTokenDetails {\n const output: OutputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.reasoning !== undefined || b?.reasoning !== undefined) {\n output.reasoning = (a?.reasoning ?? 0) + (b?.reasoning ?? 0);\n }\n return output;\n}\n\n/**\n * Usage metadata for a message, such as token counts.\n */\nexport type UsageMetadata = {\n /**\n * Count of input (or prompt) tokens. Sum of all input token types.\n */\n input_tokens: number;\n /**\n * Count of output (or completion) tokens. Sum of all output token types.\n */\n output_tokens: number;\n /**\n * Total token count. Sum of input_tokens + output_tokens.\n */\n total_tokens: number;\n\n /**\n * Breakdown of input token counts.\n *\n * Does *not* need to sum to full input token count. Does *not* need to have all keys.\n */\n input_token_details?: InputTokenDetails;\n\n /**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\n output_token_details?: OutputTokenDetails;\n};\n\nexport function mergeUsageMetadata(\n a?: UsageMetadata,\n b?: UsageMetadata\n): UsageMetadata {\n return {\n input_tokens: (a?.input_tokens ?? 0) + (b?.input_tokens ?? 0),\n output_tokens: (a?.output_tokens ?? 0) + (b?.output_tokens ?? 0),\n total_tokens: (a?.total_tokens ?? 0) + (b?.total_tokens ?? 0),\n input_token_details: mergeInputTokenDetails(\n a?.input_token_details,\n b?.input_token_details\n ),\n output_token_details: mergeOutputTokenDetails(\n a?.output_token_details,\n b?.output_token_details\n ),\n };\n}\n"],"mappings":";;AAUA,SAAgB,sBACd,GACA,GACkB;CAElB,OADiCA,aAAAA,YAAY,GAAG,CAAC,KAAK,CAAC;AAEzD;AA+BA,SAAS,4BACP,GACA,GACwB;CACxB,MAAM,SAAiC,CAAC;CACxC,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,aAAa,KAAA,KAAa,GAAG,aAAa,KAAA,GAC/C,OAAO,YAAY,GAAG,YAAY,MAAM,GAAG,YAAY;CAEzD,IAAI,GAAG,SAAS,KAAA,KAAa,GAAG,SAAS,KAAA,GACvC,OAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG,QAAQ;CAE7C,OAAO;AACT;AAwBA,SAAS,uBACP,GACA,GACmB;CACnB,MAAM,SAA4B,EAChC,GAAG,4BAA4B,GAAG,CAAC,EACrC;CACA,IAAI,GAAG,eAAe,KAAA,KAAa,GAAG,eAAe,KAAA,GACnD,OAAO,cAAc,GAAG,cAAc,MAAM,GAAG,cAAc;CAE/D,IAAI,GAAG,mBAAmB,KAAA,KAAa,GAAG,mBAAmB,KAAA,GAC3D,OAAO,kBAAkB,GAAG,kBAAkB,MAAM,GAAG,kBAAkB;CAE3E,OAAO;AACT;AAiBA,SAAS,wBACP,GACA,GACoB;CACpB,MAAM,SAA6B,EACjC,GAAG,4BAA4B,GAAG,CAAC,EACrC;CACA,IAAI,GAAG,cAAc,KAAA,KAAa,GAAG,cAAc,KAAA,GACjD,OAAO,aAAa,GAAG,aAAa,MAAM,GAAG,aAAa;CAE5D,OAAO;AACT;AAkCA,SAAgB,mBACd,GACA,GACe;CACf,OAAO;EACL,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,gBAAgB,GAAG,iBAAiB,MAAM,GAAG,iBAAiB;EAC9D,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,qBAAqB,uBACnB,GAAG,qBACH,GAAG,mBACL;EACA,sBAAsB,wBACpB,GAAG,sBACH,GAAG,oBACL;CACF;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { MessageOutputVersion } from "./message.cjs";
2
-
3
2
  //#region src/messages/metadata.d.ts
4
3
  type ResponseMetadata = {
5
4
  model_provider?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.cts","names":[],"sources":["../../src/messages/metadata.ts"],"mappings":";;;KAGY,gBAAA;EACV,cAAA;EACA,UAAA;EACA,cAAA,GAAiB,oBAAA;EAAA,CAChB,GAAA;AAAA;AAAA,iBAGa,qBAAA,CACd,CAAA,GAAI,gBAAA,EACJ,CAAA,GAAI,gBAAA,GACH,gBAAA;AAAA,KAKS,sBAAA;EAZV;;;;EAiBA,IAAA;EAbc;;;EAkBd,KAAA;EAhBI;;;EAqBJ,KAAA;EAtBI;;;EA2BJ,KAAA;EAzBC;;;AAKH;EA0BE,QAAA;AAAA;;;;;;KA+BU,iBAAA,GAAoB,sBAAA;EA/BtB;;AA+BV;;;;EAOE,UAAA;EAAA;;;;AA+BF;EAxBE,cAAA;AAAA;;;AAkDF;;;KA1BY,kBAAA,GAAqB,sBAAA;EA8B/B;;;;;;EAvBA,SAAA;AAAA;;AAgDF;;KA7BY,aAAA;EA8BN;;;EA1BJ,YAAA;EA4Bc;;;EAxBd,aAAA;EAuBA;;;EAnBA,YAAA;;;;;;EAOA,mBAAA,GAAsB,iBAAA;;;;;;EAOtB,oBAAA,GAAuB,kBAAA;AAAA;AAAA,iBAGT,kBAAA,CACd,CAAA,GAAI,aAAA,EACJ,CAAA,GAAI,aAAA,GACH,aAAA"}
1
+ {"version":3,"file":"metadata.d.cts","names":[],"sources":["../../src/messages/metadata.ts"],"mappings":";;KAGY;EACV;EACA;EACA,iBAAiB;GAChB;;iBAGa,sBACd,IAAI,kBACJ,IAAI,mBACH;KAKS;;;;;EAKV;;;;EAKA;;;;EAKA;;;;EAKA;;;;;EAMA;;;;;;;KA+BU,oBAAoB;;;;;;;EAO9B;;;;;;EAOA;;;;;;;KAwBU,qBAAqB;;;;;;;EAO/B;;;;;KAmBU;;;;EAIV;;;;EAIA;;;;EAIA;;;;;;EAOA,sBAAsB;;;;;;EAOtB,uBAAuB;;iBAGT,mBACd,IAAI,eACJ,IAAI,gBACH"}
@@ -1,5 +1,4 @@
1
1
  import { MessageOutputVersion } from "./message.js";
2
-
3
2
  //#region src/messages/metadata.d.ts
4
3
  type ResponseMetadata = {
5
4
  model_provider?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","names":[],"sources":["../../src/messages/metadata.ts"],"mappings":";;;KAGY,gBAAA;EACV,cAAA;EACA,UAAA;EACA,cAAA,GAAiB,oBAAA;EAAA,CAChB,GAAA;AAAA;AAAA,iBAGa,qBAAA,CACd,CAAA,GAAI,gBAAA,EACJ,CAAA,GAAI,gBAAA,GACH,gBAAA;AAAA,KAKS,sBAAA;EAZV;;;;EAiBA,IAAA;EAbc;;;EAkBd,KAAA;EAhBI;;;EAqBJ,KAAA;EAtBI;;;EA2BJ,KAAA;EAzBC;;;AAKH;EA0BE,QAAA;AAAA;;;;;;KA+BU,iBAAA,GAAoB,sBAAA;EA/BtB;;AA+BV;;;;EAOE,UAAA;EAAA;;;;AA+BF;EAxBE,cAAA;AAAA;;;AAkDF;;;KA1BY,kBAAA,GAAqB,sBAAA;EA8B/B;;;;;;EAvBA,SAAA;AAAA;;AAgDF;;KA7BY,aAAA;EA8BN;;;EA1BJ,YAAA;EA4Bc;;;EAxBd,aAAA;EAuBA;;;EAnBA,YAAA;;;;;;EAOA,mBAAA,GAAsB,iBAAA;;;;;;EAOtB,oBAAA,GAAuB,kBAAA;AAAA;AAAA,iBAGT,kBAAA,CACd,CAAA,GAAI,aAAA,EACJ,CAAA,GAAI,aAAA,GACH,aAAA"}
1
+ {"version":3,"file":"metadata.d.ts","names":[],"sources":["../../src/messages/metadata.ts"],"mappings":";;KAGY;EACV;EACA;EACA,iBAAiB;GAChB;;iBAGa,sBACd,IAAI,kBACJ,IAAI,mBACH;KAKS;;;;;EAKV;;;;EAKA;;;;EAKA;;;;EAKA;;;;;EAMA;;;;;;;KA+BU,oBAAoB;;;;;;;EAO9B;;;;;;EAOA;;;;;;;KAwBU,qBAAqB;;;;;;;EAO/B;;;;;KAmBU;;;;EAIV;;;;EAIA;;;;EAIA;;;;;;EAOA,sBAAsB;;;;;;EAOtB,uBAAuB;;iBAGT,mBACd,IAAI,eACJ,IAAI,gBACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","names":[],"sources":["../../src/messages/metadata.ts"],"sourcesContent":["import { _mergeDicts } from \"./base.js\";\nimport type { MessageOutputVersion } from \"./message.js\";\n\nexport type ResponseMetadata = {\n model_provider?: string;\n model_name?: string;\n output_version?: MessageOutputVersion;\n [key: string]: unknown;\n};\n\nexport function mergeResponseMetadata(\n a?: ResponseMetadata,\n b?: ResponseMetadata\n): ResponseMetadata {\n const output: ResponseMetadata = _mergeDicts(a, b) ?? {};\n return output;\n}\n\nexport type ModalitiesTokenDetails = {\n /**\n * Text tokens.\n * Does not need to be reported, but some models will do so.\n */\n text?: number;\n\n /**\n * Image (non-video) tokens.\n */\n image?: number;\n\n /**\n * Audio tokens.\n */\n audio?: number;\n\n /**\n * Video tokens.\n */\n video?: number;\n\n /**\n * Document tokens.\n * e.g. PDF\n */\n document?: number;\n};\n\nfunction mergeModalitiesTokenDetails(\n a?: ModalitiesTokenDetails,\n b?: ModalitiesTokenDetails\n): ModalitiesTokenDetails {\n const output: ModalitiesTokenDetails = {};\n if (a?.audio !== undefined || b?.audio !== undefined) {\n output.audio = (a?.audio ?? 0) + (b?.audio ?? 0);\n }\n if (a?.image !== undefined || b?.image !== undefined) {\n output.image = (a?.image ?? 0) + (b?.image ?? 0);\n }\n if (a?.video !== undefined || b?.video !== undefined) {\n output.video = (a?.video ?? 0) + (b?.video ?? 0);\n }\n if (a?.document !== undefined || b?.document !== undefined) {\n output.document = (a?.document ?? 0) + (b?.document ?? 0);\n }\n if (a?.text !== undefined || b?.text !== undefined) {\n output.text = (a?.text ?? 0) + (b?.text ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of input token counts.\n *\n * Does not *need* to sum to full input token count. Does *not* need to have all keys.\n */\nexport type InputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Input tokens that were cached and there was a cache hit.\n *\n * Since there was a cache hit, the tokens were read from the cache.\n * More precisely, the model state given these tokens was read from the cache.\n */\n cache_read?: number;\n\n /**\n * Input tokens that were cached and there was a cache miss.\n *\n * Since there was a cache miss, the cache was created from these tokens.\n */\n cache_creation?: number;\n};\n\nfunction mergeInputTokenDetails(\n a?: InputTokenDetails,\n b?: InputTokenDetails\n): InputTokenDetails {\n const output: InputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.cache_read !== undefined || b?.cache_read !== undefined) {\n output.cache_read = (a?.cache_read ?? 0) + (b?.cache_read ?? 0);\n }\n if (a?.cache_creation !== undefined || b?.cache_creation !== undefined) {\n output.cache_creation = (a?.cache_creation ?? 0) + (b?.cache_creation ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\nexport type OutputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Reasoning output tokens.\n *\n * Tokens generated by the model in a chain of thought process (i.e. by\n * OpenAI's o1 models) that are not returned as part of model output.\n */\n reasoning?: number;\n};\n\nfunction mergeOutputTokenDetails(\n a?: OutputTokenDetails,\n b?: OutputTokenDetails\n): OutputTokenDetails {\n const output: OutputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.reasoning !== undefined || b?.reasoning !== undefined) {\n output.reasoning = (a?.reasoning ?? 0) + (b?.reasoning ?? 0);\n }\n return output;\n}\n\n/**\n * Usage metadata for a message, such as token counts.\n */\nexport type UsageMetadata = {\n /**\n * Count of input (or prompt) tokens. Sum of all input token types.\n */\n input_tokens: number;\n /**\n * Count of output (or completion) tokens. Sum of all output token types.\n */\n output_tokens: number;\n /**\n * Total token count. Sum of input_tokens + output_tokens.\n */\n total_tokens: number;\n\n /**\n * Breakdown of input token counts.\n *\n * Does *not* need to sum to full input token count. Does *not* need to have all keys.\n */\n input_token_details?: InputTokenDetails;\n\n /**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\n output_token_details?: OutputTokenDetails;\n};\n\nexport function mergeUsageMetadata(\n a?: UsageMetadata,\n b?: UsageMetadata\n): UsageMetadata {\n return {\n input_tokens: (a?.input_tokens ?? 0) + (b?.input_tokens ?? 0),\n output_tokens: (a?.output_tokens ?? 0) + (b?.output_tokens ?? 0),\n total_tokens: (a?.total_tokens ?? 0) + (b?.total_tokens ?? 0),\n input_token_details: mergeInputTokenDetails(\n a?.input_token_details,\n b?.input_token_details\n ),\n output_token_details: mergeOutputTokenDetails(\n a?.output_token_details,\n b?.output_token_details\n ),\n };\n}\n"],"mappings":";;AAUA,SAAgB,sBACd,GACA,GACkB;AAElB,QADiC,YAAY,GAAG,EAAE,IAAI,EAAE;;AAiC1D,SAAS,4BACP,GACA,GACwB;CACxB,MAAM,SAAiC,EAAE;AACzC,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,EACzC,QAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;AAEhD,KAAI,GAAG,aAAa,KAAA,KAAa,GAAG,aAAa,KAAA,EAC/C,QAAO,YAAY,GAAG,YAAY,MAAM,GAAG,YAAY;AAEzD,KAAI,GAAG,SAAS,KAAA,KAAa,GAAG,SAAS,KAAA,EACvC,QAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG,QAAQ;AAE7C,QAAO;;AAyBT,SAAS,uBACP,GACA,GACmB;CACnB,MAAM,SAA4B,EAChC,GAAG,4BAA4B,GAAG,EAAE,EACrC;AACD,KAAI,GAAG,eAAe,KAAA,KAAa,GAAG,eAAe,KAAA,EACnD,QAAO,cAAc,GAAG,cAAc,MAAM,GAAG,cAAc;AAE/D,KAAI,GAAG,mBAAmB,KAAA,KAAa,GAAG,mBAAmB,KAAA,EAC3D,QAAO,kBAAkB,GAAG,kBAAkB,MAAM,GAAG,kBAAkB;AAE3E,QAAO;;AAkBT,SAAS,wBACP,GACA,GACoB;CACpB,MAAM,SAA6B,EACjC,GAAG,4BAA4B,GAAG,EAAE,EACrC;AACD,KAAI,GAAG,cAAc,KAAA,KAAa,GAAG,cAAc,KAAA,EACjD,QAAO,aAAa,GAAG,aAAa,MAAM,GAAG,aAAa;AAE5D,QAAO;;AAmCT,SAAgB,mBACd,GACA,GACe;AACf,QAAO;EACL,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,gBAAgB,GAAG,iBAAiB,MAAM,GAAG,iBAAiB;EAC9D,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,qBAAqB,uBACnB,GAAG,qBACH,GAAG,oBACJ;EACD,sBAAsB,wBACpB,GAAG,sBACH,GAAG,qBACJ;EACF"}
1
+ {"version":3,"file":"metadata.js","names":[],"sources":["../../src/messages/metadata.ts"],"sourcesContent":["import { _mergeDicts } from \"./base.js\";\nimport type { MessageOutputVersion } from \"./message.js\";\n\nexport type ResponseMetadata = {\n model_provider?: string;\n model_name?: string;\n output_version?: MessageOutputVersion;\n [key: string]: unknown;\n};\n\nexport function mergeResponseMetadata(\n a?: ResponseMetadata,\n b?: ResponseMetadata\n): ResponseMetadata {\n const output: ResponseMetadata = _mergeDicts(a, b) ?? {};\n return output;\n}\n\nexport type ModalitiesTokenDetails = {\n /**\n * Text tokens.\n * Does not need to be reported, but some models will do so.\n */\n text?: number;\n\n /**\n * Image (non-video) tokens.\n */\n image?: number;\n\n /**\n * Audio tokens.\n */\n audio?: number;\n\n /**\n * Video tokens.\n */\n video?: number;\n\n /**\n * Document tokens.\n * e.g. PDF\n */\n document?: number;\n};\n\nfunction mergeModalitiesTokenDetails(\n a?: ModalitiesTokenDetails,\n b?: ModalitiesTokenDetails\n): ModalitiesTokenDetails {\n const output: ModalitiesTokenDetails = {};\n if (a?.audio !== undefined || b?.audio !== undefined) {\n output.audio = (a?.audio ?? 0) + (b?.audio ?? 0);\n }\n if (a?.image !== undefined || b?.image !== undefined) {\n output.image = (a?.image ?? 0) + (b?.image ?? 0);\n }\n if (a?.video !== undefined || b?.video !== undefined) {\n output.video = (a?.video ?? 0) + (b?.video ?? 0);\n }\n if (a?.document !== undefined || b?.document !== undefined) {\n output.document = (a?.document ?? 0) + (b?.document ?? 0);\n }\n if (a?.text !== undefined || b?.text !== undefined) {\n output.text = (a?.text ?? 0) + (b?.text ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of input token counts.\n *\n * Does not *need* to sum to full input token count. Does *not* need to have all keys.\n */\nexport type InputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Input tokens that were cached and there was a cache hit.\n *\n * Since there was a cache hit, the tokens were read from the cache.\n * More precisely, the model state given these tokens was read from the cache.\n */\n cache_read?: number;\n\n /**\n * Input tokens that were cached and there was a cache miss.\n *\n * Since there was a cache miss, the cache was created from these tokens.\n */\n cache_creation?: number;\n};\n\nfunction mergeInputTokenDetails(\n a?: InputTokenDetails,\n b?: InputTokenDetails\n): InputTokenDetails {\n const output: InputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.cache_read !== undefined || b?.cache_read !== undefined) {\n output.cache_read = (a?.cache_read ?? 0) + (b?.cache_read ?? 0);\n }\n if (a?.cache_creation !== undefined || b?.cache_creation !== undefined) {\n output.cache_creation = (a?.cache_creation ?? 0) + (b?.cache_creation ?? 0);\n }\n return output;\n}\n\n/**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\nexport type OutputTokenDetails = ModalitiesTokenDetails & {\n /**\n * Reasoning output tokens.\n *\n * Tokens generated by the model in a chain of thought process (i.e. by\n * OpenAI's o1 models) that are not returned as part of model output.\n */\n reasoning?: number;\n};\n\nfunction mergeOutputTokenDetails(\n a?: OutputTokenDetails,\n b?: OutputTokenDetails\n): OutputTokenDetails {\n const output: OutputTokenDetails = {\n ...mergeModalitiesTokenDetails(a, b),\n };\n if (a?.reasoning !== undefined || b?.reasoning !== undefined) {\n output.reasoning = (a?.reasoning ?? 0) + (b?.reasoning ?? 0);\n }\n return output;\n}\n\n/**\n * Usage metadata for a message, such as token counts.\n */\nexport type UsageMetadata = {\n /**\n * Count of input (or prompt) tokens. Sum of all input token types.\n */\n input_tokens: number;\n /**\n * Count of output (or completion) tokens. Sum of all output token types.\n */\n output_tokens: number;\n /**\n * Total token count. Sum of input_tokens + output_tokens.\n */\n total_tokens: number;\n\n /**\n * Breakdown of input token counts.\n *\n * Does *not* need to sum to full input token count. Does *not* need to have all keys.\n */\n input_token_details?: InputTokenDetails;\n\n /**\n * Breakdown of output token counts.\n *\n * Does *not* need to sum to full output token count. Does *not* need to have all keys.\n */\n output_token_details?: OutputTokenDetails;\n};\n\nexport function mergeUsageMetadata(\n a?: UsageMetadata,\n b?: UsageMetadata\n): UsageMetadata {\n return {\n input_tokens: (a?.input_tokens ?? 0) + (b?.input_tokens ?? 0),\n output_tokens: (a?.output_tokens ?? 0) + (b?.output_tokens ?? 0),\n total_tokens: (a?.total_tokens ?? 0) + (b?.total_tokens ?? 0),\n input_token_details: mergeInputTokenDetails(\n a?.input_token_details,\n b?.input_token_details\n ),\n output_token_details: mergeOutputTokenDetails(\n a?.output_token_details,\n b?.output_token_details\n ),\n };\n}\n"],"mappings":";;AAUA,SAAgB,sBACd,GACA,GACkB;CAElB,OADiC,YAAY,GAAG,CAAC,KAAK,CAAC;AAEzD;AA+BA,SAAS,4BACP,GACA,GACwB;CACxB,MAAM,SAAiC,CAAC;CACxC,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,UAAU,KAAA,KAAa,GAAG,UAAU,KAAA,GACzC,OAAO,SAAS,GAAG,SAAS,MAAM,GAAG,SAAS;CAEhD,IAAI,GAAG,aAAa,KAAA,KAAa,GAAG,aAAa,KAAA,GAC/C,OAAO,YAAY,GAAG,YAAY,MAAM,GAAG,YAAY;CAEzD,IAAI,GAAG,SAAS,KAAA,KAAa,GAAG,SAAS,KAAA,GACvC,OAAO,QAAQ,GAAG,QAAQ,MAAM,GAAG,QAAQ;CAE7C,OAAO;AACT;AAwBA,SAAS,uBACP,GACA,GACmB;CACnB,MAAM,SAA4B,EAChC,GAAG,4BAA4B,GAAG,CAAC,EACrC;CACA,IAAI,GAAG,eAAe,KAAA,KAAa,GAAG,eAAe,KAAA,GACnD,OAAO,cAAc,GAAG,cAAc,MAAM,GAAG,cAAc;CAE/D,IAAI,GAAG,mBAAmB,KAAA,KAAa,GAAG,mBAAmB,KAAA,GAC3D,OAAO,kBAAkB,GAAG,kBAAkB,MAAM,GAAG,kBAAkB;CAE3E,OAAO;AACT;AAiBA,SAAS,wBACP,GACA,GACoB;CACpB,MAAM,SAA6B,EACjC,GAAG,4BAA4B,GAAG,CAAC,EACrC;CACA,IAAI,GAAG,cAAc,KAAA,KAAa,GAAG,cAAc,KAAA,GACjD,OAAO,aAAa,GAAG,aAAa,MAAM,GAAG,aAAa;CAE5D,OAAO;AACT;AAkCA,SAAgB,mBACd,GACA,GACe;CACf,OAAO;EACL,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,gBAAgB,GAAG,iBAAiB,MAAM,GAAG,iBAAiB;EAC9D,eAAe,GAAG,gBAAgB,MAAM,GAAG,gBAAgB;EAC3D,qBAAqB,uBACnB,GAAG,qBACH,GAAG,mBACL;EACA,sBAAsB,wBACpB,GAAG,sBACH,GAAG,oBACL;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"modifier.cjs","names":["BaseMessage"],"sources":["../../src/messages/modifier.ts"],"sourcesContent":["import { BaseMessage, BaseMessageFields } from \"./base.js\";\n\nexport interface RemoveMessageFields extends Omit<\n BaseMessageFields,\n \"content\"\n> {\n /**\n * The ID of the message to remove.\n */\n id: string;\n}\n\n/**\n * Message responsible for deleting other messages.\n *\n * `RemoveMessage` is intentionally not generic over `MessageStructure`.\n * Its content is always `[]` (empty), so carrying a structure type parameter\n * would only cause unnecessary type incompatibilities when mixing messages\n * from different structure configurations (e.g. passing a `RemoveMessage`\n * into an API that expects `Message<CustomToolCall>`).\n */\nexport class RemoveMessage extends BaseMessage {\n readonly type = \"remove\" as const;\n\n /**\n * The ID of the message to remove.\n */\n id: string;\n\n constructor(fields: RemoveMessageFields) {\n super({\n ...fields,\n content: [],\n });\n this.id = fields.id;\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n id: this.id,\n };\n }\n\n static isInstance(obj: unknown): obj is RemoveMessage {\n return super.isInstance(obj) && obj.type === \"remove\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,gBAAb,cAAmCA,aAAAA,YAAY;CAC7C,OAAgB;;;;CAKhB;CAEA,YAAY,QAA6B;AACvC,QAAM;GACJ,GAAG;GACH,SAAS,EAAE;GACZ,CAAC;AACF,OAAK,KAAK,OAAO;;CAGnB,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,IAAI,KAAK;GACV;;CAGH,OAAO,WAAW,KAAoC;AACpD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS"}
1
+ {"version":3,"file":"modifier.cjs","names":["BaseMessage"],"sources":["../../src/messages/modifier.ts"],"sourcesContent":["import { BaseMessage, BaseMessageFields } from \"./base.js\";\n\nexport interface RemoveMessageFields extends Omit<\n BaseMessageFields,\n \"content\"\n> {\n /**\n * The ID of the message to remove.\n */\n id: string;\n}\n\n/**\n * Message responsible for deleting other messages.\n *\n * `RemoveMessage` is intentionally not generic over `MessageStructure`.\n * Its content is always `[]` (empty), so carrying a structure type parameter\n * would only cause unnecessary type incompatibilities when mixing messages\n * from different structure configurations (e.g. passing a `RemoveMessage`\n * into an API that expects `Message<CustomToolCall>`).\n */\nexport class RemoveMessage extends BaseMessage {\n readonly type = \"remove\" as const;\n\n /**\n * The ID of the message to remove.\n */\n id: string;\n\n constructor(fields: RemoveMessageFields) {\n super({\n ...fields,\n content: [],\n });\n this.id = fields.id;\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n id: this.id,\n };\n }\n\n static isInstance(obj: unknown): obj is RemoveMessage {\n return super.isInstance(obj) && obj.type === \"remove\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,gBAAb,cAAmCA,aAAAA,YAAY;CAC7C,OAAgB;;;;CAKhB;CAEA,YAAY,QAA6B;EACvC,MAAM;GACJ,GAAG;GACH,SAAS,CAAC;EACZ,CAAC;EACD,KAAK,KAAK,OAAO;CACnB;CAEA,IAAa,mBAA4C;EACvD,OAAO;GACL,GAAG,MAAM;GACT,IAAI,KAAK;EACX;CACF;CAEA,OAAO,WAAW,KAAoC;EACpD,OAAO,MAAM,WAAW,GAAG,KAAK,IAAI,SAAS;CAC/C;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { BaseMessage, BaseMessageFields } from "./base.cjs";
2
-
3
2
  //#region src/messages/modifier.d.ts
4
3
  interface RemoveMessageFields extends Omit<BaseMessageFields, "content"> {
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"modifier.d.cts","names":[],"sources":["../../src/messages/modifier.ts"],"mappings":";;;UAEiB,mBAAA,SAA4B,IAAA,CAC3C,iBAAA;;AADF;;EAOE,EAAA;AAAA;;;;;;AAYF;;;;cAAa,aAAA,SAAsB,WAAA;EAAA,SACxB,IAAA;EADwB;;;EAMjC,EAAA;EAEA,WAAA,CAAY,MAAA,EAAQ,mBAAA;EAAA,IAQP,gBAAA,CAAA,GAAoB,MAAA;EAAA,OAO1B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,aAAA;AAAA"}
1
+ {"version":3,"file":"modifier.d.cts","names":[],"sources":["../../src/messages/modifier.ts"],"mappings":";;UAEiB,4BAA4B,KAC3C;;;;EAMA;;;;;;;;;;;cAYW,sBAAsB;WACxB;;;;EAKT;EAEA,YAAY,QAAQ;MAQP,oBAAoB;SAO1B,WAAW,eAAe,OAAO"}
@@ -1,5 +1,4 @@
1
1
  import { BaseMessage, BaseMessageFields } from "./base.js";
2
-
3
2
  //#region src/messages/modifier.d.ts
4
3
  interface RemoveMessageFields extends Omit<BaseMessageFields, "content"> {
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"modifier.d.ts","names":[],"sources":["../../src/messages/modifier.ts"],"mappings":";;;UAEiB,mBAAA,SAA4B,IAAA,CAC3C,iBAAA;;AADF;;EAOE,EAAA;AAAA;;;;;;AAYF;;;;cAAa,aAAA,SAAsB,WAAA;EAAA,SACxB,IAAA;EADwB;;;EAMjC,EAAA;EAEA,WAAA,CAAY,MAAA,EAAQ,mBAAA;EAAA,IAQP,gBAAA,CAAA,GAAoB,MAAA;EAAA,OAO1B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,aAAA;AAAA"}
1
+ {"version":3,"file":"modifier.d.ts","names":[],"sources":["../../src/messages/modifier.ts"],"mappings":";;UAEiB,4BAA4B,KAC3C;;;;EAMA;;;;;;;;;;;cAYW,sBAAsB;WACxB;;;;EAKT;EAEA,YAAY,QAAQ;MAQP,oBAAoB;SAO1B,WAAW,eAAe,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"modifier.js","names":[],"sources":["../../src/messages/modifier.ts"],"sourcesContent":["import { BaseMessage, BaseMessageFields } from \"./base.js\";\n\nexport interface RemoveMessageFields extends Omit<\n BaseMessageFields,\n \"content\"\n> {\n /**\n * The ID of the message to remove.\n */\n id: string;\n}\n\n/**\n * Message responsible for deleting other messages.\n *\n * `RemoveMessage` is intentionally not generic over `MessageStructure`.\n * Its content is always `[]` (empty), so carrying a structure type parameter\n * would only cause unnecessary type incompatibilities when mixing messages\n * from different structure configurations (e.g. passing a `RemoveMessage`\n * into an API that expects `Message<CustomToolCall>`).\n */\nexport class RemoveMessage extends BaseMessage {\n readonly type = \"remove\" as const;\n\n /**\n * The ID of the message to remove.\n */\n id: string;\n\n constructor(fields: RemoveMessageFields) {\n super({\n ...fields,\n content: [],\n });\n this.id = fields.id;\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n id: this.id,\n };\n }\n\n static isInstance(obj: unknown): obj is RemoveMessage {\n return super.isInstance(obj) && obj.type === \"remove\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,gBAAb,cAAmC,YAAY;CAC7C,OAAgB;;;;CAKhB;CAEA,YAAY,QAA6B;AACvC,QAAM;GACJ,GAAG;GACH,SAAS,EAAE;GACZ,CAAC;AACF,OAAK,KAAK,OAAO;;CAGnB,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,IAAI,KAAK;GACV;;CAGH,OAAO,WAAW,KAAoC;AACpD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS"}
1
+ {"version":3,"file":"modifier.js","names":[],"sources":["../../src/messages/modifier.ts"],"sourcesContent":["import { BaseMessage, BaseMessageFields } from \"./base.js\";\n\nexport interface RemoveMessageFields extends Omit<\n BaseMessageFields,\n \"content\"\n> {\n /**\n * The ID of the message to remove.\n */\n id: string;\n}\n\n/**\n * Message responsible for deleting other messages.\n *\n * `RemoveMessage` is intentionally not generic over `MessageStructure`.\n * Its content is always `[]` (empty), so carrying a structure type parameter\n * would only cause unnecessary type incompatibilities when mixing messages\n * from different structure configurations (e.g. passing a `RemoveMessage`\n * into an API that expects `Message<CustomToolCall>`).\n */\nexport class RemoveMessage extends BaseMessage {\n readonly type = \"remove\" as const;\n\n /**\n * The ID of the message to remove.\n */\n id: string;\n\n constructor(fields: RemoveMessageFields) {\n super({\n ...fields,\n content: [],\n });\n this.id = fields.id;\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n id: this.id,\n };\n }\n\n static isInstance(obj: unknown): obj is RemoveMessage {\n return super.isInstance(obj) && obj.type === \"remove\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,gBAAb,cAAmC,YAAY;CAC7C,OAAgB;;;;CAKhB;CAEA,YAAY,QAA6B;EACvC,MAAM;GACJ,GAAG;GACH,SAAS,CAAC;EACZ,CAAC;EACD,KAAK,KAAK,OAAO;CACnB;CAEA,IAAa,mBAA4C;EACvD,OAAO;GACL,GAAG,MAAM;GACT,IAAI,KAAK;EACX;CACF;CAEA,OAAO,WAAW,KAAoC;EACpD,OAAO,MAAM,WAAW,GAAG,KAAK,IAAI,SAAS;CAC/C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"system.cjs","names":["BaseMessage","mergeContent","BaseMessageChunk","_mergeDicts"],"sources":["../../src/messages/system.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n mergeContent,\n _mergeDicts,\n type BaseMessageFields,\n} from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nimport { Constructor } from \"./utils.js\";\n\nexport interface SystemMessageFields<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessageFields<TStructure, \"system\"> {}\n\n/**\n * Represents a system message in a conversation.\n */\nexport class SystemMessage<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessage<TStructure, \"system\"> {\n static lc_name() {\n return \"SystemMessage\";\n }\n\n readonly type = \"system\" as const;\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"system\">\n | SystemMessageFields<TStructure>\n ) {\n super(fields);\n }\n\n /**\n * Concatenates a string or another system message with the current system message.\n * @param chunk - The chunk to concatenate with the system message.\n * @returns A new system message with the concatenated content.\n */\n concat(chunk: string | SystemMessage) {\n if (typeof chunk === \"string\") {\n return new SystemMessage({\n content: mergeContent(this.content, chunk),\n additional_kwargs: this.additional_kwargs,\n response_metadata: this.response_metadata,\n id: this.id,\n name: this.name,\n } as SystemMessageFields<TStructure>);\n }\n\n if (SystemMessage.isInstance(chunk)) {\n return new SystemMessage({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: {\n ...this.additional_kwargs,\n ...chunk.additional_kwargs,\n },\n response_metadata: {\n ...this.response_metadata,\n ...chunk.response_metadata,\n },\n id: this.id ?? chunk.id,\n name: this.name ?? chunk.name,\n } as SystemMessageFields<TStructure>);\n }\n\n throw new Error(\"Unexpected chunk type for system message\");\n }\n\n static isInstance(obj: unknown): obj is SystemMessage {\n return super.isInstance(obj) && obj.type === \"system\";\n }\n}\n\n/**\n * Represents a chunk of a system message, which can be concatenated with\n * other system message chunks.\n */\nexport class SystemMessageChunk<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessageChunk<TStructure, \"system\"> {\n static lc_name() {\n return \"SystemMessageChunk\";\n }\n\n readonly type = \"system\" as const;\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"system\">\n | SystemMessageFields<TStructure>\n ) {\n super(fields);\n }\n\n concat(chunk: SystemMessageChunk<TStructure>) {\n const Cls = this.constructor as Constructor<this>;\n return new Cls({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n id: this.id ?? chunk.id,\n });\n }\n\n static isInstance(obj: unknown): obj is SystemMessageChunk {\n return super.isInstance(obj) && obj.type === \"system\";\n }\n}\n\n/**\n * @deprecated Use {@link SystemMessage.isInstance} instead\n */\nexport function isSystemMessage<TStructure extends MessageStructure>(\n x: BaseMessage\n): x is SystemMessage<TStructure> {\n return x._getType() === \"system\";\n}\n\n/**\n * @deprecated Use {@link SystemMessageChunk.isInstance} instead\n */\nexport function isSystemMessageChunk<TStructure extends MessageStructure>(\n x: BaseMessageChunk\n): x is SystemMessageChunk<TStructure> {\n return x._getType() === \"system\";\n}\n"],"mappings":";;;;;AAiBA,IAAa,gBAAb,MAAa,sBAEHA,aAAAA,YAAkC;CAC1C,OAAO,UAAU;AACf,SAAO;;CAGT,OAAgB;CAEhB,YACE,QAGA;AACA,QAAM,OAAO;;;;;;;CAQf,OAAO,OAA+B;AACpC,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,cAAc;GACvB,SAASC,aAAAA,aAAa,KAAK,SAAS,MAAM;GAC1C,mBAAmB,KAAK;GACxB,mBAAmB,KAAK;GACxB,IAAI,KAAK;GACT,MAAM,KAAK;GACZ,CAAoC;AAGvC,MAAI,cAAc,WAAW,MAAM,CACjC,QAAO,IAAI,cAAc;GACvB,SAASA,aAAAA,aAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmB;IACjB,GAAG,KAAK;IACR,GAAG,MAAM;IACV;GACD,mBAAmB;IACjB,GAAG,KAAK;IACR,GAAG,MAAM;IACV;GACD,IAAI,KAAK,MAAM,MAAM;GACrB,MAAM,KAAK,QAAQ,MAAM;GAC1B,CAAoC;AAGvC,QAAM,IAAI,MAAM,2CAA2C;;CAG7D,OAAO,WAAW,KAAoC;AACpD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;;;;;;;AAQjD,IAAa,qBAAb,cAEUC,aAAAA,iBAAuC;CAC/C,OAAO,UAAU;AACf,SAAO;;CAGT,OAAgB;CAEhB,YACE,QAGA;AACA,QAAM,OAAO;;CAGf,OAAO,OAAuC;EAC5C,MAAM,MAAM,KAAK;AACjB,SAAO,IAAI,IAAI;GACb,SAASD,aAAAA,aAAa,KAAK,SAAS,MAAM,QAAQ;GAClD,mBAAmBE,aAAAA,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,mBAAmBA,aAAAA,YACjB,KAAK,mBACL,MAAM,kBACP;GACD,IAAI,KAAK,MAAM,MAAM;GACtB,CAAC;;CAGJ,OAAO,WAAW,KAAyC;AACzD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;;;;;;AAOjD,SAAgB,gBACd,GACgC;AAChC,QAAO,EAAE,UAAU,KAAK;;;;;AAM1B,SAAgB,qBACd,GACqC;AACrC,QAAO,EAAE,UAAU,KAAK"}
1
+ {"version":3,"file":"system.cjs","names":["BaseMessage","mergeContent","BaseMessageChunk","_mergeDicts"],"sources":["../../src/messages/system.ts"],"sourcesContent":["import {\n BaseMessage,\n BaseMessageChunk,\n mergeContent,\n _mergeDicts,\n type BaseMessageFields,\n} from \"./base.js\";\nimport { $InferMessageContent, MessageStructure } from \"./message.js\";\nimport { Constructor } from \"./utils.js\";\n\nexport interface SystemMessageFields<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessageFields<TStructure, \"system\"> {}\n\n/**\n * Represents a system message in a conversation.\n */\nexport class SystemMessage<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessage<TStructure, \"system\"> {\n static lc_name() {\n return \"SystemMessage\";\n }\n\n readonly type = \"system\" as const;\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"system\">\n | SystemMessageFields<TStructure>\n ) {\n super(fields);\n }\n\n /**\n * Concatenates a string or another system message with the current system message.\n * @param chunk - The chunk to concatenate with the system message.\n * @returns A new system message with the concatenated content.\n */\n concat(chunk: string | SystemMessage) {\n if (typeof chunk === \"string\") {\n return new SystemMessage({\n content: mergeContent(this.content, chunk),\n additional_kwargs: this.additional_kwargs,\n response_metadata: this.response_metadata,\n id: this.id,\n name: this.name,\n } as SystemMessageFields<TStructure>);\n }\n\n if (SystemMessage.isInstance(chunk)) {\n return new SystemMessage({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: {\n ...this.additional_kwargs,\n ...chunk.additional_kwargs,\n },\n response_metadata: {\n ...this.response_metadata,\n ...chunk.response_metadata,\n },\n id: this.id ?? chunk.id,\n name: this.name ?? chunk.name,\n } as SystemMessageFields<TStructure>);\n }\n\n throw new Error(\"Unexpected chunk type for system message\");\n }\n\n static isInstance(obj: unknown): obj is SystemMessage {\n return super.isInstance(obj) && obj.type === \"system\";\n }\n}\n\n/**\n * Represents a chunk of a system message, which can be concatenated with\n * other system message chunks.\n */\nexport class SystemMessageChunk<\n TStructure extends MessageStructure = MessageStructure,\n> extends BaseMessageChunk<TStructure, \"system\"> {\n static lc_name() {\n return \"SystemMessageChunk\";\n }\n\n readonly type = \"system\" as const;\n\n constructor(\n fields:\n | $InferMessageContent<TStructure, \"system\">\n | SystemMessageFields<TStructure>\n ) {\n super(fields);\n }\n\n concat(chunk: SystemMessageChunk<TStructure>) {\n const Cls = this.constructor as Constructor<this>;\n return new Cls({\n content: mergeContent(this.content, chunk.content),\n additional_kwargs: _mergeDicts(\n this.additional_kwargs,\n chunk.additional_kwargs\n ),\n response_metadata: _mergeDicts(\n this.response_metadata,\n chunk.response_metadata\n ),\n id: this.id ?? chunk.id,\n });\n }\n\n static isInstance(obj: unknown): obj is SystemMessageChunk {\n return super.isInstance(obj) && obj.type === \"system\";\n }\n}\n\n/**\n * @deprecated Use {@link SystemMessage.isInstance} instead\n */\nexport function isSystemMessage<TStructure extends MessageStructure>(\n x: BaseMessage\n): x is SystemMessage<TStructure> {\n return x._getType() === \"system\";\n}\n\n/**\n * @deprecated Use {@link SystemMessageChunk.isInstance} instead\n */\nexport function isSystemMessageChunk<TStructure extends MessageStructure>(\n x: BaseMessageChunk\n): x is SystemMessageChunk<TStructure> {\n return x._getType() === \"system\";\n}\n"],"mappings":";;;;;AAiBA,IAAa,gBAAb,MAAa,sBAEHA,aAAAA,YAAkC;CAC1C,OAAO,UAAU;EACf,OAAO;CACT;CAEA,OAAgB;CAEhB,YACE,QAGA;EACA,MAAM,MAAM;CACd;;;;;;CAOA,OAAO,OAA+B;EACpC,IAAI,OAAO,UAAU,UACnB,OAAO,IAAI,cAAc;GACvB,SAASC,aAAAA,aAAa,KAAK,SAAS,KAAK;GACzC,mBAAmB,KAAK;GACxB,mBAAmB,KAAK;GACxB,IAAI,KAAK;GACT,MAAM,KAAK;EACb,CAAoC;EAGtC,IAAI,cAAc,WAAW,KAAK,GAChC,OAAO,IAAI,cAAc;GACvB,SAASA,aAAAA,aAAa,KAAK,SAAS,MAAM,OAAO;GACjD,mBAAmB;IACjB,GAAG,KAAK;IACR,GAAG,MAAM;GACX;GACA,mBAAmB;IACjB,GAAG,KAAK;IACR,GAAG,MAAM;GACX;GACA,IAAI,KAAK,MAAM,MAAM;GACrB,MAAM,KAAK,QAAQ,MAAM;EAC3B,CAAoC;EAGtC,MAAM,IAAI,MAAM,0CAA0C;CAC5D;CAEA,OAAO,WAAW,KAAoC;EACpD,OAAO,MAAM,WAAW,GAAG,KAAK,IAAI,SAAS;CAC/C;AACF;;;;;AAMA,IAAa,qBAAb,cAEUC,aAAAA,iBAAuC;CAC/C,OAAO,UAAU;EACf,OAAO;CACT;CAEA,OAAgB;CAEhB,YACE,QAGA;EACA,MAAM,MAAM;CACd;CAEA,OAAO,OAAuC;EAC5C,MAAM,MAAM,KAAK;EACjB,OAAO,IAAI,IAAI;GACb,SAASD,aAAAA,aAAa,KAAK,SAAS,MAAM,OAAO;GACjD,mBAAmBE,aAAAA,YACjB,KAAK,mBACL,MAAM,iBACR;GACA,mBAAmBA,aAAAA,YACjB,KAAK,mBACL,MAAM,iBACR;GACA,IAAI,KAAK,MAAM,MAAM;EACvB,CAAC;CACH;CAEA,OAAO,WAAW,KAAyC;EACzD,OAAO,MAAM,WAAW,GAAG,KAAK,IAAI,SAAS;CAC/C;AACF;;;;AAKA,SAAgB,gBACd,GACgC;CAChC,OAAO,EAAE,SAAS,MAAM;AAC1B;;;;AAKA,SAAgB,qBACd,GACqC;CACrC,OAAO,EAAE,SAAS,MAAM;AAC1B"}
@@ -1,6 +1,5 @@
1
1
  import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.cjs";
2
2
  import { $InferMessageContent, MessageStructure } from "./message.cjs";
3
-
4
3
  //#region src/messages/system.d.ts
5
4
  interface SystemMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "system"> {}
6
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.cts","names":[],"sources":["../../src/messages/system.ts"],"mappings":";;;;UAUiB,mBAAA,oBACI,gBAAA,GAAmB,gBAAA,UAC9B,iBAAA,CAAkB,UAAA;AAF5B;;;AAAA,cAOa,aAAA,oBACQ,gBAAA,GAAmB,gBAAA,UAC9B,WAAA,CAAY,UAAA;EAAA,OACb,OAAA,CAAA;EAAA,SAIE,IAAA;EAET,WAAA,CACE,MAAA,EACI,oBAAA,CAAqB,UAAA,cACrB,mBAAA,CAAoB,UAAA;EAjBD;;;;;EA2BzB,MAAA,CAAO,KAAA,WAAgB,aAAA,GAAa,aAAA,CAAA,UAAA;EAAA,OA8B7B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,aAAA;AAAA;;AApD1C;;;cA6Da,kBAAA,oBACQ,gBAAA,GAAmB,gBAAA,UAC9B,gBAAA,CAAiB,UAAA;EAAA,OAClB,OAAA,CAAA;EAAA,SAIE,IAAA;EAET,WAAA,CACE,MAAA,EACI,oBAAA,CAAqB,UAAA,cACrB,mBAAA,CAAoB,UAAA;EAK1B,MAAA,CAAO,KAAA,EAAO,kBAAA,CAAmB,UAAA;EAAA,OAgB1B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,kBAAA;AAAA;;;;iBAQ1B,eAAA,oBAAmC,gBAAA,CAAA,CACjD,CAAA,EAAG,WAAA,GACF,CAAA,IAAK,aAAA,CAAc,UAAA;;;;iBAON,oBAAA,oBAAwC,gBAAA,CAAA,CACtD,CAAA,EAAG,gBAAA,GACF,CAAA,IAAK,kBAAA,CAAmB,UAAA"}
1
+ {"version":3,"file":"system.d.cts","names":[],"sources":["../../src/messages/system.ts"],"mappings":";;;UAUiB,oBACf,mBAAmB,mBAAmB,0BAC9B,kBAAkB;;;;cAKf,cACX,mBAAmB,mBAAmB,0BAC9B,YAAY;SACb;WAIE;EAET,YACE,QACI,qBAAqB,wBACrB,oBAAoB;;;;;;EAU1B,OAAO,gBAAgB,gBAAa,cAAA;SA8B7B,WAAW,eAAe,OAAO;;;;;;cAS7B,mBACX,mBAAmB,mBAAmB,0BAC9B,iBAAiB;SAClB;WAIE;EAET,YACE,QACI,qBAAqB,wBACrB,oBAAoB;EAK1B,OAAO,OAAO,mBAAmB;SAgB1B,WAAW,eAAe,OAAO;;;;;iBAQ1B,gBAAgB,mBAAmB,kBACjD,GAAG,cACF,KAAK,cAAc;;;;iBAON,qBAAqB,mBAAmB,kBACtD,GAAG,mBACF,KAAK,mBAAmB"}
@@ -1,6 +1,5 @@
1
1
  import { BaseMessage, BaseMessageChunk, BaseMessageFields } from "./base.js";
2
2
  import { $InferMessageContent, MessageStructure } from "./message.js";
3
-
4
3
  //#region src/messages/system.d.ts
5
4
  interface SystemMessageFields<TStructure extends MessageStructure = MessageStructure> extends BaseMessageFields<TStructure, "system"> {}
6
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","names":[],"sources":["../../src/messages/system.ts"],"mappings":";;;;UAUiB,mBAAA,oBACI,gBAAA,GAAmB,gBAAA,UAC9B,iBAAA,CAAkB,UAAA;AAF5B;;;AAAA,cAOa,aAAA,oBACQ,gBAAA,GAAmB,gBAAA,UAC9B,WAAA,CAAY,UAAA;EAAA,OACb,OAAA,CAAA;EAAA,SAIE,IAAA;EAET,WAAA,CACE,MAAA,EACI,oBAAA,CAAqB,UAAA,cACrB,mBAAA,CAAoB,UAAA;EAjBD;;;;;EA2BzB,MAAA,CAAO,KAAA,WAAgB,aAAA,GAAa,aAAA,CAAA,UAAA;EAAA,OA8B7B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,aAAA;AAAA;;AApD1C;;;cA6Da,kBAAA,oBACQ,gBAAA,GAAmB,gBAAA,UAC9B,gBAAA,CAAiB,UAAA;EAAA,OAClB,OAAA,CAAA;EAAA,SAIE,IAAA;EAET,WAAA,CACE,MAAA,EACI,oBAAA,CAAqB,UAAA,cACrB,mBAAA,CAAoB,UAAA;EAK1B,MAAA,CAAO,KAAA,EAAO,kBAAA,CAAmB,UAAA;EAAA,OAgB1B,UAAA,CAAW,GAAA,YAAe,GAAA,IAAO,kBAAA;AAAA;;;;iBAQ1B,eAAA,oBAAmC,gBAAA,CAAA,CACjD,CAAA,EAAG,WAAA,GACF,CAAA,IAAK,aAAA,CAAc,UAAA;;;;iBAON,oBAAA,oBAAwC,gBAAA,CAAA,CACtD,CAAA,EAAG,gBAAA,GACF,CAAA,IAAK,kBAAA,CAAmB,UAAA"}
1
+ {"version":3,"file":"system.d.ts","names":[],"sources":["../../src/messages/system.ts"],"mappings":";;;UAUiB,oBACf,mBAAmB,mBAAmB,0BAC9B,kBAAkB;;;;cAKf,cACX,mBAAmB,mBAAmB,0BAC9B,YAAY;SACb;WAIE;EAET,YACE,QACI,qBAAqB,wBACrB,oBAAoB;;;;;;EAU1B,OAAO,gBAAgB,gBAAa,cAAA;SA8B7B,WAAW,eAAe,OAAO;;;;;;cAS7B,mBACX,mBAAmB,mBAAmB,0BAC9B,iBAAiB;SAClB;WAIE;EAET,YACE,QACI,qBAAqB,wBACrB,oBAAoB;EAK1B,OAAO,OAAO,mBAAmB;SAgB1B,WAAW,eAAe,OAAO;;;;;iBAQ1B,gBAAgB,mBAAmB,kBACjD,GAAG,cACF,KAAK,cAAc;;;;iBAON,qBAAqB,mBAAmB,kBACtD,GAAG,mBACF,KAAK,mBAAmB"}