@tambo-ai/react 0.69.1 → 0.71.0

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 (402) hide show
  1. package/README.md +7 -7
  2. package/dist/hooks/use-tambo-threads.test.js.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/mcp/index.d.ts +4 -5
  7. package/dist/mcp/index.d.ts.map +1 -1
  8. package/dist/mcp/index.js +4 -5
  9. package/dist/mcp/index.js.map +1 -1
  10. package/dist/model/component-metadata.d.ts +88 -241
  11. package/dist/model/component-metadata.d.ts.map +1 -1
  12. package/dist/model/component-metadata.js.map +1 -1
  13. package/dist/model/mcp-server-info.d.ts +3 -3
  14. package/dist/model/mcp-server-info.js.map +1 -1
  15. package/dist/providers/hooks/use-tambo-session-token.test.js.map +1 -1
  16. package/dist/providers/tambo-component-provider.d.ts +2 -2
  17. package/dist/providers/tambo-component-provider.d.ts.map +1 -1
  18. package/dist/providers/tambo-component-provider.js.map +1 -1
  19. package/dist/providers/tambo-interactable-provider.d.ts +1 -1
  20. package/dist/providers/tambo-registry-provider.d.ts +4 -4
  21. package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
  22. package/dist/providers/tambo-registry-provider.js +11 -8
  23. package/dist/providers/tambo-registry-provider.js.map +1 -1
  24. package/dist/providers/tambo-registry-provider.test.js +31 -0
  25. package/dist/providers/tambo-registry-provider.test.js.map +1 -1
  26. package/dist/providers/tambo-registry-schema-compat.test.js +42 -52
  27. package/dist/providers/tambo-registry-schema-compat.test.js.map +1 -1
  28. package/dist/providers/tambo-stubs.d.ts +2 -2
  29. package/dist/providers/tambo-stubs.d.ts.map +1 -1
  30. package/dist/providers/tambo-stubs.js.map +1 -1
  31. package/dist/providers/tambo-thread-provider-initial-messages.test.js.map +1 -1
  32. package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
  33. package/dist/providers/tambo-thread-provider.js +107 -141
  34. package/dist/providers/tambo-thread-provider.js.map +1 -1
  35. package/dist/providers/tambo-thread-provider.test.js +274 -445
  36. package/dist/providers/tambo-thread-provider.test.js.map +1 -1
  37. package/dist/schema/index.d.ts +1 -2
  38. package/dist/schema/index.d.ts.map +1 -1
  39. package/dist/schema/index.js +1 -5
  40. package/dist/schema/index.js.map +1 -1
  41. package/dist/schema/schema.d.ts +7 -24
  42. package/dist/schema/schema.d.ts.map +1 -1
  43. package/dist/schema/schema.js +34 -105
  44. package/dist/schema/schema.js.map +1 -1
  45. package/dist/schema/schema.test.js +26 -124
  46. package/dist/schema/schema.test.js.map +1 -1
  47. package/dist/testing/tools.d.ts +2 -12
  48. package/dist/testing/tools.d.ts.map +1 -1
  49. package/dist/testing/tools.js +1 -20
  50. package/dist/testing/tools.js.map +1 -1
  51. package/dist/testing/types.d.ts +2 -2
  52. package/dist/testing/types.d.ts.map +1 -1
  53. package/dist/testing/types.js.map +1 -1
  54. package/dist/util/registry-validators.d.ts +2 -2
  55. package/dist/util/registry-validators.d.ts.map +1 -1
  56. package/dist/util/registry-validators.js +37 -17
  57. package/dist/util/registry-validators.js.map +1 -1
  58. package/dist/util/registry-validators.test.js +64 -25
  59. package/dist/util/registry-validators.test.js.map +1 -1
  60. package/dist/util/registry.d.ts +4 -10
  61. package/dist/util/registry.d.ts.map +1 -1
  62. package/dist/util/registry.js +6 -22
  63. package/dist/util/registry.js.map +1 -1
  64. package/dist/util/registry.test.js +1 -47
  65. package/dist/util/registry.test.js.map +1 -1
  66. package/dist/util/tool-caller.d.ts +2 -2
  67. package/dist/util/tool-caller.d.ts.map +1 -1
  68. package/dist/util/tool-caller.js +5 -12
  69. package/dist/util/tool-caller.js.map +1 -1
  70. package/dist/v1/hooks/use-tambo-v1-messages.d.ts +58 -0
  71. package/dist/v1/hooks/use-tambo-v1-messages.d.ts.map +1 -0
  72. package/dist/v1/hooks/use-tambo-v1-messages.js +54 -0
  73. package/dist/v1/hooks/use-tambo-v1-messages.js.map +1 -0
  74. package/dist/v1/hooks/use-tambo-v1-messages.test.d.ts +2 -0
  75. package/dist/v1/hooks/use-tambo-v1-messages.test.d.ts.map +1 -0
  76. package/dist/v1/hooks/use-tambo-v1-messages.test.js +137 -0
  77. package/dist/v1/hooks/use-tambo-v1-messages.test.js.map +1 -0
  78. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts +96 -0
  79. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -0
  80. package/dist/v1/hooks/use-tambo-v1-send-message.js +227 -0
  81. package/dist/v1/hooks/use-tambo-v1-send-message.js.map +1 -0
  82. package/dist/v1/hooks/use-tambo-v1-send-message.test.d.ts +2 -0
  83. package/dist/v1/hooks/use-tambo-v1-send-message.test.d.ts.map +1 -0
  84. package/dist/v1/hooks/use-tambo-v1-send-message.test.js +827 -0
  85. package/dist/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -0
  86. package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts +61 -0
  87. package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -0
  88. package/dist/v1/hooks/use-tambo-v1-thread-list.js +56 -0
  89. package/dist/v1/hooks/use-tambo-v1-thread-list.js.map +1 -0
  90. package/dist/v1/hooks/use-tambo-v1-thread-list.test.d.ts +2 -0
  91. package/dist/v1/hooks/use-tambo-v1-thread-list.test.d.ts.map +1 -0
  92. package/dist/v1/hooks/use-tambo-v1-thread-list.test.js +98 -0
  93. package/dist/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -0
  94. package/dist/v1/hooks/use-tambo-v1-thread.d.ts +37 -0
  95. package/dist/v1/hooks/use-tambo-v1-thread.d.ts.map +1 -0
  96. package/dist/v1/hooks/use-tambo-v1-thread.js +49 -0
  97. package/dist/v1/hooks/use-tambo-v1-thread.js.map +1 -0
  98. package/dist/v1/hooks/use-tambo-v1-thread.test.d.ts +2 -0
  99. package/dist/v1/hooks/use-tambo-v1-thread.test.d.ts.map +1 -0
  100. package/dist/v1/hooks/use-tambo-v1-thread.test.js +83 -0
  101. package/dist/v1/hooks/use-tambo-v1-thread.test.js.map +1 -0
  102. package/dist/v1/hooks/use-tambo-v1.d.ts +107 -0
  103. package/dist/v1/hooks/use-tambo-v1.d.ts.map +1 -0
  104. package/dist/v1/hooks/use-tambo-v1.js +87 -0
  105. package/dist/v1/hooks/use-tambo-v1.js.map +1 -0
  106. package/dist/v1/hooks/use-tambo-v1.test.d.ts +2 -0
  107. package/dist/v1/hooks/use-tambo-v1.test.d.ts.map +1 -0
  108. package/dist/v1/hooks/use-tambo-v1.test.js +150 -0
  109. package/dist/v1/hooks/use-tambo-v1.test.js.map +1 -0
  110. package/dist/v1/index.d.ts +73 -0
  111. package/dist/v1/index.d.ts.map +1 -0
  112. package/dist/v1/index.js +106 -0
  113. package/dist/v1/index.js.map +1 -0
  114. package/dist/v1/providers/tambo-v1-provider.d.ts +91 -0
  115. package/dist/v1/providers/tambo-v1-provider.d.ts.map +1 -0
  116. package/dist/v1/providers/tambo-v1-provider.js +110 -0
  117. package/dist/v1/providers/tambo-v1-provider.js.map +1 -0
  118. package/dist/v1/providers/tambo-v1-provider.test.d.ts +2 -0
  119. package/dist/v1/providers/tambo-v1-provider.test.d.ts.map +1 -0
  120. package/dist/v1/providers/tambo-v1-provider.test.js +123 -0
  121. package/dist/v1/providers/tambo-v1-provider.test.js.map +1 -0
  122. package/dist/v1/providers/tambo-v1-stream-context.d.ts +136 -0
  123. package/dist/v1/providers/tambo-v1-stream-context.d.ts.map +1 -0
  124. package/dist/v1/providers/tambo-v1-stream-context.js +230 -0
  125. package/dist/v1/providers/tambo-v1-stream-context.js.map +1 -0
  126. package/dist/v1/providers/tambo-v1-stream-context.test.d.ts +2 -0
  127. package/dist/v1/providers/tambo-v1-stream-context.test.d.ts.map +1 -0
  128. package/dist/v1/providers/tambo-v1-stream-context.test.js +85 -0
  129. package/dist/v1/providers/tambo-v1-stream-context.test.js.map +1 -0
  130. package/dist/v1/types/component.d.ts +50 -0
  131. package/dist/v1/types/component.d.ts.map +1 -0
  132. package/dist/v1/types/component.js +14 -0
  133. package/dist/v1/types/component.js.map +1 -0
  134. package/dist/v1/types/event.d.ts +72 -0
  135. package/dist/v1/types/event.d.ts.map +1 -0
  136. package/dist/v1/types/event.js +54 -0
  137. package/dist/v1/types/event.js.map +1 -0
  138. package/dist/v1/types/event.test.d.ts +2 -0
  139. package/dist/v1/types/event.test.d.ts.map +1 -0
  140. package/dist/v1/types/event.test.js +70 -0
  141. package/dist/v1/types/event.test.js.map +1 -0
  142. package/dist/v1/types/message.d.ts +35 -0
  143. package/dist/v1/types/message.d.ts.map +1 -0
  144. package/dist/v1/types/message.js +10 -0
  145. package/dist/v1/types/message.js.map +1 -0
  146. package/dist/v1/types/thread.d.ts +52 -0
  147. package/dist/v1/types/thread.d.ts.map +1 -0
  148. package/dist/v1/types/thread.js +9 -0
  149. package/dist/v1/types/thread.js.map +1 -0
  150. package/dist/v1/utils/event-accumulator.d.ts +100 -0
  151. package/dist/v1/utils/event-accumulator.d.ts.map +1 -0
  152. package/dist/v1/utils/event-accumulator.js +715 -0
  153. package/dist/v1/utils/event-accumulator.js.map +1 -0
  154. package/dist/v1/utils/event-accumulator.test.d.ts +2 -0
  155. package/dist/v1/utils/event-accumulator.test.d.ts.map +1 -0
  156. package/dist/v1/utils/event-accumulator.test.js +1010 -0
  157. package/dist/v1/utils/event-accumulator.test.js.map +1 -0
  158. package/dist/v1/utils/json-patch.d.ts +18 -0
  159. package/dist/v1/utils/json-patch.d.ts.map +1 -0
  160. package/dist/v1/utils/json-patch.js +35 -0
  161. package/dist/v1/utils/json-patch.js.map +1 -0
  162. package/dist/v1/utils/json-patch.test.d.ts +2 -0
  163. package/dist/v1/utils/json-patch.test.d.ts.map +1 -0
  164. package/dist/v1/utils/json-patch.test.js +28 -0
  165. package/dist/v1/utils/json-patch.test.js.map +1 -0
  166. package/dist/v1/utils/registry-conversion.d.ts +53 -0
  167. package/dist/v1/utils/registry-conversion.d.ts.map +1 -0
  168. package/dist/v1/utils/registry-conversion.js +114 -0
  169. package/dist/v1/utils/registry-conversion.js.map +1 -0
  170. package/dist/v1/utils/registry-conversion.test.d.ts +2 -0
  171. package/dist/v1/utils/registry-conversion.test.d.ts.map +1 -0
  172. package/dist/v1/utils/registry-conversion.test.js +179 -0
  173. package/dist/v1/utils/registry-conversion.test.js.map +1 -0
  174. package/dist/v1/utils/stream-handler.d.ts +45 -0
  175. package/dist/v1/utils/stream-handler.d.ts.map +1 -0
  176. package/dist/v1/utils/stream-handler.js +47 -0
  177. package/dist/v1/utils/stream-handler.js.map +1 -0
  178. package/dist/v1/utils/stream-handler.test.d.ts +2 -0
  179. package/dist/v1/utils/stream-handler.test.d.ts.map +1 -0
  180. package/dist/v1/utils/stream-handler.test.js +74 -0
  181. package/dist/v1/utils/stream-handler.test.js.map +1 -0
  182. package/dist/v1/utils/tool-call-tracker.d.ts +41 -0
  183. package/dist/v1/utils/tool-call-tracker.d.ts.map +1 -0
  184. package/dist/v1/utils/tool-call-tracker.js +90 -0
  185. package/dist/v1/utils/tool-call-tracker.js.map +1 -0
  186. package/dist/v1/utils/tool-executor.d.ts +33 -0
  187. package/dist/v1/utils/tool-executor.d.ts.map +1 -0
  188. package/dist/v1/utils/tool-executor.js +103 -0
  189. package/dist/v1/utils/tool-executor.js.map +1 -0
  190. package/dist/v1/utils/tool-executor.test.d.ts +2 -0
  191. package/dist/v1/utils/tool-executor.test.d.ts.map +1 -0
  192. package/dist/v1/utils/tool-executor.test.js +222 -0
  193. package/dist/v1/utils/tool-executor.test.js.map +1 -0
  194. package/esm/hooks/use-tambo-threads.test.js.map +1 -1
  195. package/esm/index.d.ts +1 -1
  196. package/esm/index.d.ts.map +1 -1
  197. package/esm/index.js.map +1 -1
  198. package/esm/mcp/index.d.ts +4 -5
  199. package/esm/mcp/index.d.ts.map +1 -1
  200. package/esm/mcp/index.js +4 -5
  201. package/esm/mcp/index.js.map +1 -1
  202. package/esm/model/component-metadata.d.ts +88 -241
  203. package/esm/model/component-metadata.d.ts.map +1 -1
  204. package/esm/model/component-metadata.js.map +1 -1
  205. package/esm/model/mcp-server-info.d.ts +3 -3
  206. package/esm/model/mcp-server-info.js.map +1 -1
  207. package/esm/providers/hooks/use-tambo-session-token.test.js.map +1 -1
  208. package/esm/providers/tambo-component-provider.d.ts +2 -2
  209. package/esm/providers/tambo-component-provider.d.ts.map +1 -1
  210. package/esm/providers/tambo-component-provider.js.map +1 -1
  211. package/esm/providers/tambo-interactable-provider.d.ts +1 -1
  212. package/esm/providers/tambo-registry-provider.d.ts +4 -4
  213. package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
  214. package/esm/providers/tambo-registry-provider.js +11 -8
  215. package/esm/providers/tambo-registry-provider.js.map +1 -1
  216. package/esm/providers/tambo-registry-provider.test.js +31 -0
  217. package/esm/providers/tambo-registry-provider.test.js.map +1 -1
  218. package/esm/providers/tambo-registry-schema-compat.test.js +42 -52
  219. package/esm/providers/tambo-registry-schema-compat.test.js.map +1 -1
  220. package/esm/providers/tambo-stubs.d.ts +2 -2
  221. package/esm/providers/tambo-stubs.d.ts.map +1 -1
  222. package/esm/providers/tambo-stubs.js.map +1 -1
  223. package/esm/providers/tambo-thread-provider-initial-messages.test.js.map +1 -1
  224. package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
  225. package/esm/providers/tambo-thread-provider.js +107 -141
  226. package/esm/providers/tambo-thread-provider.js.map +1 -1
  227. package/esm/providers/tambo-thread-provider.test.js +241 -445
  228. package/esm/providers/tambo-thread-provider.test.js.map +1 -1
  229. package/esm/schema/index.d.ts +1 -2
  230. package/esm/schema/index.d.ts.map +1 -1
  231. package/esm/schema/index.js +1 -2
  232. package/esm/schema/index.js.map +1 -1
  233. package/esm/schema/schema.d.ts +7 -24
  234. package/esm/schema/schema.d.ts.map +1 -1
  235. package/esm/schema/schema.js +34 -103
  236. package/esm/schema/schema.js.map +1 -1
  237. package/esm/schema/schema.test.js +27 -125
  238. package/esm/schema/schema.test.js.map +1 -1
  239. package/esm/testing/tools.d.ts +2 -12
  240. package/esm/testing/tools.d.ts.map +1 -1
  241. package/esm/testing/tools.js +2 -20
  242. package/esm/testing/tools.js.map +1 -1
  243. package/esm/testing/types.d.ts +2 -2
  244. package/esm/testing/types.d.ts.map +1 -1
  245. package/esm/testing/types.js.map +1 -1
  246. package/esm/util/registry-validators.d.ts +2 -2
  247. package/esm/util/registry-validators.d.ts.map +1 -1
  248. package/esm/util/registry-validators.js +38 -18
  249. package/esm/util/registry-validators.js.map +1 -1
  250. package/esm/util/registry-validators.test.js +64 -25
  251. package/esm/util/registry-validators.test.js.map +1 -1
  252. package/esm/util/registry.d.ts +4 -10
  253. package/esm/util/registry.d.ts.map +1 -1
  254. package/esm/util/registry.js +7 -22
  255. package/esm/util/registry.js.map +1 -1
  256. package/esm/util/registry.test.js +3 -49
  257. package/esm/util/registry.test.js.map +1 -1
  258. package/esm/util/tool-caller.d.ts +2 -2
  259. package/esm/util/tool-caller.d.ts.map +1 -1
  260. package/esm/util/tool-caller.js +5 -12
  261. package/esm/util/tool-caller.js.map +1 -1
  262. package/esm/v1/hooks/use-tambo-v1-messages.d.ts +58 -0
  263. package/esm/v1/hooks/use-tambo-v1-messages.d.ts.map +1 -0
  264. package/esm/v1/hooks/use-tambo-v1-messages.js +51 -0
  265. package/esm/v1/hooks/use-tambo-v1-messages.js.map +1 -0
  266. package/esm/v1/hooks/use-tambo-v1-messages.test.d.ts +2 -0
  267. package/esm/v1/hooks/use-tambo-v1-messages.test.d.ts.map +1 -0
  268. package/esm/v1/hooks/use-tambo-v1-messages.test.js +132 -0
  269. package/esm/v1/hooks/use-tambo-v1-messages.test.js.map +1 -0
  270. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts +96 -0
  271. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -0
  272. package/esm/v1/hooks/use-tambo-v1-send-message.js +223 -0
  273. package/esm/v1/hooks/use-tambo-v1-send-message.js.map +1 -0
  274. package/esm/v1/hooks/use-tambo-v1-send-message.test.d.ts +2 -0
  275. package/esm/v1/hooks/use-tambo-v1-send-message.test.d.ts.map +1 -0
  276. package/esm/v1/hooks/use-tambo-v1-send-message.test.js +822 -0
  277. package/esm/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -0
  278. package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts +61 -0
  279. package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -0
  280. package/esm/v1/hooks/use-tambo-v1-thread-list.js +53 -0
  281. package/esm/v1/hooks/use-tambo-v1-thread-list.js.map +1 -0
  282. package/esm/v1/hooks/use-tambo-v1-thread-list.test.d.ts +2 -0
  283. package/esm/v1/hooks/use-tambo-v1-thread-list.test.d.ts.map +1 -0
  284. package/esm/v1/hooks/use-tambo-v1-thread-list.test.js +93 -0
  285. package/esm/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -0
  286. package/esm/v1/hooks/use-tambo-v1-thread.d.ts +37 -0
  287. package/esm/v1/hooks/use-tambo-v1-thread.d.ts.map +1 -0
  288. package/esm/v1/hooks/use-tambo-v1-thread.js +46 -0
  289. package/esm/v1/hooks/use-tambo-v1-thread.js.map +1 -0
  290. package/esm/v1/hooks/use-tambo-v1-thread.test.d.ts +2 -0
  291. package/esm/v1/hooks/use-tambo-v1-thread.test.d.ts.map +1 -0
  292. package/esm/v1/hooks/use-tambo-v1-thread.test.js +78 -0
  293. package/esm/v1/hooks/use-tambo-v1-thread.test.js.map +1 -0
  294. package/esm/v1/hooks/use-tambo-v1.d.ts +107 -0
  295. package/esm/v1/hooks/use-tambo-v1.d.ts.map +1 -0
  296. package/esm/v1/hooks/use-tambo-v1.js +84 -0
  297. package/esm/v1/hooks/use-tambo-v1.js.map +1 -0
  298. package/esm/v1/hooks/use-tambo-v1.test.d.ts +2 -0
  299. package/esm/v1/hooks/use-tambo-v1.test.d.ts.map +1 -0
  300. package/esm/v1/hooks/use-tambo-v1.test.js +145 -0
  301. package/esm/v1/hooks/use-tambo-v1.test.js.map +1 -0
  302. package/esm/v1/index.d.ts +73 -0
  303. package/esm/v1/index.d.ts.map +1 -0
  304. package/esm/v1/index.js +83 -0
  305. package/esm/v1/index.js.map +1 -0
  306. package/esm/v1/providers/tambo-v1-provider.d.ts +91 -0
  307. package/esm/v1/providers/tambo-v1-provider.d.ts.map +1 -0
  308. package/esm/v1/providers/tambo-v1-provider.js +74 -0
  309. package/esm/v1/providers/tambo-v1-provider.js.map +1 -0
  310. package/esm/v1/providers/tambo-v1-provider.test.d.ts +2 -0
  311. package/esm/v1/providers/tambo-v1-provider.test.d.ts.map +1 -0
  312. package/esm/v1/providers/tambo-v1-provider.test.js +118 -0
  313. package/esm/v1/providers/tambo-v1-provider.test.js.map +1 -0
  314. package/esm/v1/providers/tambo-v1-stream-context.d.ts +136 -0
  315. package/esm/v1/providers/tambo-v1-stream-context.d.ts.map +1 -0
  316. package/esm/v1/providers/tambo-v1-stream-context.js +191 -0
  317. package/esm/v1/providers/tambo-v1-stream-context.js.map +1 -0
  318. package/esm/v1/providers/tambo-v1-stream-context.test.d.ts +2 -0
  319. package/esm/v1/providers/tambo-v1-stream-context.test.d.ts.map +1 -0
  320. package/esm/v1/providers/tambo-v1-stream-context.test.js +80 -0
  321. package/esm/v1/providers/tambo-v1-stream-context.test.js.map +1 -0
  322. package/esm/v1/types/component.d.ts +50 -0
  323. package/esm/v1/types/component.d.ts.map +1 -0
  324. package/esm/v1/types/component.js +13 -0
  325. package/esm/v1/types/component.js.map +1 -0
  326. package/esm/v1/types/event.d.ts +72 -0
  327. package/esm/v1/types/event.d.ts.map +1 -0
  328. package/esm/v1/types/event.js +50 -0
  329. package/esm/v1/types/event.js.map +1 -0
  330. package/esm/v1/types/event.test.d.ts +2 -0
  331. package/esm/v1/types/event.test.d.ts.map +1 -0
  332. package/esm/v1/types/event.test.js +68 -0
  333. package/esm/v1/types/event.test.js.map +1 -0
  334. package/esm/v1/types/message.d.ts +35 -0
  335. package/esm/v1/types/message.d.ts.map +1 -0
  336. package/esm/v1/types/message.js +9 -0
  337. package/esm/v1/types/message.js.map +1 -0
  338. package/esm/v1/types/thread.d.ts +52 -0
  339. package/esm/v1/types/thread.d.ts.map +1 -0
  340. package/esm/v1/types/thread.js +8 -0
  341. package/esm/v1/types/thread.js.map +1 -0
  342. package/esm/v1/utils/event-accumulator.d.ts +100 -0
  343. package/esm/v1/utils/event-accumulator.d.ts.map +1 -0
  344. package/esm/v1/utils/event-accumulator.js +708 -0
  345. package/esm/v1/utils/event-accumulator.js.map +1 -0
  346. package/esm/v1/utils/event-accumulator.test.d.ts +2 -0
  347. package/esm/v1/utils/event-accumulator.test.d.ts.map +1 -0
  348. package/esm/v1/utils/event-accumulator.test.js +1008 -0
  349. package/esm/v1/utils/event-accumulator.test.js.map +1 -0
  350. package/esm/v1/utils/json-patch.d.ts +18 -0
  351. package/esm/v1/utils/json-patch.d.ts.map +1 -0
  352. package/esm/v1/utils/json-patch.js +32 -0
  353. package/esm/v1/utils/json-patch.js.map +1 -0
  354. package/esm/v1/utils/json-patch.test.d.ts +2 -0
  355. package/esm/v1/utils/json-patch.test.d.ts.map +1 -0
  356. package/esm/v1/utils/json-patch.test.js +26 -0
  357. package/esm/v1/utils/json-patch.test.js.map +1 -0
  358. package/esm/v1/utils/registry-conversion.d.ts +53 -0
  359. package/esm/v1/utils/registry-conversion.d.ts.map +1 -0
  360. package/esm/v1/utils/registry-conversion.js +108 -0
  361. package/esm/v1/utils/registry-conversion.js.map +1 -0
  362. package/esm/v1/utils/registry-conversion.test.d.ts +2 -0
  363. package/esm/v1/utils/registry-conversion.test.d.ts.map +1 -0
  364. package/esm/v1/utils/registry-conversion.test.js +177 -0
  365. package/esm/v1/utils/registry-conversion.test.js.map +1 -0
  366. package/esm/v1/utils/stream-handler.d.ts +45 -0
  367. package/esm/v1/utils/stream-handler.d.ts.map +1 -0
  368. package/esm/v1/utils/stream-handler.js +44 -0
  369. package/esm/v1/utils/stream-handler.js.map +1 -0
  370. package/esm/v1/utils/stream-handler.test.d.ts +2 -0
  371. package/esm/v1/utils/stream-handler.test.d.ts.map +1 -0
  372. package/esm/v1/utils/stream-handler.test.js +72 -0
  373. package/esm/v1/utils/stream-handler.test.js.map +1 -0
  374. package/esm/v1/utils/tool-call-tracker.d.ts +41 -0
  375. package/esm/v1/utils/tool-call-tracker.d.ts.map +1 -0
  376. package/esm/v1/utils/tool-call-tracker.js +86 -0
  377. package/esm/v1/utils/tool-call-tracker.js.map +1 -0
  378. package/esm/v1/utils/tool-executor.d.ts +33 -0
  379. package/esm/v1/utils/tool-executor.d.ts.map +1 -0
  380. package/esm/v1/utils/tool-executor.js +99 -0
  381. package/esm/v1/utils/tool-executor.js.map +1 -0
  382. package/esm/v1/utils/tool-executor.test.d.ts +2 -0
  383. package/esm/v1/utils/tool-executor.test.d.ts.map +1 -0
  384. package/esm/v1/utils/tool-executor.test.js +220 -0
  385. package/esm/v1/utils/tool-executor.test.js.map +1 -0
  386. package/package.json +20 -9
  387. package/dist/schema/zod.d.ts +0 -57
  388. package/dist/schema/zod.d.ts.map +0 -1
  389. package/dist/schema/zod.js +0 -191
  390. package/dist/schema/zod.js.map +0 -1
  391. package/dist/schema/zod.test.d.ts +0 -2
  392. package/dist/schema/zod.test.d.ts.map +0 -1
  393. package/dist/schema/zod.test.js +0 -663
  394. package/dist/schema/zod.test.js.map +0 -1
  395. package/esm/schema/zod.d.ts +0 -57
  396. package/esm/schema/zod.d.ts.map +0 -1
  397. package/esm/schema/zod.js +0 -180
  398. package/esm/schema/zod.js.map +0 -1
  399. package/esm/schema/zod.test.d.ts +0 -2
  400. package/esm/schema/zod.test.d.ts.map +0 -1
  401. package/esm/schema/zod.test.js +0 -628
  402. package/esm/schema/zod.test.js.map +0 -1
@@ -1,628 +0,0 @@
1
- import * as z3 from "zod/v3";
2
- import * as z4 from "zod/v4";
3
- import { getZodFunctionArgs, getZodFunctionReturns, handleZodSchemaToJson, isZod3FunctionSchema, isZod3Schema, isZod4FunctionSchema, isZod4Schema, isZodFunctionSchema, isZodSchema, } from "./zod";
4
- // Test helper: assumes `value` is JSON-serializable (plain objects/arrays/primitives).
5
- // Conservative helper: returns true if any object in the tree has an own `key`
6
- // property at any depth. This lets us assert against JSON Schema `$ref` keys
7
- // structurally (not via incidental substrings in string values).
8
- function hasKeyDeep(value, key) {
9
- const seen = new Set();
10
- function isPlainObject(v) {
11
- if (!v || typeof v !== "object" || Array.isArray(v))
12
- return false;
13
- const proto = Object.getPrototypeOf(v);
14
- return proto === Object.prototype || proto === null;
15
- }
16
- function visit(node) {
17
- if (!node || typeof node !== "object")
18
- return false;
19
- if (seen.has(node))
20
- return false;
21
- seen.add(node);
22
- if (Array.isArray(node)) {
23
- return node.some(visit);
24
- }
25
- if (!isPlainObject(node))
26
- return false;
27
- if (Object.prototype.hasOwnProperty.call(node, key))
28
- return true;
29
- return Object.values(node).some(visit);
30
- }
31
- return visit(value);
32
- }
33
- function resolveJsonPointer(doc, pointer) {
34
- if (!pointer.startsWith("#"))
35
- return undefined;
36
- if (pointer === "#")
37
- return doc;
38
- if (!pointer.startsWith("#/"))
39
- return undefined;
40
- return pointer
41
- .slice(2)
42
- .split("/")
43
- .map((segment) => segment.replaceAll("~1", "/").replaceAll("~0", "~"))
44
- .reduce((current, segment) => {
45
- if (!current || typeof current !== "object")
46
- return undefined;
47
- if (Array.isArray(current)) {
48
- const index = Number(segment);
49
- if (!Number.isInteger(index))
50
- return undefined;
51
- return current[index];
52
- }
53
- return current[segment];
54
- }, doc);
55
- }
56
- function createRecursiveZod4NodeSchema() {
57
- // Placeholder schema so we can self-reference via `z4.lazy` without
58
- // fighting ESLint `prefer-const`.
59
- let nodeSchema = z4.any();
60
- nodeSchema = z4.object({ next: z4.lazy(() => nodeSchema).optional() });
61
- return nodeSchema;
62
- }
63
- describe("zod schema utilities", () => {
64
- describe("isZod3Schema", () => {
65
- it("returns true for Zod 3 schemas", () => {
66
- const schema = z3.object({ name: z3.string() });
67
- expect(isZod3Schema(schema)).toBe(true);
68
- expect(isZod4Schema(schema)).toBe(false);
69
- });
70
- it("returns true for Zod 4 schemas (they also have _def)", () => {
71
- // Note: Zod 4 schemas have both _def and _zod, so isZod3Schema returns true.
72
- // This is fine because handleZodSchemaToJson checks isZod4Schema first.
73
- const schema = z4.object({ name: z4.string() });
74
- expect(isZod4Schema(schema)).toBe(true);
75
- expect(isZod3Schema(schema)).toBe(false);
76
- });
77
- it("returns false for non-Zod values", () => {
78
- expect(isZod3Schema({})).toBe(false);
79
- expect(isZod3Schema(null)).toBe(false);
80
- expect(isZod3Schema("string")).toBe(false);
81
- });
82
- });
83
- describe("isZod4Schema", () => {
84
- it("returns true for Zod 4 schemas", () => {
85
- const schema = z4.object({ name: z4.string() });
86
- expect(isZod4Schema(schema)).toBe(true);
87
- });
88
- it("returns false for Zod 3 schemas", () => {
89
- const schema = z3.object({ name: z3.string() });
90
- expect(isZod4Schema(schema)).toBe(false);
91
- });
92
- it("returns false for non-Zod values", () => {
93
- expect(isZod4Schema({})).toBe(false);
94
- expect(isZod4Schema(null)).toBe(false);
95
- expect(isZod4Schema("string")).toBe(false);
96
- });
97
- });
98
- describe("isZodSchema", () => {
99
- it("returns true for Zod 3 schemas", () => {
100
- expect(isZodSchema(z3.string())).toBe(true);
101
- expect(isZodSchema(z3.object({ a: z3.string() }))).toBe(true);
102
- });
103
- it("returns true for Zod 4 schemas", () => {
104
- expect(isZodSchema(z4.string())).toBe(true);
105
- expect(isZodSchema(z4.object({ a: z4.string() }))).toBe(true);
106
- });
107
- it("returns false for non-objects", () => {
108
- expect(isZodSchema(null)).toBe(false);
109
- expect(isZodSchema(undefined)).toBe(false);
110
- expect(isZodSchema("string")).toBe(false);
111
- expect(isZodSchema(123)).toBe(false);
112
- });
113
- it("returns false for objects without ~standard", () => {
114
- expect(isZodSchema({})).toBe(false);
115
- expect(isZodSchema({ foo: "bar" })).toBe(false);
116
- });
117
- it("returns false for objects with invalid ~standard", () => {
118
- expect(isZodSchema({ "~standard": null })).toBe(false);
119
- expect(isZodSchema({ "~standard": "not-object" })).toBe(false);
120
- expect(isZodSchema({ "~standard": {} })).toBe(false);
121
- expect(isZodSchema({ "~standard": { vendor: "not-zod" } })).toBe(false);
122
- });
123
- });
124
- describe("isZodFunctionSchema", () => {
125
- it("returns true for Zod 3 function schemas", () => {
126
- const schema = z3.function().args(z3.string()).returns(z3.void());
127
- expect(isZodFunctionSchema(schema)).toBe(true);
128
- expect(isZod3FunctionSchema(schema)).toBe(true);
129
- expect(isZod4FunctionSchema(schema)).toBe(false);
130
- });
131
- it("returns true for Zod 4 function schemas", () => {
132
- const schema = z4.function({
133
- input: z4.tuple([z4.string()]),
134
- output: z4.void(),
135
- });
136
- expect(isZodFunctionSchema(schema)).toBe(true);
137
- expect(isZod3FunctionSchema(schema)).toBe(false);
138
- expect(isZod4FunctionSchema(schema)).toBe(true);
139
- });
140
- it("returns false for non-function Zod schemas", () => {
141
- expect(isZodFunctionSchema(z3.string())).toBe(false);
142
- expect(isZodFunctionSchema(z3.object({ a: z3.string() }))).toBe(false);
143
- expect(isZodFunctionSchema(z4.string())).toBe(false);
144
- expect(isZodFunctionSchema(z4.object({ a: z4.string() }))).toBe(false);
145
- });
146
- it("returns false for non-Zod values", () => {
147
- expect(isZodFunctionSchema(null)).toBe(false);
148
- expect(isZodFunctionSchema({})).toBe(false);
149
- expect(isZodFunctionSchema("function")).toBe(false);
150
- });
151
- });
152
- describe("handleZodSchemaToJson", () => {
153
- describe("basic conversion", () => {
154
- it("converts Zod 3 schema to JSON Schema", () => {
155
- const schema = z3.object({
156
- name: z3.string(),
157
- age: z3.number(),
158
- });
159
- const result = handleZodSchemaToJson(schema);
160
- expect(result).toMatchObject({
161
- type: "object",
162
- properties: {
163
- name: { type: "string" },
164
- age: { type: "number" },
165
- },
166
- });
167
- });
168
- it("converts Zod 4 schema to JSON Schema", () => {
169
- const schema = z4.object({
170
- name: z4.string(),
171
- age: z4.number(),
172
- });
173
- const result = handleZodSchemaToJson(schema);
174
- expect(result).toMatchObject({
175
- type: "object",
176
- properties: {
177
- name: { type: "string" },
178
- age: { type: "number" },
179
- },
180
- });
181
- });
182
- });
183
- describe("reused schemas - no $ref references", () => {
184
- it("inlines reused Zod 3 schemas without any $ref in output", () => {
185
- // Define a shared schema that will be reused
186
- const dataSchema = z3.object({
187
- name: z3.string(),
188
- value: z3.number(),
189
- });
190
- // Use the same schema in multiple places
191
- const props = z3.object({
192
- data: z3.array(dataSchema),
193
- historicalData: z3.array(dataSchema),
194
- });
195
- const result = handleZodSchemaToJson(props);
196
- // Ensure there are no JSON Schema `$ref` keys anywhere in the produced schema.
197
- expect(hasKeyDeep(result, "$ref")).toBe(false);
198
- // Both arrays should have the full schema inline
199
- expect(result).toMatchObject({
200
- type: "object",
201
- properties: {
202
- data: {
203
- type: "array",
204
- items: {
205
- type: "object",
206
- properties: {
207
- name: { type: "string" },
208
- value: { type: "number" },
209
- },
210
- },
211
- },
212
- historicalData: {
213
- type: "array",
214
- items: {
215
- type: "object",
216
- properties: {
217
- name: { type: "string" },
218
- value: { type: "number" },
219
- },
220
- },
221
- },
222
- },
223
- });
224
- });
225
- it("inlines reused Zod 4 schemas without any $ref in output", () => {
226
- // Define a shared schema that will be reused
227
- const dataSchema = z4.object({
228
- name: z4.string(),
229
- value: z4.number(),
230
- });
231
- // Use the same schema in multiple places
232
- const props = z4.object({
233
- data: z4.array(dataSchema),
234
- historicalData: z4.array(dataSchema),
235
- });
236
- const result = handleZodSchemaToJson(props);
237
- expect(hasKeyDeep(result, "$ref")).toBe(false);
238
- // Both arrays should have the full schema inline
239
- expect(result).toMatchObject({
240
- type: "object",
241
- properties: {
242
- data: {
243
- type: "array",
244
- items: {
245
- type: "object",
246
- properties: {
247
- name: { type: "string" },
248
- value: { type: "number" },
249
- },
250
- },
251
- },
252
- historicalData: {
253
- type: "array",
254
- items: {
255
- type: "object",
256
- properties: {
257
- name: { type: "string" },
258
- value: { type: "number" },
259
- },
260
- },
261
- },
262
- },
263
- });
264
- });
265
- it("handles deeply nested reused Zod 3 schemas without any $ref", () => {
266
- const addressSchema = z3.object({
267
- street: z3.string(),
268
- city: z3.string(),
269
- });
270
- const personSchema = z3.object({
271
- name: z3.string(),
272
- homeAddress: addressSchema,
273
- workAddress: addressSchema,
274
- });
275
- const result = handleZodSchemaToJson(personSchema);
276
- expect(hasKeyDeep(result, "$ref")).toBe(false);
277
- expect(result).toMatchObject({
278
- type: "object",
279
- properties: {
280
- name: { type: "string" },
281
- homeAddress: {
282
- type: "object",
283
- properties: {
284
- street: { type: "string" },
285
- city: { type: "string" },
286
- },
287
- },
288
- workAddress: {
289
- type: "object",
290
- properties: {
291
- street: { type: "string" },
292
- city: { type: "string" },
293
- },
294
- },
295
- },
296
- });
297
- });
298
- it("handles deeply nested reused Zod 4 schemas without any $ref", () => {
299
- const addressSchema = z4.object({
300
- street: z4.string(),
301
- city: z4.string(),
302
- });
303
- const personSchema = z4.object({
304
- name: z4.string(),
305
- homeAddress: addressSchema,
306
- workAddress: addressSchema,
307
- });
308
- const result = handleZodSchemaToJson(personSchema);
309
- expect(hasKeyDeep(result, "$ref")).toBe(false);
310
- expect(result).toMatchObject({
311
- type: "object",
312
- properties: {
313
- name: { type: "string" },
314
- homeAddress: {
315
- type: "object",
316
- properties: {
317
- street: { type: "string" },
318
- city: { type: "string" },
319
- },
320
- },
321
- workAddress: {
322
- type: "object",
323
- properties: {
324
- street: { type: "string" },
325
- city: { type: "string" },
326
- },
327
- },
328
- },
329
- });
330
- });
331
- it("handles triple-nested reused Zod 4 schemas without any $ref", () => {
332
- const pointSchema = z4.object({
333
- x: z4.number(),
334
- y: z4.number(),
335
- });
336
- const lineSchema = z4.object({
337
- start: pointSchema,
338
- end: pointSchema,
339
- });
340
- const shapeSchema = z4.object({
341
- outline: z4.array(lineSchema),
342
- boundingBox: z4.object({
343
- topLeft: pointSchema,
344
- bottomRight: pointSchema,
345
- }),
346
- });
347
- const result = handleZodSchemaToJson(shapeSchema);
348
- expect(result).toMatchInlineSnapshot(`
349
- {
350
- "$schema": "https://json-schema.org/draft/2020-12/schema",
351
- "additionalProperties": false,
352
- "properties": {
353
- "boundingBox": {
354
- "additionalProperties": false,
355
- "properties": {
356
- "bottomRight": {
357
- "additionalProperties": false,
358
- "properties": {
359
- "x": {
360
- "type": "number",
361
- },
362
- "y": {
363
- "type": "number",
364
- },
365
- },
366
- "required": [
367
- "x",
368
- "y",
369
- ],
370
- "type": "object",
371
- },
372
- "topLeft": {
373
- "additionalProperties": false,
374
- "properties": {
375
- "x": {
376
- "type": "number",
377
- },
378
- "y": {
379
- "type": "number",
380
- },
381
- },
382
- "required": [
383
- "x",
384
- "y",
385
- ],
386
- "type": "object",
387
- },
388
- },
389
- "required": [
390
- "topLeft",
391
- "bottomRight",
392
- ],
393
- "type": "object",
394
- },
395
- "outline": {
396
- "items": {
397
- "additionalProperties": false,
398
- "properties": {
399
- "end": {
400
- "additionalProperties": false,
401
- "properties": {
402
- "x": {
403
- "type": "number",
404
- },
405
- "y": {
406
- "type": "number",
407
- },
408
- },
409
- "required": [
410
- "x",
411
- "y",
412
- ],
413
- "type": "object",
414
- },
415
- "start": {
416
- "additionalProperties": false,
417
- "properties": {
418
- "x": {
419
- "type": "number",
420
- },
421
- "y": {
422
- "type": "number",
423
- },
424
- },
425
- "required": [
426
- "x",
427
- "y",
428
- ],
429
- "type": "object",
430
- },
431
- },
432
- "required": [
433
- "start",
434
- "end",
435
- ],
436
- "type": "object",
437
- },
438
- "type": "array",
439
- },
440
- },
441
- "required": [
442
- "outline",
443
- "boundingBox",
444
- ],
445
- "type": "object",
446
- }
447
- `);
448
- expect(hasKeyDeep(result, "$ref")).toBe(false);
449
- });
450
- });
451
- describe("recursive schemas", () => {
452
- it("represents Zod 4 recursive schemas using $ref", () => {
453
- const nodeSchema = createRecursiveZod4NodeSchema();
454
- const result = handleZodSchemaToJson(nodeSchema);
455
- const schema = result;
456
- const properties = schema.properties;
457
- const next = properties?.next;
458
- const ref = next?.$ref;
459
- expect(hasKeyDeep(result, "$ref")).toBe(true);
460
- expect(result).toMatchObject({
461
- type: "object",
462
- properties: {
463
- next: {
464
- $ref: expect.stringMatching(/^#(\/.*)?$/),
465
- },
466
- },
467
- });
468
- expect(ref).toEqual(expect.stringMatching(/^#(\/.*)?$/));
469
- const resolved = typeof ref === "string" ? resolveJsonPointer(result, ref) : undefined;
470
- expect(resolved).toBe(result);
471
- expect(resolved).toMatchObject({
472
- type: "object",
473
- });
474
- });
475
- });
476
- describe("complex schemas", () => {
477
- it("handles optional fields in Zod 3", () => {
478
- const schema = z3.object({
479
- required: z3.string(),
480
- optional: z3.string().optional(),
481
- });
482
- const result = handleZodSchemaToJson(schema);
483
- expect(result).toMatchObject({
484
- type: "object",
485
- properties: {
486
- required: { type: "string" },
487
- optional: { type: "string" },
488
- },
489
- required: ["required"],
490
- });
491
- });
492
- it("handles optional fields in Zod 4", () => {
493
- const schema = z4.object({
494
- required: z4.string(),
495
- optional: z4.string().optional(),
496
- });
497
- const result = handleZodSchemaToJson(schema);
498
- expect(result).toMatchObject({
499
- type: "object",
500
- properties: {
501
- required: { type: "string" },
502
- optional: { type: "string" },
503
- },
504
- required: ["required"],
505
- });
506
- });
507
- it("handles enums in Zod 3", () => {
508
- const schema = z3.object({
509
- status: z3.enum(["active", "inactive", "pending"]),
510
- });
511
- const result = handleZodSchemaToJson(schema);
512
- expect(result).toMatchObject({
513
- type: "object",
514
- properties: {
515
- status: {
516
- type: "string",
517
- enum: ["active", "inactive", "pending"],
518
- },
519
- },
520
- });
521
- });
522
- it("handles enums in Zod 4", () => {
523
- const schema = z4.object({
524
- status: z4.enum(["active", "inactive", "pending"]),
525
- });
526
- const result = handleZodSchemaToJson(schema);
527
- expect(result).toMatchObject({
528
- type: "object",
529
- properties: {
530
- status: {
531
- type: "string",
532
- enum: ["active", "inactive", "pending"],
533
- },
534
- },
535
- });
536
- });
537
- it("handles descriptions in Zod 3", () => {
538
- const schema = z3.object({
539
- name: z3.string().describe("The user name"),
540
- });
541
- const result = handleZodSchemaToJson(schema);
542
- expect(result).toMatchObject({
543
- type: "object",
544
- properties: {
545
- name: {
546
- type: "string",
547
- description: "The user name",
548
- },
549
- },
550
- });
551
- });
552
- it("handles descriptions in Zod 4", () => {
553
- const schema = z4.object({
554
- name: z4.string().describe("The user name"),
555
- });
556
- const result = handleZodSchemaToJson(schema);
557
- expect(result).toMatchObject({
558
- type: "object",
559
- properties: {
560
- name: {
561
- type: "string",
562
- description: "The user name",
563
- },
564
- },
565
- });
566
- });
567
- });
568
- });
569
- describe("getZodFunctionArgs", () => {
570
- it("extracts args from Zod 3 function schema", () => {
571
- const schema = z3
572
- .function()
573
- .args(z3.string(), z3.number())
574
- .returns(z3.boolean());
575
- const args = getZodFunctionArgs(schema);
576
- expect(args).toBeDefined();
577
- // Zod 3 args is a ZodTuple - check the _def property exists
578
- expect(args._def.typeName).toBe("ZodTuple");
579
- });
580
- it("extracts args from Zod 4 function schema", () => {
581
- const schema = z4.function({
582
- input: z4.tuple([z4.string(), z4.number()]),
583
- output: z4.boolean(),
584
- });
585
- const args = getZodFunctionArgs(schema);
586
- expect(args).toBeDefined();
587
- // Zod 4 args is accessed via .def.input - it's the tuple schema
588
- expect(args).toHaveProperty("def");
589
- });
590
- it("throws for non-function schemas", () => {
591
- expect(() => getZodFunctionArgs(z3.string())).toThrow("Unable to determine parameters from zod function schema");
592
- expect(() => getZodFunctionArgs(z4.string())).toThrow("Unable to determine parameters from zod function schema");
593
- });
594
- it("throws for non-Zod values", () => {
595
- expect(() => getZodFunctionArgs({})).toThrow("Unable to determine parameters from zod function schema");
596
- });
597
- });
598
- describe("getZodFunctionReturns", () => {
599
- it("extracts returns from Zod 3 function schema", () => {
600
- const schema = z3
601
- .function()
602
- .args(z3.string())
603
- .returns(z3.object({ result: z3.boolean() }));
604
- const returns = getZodFunctionReturns(schema);
605
- expect(returns).toBeDefined();
606
- // Cast to access _def property on Zod 3 schema
607
- expect(returns._def.typeName).toBe("ZodObject");
608
- });
609
- it("extracts returns from Zod 4 function schema", () => {
610
- const schema = z4.function({
611
- input: z4.tuple([z4.string()]),
612
- output: z4.object({ result: z4.boolean() }),
613
- });
614
- const returns = getZodFunctionReturns(schema);
615
- expect(returns).toBeDefined();
616
- // Zod 4 returns is accessed via .def.output - it's the object schema
617
- expect(returns).toHaveProperty("def");
618
- });
619
- it("throws for non-function schemas", () => {
620
- expect(() => getZodFunctionReturns(z3.string())).toThrow("Unable to determine return type from zod function schema");
621
- expect(() => getZodFunctionReturns(z4.string())).toThrow("Unable to determine return type from zod function schema");
622
- });
623
- it("throws for non-Zod values", () => {
624
- expect(() => getZodFunctionReturns({})).toThrow("Unable to determine return type from zod function schema");
625
- });
626
- });
627
- });
628
- //# sourceMappingURL=zod.test.js.map