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
@@ -1,5 +1,4 @@
1
- // Re-export schema-based type
2
- export type { PromptConfig } from "./schemas/index.js";
1
+ export type { PromptConfig } from "./schemas/prompt.schema.js";
3
2
 
4
3
  export interface Prompt {
5
4
  id: string;
@@ -13,8 +13,8 @@ import { generate, generateStream } from "./local-engine.js";
13
13
  import type { ChatMessage, GenerateOptions } from "./local-engine.js";
14
14
  import { DEFAULT_LOCAL_MODEL } from "./model-catalog.js";
15
15
  import { serverLogger } from "../../utils/index.js";
16
- import { createError, fromError, toError } from "../../errors/veryfront-error.js";
17
- import { isLocalAIDisabled } from "./env.js";
16
+ import { fromError } from "../../errors/veryfront-error.js";
17
+ import { throwIfLocalAIDisabled } from "./env.js";
18
18
 
19
19
  const logger = serverLogger.component("local-llm");
20
20
 
@@ -132,14 +132,7 @@ export function createLocalModel(modelId?: string): LanguageModel {
132
132
  // Note: getTransformers() in local-engine.ts also checks this, but we need
133
133
  // the check here too because doStream creates a ReadableStream wrapper and
134
134
  // errors inside it would be swallowed as in-band stream errors.
135
- if (isLocalAIDisabled()) {
136
- throw toError(
137
- createError({
138
- type: "no_ai_available",
139
- message: "Local AI disabled via VERYFRONT_DISABLE_LOCAL_AI environment variable.",
140
- }),
141
- );
142
- }
135
+ throwIfLocalAIDisabled();
143
136
 
144
137
  const messages = convertPrompt(options.prompt);
145
138
  const genOptions = toGenerateOptions(options);
@@ -6,13 +6,18 @@
6
6
  *
7
7
  * @module provider/local
8
8
  */
9
+ import * as dntShim from "../../../_dnt.shims.js";
10
+
11
+
12
+ import { createError, toError } from "../../errors/veryfront-error.js";
13
+
14
+ const LOCAL_AI_DISABLED_MESSAGE =
15
+ "Local AI disabled via VERYFRONT_DISABLE_LOCAL_AI environment variable.";
9
16
 
10
17
  /**
11
18
  * Check whether local AI is explicitly disabled via environment variable.
12
19
  * Works in Deno, Node, and compiled binaries.
13
20
  */
14
- import * as dntShim from "../../../_dnt.shims.js";
15
-
16
21
  export function isLocalAIDisabled(): boolean {
17
22
  const denoVal = (dntShim.dntGlobalThis as Record<string, unknown>).Deno as
18
23
  | { env?: { get?: (key: string) => string | undefined } }
@@ -29,3 +34,18 @@ export function isLocalAIDisabled(): boolean {
29
34
 
30
35
  return false;
31
36
  }
37
+
38
+ export function createLocalAIDisabledError(): Error {
39
+ return toError(
40
+ createError({
41
+ type: "no_ai_available",
42
+ message: LOCAL_AI_DISABLED_MESSAGE,
43
+ }),
44
+ );
45
+ }
46
+
47
+ export function throwIfLocalAIDisabled(): void {
48
+ if (isLocalAIDisabled()) {
49
+ throw createLocalAIDisabledError();
50
+ }
51
+ }
@@ -15,7 +15,7 @@ import { serverLogger } from "../../utils/index.js";
15
15
  import { createError, toError } from "../../errors/veryfront-error.js";
16
16
  import { importTransformers } from "../../platform/compat/opaque-deps.js";
17
17
  import { DEFAULT_LOCAL_MODEL, type ModelInfo, resolveLocalModel } from "./model-catalog.js";
18
- import { isLocalAIDisabled } from "./env.js";
18
+ import { throwIfLocalAIDisabled } from "./env.js";
19
19
 
20
20
  const logger = serverLogger.component("local-llm");
21
21
 
@@ -89,14 +89,7 @@ let transformersModule: TransformersModule | null = null;
89
89
  export async function getTransformers(): Promise<TransformersModule> {
90
90
  if (transformersModule) return transformersModule;
91
91
 
92
- if (isLocalAIDisabled()) {
93
- throw toError(
94
- createError({
95
- type: "no_ai_available",
96
- message: "Local AI disabled via VERYFRONT_DISABLE_LOCAL_AI environment variable.",
97
- }),
98
- );
99
- }
92
+ throwIfLocalAIDisabled();
100
93
 
101
94
  logger.info("Loading @huggingface/transformers...");
102
95
 
@@ -27,7 +27,7 @@ import { ProjectScopedRegistryManager } from "../ai/registry-manager.js";
27
27
  import { serverLogger } from "../utils/index.js";
28
28
  import { DEFAULT_LOCAL_MODEL } from "./local/model-catalog.js";
29
29
  import { createLocalModel } from "./local/ai-sdk-adapter.js";
30
- import { isLocalAIDisabled } from "./local/env.js";
30
+ import { throwIfLocalAIDisabled } from "./local/env.js";
31
31
  import { verifyLocalRuntime } from "./local/local-engine.js";
32
32
  import {
33
33
  getDefaultVeryfrontCloudModel,
@@ -270,14 +270,7 @@ export function resolveModel(modelString: string): LanguageModel {
270
270
  manager.has("local")
271
271
  ) {
272
272
  // Check if local AI is explicitly disabled (e.g., for testing)
273
- if (isLocalAIDisabled()) {
274
- throw toError(
275
- createError({
276
- type: "no_ai_available",
277
- message: "Local AI disabled via VERYFRONT_DISABLE_LOCAL_AI environment variable.",
278
- }),
279
- );
280
- }
273
+ throwIfLocalAIDisabled();
281
274
 
282
275
  localLogger.info(
283
276
  `⚡ "${providerName}" unavailable (missing credentials or configuration). ` +
@@ -25,14 +25,6 @@ export function createVeryfrontCloudModel(modelId: string): LanguageModel {
25
25
  fetch,
26
26
  })(upstreamModelId);
27
27
 
28
- case "openai":
29
- return createOpenAI({
30
- apiKey: apiToken,
31
- baseURL,
32
- name: "veryfront-cloud",
33
- fetch,
34
- })(upstreamModelId);
35
-
36
28
  case "google":
37
29
  return createGoogleGenerativeAI({
38
30
  apiKey: apiToken,
@@ -41,6 +33,7 @@ export function createVeryfrontCloudModel(modelId: string): LanguageModel {
41
33
  fetch,
42
34
  })(upstreamModelId);
43
35
 
36
+ case "openai":
44
37
  case "moonshotai":
45
38
  return createOpenAI({
46
39
  apiKey: apiToken,
@@ -32,19 +32,23 @@ function joinUrl(base: string, path: string): string {
32
32
  return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
33
33
  }
34
34
 
35
+ function createInvalidModelIdError(modelId: string): Error {
36
+ return toError(
37
+ createError({
38
+ type: "config",
39
+ message: `Invalid veryfront-cloud model string: "${modelId}". Expected ` +
40
+ `"veryfront-cloud/provider/model".`,
41
+ }),
42
+ );
43
+ }
44
+
35
45
  export function parseVeryfrontCloudModelId(
36
46
  modelId: string,
37
47
  kind: "language" | "embedding",
38
48
  ): ParsedVeryfrontCloudModelId {
39
49
  const slashIndex = modelId.indexOf("/");
40
50
  if (slashIndex === -1) {
41
- throw toError(
42
- createError({
43
- type: "config",
44
- message: `Invalid veryfront-cloud model string: "${modelId}". Expected ` +
45
- `"veryfront-cloud/provider/model".`,
46
- }),
47
- );
51
+ throw createInvalidModelIdError(modelId);
48
52
  }
49
53
 
50
54
  const rawProvider = modelId.slice(0, slashIndex);
@@ -52,13 +56,7 @@ export function parseVeryfrontCloudModelId(
52
56
  const upstreamModelId = modelId.slice(slashIndex + 1);
53
57
 
54
58
  if (!normalizedProvider || !upstreamModelId) {
55
- throw toError(
56
- createError({
57
- type: "config",
58
- message: `Invalid veryfront-cloud model string: "${modelId}". Expected ` +
59
- `"veryfront-cloud/provider/model".`,
60
- }),
61
- );
59
+ throw createInvalidModelIdError(modelId);
62
60
  }
63
61
 
64
62
  if (
@@ -128,7 +126,6 @@ export function createVeryfrontCloudFetch(apiToken: string): typeof dntShim.fetc
128
126
 
129
127
  headers.delete("x-api-key");
130
128
  headers.delete("x-goog-api-key");
131
- headers.delete("Authorization");
132
129
  headers.set("Authorization", `Bearer ${apiToken}`);
133
130
 
134
131
  return dntShim.fetch(new dntShim.Request(request, { headers }));
@@ -210,7 +210,7 @@ function extractUserToken(cookieHeader: string): string | undefined {
210
210
  return match?.[1] ? decodeURIComponent(match[1]) : undefined;
211
211
  }
212
212
 
213
- function getStatusFromError(error: unknown): number | null {
213
+ function parseStatusFromError(error: unknown): number | null {
214
214
  const message = error instanceof Error ? error.message : String(error);
215
215
  const match = message.match(/failed: (\d+)/);
216
216
  return match ? Number(match[1]) : null;
@@ -392,6 +392,75 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
392
392
  return `https://veryfront.com/sign-in?from=${encodeURIComponent(returnPath)}`;
393
393
  }
394
394
 
395
+ function makePreviewProjectNotFoundContext(
396
+ base: {
397
+ scope: TokenScope;
398
+ host: string;
399
+ parsedDomain: ParsedDomain;
400
+ },
401
+ token?: string,
402
+ ): ProxyContext {
403
+ return makeErrorContext(
404
+ base,
405
+ 404,
406
+ "Preview project not found",
407
+ token,
408
+ undefined,
409
+ "project-not-found",
410
+ );
411
+ }
412
+
413
+ async function resolveRequestToken(
414
+ req: dntShim.Request,
415
+ scope: TokenScope,
416
+ host: string,
417
+ projectSlug: string | undefined,
418
+ options: {
419
+ allowSignedInternalControlPlaneToken?: boolean;
420
+ tokenFetchErrorMessage: string;
421
+ },
422
+ ): Promise<{ token?: string; userToken?: string; tokenFetchError?: unknown }> {
423
+ const userToken = extractUserToken(req.headers.get("cookie") ?? "");
424
+ const useSignedInternalControlPlaneToken = options.allowSignedInternalControlPlaneToken &&
425
+ isSignedInternalControlPlaneRequest(req);
426
+
427
+ let token: string | undefined;
428
+ let tokenFetchError: unknown;
429
+
430
+ if (useSignedInternalControlPlaneToken) {
431
+ token = req.headers.get("x-token") ?? undefined;
432
+ logger?.debug("Using signed control-plane token for internal request", {
433
+ pathname: new URL(req.url).pathname,
434
+ scope,
435
+ });
436
+ } else if (scope === "preview" && userToken) {
437
+ token = userToken;
438
+ logger?.debug("Using user auth token for preview");
439
+ }
440
+
441
+ if (!token && config.apiClientId && config.apiClientSecret) {
442
+ const customDomain = projectSlug ? undefined : host;
443
+ if (projectSlug || customDomain) {
444
+ try {
445
+ token = await tokenManager.getToken(scope, projectSlug, customDomain);
446
+ } catch (error) {
447
+ tokenFetchError = error;
448
+ logger?.error(options.tokenFetchErrorMessage, error as Error, {
449
+ projectSlug,
450
+ customDomain,
451
+ });
452
+ }
453
+ }
454
+ }
455
+
456
+ if (!token && config.apiToken) {
457
+ token = config.apiToken;
458
+ logger?.debug("Using static API token fallback");
459
+ }
460
+
461
+ return { token, userToken, tokenFetchError };
462
+ }
463
+
395
464
  async function checkProtectedAccess(
396
465
  req: dntShim.Request,
397
466
  matchingEnv: NonNullable<DomainLookupResult["environments"]>[number] | undefined,
@@ -486,6 +555,7 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
486
555
  const host = rawHost.replace(/:\d+$/, "");
487
556
  const parsedDomain = parseProjectDomain(host);
488
557
  const scope = getScope(parsedDomain.environment);
558
+ const base = { scope, host, parsedDomain };
489
559
 
490
560
  let projectSlug = parsedDomain.slug ?? undefined;
491
561
  let projectId: string | undefined;
@@ -494,7 +564,7 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
494
564
 
495
565
  const isCustomDomain = !projectSlug && !parsedDomain.isVeryfrontDomain;
496
566
 
497
- if (!projectSlug && parsedDomain.isVeryfrontDomain && !isCustomDomain) {
567
+ if (!projectSlug && parsedDomain.isVeryfrontDomain) {
498
568
  return {
499
569
  token: undefined,
500
570
  projectSlug: undefined,
@@ -519,58 +589,29 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
519
589
  isCustomDomain,
520
590
  });
521
591
 
522
- const cookieHeader = req.headers.get("cookie") ?? "";
523
- const userToken = extractUserToken(cookieHeader);
524
- const signedInternalControlPlaneRequest = isSignedInternalControlPlaneRequest(req);
525
-
592
+ let userToken: string | undefined;
526
593
  let token: string | undefined;
527
594
  let tokenFetchError: unknown;
528
595
 
529
596
  if (isLocalProject) {
530
597
  logger?.debug("Local project, skipping token fetch", { localPath });
531
598
  } else {
532
- if (signedInternalControlPlaneRequest) {
533
- token = req.headers.get("x-token") ?? undefined;
534
- logger?.debug("Using signed control-plane token for internal request", {
535
- pathname: new URL(req.url).pathname,
536
- scope,
537
- });
538
- } else if (scope === "preview" && userToken) {
539
- token = userToken;
540
- logger?.debug("Using user auth token for preview");
541
- }
542
-
543
- if (!token && config.apiClientId && config.apiClientSecret) {
544
- const customDomain = projectSlug ? undefined : host;
545
- if (projectSlug || customDomain) {
546
- try {
547
- token = await tokenManager.getToken(scope, projectSlug, customDomain);
548
- } catch (error) {
549
- tokenFetchError = error;
550
- logger?.error("Token fetch failed", error as Error, { projectSlug, customDomain });
551
- }
552
- }
553
- }
554
-
555
- if (!token && config.apiToken) {
556
- token = config.apiToken;
557
- logger?.debug("Using static API token fallback");
558
- }
559
-
560
- const base = { scope, host, parsedDomain };
599
+ ({ token, userToken, tokenFetchError } = await resolveRequestToken(
600
+ req,
601
+ scope,
602
+ host,
603
+ projectSlug,
604
+ {
605
+ allowSignedInternalControlPlaneToken: true,
606
+ tokenFetchErrorMessage: "Token fetch failed",
607
+ },
608
+ ));
561
609
 
562
610
  if (projectSlug && scope === "preview" && !token) {
563
- const status = getStatusFromError(tokenFetchError);
611
+ const status = parseStatusFromError(tokenFetchError);
564
612
  if (status === 404) {
565
613
  logger?.info("Preview project not found", { projectSlug, host });
566
- return makeErrorContext(
567
- base,
568
- 404,
569
- "Preview project not found",
570
- undefined,
571
- undefined,
572
- "project-not-found",
573
- );
614
+ return makePreviewProjectNotFoundContext(base);
574
615
  }
575
616
 
576
617
  logger?.warn("Preview request has no usable token", {
@@ -686,14 +727,7 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
686
727
 
687
728
  if (!resolved.projectId) {
688
729
  logger?.info("Preview project not found after lookup", { projectSlug, host });
689
- return makeErrorContext(
690
- base,
691
- 404,
692
- "Preview project not found",
693
- token,
694
- undefined,
695
- "project-not-found",
696
- );
730
+ return makePreviewProjectNotFoundContext(base, token);
697
731
  }
698
732
 
699
733
  projectId = resolved.projectId;
@@ -754,28 +788,10 @@ export function createProxyHandler(options: ProxyHandlerOptions) {
754
788
  const parsedDomain = parseProjectDomain(host);
755
789
  const scope = getScope(parsedDomain.environment);
756
790
  const projectSlug = parsedDomain.slug ?? undefined;
757
-
758
- if (scope === "preview") {
759
- const cookieHeader = req.headers.get("cookie") ?? "";
760
- const userToken = extractUserToken(cookieHeader);
761
- if (userToken) return userToken;
762
- }
763
-
764
- if (config.apiClientId && config.apiClientSecret) {
765
- const customDomain = projectSlug ? undefined : host;
766
- if (projectSlug || customDomain) {
767
- try {
768
- return await tokenManager.getToken(scope, projectSlug, customDomain);
769
- } catch (error) {
770
- logger?.error("Token fetch failed for API", error as Error, {
771
- projectSlug,
772
- customDomain,
773
- });
774
- }
775
- }
776
- }
777
-
778
- return config.apiToken;
791
+ const { token } = await resolveRequestToken(req, scope, host, projectSlug, {
792
+ tokenFetchErrorMessage: "Token fetch failed for API",
793
+ });
794
+ return token;
779
795
  }
780
796
 
781
797
  async function getStats() {
@@ -16,6 +16,19 @@ function hasReactHook(hookName: string): boolean {
16
16
  return typeof (React as Record<string, unknown>)[hookName] === "function";
17
17
  }
18
18
 
19
+ function createDefaultFormStatus(): FormStatus {
20
+ return { pending: false, data: null, method: null, action: null };
21
+ }
22
+
23
+ function supportsConcurrentHooks(): boolean {
24
+ const { isReact18, isReact19 } = getReactVersionInfo();
25
+ return isReact18 || isReact19;
26
+ }
27
+
28
+ function warnHookFallback(hookName: string, fallbackDescription: string): void {
29
+ logger.warn(`${hookName} not available, ${fallbackDescription}`);
30
+ }
31
+
19
32
  export function createTransitionFallbackScheduler(
20
33
  onPendingChange: (pending: boolean) => void,
21
34
  ): {
@@ -45,14 +58,14 @@ export function createTransitionFallbackScheduler(
45
58
 
46
59
  export function useFormStatusCompat(): FormStatus {
47
60
  if (!hasFeature("useFormStatus") || !hasReactHook("useFormStatus")) {
48
- return { pending: false, data: null, method: null, action: null };
61
+ return createDefaultFormStatus();
49
62
  }
50
63
 
51
64
  try {
52
65
  return (React as typeof React & { useFormStatus: () => FormStatus }).useFormStatus();
53
- } catch (_) {
54
- logger.warn("useFormStatus not available in current React version");
55
- return { pending: false, data: null, method: null, action: null };
66
+ } catch {
67
+ warnHookFallback("useFormStatus", "falling back to the default idle state");
68
+ return createDefaultFormStatus();
56
69
  }
57
70
  }
58
71
 
@@ -70,8 +83,8 @@ export function useOptimisticCompat<State, OptimisticState = State>(
70
83
  ) => [S, (action: OptimisticStateAction<O>) => void];
71
84
  }
72
85
  ).useOptimistic(state, updateFn);
73
- } catch (_) {
74
- logger.warn("useOptimistic not available in current React version");
86
+ } catch {
87
+ warnHookFallback("useOptimistic", "falling back to React.useState");
75
88
  }
76
89
  }
77
90
 
@@ -107,13 +120,11 @@ export function useOptimisticCompat<State, OptimisticState = State>(
107
120
  }
108
121
 
109
122
  export function useTransitionCompat(): ReturnType<typeof React.useTransition> {
110
- const versionInfo = getReactVersionInfo();
111
-
112
- if (versionInfo.isReact18 || versionInfo.isReact19) {
123
+ if (supportsConcurrentHooks()) {
113
124
  try {
114
125
  return React.useTransition();
115
- } catch (_) {
116
- logger.warn("useTransition not available, falling back to mock");
126
+ } catch {
127
+ warnHookFallback("useTransition", "falling back to the timeout scheduler");
117
128
  }
118
129
  }
119
130
 
@@ -138,13 +149,11 @@ export function useTransitionCompat(): ReturnType<typeof React.useTransition> {
138
149
  }
139
150
 
140
151
  export function useDeferredValueCompat<T>(value: T): T {
141
- const versionInfo = getReactVersionInfo();
142
-
143
- if (versionInfo.isReact18 || versionInfo.isReact19) {
152
+ if (supportsConcurrentHooks()) {
144
153
  try {
145
154
  return React.useDeferredValue(value);
146
- } catch (_) {
147
- logger.warn("useDeferredValue not available, returning value directly");
155
+ } catch {
156
+ warnHookFallback("useDeferredValue", "returning the value directly");
148
157
  }
149
158
  }
150
159
 
@@ -154,13 +163,11 @@ export function useDeferredValueCompat<T>(value: T): T {
154
163
  let idCounter = 0;
155
164
 
156
165
  export function useIdCompat(): string {
157
- const versionInfo = getReactVersionInfo();
158
-
159
- if (versionInfo.isReact18 || versionInfo.isReact19) {
166
+ if (supportsConcurrentHooks()) {
160
167
  try {
161
168
  return React.useId();
162
- } catch (_) {
163
- logger.warn("useId not available, using fallback");
169
+ } catch {
170
+ warnHookFallback("useId", "using the incremental fallback id");
164
171
  }
165
172
  }
166
173
 
@@ -191,16 +198,18 @@ export interface CompatHooks {
191
198
  useId: typeof useIdCompat;
192
199
  }
193
200
 
201
+ const defaultCompatHooks: CompatHooks = {
202
+ useFormStatus: useFormStatusCompat,
203
+ useOptimistic: useOptimisticCompat,
204
+ useTransition: useTransitionCompat,
205
+ useDeferredValue: useDeferredValueCompat,
206
+ useId: useIdCompat,
207
+ };
208
+
194
209
  let compatHooksContext: React.Context<CompatHooks> | null = null;
195
210
 
196
211
  function getCompatHooksContext(): React.Context<CompatHooks> {
197
- compatHooksContext ??= React.createContext<CompatHooks>({
198
- useFormStatus: useFormStatusCompat,
199
- useOptimistic: useOptimisticCompat,
200
- useTransition: useTransitionCompat,
201
- useDeferredValue: useDeferredValueCompat,
202
- useId: useIdCompat,
203
- });
212
+ compatHooksContext ??= React.createContext<CompatHooks>(defaultCompatHooks);
204
213
 
205
214
  return compatHooksContext;
206
215
  }
@@ -222,21 +231,11 @@ export function CompatHooksProvider({
222
231
  }: {
223
232
  children: React.ReactNode;
224
233
  }): React.ReactElement {
225
- const hooks: CompatHooks = {
226
- useFormStatus: useFormStatusCompat,
227
- useOptimistic: useOptimisticCompat,
228
- useTransition: useTransitionCompat,
229
- useDeferredValue: useDeferredValueCompat,
230
- useId: useIdCompat,
231
- };
232
-
233
- return React.createElement(getCompatHooksContext().Provider, { value: hooks }, children);
234
+ return React.createElement(
235
+ getCompatHooksContext().Provider,
236
+ { value: defaultCompatHooks },
237
+ children,
238
+ );
234
239
  }
235
240
 
236
- export const compatHooks = {
237
- useFormStatus: useFormStatusCompat,
238
- useOptimistic: useOptimisticCompat,
239
- useTransition: useTransitionCompat,
240
- useDeferredValue: useDeferredValueCompat,
241
- useId: useIdCompat,
242
- } as const;
241
+ export const compatHooks = defaultCompatHooks;