veryfront 0.1.501 → 0.1.503

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 (699) hide show
  1. package/esm/cli/commands/analyze-chunks/handler.d.ts +4 -4
  2. package/esm/cli/commands/analyze-chunks/handler.d.ts.map +1 -1
  3. package/esm/cli/commands/analyze-chunks/handler.js +6 -5
  4. package/esm/cli/commands/build/handler.d.ts +39 -27
  5. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  6. package/esm/cli/commands/build/handler.js +15 -14
  7. package/esm/cli/commands/clean/command.js +1 -1
  8. package/esm/cli/commands/clean/handler.d.ts.map +1 -1
  9. package/esm/cli/commands/clean/handler.js +9 -8
  10. package/esm/cli/commands/demo/handler.d.ts +5 -5
  11. package/esm/cli/commands/demo/handler.d.ts.map +1 -1
  12. package/esm/cli/commands/demo/handler.js +7 -6
  13. package/esm/cli/commands/deploy/command.d.ts +30 -19
  14. package/esm/cli/commands/deploy/command.d.ts.map +1 -1
  15. package/esm/cli/commands/deploy/command.js +11 -10
  16. package/esm/cli/commands/dev/handler.d.ts +6 -6
  17. package/esm/cli/commands/dev/handler.d.ts.map +1 -1
  18. package/esm/cli/commands/dev/handler.js +8 -7
  19. package/esm/cli/commands/doctor/handler.d.ts +3 -3
  20. package/esm/cli/commands/doctor/handler.d.ts.map +1 -1
  21. package/esm/cli/commands/doctor/handler.js +5 -4
  22. package/esm/cli/commands/files/command.d.ts +38 -36
  23. package/esm/cli/commands/files/command.d.ts.map +1 -1
  24. package/esm/cli/commands/files/command.js +35 -31
  25. package/esm/cli/commands/generate/handler.d.ts +4 -4
  26. package/esm/cli/commands/generate/handler.d.ts.map +1 -1
  27. package/esm/cli/commands/generate/handler.js +6 -5
  28. package/esm/cli/commands/generate/integration-generator-helpers.js +4 -4
  29. package/esm/cli/commands/generate/integration-generator.js +8 -4
  30. package/esm/cli/commands/install/handler.d.ts +5 -5
  31. package/esm/cli/commands/install/handler.d.ts.map +1 -1
  32. package/esm/cli/commands/install/handler.js +7 -6
  33. package/esm/cli/commands/install/install.d.ts.map +1 -1
  34. package/esm/cli/commands/install/install.js +7 -4
  35. package/esm/cli/commands/install/types.d.ts +52 -43
  36. package/esm/cli/commands/install/types.d.ts.map +1 -1
  37. package/esm/cli/commands/install/types.js +26 -21
  38. package/esm/cli/commands/install/uninstall.d.ts.map +1 -1
  39. package/esm/cli/commands/install/uninstall.js +4 -2
  40. package/esm/cli/commands/knowledge/command.d.ts +19 -17
  41. package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
  42. package/esm/cli/commands/knowledge/command.js +21 -20
  43. package/esm/cli/commands/lock/handler.d.ts.map +1 -1
  44. package/esm/cli/commands/lock/handler.js +10 -9
  45. package/esm/cli/commands/mcp/handler.d.ts +3 -3
  46. package/esm/cli/commands/mcp/handler.d.ts.map +1 -1
  47. package/esm/cli/commands/mcp/handler.js +5 -4
  48. package/esm/cli/commands/merge/command.d.ts +21 -15
  49. package/esm/cli/commands/merge/command.d.ts.map +1 -1
  50. package/esm/cli/commands/merge/command.js +9 -8
  51. package/esm/cli/commands/open/command.d.ts +17 -12
  52. package/esm/cli/commands/open/command.d.ts.map +1 -1
  53. package/esm/cli/commands/open/command.js +7 -6
  54. package/esm/cli/commands/pull/command.d.ts +36 -25
  55. package/esm/cli/commands/pull/command.d.ts.map +1 -1
  56. package/esm/cli/commands/pull/command.js +14 -13
  57. package/esm/cli/commands/push/command.d.ts +27 -19
  58. package/esm/cli/commands/push/command.d.ts.map +1 -1
  59. package/esm/cli/commands/push/command.js +11 -10
  60. package/esm/cli/commands/routes/handler.d.ts +4 -4
  61. package/esm/cli/commands/routes/handler.d.ts.map +1 -1
  62. package/esm/cli/commands/routes/handler.js +6 -5
  63. package/esm/cli/commands/schema/handler.d.ts.map +1 -1
  64. package/esm/cli/commands/schema/handler.js +5 -4
  65. package/esm/cli/commands/serve/handler.d.ts +9 -9
  66. package/esm/cli/commands/serve/handler.d.ts.map +1 -1
  67. package/esm/cli/commands/serve/handler.js +10 -9
  68. package/esm/cli/commands/start/handler.d.ts +6 -6
  69. package/esm/cli/commands/start/handler.d.ts.map +1 -1
  70. package/esm/cli/commands/start/handler.js +8 -7
  71. package/esm/cli/commands/studio/handler.d.ts +5 -5
  72. package/esm/cli/commands/studio/handler.d.ts.map +1 -1
  73. package/esm/cli/commands/studio/handler.js +7 -6
  74. package/esm/cli/commands/styles/command.d.ts.map +1 -1
  75. package/esm/cli/commands/styles/command.js +9 -8
  76. package/esm/cli/commands/styles/handler.d.ts +12 -12
  77. package/esm/cli/commands/styles/handler.d.ts.map +1 -1
  78. package/esm/cli/commands/styles/handler.js +7 -6
  79. package/esm/cli/commands/task/handler.d.ts +12 -12
  80. package/esm/cli/commands/task/handler.d.ts.map +1 -1
  81. package/esm/cli/commands/task/handler.js +7 -6
  82. package/esm/cli/commands/test/handler.d.ts.map +1 -1
  83. package/esm/cli/commands/test/handler.js +6 -5
  84. package/esm/cli/commands/up/command.d.ts +14 -10
  85. package/esm/cli/commands/up/command.d.ts.map +1 -1
  86. package/esm/cli/commands/up/command.js +6 -5
  87. package/esm/cli/commands/uploads/command.d.ts +43 -41
  88. package/esm/cli/commands/uploads/command.d.ts.map +1 -1
  89. package/esm/cli/commands/uploads/command.js +40 -36
  90. package/esm/cli/commands/worker/handler.d.ts +20 -23
  91. package/esm/cli/commands/worker/handler.d.ts.map +1 -1
  92. package/esm/cli/commands/worker/handler.js +11 -10
  93. package/esm/cli/commands/workflow/handler.d.ts +14 -16
  94. package/esm/cli/commands/workflow/handler.d.ts.map +1 -1
  95. package/esm/cli/commands/workflow/handler.js +8 -7
  96. package/esm/cli/mcp/jsonrpc.d.ts +34 -18
  97. package/esm/cli/mcp/jsonrpc.d.ts.map +1 -1
  98. package/esm/cli/mcp/jsonrpc.js +21 -17
  99. package/esm/cli/mcp/remote-file-tools.d.ts +79 -83
  100. package/esm/cli/mcp/remote-file-tools.d.ts.map +1 -1
  101. package/esm/cli/mcp/remote-file-tools.js +79 -67
  102. package/esm/cli/mcp/server.d.ts +0 -1
  103. package/esm/cli/mcp/server.d.ts.map +1 -1
  104. package/esm/cli/mcp/server.js +2 -60
  105. package/esm/cli/mcp/tools/bootstrap-tool.d.ts +5 -5
  106. package/esm/cli/mcp/tools/bootstrap-tool.d.ts.map +1 -1
  107. package/esm/cli/mcp/tools/bootstrap-tool.js +5 -4
  108. package/esm/cli/mcp/tools/build-tool.d.ts +9 -9
  109. package/esm/cli/mcp/tools/build-tool.d.ts.map +1 -1
  110. package/esm/cli/mcp/tools/build-tool.js +9 -8
  111. package/esm/cli/mcp/tools/catalog-tools.d.ts +18 -33
  112. package/esm/cli/mcp/tools/catalog-tools.d.ts.map +1 -1
  113. package/esm/cli/mcp/tools/catalog-tools.js +19 -14
  114. package/esm/cli/mcp/tools/context7-tools.d.ts.map +1 -1
  115. package/esm/cli/mcp/tools/context7-tools.js +9 -9
  116. package/esm/cli/mcp/tools/deploy-tool.d.ts +7 -7
  117. package/esm/cli/mcp/tools/deploy-tool.d.ts.map +1 -1
  118. package/esm/cli/mcp/tools/deploy-tool.js +7 -6
  119. package/esm/cli/mcp/tools/dev-tools.d.ts +31 -35
  120. package/esm/cli/mcp/tools/dev-tools.d.ts.map +1 -1
  121. package/esm/cli/mcp/tools/dev-tools.js +31 -25
  122. package/esm/cli/mcp/tools/introspection-tools.d.ts.map +1 -1
  123. package/esm/cli/mcp/tools/introspection-tools.js +6 -6
  124. package/esm/cli/mcp/tools/project-tools.d.ts +20 -25
  125. package/esm/cli/mcp/tools/project-tools.d.ts.map +1 -1
  126. package/esm/cli/mcp/tools/project-tools.js +20 -16
  127. package/esm/cli/mcp/tools/run-lint-tool.d.ts +5 -5
  128. package/esm/cli/mcp/tools/run-lint-tool.d.ts.map +1 -1
  129. package/esm/cli/mcp/tools/run-lint-tool.js +5 -4
  130. package/esm/cli/mcp/tools/run-tests-tool.d.ts +7 -7
  131. package/esm/cli/mcp/tools/run-tests-tool.d.ts.map +1 -1
  132. package/esm/cli/mcp/tools/run-tests-tool.js +7 -6
  133. package/esm/cli/mcp/tools/scaffold-tools.d.ts +12 -33
  134. package/esm/cli/mcp/tools/scaffold-tools.d.ts.map +1 -1
  135. package/esm/cli/mcp/tools/scaffold-tools.js +23 -21
  136. package/esm/cli/mcp/tools/skill-tools.d.ts +10 -10
  137. package/esm/cli/mcp/tools/skill-tools.d.ts.map +1 -1
  138. package/esm/cli/mcp/tools/skill-tools.js +8 -8
  139. package/esm/cli/mcp/tools.d.ts +27 -48
  140. package/esm/cli/mcp/tools.d.ts.map +1 -1
  141. package/esm/cli/mcp/tools.js +26 -21
  142. package/esm/cli/shared/args.d.ts +11 -8
  143. package/esm/cli/shared/args.d.ts.map +1 -1
  144. package/esm/cli/shared/args.js +9 -6
  145. package/esm/cli/shared/config.d.ts +38 -20
  146. package/esm/cli/shared/config.d.ts.map +1 -1
  147. package/esm/cli/shared/config.js +20 -17
  148. package/esm/cli/shared/types.d.ts +4 -7
  149. package/esm/cli/shared/types.d.ts.map +1 -1
  150. package/esm/cli/shared/types.js +3 -2
  151. package/esm/cli/skills/types.d.ts +30 -16
  152. package/esm/cli/skills/types.d.ts.map +1 -1
  153. package/esm/cli/skills/types.js +17 -15
  154. package/esm/cli/templates/manifest.js +211 -211
  155. package/esm/deno.d.ts +5 -0
  156. package/esm/deno.js +10 -4
  157. package/esm/extensions/ext-zod/src/adapter.d.ts +22 -0
  158. package/esm/extensions/ext-zod/src/adapter.d.ts.map +1 -0
  159. package/esm/extensions/ext-zod/src/adapter.js +159 -0
  160. package/esm/extensions/ext-zod/src/index.d.ts +19 -0
  161. package/esm/extensions/ext-zod/src/index.d.ts.map +1 -0
  162. package/esm/extensions/ext-zod/src/index.js +32 -0
  163. package/esm/extensions/ext-zod/src/json-schema.d.ts +15 -0
  164. package/esm/extensions/ext-zod/src/json-schema.d.ts.map +1 -0
  165. package/esm/extensions/ext-zod/src/json-schema.js +247 -0
  166. package/esm/src/agent/ag-ui-detached-start.d.ts +97 -50
  167. package/esm/src/agent/ag-ui-detached-start.d.ts.map +1 -1
  168. package/esm/src/agent/ag-ui-detached-start.js +26 -17
  169. package/esm/src/agent/ag-ui-forwarded-context.d.ts +3 -3
  170. package/esm/src/agent/ag-ui-forwarded-context.d.ts.map +1 -1
  171. package/esm/src/agent/ag-ui-forwarded-context.js +3 -2
  172. package/esm/src/agent/ag-ui-handler.d.ts.map +1 -1
  173. package/esm/src/agent/ag-ui-handler.js +5 -3
  174. package/esm/src/agent/ag-ui-host-support.d.ts +119 -65
  175. package/esm/src/agent/ag-ui-host-support.d.ts.map +1 -1
  176. package/esm/src/agent/ag-ui-host-support.js +48 -42
  177. package/esm/src/agent/ag-ui-request-shared.d.ts.map +1 -1
  178. package/esm/src/agent/ag-ui-request-shared.js +11 -2
  179. package/esm/src/agent/ag-ui-run-control.d.ts +15 -8
  180. package/esm/src/agent/ag-ui-run-control.d.ts.map +1 -1
  181. package/esm/src/agent/ag-ui-run-control.js +18 -13
  182. package/esm/src/agent/ag-ui-runtime-handler.d.ts.map +1 -1
  183. package/esm/src/agent/ag-ui-runtime-handler.js +5 -3
  184. package/esm/src/agent/ag-ui-sse-parser.d.ts +57 -0
  185. package/esm/src/agent/ag-ui-sse-parser.d.ts.map +1 -0
  186. package/esm/src/agent/ag-ui-sse-parser.js +227 -0
  187. package/esm/src/agent/ag-ui-tool-shared.d.ts.map +1 -1
  188. package/esm/src/agent/ag-ui-tool-shared.js +3 -2
  189. package/esm/src/agent/chat-handler.d.ts.map +1 -1
  190. package/esm/src/agent/chat-handler.js +58 -57
  191. package/esm/src/agent/composition/composition.js +2 -2
  192. package/esm/src/agent/conversation-bootstrap.d.ts +13 -16
  193. package/esm/src/agent/conversation-bootstrap.d.ts.map +1 -1
  194. package/esm/src/agent/conversation-bootstrap.js +19 -12
  195. package/esm/src/agent/conversation-hosted-lifecycle.d.ts.map +1 -1
  196. package/esm/src/agent/conversation-run-context.d.ts +1 -10
  197. package/esm/src/agent/conversation-run-context.d.ts.map +1 -1
  198. package/esm/src/agent/conversation-run-events.d.ts +9 -5
  199. package/esm/src/agent/conversation-run-events.d.ts.map +1 -1
  200. package/esm/src/agent/conversation-run-events.js +6 -4
  201. package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts +37 -16
  202. package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts.map +1 -1
  203. package/esm/src/agent/default-hosted-invoke-agent-tool.js +10 -5
  204. package/esm/src/agent/durable.d.ts +70 -129
  205. package/esm/src/agent/durable.d.ts.map +1 -1
  206. package/esm/src/agent/durable.js +107 -109
  207. package/esm/src/agent/hosted-ag-ui-chat-request.d.ts +29 -11
  208. package/esm/src/agent/hosted-ag-ui-chat-request.d.ts.map +1 -1
  209. package/esm/src/agent/hosted-ag-ui-chat-request.js +16 -15
  210. package/esm/src/agent/hosted-agent-service-config.d.ts +6 -6
  211. package/esm/src/agent/hosted-agent-service-routes.d.ts.map +1 -1
  212. package/esm/src/agent/hosted-agent-service-routes.js +4 -3
  213. package/esm/src/agent/hosted-chat-request-parser.d.ts.map +1 -1
  214. package/esm/src/agent/hosted-chat-request-parser.js +7 -4
  215. package/esm/src/agent/hosted-chat-request.d.ts +291 -20
  216. package/esm/src/agent/hosted-chat-request.d.ts.map +1 -1
  217. package/esm/src/agent/hosted-chat-request.js +33 -31
  218. package/esm/src/agent/hosted-child-fork-step-message-preparation.d.ts.map +1 -1
  219. package/esm/src/agent/hosted-child-status.d.ts.map +1 -1
  220. package/esm/src/agent/hosted-child-status.js +2 -0
  221. package/esm/src/agent/hosted-child-tool-input.d.ts +21 -11
  222. package/esm/src/agent/hosted-child-tool-input.d.ts.map +1 -1
  223. package/esm/src/agent/hosted-child-tool-input.js +12 -10
  224. package/esm/src/agent/hosted-form-input-tool.d.ts +78 -86
  225. package/esm/src/agent/hosted-form-input-tool.d.ts.map +1 -1
  226. package/esm/src/agent/hosted-form-input-tool.js +10 -3
  227. package/esm/src/agent/human-input.d.ts +337 -277
  228. package/esm/src/agent/human-input.d.ts.map +1 -1
  229. package/esm/src/agent/human-input.js +88 -72
  230. package/esm/src/agent/index.d.ts +8 -7
  231. package/esm/src/agent/index.d.ts.map +1 -1
  232. package/esm/src/agent/index.js +8 -7
  233. package/esm/src/agent/input-request-protocol.d.ts +461 -1611
  234. package/esm/src/agent/input-request-protocol.d.ts.map +1 -1
  235. package/esm/src/agent/input-request-protocol.js +120 -107
  236. package/esm/src/agent/invoke-agent-child-runs.d.ts +109 -107
  237. package/esm/src/agent/invoke-agent-child-runs.d.ts.map +1 -1
  238. package/esm/src/agent/invoke-agent-child-runs.js +36 -29
  239. package/esm/src/agent/runtime-ag-ui-contract.d.ts +206 -206
  240. package/esm/src/agent/runtime-ag-ui-contract.d.ts.map +1 -1
  241. package/esm/src/agent/runtime-ag-ui-contract.js +96 -91
  242. package/esm/src/agent/runtime-agent-definition.d.ts +47 -24
  243. package/esm/src/agent/runtime-agent-definition.d.ts.map +1 -1
  244. package/esm/src/agent/runtime-agent-definition.js +26 -20
  245. package/esm/src/agent/runtime-agent-invocation-contract.d.ts +306 -168
  246. package/esm/src/agent/runtime-agent-invocation-contract.d.ts.map +1 -1
  247. package/esm/src/agent/runtime-agent-invocation-contract.js +116 -101
  248. package/esm/src/agent/runtime-builtin-skill-files.d.ts.map +1 -1
  249. package/esm/src/agent/runtime-builtin-skill-files.js +3 -2
  250. package/esm/src/agent/runtime-client-profile.d.ts +23 -32
  251. package/esm/src/agent/runtime-client-profile.d.ts.map +1 -1
  252. package/esm/src/agent/runtime-client-profile.js +29 -27
  253. package/esm/src/agent/runtime-load-skill-tool.d.ts +6 -7
  254. package/esm/src/agent/runtime-load-skill-tool.d.ts.map +1 -1
  255. package/esm/src/agent/runtime-load-skill-tool.js +7 -6
  256. package/esm/src/agent/runtime-project-files-client.d.ts +19 -10
  257. package/esm/src/agent/runtime-project-files-client.d.ts.map +1 -1
  258. package/esm/src/agent/runtime-project-files-client.js +33 -35
  259. package/esm/src/agent/runtime-skill-metadata.d.ts +6 -20
  260. package/esm/src/agent/runtime-skill-metadata.d.ts.map +1 -1
  261. package/esm/src/agent/runtime-skill-metadata.js +24 -18
  262. package/esm/src/agent/runtime-upload-url-client.d.ts.map +1 -1
  263. package/esm/src/agent/runtime-upload-url-client.js +19 -25
  264. package/esm/src/agent/schemas/agent.schema.d.ts +258 -307
  265. package/esm/src/agent/schemas/agent.schema.d.ts.map +1 -1
  266. package/esm/src/agent/schemas/agent.schema.js +105 -101
  267. package/esm/src/agent/schemas/index.d.ts +2 -2
  268. package/esm/src/agent/schemas/index.d.ts.map +1 -1
  269. package/esm/src/agent/schemas/index.js +2 -2
  270. package/esm/src/agent/schemas/tool.schema.d.ts +5 -5
  271. package/esm/src/agent/schemas/tool.schema.d.ts.map +1 -1
  272. package/esm/src/agent/schemas/tool.schema.js +4 -4
  273. package/esm/src/cache/schemas/cache-backend.schema.d.ts +15 -14
  274. package/esm/src/cache/schemas/cache-backend.schema.d.ts.map +1 -1
  275. package/esm/src/cache/schemas/cache-backend.schema.js +10 -7
  276. package/esm/src/cache/schemas/cache-key.schema.d.ts +12 -10
  277. package/esm/src/cache/schemas/cache-key.schema.d.ts.map +1 -1
  278. package/esm/src/cache/schemas/cache-key.schema.js +8 -6
  279. package/esm/src/channels/control-plane.d.ts +246 -156
  280. package/esm/src/channels/control-plane.d.ts.map +1 -1
  281. package/esm/src/channels/control-plane.js +80 -73
  282. package/esm/src/channels/invoke.d.ts +220 -134
  283. package/esm/src/channels/invoke.d.ts.map +1 -1
  284. package/esm/src/channels/invoke.js +105 -93
  285. package/esm/src/chat/ag-ui.d.ts +494 -273
  286. package/esm/src/chat/ag-ui.d.ts.map +1 -1
  287. package/esm/src/chat/ag-ui.js +164 -180
  288. package/esm/src/chat/conversation.d.ts +273 -183
  289. package/esm/src/chat/conversation.d.ts.map +1 -1
  290. package/esm/src/chat/conversation.js +97 -111
  291. package/esm/src/chat/types.d.ts +635 -14
  292. package/esm/src/chat/types.d.ts.map +1 -1
  293. package/esm/src/chat/types.js +146 -174
  294. package/esm/src/config/schemas/config.schema.d.ts +799 -395
  295. package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
  296. package/esm/src/config/schemas/config.schema.js +300 -268
  297. package/esm/src/data/schemas/data.schema.d.ts +89 -48
  298. package/esm/src/data/schemas/data.schema.d.ts.map +1 -1
  299. package/esm/src/data/schemas/data.schema.js +36 -29
  300. package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
  301. package/esm/src/extensions/builtin-extensions.js +9 -0
  302. package/esm/src/extensions/schema/index.d.ts +1 -1
  303. package/esm/src/extensions/schema/index.d.ts.map +1 -1
  304. package/esm/src/extensions/schema/json-schema.d.ts +23 -0
  305. package/esm/src/extensions/schema/json-schema.d.ts.map +1 -0
  306. package/esm/src/extensions/schema/json-schema.js +8 -0
  307. package/esm/src/extensions/schema/schema-validator.d.ts +97 -4
  308. package/esm/src/extensions/schema/schema-validator.d.ts.map +1 -1
  309. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +1 -1
  310. package/esm/src/html/schemas/html.schema.d.ts +107 -90
  311. package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
  312. package/esm/src/html/schemas/html.schema.js +60 -52
  313. package/esm/src/html/utils.d.ts.map +1 -1
  314. package/esm/src/html/utils.js +1 -1
  315. package/esm/src/integrations/schema.d.ts +455 -433
  316. package/esm/src/integrations/schema.d.ts.map +1 -1
  317. package/esm/src/integrations/schema.js +105 -95
  318. package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
  319. package/esm/src/internal-agents/ag-ui-sse.js +60 -82
  320. package/esm/src/internal-agents/control-plane-auth.d.ts +10 -10
  321. package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
  322. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  323. package/esm/src/internal-agents/run-stream.js +3 -2
  324. package/esm/src/internal-agents/schema.d.ts +272 -281
  325. package/esm/src/internal-agents/schema.d.ts.map +1 -1
  326. package/esm/src/internal-agents/schema.js +55 -47
  327. package/esm/src/issues/core.d.ts.map +1 -1
  328. package/esm/src/issues/mcp.d.ts.map +1 -1
  329. package/esm/src/issues/mcp.js +47 -41
  330. package/esm/src/issues/schemas/index.d.ts +1 -1
  331. package/esm/src/issues/schemas/index.d.ts.map +1 -1
  332. package/esm/src/issues/schemas/index.js +1 -1
  333. package/esm/src/issues/schemas/issue.schema.d.ts +151 -116
  334. package/esm/src/issues/schemas/issue.schema.d.ts.map +1 -1
  335. package/esm/src/issues/schemas/issue.schema.js +64 -55
  336. package/esm/src/jobs/schemas.d.ts +1087 -658
  337. package/esm/src/jobs/schemas.d.ts.map +1 -1
  338. package/esm/src/jobs/schemas.js +244 -214
  339. package/esm/src/mcp/index.d.ts +6 -2
  340. package/esm/src/mcp/index.d.ts.map +1 -1
  341. package/esm/src/mcp/index.js +6 -2
  342. package/esm/src/mcp/schemas/index.d.ts +1 -1
  343. package/esm/src/mcp/schemas/index.d.ts.map +1 -1
  344. package/esm/src/mcp/schemas/index.js +1 -1
  345. package/esm/src/mcp/schemas/mcp.schema.d.ts +59 -31
  346. package/esm/src/mcp/schemas/mcp.schema.d.ts.map +1 -1
  347. package/esm/src/mcp/schemas/mcp.schema.js +28 -24
  348. package/esm/src/mcp/types.d.ts +2 -2
  349. package/esm/src/mcp/types.d.ts.map +1 -1
  350. package/esm/src/oauth/providers/atlassian.d.ts +36 -30
  351. package/esm/src/oauth/providers/atlassian.d.ts.map +1 -1
  352. package/esm/src/oauth/providers/common.d.ts +312 -260
  353. package/esm/src/oauth/providers/common.d.ts.map +1 -1
  354. package/esm/src/oauth/providers/google.d.ts +48 -40
  355. package/esm/src/oauth/providers/google.d.ts.map +1 -1
  356. package/esm/src/oauth/providers/microsoft.d.ts +48 -40
  357. package/esm/src/oauth/providers/microsoft.d.ts.map +1 -1
  358. package/esm/src/oauth/schemas/oauth.schema.d.ts +180 -92
  359. package/esm/src/oauth/schemas/oauth.schema.d.ts.map +1 -1
  360. package/esm/src/oauth/schemas/oauth.schema.js +67 -59
  361. package/esm/src/platform/adapters/fs/github/github-api-client.d.ts.map +1 -1
  362. package/esm/src/platform/adapters/fs/github/github-api-client.js +4 -4
  363. package/esm/src/platform/adapters/fs/github/index.d.ts +1 -1
  364. package/esm/src/platform/adapters/fs/github/index.d.ts.map +1 -1
  365. package/esm/src/platform/adapters/fs/github/index.js +1 -1
  366. package/esm/src/platform/adapters/fs/github/schemas/github-api.schema.d.ts +97 -140
  367. package/esm/src/platform/adapters/fs/github/schemas/github-api.schema.d.ts.map +1 -1
  368. package/esm/src/platform/adapters/fs/github/schemas/github-api.schema.js +40 -37
  369. package/esm/src/platform/adapters/fs/github/schemas/index.d.ts +1 -1
  370. package/esm/src/platform/adapters/fs/github/schemas/index.d.ts.map +1 -1
  371. package/esm/src/platform/adapters/fs/github/schemas/index.js +1 -1
  372. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts.map +1 -1
  373. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.js +7 -4
  374. package/esm/src/platform/adapters/fs/veryfront/schemas/index.d.ts +1 -1
  375. package/esm/src/platform/adapters/fs/veryfront/schemas/index.d.ts.map +1 -1
  376. package/esm/src/platform/adapters/fs/veryfront/schemas/index.js +1 -1
  377. package/esm/src/platform/adapters/fs/veryfront/schemas/proxy-manager.schema.d.ts +11 -11
  378. package/esm/src/platform/adapters/fs/veryfront/schemas/proxy-manager.schema.d.ts.map +1 -1
  379. package/esm/src/platform/adapters/fs/veryfront/schemas/proxy-manager.schema.js +10 -10
  380. package/esm/src/platform/adapters/fs/veryfront/stat-operations.d.ts.map +1 -1
  381. package/esm/src/platform/adapters/fs/veryfront/stat-operations.js +1 -0
  382. package/esm/src/platform/adapters/veryfront-api-client/client.d.ts +63 -63
  383. package/esm/src/platform/adapters/veryfront-api-client/index.d.ts +1 -1
  384. package/esm/src/platform/adapters/veryfront-api-client/index.d.ts.map +1 -1
  385. package/esm/src/platform/adapters/veryfront-api-client/index.js +1 -1
  386. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
  387. package/esm/src/platform/adapters/veryfront-api-client/operations.js +11 -21
  388. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +444 -471
  389. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts.map +1 -1
  390. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +150 -122
  391. package/esm/src/platform/adapters/veryfront-api-client/schemas/index.d.ts +1 -1
  392. package/esm/src/platform/adapters/veryfront-api-client/schemas/index.d.ts.map +1 -1
  393. package/esm/src/platform/adapters/veryfront-api-client/schemas/index.js +1 -1
  394. package/esm/src/prompt/schemas/prompt.schema.d.ts +10 -9
  395. package/esm/src/prompt/schemas/prompt.schema.d.ts.map +1 -1
  396. package/esm/src/prompt/schemas/prompt.schema.js +8 -8
  397. package/esm/src/proxy/handler.d.ts.map +1 -1
  398. package/esm/src/proxy/handler.js +0 -1
  399. package/esm/src/repositories/schemas/repository.schema.d.ts +40 -25
  400. package/esm/src/repositories/schemas/repository.schema.d.ts.map +1 -1
  401. package/esm/src/repositories/schemas/repository.schema.js +23 -19
  402. package/esm/src/resource/index.d.ts +6 -2
  403. package/esm/src/resource/index.d.ts.map +1 -1
  404. package/esm/src/resource/index.js +6 -2
  405. package/esm/src/resource/schemas/index.d.ts +1 -1
  406. package/esm/src/resource/schemas/index.d.ts.map +1 -1
  407. package/esm/src/resource/schemas/index.js +1 -1
  408. package/esm/src/resource/schemas/resource.schema.d.ts +13 -16
  409. package/esm/src/resource/schemas/resource.schema.d.ts.map +1 -1
  410. package/esm/src/resource/schemas/resource.schema.js +9 -6
  411. package/esm/src/resource/types.d.ts +3 -3
  412. package/esm/src/resource/types.d.ts.map +1 -1
  413. package/esm/src/routing/api/openapi/types.d.ts +4 -4
  414. package/esm/src/routing/api/openapi/types.d.ts.map +1 -1
  415. package/esm/src/sandbox/hosted-tools.d.ts.map +1 -1
  416. package/esm/src/sandbox/hosted-tools.js +11 -13
  417. package/esm/src/schemas/common.d.ts +48 -28
  418. package/esm/src/schemas/common.d.ts.map +1 -1
  419. package/esm/src/schemas/common.js +67 -28
  420. package/esm/src/schemas/define.d.ts +3 -2
  421. package/esm/src/schemas/define.d.ts.map +1 -1
  422. package/esm/src/schemas/define.js +12 -6
  423. package/esm/src/schemas/index.d.ts +8 -4
  424. package/esm/src/schemas/index.d.ts.map +1 -1
  425. package/esm/src/schemas/index.js +8 -7
  426. package/esm/src/schemas/json-schema.d.ts +25 -0
  427. package/esm/src/schemas/json-schema.d.ts.map +1 -0
  428. package/esm/src/schemas/json-schema.js +27 -0
  429. package/esm/src/schemas/primitives.d.ts +34 -23
  430. package/esm/src/schemas/primitives.d.ts.map +1 -1
  431. package/esm/src/schemas/primitives.js +25 -18
  432. package/esm/src/security/input-validation/handler.d.ts +3 -3
  433. package/esm/src/security/input-validation/handler.d.ts.map +1 -1
  434. package/esm/src/security/input-validation/parsers.d.ts +4 -4
  435. package/esm/src/security/input-validation/parsers.d.ts.map +1 -1
  436. package/esm/src/security/input-validation/parsers.js +35 -45
  437. package/esm/src/server/bootstrap.js +2 -2
  438. package/esm/src/server/dev-ui/manifest.js +1 -1
  439. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  440. package/esm/src/server/handlers/dev/framework-candidates.generated.js +1 -0
  441. package/esm/src/server/handlers/request/agent-run-cancel.handler.d.ts.map +1 -1
  442. package/esm/src/server/handlers/request/agent-run-cancel.handler.js +2 -3
  443. package/esm/src/server/handlers/request/agent-run-resume.handler.d.ts.map +1 -1
  444. package/esm/src/server/handlers/request/agent-run-resume.handler.js +4 -5
  445. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  446. package/esm/src/server/handlers/request/agent-stream.handler.js +3 -4
  447. package/esm/src/server/handlers/request/internal-agents-list.handler.d.ts.map +1 -1
  448. package/esm/src/server/handlers/request/internal-agents-list.handler.js +2 -4
  449. package/esm/src/server/runtime-handler/environment-resolution.d.ts.map +1 -1
  450. package/esm/src/server/runtime-handler/environment-resolution.js +4 -5
  451. package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
  452. package/esm/src/server/runtime-handler/request-utils.js +1 -2
  453. package/esm/src/server/schemas/action.schema.d.ts +10 -6
  454. package/esm/src/server/schemas/action.schema.d.ts.map +1 -1
  455. package/esm/src/server/schemas/action.schema.js +7 -5
  456. package/esm/src/skill/tools.d.ts.map +1 -1
  457. package/esm/src/skill/tools.js +24 -21
  458. package/esm/src/tool/factory.d.ts +1 -1
  459. package/esm/src/tool/factory.d.ts.map +1 -1
  460. package/esm/src/tool/factory.js +12 -1
  461. package/esm/src/tool/host-tools.d.ts +1 -1
  462. package/esm/src/tool/host-tools.d.ts.map +1 -1
  463. package/esm/src/tool/host-tools.js +17 -3
  464. package/esm/src/tool/index.d.ts +9 -5
  465. package/esm/src/tool/index.d.ts.map +1 -1
  466. package/esm/src/tool/index.js +9 -5
  467. package/esm/src/tool/remote-source-tools.d.ts.map +1 -1
  468. package/esm/src/tool/remote-source-tools.js +9 -2
  469. package/esm/src/tool/schema/json-schema.d.ts +8 -15
  470. package/esm/src/tool/schema/json-schema.d.ts.map +1 -1
  471. package/esm/src/tool/schema/json-schema.js +7 -0
  472. package/esm/src/tool/schema/zod-json-schema.d.ts +33 -4
  473. package/esm/src/tool/schema/zod-json-schema.d.ts.map +1 -1
  474. package/esm/src/tool/schema/zod-json-schema.js +70 -159
  475. package/esm/src/tool/sleep.d.ts +21 -11
  476. package/esm/src/tool/sleep.d.ts.map +1 -1
  477. package/esm/src/tool/sleep.js +42 -4
  478. package/esm/src/tool/types.d.ts +12 -8
  479. package/esm/src/tool/types.d.ts.map +1 -1
  480. package/esm/src/transforms/npm-import-rewrites.d.ts +1 -1
  481. package/esm/src/transforms/npm-import-rewrites.d.ts.map +1 -1
  482. package/esm/src/transforms/npm-import-rewrites.js +1 -3
  483. package/esm/src/utils/version-constant.d.ts +1 -1
  484. package/esm/src/utils/version-constant.js +1 -1
  485. package/esm/src/workflow/api.d.ts +22 -22
  486. package/esm/src/workflow/blob/veryfront-cloud-storage.d.ts.map +1 -1
  487. package/esm/src/workflow/blob/veryfront-cloud-storage.js +37 -33
  488. package/esm/src/workflow/claude-code/tool.d.ts +37 -44
  489. package/esm/src/workflow/claude-code/tool.d.ts.map +1 -1
  490. package/esm/src/workflow/claude-code/tool.js +11 -19
  491. package/esm/src/workflow/dsl/workflow.d.ts +3 -3
  492. package/esm/src/workflow/dsl/workflow.d.ts.map +1 -1
  493. package/esm/src/workflow/schemas/index.d.ts +1 -1
  494. package/esm/src/workflow/schemas/index.d.ts.map +1 -1
  495. package/esm/src/workflow/schemas/index.js +1 -1
  496. package/esm/src/workflow/schemas/workflow.schema.d.ts +194 -177
  497. package/esm/src/workflow/schemas/workflow.schema.d.ts.map +1 -1
  498. package/esm/src/workflow/schemas/workflow.schema.js +101 -83
  499. package/esm/src/workflow/types.d.ts +3 -3
  500. package/esm/src/workflow/types.d.ts.map +1 -1
  501. package/package.json +4 -1
  502. package/src/cli/commands/analyze-chunks/handler.ts +9 -5
  503. package/src/cli/commands/build/handler.ts +20 -15
  504. package/src/cli/commands/clean/command.ts +1 -1
  505. package/src/cli/commands/clean/handler.ts +12 -8
  506. package/src/cli/commands/demo/handler.ts +12 -7
  507. package/src/cli/commands/deploy/command.ts +17 -12
  508. package/src/cli/commands/dev/handler.ts +11 -7
  509. package/src/cli/commands/doctor/handler.ts +8 -4
  510. package/src/cli/commands/files/command.ts +64 -44
  511. package/src/cli/commands/generate/handler.ts +9 -5
  512. package/src/cli/commands/generate/integration-generator-helpers.ts +4 -4
  513. package/src/cli/commands/generate/integration-generator.ts +8 -4
  514. package/src/cli/commands/install/detect.ts +1 -1
  515. package/src/cli/commands/install/handler.ts +10 -6
  516. package/src/cli/commands/install/install.ts +20 -12
  517. package/src/cli/commands/install/types.ts +58 -41
  518. package/src/cli/commands/install/uninstall.ts +6 -2
  519. package/src/cli/commands/knowledge/command.ts +60 -52
  520. package/src/cli/commands/lock/handler.ts +13 -9
  521. package/src/cli/commands/mcp/handler.ts +8 -4
  522. package/src/cli/commands/merge/command.ts +14 -9
  523. package/src/cli/commands/open/command.ts +12 -7
  524. package/src/cli/commands/pull/command.ts +20 -15
  525. package/src/cli/commands/push/command.ts +17 -12
  526. package/src/cli/commands/routes/handler.ts +9 -5
  527. package/src/cli/commands/schema/handler.ts +8 -4
  528. package/src/cli/commands/serve/handler.ts +15 -11
  529. package/src/cli/commands/start/handler.ts +11 -7
  530. package/src/cli/commands/studio/handler.ts +10 -6
  531. package/src/cli/commands/styles/command.ts +22 -17
  532. package/src/cli/commands/styles/handler.ts +12 -7
  533. package/src/cli/commands/task/handler.ts +12 -7
  534. package/src/cli/commands/test/handler.ts +9 -5
  535. package/src/cli/commands/up/command.ts +11 -6
  536. package/src/cli/commands/uploads/command.ts +72 -52
  537. package/src/cli/commands/worker/handler.ts +16 -11
  538. package/src/cli/commands/workflow/handler.ts +13 -8
  539. package/src/cli/mcp/jsonrpc.ts +32 -19
  540. package/src/cli/mcp/remote-file-tools.ts +134 -97
  541. package/src/cli/mcp/server.ts +2 -80
  542. package/src/cli/mcp/tools/bootstrap-tool.ts +11 -7
  543. package/src/cli/mcp/tools/build-tool.ts +32 -28
  544. package/src/cli/mcp/tools/catalog-tools.ts +53 -42
  545. package/src/cli/mcp/tools/context7-tools.ts +29 -25
  546. package/src/cli/mcp/tools/deploy-tool.ts +17 -13
  547. package/src/cli/mcp/tools/dev-tools.ts +90 -66
  548. package/src/cli/mcp/tools/introspection-tools.ts +8 -6
  549. package/src/cli/mcp/tools/project-tools.ts +45 -32
  550. package/src/cli/mcp/tools/run-lint-tool.ts +11 -7
  551. package/src/cli/mcp/tools/run-tests-tool.ts +17 -13
  552. package/src/cli/mcp/tools/scaffold-tools.ts +43 -36
  553. package/src/cli/mcp/tools/skill-tools.ts +17 -12
  554. package/src/cli/mcp/tools.ts +65 -51
  555. package/src/cli/shared/args.ts +12 -9
  556. package/src/cli/shared/config.ts +32 -22
  557. package/src/cli/shared/project-source-context.ts +1 -1
  558. package/src/cli/shared/types.ts +5 -3
  559. package/src/cli/skills/types.ts +29 -24
  560. package/src/cli/templates/manifest.js +211 -211
  561. package/src/deno.js +10 -4
  562. package/src/extensions/ext-zod/src/adapter.ts +238 -0
  563. package/src/extensions/ext-zod/src/index.ts +36 -0
  564. package/src/extensions/ext-zod/src/json-schema.ts +311 -0
  565. package/src/src/agent/ag-ui-detached-start.ts +44 -21
  566. package/src/src/agent/ag-ui-forwarded-context.ts +6 -4
  567. package/src/src/agent/ag-ui-handler.ts +7 -3
  568. package/src/src/agent/ag-ui-host-support.ts +84 -66
  569. package/src/src/agent/ag-ui-request-shared.ts +16 -2
  570. package/src/src/agent/ag-ui-run-control.ts +26 -15
  571. package/src/src/agent/ag-ui-runtime-handler.ts +7 -3
  572. package/src/src/agent/ag-ui-sse-parser.ts +306 -0
  573. package/src/src/agent/ag-ui-tool-shared.ts +5 -2
  574. package/src/src/agent/chat-handler.ts +89 -67
  575. package/src/src/agent/composition/composition.ts +2 -2
  576. package/src/src/agent/conversation-bootstrap.ts +38 -17
  577. package/src/src/agent/conversation-hosted-lifecycle.ts +12 -10
  578. package/src/src/agent/conversation-run-events.ts +13 -5
  579. package/src/src/agent/default-hosted-invoke-agent-tool.ts +19 -8
  580. package/src/src/agent/durable.ts +186 -144
  581. package/src/src/agent/hosted-ag-ui-chat-request.ts +26 -16
  582. package/src/src/agent/hosted-agent-service-routes.ts +4 -3
  583. package/src/src/agent/hosted-chat-request-parser.ts +8 -4
  584. package/src/src/agent/hosted-chat-request.ts +46 -32
  585. package/src/src/agent/hosted-child-fork-step-message-preparation.ts +3 -1
  586. package/src/src/agent/hosted-child-status.ts +8 -1
  587. package/src/src/agent/hosted-child-tool-input.ts +27 -19
  588. package/src/src/agent/hosted-durable-child-fork-execution.ts +3 -3
  589. package/src/src/agent/hosted-form-input-tool.ts +15 -5
  590. package/src/src/agent/human-input.ts +129 -92
  591. package/src/src/agent/index.ts +38 -20
  592. package/src/src/agent/input-request-protocol.ts +193 -124
  593. package/src/src/agent/invoke-agent-child-runs.ts +64 -44
  594. package/src/src/agent/runtime-ag-ui-contract.ts +159 -123
  595. package/src/src/agent/runtime-agent-definition.ts +45 -24
  596. package/src/src/agent/runtime-agent-invocation-contract.ts +241 -174
  597. package/src/src/agent/runtime-builtin-skill-files.ts +3 -2
  598. package/src/src/agent/runtime-client-profile.ts +51 -34
  599. package/src/src/agent/runtime-load-skill-tool.ts +19 -12
  600. package/src/src/agent/runtime-project-files-client.ts +51 -39
  601. package/src/src/agent/runtime-skill-metadata.ts +41 -24
  602. package/src/src/agent/runtime-upload-url-client.ts +24 -24
  603. package/src/src/agent/schemas/agent.schema.ts +179 -142
  604. package/src/src/agent/schemas/index.ts +15 -15
  605. package/src/src/agent/schemas/tool.schema.ts +8 -5
  606. package/src/src/cache/schemas/cache-backend.schema.ts +18 -9
  607. package/src/src/cache/schemas/cache-key.schema.ts +13 -7
  608. package/src/src/channels/control-plane.ts +132 -96
  609. package/src/src/channels/invoke.ts +165 -120
  610. package/src/src/chat/ag-ui.ts +229 -225
  611. package/src/src/chat/conversation.ts +121 -124
  612. package/src/src/chat/types.ts +230 -205
  613. package/src/src/config/schemas/config.schema.ts +653 -610
  614. package/src/src/data/schemas/data.schema.ts +62 -39
  615. package/src/src/extensions/builtin-extensions.ts +9 -0
  616. package/src/src/extensions/schema/index.ts +3 -0
  617. package/src/src/extensions/schema/json-schema.ts +23 -0
  618. package/src/src/extensions/schema/schema-validator.ts +105 -6
  619. package/src/src/html/html-shell-generator.ts +1 -1
  620. package/src/src/html/hydration-script-builder/hydration-data-generator.ts +2 -2
  621. package/src/src/html/schemas/html.schema.ts +81 -65
  622. package/src/src/html/utils.ts +4 -1
  623. package/src/src/integrations/schema.ts +140 -111
  624. package/src/src/internal-agents/ag-ui-sse.ts +85 -83
  625. package/src/src/internal-agents/run-stream.ts +4 -2
  626. package/src/src/internal-agents/schema.ts +120 -89
  627. package/src/src/issues/core.ts +3 -1
  628. package/src/src/issues/mcp.ts +81 -58
  629. package/src/src/issues/schemas/index.ts +11 -0
  630. package/src/src/issues/schemas/issue.schema.ts +99 -73
  631. package/src/src/jobs/jobs-client.ts +4 -4
  632. package/src/src/jobs/schemas.ts +414 -297
  633. package/src/src/mcp/index.ts +6 -2
  634. package/src/src/mcp/schemas/index.ts +3 -0
  635. package/src/src/mcp/schemas/mcp.schema.ts +45 -29
  636. package/src/src/mcp/types.ts +2 -3
  637. package/src/src/oauth/schemas/oauth.schema.ts +96 -70
  638. package/src/src/platform/adapters/fs/github/github-api-client.ts +6 -6
  639. package/src/src/platform/adapters/fs/github/index.ts +5 -5
  640. package/src/src/platform/adapters/fs/github/schemas/github-api.schema.ts +58 -42
  641. package/src/src/platform/adapters/fs/github/schemas/index.ts +5 -5
  642. package/src/src/platform/adapters/fs/veryfront/proxy-manager.ts +9 -5
  643. package/src/src/platform/adapters/fs/veryfront/schemas/index.ts +1 -1
  644. package/src/src/platform/adapters/fs/veryfront/schemas/proxy-manager.schema.ts +14 -11
  645. package/src/src/platform/adapters/fs/veryfront/stat-operations.ts +1 -0
  646. package/src/src/platform/adapters/veryfront-api-client/index.ts +17 -16
  647. package/src/src/platform/adapters/veryfront-api-client/operations.ts +20 -31
  648. package/src/src/platform/adapters/veryfront-api-client/schemas/api.schema.ts +231 -150
  649. package/src/src/platform/adapters/veryfront-api-client/schemas/index.ts +17 -16
  650. package/src/src/prompt/schemas/prompt.schema.ts +13 -10
  651. package/src/src/proxy/handler.ts +0 -1
  652. package/src/src/rendering/orchestrator/html-project-css.ts +1 -1
  653. package/src/src/rendering/renderer.ts +2 -2
  654. package/src/src/repositories/schemas/repository.schema.ts +36 -22
  655. package/src/src/resource/index.ts +6 -2
  656. package/src/src/resource/schemas/index.ts +2 -0
  657. package/src/src/resource/schemas/resource.schema.ts +17 -8
  658. package/src/src/resource/types.ts +3 -3
  659. package/src/src/routing/api/openapi/types.ts +5 -5
  660. package/src/src/sandbox/hosted-tools.ts +17 -13
  661. package/src/src/schemas/common.ts +83 -31
  662. package/src/src/schemas/define.ts +13 -6
  663. package/src/src/schemas/index.ts +29 -17
  664. package/src/src/schemas/json-schema.ts +33 -0
  665. package/src/src/schemas/primitives.ts +71 -35
  666. package/src/src/security/http/config.ts +1 -1
  667. package/src/src/security/input-validation/handler.ts +3 -3
  668. package/src/src/security/input-validation/parsers.ts +40 -45
  669. package/src/src/server/bootstrap.ts +3 -3
  670. package/src/src/server/dev-ui/manifest.js +1 -1
  671. package/src/src/server/handlers/dev/framework-candidates.generated.ts +1 -0
  672. package/src/src/server/handlers/request/agent-run-cancel.handler.ts +2 -6
  673. package/src/src/server/handlers/request/agent-run-resume.handler.ts +4 -9
  674. package/src/src/server/handlers/request/agent-stream.handler.ts +2 -4
  675. package/src/src/server/handlers/request/internal-agents-list.handler.ts +2 -5
  676. package/src/src/server/runtime-handler/environment-resolution.ts +4 -5
  677. package/src/src/server/runtime-handler/request-utils.ts +1 -2
  678. package/src/src/server/schemas/action.schema.ts +12 -6
  679. package/src/src/skill/tools.ts +37 -25
  680. package/src/src/tool/factory.ts +23 -5
  681. package/src/src/tool/host-tools.ts +16 -6
  682. package/src/src/tool/index.ts +9 -5
  683. package/src/src/tool/remote-source-tools.ts +10 -2
  684. package/src/src/tool/schema/json-schema.ts +9 -15
  685. package/src/src/tool/schema/zod-json-schema.ts +75 -209
  686. package/src/src/tool/sleep.ts +55 -7
  687. package/src/src/tool/types.ts +12 -8
  688. package/src/src/transforms/npm-import-rewrites.ts +1 -3
  689. package/src/src/utils/version-constant.ts +1 -1
  690. package/src/src/workflow/blob/veryfront-cloud-storage.ts +53 -39
  691. package/src/src/workflow/claude-code/tool.ts +29 -38
  692. package/src/src/workflow/dsl/workflow.ts +3 -3
  693. package/src/src/workflow/schemas/index.ts +17 -0
  694. package/src/src/workflow/schemas/workflow.schema.ts +183 -123
  695. package/src/src/workflow/types.ts +3 -3
  696. package/esm/src/schemas/zod-adapter.d.ts +0 -25
  697. package/esm/src/schemas/zod-adapter.d.ts.map +0 -1
  698. package/esm/src/schemas/zod-adapter.js +0 -120
  699. package/src/src/schemas/zod-adapter.ts +0 -180
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.501",
3
+ "version": "0.1.503",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -15,7 +15,8 @@ export default {
15
15
  "./extensions/ext-node-compatibility",
16
16
  "./extensions/ext-parser-babel",
17
17
  "./extensions/ext-tracing-opentelemetry",
18
- "./extensions/ext-transform-mdx"
18
+ "./extensions/ext-transform-mdx",
19
+ "./extensions/ext-zod"
19
20
  ],
20
21
  "exclude": [
21
22
  "npm/",
@@ -286,9 +287,13 @@ export default {
286
287
  "@babel/parser": "npm:@babel/parser@7.29.2",
287
288
  "gray-matter": "npm:gray-matter@4.0.3",
288
289
  "zod": "npm:zod@4.3.6",
290
+ "mdast": "npm:@types/mdast@4.0.3",
291
+ "hast": "npm:@types/hast@3.0.3",
292
+ "unist": "npm:@types/unist@3.0.2",
289
293
  "unified": "npm:unified@11.0.5",
290
294
  "class-variance-authority": "npm:class-variance-authority@0.7.1",
291
295
  "tailwind-merge": "npm:tailwind-merge@3.5.0",
296
+ "veryfront/schemas": "./src/schemas/index.ts",
292
297
  "veryfront/chat/conversation": "./src/chat/conversation.ts",
293
298
  "veryfront/chat/message-prep": "./src/chat/message-prep.ts",
294
299
  "veryfront/chat/final-step-fallback": "./src/chat/final-step-fallback.ts",
@@ -341,13 +346,14 @@ export default {
341
346
  "fmt": "deno fmt src/ cli/",
342
347
  "fmt:check": "deno fmt --check src/ cli/",
343
348
  "typecheck": "deno task generate && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/agent-service-route-export.check.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/jobs/index.ts src/mcp/index.ts src/provider/index.ts",
344
- "verify": "deno task generate && deno fmt --check src/ cli/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
345
- "verify:quick": "deno task generate && deno fmt --check src/ cli/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task docs:validate && deno task typecheck",
349
+ "verify": "deno task generate && deno fmt --check src/ cli/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
350
+ "verify:quick": "deno task generate && deno fmt --check src/ cli/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task docs:validate && deno task typecheck",
346
351
  "docs": "rm -rf docs/reference && deno run --allow-read --allow-write --allow-run scripts/docs/generate-api-reference.ts",
347
352
  "docs:copy": "rm -rf ../../docs/docs/code/reference && cp -r docs/reference/ ../../docs/docs/code/reference/",
348
353
  "docs:validate": "deno run --allow-read scripts/docs/validate-api-reference.ts",
349
354
  "docs:verify-npm": "node scripts/docs/verify-npm-exports.mjs && node scripts/docs/verify-npm-node.mjs",
350
355
  "docs:check-links": "deno run -A scripts/lint/check-doc-links.ts",
356
+ "lint:ban-zod": "deno run --allow-read scripts/lint/ban-zod-imports.ts",
351
357
  "lint:ban-console": "deno run --allow-read scripts/lint/ban-console.ts",
352
358
  "lint:ban-deep-imports": "deno run --allow-read scripts/lint/ban-deep-imports.ts",
353
359
  "lint:imports": "deno run --allow-read scripts/lint/no-cross-boundary-relative-imports.ts",
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Zod-backed `SchemaValidator` adapter.
3
+ *
4
+ * The default implementation of the `SchemaValidator` contract. It thinly
5
+ * wraps zod so that core modules can declare schemas through the
6
+ * extension-neutral DSL while still getting zod's runtime behavior.
7
+ *
8
+ * The entire zod surface used by the contract is confined to this file.
9
+ *
10
+ * @module extensions/ext-zod/adapter
11
+ */
12
+
13
+ import { z } from "zod";
14
+ import type {
15
+ InferShape,
16
+ JsonSchema,
17
+ RefinementCtx,
18
+ Schema,
19
+ SchemaValidator,
20
+ SchemaValidatorCoerce,
21
+ ValidationIssue,
22
+ ValidationResult,
23
+ } from "../../../src/extensions/schema/index.js";
24
+ import { isOptionalSchema, zodToJsonSchema } from "./json-schema.js";
25
+
26
+ // deno-lint-ignore no-explicit-any -- zod's chainable APIs return parametric types
27
+ type AnyZodSchema = z.ZodType<any, any, any>;
28
+
29
+ /** Unwrap our opaque Schema<T> back to the underlying zod schema. */
30
+ function toZod<T>(schema: Schema<T>): AnyZodSchema {
31
+ return (schema as unknown as { __zod: AnyZodSchema }).__zod;
32
+ }
33
+
34
+ /** Wrap a zod schema as an opaque Schema<T> with chainables routed through zod. */
35
+ function wrap<T>(zs: AnyZodSchema): Schema<T> {
36
+ // The wrapper fakes the full Schema<T> surface; unsupported chainables on
37
+ // unsuitable kinds (e.g. calling `.email()` on a number) throw at runtime
38
+ // just like zod would.
39
+ // deno-lint-ignore no-explicit-any -- safe within this adapter
40
+ const anyZs = zs as any;
41
+ const s: Schema<T> = {
42
+ _output: undefined as unknown as T,
43
+ optional: () => wrap<T | undefined>(zs.optional()),
44
+ nullable: () => wrap<T | null>(zs.nullable()),
45
+ nullish: () => wrap<T | null | undefined>(zs.nullish()),
46
+ default: (value: Exclude<T, undefined> | (() => Exclude<T, undefined>)) =>
47
+ wrap<Exclude<T, undefined>>(anyZs.default(value)),
48
+ describe: (description: string) => wrap<T>(zs.describe(description)),
49
+ refine: (
50
+ check: (value: T) => boolean,
51
+ message?: string | { message?: string },
52
+ ) => wrap<T>(zs.refine(check as (v: unknown) => boolean, message as never)),
53
+ superRefine: (check: (value: T, ctx: RefinementCtx) => void) =>
54
+ wrap<T>(
55
+ // zod v4's `RefinementCtx` extends `ParsePayload` (`{ value, issues }`)
56
+ // and exposes `addIssue(string | $ZodSuperRefineIssue)`. We bridge to
57
+ // our path-aware `RefinementCtx` shape: we don't have a stable `path`
58
+ // from the zod side here (path tracking is per-issue, not per-ctx),
59
+ // so we emit `[]` and let callers pass their own `path` through
60
+ // `addIssue({ path })`.
61
+ anyZs.superRefine((value: T, zodCtx: { addIssue: (arg: unknown) => void }) => {
62
+ const ctx: RefinementCtx = {
63
+ path: [],
64
+ addIssue: (issue) =>
65
+ zodCtx.addIssue({
66
+ // String literal "custom" replaces the deprecated
67
+ // z.ZodIssueCode.custom enum (zod v4 prefers raw codes).
68
+ code: issue.code ?? "custom",
69
+ message: issue.message,
70
+ path: issue.path,
71
+ }),
72
+ };
73
+ check(value, ctx);
74
+ }),
75
+ ),
76
+ transform: <U>(fn: (value: T) => U) => wrap<U>(zs.transform(fn as never)),
77
+ strict: () => wrap<T>(anyZs.strict()),
78
+ strip: () => wrap<T>(anyZs.strip()),
79
+ passthrough: () => wrap<T & Record<string, unknown>>(anyZs.passthrough()),
80
+ partial: () => wrap<Partial<T>>(anyZs.partial()),
81
+ extend: <U extends Record<string, Schema<unknown>>>(shape: U) => {
82
+ const zodShape = toZodShape(shape);
83
+ return wrap<T & { [K in keyof U]: U[K] extends Schema<infer V> ? V : never }>(
84
+ anyZs.extend(zodShape),
85
+ );
86
+ },
87
+ merge: <U>(other: Schema<U>) => wrap<T & U>(anyZs.merge(toZod(other))),
88
+ omit: <K extends keyof T>(keys: { [P in K]?: true }) => wrap<Omit<T, K>>(anyZs.omit(keys)),
89
+ pick: <K extends keyof T>(keys: { [P in K]?: true }) => wrap<Pick<T, K>>(anyZs.pick(keys)),
90
+ min: (value: number, message?: string) => wrap<T>(anyZs.min(value, message)),
91
+ max: (value: number, message?: string) => wrap<T>(anyZs.max(value, message)),
92
+ int: (message?: string) => wrap<T>(anyZs.int(message)),
93
+ positive: (message?: string) => wrap<T>(anyZs.positive(message)),
94
+ nonnegative: (message?: string) => wrap<T>(anyZs.nonnegative(message)),
95
+ regex: (pattern: RegExp, message?: string) => wrap<T>(anyZs.regex(pattern, message)),
96
+ email: (message?: string) => wrap<T>(anyZs.email(message)),
97
+ url: (message?: string) => wrap<T>(anyZs.url(message)),
98
+ uuid: (message?: string) => wrap<T>(anyZs.uuid(message)),
99
+ datetime: (message?: string) => wrap<T>(anyZs.datetime(message)),
100
+ pipe: <U>(next: Schema<U>): Schema<U> => wrap<U>(zs.pipe(toZod(next))),
101
+ parse: (data: unknown): T => zs.parse(data) as T,
102
+ safeParse: (data: unknown): ValidationResult<T> => {
103
+ const res = zs.safeParse(data);
104
+ if (res.success) return { success: true, data: res.data as T };
105
+ const issues: ValidationIssue[] = res.error.issues.map((issue) => ({
106
+ path: issue.path as (string | number)[],
107
+ message: issue.message,
108
+ code: issue.code,
109
+ }));
110
+ return { success: false, issues, error: res.error };
111
+ },
112
+ };
113
+ // Attach the underlying zod schema for adapter round-trips without
114
+ // widening the public Schema<T> surface.
115
+ (s as unknown as { __zod: AnyZodSchema }).__zod = zs;
116
+ return s;
117
+ }
118
+
119
+ function toZodShape(
120
+ shape: Record<string, Schema<unknown>>,
121
+ ): Record<string, AnyZodSchema> {
122
+ const out: Record<string, AnyZodSchema> = {};
123
+ for (const [key, value] of Object.entries(shape)) {
124
+ out[key] = toZod(value);
125
+ }
126
+ return out;
127
+ }
128
+
129
+ const coerce: SchemaValidatorCoerce = {
130
+ string: (): Schema<string> => wrap(z.coerce.string()),
131
+ number: (): Schema<number> => wrap(z.coerce.number()),
132
+ boolean: (): Schema<boolean> => wrap(z.coerce.boolean()),
133
+ date: (): Schema<Date> => wrap(z.coerce.date()),
134
+ };
135
+
136
+ /**
137
+ * Build a zod-backed `SchemaValidator` instance.
138
+ *
139
+ * Stateless — safe to call once at extension setup and pass the returned
140
+ * value to `ctx.provide("SchemaValidator", …)`. Tests that need to register
141
+ * the validator without going through full extension bootstrap can call this
142
+ * factory directly.
143
+ */
144
+ export function createZodAdapter(): SchemaValidator {
145
+ return {
146
+ string: (): Schema<string> => wrap(z.string()),
147
+ number: (): Schema<number> => wrap(z.number()),
148
+ boolean: (): Schema<boolean> => wrap(z.boolean()),
149
+ date: (): Schema<Date> => wrap(z.date()),
150
+ null: (): Schema<null> => wrap(z.null()),
151
+ unknown: (): Schema<unknown> => wrap(z.unknown()),
152
+ bigint: (): Schema<bigint> => wrap(z.bigint()),
153
+ // deno-lint-ignore no-explicit-any -- contract mirrors zod's `any` constructor
154
+ any: (): Schema<any> => wrap(z.any()),
155
+ function: (): Schema<(...args: unknown[]) => unknown> =>
156
+ // zod 4's z.function() is callable without args/returns and produces a
157
+ // schema accepting any function. We wrap it as Schema<AnyFunction>.
158
+ wrap(z.function() as unknown as AnyZodSchema),
159
+
160
+ object: <S extends Record<string, Schema<unknown>>>(shape: S): Schema<InferShape<S>> =>
161
+ wrap(z.object(toZodShape(shape))),
162
+
163
+ array: <T>(element: Schema<T>): Schema<T[]> => wrap(z.array(toZod(element))),
164
+
165
+ tuple: <T extends readonly Schema<unknown>[]>(
166
+ items: T,
167
+ ): Schema<{ [K in keyof T]: T[K] extends Schema<infer U> ? U : never }> => {
168
+ const zodItems = items.map((s) => toZod(s)) as unknown as [
169
+ AnyZodSchema,
170
+ ...AnyZodSchema[],
171
+ ];
172
+ return wrap(z.tuple(zodItems));
173
+ },
174
+
175
+ record: <K extends string | number | symbol, V>(
176
+ keys: Schema<K>,
177
+ values: Schema<V>,
178
+ ): Schema<Record<K, V>> => wrap(z.record(toZod(keys) as unknown as z.ZodString, toZod(values))),
179
+
180
+ union: <T extends readonly [Schema<unknown>, ...Schema<unknown>[]]>(
181
+ schemas: T,
182
+ ): Schema<T[number] extends Schema<infer U> ? U : never> => {
183
+ const zodSchemas = schemas.map((s: Schema<unknown>) => toZod(s)) as unknown as [
184
+ AnyZodSchema,
185
+ AnyZodSchema,
186
+ ...AnyZodSchema[],
187
+ ];
188
+ return wrap(z.union(zodSchemas));
189
+ },
190
+
191
+ discriminatedUnion: <
192
+ K extends string,
193
+ T extends readonly [Schema<unknown>, ...Schema<unknown>[]],
194
+ >(
195
+ discriminator: K,
196
+ schemas: T,
197
+ ): Schema<T[number] extends Schema<infer U> ? U : never> => {
198
+ const zodSchemas = schemas.map((s: Schema<unknown>) => toZod(s)) as unknown as [
199
+ // deno-lint-ignore no-explicit-any -- discriminated-union variants widen here
200
+ z.ZodObject<any>,
201
+ // deno-lint-ignore no-explicit-any -- discriminated-union variants widen here
202
+ z.ZodObject<any>,
203
+ // deno-lint-ignore no-explicit-any -- discriminated-union variants widen here
204
+ ...z.ZodObject<any>[],
205
+ ];
206
+ return wrap(z.discriminatedUnion(discriminator, zodSchemas));
207
+ },
208
+
209
+ literal: <T extends string | number | boolean | null>(value: T): Schema<T> =>
210
+ wrap(z.literal(value as never)),
211
+
212
+ enum: <T extends readonly [string, ...string[]]>(values: T): Schema<T[number]> =>
213
+ wrap(
214
+ (z.enum as unknown as (v: readonly [string, ...string[]]) => AnyZodSchema)(values),
215
+ ),
216
+
217
+ lazy: <T>(factory: () => Schema<T>): Schema<T> => wrap<T>(z.lazy(() => toZod(factory()))),
218
+
219
+ instanceof: <T>(ctor: new (...args: never[]) => T): Schema<T> =>
220
+ // zod 4's z.instanceof expects `typeof Class` (z.core.util.Class). Our
221
+ // contract uses a slimmer `new`-able shape; bridge with a single cast
222
+ // through unknown.
223
+ wrap<T>(
224
+ (z.instanceof as unknown as (c: unknown) => AnyZodSchema)(ctor),
225
+ ),
226
+
227
+ custom: <T>(check?: (value: unknown) => boolean, message?: string): Schema<T> =>
228
+ wrap<T>(z.custom<T>(check as (v: unknown) => boolean, message)),
229
+
230
+ coerce,
231
+
232
+ validate: <T>(schema: Schema<T>, data: unknown): ValidationResult<T> => schema.safeParse(data),
233
+
234
+ toJsonSchema: (schema: Schema<unknown>): JsonSchema => zodToJsonSchema(toZod(schema)),
235
+
236
+ isOptional: (schema: Schema<unknown>): boolean => isOptionalSchema(toZod(schema)),
237
+ };
238
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * ext-zod — SchemaValidator implementation backed by zod.
3
+ *
4
+ * Provides the `SchemaValidator` contract via a zod-backed adapter. Core
5
+ * modules declare schemas through `defineSchema((v) => …)` (in
6
+ * `src/schemas/define.ts`); the lazy factory resolves this contract on first
7
+ * use and the adapter routes calls into zod.
8
+ *
9
+ * Registered automatically by `createBuiltinExtensions()`. Tests that need
10
+ * the adapter without going through full extension bootstrap can import
11
+ * `createZodAdapter` directly from this module's `./adapter.ts`.
12
+ *
13
+ * @module extensions/ext-zod
14
+ */
15
+
16
+ import type { ExtensionFactory } from "../../../src/extensions/index.js";
17
+ import { createZodAdapter } from "./adapter.js";
18
+
19
+ const extZod: ExtensionFactory = () => {
20
+ const impl = createZodAdapter();
21
+ return {
22
+ name: "ext-zod",
23
+ version: "0.1.0",
24
+ capabilities: [{ type: "contract", name: "SchemaValidator" }],
25
+ setup(ctx) {
26
+ ctx.provide("SchemaValidator", impl);
27
+ ctx.logger.info("[ext-zod] SchemaValidator registered");
28
+ },
29
+ teardown() {
30
+ // No resources to release.
31
+ },
32
+ };
33
+ };
34
+
35
+ export default extZod;
36
+ export { createZodAdapter } from "./adapter.js";
@@ -0,0 +1,311 @@
1
+ /**
2
+ * Zod-to-JSON-Schema converter used by the `SchemaValidator` adapter.
3
+ *
4
+ * Operates directly on zod's internal `_def` shape (covers both v3 and v4)
5
+ * because zod ships no first-class JSON-Schema export. Confined to
6
+ * `extensions/ext-zod/` so the rest of the codebase never has to import zod
7
+ * to learn what a tool's input schema looks like.
8
+ *
9
+ * @module extensions/ext-zod/json-schema
10
+ */
11
+
12
+ import type { z } from "zod";
13
+ import type { JsonSchema } from "../../../src/extensions/schema/index.js";
14
+
15
+ /** Zod internal _def shape — covers fields from both v3 and v4. */
16
+ interface ZodDef {
17
+ typeName?: string; // v3
18
+ type?: string; // v4
19
+ value?: unknown; // v3 literal
20
+ values?: unknown; // v3 enum / v4 literal
21
+ entries?: Record<string, unknown>; // v4 enum
22
+ description?: string; // v3 description metadata
23
+ shape?: (() => Record<string, z.ZodTypeAny>) | Record<string, z.ZodTypeAny>;
24
+ element?: z.ZodTypeAny; // v4 array/record
25
+ items?: z.ZodTypeAny[]; // tuple
26
+ options?: z.ZodTypeAny[] | Map<string, z.ZodTypeAny>; // union
27
+ valueType?: z.ZodTypeAny; // record
28
+ catchall?: z.ZodTypeAny; // object unknown-key policy / catchall
29
+ unknownKeys?: "strip" | "passthrough" | "strict"; // v3 object unknown-key policy
30
+ innerType?: z.ZodTypeAny; // optional/nullable/default (v3)
31
+ schema?: z.ZodTypeAny; // effects/optional/nullable (v3/v4)
32
+ in?: z.ZodTypeAny; // pipe input (v4)
33
+ getter?: () => z.ZodTypeAny; // lazy
34
+ defaultValue?: (() => unknown) | unknown;
35
+ }
36
+
37
+ interface ConversionContext {
38
+ seen: WeakSet<object>;
39
+ }
40
+
41
+ const LITERAL_TYPE_MAP: Record<string, "string" | "number" | "boolean"> = {
42
+ string: "string",
43
+ number: "number",
44
+ boolean: "boolean",
45
+ };
46
+
47
+ function getLiteralType(value: unknown): "string" | "number" | "boolean" | undefined {
48
+ return LITERAL_TYPE_MAP[typeof value];
49
+ }
50
+
51
+ function getDef(schema: z.ZodTypeAny): ZodDef {
52
+ return schema._def as ZodDef;
53
+ }
54
+
55
+ /** Get the internal type tag from a zod schema (_def.typeName in v3, _def.type in v4). */
56
+ function getTypeTag(schema: z.ZodTypeAny): string | undefined {
57
+ const def = getDef(schema);
58
+ return def.typeName ?? def.type;
59
+ }
60
+
61
+ export function zodToJsonSchema(schema: z.ZodTypeAny): JsonSchema {
62
+ return convertSchema(schema, { seen: new WeakSet() });
63
+ }
64
+
65
+ function convertSchema(schema: z.ZodTypeAny, context: ConversionContext): JsonSchema {
66
+ // Guard against invalid schemas (can happen with different zod instances in npm bundle)
67
+ if (!schema || typeof schema !== "object" || !("_def" in schema)) {
68
+ throw new Error("Invalid Zod schema: missing _def property");
69
+ }
70
+
71
+ const { schema: unwrapped, nullable } = unwrapSchema(schema);
72
+ const json = convert(unwrapped, context);
73
+ const description = getDescription(schema) ?? getDescription(unwrapped);
74
+ if (description && json.description === undefined) json.description = description;
75
+
76
+ return nullable ? { anyOf: [json, { type: "null" }] } : json;
77
+ }
78
+
79
+ export function isOptionalSchema(schema: z.ZodTypeAny): boolean {
80
+ return unwrapSchema(schema).optional || hasDefaultSchema(schema);
81
+ }
82
+
83
+ function convert(schema: z.ZodTypeAny, context: ConversionContext): JsonSchema {
84
+ if (context.seen.has(schema)) return {};
85
+ context.seen.add(schema);
86
+
87
+ try {
88
+ return convertInner(schema, context);
89
+ } finally {
90
+ context.seen.delete(schema);
91
+ }
92
+ }
93
+
94
+ function convertInner(schema: z.ZodTypeAny, context: ConversionContext): JsonSchema {
95
+ const tag = getTypeTag(schema);
96
+ const def = getDef(schema);
97
+
98
+ switch (tag) {
99
+ case "ZodString":
100
+ case "string":
101
+ return { type: "string" };
102
+
103
+ case "ZodNumber":
104
+ case "number":
105
+ return { type: "number" };
106
+
107
+ case "ZodBoolean":
108
+ case "boolean":
109
+ return { type: "boolean" };
110
+
111
+ case "ZodBigInt":
112
+ case "bigint":
113
+ return { type: "integer" };
114
+
115
+ case "ZodLiteral":
116
+ case "literal": {
117
+ // v3: _def.value, v4: _def.values (array of accepted values)
118
+ const literal = def.value ?? (Array.isArray(def.values) ? def.values[0] : def.values);
119
+ return { const: literal, type: getLiteralType(literal) };
120
+ }
121
+
122
+ case "ZodEnum":
123
+ case "ZodNativeEnum":
124
+ case "enum": {
125
+ // v3: _def.values (array), v4: _def.entries (object {key: value})
126
+ const values = def.values ?? (def.entries ? Object.values(def.entries) : []);
127
+ if (Array.isArray(values)) {
128
+ return { type: "string", enum: values };
129
+ }
130
+ // Native enum: filter out reverse-mapped numeric keys
131
+ return {
132
+ enum: Object.values(values).filter((value) => typeof value !== "number"),
133
+ };
134
+ }
135
+
136
+ case "ZodObject":
137
+ case "object": {
138
+ const shape = typeof def.shape === "function" ? def.shape() : def.shape;
139
+ const properties: Record<string, JsonSchema> = {};
140
+ const required: string[] = [];
141
+
142
+ for (const [key, value] of Object.entries(shape ?? {})) {
143
+ const zodSchema = value as z.ZodTypeAny;
144
+ properties[key] = convertSchema(zodSchema, context);
145
+ if (!isOptionalSchema(zodSchema)) required.push(key);
146
+ }
147
+
148
+ const json: JsonSchema = { type: "object", properties };
149
+ if (required.length) json.required = required;
150
+ const additionalProperties = getObjectAdditionalProperties(def, context);
151
+ if (additionalProperties !== undefined) json.additionalProperties = additionalProperties;
152
+
153
+ return json;
154
+ }
155
+
156
+ case "ZodArray":
157
+ case "array": {
158
+ // v3: _def.type (item schema), v4: _def.element (item schema)
159
+ const itemType = def.element ?? (def.type as unknown as z.ZodTypeAny | undefined);
160
+ if (!itemType || typeof itemType === "string") return { type: "array" };
161
+ return { type: "array", items: convertSchema(itemType, context) };
162
+ }
163
+
164
+ case "ZodTuple":
165
+ case "tuple": {
166
+ const items = def.items ?? [];
167
+ return {
168
+ type: "array",
169
+ prefixItems: items.map((item: z.ZodTypeAny) => convertSchema(item, context)),
170
+ minItems: items.length,
171
+ maxItems: items.length,
172
+ };
173
+ }
174
+
175
+ case "ZodUnion":
176
+ case "ZodDiscriminatedUnion":
177
+ case "union": {
178
+ const options = def.options ?? [];
179
+ const optionArray = options instanceof Map ? Array.from(options.values()) : options;
180
+ return { anyOf: optionArray.map((option: z.ZodTypeAny) => convertSchema(option, context)) };
181
+ }
182
+
183
+ case "ZodRecord":
184
+ case "record": {
185
+ const valueSchema = def.valueType ?? def.element;
186
+ if (!valueSchema) return { type: "object" };
187
+ return { type: "object", additionalProperties: convertSchema(valueSchema, context) };
188
+ }
189
+
190
+ case "ZodDefault":
191
+ case "default": {
192
+ const innerType = def.innerType ?? def.schema;
193
+ if (!innerType) return { type: "object" };
194
+ const inner = convertSchema(innerType, context);
195
+ const defaultValue = typeof def.defaultValue === "function"
196
+ ? def.defaultValue()
197
+ : def.defaultValue;
198
+
199
+ if (typeof inner === "object" && !("anyOf" in inner) && defaultValue !== undefined) {
200
+ inner.default = defaultValue;
201
+ }
202
+
203
+ return inner;
204
+ }
205
+
206
+ case "ZodLazy":
207
+ case "lazy":
208
+ return def.getter ? convert(def.getter(), context) : { type: "object" };
209
+
210
+ case "ZodEffects":
211
+ case "pipe": {
212
+ // v3: ZodEffects wraps schema in _def.schema
213
+ // v4: pipe wraps in _def.in (input schema)
214
+ const innerSchema = def.schema ?? def.in;
215
+ return innerSchema ? convert(innerSchema, context) : { type: "object" };
216
+ }
217
+
218
+ default:
219
+ return { type: "object" };
220
+ }
221
+ }
222
+
223
+ function getObjectAdditionalProperties(
224
+ def: ZodDef,
225
+ context: ConversionContext,
226
+ ): boolean | JsonSchema | undefined {
227
+ if (def.unknownKeys === "passthrough") return true;
228
+ if (def.unknownKeys === "strict") return false;
229
+ if (def.unknownKeys === "strip") return undefined;
230
+
231
+ if (!def.catchall) return undefined;
232
+
233
+ const catchallTag = getTypeTag(def.catchall);
234
+ if (catchallTag === "unknown" || catchallTag === "ZodUnknown") return true;
235
+ if (catchallTag === "never" || catchallTag === "ZodNever") return false;
236
+ return convertSchema(def.catchall, context);
237
+ }
238
+
239
+ function unwrapSchema(
240
+ schema: z.ZodTypeAny,
241
+ ): { schema: z.ZodTypeAny; nullable: boolean; optional: boolean } {
242
+ let current: z.ZodTypeAny = schema;
243
+ let nullable = false;
244
+ let optional = false;
245
+
246
+ while (true) {
247
+ const tag = getTypeTag(current);
248
+ const def = getDef(current);
249
+
250
+ switch (tag) {
251
+ case "ZodNullable":
252
+ case "nullable":
253
+ nullable = true;
254
+ current = (def.innerType ?? def.schema)!;
255
+ break;
256
+
257
+ case "ZodOptional":
258
+ case "optional":
259
+ optional = true;
260
+ current = (def.innerType ?? def.schema)!;
261
+ break;
262
+
263
+ case "ZodEffects":
264
+ case "pipe":
265
+ current = def.schema ?? def.in ?? current;
266
+ if (current === schema) return { schema: current, nullable, optional };
267
+ break;
268
+
269
+ default:
270
+ return { schema: current, nullable, optional };
271
+ }
272
+ }
273
+ }
274
+
275
+ function hasDefaultSchema(schema: z.ZodTypeAny): boolean {
276
+ let current: z.ZodTypeAny = schema;
277
+
278
+ while (true) {
279
+ const tag = getTypeTag(current);
280
+ const def = getDef(current);
281
+
282
+ switch (tag) {
283
+ case "ZodDefault":
284
+ case "default":
285
+ return true;
286
+
287
+ case "ZodNullable":
288
+ case "nullable":
289
+ case "ZodOptional":
290
+ case "optional":
291
+ case "ZodEffects":
292
+ case "pipe": {
293
+ const inner = def.innerType ?? def.schema ?? def.in;
294
+ if (!inner || inner === current) return false;
295
+ current = inner;
296
+ break;
297
+ }
298
+
299
+ default:
300
+ return false;
301
+ }
302
+ }
303
+ }
304
+
305
+ function getDescription(schema: z.ZodTypeAny): string | undefined {
306
+ const direct = (schema as { description?: unknown }).description;
307
+ if (typeof direct === "string") return direct;
308
+
309
+ const defDescription = getDef(schema).description;
310
+ return typeof defDescription === "string" ? defDescription : undefined;
311
+ }