veryfront 0.1.128 → 0.1.129

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 (382) hide show
  1. package/esm/cli/router.d.ts +0 -5
  2. package/esm/cli/router.d.ts.map +1 -1
  3. package/esm/cli/router.js +30 -2
  4. package/esm/cli/shared/update-check.d.ts +4 -0
  5. package/esm/cli/shared/update-check.d.ts.map +1 -0
  6. package/esm/cli/shared/update-check.js +97 -0
  7. package/esm/deno.d.ts +5 -0
  8. package/esm/deno.js +13 -8
  9. package/esm/src/channels/control-plane.d.ts.map +1 -1
  10. package/esm/src/channels/control-plane.js +5 -5
  11. package/esm/src/channels/invoke.d.ts +1 -1
  12. package/esm/src/channels/invoke.d.ts.map +1 -1
  13. package/esm/src/channels/invoke.js +6 -6
  14. package/esm/src/chat/index.d.ts +12 -24
  15. package/esm/src/chat/index.d.ts.map +1 -1
  16. package/esm/src/chat/index.js +5 -25
  17. package/esm/src/config/env.d.ts.map +1 -1
  18. package/esm/src/config/env.js +18 -10
  19. package/esm/src/data/static-data-fetcher.d.ts +3 -0
  20. package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
  21. package/esm/src/data/static-data-fetcher.js +29 -25
  22. package/esm/src/data/static-paths-fetcher.d.ts.map +1 -1
  23. package/esm/src/data/static-paths-fetcher.js +3 -2
  24. package/esm/src/errors/logging.d.ts.map +1 -1
  25. package/esm/src/errors/logging.js +16 -7
  26. package/esm/src/errors/user-friendly/error-formatter.d.ts.map +1 -1
  27. package/esm/src/errors/user-friendly/error-formatter.js +9 -25
  28. package/esm/src/fs/index.d.ts +11 -12
  29. package/esm/src/fs/index.d.ts.map +1 -1
  30. package/esm/src/fs/index.js +11 -24
  31. package/esm/src/html/dev-scripts.d.ts.map +1 -1
  32. package/esm/src/html/dev-scripts.js +5 -8
  33. package/esm/src/html/html-escape.d.ts +1 -0
  34. package/esm/src/html/html-escape.d.ts.map +1 -1
  35. package/esm/src/html/html-escape.js +3 -0
  36. package/esm/src/html/html-injection.js +2 -2
  37. package/esm/src/html/html-shell-generator.d.ts +5 -2
  38. package/esm/src/html/html-shell-generator.d.ts.map +1 -1
  39. package/esm/src/html/html-shell-generator.js +41 -30
  40. package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -2
  41. package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -2
  42. package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
  43. package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -6
  44. package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -2
  45. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts +3 -1
  46. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
  47. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +2 -2
  48. package/esm/src/html/hydration-script-builder/index.d.ts +1 -1
  49. package/esm/src/html/hydration-script-builder/index.d.ts.map +1 -1
  50. package/esm/src/html/hydration-script-builder/index.js +1 -1
  51. package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -2
  52. package/esm/src/html/hydration-script-builder/prod-scripts.d.ts +2 -0
  53. package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
  54. package/esm/src/html/hydration-script-builder/prod-scripts.js +14 -14
  55. package/esm/src/html/schemas/html.schema.d.ts +2 -0
  56. package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
  57. package/esm/src/html/schemas/html.schema.js +2 -0
  58. package/esm/src/html/styles-builder/css-pregeneration.d.ts +17 -1
  59. package/esm/src/html/styles-builder/css-pregeneration.d.ts.map +1 -1
  60. package/esm/src/html/styles-builder/css-pregeneration.js +103 -1
  61. package/esm/src/html/styles-builder/dev-styles.js +2 -2
  62. package/esm/src/html/utils.d.ts +2 -0
  63. package/esm/src/html/utils.d.ts.map +1 -1
  64. package/esm/src/html/utils.js +49 -28
  65. package/esm/src/integrations/remote-tools.d.ts.map +1 -1
  66. package/esm/src/integrations/remote-tools.js +32 -39
  67. package/esm/src/internal-agents/ag-ui-sse.d.ts +0 -1
  68. package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
  69. package/esm/src/internal-agents/ag-ui-sse.js +2 -16
  70. package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
  71. package/esm/src/internal-agents/control-plane-auth.js +5 -3
  72. package/esm/src/internal-agents/request-body.d.ts.map +1 -1
  73. package/esm/src/internal-agents/request-body.js +6 -3
  74. package/esm/src/internal-agents/session-manager.d.ts +1 -0
  75. package/esm/src/internal-agents/session-manager.d.ts.map +1 -1
  76. package/esm/src/internal-agents/session-manager.js +12 -18
  77. package/esm/src/issues/core.d.ts.map +1 -1
  78. package/esm/src/issues/core.js +24 -23
  79. package/esm/src/issues/schemas/issue.schema.d.ts.map +1 -1
  80. package/esm/src/issues/schemas/issue.schema.js +2 -1
  81. package/esm/src/jobs/runtime-env.d.ts.map +1 -1
  82. package/esm/src/jobs/runtime-env.js +21 -44
  83. package/esm/src/markdown/index.d.ts +1 -2
  84. package/esm/src/markdown/index.d.ts.map +1 -1
  85. package/esm/src/markdown/index.js +1 -6
  86. package/esm/src/mcp/server.d.ts +0 -1
  87. package/esm/src/mcp/server.d.ts.map +1 -1
  88. package/esm/src/mcp/server.js +40 -41
  89. package/esm/src/mdx/index.d.ts +3 -2
  90. package/esm/src/mdx/index.d.ts.map +1 -1
  91. package/esm/src/mdx/index.js +3 -5
  92. package/esm/src/middleware/builtin/logger.d.ts.map +1 -1
  93. package/esm/src/middleware/builtin/logger.js +31 -28
  94. package/esm/src/middleware/builtin/security/rate-limit.d.ts.map +1 -1
  95. package/esm/src/middleware/builtin/security/rate-limit.js +17 -12
  96. package/esm/src/middleware/builtin/timeout.d.ts.map +1 -1
  97. package/esm/src/middleware/builtin/timeout.js +17 -10
  98. package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
  99. package/esm/src/modules/import-map/default-import-map.js +4 -3
  100. package/esm/src/oauth/handlers/callback-handler.d.ts +0 -5
  101. package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
  102. package/esm/src/oauth/handlers/callback-handler.js +9 -14
  103. package/esm/src/oauth/handlers/index.d.ts +1 -1
  104. package/esm/src/oauth/handlers/index.js +1 -1
  105. package/esm/src/oauth/handlers/init-handler.d.ts.map +1 -1
  106. package/esm/src/oauth/handlers/init-handler.js +32 -20
  107. package/esm/src/oauth/providers/index.d.ts +1 -1
  108. package/esm/src/oauth/providers/index.js +1 -1
  109. package/esm/src/oauth/schemas/index.d.ts +1 -1
  110. package/esm/src/oauth/schemas/index.js +1 -1
  111. package/esm/src/oauth/token-store/index.d.ts +1 -1
  112. package/esm/src/oauth/token-store/index.js +1 -1
  113. package/esm/src/oauth/token-store/memory.d.ts +1 -1
  114. package/esm/src/oauth/token-store/memory.d.ts.map +1 -1
  115. package/esm/src/oauth/token-store/memory.js +8 -8
  116. package/esm/src/observability/request-profiler.d.ts +31 -0
  117. package/esm/src/observability/request-profiler.d.ts.map +1 -0
  118. package/esm/src/observability/request-profiler.js +94 -0
  119. package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
  120. package/esm/src/observability/tracing/otlp-setup.js +16 -21
  121. package/esm/src/prompt/factory.d.ts.map +1 -1
  122. package/esm/src/prompt/factory.js +10 -12
  123. package/esm/src/prompt/registry.d.ts.map +1 -1
  124. package/esm/src/prompt/registry.js +12 -10
  125. package/esm/src/prompt/schemas/prompt.schema.d.ts.map +1 -1
  126. package/esm/src/prompt/schemas/prompt.schema.js +0 -2
  127. package/esm/src/prompt/types.d.ts +1 -1
  128. package/esm/src/prompt/types.d.ts.map +1 -1
  129. package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
  130. package/esm/src/provider/local/ai-sdk-adapter.js +3 -8
  131. package/esm/src/provider/local/env.d.ts +4 -6
  132. package/esm/src/provider/local/env.d.ts.map +1 -1
  133. package/esm/src/provider/local/env.js +14 -1
  134. package/esm/src/provider/local/local-engine.d.ts.map +1 -1
  135. package/esm/src/provider/local/local-engine.js +2 -7
  136. package/esm/src/provider/model-registry.d.ts.map +1 -1
  137. package/esm/src/provider/model-registry.js +2 -7
  138. package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
  139. package/esm/src/provider/veryfront-cloud/provider.js +1 -7
  140. package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
  141. package/esm/src/provider/veryfront-cloud/shared.js +9 -11
  142. package/esm/src/proxy/handler.d.ts.map +1 -1
  143. package/esm/src/proxy/handler.js +56 -57
  144. package/esm/src/react/compat/hooks-adapter.d.ts +1 -7
  145. package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
  146. package/esm/src/react/compat/hooks-adapter.js +35 -40
  147. package/esm/src/react/components/Head.d.ts +1 -26
  148. package/esm/src/react/components/Head.d.ts.map +1 -1
  149. package/esm/src/react/components/Head.js +1 -172
  150. package/esm/src/react/context/index.d.ts +2 -46
  151. package/esm/src/react/context/index.d.ts.map +1 -1
  152. package/esm/src/react/context/index.js +1 -44
  153. package/esm/src/react/head-collector.d.ts +1 -10
  154. package/esm/src/react/head-collector.d.ts.map +1 -1
  155. package/esm/src/react/head-collector.js +4 -0
  156. package/esm/src/react/router/index.d.ts +2 -45
  157. package/esm/src/react/router/index.d.ts.map +1 -1
  158. package/esm/src/react/router/index.js +1 -49
  159. package/esm/src/react/runtime/core.d.ts +49 -0
  160. package/esm/src/react/runtime/core.d.ts.map +1 -0
  161. package/esm/src/react/runtime/core.js +200 -0
  162. package/esm/src/rendering/orchestrator/html.d.ts +2 -0
  163. package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
  164. package/esm/src/rendering/orchestrator/html.js +69 -12
  165. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
  166. package/esm/src/rendering/orchestrator/ssr-orchestrator.js +4 -0
  167. package/esm/src/rendering/orchestrator/types.d.ts +4 -0
  168. package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
  169. package/esm/src/repositories/types.d.ts.map +1 -1
  170. package/esm/src/resource/factory.d.ts.map +1 -1
  171. package/esm/src/resource/factory.js +12 -9
  172. package/esm/src/resource/registry.d.ts +3 -3
  173. package/esm/src/resource/registry.d.ts.map +1 -1
  174. package/esm/src/resource/registry.js +7 -7
  175. package/esm/src/schemas/common.d.ts.map +1 -1
  176. package/esm/src/schemas/common.js +7 -4
  177. package/esm/src/security/http/config.d.ts +0 -1
  178. package/esm/src/security/http/config.d.ts.map +1 -1
  179. package/esm/src/security/http/config.js +3 -16
  180. package/esm/src/security/http/response/security-handler.d.ts +1 -0
  181. package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
  182. package/esm/src/security/http/response/security-handler.js +17 -12
  183. package/esm/src/security/index.d.ts +4 -2
  184. package/esm/src/security/index.d.ts.map +1 -1
  185. package/esm/src/security/index.js +3 -1
  186. package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
  187. package/esm/src/server/handlers/dev/styles-css.handler.js +8 -7
  188. package/esm/src/server/handlers/monitoring/metrics.handler.d.ts.map +1 -1
  189. package/esm/src/server/handlers/monitoring/metrics.handler.js +3 -1
  190. package/esm/src/server/handlers/request/module/module-server-handler.d.ts.map +1 -1
  191. package/esm/src/server/handlers/request/module/module-server-handler.js +18 -15
  192. package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts +8 -0
  193. package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts.map +1 -0
  194. package/esm/src/server/handlers/request/prod-hydration-module.handler.js +41 -0
  195. package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
  196. package/esm/src/server/handlers/request/ssr/ssr.handler.js +3 -0
  197. package/esm/src/server/production-server.d.ts.map +1 -1
  198. package/esm/src/server/production-server.js +65 -0
  199. package/esm/src/server/runtime-handler/handler-context-builder.d.ts +1 -1
  200. package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
  201. package/esm/src/server/runtime-handler/index.d.ts +1 -1
  202. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  203. package/esm/src/server/runtime-handler/index.js +36 -11
  204. package/esm/src/server/runtime-handler/request-utils.d.ts +7 -0
  205. package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
  206. package/esm/src/server/runtime-handler/request-utils.js +10 -0
  207. package/esm/src/server/services/rendering/ssr.service.d.ts +1 -0
  208. package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
  209. package/esm/src/server/services/rendering/ssr.service.js +12 -5
  210. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  211. package/esm/src/skill/allowed-tools.d.ts +3 -8
  212. package/esm/src/skill/allowed-tools.d.ts.map +1 -1
  213. package/esm/src/skill/executor.js +2 -2
  214. package/esm/src/skill/parser.d.ts.map +1 -1
  215. package/esm/src/skill/parser.js +12 -12
  216. package/esm/src/skill/path-safety.js +1 -1
  217. package/esm/src/skill/tools.d.ts.map +1 -1
  218. package/esm/src/skill/tools.js +18 -11
  219. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
  220. package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
  221. package/esm/src/task/discovery.d.ts.map +1 -1
  222. package/esm/src/task/discovery.js +73 -95
  223. package/esm/src/tool/executor.d.ts.map +1 -1
  224. package/esm/src/tool/executor.js +8 -7
  225. package/esm/src/tool/factory.d.ts.map +1 -1
  226. package/esm/src/tool/factory.js +13 -16
  227. package/esm/src/transforms/esm/package-registry.d.ts +4 -0
  228. package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
  229. package/esm/src/transforms/esm/package-registry.js +34 -17
  230. package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.d.ts.map +1 -1
  231. package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.js +2 -1
  232. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
  233. package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +26 -1
  234. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -1
  235. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
  236. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +1 -1
  237. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts +1 -0
  238. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts.map +1 -1
  239. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.js +3 -0
  240. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
  241. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +1 -1
  242. package/esm/src/transforms/veryfront-module-urls.d.ts.map +1 -1
  243. package/esm/src/transforms/veryfront-module-urls.js +7 -3
  244. package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
  245. package/esm/src/types/entities/getEntityInfo.js +79 -127
  246. package/esm/src/utils/path-utils.d.ts +1 -1
  247. package/esm/src/utils/path-utils.d.ts.map +1 -1
  248. package/esm/src/utils/path-utils.js +16 -7
  249. package/esm/src/utils/version-constant.d.ts +1 -1
  250. package/esm/src/utils/version-constant.js +1 -1
  251. package/esm/src/utils/version.d.ts.map +1 -1
  252. package/esm/src/utils/version.js +0 -1
  253. package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts.map +1 -1
  254. package/esm/src/workflow/worker/dynamic-job-entrypoint.js +5 -72
  255. package/esm/src/workflow/worker/job-entrypoint.d.ts.map +1 -1
  256. package/esm/src/workflow/worker/job-entrypoint.js +5 -72
  257. package/esm/src/workflow/worker/shared.d.ts +18 -0
  258. package/esm/src/workflow/worker/shared.d.ts.map +1 -0
  259. package/esm/src/workflow/worker/shared.js +77 -0
  260. package/package.json +1 -1
  261. package/src/cli/router.ts +41 -2
  262. package/src/cli/shared/update-check.ts +110 -0
  263. package/src/deno.js +13 -8
  264. package/src/src/channels/control-plane.ts +6 -10
  265. package/src/src/channels/invoke.ts +7 -7
  266. package/src/src/chat/index.ts +96 -132
  267. package/src/src/config/env.ts +24 -11
  268. package/src/src/data/static-data-fetcher.ts +59 -34
  269. package/src/src/data/static-paths-fetcher.ts +4 -2
  270. package/src/src/errors/logging.ts +21 -7
  271. package/src/src/errors/user-friendly/error-formatter.ts +14 -29
  272. package/src/src/fs/index.ts +21 -30
  273. package/src/src/html/dev-scripts.ts +5 -9
  274. package/src/src/html/html-escape.ts +4 -0
  275. package/src/src/html/html-injection.ts +2 -2
  276. package/src/src/html/html-shell-generator.ts +60 -26
  277. package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -2
  278. package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -2
  279. package/src/src/html/hydration-script-builder/dev-error-logger.ts +2 -8
  280. package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -2
  281. package/src/src/html/hydration-script-builder/hydration-data-generator.ts +2 -1
  282. package/src/src/html/hydration-script-builder/index.ts +5 -1
  283. package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -2
  284. package/src/src/html/hydration-script-builder/prod-scripts.ts +16 -15
  285. package/src/src/html/schemas/html.schema.ts +2 -0
  286. package/src/src/html/styles-builder/css-pregeneration.ts +133 -1
  287. package/src/src/html/styles-builder/dev-styles.ts +2 -2
  288. package/src/src/html/utils.ts +62 -29
  289. package/src/src/integrations/remote-tools.ts +39 -37
  290. package/src/src/internal-agents/ag-ui-sse.ts +2 -17
  291. package/src/src/internal-agents/control-plane-auth.ts +8 -6
  292. package/src/src/internal-agents/request-body.ts +7 -5
  293. package/src/src/internal-agents/session-manager.ts +16 -20
  294. package/src/src/issues/core.ts +24 -27
  295. package/src/src/issues/schemas/issue.schema.ts +3 -1
  296. package/src/src/jobs/runtime-env.ts +24 -50
  297. package/src/src/markdown/index.ts +5 -8
  298. package/src/src/mcp/server.ts +50 -53
  299. package/src/src/mdx/index.ts +7 -8
  300. package/src/src/middleware/builtin/logger.ts +44 -29
  301. package/src/src/middleware/builtin/security/rate-limit.ts +20 -11
  302. package/src/src/middleware/builtin/timeout.ts +22 -13
  303. package/src/src/modules/import-map/default-import-map.ts +4 -3
  304. package/src/src/oauth/handlers/callback-handler.ts +9 -16
  305. package/src/src/oauth/handlers/index.ts +1 -1
  306. package/src/src/oauth/handlers/init-handler.ts +56 -27
  307. package/src/src/oauth/providers/index.ts +1 -1
  308. package/src/src/oauth/schemas/index.ts +1 -1
  309. package/src/src/oauth/token-store/index.ts +1 -1
  310. package/src/src/oauth/token-store/memory.ts +8 -8
  311. package/src/src/observability/request-profiler.ts +140 -0
  312. package/src/src/observability/tracing/otlp-setup.ts +16 -22
  313. package/src/src/prompt/factory.ts +16 -14
  314. package/src/src/prompt/registry.ts +14 -13
  315. package/src/src/prompt/schemas/prompt.schema.ts +0 -4
  316. package/src/src/prompt/types.ts +1 -2
  317. package/src/src/provider/local/ai-sdk-adapter.ts +3 -10
  318. package/src/src/provider/local/env.ts +22 -2
  319. package/src/src/provider/local/local-engine.ts +2 -9
  320. package/src/src/provider/model-registry.ts +2 -9
  321. package/src/src/provider/veryfront-cloud/provider.ts +1 -8
  322. package/src/src/provider/veryfront-cloud/shared.ts +12 -15
  323. package/src/src/proxy/handler.ts +90 -74
  324. package/src/src/react/compat/hooks-adapter.ts +43 -44
  325. package/src/src/react/components/Head.tsx +1 -181
  326. package/src/src/react/context/index.tsx +2 -83
  327. package/src/src/react/head-collector.ts +9 -0
  328. package/src/src/react/router/index.tsx +2 -100
  329. package/src/src/react/runtime/core.ts +303 -0
  330. package/src/src/rendering/orchestrator/html.ts +122 -18
  331. package/src/src/rendering/orchestrator/ssr-orchestrator.ts +8 -0
  332. package/src/src/rendering/orchestrator/types.ts +4 -0
  333. package/src/src/repositories/types.ts +0 -4
  334. package/src/src/resource/factory.ts +15 -11
  335. package/src/src/resource/registry.ts +7 -7
  336. package/src/src/schemas/common.ts +8 -5
  337. package/src/src/security/http/config.ts +3 -19
  338. package/src/src/security/http/response/security-handler.ts +22 -13
  339. package/src/src/security/index.ts +4 -7
  340. package/src/src/server/handlers/dev/styles-css.handler.ts +32 -14
  341. package/src/src/server/handlers/monitoring/metrics.handler.ts +3 -1
  342. package/src/src/server/handlers/request/module/module-server-handler.ts +24 -17
  343. package/src/src/server/handlers/request/prod-hydration-module.handler.ts +61 -0
  344. package/src/src/server/handlers/request/ssr/ssr.handler.ts +3 -0
  345. package/src/src/server/production-server.ts +84 -0
  346. package/src/src/server/runtime-handler/handler-context-builder.ts +1 -1
  347. package/src/src/server/runtime-handler/index.ts +44 -13
  348. package/src/src/server/runtime-handler/request-utils.ts +11 -0
  349. package/src/src/server/services/rendering/ssr.service.ts +31 -18
  350. package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
  351. package/src/src/skill/allowed-tools.ts +1 -8
  352. package/src/src/skill/executor.ts +2 -2
  353. package/src/src/skill/parser.ts +13 -20
  354. package/src/src/skill/path-safety.ts +1 -1
  355. package/src/src/skill/tools.ts +27 -20
  356. package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
  357. package/src/src/task/discovery.ts +97 -97
  358. package/src/src/tool/executor.ts +10 -8
  359. package/src/src/tool/factory.ts +21 -22
  360. package/src/src/tool/types.ts +0 -17
  361. package/src/src/transforms/esm/package-registry.ts +52 -20
  362. package/src/src/transforms/import-rewriter/strategies/veryfront-strategy.ts +2 -1
  363. package/src/src/transforms/mdx/esm-module-loader/cache-format.ts +34 -1
  364. package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +1 -1
  365. package/src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts +4 -0
  366. package/src/src/transforms/pipeline/stages/ssr-vf-modules/index.ts +1 -1
  367. package/src/src/transforms/veryfront-module-urls.ts +6 -2
  368. package/src/src/types/entities/getEntityInfo.ts +131 -152
  369. package/src/src/utils/path-utils.ts +16 -7
  370. package/src/src/utils/version-constant.ts +1 -1
  371. package/src/src/utils/version.ts +0 -1
  372. package/src/src/workflow/worker/dynamic-job-entrypoint.ts +18 -84
  373. package/src/src/workflow/worker/job-entrypoint.ts +18 -85
  374. package/src/src/workflow/worker/shared.ts +127 -0
  375. package/esm/src/prompt/schemas/index.d.ts +0 -7
  376. package/esm/src/prompt/schemas/index.d.ts.map +0 -1
  377. package/esm/src/prompt/schemas/index.js +0 -6
  378. package/esm/src/security/http/handlers-index.d.ts +0 -5
  379. package/esm/src/security/http/handlers-index.d.ts.map +0 -1
  380. package/esm/src/security/http/handlers-index.js +0 -3
  381. package/src/src/prompt/schemas/index.ts +0 -7
  382. package/src/src/security/http/handlers-index.ts +0 -4
@@ -3,6 +3,7 @@ import type { HandlerContext, HandlerResult } from "../../types.js";
3
3
  import { ResponseBuilder } from "../../../../security/index.js";
4
4
  import { withSpan } from "../../../../observability/tracing/otlp-setup.js";
5
5
  import { resolveProjectReactVersion } from "../../../../transforms/esm/package-registry.js";
6
+ import { profilePhase } from "../../../../observability/request-profiler.js";
6
7
 
7
8
  export function handleModuleServer(
8
9
  req: dntShim.Request,
@@ -18,24 +19,30 @@ export function handleModuleServer(
18
19
  "module.server.handle",
19
20
  async () => {
20
21
  try {
21
- const reactVersion = await resolveProjectReactVersion({
22
- projectDir: ctx.projectDir,
23
- config: ctx.config,
24
- });
22
+ const reactVersion = await profilePhase(
23
+ "module.resolve_react_version",
24
+ () =>
25
+ resolveProjectReactVersion({
26
+ projectDir: ctx.projectDir,
27
+ config: ctx.config,
28
+ }),
29
+ );
25
30
 
26
- const { serveModule } = await import("../../../../modules/server/index.js");
27
- const moduleResponse = await serveModule(req, {
28
- projectId: ctx.projectId ?? ctx.projectDir,
29
- projectDir: ctx.projectDir,
30
- adapter: ctx.adapter,
31
- dev: !!ctx.isLocalProject,
32
- projectUUID: ctx.projectId,
33
- projectSlug: ctx.projectSlug,
34
- branch: ctx.parsedDomain?.branch ?? null,
35
- releaseId: ctx.releaseId ?? null,
36
- allowedImportDirs: ctx.config?.security?.allowedImportDirs,
37
- reactVersion,
38
- mode: ctx.requestContext?.mode,
31
+ const moduleResponse = await profilePhase("module.serve", async () => {
32
+ const { serveModule } = await import("../../../../modules/server/index.js");
33
+ return await serveModule(req, {
34
+ projectId: ctx.projectId ?? ctx.projectDir,
35
+ projectDir: ctx.projectDir,
36
+ adapter: ctx.adapter,
37
+ dev: !!ctx.isLocalProject,
38
+ projectUUID: ctx.projectId,
39
+ projectSlug: ctx.projectSlug,
40
+ branch: ctx.parsedDomain?.branch ?? null,
41
+ releaseId: ctx.releaseId ?? null,
42
+ allowedImportDirs: ctx.config?.security?.allowedImportDirs,
43
+ reactVersion,
44
+ mode: ctx.requestContext?.mode,
45
+ });
39
46
  });
40
47
 
41
48
  const response = createResponseBuilder(ctx)
@@ -0,0 +1,61 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { BaseHandler } from "../response/base.js";
3
+ import type { HandlerContext, HandlerMetadata, HandlerPriority, HandlerResult } from "../types.js";
4
+ import {
5
+ generateProdHydrationModule,
6
+ PROD_HYDRATION_MODULE_PATH,
7
+ } from "../../../html/hydration-script-builder/prod-scripts.js";
8
+ import { computeStrongEtag, hasMatchingEtag } from "../utils/etag.js";
9
+ import { HTTP_OK, PRIORITY_HIGH_DEV } from "../../../utils/constants/index.js";
10
+
11
+ let cachedModule: { js: string; etag: string } | null = null;
12
+
13
+ function getProdHydrationModuleBundle(): { js: string; etag: string } {
14
+ if (cachedModule) return cachedModule;
15
+
16
+ const js = generateProdHydrationModule();
17
+ cachedModule = {
18
+ js,
19
+ etag: computeStrongEtag(js),
20
+ };
21
+ return cachedModule;
22
+ }
23
+
24
+ export class ProdHydrationModuleHandler extends BaseHandler {
25
+ metadata: HandlerMetadata = {
26
+ name: "ProdHydrationModuleHandler",
27
+ priority: PRIORITY_HIGH_DEV as HandlerPriority,
28
+ patterns: [
29
+ { pattern: PROD_HYDRATION_MODULE_PATH, exact: true, method: "GET" },
30
+ { pattern: PROD_HYDRATION_MODULE_PATH, exact: true, method: "HEAD" },
31
+ ],
32
+ };
33
+
34
+ async handle(req: dntShim.Request, ctx: HandlerContext): Promise<HandlerResult> {
35
+ if (!this.shouldHandle(req, ctx)) {
36
+ return this.continue();
37
+ }
38
+
39
+ const method = req.method.toUpperCase();
40
+ const { js, etag } = getProdHydrationModuleBundle();
41
+ const builder = this.createResponseBuilder(ctx).withCORS(req, ctx.securityConfig?.cors);
42
+
43
+ if (hasMatchingEtag(req, etag)) {
44
+ return this.respond(
45
+ builder.withSecurity(ctx.securityConfig ?? undefined, req).notModified(etag),
46
+ );
47
+ }
48
+
49
+ return this.respond(
50
+ builder
51
+ .withSecurity(ctx.securityConfig ?? undefined, req)
52
+ .withCache("no-cache")
53
+ .withETag(etag)
54
+ .withContentType(
55
+ "application/javascript; charset=utf-8",
56
+ method === "HEAD" ? null : js,
57
+ HTTP_OK,
58
+ ),
59
+ );
60
+ }
61
+ }
@@ -193,6 +193,8 @@ export class SSRHandler extends BaseHandler {
193
193
  const pageId = url.searchParams.get("page_id") || undefined;
194
194
  const noHmr = url.searchParams.get("noHmr") === "1" ||
195
195
  url.searchParams.get("no_hmr") === "1";
196
+ const forceProductionScripts = url.searchParams.get("forceProductionScripts") === "1" ||
197
+ url.searchParams.get("force_production_scripts") === "1";
196
198
  const useNoCache = shouldUseNoCacheHeadersFromHandler(ctx);
197
199
 
198
200
  const result = await this.ssrService.renderPage(ctx, {
@@ -204,6 +206,7 @@ export class SSRHandler extends BaseHandler {
204
206
  projectId,
205
207
  pageId,
206
208
  noHmr,
209
+ forceProductionScripts,
207
210
  useNoCache,
208
211
  });
209
212
 
@@ -18,6 +18,14 @@ import {
18
18
  stopMemoryMonitoring,
19
19
  } from "../utils/memory/index.js";
20
20
  import { initializeDistributedCaches } from "../cache/distributed-cache-init.js";
21
+ import { getConfig } from "../config/index.js";
22
+ import { resolveStyleContentVersion } from "../html/styles-builder/content-version.js";
23
+ import {
24
+ buildPreparedCSSArtifactFromFiles,
25
+ collectLocalProjectSourceFiles,
26
+ readLocalProjectStylesheet,
27
+ } from "../html/styles-builder/css-pregeneration.js";
28
+ import { createStyleScopeProfile } from "../html/styles-builder/style-scope-profile.js";
21
29
  import { setServerInitialized } from "./handlers/monitoring/health.handler.js";
22
30
  import {
23
31
  enableSSRClientOnlyFetching,
@@ -39,6 +47,74 @@ const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS = 25_000;
39
47
  /** Default port when PORT / VERYFRONT_PORT env vars are not set */
40
48
  const DEFAULT_SERVER_PORT = 3_000;
41
49
 
50
+ async function prewarmLocalProductionCSSArtifacts(
51
+ adapter: RuntimeAdapter,
52
+ options: Pick<
53
+ StartProductionServerOptions,
54
+ | "projectDir"
55
+ | "defaultProjectSlug"
56
+ | "defaultProjectId"
57
+ | "defaultEnvironment"
58
+ | "localProjects"
59
+ >,
60
+ ): Promise<void> {
61
+ if (options.defaultEnvironment !== "production") return;
62
+
63
+ const projectsToWarm = new Map<string, string>();
64
+
65
+ if (options.localProjects) {
66
+ for (const [projectSlug, projectDir] of Object.entries(options.localProjects)) {
67
+ projectsToWarm.set(projectSlug, projectDir);
68
+ }
69
+ }
70
+
71
+ if (options.defaultProjectSlug && options.projectDir) {
72
+ projectsToWarm.set(options.defaultProjectSlug, options.projectDir);
73
+ } else if (projectsToWarm.size === 0 && options.defaultProjectId && options.projectDir) {
74
+ projectsToWarm.set(options.defaultProjectId, options.projectDir);
75
+ }
76
+
77
+ if (projectsToWarm.size === 0) return;
78
+
79
+ await Promise.all([...projectsToWarm.entries()].map(async ([projectSlug, projectDir]) => {
80
+ try {
81
+ const config = await getConfig(projectDir, adapter, { cacheKey: projectSlug });
82
+ const styleProfile = createStyleScopeProfile(config);
83
+ const files = await collectLocalProjectSourceFiles({
84
+ projectDir,
85
+ styleProfile,
86
+ });
87
+ const stylesheet = await readLocalProjectStylesheet(projectDir, config?.tailwind?.stylesheet);
88
+
89
+ const result = await buildPreparedCSSArtifactFromFiles({
90
+ projectSlug,
91
+ projectVersion: resolveStyleContentVersion(null),
92
+ projectDir,
93
+ files,
94
+ styleProfile,
95
+ stylesheet,
96
+ stylesheetPath: config?.tailwind?.stylesheet,
97
+ minify: true,
98
+ environment: "preview",
99
+ buildMode: "production",
100
+ });
101
+
102
+ serverLog.debug("Prewarmed local production CSS artifact", {
103
+ projectSlug,
104
+ projectDir,
105
+ fileCount: files.length,
106
+ fromCache: result.fromCache,
107
+ });
108
+ } catch (error) {
109
+ serverLog.debug("Skipping local production CSS prewarm", {
110
+ projectSlug,
111
+ projectDir,
112
+ error: error instanceof Error ? error.message : String(error),
113
+ });
114
+ }
115
+ }));
116
+ }
117
+
42
118
  /** Configuration for AI primitives discovery during server startup */
43
119
  export interface DiscoveryOptions {
44
120
  baseDir: string;
@@ -117,6 +193,14 @@ export function startProductionServer(
117
193
  logger.debug("FSAdapter initialized", { type: bootstrap.fsAdapterType });
118
194
  }
119
195
 
196
+ await prewarmLocalProductionCSSArtifacts(bootstrap.adapter, {
197
+ projectDir,
198
+ defaultProjectSlug,
199
+ defaultProjectId,
200
+ defaultEnvironment,
201
+ localProjects,
202
+ });
203
+
120
204
  // Enable SSR fetch interception to handle relative URLs during SSR
121
205
  setSSRServerPort(port);
122
206
  enableSSRFetchInterception();
@@ -19,7 +19,7 @@ import type { RouteRegistry } from "../../routing/registry/index.js";
19
19
  import { buildEnrichedContext } from "../context/enriched-context.js";
20
20
  import { computeContentSourceId } from "../../cache/keys.js";
21
21
 
22
- interface HandlerContextOptions {
22
+ export interface HandlerContextOptions {
23
23
  /** Project directory */
24
24
  projectDir: string;
25
25
  /** Runtime adapter */
@@ -34,6 +34,10 @@ import { CsrfHandler } from "../../security/http/csrf/csrf-handler.js";
34
34
  import { CorsHandler } from "../handlers/response/cors.js";
35
35
  import { HealthHandler } from "../handlers/monitoring/health.handler.js";
36
36
  import { MetricsHandler } from "../handlers/monitoring/metrics.handler.js";
37
+ import {
38
+ finalizeRequestProfiling,
39
+ runWithRequestProfiling,
40
+ } from "../../observability/request-profiler.js";
37
41
  import { ClientLogHandler } from "../handlers/monitoring/client-log.handler.js";
38
42
  import { MemoryDebugHandler } from "../handlers/monitoring/memory.handler.js";
39
43
  import { DevEndpointsHandler } from "../handlers/dev/endpoints.handler.js";
@@ -44,6 +48,7 @@ import { StudioBridgeModulesHandler } from "../handlers/studio/bridge-modules.ha
44
48
  import { StaticHandler } from "../handlers/request/static.handler.js";
45
49
  import { SnippetHandler } from "../handlers/request/snippet.handler.js";
46
50
  import { LibModulesHandler } from "../handlers/request/lib-modules.handler.js";
51
+ import { ProdHydrationModuleHandler } from "../handlers/request/prod-hydration-module.handler.js";
47
52
  import { CSSHandler } from "../handlers/request/css.handler.js";
48
53
  import { RSCHandler } from "../handlers/request/rsc/index.js";
49
54
  import { ModuleHandler } from "../handlers/request/module/index.js";
@@ -99,6 +104,7 @@ import {
99
104
  isLightweightPath,
100
105
  isMonitoringPath,
101
106
  isWebSocketPath,
107
+ shouldSkipEnrichedContext,
102
108
  } from "./request-utils.js";
103
109
  import { withRequestTimeout } from "./timeout-manager.js";
104
110
  import {
@@ -138,6 +144,7 @@ export const HANDLER_NAMES = [
138
144
  "DevDashboardHandler",
139
145
  "ProjectsHandler",
140
146
  "StudioBridgeModulesHandler",
147
+ "ProdHydrationModuleHandler",
141
148
  "CSSHandler",
142
149
  "DevFileHandler",
143
150
  "SnippetHandler",
@@ -192,6 +199,7 @@ const handlerFactories: Record<
192
199
  DevDashboardHandler: () => new DevDashboardHandler(),
193
200
  ProjectsHandler: () => new ProjectsHandler(),
194
201
  StudioBridgeModulesHandler: () => new StudioBridgeModulesHandler(),
202
+ ProdHydrationModuleHandler: () => new ProdHydrationModuleHandler(),
195
203
  CSSHandler: () => new CSSHandler(),
196
204
  DevFileHandler: () => new DevFileHandler(),
197
205
  SnippetHandler: () => new SnippetHandler(),
@@ -551,7 +559,7 @@ export function createVeryfrontHandler(
551
559
  return envRes.errorResponse;
552
560
  }
553
561
 
554
- const isInternalAgentControlPlanePath = url.pathname.startsWith("/internal/agents/");
562
+ const skipRenderEnrichedContext = shouldSkipEnrichedContext(url.pathname);
555
563
 
556
564
  // Build handler context
557
565
  const ctx = buildHandlerContext({
@@ -573,7 +581,7 @@ export function createVeryfrontHandler(
573
581
  isLocalProject: adapterRes.isLocalProject,
574
582
  moduleServerUrl: opts.moduleServerUrl,
575
583
  environmentId: headers.environmentId,
576
- skipEnrichedContext: isInternalAgentControlPlanePath,
584
+ skipEnrichedContext: skipRenderEnrichedContext,
577
585
  });
578
586
 
579
587
  // Fetch per-project env vars for remote projects
@@ -604,18 +612,41 @@ export function createVeryfrontHandler(
604
612
  // reqCtx.token indicates the request came through the proxy with auth.
605
613
  // Without it (standalone / test), host env must remain accessible.
606
614
  const shouldIsolateEnv = !adapterRes.isLocalProject && !!reqCtx.token;
607
- const response = await withSpan(
608
- SpanNames.HANDLER_EXECUTE,
609
- () => {
610
- if (shouldIsolateEnv) {
611
- return runWithProjectEnv(envVarsForRequest, executeRoute);
612
- }
613
- return executeRoute();
614
- },
615
+ const response = await runWithRequestProfiling(
615
616
  {
616
- "handler.project_slug": projectRes.projectSlug || "unknown",
617
- "handler.path": url.pathname,
618
- "handler.method": req.method,
617
+ category: url.pathname.startsWith("/_vf_styles/")
618
+ ? "css"
619
+ : url.pathname.startsWith("/_vf_modules/")
620
+ ? "module"
621
+ : url.pathname.startsWith("/api/")
622
+ ? "api"
623
+ : "html",
624
+ method: req.method,
625
+ pathname: url.pathname,
626
+ projectSlug: projectRes.projectSlug,
627
+ requestMode: envRes.resolvedEnvironment,
628
+ },
629
+ async () => {
630
+ let routedResponse: dntShim.Response | null | undefined;
631
+ try {
632
+ routedResponse = await withSpan(
633
+ SpanNames.HANDLER_EXECUTE,
634
+ () => {
635
+ if (shouldIsolateEnv) {
636
+ return runWithProjectEnv(envVarsForRequest, executeRoute);
637
+ }
638
+ return executeRoute();
639
+ },
640
+ {
641
+ "handler.project_slug": projectRes.projectSlug || "unknown",
642
+ "handler.path": url.pathname,
643
+ "handler.method": req.method,
644
+ },
645
+ );
646
+ return routedResponse;
647
+ } finally {
648
+ finalizeRequestProfiling(routedResponse?.status);
649
+ }
619
650
  },
620
651
  );
621
652
 
@@ -59,6 +59,7 @@ export function isMonitoringPath(pathname: string): boolean {
59
59
  export const LIGHTWEIGHT_PATH_PREFIXES = [
60
60
  "/_vf_modules/",
61
61
  "/_veryfront/modules/",
62
+ "/_veryfront/hydration-runtime.js",
62
63
  "/_veryfront/preview-hmr.js",
63
64
  "/_veryfront/studio-bridge.js",
64
65
  "/_vf/css/",
@@ -74,3 +75,13 @@ export function isLightweightPath(pathname: string): boolean {
74
75
  export function isWebSocketPath(pathname: string): boolean {
75
76
  return pathname === "/_ws";
76
77
  }
78
+
79
+ /**
80
+ * Requests that do not need render-specific enriched context.
81
+ *
82
+ * These routes still receive the normal handler context, but they can skip
83
+ * render cache prefix/content-source derivation and the enriched render payload.
84
+ */
85
+ export function shouldSkipEnrichedContext(pathname: string): boolean {
86
+ return pathname.startsWith("/api/") || pathname.startsWith("/internal/agents/");
87
+ }
@@ -12,9 +12,11 @@ import { VeryfrontError } from "../../../errors/index.js";
12
12
  import { getColorSchemeFromRequest } from "../../../security/http/client-hints.js";
13
13
  import {
14
14
  endRenderSession,
15
+ hasRenderSession,
15
16
  startRenderSession,
16
17
  } from "../../../transforms/mdx/esm-module-loader/module-fetcher/index.js";
17
18
  import { getErrorCollector } from "../../../observability/error-collector.js";
19
+ import { profilePhase } from "../../../observability/request-profiler.js";
18
20
  import { ErrorOverlay, parseErrorLocation } from "../../dev-server/error-overlay/index.js";
19
21
  import { ErrorPages } from "../../utils/error-html.js";
20
22
  import {
@@ -77,6 +79,7 @@ export interface SSRRenderOptions {
77
79
  projectId?: string;
78
80
  pageId?: string;
79
81
  noHmr: boolean;
82
+ forceProductionScripts?: boolean;
80
83
  useNoCache: boolean;
81
84
  }
82
85
 
@@ -170,22 +173,28 @@ export class SSRService implements SSRServiceLike {
170
173
  });
171
174
 
172
175
  const renderStartTime = performance.now();
173
- const result = await timeAsync("render-page", () =>
174
- renderer.renderPage(slug, {
175
- delivery: "stream",
176
- request,
177
- url,
178
- nonce,
179
- studioEmbed,
180
- projectId,
181
- pageId,
182
- colorScheme,
183
- colorSchemeFromParam,
184
- colorSchemeFromHeader,
185
- environment: ctx.requestContext?.mode,
186
- projectSlug: ctx.projectSlug,
187
- noHmr,
188
- }));
176
+ const result = await profilePhase(
177
+ "ssr.render_page",
178
+ () =>
179
+ timeAsync("render-page", () =>
180
+ renderer.renderPage(slug, {
181
+ delivery: "stream",
182
+ request,
183
+ url,
184
+ nonce,
185
+ studioEmbed,
186
+ projectId,
187
+ pageId,
188
+ colorScheme,
189
+ colorSchemeFromParam,
190
+ colorSchemeFromHeader,
191
+ environment: ctx.requestContext?.mode,
192
+ projectSlug: ctx.projectSlug,
193
+ noHmr,
194
+ forceProductionScripts: options.forceProductionScripts,
195
+ renderSessionId,
196
+ })),
197
+ );
189
198
 
190
199
  logger.debug("renderPage DONE", {
191
200
  projectSlug: ctx.projectSlug,
@@ -195,7 +204,9 @@ export class SSRService implements SSRServiceLike {
195
204
  hasStream: !!result.stream,
196
205
  });
197
206
 
198
- endRenderSession(renderSessionId);
207
+ if (hasRenderSession(renderSessionId)) {
208
+ endRenderSession(renderSessionId);
209
+ }
199
210
 
200
211
  const postRenderHeap = getHeapStats();
201
212
  const heapGrowthMB = postRenderHeap.usedHeapSizeMB - preRenderHeap.usedHeapSizeMB;
@@ -225,7 +236,9 @@ export class SSRService implements SSRServiceLike {
225
236
  slug,
226
237
  };
227
238
  } catch (error) {
228
- endRenderSession(renderSessionId);
239
+ if (hasRenderSession(renderSessionId)) {
240
+ endRenderSession(renderSessionId);
241
+ }
229
242
  return this.handleRenderError(error, ctx, slug, request, nonce);
230
243
  }
231
244
  }