@posthog/agent 1.26.0 → 1.28.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 (572) hide show
  1. package/dist/index.d.ts +1274 -20
  2. package/dist/index.js +7327 -11
  3. package/dist/index.js.map +1 -1
  4. package/package.json +6 -12
  5. package/src/agent.ts +42 -5
  6. package/src/types.ts +1 -1
  7. package/src/worktree-manager.ts +45 -0
  8. package/dist/_virtual/_commonjsHelpers.js +0 -6
  9. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  10. package/dist/_virtual/_tslib.js +0 -74
  11. package/dist/_virtual/_tslib.js.map +0 -1
  12. package/dist/_virtual/additionalItems.js +0 -4
  13. package/dist/_virtual/additionalItems.js.map +0 -1
  14. package/dist/_virtual/additionalProperties.js +0 -4
  15. package/dist/_virtual/additionalProperties.js.map +0 -1
  16. package/dist/_virtual/ajv.js +0 -4
  17. package/dist/_virtual/ajv.js.map +0 -1
  18. package/dist/_virtual/allOf.js +0 -4
  19. package/dist/_virtual/allOf.js.map +0 -1
  20. package/dist/_virtual/anyOf.js +0 -4
  21. package/dist/_virtual/anyOf.js.map +0 -1
  22. package/dist/_virtual/applicability.js +0 -4
  23. package/dist/_virtual/applicability.js.map +0 -1
  24. package/dist/_virtual/boolSchema.js +0 -4
  25. package/dist/_virtual/boolSchema.js.map +0 -1
  26. package/dist/_virtual/code.js +0 -4
  27. package/dist/_virtual/code.js.map +0 -1
  28. package/dist/_virtual/code2.js +0 -4
  29. package/dist/_virtual/code2.js.map +0 -1
  30. package/dist/_virtual/const.js +0 -4
  31. package/dist/_virtual/const.js.map +0 -1
  32. package/dist/_virtual/contains.js +0 -4
  33. package/dist/_virtual/contains.js.map +0 -1
  34. package/dist/_virtual/core.js +0 -4
  35. package/dist/_virtual/core.js.map +0 -1
  36. package/dist/_virtual/dataType.js +0 -4
  37. package/dist/_virtual/dataType.js.map +0 -1
  38. package/dist/_virtual/defaults.js +0 -4
  39. package/dist/_virtual/defaults.js.map +0 -1
  40. package/dist/_virtual/dependencies.js +0 -4
  41. package/dist/_virtual/dependencies.js.map +0 -1
  42. package/dist/_virtual/draft7.js +0 -4
  43. package/dist/_virtual/draft7.js.map +0 -1
  44. package/dist/_virtual/enum.js +0 -4
  45. package/dist/_virtual/enum.js.map +0 -1
  46. package/dist/_virtual/equal.js +0 -4
  47. package/dist/_virtual/equal.js.map +0 -1
  48. package/dist/_virtual/errors.js +0 -4
  49. package/dist/_virtual/errors.js.map +0 -1
  50. package/dist/_virtual/format.js +0 -4
  51. package/dist/_virtual/format.js.map +0 -1
  52. package/dist/_virtual/formats.js +0 -4
  53. package/dist/_virtual/formats.js.map +0 -1
  54. package/dist/_virtual/id.js +0 -4
  55. package/dist/_virtual/id.js.map +0 -1
  56. package/dist/_virtual/if.js +0 -4
  57. package/dist/_virtual/if.js.map +0 -1
  58. package/dist/_virtual/index.js +0 -4
  59. package/dist/_virtual/index.js.map +0 -1
  60. package/dist/_virtual/index10.js +0 -4
  61. package/dist/_virtual/index10.js.map +0 -1
  62. package/dist/_virtual/index11.js +0 -4
  63. package/dist/_virtual/index11.js.map +0 -1
  64. package/dist/_virtual/index2.js +0 -4
  65. package/dist/_virtual/index2.js.map +0 -1
  66. package/dist/_virtual/index3.js +0 -4
  67. package/dist/_virtual/index3.js.map +0 -1
  68. package/dist/_virtual/index4.js +0 -4
  69. package/dist/_virtual/index4.js.map +0 -1
  70. package/dist/_virtual/index5.js +0 -4
  71. package/dist/_virtual/index5.js.map +0 -1
  72. package/dist/_virtual/index6.js +0 -4
  73. package/dist/_virtual/index6.js.map +0 -1
  74. package/dist/_virtual/index7.js +0 -4
  75. package/dist/_virtual/index7.js.map +0 -1
  76. package/dist/_virtual/index8.js +0 -4
  77. package/dist/_virtual/index8.js.map +0 -1
  78. package/dist/_virtual/index9.js +0 -4
  79. package/dist/_virtual/index9.js.map +0 -1
  80. package/dist/_virtual/items.js +0 -4
  81. package/dist/_virtual/items.js.map +0 -1
  82. package/dist/_virtual/items2020.js +0 -4
  83. package/dist/_virtual/items2020.js.map +0 -1
  84. package/dist/_virtual/keyword.js +0 -4
  85. package/dist/_virtual/keyword.js.map +0 -1
  86. package/dist/_virtual/limit.js +0 -4
  87. package/dist/_virtual/limit.js.map +0 -1
  88. package/dist/_virtual/limitItems.js +0 -4
  89. package/dist/_virtual/limitItems.js.map +0 -1
  90. package/dist/_virtual/limitLength.js +0 -4
  91. package/dist/_virtual/limitLength.js.map +0 -1
  92. package/dist/_virtual/limitNumber.js +0 -4
  93. package/dist/_virtual/limitNumber.js.map +0 -1
  94. package/dist/_virtual/limitProperties.js +0 -4
  95. package/dist/_virtual/limitProperties.js.map +0 -1
  96. package/dist/_virtual/metadata.js +0 -4
  97. package/dist/_virtual/metadata.js.map +0 -1
  98. package/dist/_virtual/multipleOf.js +0 -4
  99. package/dist/_virtual/multipleOf.js.map +0 -1
  100. package/dist/_virtual/names.js +0 -4
  101. package/dist/_virtual/names.js.map +0 -1
  102. package/dist/_virtual/not.js +0 -4
  103. package/dist/_virtual/not.js.map +0 -1
  104. package/dist/_virtual/oneOf.js +0 -4
  105. package/dist/_virtual/oneOf.js.map +0 -1
  106. package/dist/_virtual/pattern.js +0 -4
  107. package/dist/_virtual/pattern.js.map +0 -1
  108. package/dist/_virtual/patternProperties.js +0 -4
  109. package/dist/_virtual/patternProperties.js.map +0 -1
  110. package/dist/_virtual/prefixItems.js +0 -4
  111. package/dist/_virtual/prefixItems.js.map +0 -1
  112. package/dist/_virtual/properties.js +0 -4
  113. package/dist/_virtual/properties.js.map +0 -1
  114. package/dist/_virtual/propertyNames.js +0 -4
  115. package/dist/_virtual/propertyNames.js.map +0 -1
  116. package/dist/_virtual/ref.js +0 -4
  117. package/dist/_virtual/ref.js.map +0 -1
  118. package/dist/_virtual/ref_error.js +0 -4
  119. package/dist/_virtual/ref_error.js.map +0 -1
  120. package/dist/_virtual/required.js +0 -4
  121. package/dist/_virtual/required.js.map +0 -1
  122. package/dist/_virtual/resolve.js +0 -4
  123. package/dist/_virtual/resolve.js.map +0 -1
  124. package/dist/_virtual/rules.js +0 -4
  125. package/dist/_virtual/rules.js.map +0 -1
  126. package/dist/_virtual/scope.js +0 -4
  127. package/dist/_virtual/scope.js.map +0 -1
  128. package/dist/_virtual/subschema.js +0 -4
  129. package/dist/_virtual/subschema.js.map +0 -1
  130. package/dist/_virtual/thenElse.js +0 -4
  131. package/dist/_virtual/thenElse.js.map +0 -1
  132. package/dist/_virtual/types.js +0 -4
  133. package/dist/_virtual/types.js.map +0 -1
  134. package/dist/_virtual/ucs2length.js +0 -4
  135. package/dist/_virtual/ucs2length.js.map +0 -1
  136. package/dist/_virtual/uniqueItems.js +0 -4
  137. package/dist/_virtual/uniqueItems.js.map +0 -1
  138. package/dist/_virtual/uri.js +0 -4
  139. package/dist/_virtual/uri.js.map +0 -1
  140. package/dist/_virtual/util.js +0 -4
  141. package/dist/_virtual/util.js.map +0 -1
  142. package/dist/_virtual/validation_error.js +0 -4
  143. package/dist/_virtual/validation_error.js.map +0 -1
  144. package/dist/example-client.d.ts +0 -3
  145. package/dist/example-client.d.ts.map +0 -1
  146. package/dist/example.d.ts +0 -3
  147. package/dist/example.d.ts.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js +0 -891
  150. package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +0 -1
  151. package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +0 -876
  152. package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js.map +0 -1
  153. package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js +0 -66
  154. package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +0 -1
  155. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +0 -23
  156. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +0 -1
  157. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +0 -331
  158. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +0 -1
  159. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +0 -717
  160. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +0 -1
  161. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +0 -221
  162. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +0 -1
  163. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +0 -56
  164. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +0 -1
  165. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +0 -440
  166. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +0 -1
  167. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +0 -94
  168. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +0 -1
  169. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +0 -1610
  170. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +0 -1
  171. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +0 -91
  172. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +0 -1
  173. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js +0 -133
  174. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js.map +0 -1
  175. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js +0 -9
  176. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js.map +0 -1
  177. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js +0 -9
  178. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js.map +0 -1
  179. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js +0 -112
  180. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js.map +0 -1
  181. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js +0 -136
  182. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js.map +0 -1
  183. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js +0 -112
  184. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js.map +0 -1
  185. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js +0 -3297
  186. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js.map +0 -1
  187. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js +0 -44
  188. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js.map +0 -1
  189. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js +0 -36
  190. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js.map +0 -1
  191. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js +0 -10
  192. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js.map +0 -1
  193. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js +0 -657
  194. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js.map +0 -1
  195. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js +0 -449
  196. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js.map +0 -1
  197. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js +0 -413
  198. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js.map +0 -1
  199. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js +0 -57
  200. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js.map +0 -1
  201. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js +0 -38
  202. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js.map +0 -1
  203. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js +0 -86
  204. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js.map +0 -1
  205. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js +0 -61
  206. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js.map +0 -1
  207. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js +0 -80
  208. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js.map +0 -1
  209. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js +0 -52
  210. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js.map +0 -1
  211. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js +0 -1307
  212. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js.map +0 -1
  213. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js +0 -842
  214. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  215. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js +0 -335
  216. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js.map +0 -1
  217. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js +0 -8
  218. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js.map +0 -1
  219. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js +0 -51
  220. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js.map +0 -1
  221. package/dist/node_modules/ajv/dist/ajv.js +0 -69
  222. package/dist/node_modules/ajv/dist/ajv.js.map +0 -1
  223. package/dist/node_modules/ajv/dist/compile/codegen/code.js +0 -169
  224. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +0 -1
  225. package/dist/node_modules/ajv/dist/compile/codegen/index.js +0 -712
  226. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +0 -1
  227. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +0 -157
  228. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +0 -1
  229. package/dist/node_modules/ajv/dist/compile/errors.js +0 -140
  230. package/dist/node_modules/ajv/dist/compile/errors.js.map +0 -1
  231. package/dist/node_modules/ajv/dist/compile/index.js +0 -253
  232. package/dist/node_modules/ajv/dist/compile/index.js.map +0 -1
  233. package/dist/node_modules/ajv/dist/compile/names.js +0 -40
  234. package/dist/node_modules/ajv/dist/compile/names.js.map +0 -1
  235. package/dist/node_modules/ajv/dist/compile/ref_error.js +0 -25
  236. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +0 -1
  237. package/dist/node_modules/ajv/dist/compile/resolve.js +0 -162
  238. package/dist/node_modules/ajv/dist/compile/resolve.js.map +0 -1
  239. package/dist/node_modules/ajv/dist/compile/rules.js +0 -29
  240. package/dist/node_modules/ajv/dist/compile/rules.js.map +0 -1
  241. package/dist/node_modules/ajv/dist/compile/util.js +0 -183
  242. package/dist/node_modules/ajv/dist/compile/util.js.map +0 -1
  243. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +0 -30
  244. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +0 -1
  245. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -64
  246. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +0 -1
  247. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +0 -213
  248. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +0 -1
  249. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +0 -49
  250. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +0 -1
  251. package/dist/node_modules/ajv/dist/compile/validate/index.js +0 -544
  252. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +0 -1
  253. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +0 -139
  254. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +0 -1
  255. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +0 -95
  256. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +0 -1
  257. package/dist/node_modules/ajv/dist/core.js +0 -639
  258. package/dist/node_modules/ajv/dist/core.js.map +0 -1
  259. package/dist/node_modules/ajv/dist/refs/data.json.js +0 -31
  260. package/dist/node_modules/ajv/dist/refs/data.json.js.map +0 -1
  261. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +0 -254
  262. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +0 -1
  263. package/dist/node_modules/ajv/dist/runtime/equal.js +0 -9
  264. package/dist/node_modules/ajv/dist/runtime/equal.js.map +0 -1
  265. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
  266. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +0 -1
  267. package/dist/node_modules/ajv/dist/runtime/uri.js +0 -8
  268. package/dist/node_modules/ajv/dist/runtime/uri.js.map +0 -1
  269. package/dist/node_modules/ajv/dist/runtime/validation_error.js +0 -22
  270. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +0 -1
  271. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -53
  272. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +0 -1
  273. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -112
  274. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +0 -1
  275. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -26
  276. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +0 -1
  277. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -14
  278. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +0 -1
  279. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -99
  280. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +0 -1
  281. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -93
  282. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +0 -1
  283. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -70
  284. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +0 -1
  285. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -77
  286. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +0 -1
  287. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -57
  288. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +0 -1
  289. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -37
  290. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +0 -1
  291. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -29
  292. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +0 -1
  293. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -64
  294. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +0 -1
  295. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -80
  296. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +0 -1
  297. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -15
  298. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +0 -1
  299. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -61
  300. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +0 -1
  301. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -42
  302. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +0 -1
  303. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -16
  304. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +0 -1
  305. package/dist/node_modules/ajv/dist/vocabularies/code.js +0 -146
  306. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +0 -1
  307. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +0 -11
  308. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +0 -1
  309. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +0 -21
  310. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +0 -1
  311. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +0 -131
  312. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +0 -1
  313. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -113
  314. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +0 -1
  315. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -12
  316. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +0 -1
  317. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +0 -28
  318. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +0 -1
  319. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +0 -94
  320. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +0 -1
  321. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +0 -9
  322. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +0 -1
  323. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +0 -21
  324. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +0 -1
  325. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +0 -31
  326. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +0 -1
  327. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -54
  328. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +0 -1
  329. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +0 -54
  330. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +0 -1
  331. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -26
  332. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +0 -1
  333. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
  334. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +0 -1
  335. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -29
  336. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +0 -1
  337. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -26
  338. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +0 -1
  339. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -28
  340. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +0 -1
  341. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -27
  342. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +0 -1
  343. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +0 -84
  344. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +0 -1
  345. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -72
  346. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +0 -1
  347. package/dist/node_modules/ajv-formats/dist/formats.js +0 -212
  348. package/dist/node_modules/ajv-formats/dist/formats.js.map +0 -1
  349. package/dist/node_modules/ajv-formats/dist/index.js +0 -52
  350. package/dist/node_modules/ajv-formats/dist/index.js.map +0 -1
  351. package/dist/node_modules/ajv-formats/dist/limit.js +0 -75
  352. package/dist/node_modules/ajv-formats/dist/limit.js.map +0 -1
  353. package/dist/node_modules/diff/libesm/diff/base.js +0 -256
  354. package/dist/node_modules/diff/libesm/diff/base.js.map +0 -1
  355. package/dist/node_modules/diff/libesm/diff/line.js +0 -64
  356. package/dist/node_modules/diff/libesm/diff/line.js.map +0 -1
  357. package/dist/node_modules/diff/libesm/patch/create.js +0 -185
  358. package/dist/node_modules/diff/libesm/patch/create.js.map +0 -1
  359. package/dist/node_modules/fast-deep-equal/index.js +0 -47
  360. package/dist/node_modules/fast-deep-equal/index.js.map +0 -1
  361. package/dist/node_modules/fast-uri/index.js +0 -347
  362. package/dist/node_modules/fast-uri/index.js.map +0 -1
  363. package/dist/node_modules/fast-uri/lib/schemes.js +0 -255
  364. package/dist/node_modules/fast-uri/lib/schemes.js.map +0 -1
  365. package/dist/node_modules/fast-uri/lib/utils.js +0 -334
  366. package/dist/node_modules/fast-uri/lib/utils.js.map +0 -1
  367. package/dist/node_modules/json-schema-traverse/index.js +0 -98
  368. package/dist/node_modules/json-schema-traverse/index.js.map +0 -1
  369. package/dist/node_modules/uuid/dist/rng.js +0 -14
  370. package/dist/node_modules/uuid/dist/rng.js.map +0 -1
  371. package/dist/node_modules/uuid/dist/stringify.js +0 -29
  372. package/dist/node_modules/uuid/dist/stringify.js.map +0 -1
  373. package/dist/node_modules/uuid/dist/v7.js +0 -65
  374. package/dist/node_modules/uuid/dist/v7.js.map +0 -1
  375. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -37
  376. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +0 -1
  377. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -26
  378. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +0 -1
  379. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -17
  380. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +0 -1
  381. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -11
  382. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +0 -1
  383. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -66
  384. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +0 -1
  385. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -21
  386. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +0 -1
  387. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -30
  388. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +0 -1
  389. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -53
  390. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +0 -1
  391. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -8
  392. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +0 -1
  393. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -8
  394. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +0 -1
  395. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -8
  396. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +0 -1
  397. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -50
  398. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +0 -1
  399. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -11
  400. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +0 -1
  401. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -11
  402. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +0 -1
  403. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -9
  404. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +0 -1
  405. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -56
  406. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +0 -1
  407. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -24
  408. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +0 -1
  409. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -30
  410. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +0 -1
  411. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -19
  412. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +0 -1
  413. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -15
  414. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +0 -1
  415. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -13
  416. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +0 -1
  417. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -37
  418. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +0 -1
  419. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -56
  420. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +0 -1
  421. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -76
  422. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +0 -1
  423. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -25
  424. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +0 -1
  425. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -24
  426. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +0 -1
  427. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -8
  428. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +0 -1
  429. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -8
  430. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +0 -1
  431. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -65
  432. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +0 -1
  433. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -24
  434. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +0 -1
  435. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -350
  436. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +0 -1
  437. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -36
  438. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +0 -1
  439. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -10
  440. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +0 -1
  441. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -84
  442. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +0 -1
  443. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -8
  444. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +0 -1
  445. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -109
  446. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +0 -1
  447. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -90
  448. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +0 -1
  449. package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js +0 -42
  450. package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js.map +0 -1
  451. package/dist/package.json.js +0 -8
  452. package/dist/package.json.js.map +0 -1
  453. package/dist/src/acp-extensions.d.ts +0 -91
  454. package/dist/src/acp-extensions.d.ts.map +0 -1
  455. package/dist/src/acp-extensions.js +0 -38
  456. package/dist/src/acp-extensions.js.map +0 -1
  457. package/dist/src/adapters/claude/claude.d.ts +0 -136
  458. package/dist/src/adapters/claude/claude.d.ts.map +0 -1
  459. package/dist/src/adapters/claude/claude.js +0 -1128
  460. package/dist/src/adapters/claude/claude.js.map +0 -1
  461. package/dist/src/adapters/claude/mcp-server.d.ts +0 -30
  462. package/dist/src/adapters/claude/mcp-server.d.ts.map +0 -1
  463. package/dist/src/adapters/claude/mcp-server.js +0 -668
  464. package/dist/src/adapters/claude/mcp-server.js.map +0 -1
  465. package/dist/src/adapters/claude/tools.d.ts +0 -35
  466. package/dist/src/adapters/claude/tools.d.ts.map +0 -1
  467. package/dist/src/adapters/claude/tools.js +0 -473
  468. package/dist/src/adapters/claude/tools.js.map +0 -1
  469. package/dist/src/adapters/claude/utils.d.ts +0 -48
  470. package/dist/src/adapters/claude/utils.d.ts.map +0 -1
  471. package/dist/src/adapters/claude/utils.js +0 -158
  472. package/dist/src/adapters/claude/utils.js.map +0 -1
  473. package/dist/src/agent.d.ts +0 -58
  474. package/dist/src/agent.d.ts.map +0 -1
  475. package/dist/src/agent.js +0 -576
  476. package/dist/src/agent.js.map +0 -1
  477. package/dist/src/agents/execution.d.ts +0 -2
  478. package/dist/src/agents/execution.d.ts.map +0 -1
  479. package/dist/src/agents/execution.js +0 -40
  480. package/dist/src/agents/execution.js.map +0 -1
  481. package/dist/src/agents/planning.d.ts +0 -2
  482. package/dist/src/agents/planning.d.ts.map +0 -1
  483. package/dist/src/agents/planning.js +0 -63
  484. package/dist/src/agents/planning.js.map +0 -1
  485. package/dist/src/agents/research.d.ts +0 -2
  486. package/dist/src/agents/research.d.ts.map +0 -1
  487. package/dist/src/agents/research.js +0 -163
  488. package/dist/src/agents/research.js.map +0 -1
  489. package/dist/src/file-manager.d.ts +0 -43
  490. package/dist/src/file-manager.d.ts.map +0 -1
  491. package/dist/src/file-manager.js +0 -266
  492. package/dist/src/file-manager.js.map +0 -1
  493. package/dist/src/git-manager.d.ts +0 -79
  494. package/dist/src/git-manager.d.ts.map +0 -1
  495. package/dist/src/git-manager.js +0 -454
  496. package/dist/src/git-manager.js.map +0 -1
  497. package/dist/src/posthog-api.d.ts +0 -48
  498. package/dist/src/posthog-api.d.ts.map +0 -1
  499. package/dist/src/posthog-api.js +0 -260
  500. package/dist/src/posthog-api.js.map +0 -1
  501. package/dist/src/prompt-builder.d.ts +0 -49
  502. package/dist/src/prompt-builder.d.ts.map +0 -1
  503. package/dist/src/prompt-builder.js +0 -397
  504. package/dist/src/prompt-builder.js.map +0 -1
  505. package/dist/src/schemas.d.ts +0 -980
  506. package/dist/src/schemas.d.ts.map +0 -1
  507. package/dist/src/schemas.js +0 -196
  508. package/dist/src/schemas.js.map +0 -1
  509. package/dist/src/session-store.d.ts +0 -58
  510. package/dist/src/session-store.d.ts.map +0 -1
  511. package/dist/src/session-store.js +0 -206
  512. package/dist/src/session-store.js.map +0 -1
  513. package/dist/src/task-manager.d.ts +0 -25
  514. package/dist/src/task-manager.d.ts.map +0 -1
  515. package/dist/src/task-manager.js +0 -123
  516. package/dist/src/task-manager.js.map +0 -1
  517. package/dist/src/template-manager.d.ts +0 -30
  518. package/dist/src/template-manager.d.ts.map +0 -1
  519. package/dist/src/template-manager.js +0 -152
  520. package/dist/src/template-manager.js.map +0 -1
  521. package/dist/src/todo-manager.d.ts +0 -29
  522. package/dist/src/todo-manager.d.ts.map +0 -1
  523. package/dist/src/todo-manager.js +0 -135
  524. package/dist/src/todo-manager.js.map +0 -1
  525. package/dist/src/tools/registry.d.ts +0 -25
  526. package/dist/src/tools/registry.d.ts.map +0 -1
  527. package/dist/src/tools/registry.js +0 -120
  528. package/dist/src/tools/registry.js.map +0 -1
  529. package/dist/src/tools/types.d.ts +0 -80
  530. package/dist/src/tools/types.d.ts.map +0 -1
  531. package/dist/src/types.d.ts +0 -193
  532. package/dist/src/types.d.ts.map +0 -1
  533. package/dist/src/types.js +0 -11
  534. package/dist/src/types.js.map +0 -1
  535. package/dist/src/utils/logger.d.ts +0 -37
  536. package/dist/src/utils/logger.d.ts.map +0 -1
  537. package/dist/src/utils/logger.js +0 -83
  538. package/dist/src/utils/logger.js.map +0 -1
  539. package/dist/src/utils/tapped-stream.d.ts +0 -17
  540. package/dist/src/utils/tapped-stream.d.ts.map +0 -1
  541. package/dist/src/utils/tapped-stream.js +0 -45
  542. package/dist/src/utils/tapped-stream.js.map +0 -1
  543. package/dist/src/workflow/config.d.ts +0 -3
  544. package/dist/src/workflow/config.d.ts.map +0 -1
  545. package/dist/src/workflow/config.js +0 -54
  546. package/dist/src/workflow/config.js.map +0 -1
  547. package/dist/src/workflow/steps/build.d.ts +0 -3
  548. package/dist/src/workflow/steps/build.d.ts.map +0 -1
  549. package/dist/src/workflow/steps/build.js +0 -108
  550. package/dist/src/workflow/steps/build.js.map +0 -1
  551. package/dist/src/workflow/steps/finalize.d.ts +0 -3
  552. package/dist/src/workflow/steps/finalize.d.ts.map +0 -1
  553. package/dist/src/workflow/steps/finalize.js +0 -188
  554. package/dist/src/workflow/steps/finalize.js.map +0 -1
  555. package/dist/src/workflow/steps/plan.d.ts +0 -3
  556. package/dist/src/workflow/steps/plan.d.ts.map +0 -1
  557. package/dist/src/workflow/steps/plan.js +0 -136
  558. package/dist/src/workflow/steps/plan.js.map +0 -1
  559. package/dist/src/workflow/steps/research.d.ts +0 -3
  560. package/dist/src/workflow/steps/research.d.ts.map +0 -1
  561. package/dist/src/workflow/steps/research.js +0 -189
  562. package/dist/src/workflow/steps/research.js.map +0 -1
  563. package/dist/src/workflow/types.d.ts +0 -51
  564. package/dist/src/workflow/types.d.ts.map +0 -1
  565. package/dist/src/workflow/utils.d.ts +0 -12
  566. package/dist/src/workflow/utils.d.ts.map +0 -1
  567. package/dist/src/workflow/utils.js +0 -41
  568. package/dist/src/workflow/utils.js.map +0 -1
  569. package/dist/src/worktree-manager.d.ts +0 -39
  570. package/dist/src/worktree-manager.d.ts.map +0 -1
  571. package/dist/src/worktree-manager.js +0 -808
  572. package/dist/src/worktree-manager.js.map +0 -1
@@ -1,1307 +0,0 @@
1
- import { $ZodCheck, $ZodCheckStringFormat, $ZodCheckNumberFormat } from './checks.js';
2
- import { $constructor, globalConfig, $ZodAsyncError, config } from './core.js';
3
- import { Doc } from './doc.js';
4
- import { safeParse, safeParseAsync } from './parse.js';
5
- import { string, number, boolean, datetime, date, time, duration, email, guid, uuid, hostname, emoji, nanoid, cuid, cuid2, ulid, xid, ksuid, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164 } from './regexes.js';
6
- import { defineLazy, allowsEval, cached, isObject, esc, aborted, optionalKeys, prefixIssues, cleanRegex, isPlainObject, finalizeIssue, getEnumValues, propertyKeyTypes, escapeRegex, issue } from './util.js';
7
- export { clone } from './util.js';
8
- import { version } from './versions.js';
9
-
10
- const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
11
- var _a;
12
- inst ?? (inst = {});
13
- inst._zod.def = def; // set _def property
14
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
15
- inst._zod.version = version;
16
- const checks = [...(inst._zod.def.checks ?? [])];
17
- // if inst is itself a checks.$ZodCheck, run it as a check
18
- if (inst._zod.traits.has("$ZodCheck")) {
19
- checks.unshift(inst);
20
- }
21
- //
22
- for (const ch of checks) {
23
- for (const fn of ch._zod.onattach) {
24
- fn(inst);
25
- }
26
- }
27
- if (checks.length === 0) {
28
- // deferred initializer
29
- // inst._zod.parse is not yet defined
30
- (_a = inst._zod).deferred ?? (_a.deferred = []);
31
- inst._zod.deferred?.push(() => {
32
- inst._zod.run = inst._zod.parse;
33
- });
34
- }
35
- else {
36
- const runChecks = (payload, checks, ctx) => {
37
- let isAborted = aborted(payload);
38
- let asyncResult;
39
- for (const ch of checks) {
40
- if (ch._zod.def.when) {
41
- const shouldRun = ch._zod.def.when(payload);
42
- if (!shouldRun)
43
- continue;
44
- }
45
- else if (isAborted) {
46
- continue;
47
- }
48
- const currLen = payload.issues.length;
49
- const _ = ch._zod.check(payload);
50
- if (_ instanceof Promise && ctx?.async === false) {
51
- throw new $ZodAsyncError();
52
- }
53
- if (asyncResult || _ instanceof Promise) {
54
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
55
- await _;
56
- const nextLen = payload.issues.length;
57
- if (nextLen === currLen)
58
- return;
59
- if (!isAborted)
60
- isAborted = aborted(payload, currLen);
61
- });
62
- }
63
- else {
64
- const nextLen = payload.issues.length;
65
- if (nextLen === currLen)
66
- continue;
67
- if (!isAborted)
68
- isAborted = aborted(payload, currLen);
69
- }
70
- }
71
- if (asyncResult) {
72
- return asyncResult.then(() => {
73
- return payload;
74
- });
75
- }
76
- return payload;
77
- };
78
- inst._zod.run = (payload, ctx) => {
79
- const result = inst._zod.parse(payload, ctx);
80
- if (result instanceof Promise) {
81
- if (ctx.async === false)
82
- throw new $ZodAsyncError();
83
- return result.then((result) => runChecks(result, checks, ctx));
84
- }
85
- return runChecks(result, checks, ctx);
86
- };
87
- }
88
- inst["~standard"] = {
89
- validate: (value) => {
90
- try {
91
- const r = safeParse(inst, value);
92
- return r.success ? { value: r.data } : { issues: r.error?.issues };
93
- }
94
- catch (_) {
95
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
96
- }
97
- },
98
- vendor: "zod",
99
- version: 1,
100
- };
101
- });
102
- const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
103
- $ZodType.init(inst, def);
104
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string(inst._zod.bag);
105
- inst._zod.parse = (payload, _) => {
106
- if (def.coerce)
107
- try {
108
- payload.value = String(payload.value);
109
- }
110
- catch (_) { }
111
- if (typeof payload.value === "string")
112
- return payload;
113
- payload.issues.push({
114
- expected: "string",
115
- code: "invalid_type",
116
- input: payload.value,
117
- inst,
118
- });
119
- return payload;
120
- };
121
- });
122
- const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
123
- // check initialization must come first
124
- $ZodCheckStringFormat.init(inst, def);
125
- $ZodString.init(inst, def);
126
- });
127
- const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
128
- def.pattern ?? (def.pattern = guid);
129
- $ZodStringFormat.init(inst, def);
130
- });
131
- const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
132
- if (def.version) {
133
- const versionMap = {
134
- v1: 1,
135
- v2: 2,
136
- v3: 3,
137
- v4: 4,
138
- v5: 5,
139
- v6: 6,
140
- v7: 7,
141
- v8: 8,
142
- };
143
- const v = versionMap[def.version];
144
- if (v === undefined)
145
- throw new Error(`Invalid UUID version: "${def.version}"`);
146
- def.pattern ?? (def.pattern = uuid(v));
147
- }
148
- else
149
- def.pattern ?? (def.pattern = uuid());
150
- $ZodStringFormat.init(inst, def);
151
- });
152
- const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
153
- def.pattern ?? (def.pattern = email);
154
- $ZodStringFormat.init(inst, def);
155
- });
156
- const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
157
- $ZodStringFormat.init(inst, def);
158
- inst._zod.check = (payload) => {
159
- try {
160
- const orig = payload.value;
161
- const url = new URL(orig);
162
- const href = url.href;
163
- if (def.hostname) {
164
- def.hostname.lastIndex = 0;
165
- if (!def.hostname.test(url.hostname)) {
166
- payload.issues.push({
167
- code: "invalid_format",
168
- format: "url",
169
- note: "Invalid hostname",
170
- pattern: hostname.source,
171
- input: payload.value,
172
- inst,
173
- continue: !def.abort,
174
- });
175
- }
176
- }
177
- if (def.protocol) {
178
- def.protocol.lastIndex = 0;
179
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
180
- payload.issues.push({
181
- code: "invalid_format",
182
- format: "url",
183
- note: "Invalid protocol",
184
- pattern: def.protocol.source,
185
- input: payload.value,
186
- inst,
187
- continue: !def.abort,
188
- });
189
- }
190
- }
191
- // payload.value = url.href;
192
- if (!orig.endsWith("/") && href.endsWith("/")) {
193
- payload.value = href.slice(0, -1);
194
- }
195
- else {
196
- payload.value = href;
197
- }
198
- return;
199
- }
200
- catch (_) {
201
- payload.issues.push({
202
- code: "invalid_format",
203
- format: "url",
204
- input: payload.value,
205
- inst,
206
- continue: !def.abort,
207
- });
208
- }
209
- };
210
- });
211
- const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
212
- def.pattern ?? (def.pattern = emoji());
213
- $ZodStringFormat.init(inst, def);
214
- });
215
- const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
216
- def.pattern ?? (def.pattern = nanoid);
217
- $ZodStringFormat.init(inst, def);
218
- });
219
- const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
220
- def.pattern ?? (def.pattern = cuid);
221
- $ZodStringFormat.init(inst, def);
222
- });
223
- const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
224
- def.pattern ?? (def.pattern = cuid2);
225
- $ZodStringFormat.init(inst, def);
226
- });
227
- const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
228
- def.pattern ?? (def.pattern = ulid);
229
- $ZodStringFormat.init(inst, def);
230
- });
231
- const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
232
- def.pattern ?? (def.pattern = xid);
233
- $ZodStringFormat.init(inst, def);
234
- });
235
- const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
236
- def.pattern ?? (def.pattern = ksuid);
237
- $ZodStringFormat.init(inst, def);
238
- });
239
- const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
240
- def.pattern ?? (def.pattern = datetime(def));
241
- $ZodStringFormat.init(inst, def);
242
- });
243
- const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
244
- def.pattern ?? (def.pattern = date);
245
- $ZodStringFormat.init(inst, def);
246
- });
247
- const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
248
- def.pattern ?? (def.pattern = time(def));
249
- $ZodStringFormat.init(inst, def);
250
- });
251
- const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
252
- def.pattern ?? (def.pattern = duration);
253
- $ZodStringFormat.init(inst, def);
254
- });
255
- const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
256
- def.pattern ?? (def.pattern = ipv4);
257
- $ZodStringFormat.init(inst, def);
258
- inst._zod.onattach.push((inst) => {
259
- const bag = inst._zod.bag;
260
- bag.format = `ipv4`;
261
- });
262
- });
263
- const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
264
- def.pattern ?? (def.pattern = ipv6);
265
- $ZodStringFormat.init(inst, def);
266
- inst._zod.onattach.push((inst) => {
267
- const bag = inst._zod.bag;
268
- bag.format = `ipv6`;
269
- });
270
- inst._zod.check = (payload) => {
271
- try {
272
- new URL(`http://[${payload.value}]`);
273
- // return;
274
- }
275
- catch {
276
- payload.issues.push({
277
- code: "invalid_format",
278
- format: "ipv6",
279
- input: payload.value,
280
- inst,
281
- continue: !def.abort,
282
- });
283
- }
284
- };
285
- });
286
- const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
287
- def.pattern ?? (def.pattern = cidrv4);
288
- $ZodStringFormat.init(inst, def);
289
- });
290
- const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
291
- def.pattern ?? (def.pattern = cidrv6); // not used for validation
292
- $ZodStringFormat.init(inst, def);
293
- inst._zod.check = (payload) => {
294
- const [address, prefix] = payload.value.split("/");
295
- try {
296
- if (!prefix)
297
- throw new Error();
298
- const prefixNum = Number(prefix);
299
- if (`${prefixNum}` !== prefix)
300
- throw new Error();
301
- if (prefixNum < 0 || prefixNum > 128)
302
- throw new Error();
303
- new URL(`http://[${address}]`);
304
- }
305
- catch {
306
- payload.issues.push({
307
- code: "invalid_format",
308
- format: "cidrv6",
309
- input: payload.value,
310
- inst,
311
- continue: !def.abort,
312
- });
313
- }
314
- };
315
- });
316
- ////////////////////////////// ZodBase64 //////////////////////////////
317
- function isValidBase64(data) {
318
- if (data === "")
319
- return true;
320
- if (data.length % 4 !== 0)
321
- return false;
322
- try {
323
- atob(data);
324
- return true;
325
- }
326
- catch {
327
- return false;
328
- }
329
- }
330
- const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
331
- def.pattern ?? (def.pattern = base64);
332
- $ZodStringFormat.init(inst, def);
333
- inst._zod.onattach.push((inst) => {
334
- inst._zod.bag.contentEncoding = "base64";
335
- });
336
- inst._zod.check = (payload) => {
337
- if (isValidBase64(payload.value))
338
- return;
339
- payload.issues.push({
340
- code: "invalid_format",
341
- format: "base64",
342
- input: payload.value,
343
- inst,
344
- continue: !def.abort,
345
- });
346
- };
347
- });
348
- ////////////////////////////// ZodBase64 //////////////////////////////
349
- function isValidBase64URL(data) {
350
- if (!base64url.test(data))
351
- return false;
352
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
353
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
354
- return isValidBase64(padded);
355
- }
356
- const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
357
- def.pattern ?? (def.pattern = base64url);
358
- $ZodStringFormat.init(inst, def);
359
- inst._zod.onattach.push((inst) => {
360
- inst._zod.bag.contentEncoding = "base64url";
361
- });
362
- inst._zod.check = (payload) => {
363
- if (isValidBase64URL(payload.value))
364
- return;
365
- payload.issues.push({
366
- code: "invalid_format",
367
- format: "base64url",
368
- input: payload.value,
369
- inst,
370
- continue: !def.abort,
371
- });
372
- };
373
- });
374
- const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
375
- def.pattern ?? (def.pattern = e164);
376
- $ZodStringFormat.init(inst, def);
377
- });
378
- ////////////////////////////// ZodJWT //////////////////////////////
379
- function isValidJWT(token, algorithm = null) {
380
- try {
381
- const tokensParts = token.split(".");
382
- if (tokensParts.length !== 3)
383
- return false;
384
- const [header] = tokensParts;
385
- if (!header)
386
- return false;
387
- const parsedHeader = JSON.parse(atob(header));
388
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
389
- return false;
390
- if (!parsedHeader.alg)
391
- return false;
392
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
393
- return false;
394
- return true;
395
- }
396
- catch {
397
- return false;
398
- }
399
- }
400
- const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
401
- $ZodStringFormat.init(inst, def);
402
- inst._zod.check = (payload) => {
403
- if (isValidJWT(payload.value, def.alg))
404
- return;
405
- payload.issues.push({
406
- code: "invalid_format",
407
- format: "jwt",
408
- input: payload.value,
409
- inst,
410
- continue: !def.abort,
411
- });
412
- };
413
- });
414
- const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
415
- $ZodType.init(inst, def);
416
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
417
- inst._zod.parse = (payload, _ctx) => {
418
- if (def.coerce)
419
- try {
420
- payload.value = Number(payload.value);
421
- }
422
- catch (_) { }
423
- const input = payload.value;
424
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
425
- return payload;
426
- }
427
- const received = typeof input === "number"
428
- ? Number.isNaN(input)
429
- ? "NaN"
430
- : !Number.isFinite(input)
431
- ? "Infinity"
432
- : undefined
433
- : undefined;
434
- payload.issues.push({
435
- expected: "number",
436
- code: "invalid_type",
437
- input,
438
- inst,
439
- ...(received ? { received } : {}),
440
- });
441
- return payload;
442
- };
443
- });
444
- const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
445
- $ZodCheckNumberFormat.init(inst, def);
446
- $ZodNumber.init(inst, def); // no format checksp
447
- });
448
- const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
449
- $ZodType.init(inst, def);
450
- inst._zod.pattern = boolean;
451
- inst._zod.parse = (payload, _ctx) => {
452
- if (def.coerce)
453
- try {
454
- payload.value = Boolean(payload.value);
455
- }
456
- catch (_) { }
457
- const input = payload.value;
458
- if (typeof input === "boolean")
459
- return payload;
460
- payload.issues.push({
461
- expected: "boolean",
462
- code: "invalid_type",
463
- input,
464
- inst,
465
- });
466
- return payload;
467
- };
468
- });
469
- const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
470
- $ZodType.init(inst, def);
471
- inst._zod.parse = (payload) => payload;
472
- });
473
- const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
474
- $ZodType.init(inst, def);
475
- inst._zod.parse = (payload, _ctx) => {
476
- payload.issues.push({
477
- expected: "never",
478
- code: "invalid_type",
479
- input: payload.value,
480
- inst,
481
- });
482
- return payload;
483
- };
484
- });
485
- function handleArrayResult(result, final, index) {
486
- if (result.issues.length) {
487
- final.issues.push(...prefixIssues(index, result.issues));
488
- }
489
- final.value[index] = result.value;
490
- }
491
- const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
492
- $ZodType.init(inst, def);
493
- inst._zod.parse = (payload, ctx) => {
494
- const input = payload.value;
495
- if (!Array.isArray(input)) {
496
- payload.issues.push({
497
- expected: "array",
498
- code: "invalid_type",
499
- input,
500
- inst,
501
- });
502
- return payload;
503
- }
504
- payload.value = Array(input.length);
505
- const proms = [];
506
- for (let i = 0; i < input.length; i++) {
507
- const item = input[i];
508
- const result = def.element._zod.run({
509
- value: item,
510
- issues: [],
511
- }, ctx);
512
- if (result instanceof Promise) {
513
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
514
- }
515
- else {
516
- handleArrayResult(result, payload, i);
517
- }
518
- }
519
- if (proms.length) {
520
- return Promise.all(proms).then(() => payload);
521
- }
522
- return payload; //handleArrayResultsAsync(parseResults, final);
523
- };
524
- });
525
- function handleObjectResult(result, final, key) {
526
- // if(isOptional)
527
- if (result.issues.length) {
528
- final.issues.push(...prefixIssues(key, result.issues));
529
- }
530
- final.value[key] = result.value;
531
- }
532
- function handleOptionalObjectResult(result, final, key, input) {
533
- if (result.issues.length) {
534
- // validation failed against value schema
535
- if (input[key] === undefined) {
536
- // if input was undefined, ignore the error
537
- if (key in input) {
538
- final.value[key] = undefined;
539
- }
540
- else {
541
- final.value[key] = result.value;
542
- }
543
- }
544
- else {
545
- final.issues.push(...prefixIssues(key, result.issues));
546
- }
547
- }
548
- else if (result.value === undefined) {
549
- // validation returned `undefined`
550
- if (key in input)
551
- final.value[key] = undefined;
552
- }
553
- else {
554
- // non-undefined value
555
- final.value[key] = result.value;
556
- }
557
- }
558
- const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
559
- // requires cast because technically $ZodObject doesn't extend
560
- $ZodType.init(inst, def);
561
- const _normalized = cached(() => {
562
- const keys = Object.keys(def.shape);
563
- for (const k of keys) {
564
- if (!(def.shape[k] instanceof $ZodType)) {
565
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
566
- }
567
- }
568
- const okeys = optionalKeys(def.shape);
569
- return {
570
- shape: def.shape,
571
- keys,
572
- keySet: new Set(keys),
573
- numKeys: keys.length,
574
- optionalKeys: new Set(okeys),
575
- };
576
- });
577
- defineLazy(inst._zod, "propValues", () => {
578
- const shape = def.shape;
579
- const propValues = {};
580
- for (const key in shape) {
581
- const field = shape[key]._zod;
582
- if (field.values) {
583
- propValues[key] ?? (propValues[key] = new Set());
584
- for (const v of field.values)
585
- propValues[key].add(v);
586
- }
587
- }
588
- return propValues;
589
- });
590
- const generateFastpass = (shape) => {
591
- const doc = new Doc(["shape", "payload", "ctx"]);
592
- const normalized = _normalized.value;
593
- const parseStr = (key) => {
594
- const k = esc(key);
595
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
596
- };
597
- doc.write(`const input = payload.value;`);
598
- const ids = Object.create(null);
599
- let counter = 0;
600
- for (const key of normalized.keys) {
601
- ids[key] = `key_${counter++}`;
602
- }
603
- // A: preserve key order {
604
- doc.write(`const newResult = {}`);
605
- for (const key of normalized.keys) {
606
- if (normalized.optionalKeys.has(key)) {
607
- const id = ids[key];
608
- doc.write(`const ${id} = ${parseStr(key)};`);
609
- const k = esc(key);
610
- doc.write(`
611
- if (${id}.issues.length) {
612
- if (input[${k}] === undefined) {
613
- if (${k} in input) {
614
- newResult[${k}] = undefined;
615
- }
616
- } else {
617
- payload.issues = payload.issues.concat(
618
- ${id}.issues.map((iss) => ({
619
- ...iss,
620
- path: iss.path ? [${k}, ...iss.path] : [${k}],
621
- }))
622
- );
623
- }
624
- } else if (${id}.value === undefined) {
625
- if (${k} in input) newResult[${k}] = undefined;
626
- } else {
627
- newResult[${k}] = ${id}.value;
628
- }
629
- `);
630
- }
631
- else {
632
- const id = ids[key];
633
- // const id = ids[key];
634
- doc.write(`const ${id} = ${parseStr(key)};`);
635
- doc.write(`
636
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
637
- ...iss,
638
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
639
- })));`);
640
- doc.write(`newResult[${esc(key)}] = ${id}.value`);
641
- }
642
- }
643
- doc.write(`payload.value = newResult;`);
644
- doc.write(`return payload;`);
645
- const fn = doc.compile();
646
- return (payload, ctx) => fn(shape, payload, ctx);
647
- };
648
- let fastpass;
649
- const isObject$1 = isObject;
650
- const jit = !globalConfig.jitless;
651
- const allowsEval$1 = allowsEval;
652
- const fastEnabled = jit && allowsEval$1.value; // && !def.catchall;
653
- const catchall = def.catchall;
654
- let value;
655
- inst._zod.parse = (payload, ctx) => {
656
- value ?? (value = _normalized.value);
657
- const input = payload.value;
658
- if (!isObject$1(input)) {
659
- payload.issues.push({
660
- expected: "object",
661
- code: "invalid_type",
662
- input,
663
- inst,
664
- });
665
- return payload;
666
- }
667
- const proms = [];
668
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
669
- // always synchronous
670
- if (!fastpass)
671
- fastpass = generateFastpass(def.shape);
672
- payload = fastpass(payload, ctx);
673
- }
674
- else {
675
- payload.value = {};
676
- const shape = value.shape;
677
- for (const key of value.keys) {
678
- const el = shape[key];
679
- // do not add omitted optional keys
680
- // if (!(key in input)) {
681
- // if (optionalKeys.has(key)) continue;
682
- // payload.issues.push({
683
- // code: "invalid_type",
684
- // path: [key],
685
- // expected: "nonoptional",
686
- // note: `Missing required key: "${key}"`,
687
- // input,
688
- // inst,
689
- // });
690
- // }
691
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
692
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
693
- if (r instanceof Promise) {
694
- proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
695
- }
696
- else if (isOptional) {
697
- handleOptionalObjectResult(r, payload, key, input);
698
- }
699
- else {
700
- handleObjectResult(r, payload, key);
701
- }
702
- }
703
- }
704
- if (!catchall) {
705
- // return payload;
706
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
707
- }
708
- const unrecognized = [];
709
- // iterate over input keys
710
- const keySet = value.keySet;
711
- const _catchall = catchall._zod;
712
- const t = _catchall.def.type;
713
- for (const key of Object.keys(input)) {
714
- if (keySet.has(key))
715
- continue;
716
- if (t === "never") {
717
- unrecognized.push(key);
718
- continue;
719
- }
720
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
721
- if (r instanceof Promise) {
722
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
723
- }
724
- else {
725
- handleObjectResult(r, payload, key);
726
- }
727
- }
728
- if (unrecognized.length) {
729
- payload.issues.push({
730
- code: "unrecognized_keys",
731
- keys: unrecognized,
732
- input,
733
- inst,
734
- });
735
- }
736
- if (!proms.length)
737
- return payload;
738
- return Promise.all(proms).then(() => {
739
- return payload;
740
- });
741
- };
742
- });
743
- function handleUnionResults(results, final, inst, ctx) {
744
- for (const result of results) {
745
- if (result.issues.length === 0) {
746
- final.value = result.value;
747
- return final;
748
- }
749
- }
750
- final.issues.push({
751
- code: "invalid_union",
752
- input: final.value,
753
- inst,
754
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
755
- });
756
- return final;
757
- }
758
- const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
759
- $ZodType.init(inst, def);
760
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
761
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
762
- defineLazy(inst._zod, "values", () => {
763
- if (def.options.every((o) => o._zod.values)) {
764
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
765
- }
766
- return undefined;
767
- });
768
- defineLazy(inst._zod, "pattern", () => {
769
- if (def.options.every((o) => o._zod.pattern)) {
770
- const patterns = def.options.map((o) => o._zod.pattern);
771
- return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
772
- }
773
- return undefined;
774
- });
775
- inst._zod.parse = (payload, ctx) => {
776
- let async = false;
777
- const results = [];
778
- for (const option of def.options) {
779
- const result = option._zod.run({
780
- value: payload.value,
781
- issues: [],
782
- }, ctx);
783
- if (result instanceof Promise) {
784
- results.push(result);
785
- async = true;
786
- }
787
- else {
788
- if (result.issues.length === 0)
789
- return result;
790
- results.push(result);
791
- }
792
- }
793
- if (!async)
794
- return handleUnionResults(results, payload, inst, ctx);
795
- return Promise.all(results).then((results) => {
796
- return handleUnionResults(results, payload, inst, ctx);
797
- });
798
- };
799
- });
800
- const $ZodDiscriminatedUnion =
801
- /*@__PURE__*/
802
- $constructor("$ZodDiscriminatedUnion", (inst, def) => {
803
- $ZodUnion.init(inst, def);
804
- const _super = inst._zod.parse;
805
- defineLazy(inst._zod, "propValues", () => {
806
- const propValues = {};
807
- for (const option of def.options) {
808
- const pv = option._zod.propValues;
809
- if (!pv || Object.keys(pv).length === 0)
810
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
811
- for (const [k, v] of Object.entries(pv)) {
812
- if (!propValues[k])
813
- propValues[k] = new Set();
814
- for (const val of v) {
815
- propValues[k].add(val);
816
- }
817
- }
818
- }
819
- return propValues;
820
- });
821
- const disc = cached(() => {
822
- const opts = def.options;
823
- const map = new Map();
824
- for (const o of opts) {
825
- const values = o._zod.propValues[def.discriminator];
826
- if (!values || values.size === 0)
827
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
828
- for (const v of values) {
829
- if (map.has(v)) {
830
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
831
- }
832
- map.set(v, o);
833
- }
834
- }
835
- return map;
836
- });
837
- inst._zod.parse = (payload, ctx) => {
838
- const input = payload.value;
839
- if (!isObject(input)) {
840
- payload.issues.push({
841
- code: "invalid_type",
842
- expected: "object",
843
- input,
844
- inst,
845
- });
846
- return payload;
847
- }
848
- const opt = disc.value.get(input?.[def.discriminator]);
849
- if (opt) {
850
- return opt._zod.run(payload, ctx);
851
- }
852
- if (def.unionFallback) {
853
- return _super(payload, ctx);
854
- }
855
- // no matching discriminator
856
- payload.issues.push({
857
- code: "invalid_union",
858
- errors: [],
859
- note: "No matching discriminator",
860
- input,
861
- path: [def.discriminator],
862
- inst,
863
- });
864
- return payload;
865
- };
866
- });
867
- const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
868
- $ZodType.init(inst, def);
869
- inst._zod.parse = (payload, ctx) => {
870
- const input = payload.value;
871
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
872
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
873
- const async = left instanceof Promise || right instanceof Promise;
874
- if (async) {
875
- return Promise.all([left, right]).then(([left, right]) => {
876
- return handleIntersectionResults(payload, left, right);
877
- });
878
- }
879
- return handleIntersectionResults(payload, left, right);
880
- };
881
- });
882
- function mergeValues(a, b) {
883
- // const aType = parse.t(a);
884
- // const bType = parse.t(b);
885
- if (a === b) {
886
- return { valid: true, data: a };
887
- }
888
- if (a instanceof Date && b instanceof Date && +a === +b) {
889
- return { valid: true, data: a };
890
- }
891
- if (isPlainObject(a) && isPlainObject(b)) {
892
- const bKeys = Object.keys(b);
893
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
894
- const newObj = { ...a, ...b };
895
- for (const key of sharedKeys) {
896
- const sharedValue = mergeValues(a[key], b[key]);
897
- if (!sharedValue.valid) {
898
- return {
899
- valid: false,
900
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
901
- };
902
- }
903
- newObj[key] = sharedValue.data;
904
- }
905
- return { valid: true, data: newObj };
906
- }
907
- if (Array.isArray(a) && Array.isArray(b)) {
908
- if (a.length !== b.length) {
909
- return { valid: false, mergeErrorPath: [] };
910
- }
911
- const newArray = [];
912
- for (let index = 0; index < a.length; index++) {
913
- const itemA = a[index];
914
- const itemB = b[index];
915
- const sharedValue = mergeValues(itemA, itemB);
916
- if (!sharedValue.valid) {
917
- return {
918
- valid: false,
919
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
920
- };
921
- }
922
- newArray.push(sharedValue.data);
923
- }
924
- return { valid: true, data: newArray };
925
- }
926
- return { valid: false, mergeErrorPath: [] };
927
- }
928
- function handleIntersectionResults(result, left, right) {
929
- if (left.issues.length) {
930
- result.issues.push(...left.issues);
931
- }
932
- if (right.issues.length) {
933
- result.issues.push(...right.issues);
934
- }
935
- if (aborted(result))
936
- return result;
937
- const merged = mergeValues(left.value, right.value);
938
- if (!merged.valid) {
939
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
940
- }
941
- result.value = merged.data;
942
- return result;
943
- }
944
- const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
945
- $ZodType.init(inst, def);
946
- inst._zod.parse = (payload, ctx) => {
947
- const input = payload.value;
948
- if (!isPlainObject(input)) {
949
- payload.issues.push({
950
- expected: "record",
951
- code: "invalid_type",
952
- input,
953
- inst,
954
- });
955
- return payload;
956
- }
957
- const proms = [];
958
- if (def.keyType._zod.values) {
959
- const values = def.keyType._zod.values;
960
- payload.value = {};
961
- for (const key of values) {
962
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
963
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
964
- if (result instanceof Promise) {
965
- proms.push(result.then((result) => {
966
- if (result.issues.length) {
967
- payload.issues.push(...prefixIssues(key, result.issues));
968
- }
969
- payload.value[key] = result.value;
970
- }));
971
- }
972
- else {
973
- if (result.issues.length) {
974
- payload.issues.push(...prefixIssues(key, result.issues));
975
- }
976
- payload.value[key] = result.value;
977
- }
978
- }
979
- }
980
- let unrecognized;
981
- for (const key in input) {
982
- if (!values.has(key)) {
983
- unrecognized = unrecognized ?? [];
984
- unrecognized.push(key);
985
- }
986
- }
987
- if (unrecognized && unrecognized.length > 0) {
988
- payload.issues.push({
989
- code: "unrecognized_keys",
990
- input,
991
- inst,
992
- keys: unrecognized,
993
- });
994
- }
995
- }
996
- else {
997
- payload.value = {};
998
- for (const key of Reflect.ownKeys(input)) {
999
- if (key === "__proto__")
1000
- continue;
1001
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1002
- if (keyResult instanceof Promise) {
1003
- throw new Error("Async schemas not supported in object keys currently");
1004
- }
1005
- if (keyResult.issues.length) {
1006
- payload.issues.push({
1007
- origin: "record",
1008
- code: "invalid_key",
1009
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1010
- input: key,
1011
- path: [key],
1012
- inst,
1013
- });
1014
- payload.value[keyResult.value] = keyResult.value;
1015
- continue;
1016
- }
1017
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1018
- if (result instanceof Promise) {
1019
- proms.push(result.then((result) => {
1020
- if (result.issues.length) {
1021
- payload.issues.push(...prefixIssues(key, result.issues));
1022
- }
1023
- payload.value[keyResult.value] = result.value;
1024
- }));
1025
- }
1026
- else {
1027
- if (result.issues.length) {
1028
- payload.issues.push(...prefixIssues(key, result.issues));
1029
- }
1030
- payload.value[keyResult.value] = result.value;
1031
- }
1032
- }
1033
- }
1034
- if (proms.length) {
1035
- return Promise.all(proms).then(() => payload);
1036
- }
1037
- return payload;
1038
- };
1039
- });
1040
- const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1041
- $ZodType.init(inst, def);
1042
- const values = getEnumValues(def.entries);
1043
- inst._zod.values = new Set(values);
1044
- inst._zod.pattern = new RegExp(`^(${values
1045
- .filter((k) => propertyKeyTypes.has(typeof k))
1046
- .map((o) => (typeof o === "string" ? escapeRegex(o) : o.toString()))
1047
- .join("|")})$`);
1048
- inst._zod.parse = (payload, _ctx) => {
1049
- const input = payload.value;
1050
- if (inst._zod.values.has(input)) {
1051
- return payload;
1052
- }
1053
- payload.issues.push({
1054
- code: "invalid_value",
1055
- values,
1056
- input,
1057
- inst,
1058
- });
1059
- return payload;
1060
- };
1061
- });
1062
- const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1063
- $ZodType.init(inst, def);
1064
- inst._zod.values = new Set(def.values);
1065
- inst._zod.pattern = new RegExp(`^(${def.values
1066
- .map((o) => (typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)))
1067
- .join("|")})$`);
1068
- inst._zod.parse = (payload, _ctx) => {
1069
- const input = payload.value;
1070
- if (inst._zod.values.has(input)) {
1071
- return payload;
1072
- }
1073
- payload.issues.push({
1074
- code: "invalid_value",
1075
- values: def.values,
1076
- input,
1077
- inst,
1078
- });
1079
- return payload;
1080
- };
1081
- });
1082
- const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1083
- $ZodType.init(inst, def);
1084
- inst._zod.parse = (payload, _ctx) => {
1085
- const _out = def.transform(payload.value, payload);
1086
- if (_ctx.async) {
1087
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1088
- return output.then((output) => {
1089
- payload.value = output;
1090
- return payload;
1091
- });
1092
- }
1093
- if (_out instanceof Promise) {
1094
- throw new $ZodAsyncError();
1095
- }
1096
- payload.value = _out;
1097
- return payload;
1098
- };
1099
- });
1100
- const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
1101
- $ZodType.init(inst, def);
1102
- inst._zod.optin = "optional";
1103
- inst._zod.optout = "optional";
1104
- defineLazy(inst._zod, "values", () => {
1105
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1106
- });
1107
- defineLazy(inst._zod, "pattern", () => {
1108
- const pattern = def.innerType._zod.pattern;
1109
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
1110
- });
1111
- inst._zod.parse = (payload, ctx) => {
1112
- if (def.innerType._zod.optin === "optional") {
1113
- return def.innerType._zod.run(payload, ctx);
1114
- }
1115
- if (payload.value === undefined) {
1116
- return payload;
1117
- }
1118
- return def.innerType._zod.run(payload, ctx);
1119
- };
1120
- });
1121
- const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1122
- $ZodType.init(inst, def);
1123
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1124
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1125
- defineLazy(inst._zod, "pattern", () => {
1126
- const pattern = def.innerType._zod.pattern;
1127
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
1128
- });
1129
- defineLazy(inst._zod, "values", () => {
1130
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1131
- });
1132
- inst._zod.parse = (payload, ctx) => {
1133
- if (payload.value === null)
1134
- return payload;
1135
- return def.innerType._zod.run(payload, ctx);
1136
- };
1137
- });
1138
- const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
1139
- $ZodType.init(inst, def);
1140
- // inst._zod.qin = "true";
1141
- inst._zod.optin = "optional";
1142
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1143
- inst._zod.parse = (payload, ctx) => {
1144
- if (payload.value === undefined) {
1145
- payload.value = def.defaultValue;
1146
- /**
1147
- * $ZodDefault always returns the default value immediately.
1148
- * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1149
- return payload;
1150
- }
1151
- const result = def.innerType._zod.run(payload, ctx);
1152
- if (result instanceof Promise) {
1153
- return result.then((result) => handleDefaultResult(result, def));
1154
- }
1155
- return handleDefaultResult(result, def);
1156
- };
1157
- });
1158
- function handleDefaultResult(payload, def) {
1159
- if (payload.value === undefined) {
1160
- payload.value = def.defaultValue;
1161
- }
1162
- return payload;
1163
- }
1164
- const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
1165
- $ZodType.init(inst, def);
1166
- inst._zod.optin = "optional";
1167
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1168
- inst._zod.parse = (payload, ctx) => {
1169
- if (payload.value === undefined) {
1170
- payload.value = def.defaultValue;
1171
- }
1172
- return def.innerType._zod.run(payload, ctx);
1173
- };
1174
- });
1175
- const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
1176
- $ZodType.init(inst, def);
1177
- defineLazy(inst._zod, "values", () => {
1178
- const v = def.innerType._zod.values;
1179
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1180
- });
1181
- inst._zod.parse = (payload, ctx) => {
1182
- const result = def.innerType._zod.run(payload, ctx);
1183
- if (result instanceof Promise) {
1184
- return result.then((result) => handleNonOptionalResult(result, inst));
1185
- }
1186
- return handleNonOptionalResult(result, inst);
1187
- };
1188
- });
1189
- function handleNonOptionalResult(payload, inst) {
1190
- if (!payload.issues.length && payload.value === undefined) {
1191
- payload.issues.push({
1192
- code: "invalid_type",
1193
- expected: "nonoptional",
1194
- input: payload.value,
1195
- inst,
1196
- });
1197
- }
1198
- return payload;
1199
- }
1200
- const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
1201
- $ZodType.init(inst, def);
1202
- inst._zod.optin = "optional";
1203
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1204
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1205
- inst._zod.parse = (payload, ctx) => {
1206
- const result = def.innerType._zod.run(payload, ctx);
1207
- if (result instanceof Promise) {
1208
- return result.then((result) => {
1209
- payload.value = result.value;
1210
- if (result.issues.length) {
1211
- payload.value = def.catchValue({
1212
- ...payload,
1213
- error: {
1214
- issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1215
- },
1216
- input: payload.value,
1217
- });
1218
- payload.issues = [];
1219
- }
1220
- return payload;
1221
- });
1222
- }
1223
- payload.value = result.value;
1224
- if (result.issues.length) {
1225
- payload.value = def.catchValue({
1226
- ...payload,
1227
- error: {
1228
- issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1229
- },
1230
- input: payload.value,
1231
- });
1232
- payload.issues = [];
1233
- }
1234
- return payload;
1235
- };
1236
- });
1237
- const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
1238
- $ZodType.init(inst, def);
1239
- defineLazy(inst._zod, "values", () => def.in._zod.values);
1240
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1241
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1242
- inst._zod.parse = (payload, ctx) => {
1243
- const left = def.in._zod.run(payload, ctx);
1244
- if (left instanceof Promise) {
1245
- return left.then((left) => handlePipeResult(left, def, ctx));
1246
- }
1247
- return handlePipeResult(left, def, ctx);
1248
- };
1249
- });
1250
- function handlePipeResult(left, def, ctx) {
1251
- if (aborted(left)) {
1252
- return left;
1253
- }
1254
- return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1255
- }
1256
- const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
1257
- $ZodType.init(inst, def);
1258
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1259
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1260
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1261
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1262
- inst._zod.parse = (payload, ctx) => {
1263
- const result = def.innerType._zod.run(payload, ctx);
1264
- if (result instanceof Promise) {
1265
- return result.then(handleReadonlyResult);
1266
- }
1267
- return handleReadonlyResult(result);
1268
- };
1269
- });
1270
- function handleReadonlyResult(payload) {
1271
- payload.value = Object.freeze(payload.value);
1272
- return payload;
1273
- }
1274
- const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
1275
- $ZodCheck.init(inst, def);
1276
- $ZodType.init(inst, def);
1277
- inst._zod.parse = (payload, _) => {
1278
- return payload;
1279
- };
1280
- inst._zod.check = (payload) => {
1281
- const input = payload.value;
1282
- const r = def.fn(input);
1283
- if (r instanceof Promise) {
1284
- return r.then((r) => handleRefineResult(r, payload, input, inst));
1285
- }
1286
- handleRefineResult(r, payload, input, inst);
1287
- return;
1288
- };
1289
- });
1290
- function handleRefineResult(result, payload, input, inst) {
1291
- if (!result) {
1292
- const _iss = {
1293
- code: "custom",
1294
- input,
1295
- inst, // incorporates params.error into issue reporting
1296
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
1297
- continue: !inst._zod.def.abort,
1298
- // params: inst._zod.def.params,
1299
- };
1300
- if (inst._zod.def.params)
1301
- _iss.params = inst._zod.def.params;
1302
- payload.issues.push(issue(_iss));
1303
- }
1304
- }
1305
-
1306
- export { $ZodArray, $ZodBase64, $ZodBase64URL, $ZodBoolean, $ZodCIDRv4, $ZodCIDRv6, $ZodCUID, $ZodCUID2, $ZodCatch, $ZodCustom, $ZodDefault, $ZodDiscriminatedUnion, $ZodE164, $ZodEmail, $ZodEmoji, $ZodEnum, $ZodGUID, $ZodIPv4, $ZodIPv6, $ZodISODate, $ZodISODateTime, $ZodISODuration, $ZodISOTime, $ZodIntersection, $ZodJWT, $ZodKSUID, $ZodLiteral, $ZodNanoID, $ZodNever, $ZodNonOptional, $ZodNullable, $ZodNumber, $ZodNumberFormat, $ZodObject, $ZodOptional, $ZodPipe, $ZodPrefault, $ZodReadonly, $ZodRecord, $ZodString, $ZodStringFormat, $ZodTransform, $ZodType, $ZodULID, $ZodURL, $ZodUUID, $ZodUnion, $ZodUnknown, $ZodXID, isValidBase64, isValidBase64URL, isValidJWT };
1307
- //# sourceMappingURL=schemas.js.map