veryfront 0.1.324 → 0.1.326

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 (271) hide show
  1. package/esm/cli/commands/extension/init-command.js +2 -2
  2. package/esm/cli/commands/extension/validate-command.js +1 -1
  3. package/esm/deno.d.ts +7 -0
  4. package/esm/deno.js +8 -1
  5. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +2 -0
  6. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +1 -0
  7. package/esm/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
  8. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +2 -0
  9. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +1 -0
  10. package/esm/deps/esm.sh/scheduler@^0.27.0.js +3 -0
  11. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +30 -0
  12. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts.map +1 -0
  13. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +47 -0
  14. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +29 -0
  15. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +65 -0
  17. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +17 -0
  18. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +23 -0
  20. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +26 -0
  21. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +30 -0
  23. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +25 -0
  24. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts.map +1 -0
  25. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +194 -0
  26. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +37 -0
  27. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +61 -0
  29. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +18 -0
  30. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +27 -0
  32. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +15 -0
  33. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +20 -0
  35. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +19 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +23 -0
  38. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +20 -0
  39. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +29 -0
  41. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +20 -0
  42. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +29 -0
  44. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +23 -0
  45. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +52 -0
  47. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +25 -0
  48. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +53 -0
  50. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +19 -0
  51. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +28 -0
  53. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +20 -0
  54. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +29 -0
  56. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +18 -0
  57. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +26 -0
  59. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +44 -0
  60. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +45 -0
  62. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +27 -0
  63. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +39 -0
  65. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +20 -0
  66. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +29 -0
  68. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +18 -0
  69. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +26 -0
  71. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +23 -0
  72. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts.map +1 -0
  73. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +32 -0
  74. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +29 -0
  75. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts.map +1 -0
  76. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +177 -0
  77. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +42 -0
  78. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +53 -0
  80. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +24 -0
  81. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts.map +1 -0
  82. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +58 -0
  83. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +18 -0
  84. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts.map +1 -0
  85. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +26 -0
  86. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +45 -0
  87. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts.map +1 -0
  88. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +44 -0
  89. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +15 -0
  90. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts.map +1 -0
  91. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +20 -0
  92. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +15 -0
  93. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts.map +1 -0
  94. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +20 -0
  95. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts +150 -0
  96. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts.map +1 -0
  97. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.js +224 -0
  98. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts +80 -0
  99. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts.map +1 -0
  100. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.js +116 -0
  101. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts +140 -0
  102. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts.map +1 -0
  103. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.js +276 -0
  104. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts +99 -0
  105. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts.map +1 -0
  106. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.js +182 -0
  107. package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts +29 -0
  108. package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts.map +1 -0
  109. package/esm/deps/jsr.io/@std/internal/1.0.13/format.js +70 -0
  110. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts +159 -0
  111. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts.map +1 -0
  112. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.js +207 -0
  113. package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts +25 -0
  114. package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts.map +1 -0
  115. package/esm/deps/jsr.io/@std/internal/1.0.13/types.js +3 -0
  116. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts +80 -0
  117. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts.map +1 -0
  118. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.js +348 -0
  119. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts +738 -0
  120. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts.map +1 -0
  121. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.js +656 -0
  122. package/esm/src/agent/fork-runtime-stream.d.ts +143 -0
  123. package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -0
  124. package/esm/src/agent/fork-runtime-stream.js +505 -0
  125. package/esm/src/agent/index.d.ts +1 -0
  126. package/esm/src/agent/index.d.ts.map +1 -1
  127. package/esm/src/agent/index.js +1 -0
  128. package/esm/src/chat/conversation.d.ts +5 -5
  129. package/esm/src/modules/index.d.ts +12 -0
  130. package/esm/src/modules/index.d.ts.map +1 -0
  131. package/esm/src/modules/index.js +10 -0
  132. package/esm/src/modules/module-resolver.d.ts +28 -0
  133. package/esm/src/modules/module-resolver.d.ts.map +1 -0
  134. package/esm/src/modules/module-resolver.js +106 -0
  135. package/esm/src/rendering/cleanup.d.ts +7 -0
  136. package/esm/src/rendering/cleanup.d.ts.map +1 -0
  137. package/esm/src/rendering/cleanup.js +22 -0
  138. package/esm/src/rendering/ssr/index.d.ts +10 -0
  139. package/esm/src/rendering/ssr/index.d.ts.map +1 -0
  140. package/esm/src/rendering/ssr/index.js +8 -0
  141. package/esm/src/rendering/ssr/mdx-module-loader.d.ts +5 -0
  142. package/esm/src/rendering/ssr/mdx-module-loader.d.ts.map +1 -0
  143. package/esm/src/rendering/ssr/mdx-module-loader.js +150 -0
  144. package/esm/src/rendering/ssr/mdx-renderer.d.ts +4 -0
  145. package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -0
  146. package/esm/src/rendering/ssr/mdx-renderer.js +44 -0
  147. package/esm/src/rendering/ssr/types.d.ts +13 -0
  148. package/esm/src/rendering/ssr/types.d.ts.map +1 -0
  149. package/esm/src/rendering/ssr/types.js +1 -0
  150. package/esm/src/sandbox/index.d.ts +1 -0
  151. package/esm/src/sandbox/index.d.ts.map +1 -1
  152. package/esm/src/sandbox/index.js +1 -0
  153. package/esm/src/sandbox/shell-tools.d.ts +39 -0
  154. package/esm/src/sandbox/shell-tools.d.ts.map +1 -0
  155. package/esm/src/sandbox/shell-tools.js +177 -0
  156. package/esm/src/server/shared/index.d.ts +7 -0
  157. package/esm/src/server/shared/index.d.ts.map +1 -0
  158. package/esm/src/server/shared/index.js +6 -0
  159. package/esm/src/testing/assert.d.ts +22 -0
  160. package/esm/src/testing/assert.d.ts.map +1 -0
  161. package/esm/src/testing/assert.js +217 -0
  162. package/esm/src/testing/bdd.d.ts +67 -0
  163. package/esm/src/testing/bdd.d.ts.map +1 -0
  164. package/esm/src/testing/bdd.js +401 -0
  165. package/esm/src/testing/deno-compat.d.ts +26 -0
  166. package/esm/src/testing/deno-compat.d.ts.map +1 -0
  167. package/esm/src/testing/deno-compat.js +146 -0
  168. package/esm/src/testing/index.d.ts +28 -0
  169. package/esm/src/testing/index.d.ts.map +1 -0
  170. package/esm/src/testing/index.js +27 -0
  171. package/esm/src/testing/init.d.ts +2 -0
  172. package/esm/src/testing/init.d.ts.map +1 -0
  173. package/esm/src/testing/init.js +18 -0
  174. package/esm/src/testing/isolation.d.ts +30 -0
  175. package/esm/src/testing/isolation.d.ts.map +1 -0
  176. package/esm/src/testing/isolation.js +151 -0
  177. package/esm/src/testing/timing.d.ts +4 -0
  178. package/esm/src/testing/timing.d.ts.map +1 -0
  179. package/esm/src/testing/timing.js +22 -0
  180. package/esm/src/testing/utils.d.ts +6 -0
  181. package/esm/src/testing/utils.d.ts.map +1 -0
  182. package/esm/src/testing/utils.js +49 -0
  183. package/esm/src/types/global-guards.d.ts +11 -0
  184. package/esm/src/types/global-guards.d.ts.map +1 -0
  185. package/esm/src/types/global-guards.js +12 -0
  186. package/esm/src/utils/cache/keys/namespace.d.ts +3 -0
  187. package/esm/src/utils/cache/keys/namespace.d.ts.map +1 -0
  188. package/esm/src/utils/cache/keys/namespace.js +19 -0
  189. package/esm/src/utils/clsx.d.ts +3 -3
  190. package/esm/src/utils/clsx.d.ts.map +1 -1
  191. package/esm/src/utils/clsx.js +2 -3
  192. package/esm/src/utils/mime-types.d.ts +0 -6
  193. package/esm/src/utils/mime-types.d.ts.map +1 -1
  194. package/esm/src/utils/mime-types.js +0 -1
  195. package/esm/src/utils/version-constant.d.ts +1 -1
  196. package/esm/src/utils/version-constant.js +1 -1
  197. package/package.json +14 -1
  198. package/src/cli/commands/extension/init-command.ts +2 -2
  199. package/src/cli/commands/extension/validate-command.ts +1 -1
  200. package/src/deno.js +8 -1
  201. package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +105 -0
  202. package/src/deps/esm.sh/@types/react@19.2.3/global.d.ts +165 -0
  203. package/src/deps/esm.sh/@types/react@19.2.3/index.d.ts +4301 -0
  204. package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
  205. package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
  206. package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +105 -0
  207. package/src/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
  208. package/src/deps/esm.sh/scheduler@^0.27.0.d.ts +30 -0
  209. package/src/deps/esm.sh/scheduler@^0.27.0.js +3 -0
  210. package/src/deps/jsr.io/@std/assert/1.0.19/almost_equals.ts +56 -0
  211. package/src/deps/jsr.io/@std/assert/1.0.19/array_includes.ts +76 -0
  212. package/src/deps/jsr.io/@std/assert/1.0.19/assert.ts +24 -0
  213. package/src/deps/jsr.io/@std/assert/1.0.19/assertion_error.ts +31 -0
  214. package/src/deps/jsr.io/@std/assert/1.0.19/equal.ts +226 -0
  215. package/src/deps/jsr.io/@std/assert/1.0.19/equals.ts +68 -0
  216. package/src/deps/jsr.io/@std/assert/1.0.19/exists.ts +31 -0
  217. package/src/deps/jsr.io/@std/assert/1.0.19/fail.ts +21 -0
  218. package/src/deps/jsr.io/@std/assert/1.0.19/false.ts +27 -0
  219. package/src/deps/jsr.io/@std/assert/1.0.19/greater.ts +30 -0
  220. package/src/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.ts +36 -0
  221. package/src/deps/jsr.io/@std/assert/1.0.19/instance_of.ts +64 -0
  222. package/src/deps/jsr.io/@std/assert/1.0.19/is_error.ts +65 -0
  223. package/src/deps/jsr.io/@std/assert/1.0.19/less.ts +29 -0
  224. package/src/deps/jsr.io/@std/assert/1.0.19/less_or_equal.ts +36 -0
  225. package/src/deps/jsr.io/@std/assert/1.0.19/match.ts +30 -0
  226. package/src/deps/jsr.io/@std/assert/1.0.19/mod.ts +47 -0
  227. package/src/deps/jsr.io/@std/assert/1.0.19/not_equals.ts +43 -0
  228. package/src/deps/jsr.io/@std/assert/1.0.19/not_instance_of.ts +33 -0
  229. package/src/deps/jsr.io/@std/assert/1.0.19/not_match.ts +30 -0
  230. package/src/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.ts +42 -0
  231. package/src/deps/jsr.io/@std/assert/1.0.19/object_match.ts +224 -0
  232. package/src/deps/jsr.io/@std/assert/1.0.19/rejects.ts +123 -0
  233. package/src/deps/jsr.io/@std/assert/1.0.19/strict_equals.ts +68 -0
  234. package/src/deps/jsr.io/@std/assert/1.0.19/string_includes.ts +30 -0
  235. package/src/deps/jsr.io/@std/assert/1.0.19/throws.ts +111 -0
  236. package/src/deps/jsr.io/@std/assert/1.0.19/unimplemented.ts +21 -0
  237. package/src/deps/jsr.io/@std/assert/1.0.19/unreachable.ts +21 -0
  238. package/src/deps/jsr.io/@std/internal/1.0.13/assertion_state.ts +248 -0
  239. package/src/deps/jsr.io/@std/internal/1.0.13/build_message.ts +147 -0
  240. package/src/deps/jsr.io/@std/internal/1.0.13/diff.ts +317 -0
  241. package/src/deps/jsr.io/@std/internal/1.0.13/diff_str.ts +208 -0
  242. package/src/deps/jsr.io/@std/internal/1.0.13/format.ts +89 -0
  243. package/src/deps/jsr.io/@std/internal/1.0.13/styles.ts +233 -0
  244. package/src/deps/jsr.io/@std/internal/1.0.13/types.ts +30 -0
  245. package/src/deps/jsr.io/@std/testing/1.0.18/_test_suite.ts +461 -0
  246. package/src/deps/jsr.io/@std/testing/1.0.18/bdd.ts +1294 -0
  247. package/src/src/agent/fork-runtime-stream.ts +780 -0
  248. package/src/src/agent/index.ts +16 -0
  249. package/src/src/modules/index.ts +43 -0
  250. package/src/src/modules/module-resolver.ts +145 -0
  251. package/src/src/rendering/cleanup.ts +27 -0
  252. package/src/src/rendering/ssr/index.ts +10 -0
  253. package/src/src/rendering/ssr/mdx-module-loader.ts +185 -0
  254. package/src/src/rendering/ssr/mdx-renderer.ts +66 -0
  255. package/src/src/rendering/ssr/types.ts +14 -0
  256. package/src/src/sandbox/index.ts +9 -0
  257. package/src/src/sandbox/shell-tools.ts +242 -0
  258. package/src/src/server/shared/index.ts +12 -0
  259. package/src/src/testing/assert.ts +352 -0
  260. package/src/src/testing/bdd.ts +618 -0
  261. package/src/src/testing/deno-compat.ts +206 -0
  262. package/src/src/testing/index.ts +92 -0
  263. package/src/src/testing/init.ts +21 -0
  264. package/src/src/testing/isolation.ts +177 -0
  265. package/src/src/testing/timing.ts +27 -0
  266. package/src/src/testing/utils.ts +44 -0
  267. package/src/src/types/global-guards.ts +21 -0
  268. package/src/src/utils/cache/keys/namespace.ts +25 -0
  269. package/src/src/utils/clsx.ts +2 -4
  270. package/src/src/utils/mime-types.ts +0 -2
  271. package/src/src/utils/version-constant.ts +1 -1
@@ -0,0 +1,242 @@
1
+ import type { Tool, ToolExecutionContext } from "../tool/index.js";
2
+ import type { JsonSchema } from "../tool/schema/json-schema.js";
3
+
4
+ const SANDBOX_WORKING_DIRECTORY = "/workspace";
5
+ const SANDBOX_TOOL_PROMPT =
6
+ "Available tools: agent-browser, awk, cat, column, comm, curl, cut, diff, expand, find, fold, grep, head, iconv, join, jq, nl, node, od, paste, printf, python3, rev, sed, sort, split, strings, tail, tee, tr, unexpand, uniq, veryfront, wc, xargs, xxd, yq, and more";
7
+
8
+ const JSON_SCHEMA_TYPES: ReadonlySet<string> = new Set([
9
+ "string",
10
+ "number",
11
+ "integer",
12
+ "boolean",
13
+ "object",
14
+ "array",
15
+ "null",
16
+ ]);
17
+
18
+ type SandboxShellToolExecute = {
19
+ bivarianceHack: (input: unknown, options?: ToolExecutionContext) => Promise<unknown> | unknown;
20
+ }["bivarianceHack"];
21
+
22
+ export type SandboxShellToolDefinition = {
23
+ id?: string;
24
+ type?: Tool["type"];
25
+ title?: string;
26
+ description?: string;
27
+ inputSchema?: unknown;
28
+ inputSchemaJson?: JsonSchema;
29
+ parameters?: unknown;
30
+ providerOptions?: unknown;
31
+ execute?: Tool["execute"] | SandboxShellToolExecute;
32
+ mcp?: Tool["mcp"];
33
+ };
34
+
35
+ export type SandboxShellToolSet = Record<string, SandboxShellToolDefinition>;
36
+
37
+ export type BashToolSandboxLike = {
38
+ ensure?: () => Promise<void> | void;
39
+ executeCommand: (command: string, options?: unknown) => Promise<unknown>;
40
+ readFile?: (path: string) => Promise<unknown> | unknown;
41
+ writeFiles?: (files: unknown[]) => Promise<unknown> | unknown;
42
+ };
43
+
44
+ type CreateBashToolInput = {
45
+ sandbox: BashToolSandboxLike;
46
+ destination: string;
47
+ promptOptions: {
48
+ toolPrompt: string;
49
+ };
50
+ };
51
+
52
+ export type CreateSandboxBashTool = (
53
+ input: CreateBashToolInput,
54
+ ) => Promise<{ tools: Record<string, unknown> }>;
55
+
56
+ function isRecord(value: unknown): value is Record<string, unknown> {
57
+ return typeof value === "object" && value !== null && !Array.isArray(value);
58
+ }
59
+
60
+ function normalizeJsonSchemaType(value: unknown): JsonSchema["type"] | undefined {
61
+ if (typeof value !== "string" || !JSON_SCHEMA_TYPES.has(value)) {
62
+ return undefined;
63
+ }
64
+
65
+ switch (value) {
66
+ case "string":
67
+ case "number":
68
+ case "integer":
69
+ case "boolean":
70
+ case "object":
71
+ case "array":
72
+ case "null":
73
+ return value;
74
+ }
75
+ }
76
+
77
+ function normalizeStringArray(value: unknown): string[] | undefined {
78
+ if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
79
+ return undefined;
80
+ }
81
+
82
+ return value.map(String);
83
+ }
84
+
85
+ function normalizeJsonSchemaArray(value: unknown): JsonSchema[] | undefined {
86
+ if (!Array.isArray(value)) {
87
+ return undefined;
88
+ }
89
+
90
+ const schemas = value.map(normalizeJsonSchema).filter((schema) => schema !== undefined);
91
+ return schemas.length === value.length ? schemas : undefined;
92
+ }
93
+
94
+ function normalizeJsonSchemaProperties(value: unknown): Record<string, JsonSchema> | undefined {
95
+ if (!isRecord(value)) {
96
+ return undefined;
97
+ }
98
+
99
+ const properties: Record<string, JsonSchema> = {};
100
+ for (const [key, propertyValue] of Object.entries(value)) {
101
+ const schema = normalizeJsonSchema(propertyValue);
102
+ if (schema === undefined) {
103
+ return undefined;
104
+ }
105
+ properties[key] = schema;
106
+ }
107
+ return properties;
108
+ }
109
+
110
+ function normalizeJsonSchema(value: unknown): JsonSchema | undefined {
111
+ if (!isRecord(value)) {
112
+ return undefined;
113
+ }
114
+
115
+ const schema: JsonSchema = {};
116
+ const type = normalizeJsonSchemaType(value.type);
117
+ const description = typeof value.description === "string" ? value.description : undefined;
118
+ const required = normalizeStringArray(value.required);
119
+ const properties = normalizeJsonSchemaProperties(value.properties);
120
+ const items = normalizeJsonSchema(value.items);
121
+ const anyOf = normalizeJsonSchemaArray(value.anyOf);
122
+ const prefixItems = normalizeJsonSchemaArray(value.prefixItems);
123
+
124
+ if (type !== undefined) schema.type = type;
125
+ if (description !== undefined) schema.description = description;
126
+ if (Array.isArray(value.enum)) schema.enum = [...value.enum];
127
+ if ("const" in value) schema.const = value.const;
128
+ if ("default" in value) schema.default = value.default;
129
+ if (properties !== undefined) schema.properties = properties;
130
+ if (required !== undefined) schema.required = required;
131
+ if (items !== undefined) schema.items = items;
132
+ if (typeof value.additionalProperties === "boolean") {
133
+ schema.additionalProperties = value.additionalProperties;
134
+ } else {
135
+ const additionalProperties = normalizeJsonSchema(value.additionalProperties);
136
+ if (additionalProperties !== undefined) schema.additionalProperties = additionalProperties;
137
+ }
138
+ if (anyOf !== undefined) schema.anyOf = anyOf;
139
+ if (prefixItems !== undefined) schema.prefixItems = prefixItems;
140
+ if (typeof value.minItems === "number") schema.minItems = value.minItems;
141
+ if (typeof value.maxItems === "number") schema.maxItems = value.maxItems;
142
+
143
+ return schema;
144
+ }
145
+
146
+ function normalizeBashTool(toolDefinition: unknown): SandboxShellToolDefinition {
147
+ if (!isRecord(toolDefinition)) {
148
+ return {};
149
+ }
150
+
151
+ const normalized: SandboxShellToolDefinition = {};
152
+ const id = toolDefinition.id;
153
+ const type = toolDefinition.type;
154
+ const description = toolDefinition.description;
155
+ const inputSchema = toolDefinition.inputSchema;
156
+ const inputSchemaJson = normalizeJsonSchema(toolDefinition.inputSchemaJson);
157
+ const executeCandidate = toolDefinition.execute;
158
+ const mcp = toolDefinition.mcp;
159
+
160
+ if (typeof id === "string") {
161
+ normalized.id = id;
162
+ }
163
+ if (type === "function" || type === "dynamic") {
164
+ normalized.type = type;
165
+ }
166
+ if (typeof description === "string") {
167
+ normalized.description = description;
168
+ }
169
+ if (inputSchema !== undefined) {
170
+ normalized.inputSchema = inputSchema;
171
+ }
172
+ if (inputSchemaJson !== undefined) {
173
+ normalized.inputSchemaJson = inputSchemaJson;
174
+ }
175
+ if (typeof executeCandidate === "function") {
176
+ normalized.execute = async (input: unknown, options?: ToolExecutionContext) =>
177
+ executeCandidate(input, options);
178
+ }
179
+ if (isRecord(mcp)) {
180
+ normalized.mcp = Object.fromEntries(Object.entries(mcp));
181
+ }
182
+
183
+ return normalized;
184
+ }
185
+
186
+ export function normalizeBashToolSet(bashTools: Record<string, unknown>): SandboxShellToolSet {
187
+ return Object.fromEntries(
188
+ Object.entries(bashTools).map((
189
+ [name, toolDefinition],
190
+ ) => [name, normalizeBashTool(toolDefinition)]),
191
+ );
192
+ }
193
+
194
+ export function renameSandboxFileTools(bashTools: SandboxShellToolSet): SandboxShellToolSet {
195
+ const tools: SandboxShellToolSet = { ...bashTools };
196
+
197
+ const sandboxReadFile = tools.readFile;
198
+ if (sandboxReadFile) {
199
+ tools.sandbox_read_file = {
200
+ ...sandboxReadFile,
201
+ description:
202
+ "Read a file from the sandbox /workspace filesystem only. This does NOT read project files stored in Veryfront. Use project file tools like get_file/get_files for real project source.",
203
+ };
204
+ delete tools.readFile;
205
+ }
206
+
207
+ const sandboxWriteFile = tools.writeFile;
208
+ if (sandboxWriteFile) {
209
+ tools.sandbox_write_file = {
210
+ ...sandboxWriteFile,
211
+ description:
212
+ "Write a file inside the sandbox /workspace filesystem only. This does NOT update project files stored in Veryfront. Use project file tools like create_file/update_file for real project source.",
213
+ };
214
+ delete tools.writeFile;
215
+ }
216
+
217
+ const sandboxBash = tools.bash;
218
+ if (sandboxBash) {
219
+ tools.bash = {
220
+ ...sandboxBash,
221
+ description:
222
+ "Run shell commands in the sandbox /workspace environment. This is for temporary shell work only and does NOT provide direct access to Veryfront project files.",
223
+ };
224
+ }
225
+
226
+ return tools;
227
+ }
228
+
229
+ export async function createSandboxShellTools(
230
+ sandbox: BashToolSandboxLike,
231
+ createBashTool: CreateSandboxBashTool,
232
+ ): Promise<SandboxShellToolSet> {
233
+ const { tools: bashTools } = await createBashTool({
234
+ sandbox,
235
+ destination: SANDBOX_WORKING_DIRECTORY,
236
+ promptOptions: {
237
+ toolPrompt: SANDBOX_TOOL_PROMPT,
238
+ },
239
+ });
240
+
241
+ return renameSandboxFileTools(normalizeBashToolSet(bashTools));
242
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Server Shared
3
+ *
4
+ * @module server/shared
5
+ */
6
+
7
+ export {
8
+ destroyRendererAdapter,
9
+ getRendererForProject,
10
+ type RendererAdapter,
11
+ shouldRejectDueToMemory,
12
+ } from "./renderer-factory.js";
@@ -0,0 +1,352 @@
1
+ import "../../_dnt.polyfills.js";
2
+ import "./init.js";
3
+ import { isDeno } from "../platform/compat/runtime.js";
4
+ import { deepEquals, safeStringify } from "./utils.js";
5
+
6
+ // deno-lint-ignore no-explicit-any -- any[] required: constructor params are contravariant
7
+ type ErrorClass = new (...args: any[]) => Error;
8
+
9
+ interface AssertImpl {
10
+ assertEquals<T>(actual: T, expected: T, msg?: string): void;
11
+ assertNotEquals<T>(actual: T, expected: T, msg?: string): void;
12
+ assertStrictEquals<T>(actual: T, expected: T, msg?: string): void;
13
+ assert(expr: unknown, msg?: string): void;
14
+ assertExists<T>(actual: T, msg?: string): void;
15
+ assertThrows(
16
+ fn: () => unknown,
17
+ errorClassOrMsg?: ErrorClass | string,
18
+ msgIncludesOrMsg?: string,
19
+ msg?: string,
20
+ ): void;
21
+ assertRejects(
22
+ fn: () => Promise<unknown>,
23
+ errorClassOrMsg?: ErrorClass | string,
24
+ msgIncludesOrMsg?: string,
25
+ msg?: string,
26
+ ): Promise<unknown>;
27
+ assertStringIncludes(actual: string, expected: string, msg?: string): void;
28
+ assertMatch(actual: string, expected: RegExp, msg?: string): void;
29
+ assertInstanceOf<T>(
30
+ actual: unknown,
31
+ // deno-lint-ignore no-explicit-any -- any[] required: constructor params are contravariant
32
+ expectedType: abstract new (...args: any[]) => T,
33
+ msg?: string,
34
+ ): void;
35
+ fail(msg?: string): never;
36
+ assertNotStrictEquals<T>(actual: T, expected: T, msg?: string): void;
37
+ assertObjectMatch(
38
+ actual: Record<string, unknown>,
39
+ expected: Record<string, unknown>,
40
+ msg?: string,
41
+ ): void;
42
+ assertGreater(actual: number, expected: number, msg?: string): void;
43
+ assertGreaterOrEqual(actual: number, expected: number, msg?: string): void;
44
+ assertLess(actual: number, expected: number, msg?: string): void;
45
+ assertLessOrEqual(actual: number, expected: number, msg?: string): void;
46
+ }
47
+
48
+ function createNodeAssertImpl(): AssertImpl {
49
+ function assertErrorMessageIncludes(error: unknown, includes?: string): void {
50
+ if (!includes) return;
51
+ if (!(error instanceof Error)) return;
52
+
53
+ if (error.message.includes(includes)) return;
54
+ throw new Error(`Expected error message to include "${includes}", got "${error.message}"`);
55
+ }
56
+
57
+ function assertThrowsOrRejects(
58
+ threw: boolean,
59
+ error: unknown,
60
+ errorClassOrMsg?: ErrorClass | string,
61
+ msgIncludesOrMsg?: string,
62
+ defaultMsg?: string,
63
+ ): void {
64
+ if (!threw) {
65
+ throw new Error(typeof errorClassOrMsg === "string" ? errorClassOrMsg : defaultMsg);
66
+ }
67
+
68
+ if (typeof errorClassOrMsg !== "function") return;
69
+
70
+ if (!(error instanceof errorClassOrMsg)) {
71
+ throw new Error(
72
+ `Expected error to be instance of ${errorClassOrMsg.name}, got ${
73
+ (error as Error | undefined)?.name ?? typeof error
74
+ }`,
75
+ );
76
+ }
77
+
78
+ assertErrorMessageIncludes(error, msgIncludesOrMsg);
79
+ }
80
+
81
+ function assertObjectMatch(
82
+ actual: Record<string, unknown>,
83
+ expected: Record<string, unknown>,
84
+ msg?: string,
85
+ ): void {
86
+ for (const key of Object.keys(expected)) {
87
+ const actualVal = actual[key];
88
+ const expectedVal = expected[key];
89
+
90
+ if (typeof expectedVal === "object" && expectedVal !== null) {
91
+ if (typeof actualVal !== "object" || actualVal === null) {
92
+ throw new Error(msg || `Expected ${key} to be an object`);
93
+ }
94
+
95
+ assertObjectMatch(
96
+ actualVal as Record<string, unknown>,
97
+ expectedVal as Record<string, unknown>,
98
+ msg,
99
+ );
100
+ continue;
101
+ }
102
+
103
+ if (actualVal === expectedVal) continue;
104
+
105
+ throw new Error(
106
+ msg ||
107
+ `Expected ${key} to be ${JSON.stringify(expectedVal)}, got ${JSON.stringify(actualVal)}`,
108
+ );
109
+ }
110
+ }
111
+
112
+ return {
113
+ assertEquals<T>(actual: T, expected: T, msg?: string): void {
114
+ if (deepEquals(actual, expected)) return;
115
+ throw new Error(msg || `Expected ${safeStringify(expected)}, got ${safeStringify(actual)}`);
116
+ },
117
+
118
+ assertNotEquals<T>(actual: T, expected: T, msg?: string): void {
119
+ if (!deepEquals(actual, expected)) return;
120
+ throw new Error(msg || `Expected values to not be equal: ${safeStringify(actual)}`);
121
+ },
122
+
123
+ assertStrictEquals<T>(actual: T, expected: T, msg?: string): void {
124
+ if (actual === expected) return;
125
+ throw new Error(msg || `Expected ${expected}, got ${actual}`);
126
+ },
127
+
128
+ assert(expr: unknown, msg?: string): void {
129
+ if (expr) return;
130
+ throw new Error(msg || "Assertion failed: expected truthy value");
131
+ },
132
+
133
+ assertExists<T>(actual: T, msg?: string): void {
134
+ if (actual !== null && actual !== undefined) return;
135
+ throw new Error(msg || `Expected value to exist, but got ${actual}`);
136
+ },
137
+
138
+ assertThrows(
139
+ fn: () => unknown,
140
+ errorClassOrMsg?: ErrorClass | string,
141
+ msgIncludesOrMsg?: string,
142
+ _msg?: string,
143
+ ): void {
144
+ let threw = false;
145
+ let error: unknown;
146
+
147
+ try {
148
+ fn();
149
+ } catch (e) {
150
+ threw = true;
151
+ error = e;
152
+ }
153
+
154
+ assertThrowsOrRejects(
155
+ threw,
156
+ error,
157
+ errorClassOrMsg,
158
+ msgIncludesOrMsg,
159
+ "Expected function to throw",
160
+ );
161
+ },
162
+
163
+ async assertRejects(
164
+ fn: () => Promise<unknown>,
165
+ errorClassOrMsg?: ErrorClass | string,
166
+ msgIncludesOrMsg?: string,
167
+ _msg?: string,
168
+ ): Promise<void> {
169
+ let threw = false;
170
+ let error: unknown;
171
+
172
+ try {
173
+ await fn();
174
+ } catch (e) {
175
+ threw = true;
176
+ error = e;
177
+ }
178
+
179
+ assertThrowsOrRejects(
180
+ threw,
181
+ error,
182
+ errorClassOrMsg,
183
+ msgIncludesOrMsg,
184
+ "Expected function to reject",
185
+ );
186
+ },
187
+
188
+ assertStringIncludes(actual: string, expected: string, msg?: string): void {
189
+ if (actual.includes(expected)) return;
190
+ throw new Error(msg || `Expected "${actual}" to include "${expected}"`);
191
+ },
192
+
193
+ assertMatch(actual: string, expected: RegExp, msg?: string): void {
194
+ if (expected.test(actual)) return;
195
+ throw new Error(msg || `Expected "${actual}" to match ${expected}`);
196
+ },
197
+
198
+ assertInstanceOf<T>(
199
+ actual: unknown,
200
+ expectedType: new (...args: unknown[]) => T,
201
+ msg?: string,
202
+ ): void {
203
+ if (actual instanceof expectedType) return;
204
+ throw new Error(msg || `Expected instance of ${expectedType.name}, got ${typeof actual}`);
205
+ },
206
+
207
+ fail(msg?: string): never {
208
+ throw new Error(msg || "Test failed");
209
+ },
210
+
211
+ assertNotStrictEquals<T>(actual: T, expected: T, msg?: string): void {
212
+ if (actual !== expected) return;
213
+ throw new Error(msg || "Expected values to not be strictly equal");
214
+ },
215
+
216
+ assertObjectMatch,
217
+
218
+ assertGreater(actual: number, expected: number, msg?: string): void {
219
+ if (actual > expected) return;
220
+ throw new Error(msg || `Expected ${actual} to be greater than ${expected}`);
221
+ },
222
+
223
+ assertGreaterOrEqual(actual: number, expected: number, msg?: string): void {
224
+ if (actual >= expected) return;
225
+ throw new Error(msg || `Expected ${actual} to be greater than or equal to ${expected}`);
226
+ },
227
+
228
+ assertLess(actual: number, expected: number, msg?: string): void {
229
+ if (actual < expected) return;
230
+ throw new Error(msg || `Expected ${actual} to be less than ${expected}`);
231
+ },
232
+
233
+ assertLessOrEqual(actual: number, expected: number, msg?: string): void {
234
+ if (actual <= expected) return;
235
+ throw new Error(msg || `Expected ${actual} to be less than or equal to ${expected}`);
236
+ },
237
+ };
238
+ }
239
+
240
+ let impl: AssertImpl;
241
+
242
+ if (isDeno) {
243
+ const denoAssert = await import("../../deps/jsr.io/@std/assert/1.0.19/mod.js");
244
+ impl = {
245
+ assertEquals: denoAssert.assertEquals,
246
+ assertNotEquals: denoAssert.assertNotEquals,
247
+ assertStrictEquals: denoAssert.assertStrictEquals,
248
+ assert: denoAssert.assert,
249
+ assertExists: denoAssert.assertExists,
250
+ assertThrows: denoAssert.assertThrows,
251
+ assertRejects: denoAssert.assertRejects,
252
+ assertStringIncludes: denoAssert.assertStringIncludes,
253
+ assertMatch: denoAssert.assertMatch,
254
+ assertInstanceOf: denoAssert.assertInstanceOf,
255
+ fail: denoAssert.fail,
256
+ assertNotStrictEquals: denoAssert.assertNotStrictEquals,
257
+ assertObjectMatch: denoAssert.assertObjectMatch,
258
+ assertGreater: denoAssert.assertGreater,
259
+ assertGreaterOrEqual: denoAssert.assertGreaterOrEqual,
260
+ assertLess: denoAssert.assertLess,
261
+ assertLessOrEqual: denoAssert.assertLessOrEqual,
262
+ };
263
+ } else {
264
+ impl = createNodeAssertImpl();
265
+ }
266
+
267
+ export function assertEquals<T>(actual: T, expected: T, msg?: string): void {
268
+ impl.assertEquals(actual, expected, msg);
269
+ }
270
+
271
+ export function assertNotEquals<T>(actual: T, expected: T, msg?: string): void {
272
+ impl.assertNotEquals(actual, expected, msg);
273
+ }
274
+
275
+ export function assertStrictEquals<T>(actual: T, expected: T, msg?: string): void {
276
+ impl.assertStrictEquals(actual, expected, msg);
277
+ }
278
+
279
+ export function assert(expr: unknown, msg?: string): asserts expr {
280
+ impl.assert(expr, msg);
281
+ }
282
+
283
+ export function assertExists<T>(actual: T, msg?: string): asserts actual is NonNullable<T> {
284
+ impl.assertExists(actual, msg);
285
+ }
286
+
287
+ export function assertThrows(
288
+ fn: () => unknown,
289
+ errorClassOrMsg?: ErrorClass | string,
290
+ msgIncludesOrMsg?: string,
291
+ msg?: string,
292
+ ): void {
293
+ impl.assertThrows(fn, errorClassOrMsg, msgIncludesOrMsg, msg);
294
+ }
295
+
296
+ export function assertRejects(
297
+ fn: () => Promise<unknown>,
298
+ errorClassOrMsg?: ErrorClass | string,
299
+ msgIncludesOrMsg?: string,
300
+ msg?: string,
301
+ ): Promise<unknown> {
302
+ return impl.assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg);
303
+ }
304
+
305
+ export function assertStringIncludes(actual: string, expected: string, msg?: string): void {
306
+ impl.assertStringIncludes(actual, expected, msg);
307
+ }
308
+
309
+ export function assertMatch(actual: string, expected: RegExp, msg?: string): void {
310
+ impl.assertMatch(actual, expected, msg);
311
+ }
312
+
313
+ export function assertInstanceOf<T>(
314
+ actual: unknown,
315
+ // deno-lint-ignore no-explicit-any -- any[] required: constructor params are contravariant
316
+ expectedType: abstract new (...args: any[]) => T,
317
+ msg?: string,
318
+ ): asserts actual is T {
319
+ impl.assertInstanceOf(actual, expectedType, msg);
320
+ }
321
+
322
+ export function fail(msg?: string): never {
323
+ impl.fail(msg);
324
+ }
325
+
326
+ export function assertNotStrictEquals<T>(actual: T, expected: T, msg?: string): void {
327
+ impl.assertNotStrictEquals(actual, expected, msg);
328
+ }
329
+
330
+ export function assertObjectMatch(
331
+ actual: Record<string, unknown>,
332
+ expected: Record<string, unknown>,
333
+ msg?: string,
334
+ ): void {
335
+ impl.assertObjectMatch(actual, expected, msg);
336
+ }
337
+
338
+ export function assertGreater(actual: number, expected: number, msg?: string): void {
339
+ impl.assertGreater(actual, expected, msg);
340
+ }
341
+
342
+ export function assertGreaterOrEqual(actual: number, expected: number, msg?: string): void {
343
+ impl.assertGreaterOrEqual(actual, expected, msg);
344
+ }
345
+
346
+ export function assertLess(actual: number, expected: number, msg?: string): void {
347
+ impl.assertLess(actual, expected, msg);
348
+ }
349
+
350
+ export function assertLessOrEqual(actual: number, expected: number, msg?: string): void {
351
+ impl.assertLessOrEqual(actual, expected, msg);
352
+ }