@tambo-ai/react 0.65.3 → 0.66.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 (346) hide show
  1. package/README.md +120 -20
  2. package/dist/{providers/hoc → hoc}/with-tambo-interactable.d.ts +2 -2
  3. package/dist/hoc/with-tambo-interactable.d.ts.map +1 -0
  4. package/dist/{providers/hoc → hoc}/with-tambo-interactable.js +29 -2
  5. package/dist/hoc/with-tambo-interactable.js.map +1 -0
  6. package/dist/hoc/with-tambo-interactable.test.d.ts +2 -0
  7. package/dist/hoc/with-tambo-interactable.test.d.ts.map +1 -0
  8. package/dist/hoc/with-tambo-interactable.test.js +192 -0
  9. package/dist/hoc/with-tambo-interactable.test.js.map +1 -0
  10. package/dist/hooks/index.d.ts +1 -1
  11. package/dist/hooks/index.d.ts.map +1 -1
  12. package/dist/hooks/index.js +2 -1
  13. package/dist/hooks/index.js.map +1 -1
  14. package/dist/hooks/use-current-message.d.ts +51 -7
  15. package/dist/hooks/use-current-message.d.ts.map +1 -1
  16. package/dist/hooks/use-current-message.js +50 -6
  17. package/dist/hooks/use-current-message.js.map +1 -1
  18. package/dist/hooks/use-current-message.test.d.ts +2 -0
  19. package/dist/hooks/use-current-message.test.d.ts.map +1 -0
  20. package/dist/hooks/use-current-message.test.js +264 -0
  21. package/dist/hooks/use-current-message.test.js.map +1 -0
  22. package/dist/index.d.ts +10 -8
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +7 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/mcp/index.d.ts +1 -1
  27. package/dist/mcp/index.d.ts.map +1 -1
  28. package/dist/mcp/index.js +2 -1
  29. package/dist/mcp/index.js.map +1 -1
  30. package/dist/mcp/mcp-hooks.d.ts +77 -6
  31. package/dist/mcp/mcp-hooks.d.ts.map +1 -1
  32. package/dist/mcp/mcp-hooks.js +104 -40
  33. package/dist/mcp/mcp-hooks.js.map +1 -1
  34. package/dist/mcp/mcp-hooks.test.js +83 -18
  35. package/dist/mcp/mcp-hooks.test.js.map +1 -1
  36. package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
  37. package/dist/mcp/tambo-mcp-provider.js +2 -1
  38. package/dist/mcp/tambo-mcp-provider.js.map +1 -1
  39. package/dist/model/component-metadata.d.ts +444 -14
  40. package/dist/model/component-metadata.d.ts.map +1 -1
  41. package/dist/model/component-metadata.js.map +1 -1
  42. package/dist/model/generate-component-response.d.ts +12 -1
  43. package/dist/model/generate-component-response.d.ts.map +1 -1
  44. package/dist/model/generate-component-response.js.map +1 -1
  45. package/dist/model/resource-info.d.ts +55 -0
  46. package/dist/model/resource-info.d.ts.map +1 -0
  47. package/dist/model/resource-info.js +3 -0
  48. package/dist/model/resource-info.js.map +1 -0
  49. package/dist/providers/index.d.ts +1 -1
  50. package/dist/providers/index.d.ts.map +1 -1
  51. package/dist/providers/index.js.map +1 -1
  52. package/dist/providers/tambo-component-provider.d.ts +4 -4
  53. package/dist/providers/tambo-component-provider.d.ts.map +1 -1
  54. package/dist/providers/tambo-component-provider.js.map +1 -1
  55. package/dist/providers/tambo-interactable-provider-partial-updates.test.js +87 -87
  56. package/dist/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
  57. package/dist/providers/tambo-interactable-provider.d.ts +2 -3
  58. package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
  59. package/dist/providers/tambo-interactable-provider.js +47 -41
  60. package/dist/providers/tambo-interactable-provider.js.map +1 -1
  61. package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js +9 -9
  62. package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
  63. package/dist/providers/tambo-interactables-additional-context.test.js +11 -11
  64. package/dist/providers/tambo-interactables-additional-context.test.js.map +1 -1
  65. package/dist/providers/tambo-registry-provider.d.ts +28 -7
  66. package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
  67. package/dist/providers/tambo-registry-provider.js +70 -181
  68. package/dist/providers/tambo-registry-provider.js.map +1 -1
  69. package/dist/providers/tambo-registry-provider.test.js +152 -30
  70. package/dist/providers/tambo-registry-provider.test.js.map +1 -1
  71. package/dist/providers/tambo-registry-schema-compat.test.d.ts +2 -0
  72. package/dist/providers/tambo-registry-schema-compat.test.d.ts.map +1 -0
  73. package/dist/providers/tambo-registry-schema-compat.test.js +616 -0
  74. package/dist/providers/tambo-registry-schema-compat.test.js.map +1 -0
  75. package/dist/providers/tambo-stubs.d.ts +2 -2
  76. package/dist/providers/tambo-stubs.d.ts.map +1 -1
  77. package/dist/providers/tambo-stubs.js +5 -0
  78. package/dist/providers/tambo-stubs.js.map +1 -1
  79. package/dist/providers/tambo-thread-input-provider.d.ts +1 -0
  80. package/dist/providers/tambo-thread-input-provider.d.ts.map +1 -1
  81. package/dist/providers/tambo-thread-input-provider.js +3 -3
  82. package/dist/providers/tambo-thread-input-provider.js.map +1 -1
  83. package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
  84. package/dist/providers/tambo-thread-provider.js.map +1 -1
  85. package/dist/providers/tambo-thread-provider.test.js +32 -36
  86. package/dist/providers/tambo-thread-provider.test.js.map +1 -1
  87. package/dist/schema/index.d.ts +6 -0
  88. package/dist/schema/index.d.ts.map +1 -0
  89. package/dist/schema/index.js +18 -0
  90. package/dist/schema/index.js.map +1 -0
  91. package/dist/schema/json-schema.d.ts +35 -0
  92. package/dist/schema/json-schema.d.ts.map +1 -0
  93. package/dist/schema/json-schema.js +103 -0
  94. package/dist/schema/json-schema.js.map +1 -0
  95. package/dist/schema/schema.d.ts +66 -0
  96. package/dist/schema/schema.d.ts.map +1 -0
  97. package/dist/schema/schema.js +192 -0
  98. package/dist/schema/schema.js.map +1 -0
  99. package/dist/schema/schema.test.d.ts +2 -0
  100. package/dist/schema/schema.test.d.ts.map +1 -0
  101. package/dist/schema/schema.test.js +41 -0
  102. package/dist/schema/schema.test.js.map +1 -0
  103. package/dist/schema/standard-schema.d.ts +21 -0
  104. package/dist/schema/standard-schema.d.ts.map +1 -0
  105. package/dist/schema/standard-schema.js +37 -0
  106. package/dist/schema/standard-schema.js.map +1 -0
  107. package/dist/schema/validate.d.ts +14 -0
  108. package/dist/schema/validate.d.ts.map +1 -0
  109. package/dist/schema/validate.js +148 -0
  110. package/dist/schema/validate.js.map +1 -0
  111. package/dist/schema/validate.test.d.ts +2 -0
  112. package/dist/schema/validate.test.d.ts.map +1 -0
  113. package/dist/schema/validate.test.js +128 -0
  114. package/dist/schema/validate.test.js.map +1 -0
  115. package/dist/schema/zod.d.ts +54 -0
  116. package/dist/schema/zod.d.ts.map +1 -0
  117. package/dist/schema/zod.js +135 -0
  118. package/dist/schema/zod.js.map +1 -0
  119. package/dist/testing/tools.d.ts +29 -15
  120. package/dist/testing/tools.d.ts.map +1 -1
  121. package/dist/testing/tools.js +64 -19
  122. package/dist/testing/tools.js.map +1 -1
  123. package/dist/util/generate-component.d.ts.map +1 -1
  124. package/dist/util/generate-component.js +3 -3
  125. package/dist/util/generate-component.js.map +1 -1
  126. package/dist/util/mcp-server-utils.d.ts +23 -0
  127. package/dist/util/mcp-server-utils.d.ts.map +1 -0
  128. package/dist/util/mcp-server-utils.js +107 -0
  129. package/dist/util/mcp-server-utils.js.map +1 -0
  130. package/dist/util/mcp-server-utils.test.d.ts +2 -0
  131. package/dist/util/mcp-server-utils.test.d.ts.map +1 -0
  132. package/dist/util/mcp-server-utils.test.js +287 -0
  133. package/dist/util/mcp-server-utils.test.js.map +1 -0
  134. package/dist/util/message-builder.d.ts +2 -1
  135. package/dist/util/message-builder.d.ts.map +1 -1
  136. package/dist/util/message-builder.js +54 -36
  137. package/dist/util/message-builder.js.map +1 -1
  138. package/dist/util/message-builder.test.js +500 -13
  139. package/dist/util/message-builder.test.js.map +1 -1
  140. package/dist/util/registry-validators.d.ts +26 -0
  141. package/dist/util/registry-validators.d.ts.map +1 -0
  142. package/dist/util/registry-validators.js +105 -0
  143. package/dist/util/registry-validators.js.map +1 -0
  144. package/dist/util/registry-validators.test.d.ts +2 -0
  145. package/dist/util/registry-validators.test.d.ts.map +1 -0
  146. package/dist/util/registry-validators.test.js +235 -0
  147. package/dist/util/registry-validators.test.js.map +1 -0
  148. package/dist/util/registry.d.ts +35 -7
  149. package/dist/util/registry.d.ts.map +1 -1
  150. package/dist/util/registry.js +60 -77
  151. package/dist/util/registry.js.map +1 -1
  152. package/dist/util/registry.test.d.ts +2 -0
  153. package/dist/util/registry.test.d.ts.map +1 -0
  154. package/dist/util/registry.test.js +204 -0
  155. package/dist/util/registry.test.js.map +1 -0
  156. package/dist/util/resource-validators.d.ts +16 -0
  157. package/dist/util/resource-validators.d.ts.map +1 -0
  158. package/dist/util/resource-validators.js +34 -0
  159. package/dist/util/resource-validators.js.map +1 -0
  160. package/dist/util/tool-caller.d.ts +2 -2
  161. package/dist/util/tool-caller.d.ts.map +1 -1
  162. package/dist/util/tool-caller.js +12 -4
  163. package/dist/util/tool-caller.js.map +1 -1
  164. package/esm/{providers/hoc → hoc}/with-tambo-interactable.d.ts +2 -2
  165. package/esm/hoc/with-tambo-interactable.d.ts.map +1 -0
  166. package/esm/{providers/hoc → hoc}/with-tambo-interactable.js +29 -2
  167. package/esm/hoc/with-tambo-interactable.js.map +1 -0
  168. package/esm/hoc/with-tambo-interactable.test.d.ts +2 -0
  169. package/esm/hoc/with-tambo-interactable.test.d.ts.map +1 -0
  170. package/esm/hoc/with-tambo-interactable.test.js +187 -0
  171. package/esm/hoc/with-tambo-interactable.test.js.map +1 -0
  172. package/esm/hooks/index.d.ts +1 -1
  173. package/esm/hooks/index.d.ts.map +1 -1
  174. package/esm/hooks/index.js +1 -1
  175. package/esm/hooks/index.js.map +1 -1
  176. package/esm/hooks/use-current-message.d.ts +51 -7
  177. package/esm/hooks/use-current-message.d.ts.map +1 -1
  178. package/esm/hooks/use-current-message.js +48 -5
  179. package/esm/hooks/use-current-message.js.map +1 -1
  180. package/esm/hooks/use-current-message.test.d.ts +2 -0
  181. package/esm/hooks/use-current-message.test.d.ts.map +1 -0
  182. package/esm/hooks/use-current-message.test.js +259 -0
  183. package/esm/hooks/use-current-message.test.js.map +1 -0
  184. package/esm/index.d.ts +10 -8
  185. package/esm/index.d.ts.map +1 -1
  186. package/esm/index.js +4 -2
  187. package/esm/index.js.map +1 -1
  188. package/esm/mcp/index.d.ts +1 -1
  189. package/esm/mcp/index.d.ts.map +1 -1
  190. package/esm/mcp/index.js +1 -1
  191. package/esm/mcp/index.js.map +1 -1
  192. package/esm/mcp/mcp-hooks.d.ts +77 -6
  193. package/esm/mcp/mcp-hooks.d.ts.map +1 -1
  194. package/esm/mcp/mcp-hooks.js +103 -40
  195. package/esm/mcp/mcp-hooks.js.map +1 -1
  196. package/esm/mcp/mcp-hooks.test.js +84 -19
  197. package/esm/mcp/mcp-hooks.test.js.map +1 -1
  198. package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
  199. package/esm/mcp/tambo-mcp-provider.js +2 -1
  200. package/esm/mcp/tambo-mcp-provider.js.map +1 -1
  201. package/esm/model/component-metadata.d.ts +444 -14
  202. package/esm/model/component-metadata.d.ts.map +1 -1
  203. package/esm/model/component-metadata.js.map +1 -1
  204. package/esm/model/generate-component-response.d.ts +12 -1
  205. package/esm/model/generate-component-response.d.ts.map +1 -1
  206. package/esm/model/generate-component-response.js.map +1 -1
  207. package/esm/model/resource-info.d.ts +55 -0
  208. package/esm/model/resource-info.d.ts.map +1 -0
  209. package/esm/model/resource-info.js +2 -0
  210. package/esm/model/resource-info.js.map +1 -0
  211. package/esm/providers/index.d.ts +1 -1
  212. package/esm/providers/index.d.ts.map +1 -1
  213. package/esm/providers/index.js.map +1 -1
  214. package/esm/providers/tambo-component-provider.d.ts +4 -4
  215. package/esm/providers/tambo-component-provider.d.ts.map +1 -1
  216. package/esm/providers/tambo-component-provider.js.map +1 -1
  217. package/esm/providers/tambo-interactable-provider-partial-updates.test.js +1 -1
  218. package/esm/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
  219. package/esm/providers/tambo-interactable-provider.d.ts +2 -3
  220. package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
  221. package/esm/providers/tambo-interactable-provider.js +44 -38
  222. package/esm/providers/tambo-interactable-provider.js.map +1 -1
  223. package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js +3 -3
  224. package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
  225. package/esm/providers/tambo-interactables-additional-context.test.js +3 -3
  226. package/esm/providers/tambo-interactables-additional-context.test.js.map +1 -1
  227. package/esm/providers/tambo-registry-provider.d.ts +28 -7
  228. package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
  229. package/esm/providers/tambo-registry-provider.js +67 -175
  230. package/esm/providers/tambo-registry-provider.js.map +1 -1
  231. package/esm/providers/tambo-registry-provider.test.js +148 -26
  232. package/esm/providers/tambo-registry-provider.test.js.map +1 -1
  233. package/esm/providers/tambo-registry-schema-compat.test.d.ts +2 -0
  234. package/esm/providers/tambo-registry-schema-compat.test.d.ts.map +1 -0
  235. package/esm/providers/tambo-registry-schema-compat.test.js +578 -0
  236. package/esm/providers/tambo-registry-schema-compat.test.js.map +1 -0
  237. package/esm/providers/tambo-stubs.d.ts +2 -2
  238. package/esm/providers/tambo-stubs.d.ts.map +1 -1
  239. package/esm/providers/tambo-stubs.js +5 -0
  240. package/esm/providers/tambo-stubs.js.map +1 -1
  241. package/esm/providers/tambo-thread-input-provider.d.ts +1 -0
  242. package/esm/providers/tambo-thread-input-provider.d.ts.map +1 -1
  243. package/esm/providers/tambo-thread-input-provider.js +3 -3
  244. package/esm/providers/tambo-thread-input-provider.js.map +1 -1
  245. package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
  246. package/esm/providers/tambo-thread-provider.js.map +1 -1
  247. package/esm/providers/tambo-thread-provider.test.js +24 -28
  248. package/esm/providers/tambo-thread-provider.test.js.map +1 -1
  249. package/esm/schema/index.d.ts +6 -0
  250. package/esm/schema/index.d.ts.map +1 -0
  251. package/esm/schema/index.js +6 -0
  252. package/esm/schema/index.js.map +1 -0
  253. package/esm/schema/json-schema.d.ts +35 -0
  254. package/esm/schema/json-schema.d.ts.map +1 -0
  255. package/esm/schema/json-schema.js +98 -0
  256. package/esm/schema/json-schema.js.map +1 -0
  257. package/esm/schema/schema.d.ts +66 -0
  258. package/esm/schema/schema.d.ts.map +1 -0
  259. package/esm/schema/schema.js +185 -0
  260. package/esm/schema/schema.js.map +1 -0
  261. package/esm/schema/schema.test.d.ts +2 -0
  262. package/esm/schema/schema.test.d.ts.map +1 -0
  263. package/esm/schema/schema.test.js +39 -0
  264. package/esm/schema/schema.test.js.map +1 -0
  265. package/esm/schema/standard-schema.d.ts +21 -0
  266. package/esm/schema/standard-schema.d.ts.map +1 -0
  267. package/esm/schema/standard-schema.js +34 -0
  268. package/esm/schema/standard-schema.js.map +1 -0
  269. package/esm/schema/validate.d.ts +14 -0
  270. package/esm/schema/validate.d.ts.map +1 -0
  271. package/esm/schema/validate.js +145 -0
  272. package/esm/schema/validate.js.map +1 -0
  273. package/esm/schema/validate.test.d.ts +2 -0
  274. package/esm/schema/validate.test.d.ts.map +1 -0
  275. package/esm/schema/validate.test.js +126 -0
  276. package/esm/schema/validate.test.js.map +1 -0
  277. package/esm/schema/zod.d.ts +54 -0
  278. package/esm/schema/zod.d.ts.map +1 -0
  279. package/esm/schema/zod.js +124 -0
  280. package/esm/schema/zod.js.map +1 -0
  281. package/esm/testing/tools.d.ts +29 -15
  282. package/esm/testing/tools.d.ts.map +1 -1
  283. package/esm/testing/tools.js +62 -16
  284. package/esm/testing/tools.js.map +1 -1
  285. package/esm/util/generate-component.d.ts.map +1 -1
  286. package/esm/util/generate-component.js +3 -3
  287. package/esm/util/generate-component.js.map +1 -1
  288. package/esm/util/mcp-server-utils.d.ts +23 -0
  289. package/esm/util/mcp-server-utils.d.ts.map +1 -0
  290. package/esm/util/mcp-server-utils.js +102 -0
  291. package/esm/util/mcp-server-utils.js.map +1 -0
  292. package/esm/util/mcp-server-utils.test.d.ts +2 -0
  293. package/esm/util/mcp-server-utils.test.d.ts.map +1 -0
  294. package/esm/util/mcp-server-utils.test.js +285 -0
  295. package/esm/util/mcp-server-utils.test.js.map +1 -0
  296. package/esm/util/message-builder.d.ts +2 -1
  297. package/esm/util/message-builder.d.ts.map +1 -1
  298. package/esm/util/message-builder.js +54 -36
  299. package/esm/util/message-builder.js.map +1 -1
  300. package/esm/util/message-builder.test.js +500 -13
  301. package/esm/util/message-builder.test.js.map +1 -1
  302. package/esm/util/registry-validators.d.ts +26 -0
  303. package/esm/util/registry-validators.d.ts.map +1 -0
  304. package/esm/util/registry-validators.js +100 -0
  305. package/esm/util/registry-validators.js.map +1 -0
  306. package/esm/util/registry-validators.test.d.ts +2 -0
  307. package/esm/util/registry-validators.test.d.ts.map +1 -0
  308. package/esm/util/registry-validators.test.js +233 -0
  309. package/esm/util/registry-validators.test.js.map +1 -0
  310. package/esm/util/registry.d.ts +35 -7
  311. package/esm/util/registry.d.ts.map +1 -1
  312. package/esm/util/registry.js +57 -73
  313. package/esm/util/registry.js.map +1 -1
  314. package/esm/util/registry.test.d.ts +2 -0
  315. package/esm/util/registry.test.d.ts.map +1 -0
  316. package/esm/util/registry.test.js +169 -0
  317. package/esm/util/registry.test.js.map +1 -0
  318. package/esm/util/resource-validators.d.ts +16 -0
  319. package/esm/util/resource-validators.d.ts.map +1 -0
  320. package/esm/util/resource-validators.js +30 -0
  321. package/esm/util/resource-validators.js.map +1 -0
  322. package/esm/util/tool-caller.d.ts +2 -2
  323. package/esm/util/tool-caller.d.ts.map +1 -1
  324. package/esm/util/tool-caller.js +12 -4
  325. package/esm/util/tool-caller.js.map +1 -1
  326. package/package.json +13 -8
  327. package/dist/providers/hoc/with-tambo-interactable.d.ts.map +0 -1
  328. package/dist/providers/hoc/with-tambo-interactable.js.map +0 -1
  329. package/dist/util/validate-zod-schema.d.ts +0 -10
  330. package/dist/util/validate-zod-schema.d.ts.map +0 -1
  331. package/dist/util/validate-zod-schema.js +0 -100
  332. package/dist/util/validate-zod-schema.js.map +0 -1
  333. package/dist/util/validate-zod-schema.test.d.ts +0 -2
  334. package/dist/util/validate-zod-schema.test.d.ts.map +0 -1
  335. package/dist/util/validate-zod-schema.test.js +0 -96
  336. package/dist/util/validate-zod-schema.test.js.map +0 -1
  337. package/esm/providers/hoc/with-tambo-interactable.d.ts.map +0 -1
  338. package/esm/providers/hoc/with-tambo-interactable.js.map +0 -1
  339. package/esm/util/validate-zod-schema.d.ts +0 -10
  340. package/esm/util/validate-zod-schema.d.ts.map +0 -1
  341. package/esm/util/validate-zod-schema.js +0 -97
  342. package/esm/util/validate-zod-schema.js.map +0 -1
  343. package/esm/util/validate-zod-schema.test.d.ts +0 -2
  344. package/esm/util/validate-zod-schema.test.d.ts.map +0 -1
  345. package/esm/util/validate-zod-schema.test.js +0 -94
  346. package/esm/util/validate-zod-schema.test.js.map +0 -1
@@ -1,15 +1,26 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
1
2
  import TamboAI from "@tambo-ai/typescript-sdk";
2
3
  import { JSONSchema7 } from "json-schema";
3
4
  import { ComponentType } from "react";
4
- import z from "zod/v3";
5
- import type zodToJsonSchema from "zod-to-json-schema";
5
+ import { ZodFunction as Zod3Function, ZodTuple as Zod3FunctionArgs, ZodType as Zod3FunctionReturns, infer as Zod3Infer } from "zod/v3";
6
+ import { $ZodFunction as Zod4Function, $ZodFunctionArgs as Zod4FunctionArgs, $ZodType as Zod4FunctionReturns, infer as Zod4Infer } from "zod/v4/core";
7
+ /**
8
+ * A schema type that accepts either a Standard Schema compliant validator
9
+ * (e.g., Zod, Valibot, ArkType) or a raw JSON Schema object.
10
+ *
11
+ * Standard Schema is a specification that provides a unified interface for
12
+ * TypeScript validation libraries. Libraries like Zod implement this spec,
13
+ * allowing us to accept any compliant validator without depending on a specific library.
14
+ * @see https://standardschema.dev/
15
+ */
16
+ export type SupportedSchema = StandardSchemaV1 | JSONSchema7;
6
17
  /** Extension of the ToolParameters interface from Tambo AI to include JSONSchema definition */
7
18
  export type ParameterSpec = TamboAI.ToolParameters & {
8
- schema?: ReturnType<typeof zodToJsonSchema>;
19
+ schema?: JSONSchema7;
9
20
  };
10
21
  /**
11
22
  * Extends the base ContextTool interface from Tambo AI to include schema information
12
- * for parameter validation using zod-to-json-schema.
23
+ * for parameter validation.
13
24
  */
14
25
  export interface ComponentContextToolMetadata extends TamboAI.ComponentContextToolMetadata {
15
26
  parameters: ParameterSpec[];
@@ -23,29 +34,229 @@ export interface RegisteredComponent extends TamboAI.AvailableComponent {
23
34
  loadingComponent?: ComponentType<any>;
24
35
  }
25
36
  export type ComponentRegistry = Record<string, RegisteredComponent>;
26
- export type TamboToolRegistry = Record<string, TamboTool>;
37
+ export type TamboToolRegistry = Record<string, TamboTool | TamboToolWithToolSchema>;
27
38
  /**
28
39
  * A JSON Schema that is compatible with the MCP.
29
- * This is a simplified JSON Schema that is compatible with the MCPClient and the toolSchema.
40
+ * This is a simplified JSON Schema that is compatible with the MCPClient and the tool's inputSchema.
30
41
  *
31
42
  * Do not export this type from the SDK.
32
43
  */
33
- export type JSONSchemaLite = ReturnType<typeof zodToJsonSchema> & {
44
+ export type JSONSchemaLite = JSONSchema7 & {
34
45
  description?: string;
35
46
  };
36
- export interface TamboTool<Args extends z.ZodTuple<any, any> = z.ZodTuple<any, any>, Returns extends z.ZodTypeAny = z.ZodTypeAny> {
47
+ type MaybeAsync<T> = T | Promise<T>;
48
+ /**
49
+ * TamboTool is a type that represents a tool that can be registered with Tambo.
50
+ *
51
+ * It is preferable to use the `defineTool` helper function to create tools, as
52
+ * it provides better type inference and safety.
53
+ * @example
54
+ * ```ts
55
+ * import { TamboTool, defineTool } from "@tambo-ai/react";
56
+ * import { z } from "zod";
57
+ *
58
+ * const locationToLatLon = defineTool({
59
+ * name: "location_to_latlon",
60
+ * description:
61
+ * "Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.",
62
+ * tool: async ({ location }) => getLatLonFromLocation(location),
63
+ * inputSchema: z.object({
64
+ * location: z.string(),
65
+ * }),
66
+ * outputSchema: z.object({
67
+ * lat: z.number(),
68
+ * lon: z.number(),
69
+ * }),
70
+ * });
71
+ * ```
72
+ * Alternatively, you manually construct a TamboTool with type safety by passing
73
+ * the expected parameter and return types as generics:
74
+ * ```ts
75
+ * import { TamboTool } from "@tambo-ai/react";
76
+ * import { z } from "zod";
77
+ *
78
+ * const locationToLatLon: TamboTool<{ location: string }, { lat: number; lon: number }> = {
79
+ * name: "location_to_latlon",
80
+ * description:
81
+ * "Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.",
82
+ * tool: async ({ location }) => getLatLonFromLocation(location),
83
+ * inputSchema: z.object({
84
+ * location: z.string(),
85
+ * }),
86
+ * outputSchema: z.object({
87
+ * lat: z.number(),
88
+ * lon: z.number(),
89
+ * }),
90
+ * });
91
+ * ```
92
+ */
93
+ export interface TamboTool<Params = any, Returns = any, Rest extends any[] = []> {
94
+ /**
95
+ * Unique identifier for the tool
96
+ */
37
97
  name: string;
98
+ /**
99
+ * Description of what the tool does - used by AI to determine when to use it
100
+ */
38
101
  description: string;
39
- tool: (...args: z.infer<Args>) => z.infer<Returns>;
40
- toolSchema: z.ZodFunction<Args, Returns> | JSONSchemaLite;
102
+ /**
103
+ * Optional human-readable name of the tool for display purposes.
104
+ */
105
+ title?: string;
106
+ /**
107
+ * Optional properties describing tool behavior
108
+ */
109
+ annotations?: {
110
+ /**
111
+ * An array indicating the intended audience(s) for this resource. Valid
112
+ * values are "user" and "assistant". For example, ["user", "assistant"]
113
+ * indicates content useful for both.
114
+ */
115
+ audience: ("user" | "assistant")[];
116
+ /**
117
+ * A number from 0.0 to 1.0 indicating the importance of this resource. A
118
+ * value of 1 means "most important" (effectively required), while 0 means
119
+ * "least important" (entirely optional).
120
+ */
121
+ priority: number;
122
+ /**
123
+ * An ISO 8601 formatted timestamp indicating when the resource was last
124
+ * modified (e.g., "2025-01-12T15:00:58Z").
125
+ */
126
+ lastModified: string;
127
+ };
128
+ /**
129
+ * The function that implements the tool's logic. This function will be called
130
+ * by Tambo when the model decides to invoke the tool.
131
+ * @param params - The input parameters for the tool. These are validated
132
+ * against the inputSchema before being passed so are guaranteed to be correct
133
+ * when called by the model.
134
+ * @returns The result of the tool execution, which can be a value or a
135
+ * Promise resolving to a value
136
+ */
137
+ tool: (params: Params, ...rest: Rest) => MaybeAsync<Returns>;
138
+ /**
139
+ * The schema for the tool's input parameters. This can be a validator from
140
+ * any Standard Schema compliant library (Zod, Valibot, ArkType, etc.) or a
141
+ * raw JSON Schema object.
142
+ *
143
+ * This schema is used to validate and parse the parameters before passing
144
+ * them to the tool function.
145
+ */
146
+ inputSchema: SupportedSchema | unknown;
147
+ /**
148
+ * The schema for the tool's output/return value. This can be any Standard Schema
149
+ * compliant validator (Zod, Valibot, ArkType, etc.) or a raw JSON Schema object.
150
+ *
151
+ * This is used to inform the model about the structure of the tool's return value
152
+ * and is not used for runtime validation at this stage.
153
+ */
154
+ outputSchema: SupportedSchema | unknown;
41
155
  /**
42
156
  * Optional function to transform the tool's return value into an array of content parts.
43
157
  * If not provided, the return value will be converted to a string and wrapped in a text content part.
44
158
  * @param result - The result returned by the tool function
45
159
  * @returns An array of content parts to be sent back to the AI
46
160
  */
47
- transformToContent?: (result: z.infer<Returns>) => Promise<TamboAI.Beta.Threads.ChatCompletionContentPart[]> | TamboAI.Beta.Threads.ChatCompletionContentPart[];
161
+ transformToContent?: (result: any) => Promise<TamboAI.Beta.Threads.ChatCompletionContentPart[]> | TamboAI.Beta.Threads.ChatCompletionContentPart[];
48
162
  }
163
+ /**
164
+ * Simplified interface for tools using the deprecated toolSchema format.
165
+ * This interface uses simple `any` types to avoid complex type instantiation.
166
+ * Use `defineTamboTool()` for full type inference when creating tools.
167
+ * @deprecated Use TamboTool with `inputSchema`/`outputSchema` instead.
168
+ */
169
+ export type TamboToolWithToolSchema<Args extends any[] = any[], Returns = any> = Omit<TamboTool, "tool" | "inputSchema" | "outputSchema"> & {
170
+ tool: (...args: Args) => MaybeAsync<Returns>;
171
+ /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */
172
+ toolSchema: unknown;
173
+ };
174
+ /**
175
+ * TamboTool is a type that represents a tool that can be registered with Tambo.
176
+ *
177
+ * It is preferable to use the `defineTool` helper function to create tools, as
178
+ * it provides better type inference and safety.
179
+ * @example
180
+ * ```ts
181
+ * import { TamboTool, defineTool } from "@tambo-ai/react";
182
+ * import { z } from "zod";
183
+ *
184
+ * const locationToLatLon = defineTool({
185
+ * name: "location_to_latlon",
186
+ * description:
187
+ * "Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.",
188
+ * tool: async ({ location }) => getLatLonFromLocation(location),
189
+ * inputSchema: z.object({
190
+ * location: z.string(),
191
+ * }),
192
+ * outputSchema: z.object({
193
+ * lat: z.number(),
194
+ * lon: z.number(),
195
+ * }),
196
+ * });
197
+ * ```
198
+ * Alternatively, you manually construct a TamboTool with type safety by passing
199
+ * the expected parameter and return types as generics:
200
+ * ```ts
201
+ * import { TamboTool } from "@tambo-ai/react";
202
+ * import { z } from "zod";
203
+ *
204
+ * const locationToLatLon: TamboTool<{ location: string }, { lat: number; lon: number }> = {
205
+ * name: "location_to_latlon",
206
+ * description:
207
+ * "Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.",
208
+ * tool: async ({ location }) => getLatLonFromLocation(location),
209
+ * inputSchema: z.object({
210
+ * location: z.string(),
211
+ * }),
212
+ * outputSchema: z.object({
213
+ * lat: z.number(),
214
+ * lon: z.number(),
215
+ * }),
216
+ * });
217
+ * ```
218
+ */
219
+ export type TamboToolBase<Params = any, Returns = any> = TamboToolWithToolSchema | TamboTool<Params, Returns>;
220
+ /**
221
+ * A tool that uses JSON Schema compliant input and output schemas.
222
+ * This does not provide type safety for the tool's parameters and return value.
223
+ * @internal
224
+ */
225
+ export type TamboToolJSONSchema<Args extends unknown[] = unknown[], Returns = unknown> = Omit<TamboTool<Args, Returns>, "tool" | "inputSchema" | "outputSchema"> & {
226
+ tool: (...args: Args) => MaybeAsync<Returns>;
227
+ inputSchema: JSONSchemaLite;
228
+ outputSchema: JSONSchemaLite;
229
+ };
230
+ /**
231
+ * A tool that could not be matched to any known schema types.
232
+ * This means type safety cannot be guaranteed.
233
+ * @internal
234
+ */
235
+ export type TamboToolUnknown = Omit<TamboTool, "tool" | "inputSchema" | "outputSchema"> & {
236
+ tool: (...args: unknown[]) => MaybeAsync<unknown>;
237
+ inputSchema: unknown;
238
+ outputSchema: unknown;
239
+ };
240
+ /**
241
+ * A tool that uses Standard Schema compliant input and output schemas.
242
+ * This provides full type safety for the tool's parameters and return value.
243
+ * @internal
244
+ */
245
+ export type TamboToolStandardSchema<Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1> = Omit<TamboTool<StandardSchemaV1.InferOutput<Input>, StandardSchemaV1.InferOutput<Output>>, "tool" | "inputSchema" | "outputSchema"> & {
246
+ tool: (...args: [StandardSchemaV1.InferOutput<Input>]) => MaybeAsync<StandardSchemaV1.InferOutput<Output>>;
247
+ inputSchema: Input;
248
+ outputSchema: Output;
249
+ };
250
+ type TamboToolZod3Function<Args extends Zod3FunctionArgs, Returns extends Zod3FunctionReturns> = Omit<TamboToolWithToolSchema<Zod3Infer<Args>, Zod3Infer<Returns>>, "toolSchema"> & {
251
+ tool: (...args: Zod3Infer<Args>) => MaybeAsync<Zod3Infer<Returns>>;
252
+ /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */
253
+ toolSchema: Zod3Function<Args, Returns>;
254
+ };
255
+ type TamboToolZod4Function<Args extends Zod4FunctionArgs, Returns extends Zod4FunctionReturns> = Omit<TamboToolWithToolSchema<Zod4Infer<Args>, Zod4Infer<Returns>>, "toolSchema"> & {
256
+ tool: (...args: Zod4Infer<Args>) => MaybeAsync<Zod4Infer<Returns>>;
257
+ /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */
258
+ toolSchema: Zod4Function<Args, Returns>;
259
+ };
49
260
  export type TamboToolAssociations = Record<string, string[]>;
50
261
  /**
51
262
  * A component that can be registered with the TamboRegistryProvider.
@@ -76,10 +287,27 @@ export interface TamboComponent {
76
287
  */
77
288
  component: ComponentType<any>;
78
289
  /**
79
- * A zod schema for the component props. (Recommended)
290
+ * Schema describing the component's props. Accepts any Standard Schema
291
+ * compliant validator (Zod, Valibot, ArkType, etc.) or a raw JSON Schema
292
+ * object.
293
+ *
80
294
  * Either this or propsDefinition must be provided, but not both.
295
+ * @example
296
+ * ```typescript
297
+ * import { z } from "zod/v4";
298
+ *
299
+ * const component: TamboComponent = {
300
+ * name: "MyComponent",
301
+ * description: "A sample component",
302
+ * component: MyComponent,
303
+ * propsSchema: z.object({
304
+ * title: z.string(),
305
+ * count: z.number().optional()
306
+ * })
307
+ * };
308
+ * ```
81
309
  */
82
- propsSchema?: z.ZodTypeAny | JSONSchema7;
310
+ propsSchema?: SupportedSchema;
83
311
  /**
84
312
  * The props definition of the component as a JSON object.
85
313
  * Either this or propsSchema must be provided, but not both.
@@ -89,6 +317,208 @@ export interface TamboComponent {
89
317
  /** The loading component to render while the component is loading */
90
318
  loadingComponent?: ComponentType<any>;
91
319
  /** The tools that are associated with the component */
92
- associatedTools?: TamboTool[];
320
+ associatedTools?: (TamboTool | TamboToolWithToolSchema)[];
321
+ }
322
+ export interface RegisterToolsFn {
323
+ /**
324
+ * Registers one or more Tambo tools.
325
+ * @param tools - An array of Tambo tools to register
326
+ */
327
+ (tools: TamboTool[]): void;
328
+ (tools: (TamboTool | TamboToolWithToolSchema)[]): void;
329
+ }
330
+ /**
331
+ * Function interface for registering a Tambo tool with full type inference.
332
+ * This function has multiple overloads to handle different schema types. This
333
+ * is a utility function and does not perform any runtime logic.
334
+ */
335
+ export interface RegisterToolFn {
336
+ /**
337
+ * @deprecated Use `inputSchema`/`outputSchema` instead. toolSchema is deprecated
338
+ * and will be removed in future versions.
339
+ * @example
340
+ * ```diff
341
+ * import { z } from "zod/v3";
342
+ * const myTool = defineTamboTool({
343
+ * ...
344
+ * - toolSchema: z.function()
345
+ * - .arguments(z.tuple([z.string()]))
346
+ * - .returns(z.number()),
347
+ * + inputSchema: z.object({
348
+ * + input: z.string().describe("Input description")
349
+ * + }),
350
+ * + outputSchema: z.number().describe("Result description"),
351
+ * });
352
+ */
353
+ <Args extends Zod3FunctionArgs, Returns extends Zod3FunctionReturns>(tool: TamboToolZod3Function<Args, Returns>, warnOnOverwrite?: boolean): void;
354
+ /**
355
+ * @deprecated Use `inputSchema`/`outputSchema` instead. toolSchema is deprecated
356
+ * and will be removed in future versions.
357
+ * @example
358
+ * ```diff
359
+ * import { z } from "zod/v4";
360
+ * const myTool = defineTamboTool({
361
+ * ...
362
+ * - toolSchema: z.function({
363
+ * - input: z.tuple([z.string()]),
364
+ * - output: z.number(),
365
+ * - }),
366
+ * + inputSchema: z.object({
367
+ * + input: z.string().describe("Input description")
368
+ * + }),
369
+ * + outputSchema: z.number().describe("Result description"),
370
+ * });
371
+ */
372
+ <Args extends Zod4FunctionArgs, Returns extends Zod4FunctionReturns>(tool: TamboToolZod4Function<Args, Returns>, warnOnOverwrite?: boolean): void;
373
+ (tool: TamboToolWithToolSchema, warnOnOverwrite?: boolean): void;
374
+ <Args extends StandardSchemaV1, Returns extends StandardSchemaV1>(tool: TamboTool<StandardSchemaV1.InferOutput<Args>, StandardSchemaV1.InferOutput<Returns>>, warnOnOverwrite?: boolean): void;
375
+ <Args extends any[], Returns = any>(tool: TamboToolJSONSchema<Args, Returns>, warnOnOverwrite?: boolean): void;
376
+ (tool: TamboToolUnknown, warnOnOverwrite?: boolean): void;
377
+ (tool: TamboTool, warnOnOverwrite?: boolean): void;
378
+ }
379
+ /**
380
+ * Function interface for defining a Tambo tool with full type inference. This
381
+ * function has multiple overloads to handle different schema types. This is a
382
+ * utility function and does not perform any runtime logic.
383
+ */
384
+ export interface DefineToolFn {
385
+ /**
386
+ * Provides type safety for defining a Tambo Tool.
387
+ *
388
+ * Tambo uses the [standard-schema.dev](https://standard-schema.dev) spec which means you can use any Standard Schema
389
+ * compliant validator (Zod, Valibot, ArkType, etc.). This definition ensures the input and output types are correctly
390
+ * inferred from the provided schemas.
391
+ * @example
392
+ * ```typescript
393
+ * import { z } from "zod/v4";
394
+ *
395
+ * const myTool = defineTamboTool({
396
+ * // ...
397
+ * inputSchema: z.object({
398
+ * input: z.string().describe("Input description")
399
+ * }),
400
+ * outputSchema: z.number().describe("Result description"),
401
+ * });
402
+ * ```
403
+ * @see {@link https://standard-schema.dev/}
404
+ * @param tool The tool definition to register
405
+ * @returns The registered tool definition
406
+ */
407
+ <Input extends StandardSchemaV1, Output extends StandardSchemaV1>(tool: TamboToolStandardSchema<Input, Output>): TamboTool<StandardSchemaV1.InferOutput<Input>, StandardSchemaV1.InferOutput<Output>>;
408
+ /**
409
+ * Provides type safety for defining a Tambo Tool.
410
+ *
411
+ * This tool uses the deprecated `toolSchema` format which uses a zod function schema. If you are using a validation
412
+ * library that implements StandardSchema.dev, please switch to using separate `inputSchema` and `outputSchema`
413
+ * properties instead. See example below.
414
+ * @example
415
+ * ```diff
416
+ * import { z } from "zod/v4";
417
+ *
418
+ * const myTool = defineTamboTool({
419
+ * // ...
420
+ * - toolSchema: z.function({
421
+ * - input: z.tuple([z.string()]),
422
+ * - output: z.number(),
423
+ * - })
424
+ * + inputSchema: z.object({
425
+ * + input: z.string().describe("Input description")
426
+ * + }),
427
+ * + outputSchema: z.number().describe("Result description"),
428
+ * });
429
+ * @see {@link https://standard-schema.dev/}
430
+ * @param tool The tool definition to register
431
+ * @returns The registered tool definition
432
+ * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.
433
+ * Note that use of `toolSchema` will be removed in a future release.
434
+ * ```
435
+ */
436
+ <Args extends Zod3FunctionArgs, Returns extends Zod3FunctionReturns>(tool: TamboToolZod3Function<Args, Returns>): TamboToolZod3Function<Args, Returns>;
437
+ /**
438
+ * Provides type safety for defining a Tambo Tool.
439
+ *
440
+ * This tool uses the deprecated `toolSchema` format which uses a zod function schema. If you are using a validation
441
+ * library that implements standard-schema.dev, please switch to using separate `inputSchema` and `outputSchema`
442
+ * properties instead. See example below.
443
+ * @param tool The tool definition to register
444
+ * @returns The registered tool definition
445
+ * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.
446
+ * Note that use of `toolSchema` will be removed in a future release.
447
+ * @example
448
+ * ```diff
449
+ * import { z } from "zod/v4";
450
+ *
451
+ * const myTool = defineTamboTool({
452
+ * // ...
453
+ * - toolSchema: z.function({
454
+ * - input: z.tuple([z.string()]),
455
+ * - output: z.number(),
456
+ * - })
457
+ * + inputSchema: z.object({
458
+ * + input: z.string().describe("Input description")
459
+ * + }),
460
+ * + outputSchema: z.number().describe("Result description"),
461
+ * });
462
+ * ```
463
+ */
464
+ <Args extends Zod4FunctionArgs, Returns extends Zod4FunctionReturns>(tool: TamboToolZod4Function<Args, Returns>): TamboToolZod4Function<Args, Returns>;
465
+ /**
466
+ * Provides type safety for defining a Tambo Tool.
467
+ *
468
+ * This tool uses the deprecated `toolSchema` property which uses a zod function schema. If you are using a validation
469
+ * library that implements standard-schema.dev, please switch to using separate `inputSchema` and `outputSchema`
470
+ * properties instead. See example below.
471
+ * @param tool The tool definition to register
472
+ * @returns The registered tool definition
473
+ * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.
474
+ * Note that use of `toolSchema` will be removed in a future release.
475
+ * @example
476
+ * ```diff
477
+ * import { z } from "zod/v4";
478
+ *
479
+ * const myTool = defineTamboTool({
480
+ * // ...
481
+ * - toolSchema: { ... }
482
+ * + inputSchema: z.object({ ... }),
483
+ * + outputSchema: z.number(),
484
+ * });
485
+ * ```
486
+ */
487
+ (tool: TamboToolWithToolSchema): TamboToolWithToolSchema;
488
+ /**
489
+ * Provides type safety for defining a Tambo Tool.
490
+ *
491
+ * This tool definition matched to JSON Schema input and output schemas which allows does not guarantee type
492
+ * safety. If you are using a validation library that implements
493
+ * [Standard Schema](https://standardschema.dev/#what-tools-frameworks-accept-speccompliant-schemas), please ensure
494
+ * your schemas are correctly typed.
495
+ * @see {@link https://standard-schema.dev/}
496
+ * @param tool The tool definition to register
497
+ * @returns The registered tool definition
498
+ */
499
+ <I extends any[], O = any>(tool: TamboToolJSONSchema<I, O>): TamboToolJSONSchema<I, O>;
500
+ /**
501
+ * Provides type safety for defining a Tambo Tool.
502
+ *
503
+ * This tool definition could not be matched to any known schema types which means type safety cannot be
504
+ * guaranteed. If you are using a validation library that implements
505
+ * [Standard Schema](https://standardschema.dev/#what-tools-frameworks-accept-speccompliant-schemas), please ensure
506
+ * your schemas are correctly typed.
507
+ * @example
508
+ * ```typescript
509
+ * const myTool = defineTamboTool({
510
+ * name: "myTool",
511
+ * description: "An example tool",
512
+ * tool: (input) => { ... },
513
+ * inputSchema: yourInputSchema,
514
+ * outputSchema: yourOutputSchema,
515
+ * });
516
+ * @param tool The tool definition to register
517
+ * @returns The registered tool definition
518
+ * ```
519
+ */
520
+ (tool: TamboToolUnknown): TamboToolUnknown;
521
+ (tool: TamboTool): TamboTool;
93
522
  }
523
+ export {};
94
524
  //# sourceMappingURL=component-metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-metadata.d.ts","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,GAAG;IACnD,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,4BACf,SAAQ,OAAO,CAAC,4BAA4B;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GAAG,SAAS,CAAC;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"component-metadata.js","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { JSONSchema7 } from \"json-schema\";\nimport { ComponentType } from \"react\";\nimport z from \"zod/v3\";\nimport type zodToJsonSchema from \"zod-to-json-schema\";\n/** Extension of the ToolParameters interface from Tambo AI to include JSONSchema definition */\nexport type ParameterSpec = TamboAI.ToolParameters & {\n schema?: ReturnType<typeof zodToJsonSchema>;\n};\n\n/**\n * Extends the base ContextTool interface from Tambo AI to include schema information\n * for parameter validation using zod-to-json-schema.\n */\nexport interface ComponentContextToolMetadata\n extends TamboAI.ComponentContextToolMetadata {\n parameters: ParameterSpec[];\n}\n\nexport interface ComponentContextTool {\n getComponentContext: (...args: any[]) => Promise<any>;\n definition: ComponentContextToolMetadata;\n}\n\nexport interface RegisteredComponent extends TamboAI.AvailableComponent {\n component: ComponentType<any>;\n loadingComponent?: ComponentType<any>;\n}\n\nexport type ComponentRegistry = Record<string, RegisteredComponent>;\n\nexport type TamboToolRegistry = Record<string, TamboTool>;\n\n/**\n * A JSON Schema that is compatible with the MCP.\n * This is a simplified JSON Schema that is compatible with the MCPClient and the toolSchema.\n *\n * Do not export this type from the SDK.\n */\nexport type JSONSchemaLite = ReturnType<typeof zodToJsonSchema> & {\n description?: string;\n};\n\nexport interface TamboTool<\n Args extends z.ZodTuple<any, any> = z.ZodTuple<any, any>,\n Returns extends z.ZodTypeAny = z.ZodTypeAny,\n> {\n name: string;\n description: string;\n tool: (...args: z.infer<Args>) => z.infer<Returns>;\n toolSchema: z.ZodFunction<Args, Returns> | JSONSchemaLite;\n /**\n * Optional function to transform the tool's return value into an array of content parts.\n * If not provided, the return value will be converted to a string and wrapped in a text content part.\n * @param result - The result returned by the tool function\n * @returns An array of content parts to be sent back to the AI\n */\n transformToContent?: (\n result: z.infer<Returns>,\n ) =>\n | Promise<TamboAI.Beta.Threads.ChatCompletionContentPart[]>\n | TamboAI.Beta.Threads.ChatCompletionContentPart[];\n}\n\nexport type TamboToolAssociations = Record<string, string[]>;\n/**\n * A component that can be registered with the TamboRegistryProvider.\n */\n\nexport interface TamboComponent {\n /** The name of the component */\n name: string;\n /** The description of the component */\n description: string;\n /**\n * The React component to render.\n *\n * Make sure to pass the Component itself, not an instance of the component. For example,\n * if you have a component like this:\n *\n * ```tsx\n * const MyComponent = () => {\n * return <div>My Component</div>;\n * };\n * ```\n *\n * You should pass the `Component`:\n *\n * ```tsx\n * const components = [MyComponent];\n * <TamboRegistryProvider components={components} />\n * ```\n */\n component: ComponentType<any>;\n\n /**\n * A zod schema for the component props. (Recommended)\n * Either this or propsDefinition must be provided, but not both.\n */\n propsSchema?: z.ZodTypeAny | JSONSchema7;\n /**\n * The props definition of the component as a JSON object.\n * Either this or propsSchema must be provided, but not both.\n * @deprecated Use propsSchema instead.\n */\n propsDefinition?: any;\n /** The loading component to render while the component is loading */\n loadingComponent?: ComponentType<any>;\n /** The tools that are associated with the component */\n associatedTools?: TamboTool[];\n}\n"]}
1
+ {"version":3,"file":"component-metadata.js","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"","sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { JSONSchema7 } from \"json-schema\";\nimport { ComponentType } from \"react\";\nimport {\n ZodFunction as Zod3Function,\n ZodTuple as Zod3FunctionArgs,\n ZodType as Zod3FunctionReturns,\n infer as Zod3Infer,\n} from \"zod/v3\";\nimport {\n $ZodFunction as Zod4Function,\n $ZodFunctionArgs as Zod4FunctionArgs,\n $ZodType as Zod4FunctionReturns,\n infer as Zod4Infer,\n} from \"zod/v4/core\";\n\n/**\n * A schema type that accepts either a Standard Schema compliant validator\n * (e.g., Zod, Valibot, ArkType) or a raw JSON Schema object.\n *\n * Standard Schema is a specification that provides a unified interface for\n * TypeScript validation libraries. Libraries like Zod implement this spec,\n * allowing us to accept any compliant validator without depending on a specific library.\n * @see https://standardschema.dev/\n */\nexport type SupportedSchema = StandardSchemaV1 | JSONSchema7;\n\n/** Extension of the ToolParameters interface from Tambo AI to include JSONSchema definition */\nexport type ParameterSpec = TamboAI.ToolParameters & {\n schema?: JSONSchema7;\n};\n\n/**\n * Extends the base ContextTool interface from Tambo AI to include schema information\n * for parameter validation.\n */\nexport interface ComponentContextToolMetadata\n extends TamboAI.ComponentContextToolMetadata {\n parameters: ParameterSpec[];\n}\n\nexport interface ComponentContextTool {\n getComponentContext: (...args: any[]) => Promise<any>;\n definition: ComponentContextToolMetadata;\n}\n\nexport interface RegisteredComponent extends TamboAI.AvailableComponent {\n component: ComponentType<any>;\n loadingComponent?: ComponentType<any>;\n}\n\nexport type ComponentRegistry = Record<string, RegisteredComponent>;\n\nexport type TamboToolRegistry = Record<\n string,\n TamboTool | TamboToolWithToolSchema\n>;\n\n/**\n * A JSON Schema that is compatible with the MCP.\n * This is a simplified JSON Schema that is compatible with the MCPClient and the tool's inputSchema.\n *\n * Do not export this type from the SDK.\n */\nexport type JSONSchemaLite = JSONSchema7 & {\n description?: string;\n};\n\ntype MaybeAsync<T> = T | Promise<T>;\n\n/**\n * TamboTool is a type that represents a tool that can be registered with Tambo.\n *\n * It is preferable to use the `defineTool` helper function to create tools, as\n * it provides better type inference and safety.\n * @example\n * ```ts\n * import { TamboTool, defineTool } from \"@tambo-ai/react\";\n * import { z } from \"zod\";\n *\n * const locationToLatLon = defineTool({\n * name: \"location_to_latlon\",\n * description:\n * \"Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.\",\n * tool: async ({ location }) => getLatLonFromLocation(location),\n * inputSchema: z.object({\n * location: z.string(),\n * }),\n * outputSchema: z.object({\n * lat: z.number(),\n * lon: z.number(),\n * }),\n * });\n * ```\n * Alternatively, you manually construct a TamboTool with type safety by passing\n * the expected parameter and return types as generics:\n * ```ts\n * import { TamboTool } from \"@tambo-ai/react\";\n * import { z } from \"zod\";\n *\n * const locationToLatLon: TamboTool<{ location: string }, { lat: number; lon: number }> = {\n * name: \"location_to_latlon\",\n * description:\n * \"Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.\",\n * tool: async ({ location }) => getLatLonFromLocation(location),\n * inputSchema: z.object({\n * location: z.string(),\n * }),\n * outputSchema: z.object({\n * lat: z.number(),\n * lon: z.number(),\n * }),\n * });\n * ```\n */\nexport interface TamboTool<\n Params = any,\n Returns = any,\n Rest extends any[] = [],\n> {\n /**\n * Unique identifier for the tool\n */\n name: string;\n /**\n * Description of what the tool does - used by AI to determine when to use it\n */\n description: string;\n /**\n * Optional human-readable name of the tool for display purposes.\n */\n title?: string;\n /**\n * Optional properties describing tool behavior\n */\n annotations?: {\n /**\n * An array indicating the intended audience(s) for this resource. Valid\n * values are \"user\" and \"assistant\". For example, [\"user\", \"assistant\"]\n * indicates content useful for both.\n */\n audience: (\"user\" | \"assistant\")[];\n /**\n * A number from 0.0 to 1.0 indicating the importance of this resource. A\n * value of 1 means \"most important\" (effectively required), while 0 means\n * \"least important\" (entirely optional).\n */\n priority: number;\n /**\n * An ISO 8601 formatted timestamp indicating when the resource was last\n * modified (e.g., \"2025-01-12T15:00:58Z\").\n */\n lastModified: string;\n };\n\n /**\n * The function that implements the tool's logic. This function will be called\n * by Tambo when the model decides to invoke the tool.\n * @param params - The input parameters for the tool. These are validated\n * against the inputSchema before being passed so are guaranteed to be correct\n * when called by the model.\n * @returns The result of the tool execution, which can be a value or a\n * Promise resolving to a value\n */\n tool: (params: Params, ...rest: Rest) => MaybeAsync<Returns>;\n\n /**\n * The schema for the tool's input parameters. This can be a validator from\n * any Standard Schema compliant library (Zod, Valibot, ArkType, etc.) or a\n * raw JSON Schema object.\n *\n * This schema is used to validate and parse the parameters before passing\n * them to the tool function.\n */\n inputSchema: SupportedSchema | unknown;\n\n /**\n * The schema for the tool's output/return value. This can be any Standard Schema\n * compliant validator (Zod, Valibot, ArkType, etc.) or a raw JSON Schema object.\n *\n * This is used to inform the model about the structure of the tool's return value\n * and is not used for runtime validation at this stage.\n */\n outputSchema: SupportedSchema | unknown;\n\n /**\n * Optional function to transform the tool's return value into an array of content parts.\n * If not provided, the return value will be converted to a string and wrapped in a text content part.\n * @param result - The result returned by the tool function\n * @returns An array of content parts to be sent back to the AI\n */\n transformToContent?: (\n result: any,\n ) =>\n | Promise<TamboAI.Beta.Threads.ChatCompletionContentPart[]>\n | TamboAI.Beta.Threads.ChatCompletionContentPart[];\n}\n\n/**\n * Simplified interface for tools using the deprecated toolSchema format.\n * This interface uses simple `any` types to avoid complex type instantiation.\n * Use `defineTamboTool()` for full type inference when creating tools.\n * @deprecated Use TamboTool with `inputSchema`/`outputSchema` instead.\n */\nexport type TamboToolWithToolSchema<\n Args extends any[] = any[],\n Returns = any,\n> = Omit<TamboTool, \"tool\" | \"inputSchema\" | \"outputSchema\"> & {\n tool: (...args: Args) => MaybeAsync<Returns>;\n /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */\n toolSchema: unknown;\n};\n\n// NOTE(lachieh): this comment mirrors the one from `TamboTool` above\n/**\n * TamboTool is a type that represents a tool that can be registered with Tambo.\n *\n * It is preferable to use the `defineTool` helper function to create tools, as\n * it provides better type inference and safety.\n * @example\n * ```ts\n * import { TamboTool, defineTool } from \"@tambo-ai/react\";\n * import { z } from \"zod\";\n *\n * const locationToLatLon = defineTool({\n * name: \"location_to_latlon\",\n * description:\n * \"Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.\",\n * tool: async ({ location }) => getLatLonFromLocation(location),\n * inputSchema: z.object({\n * location: z.string(),\n * }),\n * outputSchema: z.object({\n * lat: z.number(),\n * lon: z.number(),\n * }),\n * });\n * ```\n * Alternatively, you manually construct a TamboTool with type safety by passing\n * the expected parameter and return types as generics:\n * ```ts\n * import { TamboTool } from \"@tambo-ai/react\";\n * import { z } from \"zod\";\n *\n * const locationToLatLon: TamboTool<{ location: string }, { lat: number; lon: number }> = {\n * name: \"location_to_latlon\",\n * description:\n * \"Fetch latitude and longitude from a location string. Returns an object with 'lat' and 'lon' properties.\",\n * tool: async ({ location }) => getLatLonFromLocation(location),\n * inputSchema: z.object({\n * location: z.string(),\n * }),\n * outputSchema: z.object({\n * lat: z.number(),\n * lon: z.number(),\n * }),\n * });\n * ```\n */\nexport type TamboToolBase<Params = any, Returns = any> =\n | TamboToolWithToolSchema\n | TamboTool<Params, Returns>;\n\n/**\n * A tool that uses JSON Schema compliant input and output schemas.\n * This does not provide type safety for the tool's parameters and return value.\n * @internal\n */\nexport type TamboToolJSONSchema<\n Args extends unknown[] = unknown[],\n Returns = unknown,\n> = Omit<TamboTool<Args, Returns>, \"tool\" | \"inputSchema\" | \"outputSchema\"> & {\n tool: (...args: Args) => MaybeAsync<Returns>;\n inputSchema: JSONSchemaLite;\n outputSchema: JSONSchemaLite;\n};\n\n/**\n * A tool that could not be matched to any known schema types.\n * This means type safety cannot be guaranteed.\n * @internal\n */\nexport type TamboToolUnknown = Omit<\n TamboTool,\n \"tool\" | \"inputSchema\" | \"outputSchema\"\n> & {\n tool: (...args: unknown[]) => MaybeAsync<unknown>;\n inputSchema: unknown;\n outputSchema: unknown;\n};\n\n/**\n * A tool that uses Standard Schema compliant input and output schemas.\n * This provides full type safety for the tool's parameters and return value.\n * @internal\n */\nexport type TamboToolStandardSchema<\n Input extends StandardSchemaV1 = StandardSchemaV1,\n Output extends StandardSchemaV1 = StandardSchemaV1,\n> = Omit<\n TamboTool<\n StandardSchemaV1.InferOutput<Input>,\n StandardSchemaV1.InferOutput<Output>\n >,\n \"tool\" | \"inputSchema\" | \"outputSchema\"\n> & {\n tool: (\n ...args: [StandardSchemaV1.InferOutput<Input>]\n ) => MaybeAsync<StandardSchemaV1.InferOutput<Output>>;\n inputSchema: Input;\n outputSchema: Output;\n};\n\ntype TamboToolZod3Function<\n Args extends Zod3FunctionArgs,\n Returns extends Zod3FunctionReturns,\n> = Omit<\n TamboToolWithToolSchema<Zod3Infer<Args>, Zod3Infer<Returns>>,\n \"toolSchema\"\n> & {\n tool: (...args: Zod3Infer<Args>) => MaybeAsync<Zod3Infer<Returns>>;\n /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */\n toolSchema: Zod3Function<Args, Returns>;\n};\n\ntype TamboToolZod4Function<\n Args extends Zod4FunctionArgs,\n Returns extends Zod4FunctionReturns,\n> = Omit<\n TamboToolWithToolSchema<Zod4Infer<Args>, Zod4Infer<Returns>>,\n \"toolSchema\"\n> & {\n tool: (...args: Zod4Infer<Args>) => MaybeAsync<Zod4Infer<Returns>>;\n /** @deprecated Use `inputSchema`/`outputSchema` properties instead. */\n toolSchema: Zod4Function<Args, Returns>;\n};\n\nexport type TamboToolAssociations = Record<string, string[]>;\n/**\n * A component that can be registered with the TamboRegistryProvider.\n */\n\nexport interface TamboComponent {\n /** The name of the component */\n name: string;\n /** The description of the component */\n description: string;\n /**\n * The React component to render.\n *\n * Make sure to pass the Component itself, not an instance of the component. For example,\n * if you have a component like this:\n *\n * ```tsx\n * const MyComponent = () => {\n * return <div>My Component</div>;\n * };\n * ```\n *\n * You should pass the `Component`:\n *\n * ```tsx\n * const components = [MyComponent];\n * <TamboRegistryProvider components={components} />\n * ```\n */\n component: ComponentType<any>;\n\n /**\n * Schema describing the component's props. Accepts any Standard Schema\n * compliant validator (Zod, Valibot, ArkType, etc.) or a raw JSON Schema\n * object.\n *\n * Either this or propsDefinition must be provided, but not both.\n * @example\n * ```typescript\n * import { z } from \"zod/v4\";\n *\n * const component: TamboComponent = {\n * name: \"MyComponent\",\n * description: \"A sample component\",\n * component: MyComponent,\n * propsSchema: z.object({\n * title: z.string(),\n * count: z.number().optional()\n * })\n * };\n * ```\n */\n propsSchema?: SupportedSchema;\n /**\n * The props definition of the component as a JSON object.\n * Either this or propsSchema must be provided, but not both.\n * @deprecated Use propsSchema instead.\n */\n propsDefinition?: any;\n /** The loading component to render while the component is loading */\n loadingComponent?: ComponentType<any>;\n /** The tools that are associated with the component */\n associatedTools?: (TamboTool | TamboToolWithToolSchema)[];\n}\n\nexport interface RegisterToolsFn {\n /**\n * Registers one or more Tambo tools.\n * @param tools - An array of Tambo tools to register\n */\n (tools: TamboTool[]): void;\n (tools: (TamboTool | TamboToolWithToolSchema)[]): void;\n}\n\n/**\n * Function interface for registering a Tambo tool with full type inference.\n * This function has multiple overloads to handle different schema types. This\n * is a utility function and does not perform any runtime logic.\n */\nexport interface RegisterToolFn {\n /**\n * @deprecated Use `inputSchema`/`outputSchema` instead. toolSchema is deprecated\n * and will be removed in future versions.\n * @example\n * ```diff\n * import { z } from \"zod/v3\";\n * const myTool = defineTamboTool({\n * ...\n * - toolSchema: z.function()\n * - .arguments(z.tuple([z.string()]))\n * - .returns(z.number()),\n * + inputSchema: z.object({\n * + input: z.string().describe(\"Input description\")\n * + }),\n * + outputSchema: z.number().describe(\"Result description\"),\n * });\n */\n <Args extends Zod3FunctionArgs, Returns extends Zod3FunctionReturns>(\n tool: TamboToolZod3Function<Args, Returns>,\n warnOnOverwrite?: boolean,\n ): void;\n /**\n * @deprecated Use `inputSchema`/`outputSchema` instead. toolSchema is deprecated\n * and will be removed in future versions.\n * @example\n * ```diff\n * import { z } from \"zod/v4\";\n * const myTool = defineTamboTool({\n * ...\n * - toolSchema: z.function({\n * - input: z.tuple([z.string()]),\n * - output: z.number(),\n * - }),\n * + inputSchema: z.object({\n * + input: z.string().describe(\"Input description\")\n * + }),\n * + outputSchema: z.number().describe(\"Result description\"),\n * });\n */\n <Args extends Zod4FunctionArgs, Returns extends Zod4FunctionReturns>(\n tool: TamboToolZod4Function<Args, Returns>,\n warnOnOverwrite?: boolean,\n ): void;\n (tool: TamboToolWithToolSchema, warnOnOverwrite?: boolean): void;\n <Args extends StandardSchemaV1, Returns extends StandardSchemaV1>(\n tool: TamboTool<\n StandardSchemaV1.InferOutput<Args>,\n StandardSchemaV1.InferOutput<Returns>\n >,\n warnOnOverwrite?: boolean,\n ): void;\n <Args extends any[], Returns = any>(\n tool: TamboToolJSONSchema<Args, Returns>,\n warnOnOverwrite?: boolean,\n ): void;\n (tool: TamboToolUnknown, warnOnOverwrite?: boolean): void;\n (tool: TamboTool, warnOnOverwrite?: boolean): void;\n}\n\n/**\n * Function interface for defining a Tambo tool with full type inference. This\n * function has multiple overloads to handle different schema types. This is a\n * utility function and does not perform any runtime logic.\n */\nexport interface DefineToolFn {\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * Tambo uses the [standard-schema.dev](https://standard-schema.dev) spec which means you can use any Standard Schema\n * compliant validator (Zod, Valibot, ArkType, etc.). This definition ensures the input and output types are correctly\n * inferred from the provided schemas.\n * @example\n * ```typescript\n * import { z } from \"zod/v4\";\n *\n * const myTool = defineTamboTool({\n * // ...\n * inputSchema: z.object({\n * input: z.string().describe(\"Input description\")\n * }),\n * outputSchema: z.number().describe(\"Result description\"),\n * });\n * ```\n * @see {@link https://standard-schema.dev/}\n * @param tool The tool definition to register\n * @returns The registered tool definition\n */\n <Input extends StandardSchemaV1, Output extends StandardSchemaV1>(\n tool: TamboToolStandardSchema<Input, Output>,\n ): TamboTool<\n StandardSchemaV1.InferOutput<Input>,\n StandardSchemaV1.InferOutput<Output>\n >;\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * This tool uses the deprecated `toolSchema` format which uses a zod function schema. If you are using a validation\n * library that implements StandardSchema.dev, please switch to using separate `inputSchema` and `outputSchema`\n * properties instead. See example below.\n * @example\n * ```diff\n * import { z } from \"zod/v4\";\n *\n * const myTool = defineTamboTool({\n * // ...\n * - toolSchema: z.function({\n * - input: z.tuple([z.string()]),\n * - output: z.number(),\n * - })\n * + inputSchema: z.object({\n * + input: z.string().describe(\"Input description\")\n * + }),\n * + outputSchema: z.number().describe(\"Result description\"),\n * });\n * @see {@link https://standard-schema.dev/}\n * @param tool The tool definition to register\n * @returns The registered tool definition\n * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.\n * Note that use of `toolSchema` will be removed in a future release.\n * ```\n */\n <Args extends Zod3FunctionArgs, Returns extends Zod3FunctionReturns>(\n tool: TamboToolZod3Function<Args, Returns>,\n ): TamboToolZod3Function<Args, Returns>;\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * This tool uses the deprecated `toolSchema` format which uses a zod function schema. If you are using a validation\n * library that implements standard-schema.dev, please switch to using separate `inputSchema` and `outputSchema`\n * properties instead. See example below.\n * @param tool The tool definition to register\n * @returns The registered tool definition\n * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.\n * Note that use of `toolSchema` will be removed in a future release.\n * @example\n * ```diff\n * import { z } from \"zod/v4\";\n *\n * const myTool = defineTamboTool({\n * // ...\n * - toolSchema: z.function({\n * - input: z.tuple([z.string()]),\n * - output: z.number(),\n * - })\n * + inputSchema: z.object({\n * + input: z.string().describe(\"Input description\")\n * + }),\n * + outputSchema: z.number().describe(\"Result description\"),\n * });\n * ```\n */\n <Args extends Zod4FunctionArgs, Returns extends Zod4FunctionReturns>(\n tool: TamboToolZod4Function<Args, Returns>,\n ): TamboToolZod4Function<Args, Returns>;\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * This tool uses the deprecated `toolSchema` property which uses a zod function schema. If you are using a validation\n * library that implements standard-schema.dev, please switch to using separate `inputSchema` and `outputSchema`\n * properties instead. See example below.\n * @param tool The tool definition to register\n * @returns The registered tool definition\n * @deprecated Using `toolSchema` is deprecated. Please use separate `inputSchema` and `outputSchema` properties instead.\n * Note that use of `toolSchema` will be removed in a future release.\n * @example\n * ```diff\n * import { z } from \"zod/v4\";\n *\n * const myTool = defineTamboTool({\n * // ...\n * - toolSchema: { ... }\n * + inputSchema: z.object({ ... }),\n * + outputSchema: z.number(),\n * });\n * ```\n */\n (tool: TamboToolWithToolSchema): TamboToolWithToolSchema;\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * This tool definition matched to JSON Schema input and output schemas which allows does not guarantee type\n * safety. If you are using a validation library that implements\n * [Standard Schema](https://standardschema.dev/#what-tools-frameworks-accept-speccompliant-schemas), please ensure\n * your schemas are correctly typed.\n * @see {@link https://standard-schema.dev/}\n * @param tool The tool definition to register\n * @returns The registered tool definition\n */\n <I extends any[], O = any>(\n tool: TamboToolJSONSchema<I, O>,\n ): TamboToolJSONSchema<I, O>;\n /**\n * Provides type safety for defining a Tambo Tool.\n *\n * This tool definition could not be matched to any known schema types which means type safety cannot be\n * guaranteed. If you are using a validation library that implements\n * [Standard Schema](https://standardschema.dev/#what-tools-frameworks-accept-speccompliant-schemas), please ensure\n * your schemas are correctly typed.\n * @example\n * ```typescript\n * const myTool = defineTamboTool({\n * name: \"myTool\",\n * description: \"An example tool\",\n * tool: (input) => { ... },\n * inputSchema: yourInputSchema,\n * outputSchema: yourOutputSchema,\n * });\n * @param tool The tool definition to register\n * @returns The registered tool definition\n * ```\n */\n (tool: TamboToolUnknown): TamboToolUnknown;\n (tool: TamboTool): TamboTool;\n}\n"]}
@@ -1,11 +1,22 @@
1
1
  import TamboAI from "@tambo-ai/typescript-sdk";
2
2
  import { ReactElement } from "react";
3
+ import type { InteractableConfig } from "../hoc/with-tambo-interactable";
4
+ /**
5
+ * Metadata for interactable components.
6
+ * Used when a component is wrapped with withInteractable.
7
+ */
8
+ export interface InteractableMetadata extends InteractableConfig {
9
+ /** Unique identifier for this interactable instance */
10
+ id: string;
11
+ }
3
12
  /**
4
13
  * An extension of the TamboAI.Beta.Threads.ThreadMessage type that includes a
5
- * renderedComponent
14
+ * renderedComponent and optional interactable metadata
6
15
  */
7
16
  export interface TamboThreadMessage extends TamboAI.Beta.Threads.ThreadMessage {
8
17
  renderedComponent?: ReactElement | null;
18
+ /** Optional metadata for interactable components */
19
+ interactableMetadata?: InteractableMetadata;
9
20
  }
10
21
  export declare enum GenerationStage {
11
22
  IDLE = "IDLE",
@@ -1 +1 @@
1
- {"version":3,"file":"generate-component-response.d.ts","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa;IAC5E,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACzC;AAED,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,eAAe,EAAE,eAAe,WAO3D"}
1
+ {"version":3,"file":"generate-component-response.d.ts","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa;IAC5E,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACxC,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,eAAe,EAAE,eAAe,WAO3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-component-response.js","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":";;;AA0BA,kCAOC;AAtBD,IAAY,eASX;AATD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,4DAAyC,CAAA;IACzC,wDAAqC,CAAA;IACrC,8DAA2C,CAAA;IAC3C,4DAAyC,CAAA;IACzC,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,0CAAuB,CAAA;AACzB,CAAC,EATW,eAAe,+BAAf,eAAe,QAS1B;AACD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,eAAgC;IAC1D,OAAO;QACL,eAAe,CAAC,IAAI;QACpB,eAAe,CAAC,QAAQ;QACxB,eAAe,CAAC,KAAK;QACrB,eAAe,CAAC,SAAS;KAC1B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { ReactElement } from \"react\";\n\n/**\n * An extension of the TamboAI.Beta.Threads.ThreadMessage type that includes a\n * renderedComponent\n */\nexport interface TamboThreadMessage extends TamboAI.Beta.Threads.ThreadMessage {\n renderedComponent?: ReactElement | null;\n}\n\nexport enum GenerationStage {\n IDLE = \"IDLE\",\n CHOOSING_COMPONENT = \"CHOOSING_COMPONENT\",\n FETCHING_CONTEXT = \"FETCHING_CONTEXT\",\n HYDRATING_COMPONENT = \"HYDRATING_COMPONENT\",\n STREAMING_RESPONSE = \"STREAMING_RESPONSE\",\n COMPLETE = \"COMPLETE\",\n ERROR = \"ERROR\",\n CANCELLED = \"CANCELLED\",\n}\n/**\n * Checks if the generation stage is in a state where it can accept user input.\n * @param generationStage - The generation stage to check\n * @returns True if the generation stage is idle, false otherwise\n */\nexport function isIdleStage(generationStage: GenerationStage) {\n return [\n GenerationStage.IDLE,\n GenerationStage.COMPLETE,\n GenerationStage.ERROR,\n GenerationStage.CANCELLED,\n ].includes(generationStage);\n}\n"]}
1
+ {"version":3,"file":"generate-component-response.js","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":";;;AAsCA,kCAOC;AAtBD,IAAY,eASX;AATD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,4DAAyC,CAAA;IACzC,wDAAqC,CAAA;IACrC,8DAA2C,CAAA;IAC3C,4DAAyC,CAAA;IACzC,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,0CAAuB,CAAA;AACzB,CAAC,EATW,eAAe,+BAAf,eAAe,QAS1B;AACD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,eAAgC;IAC1D,OAAO;QACL,eAAe,CAAC,IAAI;QACpB,eAAe,CAAC,QAAQ;QACxB,eAAe,CAAC,KAAK;QACrB,eAAe,CAAC,SAAS;KAC1B,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { ReactElement } from \"react\";\nimport type { InteractableConfig } from \"../hoc/with-tambo-interactable\";\n\n/**\n * Metadata for interactable components.\n * Used when a component is wrapped with withInteractable.\n */\nexport interface InteractableMetadata extends InteractableConfig {\n /** Unique identifier for this interactable instance */\n id: string;\n}\n\n/**\n * An extension of the TamboAI.Beta.Threads.ThreadMessage type that includes a\n * renderedComponent and optional interactable metadata\n */\nexport interface TamboThreadMessage extends TamboAI.Beta.Threads.ThreadMessage {\n renderedComponent?: ReactElement | null;\n /** Optional metadata for interactable components */\n interactableMetadata?: InteractableMetadata;\n}\n\nexport enum GenerationStage {\n IDLE = \"IDLE\",\n CHOOSING_COMPONENT = \"CHOOSING_COMPONENT\",\n FETCHING_CONTEXT = \"FETCHING_CONTEXT\",\n HYDRATING_COMPONENT = \"HYDRATING_COMPONENT\",\n STREAMING_RESPONSE = \"STREAMING_RESPONSE\",\n COMPLETE = \"COMPLETE\",\n ERROR = \"ERROR\",\n CANCELLED = \"CANCELLED\",\n}\n/**\n * Checks if the generation stage is in a state where it can accept user input.\n * @param generationStage - The generation stage to check\n * @returns True if the generation stage is idle, false otherwise\n */\nexport function isIdleStage(generationStage: GenerationStage) {\n return [\n GenerationStage.IDLE,\n GenerationStage.COMPLETE,\n GenerationStage.ERROR,\n GenerationStage.CANCELLED,\n ].includes(generationStage);\n}\n"]}