veryfront 0.1.1237 → 0.1.1239

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 (493) hide show
  1. package/esm/cli/auth/login.d.ts +24 -2
  2. package/esm/cli/auth/login.d.ts.map +1 -1
  3. package/esm/cli/auth/login.js +444 -35
  4. package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
  5. package/esm/cli/commands/build/error-handler.js +41 -3
  6. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  7. package/esm/cli/commands/build/handler.js +1 -1
  8. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  9. package/esm/cli/commands/dev/command.js +14 -1
  10. package/esm/cli/commands/dev/inference-status.d.ts +6 -0
  11. package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
  12. package/esm/cli/commands/dev/inference-status.js +14 -2
  13. package/esm/cli/commands/generate/command.d.ts.map +1 -1
  14. package/esm/cli/commands/generate/command.js +61 -0
  15. package/esm/cli/commands/init/init-command.d.ts.map +1 -1
  16. package/esm/cli/commands/init/init-command.js +23 -31
  17. package/esm/cli/commands/install/registry.d.ts.map +1 -1
  18. package/esm/cli/commands/install/registry.js +6 -9
  19. package/esm/cli/commands/login/command-help.d.ts.map +1 -1
  20. package/esm/cli/commands/login/command-help.js +3 -1
  21. package/esm/cli/commands/pull/command.d.ts +1 -0
  22. package/esm/cli/commands/pull/command.d.ts.map +1 -1
  23. package/esm/cli/commands/pull/command.js +49 -6
  24. package/esm/cli/commands/push/command-help.d.ts.map +1 -1
  25. package/esm/cli/commands/push/command-help.js +7 -0
  26. package/esm/cli/commands/push/command.d.ts +23 -12
  27. package/esm/cli/commands/push/command.d.ts.map +1 -1
  28. package/esm/cli/commands/push/command.js +461 -44
  29. package/esm/cli/commands/push/plan.d.ts +35 -0
  30. package/esm/cli/commands/push/plan.d.ts.map +1 -0
  31. package/esm/cli/commands/push/plan.js +96 -0
  32. package/esm/cli/commands/schedule/handler.d.ts +21 -2
  33. package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
  34. package/esm/cli/commands/schedule/handler.js +74 -27
  35. package/esm/cli/commands/schema/command-help.js +1 -1
  36. package/esm/cli/commands/up/command.js +1 -1
  37. package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
  38. package/esm/cli/commands/webhook/handler.js +3 -1
  39. package/esm/cli/router.d.ts.map +1 -1
  40. package/esm/cli/router.js +27 -5
  41. package/esm/cli/shared/args.d.ts +15 -1
  42. package/esm/cli/shared/args.d.ts.map +1 -1
  43. package/esm/cli/shared/args.js +56 -3
  44. package/esm/cli/shared/config.d.ts +11 -2
  45. package/esm/cli/shared/config.d.ts.map +1 -1
  46. package/esm/cli/shared/config.js +72 -27
  47. package/esm/cli/shared/project-creation.js +1 -1
  48. package/esm/cli/sync/state.d.ts +20 -0
  49. package/esm/cli/sync/state.d.ts.map +1 -0
  50. package/esm/cli/sync/state.js +193 -0
  51. package/esm/deno.js +2 -2
  52. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
  53. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
  54. package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
  55. package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
  56. package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
  57. package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
  58. package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
  59. package/esm/src/agent/conversation/delegation-policy.js +13 -3
  60. package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
  61. package/esm/src/agent/conversation/hosted-terminal.js +6 -2
  62. package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
  63. package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
  64. package/esm/src/agent/factory.d.ts.map +1 -1
  65. package/esm/src/agent/factory.js +22 -11
  66. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
  67. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
  68. package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
  69. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
  70. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
  71. package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
  72. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
  73. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
  74. package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
  75. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
  76. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
  77. package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
  78. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
  79. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
  80. package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
  81. package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
  82. package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
  83. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
  84. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
  85. package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
  86. package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
  87. package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
  88. package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
  89. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
  90. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
  91. package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
  92. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
  93. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
  94. package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
  95. package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
  96. package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
  97. package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
  98. package/esm/src/agent/index.d.ts +3 -3
  99. package/esm/src/agent/index.d.ts.map +1 -1
  100. package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
  101. package/esm/src/agent/project/agent-runtime.js +6 -3
  102. package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
  103. package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
  104. package/esm/src/agent/runtime/agent-definition.js +15 -2
  105. package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
  106. package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
  107. package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
  108. package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
  109. package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
  110. package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
  111. package/esm/src/agent/runtime/call-context.d.ts +42 -11
  112. package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
  113. package/esm/src/agent/runtime/call-context.js +480 -42
  114. package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
  115. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  116. package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
  117. package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
  118. package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
  119. package/esm/src/agent/runtime/effective-agent-system.js +29 -0
  120. package/esm/src/agent/runtime/index.d.ts +1 -0
  121. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  122. package/esm/src/agent/runtime/index.js +638 -53
  123. package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
  124. package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
  125. package/esm/src/agent/runtime/load-skill-tool.js +152 -21
  126. package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
  127. package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
  128. package/esm/src/agent/runtime/model-resolution.js +14 -0
  129. package/esm/src/agent/runtime/model-transport.d.ts +1 -0
  130. package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
  131. package/esm/src/agent/runtime/model-transport.js +5 -2
  132. package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
  133. package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
  134. package/esm/src/agent/runtime/run-runtime-context.js +9 -3
  135. package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
  136. package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
  137. package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
  138. package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
  139. package/esm/src/agent/runtime/skill-prompt.js +113 -25
  140. package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
  141. package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
  142. package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
  143. package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
  144. package/esm/src/agent/runtime/tool-inventory.js +13 -9
  145. package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
  146. package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
  147. package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
  148. package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
  149. package/esm/src/agent/service/runtime.js +1 -1
  150. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
  151. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  152. package/esm/src/agent/types.d.ts +14 -1
  153. package/esm/src/agent/types.d.ts.map +1 -1
  154. package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
  155. package/esm/src/chat/chat-ui-message-helpers.js +75 -16
  156. package/esm/src/config/loader.d.ts.map +1 -1
  157. package/esm/src/config/loader.js +37 -1
  158. package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
  159. package/esm/src/errors/catalog/build-errors.js +14 -0
  160. package/esm/src/errors/error-registry/build.d.ts +2 -0
  161. package/esm/src/errors/error-registry/build.d.ts.map +1 -1
  162. package/esm/src/errors/error-registry/build.js +8 -0
  163. package/esm/src/errors/error-registry/deploy.d.ts +4 -0
  164. package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
  165. package/esm/src/errors/error-registry/deploy.js +16 -0
  166. package/esm/src/errors/error-registry.d.ts +3 -0
  167. package/esm/src/errors/error-registry.d.ts.map +1 -1
  168. package/esm/src/errors/index.d.ts +2 -1
  169. package/esm/src/errors/index.d.ts.map +1 -1
  170. package/esm/src/errors/index.js +4 -3
  171. package/esm/src/errors/tenant-classification.d.ts +25 -0
  172. package/esm/src/errors/tenant-classification.d.ts.map +1 -0
  173. package/esm/src/errors/tenant-classification.js +61 -0
  174. package/esm/src/extensions/builtin-extensions.d.ts +10 -15
  175. package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
  176. package/esm/src/extensions/builtin-extensions.js +32 -26
  177. package/esm/src/extensions/deferred-extension.d.ts +4 -4
  178. package/esm/src/extensions/deferred-extension.js +4 -4
  179. package/esm/src/extensions/index.d.ts +1 -0
  180. package/esm/src/extensions/index.d.ts.map +1 -1
  181. package/esm/src/extensions/index.js +1 -0
  182. package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
  183. package/esm/src/integrations/_data.d.ts.map +1 -1
  184. package/esm/src/integrations/_data.js +6 -0
  185. package/esm/src/integrations/schema.d.ts +8 -0
  186. package/esm/src/integrations/schema.d.ts.map +1 -1
  187. package/esm/src/integrations/schema.js +3 -0
  188. package/esm/src/integrations/types.d.ts +2 -0
  189. package/esm/src/integrations/types.d.ts.map +1 -1
  190. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  191. package/esm/src/internal-agents/run-stream.js +35 -20
  192. package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
  193. package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
  194. package/esm/src/internal-agents/run-system-prompt.js +19 -13
  195. package/esm/src/internal-agents/schema.d.ts +2 -0
  196. package/esm/src/internal-agents/schema.d.ts.map +1 -1
  197. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  198. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +2 -18
  199. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
  200. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
  201. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
  202. package/esm/src/observability/application-error-contract.d.ts +4 -0
  203. package/esm/src/observability/application-error-contract.d.ts.map +1 -1
  204. package/esm/src/observability/application-errors.d.ts.map +1 -1
  205. package/esm/src/observability/application-errors.js +64 -3
  206. package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
  207. package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
  208. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
  209. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
  210. package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
  211. package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
  212. package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
  213. package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
  214. package/esm/src/provider/runtime-loader/provider-http.js +55 -17
  215. package/esm/src/provider/shared/index.d.ts +1 -0
  216. package/esm/src/provider/shared/index.d.ts.map +1 -1
  217. package/esm/src/provider/shared/index.js +2 -0
  218. package/esm/src/provider/types.d.ts +1 -0
  219. package/esm/src/provider/types.d.ts.map +1 -1
  220. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
  221. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
  222. package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
  223. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
  224. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
  225. package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
  226. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
  227. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
  228. package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
  229. package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
  230. package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
  231. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
  232. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
  233. package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
  234. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
  235. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
  236. package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
  237. package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
  238. package/esm/src/react/components/ui/adapter/context.js +10 -0
  239. package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
  240. package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
  241. package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
  242. package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
  243. package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
  244. package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
  245. package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
  246. package/esm/src/react/components/ui/alert-dialog.js +181 -0
  247. package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
  248. package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
  249. package/esm/src/react/components/ui/aspect-ratio.js +13 -0
  250. package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
  251. package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
  252. package/esm/src/react/components/ui/autocomplete.js +59 -0
  253. package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
  254. package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
  255. package/esm/src/react/components/ui/breadcrumb.js +67 -0
  256. package/esm/src/react/components/ui/calendar.d.ts +40 -0
  257. package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
  258. package/esm/src/react/components/ui/calendar.js +170 -0
  259. package/esm/src/react/components/ui/combobox.d.ts +74 -0
  260. package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
  261. package/esm/src/react/components/ui/combobox.js +100 -0
  262. package/esm/src/react/components/ui/context-menu.d.ts +116 -0
  263. package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
  264. package/esm/src/react/components/ui/context-menu.js +168 -0
  265. package/esm/src/react/components/ui/date-picker.d.ts +69 -0
  266. package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
  267. package/esm/src/react/components/ui/date-picker.js +96 -0
  268. package/esm/src/react/components/ui/dialog.d.ts +41 -11
  269. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  270. package/esm/src/react/components/ui/dialog.js +47 -28
  271. package/esm/src/react/components/ui/drawer.d.ts +31 -8
  272. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  273. package/esm/src/react/components/ui/drawer.js +33 -22
  274. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  275. package/esm/src/react/components/ui/dropdown-menu.js +7 -75
  276. package/esm/src/react/components/ui/field.d.ts +70 -0
  277. package/esm/src/react/components/ui/field.d.ts.map +1 -0
  278. package/esm/src/react/components/ui/field.js +161 -0
  279. package/esm/src/react/components/ui/file-type.d.ts +9 -8
  280. package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
  281. package/esm/src/react/components/ui/file-type.js +8 -8
  282. package/esm/src/react/components/ui/hover-card.d.ts +82 -0
  283. package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
  284. package/esm/src/react/components/ui/hover-card.js +140 -0
  285. package/esm/src/react/components/ui/index.d.ts +23 -2
  286. package/esm/src/react/components/ui/index.d.ts.map +1 -1
  287. package/esm/src/react/components/ui/index.js +21 -0
  288. package/esm/src/react/components/ui/input-otp.d.ts +37 -0
  289. package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
  290. package/esm/src/react/components/ui/input-otp.js +42 -0
  291. package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
  292. package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
  293. package/esm/src/react/components/ui/menu-keyboard.js +76 -0
  294. package/esm/src/react/components/ui/menubar.d.ts +98 -0
  295. package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
  296. package/esm/src/react/components/ui/menubar.js +173 -0
  297. package/esm/src/react/components/ui/meter.d.ts +45 -0
  298. package/esm/src/react/components/ui/meter.d.ts.map +1 -0
  299. package/esm/src/react/components/ui/meter.js +59 -0
  300. package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
  301. package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
  302. package/esm/src/react/components/ui/modal-surface.js +23 -6
  303. package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
  304. package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
  305. package/esm/src/react/components/ui/navigation-menu.js +195 -0
  306. package/esm/src/react/components/ui/number-field.d.ts +46 -0
  307. package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
  308. package/esm/src/react/components/ui/number-field.js +121 -0
  309. package/esm/src/react/components/ui/pagination.d.ts +77 -0
  310. package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
  311. package/esm/src/react/components/ui/pagination.js +62 -0
  312. package/esm/src/react/components/ui/popover.d.ts +42 -13
  313. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  314. package/esm/src/react/components/ui/popover.js +25 -12
  315. package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
  316. package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
  317. package/esm/src/react/components/ui/scroll-area.js +35 -0
  318. package/esm/src/react/components/ui/separator.d.ts +20 -0
  319. package/esm/src/react/components/ui/separator.d.ts.map +1 -0
  320. package/esm/src/react/components/ui/separator.js +13 -0
  321. package/esm/src/react/components/ui/slider.d.ts +44 -0
  322. package/esm/src/react/components/ui/slider.d.ts.map +1 -0
  323. package/esm/src/react/components/ui/slider.js +46 -0
  324. package/esm/src/react/components/ui/status.d.ts +6 -5
  325. package/esm/src/react/components/ui/status.d.ts.map +1 -1
  326. package/esm/src/react/components/ui/status.js +4 -4
  327. package/esm/src/react/components/ui/tabs.d.ts +32 -9
  328. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  329. package/esm/src/react/components/ui/tabs.js +46 -22
  330. package/esm/src/react/components/ui/toggle.d.ts +26 -0
  331. package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
  332. package/esm/src/react/components/ui/toggle.js +29 -0
  333. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
  334. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
  335. package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
  336. package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
  337. package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
  338. package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
  339. package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
  340. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
  341. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
  342. package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
  343. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
  344. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
  345. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
  346. package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
  347. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  348. package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
  349. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
  350. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
  351. package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
  352. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  353. package/esm/src/rendering/orchestrator/pipeline.js +12 -1
  354. package/esm/src/runs/runs-client.d.ts +2 -4
  355. package/esm/src/runs/runs-client.d.ts.map +1 -1
  356. package/esm/src/runs/schemas.d.ts +18 -8
  357. package/esm/src/runs/schemas.d.ts.map +1 -1
  358. package/esm/src/runs/schemas.js +26 -0
  359. package/esm/src/runtime/model-call-context.d.ts +6 -1
  360. package/esm/src/runtime/model-call-context.d.ts.map +1 -1
  361. package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
  362. package/esm/src/runtime/runtime-bridge.js +133 -15
  363. package/esm/src/schedule/factory.d.ts +8 -2
  364. package/esm/src/schedule/factory.d.ts.map +1 -1
  365. package/esm/src/schedule/factory.js +0 -8
  366. package/esm/src/schedule/index.d.ts +10 -1
  367. package/esm/src/schedule/index.d.ts.map +1 -1
  368. package/esm/src/schedule/index.js +9 -0
  369. package/esm/src/schedule/types.d.ts +30 -11
  370. package/esm/src/schedule/types.d.ts.map +1 -1
  371. package/esm/src/schedule/validation.d.ts +17 -0
  372. package/esm/src/schedule/validation.d.ts.map +1 -1
  373. package/esm/src/schedule/validation.js +93 -5
  374. package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
  375. package/esm/src/security/sandbox/worker-pool.js +6 -1
  376. package/esm/src/server/bootstrap.d.ts.map +1 -1
  377. package/esm/src/server/bootstrap.js +6 -0
  378. package/esm/src/server/dev-server/index.d.ts +1 -1
  379. package/esm/src/server/dev-server/index.d.ts.map +1 -1
  380. package/esm/src/server/dev-server/server.d.ts +7 -3
  381. package/esm/src/server/dev-server/server.d.ts.map +1 -1
  382. package/esm/src/server/dev-server/server.js +12 -3
  383. package/esm/src/server/dev-server/types.d.ts +7 -1
  384. package/esm/src/server/dev-server/types.d.ts.map +1 -1
  385. package/esm/src/server/dev-server.d.ts +1 -1
  386. package/esm/src/server/dev-server.d.ts.map +1 -1
  387. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  388. package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
  389. package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
  390. package/esm/src/server/handlers/dev/projects/index.js +3 -0
  391. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  392. package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
  393. package/esm/src/server/index.d.ts +3 -3
  394. package/esm/src/server/index.d.ts.map +1 -1
  395. package/esm/src/server/index.js +10 -5
  396. package/esm/src/server/node-handler.d.ts.map +1 -1
  397. package/esm/src/server/node-handler.js +4 -1
  398. package/esm/src/server/production-server.d.ts.map +1 -1
  399. package/esm/src/server/production-server.js +2 -1
  400. package/esm/src/server/project-env/cache.d.ts +17 -0
  401. package/esm/src/server/project-env/cache.d.ts.map +1 -1
  402. package/esm/src/server/project-env/cache.js +78 -2
  403. package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
  404. package/esm/src/server/project-env/fetcher.js +24 -14
  405. package/esm/src/server/project-env/index.d.ts +1 -1
  406. package/esm/src/server/project-env/index.d.ts.map +1 -1
  407. package/esm/src/server/project-env/index.js +1 -1
  408. package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
  409. package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
  410. package/esm/src/server/project-env/internal-authorization.js +32 -0
  411. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  412. package/esm/src/server/runtime-handler/index.js +1 -1
  413. package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
  414. package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
  415. package/esm/src/server/runtime-handler/projects-handler.js +4 -2
  416. package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
  417. package/esm/src/transforms/esm/http-bundler.js +6 -5
  418. package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
  419. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  420. package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
  421. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  422. package/esm/src/transforms/esm/http-cache.js +16 -10
  423. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  424. package/esm/src/transforms/esm/specifier-resolver.js +87 -7
  425. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
  426. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
  427. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
  428. package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
  429. package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
  430. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
  431. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
  432. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
  433. package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
  434. package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
  435. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
  436. package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +8 -2
  437. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
  438. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
  439. package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +3 -0
  440. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
  441. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
  442. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
  443. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
  444. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
  445. package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
  446. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
  447. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
  448. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
  449. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
  450. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
  451. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
  452. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
  453. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
  454. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
  455. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  456. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
  457. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
  458. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
  459. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
  460. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
  461. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
  462. package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
  463. package/esm/src/transforms/pipeline/stages/compile.js +44 -0
  464. package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
  465. package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
  466. package/esm/src/transforms/shared/specifier-suffix.js +43 -0
  467. package/esm/src/trigger/index.d.ts +2 -2
  468. package/esm/src/trigger/index.d.ts.map +1 -1
  469. package/esm/src/trigger/index.js +1 -1
  470. package/esm/src/trigger/local-runner.d.ts +2 -2
  471. package/esm/src/trigger/local-runner.d.ts.map +1 -1
  472. package/esm/src/trigger/local-runner.js +11 -4
  473. package/esm/src/trigger/target.d.ts +97 -5
  474. package/esm/src/trigger/target.d.ts.map +1 -1
  475. package/esm/src/trigger/target.js +175 -5
  476. package/esm/src/utils/version-constant.d.ts +1 -1
  477. package/esm/src/utils/version-constant.js +1 -1
  478. package/esm/src/webhook/types.d.ts +21 -6
  479. package/esm/src/webhook/types.d.ts.map +1 -1
  480. package/esm/src/webhook/validation.d.ts.map +1 -1
  481. package/esm/src/webhook/validation.js +27 -39
  482. package/esm/templates/index.d.ts +1 -1
  483. package/esm/templates/index.d.ts.map +1 -1
  484. package/esm/templates/loader.d.ts +6 -6
  485. package/esm/templates/loader.d.ts.map +1 -1
  486. package/esm/templates/loader.js +34 -18
  487. package/esm/templates/manifest.generated.d.ts +3 -0
  488. package/esm/templates/manifest.generated.d.ts.map +1 -0
  489. package/esm/templates/manifest.generated.js +2 -0
  490. package/package.json +8 -8
  491. package/esm/templates/manifest.d.ts +0 -664
  492. package/esm/templates/manifest.d.ts.map +0 -1
  493. package/esm/templates/manifest.js +0 -662
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/projects/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AAUxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAajF,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;gBAE5B,QAAQ,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAKnD,QAAQ,EAAE,eAAe,CAevB;cAEiB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO;IAOrE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAmDxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/projects/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AAUxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAcjF,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;gBAE5B,QAAQ,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAKnD,QAAQ,EAAE,eAAe,CAevB;cAEiB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO;IAQrE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAmDxE"}
@@ -10,6 +10,7 @@ import { handleProjectsAPI } from "./api.js";
10
10
  import { handleProjectsUI } from "./ui-handler.js";
11
11
  import { createDevNotFoundResponse } from "../shared/not-found-response.js";
12
12
  import { createDevUiAssetsUnavailableResponse, omitHeadResponseBody, } from "../shared/dev-ui-bundle-response.js";
13
+ import { isTrustedLocalControlRequest } from "../../../../security/http/local-control-request.js";
13
14
  const PROJECTS_ALLOWED_METHODS = "GET, HEAD";
14
15
  function cancelRejectedRequestBody(req) {
15
16
  try {
@@ -44,6 +45,8 @@ export class ProjectsHandler extends BaseHandler {
44
45
  shouldHandle(req, ctx) {
45
46
  if (!this.metadata.enabled?.(ctx))
46
47
  return false;
48
+ if (!isTrustedLocalControlRequest(req))
49
+ return false;
47
50
  const { pathname } = new URL(req.url);
48
51
  return pathname === "/" || pathname.startsWith("/_projects");
49
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAGpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAchD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAkBnD,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAG/B,MAAM,oCAAoC,CAAC;AAQ5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAuBnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;IACnF,0BAA0B,CAAC,EAAE,4BAA4B,CAAC;CAC3D;AAED,KAAK,yBAAyB,GAAG,IAAI,CACnC,0BAA0B,EAC1B,mBAAmB,GAAG,4BAA4B,GAAG,uBAAuB,CAC7E,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,CACzC,GAAG,EAAE,cAAc,EACnB,aAAa,EAAE,yBAAyB,EACxC,cAAc,EAAE,yBAAyB,EACzC,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAomBrC,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAsBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA0QxE"}
1
+ {"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAGpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAchD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAkBnD,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAG/B,MAAM,oCAAoC,CAAC;AAQ5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAwBnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;IACnF,0BAA0B,CAAC,EAAE,4BAA4B,CAAC;CAC3D;AAED,KAAK,yBAAyB,GAAG,IAAI,CACnC,0BAA0B,EAC1B,mBAAmB,GAAG,4BAA4B,GAAG,uBAAuB,CAC7E,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,CACzC,GAAG,EAAE,cAAc,EACnB,aAAa,EAAE,yBAAyB,EACxC,cAAc,EAAE,yBAAyB,EACzC,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAumBrC,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAsBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA+QxE"}
@@ -22,7 +22,7 @@ import { isServerShuttingDown } from "../../shutdown-state.js";
22
22
  import { getHostEnv } from "../../../platform/compat/process.js";
23
23
  import { resolveVeryfrontApiBaseUrlFromHostEnv } from "../../../platform/cloud/resolver.js";
24
24
  import { serverLogger } from "../../../utils/index.js";
25
- import { EnvironmentVariableCache, fetchProjectEnvVars, filterRuntimeProjectEnv, ProjectEnvironmentIdentityResolver, runWithProjectEnv, } from "../../project-env/index.js";
25
+ import { EnvironmentVariableCache, fetchProjectEnvVars, filterRuntimeProjectEnv, ProjectEnvironmentIdentityResolver, runWithProjectEnv, unwrapReplayedProjectEnvironmentFailure, } from "../../project-env/index.js";
26
26
  import { getHostedConfig } from "../../../config/loader.js";
27
27
  import { prepareDeclarativeConfigContext } from "../../../config/declarative-evaluator.js";
28
28
  import { normalizeSourceIntegrationPolicy } from "../../../integrations/source-policy.js";
@@ -55,7 +55,7 @@ const STUDIO_RUNTIME_REMOTE_TOOL_NAMES = new Set([
55
55
  // Per-environment env var cache shared across all agent stream requests (60s TTL)
56
56
  const _agentEnvVarCache = new EnvironmentVariableCache(({ environmentId, token, projectSlug }, signal) => {
57
57
  return fetchProjectEnvVars(resolveVeryfrontApiBaseUrlFromHostEnv(), projectSlug, environmentId, token, signal);
58
- });
58
+ }, 60_000, 100, { markFailureReplays: true });
59
59
  const _environmentIdentityResolver = new ProjectEnvironmentIdentityResolver();
60
60
  function mergeAllowedRemoteTools(current, requestedToolNames) {
61
61
  const allowed = new Set(Array.isArray(current) && current.every((toolName) => typeof toolName === "string")
@@ -627,7 +627,10 @@ export class AgentStreamHandler extends BaseHandler {
627
627
  });
628
628
  return await runWithVerifiedCacheApiCredential(verifiedClaims, runWithAgentSourceContext);
629
629
  }
630
- catch (error) {
630
+ catch (caught) {
631
+ // The first negative-cache failure owns diagnostics. Replays retain the
632
+ // original error for response construction but must not repeat reports.
633
+ const { error, replayed } = unwrapReplayedProjectEnvironmentFailure(caught);
631
634
  if (error instanceof InternalAgentRequestBodyTooLargeError) {
632
635
  return this.respond(builder.json({ error: error.message }, error.status));
633
636
  }
@@ -647,7 +650,7 @@ export class AgentStreamHandler extends BaseHandler {
647
650
  const response = errorToResponse(error, new URL(req.url).pathname);
648
651
  // errorToResponse strips `detail` from 5xx bodies, so the log and the
649
652
  // reported event are the only places it survives.
650
- if (response.status >= 500) {
653
+ if (response.status >= 500 && !replayed) {
651
654
  const cause = describeErrorCause(error.cause);
652
655
  logger.error("Internal agent stream request failed", {
653
656
  projectId: ctx.projectId,
@@ -674,26 +677,28 @@ export class AgentStreamHandler extends BaseHandler {
674
677
  }
675
678
  return this.respond(applyBuilderHeaders(response, builder.headers));
676
679
  }
677
- this.logWarn("Internal agent stream request failed", {
678
- error: error instanceof Error ? error.message : String(error),
679
- projectId: ctx.projectId,
680
- projectSlug: ctx.projectSlug,
681
- });
682
- logger.error("Internal agent stream handler failed", {
683
- projectId: ctx.projectId,
684
- projectSlug: ctx.projectSlug,
685
- error: error instanceof Error ? error.message : String(error),
686
- });
687
- // Unexpected failures have no slug or detail, so the captured stack is
688
- // the only real diagnostic.
689
- reportHandlerFailure(error, {
690
- boundary: "agent.stream.handler",
691
- method: req.method,
692
- status: HTTP_INTERNAL_SERVER_ERROR,
693
- runId: safeRunId(req),
694
- projectId: ctx.projectId,
695
- projectSlug: ctx.projectSlug,
696
- });
680
+ if (!replayed) {
681
+ this.logWarn("Internal agent stream request failed", {
682
+ error: error instanceof Error ? error.message : String(error),
683
+ projectId: ctx.projectId,
684
+ projectSlug: ctx.projectSlug,
685
+ });
686
+ logger.error("Internal agent stream handler failed", {
687
+ projectId: ctx.projectId,
688
+ projectSlug: ctx.projectSlug,
689
+ error: error instanceof Error ? error.message : String(error),
690
+ });
691
+ // Unexpected failures have no slug or detail, so the captured stack is
692
+ // the only real diagnostic.
693
+ reportHandlerFailure(error, {
694
+ boundary: "agent.stream.handler",
695
+ method: req.method,
696
+ status: HTTP_INTERNAL_SERVER_ERROR,
697
+ runId: safeRunId(req),
698
+ projectId: ctx.projectId,
699
+ projectSlug: ctx.projectSlug,
700
+ });
701
+ }
697
702
  return this.respond(builder.json({ error: "Internal agent stream failed" }, 500));
698
703
  }
699
704
  }
@@ -21,9 +21,9 @@
21
21
  * @see docs/security.md
22
22
  */
23
23
  import "../../_dnt.polyfills.js";
24
- import { DevServer, type DevServerOptions, type FileWatcherMetrics, type RouteDirectory, startDevServer } from "./dev-server.js";
24
+ import { DevServer, type DevServerHandler, type DevServerOptions, type FileWatcherMetrics, type RouteDirectory, startDevServer } from "./dev-server.js";
25
25
  import { type DiscoveryOptions, type ServerHandle, startProductionServer, type StartProductionServerOptions } from "./production-server.js";
26
- export { DevServer, startDevServer, startProductionServer };
26
+ export { DevServer, type DevServerHandler, startDevServer, startProductionServer };
27
27
  export { gracefullyShutdownProductionServer, type GracefulProductionShutdownOptions, } from "./graceful-shutdown.js";
28
28
  export { createVeryfrontServer, type CreateVeryfrontServerOptions, type NodeVeryfrontServiceServer, startNodeVeryfrontServer, type StartNodeVeryfrontServerOptions, startVeryfrontServer, type StartVeryfrontServerOptions, type VeryfrontServiceServer, type VeryfrontServiceServerFetch, type VeryfrontServiceServerLogger, type VeryfrontServiceServerModule, type VeryfrontServiceServerModuleResponse, type VeryfrontServiceServerRuntime, type VeryfrontServiceServerRuntimeKind, } from "./service-server.js";
29
29
  export type { DevServerOptions, DiscoveryOptions, FileWatcherMetrics, RouteDirectory, ServerHandle, StartProductionServerOptions, };
@@ -88,7 +88,7 @@ export interface VeryfrontServer {
88
88
  url: string;
89
89
  }
90
90
  /** Web API request handler with WebSocket upgrade and HMR helpers. */
91
- export type VeryfrontHandler = ((req: Request) => Promise<Response>) & {
91
+ export type VeryfrontHandler = ((req: Request, nativeContext?: unknown) => Promise<Response>) & {
92
92
  /**
93
93
  * Attach WebSocket upgrade handling to a Node.js HTTP server.
94
94
  * Required for HMR live reload when using an external server like Hono, Express, etc.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,yBAAyB,CAAC;AAKjC,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,qBAAqB,EACrB,KAAK,4BAA4B,EAClC,MAAM,wBAAwB,CAAC;AAqBhC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAAC;AAC5D,OAAO,EACL,kCAAkC,EAClC,KAAK,iCAAiC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,oBAAoB,EACpB,KAAK,2BAA2B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CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACxF,OAAO,CAAC,gBAAgB,CAAC,CAuQ3B;AAED;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAkD1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,yBAAyB,CAAC;AAKjC,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,qBAAqB,EACrB,KAAK,4BAA4B,EAClC,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAAC;AACnF,OAAO,EACL,kCAAkC,EAClC,KAAK,iCAAiC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EACzC,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,GACvC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ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AAW,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAkD1B"}
@@ -26,6 +26,7 @@ import { DevServer, startDevServer, } from "./dev-server.js";
26
26
  import { startProductionServer, } from "./production-server.js";
27
27
  import { runtime } from "../platform/adapters/detect.js";
28
28
  import { isWebSocketUpgradeResponse } from "../platform/adapters/base.js";
29
+ import { recordHandlerRequestPeer } from "../platform/adapters/runtime/shared/request-peer.js";
29
30
  import { cwd } from "../platform/compat/process.js";
30
31
  import { bootstrapProd } from "./bootstrap.js";
31
32
  import { createVeryfrontHandler } from "./runtime-handler/index.js";
@@ -54,11 +55,12 @@ export { HOSTED_ENVIRONMENT_NAMES, isHostedEnvironmentName, parseProjectDomain,
54
55
  * ```ts
55
56
  * import { Hono } from "hono"
56
57
  * import { serve } from "@hono/node-server"
58
+ * import type { HttpBindings } from "@hono/node-server"
57
59
  * import { createHandler } from "veryfront"
58
60
  *
59
- * const app = new Hono()
61
+ * const app = new Hono<{ Bindings: HttpBindings }>()
60
62
  * const handler = await createHandler()
61
- * app.all("*", (c) => handler(c.req.raw))
63
+ * app.all("*", (c) => handler(c.req.raw, c.env.incoming))
62
64
  * const server = serve({ fetch: app.fetch, port: 3000 })
63
65
  * handler.upgrade(server)
64
66
  * ```
@@ -111,7 +113,10 @@ export async function createHandler(options = {}) {
111
113
  const adapter = await runtime.get();
112
114
  const bootstrap = await bootstrapProd(projectDir, adapter);
113
115
  const internalHandler = createVeryfrontHandler(projectDir, bootstrap.adapter, { projectDir });
114
- const handler = async (req) => toNativeResponse(await internalHandler(req));
116
+ const handler = async (req, info) => {
117
+ recordHandlerRequestPeer(req, info);
118
+ return toNativeResponse(await internalHandler(req));
119
+ };
115
120
  const dispose = createRetryableHandlerDisposer(async () => {
116
121
  await bootstrap.dispose?.();
117
122
  });
@@ -136,14 +141,14 @@ export async function createHandler(options = {}) {
136
141
  const internalFetch = devServer.handler;
137
142
  const nodeWebSocketServerProvider = devServer.nodeWebSocketServerProvider;
138
143
  let disposalStarted = false;
139
- const fetch = async (req) => {
144
+ const fetch = async (req, info) => {
140
145
  if (disposalStarted) {
141
146
  return new _NativeResponse("Handler is shutting down", {
142
147
  status: 503,
143
148
  headers: { "cache-control": "no-store" },
144
149
  });
145
150
  }
146
- return toNativeResponse(await internalFetch(req));
151
+ return toNativeResponse(await internalFetch(req, info));
147
152
  };
148
153
  const hmrRateLimiter = new RateLimiter(HMR_MAX_MESSAGES_PER_MINUTE);
149
154
  const nodeUpgradeLifecycle = new NodeUpgradeLifecycle();
@@ -1 +1 @@
1
- {"version":3,"file":"node-handler.d.ts","sourceRoot":"","sources":["../../../src/src/server/node-handler.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GACtD,CAAC,GAAG,EAAE,OAAO,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,WAAW,EAAE,cAAc,KAAK,IAAI,CAyE7F"}
1
+ {"version":3,"file":"node-handler.d.ts","sourceRoot":"","sources":["../../../src/src/server/node-handler.ts"],"names":[],"mappings":"AAGA,sEAAsE;AACtE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GACtD,CAAC,GAAG,EAAE,OAAO,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,WAAW,EAAE,cAAc,KAAK,IAAI,CA4E7F"}
@@ -1,4 +1,5 @@
1
1
  import { serverLogger } from "../utils/index.js";
2
+ import { recordNodeIncomingRequestPeer } from "../platform/adapters/runtime/shared/request-peer.js";
2
3
  /** Convert a Web API request handler into a Node.js HTTP listener. */
3
4
  export function toNodeHandler(handler) {
4
5
  return async (req, res) => {
@@ -22,7 +23,9 @@ export function toNodeHandler(handler) {
22
23
  };
23
24
  if (body)
24
25
  init.duplex = "half";
25
- const response = await handler(new Request(url.toString(), init));
26
+ const request = new Request(url.toString(), init);
27
+ recordNodeIncomingRequestPeer(request, req);
28
+ const response = await handler(request);
26
29
  if (response.status === 101)
27
30
  return;
28
31
  const outHeaders = {};
@@ -1 +1 @@
1
- {"version":3,"file":"production-server.d.ts","sourceRoot":"","sources":["../../../src/src/server/production-server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA4BrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAoFtE,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,oFAAoF;IACpF,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,mDAAmD;AACnD,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;;OASG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,gCAAgC;AAChC,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,YAAY,CAAC,CA6LvB"}
1
+ {"version":3,"file":"production-server.d.ts","sourceRoot":"","sources":["../../../src/src/server/production-server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA4BrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAqFtE,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,oFAAoF;IACpF,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,mDAAmD;AACnD,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;;OASG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,gCAAgC;AAChC,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,YAAY,CAAC,CA6LvB"}
@@ -21,6 +21,7 @@ import { HOST_PROJECT_EXECUTION_OVERRIDE_ENV, isHostProjectExecutionOverrideEnab
21
21
  import { isSharedProjectRuntime } from "../security/project-locality.js";
22
22
  import { getIsolationPosture } from "../security/sandbox/worker-pool.js";
23
23
  import { runStartupDiscovery } from "./startup-discovery.js";
24
+ import { runRequestInterceptor } from "../platform/adapters/runtime/shared/request-peer.js";
24
25
  const serverLog = logger.component("server");
25
26
  const globalLog = logger.component("global");
26
27
  /** Default port when PORT / VERYFRONT_PORT env vars are not set */
@@ -187,7 +188,7 @@ export function startProductionServer(options) {
187
188
  const isWebSocketUpgrade = req.headers.get("upgrade")?.toLowerCase() === "websocket";
188
189
  if (isWebSocketUpgrade)
189
190
  return coreHandler(req);
190
- return coreHandler(await requestInterceptor(req));
191
+ return coreHandler(await runRequestInterceptor(req, requestInterceptor));
191
192
  }, { ready: coreHandler.ready })
192
193
  : coreHandler;
193
194
  let resolveListenReady;
@@ -6,6 +6,10 @@ export interface ProjectEnvironmentScope {
6
6
  environmentId: string;
7
7
  token: string;
8
8
  }
9
+ export declare function unwrapReplayedProjectEnvironmentFailure(error: unknown): {
10
+ error: unknown;
11
+ replayed: boolean;
12
+ };
9
13
  type Fetcher = (scope: ProjectEnvironmentScope, signal: AbortSignal) => Promise<Record<string, string>>;
10
14
  export interface EnvironmentVariableCacheOptions {
11
15
  /** Maximum time allowed for one cache-owned upstream fetch. */
@@ -14,9 +18,18 @@ export interface EnvironmentVariableCacheOptions {
14
18
  maxInflight?: number;
15
19
  /** Maximum number of distinct upstream fetches for one canonical project. */
16
20
  maxInflightPerProject?: number;
21
+ /**
22
+ * How long a failed fetch is rethrown before the upstream is retried.
23
+ * Collapses per-request refetch storms during a persistent upstream refusal
24
+ * without ever serving stale or empty data. Zero disables negative caching.
25
+ */
26
+ failureTtlMs?: number;
27
+ /** Mark replayed failures so an error boundary can suppress duplicate reporting. */
28
+ markFailureReplays?: boolean;
17
29
  }
18
30
  export declare class EnvironmentVariableCache {
19
31
  private cache;
32
+ private failures;
20
33
  private inflight;
21
34
  private inflightByProject;
22
35
  private fetcher;
@@ -25,6 +38,8 @@ export declare class EnvironmentVariableCache {
25
38
  private fetchTimeoutMs;
26
39
  private maxInflight;
27
40
  private maxInflightPerProject;
41
+ private failureTtlMs;
42
+ private markFailureReplays;
28
43
  private globalEpoch;
29
44
  private environmentEpochs;
30
45
  constructor(fetcher: Fetcher, ttlMs?: number, maxEntries?: number, options?: EnvironmentVariableCacheOptions);
@@ -37,6 +52,8 @@ export declare class EnvironmentVariableCache {
37
52
  private addInflight;
38
53
  private removeInflight;
39
54
  private invalidateInflight;
55
+ /** Evict oldest recorded failures when they exceed maxEntries. */
56
+ private evictFailuresIfNeeded;
40
57
  /** Evict oldest entries when cache exceeds maxEntries. */
41
58
  private evictIfNeeded;
42
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/cache.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAQD,KAAK,OAAO,GAAG,CACb,KAAK,EAAE,uBAAuB,EAC9B,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAErC,MAAM,WAAW,+BAA+B;IAC9C,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAqGD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAA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AC;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAsGD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,iBAAiB,CAA6B;gBAGpD,OAAO,EAAE,OAAO,EAChB,KAAK,SAAS,EACd,UAAU,SAAsB,EAChC,OAAO,GAAE,+BAAoC;IAwBzC,GAAG,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA+D1E,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;YA8B1B,KAAK;IAyEnB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,kBAAkB;IAK1B,kEAAkE;IAClE,OAAO,CAAC,qBAAqB;IAW7B,0DAA0D;IAC1D,OAAO,CAAC,aAAa;CAUtB"}
@@ -11,9 +11,28 @@ import * as dntShim from "../../../_dnt.shims.js";
11
11
  import { createProjectEnvSnapshot } from "./snapshot.js";
12
12
  import { isErrorAcrossRealms } from "../../platform/compat/error-introspection.js";
13
13
  import { CACHE_ERROR, SERVICE_OVERLOADED, TIMEOUT_ERROR, } from "../../errors/index.js";
14
+ const replayedProjectEnvironmentFailures = new WeakMap();
15
+ class ReplayedProjectEnvironmentFailure extends Error {
16
+ constructor(error) {
17
+ super("Project environment request reused a cached failure");
18
+ this.name = "ReplayedProjectEnvironmentFailure";
19
+ replayedProjectEnvironmentFailures.set(this, error);
20
+ }
21
+ }
22
+ export function unwrapReplayedProjectEnvironmentFailure(error) {
23
+ if (typeof error === "object" && error !== null &&
24
+ replayedProjectEnvironmentFailures.has(error)) {
25
+ return {
26
+ error: replayedProjectEnvironmentFailures.get(error),
27
+ replayed: true,
28
+ };
29
+ }
30
+ return { error, replayed: false };
31
+ }
14
32
  /** Max number of scoped environments to cache. Evicts oldest entry when exceeded. */
15
33
  const DEFAULT_MAX_ENTRIES = 100;
16
34
  const DEFAULT_FETCH_TIMEOUT_MS = 10_000;
35
+ const DEFAULT_FAILURE_TTL_MS = 5_000;
17
36
  const DEFAULT_MAX_INFLIGHT = 100;
18
37
  const DEFAULT_MAX_INFLIGHT_PER_PROJECT = 10;
19
38
  const encodeText = TextEncoder.prototype.encode;
@@ -86,6 +105,7 @@ function invalidatedError() {
86
105
  }
87
106
  export class EnvironmentVariableCache {
88
107
  cache = new Map();
108
+ failures = new Map();
89
109
  inflight = new Map();
90
110
  inflightByProject = new Map();
91
111
  fetcher;
@@ -94,6 +114,8 @@ export class EnvironmentVariableCache {
94
114
  fetchTimeoutMs;
95
115
  maxInflight;
96
116
  maxInflightPerProject;
117
+ failureTtlMs;
118
+ markFailureReplays;
97
119
  globalEpoch = 0;
98
120
  environmentEpochs = new Map();
99
121
  constructor(fetcher, ttlMs = 60_000, maxEntries = DEFAULT_MAX_ENTRIES, options = {}) {
@@ -103,6 +125,8 @@ export class EnvironmentVariableCache {
103
125
  this.fetchTimeoutMs = positiveInteger(options.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS, "fetchTimeoutMs");
104
126
  this.maxInflight = positiveInteger(options.maxInflight ?? DEFAULT_MAX_INFLIGHT, "maxInflight");
105
127
  this.maxInflightPerProject = positiveInteger(options.maxInflightPerProject ?? DEFAULT_MAX_INFLIGHT_PER_PROJECT, "maxInflightPerProject");
128
+ this.failureTtlMs = nonNegativeInteger(options.failureTtlMs ?? DEFAULT_FAILURE_TTL_MS, "failureTtlMs");
129
+ this.markFailureReplays = options.markFailureReplays === true;
106
130
  }
107
131
  async get(scope) {
108
132
  const normalizedScope = normalizeScope(scope);
@@ -121,8 +145,26 @@ export class EnvironmentVariableCache {
121
145
  // Deduplicate only requests with exactly the same canonical identity and
122
146
  // credential principal. A shared environment ID is never sufficient.
123
147
  const existing = this.inflight.get(key);
124
- if (existing)
125
- return existing.promise;
148
+ if (existing) {
149
+ if (!this.markFailureReplays)
150
+ return existing.promise;
151
+ return existing.promise.catch((error) => {
152
+ throw new ReplayedProjectEnvironmentFailure(error);
153
+ });
154
+ }
155
+ // Rethrow a recent upstream failure instead of starting another fetch so a
156
+ // persistent refusal produces one upstream fetch per TTL window instead of
157
+ // one per request. Still fails closed: no stale or empty data is served.
158
+ const failure = this.failures.get(key);
159
+ if (failure) {
160
+ if (now - failure.failedAt < this.failureTtlMs) {
161
+ if (this.markFailureReplays) {
162
+ throw new ReplayedProjectEnvironmentFailure(failure.error);
163
+ }
164
+ throw failure.error;
165
+ }
166
+ this.failures.delete(key);
167
+ }
126
168
  this.assertAdmission(normalizedScope.projectSlug);
127
169
  const controller = new AbortController();
128
170
  const start = Promise.withResolvers();
@@ -146,6 +188,7 @@ export class EnvironmentVariableCache {
146
188
  this.globalEpoch++;
147
189
  this.environmentEpochs.clear();
148
190
  this.cache.clear();
191
+ this.failures.clear();
149
192
  for (const entry of [...this.inflight.values()]) {
150
193
  this.invalidateInflight(entry);
151
194
  }
@@ -156,6 +199,10 @@ export class EnvironmentVariableCache {
156
199
  if (entry.environmentId === environmentId)
157
200
  this.cache.delete(key);
158
201
  }
202
+ for (const [key, failure] of this.failures) {
203
+ if (failure.environmentId === environmentId)
204
+ this.failures.delete(key);
205
+ }
159
206
  for (const entry of [...this.inflight.values()]) {
160
207
  if (entry.environmentId === environmentId)
161
208
  this.invalidateInflight(entry);
@@ -198,6 +245,7 @@ export class EnvironmentVariableCache {
198
245
  if (!this.isCurrentEpoch(scope.environmentId, entry.epoch)) {
199
246
  throw invalidatedError();
200
247
  }
248
+ this.failures.delete(entry.key);
201
249
  this.cache.delete(entry.key);
202
250
  this.cache.set(entry.key, {
203
251
  vars,
@@ -207,6 +255,21 @@ export class EnvironmentVariableCache {
207
255
  this.evictIfNeeded();
208
256
  return vars;
209
257
  }
258
+ catch (error) {
259
+ // Record only failures from the current epoch: invalidated work must not
260
+ // poison the newer epoch with its cancellation error.
261
+ if (this.failureTtlMs > 0 &&
262
+ this.isCurrentEpoch(scope.environmentId, entry.epoch)) {
263
+ this.failures.delete(entry.key);
264
+ this.failures.set(entry.key, {
265
+ error,
266
+ failedAt: Date.now(),
267
+ environmentId: scope.environmentId,
268
+ });
269
+ this.evictFailuresIfNeeded();
270
+ }
271
+ throw error;
272
+ }
210
273
  finally {
211
274
  clearTimeout(timeoutId);
212
275
  removeAbortListener();
@@ -252,6 +315,19 @@ export class EnvironmentVariableCache {
252
315
  this.removeInflight(entry);
253
316
  entry.controller.abort(invalidatedError());
254
317
  }
318
+ /** Evict oldest recorded failures when they exceed maxEntries. */
319
+ evictFailuresIfNeeded() {
320
+ if (this.failures.size <= this.maxEntries)
321
+ return;
322
+ const excess = this.failures.size - this.maxEntries;
323
+ let removed = 0;
324
+ for (const key of this.failures.keys()) {
325
+ if (removed >= excess)
326
+ break;
327
+ this.failures.delete(key);
328
+ removed++;
329
+ }
330
+ }
255
331
  /** Evict oldest entries when cache exceeds maxEntries. */
256
332
  evictIfNeeded() {
257
333
  if (this.cache.size <= this.maxEntries)
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/fetcher.ts"],"names":[],"mappings":"A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AAO,MAAM,0BAA0B;;CAE7B,CAAC"}
@@ -3,12 +3,12 @@
3
3
  *
4
4
  * @module server/project-env/fetcher
5
5
  */
6
- import { encodeBase64, getBaseLogger } from "../../utils/index.js";
6
+ import { getBaseLogger } from "../../utils/index.js";
7
7
  import { readResponseTextPrefix } from "../../utils/response-body.js";
8
- import { AUTHENTICATION_REQUIRED, isVeryfrontError, NETWORK_ERROR, PERMISSION_DENIED, } from "../../errors/index.js";
9
- import { getHostEnv } from "../../platform/compat/process.js";
8
+ import { AUTHENTICATION_REQUIRED, CONFIG_INVALID, isVeryfrontError, NETWORK_ERROR, PERMISSION_DENIED, } from "../../errors/index.js";
10
9
  import { isErrorAcrossRealms } from "../../platform/compat/error-introspection.js";
11
10
  import { createProjectEnvSnapshot } from "./snapshot.js";
11
+ import { getMissingProjectEnvInternalCredentialDetail, getProjectEnvInternalAuthorization, requiresProjectEnvInternalAuthorization, } from "./internal-authorization.js";
12
12
  const baseLogger = getBaseLogger("PROJECT-ENV");
13
13
  const logger = baseLogger.component("project-env");
14
14
  /** Max env vars per request. API enforces a hard cap of 100. */
@@ -47,7 +47,17 @@ async function readBoundedEnvironmentResponse(response, signal) {
47
47
  }
48
48
  return text;
49
49
  }
50
- function parseEnvironmentResponse(text) {
50
+ function maskedEnvironmentError(source) {
51
+ if (source === "management") {
52
+ // The management endpoint masks every value by contract. Reaching a masked
53
+ // value here means the host has no internal credentials configured, so the
54
+ // refusal must state the operator-actionable cause.
55
+ return invalidEnvironmentResponse("Refusing masked environment variable response: the management endpoint masks values by contract " +
56
+ "and VERYFRONT_API_INTERNAL_USER/VERYFRONT_API_INTERNAL_PASS are not configured on this host");
57
+ }
58
+ return invalidEnvironmentResponse("Refusing masked environment variable response: the internal endpoint returned a masked value");
59
+ }
60
+ function parseEnvironmentResponse(text, source) {
51
61
  let body;
52
62
  try {
53
63
  body = JSON.parse(text);
@@ -81,7 +91,7 @@ function parseEnvironmentResponse(text) {
81
91
  }
82
92
  keys.add(key);
83
93
  if (value === MASKED_ENV_VALUE) {
84
- throw invalidEnvironmentResponse("Refusing masked environment variable response");
94
+ throw maskedEnvironmentError(source);
85
95
  }
86
96
  result[key] = value;
87
97
  }
@@ -92,13 +102,6 @@ function parseEnvironmentResponse(text) {
92
102
  throw invalidEnvironmentResponse("Project environment response violated runtime limits", cause);
93
103
  }
94
104
  }
95
- function getInternalAuthorization() {
96
- const username = getHostEnv("VERYFRONT_API_INTERNAL_USER");
97
- const password = getHostEnv("VERYFRONT_API_INTERNAL_PASS");
98
- if (!username || !password)
99
- return undefined;
100
- return `Basic ${encodeBase64(`${username}:${password}`)}`;
101
- }
102
105
  async function fetchEnvironmentVariables(url, authorization, projectSlug, environmentId, signal, headers = {}) {
103
106
  try {
104
107
  const requestHeaders = new Headers(headers);
@@ -171,7 +174,14 @@ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId
171
174
  }
172
175
  // Do not even materialize the host credential until the tenant credential
173
176
  // has proved access to this canonical project/environment pair.
174
- const internalAuthorization = getInternalAuthorization();
177
+ const internalAuthorization = getProjectEnvInternalAuthorization();
178
+ if (!internalAuthorization && requiresProjectEnvInternalAuthorization()) {
179
+ discardResponseBody(response);
180
+ throw CONFIG_INVALID.create({
181
+ detail: getMissingProjectEnvInternalCredentialDetail() ??
182
+ "Internal project environment authorization is unavailable in hosted proxy mode",
183
+ });
184
+ }
175
185
  if (internalAuthorization) {
176
186
  discardResponseBody(response);
177
187
  response = await fetchEnvironmentVariables(internalUrl, internalAuthorization, projectSlug, environmentId, signal, { "x-project-slug": projectSlug });
@@ -186,7 +196,7 @@ export async function fetchProjectEnvVars(apiBaseUrl, projectSlug, environmentId
186
196
  throw NETWORK_ERROR.create({ detail: "Internal project environment request failed" });
187
197
  }
188
198
  try {
189
- const result = parseEnvironmentResponse(await readBoundedEnvironmentResponse(response, signal));
199
+ const result = parseEnvironmentResponse(await readBoundedEnvironmentResponse(response, signal), internalAuthorization ? "internal" : "management");
190
200
  logger.debug("Fetched env vars", {
191
201
  projectSlug,
192
202
  environmentId,
@@ -4,7 +4,7 @@
4
4
  * @module server/project-env
5
5
  */
6
6
  export { getProjectEnv, getProjectEnvSnapshot, isProjectEnvActive, runWithProjectEnv, } from "./storage.js";
7
- export { EnvironmentVariableCache, type EnvironmentVariableCacheOptions, type ProjectEnvironmentScope, } from "./cache.js";
7
+ export { EnvironmentVariableCache, type EnvironmentVariableCacheOptions, type ProjectEnvironmentScope, unwrapReplayedProjectEnvironmentFailure, } from "./cache.js";
8
8
  export { filterRuntimeProjectEnv, filterSharedRuntimeProjectEnv } from "./reserved-env.js";
9
9
  export { fetchProjectEnvVars } from "./fetcher.js";
10
10
  export { type NamedProjectEnvironmentScope, ProductionEnvironmentResolver, type ProductionEnvironmentScope, ProjectEnvironmentIdentityResolver, } from "./production-environment-resolver.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,4BAA4B,EACjC,6BAA6B,EAC7B,KAAK,0BAA0B,EAC/B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,4BAA4B,EACjC,6BAA6B,EAC7B,KAAK,0BAA0B,EAC/B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * @module server/project-env
5
5
  */
6
6
  export { getProjectEnv, getProjectEnvSnapshot, isProjectEnvActive, runWithProjectEnv, } from "./storage.js";
7
- export { EnvironmentVariableCache, } from "./cache.js";
7
+ export { EnvironmentVariableCache, unwrapReplayedProjectEnvironmentFailure, } from "./cache.js";
8
8
  export { filterRuntimeProjectEnv, filterSharedRuntimeProjectEnv } from "./reserved-env.js";
9
9
  export { fetchProjectEnvVars } from "./fetcher.js";
10
10
  export { ProductionEnvironmentResolver, ProjectEnvironmentIdentityResolver, } from "./production-environment-resolver.js";
@@ -0,0 +1,7 @@
1
+ /** Whether project env reads require the hosted runtime's internal API credential. */
2
+ export declare function requiresProjectEnvInternalAuthorization(): boolean;
3
+ /** Name the missing hosted runtime credentials without exposing their values. */
4
+ export declare function getMissingProjectEnvInternalCredentialDetail(): string | undefined;
5
+ /** Build the internal API authorization header when both credentials are present. */
6
+ export declare function getProjectEnvInternalAuthorization(): string | undefined;
7
+ //# sourceMappingURL=internal-authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-authorization.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/internal-authorization.ts"],"names":[],"mappings":"AAQA,sFAAsF;AACtF,wBAAgB,uCAAuC,IAAI,OAAO,CAKjE;AAED,iFAAiF;AACjF,wBAAgB,4CAA4C,IAAI,MAAM,GAAG,SAAS,CAQjF;AAED,qFAAqF;AACrF,wBAAgB,kCAAkC,IAAI,MAAM,GAAG,SAAS,CAKvE"}