veryfront 0.1.47 → 0.1.49

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 (813) hide show
  1. package/esm/cli/app/components/inline-input.d.ts +1 -4
  2. package/esm/cli/app/components/inline-input.d.ts.map +1 -1
  3. package/esm/cli/app/components/inline-input.js +1 -1
  4. package/esm/cli/app/components/list-select.d.ts +0 -8
  5. package/esm/cli/app/components/list-select.d.ts.map +1 -1
  6. package/esm/cli/app/components/list-select.js +0 -13
  7. package/esm/cli/app/operations/project-creation.d.ts +2 -14
  8. package/esm/cli/app/operations/project-creation.d.ts.map +1 -1
  9. package/esm/cli/app/operations/project-creation.js +3 -68
  10. package/esm/cli/app/shell.js +2 -2
  11. package/esm/cli/app/utils.d.ts +1 -2
  12. package/esm/cli/app/utils.d.ts.map +1 -1
  13. package/esm/cli/app/utils.js +1 -17
  14. package/esm/cli/app/views/dashboard.d.ts +0 -4
  15. package/esm/cli/app/views/dashboard.d.ts.map +1 -1
  16. package/esm/cli/app/views/dashboard.js +0 -15
  17. package/esm/cli/app/views/startup.d.ts +0 -4
  18. package/esm/cli/app/views/startup.d.ts.map +1 -1
  19. package/esm/cli/app/views/startup.js +0 -7
  20. package/esm/cli/auth/login.d.ts.map +1 -1
  21. package/esm/cli/auth/login.js +1 -2
  22. package/esm/cli/auth/token-store.js +1 -1
  23. package/esm/cli/auth/utils.d.ts +2 -1
  24. package/esm/cli/auth/utils.d.ts.map +1 -1
  25. package/esm/cli/commands/build/handler.d.ts +1 -1
  26. package/esm/cli/commands/generate/integration-generator.js +1 -1
  27. package/esm/cli/commands/init/catalog.js +3 -3
  28. package/esm/cli/commands/init/command-help.js +2 -2
  29. package/esm/cli/commands/init/config-generator.d.ts.map +1 -1
  30. package/esm/cli/commands/init/config-generator.js +8 -0
  31. package/esm/cli/commands/init/types.d.ts +1 -1
  32. package/esm/cli/commands/init/types.d.ts.map +1 -1
  33. package/esm/cli/commands/install/types.d.ts +2 -2
  34. package/esm/cli/commands/merge/command.d.ts +1 -1
  35. package/esm/cli/help/formatters.d.ts +1 -1
  36. package/esm/cli/help/formatters.d.ts.map +1 -1
  37. package/esm/cli/help/formatters.js +8 -4
  38. package/esm/cli/help/main-help.d.ts.map +1 -1
  39. package/esm/cli/help/main-help.js +2 -2
  40. package/esm/cli/help/tips.js +1 -1
  41. package/esm/cli/mcp/remote-file-tools.js +1 -1
  42. package/esm/cli/mcp/server.d.ts +0 -1
  43. package/esm/cli/mcp/server.d.ts.map +1 -1
  44. package/esm/cli/mcp/server.js +2 -5
  45. package/esm/cli/mcp/tools/catalog-tools.d.ts +3 -3
  46. package/esm/cli/mcp/tools/catalog-tools.js +3 -3
  47. package/esm/cli/mcp/tools/dev-tools.d.ts +1 -1
  48. package/esm/cli/mcp/tools/dev-tools.d.ts.map +1 -1
  49. package/esm/cli/mcp/tools/dev-tools.js +1 -2
  50. package/esm/cli/mcp/tools/scaffold-tools.d.ts +2 -2
  51. package/esm/cli/mcp/tools.d.ts +1 -2
  52. package/esm/cli/mcp/tools.d.ts.map +1 -1
  53. package/esm/cli/mcp/tools.js +1 -2
  54. package/esm/cli/shared/reserve-slug.d.ts.map +1 -1
  55. package/esm/cli/shared/reserve-slug.js +1 -3
  56. package/esm/cli/sync/ignore.d.ts +1 -1
  57. package/esm/cli/sync/ignore.d.ts.map +1 -1
  58. package/esm/cli/sync/ignore.js +22 -18
  59. package/esm/cli/templates/index.js +2 -2
  60. package/esm/cli/templates/manifest.d.ts +10 -8
  61. package/esm/cli/templates/manifest.js +15 -13
  62. package/esm/cli/templates/types.d.ts +1 -1
  63. package/esm/cli/templates/types.d.ts.map +1 -1
  64. package/esm/cli/ui/colors.d.ts +0 -1
  65. package/esm/cli/ui/colors.d.ts.map +1 -1
  66. package/esm/cli/ui/colors.js +0 -10
  67. package/esm/cli/ui/dot-matrix.d.ts.map +1 -1
  68. package/esm/cli/ui/dot-matrix.js +2 -5
  69. package/esm/cli/ui/tui.js +2 -3
  70. package/esm/cli/utils/index.js +1 -2
  71. package/esm/cli/utils/package-manager.d.ts.map +1 -1
  72. package/esm/cli/utils/package-manager.js +3 -4
  73. package/esm/deno.d.ts +10 -0
  74. package/esm/deno.js +30 -20
  75. package/esm/src/agent/chat-handler.d.ts +22 -0
  76. package/esm/src/agent/chat-handler.d.ts.map +1 -1
  77. package/esm/src/agent/chat-handler.js +88 -28
  78. package/esm/src/agent/factory.d.ts +0 -8
  79. package/esm/src/agent/factory.d.ts.map +1 -1
  80. package/esm/src/agent/factory.js +50 -1
  81. package/esm/src/agent/index.d.ts +17 -2
  82. package/esm/src/agent/index.d.ts.map +1 -1
  83. package/esm/src/agent/index.js +17 -2
  84. package/esm/src/agent/memory/memory.d.ts +2 -2
  85. package/esm/src/agent/memory/memory.d.ts.map +1 -1
  86. package/esm/src/agent/memory/memory.js +0 -1
  87. package/esm/src/agent/react/index.d.ts +1 -1
  88. package/esm/src/agent/react/index.d.ts.map +1 -1
  89. package/esm/src/agent/react/use-chat/index.d.ts +1 -1
  90. package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
  91. package/esm/src/agent/react/use-chat/streaming/handler.d.ts.map +1 -1
  92. package/esm/src/agent/react/use-chat/streaming/handler.js +42 -4
  93. package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts +2 -2
  94. package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts.map +1 -1
  95. package/esm/src/agent/react/use-chat/streaming/parts-builder.js +14 -1
  96. package/esm/src/agent/react/use-chat/streaming/types.d.ts +5 -0
  97. package/esm/src/agent/react/use-chat/streaming/types.d.ts.map +1 -1
  98. package/esm/src/agent/react/use-chat/types.d.ts +23 -1
  99. package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
  100. package/esm/src/agent/react/use-chat/use-chat.d.ts +15 -1
  101. package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
  102. package/esm/src/agent/react/use-chat/use-chat.js +187 -35
  103. package/esm/src/agent/runtime/index.d.ts +18 -0
  104. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  105. package/esm/src/agent/runtime/index.js +167 -36
  106. package/esm/src/agent/runtime/tool-helpers.d.ts +6 -1
  107. package/esm/src/agent/runtime/tool-helpers.d.ts.map +1 -1
  108. package/esm/src/agent/runtime/tool-helpers.js +10 -1
  109. package/esm/src/agent/schemas/agent.schema.d.ts +4 -4
  110. package/esm/src/agent/types.d.ts +10 -0
  111. package/esm/src/agent/types.d.ts.map +1 -1
  112. package/esm/src/ai/registry-manager.d.ts.map +1 -1
  113. package/esm/src/ai/registry-manager.js +2 -1
  114. package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts +0 -2
  115. package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts.map +1 -1
  116. package/esm/src/build/bundler/code-splitter/manifest-builder.js +1 -1
  117. package/esm/src/build/compiler/mdx-compiler/validator.d.ts.map +1 -1
  118. package/esm/src/build/compiler/mdx-compiler/validator.js +2 -3
  119. package/esm/src/build/compiler/mdx-to-js.d.ts +0 -2
  120. package/esm/src/build/compiler/mdx-to-js.d.ts.map +1 -1
  121. package/esm/src/build/compiler/mdx-to-js.js +0 -81
  122. package/esm/src/build/index.d.ts +0 -6
  123. package/esm/src/build/index.d.ts.map +1 -1
  124. package/esm/src/build/index.js +0 -1
  125. package/esm/src/build/production-build/build/route-collector.d.ts.map +1 -1
  126. package/esm/src/build/production-build/build/route-collector.js +2 -3
  127. package/esm/src/build/production-build/client-runtime.d.ts +7 -3
  128. package/esm/src/build/production-build/client-runtime.d.ts.map +1 -1
  129. package/esm/src/build/production-build/client-runtime.js +9 -9
  130. package/esm/src/build/production-build/templates.d.ts +5 -9
  131. package/esm/src/build/production-build/templates.d.ts.map +1 -1
  132. package/esm/src/build/production-build/templates.js +6 -18
  133. package/esm/src/build/vendor-cache.d.ts.map +1 -1
  134. package/esm/src/build/vendor-cache.js +0 -5
  135. package/esm/src/cache/tokenizing-gateway.d.ts +0 -2
  136. package/esm/src/cache/tokenizing-gateway.d.ts.map +1 -1
  137. package/esm/src/cache/tokenizing-gateway.js +1 -3
  138. package/esm/src/chat/index.d.ts +33 -24
  139. package/esm/src/chat/index.d.ts.map +1 -1
  140. package/esm/src/chat/index.js +40 -26
  141. package/esm/src/config/define-config.d.ts.map +1 -1
  142. package/esm/src/config/define-config.js +28 -25
  143. package/esm/src/config/loader.d.ts.map +1 -1
  144. package/esm/src/config/loader.js +10 -7
  145. package/esm/src/config/schemas/config.schema.d.ts +58 -12
  146. package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
  147. package/esm/src/config/schemas/config.schema.js +12 -0
  148. package/esm/src/data/data-fetcher.d.ts +1 -2
  149. package/esm/src/data/data-fetcher.d.ts.map +1 -1
  150. package/esm/src/data/data-fetcher.js +14 -15
  151. package/esm/src/data/server-data-fetcher.d.ts +0 -3
  152. package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
  153. package/esm/src/data/server-data-fetcher.js +1 -8
  154. package/esm/src/data/static-data-fetcher.d.ts +1 -3
  155. package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
  156. package/esm/src/data/static-data-fetcher.js +1 -3
  157. package/esm/src/discovery/discovery-engine.d.ts.map +1 -1
  158. package/esm/src/discovery/discovery-engine.js +19 -1
  159. package/esm/src/discovery/discovery-utils.d.ts +0 -4
  160. package/esm/src/discovery/discovery-utils.d.ts.map +1 -1
  161. package/esm/src/discovery/discovery-utils.js +0 -6
  162. package/esm/src/discovery/file-discovery.d.ts +3 -1
  163. package/esm/src/discovery/file-discovery.d.ts.map +1 -1
  164. package/esm/src/discovery/file-discovery.js +3 -8
  165. package/esm/src/discovery/handlers/index.d.ts +1 -0
  166. package/esm/src/discovery/handlers/index.d.ts.map +1 -1
  167. package/esm/src/discovery/handlers/index.js +1 -0
  168. package/esm/src/discovery/handlers/skill-handler.d.ts +26 -0
  169. package/esm/src/discovery/handlers/skill-handler.d.ts.map +1 -0
  170. package/esm/src/discovery/handlers/skill-handler.js +87 -0
  171. package/esm/src/discovery/handlers/task-handler.d.ts.map +1 -1
  172. package/esm/src/discovery/handlers/task-handler.js +1 -5
  173. package/esm/src/discovery/transpiler.d.ts.map +1 -1
  174. package/esm/src/discovery/transpiler.js +7 -2
  175. package/esm/src/discovery/types.d.ts +3 -0
  176. package/esm/src/discovery/types.d.ts.map +1 -1
  177. package/esm/src/embedding/chunk.d.ts +18 -0
  178. package/esm/src/embedding/chunk.d.ts.map +1 -0
  179. package/esm/src/embedding/chunk.js +48 -0
  180. package/esm/src/embedding/embedding.d.ts +23 -0
  181. package/esm/src/embedding/embedding.d.ts.map +1 -0
  182. package/esm/src/embedding/embedding.js +54 -0
  183. package/esm/src/embedding/index.d.ts +29 -0
  184. package/esm/src/embedding/index.d.ts.map +1 -0
  185. package/esm/src/embedding/index.js +26 -0
  186. package/esm/src/embedding/react/use-uploads.d.ts +31 -0
  187. package/esm/src/embedding/react/use-uploads.d.ts.map +1 -0
  188. package/esm/src/embedding/react/use-uploads.js +71 -0
  189. package/esm/src/embedding/resolve.d.ts +27 -0
  190. package/esm/src/embedding/resolve.d.ts.map +1 -0
  191. package/esm/src/embedding/resolve.js +94 -0
  192. package/esm/src/embedding/types.d.ts +90 -0
  193. package/esm/src/embedding/types.d.ts.map +1 -0
  194. package/esm/src/embedding/types.js +1 -0
  195. package/esm/src/embedding/upload-handler.d.ts +43 -0
  196. package/esm/src/embedding/upload-handler.d.ts.map +1 -0
  197. package/esm/src/embedding/upload-handler.js +144 -0
  198. package/esm/src/embedding/upload-loader.d.ts +14 -0
  199. package/esm/src/embedding/upload-loader.d.ts.map +1 -0
  200. package/esm/src/embedding/upload-loader.js +70 -0
  201. package/esm/src/embedding/upload-store.d.ts +27 -0
  202. package/esm/src/embedding/upload-store.d.ts.map +1 -0
  203. package/esm/src/embedding/upload-store.js +244 -0
  204. package/esm/src/embedding/vector-store.d.ts +33 -0
  205. package/esm/src/embedding/vector-store.d.ts.map +1 -0
  206. package/esm/src/embedding/vector-store.js +215 -0
  207. package/esm/src/errors/error-registry.d.ts +2 -1
  208. package/esm/src/errors/error-registry.d.ts.map +1 -1
  209. package/esm/src/errors/http-error.d.ts +1 -2
  210. package/esm/src/errors/http-error.d.ts.map +1 -1
  211. package/esm/src/errors/http-error.js +2 -2
  212. package/esm/src/errors/middleware/cli-error-boundary.d.ts.map +1 -1
  213. package/esm/src/errors/middleware/cli-error-boundary.js +13 -2
  214. package/esm/src/errors/middleware/wrap-unknown.d.ts +0 -7
  215. package/esm/src/errors/middleware/wrap-unknown.d.ts.map +1 -1
  216. package/esm/src/errors/middleware/wrap-unknown.js +0 -9
  217. package/esm/src/errors/veryfront-error.d.ts +0 -3
  218. package/esm/src/errors/veryfront-error.d.ts.map +1 -1
  219. package/esm/src/errors/veryfront-error.js +0 -5
  220. package/esm/src/html/schemas/html.schema.d.ts +2 -2
  221. package/esm/src/html/styles-builder/css-hash-cache.d.ts.map +1 -1
  222. package/esm/src/html/styles-builder/css-hash-cache.js +1 -2
  223. package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
  224. package/esm/src/html/styles-builder/plugin-loader.js +50 -21
  225. package/esm/src/html/styles-builder/tailwind-compiler-cache.d.ts.map +1 -1
  226. package/esm/src/html/styles-builder/tailwind-compiler-cache.js +12 -4
  227. package/esm/src/html/utils.d.ts +0 -7
  228. package/esm/src/html/utils.d.ts.map +1 -1
  229. package/esm/src/html/utils.js +0 -25
  230. package/esm/src/modules/component-registry/registry.d.ts +0 -3
  231. package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
  232. package/esm/src/modules/component-registry/registry.js +0 -3
  233. package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
  234. package/esm/src/modules/import-map/default-import-map.js +8 -0
  235. package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
  236. package/esm/src/modules/react-loader/component-loader.js +1 -0
  237. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  238. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +10 -1
  239. package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts +2 -0
  240. package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts.map +1 -1
  241. package/esm/src/modules/react-loader/types.d.ts +2 -0
  242. package/esm/src/modules/react-loader/types.d.ts.map +1 -1
  243. package/esm/src/modules/server/module-server.d.ts +2 -0
  244. package/esm/src/modules/server/module-server.d.ts.map +1 -1
  245. package/esm/src/modules/server/module-server.js +2 -1
  246. package/esm/src/oauth/handlers/callback-handler.d.ts +2 -0
  247. package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
  248. package/esm/src/oauth/handlers/callback-handler.js +10 -4
  249. package/esm/src/oauth/providers/common.d.ts.map +1 -1
  250. package/esm/src/oauth/providers/common.js +0 -23
  251. package/esm/src/observability/auto-instrument/react-instrumentation.js +2 -1
  252. package/esm/src/observability/instruments/instruments-factory.d.ts +1 -1
  253. package/esm/src/observability/instruments/instruments-factory.d.ts.map +1 -1
  254. package/esm/src/observability/instruments/instruments-factory.js +5 -4
  255. package/esm/src/observability/metrics/config.js +5 -4
  256. package/esm/src/observability/metrics/manager.js +1 -1
  257. package/esm/src/observability/tracing/span-operations.d.ts.map +1 -1
  258. package/esm/src/observability/tracing/span-operations.js +14 -8
  259. package/esm/src/platform/compat/console/node.d.ts +0 -1
  260. package/esm/src/platform/compat/console/node.d.ts.map +1 -1
  261. package/esm/src/platform/compat/console/node.js +4 -11
  262. package/esm/src/platform/compat/fs.d.ts.map +1 -1
  263. package/esm/src/platform/compat/fs.js +4 -2
  264. package/esm/src/platform/compat/opaque-deps.d.ts +18 -2
  265. package/esm/src/platform/compat/opaque-deps.d.ts.map +1 -1
  266. package/esm/src/platform/compat/opaque-deps.js +19 -0
  267. package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -1
  268. package/esm/src/platform/compat/path/basic-operations.js +17 -10
  269. package/esm/src/platform/compat/path/resolution.d.ts.map +1 -1
  270. package/esm/src/platform/compat/path/resolution.js +65 -20
  271. package/esm/src/platform/compat/path/url-conversion.d.ts.map +1 -1
  272. package/esm/src/platform/compat/path/url-conversion.js +3 -2
  273. package/esm/src/platform/compat/process.d.ts +2 -14
  274. package/esm/src/platform/compat/process.d.ts.map +1 -1
  275. package/esm/src/platform/compat/process.js +92 -70
  276. package/esm/src/provider/index.d.ts +1 -1
  277. package/esm/src/provider/index.d.ts.map +1 -1
  278. package/esm/src/provider/index.js +1 -1
  279. package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
  280. package/esm/src/provider/local/ai-sdk-adapter.js +18 -18
  281. package/esm/src/provider/local/env.d.ts.map +1 -1
  282. package/esm/src/provider/local/env.js +2 -1
  283. package/esm/src/provider/local/local-embedding-adapter.d.ts +19 -0
  284. package/esm/src/provider/local/local-embedding-adapter.d.ts.map +1 -0
  285. package/esm/src/provider/local/local-embedding-adapter.js +32 -0
  286. package/esm/src/provider/local/local-embedding-engine.d.ts +17 -0
  287. package/esm/src/provider/local/local-embedding-engine.d.ts.map +1 -0
  288. package/esm/src/provider/local/local-embedding-engine.js +63 -0
  289. package/esm/src/provider/local/local-engine.d.ts +7 -0
  290. package/esm/src/provider/local/local-engine.d.ts.map +1 -1
  291. package/esm/src/provider/local/local-engine.js +1 -1
  292. package/esm/src/provider/local/model-catalog.d.ts +10 -1
  293. package/esm/src/provider/local/model-catalog.d.ts.map +1 -1
  294. package/esm/src/provider/local/model-catalog.js +61 -0
  295. package/esm/src/provider/model-registry.d.ts +10 -0
  296. package/esm/src/provider/model-registry.d.ts.map +1 -1
  297. package/esm/src/provider/model-registry.js +43 -0
  298. package/esm/src/proxy/retry.d.ts +3 -3
  299. package/esm/src/proxy/retry.d.ts.map +1 -1
  300. package/esm/src/proxy/retry.js +0 -7
  301. package/esm/src/proxy/tracing.d.ts +1 -5
  302. package/esm/src/proxy/tracing.d.ts.map +1 -1
  303. package/esm/src/proxy/tracing.js +1 -7
  304. package/esm/src/react/components/ai/agent-card.js +13 -13
  305. package/esm/src/react/components/ai/chat/components/animations.d.ts +5 -0
  306. package/esm/src/react/components/ai/chat/components/animations.d.ts.map +1 -1
  307. package/esm/src/react/components/ai/chat/components/animations.js +13 -1
  308. package/esm/src/react/components/ai/chat/components/attachment-pill.d.ts +15 -0
  309. package/esm/src/react/components/ai/chat/components/attachment-pill.d.ts.map +1 -0
  310. package/esm/src/react/components/ai/chat/components/attachment-pill.js +40 -0
  311. package/esm/src/react/components/ai/chat/components/branch-picker.d.ts +9 -0
  312. package/esm/src/react/components/ai/chat/components/branch-picker.d.ts.map +1 -0
  313. package/esm/src/react/components/ai/chat/components/branch-picker.js +17 -0
  314. package/esm/src/react/components/ai/chat/components/code-block.d.ts +8 -0
  315. package/esm/src/react/components/ai/chat/components/code-block.d.ts.map +1 -0
  316. package/esm/src/react/components/ai/chat/components/code-block.js +38 -0
  317. package/esm/src/react/components/ai/chat/components/drop-zone.d.ts +7 -0
  318. package/esm/src/react/components/ai/chat/components/drop-zone.d.ts.map +1 -0
  319. package/esm/src/react/components/ai/chat/components/drop-zone.js +14 -0
  320. package/esm/src/react/components/ai/chat/components/empty-state.d.ts.map +1 -1
  321. package/esm/src/react/components/ai/chat/components/empty-state.js +10 -8
  322. package/esm/src/react/components/ai/chat/components/inference-badge.js +1 -1
  323. package/esm/src/react/components/ai/chat/components/inline-citation.d.ts +10 -0
  324. package/esm/src/react/components/ai/chat/components/inline-citation.d.ts.map +1 -0
  325. package/esm/src/react/components/ai/chat/components/inline-citation.js +59 -0
  326. package/esm/src/react/components/ai/chat/components/message-actions.d.ts +3 -2
  327. package/esm/src/react/components/ai/chat/components/message-actions.d.ts.map +1 -1
  328. package/esm/src/react/components/ai/chat/components/message-actions.js +10 -10
  329. package/esm/src/react/components/ai/chat/components/message-edit-form.d.ts +8 -0
  330. package/esm/src/react/components/ai/chat/components/message-edit-form.d.ts.map +1 -0
  331. package/esm/src/react/components/ai/chat/components/message-edit-form.js +46 -0
  332. package/esm/src/react/components/ai/chat/components/message-feedback.d.ts +9 -0
  333. package/esm/src/react/components/ai/chat/components/message-feedback.d.ts.map +1 -0
  334. package/esm/src/react/components/ai/chat/components/message-feedback.js +19 -0
  335. package/esm/src/react/components/ai/chat/components/quick-actions.d.ts +14 -0
  336. package/esm/src/react/components/ai/chat/components/quick-actions.d.ts.map +1 -0
  337. package/esm/src/react/components/ai/chat/components/quick-actions.js +7 -0
  338. package/esm/src/react/components/ai/chat/components/reasoning.d.ts +3 -4
  339. package/esm/src/react/components/ai/chat/components/reasoning.d.ts.map +1 -1
  340. package/esm/src/react/components/ai/chat/components/reasoning.js +11 -6
  341. package/esm/src/react/components/ai/chat/components/sidebar.d.ts +14 -0
  342. package/esm/src/react/components/ai/chat/components/sidebar.d.ts.map +1 -0
  343. package/esm/src/react/components/ai/chat/components/sidebar.js +92 -0
  344. package/esm/src/react/components/ai/chat/components/skill-badge.d.ts +12 -0
  345. package/esm/src/react/components/ai/chat/components/skill-badge.d.ts.map +1 -0
  346. package/esm/src/react/components/ai/chat/components/skill-badge.js +34 -0
  347. package/esm/src/react/components/ai/chat/components/sources.d.ts +13 -0
  348. package/esm/src/react/components/ai/chat/components/sources.d.ts.map +1 -0
  349. package/esm/src/react/components/ai/chat/components/sources.js +28 -0
  350. package/esm/src/react/components/ai/chat/components/step-indicator.d.ts +8 -0
  351. package/esm/src/react/components/ai/chat/components/step-indicator.d.ts.map +1 -0
  352. package/esm/src/react/components/ai/chat/components/step-indicator.js +15 -0
  353. package/esm/src/react/components/ai/chat/components/tab-switcher.d.ts +16 -0
  354. package/esm/src/react/components/ai/chat/components/tab-switcher.d.ts.map +1 -0
  355. package/esm/src/react/components/ai/chat/components/tab-switcher.js +28 -0
  356. package/esm/src/react/components/ai/chat/components/tool-ui.d.ts.map +1 -1
  357. package/esm/src/react/components/ai/chat/components/tool-ui.js +23 -21
  358. package/esm/src/react/components/ai/chat/components/upgrade-cta.d.ts.map +1 -1
  359. package/esm/src/react/components/ai/chat/components/upgrade-cta.js +3 -3
  360. package/esm/src/react/components/ai/chat/components/uploads-panel.d.ts +16 -0
  361. package/esm/src/react/components/ai/chat/components/uploads-panel.d.ts.map +1 -0
  362. package/esm/src/react/components/ai/chat/components/uploads-panel.js +46 -0
  363. package/esm/src/react/components/ai/chat/composition/api.d.ts +10 -5
  364. package/esm/src/react/components/ai/chat/composition/api.d.ts.map +1 -1
  365. package/esm/src/react/components/ai/chat/composition/api.js +12 -20
  366. package/esm/src/react/components/ai/chat/composition/chat-composer.d.ts +35 -0
  367. package/esm/src/react/components/ai/chat/composition/chat-composer.d.ts.map +1 -0
  368. package/esm/src/react/components/ai/chat/composition/chat-composer.js +53 -0
  369. package/esm/src/react/components/ai/chat/composition/chat-empty.d.ts +20 -0
  370. package/esm/src/react/components/ai/chat/composition/chat-empty.d.ts.map +1 -0
  371. package/esm/src/react/components/ai/chat/composition/chat-empty.js +23 -0
  372. package/esm/src/react/components/ai/chat/composition/chat-if.d.ts +14 -0
  373. package/esm/src/react/components/ai/chat/composition/chat-if.d.ts.map +1 -0
  374. package/esm/src/react/components/ai/chat/composition/chat-if.js +11 -0
  375. package/esm/src/react/components/ai/chat/composition/chat-message-list.d.ts +36 -0
  376. package/esm/src/react/components/ai/chat/composition/chat-message-list.d.ts.map +1 -0
  377. package/esm/src/react/components/ai/chat/composition/chat-message-list.js +113 -0
  378. package/esm/src/react/components/ai/chat/composition/chat-root.d.ts +43 -0
  379. package/esm/src/react/components/ai/chat/composition/chat-root.d.ts.map +1 -0
  380. package/esm/src/react/components/ai/chat/composition/chat-root.js +78 -0
  381. package/esm/src/react/components/ai/chat/composition/error-banner.d.ts +12 -0
  382. package/esm/src/react/components/ai/chat/composition/error-banner.d.ts.map +1 -0
  383. package/esm/src/react/components/ai/chat/composition/error-banner.js +17 -0
  384. package/esm/src/react/components/ai/chat/composition/message.d.ts +54 -0
  385. package/esm/src/react/components/ai/chat/composition/message.d.ts.map +1 -0
  386. package/esm/src/react/components/ai/chat/composition/message.js +175 -0
  387. package/esm/src/react/components/ai/chat/composition/model-avatar.d.ts +14 -0
  388. package/esm/src/react/components/ai/chat/composition/model-avatar.d.ts.map +1 -0
  389. package/esm/src/react/components/ai/chat/composition/model-avatar.js +60 -0
  390. package/esm/src/react/components/ai/chat/contexts/chat-context.d.ts +45 -0
  391. package/esm/src/react/components/ai/chat/contexts/chat-context.d.ts.map +1 -0
  392. package/esm/src/react/components/ai/chat/contexts/chat-context.js +20 -0
  393. package/esm/src/react/components/ai/chat/contexts/composer-context.d.ts +34 -0
  394. package/esm/src/react/components/ai/chat/contexts/composer-context.d.ts.map +1 -0
  395. package/esm/src/react/components/ai/chat/contexts/composer-context.js +21 -0
  396. package/esm/src/react/components/ai/chat/contexts/index.d.ts +13 -0
  397. package/esm/src/react/components/ai/chat/contexts/index.d.ts.map +1 -0
  398. package/esm/src/react/components/ai/chat/contexts/index.js +12 -0
  399. package/esm/src/react/components/ai/chat/contexts/message-context.d.ts +30 -0
  400. package/esm/src/react/components/ai/chat/contexts/message-context.d.ts.map +1 -0
  401. package/esm/src/react/components/ai/chat/contexts/message-context.js +21 -0
  402. package/esm/src/react/components/ai/chat/contexts/thread-list-context.d.ts +23 -0
  403. package/esm/src/react/components/ai/chat/contexts/thread-list-context.d.ts.map +1 -0
  404. package/esm/src/react/components/ai/chat/contexts/thread-list-context.js +21 -0
  405. package/esm/src/react/components/ai/chat/hooks/use-threads.d.ts +24 -0
  406. package/esm/src/react/components/ai/chat/hooks/use-threads.d.ts.map +1 -0
  407. package/esm/src/react/components/ai/chat/hooks/use-threads.js +151 -0
  408. package/esm/src/react/components/ai/chat/index.d.ts +102 -17
  409. package/esm/src/react/components/ai/chat/index.d.ts.map +1 -1
  410. package/esm/src/react/components/ai/chat/index.js +164 -95
  411. package/esm/src/react/components/ai/chat/utils/export.d.ts +10 -0
  412. package/esm/src/react/components/ai/chat/utils/export.d.ts.map +1 -0
  413. package/esm/src/react/components/ai/chat/utils/export.js +64 -0
  414. package/esm/src/react/components/ai/chat/utils/message-parts.d.ts +12 -0
  415. package/esm/src/react/components/ai/chat/utils/message-parts.d.ts.map +1 -1
  416. package/esm/src/react/components/ai/chat/utils/message-parts.js +55 -0
  417. package/esm/src/react/components/ai/chat-with-sidebar.d.ts +98 -0
  418. package/esm/src/react/components/ai/chat-with-sidebar.d.ts.map +1 -0
  419. package/esm/src/react/components/ai/chat-with-sidebar.js +165 -0
  420. package/esm/src/react/components/ai/chat.d.ts +10 -1
  421. package/esm/src/react/components/ai/chat.d.ts.map +1 -1
  422. package/esm/src/react/components/ai/chat.js +25 -1
  423. package/esm/src/react/components/ai/error-boundary.js +6 -6
  424. package/esm/src/react/components/ai/icons/index.d.ts +9 -0
  425. package/esm/src/react/components/ai/icons/index.d.ts.map +1 -1
  426. package/esm/src/react/components/ai/icons/index.js +82 -0
  427. package/esm/src/react/components/ai/markdown.d.ts.map +1 -1
  428. package/esm/src/react/components/ai/markdown.js +12 -12
  429. package/esm/src/react/components/ai/model-selector.d.ts +10 -2
  430. package/esm/src/react/components/ai/model-selector.d.ts.map +1 -1
  431. package/esm/src/react/components/ai/model-selector.js +138 -4
  432. package/esm/src/react/components/ai/theme.d.ts +96 -13
  433. package/esm/src/react/components/ai/theme.d.ts.map +1 -1
  434. package/esm/src/react/components/ai/theme.js +177 -21
  435. package/esm/src/react/primitives/input-box.d.ts.map +1 -1
  436. package/esm/src/react/primitives/input-box.js +16 -3
  437. package/esm/src/rendering/cache/index.d.ts +1 -5
  438. package/esm/src/rendering/cache/index.d.ts.map +1 -1
  439. package/esm/src/rendering/cache/index.js +1 -5
  440. package/esm/src/rendering/component-handling.d.ts +2 -0
  441. package/esm/src/rendering/component-handling.d.ts.map +1 -1
  442. package/esm/src/rendering/component-handling.js +7 -9
  443. package/esm/src/rendering/orchestrator/pipeline.d.ts +11 -2
  444. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  445. package/esm/src/rendering/page-renderer.d.ts.map +1 -1
  446. package/esm/src/rendering/page-renderer.js +1 -0
  447. package/esm/src/rendering/shared/context-aware-cache.d.ts.map +1 -1
  448. package/esm/src/rendering/shared/context-aware-cache.js +0 -4
  449. package/esm/src/repositories/schemas/index.d.ts +1 -1
  450. package/esm/src/repositories/schemas/index.d.ts.map +1 -1
  451. package/esm/src/repositories/schemas/index.js +1 -1
  452. package/esm/src/repositories/schemas/repository.schema.d.ts +0 -11
  453. package/esm/src/repositories/schemas/repository.schema.d.ts.map +1 -1
  454. package/esm/src/repositories/schemas/repository.schema.js +0 -13
  455. package/esm/src/repositories/types.d.ts +1 -1
  456. package/esm/src/repositories/types.d.ts.map +1 -1
  457. package/esm/src/routing/api/module-loader/esbuild-plugin.d.ts.map +1 -1
  458. package/esm/src/routing/api/module-loader/esbuild-plugin.js +11 -24
  459. package/esm/src/routing/api/module-loader/loader.d.ts +1 -0
  460. package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
  461. package/esm/src/routing/api/module-loader/loader.js +347 -27
  462. package/esm/src/routing/api/openapi/path-utils.d.ts +0 -19
  463. package/esm/src/routing/api/openapi/path-utils.d.ts.map +1 -1
  464. package/esm/src/routing/api/openapi/path-utils.js +0 -34
  465. package/esm/src/routing/api/openapi/spec-generator.d.ts.map +1 -1
  466. package/esm/src/routing/api/openapi/spec-generator.js +1 -19
  467. package/esm/src/routing/api/openapi/types.d.ts +1 -0
  468. package/esm/src/routing/api/openapi/types.d.ts.map +1 -1
  469. package/esm/src/routing/api/openapi/types.js +18 -0
  470. package/esm/src/sandbox/sandbox.d.ts +1 -0
  471. package/esm/src/sandbox/sandbox.d.ts.map +1 -1
  472. package/esm/src/sandbox/sandbox.js +7 -8
  473. package/esm/src/security/http/cors/constants.d.ts +0 -2
  474. package/esm/src/security/http/cors/constants.d.ts.map +1 -1
  475. package/esm/src/security/http/cors/constants.js +0 -2
  476. package/esm/src/security/http/response/index.d.ts +3 -4
  477. package/esm/src/security/http/response/index.d.ts.map +1 -1
  478. package/esm/src/security/http/response/index.js +2 -3
  479. package/esm/src/server/context/enriched-context.d.ts +0 -8
  480. package/esm/src/server/context/enriched-context.d.ts.map +1 -1
  481. package/esm/src/server/context/enriched-context.js +1 -12
  482. package/esm/src/server/dev-server/server.d.ts.map +1 -1
  483. package/esm/src/server/dev-server/server.js +11 -4
  484. package/esm/src/server/dev-ui/manifest.d.ts +20 -20
  485. package/esm/src/server/dev-ui/manifest.js +20 -20
  486. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts +9 -0
  487. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -0
  488. package/esm/src/server/handlers/dev/framework-candidates.generated.js +5187 -0
  489. package/esm/src/server/handlers/dev/styles-candidate-scanner.d.ts.map +1 -1
  490. package/esm/src/server/handlers/dev/styles-candidate-scanner.js +3 -190
  491. package/esm/src/server/handlers/request/module/module-server-handler.d.ts.map +1 -1
  492. package/esm/src/server/handlers/request/module/module-server-handler.js +1 -0
  493. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  494. package/esm/src/server/runtime-handler/index.js +14 -24
  495. package/esm/src/server/shared/renderer/memory/pressure.d.ts +0 -7
  496. package/esm/src/server/shared/renderer/memory/pressure.d.ts.map +1 -1
  497. package/esm/src/server/shared/renderer/memory/pressure.js +1 -13
  498. package/esm/src/server/utils/domain-lookup.d.ts +0 -4
  499. package/esm/src/server/utils/domain-lookup.d.ts.map +1 -1
  500. package/esm/src/server/utils/domain-lookup.js +0 -3
  501. package/esm/src/skill/allowed-tools.d.ts +54 -0
  502. package/esm/src/skill/allowed-tools.d.ts.map +1 -0
  503. package/esm/src/skill/allowed-tools.js +87 -0
  504. package/esm/src/skill/executor.d.ts +28 -0
  505. package/esm/src/skill/executor.d.ts.map +1 -0
  506. package/esm/src/skill/executor.js +187 -0
  507. package/esm/src/skill/index.d.ts +19 -0
  508. package/esm/src/skill/index.d.ts.map +1 -0
  509. package/esm/src/skill/index.js +24 -0
  510. package/esm/src/skill/parser.d.ts +30 -0
  511. package/esm/src/skill/parser.d.ts.map +1 -0
  512. package/esm/src/skill/parser.js +162 -0
  513. package/esm/src/skill/path-safety.d.ts +22 -0
  514. package/esm/src/skill/path-safety.d.ts.map +1 -0
  515. package/esm/src/skill/path-safety.js +156 -0
  516. package/esm/src/skill/prompt-augmentation.d.ts +19 -0
  517. package/esm/src/skill/prompt-augmentation.d.ts.map +1 -0
  518. package/esm/src/skill/prompt-augmentation.js +36 -0
  519. package/esm/src/skill/registry.d.ts +25 -0
  520. package/esm/src/skill/registry.d.ts.map +1 -0
  521. package/esm/src/skill/registry.js +42 -0
  522. package/esm/src/skill/tools.d.ts +27 -0
  523. package/esm/src/skill/tools.d.ts.map +1 -0
  524. package/esm/src/skill/tools.js +149 -0
  525. package/esm/src/skill/types.d.ts +85 -0
  526. package/esm/src/skill/types.d.ts.map +1 -0
  527. package/esm/src/skill/types.js +27 -0
  528. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts +1 -1
  529. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
  530. package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
  531. package/esm/src/studio/element-selector-injector.d.ts +0 -2
  532. package/esm/src/studio/element-selector-injector.d.ts.map +1 -1
  533. package/esm/src/task/runner.d.ts +6 -0
  534. package/esm/src/task/runner.d.ts.map +1 -1
  535. package/esm/src/task/runner.js +8 -8
  536. package/esm/src/tool/factory.js +31 -39
  537. package/esm/src/transforms/esm/http-cache-helpers.d.ts +0 -8
  538. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  539. package/esm/src/transforms/esm/http-cache-helpers.js +0 -20
  540. package/esm/src/transforms/esm/path-resolver.d.ts +0 -14
  541. package/esm/src/transforms/esm/path-resolver.d.ts.map +1 -1
  542. package/esm/src/transforms/esm/path-resolver.js +1 -92
  543. package/esm/src/transforms/esm/source-url-embed.d.ts +0 -14
  544. package/esm/src/transforms/esm/source-url-embed.d.ts.map +1 -1
  545. package/esm/src/transforms/esm/source-url-embed.js +0 -47
  546. package/esm/src/transforms/esm/transform-cache.d.ts.map +1 -1
  547. package/esm/src/transforms/esm/transform-cache.js +2 -6
  548. package/esm/src/transforms/mdx/index.d.ts +0 -1
  549. package/esm/src/transforms/mdx/index.d.ts.map +1 -1
  550. package/esm/src/transforms/mdx/index.js +0 -4
  551. package/esm/src/transforms/pipeline/context.d.ts +0 -1
  552. package/esm/src/transforms/pipeline/context.d.ts.map +1 -1
  553. package/esm/src/transforms/pipeline/context.js +0 -1
  554. package/esm/src/transforms/pipeline/index.d.ts +1 -2
  555. package/esm/src/transforms/pipeline/index.d.ts.map +1 -1
  556. package/esm/src/transforms/pipeline/index.js +0 -3
  557. package/esm/src/transforms/pipeline/stages/ssr-http-cache.d.ts.map +1 -1
  558. package/esm/src/transforms/pipeline/stages/ssr-http-cache.js +0 -1
  559. package/esm/src/transforms/plugins/rehype-node-positions.d.ts.map +1 -1
  560. package/esm/src/transforms/plugins/rehype-node-positions.js +1 -0
  561. package/esm/src/types/entities/getEntityInfo.js +1 -1
  562. package/esm/src/types/index.d.ts +2 -13
  563. package/esm/src/types/index.d.ts.map +1 -1
  564. package/esm/src/types/server.d.ts +2 -1
  565. package/esm/src/types/server.d.ts.map +1 -1
  566. package/esm/src/utils/cache-file-ops.d.ts +1 -1
  567. package/esm/src/utils/cache-file-ops.d.ts.map +1 -1
  568. package/esm/src/utils/cache-file-ops.js +5 -6
  569. package/esm/src/utils/lru-wrapper.d.ts.map +1 -1
  570. package/esm/src/utils/lru-wrapper.js +2 -4
  571. package/esm/src/workflow/claude-code/event-publisher.d.ts +0 -4
  572. package/esm/src/workflow/claude-code/event-publisher.d.ts.map +1 -1
  573. package/esm/src/workflow/claude-code/event-publisher.js +2 -6
  574. package/esm/src/workflow/executor/workflow-executor.d.ts.map +1 -1
  575. package/esm/src/workflow/executor/workflow-executor.js +6 -1
  576. package/esm/src/workflow/react/use-workflow-list.d.ts.map +1 -1
  577. package/esm/src/workflow/react/use-workflow-list.js +2 -1
  578. package/esm/src/workflow/schemas/workflow.schema.d.ts +8 -8
  579. package/package.json +10 -3
  580. package/src/cli/app/components/inline-input.ts +0 -5
  581. package/src/cli/app/components/list-select.ts +0 -21
  582. package/src/cli/app/operations/project-creation.ts +4 -109
  583. package/src/cli/app/shell.ts +2 -2
  584. package/src/cli/app/utils.ts +0 -22
  585. package/src/cli/app/views/dashboard.ts +0 -17
  586. package/src/cli/app/views/startup.ts +0 -13
  587. package/src/cli/auth/login.ts +1 -2
  588. package/src/cli/auth/token-store.ts +1 -1
  589. package/src/cli/auth/utils.ts +2 -1
  590. package/src/cli/commands/generate/integration-generator.ts +1 -1
  591. package/src/cli/commands/init/catalog.ts +3 -3
  592. package/src/cli/commands/init/command-help.ts +2 -2
  593. package/src/cli/commands/init/config-generator.ts +9 -0
  594. package/src/cli/commands/init/types.ts +1 -1
  595. package/src/cli/help/formatters.ts +11 -4
  596. package/src/cli/help/main-help.ts +2 -3
  597. package/src/cli/help/tips.ts +1 -1
  598. package/src/cli/mcp/remote-file-tools.ts +1 -1
  599. package/src/cli/mcp/server.ts +2 -5
  600. package/src/cli/mcp/tools/catalog-tools.ts +3 -3
  601. package/src/cli/mcp/tools/dev-tools.ts +1 -2
  602. package/src/cli/mcp/tools.ts +8 -2
  603. package/src/cli/shared/reserve-slug.ts +1 -4
  604. package/src/cli/sync/ignore.ts +26 -21
  605. package/src/cli/templates/index.ts +2 -2
  606. package/src/cli/templates/manifest.js +15 -13
  607. package/src/cli/templates/types.ts +1 -1
  608. package/src/cli/ui/colors.ts +0 -12
  609. package/src/cli/ui/dot-matrix.ts +3 -6
  610. package/src/cli/ui/tui.ts +3 -3
  611. package/src/cli/utils/index.ts +1 -1
  612. package/src/cli/utils/package-manager.ts +3 -4
  613. package/src/deno.js +30 -20
  614. package/src/src/agent/chat-handler.ts +138 -28
  615. package/src/src/agent/factory.ts +58 -9
  616. package/src/src/agent/index.ts +24 -2
  617. package/src/src/agent/memory/memory.ts +0 -9
  618. package/src/src/agent/react/index.ts +2 -0
  619. package/src/src/agent/react/use-chat/index.ts +2 -0
  620. package/src/src/agent/react/use-chat/streaming/handler.ts +66 -5
  621. package/src/src/agent/react/use-chat/streaming/parts-builder.ts +18 -1
  622. package/src/src/agent/react/use-chat/streaming/types.ts +6 -0
  623. package/src/src/agent/react/use-chat/types.ts +26 -1
  624. package/src/src/agent/react/use-chat/use-chat.ts +245 -36
  625. package/src/src/agent/runtime/index.ts +213 -35
  626. package/src/src/agent/runtime/tool-helpers.ts +9 -0
  627. package/src/src/agent/types.ts +10 -0
  628. package/src/src/ai/registry-manager.ts +2 -1
  629. package/src/src/build/bundler/code-splitter/manifest-builder.ts +1 -1
  630. package/src/src/build/compiler/mdx-compiler/validator.ts +3 -7
  631. package/src/src/build/compiler/mdx-to-js.ts +0 -101
  632. package/src/src/build/index.ts +0 -8
  633. package/src/src/build/production-build/build/route-collector.ts +2 -4
  634. package/src/src/build/production-build/client-runtime.ts +21 -5
  635. package/src/src/build/production-build/templates.ts +9 -18
  636. package/src/src/build/vendor-cache.ts +0 -6
  637. package/src/src/cache/tokenizing-gateway.ts +1 -9
  638. package/src/src/chat/index.ts +169 -34
  639. package/src/src/config/define-config.ts +30 -29
  640. package/src/src/config/loader.ts +10 -9
  641. package/src/src/config/schemas/config.schema.ts +12 -0
  642. package/src/src/data/data-fetcher.ts +15 -21
  643. package/src/src/data/server-data-fetcher.ts +1 -8
  644. package/src/src/data/static-data-fetcher.ts +1 -6
  645. package/src/src/discovery/discovery-engine.ts +27 -0
  646. package/src/src/discovery/discovery-utils.ts +0 -7
  647. package/src/src/discovery/file-discovery.ts +3 -9
  648. package/src/src/discovery/handlers/index.ts +1 -0
  649. package/src/src/discovery/handlers/skill-handler.ts +123 -0
  650. package/src/src/discovery/handlers/task-handler.ts +1 -5
  651. package/src/src/discovery/transpiler.ts +7 -2
  652. package/src/src/discovery/types.ts +3 -0
  653. package/src/src/embedding/chunk.ts +60 -0
  654. package/src/src/embedding/embedding.ts +62 -0
  655. package/src/src/embedding/index.ts +49 -0
  656. package/src/src/embedding/react/use-uploads.ts +101 -0
  657. package/src/src/embedding/resolve.ts +126 -0
  658. package/src/src/embedding/types.ts +103 -0
  659. package/src/src/embedding/upload-handler.ts +180 -0
  660. package/src/src/embedding/upload-loader.ts +76 -0
  661. package/src/src/embedding/upload-store.ts +299 -0
  662. package/src/src/embedding/vector-store.ts +282 -0
  663. package/src/src/errors/error-registry.ts +2 -2
  664. package/src/src/errors/http-error.ts +7 -3
  665. package/src/src/errors/middleware/cli-error-boundary.ts +28 -2
  666. package/src/src/errors/middleware/wrap-unknown.ts +0 -10
  667. package/src/src/errors/veryfront-error.ts +0 -9
  668. package/src/src/html/styles-builder/css-hash-cache.ts +5 -2
  669. package/src/src/html/styles-builder/plugin-loader.ts +58 -21
  670. package/src/src/html/styles-builder/tailwind-compiler-cache.ts +11 -4
  671. package/src/src/html/utils.ts +0 -33
  672. package/src/src/modules/component-registry/registry.ts +0 -3
  673. package/src/src/modules/import-map/default-import-map.ts +10 -0
  674. package/src/src/modules/react-loader/component-loader.ts +1 -0
  675. package/src/src/modules/react-loader/ssr-module-loader/loader.ts +12 -1
  676. package/src/src/modules/react-loader/ssr-module-loader/types.ts +2 -0
  677. package/src/src/modules/react-loader/types.ts +2 -0
  678. package/src/src/modules/server/module-server.ts +4 -1
  679. package/src/src/modules/server/websocket-handler.ts +1 -1
  680. package/src/src/oauth/handlers/callback-handler.ts +17 -5
  681. package/src/src/oauth/providers/base.ts +3 -3
  682. package/src/src/oauth/providers/common.ts +0 -23
  683. package/src/src/observability/auto-instrument/react-instrumentation.ts +2 -2
  684. package/src/src/observability/instruments/instruments-factory.ts +6 -6
  685. package/src/src/observability/metrics/config.ts +5 -5
  686. package/src/src/observability/metrics/manager.ts +1 -1
  687. package/src/src/observability/tracing/span-operations.ts +14 -9
  688. package/src/src/platform/compat/console/node.ts +4 -14
  689. package/src/src/platform/compat/fs.ts +14 -3
  690. package/src/src/platform/compat/opaque-deps.ts +32 -2
  691. package/src/src/platform/compat/path/basic-operations.ts +19 -10
  692. package/src/src/platform/compat/path/resolution.ts +69 -18
  693. package/src/src/platform/compat/path/url-conversion.ts +10 -6
  694. package/src/src/platform/compat/process.ts +133 -76
  695. package/src/src/provider/index.ts +1 -0
  696. package/src/src/provider/local/ai-sdk-adapter.ts +40 -37
  697. package/src/src/provider/local/env.ts +4 -1
  698. package/src/src/provider/local/local-embedding-adapter.ts +37 -0
  699. package/src/src/provider/local/local-embedding-engine.ts +88 -0
  700. package/src/src/provider/local/local-engine.ts +1 -1
  701. package/src/src/provider/local/model-catalog.ts +67 -1
  702. package/src/src/provider/model-registry.ts +47 -0
  703. package/src/src/proxy/retry.ts +0 -9
  704. package/src/src/proxy/tracing.ts +1 -9
  705. package/src/src/react/components/ai/agent-card.tsx +13 -13
  706. package/src/src/react/components/ai/chat/components/animations.tsx +31 -1
  707. package/src/src/react/components/ai/chat/components/attachment-pill.tsx +110 -0
  708. package/src/src/react/components/ai/chat/components/branch-picker.tsx +70 -0
  709. package/src/src/react/components/ai/chat/components/code-block.tsx +82 -0
  710. package/src/src/react/components/ai/chat/components/drop-zone.tsx +49 -0
  711. package/src/src/react/components/ai/chat/components/empty-state.tsx +20 -8
  712. package/src/src/react/components/ai/chat/components/inference-badge.tsx +1 -1
  713. package/src/src/react/components/ai/chat/components/inline-citation.tsx +150 -0
  714. package/src/src/react/components/ai/chat/components/message-actions.tsx +73 -51
  715. package/src/src/react/components/ai/chat/components/message-edit-form.tsx +95 -0
  716. package/src/src/react/components/ai/chat/components/message-feedback.tsx +72 -0
  717. package/src/src/react/components/ai/chat/components/quick-actions.tsx +38 -0
  718. package/src/src/react/components/ai/chat/components/reasoning.tsx +40 -35
  719. package/src/src/react/components/ai/chat/components/sidebar.tsx +204 -0
  720. package/src/src/react/components/ai/chat/components/skill-badge.tsx +51 -0
  721. package/src/src/react/components/ai/chat/components/sources.tsx +99 -0
  722. package/src/src/react/components/ai/chat/components/step-indicator.tsx +33 -0
  723. package/src/src/react/components/ai/chat/components/tab-switcher.tsx +69 -0
  724. package/src/src/react/components/ai/chat/components/tool-ui.tsx +31 -29
  725. package/src/src/react/components/ai/chat/components/upgrade-cta.tsx +3 -4
  726. package/src/src/react/components/ai/chat/components/uploads-panel.tsx +129 -0
  727. package/src/src/react/components/ai/chat/composition/api.tsx +12 -62
  728. package/src/src/react/components/ai/chat/composition/chat-composer.tsx +205 -0
  729. package/src/src/react/components/ai/chat/composition/chat-empty.tsx +77 -0
  730. package/src/src/react/components/ai/chat/composition/chat-if.tsx +25 -0
  731. package/src/src/react/components/ai/chat/composition/chat-message-list.tsx +356 -0
  732. package/src/src/react/components/ai/chat/composition/chat-root.tsx +181 -0
  733. package/src/src/react/components/ai/chat/composition/error-banner.tsx +38 -0
  734. package/src/src/react/components/ai/chat/composition/message.tsx +337 -0
  735. package/src/src/react/components/ai/chat/composition/model-avatar.tsx +103 -0
  736. package/src/src/react/components/ai/chat/contexts/chat-context.tsx +78 -0
  737. package/src/src/react/components/ai/chat/contexts/composer-context.tsx +59 -0
  738. package/src/src/react/components/ai/chat/contexts/index.ts +36 -0
  739. package/src/src/react/components/ai/chat/contexts/message-context.tsx +49 -0
  740. package/src/src/react/components/ai/chat/contexts/thread-list-context.tsx +40 -0
  741. package/src/src/react/components/ai/chat/hooks/use-threads.ts +208 -0
  742. package/src/src/react/components/ai/chat/index.tsx +389 -230
  743. package/src/src/react/components/ai/chat/utils/export.ts +77 -0
  744. package/src/src/react/components/ai/chat/utils/message-parts.ts +63 -1
  745. package/src/src/react/components/ai/chat-with-sidebar.tsx +371 -0
  746. package/src/src/react/components/ai/chat.tsx +122 -7
  747. package/src/src/react/components/ai/error-boundary.tsx +6 -6
  748. package/src/src/react/components/ai/icons/index.ts +100 -0
  749. package/src/src/react/components/ai/markdown.tsx +12 -15
  750. package/src/src/react/components/ai/model-selector.tsx +223 -15
  751. package/src/src/react/components/ai/theme.ts +205 -39
  752. package/src/src/react/primitives/input-box.tsx +27 -4
  753. package/src/src/rendering/cache/index.ts +12 -5
  754. package/src/src/rendering/component-handling.ts +9 -9
  755. package/src/src/rendering/orchestrator/pipeline.ts +12 -2
  756. package/src/src/rendering/page-renderer.ts +1 -0
  757. package/src/src/rendering/renderer.ts +1 -1
  758. package/src/src/rendering/shared/context-aware-cache.ts +0 -5
  759. package/src/src/repositories/schemas/index.ts +0 -2
  760. package/src/src/repositories/schemas/repository.schema.ts +0 -15
  761. package/src/src/repositories/types.ts +1 -6
  762. package/src/src/routing/api/module-loader/esbuild-plugin.ts +11 -25
  763. package/src/src/routing/api/module-loader/loader.ts +421 -17
  764. package/src/src/routing/api/openapi/path-utils.ts +0 -39
  765. package/src/src/routing/api/openapi/spec-generator.ts +1 -20
  766. package/src/src/routing/api/openapi/types.ts +20 -0
  767. package/src/src/sandbox/sandbox.ts +8 -8
  768. package/src/src/security/http/cors/constants.ts +0 -4
  769. package/src/src/security/http/response/index.ts +3 -9
  770. package/src/src/server/context/enriched-context.ts +1 -19
  771. package/src/src/server/dev-server/server.ts +11 -4
  772. package/src/src/server/dev-ui/manifest.js +20 -20
  773. package/src/src/server/handlers/dev/framework-candidates.generated.ts +5188 -0
  774. package/src/src/server/handlers/dev/styles-candidate-scanner.ts +3 -191
  775. package/src/src/server/handlers/request/module/module-server-handler.ts +1 -0
  776. package/src/src/server/runtime-handler/index.ts +17 -28
  777. package/src/src/server/shared/renderer/memory/pressure.ts +2 -15
  778. package/src/src/server/utils/domain-lookup.ts +0 -4
  779. package/src/src/skill/allowed-tools.ts +107 -0
  780. package/src/src/skill/executor.ts +215 -0
  781. package/src/src/skill/index.ts +60 -0
  782. package/src/src/skill/parser.ts +214 -0
  783. package/src/src/skill/path-safety.ts +203 -0
  784. package/src/src/skill/prompt-augmentation.ts +48 -0
  785. package/src/src/skill/registry.ts +51 -0
  786. package/src/src/skill/tools.ts +197 -0
  787. package/src/src/skill/types.ts +107 -0
  788. package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
  789. package/src/src/studio/element-selector-injector.ts +0 -2
  790. package/src/src/task/runner.ts +10 -8
  791. package/src/src/tool/factory.ts +54 -54
  792. package/src/src/transforms/esm/http-cache-helpers.ts +0 -20
  793. package/src/src/transforms/esm/path-resolver.ts +1 -140
  794. package/src/src/transforms/esm/source-url-embed.ts +0 -53
  795. package/src/src/transforms/esm/transform-cache.ts +3 -7
  796. package/src/src/transforms/mdx/index.ts +0 -5
  797. package/src/src/transforms/pipeline/context.ts +0 -2
  798. package/src/src/transforms/pipeline/index.ts +0 -4
  799. package/src/src/transforms/pipeline/stages/ssr-http-cache.ts +0 -1
  800. package/src/src/transforms/plugins/rehype-node-positions.ts +1 -0
  801. package/src/src/types/entities/getEntityInfo.ts +1 -1
  802. package/src/src/types/index.ts +1 -20
  803. package/src/src/types/server.ts +1 -1
  804. package/src/src/utils/cache-file-ops.ts +5 -5
  805. package/src/src/utils/logger/logger.ts +2 -2
  806. package/src/src/utils/lru-wrapper.ts +2 -8
  807. package/src/src/workflow/claude-code/event-publisher.ts +13 -4
  808. package/src/src/workflow/executor/workflow-executor.ts +7 -2
  809. package/src/src/workflow/react/use-workflow-list.ts +3 -2
  810. package/esm/src/transforms/mdx/parser.d.ts +0 -4
  811. package/esm/src/transforms/mdx/parser.d.ts.map +0 -1
  812. package/esm/src/transforms/mdx/parser.js +0 -49
  813. package/src/src/transforms/mdx/parser.ts +0 -65
@@ -16,9 +16,187 @@ import { isDeno, isNode } from "../../../platform/compat/runtime.js";
16
16
  import { withSpan } from "../../../observability/tracing/otlp-setup.js";
17
17
  import { isCompiledBinary } from "../../../utils/index.js";
18
18
  import { wrapWithCurrentContext } from "../../../platform/adapters/fs/veryfront/multi-project-adapter.js";
19
+ import { isWithinDirectory } from "../../../security/path-validation.js";
19
20
 
20
21
  const logger = serverLogger.component("api");
21
22
 
23
+ /**
24
+ * Validates that a module path is contained within the project directory.
25
+ * Prevents path traversal attacks that could load arbitrary files from the host.
26
+ */
27
+ function validateModulePath(modulePath: string, projectDir: string): void {
28
+ const resolved = pathHelper.resolve(modulePath);
29
+ const resolvedProject = pathHelper.resolve(projectDir);
30
+
31
+ if (!isWithinDirectory(resolvedProject, resolved)) {
32
+ throw toError(
33
+ createError({
34
+ type: "api",
35
+ message: `[API] module path escapes project directory: ${modulePath}`,
36
+ }),
37
+ );
38
+ }
39
+ }
40
+
41
+ /** Node.js built-in module names — shared across the CJS shim, esbuild externals, and Deno rewrites. */
42
+ const NODE_BUILTINS = [
43
+ "assert",
44
+ "buffer",
45
+ "child_process",
46
+ "cluster",
47
+ "console",
48
+ "constants",
49
+ "crypto",
50
+ "dgram",
51
+ "dns",
52
+ "events",
53
+ "fs",
54
+ "http",
55
+ "http2",
56
+ "https",
57
+ "module",
58
+ "net",
59
+ "os",
60
+ "path",
61
+ "perf_hooks",
62
+ "process",
63
+ "querystring",
64
+ "readline",
65
+ "stream",
66
+ "string_decoder",
67
+ "timers",
68
+ "tls",
69
+ "tty",
70
+ "url",
71
+ "util",
72
+ "v8",
73
+ "vm",
74
+ "worker_threads",
75
+ "zlib",
76
+ ] as const;
77
+
78
+ async function readProjectDependencies(
79
+ projectDir: string,
80
+ fs: FileSystem,
81
+ ): Promise<Map<string, string>> {
82
+ try {
83
+ const content = await fs.readTextFile(pathHelper.join(projectDir, "package.json"));
84
+ const pkg = JSON.parse(content) as { dependencies?: Record<string, string> };
85
+ return new Map(Object.entries(pkg.dependencies ?? {}));
86
+ } catch {
87
+ return new Map();
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Generates a CJS module loader shim for compiled Deno binaries.
93
+ *
94
+ * In compiled binaries, `createRequire()` can resolve module paths and load
95
+ * built-in modules (fs, path, etc.), but cannot load CJS files from disk
96
+ * (loadMaybeCjs fails with "path not found"). This shim works around that
97
+ * limitation by using `Deno.readTextFileSync` to read CJS files and
98
+ * `new Function` to evaluate them in a proper CJS wrapper with require,
99
+ * exports, module, __filename, and __dirname bindings.
100
+ */
101
+ function generateCompiledBinaryRequireShim(projectDir: string): string {
102
+ const builtinSet = JSON.stringify(NODE_BUILTINS);
103
+ const safeProjectDir = JSON.stringify(projectDir + "/package.json");
104
+ const safeProjectRoot = JSON.stringify(pathHelper.resolve(projectDir));
105
+
106
+ return `
107
+ import { createRequire as __vf_createRequire } from "node:module";
108
+ import { dirname as __vf_dirname, resolve as __vf_resolve } from "node:path";
109
+ var __vf_builtinRequire = __vf_createRequire(${safeProjectDir});
110
+ var __vf_builtinSet = new Set(${builtinSet});
111
+ var __vf_projectRoot = ${safeProjectRoot};
112
+ var __vf_cache = Object.create(null);
113
+ function __vf_assertContained(resolved) {
114
+ var norm = __vf_resolve(resolved).replace(/\\\\/g, "/");
115
+ var root = __vf_projectRoot.replace(/\\\\/g, "/");
116
+ if (!norm.startsWith(root + "/") && norm !== root) {
117
+ throw new Error("CJS loader blocked path outside project: " + resolved);
118
+ }
119
+ }
120
+ function __vf_loadCjs(id, parentDir) {
121
+ if (id.startsWith("node:")) return __vf_builtinRequire(id);
122
+ if (__vf_builtinSet.has(id)) return __vf_builtinRequire(id);
123
+ var slashIdx = id.indexOf("/");
124
+ if (slashIdx > 0 && __vf_builtinSet.has(id.slice(0, slashIdx))) return __vf_builtinRequire(id);
125
+ var resolved;
126
+ if (id.startsWith(".") || id.startsWith("/")) {
127
+ resolved = __vf_resolve(parentDir, id);
128
+ if (!resolved.match(/\\.[a-zA-Z0-9]+$/)) {
129
+ var exts = [".js", ".cjs", ".json", "/index.js", "/index.cjs", "/index.json"];
130
+ for (var i = 0; i < exts.length; i++) {
131
+ try { Deno.statSync(resolved + exts[i]); resolved += exts[i]; break; } catch {}
132
+ }
133
+ }
134
+ __vf_assertContained(resolved);
135
+ } else {
136
+ resolved = __vf_builtinRequire.resolve(id);
137
+ }
138
+ if (resolved in __vf_cache) return __vf_cache[resolved];
139
+ var code = Deno.readTextFileSync(resolved);
140
+ if (resolved.endsWith(".json")) {
141
+ var json = JSON.parse(code);
142
+ __vf_cache[resolved] = json;
143
+ return json;
144
+ }
145
+ var mod = { exports: {} };
146
+ __vf_cache[resolved] = mod.exports;
147
+ var dir = __vf_dirname(resolved);
148
+ var childReq = function(childId) { return __vf_loadCjs(childId, dir); };
149
+ childReq.resolve = function(childId) {
150
+ if (childId.startsWith(".") || childId.startsWith("/")) return __vf_resolve(dir, childId);
151
+ return __vf_builtinRequire.resolve(childId);
152
+ };
153
+ childReq.ensure = function(mods, cb) { cb(); };
154
+ var fn = new Function("exports", "require", "module", "__filename", "__dirname", "global", "globalThis", "Worker", code);
155
+ fn(mod.exports, childReq, mod, resolved, dir, globalThis, globalThis, undefined);
156
+ __vf_cache[resolved] = mod.exports;
157
+ return mod.exports;
158
+ }
159
+ function __vf_interopDefault(m) { return m && m.__esModule && m.default !== undefined ? m.default : m; }
160
+ var require = function(id) { return __vf_loadCjs(id, ${JSON.stringify(projectDir)}); };
161
+ require.resolve = function(id) { return __vf_builtinRequire.resolve(id); };
162
+ require.ensure = function(mods, cb) { cb(); };
163
+ `.trim();
164
+ }
165
+
166
+ function resolveExportEntry(entry: unknown): string | undefined {
167
+ if (typeof entry === "string") return entry;
168
+ if (entry && typeof entry === "object") {
169
+ const obj = entry as Record<string, unknown>;
170
+ // Prefer import > default > first string value
171
+ for (const key of ["import", "default"]) {
172
+ const val = obj[key];
173
+ if (typeof val === "string") return val;
174
+ if (val && typeof val === "object") {
175
+ const nested = val as Record<string, unknown>;
176
+ if (typeof nested.default === "string") return nested.default;
177
+ }
178
+ }
179
+ }
180
+ return undefined;
181
+ }
182
+
183
+ export function toCjsDestructureBindings(bindings: string): string {
184
+ const inner = bindings.trim().replace(/^\{\s*/, "").replace(/\s*\}$/, "");
185
+ if (!inner) return "{}";
186
+
187
+ const converted = inner
188
+ .split(",")
189
+ .map((part) => part.trim())
190
+ .filter(Boolean)
191
+ .map((part) => {
192
+ const aliasMatch = part.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
193
+ if (aliasMatch) return `${aliasMatch[1]}: ${aliasMatch[2]}`;
194
+ return part;
195
+ });
196
+
197
+ return `{ ${converted.join(", ")} }`;
198
+ }
199
+
22
200
  const FILE_EXTENSIONS: string[] = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs"];
23
201
 
24
202
  const EXT_TO_LOADER: Record<string, "tsx" | "jsx" | "ts" | "js" | "json"> = {
@@ -40,6 +218,8 @@ export function loadHandlerModule(options: LoadModuleOptions): Promise<APIRoute
40
218
  const { projectDir, modulePath, adapter, config } = options;
41
219
  const fs = createFileSystem();
42
220
 
221
+ validateModulePath(modulePath, projectDir);
222
+
43
223
  try {
44
224
  const module = await loadModule({ modulePath, projectDir, adapter, fs, config });
45
225
  return extractAPIRouteHandlers(module);
@@ -163,6 +343,13 @@ function createImportMapPlugin(
163
343
  ? resolvedPath
164
344
  : pathHelper.resolve(projectDir, resolvedPath);
165
345
 
346
+ if (!isWithinDirectory(pathHelper.resolve(projectDir), absolutePath)) {
347
+ logger.error(
348
+ `[API] Import map entry escapes project directory: ${args.path} -> ${absolutePath}`,
349
+ );
350
+ return { errors: [{ text: `Import map path escapes project: ${args.path}` }] };
351
+ }
352
+
166
353
  logger.debug(`Import map resolved: ${args.path} -> ${absolutePath}`);
167
354
 
168
355
  return { path: absolutePath, namespace: "import-map" };
@@ -176,6 +363,7 @@ function createImportMapPlugin(
176
363
  adapter,
177
364
  args.path,
178
365
  FILE_EXTENSIONS,
366
+ projectDir,
179
367
  );
180
368
 
181
369
  return {
@@ -195,7 +383,10 @@ function createImportMapPlugin(
195
383
  }
196
384
 
197
385
  /** Resolves relative imports through the adapter's virtual FS for remote projects. */
198
- function createAdapterResolvePlugin(adapter: RuntimeAdapter): Plugin {
386
+ function createAdapterResolvePlugin(
387
+ adapter: RuntimeAdapter,
388
+ projectDir: string,
389
+ ): Plugin {
199
390
  return {
200
391
  name: "vf-adapter-resolve",
201
392
  setup(build) {
@@ -206,6 +397,16 @@ function createAdapterResolvePlugin(adapter: RuntimeAdapter): Plugin {
206
397
  if (!baseDir) return undefined;
207
398
 
208
399
  const absolutePath = pathHelper.resolve(baseDir, args.path);
400
+
401
+ if (!isWithinDirectory(pathHelper.resolve(projectDir), absolutePath)) {
402
+ logger.error(
403
+ `[API] Adapter resolve path escapes project: ${args.path} -> ${absolutePath}`,
404
+ );
405
+ return {
406
+ errors: [{ text: `Relative import escapes project: ${args.path}` }],
407
+ };
408
+ }
409
+
209
410
  logger.debug(
210
411
  `[API] Adapter resolve: ${args.path} (from ${
211
412
  args.importer || "stdin"
@@ -227,6 +428,7 @@ function createAdapterResolvePlugin(adapter: RuntimeAdapter): Plugin {
227
428
  adapter,
228
429
  args.path,
229
430
  FILE_EXTENSIONS,
431
+ projectDir,
230
432
  );
231
433
 
232
434
  return {
@@ -259,6 +461,7 @@ function loadAndTranspileModule(
259
461
  adapter,
260
462
  modulePath,
261
463
  FILE_EXTENSIONS,
464
+ projectDir,
262
465
  );
263
466
 
264
467
  if (!source) {
@@ -275,8 +478,46 @@ function loadAndTranspileModule(
275
478
  const allowedHosts = await loadSecurityConfig(projectDir, adapter);
276
479
  validateHTTPImports(source, allowedHosts);
277
480
 
481
+ const allDeps = await readProjectDependencies(projectDir, fs);
482
+
483
+ // Filter out framework-managed packages from user deps. These are already
484
+ // handled by the framework's own external/rewrite logic and should not be
485
+ // treated as user npm packages.
486
+ const frameworkPackages = new Set(["ai", "zod", "veryfront", "react", "react-dom", "path"]);
487
+ const frameworkPrefixes = ["@ai-sdk/", "@opentelemetry/", "node:", "veryfront/"];
488
+ const userDeps = new Map<string, string>();
489
+ for (const [name, version] of allDeps) {
490
+ if (frameworkPackages.has(name)) continue;
491
+ if (frameworkPrefixes.some((p) => name.startsWith(p))) continue;
492
+ userDeps.set(name, version);
493
+ }
494
+
495
+ // Always externalize user npm dependencies. The bundled handler is loaded
496
+ // from a temp file and user deps are resolved at runtime:
497
+ // - Node.js: via file:// URLs pointing to node_modules
498
+ // - Deno (compiled or not): via createRequire or npm: specifiers
499
+ // Bundling CJS deps inline (especially complex ones like pdf-parse/pdf.js)
500
+ // breaks their internal global state management during esbuild's CJS→ESM
501
+ // conversion.
502
+ const userExternals: string[] = [];
503
+ for (const name of userDeps.keys()) {
504
+ userExternals.push(name, `${name}/*`);
505
+ }
506
+
278
507
  const { build } = await import("esbuild");
279
508
 
509
+ // Many npm packages use CJS require() for Node built-ins (e.g. require('fs')).
510
+ // When esbuild bundles CJS into ESM output, these become __require() shims that
511
+ // fail at runtime. Inject a createRequire-based shim so require() works in ESM.
512
+ // Use projectDir as the resolve base so require() finds the project's node_modules.
513
+ const safeProjectDir = JSON.stringify(projectDir + "/package.json");
514
+ const requireShim = isDeno && isCompiledBinary()
515
+ ? generateCompiledBinaryRequireShim(projectDir)
516
+ : [
517
+ 'import { createRequire as __vf_createRequire } from "node:module";',
518
+ `var require = __vf_createRequire(${safeProjectDir});`,
519
+ ].join("\n");
520
+
280
521
  const result: BuildResult = await build({
281
522
  bundle: true,
282
523
  write: false,
@@ -286,6 +527,7 @@ function loadAndTranspileModule(
286
527
  jsx: "automatic",
287
528
  jsxImportSource: "react",
288
529
  resolveExtensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"],
530
+ banner: { js: requireShim },
289
531
  external: [
290
532
  "ai",
291
533
  "ai/*",
@@ -293,10 +535,11 @@ function loadAndTranspileModule(
293
535
  "@ai-sdk/*",
294
536
  "zod",
295
537
  "node:*",
538
+ ...NODE_BUILTINS,
296
539
  "veryfront",
297
540
  "veryfront/*",
298
541
  "@opentelemetry/*",
299
- "path",
542
+ ...userExternals,
300
543
  ],
301
544
  stdin: {
302
545
  contents: source,
@@ -306,7 +549,7 @@ function loadAndTranspileModule(
306
549
  },
307
550
  plugins: [
308
551
  createImportMapPlugin(projectDir, adapter, config),
309
- createAdapterResolvePlugin(adapter),
552
+ createAdapterResolvePlugin(adapter, projectDir),
310
553
  createHTTPPlugin(allowedHosts),
311
554
  ],
312
555
  });
@@ -325,7 +568,7 @@ function loadAndTranspileModule(
325
568
  const js = result.outputFiles?.[0]?.text ?? "export {}";
326
569
  logger.debug(`transpiled size ${js.length} bytes`);
327
570
 
328
- return loadModuleFromCode(js, projectDir, fs);
571
+ return loadModuleFromCode(js, projectDir, fs, userDeps);
329
572
  },
330
573
  { "api.modulePath": modulePath, "api.projectDir": projectDir },
331
574
  );
@@ -335,9 +578,25 @@ async function readFileWithExtensions(
335
578
  adapter: RuntimeAdapter,
336
579
  basePath: string,
337
580
  extensions: string[],
581
+ projectDir?: string,
338
582
  ): Promise<{ filePath: string; contents: string }> {
583
+ const resolvedProjectDir = projectDir ? pathHelper.resolve(projectDir) : undefined;
584
+
339
585
  for (const ext of extensions) {
340
586
  const filePath = ext ? basePath + ext : basePath;
587
+
588
+ if (resolvedProjectDir) {
589
+ const resolved = pathHelper.resolve(filePath);
590
+ if (!isWithinDirectory(resolvedProjectDir, resolved)) {
591
+ throw toError(
592
+ createError({
593
+ type: "api",
594
+ message: `[API] file path escapes project directory: ${filePath}`,
595
+ }),
596
+ );
597
+ }
598
+ }
599
+
341
600
  try {
342
601
  const contents = await adapter.fs.readFile(filePath);
343
602
  return { filePath, contents };
@@ -358,11 +617,12 @@ async function loadModuleFromCode(
358
617
  code: string,
359
618
  projectDir: string,
360
619
  fs: FileSystem,
620
+ userDeps: Map<string, string> = new Map(),
361
621
  ): Promise<APIRoute> {
362
622
  const tempDir = await fs.makeTempDir({ prefix: "vf-api-" });
363
623
  const tempFile = pathHelper.join(tempDir, "handler.mjs");
364
624
 
365
- const transformedCode = await rewriteExternalImports(code, projectDir, fs);
625
+ const transformedCode = await rewriteExternalImports(code, projectDir, fs, userDeps);
366
626
 
367
627
  // In compiled Deno binaries, external modules loaded from temp files cannot
368
628
  // resolve "veryfront" since the source is embedded in the binary's virtual FS.
@@ -390,6 +650,9 @@ async function loadModuleFromCode(
390
650
  await fs.writeTextFile(pathHelper.join(tempDir, shimName), shimCode);
391
651
  }
392
652
  }
653
+
654
+ // Note: user npm dependencies are externalized and loaded at runtime via
655
+ // a custom CJS loader (see generateCompiledBinaryRequireShim), no shims needed.
393
656
  }
394
657
 
395
658
  await fs.writeTextFile(tempFile, transformedCode);
@@ -409,6 +672,7 @@ async function rewriteExternalImports(
409
672
  code: string,
410
673
  projectDir: string,
411
674
  fs: FileSystem,
675
+ userDeps: Map<string, string> = new Map(),
412
676
  ): Promise<string> {
413
677
  let transformed = code;
414
678
 
@@ -427,10 +691,7 @@ async function rewriteExternalImports(
427
691
  let entryPoint: string | undefined;
428
692
 
429
693
  if (pkgJson.exports) {
430
- const dotExport = pkgJson.exports["."];
431
- if (typeof dotExport === "string") entryPoint = dotExport;
432
- else if (dotExport?.import) entryPoint = dotExport.import;
433
- else if (dotExport?.default) entryPoint = dotExport.default;
694
+ entryPoint = resolveExportEntry(pkgJson.exports["."]);
434
695
  }
435
696
 
436
697
  entryPoint ||= pkgJson.module || pkgJson.main || "index.js";
@@ -453,27 +714,53 @@ async function rewriteExternalImports(
453
714
  "@ai-sdk/provider-utils",
454
715
  ];
455
716
 
717
+ for (const name of userDeps.keys()) {
718
+ if (!externalPackagesToResolve.includes(name)) {
719
+ externalPackagesToResolve.push(name);
720
+ }
721
+ }
722
+
456
723
  for (const pkg of externalPackagesToResolve) {
457
724
  const escapedPkg = pkg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
458
725
 
459
- const staticImportRegex = new RegExp(`from\\s*["']${escapedPkg}["']`, "g");
460
- const dynamicImportRegex = new RegExp(`import\\s*\\(\\s*["']${escapedPkg}["']\\s*\\)`, "g");
726
+ // Match both exact imports (from "pkg") and subpath imports (from "pkg/sub")
727
+ const staticImportRegex = new RegExp(`from\\s*["']${escapedPkg}(/[^"']*)?["']`, "g");
728
+ const dynamicImportRegex = new RegExp(
729
+ `import\\s*\\(\\s*["']${escapedPkg}(/[^"']*)?["']\\s*\\)`,
730
+ "g",
731
+ );
461
732
 
462
733
  const needsStatic = staticImportRegex.test(transformed);
734
+ staticImportRegex.lastIndex = 0;
463
735
  const needsDynamic = dynamicImportRegex.test(transformed);
736
+ dynamicImportRegex.lastIndex = 0;
464
737
  if (!needsStatic && !needsDynamic) continue;
465
738
 
739
+ const packageDir = pathToFileURL(pathHelper.join(projectDir, "node_modules", pkg)).href;
466
740
  const resolvedUrl = await resolvePackageToFileUrl(pkg);
467
- if (!resolvedUrl) continue;
468
741
 
469
742
  if (needsStatic) {
470
- transformed = transformed.replace(staticImportRegex, `from "${resolvedUrl}"`);
471
- logger.debug(`Resolved ${pkg} -> ${resolvedUrl}`);
743
+ transformed = transformed.replace(staticImportRegex, (_, subpath) => {
744
+ if (subpath) {
745
+ const subUrl = `${packageDir}${subpath}`;
746
+ logger.debug(`Resolved ${pkg}${subpath} -> ${subUrl}`);
747
+ return `from "${subUrl}"`;
748
+ }
749
+ if (!resolvedUrl) return `from "${pkg}"`;
750
+ logger.debug(`Resolved ${pkg} -> ${resolvedUrl}`);
751
+ return `from "${resolvedUrl}"`;
752
+ });
472
753
  }
473
754
 
474
755
  if (needsDynamic) {
475
- transformed = transformed.replace(dynamicImportRegex, `import("${resolvedUrl}")`);
476
- logger.debug(`Resolved dynamic import ${pkg} -> ${resolvedUrl}`);
756
+ transformed = transformed.replace(dynamicImportRegex, (_, subpath) => {
757
+ if (subpath) {
758
+ const subUrl = `${packageDir}${subpath}`;
759
+ return `import("${subUrl}")`;
760
+ }
761
+ if (!resolvedUrl) return `import("${pkg}")`;
762
+ return `import("${resolvedUrl}")`;
763
+ });
477
764
  }
478
765
  }
479
766
 
@@ -577,6 +864,108 @@ async function rewriteExternalImports(
577
864
  transformed = transformed.replace(pattern, replacement);
578
865
  }
579
866
 
867
+ // Rewrite bare Node.js built-in imports to node: prefix for Deno compatibility.
868
+ // npm packages often use require('fs') / from "fs" without the node: prefix.
869
+ for (const mod of NODE_BUILTINS) {
870
+ const escaped = mod.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
871
+ transformed = transformed.replace(
872
+ new RegExp(`from\\s+["']${escaped}["']`, "g"),
873
+ `from "node:${mod}"`,
874
+ );
875
+ transformed = transformed.replace(
876
+ new RegExp(`import\\s*\\(\\s*["']${escaped}["']\\s*\\)`, "g"),
877
+ `import("node:${mod}")`,
878
+ );
879
+ }
880
+
881
+ // Rewrite user-installed npm dependencies.
882
+ // In non-compiled Deno: use npm: specifiers (resolved by Deno's npm support).
883
+ // In compiled binaries: use the createRequire-based `require` shim (already
884
+ // injected by the esbuild banner) to load CJS packages from node_modules,
885
+ // since npm: specifiers only work for packages embedded at compile time.
886
+ if (isCompiledBinary()) {
887
+ for (const name of userDeps.keys()) {
888
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
889
+ // Default imports: import foo from "pkg" → const foo = __vf_interopDefault(require("pkg"))
890
+ // interopDefault unwraps .default for ESM packages transpiled to CJS
891
+ transformed = transformed.replace(
892
+ new RegExp(`import\\s+(\\w+)\\s+from\\s+["']${escaped}["']`, "g"),
893
+ (_, localName) => `const ${localName} = __vf_interopDefault(require("${name}"))`,
894
+ );
895
+ // Named imports: import { a, b } from "pkg" → const { a, b } = require("pkg")
896
+ transformed = transformed.replace(
897
+ new RegExp(`import\\s+(\\{[^}]+\\})\\s+from\\s+["']${escaped}["']`, "g"),
898
+ (_, bindings) => `const ${toCjsDestructureBindings(bindings)} = require("${name}")`,
899
+ );
900
+ // Namespace imports: import * as foo from "pkg" → const foo = require("pkg")
901
+ transformed = transformed.replace(
902
+ new RegExp(`import\\s+\\*\\s+as\\s+(\\w+)\\s+from\\s+["']${escaped}["']`, "g"),
903
+ (_, localName) => `const ${localName} = require("${name}")`,
904
+ );
905
+ // Mixed imports: import foo, { bar } from "pkg"
906
+ transformed = transformed.replace(
907
+ new RegExp(
908
+ `import\\s+(\\w+)\\s*,\\s*(\\{[^}]+\\})\\s+from\\s+["']${escaped}["']`,
909
+ "g",
910
+ ),
911
+ (_, defaultName, bindings) => {
912
+ const tmp = `__vf_tmp_${defaultName}`;
913
+ return `const ${tmp} = require("${name}"); const ${defaultName} = __vf_interopDefault(${tmp}); const ${
914
+ toCjsDestructureBindings(bindings)
915
+ } = ${tmp}`;
916
+ },
917
+ );
918
+ // Subpath static imports: from "pkg/sub" → require("pkg/sub")
919
+ transformed = transformed.replace(
920
+ new RegExp(
921
+ `import\\s+(\\w+|\\*\\s+as\\s+\\w+|\\{[^}]+\\})\\s+from\\s+["']${escaped}(/[^"']+)["']`,
922
+ "g",
923
+ ),
924
+ (_, binding, subpath) => {
925
+ const trimmedBinding = String(binding).trim();
926
+ if (trimmedBinding.startsWith("{")) {
927
+ return `const ${
928
+ toCjsDestructureBindings(trimmedBinding)
929
+ } = require("${name}${subpath}")`;
930
+ }
931
+ const name_ = trimmedBinding.startsWith("*")
932
+ ? trimmedBinding.replace(/\*\s+as\s+/, "")
933
+ : trimmedBinding;
934
+ return `const ${name_} = require("${name}${subpath}")`;
935
+ },
936
+ );
937
+ // Dynamic imports: import("pkg") → Promise.resolve(require("pkg"))
938
+ transformed = transformed.replace(
939
+ new RegExp(`import\\s*\\(\\s*["']${escaped}(/[^"']*)?["']\\s*\\)`, "g"),
940
+ (_, subpath) => `Promise.resolve(require("${name}${subpath || ""}"))`,
941
+ );
942
+ }
943
+ } else {
944
+ for (const [name, version] of userDeps) {
945
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
946
+ // Resolve exact installed version from node_modules (falls back to range)
947
+ let resolvedVersion = version;
948
+ try {
949
+ const pkgPath = pathHelper.join(projectDir, "node_modules", name, "package.json");
950
+ const pkgContent = await fs.readTextFile(pkgPath);
951
+ const pkg = JSON.parse(pkgContent) as { version?: string };
952
+ if (pkg.version) resolvedVersion = pkg.version;
953
+ } catch {
954
+ // Fall back to declared range
955
+ }
956
+ // Static: from "pkg" and from "pkg/sub"
957
+ transformed = transformed.replace(
958
+ new RegExp(`from\\s+["']${escaped}(/[^"']*)?["']`, "g"),
959
+ (_, subpath) => `from "npm:${name}@${resolvedVersion}${subpath || ""}"`,
960
+ );
961
+ // Dynamic: import("pkg") and import("pkg/sub")
962
+ transformed = transformed.replace(
963
+ new RegExp(`import\\s*\\(\\s*["']${escaped}(/[^"']*)?["']\\s*\\)`, "g"),
964
+ (_, subpath) => `import("npm:${name}@${resolvedVersion}${subpath || ""}")`,
965
+ );
966
+ }
967
+ }
968
+
580
969
  // In compiled binaries, "veryfront" resolves to embedded source that can't be
581
970
  // imported from external temp files. Rewrite to use local runtime shims.
582
971
  if (isCompiledBinary()) {
@@ -655,11 +1044,26 @@ async function registerVfModules(subpaths: Set<string>): Promise<void> {
655
1044
  Record<string, unknown>
656
1045
  >;
657
1046
 
1047
+ // __VERYFRONT_MODULES__ is populated by the discovery transpiler via hash
1048
+ // imports (#veryfront/...) which resolve correctly in compiled binaries.
1049
+ // Check it first before attempting bare specifier dynamic imports.
1050
+ const discoveryModules = (dntShim.dntGlobalThis as Record<string, unknown>).__VERYFRONT_MODULES__ as
1051
+ | Record<string, Record<string, unknown>>
1052
+ | undefined;
1053
+
658
1054
  for (const subpath of subpaths) {
659
1055
  if (modules[subpath]) continue;
660
1056
 
1057
+ const specifier = `veryfront/${subpath}`;
1058
+
1059
+ const fromDiscovery = discoveryModules?.[specifier];
1060
+ if (fromDiscovery) {
1061
+ modules[subpath] = fromDiscovery;
1062
+ logger.debug(`[API] Registered module ${specifier} from discovery globals`);
1063
+ continue;
1064
+ }
1065
+
661
1066
  try {
662
- const specifier = `veryfront/${subpath}`;
663
1067
  modules[subpath] = await import(specifier) as Record<string, unknown>;
664
1068
  logger.debug(`[API] Registered module ${specifier} on globalThis`);
665
1069
  } catch (e) {
@@ -97,45 +97,6 @@ export function extractPathParams(pattern: string): PathParam[] {
97
97
  return params;
98
98
  }
99
99
 
100
- /**
101
- * Convert file path to route pattern.
102
- *
103
- * Transforms a file system path to an API route pattern.
104
- *
105
- * @param filePath - File path relative to pages/api or app directory
106
- * @param routePrefix - Prefix to add (e.g., "/api")
107
- * @returns Route pattern
108
- *
109
- * @example
110
- * ```typescript
111
- * filePathToPattern("users/[id]/route.ts", "/api")
112
- * // → "/api/users/[id]"
113
- *
114
- * filePathToPattern("users/[id].ts", "/api")
115
- * // → "/api/users/[id]"
116
- * ```
117
- */
118
- export function filePathToPattern(filePath: string, routePrefix: string = ""): string {
119
- let pattern = filePath
120
- .replace(/\.(ts|tsx|js|jsx)$/, "")
121
- .replace(/\/route$/, "")
122
- .replace(/\/index$/, "");
123
-
124
- if (!pattern.startsWith("/")) pattern = `/${pattern}`;
125
-
126
- if (routePrefix && !pattern.startsWith(routePrefix)) {
127
- pattern = `${routePrefix}${pattern}`;
128
- }
129
-
130
- pattern = pattern.replace(/\/+/g, "/");
131
-
132
- if (pattern.length > 1 && pattern.endsWith("/")) {
133
- pattern = pattern.slice(0, -1);
134
- }
135
-
136
- return pattern;
137
- }
138
-
139
100
  /**
140
101
  * Generate a unique operation ID from method and path.
141
102
  *
@@ -11,6 +11,7 @@ import type { VeryfrontConfig } from "../../../config/index.js";
11
11
  import type { DynamicRouter, RouteEntry } from "../api-route-matcher.js";
12
12
  import { loadHandlerModule } from "../module-loader/loader.js";
13
13
  import {
14
+ getDefaultStatusDescription,
14
15
  OPENAPI_METADATA,
15
16
  type OpenAPIOperation,
16
17
  type OpenAPIParameter,
@@ -261,23 +262,3 @@ function toYaml(obj: unknown, indent: number): string {
261
262
 
262
263
  return String(obj);
263
264
  }
264
-
265
- function getDefaultStatusDescription(statusCode: number): string {
266
- const descriptions: Record<number, string> = {
267
- 200: "Successful response",
268
- 201: "Resource created",
269
- 204: "No content",
270
- 400: "Bad request",
271
- 401: "Unauthorized",
272
- 403: "Forbidden",
273
- 404: "Not found",
274
- 409: "Conflict",
275
- 422: "Unprocessable entity",
276
- 429: "Too many requests",
277
- 500: "Internal server error",
278
- 502: "Bad gateway",
279
- 503: "Service unavailable",
280
- };
281
-
282
- return descriptions[statusCode] || `Response with status ${statusCode}`;
283
- }