@tambo-ai/react 0.65.3 → 0.66.1

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 +189 -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 +147 -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 +182 -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 +136 -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
@@ -0,0 +1,55 @@
1
+ import type { ListResourcesResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
2
+ /**
3
+ * A single resource item from the MCP SDK listResources response.
4
+ * Re-exported for convenience when registering static resources.
5
+ */
6
+ export type ListResourceItem = ListResourcesResult["resources"][number];
7
+ export type { ReadResourceResult };
8
+ /**
9
+ * Configuration for a dynamic resource source that can search and fetch resources.
10
+ *
11
+ * Both `listResources` and `getResource` must be provided together - you cannot
12
+ * provide one without the other.
13
+ * @example
14
+ * ```typescript
15
+ * const resourceSource: ResourceSource = {
16
+ * listResources: async (search) => {
17
+ * const allResources = await fetchMyResources();
18
+ * return search
19
+ * ? allResources.filter(r => r.name.includes(search))
20
+ * : allResources;
21
+ * },
22
+ * getResource: async (uri, args) => {
23
+ * const content = await fetchResourceContent(uri, args);
24
+ * return {
25
+ * contents: [{
26
+ * uri,
27
+ * mimeType: 'text/plain',
28
+ * text: content,
29
+ * }],
30
+ * };
31
+ * },
32
+ * };
33
+ * ```
34
+ */
35
+ export interface ResourceSource {
36
+ /**
37
+ * Lists available resources, optionally filtered by a search string.
38
+ * @param search - Optional search string to filter resources
39
+ * @returns Promise resolving to an array of resource items
40
+ */
41
+ listResources: (search?: string) => Promise<ListResourceItem[]>;
42
+ /**
43
+ * Fetches the content of a specific resource by URI.
44
+ *
45
+ * Note: `getResource` may be invoked for URIs that have not previously
46
+ * been returned by `listResources` (for example, when the caller already
47
+ * knows a concrete URI). Implementations should handle unknown URIs
48
+ * gracefully rather than assuming they were listed first.
49
+ * @param uri - The URI of the resource to fetch
50
+ * @param args - Optional arguments to pass to the resource fetch
51
+ * @returns Promise resolving to the resource content
52
+ */
53
+ getResource: (uri: string, args?: Record<string, unknown>) => Promise<ReadResourceResult>;
54
+ }
55
+ //# sourceMappingURL=resource-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-info.d.ts","sourceRoot":"","sources":["../../src/model/resource-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,oCAAoC,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAIxE,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,aAAa,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhE;;;;;;;;;;OAUG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resource-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-info.js","sourceRoot":"","sources":["../../src/model/resource-info.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ListResourcesResult,\n ReadResourceResult,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\n/**\n * A single resource item from the MCP SDK listResources response.\n * Re-exported for convenience when registering static resources.\n */\nexport type ListResourceItem = ListResourcesResult[\"resources\"][number];\n\n// Re-export the MCP SDK ReadResourceResult type so consumers can depend on\n// a stable SDK surface without importing directly from the MCP package.\nexport type { ReadResourceResult };\n\n/**\n * Configuration for a dynamic resource source that can search and fetch resources.\n *\n * Both `listResources` and `getResource` must be provided together - you cannot\n * provide one without the other.\n * @example\n * ```typescript\n * const resourceSource: ResourceSource = {\n * listResources: async (search) => {\n * const allResources = await fetchMyResources();\n * return search\n * ? allResources.filter(r => r.name.includes(search))\n * : allResources;\n * },\n * getResource: async (uri, args) => {\n * const content = await fetchResourceContent(uri, args);\n * return {\n * contents: [{\n * uri,\n * mimeType: 'text/plain',\n * text: content,\n * }],\n * };\n * },\n * };\n * ```\n */\nexport interface ResourceSource {\n /**\n * Lists available resources, optionally filtered by a search string.\n * @param search - Optional search string to filter resources\n * @returns Promise resolving to an array of resource items\n */\n listResources: (search?: string) => Promise<ListResourceItem[]>;\n\n /**\n * Fetches the content of a specific resource by URI.\n *\n * Note: `getResource` may be invoked for URIs that have not previously\n * been returned by `listResources` (for example, when the caller already\n * knows a concrete URI). Implementations should handle unknown URIs\n * gracefully rather than assuming they were listed first.\n * @param uri - The URI of the resource to fetch\n * @param args - Optional arguments to pass to the resource fetch\n * @returns Promise resolving to the resource content\n */\n getResource: (\n uri: string,\n args?: Record<string, unknown>,\n ) => Promise<ReadResourceResult>;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type { TamboComponent, TamboTool } from "../model/component-metadata";
1
+ export type { RegisterToolFn, RegisterToolsFn, TamboComponent, TamboTool, } from "../model/component-metadata";
2
2
  export { TamboClientProvider, useIsTamboTokenUpdating, useTamboClient, } from "./tambo-client-provider";
3
3
  export { TamboComponentProvider, useTamboComponent, } from "./tambo-component-provider";
4
4
  export { TamboContextAttachmentProvider, useTamboContextAttachment, type ContextAttachment, type ContextAttachmentState, type ContextHelperData, type TamboContextAttachmentProviderProps, } from "./tambo-context-attachment-provider";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,GACzC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,uBAAuB,EACvB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,oBAAoB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,4BAA4B,GAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,GACzC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,uBAAuB,EACvB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,oBAAoB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,4BAA4B,GAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";;;AACA,iEAIiC;AAH/B,4HAAA,mBAAmB,OAAA;AACnB,gIAAA,uBAAuB,OAAA;AACvB,uHAAA,cAAc,OAAA;AAEhB,uEAGoC;AAFlC,kIAAA,sBAAsB,OAAA;AACtB,6HAAA,iBAAiB,OAAA;AAEnB,yFAO6C;AAN3C,mJAAA,8BAA8B,OAAA;AAC9B,8IAAA,yBAAyB,OAAA;AAM3B,mFAK0C;AAJxC,6IAAA,2BAA2B,OAAA;AAC3B,wIAAA,sBAAsB,OAAA;AAIxB,2EAMsC;AALpC,qHAAA,OAAO,OAAA;AACP,uHAAA,SAAS,OAAA;AACT,qHAAA,OAAO,OAAA;AACP,qIAAA,uBAAuB,OAAA;AACvB,4HAAA,cAAc,OAAA;AAOhB,mDAAyE;AAAhE,8GAAA,YAAY,OAAA;AAAE,+GAAA,aAAa,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAC9C,qEAKmC;AAJjC,gIAAA,qBAAqB,OAAA;AACrB,iIAAA,sBAAsB,OAAA;AACtB,2HAAA,gBAAgB,OAAA;AAGlB,6CAA+E;AAAtE,gHAAA,iBAAiB,OAAA;AAC1B,6EAIuC;AAHrC,uIAAA,wBAAwB,OAAA;AACxB,kIAAA,mBAAmB,OAAA;AAGrB,iEAMiC;AAL/B,2HAAA,kBAAkB,OAAA;AAClB,4HAAA,mBAAmB,OAAA;AACnB,gIAAA,uBAAuB,OAAA;AACvB,uHAAA,cAAc,OAAA","sourcesContent":["export type { TamboComponent, TamboTool } from \"../model/component-metadata\";\nexport {\n TamboClientProvider,\n useIsTamboTokenUpdating,\n useTamboClient,\n} from \"./tambo-client-provider\";\nexport {\n TamboComponentProvider,\n useTamboComponent,\n} from \"./tambo-component-provider\";\nexport {\n TamboContextAttachmentProvider,\n useTamboContextAttachment,\n type ContextAttachment,\n type ContextAttachmentState,\n type ContextHelperData,\n type TamboContextAttachmentProviderProps,\n} from \"./tambo-context-attachment-provider\";\nexport {\n TamboContextHelpersProvider,\n useTamboContextHelpers,\n type TamboContextHelpersContextProps,\n type TamboContextHelpersProviderProps,\n} from \"./tambo-context-helpers-provider\";\nexport {\n Pending,\n Streaming,\n Success,\n TamboPropStreamProvider,\n useTamboStream,\n} from \"./tambo-prop-stream-provider\";\nexport type {\n StreamStateComponentProps,\n StreamStatus,\n TamboPropStreamContextValue,\n} from \"./tambo-prop-stream-provider\";\nexport { TamboContext, TamboProvider, useTambo } from \"./tambo-provider\";\nexport {\n TamboRegistryProvider,\n useTamboMcpServerInfos,\n useTamboRegistry,\n type TamboRegistryContext,\n} from \"./tambo-registry-provider\";\nexport { TamboStubProvider, type TamboStubProviderProps } from \"./tambo-stubs\";\nexport {\n TamboThreadInputProvider,\n useTamboThreadInput,\n type TamboThreadInputContextProps,\n} from \"./tambo-thread-input-provider\";\nexport {\n TamboThreadContext,\n TamboThreadProvider,\n useTamboGenerationStage,\n useTamboThread,\n type TamboThreadProviderProps,\n} from \"./tambo-thread-provider\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";;;AAMA,iEAIiC;AAH/B,4HAAA,mBAAmB,OAAA;AACnB,gIAAA,uBAAuB,OAAA;AACvB,uHAAA,cAAc,OAAA;AAEhB,uEAGoC;AAFlC,kIAAA,sBAAsB,OAAA;AACtB,6HAAA,iBAAiB,OAAA;AAEnB,yFAO6C;AAN3C,mJAAA,8BAA8B,OAAA;AAC9B,8IAAA,yBAAyB,OAAA;AAM3B,mFAK0C;AAJxC,6IAAA,2BAA2B,OAAA;AAC3B,wIAAA,sBAAsB,OAAA;AAIxB,2EAMsC;AALpC,qHAAA,OAAO,OAAA;AACP,uHAAA,SAAS,OAAA;AACT,qHAAA,OAAO,OAAA;AACP,qIAAA,uBAAuB,OAAA;AACvB,4HAAA,cAAc,OAAA;AAOhB,mDAAyE;AAAhE,8GAAA,YAAY,OAAA;AAAE,+GAAA,aAAa,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAC9C,qEAKmC;AAJjC,gIAAA,qBAAqB,OAAA;AACrB,iIAAA,sBAAsB,OAAA;AACtB,2HAAA,gBAAgB,OAAA;AAGlB,6CAA+E;AAAtE,gHAAA,iBAAiB,OAAA;AAC1B,6EAIuC;AAHrC,uIAAA,wBAAwB,OAAA;AACxB,kIAAA,mBAAmB,OAAA;AAGrB,iEAMiC;AAL/B,2HAAA,kBAAkB,OAAA;AAClB,4HAAA,mBAAmB,OAAA;AACnB,gIAAA,uBAAuB,OAAA;AACvB,uHAAA,cAAc,OAAA","sourcesContent":["export type {\n RegisterToolFn,\n RegisterToolsFn,\n TamboComponent,\n TamboTool,\n} from \"../model/component-metadata\";\nexport {\n TamboClientProvider,\n useIsTamboTokenUpdating,\n useTamboClient,\n} from \"./tambo-client-provider\";\nexport {\n TamboComponentProvider,\n useTamboComponent,\n} from \"./tambo-component-provider\";\nexport {\n TamboContextAttachmentProvider,\n useTamboContextAttachment,\n type ContextAttachment,\n type ContextAttachmentState,\n type ContextHelperData,\n type TamboContextAttachmentProviderProps,\n} from \"./tambo-context-attachment-provider\";\nexport {\n TamboContextHelpersProvider,\n useTamboContextHelpers,\n type TamboContextHelpersContextProps,\n type TamboContextHelpersProviderProps,\n} from \"./tambo-context-helpers-provider\";\nexport {\n Pending,\n Streaming,\n Success,\n TamboPropStreamProvider,\n useTamboStream,\n} from \"./tambo-prop-stream-provider\";\nexport type {\n StreamStateComponentProps,\n StreamStatus,\n TamboPropStreamContextValue,\n} from \"./tambo-prop-stream-provider\";\nexport { TamboContext, TamboProvider, useTambo } from \"./tambo-provider\";\nexport {\n TamboRegistryProvider,\n useTamboMcpServerInfos,\n useTamboRegistry,\n type TamboRegistryContext,\n} from \"./tambo-registry-provider\";\nexport { TamboStubProvider, type TamboStubProviderProps } from \"./tambo-stubs\";\nexport {\n TamboThreadInputProvider,\n useTamboThreadInput,\n type TamboThreadInputContextProps,\n} from \"./tambo-thread-input-provider\";\nexport {\n TamboThreadContext,\n TamboThreadProvider,\n useTamboGenerationStage,\n useTamboThread,\n type TamboThreadProviderProps,\n} from \"./tambo-thread-provider\";\n"]}
@@ -1,10 +1,10 @@
1
1
  import React, { PropsWithChildren } from "react";
2
- import { TamboComponent, TamboTool } from "../model/component-metadata";
2
+ import { RegisterToolFn, RegisterToolsFn, TamboComponent, TamboTool, TamboToolWithToolSchema } from "../model/component-metadata";
3
3
  export interface TamboComponentContextProps {
4
4
  registerComponent: (options: TamboComponent) => void;
5
- registerTool: (tool: TamboTool) => void;
6
- registerTools: (tools: TamboTool[]) => void;
7
- addToolAssociation: (componentName: string, tool: TamboTool) => void;
5
+ registerTool: RegisterToolFn;
6
+ registerTools: RegisterToolsFn;
7
+ addToolAssociation: (componentName: string, tool: TamboTool | TamboToolWithToolSchema) => void;
8
8
  }
9
9
  /**
10
10
  * The TamboComponentProvider is a React provider that provides component
@@ -1 +1 @@
1
- {"version":3,"file":"tambo-component-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAIxE,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtE;AAqBD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoB9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kCAE7B,CAAC"}
1
+ {"version":3,"file":"tambo-component-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,SAAS,EACT,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,cAAc,CAAC;IAC7B,aAAa,EAAE,eAAe,CAAC;IAC/B,kBAAkB,EAAE,CAClB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,GAAG,uBAAuB,KACtC,IAAI,CAAC;CACX;AAqBD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoB9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kCAE7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tambo-component-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAE5E,mEAAyD;AACzD,uEAA6D;AAS7D,MAAM,qBAAqB,GAAG,IAAA,qBAAa,EAA6B;IACtE;;OAEG;IACH,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;IACvB;;OAEG;IACH,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAgC,CAAC,EAClE,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAA,sCAAc,GAAE,CAAC;IAChC,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,GAC1E,IAAA,0CAAgB,GAAE,CAAC;IAErB,MAAM,KAAK,GAAG;QACZ,MAAM;QACN,iBAAiB;QACjB,YAAY;QACZ,aAAa;QACb,kBAAkB;KACnB,CAAC;IAEF,OAAO,CACL,8BAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACzC,QAAQ,CACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B","sourcesContent":["\"use client\";\nimport React, { createContext, PropsWithChildren, useContext } from \"react\";\nimport { TamboComponent, TamboTool } from \"../model/component-metadata\";\nimport { useTamboClient } from \"./tambo-client-provider\";\nimport { useTamboRegistry } from \"./tambo-registry-provider\";\n\nexport interface TamboComponentContextProps {\n registerComponent: (options: TamboComponent) => void;\n registerTool: (tool: TamboTool) => void;\n registerTools: (tools: TamboTool[]) => void;\n addToolAssociation: (componentName: string, tool: TamboTool) => void;\n}\n\nconst TamboComponentContext = createContext<TamboComponentContextProps>({\n /**\n *\n */\n registerComponent: () => {},\n /**\n *\n */\n registerTool: () => {},\n /**\n *\n */\n registerTools: () => {},\n /**\n *\n */\n addToolAssociation: () => {},\n});\n\n/**\n * The TamboComponentProvider is a React provider that provides component\n * registration services to the descendants of the provider.\n * @param props - The props for the TamboComponentProvider\n * @param props.children - The children to wrap\n * @returns The TamboComponentProvider component\n */\nexport const TamboComponentProvider: React.FC<PropsWithChildren> = ({\n children,\n}) => {\n const client = useTamboClient();\n const { registerComponent, addToolAssociation, registerTool, registerTools } =\n useTamboRegistry();\n\n const value = {\n client,\n registerComponent,\n registerTool,\n registerTools,\n addToolAssociation,\n };\n\n return (\n <TamboComponentContext.Provider value={value}>\n {children}\n </TamboComponentContext.Provider>\n );\n};\n\n/**\n * The useTamboComponent hook provides access to the component registration\n * services to the descendants of the TamboComponentProvider.\n * @returns The component registration services\n */\nexport const useTamboComponent = () => {\n return useContext(TamboComponentContext);\n};\n"]}
1
+ {"version":3,"file":"tambo-component-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAQ5E,mEAAyD;AACzD,uEAA6D;AAY7D,MAAM,qBAAqB,GAAG,IAAA,qBAAa,EAA6B;IACtE;;OAEG;IACH,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;IACvB;;OAEG;IACH,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAgC,CAAC,EAClE,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAA,sCAAc,GAAE,CAAC;IAChC,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,GAC1E,IAAA,0CAAgB,GAAE,CAAC;IAErB,MAAM,KAAK,GAAG;QACZ,MAAM;QACN,iBAAiB;QACjB,YAAY;QACZ,aAAa;QACb,kBAAkB;KACnB,CAAC;IAEF,OAAO,CACL,8BAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACzC,QAAQ,CACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B","sourcesContent":["\"use client\";\nimport React, { createContext, PropsWithChildren, useContext } from \"react\";\nimport {\n RegisterToolFn,\n RegisterToolsFn,\n TamboComponent,\n TamboTool,\n TamboToolWithToolSchema,\n} from \"../model/component-metadata\";\nimport { useTamboClient } from \"./tambo-client-provider\";\nimport { useTamboRegistry } from \"./tambo-registry-provider\";\n\nexport interface TamboComponentContextProps {\n registerComponent: (options: TamboComponent) => void;\n registerTool: RegisterToolFn;\n registerTools: RegisterToolsFn;\n addToolAssociation: (\n componentName: string,\n tool: TamboTool | TamboToolWithToolSchema,\n ) => void;\n}\n\nconst TamboComponentContext = createContext<TamboComponentContextProps>({\n /**\n *\n */\n registerComponent: () => {},\n /**\n *\n */\n registerTool: () => {},\n /**\n *\n */\n registerTools: () => {},\n /**\n *\n */\n addToolAssociation: () => {},\n});\n\n/**\n * The TamboComponentProvider is a React provider that provides component\n * registration services to the descendants of the provider.\n * @param props - The props for the TamboComponentProvider\n * @param props.children - The children to wrap\n * @returns The TamboComponentProvider component\n */\nexport const TamboComponentProvider: React.FC<PropsWithChildren> = ({\n children,\n}) => {\n const client = useTamboClient();\n const { registerComponent, addToolAssociation, registerTool, registerTools } =\n useTamboRegistry();\n\n const value = {\n client,\n registerComponent,\n registerTool,\n registerTools,\n addToolAssociation,\n };\n\n return (\n <TamboComponentContext.Provider value={value}>\n {children}\n </TamboComponentContext.Provider>\n );\n};\n\n/**\n * The useTamboComponent hook provides access to the component registration\n * services to the descendants of the TamboComponentProvider.\n * @returns The component registration services\n */\nexport const useTamboComponent = () => {\n return useContext(TamboComponentContext);\n};\n"]}
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = require("@testing-library/react");
7
7
  const react_2 = __importDefault(require("react"));
8
- const v3_1 = require("zod/v3");
8
+ const zodInternalAlias_1 = require("zodInternalAlias");
9
9
  const tambo_interactable_provider_1 = require("./tambo-interactable-provider");
10
10
  // Mock the context helpers
11
11
  const mockAddContextHelper = jest.fn();
@@ -52,13 +52,13 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
52
52
  active: true,
53
53
  metadata: { type: "test", version: "1.0" },
54
54
  },
55
- propsSchema: v3_1.z.object({
56
- title: v3_1.z.string(),
57
- count: v3_1.z.number(),
58
- active: v3_1.z.boolean(),
59
- metadata: v3_1.z.object({
60
- type: v3_1.z.string(),
61
- version: v3_1.z.string(),
55
+ propsSchema: zodInternalAlias_1.z.object({
56
+ title: zodInternalAlias_1.z.string(),
57
+ count: zodInternalAlias_1.z.number(),
58
+ active: zodInternalAlias_1.z.boolean(),
59
+ metadata: zodInternalAlias_1.z.object({
60
+ type: zodInternalAlias_1.z.string(),
61
+ version: zodInternalAlias_1.z.string(),
62
62
  }),
63
63
  }),
64
64
  };
@@ -100,11 +100,11 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
100
100
  active: true,
101
101
  description: "Original description",
102
102
  },
103
- propsSchema: v3_1.z.object({
104
- title: v3_1.z.string(),
105
- count: v3_1.z.number(),
106
- active: v3_1.z.boolean(),
107
- description: v3_1.z.string(),
103
+ propsSchema: zodInternalAlias_1.z.object({
104
+ title: zodInternalAlias_1.z.string(),
105
+ count: zodInternalAlias_1.z.number(),
106
+ active: zodInternalAlias_1.z.boolean(),
107
+ description: zodInternalAlias_1.z.string(),
108
108
  }),
109
109
  };
110
110
  let componentId = "";
@@ -155,14 +155,14 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
155
155
  },
156
156
  },
157
157
  },
158
- propsSchema: v3_1.z.object({
159
- title: v3_1.z.string(),
160
- config: v3_1.z.object({
161
- theme: v3_1.z.string(),
162
- language: v3_1.z.string(),
163
- features: v3_1.z.object({
164
- notifications: v3_1.z.boolean(),
165
- analytics: v3_1.z.boolean(),
158
+ propsSchema: zodInternalAlias_1.z.object({
159
+ title: zodInternalAlias_1.z.string(),
160
+ config: zodInternalAlias_1.z.object({
161
+ theme: zodInternalAlias_1.z.string(),
162
+ language: zodInternalAlias_1.z.string(),
163
+ features: zodInternalAlias_1.z.object({
164
+ notifications: zodInternalAlias_1.z.boolean(),
165
+ analytics: zodInternalAlias_1.z.boolean(),
166
166
  }),
167
167
  }),
168
168
  }),
@@ -200,10 +200,10 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
200
200
  items: ["item1", "item2", "item3"],
201
201
  tags: ["tag1", "tag2"],
202
202
  },
203
- propsSchema: v3_1.z.object({
204
- title: v3_1.z.string(),
205
- items: v3_1.z.array(v3_1.z.string()),
206
- tags: v3_1.z.array(v3_1.z.string()),
203
+ propsSchema: zodInternalAlias_1.z.object({
204
+ title: zodInternalAlias_1.z.string(),
205
+ items: zodInternalAlias_1.z.array(zodInternalAlias_1.z.string()),
206
+ tags: zodInternalAlias_1.z.array(zodInternalAlias_1.z.string()),
207
207
  }),
208
208
  };
209
209
  let componentId = "";
@@ -233,10 +233,10 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
233
233
  count: 5,
234
234
  description: "Original description",
235
235
  },
236
- propsSchema: v3_1.z.object({
237
- title: v3_1.z.string(),
238
- count: v3_1.z.number(),
239
- description: v3_1.z.string(),
236
+ propsSchema: zodInternalAlias_1.z.object({
237
+ title: zodInternalAlias_1.z.string(),
238
+ count: zodInternalAlias_1.z.number(),
239
+ description: zodInternalAlias_1.z.string(),
240
240
  }),
241
241
  };
242
242
  let componentId = "";
@@ -285,7 +285,7 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
285
285
  description: "A component with spaces in name",
286
286
  component: () => react_2.default.createElement("div", null, "Invalid"),
287
287
  props: { title: "Test" },
288
- propsSchema: v3_1.z.object({ title: v3_1.z.string() }),
288
+ propsSchema: zodInternalAlias_1.z.object({ title: zodInternalAlias_1.z.string() }),
289
289
  };
290
290
  expect(() => {
291
291
  (0, react_1.act)(() => {
@@ -300,7 +300,7 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
300
300
  description: "A test component",
301
301
  component: () => react_2.default.createElement("div", null, "Test"),
302
302
  props: { title: "Original Title" },
303
- propsSchema: v3_1.z.object({ title: v3_1.z.string() }),
303
+ propsSchema: zodInternalAlias_1.z.object({ title: zodInternalAlias_1.z.string() }),
304
304
  };
305
305
  let componentId = "";
306
306
  (0, react_1.act)(() => {
@@ -319,7 +319,7 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
319
319
  description: "A test component",
320
320
  component: () => react_2.default.createElement("div", null, "Test"),
321
321
  props: { title: "Original Title" },
322
- propsSchema: v3_1.z.object({ title: v3_1.z.string() }),
322
+ propsSchema: zodInternalAlias_1.z.object({ title: zodInternalAlias_1.z.string() }),
323
323
  };
324
324
  let componentId = "";
325
325
  (0, react_1.act)(() => {
@@ -338,7 +338,7 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
338
338
  description: "A test component",
339
339
  component: () => react_2.default.createElement("div", null, "Test"),
340
340
  props: { title: "Original Title" },
341
- propsSchema: v3_1.z.object({ title: v3_1.z.string() }),
341
+ propsSchema: zodInternalAlias_1.z.object({ title: zodInternalAlias_1.z.string() }),
342
342
  };
343
343
  let componentId = "";
344
344
  (0, react_1.act)(() => {
@@ -365,15 +365,15 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
365
365
  metadata: { type: "test", version: "1.0" },
366
366
  items: ["item1", "item2"],
367
367
  },
368
- propsSchema: v3_1.z.object({
369
- title: v3_1.z.string(),
370
- count: v3_1.z.number(),
371
- active: v3_1.z.boolean(),
372
- metadata: v3_1.z.object({
373
- type: v3_1.z.string(),
374
- version: v3_1.z.string(),
368
+ propsSchema: zodInternalAlias_1.z.object({
369
+ title: zodInternalAlias_1.z.string(),
370
+ count: zodInternalAlias_1.z.number(),
371
+ active: zodInternalAlias_1.z.boolean(),
372
+ metadata: zodInternalAlias_1.z.object({
373
+ type: zodInternalAlias_1.z.string(),
374
+ version: zodInternalAlias_1.z.string(),
375
375
  }),
376
- items: v3_1.z.array(v3_1.z.string()),
376
+ items: zodInternalAlias_1.z.array(zodInternalAlias_1.z.string()),
377
377
  }),
378
378
  };
379
379
  let componentId = "";
@@ -427,25 +427,25 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
427
427
  description: "A test component with large data",
428
428
  component: () => react_2.default.createElement("div", null, "Test"),
429
429
  props: largeData,
430
- propsSchema: v3_1.z.object({
431
- users: v3_1.z.array(v3_1.z.object({
432
- id: v3_1.z.number(),
433
- name: v3_1.z.string(),
430
+ propsSchema: zodInternalAlias_1.z.object({
431
+ users: zodInternalAlias_1.z.array(zodInternalAlias_1.z.object({
432
+ id: zodInternalAlias_1.z.number(),
433
+ name: zodInternalAlias_1.z.string(),
434
434
  })),
435
- settings: v3_1.z.object({
436
- theme: v3_1.z.string(),
437
- language: v3_1.z.string(),
438
- notifications: v3_1.z.boolean(),
439
- privacy: v3_1.z.object({
440
- shareData: v3_1.z.boolean(),
441
- analytics: v3_1.z.boolean(),
442
- marketing: v3_1.z.boolean(),
435
+ settings: zodInternalAlias_1.z.object({
436
+ theme: zodInternalAlias_1.z.string(),
437
+ language: zodInternalAlias_1.z.string(),
438
+ notifications: zodInternalAlias_1.z.boolean(),
439
+ privacy: zodInternalAlias_1.z.object({
440
+ shareData: zodInternalAlias_1.z.boolean(),
441
+ analytics: zodInternalAlias_1.z.boolean(),
442
+ marketing: zodInternalAlias_1.z.boolean(),
443
443
  }),
444
444
  }),
445
- metadata: v3_1.z.object({
446
- version: v3_1.z.string(),
447
- build: v3_1.z.string(),
448
- timestamp: v3_1.z.number(),
445
+ metadata: zodInternalAlias_1.z.object({
446
+ version: zodInternalAlias_1.z.string(),
447
+ build: zodInternalAlias_1.z.string(),
448
+ timestamp: zodInternalAlias_1.z.number(),
449
449
  }),
450
450
  }),
451
451
  };
@@ -488,10 +488,10 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
488
488
  title: "Original Title",
489
489
  count: 0,
490
490
  },
491
- propsSchema: v3_1.z.object({
492
- title: v3_1.z.string(),
493
- count: v3_1.z.number(),
494
- newProperty: v3_1.z.string().optional(),
491
+ propsSchema: zodInternalAlias_1.z.object({
492
+ title: zodInternalAlias_1.z.string(),
493
+ count: zodInternalAlias_1.z.number(),
494
+ newProperty: zodInternalAlias_1.z.string().optional(),
495
495
  }),
496
496
  };
497
497
  let componentId = "";
@@ -521,10 +521,10 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
521
521
  count: 5,
522
522
  active: true,
523
523
  },
524
- propsSchema: v3_1.z.object({
525
- title: v3_1.z.string(),
526
- count: v3_1.z.number(),
527
- active: v3_1.z.boolean(),
524
+ propsSchema: zodInternalAlias_1.z.object({
525
+ title: zodInternalAlias_1.z.string(),
526
+ count: zodInternalAlias_1.z.number(),
527
+ active: zodInternalAlias_1.z.boolean(),
528
528
  }),
529
529
  };
530
530
  let componentId = "";
@@ -565,17 +565,17 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
565
565
  },
566
566
  },
567
567
  },
568
- propsSchema: v3_1.z.object({
569
- title: v3_1.z.string(),
570
- config: v3_1.z.object({
571
- theme: v3_1.z.string(),
572
- language: v3_1.z.string(),
573
- features: v3_1.z.object({
574
- notifications: v3_1.z.boolean(),
575
- analytics: v3_1.z.boolean(),
576
- experimental: v3_1.z.object({
577
- beta: v3_1.z.boolean(),
578
- alpha: v3_1.z.boolean(),
568
+ propsSchema: zodInternalAlias_1.z.object({
569
+ title: zodInternalAlias_1.z.string(),
570
+ config: zodInternalAlias_1.z.object({
571
+ theme: zodInternalAlias_1.z.string(),
572
+ language: zodInternalAlias_1.z.string(),
573
+ features: zodInternalAlias_1.z.object({
574
+ notifications: zodInternalAlias_1.z.boolean(),
575
+ analytics: zodInternalAlias_1.z.boolean(),
576
+ experimental: zodInternalAlias_1.z.object({
577
+ beta: zodInternalAlias_1.z.boolean(),
578
+ alpha: zodInternalAlias_1.z.boolean(),
579
579
  }),
580
580
  }),
581
581
  }),
@@ -639,17 +639,17 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
639
639
  },
640
640
  },
641
641
  },
642
- propsSchema: v3_1.z.object({
643
- title: v3_1.z.string(),
644
- config: v3_1.z.object({
645
- theme: v3_1.z.string(),
646
- language: v3_1.z.string(),
647
- features: v3_1.z.object({
648
- notifications: v3_1.z.boolean(),
649
- analytics: v3_1.z.boolean(),
650
- experimental: v3_1.z.object({
651
- beta: v3_1.z.boolean(),
652
- alpha: v3_1.z.boolean(),
642
+ propsSchema: zodInternalAlias_1.z.object({
643
+ title: zodInternalAlias_1.z.string(),
644
+ config: zodInternalAlias_1.z.object({
645
+ theme: zodInternalAlias_1.z.string(),
646
+ language: zodInternalAlias_1.z.string(),
647
+ features: zodInternalAlias_1.z.object({
648
+ notifications: zodInternalAlias_1.z.boolean(),
649
+ analytics: zodInternalAlias_1.z.boolean(),
650
+ experimental: zodInternalAlias_1.z.object({
651
+ beta: zodInternalAlias_1.z.boolean(),
652
+ alpha: zodInternalAlias_1.z.boolean(),
653
653
  }),
654
654
  }),
655
655
  }),