@tambo-ai/react 1.1.0 → 1.2.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 (457) hide show
  1. package/dist/context-helpers/current-interactables-context-helper.d.ts +16 -2
  2. package/dist/context-helpers/current-interactables-context-helper.d.ts.map +1 -1
  3. package/dist/context-helpers/current-interactables-context-helper.js.map +1 -1
  4. package/dist/context-helpers/current-interactables-context-helper.test.d.ts +2 -0
  5. package/dist/context-helpers/current-interactables-context-helper.test.d.ts.map +1 -0
  6. package/dist/context-helpers/current-interactables-context-helper.test.js +70 -0
  7. package/dist/context-helpers/current-interactables-context-helper.test.js.map +1 -0
  8. package/dist/mcp/elicitation.d.ts +3 -37
  9. package/dist/mcp/elicitation.d.ts.map +1 -1
  10. package/dist/mcp/elicitation.js +7 -24
  11. package/dist/mcp/elicitation.js.map +1 -1
  12. package/dist/mcp/index.d.ts +4 -4
  13. package/dist/mcp/index.d.ts.map +1 -1
  14. package/dist/mcp/index.js +2 -2
  15. package/dist/mcp/index.js.map +1 -1
  16. package/dist/mcp/mcp-client.test.js +17 -17
  17. package/dist/mcp/mcp-client.test.js.map +1 -1
  18. package/dist/mcp/mcp-hooks.d.ts.map +1 -1
  19. package/dist/mcp/mcp-hooks.js +8 -5
  20. package/dist/mcp/mcp-hooks.js.map +1 -1
  21. package/dist/mcp/mcp-hooks.test.js +30 -29
  22. package/dist/mcp/mcp-hooks.test.js.map +1 -1
  23. package/dist/mcp/tambo-mcp-provider.d.ts +6 -9
  24. package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
  25. package/dist/mcp/tambo-mcp-provider.js +9 -13
  26. package/dist/mcp/tambo-mcp-provider.js.map +1 -1
  27. package/dist/mcp/tambo-mcp-provider.test.js +26 -25
  28. package/dist/mcp/tambo-mcp-provider.test.js.map +1 -1
  29. package/dist/mcp/use-mcp-servers.test.js +2 -1
  30. package/dist/mcp/use-mcp-servers.test.js.map +1 -1
  31. package/dist/model/component-metadata.d.ts +7 -372
  32. package/dist/model/component-metadata.d.ts.map +1 -1
  33. package/dist/model/component-metadata.js.map +1 -1
  34. package/dist/model/validate-input.test.d.ts +2 -0
  35. package/dist/model/validate-input.test.d.ts.map +1 -0
  36. package/dist/model/validate-input.test.js +38 -0
  37. package/dist/model/validate-input.test.js.map +1 -0
  38. package/dist/providers/tambo-interactable-provider.d.ts +7 -7
  39. package/dist/providers/tambo-registry-provider.d.ts +1 -1
  40. package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
  41. package/dist/providers/tambo-registry-provider.js.map +1 -1
  42. package/dist/providers/tambo-registry-schema-compat.test.js +4 -4
  43. package/dist/providers/tambo-registry-schema-compat.test.js.map +1 -1
  44. package/dist/schema/index.d.ts +2 -4
  45. package/dist/schema/index.d.ts.map +1 -1
  46. package/dist/schema/index.js +9 -11
  47. package/dist/schema/index.js.map +1 -1
  48. package/dist/schema/json-schema.d.ts +1 -17
  49. package/dist/schema/json-schema.d.ts.map +1 -1
  50. package/dist/schema/json-schema.js +5 -69
  51. package/dist/schema/json-schema.js.map +1 -1
  52. package/dist/schema/schema.test.js +24 -25
  53. package/dist/schema/schema.test.js.map +1 -1
  54. package/dist/schema/standard-schema.test.js +25 -25
  55. package/dist/schema/standard-schema.test.js.map +1 -1
  56. package/dist/schema/validate.test.js +33 -33
  57. package/dist/schema/validate.test.js.map +1 -1
  58. package/dist/testing/tools.d.ts +4 -4
  59. package/dist/testing/tools.test.d.ts +2 -0
  60. package/dist/testing/tools.test.d.ts.map +1 -0
  61. package/dist/testing/tools.test.js +60 -0
  62. package/dist/testing/tools.test.js.map +1 -0
  63. package/dist/util/mcp-server-utils.d.ts +1 -1
  64. package/dist/util/mcp-server-utils.d.ts.map +1 -1
  65. package/dist/util/mcp-server-utils.js +4 -4
  66. package/dist/util/mcp-server-utils.js.map +1 -1
  67. package/dist/util/mcp-server-utils.test.js +27 -27
  68. package/dist/util/mcp-server-utils.test.js.map +1 -1
  69. package/dist/util/registry.js +1 -1
  70. package/dist/util/registry.js.map +1 -1
  71. package/dist/util/resource-content-resolver.js +5 -5
  72. package/dist/util/resource-content-resolver.js.map +1 -1
  73. package/dist/util/resource-content-resolver.test.js +6 -6
  74. package/dist/util/resource-content-resolver.test.js.map +1 -1
  75. package/dist/util/tool-caller.test.d.ts +2 -0
  76. package/dist/util/tool-caller.test.d.ts.map +1 -0
  77. package/dist/util/tool-caller.test.js +71 -0
  78. package/dist/util/tool-caller.test.js.map +1 -0
  79. package/dist/v1/__tests__/v1-interactables.test.js +1 -0
  80. package/dist/v1/__tests__/v1-interactables.test.js.map +1 -1
  81. package/dist/v1/hooks/use-tambo-v1-auth-state.d.ts +1 -1
  82. package/dist/v1/hooks/use-tambo-v1-auth-state.d.ts.map +1 -1
  83. package/dist/v1/hooks/use-tambo-v1-auth-state.js.map +1 -1
  84. package/dist/v1/hooks/use-tambo-v1-component-state.js +2 -2
  85. package/dist/v1/hooks/use-tambo-v1-component-state.js.map +1 -1
  86. package/dist/v1/hooks/use-tambo-v1-component-state.test.js +1 -1
  87. package/dist/v1/hooks/use-tambo-v1-component-state.test.js.map +1 -1
  88. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts +1 -1
  89. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
  90. package/dist/v1/hooks/use-tambo-v1-send-message.js +17 -17
  91. package/dist/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
  92. package/dist/v1/hooks/use-tambo-v1-send-message.test.js +1 -1
  93. package/dist/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
  94. package/dist/v1/hooks/use-tambo-v1-stream-status.js +2 -2
  95. package/dist/v1/hooks/use-tambo-v1-stream-status.js.map +1 -1
  96. package/dist/v1/hooks/use-tambo-v1-stream-status.test.js +9 -5
  97. package/dist/v1/hooks/use-tambo-v1-stream-status.test.js.map +1 -1
  98. package/dist/v1/hooks/use-tambo-v1-suggestions.js +2 -2
  99. package/dist/v1/hooks/use-tambo-v1-suggestions.js.map +1 -1
  100. package/dist/v1/hooks/use-tambo-v1-thread-input.test.js +1 -0
  101. package/dist/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
  102. package/dist/v1/hooks/use-tambo-v1.d.ts +7 -6
  103. package/dist/v1/hooks/use-tambo-v1.d.ts.map +1 -1
  104. package/dist/v1/hooks/use-tambo-v1.js +2 -2
  105. package/dist/v1/hooks/use-tambo-v1.js.map +1 -1
  106. package/dist/v1/hooks/use-tambo-v1.test.js +23 -23
  107. package/dist/v1/hooks/use-tambo-v1.test.js.map +1 -1
  108. package/dist/v1/index.d.ts +6 -6
  109. package/dist/v1/index.d.ts.map +1 -1
  110. package/dist/v1/index.js +2 -2
  111. package/dist/v1/index.js.map +1 -1
  112. package/dist/v1/providers/tambo-v1-provider.d.ts +2 -1
  113. package/dist/v1/providers/tambo-v1-provider.d.ts.map +1 -1
  114. package/dist/v1/providers/tambo-v1-provider.js +2 -0
  115. package/dist/v1/providers/tambo-v1-provider.js.map +1 -1
  116. package/dist/v1/providers/tambo-v1-stream-context.d.ts +2 -2
  117. package/dist/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
  118. package/dist/v1/providers/tambo-v1-stream-context.js +9 -9
  119. package/dist/v1/providers/tambo-v1-stream-context.js.map +1 -1
  120. package/dist/v1/providers/tambo-v1-stream-context.test.js +35 -0
  121. package/dist/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
  122. package/dist/v1/providers/tambo-v1-stub-provider.d.ts +1 -1
  123. package/dist/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -1
  124. package/dist/v1/providers/tambo-v1-stub-provider.js +1 -1
  125. package/dist/v1/providers/tambo-v1-stub-provider.js.map +1 -1
  126. package/dist/v1/providers/tambo-v1-stub-provider.test.js.map +1 -1
  127. package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts +1 -1
  128. package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -1
  129. package/dist/v1/providers/tambo-v1-thread-input-provider.js +2 -2
  130. package/dist/v1/providers/tambo-v1-thread-input-provider.js.map +1 -1
  131. package/dist/v1/types/event.test.js +13 -13
  132. package/dist/v1/types/event.test.js.map +1 -1
  133. package/dist/v1/types/message.d.ts +12 -109
  134. package/dist/v1/types/message.d.ts.map +1 -1
  135. package/dist/v1/types/message.js +0 -7
  136. package/dist/v1/types/message.js.map +1 -1
  137. package/dist/v1/utils/event-accumulator.test.js +183 -184
  138. package/dist/v1/utils/event-accumulator.test.js.map +1 -1
  139. package/dist/v1/utils/json-patch.test.js +4 -4
  140. package/dist/v1/utils/json-patch.test.js.map +1 -1
  141. package/dist/v1/utils/keyed-throttle.test.js +12 -12
  142. package/dist/v1/utils/keyed-throttle.test.js.map +1 -1
  143. package/dist/v1/utils/registry-conversion.test.js +13 -13
  144. package/dist/v1/utils/registry-conversion.test.js.map +1 -1
  145. package/dist/v1/utils/stream-handler.test.js +5 -5
  146. package/dist/v1/utils/stream-handler.test.js.map +1 -1
  147. package/dist/v1/utils/tool-call-tracker.test.js +15 -9
  148. package/dist/v1/utils/tool-call-tracker.test.js.map +1 -1
  149. package/dist/v1/utils/tool-executor.test.js +25 -26
  150. package/dist/v1/utils/tool-executor.test.js.map +1 -1
  151. package/dist/v1/utils/unstrictify.test.js +16 -16
  152. package/dist/v1/utils/unstrictify.test.js.map +1 -1
  153. package/esm/context-helpers/current-interactables-context-helper.d.ts +16 -2
  154. package/esm/context-helpers/current-interactables-context-helper.d.ts.map +1 -1
  155. package/esm/context-helpers/current-interactables-context-helper.js.map +1 -1
  156. package/esm/context-helpers/current-interactables-context-helper.test.d.ts +2 -0
  157. package/esm/context-helpers/current-interactables-context-helper.test.d.ts.map +1 -0
  158. package/esm/context-helpers/current-interactables-context-helper.test.js +68 -0
  159. package/esm/context-helpers/current-interactables-context-helper.test.js.map +1 -0
  160. package/esm/mcp/elicitation.d.ts +3 -37
  161. package/esm/mcp/elicitation.d.ts.map +1 -1
  162. package/esm/mcp/elicitation.js +4 -24
  163. package/esm/mcp/elicitation.js.map +1 -1
  164. package/esm/mcp/index.d.ts +4 -4
  165. package/esm/mcp/index.d.ts.map +1 -1
  166. package/esm/mcp/index.js +1 -1
  167. package/esm/mcp/index.js.map +1 -1
  168. package/esm/mcp/mcp-client.test.js +1 -1
  169. package/esm/mcp/mcp-client.test.js.map +1 -1
  170. package/esm/mcp/mcp-hooks.d.ts.map +1 -1
  171. package/esm/mcp/mcp-hooks.js +4 -1
  172. package/esm/mcp/mcp-hooks.js.map +1 -1
  173. package/esm/mcp/mcp-hooks.test.js +3 -2
  174. package/esm/mcp/mcp-hooks.test.js.map +1 -1
  175. package/esm/mcp/tambo-mcp-provider.d.ts +6 -9
  176. package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
  177. package/esm/mcp/tambo-mcp-provider.js +4 -8
  178. package/esm/mcp/tambo-mcp-provider.js.map +1 -1
  179. package/esm/mcp/tambo-mcp-provider.test.js +3 -2
  180. package/esm/mcp/tambo-mcp-provider.test.js.map +1 -1
  181. package/esm/mcp/use-mcp-servers.test.js +2 -1
  182. package/esm/mcp/use-mcp-servers.test.js.map +1 -1
  183. package/esm/model/component-metadata.d.ts +7 -372
  184. package/esm/model/component-metadata.d.ts.map +1 -1
  185. package/esm/model/component-metadata.js.map +1 -1
  186. package/esm/model/validate-input.test.d.ts +2 -0
  187. package/esm/model/validate-input.test.d.ts.map +1 -0
  188. package/esm/model/validate-input.test.js +36 -0
  189. package/esm/model/validate-input.test.js.map +1 -0
  190. package/esm/providers/tambo-interactable-provider.d.ts +7 -7
  191. package/esm/providers/tambo-registry-provider.d.ts +1 -1
  192. package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
  193. package/esm/providers/tambo-registry-provider.js.map +1 -1
  194. package/esm/providers/tambo-registry-schema-compat.test.js +4 -4
  195. package/esm/providers/tambo-registry-schema-compat.test.js.map +1 -1
  196. package/esm/schema/index.d.ts +2 -4
  197. package/esm/schema/index.d.ts.map +1 -1
  198. package/esm/schema/index.js +2 -4
  199. package/esm/schema/index.js.map +1 -1
  200. package/esm/schema/json-schema.d.ts +1 -17
  201. package/esm/schema/json-schema.d.ts.map +1 -1
  202. package/esm/schema/json-schema.js +2 -67
  203. package/esm/schema/json-schema.js.map +1 -1
  204. package/esm/schema/schema.test.js +1 -2
  205. package/esm/schema/schema.test.js.map +1 -1
  206. package/esm/schema/standard-schema.test.js +1 -1
  207. package/esm/schema/standard-schema.test.js.map +1 -1
  208. package/esm/schema/validate.test.js +1 -1
  209. package/esm/schema/validate.test.js.map +1 -1
  210. package/esm/testing/tools.d.ts +4 -4
  211. package/esm/testing/tools.test.d.ts +2 -0
  212. package/esm/testing/tools.test.d.ts.map +1 -0
  213. package/esm/testing/tools.test.js +58 -0
  214. package/esm/testing/tools.test.js.map +1 -0
  215. package/esm/util/mcp-server-utils.d.ts +1 -1
  216. package/esm/util/mcp-server-utils.d.ts.map +1 -1
  217. package/esm/util/mcp-server-utils.js +1 -1
  218. package/esm/util/mcp-server-utils.js.map +1 -1
  219. package/esm/util/mcp-server-utils.test.js +1 -1
  220. package/esm/util/mcp-server-utils.test.js.map +1 -1
  221. package/esm/util/registry.js +1 -1
  222. package/esm/util/registry.js.map +1 -1
  223. package/esm/util/resource-content-resolver.js +1 -1
  224. package/esm/util/resource-content-resolver.js.map +1 -1
  225. package/esm/util/resource-content-resolver.test.js +2 -2
  226. package/esm/util/resource-content-resolver.test.js.map +1 -1
  227. package/esm/util/tool-caller.test.d.ts +2 -0
  228. package/esm/util/tool-caller.test.d.ts.map +1 -0
  229. package/esm/util/tool-caller.test.js +69 -0
  230. package/esm/util/tool-caller.test.js.map +1 -0
  231. package/esm/v1/__tests__/v1-interactables.test.js +1 -0
  232. package/esm/v1/__tests__/v1-interactables.test.js.map +1 -1
  233. package/esm/v1/hooks/use-tambo-v1-auth-state.d.ts +1 -1
  234. package/esm/v1/hooks/use-tambo-v1-auth-state.d.ts.map +1 -1
  235. package/esm/v1/hooks/use-tambo-v1-auth-state.js.map +1 -1
  236. package/esm/v1/hooks/use-tambo-v1-component-state.js +1 -1
  237. package/esm/v1/hooks/use-tambo-v1-component-state.js.map +1 -1
  238. package/esm/v1/hooks/use-tambo-v1-component-state.test.js +1 -1
  239. package/esm/v1/hooks/use-tambo-v1-component-state.test.js.map +1 -1
  240. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts +1 -1
  241. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
  242. package/esm/v1/hooks/use-tambo-v1-send-message.js +6 -6
  243. package/esm/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
  244. package/esm/v1/hooks/use-tambo-v1-send-message.test.js +1 -1
  245. package/esm/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
  246. package/esm/v1/hooks/use-tambo-v1-stream-status.js +1 -1
  247. package/esm/v1/hooks/use-tambo-v1-stream-status.js.map +1 -1
  248. package/esm/v1/hooks/use-tambo-v1-stream-status.test.js +9 -5
  249. package/esm/v1/hooks/use-tambo-v1-stream-status.test.js.map +1 -1
  250. package/esm/v1/hooks/use-tambo-v1-suggestions.js +1 -1
  251. package/esm/v1/hooks/use-tambo-v1-suggestions.js.map +1 -1
  252. package/esm/v1/hooks/use-tambo-v1-thread-input.test.js +1 -0
  253. package/esm/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
  254. package/esm/v1/hooks/use-tambo-v1.d.ts +7 -6
  255. package/esm/v1/hooks/use-tambo-v1.d.ts.map +1 -1
  256. package/esm/v1/hooks/use-tambo-v1.js +1 -1
  257. package/esm/v1/hooks/use-tambo-v1.js.map +1 -1
  258. package/esm/v1/hooks/use-tambo-v1.test.js +22 -22
  259. package/esm/v1/hooks/use-tambo-v1.test.js.map +1 -1
  260. package/esm/v1/index.d.ts +6 -6
  261. package/esm/v1/index.d.ts.map +1 -1
  262. package/esm/v1/index.js +1 -1
  263. package/esm/v1/index.js.map +1 -1
  264. package/esm/v1/providers/tambo-v1-provider.d.ts +2 -1
  265. package/esm/v1/providers/tambo-v1-provider.d.ts.map +1 -1
  266. package/esm/v1/providers/tambo-v1-provider.js +2 -0
  267. package/esm/v1/providers/tambo-v1-provider.js.map +1 -1
  268. package/esm/v1/providers/tambo-v1-stream-context.d.ts +2 -2
  269. package/esm/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
  270. package/esm/v1/providers/tambo-v1-stream-context.js +1 -1
  271. package/esm/v1/providers/tambo-v1-stream-context.js.map +1 -1
  272. package/esm/v1/providers/tambo-v1-stream-context.test.js +35 -0
  273. package/esm/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
  274. package/esm/v1/providers/tambo-v1-stub-provider.d.ts +1 -1
  275. package/esm/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -1
  276. package/esm/v1/providers/tambo-v1-stub-provider.js +1 -1
  277. package/esm/v1/providers/tambo-v1-stub-provider.js.map +1 -1
  278. package/esm/v1/providers/tambo-v1-stub-provider.test.js.map +1 -1
  279. package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts +1 -1
  280. package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -1
  281. package/esm/v1/providers/tambo-v1-thread-input-provider.js +1 -1
  282. package/esm/v1/providers/tambo-v1-thread-input-provider.js.map +1 -1
  283. package/esm/v1/types/event.test.js +1 -1
  284. package/esm/v1/types/event.test.js.map +1 -1
  285. package/esm/v1/types/message.d.ts +12 -109
  286. package/esm/v1/types/message.d.ts.map +1 -1
  287. package/esm/v1/types/message.js +0 -7
  288. package/esm/v1/types/message.js.map +1 -1
  289. package/esm/v1/utils/event-accumulator.test.js +2 -3
  290. package/esm/v1/utils/event-accumulator.test.js.map +1 -1
  291. package/esm/v1/utils/json-patch.test.js +1 -1
  292. package/esm/v1/utils/json-patch.test.js.map +1 -1
  293. package/esm/v1/utils/keyed-throttle.test.js +1 -1
  294. package/esm/v1/utils/keyed-throttle.test.js.map +1 -1
  295. package/esm/v1/utils/registry-conversion.test.js +1 -1
  296. package/esm/v1/utils/registry-conversion.test.js.map +1 -1
  297. package/esm/v1/utils/stream-handler.test.js +1 -1
  298. package/esm/v1/utils/stream-handler.test.js.map +1 -1
  299. package/esm/v1/utils/tool-call-tracker.test.js +9 -3
  300. package/esm/v1/utils/tool-call-tracker.test.js.map +1 -1
  301. package/esm/v1/utils/tool-executor.test.js +1 -2
  302. package/esm/v1/utils/tool-executor.test.js.map +1 -1
  303. package/esm/v1/utils/unstrictify.test.js +1 -1
  304. package/esm/v1/utils/unstrictify.test.js.map +1 -1
  305. package/package.json +10 -11
  306. package/dist/mcp/mcp-client.d.ts +0 -185
  307. package/dist/mcp/mcp-client.d.ts.map +0 -1
  308. package/dist/mcp/mcp-client.js +0 -219
  309. package/dist/mcp/mcp-client.js.map +0 -1
  310. package/dist/mcp/mcp-constants.d.ts +0 -19
  311. package/dist/mcp/mcp-constants.d.ts.map +0 -1
  312. package/dist/mcp/mcp-constants.js +0 -21
  313. package/dist/mcp/mcp-constants.js.map +0 -1
  314. package/dist/model/mcp-server-info.d.ts +0 -76
  315. package/dist/model/mcp-server-info.d.ts.map +0 -1
  316. package/dist/model/mcp-server-info.js +0 -29
  317. package/dist/model/mcp-server-info.js.map +0 -1
  318. package/dist/schema/schema.d.ts +0 -49
  319. package/dist/schema/schema.d.ts.map +0 -1
  320. package/dist/schema/schema.js +0 -129
  321. package/dist/schema/schema.js.map +0 -1
  322. package/dist/schema/standard-schema.d.ts +0 -22
  323. package/dist/schema/standard-schema.d.ts.map +0 -1
  324. package/dist/schema/standard-schema.js +0 -42
  325. package/dist/schema/standard-schema.js.map +0 -1
  326. package/dist/schema/validate.d.ts +0 -14
  327. package/dist/schema/validate.d.ts.map +0 -1
  328. package/dist/schema/validate.js +0 -148
  329. package/dist/schema/validate.js.map +0 -1
  330. package/dist/v1/types/auth.d.ts +0 -24
  331. package/dist/v1/types/auth.d.ts.map +0 -1
  332. package/dist/v1/types/auth.js +0 -3
  333. package/dist/v1/types/auth.js.map +0 -1
  334. package/dist/v1/types/event.d.ts +0 -89
  335. package/dist/v1/types/event.d.ts.map +0 -1
  336. package/dist/v1/types/event.js +0 -57
  337. package/dist/v1/types/event.js.map +0 -1
  338. package/dist/v1/types/thread.d.ts +0 -58
  339. package/dist/v1/types/thread.d.ts.map +0 -1
  340. package/dist/v1/types/thread.js +0 -9
  341. package/dist/v1/types/thread.js.map +0 -1
  342. package/dist/v1/types/tool-choice.d.ts +0 -8
  343. package/dist/v1/types/tool-choice.d.ts.map +0 -1
  344. package/dist/v1/types/tool-choice.js +0 -3
  345. package/dist/v1/types/tool-choice.js.map +0 -1
  346. package/dist/v1/utils/event-accumulator.d.ts +0 -165
  347. package/dist/v1/utils/event-accumulator.d.ts.map +0 -1
  348. package/dist/v1/utils/event-accumulator.js +0 -1277
  349. package/dist/v1/utils/event-accumulator.js.map +0 -1
  350. package/dist/v1/utils/json-patch.d.ts +0 -18
  351. package/dist/v1/utils/json-patch.d.ts.map +0 -1
  352. package/dist/v1/utils/json-patch.js +0 -35
  353. package/dist/v1/utils/json-patch.js.map +0 -1
  354. package/dist/v1/utils/keyed-throttle.d.ts +0 -42
  355. package/dist/v1/utils/keyed-throttle.d.ts.map +0 -1
  356. package/dist/v1/utils/keyed-throttle.js +0 -86
  357. package/dist/v1/utils/keyed-throttle.js.map +0 -1
  358. package/dist/v1/utils/registry-conversion.d.ts +0 -53
  359. package/dist/v1/utils/registry-conversion.d.ts.map +0 -1
  360. package/dist/v1/utils/registry-conversion.js +0 -115
  361. package/dist/v1/utils/registry-conversion.js.map +0 -1
  362. package/dist/v1/utils/stream-handler.d.ts +0 -45
  363. package/dist/v1/utils/stream-handler.d.ts.map +0 -1
  364. package/dist/v1/utils/stream-handler.js +0 -47
  365. package/dist/v1/utils/stream-handler.js.map +0 -1
  366. package/dist/v1/utils/thread-utils.d.ts +0 -16
  367. package/dist/v1/utils/thread-utils.d.ts.map +0 -1
  368. package/dist/v1/utils/thread-utils.js +0 -34
  369. package/dist/v1/utils/thread-utils.js.map +0 -1
  370. package/dist/v1/utils/tool-call-tracker.d.ts +0 -73
  371. package/dist/v1/utils/tool-call-tracker.d.ts.map +0 -1
  372. package/dist/v1/utils/tool-call-tracker.js +0 -180
  373. package/dist/v1/utils/tool-call-tracker.js.map +0 -1
  374. package/dist/v1/utils/tool-executor.d.ts +0 -67
  375. package/dist/v1/utils/tool-executor.d.ts.map +0 -1
  376. package/dist/v1/utils/tool-executor.js +0 -160
  377. package/dist/v1/utils/tool-executor.js.map +0 -1
  378. package/dist/v1/utils/unstrictify.d.ts +0 -32
  379. package/dist/v1/utils/unstrictify.d.ts.map +0 -1
  380. package/dist/v1/utils/unstrictify.js +0 -159
  381. package/dist/v1/utils/unstrictify.js.map +0 -1
  382. package/esm/mcp/mcp-client.d.ts +0 -185
  383. package/esm/mcp/mcp-client.d.ts.map +0 -1
  384. package/esm/mcp/mcp-client.js +0 -216
  385. package/esm/mcp/mcp-client.js.map +0 -1
  386. package/esm/mcp/mcp-constants.d.ts +0 -19
  387. package/esm/mcp/mcp-constants.d.ts.map +0 -1
  388. package/esm/mcp/mcp-constants.js +0 -18
  389. package/esm/mcp/mcp-constants.js.map +0 -1
  390. package/esm/model/mcp-server-info.d.ts +0 -76
  391. package/esm/model/mcp-server-info.d.ts.map +0 -1
  392. package/esm/model/mcp-server-info.js +0 -25
  393. package/esm/model/mcp-server-info.js.map +0 -1
  394. package/esm/schema/schema.d.ts +0 -49
  395. package/esm/schema/schema.d.ts.map +0 -1
  396. package/esm/schema/schema.js +0 -124
  397. package/esm/schema/schema.js.map +0 -1
  398. package/esm/schema/standard-schema.d.ts +0 -22
  399. package/esm/schema/standard-schema.d.ts.map +0 -1
  400. package/esm/schema/standard-schema.js +0 -39
  401. package/esm/schema/standard-schema.js.map +0 -1
  402. package/esm/schema/validate.d.ts +0 -14
  403. package/esm/schema/validate.d.ts.map +0 -1
  404. package/esm/schema/validate.js +0 -145
  405. package/esm/schema/validate.js.map +0 -1
  406. package/esm/v1/types/auth.d.ts +0 -24
  407. package/esm/v1/types/auth.d.ts.map +0 -1
  408. package/esm/v1/types/auth.js +0 -2
  409. package/esm/v1/types/auth.js.map +0 -1
  410. package/esm/v1/types/event.d.ts +0 -89
  411. package/esm/v1/types/event.d.ts.map +0 -1
  412. package/esm/v1/types/event.js +0 -53
  413. package/esm/v1/types/event.js.map +0 -1
  414. package/esm/v1/types/thread.d.ts +0 -58
  415. package/esm/v1/types/thread.d.ts.map +0 -1
  416. package/esm/v1/types/thread.js +0 -8
  417. package/esm/v1/types/thread.js.map +0 -1
  418. package/esm/v1/types/tool-choice.d.ts +0 -8
  419. package/esm/v1/types/tool-choice.d.ts.map +0 -1
  420. package/esm/v1/types/tool-choice.js +0 -2
  421. package/esm/v1/types/tool-choice.js.map +0 -1
  422. package/esm/v1/utils/event-accumulator.d.ts +0 -165
  423. package/esm/v1/utils/event-accumulator.d.ts.map +0 -1
  424. package/esm/v1/utils/event-accumulator.js +0 -1268
  425. package/esm/v1/utils/event-accumulator.js.map +0 -1
  426. package/esm/v1/utils/json-patch.d.ts +0 -18
  427. package/esm/v1/utils/json-patch.d.ts.map +0 -1
  428. package/esm/v1/utils/json-patch.js +0 -32
  429. package/esm/v1/utils/json-patch.js.map +0 -1
  430. package/esm/v1/utils/keyed-throttle.d.ts +0 -42
  431. package/esm/v1/utils/keyed-throttle.d.ts.map +0 -1
  432. package/esm/v1/utils/keyed-throttle.js +0 -83
  433. package/esm/v1/utils/keyed-throttle.js.map +0 -1
  434. package/esm/v1/utils/registry-conversion.d.ts +0 -53
  435. package/esm/v1/utils/registry-conversion.d.ts.map +0 -1
  436. package/esm/v1/utils/registry-conversion.js +0 -109
  437. package/esm/v1/utils/registry-conversion.js.map +0 -1
  438. package/esm/v1/utils/stream-handler.d.ts +0 -45
  439. package/esm/v1/utils/stream-handler.d.ts.map +0 -1
  440. package/esm/v1/utils/stream-handler.js +0 -44
  441. package/esm/v1/utils/stream-handler.js.map +0 -1
  442. package/esm/v1/utils/thread-utils.d.ts +0 -16
  443. package/esm/v1/utils/thread-utils.d.ts.map +0 -1
  444. package/esm/v1/utils/thread-utils.js +0 -31
  445. package/esm/v1/utils/thread-utils.js.map +0 -1
  446. package/esm/v1/utils/tool-call-tracker.d.ts +0 -73
  447. package/esm/v1/utils/tool-call-tracker.d.ts.map +0 -1
  448. package/esm/v1/utils/tool-call-tracker.js +0 -176
  449. package/esm/v1/utils/tool-call-tracker.js.map +0 -1
  450. package/esm/v1/utils/tool-executor.d.ts +0 -67
  451. package/esm/v1/utils/tool-executor.d.ts.map +0 -1
  452. package/esm/v1/utils/tool-executor.js +0 -154
  453. package/esm/v1/utils/tool-executor.js.map +0 -1
  454. package/esm/v1/utils/unstrictify.d.ts +0 -32
  455. package/esm/v1/utils/unstrictify.d.ts.map +0 -1
  456. package/esm/v1/utils/unstrictify.js +0 -155
  457. package/esm/v1/utils/unstrictify.js.map +0 -1
@@ -1,76 +0,0 @@
1
- /**
2
- * The transport protocol to use for MCP connections.
3
- */
4
- export declare enum MCPTransport {
5
- SSE = "sse",
6
- HTTP = "http"
7
- }
8
- /**
9
- * User-provided configuration for an MCP server.
10
- *
11
- * This is the type accepted by `TamboProvider` / `TamboRegistryProvider` in
12
- * the `mcpServers` prop.
13
- *
14
- * The `handlers` field is intentionally typed as `unknown` here so the core
15
- * SDK does not depend on the MCP subpackage. In the `@tambo-ai/react/mcp`
16
- * subpackage this is treated as `Partial<MCPHandlers>` (with
17
- * `elicitation` / `sampling` callbacks). The `@modelcontextprotocol/sdk` is
18
- * included automatically with `@tambo-ai/react`. See the React SDK README for
19
- * any additional optional peer dependencies needed for MCP features.
20
- */
21
- export interface McpServerInfo {
22
- /** Optional name for the MCP server */
23
- name?: string;
24
- /** The URL of the MCP server to connect to */
25
- url: string;
26
- /** Optional description of the MCP server */
27
- description?: string;
28
- /** The transport type to use (SSE or HTTP). Defaults to HTTP for string URLs */
29
- transport?: MCPTransport;
30
- /** Optional custom headers to include in requests */
31
- customHeaders?: Record<string, string>;
32
- /**
33
- * Optional short name for namespacing MCP resources, prompts, and tools.
34
- * When multiple MCP servers are configured, this key is used to prefix:
35
- * - prompts: `<serverKey>:<promptName>`
36
- * - resources: `<serverKey>:<resourceUrl>`
37
- * - tools: `<serverKey>__<toolName>`
38
- *
39
- * If not provided, a key will be derived from the URL hostname.
40
- * For example, "https://mcp.linear.app/mcp" becomes "linear".
41
- */
42
- serverKey?: string;
43
- /**
44
- * Optional handlers for elicitation and sampling requests from the server.
45
- *
46
- * In the MCP subpackage this is interpreted as `Partial<MCPHandlers>`,
47
- * i.e. `{ elicitation?: MCPElicitationHandler; sampling?: MCPSamplingHandler }`.
48
- *
49
- * Note: These callbacks should be stable (e.g., wrapped in useCallback or
50
- * defined outside the component) to avoid constant re-registration of the
51
- * MCP server on every render.
52
- */
53
- handlers?: unknown;
54
- }
55
- /**
56
- * Normalized MCP server metadata used internally by the registry and MCP
57
- * provider.
58
- *
59
- * This is equivalent to `McpServerInfo` except that:
60
- * - `serverKey` is guaranteed to be present
61
- * - `transport` is resolved to a concrete value (defaults to HTTP)
62
- */
63
- export interface NormalizedMcpServerInfo extends McpServerInfo {
64
- transport: MCPTransport;
65
- serverKey: string;
66
- }
67
- /**
68
- * Creates a stable identifier for an MCP server based on its connection properties.
69
- * Two servers with the same URL, transport, and headers will have the same key.
70
- *
71
- * This is used by both the registry and MCP provider to deduplicate servers,
72
- * so it lives alongside the shared server metadata type.
73
- * @returns A stable string key identifying the server
74
- */
75
- export declare function getMcpServerUniqueKey(serverInfo: Pick<McpServerInfo, "url" | "transport" | "customHeaders">): string;
76
- //# sourceMappingURL=mcp-server-info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-server-info.d.ts","sourceRoot":"","sources":["../../src/model/mcp-server-info.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D,SAAS,EAAE,YAAY,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,WAAW,GAAG,eAAe,CAAC,GACrE,MAAM,CAUR"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MCPTransport = void 0;
4
- exports.getMcpServerUniqueKey = getMcpServerUniqueKey;
5
- /**
6
- * The transport protocol to use for MCP connections.
7
- */
8
- var MCPTransport;
9
- (function (MCPTransport) {
10
- MCPTransport["SSE"] = "sse";
11
- MCPTransport["HTTP"] = "http";
12
- })(MCPTransport || (exports.MCPTransport = MCPTransport = {}));
13
- /**
14
- * Creates a stable identifier for an MCP server based on its connection properties.
15
- * Two servers with the same URL, transport, and headers will have the same key.
16
- *
17
- * This is used by both the registry and MCP provider to deduplicate servers,
18
- * so it lives alongside the shared server metadata type.
19
- * @returns A stable string key identifying the server
20
- */
21
- function getMcpServerUniqueKey(serverInfo) {
22
- const headerStr = serverInfo.customHeaders
23
- ? JSON.stringify(Object.entries(serverInfo.customHeaders)
24
- .map(([k, v]) => [k.toLowerCase(), v])
25
- .sort(([a], [b]) => a.localeCompare(b)))
26
- : "";
27
- return `${serverInfo.url}|${serverInfo.transport ?? MCPTransport.HTTP}|${headerStr}`;
28
- }
29
- //# sourceMappingURL=mcp-server-info.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-server-info.js","sourceRoot":"","sources":["../../src/model/mcp-server-info.ts"],"names":[],"mappings":";;;AA6EA,sDAYC;AAzFD;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACf,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AA+DD;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,UAAsE;IAEtE,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa;QACxC,CAAC,CAAC,IAAI,CAAC,SAAS,CACZ,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAU,CAAC;aAC9C,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAC1C;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,GAAG,UAAU,CAAC,GAAG,IAAI,UAAU,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;AACvF,CAAC","sourcesContent":["/**\n * The transport protocol to use for MCP connections.\n */\nexport enum MCPTransport {\n SSE = \"sse\",\n HTTP = \"http\",\n}\n\n/**\n * User-provided configuration for an MCP server.\n *\n * This is the type accepted by `TamboProvider` / `TamboRegistryProvider` in\n * the `mcpServers` prop.\n *\n * The `handlers` field is intentionally typed as `unknown` here so the core\n * SDK does not depend on the MCP subpackage. In the `@tambo-ai/react/mcp`\n * subpackage this is treated as `Partial<MCPHandlers>` (with\n * `elicitation` / `sampling` callbacks). The `@modelcontextprotocol/sdk` is\n * included automatically with `@tambo-ai/react`. See the React SDK README for\n * any additional optional peer dependencies needed for MCP features.\n */\nexport interface McpServerInfo {\n /** Optional name for the MCP server */\n name?: string;\n /** The URL of the MCP server to connect to */\n url: string;\n /** Optional description of the MCP server */\n description?: string;\n /** The transport type to use (SSE or HTTP). Defaults to HTTP for string URLs */\n transport?: MCPTransport;\n /** Optional custom headers to include in requests */\n customHeaders?: Record<string, string>;\n /**\n * Optional short name for namespacing MCP resources, prompts, and tools.\n * When multiple MCP servers are configured, this key is used to prefix:\n * - prompts: `<serverKey>:<promptName>`\n * - resources: `<serverKey>:<resourceUrl>`\n * - tools: `<serverKey>__<toolName>`\n *\n * If not provided, a key will be derived from the URL hostname.\n * For example, \"https://mcp.linear.app/mcp\" becomes \"linear\".\n */\n serverKey?: string;\n /**\n * Optional handlers for elicitation and sampling requests from the server.\n *\n * In the MCP subpackage this is interpreted as `Partial<MCPHandlers>`,\n * i.e. `{ elicitation?: MCPElicitationHandler; sampling?: MCPSamplingHandler }`.\n *\n * Note: These callbacks should be stable (e.g., wrapped in useCallback or\n * defined outside the component) to avoid constant re-registration of the\n * MCP server on every render.\n */\n handlers?: unknown;\n}\n\n/**\n * Normalized MCP server metadata used internally by the registry and MCP\n * provider.\n *\n * This is equivalent to `McpServerInfo` except that:\n * - `serverKey` is guaranteed to be present\n * - `transport` is resolved to a concrete value (defaults to HTTP)\n */\nexport interface NormalizedMcpServerInfo extends McpServerInfo {\n transport: MCPTransport;\n serverKey: string;\n}\n\n/**\n * Creates a stable identifier for an MCP server based on its connection properties.\n * Two servers with the same URL, transport, and headers will have the same key.\n *\n * This is used by both the registry and MCP provider to deduplicate servers,\n * so it lives alongside the shared server metadata type.\n * @returns A stable string key identifying the server\n */\nexport function getMcpServerUniqueKey(\n serverInfo: Pick<McpServerInfo, \"url\" | \"transport\" | \"customHeaders\">,\n): string {\n const headerStr = serverInfo.customHeaders\n ? JSON.stringify(\n Object.entries(serverInfo.customHeaders)\n .map(([k, v]) => [k.toLowerCase(), v] as const)\n .sort(([a], [b]) => a.localeCompare(b)),\n )\n : \"\";\n\n return `${serverInfo.url}|${serverInfo.transport ?? MCPTransport.HTTP}|${headerStr}`;\n}\n"]}
@@ -1,49 +0,0 @@
1
- /**
2
- * Schema utilities for working with Standard Schema and JSON Schema.
3
- *
4
- * This module provides a unified interface for handling different schema types
5
- * used in Tambo components and tools. It uses Standard Schema (https://standardschema.dev/)
6
- * as the primary interface, which is implemented by Zod 3.24+ and other validation libraries.
7
- *
8
- * JSON Schema conversion is handled by `@standard-community/standard-json`.
9
- * @module schema
10
- */
11
- import type { JSONSchema7 } from "json-schema";
12
- import { ParameterSpec, SupportedSchema, TamboTool } from "../model/component-metadata";
13
- /**
14
- * Converts a schema (Standard Schema or JSON Schema) to a JSON Schema object.
15
- *
16
- * If the schema is already a JSON Schema, it is returned as-is.
17
- * For Standard Schema validators (Zod 3.24+, etc.), uses
18
- * `@standard-community/standard-json` for conversion.
19
- * @param schema - The schema to convert
20
- * @returns The JSON Schema representation
21
- * @example
22
- * ```typescript
23
- * import { z } from "zod/v4";
24
- *
25
- * // Convert a Zod schema
26
- * const zodSchema = z.object({ name: z.string() });
27
- * const jsonSchema = schemaToJsonSchema(zodSchema);
28
- *
29
- * // Pass through a JSON Schema
30
- * const existingJsonSchema = { type: "object", properties: { name: { type: "string" } } };
31
- * schemaToJsonSchema(existingJsonSchema); // returns the same object
32
- * ```
33
- */
34
- export declare function schemaToJsonSchema(schema: SupportedSchema): JSONSchema7;
35
- /**
36
- * Safely converts a schema to JSON Schema, returning undefined for invalid inputs.
37
- * @param schema - The schema to convert (may be undefined)
38
- * @param onError - Optional callback invoked on conversion error
39
- * @returns The JSON Schema representation, or undefined if conversion fails
40
- */
41
- export declare function safeSchemaToJsonSchema(schema: SupportedSchema | undefined | null, onError?: (error: unknown) => void): JSONSchema7 | undefined;
42
- /**
43
- * Extracts parameter specifications from a tool's inputSchema.
44
- * @param tool - The tool containing the schema
45
- * @returns An array of parameter specifications
46
- */
47
- export declare function getParametersFromToolSchema(tool: TamboTool): ParameterSpec[];
48
- export type { SupportedSchema };
49
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EACL,aAAa,EACb,eAAe,EACf,SAAS,EACV,MAAM,6BAA6B,CAAC;AAuBrC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,CAOvE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,EAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,WAAW,GAAG,SAAS,CAYzB;AAoCD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,CAe5E;AAED,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- /**
3
- * Schema utilities for working with Standard Schema and JSON Schema.
4
- *
5
- * This module provides a unified interface for handling different schema types
6
- * used in Tambo components and tools. It uses Standard Schema (https://standardschema.dev/)
7
- * as the primary interface, which is implemented by Zod 3.24+ and other validation libraries.
8
- *
9
- * JSON Schema conversion is handled by `@standard-community/standard-json`.
10
- * @module schema
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.schemaToJsonSchema = schemaToJsonSchema;
14
- exports.safeSchemaToJsonSchema = safeSchemaToJsonSchema;
15
- exports.getParametersFromToolSchema = getParametersFromToolSchema;
16
- const standard_json_1 = require("@standard-community/standard-json");
17
- const zod_to_json_schema_1 = require("zod-to-json-schema");
18
- const core_1 = require("zod/v4/core");
19
- const json_schema_1 = require("./json-schema");
20
- const standard_schema_1 = require("./standard-schema");
21
- /**
22
- * Register the zod vendor handler for synchronous JSON Schema conversion.
23
- * This uses Zod 4's native toJSONSchema for Zod 4.x schemas and zod-to-json-schema for Zod 3.x.
24
- */
25
- (0, standard_json_1.loadVendor)("zod", (schema) => {
26
- // Check if this is a Zod 4 schema (has _zod property)
27
- if (schema && typeof schema === "object" && "_zod" in schema) {
28
- // Use Zod 4's native toJSONSchema from zod/v4/core
29
- // Cast through unknown since the Zod 4 internal types don't match our detection pattern
30
- return (0, core_1.toJSONSchema)(schema);
31
- }
32
- // Fall back to zod-to-json-schema for Zod 3.x
33
- return (0, zod_to_json_schema_1.zodToJsonSchema)(schema);
34
- });
35
- /**
36
- * Converts a schema (Standard Schema or JSON Schema) to a JSON Schema object.
37
- *
38
- * If the schema is already a JSON Schema, it is returned as-is.
39
- * For Standard Schema validators (Zod 3.24+, etc.), uses
40
- * `@standard-community/standard-json` for conversion.
41
- * @param schema - The schema to convert
42
- * @returns The JSON Schema representation
43
- * @example
44
- * ```typescript
45
- * import { z } from "zod/v4";
46
- *
47
- * // Convert a Zod schema
48
- * const zodSchema = z.object({ name: z.string() });
49
- * const jsonSchema = schemaToJsonSchema(zodSchema);
50
- *
51
- * // Pass through a JSON Schema
52
- * const existingJsonSchema = { type: "object", properties: { name: { type: "string" } } };
53
- * schemaToJsonSchema(existingJsonSchema); // returns the same object
54
- * ```
55
- */
56
- function schemaToJsonSchema(schema) {
57
- // Already a JSON Schema - return as-is
58
- if (!(0, standard_schema_1.isStandardSchema)(schema)) {
59
- return schema;
60
- }
61
- return standard_json_1.toJsonSchema.sync(schema);
62
- }
63
- /**
64
- * Safely converts a schema to JSON Schema, returning undefined for invalid inputs.
65
- * @param schema - The schema to convert (may be undefined)
66
- * @param onError - Optional callback invoked on conversion error
67
- * @returns The JSON Schema representation, or undefined if conversion fails
68
- */
69
- function safeSchemaToJsonSchema(schema, onError) {
70
- if (!schema) {
71
- return undefined;
72
- }
73
- try {
74
- return schemaToJsonSchema(schema);
75
- }
76
- catch (error) {
77
- console.error("Error converting schema to JSON Schema:", error);
78
- onError?.(error);
79
- return undefined;
80
- }
81
- }
82
- /**
83
- * Creates parameter specs from an input schema.
84
- * The schema represents the shape of the single object argument to the tool function.
85
- * @param schema - The input schema (JSON Schema)
86
- * @returns An array of parameter specifications
87
- */
88
- function createParametersFromSchema(schema) {
89
- const properties = schema.properties ?? {};
90
- return Object.entries(properties).map(([key, propSchema]) => ({
91
- name: key,
92
- type: propSchema && typeof propSchema === "object" && "type" in propSchema
93
- ? propSchema.type
94
- : "object",
95
- description: propSchema &&
96
- typeof propSchema === "object" &&
97
- "description" in propSchema
98
- ? (propSchema.description ?? "")
99
- : "",
100
- isRequired: Array.isArray(schema.required)
101
- ? schema.required.includes(key)
102
- : false,
103
- schema: typeof propSchema === "object" && propSchema !== null
104
- ? propSchema
105
- : {},
106
- }));
107
- }
108
- /**
109
- * Extracts parameter specifications from a tool's inputSchema.
110
- * @param tool - The tool containing the schema
111
- * @returns An array of parameter specifications
112
- */
113
- function getParametersFromToolSchema(tool) {
114
- const schema = tool.inputSchema;
115
- // Convert to JSON Schema if needed
116
- let jsonSchema;
117
- if ((0, json_schema_1.looksLikeJSONSchema)(schema)) {
118
- jsonSchema = schema;
119
- }
120
- else if ((0, standard_schema_1.isStandardSchema)(schema)) {
121
- jsonSchema = schemaToJsonSchema(schema);
122
- }
123
- else {
124
- console.warn("Unknown inputSchema type, returning empty parameters");
125
- return [];
126
- }
127
- return createParametersFromSchema(jsonSchema);
128
- }
129
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAsDH,gDAOC;AAQD,wDAeC;AAyCD,kEAeC;AA1ID,qEAA6E;AAE7E,2DAAqD;AACrD,sCAA+D;AAM/D,+CA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AE,EAAE,CACpB,CAAC;QACC,IAAI,EAAE,GAAG;QACT,IAAI,EACF,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,IAAI,UAAU;YAClE,CAAC,CAAE,UAAU,CAAC,IAAe;YAC7B,CAAC,CAAC,QAAQ;QACd,WAAW,EACT,UAAU;YACV,OAAO,UAAU,KAAK,QAAQ;YAC9B,aAAa,IAAI,UAAU;YACzB,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,CAAC;YAChC,CAAC,CAAC,EAAE;QACR,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YACxC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/B,CAAC,CAAC,KAAK;QACT,MAAM,EACJ,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI;YACnD,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,EAAE;KACT,CAAyB,CAC7B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,IAAe;IACzD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;IAEhC,mCAAmC;IACnC,IAAI,UAAuB,CAAC;IAC5B,IAAI,IAAA,iCAAmB,EAAC,MAAM,CAAC,EAAE,CAAC;QAChC,UAAU,GAAG,MAAM,CAAC;IACtB,CAAC;SAAM,IAAI,IAAA,kCAAgB,EAAC,MAAM,CAAC,EAAE,CAAC;QACpC,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;QACrE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,0BAA0B,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/**\n * Schema utilities for working with Standard Schema and JSON Schema.\n *\n * This module provides a unified interface for handling different schema types\n * used in Tambo components and tools. It uses Standard Schema (https://standardschema.dev/)\n * as the primary interface, which is implemented by Zod 3.24+ and other validation libraries.\n *\n * JSON Schema conversion is handled by `@standard-community/standard-json`.\n * @module schema\n */\n\nimport { loadVendor, toJsonSchema } from \"@standard-community/standard-json\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { toJSONSchema as zod4ToJSONSchema } from \"zod/v4/core\";\nimport {\n ParameterSpec,\n SupportedSchema,\n TamboTool,\n} from \"../model/component-metadata\";\nimport { looksLikeJSONSchema } from \"./json-schema\";\nimport { isStandardSchema } from \"./standard-schema\";\n\n/**\n * Register the zod vendor handler for synchronous JSON Schema conversion.\n * This uses Zod 4's native toJSONSchema for Zod 4.x schemas and zod-to-json-schema for Zod 3.x.\n */\nloadVendor(\"zod\", (schema: unknown): JSONSchema7 => {\n // Check if this is a Zod 4 schema (has _zod property)\n if (schema && typeof schema === \"object\" && \"_zod\" in schema) {\n // Use Zod 4's native toJSONSchema from zod/v4/core\n // Cast through unknown since the Zod 4 internal types don't match our detection pattern\n return zod4ToJSONSchema(\n schema as unknown as Parameters<typeof zod4ToJSONSchema>[0],\n ) as JSONSchema7;\n }\n // Fall back to zod-to-json-schema for Zod 3.x\n return zodToJsonSchema(\n schema as Parameters<typeof zodToJsonSchema>[0],\n ) as JSONSchema7;\n});\n\n/**\n * Converts a schema (Standard Schema or JSON Schema) to a JSON Schema object.\n *\n * If the schema is already a JSON Schema, it is returned as-is.\n * For Standard Schema validators (Zod 3.24+, etc.), uses\n * `@standard-community/standard-json` for conversion.\n * @param schema - The schema to convert\n * @returns The JSON Schema representation\n * @example\n * ```typescript\n * import { z } from \"zod/v4\";\n *\n * // Convert a Zod schema\n * const zodSchema = z.object({ name: z.string() });\n * const jsonSchema = schemaToJsonSchema(zodSchema);\n *\n * // Pass through a JSON Schema\n * const existingJsonSchema = { type: \"object\", properties: { name: { type: \"string\" } } };\n * schemaToJsonSchema(existingJsonSchema); // returns the same object\n * ```\n */\nexport function schemaToJsonSchema(schema: SupportedSchema): JSONSchema7 {\n // Already a JSON Schema - return as-is\n if (!isStandardSchema(schema)) {\n return schema;\n }\n\n return toJsonSchema.sync(schema) as JSONSchema7;\n}\n\n/**\n * Safely converts a schema to JSON Schema, returning undefined for invalid inputs.\n * @param schema - The schema to convert (may be undefined)\n * @param onError - Optional callback invoked on conversion error\n * @returns The JSON Schema representation, or undefined if conversion fails\n */\nexport function safeSchemaToJsonSchema(\n schema: SupportedSchema | undefined | null,\n onError?: (error: unknown) => void,\n): JSONSchema7 | undefined {\n if (!schema) {\n return undefined;\n }\n\n try {\n return schemaToJsonSchema(schema);\n } catch (error) {\n console.error(\"Error converting schema to JSON Schema:\", error);\n onError?.(error);\n return undefined;\n }\n}\n\n/**\n * Creates parameter specs from an input schema.\n * The schema represents the shape of the single object argument to the tool function.\n * @param schema - The input schema (JSON Schema)\n * @returns An array of parameter specifications\n */\nfunction createParametersFromSchema(schema: JSONSchema7): ParameterSpec[] {\n const properties = schema.properties ?? {};\n\n return Object.entries(properties).map(\n ([key, propSchema]) =>\n ({\n name: key,\n type:\n propSchema && typeof propSchema === \"object\" && \"type\" in propSchema\n ? (propSchema.type as string)\n : \"object\",\n description:\n propSchema &&\n typeof propSchema === \"object\" &&\n \"description\" in propSchema\n ? (propSchema.description ?? \"\")\n : \"\",\n isRequired: Array.isArray(schema.required)\n ? schema.required.includes(key)\n : false,\n schema:\n typeof propSchema === \"object\" && propSchema !== null\n ? propSchema\n : {},\n }) satisfies ParameterSpec,\n );\n}\n\n/**\n * Extracts parameter specifications from a tool's inputSchema.\n * @param tool - The tool containing the schema\n * @returns An array of parameter specifications\n */\nexport function getParametersFromToolSchema(tool: TamboTool): ParameterSpec[] {\n const schema = tool.inputSchema;\n\n // Convert to JSON Schema if needed\n let jsonSchema: JSONSchema7;\n if (looksLikeJSONSchema(schema)) {\n jsonSchema = schema;\n } else if (isStandardSchema(schema)) {\n jsonSchema = schemaToJsonSchema(schema);\n } else {\n console.warn(\"Unknown inputSchema type, returning empty parameters\");\n return [];\n }\n\n return createParametersFromSchema(jsonSchema);\n}\n\nexport type { SupportedSchema };\n"]}
@@ -1,22 +0,0 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
- /**
3
- * Type guard to check if an object implements the Standard Schema interface.
4
- *
5
- * Standard Schema compliant validators have a `~standard` property containing
6
- * metadata about the schema including version, vendor, and validate function.
7
- * Uses duck typing to avoid cross-version Zod compatibility issues.
8
- * @param obj - The object to check
9
- * @returns True if the object implements StandardSchemaV1
10
- * @example
11
- * ```typescript
12
- * import { z } from "zod/v4";
13
- *
14
- * const zodSchema = z.object({ name: z.string() });
15
- * isStandardSchema(zodSchema); // true
16
- *
17
- * const jsonSchema = { type: "object", properties: { name: { type: "string" } } };
18
- * isStandardSchema(jsonSchema); // false
19
- * ```
20
- */
21
- export declare function isStandardSchema(obj: unknown): obj is StandardSchemaV1;
22
- //# sourceMappingURL=standard-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard-schema.d.ts","sourceRoot":"","sources":["../../src/schema/standard-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CAuBtE"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isStandardSchema = isStandardSchema;
4
- /**
5
- * Type guard to check if an object implements the Standard Schema interface.
6
- *
7
- * Standard Schema compliant validators have a `~standard` property containing
8
- * metadata about the schema including version, vendor, and validate function.
9
- * Uses duck typing to avoid cross-version Zod compatibility issues.
10
- * @param obj - The object to check
11
- * @returns True if the object implements StandardSchemaV1
12
- * @example
13
- * ```typescript
14
- * import { z } from "zod/v4";
15
- *
16
- * const zodSchema = z.object({ name: z.string() });
17
- * isStandardSchema(zodSchema); // true
18
- *
19
- * const jsonSchema = { type: "object", properties: { name: { type: "string" } } };
20
- * isStandardSchema(jsonSchema); // false
21
- * ```
22
- */
23
- function isStandardSchema(obj) {
24
- if (typeof obj !== "object" || obj === null) {
25
- return false;
26
- }
27
- if (!("~standard" in obj)) {
28
- return false;
29
- }
30
- const standard = obj["~standard"];
31
- if (typeof standard !== "object" || standard === null) {
32
- return false;
33
- }
34
- // Check required Standard Schema v1 properties
35
- return ("version" in standard &&
36
- standard.version === 1 &&
37
- "vendor" in standard &&
38
- typeof standard.vendor === "string" &&
39
- "validate" in standard &&
40
- typeof standard.validate === "function");
41
- }
42
- //# sourceMappingURL=standard-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard-schema.js","sourceRoot":"","sources":["../../src/schema/standard-schema.ts"],"names":[],"mappings":";;AAqBA,4CAuBC;AA1CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gBAAgB,CAAC,GAAY;IAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,CAAC,WAAW,IAAI,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;IAClC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+CAA+C;IAC/C,OAAO,CACL,SAAS,IAAI,QAAQ;QACrB,QAAQ,CAAC,OAAO,KAAK,CAAC;QACtB,QAAQ,IAAI,QAAQ;QACpB,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;QACnC,UAAU,IAAI,QAAQ;QACtB,OAAO,QAAQ,CAAC,QAAQ,KAAK,UAAU,CACxC,CAAC;AACJ,CAAC","sourcesContent":["import { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Type guard to check if an object implements the Standard Schema interface.\n *\n * Standard Schema compliant validators have a `~standard` property containing\n * metadata about the schema including version, vendor, and validate function.\n * Uses duck typing to avoid cross-version Zod compatibility issues.\n * @param obj - The object to check\n * @returns True if the object implements StandardSchemaV1\n * @example\n * ```typescript\n * import { z } from \"zod/v4\";\n *\n * const zodSchema = z.object({ name: z.string() });\n * isStandardSchema(zodSchema); // true\n *\n * const jsonSchema = { type: \"object\", properties: { name: { type: \"string\" } } };\n * isStandardSchema(jsonSchema); // false\n * ```\n */\nexport function isStandardSchema(obj: unknown): obj is StandardSchemaV1 {\n if (typeof obj !== \"object\" || obj === null) {\n return false;\n }\n\n if (!(\"~standard\" in obj)) {\n return false;\n }\n\n const standard = obj[\"~standard\"];\n if (typeof standard !== \"object\" || standard === null) {\n return false;\n }\n\n // Check required Standard Schema v1 properties\n return (\n \"version\" in standard &&\n standard.version === 1 &&\n \"vendor\" in standard &&\n typeof standard.vendor === \"string\" &&\n \"validate\" in standard &&\n typeof standard.validate === \"function\"\n );\n}\n"]}
@@ -1,14 +0,0 @@
1
- /**
2
- * Asserts that a schema does not contain record types (objects with dynamic keys).
3
- * Records are not serializable to JSON Schema in a way that the Tambo backend
4
- * understands, so they are disallowed.
5
- *
6
- * This function accepts Standard Schema validators (Zod, Valibot, ArkType, etc.)
7
- * or JSON Schema objects. It converts them to JSON Schema and checks for record patterns.
8
- *
9
- * For tool schemas that are function types, this extracts and validates the input parameters.
10
- * @param schema - The schema to validate (Standard Schema or JSON Schema)
11
- * @param contextName - A human-readable label echoed in the error message
12
- */
13
- export declare function assertNoRecordSchema(schema: unknown, contextName?: string): void;
14
- //# sourceMappingURL=validate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/schema/validate.ts"],"names":[],"mappings":"AAuIA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,EACf,WAAW,SAAW,GACrB,IAAI,CAqCN"}
@@ -1,148 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertNoRecordSchema = assertNoRecordSchema;
4
- const schema_1 = require("./schema");
5
- const standard_schema_1 = require("./standard-schema");
6
- /*
7
- * Check if a JSON Schema represents a record type (map with dynamic keys).
8
- *
9
- * For our purposes, any `object` schema with `additionalProperties` defined
10
- * as a nested schema (not just `true`/`false`) is treated as a record, even
11
- * if it also declares some explicit `properties`.
12
- * @param schema - The JSON Schema to check
13
- * @returns True if the schema represents a record-like type
14
- */
15
- function isRecordJsonSchema(schema) {
16
- return (schema.type === "object" &&
17
- typeof schema.additionalProperties === "object" &&
18
- schema.additionalProperties !== null);
19
- }
20
- /**
21
- * Recursively walks a JSON Schema and throws when it encounters a record type.
22
- * Records are not supported because they use dynamic keys which don't serialize
23
- * well for the Tambo backend.
24
- * @param schema - The JSON Schema to check
25
- * @param path - Current path in the schema (for error messages)
26
- * @param contextName - Human-readable context name for error messages
27
- */
28
- function assertNoRecordInJsonSchema(schema, path, contextName) {
29
- if (isRecordJsonSchema(schema)) {
30
- const joined = path.length ? path.join(".") : "(root)";
31
- throw new Error(`Record types (objects with dynamic keys) are not supported in ${contextName}. ` +
32
- `Found at path "${joined}". ` +
33
- "Replace it with an object using explicit keys.");
34
- }
35
- if (schema.properties) {
36
- for (const [key, propSchema] of Object.entries(schema.properties)) {
37
- if (typeof propSchema === "object" && propSchema !== null) {
38
- assertNoRecordInJsonSchema(propSchema, [...path, key], contextName);
39
- }
40
- }
41
- }
42
- if (typeof schema.additionalProperties === "object" &&
43
- schema.additionalProperties !== null) {
44
- assertNoRecordInJsonSchema(schema.additionalProperties, [...path, "[*]"], contextName);
45
- }
46
- if (schema.items) {
47
- if (Array.isArray(schema.items)) {
48
- // Tuple (JSON Schema draft-07): check each item schema
49
- schema.items.forEach((itemSchema, index) => {
50
- if (typeof itemSchema === "object" && itemSchema !== null) {
51
- assertNoRecordInJsonSchema(itemSchema, [...path, `${index}`], contextName);
52
- }
53
- });
54
- }
55
- else if (typeof schema.items === "object") {
56
- // Array: check the item schema
57
- assertNoRecordInJsonSchema(schema.items, [...path, "[]"], contextName);
58
- }
59
- }
60
- const prefixItems = schema.prefixItems;
61
- if (Array.isArray(prefixItems)) {
62
- prefixItems.forEach((itemSchema, index) => {
63
- if (typeof itemSchema === "object" && itemSchema !== null) {
64
- assertNoRecordInJsonSchema(itemSchema, [...path, `${index}`], contextName);
65
- }
66
- });
67
- }
68
- if (schema.allOf) {
69
- schema.allOf.forEach((subSchema, index) => {
70
- if (typeof subSchema === "object" && subSchema !== null) {
71
- assertNoRecordInJsonSchema(subSchema, [...path, `&${index}`], contextName);
72
- }
73
- });
74
- }
75
- if (schema.anyOf) {
76
- schema.anyOf.forEach((subSchema, index) => {
77
- if (typeof subSchema === "object" && subSchema !== null) {
78
- assertNoRecordInJsonSchema(subSchema, [...path, `|${index}`], contextName);
79
- }
80
- });
81
- }
82
- if (schema.oneOf) {
83
- schema.oneOf.forEach((subSchema, index) => {
84
- if (typeof subSchema === "object" && subSchema !== null) {
85
- assertNoRecordInJsonSchema(subSchema, [...path, `|${index}`], contextName);
86
- }
87
- });
88
- }
89
- if (typeof schema.not === "object" && schema.not !== null) {
90
- assertNoRecordInJsonSchema(schema.not, [...path, "!"], contextName);
91
- }
92
- if (typeof schema.if === "object" && schema.if !== null) {
93
- assertNoRecordInJsonSchema(schema.if, [...path, "if"], contextName);
94
- }
95
- if (typeof schema.then === "object" && schema.then !== null) {
96
- assertNoRecordInJsonSchema(schema.then, [...path, "then"], contextName);
97
- }
98
- if (typeof schema.else === "object" && schema.else !== null) {
99
- assertNoRecordInJsonSchema(schema.else, [...path, "else"], contextName);
100
- }
101
- }
102
- /**
103
- * Asserts that a schema does not contain record types (objects with dynamic keys).
104
- * Records are not serializable to JSON Schema in a way that the Tambo backend
105
- * understands, so they are disallowed.
106
- *
107
- * This function accepts Standard Schema validators (Zod, Valibot, ArkType, etc.)
108
- * or JSON Schema objects. It converts them to JSON Schema and checks for record patterns.
109
- *
110
- * For tool schemas that are function types, this extracts and validates the input parameters.
111
- * @param schema - The schema to validate (Standard Schema or JSON Schema)
112
- * @param contextName - A human-readable label echoed in the error message
113
- */
114
- function assertNoRecordSchema(schema, contextName = "schema") {
115
- if (!schema) {
116
- return;
117
- }
118
- let jsonSchema;
119
- try {
120
- if ((0, standard_schema_1.isStandardSchema)(schema)) {
121
- // Handle function schemas specially - extract input parameters
122
- const converted = (0, schema_1.schemaToJsonSchema)(schema);
123
- // If it's a function schema that couldn't be converted, the input params
124
- // were extracted in registry.ts, so we can skip validation here
125
- if (!converted || Object.keys(converted).length === 0) {
126
- return;
127
- }
128
- jsonSchema = converted;
129
- }
130
- else if (typeof schema === "object" &&
131
- schema !== null &&
132
- "type" in schema) {
133
- // Already JSON Schema
134
- jsonSchema = schema;
135
- }
136
- else {
137
- // Unknown schema type - skip validation
138
- return;
139
- }
140
- }
141
- catch {
142
- // If schema conversion fails, skip validation
143
- // This can happen for function schemas or other special types
144
- return;
145
- }
146
- assertNoRecordInJsonSchema(jsonSchema, [], contextName);
147
- }
148
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/schema/validate.ts"],"names":[],"mappings":";;AAmJA,oDAwCC;AA1LD,qCAA8C;AAC9C,uDAAqD;AAErD;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,MAAmB;IAC7C,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,QAAQ;QACxB,OAAO,MAAM,CAAC,oBAAoB,KAAK,QAAQ;QAC/C,MAAM,CAAC,oBAAoB,KAAK,IAAI,CACrC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,0BAA0B,CACjC,MAAmB,EACnB,IAAc,EACd,WAAmB;IAEnB,IAAI,kBAAkB,CAAC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,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,oBAAoB,CAClC,MAAe,EACf,WAAW,GAAG,QAAQ;IAEtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,UAAuB,CAAC;IAE5B,IAAI,CAAC;QACH,IAAI,IAAA,kCAAgB,EAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,+DAA+D;YAC/D,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;YAE7C,yEAAyE;YACzE,gEAAgE;YAChE,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtD,OAAO;YACT,CAAC;YAED,UAAU,GAAG,SAAS,CAAC;QACzB,CAAC;aAAM,IACL,OAAO,MAAM,KAAK,QAAQ;YAC1B,MAAM,KAAK,IAAI;YACf,MAAM,IAAI,MAAM,EAChB,CAAC;YACD,sBAAsB;YACtB,UAAU,GAAG,MAAqB,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,wCAAwC;YACxC,OAAO;QACT,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8CAA8C;QAC9C,8DAA8D;QAC9D,OAAO;IACT,CAAC;IAED,0BAA0B,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\nimport { schemaToJsonSchema } from \"./schema\";\nimport { isStandardSchema } from \"./standard-schema\";\n\n/*\n * Check if a JSON Schema represents a record type (map with dynamic keys).\n *\n * For our purposes, any `object` schema with `additionalProperties` defined\n * as a nested schema (not just `true`/`false`) is treated as a record, even\n * if it also declares some explicit `properties`.\n * @param schema - The JSON Schema to check\n * @returns True if the schema represents a record-like type\n */\nfunction isRecordJsonSchema(schema: JSONSchema7): boolean {\n return (\n schema.type === \"object\" &&\n typeof schema.additionalProperties === \"object\" &&\n schema.additionalProperties !== null\n );\n}\n\n/**\n * Recursively walks a JSON Schema and throws when it encounters a record type.\n * Records are not supported because they use dynamic keys which don't serialize\n * well for the Tambo backend.\n * @param schema - The JSON Schema to check\n * @param path - Current path in the schema (for error messages)\n * @param contextName - Human-readable context name for error messages\n */\nfunction assertNoRecordInJsonSchema(\n schema: JSONSchema7,\n path: string[],\n contextName: string,\n): void {\n if (isRecordJsonSchema(schema)) {\n const joined = path.length ? path.join(\".\") : \"(root)\";\n throw new Error(\n `Record types (objects with dynamic keys) are not supported in ${contextName}. ` +\n `Found at path \"${joined}\". ` +\n \"Replace it with an object using explicit keys.\",\n );\n }\n if (schema.properties) {\n for (const [key, propSchema] of Object.entries(schema.properties)) {\n if (typeof propSchema === \"object\" && propSchema !== null) {\n assertNoRecordInJsonSchema(propSchema, [...path, key], contextName);\n }\n }\n }\n if (\n typeof schema.additionalProperties === \"object\" &&\n schema.additionalProperties !== null\n ) {\n assertNoRecordInJsonSchema(\n schema.additionalProperties,\n [...path, \"[*]\"],\n contextName,\n );\n }\n if (schema.items) {\n if (Array.isArray(schema.items)) {\n // Tuple (JSON Schema draft-07): check each item schema\n schema.items.forEach((itemSchema, index) => {\n if (typeof itemSchema === \"object\" && itemSchema !== null) {\n assertNoRecordInJsonSchema(\n itemSchema,\n [...path, `${index}`],\n contextName,\n );\n }\n });\n } else if (typeof schema.items === \"object\") {\n // Array: check the item schema\n assertNoRecordInJsonSchema(schema.items, [...path, \"[]\"], contextName);\n }\n }\n const prefixItems = (schema as Record<string, unknown>).prefixItems;\n if (Array.isArray(prefixItems)) {\n prefixItems.forEach((itemSchema, index) => {\n if (typeof itemSchema === \"object\" && itemSchema !== null) {\n assertNoRecordInJsonSchema(\n itemSchema as JSONSchema7,\n [...path, `${index}`],\n contextName,\n );\n }\n });\n }\n if (schema.allOf) {\n schema.allOf.forEach((subSchema, index) => {\n if (typeof subSchema === \"object\" && subSchema !== null) {\n assertNoRecordInJsonSchema(\n subSchema,\n [...path, `&${index}`],\n contextName,\n );\n }\n });\n }\n if (schema.anyOf) {\n schema.anyOf.forEach((subSchema, index) => {\n if (typeof subSchema === \"object\" && subSchema !== null) {\n assertNoRecordInJsonSchema(\n subSchema,\n [...path, `|${index}`],\n contextName,\n );\n }\n });\n }\n if (schema.oneOf) {\n schema.oneOf.forEach((subSchema, index) => {\n if (typeof subSchema === \"object\" && subSchema !== null) {\n assertNoRecordInJsonSchema(\n subSchema,\n [...path, `|${index}`],\n contextName,\n );\n }\n });\n }\n if (typeof schema.not === \"object\" && schema.not !== null) {\n assertNoRecordInJsonSchema(schema.not, [...path, \"!\"], contextName);\n }\n if (typeof schema.if === \"object\" && schema.if !== null) {\n assertNoRecordInJsonSchema(schema.if, [...path, \"if\"], contextName);\n }\n if (typeof schema.then === \"object\" && schema.then !== null) {\n assertNoRecordInJsonSchema(schema.then, [...path, \"then\"], contextName);\n }\n if (typeof schema.else === \"object\" && schema.else !== null) {\n assertNoRecordInJsonSchema(schema.else, [...path, \"else\"], contextName);\n }\n}\n\n/**\n * Asserts that a schema does not contain record types (objects with dynamic keys).\n * Records are not serializable to JSON Schema in a way that the Tambo backend\n * understands, so they are disallowed.\n *\n * This function accepts Standard Schema validators (Zod, Valibot, ArkType, etc.)\n * or JSON Schema objects. It converts them to JSON Schema and checks for record patterns.\n *\n * For tool schemas that are function types, this extracts and validates the input parameters.\n * @param schema - The schema to validate (Standard Schema or JSON Schema)\n * @param contextName - A human-readable label echoed in the error message\n */\nexport function assertNoRecordSchema(\n schema: unknown,\n contextName = \"schema\",\n): void {\n if (!schema) {\n return;\n }\n\n let jsonSchema: JSONSchema7;\n\n try {\n if (isStandardSchema(schema)) {\n // Handle function schemas specially - extract input parameters\n const converted = schemaToJsonSchema(schema);\n\n // If it's a function schema that couldn't be converted, the input params\n // were extracted in registry.ts, so we can skip validation here\n if (!converted || Object.keys(converted).length === 0) {\n return;\n }\n\n jsonSchema = converted;\n } else if (\n typeof schema === \"object\" &&\n schema !== null &&\n \"type\" in schema\n ) {\n // Already JSON Schema\n jsonSchema = schema as JSONSchema7;\n } else {\n // Unknown schema type - skip validation\n return;\n }\n } catch {\n // If schema conversion fails, skip validation\n // This can happen for function schemas or other special types\n return;\n }\n\n assertNoRecordInJsonSchema(jsonSchema, [], contextName);\n}\n"]}
@@ -1,24 +0,0 @@
1
- /**
2
- * Authentication state for the SDK.
3
- *
4
- * Discriminated union tracking the current auth lifecycle:
5
- * - `identified`: ready to make API calls (via userKey or successful token exchange)
6
- * - `exchanging`: userToken provided, exchange in-flight
7
- * - `error`: token exchange failed
8
- * - `invalid`: both userKey AND userToken provided (must choose one)
9
- * - `unauthenticated`: neither userKey nor userToken provided
10
- */
11
- export type TamboAuthState = {
12
- status: "identified";
13
- source: "userKey" | "tokenExchange";
14
- } | {
15
- status: "exchanging";
16
- } | {
17
- status: "error";
18
- error: Error;
19
- } | {
20
- status: "invalid";
21
- } | {
22
- status: "unauthenticated";
23
- };
24
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/v1/types/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,eAAe,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/v1/types/auth.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Authentication state for the SDK.\n *\n * Discriminated union tracking the current auth lifecycle:\n * - `identified`: ready to make API calls (via userKey or successful token exchange)\n * - `exchanging`: userToken provided, exchange in-flight\n * - `error`: token exchange failed\n * - `invalid`: both userKey AND userToken provided (must choose one)\n * - `unauthenticated`: neither userKey nor userToken provided\n */\nexport type TamboAuthState =\n | { status: \"identified\"; source: \"userKey\" | \"tokenExchange\" }\n | { status: \"exchanging\" }\n | { status: \"error\"; error: Error }\n | { status: \"invalid\" }\n | { status: \"unauthenticated\" };\n"]}