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
@@ -206,12 +206,12 @@ export function normalizeConversationHistoryForRuntime(
206
206
 
207
207
  export function resolveChannelInvokeAgent(
208
208
  assistantId: string,
209
- deps: Pick<ChannelInvokeDeps, "getAgent" | "getAllAgentIds">,
209
+ deps: Pick<ChannelInvokeDeps, "getAgent">,
210
210
  ): Agent | undefined {
211
211
  return deps.getAgent(assistantId);
212
212
  }
213
213
 
214
- function normalizeToolCallState(status: string): "pending" | "completed" | "error" {
214
+ function toChannelToolCallState(status: string): "pending" | "completed" | "error" {
215
215
  switch (status) {
216
216
  case "completed":
217
217
  return "completed";
@@ -281,7 +281,7 @@ export function buildChannelResponseParts(response: AgentResponse): ChannelRespo
281
281
  id: toolCall.id,
282
282
  name: toolCall.name,
283
283
  input: toolCall.args,
284
- state: normalizeToolCallState(toolCall.status),
284
+ state: toChannelToolCallState(toolCall.status),
285
285
  }));
286
286
 
287
287
  if (toolCall.status === "completed" || toolCall.status === "error") {
@@ -314,7 +314,7 @@ export function buildChannelResponseParts(response: AgentResponse): ChannelRespo
314
314
  return responseParts;
315
315
  }
316
316
 
317
- function classifyRuntimeError(error: unknown): ChannelInvokeResponse["error"] {
317
+ function classifyChannelInvokeError(error: unknown): ChannelInvokeResponse["error"] {
318
318
  const veryfrontError = fromError(error);
319
319
 
320
320
  if (veryfrontError?.type === "no_ai_available") {
@@ -352,12 +352,12 @@ export async function executeChannelInvoke(
352
352
  };
353
353
  }
354
354
 
355
- const messages = normalizeConversationHistoryForRuntime(payload.conversationHistory);
355
+ const normalizedHistory = normalizeConversationHistoryForRuntime(payload.conversationHistory);
356
356
  await agent.clearMemory();
357
357
 
358
358
  try {
359
359
  const result = await agent.generate({
360
- input: messages,
360
+ input: normalizedHistory,
361
361
  context: {
362
362
  requestId: payload.dispatchId,
363
363
  dispatchId: payload.dispatchId,
@@ -395,7 +395,7 @@ export async function executeChannelInvoke(
395
395
 
396
396
  return {
397
397
  ignored: false,
398
- error: classifyRuntimeError(error),
398
+ error: classifyChannelInvokeError(error),
399
399
  };
400
400
  }
401
401
  }
@@ -47,55 +47,39 @@
47
47
  * </Message.Root>
48
48
  * ```
49
49
  */
50
-
51
- // veryfront/chat — Chat UI components + hooks
52
- //
53
- // Merges components/ai (UI) and agent/react (hooks) into a single
54
- // product-oriented import path.
55
-
56
- // ---------------------------------------------------------------------------
57
- // Core preset + compound
58
- // ---------------------------------------------------------------------------
59
50
  import "../../_dnt.polyfills.js";
60
51
 
61
52
 
62
- export { Chat, ChatComponents } from "../react/components/ai/chat.js";
63
- export type { ChatProps } from "../react/components/ai/chat.js";
64
-
65
- // ---------------------------------------------------------------------------
66
- // Composition building blocks
67
- // ---------------------------------------------------------------------------
53
+ export { Chat, ChatComponents, type ChatProps } from "../react/components/ai/chat.js";
68
54
 
69
55
  export {
70
56
  ChatComposer,
57
+ type ChatComposerProps,
71
58
  ChatEmpty,
59
+ type ChatEmptyProps,
72
60
  ChatIf,
61
+ type ChatIfProps,
73
62
  ChatMessageList,
63
+ type ChatMessageListProps,
74
64
  ChatRoot,
65
+ type ChatRootProps,
75
66
  ErrorBanner,
67
+ type ErrorBannerProps,
76
68
  Message,
69
+ type MessageRootProps,
77
70
  ModelAvatar,
71
+ type ModelAvatarProps,
78
72
  } from "../react/components/ai/chat.js";
79
- export type {
80
- ChatComposerProps,
81
- ChatEmptyProps,
82
- ChatIfProps,
83
- ChatMessageListProps,
84
- ChatRootProps,
85
- ErrorBannerProps,
86
- MessageRootProps,
87
- ModelAvatarProps,
88
- } from "../react/components/ai/chat.js";
89
-
90
- // ---------------------------------------------------------------------------
91
- // Contexts
92
- // ---------------------------------------------------------------------------
93
73
 
94
74
  export {
95
75
  ChatContextProvider,
76
+ type ChatContextValue,
96
77
  ComposerContextProvider,
78
+ type ComposerContextValue,
97
79
  MessageContextProvider,
80
+ type MessageContextValue,
98
81
  ThreadListContextProvider,
82
+ type ThreadListContextValue,
99
83
  useChatContext,
100
84
  useChatContextOptional,
101
85
  useComposerContext,
@@ -105,167 +89,147 @@ export {
105
89
  useThreadListContext,
106
90
  useThreadListContextOptional,
107
91
  } from "../react/components/ai/chat.js";
108
- export type {
109
- ChatContextValue,
110
- ComposerContextValue,
111
- MessageContextValue,
112
- ThreadListContextValue,
113
- } from "../react/components/ai/chat.js";
114
-
115
- // ---------------------------------------------------------------------------
116
- // Sub-components
117
- // ---------------------------------------------------------------------------
118
92
 
119
93
  export {
94
+ type AttachmentInfo,
120
95
  AttachmentPill,
96
+ type AttachmentPillProps,
121
97
  BranchPicker,
98
+ type BranchPickerProps,
122
99
  ChatSidebar,
100
+ type ChatSidebarProps,
101
+ type ChatTab,
123
102
  ChatWithSidebar,
103
+ type ChatWithSidebarAttachmentConfig,
104
+ type ChatWithSidebarChatController,
105
+ type ChatWithSidebarFeatureConfig,
106
+ type ChatWithSidebarGroupedProps,
107
+ type ChatWithSidebarMessageConfig,
108
+ type ChatWithSidebarModelConfig,
109
+ type ChatWithSidebarProps,
110
+ type ChatWithSidebarQuickActionsConfig,
111
+ type ChatWithSidebarSidebarConfig,
112
+ type ChatWithSidebarTabsConfig,
113
+ type ChatWithSidebarVoiceConfig,
114
+ type CodeBlockProps,
124
115
  ConversationEmptyState,
116
+ type ConversationEmptyStateProps,
125
117
  ConversationScrollButton,
118
+ type ConversationScrollButtonProps,
126
119
  downloadMarkdown,
127
120
  DropZoneOverlay,
121
+ type DropZoneOverlayProps,
128
122
  exportAsMarkdown,
129
123
  extractSourcesFromParts,
130
124
  FadeIn,
125
+ type FeedbackValue,
131
126
  getTextContent,
132
127
  groupPartsInOrder,
133
128
  InferenceBadge,
129
+ type InferenceBadgeProps,
134
130
  InlineCitation,
131
+ type InlineCitationProps,
135
132
  isReasoningPart,
136
133
  isSkillToolPart,
137
134
  isToolPart,
138
135
  Loader,
139
136
  MessageActions,
137
+ type MessageActionsProps,
140
138
  MessageEditForm,
139
+ type MessageEditFormProps,
141
140
  MessageFeedback,
141
+ type MessageFeedbackProps,
142
+ type ModelOption,
142
143
  ModelSelector,
144
+ type ModelSelectorProps,
145
+ type PartGroup,
146
+ type QuickAction,
143
147
  QuickActions,
148
+ type QuickActionsProps,
144
149
  ReasoningCard,
145
150
  RichCodeBlock,
146
151
  Shimmer,
147
152
  SkillBadge,
153
+ type SkillBadgeProps,
154
+ type Source,
148
155
  Sources,
156
+ type SourcesProps,
149
157
  StepIndicator,
158
+ type StepIndicatorProps,
150
159
  Suggestion,
160
+ type SuggestionProps,
151
161
  Suggestions,
162
+ type SuggestionsProps,
152
163
  TabSwitcher,
164
+ type TabSwitcherProps,
165
+ type Thread,
153
166
  ToolCallCard,
154
167
  ToolStatusBadge,
155
168
  UpgradeCTA,
169
+ type UpgradeCTAProps,
170
+ type UploadedFile,
156
171
  UploadsPanel,
172
+ type UploadsPanelProps,
157
173
  useThreads,
158
- } from "../react/components/ai/chat.js";
159
- export type {
160
- AttachmentInfo,
161
- AttachmentPillProps,
162
- BranchPickerProps,
163
- ChatSidebarProps,
164
- ChatTab,
165
- ChatWithSidebarAttachmentConfig,
166
- ChatWithSidebarChatController,
167
- ChatWithSidebarFeatureConfig,
168
- ChatWithSidebarGroupedProps,
169
- ChatWithSidebarMessageConfig,
170
- ChatWithSidebarModelConfig,
171
- ChatWithSidebarProps,
172
- ChatWithSidebarQuickActionsConfig,
173
- ChatWithSidebarSidebarConfig,
174
- ChatWithSidebarTabsConfig,
175
- ChatWithSidebarVoiceConfig,
176
- CodeBlockProps,
177
- ConversationEmptyStateProps,
178
- ConversationScrollButtonProps,
179
- DropZoneOverlayProps,
180
- FeedbackValue,
181
- InferenceBadgeProps,
182
- InlineCitationProps,
183
- MessageActionsProps,
184
- MessageEditFormProps,
185
- MessageFeedbackProps,
186
- ModelOption,
187
- ModelSelectorProps,
188
- PartGroup,
189
- QuickAction,
190
- QuickActionsProps,
191
- SkillBadgeProps,
192
- Source,
193
- SourcesProps,
194
- StepIndicatorProps,
195
- SuggestionProps,
196
- SuggestionsProps,
197
- TabSwitcherProps,
198
- Thread,
199
- UpgradeCTAProps,
200
- UploadedFile,
201
- UploadsPanelProps,
202
- UseThreadsOptions,
203
- UseThreadsResult,
174
+ type UseThreadsOptions,
175
+ type UseThreadsResult,
204
176
  } from "../react/components/ai/chat.js";
205
177
 
206
- // Message (standalone bubble, not the chat compound)
207
178
  export {
208
179
  Message as StandaloneMessage,
180
+ type MessageProps,
209
181
  StreamingMessage,
210
- } from "../react/components/ai/message.js";
211
- export type {
212
- MessageProps,
213
- StreamingMessageProps,
182
+ type StreamingMessageProps,
214
183
  } from "../react/components/ai/message.js";
215
184
 
216
- export { AgentCard } from "../react/components/ai/agent-card.js";
217
- export type { AgentCardProps } from "../react/components/ai/agent-card.js";
218
-
185
+ export { AgentCard, type AgentCardProps } from "../react/components/ai/agent-card.js";
219
186
  export {
220
187
  AIErrorBoundary,
188
+ type AIErrorBoundaryProps,
221
189
  useAIErrorHandler,
222
190
  } from "../react/components/ai/error-boundary.js";
223
- export type { AIErrorBoundaryProps } from "../react/components/ai/error-boundary.js";
224
-
225
- // Types only from theme
226
191
  export type { AgentTheme, ChatTheme } from "../react/components/ai/theme.js";
227
192
 
228
- // ---------------------------------------------------------------------------
229
- // Hooks (from agent/react)
230
- // ---------------------------------------------------------------------------
231
-
232
- export { useChat } from "../agent/react/use-chat/index.js";
233
- export type {
234
- BranchInfo,
235
- BrowserInferenceStatus,
236
- DynamicToolUIPart,
237
- InferenceMode,
238
- OnToolCallArg,
239
- ReasoningUIPart,
240
- StepUIPart,
241
- TextUIPart,
242
- ToolOutput,
243
- ToolResultUIPart,
244
- ToolState,
245
- ToolUIPart,
246
- UIMessage,
247
- UIMessagePart,
248
- UseChatOptions,
249
- UseChatResult,
193
+ export {
194
+ type BranchInfo,
195
+ type BrowserInferenceStatus,
196
+ type DynamicToolUIPart,
197
+ type InferenceMode,
198
+ type OnToolCallArg,
199
+ type ReasoningUIPart,
200
+ type StepUIPart,
201
+ type TextUIPart,
202
+ type ToolOutput,
203
+ type ToolResultUIPart,
204
+ type ToolState,
205
+ type ToolUIPart,
206
+ type UIMessage,
207
+ type UIMessagePart,
208
+ useChat,
209
+ type UseChatOptions,
210
+ type UseChatResult,
250
211
  } from "../agent/react/use-chat/index.js";
251
212
 
252
- export { useAgent } from "../agent/react/use-agent.js";
253
- export type { UseAgentOptions, UseAgentResult } from "../agent/react/use-agent.js";
213
+ export {
214
+ useAgent,
215
+ type UseAgentOptions,
216
+ type UseAgentResult,
217
+ } from "../agent/react/use-agent.js";
254
218
 
255
- export { useCompletion } from "../agent/react/use-completion.js";
256
- export type {
257
- UseCompletionOptions,
258
- UseCompletionResult,
219
+ export {
220
+ useCompletion,
221
+ type UseCompletionOptions,
222
+ type UseCompletionResult,
259
223
  } from "../agent/react/use-completion.js";
260
224
 
261
- export { useStreaming } from "../agent/react/use-streaming.js";
262
- export type {
263
- UseStreamingOptions,
264
- UseStreamingResult,
225
+ export {
226
+ useStreaming,
227
+ type UseStreamingOptions,
228
+ type UseStreamingResult,
265
229
  } from "../agent/react/use-streaming.js";
266
230
 
267
- export { useVoiceInput } from "../agent/react/use-voice-input.js";
268
- export type {
269
- UseVoiceInputOptions,
270
- UseVoiceInputResult,
231
+ export {
232
+ useVoiceInput,
233
+ type UseVoiceInputOptions,
234
+ type UseVoiceInputResult,
271
235
  } from "../agent/react/use-voice-input.js";
@@ -14,6 +14,24 @@
14
14
  import { type EnvironmentConfig, getEnvironmentConfig } from "./environment-config.js";
15
15
  import { getEnv } from "../platform/compat/process.js";
16
16
 
17
+ function toEnabledFlag<T extends string>(enabled: boolean, truthyValue: T): T | undefined {
18
+ return enabled ? truthyValue : undefined;
19
+ }
20
+
21
+ function toCliBooleanFlag(enabled: boolean): "1" | undefined {
22
+ return toEnabledFlag(enabled, "1");
23
+ }
24
+
25
+ function getBaseOtelConfig(env: EnvironmentConfig): {
26
+ veryfrontFlag?: string;
27
+ endpoint?: string;
28
+ } {
29
+ return {
30
+ veryfrontFlag: toCliBooleanFlag(env.otelEnabled),
31
+ endpoint: env.otelEndpoint,
32
+ };
33
+ }
34
+
17
35
  export function getDisableLruIntervalEnv(env: EnvironmentConfig = getEnvironmentConfig()): boolean {
18
36
  return env.disableLruInterval;
19
37
  }
@@ -108,13 +126,13 @@ export function isDenoTestingEnv(env: EnvironmentConfig = getEnvironmentConfig()
108
126
  }
109
127
 
110
128
  export function getNoColorEnv(env: EnvironmentConfig = getEnvironmentConfig()): string | undefined {
111
- return env.noColor ? "1" : undefined;
129
+ return toCliBooleanFlag(env.noColor);
112
130
  }
113
131
 
114
132
  export function getForceColorEnv(
115
133
  env: EnvironmentConfig = getEnvironmentConfig(),
116
134
  ): string | undefined {
117
- return env.forceColor ? "1" : undefined;
135
+ return toCliBooleanFlag(env.forceColor);
118
136
  }
119
137
 
120
138
  export function isRscExperimentalEnabled(env: EnvironmentConfig = getEnvironmentConfig()): boolean {
@@ -143,14 +161,10 @@ export function getOtelTracingConfig(env: EnvironmentConfig = getEnvironmentConf
143
161
  headers?: string;
144
162
  tracesHeaders?: string;
145
163
  } {
146
- const enabledFlag = env.otelEnabled ? "true" : undefined;
147
- const veryfrontFlag = env.otelEnabled ? "1" : undefined;
148
-
149
164
  return {
150
- enabledFlag,
151
- veryfrontFlag,
165
+ enabledFlag: toEnabledFlag(env.otelEnabled, "true"),
166
+ ...getBaseOtelConfig(env),
152
167
  serviceName: env.otelServiceName,
153
- endpoint: env.otelEndpoint,
154
168
  tracesEndpoint: env.otelTracesEndpoint,
155
169
  exporter: env.otelTracesExporter,
156
170
  headers: env.otelHeaders,
@@ -166,9 +180,8 @@ export function getOtelMetricsConfig(env: EnvironmentConfig = getEnvironmentConf
166
180
  exporter?: string;
167
181
  } {
168
182
  return {
169
- enabledFlag: env.otelMetricsEnabled ? "1" : undefined,
170
- veryfrontFlag: env.otelEnabled ? "1" : undefined,
171
- endpoint: env.otelEndpoint,
183
+ enabledFlag: toCliBooleanFlag(env.otelMetricsEnabled),
184
+ ...getBaseOtelConfig(env),
172
185
  metricsEndpoint: env.otelMetricsEndpoint,
173
186
  exporter: env.otelMetricsExporter,
174
187
  };
@@ -47,24 +47,27 @@ function releaseRevalidationSlot(projectId: string): void {
47
47
  projectRevalidationCounts.set(projectId, current - 1);
48
48
  }
49
49
 
50
- function getProjectId(context: DataContext, fallback: string): string {
50
+ function resolveProjectId(context: DataContext, fallback: string): string {
51
51
  return context.request?.headers?.get("x-project-id") ?? context.url?.hostname ?? fallback;
52
52
  }
53
53
 
54
+ type StaticDataHandler = NonNullable<PageWithData["getStaticData"]>;
55
+
54
56
  export class StaticDataFetcher {
55
57
  private pendingRevalidations = new Map<string, Promise<void>>();
56
58
 
57
59
  constructor(private cacheManager: CacheManager) {}
58
60
 
59
61
  async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {
60
- if (typeof pageModule.getStaticData !== "function") return { props: {} };
62
+ const getStaticData = pageModule.getStaticData;
63
+ if (typeof getStaticData !== "function") return { props: {} };
61
64
 
62
65
  const pathname = context.url?.pathname ?? "unknown";
63
66
  const cacheKey = this.cacheManager.createCacheKey(context);
64
67
 
65
68
  // No caching in preview mode (cacheKey is null)
66
69
  if (!cacheKey) {
67
- return withSpan("data.fetch_static", () => this.fetchFreshNoCache(pageModule, context), {
70
+ return withSpan("data.fetch_static", () => this.fetchFreshNoCache(getStaticData, context), {
68
71
  "data.fetch_method": "getStaticData",
69
72
  "data.pathname": pathname,
70
73
  "data.cache": "disabled",
@@ -78,33 +81,65 @@ export class StaticDataFetcher {
78
81
  );
79
82
 
80
83
  if (!cached) {
81
- return withSpan("data.fetch_static", () => this.fetchFresh(pageModule, context, cacheKey), {
82
- "data.fetch_method": "getStaticData",
83
- "data.pathname": pathname,
84
- "data.cache": "miss",
85
- });
84
+ return withSpan(
85
+ "data.fetch_static",
86
+ () => this.fetchFresh(getStaticData, context, cacheKey),
87
+ {
88
+ "data.fetch_method": "getStaticData",
89
+ "data.pathname": pathname,
90
+ "data.cache": "miss",
91
+ },
92
+ );
86
93
  }
87
94
 
88
95
  if (this.cacheManager.shouldRevalidate(cached) && !this.pendingRevalidations.has(cacheKey)) {
89
96
  this.pendingRevalidations.set(
90
97
  cacheKey,
91
- this.revalidateInBackground(pageModule, context, cacheKey),
98
+ this.revalidateInBackground(getStaticData, context, cacheKey),
92
99
  );
93
100
  }
94
101
 
95
102
  return cached.data;
96
103
  }
97
104
 
105
+ private createStaticDataContext(
106
+ context: DataContext,
107
+ ): Omit<DataContext, "request" | "query"> {
108
+ return { params: context.params, url: context.url };
109
+ }
110
+
111
+ private executeStaticData(
112
+ getStaticData: StaticDataHandler,
113
+ context: DataContext,
114
+ timeoutMs: number,
115
+ label: string,
116
+ ): Promise<DataResult> {
117
+ return withTimeoutThrow(
118
+ Promise.resolve(getStaticData(this.createStaticDataContext(context))),
119
+ timeoutMs,
120
+ label,
121
+ );
122
+ }
123
+
124
+ private storeCacheEntry(cacheKey: string, result: DataResult): void {
125
+ this.cacheManager.set(cacheKey, {
126
+ data: result,
127
+ timestamp: Date.now(),
128
+ revalidate: result.revalidate,
129
+ });
130
+ }
131
+
98
132
  private async fetchFreshNoCache(
99
- pageModule: PageWithData,
133
+ getStaticData: StaticDataHandler,
100
134
  context: DataContext,
101
135
  ): Promise<DataResult> {
102
136
  const pathname = context.url?.pathname ?? "unknown";
103
137
  const start = performance.now();
104
138
 
105
139
  try {
106
- return await withTimeoutThrow(
107
- Promise.resolve(pageModule.getStaticData!({ params: context.params, url: context.url })),
140
+ return await this.executeStaticData(
141
+ getStaticData,
142
+ context,
108
143
  DATA_FETCH_TIMEOUT_MS,
109
144
  `getStaticData for ${pathname}`,
110
145
  );
@@ -126,13 +161,13 @@ export class StaticDataFetcher {
126
161
  }
127
162
 
128
163
  private async fetchFresh(
129
- pageModule: PageWithData,
164
+ getStaticData: StaticDataHandler,
130
165
  context: DataContext,
131
166
  cacheKey: string,
132
167
  ): Promise<DataResult> {
133
168
  const pathname = context.url?.pathname ?? "unknown";
134
169
  // Extract projectId from request headers (set by proxy) for proper circuit breaker isolation
135
- const projectId = getProjectId(context, "default");
170
+ const projectId = resolveProjectId(context, "default");
136
171
  const start = performance.now();
137
172
 
138
173
  // Circuit breaker per project to prevent cascade failures
@@ -144,8 +179,9 @@ export class StaticDataFetcher {
144
179
 
145
180
  try {
146
181
  const result = await circuitBreaker.execute(() =>
147
- withTimeoutThrow(
148
- Promise.resolve(pageModule.getStaticData!({ params: context.params, url: context.url })),
182
+ this.executeStaticData(
183
+ getStaticData,
184
+ context,
149
185
  DATA_FETCH_TIMEOUT_MS,
150
186
  `getStaticData for ${pathname}`,
151
187
  )
@@ -154,11 +190,7 @@ export class StaticDataFetcher {
154
190
  await withSpan(
155
191
  SpanNames.DATA_CACHE_SET,
156
192
  () => {
157
- this.cacheManager.set(cacheKey, {
158
- data: result,
159
- timestamp: Date.now(),
160
- revalidate: result.revalidate,
161
- });
193
+ this.storeCacheEntry(cacheKey, result);
162
194
  return Promise.resolve();
163
195
  },
164
196
  { "data.cache_key": cacheKey, "data.revalidate": result.revalidate ?? 0 },
@@ -198,15 +230,13 @@ export class StaticDataFetcher {
198
230
  }
199
231
 
200
232
  private async revalidateInBackground(
201
- pageModule: PageWithData,
233
+ getStaticData: StaticDataHandler,
202
234
  context: DataContext,
203
235
  cacheKey: string,
204
236
  ): Promise<void> {
205
- if (typeof pageModule.getStaticData !== "function") return;
206
-
207
237
  const pathname = context.url?.pathname ?? "unknown";
208
238
  // Use projectId from request headers for proper per-project fairness
209
- const projectId = getProjectId(context, "unknown");
239
+ const projectId = resolveProjectId(context, "unknown");
210
240
 
211
241
  // Check per-project limit before acquiring global semaphore
212
242
  if (!acquireRevalidationSlot(projectId)) {
@@ -225,19 +255,14 @@ export class StaticDataFetcher {
225
255
  const start = performance.now();
226
256
 
227
257
  try {
228
- const result = await withTimeoutThrow(
229
- Promise.resolve(
230
- pageModule.getStaticData!({ params: context.params, url: context.url }),
231
- ),
258
+ const result = await this.executeStaticData(
259
+ getStaticData,
260
+ context,
232
261
  REVALIDATION_TIMEOUT_MS,
233
262
  `getStaticData revalidation for ${pathname}`,
234
263
  );
235
264
 
236
- this.cacheManager.set(cacheKey, {
237
- data: result,
238
- timestamp: Date.now(),
239
- revalidate: result.revalidate,
240
- });
265
+ this.storeCacheEntry(cacheKey, result);
241
266
  } catch (error) {
242
267
  const durationMs = Math.round(performance.now() - start);
243
268
 
@@ -4,6 +4,8 @@ import { withSpan } from "../observability/tracing/otlp-setup.js";
4
4
  import { SpanNames } from "../observability/tracing/span-names.js";
5
5
  import type { Span } from "@opentelemetry/api";
6
6
 
7
+ const EMPTY_STATIC_PATHS_RESULT: StaticPathsResult = { paths: [], fallback: false };
8
+
7
9
  export class StaticPathsFetcher {
8
10
  fetch(pageModule: PageWithData): Promise<StaticPathsResult | null> {
9
11
  const getStaticPaths = pageModule.getStaticPaths;
@@ -16,14 +18,14 @@ export class StaticPathsFetcher {
16
18
  async (span?: Span) => {
17
19
  try {
18
20
  const result = await getStaticPaths();
19
- const finalResult = result ?? { paths: [], fallback: false };
21
+ const finalResult = result ?? EMPTY_STATIC_PATHS_RESULT;
20
22
 
21
23
  span?.setAttribute("data.paths_count", finalResult.paths?.length ?? 0);
22
24
  span?.setAttribute("data.fallback", String(finalResult.fallback ?? false));
23
25
 
24
26
  return finalResult;
25
27
  } catch (error) {
26
- serverLogger.error("Error in getStaticPaths:", error);
28
+ serverLogger.error("DATA_FETCH_STATIC_PATHS_ERROR getStaticPaths failed", {}, error);
27
29
  throw error;
28
30
  }
29
31
  },