@posthog/agent 1.24.2 → 1.26.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 (606) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/_virtual/_tslib.js +74 -0
  4. package/dist/_virtual/_tslib.js.map +1 -0
  5. package/dist/_virtual/additionalItems.js +4 -0
  6. package/dist/_virtual/additionalItems.js.map +1 -0
  7. package/dist/_virtual/additionalProperties.js +4 -0
  8. package/dist/_virtual/additionalProperties.js.map +1 -0
  9. package/dist/_virtual/ajv.js +4 -0
  10. package/dist/_virtual/ajv.js.map +1 -0
  11. package/dist/_virtual/allOf.js +4 -0
  12. package/dist/_virtual/allOf.js.map +1 -0
  13. package/dist/_virtual/anyOf.js +4 -0
  14. package/dist/_virtual/anyOf.js.map +1 -0
  15. package/dist/_virtual/applicability.js +4 -0
  16. package/dist/_virtual/applicability.js.map +1 -0
  17. package/dist/_virtual/boolSchema.js +4 -0
  18. package/dist/_virtual/boolSchema.js.map +1 -0
  19. package/dist/_virtual/code.js +4 -0
  20. package/dist/_virtual/code.js.map +1 -0
  21. package/dist/_virtual/code2.js +4 -0
  22. package/dist/_virtual/code2.js.map +1 -0
  23. package/dist/_virtual/const.js +4 -0
  24. package/dist/_virtual/const.js.map +1 -0
  25. package/dist/_virtual/contains.js +4 -0
  26. package/dist/_virtual/contains.js.map +1 -0
  27. package/dist/_virtual/core.js +4 -0
  28. package/dist/_virtual/core.js.map +1 -0
  29. package/dist/_virtual/dataType.js +4 -0
  30. package/dist/_virtual/dataType.js.map +1 -0
  31. package/dist/_virtual/defaults.js +4 -0
  32. package/dist/_virtual/defaults.js.map +1 -0
  33. package/dist/_virtual/dependencies.js +4 -0
  34. package/dist/_virtual/dependencies.js.map +1 -0
  35. package/dist/_virtual/draft7.js +4 -0
  36. package/dist/_virtual/draft7.js.map +1 -0
  37. package/dist/_virtual/enum.js +4 -0
  38. package/dist/_virtual/enum.js.map +1 -0
  39. package/dist/_virtual/equal.js +4 -0
  40. package/dist/_virtual/equal.js.map +1 -0
  41. package/dist/_virtual/errors.js +4 -0
  42. package/dist/_virtual/errors.js.map +1 -0
  43. package/dist/_virtual/format.js +4 -0
  44. package/dist/_virtual/format.js.map +1 -0
  45. package/dist/_virtual/formats.js +4 -0
  46. package/dist/_virtual/formats.js.map +1 -0
  47. package/dist/_virtual/id.js +4 -0
  48. package/dist/_virtual/id.js.map +1 -0
  49. package/dist/_virtual/if.js +4 -0
  50. package/dist/_virtual/if.js.map +1 -0
  51. package/dist/_virtual/index.js +4 -0
  52. package/dist/_virtual/index.js.map +1 -0
  53. package/dist/_virtual/index10.js +4 -0
  54. package/dist/_virtual/index10.js.map +1 -0
  55. package/dist/_virtual/index11.js +4 -0
  56. package/dist/_virtual/index11.js.map +1 -0
  57. package/dist/_virtual/index2.js +4 -0
  58. package/dist/_virtual/index2.js.map +1 -0
  59. package/dist/_virtual/index3.js +4 -0
  60. package/dist/_virtual/index3.js.map +1 -0
  61. package/dist/_virtual/index4.js +4 -0
  62. package/dist/_virtual/index4.js.map +1 -0
  63. package/dist/_virtual/index5.js +4 -0
  64. package/dist/_virtual/index5.js.map +1 -0
  65. package/dist/_virtual/index6.js +4 -0
  66. package/dist/_virtual/index6.js.map +1 -0
  67. package/dist/_virtual/index7.js +4 -0
  68. package/dist/_virtual/index7.js.map +1 -0
  69. package/dist/_virtual/index8.js +4 -0
  70. package/dist/_virtual/index8.js.map +1 -0
  71. package/dist/_virtual/index9.js +4 -0
  72. package/dist/_virtual/index9.js.map +1 -0
  73. package/dist/_virtual/items.js +4 -0
  74. package/dist/_virtual/items.js.map +1 -0
  75. package/dist/_virtual/items2020.js +4 -0
  76. package/dist/_virtual/items2020.js.map +1 -0
  77. package/dist/_virtual/keyword.js +4 -0
  78. package/dist/_virtual/keyword.js.map +1 -0
  79. package/dist/_virtual/limit.js +4 -0
  80. package/dist/_virtual/limit.js.map +1 -0
  81. package/dist/_virtual/limitItems.js +4 -0
  82. package/dist/_virtual/limitItems.js.map +1 -0
  83. package/dist/_virtual/limitLength.js +4 -0
  84. package/dist/_virtual/limitLength.js.map +1 -0
  85. package/dist/_virtual/limitNumber.js +4 -0
  86. package/dist/_virtual/limitNumber.js.map +1 -0
  87. package/dist/_virtual/limitProperties.js +4 -0
  88. package/dist/_virtual/limitProperties.js.map +1 -0
  89. package/dist/_virtual/metadata.js +4 -0
  90. package/dist/_virtual/metadata.js.map +1 -0
  91. package/dist/_virtual/multipleOf.js +4 -0
  92. package/dist/_virtual/multipleOf.js.map +1 -0
  93. package/dist/_virtual/names.js +4 -0
  94. package/dist/_virtual/names.js.map +1 -0
  95. package/dist/_virtual/not.js +4 -0
  96. package/dist/_virtual/not.js.map +1 -0
  97. package/dist/_virtual/oneOf.js +4 -0
  98. package/dist/_virtual/oneOf.js.map +1 -0
  99. package/dist/_virtual/pattern.js +4 -0
  100. package/dist/_virtual/pattern.js.map +1 -0
  101. package/dist/_virtual/patternProperties.js +4 -0
  102. package/dist/_virtual/patternProperties.js.map +1 -0
  103. package/dist/_virtual/prefixItems.js +4 -0
  104. package/dist/_virtual/prefixItems.js.map +1 -0
  105. package/dist/_virtual/properties.js +4 -0
  106. package/dist/_virtual/properties.js.map +1 -0
  107. package/dist/_virtual/propertyNames.js +4 -0
  108. package/dist/_virtual/propertyNames.js.map +1 -0
  109. package/dist/_virtual/ref.js +4 -0
  110. package/dist/_virtual/ref.js.map +1 -0
  111. package/dist/_virtual/ref_error.js +4 -0
  112. package/dist/_virtual/ref_error.js.map +1 -0
  113. package/dist/_virtual/required.js +4 -0
  114. package/dist/_virtual/required.js.map +1 -0
  115. package/dist/_virtual/resolve.js +4 -0
  116. package/dist/_virtual/resolve.js.map +1 -0
  117. package/dist/_virtual/rules.js +4 -0
  118. package/dist/_virtual/rules.js.map +1 -0
  119. package/dist/_virtual/scope.js +4 -0
  120. package/dist/_virtual/scope.js.map +1 -0
  121. package/dist/_virtual/subschema.js +4 -0
  122. package/dist/_virtual/subschema.js.map +1 -0
  123. package/dist/_virtual/thenElse.js +4 -0
  124. package/dist/_virtual/thenElse.js.map +1 -0
  125. package/dist/_virtual/types.js +4 -0
  126. package/dist/_virtual/types.js.map +1 -0
  127. package/dist/_virtual/ucs2length.js +4 -0
  128. package/dist/_virtual/ucs2length.js.map +1 -0
  129. package/dist/_virtual/uniqueItems.js +4 -0
  130. package/dist/_virtual/uniqueItems.js.map +1 -0
  131. package/dist/_virtual/uri.js +4 -0
  132. package/dist/_virtual/uri.js.map +1 -0
  133. package/dist/_virtual/util.js +4 -0
  134. package/dist/_virtual/util.js.map +1 -0
  135. package/dist/_virtual/validation_error.js +4 -0
  136. package/dist/_virtual/validation_error.js.map +1 -0
  137. package/dist/claude-cli/cli.js +2294 -2146
  138. package/dist/example-client.d.ts +3 -0
  139. package/dist/example-client.d.ts.map +1 -0
  140. package/dist/index.d.ts +19 -11
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +7 -3
  143. package/dist/index.js.map +1 -1
  144. package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js +891 -0
  145. package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
  146. package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +876 -0
  147. package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js.map +1 -0
  148. package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js +66 -0
  149. package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
  150. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +23 -0
  151. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
  152. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +331 -0
  153. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
  154. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +717 -0
  155. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
  156. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +221 -0
  157. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  158. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +56 -0
  159. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  160. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +440 -0
  161. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  162. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +94 -0
  163. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
  164. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1610 -0
  165. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  166. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +91 -0
  167. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  168. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js +133 -0
  169. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js.map +1 -0
  170. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js +9 -0
  171. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js.map +1 -0
  172. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js +9 -0
  173. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
  174. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js +112 -0
  175. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
  176. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js +136 -0
  177. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js.map +1 -0
  178. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js +112 -0
  179. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js.map +1 -0
  180. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js +3297 -0
  181. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js.map +1 -0
  182. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js +44 -0
  183. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js.map +1 -0
  184. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js +36 -0
  185. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js.map +1 -0
  186. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js +10 -0
  187. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js.map +1 -0
  188. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js +657 -0
  189. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js.map +1 -0
  190. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js +449 -0
  191. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js.map +1 -0
  192. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js +413 -0
  193. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js.map +1 -0
  194. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js +57 -0
  195. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js.map +1 -0
  196. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js +38 -0
  197. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js.map +1 -0
  198. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js +86 -0
  199. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js.map +1 -0
  200. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js +61 -0
  201. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js.map +1 -0
  202. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js +80 -0
  203. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js.map +1 -0
  204. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js +52 -0
  205. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js.map +1 -0
  206. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js +1307 -0
  207. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js.map +1 -0
  208. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js +842 -0
  209. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  210. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js +335 -0
  211. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js.map +1 -0
  212. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js +8 -0
  213. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js.map +1 -0
  214. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js +51 -0
  215. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js.map +1 -0
  216. package/dist/node_modules/ajv/dist/ajv.js +69 -0
  217. package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
  218. package/dist/node_modules/ajv/dist/compile/codegen/code.js +169 -0
  219. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  220. package/dist/node_modules/ajv/dist/compile/codegen/index.js +712 -0
  221. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  222. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +157 -0
  223. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  224. package/dist/node_modules/ajv/dist/compile/errors.js +140 -0
  225. package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
  226. package/dist/node_modules/ajv/dist/compile/index.js +253 -0
  227. package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
  228. package/dist/node_modules/ajv/dist/compile/names.js +40 -0
  229. package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
  230. package/dist/node_modules/ajv/dist/compile/ref_error.js +25 -0
  231. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  232. package/dist/node_modules/ajv/dist/compile/resolve.js +162 -0
  233. package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  234. package/dist/node_modules/ajv/dist/compile/rules.js +29 -0
  235. package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
  236. package/dist/node_modules/ajv/dist/compile/util.js +183 -0
  237. package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
  238. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +30 -0
  239. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  240. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +64 -0
  241. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  242. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +213 -0
  243. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  244. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +49 -0
  245. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  246. package/dist/node_modules/ajv/dist/compile/validate/index.js +544 -0
  247. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  248. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +139 -0
  249. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  250. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +95 -0
  251. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  252. package/dist/node_modules/ajv/dist/core.js +639 -0
  253. package/dist/node_modules/ajv/dist/core.js.map +1 -0
  254. package/dist/node_modules/ajv/dist/refs/data.json.js +31 -0
  255. package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
  256. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +254 -0
  257. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
  258. package/dist/node_modules/ajv/dist/runtime/equal.js +9 -0
  259. package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  260. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
  261. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  262. package/dist/node_modules/ajv/dist/runtime/uri.js +8 -0
  263. package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  264. package/dist/node_modules/ajv/dist/runtime/validation_error.js +22 -0
  265. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  266. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +53 -0
  267. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  268. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +112 -0
  269. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  270. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +26 -0
  271. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  272. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +14 -0
  273. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  274. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +99 -0
  275. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  276. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +93 -0
  277. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  278. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +70 -0
  279. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  280. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +77 -0
  281. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  282. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +57 -0
  283. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  284. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +37 -0
  285. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  286. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +29 -0
  287. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  288. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
  289. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  290. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +80 -0
  291. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  292. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +15 -0
  293. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  294. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +61 -0
  295. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  296. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +42 -0
  297. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  298. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +16 -0
  299. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  300. package/dist/node_modules/ajv/dist/vocabularies/code.js +146 -0
  301. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  302. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +11 -0
  303. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  304. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +21 -0
  305. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  306. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +131 -0
  307. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  308. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +113 -0
  309. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  310. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +12 -0
  311. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  312. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +28 -0
  313. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  314. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +94 -0
  315. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  316. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +9 -0
  317. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  318. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +21 -0
  319. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  320. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +31 -0
  321. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  322. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +54 -0
  323. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  324. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +54 -0
  325. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  326. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +26 -0
  327. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  328. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
  329. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  330. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +29 -0
  331. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  332. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +26 -0
  333. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  334. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +28 -0
  335. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  336. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +27 -0
  337. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  338. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +84 -0
  339. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  340. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +72 -0
  341. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  342. package/dist/node_modules/ajv-formats/dist/formats.js +212 -0
  343. package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
  344. package/dist/node_modules/ajv-formats/dist/index.js +52 -0
  345. package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
  346. package/dist/node_modules/ajv-formats/dist/limit.js +75 -0
  347. package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
  348. package/dist/node_modules/diff/libesm/diff/base.js +256 -0
  349. package/dist/node_modules/diff/libesm/diff/base.js.map +1 -0
  350. package/dist/node_modules/diff/libesm/diff/line.js +64 -0
  351. package/dist/node_modules/diff/libesm/diff/line.js.map +1 -0
  352. package/dist/node_modules/diff/libesm/patch/create.js +185 -0
  353. package/dist/node_modules/diff/libesm/patch/create.js.map +1 -0
  354. package/dist/node_modules/fast-deep-equal/index.js +47 -0
  355. package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
  356. package/dist/node_modules/fast-uri/index.js +347 -0
  357. package/dist/node_modules/fast-uri/index.js.map +1 -0
  358. package/dist/node_modules/fast-uri/lib/schemes.js +255 -0
  359. package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
  360. package/dist/node_modules/fast-uri/lib/utils.js +334 -0
  361. package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
  362. package/dist/node_modules/json-schema-traverse/index.js +98 -0
  363. package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
  364. package/dist/node_modules/uuid/dist/rng.js +14 -0
  365. package/dist/node_modules/uuid/dist/rng.js.map +1 -0
  366. package/dist/node_modules/uuid/dist/stringify.js +29 -0
  367. package/dist/node_modules/uuid/dist/stringify.js.map +1 -0
  368. package/dist/node_modules/uuid/dist/v7.js +65 -0
  369. package/dist/node_modules/uuid/dist/v7.js.map +1 -0
  370. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +37 -0
  371. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
  372. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +26 -0
  373. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
  374. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +17 -0
  375. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
  376. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +11 -0
  377. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +1 -0
  378. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +66 -0
  379. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
  380. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +21 -0
  381. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
  382. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +30 -0
  383. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
  384. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +53 -0
  385. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
  386. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +8 -0
  387. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
  388. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +8 -0
  389. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
  390. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +8 -0
  391. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
  392. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +50 -0
  393. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
  394. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +11 -0
  395. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
  396. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +11 -0
  397. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
  398. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +9 -0
  399. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
  400. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +56 -0
  401. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
  402. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +24 -0
  403. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
  404. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +30 -0
  405. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
  406. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +19 -0
  407. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
  408. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +15 -0
  409. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
  410. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +13 -0
  411. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
  412. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +37 -0
  413. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
  414. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +56 -0
  415. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
  416. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +76 -0
  417. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
  418. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +25 -0
  419. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
  420. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +24 -0
  421. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
  422. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +8 -0
  423. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
  424. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +8 -0
  425. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
  426. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +65 -0
  427. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
  428. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +24 -0
  429. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
  430. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +350 -0
  431. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  432. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +36 -0
  433. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
  434. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +10 -0
  435. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
  436. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +84 -0
  437. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
  438. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +8 -0
  439. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
  440. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +109 -0
  441. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
  442. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +90 -0
  443. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
  444. package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js +42 -0
  445. package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js.map +1 -0
  446. package/dist/package.json.js +8 -0
  447. package/dist/package.json.js.map +1 -0
  448. package/dist/src/acp-extensions.d.ts +91 -0
  449. package/dist/src/acp-extensions.d.ts.map +1 -0
  450. package/dist/src/acp-extensions.js +38 -0
  451. package/dist/src/acp-extensions.js.map +1 -0
  452. package/dist/src/adapters/claude/claude.d.ts +136 -0
  453. package/dist/src/adapters/claude/claude.d.ts.map +1 -0
  454. package/dist/src/adapters/claude/claude.js +1128 -0
  455. package/dist/src/adapters/claude/claude.js.map +1 -0
  456. package/dist/src/adapters/claude/mcp-server.d.ts +30 -0
  457. package/dist/src/adapters/claude/mcp-server.d.ts.map +1 -0
  458. package/dist/src/adapters/claude/mcp-server.js +668 -0
  459. package/dist/src/adapters/claude/mcp-server.js.map +1 -0
  460. package/dist/src/adapters/claude/tools.d.ts +35 -0
  461. package/dist/src/adapters/claude/tools.d.ts.map +1 -0
  462. package/dist/src/adapters/claude/tools.js +473 -0
  463. package/dist/src/adapters/claude/tools.js.map +1 -0
  464. package/dist/src/adapters/claude/utils.d.ts +48 -0
  465. package/dist/src/adapters/claude/utils.d.ts.map +1 -0
  466. package/dist/src/adapters/claude/utils.js +158 -0
  467. package/dist/src/adapters/claude/utils.js.map +1 -0
  468. package/dist/src/agent.d.ts +24 -28
  469. package/dist/src/agent.d.ts.map +1 -1
  470. package/dist/src/agent.js +343 -172
  471. package/dist/src/agent.js.map +1 -1
  472. package/dist/src/agents/execution.js.map +1 -1
  473. package/dist/src/agents/planning.js.map +1 -1
  474. package/dist/src/agents/research.js.map +1 -1
  475. package/dist/src/file-manager.d.ts +6 -6
  476. package/dist/src/file-manager.d.ts.map +1 -1
  477. package/dist/src/file-manager.js +72 -63
  478. package/dist/src/file-manager.js.map +1 -1
  479. package/dist/src/git-manager.d.ts +2 -1
  480. package/dist/src/git-manager.d.ts.map +1 -1
  481. package/dist/src/git-manager.js +105 -70
  482. package/dist/src/git-manager.js.map +1 -1
  483. package/dist/src/posthog-api.d.ts +8 -14
  484. package/dist/src/posthog-api.d.ts.map +1 -1
  485. package/dist/src/posthog-api.js +35 -23
  486. package/dist/src/posthog-api.js.map +1 -1
  487. package/dist/src/prompt-builder.d.ts +4 -4
  488. package/dist/src/prompt-builder.d.ts.map +1 -1
  489. package/dist/src/prompt-builder.js +129 -99
  490. package/dist/src/prompt-builder.js.map +1 -1
  491. package/dist/src/schemas.d.ts +980 -0
  492. package/dist/src/schemas.d.ts.map +1 -0
  493. package/dist/src/schemas.js +196 -0
  494. package/dist/src/schemas.js.map +1 -0
  495. package/dist/src/session-store.d.ts +58 -0
  496. package/dist/src/session-store.d.ts.map +1 -0
  497. package/dist/src/session-store.js +206 -0
  498. package/dist/src/session-store.js.map +1 -0
  499. package/dist/src/task-manager.d.ts +7 -7
  500. package/dist/src/task-manager.d.ts.map +1 -1
  501. package/dist/src/task-manager.js +19 -18
  502. package/dist/src/task-manager.js.map +1 -1
  503. package/dist/src/template-manager.d.ts +1 -1
  504. package/dist/src/template-manager.d.ts.map +1 -1
  505. package/dist/src/template-manager.js +30 -28
  506. package/dist/src/template-manager.js.map +1 -1
  507. package/dist/src/todo-manager.d.ts +5 -5
  508. package/dist/src/todo-manager.d.ts.map +1 -1
  509. package/dist/src/todo-manager.js +33 -24
  510. package/dist/src/todo-manager.js.map +1 -1
  511. package/dist/src/tools/registry.d.ts +1 -1
  512. package/dist/src/tools/registry.js +60 -60
  513. package/dist/src/tools/registry.js.map +1 -1
  514. package/dist/src/tools/types.d.ts +31 -31
  515. package/dist/src/types.d.ts +62 -167
  516. package/dist/src/types.d.ts.map +1 -1
  517. package/dist/src/types.js +1 -0
  518. package/dist/src/types.js.map +1 -1
  519. package/dist/src/utils/logger.d.ts +14 -6
  520. package/dist/src/utils/logger.d.ts.map +1 -1
  521. package/dist/src/utils/logger.js +37 -22
  522. package/dist/src/utils/logger.js.map +1 -1
  523. package/dist/src/utils/tapped-stream.d.ts +17 -0
  524. package/dist/src/utils/tapped-stream.d.ts.map +1 -0
  525. package/dist/src/utils/tapped-stream.js +45 -0
  526. package/dist/src/utils/tapped-stream.js.map +1 -0
  527. package/dist/src/workflow/config.d.ts +1 -1
  528. package/dist/src/workflow/config.d.ts.map +1 -1
  529. package/dist/src/workflow/config.js +18 -18
  530. package/dist/src/workflow/config.js.map +1 -1
  531. package/dist/src/workflow/steps/build.d.ts +1 -1
  532. package/dist/src/workflow/steps/build.d.ts.map +1 -1
  533. package/dist/src/workflow/steps/build.js +53 -39
  534. package/dist/src/workflow/steps/build.js.map +1 -1
  535. package/dist/src/workflow/steps/finalize.d.ts +1 -1
  536. package/dist/src/workflow/steps/finalize.d.ts.map +1 -1
  537. package/dist/src/workflow/steps/finalize.js +58 -52
  538. package/dist/src/workflow/steps/finalize.js.map +1 -1
  539. package/dist/src/workflow/steps/plan.d.ts +1 -1
  540. package/dist/src/workflow/steps/plan.d.ts.map +1 -1
  541. package/dist/src/workflow/steps/plan.js +69 -47
  542. package/dist/src/workflow/steps/plan.js.map +1 -1
  543. package/dist/src/workflow/steps/research.d.ts +1 -1
  544. package/dist/src/workflow/steps/research.d.ts.map +1 -1
  545. package/dist/src/workflow/steps/research.js +86 -67
  546. package/dist/src/workflow/steps/research.js.map +1 -1
  547. package/dist/src/workflow/types.d.ts +19 -14
  548. package/dist/src/workflow/types.d.ts.map +1 -1
  549. package/dist/src/workflow/utils.d.ts +1 -1
  550. package/dist/src/workflow/utils.d.ts.map +1 -1
  551. package/dist/src/workflow/utils.js +7 -4
  552. package/dist/src/workflow/utils.js.map +1 -1
  553. package/dist/src/worktree-manager.d.ts +39 -0
  554. package/dist/src/worktree-manager.d.ts.map +1 -0
  555. package/dist/src/worktree-manager.js +808 -0
  556. package/dist/src/worktree-manager.js.map +1 -0
  557. package/package.json +20 -16
  558. package/src/acp-extensions.ts +117 -0
  559. package/src/adapters/claude/claude.ts +1514 -0
  560. package/src/adapters/claude/mcp-server.ts +810 -0
  561. package/src/adapters/claude/tools.ts +616 -0
  562. package/src/adapters/claude/utils.ts +267 -0
  563. package/src/agent.ts +717 -441
  564. package/src/agents/execution.ts +1 -1
  565. package/src/agents/planning.ts +1 -1
  566. package/src/agents/research.ts +0 -1
  567. package/src/file-manager.ts +80 -70
  568. package/src/git-manager.ts +164 -88
  569. package/src/posthog-api.ts +155 -94
  570. package/src/prompt-builder.ts +196 -143
  571. package/src/schemas.ts +241 -0
  572. package/src/session-store.ts +259 -0
  573. package/src/task-manager.ts +41 -33
  574. package/src/template-manager.ts +98 -45
  575. package/src/todo-manager.ts +43 -32
  576. package/src/tools/registry.ts +62 -62
  577. package/src/tools/types.ts +36 -36
  578. package/src/types.ts +130 -239
  579. package/src/utils/logger.ts +89 -58
  580. package/src/utils/tapped-stream.ts +60 -0
  581. package/src/workflow/config.ts +48 -48
  582. package/src/workflow/steps/build.ts +127 -113
  583. package/src/workflow/steps/finalize.ts +207 -182
  584. package/src/workflow/steps/plan.ts +155 -130
  585. package/src/workflow/steps/research.ts +207 -187
  586. package/src/workflow/types.ts +47 -36
  587. package/src/workflow/utils.ts +37 -34
  588. package/src/worktree-manager.ts +881 -0
  589. package/dist/src/adapters/claude/claude-adapter.d.ts +0 -18
  590. package/dist/src/adapters/claude/claude-adapter.d.ts.map +0 -1
  591. package/dist/src/adapters/claude/claude-adapter.js +0 -311
  592. package/dist/src/adapters/claude/claude-adapter.js.map +0 -1
  593. package/dist/src/adapters/claude/tool-mapper.d.ts +0 -19
  594. package/dist/src/adapters/claude/tool-mapper.d.ts.map +0 -1
  595. package/dist/src/adapters/claude/tool-mapper.js +0 -44
  596. package/dist/src/adapters/claude/tool-mapper.js.map +0 -1
  597. package/dist/src/adapters/types.d.ts +0 -33
  598. package/dist/src/adapters/types.d.ts.map +0 -1
  599. package/dist/src/task-progress-reporter.d.ts +0 -43
  600. package/dist/src/task-progress-reporter.d.ts.map +0 -1
  601. package/dist/src/task-progress-reporter.js +0 -393
  602. package/dist/src/task-progress-reporter.js.map +0 -1
  603. package/src/adapters/claude/claude-adapter.ts +0 -338
  604. package/src/adapters/claude/tool-mapper.ts +0 -46
  605. package/src/adapters/types.ts +0 -37
  606. package/src/task-progress-reporter.ts +0 -443
@@ -0,0 +1,842 @@
1
+ import { $ZodRegistry, globalRegistry } from './registries.js';
2
+ import { getEnumValues } from './util.js';
3
+
4
+ class JSONSchemaGenerator {
5
+ constructor(params) {
6
+ this.counter = 0;
7
+ this.metadataRegistry = params?.metadata ?? globalRegistry;
8
+ this.target = params?.target ?? "draft-2020-12";
9
+ this.unrepresentable = params?.unrepresentable ?? "throw";
10
+ this.override = params?.override ?? (() => { });
11
+ this.io = params?.io ?? "output";
12
+ this.seen = new Map();
13
+ }
14
+ process(schema, _params = { path: [], schemaPath: [] }) {
15
+ var _a;
16
+ const def = schema._zod.def;
17
+ const formatMap = {
18
+ guid: "uuid",
19
+ url: "uri",
20
+ datetime: "date-time",
21
+ json_string: "json-string",
22
+ regex: "", // do not set
23
+ };
24
+ // check for schema in seens
25
+ const seen = this.seen.get(schema);
26
+ if (seen) {
27
+ seen.count++;
28
+ // check if cycle
29
+ const isCycle = _params.schemaPath.includes(schema);
30
+ if (isCycle) {
31
+ seen.cycle = _params.path;
32
+ }
33
+ return seen.schema;
34
+ }
35
+ // initialize
36
+ const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
37
+ this.seen.set(schema, result);
38
+ // custom method overrides default behavior
39
+ const overrideSchema = schema._zod.toJSONSchema?.();
40
+ if (overrideSchema) {
41
+ result.schema = overrideSchema;
42
+ }
43
+ else {
44
+ const params = {
45
+ ..._params,
46
+ schemaPath: [..._params.schemaPath, schema],
47
+ path: _params.path,
48
+ };
49
+ const parent = schema._zod.parent;
50
+ if (parent) {
51
+ // schema was cloned from another schema
52
+ result.ref = parent;
53
+ this.process(parent, params);
54
+ this.seen.get(parent).isParent = true;
55
+ }
56
+ else {
57
+ const _json = result.schema;
58
+ switch (def.type) {
59
+ case "string": {
60
+ const json = _json;
61
+ json.type = "string";
62
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod
63
+ .bag;
64
+ if (typeof minimum === "number")
65
+ json.minLength = minimum;
66
+ if (typeof maximum === "number")
67
+ json.maxLength = maximum;
68
+ // custom pattern overrides format
69
+ if (format) {
70
+ json.format = formatMap[format] ?? format;
71
+ if (json.format === "")
72
+ delete json.format; // empty format is not valid
73
+ }
74
+ if (contentEncoding)
75
+ json.contentEncoding = contentEncoding;
76
+ if (patterns && patterns.size > 0) {
77
+ const regexes = [...patterns];
78
+ if (regexes.length === 1)
79
+ json.pattern = regexes[0].source;
80
+ else if (regexes.length > 1) {
81
+ result.schema.allOf = [
82
+ ...regexes.map((regex) => ({
83
+ ...(this.target === "draft-7" ? { type: "string" } : {}),
84
+ pattern: regex.source,
85
+ })),
86
+ ];
87
+ }
88
+ }
89
+ break;
90
+ }
91
+ case "number": {
92
+ const json = _json;
93
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
94
+ if (typeof format === "string" && format.includes("int"))
95
+ json.type = "integer";
96
+ else
97
+ json.type = "number";
98
+ if (typeof exclusiveMinimum === "number")
99
+ json.exclusiveMinimum = exclusiveMinimum;
100
+ if (typeof minimum === "number") {
101
+ json.minimum = minimum;
102
+ if (typeof exclusiveMinimum === "number") {
103
+ if (exclusiveMinimum >= minimum)
104
+ delete json.minimum;
105
+ else
106
+ delete json.exclusiveMinimum;
107
+ }
108
+ }
109
+ if (typeof exclusiveMaximum === "number")
110
+ json.exclusiveMaximum = exclusiveMaximum;
111
+ if (typeof maximum === "number") {
112
+ json.maximum = maximum;
113
+ if (typeof exclusiveMaximum === "number") {
114
+ if (exclusiveMaximum <= maximum)
115
+ delete json.maximum;
116
+ else
117
+ delete json.exclusiveMaximum;
118
+ }
119
+ }
120
+ if (typeof multipleOf === "number")
121
+ json.multipleOf = multipleOf;
122
+ break;
123
+ }
124
+ case "boolean": {
125
+ const json = _json;
126
+ json.type = "boolean";
127
+ break;
128
+ }
129
+ case "bigint": {
130
+ if (this.unrepresentable === "throw") {
131
+ throw new Error("BigInt cannot be represented in JSON Schema");
132
+ }
133
+ break;
134
+ }
135
+ case "symbol": {
136
+ if (this.unrepresentable === "throw") {
137
+ throw new Error("Symbols cannot be represented in JSON Schema");
138
+ }
139
+ break;
140
+ }
141
+ case "null": {
142
+ _json.type = "null";
143
+ break;
144
+ }
145
+ case "any": {
146
+ break;
147
+ }
148
+ case "unknown": {
149
+ break;
150
+ }
151
+ case "undefined": {
152
+ if (this.unrepresentable === "throw") {
153
+ throw new Error("Undefined cannot be represented in JSON Schema");
154
+ }
155
+ break;
156
+ }
157
+ case "void": {
158
+ if (this.unrepresentable === "throw") {
159
+ throw new Error("Void cannot be represented in JSON Schema");
160
+ }
161
+ break;
162
+ }
163
+ case "never": {
164
+ _json.not = {};
165
+ break;
166
+ }
167
+ case "date": {
168
+ if (this.unrepresentable === "throw") {
169
+ throw new Error("Date cannot be represented in JSON Schema");
170
+ }
171
+ break;
172
+ }
173
+ case "array": {
174
+ const json = _json;
175
+ const { minimum, maximum } = schema._zod.bag;
176
+ if (typeof minimum === "number")
177
+ json.minItems = minimum;
178
+ if (typeof maximum === "number")
179
+ json.maxItems = maximum;
180
+ json.type = "array";
181
+ json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
182
+ break;
183
+ }
184
+ case "object": {
185
+ const json = _json;
186
+ json.type = "object";
187
+ json.properties = {};
188
+ const shape = def.shape; // params.shapeCache.get(schema)!;
189
+ for (const key in shape) {
190
+ json.properties[key] = this.process(shape[key], {
191
+ ...params,
192
+ path: [...params.path, "properties", key],
193
+ });
194
+ }
195
+ // required keys
196
+ const allKeys = new Set(Object.keys(shape));
197
+ // const optionalKeys = new Set(def.optional);
198
+ const requiredKeys = new Set([...allKeys].filter((key) => {
199
+ const v = def.shape[key]._zod;
200
+ if (this.io === "input") {
201
+ return v.optin === undefined;
202
+ }
203
+ else {
204
+ return v.optout === undefined;
205
+ }
206
+ }));
207
+ if (requiredKeys.size > 0) {
208
+ json.required = Array.from(requiredKeys);
209
+ }
210
+ // catchall
211
+ if (def.catchall?._zod.def.type === "never") {
212
+ // strict
213
+ json.additionalProperties = false;
214
+ }
215
+ else if (!def.catchall) {
216
+ // regular
217
+ if (this.io === "output")
218
+ json.additionalProperties = false;
219
+ }
220
+ else if (def.catchall) {
221
+ json.additionalProperties = this.process(def.catchall, {
222
+ ...params,
223
+ path: [...params.path, "additionalProperties"],
224
+ });
225
+ }
226
+ break;
227
+ }
228
+ case "union": {
229
+ const json = _json;
230
+ json.anyOf = def.options.map((x, i) => this.process(x, {
231
+ ...params,
232
+ path: [...params.path, "anyOf", i],
233
+ }));
234
+ break;
235
+ }
236
+ case "intersection": {
237
+ const json = _json;
238
+ const a = this.process(def.left, {
239
+ ...params,
240
+ path: [...params.path, "allOf", 0],
241
+ });
242
+ const b = this.process(def.right, {
243
+ ...params,
244
+ path: [...params.path, "allOf", 1],
245
+ });
246
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
247
+ const allOf = [
248
+ ...(isSimpleIntersection(a) ? a.allOf : [a]),
249
+ ...(isSimpleIntersection(b) ? b.allOf : [b]),
250
+ ];
251
+ json.allOf = allOf;
252
+ break;
253
+ }
254
+ case "tuple": {
255
+ const json = _json;
256
+ json.type = "array";
257
+ const prefixItems = def.items.map((x, i) => this.process(x, { ...params, path: [...params.path, "prefixItems", i] }));
258
+ if (this.target === "draft-2020-12") {
259
+ json.prefixItems = prefixItems;
260
+ }
261
+ else {
262
+ json.items = prefixItems;
263
+ }
264
+ if (def.rest) {
265
+ const rest = this.process(def.rest, {
266
+ ...params,
267
+ path: [...params.path, "items"],
268
+ });
269
+ if (this.target === "draft-2020-12") {
270
+ json.items = rest;
271
+ }
272
+ else {
273
+ json.additionalItems = rest;
274
+ }
275
+ }
276
+ // additionalItems
277
+ if (def.rest) {
278
+ json.items = this.process(def.rest, {
279
+ ...params,
280
+ path: [...params.path, "items"],
281
+ });
282
+ }
283
+ // length
284
+ const { minimum, maximum } = schema._zod.bag;
285
+ if (typeof minimum === "number")
286
+ json.minItems = minimum;
287
+ if (typeof maximum === "number")
288
+ json.maxItems = maximum;
289
+ break;
290
+ }
291
+ case "record": {
292
+ const json = _json;
293
+ json.type = "object";
294
+ json.propertyNames = this.process(def.keyType, { ...params, path: [...params.path, "propertyNames"] });
295
+ json.additionalProperties = this.process(def.valueType, {
296
+ ...params,
297
+ path: [...params.path, "additionalProperties"],
298
+ });
299
+ break;
300
+ }
301
+ case "map": {
302
+ if (this.unrepresentable === "throw") {
303
+ throw new Error("Map cannot be represented in JSON Schema");
304
+ }
305
+ break;
306
+ }
307
+ case "set": {
308
+ if (this.unrepresentable === "throw") {
309
+ throw new Error("Set cannot be represented in JSON Schema");
310
+ }
311
+ break;
312
+ }
313
+ case "enum": {
314
+ const json = _json;
315
+ const values = getEnumValues(def.entries);
316
+ // Number enums can have both string and number values
317
+ if (values.every((v) => typeof v === "number"))
318
+ json.type = "number";
319
+ if (values.every((v) => typeof v === "string"))
320
+ json.type = "string";
321
+ json.enum = values;
322
+ break;
323
+ }
324
+ case "literal": {
325
+ const json = _json;
326
+ const vals = [];
327
+ for (const val of def.values) {
328
+ if (val === undefined) {
329
+ if (this.unrepresentable === "throw") {
330
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
331
+ }
332
+ }
333
+ else if (typeof val === "bigint") {
334
+ if (this.unrepresentable === "throw") {
335
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
336
+ }
337
+ else {
338
+ vals.push(Number(val));
339
+ }
340
+ }
341
+ else {
342
+ vals.push(val);
343
+ }
344
+ }
345
+ if (vals.length === 0) ;
346
+ else if (vals.length === 1) {
347
+ const val = vals[0];
348
+ json.type = val === null ? "null" : typeof val;
349
+ json.const = val;
350
+ }
351
+ else {
352
+ if (vals.every((v) => typeof v === "number"))
353
+ json.type = "number";
354
+ if (vals.every((v) => typeof v === "string"))
355
+ json.type = "string";
356
+ if (vals.every((v) => typeof v === "boolean"))
357
+ json.type = "string";
358
+ if (vals.every((v) => v === null))
359
+ json.type = "null";
360
+ json.enum = vals;
361
+ }
362
+ break;
363
+ }
364
+ case "file": {
365
+ const json = _json;
366
+ const file = {
367
+ type: "string",
368
+ format: "binary",
369
+ contentEncoding: "binary",
370
+ };
371
+ const { minimum, maximum, mime } = schema._zod.bag;
372
+ if (minimum !== undefined)
373
+ file.minLength = minimum;
374
+ if (maximum !== undefined)
375
+ file.maxLength = maximum;
376
+ if (mime) {
377
+ if (mime.length === 1) {
378
+ file.contentMediaType = mime[0];
379
+ Object.assign(json, file);
380
+ }
381
+ else {
382
+ json.anyOf = mime.map((m) => {
383
+ const mFile = { ...file, contentMediaType: m };
384
+ return mFile;
385
+ });
386
+ }
387
+ }
388
+ else {
389
+ Object.assign(json, file);
390
+ }
391
+ // if (this.unrepresentable === "throw") {
392
+ // throw new Error("File cannot be represented in JSON Schema");
393
+ // }
394
+ break;
395
+ }
396
+ case "transform": {
397
+ if (this.unrepresentable === "throw") {
398
+ throw new Error("Transforms cannot be represented in JSON Schema");
399
+ }
400
+ break;
401
+ }
402
+ case "nullable": {
403
+ const inner = this.process(def.innerType, params);
404
+ _json.anyOf = [inner, { type: "null" }];
405
+ break;
406
+ }
407
+ case "nonoptional": {
408
+ this.process(def.innerType, params);
409
+ result.ref = def.innerType;
410
+ break;
411
+ }
412
+ case "success": {
413
+ const json = _json;
414
+ json.type = "boolean";
415
+ break;
416
+ }
417
+ case "default": {
418
+ this.process(def.innerType, params);
419
+ result.ref = def.innerType;
420
+ _json.default = JSON.parse(JSON.stringify(def.defaultValue));
421
+ break;
422
+ }
423
+ case "prefault": {
424
+ this.process(def.innerType, params);
425
+ result.ref = def.innerType;
426
+ if (this.io === "input")
427
+ _json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
428
+ break;
429
+ }
430
+ case "catch": {
431
+ // use conditionals
432
+ this.process(def.innerType, params);
433
+ result.ref = def.innerType;
434
+ let catchValue;
435
+ try {
436
+ catchValue = def.catchValue(undefined);
437
+ }
438
+ catch {
439
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
440
+ }
441
+ _json.default = catchValue;
442
+ break;
443
+ }
444
+ case "nan": {
445
+ if (this.unrepresentable === "throw") {
446
+ throw new Error("NaN cannot be represented in JSON Schema");
447
+ }
448
+ break;
449
+ }
450
+ case "template_literal": {
451
+ const json = _json;
452
+ const pattern = schema._zod.pattern;
453
+ if (!pattern)
454
+ throw new Error("Pattern not found in template literal");
455
+ json.type = "string";
456
+ json.pattern = pattern.source;
457
+ break;
458
+ }
459
+ case "pipe": {
460
+ const innerType = this.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
461
+ this.process(innerType, params);
462
+ result.ref = innerType;
463
+ break;
464
+ }
465
+ case "readonly": {
466
+ this.process(def.innerType, params);
467
+ result.ref = def.innerType;
468
+ _json.readOnly = true;
469
+ break;
470
+ }
471
+ // passthrough types
472
+ case "promise": {
473
+ this.process(def.innerType, params);
474
+ result.ref = def.innerType;
475
+ break;
476
+ }
477
+ case "optional": {
478
+ this.process(def.innerType, params);
479
+ result.ref = def.innerType;
480
+ break;
481
+ }
482
+ case "lazy": {
483
+ const innerType = schema._zod.innerType;
484
+ this.process(innerType, params);
485
+ result.ref = innerType;
486
+ break;
487
+ }
488
+ case "custom": {
489
+ if (this.unrepresentable === "throw") {
490
+ throw new Error("Custom types cannot be represented in JSON Schema");
491
+ }
492
+ break;
493
+ }
494
+ }
495
+ }
496
+ }
497
+ // metadata
498
+ const meta = this.metadataRegistry.get(schema);
499
+ if (meta)
500
+ Object.assign(result.schema, meta);
501
+ if (this.io === "input" && isTransforming(schema)) {
502
+ // examples/defaults only apply to output type of pipe
503
+ delete result.schema.examples;
504
+ delete result.schema.default;
505
+ }
506
+ // set prefault as default
507
+ if (this.io === "input" && result.schema._prefault)
508
+ (_a = result.schema).default ?? (_a.default = result.schema._prefault);
509
+ delete result.schema._prefault;
510
+ // pulling fresh from this.seen in case it was overwritten
511
+ const _result = this.seen.get(schema);
512
+ return _result.schema;
513
+ }
514
+ emit(schema, _params) {
515
+ const params = {
516
+ cycles: _params?.cycles ?? "ref",
517
+ reused: _params?.reused ?? "inline",
518
+ // unrepresentable: _params?.unrepresentable ?? "throw",
519
+ // uri: _params?.uri ?? ((id) => `${id}`),
520
+ external: _params?.external ?? undefined,
521
+ };
522
+ // iterate over seen map;
523
+ const root = this.seen.get(schema);
524
+ if (!root)
525
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
526
+ // initialize result with root schema fields
527
+ // Object.assign(result, seen.cached);
528
+ // returns a ref to the schema
529
+ // defId will be empty if the ref points to an external schema (or #)
530
+ const makeURI = (entry) => {
531
+ // comparing the seen objects because sometimes
532
+ // multiple schemas map to the same seen object.
533
+ // e.g. lazy
534
+ // external is configured
535
+ const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
536
+ if (params.external) {
537
+ const externalId = params.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${this.counter++}`;
538
+ // check if schema is in the external registry
539
+ const uriGenerator = params.external.uri ?? ((id) => id);
540
+ if (externalId) {
541
+ return { ref: uriGenerator(externalId) };
542
+ }
543
+ // otherwise, add to __shared
544
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
545
+ entry[1].defId = id; // set defId so it will be reused if needed
546
+ return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
547
+ }
548
+ if (entry[1] === root) {
549
+ return { ref: "#" };
550
+ }
551
+ // self-contained schema
552
+ const uriPrefix = `#`;
553
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
554
+ const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
555
+ return { defId, ref: defUriPrefix + defId };
556
+ };
557
+ // stored cached version in `def` property
558
+ // remove all properties, set $ref
559
+ const extractToDef = (entry) => {
560
+ // if the schema is already a reference, do not extract it
561
+ if (entry[1].schema.$ref) {
562
+ return;
563
+ }
564
+ const seen = entry[1];
565
+ const { ref, defId } = makeURI(entry);
566
+ seen.def = { ...seen.schema };
567
+ // defId won't be set if the schema is a reference to an external schema
568
+ if (defId)
569
+ seen.defId = defId;
570
+ // wipe away all properties except $ref
571
+ const schema = seen.schema;
572
+ for (const key in schema) {
573
+ delete schema[key];
574
+ }
575
+ schema.$ref = ref;
576
+ };
577
+ // throw on cycles
578
+ // break cycles
579
+ if (params.cycles === "throw") {
580
+ for (const entry of this.seen.entries()) {
581
+ const seen = entry[1];
582
+ if (seen.cycle) {
583
+ throw new Error("Cycle detected: " +
584
+ `#/${seen.cycle?.join("/")}/<root>` +
585
+ '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
586
+ }
587
+ }
588
+ }
589
+ // extract schemas into $defs
590
+ for (const entry of this.seen.entries()) {
591
+ const seen = entry[1];
592
+ // convert root schema to # $ref
593
+ if (schema === entry[0]) {
594
+ extractToDef(entry); // this has special handling for the root schema
595
+ continue;
596
+ }
597
+ // extract schemas that are in the external registry
598
+ if (params.external) {
599
+ const ext = params.external.registry.get(entry[0])?.id;
600
+ if (schema !== entry[0] && ext) {
601
+ extractToDef(entry);
602
+ continue;
603
+ }
604
+ }
605
+ // extract schemas with `id` meta
606
+ const id = this.metadataRegistry.get(entry[0])?.id;
607
+ if (id) {
608
+ extractToDef(entry);
609
+ continue;
610
+ }
611
+ // break cycles
612
+ if (seen.cycle) {
613
+ // any
614
+ extractToDef(entry);
615
+ continue;
616
+ }
617
+ // extract reused schemas
618
+ if (seen.count > 1) {
619
+ if (params.reused === "ref") {
620
+ extractToDef(entry);
621
+ // biome-ignore lint:
622
+ continue;
623
+ }
624
+ }
625
+ }
626
+ // flatten _refs
627
+ const flattenRef = (zodSchema, params) => {
628
+ const seen = this.seen.get(zodSchema);
629
+ const schema = seen.def ?? seen.schema;
630
+ const _cached = { ...schema };
631
+ // already seen
632
+ if (seen.ref === null) {
633
+ return;
634
+ }
635
+ // flatten ref if defined
636
+ const ref = seen.ref;
637
+ seen.ref = null; // prevent recursion
638
+ if (ref) {
639
+ flattenRef(ref, params);
640
+ // merge referenced schema into current
641
+ const refSchema = this.seen.get(ref).schema;
642
+ if (refSchema.$ref && params.target === "draft-7") {
643
+ schema.allOf = schema.allOf ?? [];
644
+ schema.allOf.push(refSchema);
645
+ }
646
+ else {
647
+ Object.assign(schema, refSchema);
648
+ Object.assign(schema, _cached); // prevent overwriting any fields in the original schema
649
+ }
650
+ }
651
+ // execute overrides
652
+ if (!seen.isParent)
653
+ this.override({
654
+ zodSchema: zodSchema,
655
+ jsonSchema: schema,
656
+ path: seen.path ?? [],
657
+ });
658
+ };
659
+ for (const entry of [...this.seen.entries()].reverse()) {
660
+ flattenRef(entry[0], { target: this.target });
661
+ }
662
+ const result = {};
663
+ if (this.target === "draft-2020-12") {
664
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
665
+ }
666
+ else if (this.target === "draft-7") {
667
+ result.$schema = "http://json-schema.org/draft-07/schema#";
668
+ }
669
+ else {
670
+ console.warn(`Invalid target: ${this.target}`);
671
+ }
672
+ if (params.external?.uri) {
673
+ const id = params.external.registry.get(schema)?.id;
674
+ if (!id)
675
+ throw new Error("Schema is missing an `id` property");
676
+ result.$id = params.external.uri(id);
677
+ }
678
+ Object.assign(result, root.def);
679
+ // build defs object
680
+ const defs = params.external?.defs ?? {};
681
+ for (const entry of this.seen.entries()) {
682
+ const seen = entry[1];
683
+ if (seen.def && seen.defId) {
684
+ defs[seen.defId] = seen.def;
685
+ }
686
+ }
687
+ // set definitions in result
688
+ if (params.external) ;
689
+ else {
690
+ if (Object.keys(defs).length > 0) {
691
+ if (this.target === "draft-2020-12") {
692
+ result.$defs = defs;
693
+ }
694
+ else {
695
+ result.definitions = defs;
696
+ }
697
+ }
698
+ }
699
+ try {
700
+ // this "finalizes" this schema and ensures all cycles are removed
701
+ // each call to .emit() is functionally independent
702
+ // though the seen map is shared
703
+ return JSON.parse(JSON.stringify(result));
704
+ }
705
+ catch (_err) {
706
+ throw new Error("Error converting schema to JSON.");
707
+ }
708
+ }
709
+ }
710
+ function toJSONSchema(input, _params) {
711
+ if (input instanceof $ZodRegistry) {
712
+ const gen = new JSONSchemaGenerator(_params);
713
+ const defs = {};
714
+ for (const entry of input._idmap.entries()) {
715
+ const [_, schema] = entry;
716
+ gen.process(schema);
717
+ }
718
+ const schemas = {};
719
+ const external = {
720
+ registry: input,
721
+ uri: _params?.uri,
722
+ defs,
723
+ };
724
+ for (const entry of input._idmap.entries()) {
725
+ const [key, schema] = entry;
726
+ schemas[key] = gen.emit(schema, {
727
+ ..._params,
728
+ external,
729
+ });
730
+ }
731
+ if (Object.keys(defs).length > 0) {
732
+ const defsSegment = gen.target === "draft-2020-12" ? "$defs" : "definitions";
733
+ schemas.__shared = {
734
+ [defsSegment]: defs,
735
+ };
736
+ }
737
+ return { schemas };
738
+ }
739
+ const gen = new JSONSchemaGenerator(_params);
740
+ gen.process(input);
741
+ return gen.emit(input, _params);
742
+ }
743
+ function isTransforming(_schema, _ctx) {
744
+ const ctx = _ctx ?? { seen: new Set() };
745
+ if (ctx.seen.has(_schema))
746
+ return false;
747
+ ctx.seen.add(_schema);
748
+ const schema = _schema;
749
+ const def = schema._zod.def;
750
+ switch (def.type) {
751
+ case "string":
752
+ case "number":
753
+ case "bigint":
754
+ case "boolean":
755
+ case "date":
756
+ case "symbol":
757
+ case "undefined":
758
+ case "null":
759
+ case "any":
760
+ case "unknown":
761
+ case "never":
762
+ case "void":
763
+ case "literal":
764
+ case "enum":
765
+ case "nan":
766
+ case "file":
767
+ case "template_literal":
768
+ return false;
769
+ case "array": {
770
+ return isTransforming(def.element, ctx);
771
+ }
772
+ case "object": {
773
+ for (const key in def.shape) {
774
+ if (isTransforming(def.shape[key], ctx))
775
+ return true;
776
+ }
777
+ return false;
778
+ }
779
+ case "union": {
780
+ for (const option of def.options) {
781
+ if (isTransforming(option, ctx))
782
+ return true;
783
+ }
784
+ return false;
785
+ }
786
+ case "intersection": {
787
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
788
+ }
789
+ case "tuple": {
790
+ for (const item of def.items) {
791
+ if (isTransforming(item, ctx))
792
+ return true;
793
+ }
794
+ if (def.rest && isTransforming(def.rest, ctx))
795
+ return true;
796
+ return false;
797
+ }
798
+ case "record": {
799
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
800
+ }
801
+ case "map": {
802
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
803
+ }
804
+ case "set": {
805
+ return isTransforming(def.valueType, ctx);
806
+ }
807
+ // inner types
808
+ case "promise":
809
+ case "optional":
810
+ case "nonoptional":
811
+ case "nullable":
812
+ case "readonly":
813
+ return isTransforming(def.innerType, ctx);
814
+ case "lazy":
815
+ return isTransforming(def.getter(), ctx);
816
+ case "default": {
817
+ return isTransforming(def.innerType, ctx);
818
+ }
819
+ case "prefault": {
820
+ return isTransforming(def.innerType, ctx);
821
+ }
822
+ case "custom": {
823
+ return false;
824
+ }
825
+ case "transform": {
826
+ return true;
827
+ }
828
+ case "pipe": {
829
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
830
+ }
831
+ case "success": {
832
+ return false;
833
+ }
834
+ case "catch": {
835
+ return false;
836
+ }
837
+ }
838
+ throw new Error(`Unknown schema type: ${def.type}`);
839
+ }
840
+
841
+ export { JSONSchemaGenerator, toJSONSchema };
842
+ //# sourceMappingURL=to-json-schema.js.map