@openclaw/voice-call 2026.7.1-beta.2 → 2026.7.1-beta.5

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 (394) hide show
  1. package/README.md +1 -0
  2. package/dist/{config-DNtTB7Iw.js → config-CgigQDrF.js} +31 -13
  3. package/dist/{config-compat-CCEjHjAJ.js → config-compat-DAFd5tVH.js} +3 -2
  4. package/dist/doctor-contract-api.js +4 -22
  5. package/dist/{guarded-json-api-7ITxTL6G.js → guarded-json-api-BrBbW_RJ.js} +19 -57
  6. package/dist/index.js +46 -33
  7. package/dist/{mock-YAo3QDri.js → mock-YsvBTX-7.js} +18 -2
  8. package/dist/{plivo-wmeT9r_t.js → plivo-BnCuAGwj.js} +25 -6
  9. package/dist/{realtime-handler-DdViwdCW.js → realtime-handler-Bz-MNWtD.js} +103 -43
  10. package/dist/response-generator-PXuisI3L.js +272 -0
  11. package/dist/{runtime-entry-DN7HllXj.js → runtime-entry-kCq5Xjph.js} +234 -96
  12. package/dist/runtime-entry.js +1 -1
  13. package/dist/setup-api.js +1 -1
  14. package/dist/{store-8M2m4Isq.js → store-DtewuuOb.js} +23 -6
  15. package/dist/{telnyx-DuUBsPW2.js → telnyx-DTHQGeaW.js} +1 -1
  16. package/dist/{twilio-CsJBvC3a.js → twilio-xNIXGJ-M.js} +16 -8
  17. package/dist/webhook-replay-aaP79dI8.js +32 -0
  18. package/node_modules/commander/Readme.md +11 -15
  19. package/node_modules/commander/index.js +14 -17
  20. package/node_modules/commander/lib/argument.js +3 -6
  21. package/node_modules/commander/lib/command.js +46 -33
  22. package/node_modules/commander/lib/error.js +2 -5
  23. package/node_modules/commander/lib/help.js +4 -20
  24. package/node_modules/commander/lib/option.js +3 -6
  25. package/node_modules/commander/lib/suggestSimilar.js +2 -4
  26. package/node_modules/commander/package.json +10 -28
  27. package/node_modules/commander/typings/index.d.ts +3 -3
  28. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  29. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  30. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  31. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  32. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  33. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  34. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  35. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  36. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  37. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  38. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  39. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  40. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  41. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  42. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  43. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  44. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  45. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  46. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  47. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  48. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  49. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  50. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  51. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  52. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  53. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  54. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  55. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  56. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  57. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  58. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  59. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  60. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  61. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  62. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  63. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  64. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  65. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  66. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  67. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  68. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  69. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  70. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  71. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  72. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  73. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  74. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  75. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  76. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  77. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  78. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  79. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  80. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  81. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  82. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  83. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  84. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  85. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  86. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  87. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  88. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  89. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  90. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  91. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  92. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  93. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  94. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  95. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  96. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  97. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  98. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  99. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  100. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  101. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  102. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  103. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  104. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  105. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  106. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  107. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  108. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  109. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  110. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  111. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  112. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  113. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  114. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  115. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  116. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  117. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  118. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  119. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  120. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  121. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  122. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  123. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  124. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  125. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  126. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  127. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  128. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  129. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  130. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  131. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  132. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  133. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  134. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  135. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  136. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  137. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  138. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  139. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  140. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  141. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  142. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  143. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  144. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  145. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  146. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  147. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  148. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  149. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  150. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  151. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  152. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  153. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  154. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  155. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  156. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  157. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  158. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  159. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  160. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  161. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  162. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  163. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  164. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  165. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  166. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  167. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  168. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  169. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  170. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  171. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  172. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  173. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  174. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  175. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  176. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  177. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  178. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  179. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  180. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  181. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  182. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  183. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  184. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  185. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  186. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  187. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  188. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  189. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  190. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  191. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  192. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  193. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  194. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  195. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  196. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  197. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  198. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  199. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  200. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  201. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  202. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  203. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  204. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  205. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  206. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  207. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  208. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  209. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  210. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  211. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  212. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  213. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  214. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  215. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  216. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  217. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  218. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  219. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  220. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  221. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  222. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  223. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  224. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  225. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  226. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  227. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  228. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  229. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  230. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  231. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  232. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  233. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  234. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  235. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  236. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  237. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  238. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  239. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  240. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  241. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  242. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  243. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  244. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  245. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  246. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  247. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  248. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  249. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  250. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  251. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  252. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  253. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  254. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  255. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  256. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  257. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  258. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  259. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  260. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  261. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  262. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  263. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  264. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  265. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  266. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  267. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  268. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  269. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  270. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  271. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  272. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  273. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  274. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  275. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  276. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  277. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  278. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  279. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  280. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  281. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  282. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  283. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  284. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  285. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  286. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  287. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  288. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  289. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  290. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  291. package/node_modules/typebox/build/typebox.d.mts +4 -8
  292. package/node_modules/typebox/build/typebox.mjs +4 -8
  293. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  294. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  295. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  296. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  297. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  298. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  299. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  300. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  301. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  302. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  303. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  304. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  305. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  306. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  307. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  308. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  309. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  310. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  311. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  312. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  313. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  314. package/node_modules/typebox/build/value/index.d.mts +0 -1
  315. package/node_modules/typebox/build/value/index.mjs +0 -1
  316. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  317. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  318. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  319. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  320. package/node_modules/typebox/build/value/value.d.mts +0 -1
  321. package/node_modules/typebox/build/value/value.mjs +0 -1
  322. package/node_modules/typebox/package.json +25 -25
  323. package/node_modules/typebox/readme.md +97 -80
  324. package/npm-shrinkwrap.json +12 -12
  325. package/openclaw.plugin.json +8 -0
  326. package/package.json +6 -6
  327. package/dist/response-generator-CXBGKbAp.js +0 -212
  328. package/node_modules/commander/esm.mjs +0 -16
  329. package/node_modules/commander/typings/esm.d.mts +0 -3
  330. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  331. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  332. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  333. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  334. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  335. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  336. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  337. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  338. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  339. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  340. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  341. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  342. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  343. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  344. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  345. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  346. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  347. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  348. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  349. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  350. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  351. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  352. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  353. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  354. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  355. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  356. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  357. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  358. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  359. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  360. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  361. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  362. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  363. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  364. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  365. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  366. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  367. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  368. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  369. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  370. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  371. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  372. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  373. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  374. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  375. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  376. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  377. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  378. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  379. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  380. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  381. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  382. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  383. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  384. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  385. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  386. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  387. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  388. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  389. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  390. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  391. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  392. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  393. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  394. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -50,7 +50,7 @@ type T = Type.Static<typeof T> // type T = {
50
50
 
51
51
  [Documentation](https://sinclairzx81.github.io/typebox/)
52
52
 
53
- TypeBox is a runtime type system that creates in-memory JSON Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type system that can be statically checked by TypeScript and validated at runtime using standard JSON Schema.
53
+ TypeBox is a runtime type system that creates in-memory JSON Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type that can be statically checked by TypeScript and runtime checked using standard JSON Schema validation.
54
54
 
55
55
  This library is designed to allow JSON Schema to compose similar to how types compose within TypeScript's type system. It can be used as a simple tool to build up complex schematics or integrated into REST and RPC services to help validate data received over the wire.
56
56
 
@@ -73,7 +73,7 @@ License: MIT
73
73
 
74
74
  TypeBox types are JSON Schema fragments that compose into more complex types. The library offers a set of types used to construct JSON Schema compliant schematics as well as a set of extended types used to model constructs native to the JavaScript language. The schematics produced by TypeBox can be passed directly to any JSON Schema compliant validator.
75
75
 
76
- ## Example
76
+ ### Example
77
77
 
78
78
  The following creates a User type and infers with Static.
79
79
 
@@ -111,113 +111,130 @@ type User = Type.Static<typeof User> // type User = {
111
111
 
112
112
  ## Script
113
113
 
114
- [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POvueHb6AygGMowMDH6Ne0mbLnNqQiADsAzvADecAKqrUUADQ69UbWAAmAQxjoAvnAC8iIgDpho8QAoABtThxgZRsoDEshdABRIOBCOA1Kf39gcwAuOHVRZQBzBLhbPwCg-VDw4304VDIbZXNVOCiYGKQ4uFz-ZUsQVDSMwKyjNoqQS2AAGx6YTKzW-3zcwjQy0wtrdCcIgDdLUYBXVYAeQYAFYCEAa33dfSMz1CQIDHrowgA+OAAyGcSjy1hgbf2AHkQDFLiYbncHk9Gq8Xrk4ZRvABKah0KTyDGYzGSABKqAwo1QQgkaKxZPJvEUKlUEEJLlGECyniuUCRiXZHM5XK5aPi3P5AsFgrR-gW3XwEGIACsiTA8AZBkKlcrOSK4GBsGg-qhVGk+SqDYa1UlUi0xWk8L1sng8grDfblca4B0unq4Ob8FasjbbHaHf7+U7UMMxm6PZbJn0fYqA7G4GrfTG4-61VBUABHHbANOmgDaSeT9qdeGS8q+hdjxZdqDLBYrKuLwZGoyo9cr9H8AF0622hWi5ko1LTUPTGcyTGYrDY2YXeT3ewK1eHJTLifL5wvuWqNRAtY0dXqN5vVR3Eskw0QLV6fX7jw3T+1OuKtOHr7aj3fEkGQ+MzZfPZG1p5B+n7xqeiagY6p5ppm2aoHmJbmHg3aQUq-aovQFJYdhLCSAIMDWKckg4SRFLUGKSyOM4aBuARjRCPsYpQiybxofQFEslR+qocKp7nukgH9CBoFqtWExTLePGBqeTahgJUzCZ+6GUBxE4rDYVHIDR+GEQxTGPCyk6rKxaKqfoRkaU43FSVufGml6kk2SeiTVgA-OJfSOU57JqrJozufJfSKXe6FAA) | [Example 2](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POvnb7k1ejbsJGj21AMYQAdgGd4AUWkxghOAF5ERAHQBJZaigYAhhNQAKANoBdADRwA3pThxgAEwBcWtNoDKMKGBpAHNzAEpKAF8Iyik5eABVWUMNb1Q9AyNTC0slFUI7R2c4aWMQVC9+dP9AkPDbYtQQY2AAG0qdGqDQiOjJGXk4JMMEsDdjGHRNKu0FADdjVoBXCYsZ-UmoZIkYK2KZgAVgCQBrc2GoexmAaVQkAHkMczzVJDCwhpdD41hgRfMZvcQKpzslLmltLcHk8XoR3hFrO9qHQhGI0eiMdxBAAlVAYVqoHaCTEk0mY-pyCAE7StCChC5hFxM5ks1lslkopzs7k83m8lEuQhoLx4CDEABWhJgeE+fLl8u5ArgYGwaF+qFkXi5Cp1uqVLncWrgQoq+HktWCeDgkVlurtfP1JTKpocxqIIvN3StNuK9r97MdTRa7UcbuFZoCXutvv9saZSp9caTLiVUFQAEclsA0544JYY8m-Y68O4ZXAC4W7cXSuUyxXKzri0G2lQG-6ldZ6225SjIhTZFT0rT6WDRuNJozk5yu93+fRBe78GLJTsZTPZ4r58rVYYVBqteuN2zHYbQyaPZGQt7bUee1uXDWXWHTXhPVfrTfb3OWc2Q67zxGFreoeX7xluiagQ6W5ppm2aoLmlglm4eCdpBUHRsSZJYdhnCCP4EzHJhOHEcR1AmkMYKpDM+EqBIAA8JoQBgFGGAAfPKKLkRcqTamhPJKqeb7BJ+fGskqj5eEJImicySq-pJl7BCBaG9mRRAsVAY6rFRnQwAR9GMcxFxaZM7FwJx6nGWM2maLxMliVugmKdJ9nmVuj4APwKRaLn2XJzRtF5cBCcpkG9kAA)
114
+ [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POv3b7k0AdAGUAxlGBgYACjwC5eAJS9G3VWvXdqdOADkAhiFQBnMHpGpKIiADsj8ALJ6YACzgBeREWFiJ0gAaUcHCEaHAAaqgiMNAATO5wAN5wZABccNYAriDEqFAANHBIaZnZuXAAvoHBROGR0VAAzPEAogBuegA2GU6oADwRUbFwAGSJcABexVk5UBUAfFUh6AP1ACwt7V09-XXQTaNJAO5TpbPlC35KygAiqGjWACao1vD6hiZmFla28En2xq5yvF+KhvOJJFIknIBI4XBUCn4gosahFYKgyPEElUgpAjMAYMAbGkVtBVnlseloCBOsTdo1yUEghlWrTBlAYlVKkElnAAOKoHCoGBQJCYimtXIE8xGWlosgAbQAugzGcBHsBpScZkrOcjQrDcsBOmLGXADMRgM8YKy1iqgg9gBgMBkjKgbaS7XATJEMh09FB3VBVrruTV-kZXB4saaAOYCwzCop8+NCkWe6kwQ00uAG8SdXWXLT0ABKGReoHQxdQGA6dUJ1ko4ecAjA2DQsEtRgEccFiZbbclnYEEo70oE+NQIC7rYg7YJxhbEDxBJs-dng4XZEbALXc6HPYTIt3G67I6lC4nU+PHYX1ipnWv867W6bj-3Kb7M73C7PGovmavL8TwEZk303bcIzArsMyzDooIEB0nRdUEgJvZ8IObVCnwEGC8zgrCh3NS0Xngl8dwIhdcKNfCBzQgRvREX1-VIos4CEGAnA1OAAElrAwXJnnMShnWsKJ6zgKBnieKApHeZw0hBYQOKlXolggDAcwBOYFESKo5O7D8j1-aV5QABkVRdl3rAQtyCfSD1TJBh0HEzzIEO8oGpODbLgezDKc4zjDMizQJ8-SqIfRDnVdGy9J3CK4KIq1Yrs+Kejw+i0EYv0oFi8ogA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POv3b7k0AdACpejbuImTu1OnAByAQxCoAzmAUBjVJQB2S1eq1wAsgpgALOAG9KcOKjKRYcDRB0r4ANVQaY0AExwALyIRAIA8sQAVj4wABRWcGQAXKGCcgCuIMSoUHEAlAA0cEip-KgCmdm5BXAAvvm29o7Q8K7uXrHQAMzBaRUAogBuCgA2GWaoceUCAJI6MLkqsXEA2t6+AcUzkTG+CXAAXmVhVTl5+fX5ALr5jXYOTm1uHnAbflAALH0zw2MTi2mYXmiygy326y6UG62zCuxWiQA7id0llzrUGrdGnUZPQACKoNA6AAmqAW8n0ak02nar28sAcPzh0QRTUgKmAMGAblSpgsAne0E+hSaOmgIDGvLM5gFUJhTQyQyl-MFUH8lAalFp8AA4qgcKgYFAkEzBPD9jY7ENclytCoURUAIJQKAKJBxemLMhFJrAEnAO0OgTO13umZnGp3DWNbUmSZQYBjU0Vc3xS1wJTEYBkmDKmWq4VNYnADAYDLLPOyzZfEV2NQ+DKjBRQSsF6Nal7wYyqSwhHYsi1NADm+uURtKcD1BvHtbgEtBidGytyi-bogAShkFqB0OvUBhRrFuTpKN2VDKwNg0LBsyoBCPp8aBJeINeuaoBNab3aBJzUCA7xfN9b2fCAOS5NxnyvG0QLIU8eyg18YI-B8xyfIDkLvL9bQ-P8AMQ4CPzFKAJVGAjMIEOCzwvaCbxQ0dDXQ2j3ywmCfzwwDmJAxVyLou8qIQjC+IEecVzGXiWIEYtS3LCohMkgTzwkkDRITcT5JAzNswWZSP0UmikOE1TF10u96w0Rtm1MyjcTgABlGAzADOB5gwXIyS0Sgyx0XxjzgKAyVJPJlHPIMHKcjQAB5CDQCAMBMHsAD5LnTEKZVQxikE-NjVFWAAGa5QPA48bLsNL7wY8dsu-XKCoEYjSNKucEIyqrsIDWrCp4uCyoQ4zxOkstlia8r+rIrScxGvr4xM8zLKgGy6iAA) | [Challenge](test/typescript/readme.md)
115
115
 
116
- The TypeBox Script function is a micro DSL for constructing JSON Schema from TypeScript syntax. It offers a full syntactic frontend to Type.* with broad support for type-level expressions including Conditional, Mapped, Infer, Generic, Distributive types and more. This feature is implemented symmetrically at both runtime and in the type system.
116
+ TypeBox includes a syntax engine that can transform TypeScript declarations into JSON Schema. The engine is a full syntactic frontend to Type.* and supports many advanced type-level constructs such as Conditional, Mapped, Indexed, Infer, Generics, Distributed types and more. This feature is implemented symmetrically at runtime and statically via TypeScript Template Literal types.
117
117
 
118
- ### Example
118
+ Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
119
119
 
120
- The following uses the Script function to parse TypeScript interfaces into JSON Schema.
121
120
 
122
- ```typescript
123
- import Type from 'typebox'
121
+ ### Example
124
122
 
125
- // Script
123
+ The following uses Script to parse TypeScript declarations into JSON Schema.
126
124
 
127
- const { User, UserUpdate } = Type.Script(`
125
+ ```typescript
126
+ // Module
127
+ const Math = Type.Script(`
128
+ type Vector2 = { x: number, y: number }
129
+ type Vector3 = Evaluate<Vector2 & { z: number }>
130
+ type Vector4 = Evaluate<Vector3 & { w: number }>
131
+ `)
128
132
 
129
- interface Entity {
130
- id: string
133
+ // Dependent Module
134
+ const { Mesh } = Type.Script({ ...Math }, `
135
+ type Vertex = {
136
+ position: Vector4,
137
+ normal: Vector3,
138
+ uv: Vector2
131
139
  }
132
-
133
- interface User extends Entity {
134
- name: string,
135
- email: string
140
+ type Geometry = {
141
+ vertices: Vertex[],
142
+ indices: number[]
143
+ }
144
+ type Material = {
145
+ ambient: Vector4,
146
+ diffuse: Vector4,
147
+ specular: Vector4
148
+ }
149
+ type Mesh = {
150
+ geometry: Geometry,
151
+ material: Material
136
152
  }
137
-
138
- type UserUpdate = Evaluate<
139
- Pick<User, keyof Entity> &
140
- Partial<Omit<User, keyof Entity>>
141
- >
142
-
143
153
  `)
144
154
 
145
- // Reflect
146
-
147
- console.log(User) // {
148
- // type: 'object',
149
- // properties: {
150
- // id: { type: 'string' },
151
- // name: { type: 'string' },
152
- // email: { type: 'string' }
153
- // },
154
- // required: [
155
- // 'id',
156
- // 'name',
157
- // 'email'
158
- // ]
159
- // }
160
-
161
- console.log(UserUpdate) // {
162
- // type: 'object',
163
- // properties: {
164
- // id: { type: 'string' },
165
- // name: { type: 'string' },
166
- // email: { type: 'string' }
167
- // },
168
- // required: ['id']
169
- // }
170
-
171
- // Static
172
-
173
- type User = Type.Static<typeof User> // type User = {
174
- // id: string,
175
- // name: string,
176
- // email: string
177
- // }
178
-
179
- type UserUpdate = Type.Static<typeof UserUpdate> // type UserUpdate = {
180
- // id: string,
181
- // name?: string,
182
- // email?: string
183
- // }
184
-
185
-
155
+ // Runtime Reflection
156
+ Mesh.properties.geometry.properties.vertices.items.properties.position.properties.x
157
+ Mesh.properties.geometry.properties.vertices.items.properties.normal.properties.x
158
+ Mesh.properties.geometry.properties.vertices.items.properties.uv.properties.x
159
+ Mesh.properties.material.properties.diffuse.properties.x
160
+ Mesh.properties.material.properties.ambient.properties.x
161
+ Mesh.properties.material.properties.specular.properties.x
162
+
163
+ // Static Inference
164
+ function render(mesh: Type.Static<typeof Mesh>) {
165
+ mesh.geometry.vertices[0].position.x
166
+ mesh.geometry.vertices[0].normal.x
167
+ mesh.geometry.vertices[0].uv.x
168
+ mesh.material.diffuse.x
169
+ mesh.material.ambient.x
170
+ mesh.material.specular.x
171
+ }
186
172
  ```
187
173
 
188
174
  <a name="Schema"></a>
189
175
 
190
176
  ## Schema
191
177
 
192
- [Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQokscAKuWrnyES-ajXZs6dOAFo58hYqXKVqteo0zJ0gMIEwwADZptszeYuWr8tmyQQAdg3gBVBmihwAvImZYAdHrgRmgAFHwU-gDylABWaEgwoQDebHBwwAAmAFy8-P4IMFDADgDmoQCUADRpcA6YIGi5EWgFRSXl1bUsRs35hcVlKbjQWDC5RD2GRHAAvhVs8wum1qtr61pScAAKmFDuKxtHx6q29k7wAK7unj5uHv67+2HJ6W-vH5-vW+fOcNceXKpdJZCYANgArDgAIyYABMlAAzEgACyZCFoME4ADsmAAHJQAJxIAAMmWhRCqX2pcC2IJycGcg1KNXS9UaEwBUEpNN5fO+0jZDSajPaZVZcCmnJuAAFMgRMCV-PYQDN+by6ZKsL1RczFhV1YajR8trNvHB-JagA) | [Example 2](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQbddcAtH-wMFDhI0WPESenbgGECYYABs003pPUbNW-hyQQAdg3gBVBmihwAvImZYAdHPBK0ACgDebOHDIUAXMQhKACs0JBgiABpPODB8ClhgNAZ-Dy8vYAATFO9yNH8iIyhgfQBzIjgAXyi0uH1MEDy4Nxy-YkLissrqtJYlbJ9Ggpgi0sjcaCwYfN7FcoroquioNABHAFdgZay4AG1oryJMsf3iOobjmqIZ9i8AXTYKgEoOLjVtd4+P1QAFTCgzVSfIHAyS6AxGOBrMwWaymcx2X7-VzNGqotHouCvPSGeBQ8wpaKZfIANgArDgAIyYABMlAAzEgACwZUloYk4ADsmAAHJQAJxIAAMGQpYwx6Ne6W27VK3TOgzxUDF4pVqq8ktq9UaMpK3Rm+UVAAEMgRMMU7HoQOU1SqNfq4DqHo8bS7XajXhUrHA7D6gA) | [Specification](https://sinclairzx81.github.io/typebox/#/docs/schema/1_spec)
178
+ [Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQbddcAtH-wMFDhI0WPESenbgGECYYABs003pPUbNW-hyQQAdg3gBVBmihwAvImZYAdHPBK0ACgDebOHDIUAXMQhKACs0JBgiABpPODB8ClhgNAZ-Dy8vYAATFO9yNH8iIyhgfQBzIjgAXyi0uH1MEDy4Nxy-YkLissrqtJYlbJ9Ggpgi0sjcaCwYfN7FcoroquioNABHAFdgZay4AG1oryJMsf3iOobjmqIZ9i8AXTYKgEoOLjVtd4+P1QAFTCgzVSfIHAyS6AxGOBrMwWaymcx2X7-VzNGqotHouCvPSGeBQ8wpaKZfIANgArDgAIyYABMlAAzEgACwZUloYk4ADsmAAHJQAJxIAAMGQpYwx6Ne6W27VK3TOgzxUDF4pVqq8ktq9UaMpK3Rm+UVAAEMgRMMU7HoQOU1SqNfq4DqHo8bS7XajXhUrHA7D6gA) | [Example 2](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQokscAKuWrnyES-ajXZs6dOAFo58hYqXKVqteo0zJ0gMIEwwADZptszeYuWr8tmyQQAdg3gBVBmihwAvImZYAdHrgRmgAFHwU-gDylABWaEgwoQDebHBwwAAmAFy8-P4IMFDADgDmoQCUADRpcA6YIGi5EWgFRSXl1bUsRs35hcVlKbjQWDC5RD2GRHAAvhVs8wum1qtr61pScAAKmFDuKxtHx6q29k7wAK7unj5uHv67+2HJ6W-vH5-vW+fOcNceXKpdJZCYANgArDgAIyYABMlAAzEgACyZCFoME4ADsmAAHJQAJxIAAMmWhRCqX2pcC2IJycGcg1KNXS9UaEwBUEpNN5fO+0jZDSajPaZVZcCmnJuAAFMgRMCV-PYQDN+by6ZKsL1RczFhV1YajR8trNvHB-JagA)
193
179
 
194
- TypeBox includes a high-performance JSON Schema compiler with support for drafts 3 through to 2020-12. The compiler is designed to be a lightweight industry-grade alternative to Ajv and offers improved compilation and validation performance. The compiler also offers automatic fallback to dynamic checking in JIT-restricted environments such as Cloudflare Workers.
180
+ TypeBox includes a high-performance JIT compiler that supports JSON Schema Draft 3 through to 2020-12. It is designed to be a lightweight industry-grade alternative to Ajv and offers improved compilation and validation performance. It also provides automatic fallback to dynamic validation in JIT restricted environments such as Cloudflare Workers.
195
181
 
196
- ### Example
197
-
198
- The following uses the Schema submodule to compile a TypeBox type.
182
+ The compiler is available via optional sub module import.
199
183
 
200
184
  ```typescript
201
185
  import Schema from 'typebox/schema'
186
+ ```
202
187
 
203
- // Compile
188
+ ### Compile
204
189
 
205
- const User = Schema.Compile(Type.Object({ // const User = Validator<Type.TObject<{
206
- id: Type.String(), // id: Type.TString;
207
- name: Type.String(), // name: Type.TString;
208
- email: Type.String({ format: 'email' }) // email: Type.TString;
209
- })) // }>, { ... }>
190
+ The compiler accepts JSON Schema and returns Validator instances.
210
191
 
211
- // Parse
192
+ ```typescript
193
+ const Vector = Schema.Compile(Type.Object({ // const Vector: Validator<TObject<{
194
+ x: Type.Number(), // x: TNumber
195
+ y: Type.Number(), // y: TNumber
196
+ z: Type.Number() // z: TNumber
197
+ })) // }>>
198
+ ```
199
+ With JSON Schema
200
+ ```typescript
201
+ const Vector = Schema.Compile({ // const Vector: Validator<{
202
+ type: 'object', // type: "object";
203
+ required: ['x', 'y', 'z'], // required: ["x", "y", "z"];
204
+ properties: { // properties: { ... };
205
+ x: { type: 'number' }, // }, { ... }>
206
+ y: { type: 'number' },
207
+ z: { type: 'number' }
208
+ }
209
+ })
210
+ ```
211
+
212
+ ### Validate
212
213
 
213
- const user = User.Parse({ // const user: {
214
- id: '65f1a2b3c4d5e6f7a8b9c0d1', // id: string,
215
- name: 'user', // name: string,
216
- email: 'user@domain.com' // email: string
217
- }) // } = ...
214
+ Validator instances provide functions to Check and Parse values.
218
215
 
216
+ ```typescript
217
+ const Vector = Schema.Compile(Type.Script(`{
218
+ x: number
219
+ y: number
220
+ z: number
221
+ }`))
222
+
223
+ const valid = Vector.Check({ // const valid: boolean
224
+ x: 1,
225
+ y: 0,
226
+ z: 0
227
+ })
228
+
229
+ const value = Vector.Parse({ // const value: {
230
+ x: 1, // x: number
231
+ y: 0, // y: number
232
+ z: 0 // z: number
233
+ }) // }
219
234
  ```
220
235
 
236
+
237
+
221
238
  ### Coverage
222
239
 
223
240
  The following table shows specification coverage implemented by TypeBox.
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@openclaw/voice-call",
3
- "version": "2026.7.1-beta.2",
3
+ "version": "2026.7.1-beta.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/voice-call",
9
- "version": "2026.7.1-beta.2",
9
+ "version": "2026.7.1-beta.5",
10
10
  "dependencies": {
11
- "commander": "14.0.3",
12
- "typebox": "1.1.39",
11
+ "commander": "15.0.0",
12
+ "typebox": "1.3.3",
13
13
  "ws": "8.21.0",
14
14
  "zod": "4.4.3"
15
15
  },
16
16
  "peerDependencies": {
17
- "openclaw": ">=2026.7.1-beta.2"
17
+ "openclaw": ">=2026.7.1-beta.5"
18
18
  },
19
19
  "peerDependenciesMeta": {
20
20
  "openclaw": {
@@ -23,18 +23,18 @@
23
23
  }
24
24
  },
25
25
  "node_modules/commander": {
26
- "version": "14.0.3",
27
- "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
28
- "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
26
+ "version": "15.0.0",
27
+ "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz",
28
+ "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
29
29
  "license": "MIT",
30
30
  "engines": {
31
- "node": ">=20"
31
+ "node": ">=22.12.0"
32
32
  }
33
33
  },
34
34
  "node_modules/typebox": {
35
- "version": "1.1.39",
36
- "resolved": "https://registry.npmjs.org/typebox/-/typebox-1.1.39.tgz",
37
- "integrity": "sha512-vj0afVtOfLQvv0GR0VxVagYxsXN64btL7Z9XoaG0ZggH3mruMMkOO6hXdgMsjCY3shZgEvooAWVeznQVs5c43w==",
35
+ "version": "1.3.3",
36
+ "resolved": "https://registry.npmjs.org/typebox/-/typebox-1.3.3.tgz",
37
+ "integrity": "sha512-URXGUE31PJDQC+PtRMJeLdF4kmmOdFoVPikPCtV2oOIhUpNpppEdIz7W8bH8cFYPYHdDpaRvqwdegMTmHliudg==",
38
38
  "license": "MIT"
39
39
  },
40
40
  "node_modules/ws": {
@@ -71,6 +71,10 @@
71
71
  "label": "Twilio Auth Token",
72
72
  "sensitive": true
73
73
  },
74
+ "twilio.region": {
75
+ "label": "Twilio Region",
76
+ "advanced": true
77
+ },
74
78
  "outbound.defaultMode": {
75
79
  "label": "Default Call Mode"
76
80
  },
@@ -286,6 +290,10 @@
286
290
  },
287
291
  "authToken": {
288
292
  "type": ["string", "object"]
293
+ },
294
+ "region": {
295
+ "type": "string",
296
+ "enum": ["us1", "ie1", "au1"]
289
297
  }
290
298
  }
291
299
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/voice-call",
3
- "version": "2026.7.1-beta.2",
3
+ "version": "2026.7.1-beta.5",
4
4
  "description": "OpenClaw voice-call plugin for Twilio, Telnyx, and Plivo phone calls.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,13 +8,13 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "commander": "14.0.3",
12
- "typebox": "1.1.39",
11
+ "commander": "15.0.0",
12
+ "typebox": "1.3.3",
13
13
  "ws": "8.21.0",
14
14
  "zod": "4.4.3"
15
15
  },
16
16
  "peerDependencies": {
17
- "openclaw": ">=2026.7.1-beta.2"
17
+ "openclaw": ">=2026.7.1-beta.5"
18
18
  },
19
19
  "peerDependenciesMeta": {
20
20
  "openclaw": {
@@ -31,10 +31,10 @@
31
31
  "minHostVersion": ">=2026.4.10"
32
32
  },
33
33
  "compat": {
34
- "pluginApi": ">=2026.7.1-beta.2"
34
+ "pluginApi": ">=2026.7.1-beta.5"
35
35
  },
36
36
  "build": {
37
- "openclawVersion": "2026.7.1-beta.2"
37
+ "openclawVersion": "2026.7.1-beta.5"
38
38
  },
39
39
  "release": {
40
40
  "publishToClawHub": true,
@@ -1,212 +0,0 @@
1
- import { s as resolveVoiceCallSessionKey } from "./config-DNtTB7Iw.js";
2
- import { f as resolveVoiceResponseModel } from "./runtime-entry-DN7HllXj.js";
3
- import { isRecord, normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
4
- import crypto from "node:crypto";
5
- import { applyModelOverrideToSessionEntry } from "openclaw/plugin-sdk/model-session-runtime";
6
- //#region extensions/voice-call/src/response-generator.ts
7
- /**
8
- * Voice call response generator - uses the embedded OpenClaw agent for tool support.
9
- * Routes voice responses through the same agent infrastructure as messaging.
10
- */
11
- function readExplicitToolsAllow(value) {
12
- if (!isRecord(value)) return;
13
- const allow = value.allow;
14
- if (!Array.isArray(allow)) return;
15
- return allow.filter((entry) => typeof entry === "string");
16
- }
17
- function resolveVoiceAgentToolsAllow(config, agentId) {
18
- const agents = isRecord(config.agents) ? config.agents : void 0;
19
- const agent = (Array.isArray(agents?.list) ? agents.list : []).find((entry) => isRecord(entry) && entry.id === agentId);
20
- if (!isRecord(agent)) return;
21
- return readExplicitToolsAllow(isRecord(agent.tools) ? agent.tools : void 0);
22
- }
23
- const VOICE_SPOKEN_OUTPUT_CONTRACT = [
24
- "Output format requirements:",
25
- "- Return only valid JSON in this exact shape: {\"spoken\":\"...\"}",
26
- "- Do not include markdown, code fences, planning text, or extra keys.",
27
- "- Put exactly what should be spoken to the caller into \"spoken\".",
28
- "- If there is nothing to say, return {\"spoken\":\"\"}."
29
- ].join("\n");
30
- function normalizeSpokenText(value) {
31
- const normalized = value.replace(/\s+/g, " ").trim();
32
- return normalized.length > 0 ? normalized : null;
33
- }
34
- function tryParseSpokenJson(text) {
35
- const candidates = [];
36
- const trimmed = text.trim();
37
- if (!trimmed) return null;
38
- candidates.push(trimmed);
39
- const fenced = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
40
- if (fenced?.[1]) candidates.push(fenced[1]);
41
- const firstBrace = trimmed.indexOf("{");
42
- const lastBrace = trimmed.lastIndexOf("}");
43
- if (firstBrace >= 0 && lastBrace > firstBrace) candidates.push(trimmed.slice(firstBrace, lastBrace + 1));
44
- for (const candidate of candidates) try {
45
- const parsed = JSON.parse(candidate);
46
- if (typeof parsed?.spoken !== "string") continue;
47
- return normalizeSpokenText(parsed.spoken) ?? "";
48
- } catch {}
49
- const inlineSpokenMatch = trimmed.match(/"spoken"\s*:\s*"((?:[^"\\]|\\.)*)"/i);
50
- if (!inlineSpokenMatch) return null;
51
- try {
52
- return normalizeSpokenText(JSON.parse(`"${inlineSpokenMatch[1] ?? ""}"`)) ?? "";
53
- } catch {
54
- return null;
55
- }
56
- }
57
- function isLikelyMetaReasoningParagraph(paragraph) {
58
- const lower = normalizeLowercaseStringOrEmpty(paragraph);
59
- if (!lower) return false;
60
- if (lower.startsWith("thinking process")) return true;
61
- if (lower.startsWith("reasoning:") || lower.startsWith("analysis:")) return true;
62
- if (lower.startsWith("the user ") && (lower.includes("i should") || lower.includes("i need to") || lower.includes("i will"))) return true;
63
- if (lower.includes("this is a natural continuation of the conversation") || lower.includes("keep the conversation flowing")) return true;
64
- return false;
65
- }
66
- function sanitizePlainSpokenText(text) {
67
- const withoutCodeFences = text.replace(/```[\s\S]*?```/g, " ").trim();
68
- if (!withoutCodeFences) return null;
69
- const paragraphs = normalizeStringEntries(withoutCodeFences.split(/\n\s*\n+/));
70
- while (paragraphs.length > 1 && isLikelyMetaReasoningParagraph(paragraphs[0])) paragraphs.shift();
71
- return normalizeSpokenText(paragraphs.join(" "));
72
- }
73
- function extractSpokenTextFromPayloads(payloads) {
74
- const spokenSegments = [];
75
- for (const payload of payloads) {
76
- if (payload.isError || payload.isReasoning) continue;
77
- const rawText = payload.text?.trim() ?? "";
78
- if (!rawText) continue;
79
- const structured = tryParseSpokenJson(rawText);
80
- if (structured !== null) {
81
- if (structured.length > 0) spokenSegments.push(structured);
82
- continue;
83
- }
84
- const plain = sanitizePlainSpokenText(rawText);
85
- if (plain) spokenSegments.push(plain);
86
- }
87
- return spokenSegments.length > 0 ? spokenSegments.join(" ").trim() : null;
88
- }
89
- function resolveVoiceSandboxSessionKey(agentId, sessionKey) {
90
- const trimmed = sessionKey.trim();
91
- if (trimmed.toLowerCase().startsWith("agent:")) return trimmed;
92
- return `agent:${agentId}:${trimmed}`;
93
- }
94
- /**
95
- * Generate a voice response using the embedded OpenClaw agent with full tool support.
96
- * Uses the same agent infrastructure as messaging for consistent behavior.
97
- */
98
- async function generateVoiceResponse(params) {
99
- const { voiceConfig, callId, sessionKey, from, transcript, userMessage, coreConfig, agentRuntime } = params;
100
- if (!coreConfig) return {
101
- text: null,
102
- error: "Core config unavailable for voice response"
103
- };
104
- const cfg = coreConfig;
105
- const resolvedSessionKey = resolveVoiceCallSessionKey({
106
- config: voiceConfig,
107
- callId,
108
- phone: from,
109
- explicitSessionKey: sessionKey,
110
- coreSession: coreConfig.session
111
- });
112
- const agentId = voiceConfig.agentId ?? "main";
113
- const toolsAllow = resolveVoiceAgentToolsAllow(cfg, agentId);
114
- const storePath = agentRuntime.session.resolveStorePath(cfg.session?.store, { agentId });
115
- const agentDir = agentRuntime.resolveAgentDir(cfg, agentId);
116
- const workspaceDir = agentRuntime.resolveAgentWorkspaceDir(cfg, agentId);
117
- await agentRuntime.ensureAgentWorkspace({ dir: workspaceDir });
118
- const now = Date.now();
119
- const existingSessionEntry = agentRuntime.session.getSessionEntry({
120
- storePath,
121
- sessionKey: resolvedSessionKey
122
- });
123
- const { provider, model } = resolveVoiceResponseModel({
124
- voiceConfig,
125
- agentRuntime
126
- });
127
- let sessionEntry = existingSessionEntry;
128
- if (!sessionEntry?.sessionId || voiceConfig.responseModel) sessionEntry = await agentRuntime.session.patchSessionEntry({
129
- storePath,
130
- sessionKey: resolvedSessionKey,
131
- replaceEntry: true,
132
- fallbackEntry: sessionEntry ?? {
133
- sessionId: crypto.randomUUID(),
134
- updatedAt: now
135
- },
136
- update: (entry) => {
137
- const next = entry.sessionId ? { ...entry } : {
138
- ...entry,
139
- sessionId: crypto.randomUUID(),
140
- updatedAt: now
141
- };
142
- if (voiceConfig.responseModel) applyModelOverrideToSessionEntry({
143
- entry: next,
144
- selection: {
145
- provider,
146
- model
147
- },
148
- selectionSource: "auto"
149
- });
150
- return next;
151
- }
152
- }) ?? void 0;
153
- if (!sessionEntry?.sessionId) return {
154
- text: null,
155
- error: "Voice response session could not be initialized"
156
- };
157
- const sessionId = sessionEntry.sessionId;
158
- const thinkLevel = agentRuntime.resolveThinkingDefault({
159
- cfg,
160
- provider,
161
- model
162
- });
163
- const agentName = agentRuntime.resolveAgentIdentity(cfg, agentId)?.name?.trim() || "assistant";
164
- const basePrompt = voiceConfig.responseSystemPrompt ?? `You are ${agentName}, a helpful voice assistant on a phone call. Keep responses brief and conversational (1-2 sentences max). Be natural and friendly. The caller's phone number is ${from}. You have access to tools - use them when helpful.`;
165
- let extraSystemPrompt = basePrompt;
166
- if (transcript.length > 0) extraSystemPrompt = `${basePrompt}\n\nConversation so far:\n${transcript.map((entry) => `${entry.speaker === "bot" ? "You" : "Caller"}: ${entry.text}`).join("\n")}`;
167
- extraSystemPrompt = `${extraSystemPrompt}\n\n${VOICE_SPOKEN_OUTPUT_CONTRACT}`;
168
- const timeoutMs = voiceConfig.responseTimeoutMs ?? agentRuntime.resolveAgentTimeoutMs({ cfg });
169
- const runId = `voice:${callId}:${Date.now()}`;
170
- try {
171
- const result = await agentRuntime.runEmbeddedAgent({
172
- sessionId,
173
- sessionKey: resolvedSessionKey,
174
- sessionTarget: {
175
- agentId,
176
- sessionId,
177
- sessionKey: resolvedSessionKey,
178
- storePath
179
- },
180
- sandboxSessionKey: resolveVoiceSandboxSessionKey(agentId, resolvedSessionKey),
181
- agentId,
182
- messageProvider: "voice",
183
- workspaceDir,
184
- config: cfg,
185
- prompt: userMessage,
186
- provider,
187
- model,
188
- thinkLevel,
189
- verboseLevel: "off",
190
- timeoutMs,
191
- runId,
192
- lane: "voice",
193
- extraSystemPrompt,
194
- agentDir,
195
- toolsAllow
196
- });
197
- const text = extractSpokenTextFromPayloads(result.payloads ?? []);
198
- if (!text && result.meta?.aborted) return {
199
- text: null,
200
- error: "Response generation was aborted"
201
- };
202
- return { text };
203
- } catch (err) {
204
- console.error(`[voice-call] Response generation failed:`, err);
205
- return {
206
- text: null,
207
- error: String(err)
208
- };
209
- }
210
- }
211
- //#endregion
212
- export { generateVoiceResponse };
@@ -1,16 +0,0 @@
1
- import commander from './index.js';
2
-
3
- // wrapper to provide named exports for ESM.
4
- export const {
5
- program,
6
- createCommand,
7
- createArgument,
8
- createOption,
9
- CommanderError,
10
- InvalidArgumentError,
11
- InvalidOptionArgumentError, // deprecated old name
12
- Command,
13
- Argument,
14
- Option,
15
- Help,
16
- } = commander;
@@ -1,3 +0,0 @@
1
- // Just reexport the types from cjs
2
- // This is a bit indirect. There is not an index.js, but TypeScript will look for index.d.ts for types.
3
- export * from './index.js';
@@ -1,6 +0,0 @@
1
- import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
3
- import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildGuard(_stack: Stack, _context: BuildContext, schema: Schema.XGuard, value: string): string;
5
- export declare function CheckGuard(_stack: Stack, _context: CheckContext, schema: Schema.XGuard, value: unknown): boolean;
6
- export declare function ErrorGuard(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XGuard, value: unknown): boolean;
@@ -1,26 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import * as Externals from './_externals.mjs';
3
- import { EmitGuard as E } from '../../guard/index.mjs';
4
- // ------------------------------------------------------------------
5
- // Build
6
- // ------------------------------------------------------------------
7
- export function BuildGuard(_stack, _context, schema, value) {
8
- return E.Call(E.Member(E.Member(Externals.CreateVariable(schema), '~guard'), 'check'), [value]);
9
- }
10
- // ------------------------------------------------------------------
11
- // Check
12
- // ------------------------------------------------------------------
13
- export function CheckGuard(_stack, _context, schema, value) {
14
- return schema['~guard'].check(value);
15
- }
16
- // ------------------------------------------------------------------
17
- // Error
18
- // ------------------------------------------------------------------
19
- export function ErrorGuard(_stack, context, schemaPath, instancePath, schema, value) {
20
- return schema['~guard'].check(value) || context.AddError({
21
- keyword: '~guard',
22
- schemaPath,
23
- instancePath,
24
- params: { errors: schema['~guard'].errors(value) },
25
- });
26
- }
@@ -1,10 +0,0 @@
1
- import type { XSchemaObject } from './schema.mjs';
2
- export interface XGuardInterface<Value extends unknown = unknown> {
3
- check(value: unknown): value is Value;
4
- errors(value: unknown): object[];
5
- }
6
- export interface XGuard<Value extends unknown = unknown> {
7
- '~guard': XGuardInterface<Value>;
8
- }
9
- export declare function IsGuardInterface(value: unknown): value is XGuardInterface;
10
- export declare function IsGuard(value: XSchemaObject): value is XGuard;
@@ -1,16 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- // ------------------------------------------------------------------
4
- // Guard
5
- // ------------------------------------------------------------------
6
- export function IsGuardInterface(value) {
7
- return Guard.IsObject(value)
8
- && Guard.HasPropertyKey(value, 'check')
9
- && Guard.HasPropertyKey(value, 'errors')
10
- && Guard.IsFunction(value.check)
11
- && Guard.IsFunction(value.errors);
12
- }
13
- export function IsGuard(value) {
14
- return Guard.HasPropertyKey(value, '~guard')
15
- && IsGuardInterface(value['~guard']);
16
- }