eve 0.44.3 → 0.45.0

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 (821) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +13 -12
  3. package/dist/src/acp/adapter.d.ts +1 -1
  4. package/dist/src/approval/definition.d.ts +84 -0
  5. package/dist/src/approval/definition.js +1 -0
  6. package/dist/src/channel/adapter.d.ts +2 -2
  7. package/dist/src/{runtime/governance → channel}/auth/http-basic.d.ts +1 -1
  8. package/dist/src/{runtime/governance → channel}/auth/jwt-ecdsa.d.ts +1 -1
  9. package/dist/src/channel/auth/jwt-ecdsa.js +1 -0
  10. package/dist/src/{runtime/governance → channel}/auth/jwt-hmac.d.ts +1 -1
  11. package/dist/src/channel/auth/jwt-hmac.js +1 -0
  12. package/dist/src/{runtime/governance → channel}/auth/oidc.d.ts +1 -1
  13. package/dist/src/channel/auth/oidc.js +1 -0
  14. package/dist/src/{runtime/governance → channel}/auth/token-claims.d.ts +1 -1
  15. package/dist/src/{runtime/governance → channel}/auth/types.d.ts +1 -1
  16. package/dist/src/{runtime/governance → channel}/auth/vercel-oidc-project.d.ts +1 -1
  17. package/dist/src/channel/channel-operations.d.ts +1 -1
  18. package/dist/src/channel/channel-operations.js +1 -1
  19. package/dist/src/channel/instrumentation.d.ts +1 -0
  20. package/dist/src/channel/instrumentation.js +1 -1
  21. package/dist/src/channel/resolve-text.d.ts +1 -1
  22. package/dist/src/channel/routes.d.ts +1 -1
  23. package/dist/src/channel/session.d.ts +1 -1
  24. package/dist/src/channel/session.js +1 -1
  25. package/dist/src/channel/types.d.ts +2 -2
  26. package/dist/src/chunks/{use-eve-agent-DpUEwS23.js → use-eve-agent-C46Kan_I.js} +390 -107
  27. package/dist/src/chunks/{use-eve-agent-BsLJiIbc.js → use-eve-agent-OtHRoxIS.js} +390 -107
  28. package/dist/src/cli/banner.js +1 -1
  29. package/dist/src/cli/commands/agent-instructions.js +2 -2
  30. package/dist/src/cli/commands/channel-add-conflicts.js +1 -1
  31. package/dist/src/cli/commands/extension-build.js +1 -1
  32. package/dist/src/cli/commands/extension-init.js +1 -1
  33. package/dist/src/cli/commands/info.js +1 -1
  34. package/dist/src/cli/commands/init.js +1 -1
  35. package/dist/src/cli/commands/trace.js +1 -1
  36. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  37. package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
  38. package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
  39. package/dist/src/cli/dev/tui/remote-auth.js +1 -1
  40. package/dist/src/cli/dev/tui/setup-commands.d.ts +2 -0
  41. package/dist/src/cli/dev/tui/setup-commands.js +1 -1
  42. package/dist/src/cli/dev/tui/setup-selection-input.d.ts +3 -1
  43. package/dist/src/cli/dev/tui/setup-selection-input.js +2 -2
  44. package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
  45. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +1 -1
  46. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
  47. package/dist/src/cli/dev/tui/traces/trace-viewer-state.js +1 -1
  48. package/dist/src/cli/invoke/result.d.ts +1 -1
  49. package/dist/src/cli/ui/live-row.js +1 -1
  50. package/dist/src/cli/ui/output.js +1 -1
  51. package/dist/src/client/agent-info-schema.d.ts +1757 -302
  52. package/dist/src/client/agent-info-schema.js +1 -1
  53. package/dist/src/client/client.js +1 -1
  54. package/dist/src/client/eve-agent-store.d.ts +6 -5
  55. package/dist/src/client/eve-agent-store.js +1 -1
  56. package/dist/src/client/health-response-error.d.ts +5 -0
  57. package/dist/src/client/health-response-error.js +1 -0
  58. package/dist/src/client/health-schema.d.ts +7 -0
  59. package/dist/src/client/health-schema.js +1 -0
  60. package/dist/src/client/index.d.ts +6 -3
  61. package/dist/src/client/index.js +1 -1
  62. package/dist/src/client/message-action-parts.d.ts +2 -2
  63. package/dist/src/client/message-reducer-types.d.ts +1 -1
  64. package/dist/src/client/reducer.d.ts +1 -1
  65. package/dist/src/client/session-utils.d.ts +1 -1
  66. package/dist/src/client/session.d.ts +1 -1
  67. package/dist/src/client/session.js +1 -1
  68. package/dist/src/client/types.d.ts +3 -7
  69. package/dist/src/compiler/artifacts.d.ts +37 -11
  70. package/dist/src/compiler/artifacts.js +1 -1
  71. package/dist/src/compiler/channel-route-plan.d.ts +10 -0
  72. package/dist/src/compiler/channel-route-plan.js +1 -0
  73. package/dist/src/compiler/compile-agent.d.ts +2 -2
  74. package/dist/src/compiler/compile-agent.js +2 -2
  75. package/dist/src/compiler/compile-from-memory.d.ts +13 -52
  76. package/dist/src/compiler/compile-from-memory.js +1 -1
  77. package/dist/src/compiler/diagnostics.d.ts +38 -0
  78. package/dist/src/compiler/diagnostics.js +1 -0
  79. package/dist/src/compiler/extension-compatibility.d.ts +14 -11
  80. package/dist/src/compiler/extension-compatibility.js +1 -1
  81. package/dist/src/compiler/load-binding-namespace.d.ts +9 -0
  82. package/dist/src/compiler/load-binding-namespace.js +1 -0
  83. package/dist/src/compiler/manifest.d.ts +172 -51
  84. package/dist/src/compiler/manifest.js +1 -1
  85. package/dist/src/compiler/module-map.d.ts +12 -30
  86. package/dist/src/compiler/module-map.js +3 -3
  87. package/dist/src/compiler/node-source-state.d.ts +24 -0
  88. package/dist/src/compiler/node-source-state.js +1 -0
  89. package/dist/src/compiler/normalize-agent-config.d.ts +5 -1
  90. package/dist/src/compiler/normalize-agent-config.js +1 -1
  91. package/dist/src/compiler/normalize-channel.d.ts +8 -2
  92. package/dist/src/compiler/normalize-channel.js +1 -1
  93. package/dist/src/compiler/normalize-connection.d.ts +1 -1
  94. package/dist/src/compiler/normalize-connection.js +1 -1
  95. package/dist/src/compiler/normalize-helpers.d.ts +13 -4
  96. package/dist/src/compiler/normalize-helpers.js +1 -1
  97. package/dist/src/compiler/normalize-hook.d.ts +4 -11
  98. package/dist/src/compiler/normalize-hook.js +1 -1
  99. package/dist/src/compiler/normalize-instructions.d.ts +3 -3
  100. package/dist/src/compiler/normalize-instructions.js +1 -1
  101. package/dist/src/compiler/normalize-manifest-helpers.d.ts +29 -0
  102. package/dist/src/compiler/normalize-manifest-helpers.js +1 -0
  103. package/dist/src/compiler/normalize-manifest.d.ts +8 -4
  104. package/dist/src/compiler/normalize-manifest.js +1 -1
  105. package/dist/src/compiler/normalize-sandbox.d.ts +1 -1
  106. package/dist/src/compiler/normalize-sandbox.js +1 -1
  107. package/dist/src/compiler/normalize-schedule.d.ts +2 -2
  108. package/dist/src/compiler/normalize-schedule.js +1 -1
  109. package/dist/src/compiler/normalize-skill.d.ts +2 -2
  110. package/dist/src/compiler/normalize-skill.js +1 -1
  111. package/dist/src/compiler/normalize-subagent.d.ts +21 -39
  112. package/dist/src/compiler/normalize-subagent.js +1 -1
  113. package/dist/src/compiler/normalize-tool.d.ts +2 -1
  114. package/dist/src/compiler/normalize-tool.js +1 -1
  115. package/dist/src/compiler/project-sources.d.ts +71 -0
  116. package/dist/src/compiler/project-sources.js +1 -0
  117. package/dist/src/compiler/remote-agent-node.d.ts +8 -0
  118. package/dist/src/compiler/remote-agent-node.js +1 -1
  119. package/dist/src/compiler/source-graph.d.ts +153 -0
  120. package/dist/src/compiler/source-graph.js +1 -0
  121. package/dist/src/compiler/validate-artifact.d.ts +17 -0
  122. package/dist/src/compiler/validate-artifact.js +1 -0
  123. package/dist/src/compiler/workspace-resources.js +1 -1
  124. package/dist/src/connections/errors.d.ts +125 -0
  125. package/dist/src/connections/errors.js +1 -0
  126. package/dist/src/context/build-base-tool-context.d.ts +2 -2
  127. package/dist/src/context/build-callback-context.d.ts +1 -1
  128. package/dist/src/context/build-dynamic-tools.js +1 -1
  129. package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
  130. package/dist/src/context/dynamic-resolve-context.d.ts +1 -1
  131. package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
  132. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +0 -2
  133. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  134. package/dist/src/context/dynamic-tool-lifecycle.d.ts +2 -2
  135. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  136. package/dist/src/context/key-names.d.ts +12 -0
  137. package/dist/src/context/key-names.js +1 -0
  138. package/dist/src/context/keys.d.ts +8 -1
  139. package/dist/src/context/keys.js +1 -1
  140. package/dist/src/context/providers/connection-key.d.ts +1 -1
  141. package/dist/src/context/providers/connection.d.ts +1 -1
  142. package/dist/src/context/session-context.d.ts +32 -0
  143. package/dist/src/discover/discover-agent.d.ts +0 -13
  144. package/dist/src/discover/discover-agent.js +1 -1
  145. package/dist/src/discover/discover-subagent.js +1 -1
  146. package/dist/src/discover/extensions.d.ts +0 -6
  147. package/dist/src/discover/extensions.js +1 -1
  148. package/dist/src/discover/manifest.d.ts +4 -1
  149. package/dist/src/discover/manifest.js +1 -1
  150. package/dist/src/dynamic/definition.d.ts +117 -0
  151. package/dist/src/dynamic/definition.js +1 -0
  152. package/dist/src/evals/autoevals-client.js +1 -1
  153. package/dist/src/evals/index.d.ts +1 -1
  154. package/dist/src/evals/match.d.ts +1 -1
  155. package/dist/src/evals/runner/reporters/console.js +1 -1
  156. package/dist/src/evals/session.d.ts +1 -1
  157. package/dist/src/evals/target.js +1 -1
  158. package/dist/src/evals/types.d.ts +1 -1
  159. package/dist/src/eve-channel/index.d.ts +12 -0
  160. package/dist/src/eve-channel/index.js +1 -0
  161. package/dist/src/eve-channel/request.d.ts +49 -0
  162. package/dist/src/eve-channel/request.js +3 -0
  163. package/dist/src/eve-channel/support.d.ts +34 -0
  164. package/dist/src/eve-channel/support.js +1 -0
  165. package/dist/src/eve-channel/types.d.ts +128 -0
  166. package/dist/src/eve-channel/types.js +1 -0
  167. package/dist/src/execution/agent-handle-dispatch.d.ts +1 -1
  168. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  169. package/dist/src/execution/authorization-callback-match.d.ts +1 -1
  170. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  171. package/dist/src/execution/compaction.js +1 -1
  172. package/dist/src/execution/connection-auth-tool-result.d.ts +1 -1
  173. package/dist/src/{runtime → execution}/connections/callback-route.d.ts +2 -20
  174. package/dist/src/execution/connections/callback-route.js +1 -0
  175. package/dist/src/execution/create-session-step.js +1 -1
  176. package/dist/src/execution/delegated-parent-notification.d.ts +2 -2
  177. package/dist/src/execution/delegated-parent-notification.js +1 -1
  178. package/dist/src/execution/delegated-parent-result.d.ts +1 -1
  179. package/dist/src/execution/delegated-parent-result.js +1 -1
  180. package/dist/src/execution/delegation-tool.d.ts +1 -1
  181. package/dist/src/execution/delegation-tool.js +1 -1
  182. package/dist/src/execution/dispatch-action-failures.d.ts +1 -1
  183. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +1 -2
  184. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  185. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  186. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +1 -1
  187. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -1
  188. package/dist/src/execution/durable-session-store.js +1 -1
  189. package/dist/src/execution/effective-output-schema.d.ts +2 -1
  190. package/dist/src/execution/eve-workflow-attributes.d.ts +6 -0
  191. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  192. package/dist/src/execution/forward-turn-cancellation-step.js +1 -1
  193. package/dist/src/execution/node-step.js +1 -1
  194. package/dist/src/execution/remote-agent-dispatch.d.ts +10 -8
  195. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  196. package/dist/src/execution/runtime-context.js +1 -1
  197. package/dist/src/execution/sandbox/{bash-tool.d.ts → bash.d.ts} +2 -2
  198. package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +1 -0
  199. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  200. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  201. package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
  202. package/dist/src/execution/sandbox/glob-tool.js +1 -1
  203. package/dist/src/execution/sandbox/grep-tool.js +1 -1
  204. package/dist/src/execution/sandbox/{read-file-tool.d.ts → read-file.d.ts} +2 -2
  205. package/dist/src/execution/sandbox/{read-file-tool.js → read-file.js} +1 -1
  206. package/dist/src/execution/sandbox/{write-file-tool.d.ts → write-file.d.ts} +2 -2
  207. package/dist/src/execution/sandbox/write-file.js +1 -0
  208. package/dist/src/execution/session-callback-route.d.ts +2 -0
  209. package/dist/src/execution/session-callback-route.js +1 -0
  210. package/dist/src/execution/session-callback-step.js +1 -1
  211. package/dist/src/execution/session-timeout-steps.js +1 -1
  212. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  213. package/dist/src/execution/subagent-adapter.js +1 -1
  214. package/dist/src/execution/subagent-hitl-proxy.d.ts +1 -1
  215. package/dist/src/execution/subagent-invocation.d.ts +0 -3
  216. package/dist/src/execution/subagent-invocation.js +1 -1
  217. package/dist/src/execution/subagent-start-local.d.ts +1 -2
  218. package/dist/src/execution/subagent-start-local.js +1 -1
  219. package/dist/src/execution/subagent-start-remote.d.ts +1 -2
  220. package/dist/src/execution/subagent-start-remote.js +1 -1
  221. package/dist/src/execution/subagent-tool.d.ts +4 -8
  222. package/dist/src/execution/subagent-tool.js +1 -1
  223. package/dist/src/execution/subagent-usage-span.d.ts +1 -1
  224. package/dist/src/execution/task-input-response-route.d.ts +2 -0
  225. package/dist/src/execution/task-input-response-route.js +1 -0
  226. package/dist/src/execution/tasks/child/instructions.js +1 -1
  227. package/dist/src/execution/tasks/child/update.d.ts +1 -1
  228. package/dist/src/execution/tasks/child/update.js +1 -1
  229. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +1 -1
  230. package/dist/src/execution/tasks/parent/control-shared.d.ts +1 -1
  231. package/dist/src/execution/tasks/parent/delegate.d.ts +2 -2
  232. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  233. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  234. package/dist/src/execution/tasks/parent/dispatch.d.ts +3 -1
  235. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  236. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  237. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  238. package/dist/src/execution/terminate-child-sessions-step.d.ts +4 -5
  239. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  240. package/dist/src/execution/tool-auth.d.ts +5 -6
  241. package/dist/src/execution/tool-auth.js +1 -1
  242. package/dist/src/execution/tools/connection-search.d.ts +1 -0
  243. package/dist/src/execution/tools/connection-search.js +2 -0
  244. package/dist/src/{runtime/framework-tools → execution/tools}/file-state.d.ts +2 -2
  245. package/dist/src/execution/tools/load-skill.d.ts +6 -0
  246. package/dist/src/execution/tools/load-skill.js +1 -0
  247. package/dist/src/{runtime/framework-tools → execution/tools}/subagent/local.d.ts +7 -7
  248. package/dist/src/execution/tools/subagent/local.js +1 -0
  249. package/dist/src/{runtime/framework-tools → execution/tools}/subagent/remote.d.ts +5 -5
  250. package/dist/src/execution/tools/subagent/remote.js +1 -0
  251. package/dist/src/execution/tools/tasks.d.ts +18 -0
  252. package/dist/src/execution/tools/tasks.js +1 -0
  253. package/dist/src/{runtime/framework-tools → execution/tools}/todo.d.ts +0 -2
  254. package/dist/src/{runtime/framework-tools → execution/tools}/todo.js +1 -2
  255. package/dist/src/execution/turn-control-protocol.js +1 -1
  256. package/dist/src/execution/web-fetch/execute.js +1 -0
  257. package/dist/src/execution/web-fetch/request.js +1 -1
  258. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  259. package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
  260. package/dist/src/execution/workflow-entry.js +1 -1
  261. package/dist/src/execution/workflow-runtime.js +1 -1
  262. package/dist/src/execution/workflow-steps.js +1 -1
  263. package/dist/src/execution/workflow-trace-context.js +1 -1
  264. package/dist/src/framework/host-inventory.d.ts +8 -0
  265. package/dist/src/framework/host-inventory.js +1 -0
  266. package/dist/src/framework/sources/modules/agent.d.ts +4 -0
  267. package/dist/src/framework/sources/modules/agent.js +1 -0
  268. package/dist/src/framework/sources/modules/eve-channel.d.ts +1 -0
  269. package/dist/src/framework/sources/modules/eve-channel.js +1 -0
  270. package/dist/src/framework/sources/modules/home-channel.d.ts +2 -0
  271. package/dist/src/framework/sources/modules/home-channel.js +1 -0
  272. package/dist/src/framework/sources/modules/sandbox.d.ts +2 -0
  273. package/dist/src/framework/sources/modules/sandbox.js +1 -0
  274. package/dist/src/framework/sources/registry.d.ts +5 -0
  275. package/dist/src/framework/sources/registry.js +1 -0
  276. package/dist/src/harness/action-result-helpers.d.ts +1 -1
  277. package/dist/src/harness/advertised-tools.js +1 -1
  278. package/dist/src/harness/attachment-staging.js +1 -1
  279. package/dist/src/harness/authorization.d.ts +3 -3
  280. package/dist/src/harness/background-tools.d.ts +2 -2
  281. package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
  282. package/dist/src/harness/compaction.js +1 -1
  283. package/dist/src/harness/execute-tool.d.ts +3 -3
  284. package/dist/src/{runtime/framework-tools → harness}/final-output.d.ts +1 -1
  285. package/dist/src/harness/final-output.js +1 -0
  286. package/dist/src/harness/handles/query.d.ts +1 -1
  287. package/dist/src/harness/handles/store.d.ts +8 -0
  288. package/dist/src/harness/handles/store.js +1 -1
  289. package/dist/src/harness/hitl/approval-input-requests.d.ts +1 -1
  290. package/dist/src/harness/hitl/approval-prompt.d.ts +1 -1
  291. package/dist/src/harness/hitl/pending-input-resolution.d.ts +2 -2
  292. package/dist/src/harness/hitl/question-input-requests.d.ts +1 -1
  293. package/dist/src/harness/input-extraction.d.ts +1 -1
  294. package/dist/src/harness/input-extraction.js +1 -1
  295. package/dist/src/harness/input-request-class.d.ts +1 -1
  296. package/dist/src/harness/input-request-resolution.d.ts +1 -1
  297. package/dist/src/harness/input-requests.d.ts +2 -2
  298. package/dist/src/harness/instrumentation/lifecycle.d.ts +3 -0
  299. package/dist/src/harness/instrumentation/providers.js +1 -1
  300. package/dist/src/harness/instrumentation/runtime.d.ts +2 -1
  301. package/dist/src/harness/pending-input-batches.d.ts +1 -1
  302. package/dist/src/harness/prepare-trace-context.d.ts +3 -0
  303. package/dist/src/harness/prepare-trace-context.js +1 -1
  304. package/dist/src/harness/provider-safety.d.ts +7 -0
  305. package/dist/src/harness/provider-safety.js +1 -0
  306. package/dist/src/{runtime/framework-tools/web-search.d.ts → harness/provider-tool-schemas.d.ts} +1 -9
  307. package/dist/src/harness/provider-tool-schemas.js +1 -0
  308. package/dist/src/harness/provider-tools.js +1 -1
  309. package/dist/src/harness/proxy-input-requests.d.ts +1 -1
  310. package/dist/src/harness/request-input-tool.d.ts +4 -0
  311. package/dist/src/harness/request-input-tool.js +1 -0
  312. package/dist/src/harness/runtime-actions.d.ts +1 -1
  313. package/dist/src/harness/session-limit-continuation.d.ts +1 -1
  314. package/dist/src/harness/step-hooks.d.ts +2 -0
  315. package/dist/src/harness/step-hooks.js +1 -1
  316. package/dist/src/harness/stream-actions.d.ts +1 -1
  317. package/dist/src/harness/subagent-depth.d.ts +1 -1
  318. package/dist/src/harness/tool-call-action.d.ts +1 -1
  319. package/dist/src/harness/tool-call-input-errors.d.ts +1 -1
  320. package/dist/src/harness/tool-loop.js +2 -2
  321. package/dist/src/harness/tool-model-output.d.ts +1 -1
  322. package/dist/src/harness/tools.d.ts +1 -1
  323. package/dist/src/harness/tools.js +1 -1
  324. package/dist/src/harness/types.d.ts +3 -9
  325. package/dist/src/harness/workflow-runtime-action-state.d.ts +1 -1
  326. package/dist/src/harness/workflow-subagent-limit.d.ts +1 -1
  327. package/dist/src/instrumentation/provider.d.ts +117 -0
  328. package/dist/src/instrumentation/provider.js +1 -0
  329. package/dist/src/internal/application/compiled-artifacts.js +5 -4
  330. package/dist/src/internal/application/package.js +1 -1
  331. package/dist/src/internal/authored-definition/approval.d.ts +1 -1
  332. package/dist/src/internal/authored-definition/connection.js +1 -1
  333. package/dist/src/internal/authored-definition/core.js +1 -1
  334. package/dist/src/internal/authored-definition/schema-backed.d.ts +6 -3
  335. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  336. package/dist/src/internal/authored-definition/source-identity.d.ts +17 -0
  337. package/dist/src/internal/authored-definition/source-identity.js +1 -0
  338. package/dist/src/internal/authored-module-map-loader.d.ts +1 -5
  339. package/dist/src/internal/authored-module-map-loader.js +1 -1
  340. package/dist/src/internal/helpers/markdown.js +1 -1
  341. package/dist/src/internal/invocation/agent-invocation.d.ts +2 -2
  342. package/dist/src/internal/invocation/workflow-execution.d.ts +1 -1
  343. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  344. package/dist/src/internal/materialized-authored-modules.js +1 -1
  345. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  346. package/dist/src/internal/nitro/host/application-route-registry.d.ts +2 -41
  347. package/dist/src/internal/nitro/host/application-route-registry.js +1 -1
  348. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  349. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  350. package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -4
  351. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  352. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  353. package/dist/src/internal/nitro/host/extension-capability-requirements.d.ts +2 -0
  354. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  355. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  356. package/dist/src/internal/nitro/host/start-production-server.js +3 -3
  357. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +9 -215
  358. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  359. package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.d.ts +2 -13
  360. package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -1
  361. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  362. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +5 -0
  363. package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
  364. package/dist/src/internal/nitro/routes/index.d.ts +0 -9
  365. package/dist/src/internal/nitro/routes/index.js +1 -1
  366. package/dist/src/internal/nitro/routes/info.js +1 -1
  367. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +5 -5
  368. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  369. package/dist/src/internal/programmatic-source-loader.d.ts +1 -0
  370. package/dist/src/internal/programmatic-source-loader.js +1 -0
  371. package/dist/src/internal/runtime-registry.d.ts +3 -4
  372. package/dist/src/protocol/message.d.ts +3 -3
  373. package/dist/src/protocol/routes.d.ts +2 -0
  374. package/dist/src/protocol/routes.js +1 -1
  375. package/dist/src/public/agents/auth.d.ts +10 -6
  376. package/dist/src/public/agents/auth.js +1 -1
  377. package/dist/src/public/channels/auth.d.ts +1 -1
  378. package/dist/src/public/channels/auth.js +1 -1
  379. package/dist/src/public/channels/chat-sdk/authorization.d.ts +3 -0
  380. package/dist/src/public/channels/chat-sdk/authorization.js +3 -0
  381. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +2 -0
  382. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  383. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  384. package/dist/src/public/channels/discord/hitl.d.ts +1 -1
  385. package/dist/src/public/channels/discord/hitl.js +1 -1
  386. package/dist/src/public/channels/discord/inbound.d.ts +1 -0
  387. package/dist/src/public/channels/discord/inbound.js +1 -1
  388. package/dist/src/public/channels/eve.d.ts +1 -139
  389. package/dist/src/public/channels/eve.js +1 -3
  390. package/dist/src/public/channels/github/dispatch.d.ts +5 -0
  391. package/dist/src/public/channels/github/dispatch.js +1 -1
  392. package/dist/src/public/channels/github/githubChannel.js +1 -1
  393. package/dist/src/public/channels/github/inbound.d.ts +2 -0
  394. package/dist/src/public/channels/github/inbound.js +1 -1
  395. package/dist/src/public/channels/index.d.ts +1 -1
  396. package/dist/src/public/channels/index.js +1 -1
  397. package/dist/src/public/channels/linear/hitl.d.ts +1 -1
  398. package/dist/src/public/channels/linear/inbound.js +1 -1
  399. package/dist/src/public/channels/linq/index.d.ts +1 -1
  400. package/dist/src/public/channels/linq/index.js +1 -1
  401. package/dist/src/public/channels/linq/linqChannel.d.ts +3 -1
  402. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  403. package/dist/src/public/channels/mcp.js +1 -1
  404. package/dist/src/public/channels/photon/index.d.ts +1 -1
  405. package/dist/src/public/channels/photon/index.js +1 -1
  406. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +3 -1
  407. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  408. package/dist/src/public/channels/slack/action-status.d.ts +1 -1
  409. package/dist/src/public/channels/slack/api.d.ts +15 -5
  410. package/dist/src/public/channels/slack/api.js +1 -1
  411. package/dist/src/public/channels/slack/attachments.d.ts +2 -2
  412. package/dist/src/public/channels/slack/attachments.js +1 -1
  413. package/dist/src/public/channels/slack/hitl.d.ts +3 -1
  414. package/dist/src/public/channels/slack/hitl.js +1 -1
  415. package/dist/src/public/channels/slack/inbound-content.d.ts +4 -0
  416. package/dist/src/public/channels/slack/inbound-content.js +4 -0
  417. package/dist/src/public/channels/slack/inbound.d.ts +17 -1
  418. package/dist/src/public/channels/slack/inbound.js +1 -1
  419. package/dist/src/public/channels/slack/index.d.ts +1 -1
  420. package/dist/src/public/channels/slack/input-response.d.ts +1 -0
  421. package/dist/src/public/channels/slack/input-response.js +1 -1
  422. package/dist/src/public/channels/slack/interaction-cards.d.ts +10 -0
  423. package/dist/src/public/channels/slack/interaction-cards.js +1 -0
  424. package/dist/src/public/channels/slack/interactions.d.ts +1 -0
  425. package/dist/src/public/channels/slack/interactions.js +1 -1
  426. package/dist/src/public/channels/slack/model-context.d.ts +3 -1
  427. package/dist/src/public/channels/slack/model-context.js +2 -2
  428. package/dist/src/public/channels/slack/session-operations.d.ts +1 -1
  429. package/dist/src/public/channels/slack/slackChannel.d.ts +7 -2
  430. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  431. package/dist/src/public/channels/teams/hitl.d.ts +1 -1
  432. package/dist/src/public/channels/teams/hitl.js +1 -1
  433. package/dist/src/public/channels/teams/inbound.d.ts +2 -0
  434. package/dist/src/public/channels/teams/inbound.js +1 -1
  435. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  436. package/dist/src/public/channels/teams/verify.js +1 -1
  437. package/dist/src/public/channels/telegram/api.d.ts +15 -0
  438. package/dist/src/public/channels/telegram/api.js +2 -2
  439. package/dist/src/public/channels/telegram/authorization-callback.d.ts +10 -0
  440. package/dist/src/public/channels/telegram/authorization-callback.js +1 -0
  441. package/dist/src/public/channels/telegram/authorization.d.ts +19 -0
  442. package/dist/src/public/channels/telegram/authorization.js +3 -0
  443. package/dist/src/public/channels/telegram/defaults.d.ts +1 -0
  444. package/dist/src/public/channels/telegram/defaults.js +3 -3
  445. package/dist/src/public/channels/telegram/hitl.d.ts +1 -1
  446. package/dist/src/public/channels/telegram/hitl.js +1 -1
  447. package/dist/src/public/channels/telegram/inbound.d.ts +1 -0
  448. package/dist/src/public/channels/telegram/inbound.js +1 -1
  449. package/dist/src/public/channels/telegram/index.d.ts +1 -1
  450. package/dist/src/public/channels/telegram/index.js +1 -1
  451. package/dist/src/public/channels/telegram/state.d.ts +6 -0
  452. package/dist/src/public/channels/telegram/state.js +1 -0
  453. package/dist/src/public/channels/telegram/telegramChannel.d.ts +11 -0
  454. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  455. package/dist/src/public/connections/errors.d.ts +1 -125
  456. package/dist/src/public/connections/errors.js +1 -1
  457. package/dist/src/public/connections/index.d.ts +2 -2
  458. package/dist/src/public/connections/index.js +1 -1
  459. package/dist/src/public/definitions/agent.d.ts +1 -1
  460. package/dist/src/public/definitions/agent.js +1 -1
  461. package/dist/src/public/definitions/approval.d.ts +2 -84
  462. package/dist/src/public/definitions/approval.js +1 -1
  463. package/dist/src/public/definitions/callback-context.d.ts +1 -32
  464. package/dist/src/public/definitions/connections/mcp.d.ts +1 -1
  465. package/dist/src/public/definitions/connections/mcp.js +1 -1
  466. package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
  467. package/dist/src/public/definitions/connections/openapi.js +1 -1
  468. package/dist/src/public/definitions/connections/protocol.d.ts +1 -1
  469. package/dist/src/public/definitions/instructions.d.ts +2 -2
  470. package/dist/src/public/definitions/instructions.js +1 -1
  471. package/dist/src/public/definitions/skill.js +1 -1
  472. package/dist/src/public/index.d.ts +1 -1
  473. package/dist/src/public/instructions/index.d.ts +1 -1
  474. package/dist/src/public/instrumentation/provider.d.ts +1 -117
  475. package/dist/src/public/instrumentation/provider.js +1 -1
  476. package/dist/src/public/models/openai/chatgpt/auth.js +1 -1
  477. package/dist/src/public/next/server.js +1 -1
  478. package/dist/src/public/nuxt/dev-server.js +1 -1
  479. package/dist/src/public/sandbox/backends/default.d.ts +1 -49
  480. package/dist/src/public/sandbox/backends/default.js +1 -1
  481. package/dist/src/public/sandbox/backends/docker.d.ts +1 -14
  482. package/dist/src/public/sandbox/backends/docker.js +1 -1
  483. package/dist/src/public/sandbox/backends/just-bash.d.ts +1 -17
  484. package/dist/src/public/sandbox/backends/just-bash.js +1 -1
  485. package/dist/src/public/sandbox/backends/microsandbox.d.ts +1 -17
  486. package/dist/src/public/sandbox/backends/microsandbox.js +1 -1
  487. package/dist/src/public/sandbox/backends/vercel.d.ts +1 -30
  488. package/dist/src/public/sandbox/backends/vercel.js +1 -1
  489. package/dist/src/public/sandbox/just-bash-sandbox.d.ts +12 -1
  490. package/dist/src/public/skills/index.d.ts +3 -3
  491. package/dist/src/public/skills/index.js +1 -1
  492. package/dist/src/public/sveltekit/dev-server.js +1 -1
  493. package/dist/src/public/tools/approval/index.d.ts +2 -2
  494. package/dist/src/public/tools/approval/index.js +1 -1
  495. package/dist/src/public/tools/bash.d.ts +3 -0
  496. package/dist/src/public/tools/bash.js +1 -0
  497. package/dist/src/public/tools/glob.d.ts +3 -0
  498. package/dist/src/public/tools/glob.js +1 -0
  499. package/dist/src/public/tools/grep.d.ts +3 -0
  500. package/dist/src/public/tools/grep.js +1 -0
  501. package/dist/src/public/tools/index.d.ts +6 -11
  502. package/dist/src/public/tools/index.js +1 -1
  503. package/dist/src/public/tools/load-skill.d.ts +3 -0
  504. package/dist/src/public/tools/load-skill.js +1 -0
  505. package/dist/src/public/tools/read-file.d.ts +3 -0
  506. package/dist/src/public/tools/read-file.js +1 -0
  507. package/dist/src/public/{tool-result-narrowing.d.ts → tools/result.d.ts} +2 -28
  508. package/dist/src/public/tools/result.js +1 -0
  509. package/dist/src/public/tools/sleep.d.ts +1 -0
  510. package/dist/src/public/tools/sleep.js +1 -0
  511. package/dist/src/public/tools/todo.d.ts +3 -0
  512. package/dist/src/public/tools/todo.js +1 -0
  513. package/dist/src/public/tools/web-fetch.d.ts +3 -0
  514. package/dist/src/public/tools/web-fetch.js +1 -0
  515. package/dist/src/public/tools/web-search.d.ts +3 -36
  516. package/dist/src/public/tools/web-search.js +1 -1
  517. package/dist/src/public/tools/workflow.d.ts +4 -0
  518. package/dist/src/public/tools/workflow.js +1 -0
  519. package/dist/src/public/tools/write-file.d.ts +3 -0
  520. package/dist/src/public/tools/write-file.js +1 -0
  521. package/dist/src/public/types/json.d.ts +1 -28
  522. package/dist/src/react/use-eve-agent.d.ts +1 -0
  523. package/dist/src/react/use-eve-agent.js +1 -1
  524. package/dist/src/runtime/actions/keys.d.ts +1 -1
  525. package/dist/src/runtime/actions/results.d.ts +1 -1
  526. package/dist/src/runtime/agent/bootstrap.js +1 -1
  527. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  528. package/dist/src/runtime/connections/authorization-tokens.d.ts +1 -1
  529. package/dist/src/runtime/connections/mcp-client.d.ts +1 -1
  530. package/dist/src/runtime/connections/mcp-client.js +1 -1
  531. package/dist/src/runtime/connections/openapi-client.d.ts +1 -1
  532. package/dist/src/runtime/connections/openapi-client.js +1 -1
  533. package/dist/src/runtime/connections/principal.d.ts +1 -1
  534. package/dist/src/runtime/connections/principal.js +1 -1
  535. package/dist/src/runtime/connections/registry-types.d.ts +11 -0
  536. package/dist/src/runtime/connections/registry.d.ts +3 -2
  537. package/dist/src/runtime/connections/resolve-authorization.d.ts +2 -2
  538. package/dist/src/runtime/connections/resolve-authorization.js +1 -1
  539. package/dist/src/runtime/connections/scoped-authorization.d.ts +2 -2
  540. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  541. package/dist/src/runtime/loaders/compile-metadata.js +1 -1
  542. package/dist/src/runtime/loaders/manifest.js +1 -1
  543. package/dist/src/runtime/prompt/compose.d.ts +0 -6
  544. package/dist/src/runtime/prompt/compose.js +1 -1
  545. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  546. package/dist/src/runtime/resolve-agent.js +1 -1
  547. package/dist/src/runtime/resolve-connection.js +1 -1
  548. package/dist/src/runtime/resolve-dynamic-tool.js +1 -1
  549. package/dist/src/runtime/resolve-tool.d.ts +2 -1
  550. package/dist/src/runtime/resolve-tool.js +1 -1
  551. package/dist/src/runtime/sandbox/keys.js +1 -1
  552. package/dist/src/runtime/sandbox/registry.d.ts +4 -20
  553. package/dist/src/runtime/sandbox/registry.js +1 -1
  554. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  555. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  556. package/dist/src/runtime/sessions/turn.d.ts +3 -1
  557. package/dist/src/runtime/skills/sandbox-access.d.ts +1 -1
  558. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  559. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  560. package/dist/src/runtime/subagents/registry.d.ts +0 -27
  561. package/dist/src/runtime/subagents/registry.js +1 -1
  562. package/dist/src/runtime/tools/registry.js +1 -1
  563. package/dist/src/runtime/types.d.ts +11 -27
  564. package/dist/src/sandbox/backends/default.d.ts +49 -0
  565. package/dist/src/sandbox/backends/default.js +1 -0
  566. package/dist/src/sandbox/backends/docker.d.ts +14 -0
  567. package/dist/src/sandbox/backends/docker.js +1 -0
  568. package/dist/src/sandbox/backends/just-bash.d.ts +17 -0
  569. package/dist/src/sandbox/backends/just-bash.js +1 -0
  570. package/dist/src/sandbox/backends/microsandbox.d.ts +17 -0
  571. package/dist/src/sandbox/backends/microsandbox.js +1 -0
  572. package/dist/src/sandbox/backends/vercel.d.ts +30 -0
  573. package/dist/src/sandbox/backends/vercel.js +1 -0
  574. package/dist/src/services/dev-client/runtime-artifacts.d.ts +2 -0
  575. package/dist/src/services/dev-client/runtime-artifacts.js +1 -1
  576. package/dist/src/services/dev-client.d.ts +1 -1
  577. package/dist/src/setup/channel-add-conflicts.js +1 -1
  578. package/dist/src/setup/cli/select-component.js +1 -1
  579. package/dist/src/setup/flows/link.js +1 -1
  580. package/dist/src/setup/flows/model-source-change.js +1 -1
  581. package/dist/src/setup/flows/model.js +1 -1
  582. package/dist/src/setup/flows/registry.d.ts +7 -1
  583. package/dist/src/setup/flows/registry.js +1 -1
  584. package/dist/src/setup/integrations/runner.js +1 -1
  585. package/dist/src/setup/prompter.js +1 -1
  586. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  587. package/dist/src/setup/scaffold/create/project.js +40 -3
  588. package/dist/src/setup/scaffold/create/web-template.d.ts +8 -8
  589. package/dist/src/setup/scaffold/create/web-template.js +336 -120
  590. package/dist/src/setup/scaffold/update/channels.js +1 -1
  591. package/dist/src/setup/scaffold/update/connections.js +1 -1
  592. package/dist/src/setup/vercel-project.js +0 -0
  593. package/dist/src/{runtime/actions/types.d.ts → shared/action-types.d.ts} +12 -12
  594. package/dist/src/{runtime/actions/types.js → shared/action-types.js} +1 -1
  595. package/dist/src/shared/agent-definition.d.ts +3 -10
  596. package/dist/src/shared/agent-definition.js +1 -1
  597. package/dist/src/shared/channel-definition.d.ts +5 -1
  598. package/dist/src/{runtime/connections/types.d.ts → shared/connection-types.d.ts} +3 -13
  599. package/dist/src/{runtime/input/types.d.ts → shared/input.d.ts} +1 -1
  600. package/dist/src/shared/input.js +1 -0
  601. package/dist/src/shared/instructions-definition.d.ts +2 -0
  602. package/dist/src/shared/instructions-definition.js +1 -1
  603. package/dist/src/shared/objects.d.ts +5 -0
  604. package/dist/src/shared/objects.js +1 -0
  605. package/dist/src/shared/sandbox-definition.d.ts +1 -1
  606. package/dist/src/shared/skill-definition.d.ts +2 -0
  607. package/dist/src/shared/skill-definition.js +1 -1
  608. package/dist/src/{execution/skills/types.d.ts → shared/skill-types.d.ts} +1 -1
  609. package/dist/src/shared/skill-types.js +1 -0
  610. package/dist/src/{runtime/connections → shared}/validate-authorization.d.ts +1 -1
  611. package/dist/src/shared/vercel-project.d.ts +1 -0
  612. package/dist/src/shared/vercel-project.js +1 -1
  613. package/dist/src/svelte/index.js +1 -1
  614. package/dist/src/svelte/use-eve-agent.d.ts +8 -4
  615. package/dist/src/svelte/use-eve-agent.js +1 -1
  616. package/dist/src/tasks/json.d.ts +4 -89
  617. package/dist/src/tasks/json.js +1 -1
  618. package/dist/src/tasks/session-index.d.ts +1 -1
  619. package/dist/src/tasks/task-id.d.ts +0 -1
  620. package/dist/src/tasks/task-id.js +1 -1
  621. package/dist/src/tasks/types.d.ts +1 -1
  622. package/dist/src/tasks/types.js +1 -1
  623. package/dist/src/{public/tools/approval/approval-helpers.d.ts → tools/approval/policies.d.ts} +1 -1
  624. package/dist/src/tools/approval/policies.js +1 -0
  625. package/dist/src/tools/auth.d.ts +35 -0
  626. package/dist/src/tools/auth.js +1 -0
  627. package/dist/src/{public/definitions/tool.d.ts → tools/definition.d.ts} +42 -138
  628. package/dist/src/tools/definition.js +1 -0
  629. package/dist/src/{shared/durable-dynamic-tool-callbacks.d.ts → tools/durable-callbacks.d.ts} +1 -1
  630. package/dist/src/tools/durable-callbacks.js +1 -0
  631. package/dist/src/tools/dynamic.d.ts +68 -0
  632. package/dist/src/tools/dynamic.js +1 -0
  633. package/dist/src/tools/framework/agent-contract.d.ts +8 -0
  634. package/dist/src/tools/framework/agent-contract.js +1 -0
  635. package/dist/src/tools/framework/agent.d.ts +17 -0
  636. package/dist/src/tools/framework/agent.js +1 -0
  637. package/dist/src/tools/framework/ask-question.d.ts +50 -0
  638. package/dist/src/tools/framework/ask-question.js +1 -0
  639. package/dist/src/tools/framework/connection-search.d.ts +3 -0
  640. package/dist/src/tools/framework/connection-search.js +1 -0
  641. package/dist/src/tools/framework/task-cancel.d.ts +29 -0
  642. package/dist/src/tools/framework/task-cancel.js +1 -0
  643. package/dist/src/tools/framework/task-contract.d.ts +167 -0
  644. package/dist/src/tools/framework/task-contract.js +1 -0
  645. package/dist/src/tools/framework/task-update.d.ts +9 -0
  646. package/dist/src/tools/framework/task-update.js +1 -0
  647. package/dist/src/{public/tools/output-builders.d.ts → tools/model-output.d.ts} +41 -1
  648. package/dist/src/tools/provided/bash.d.ts +29 -0
  649. package/dist/src/tools/provided/bash.js +1 -0
  650. package/dist/src/tools/provided/glob.d.ts +26 -0
  651. package/dist/src/tools/provided/glob.js +2 -0
  652. package/dist/src/{runtime/framework-tools → tools/provided}/grep.d.ts +10 -10
  653. package/dist/src/tools/provided/grep.js +2 -0
  654. package/dist/src/tools/provided/load-skill.d.ts +2 -0
  655. package/dist/src/tools/provided/load-skill.js +1 -0
  656. package/dist/src/tools/provided/read-file.d.ts +27 -0
  657. package/dist/src/tools/provided/read-file.js +2 -0
  658. package/dist/src/{public/tools/sleep/index.d.ts → tools/provided/sleep.d.ts} +3 -3
  659. package/dist/src/tools/provided/sleep.js +1 -0
  660. package/dist/src/tools/provided/todo.d.ts +8 -0
  661. package/dist/src/tools/provided/todo.js +2 -0
  662. package/dist/src/{runtime/framework-tools → tools/provided}/web-fetch.d.ts +5 -2
  663. package/dist/src/tools/provided/web-fetch.js +2 -0
  664. package/dist/src/tools/provided/web-search.d.ts +39 -0
  665. package/dist/src/tools/provided/web-search.js +1 -0
  666. package/dist/src/tools/provided/write-file.d.ts +23 -0
  667. package/dist/src/tools/provided/write-file.js +2 -0
  668. package/dist/src/tools/workflow.d.ts +37 -0
  669. package/dist/src/tools/workflow.js +1 -0
  670. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  671. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  672. package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
  673. package/dist/src/tracing/agent-otel-provider.js +2 -2
  674. package/dist/src/tracing/agent-otel-session-context.d.ts +1 -1
  675. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  676. package/dist/src/tracing/agent-span-id-generator.d.ts +1 -0
  677. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  678. package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
  679. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  680. package/dist/src/tracing/agent-trace-span-processor.js +1 -1
  681. package/dist/src/tracing/agent-trace-state.d.ts +2 -6
  682. package/dist/src/tracing/agent-trace-state.js +1 -1
  683. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  684. package/dist/src/tracing/local-trace-reader.d.ts +1 -3
  685. package/dist/src/tracing/local-trace-reader.js +1 -1
  686. package/dist/src/tracing/otel-declaration.d.ts +1 -2
  687. package/dist/src/tracing/otel-registration.js +1 -1
  688. package/dist/src/tracing/sampled-trace.d.ts +10 -2
  689. package/dist/src/tracing/sampled-trace.js +1 -1
  690. package/dist/src/vue/index.js +1 -1
  691. package/dist/src/vue/use-eve-agent.d.ts +8 -4
  692. package/dist/src/vue/use-eve-agent.js +1 -1
  693. package/docs/agent-config.md +16 -4
  694. package/docs/channels/chat-sdk.mdx +1 -1
  695. package/docs/channels/discord.mdx +5 -1
  696. package/docs/channels/eve.mdx +19 -3
  697. package/docs/channels/github.mdx +2 -0
  698. package/docs/channels/linear.mdx +1 -1
  699. package/docs/channels/linq.mdx +1 -1
  700. package/docs/channels/overview.mdx +1 -1
  701. package/docs/channels/photon.mdx +4 -4
  702. package/docs/channels/slack.mdx +20 -3
  703. package/docs/channels/teams.mdx +1 -1
  704. package/docs/channels/telegram.mdx +2 -0
  705. package/docs/concepts/built-in-tools.md +31 -21
  706. package/docs/concepts/sessions-runs-and-streaming.md +3 -1
  707. package/docs/connections/overview.mdx +1 -1
  708. package/docs/extensions.md +2 -2
  709. package/docs/getting-started.mdx +10 -9
  710. package/docs/guides/auth-and-route-protection.md +3 -3
  711. package/docs/guides/client/output-schema.mdx +2 -2
  712. package/docs/guides/client/overview.mdx +4 -2
  713. package/docs/guides/dev-tui.md +26 -15
  714. package/docs/guides/frontend/nuxt.mdx +4 -3
  715. package/docs/guides/frontend/overview.mdx +21 -18
  716. package/docs/guides/frontend/sveltekit.mdx +4 -3
  717. package/docs/guides/frontend/use-eve-agent-svelte.mdx +5 -4
  718. package/docs/guides/frontend/use-eve-agent-vue.mdx +5 -4
  719. package/docs/guides/instrumentation.md +1 -0
  720. package/docs/guides/remote-agents.md +37 -18
  721. package/docs/meta.json +1 -1
  722. package/docs/patterns/multi-tenant-approvals.md +1 -1
  723. package/docs/reference/cli.md +2 -4
  724. package/docs/reference/typescript-api.md +35 -31
  725. package/docs/sandbox.mdx +21 -1
  726. package/docs/subagents/index.mdx +11 -28
  727. package/docs/tools/human-in-the-loop.md +43 -2
  728. package/docs/tools/overview.mdx +1 -1
  729. package/package.json +59 -9
  730. package/dist/src/compiler/normalize-extension.d.ts +0 -80
  731. package/dist/src/compiler/normalize-extension.js +0 -1
  732. package/dist/src/execution/sandbox/write-file-tool.js +0 -1
  733. package/dist/src/execution/web-fetch/tool.js +0 -1
  734. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.d.ts +0 -9
  735. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +0 -1
  736. package/dist/src/internal/nitro/routes/health.d.ts +0 -14
  737. package/dist/src/internal/nitro/routes/health.js +0 -1
  738. package/dist/src/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js +0 -1
  739. package/dist/src/public/definitions/tool.js +0 -1
  740. package/dist/src/public/tool-result-narrowing.js +0 -1
  741. package/dist/src/public/tools/approval/approval-helpers.js +0 -1
  742. package/dist/src/public/tools/defaults.d.ts +0 -46
  743. package/dist/src/public/tools/defaults.js +0 -1
  744. package/dist/src/public/tools/define-bash-tool.d.ts +0 -21
  745. package/dist/src/public/tools/define-bash-tool.js +0 -1
  746. package/dist/src/public/tools/define-glob-tool.d.ts +0 -22
  747. package/dist/src/public/tools/define-glob-tool.js +0 -1
  748. package/dist/src/public/tools/define-grep-tool.d.ts +0 -22
  749. package/dist/src/public/tools/define-grep-tool.js +0 -1
  750. package/dist/src/public/tools/define-read-file-tool.d.ts +0 -21
  751. package/dist/src/public/tools/define-read-file-tool.js +0 -1
  752. package/dist/src/public/tools/define-write-file-tool.d.ts +0 -22
  753. package/dist/src/public/tools/define-write-file-tool.js +0 -1
  754. package/dist/src/public/tools/internal.d.ts +0 -13
  755. package/dist/src/public/tools/internal.js +0 -1
  756. package/dist/src/public/tools/sleep/index.js +0 -1
  757. package/dist/src/runtime/connections/callback-route.js +0 -1
  758. package/dist/src/runtime/framework-channels/index.d.ts +0 -6
  759. package/dist/src/runtime/framework-channels/index.js +0 -1
  760. package/dist/src/runtime/framework-tools/agent.d.ts +0 -29
  761. package/dist/src/runtime/framework-tools/agent.js +0 -1
  762. package/dist/src/runtime/framework-tools/ask-question.d.ts +0 -35
  763. package/dist/src/runtime/framework-tools/ask-question.js +0 -1
  764. package/dist/src/runtime/framework-tools/bash.d.ts +0 -24
  765. package/dist/src/runtime/framework-tools/bash.js +0 -1
  766. package/dist/src/runtime/framework-tools/connection-search-dynamic.d.ts +0 -19
  767. package/dist/src/runtime/framework-tools/connection-search-dynamic.js +0 -2
  768. package/dist/src/runtime/framework-tools/final-output.js +0 -1
  769. package/dist/src/runtime/framework-tools/glob.d.ts +0 -26
  770. package/dist/src/runtime/framework-tools/glob.js +0 -2
  771. package/dist/src/runtime/framework-tools/grep.js +0 -2
  772. package/dist/src/runtime/framework-tools/index.d.ts +0 -39
  773. package/dist/src/runtime/framework-tools/index.js +0 -1
  774. package/dist/src/runtime/framework-tools/read-file.d.ts +0 -27
  775. package/dist/src/runtime/framework-tools/read-file.js +0 -2
  776. package/dist/src/runtime/framework-tools/skill.d.ts +0 -12
  777. package/dist/src/runtime/framework-tools/skill.js +0 -1
  778. package/dist/src/runtime/framework-tools/subagent/local.js +0 -1
  779. package/dist/src/runtime/framework-tools/subagent/remote.js +0 -1
  780. package/dist/src/runtime/framework-tools/tasks.d.ts +0 -91
  781. package/dist/src/runtime/framework-tools/tasks.js +0 -1
  782. package/dist/src/runtime/framework-tools/web-fetch.js +0 -2
  783. package/dist/src/runtime/framework-tools/web-search.js +0 -1
  784. package/dist/src/runtime/framework-tools/write-file.d.ts +0 -23
  785. package/dist/src/runtime/framework-tools/write-file.js +0 -2
  786. package/dist/src/runtime/governance/auth/jwt-ecdsa.js +0 -1
  787. package/dist/src/runtime/governance/auth/jwt-hmac.js +0 -1
  788. package/dist/src/runtime/governance/auth/oidc.js +0 -1
  789. package/dist/src/runtime/input/types.js +0 -1
  790. package/dist/src/runtime/session-callback-route.d.ts +0 -6
  791. package/dist/src/runtime/session-callback-route.js +0 -1
  792. package/dist/src/runtime/task-input-response-route.d.ts +0 -5
  793. package/dist/src/runtime/task-input-response-route.js +0 -1
  794. package/dist/src/shared/durable-dynamic-tool-callbacks.js +0 -1
  795. package/dist/src/shared/dynamic-tool-definition.d.ts +0 -154
  796. package/dist/src/shared/dynamic-tool-definition.js +0 -1
  797. package/dist/src/shared/eve-server-health.d.ts +0 -5
  798. package/dist/src/shared/eve-server-health.js +0 -1
  799. package/dist/src/shared/tool-definition.d.ts +0 -89
  800. /package/dist/src/{runtime/governance → channel}/auth/http-basic.js +0 -0
  801. /package/dist/src/{runtime/governance → channel}/auth/token-claims.js +0 -0
  802. /package/dist/src/{runtime/governance → channel}/auth/types.js +0 -0
  803. /package/dist/src/{runtime/governance → channel}/auth/vercel-oidc-project.js +0 -0
  804. /package/dist/src/{runtime/governance/network → channel}/ip-allow-list.d.ts +0 -0
  805. /package/dist/src/{runtime/governance/network → channel}/ip-allow-list.js +0 -0
  806. /package/dist/src/{execution/skills/types.js → context/session-context.js} +0 -0
  807. /package/dist/src/execution/sandbox/{bash-tool.js → bash.js} +0 -0
  808. /package/dist/src/{runtime/framework-tools → execution/tools}/file-state.js +0 -0
  809. /package/dist/src/{runtime/framework-tools → execution/tools}/sleep.d.ts +0 -0
  810. /package/dist/src/{runtime/framework-tools → execution/tools}/sleep.js +0 -0
  811. /package/dist/src/execution/web-fetch/{tool.d.ts → execute.d.ts} +0 -0
  812. /package/dist/src/{shared/tool-definition.js → runtime/connections/registry-types.js} +0 -0
  813. /package/dist/src/{runtime/connections/types.js → shared/connection-types.js} +0 -0
  814. /package/dist/src/{runtime/sessions/auth.d.ts → shared/session-auth.d.ts} +0 -0
  815. /package/dist/src/{runtime/sessions/auth.js → shared/session-auth.js} +0 -0
  816. /package/dist/src/{runtime/connections → shared}/validate-authorization.js +0 -0
  817. /package/dist/src/{public/tools/output-builders.js → tools/model-output.js} +0 -0
  818. /package/dist/src/{shared/tool-schema.d.ts → tools/schema.d.ts} +0 -0
  819. /package/dist/src/{shared/tool-schema.js → tools/schema.js} +0 -0
  820. /package/dist/src/{shared/tool-task.d.ts → tools/task.d.ts} +0 -0
  821. /package/dist/src/{shared/tool-task.js → tools/task.js} +0 -0
@@ -1 +1 @@
1
- import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,symlink,writeFile}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{existsSync,readFileSync}from"node:fs";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";import{copyDevelopmentSourceSnapshot}from"#internal/nitro/dev-runtime-source-snapshot-copy.js";import{resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createDevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts-retention.js";const DEV_RUNTIME_ARTIFACTS_DIRECTORY=`dev-runtime`;function resolveDevelopmentRuntimeArtifactsPointerPath(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`current.json`)}function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`snapshots`)}function isDevelopmentRuntimeArtifactsSnapshotRoot(e,t){return dirname(resolve(t))===resolve(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e))}async function stageDevelopmentRuntimeArtifactsSnapshot(n){let r=join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(n.project.appRoot),`${Date.now().toString(36)}-${randomUUID()}`),a=await createDevelopmentSourceSnapshotPlan({appRoot:n.project.appRoot,authoredSourceRoots:collectExtensionMountSourceRoots(n.manifest),snapshotRoot:r});try{await copyDevelopmentSourceSnapshot(a),await mountExtensionExternalDependencies({manifest:n.manifest,runtimeAppRoot:a.runtimeAppRoot}),await cp(n.paths.compileDirectoryPath,join(a.runtimeAppRoot,`.eve`,`compile`),{recursive:!0}),await rewriteSnapshotCompiledManifest({appRoot:n.project.appRoot,manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}),await validateSnapshotCompiledManifestRoots({manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot}),await writeFile(join(r,`generation.json`),`${JSON.stringify({runtimeAppRoot:a.runtimeAppRoot})}\n`)}catch(e){throw await rm(r,{force:!0,recursive:!0}).catch(()=>{}),e}return{runtimeAppRoot:a.runtimeAppRoot,snapshotRoot:r,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}}async function mountExtensionExternalDependencies(e){if(e.manifest===void 0)return;let t=[e.manifest,...(e.manifest.subagents??[]).map(e=>e.agent)].flatMap(e=>e.extensionMounts??[]).filter(e=>(e.externalDependencies??[]).length>0);for(let[r,o]of Object.entries(resolveExtensionExternalDependencyPaths(t))){let t=findPackageRoot(o,r),c=join(e.runtimeAppRoot,`node_modules`,...r.split(`/`));await mkdir(dirname(c),{recursive:!0}),await rm(c,{force:!0,recursive:!0}),await symlink(t,c,`junction`)}}function findPackageRoot(e,t){let n=dirname(e);for(;;){let e=join(n,`package.json`);if(existsSync(e))try{if(JSON.parse(readFileSync(e,`utf8`)).name===t)return n}catch{}let r=dirname(n);if(r===n)throw Error(`Cannot locate package root for extension external dependency "${t}".`);n=r}}async function activateDevelopmentRuntimeArtifactsSnapshot(e){(await activateDevelopmentRuntimeArtifactsSnapshotTransaction(e)).commit()}async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(e){let t=await readMaterializedAuthoredModuleIndex(e.snapshot.runtimeAppRoot);if(t===void 0||!existsSync(join(e.snapshot.runtimeAppRoot,`.eve`,`compile`,t.moduleMap)))throw Error(`Cannot activate development runtime generation "${e.snapshot.snapshotRoot}" before its authored modules are materialized.`);let n=join(e.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER),r=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),i=readDevelopmentRuntimeArtifactsPointer(r),a=await readOptionalFile(r);try{await writeFile(n,``),await writeDevelopmentRuntimeArtifactsPointer(e),i?.version===2&&i.snapshotRoot!==e.snapshot.snapshotRoot&&isDevelopmentRuntimeArtifactsSnapshotRoot(e.appRoot,i.snapshotRoot)&&await recordRetiredDevelopmentRuntimeArtifactsSnapshot(i.snapshotRoot).catch(e=>{console.warn(`[eve:dev] failed to record retired runtime generation "${i.snapshotRoot}": ${String(e)}`)})}catch(e){throw await rollbackFailedActivation({cause:e,markerPath:n,pointerPath:r,previousPointerSource:a})}let s=!1;return{commit(){s=!0},async rollback(){if(s)return;s=!0;let e=await restoreDevelopmentRuntimeArtifactsActivation({markerPath:n,pointerPath:r,previousPointerSource:a});if(e!==void 0)throw e}}}function readDevelopmentRuntimeArtifactsSnapshotRoot(e){let t=readDevelopmentRuntimeArtifactsPointer(e);if(t!==void 0)return t.version===1?t.appRoot:t.runtimeAppRoot}function readActiveDevelopmentRuntimeArtifactsSnapshot(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e));if(!(t===void 0||t.version===1))return{runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot}}function readDevelopmentRuntimeArtifactsRevision(e){return{revision:readDevelopmentRuntimeArtifactsSnapshotRoot(resolveDevelopmentRuntimeArtifactsPointerPath(e))??e}}async function pruneDevelopmentRuntimeArtifactsSnapshots(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot));await pruneDevelopmentRuntimeArtifactsSnapshotDirectory({activeSnapshotRoot:t?.version===2?t.snapshotRoot:void 0,gracePeriodMs:e.gracePeriodMs,now:e.now,protectAll:t?.version===1,retainCount:e.retainCount,snapshotsDirectory:resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.appRoot)})}function collectExtensionMountSourceRoots(e){return e===void 0?[]:[e,...(e.subagents??[]).map(e=>e.agent)].flatMap(e=>(e.extensionMounts??[]).map(e=>e.sourceRoot))}function readDevelopmentRuntimeArtifactsPointer(e){if(!(e===void 0||!existsSync(e)))try{let t=JSON.parse(readFileSync(e,`utf8`));return t.kind!==`eve-dev-runtime-artifacts-pointer`||typeof t.version!=`number`?void 0:t.version===1&&typeof t.appRoot==`string`&&t.appRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,version:1}:t.version===2&&typeof t.appRoot==`string`&&typeof t.runtimeAppRoot==`string`&&t.runtimeAppRoot.length>0&&typeof t.snapshotRoot==`string`&&t.snapshotRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot,version:2}:void 0}catch{return}}async function rewriteSnapshotCompiledManifest(e){let t=JSON.parse(await readFile(e.manifestPath,`utf8`)),n=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t});await writeFile(e.manifestPath,`${JSON.stringify(n,null,2)}\n`)}function rewriteManifestRoots(e){if(Array.isArray(e.value))return e.value.map(t=>rewriteManifestRoots({...e,value:t}));if(e.value===null||typeof e.value!=`object`)return e.value;let t={};for(let[n,r]of Object.entries(e.value)){if(typeof r==`string`&&(n===`appRoot`||n===`agentRoot`)){t[n]=rewritePathWithinAppRoot({appRoot:e.appRoot,path:r,runtimeAppRoot:e.runtimeAppRoot});continue}if(typeof r==`string`&&n===`sourceRoot`){t[n]=rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}t[n]=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:r})}return t}function rewritePathWithinSourceRoot(e){return isPathInsideOrEqual(e.path,e.sourceRoot)?toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:e.path,sourceRoot:e.sourceRoot}):e.path}function rewritePathWithinAppRoot(e){if(!isPathInsideOrEqual(e.path,e.appRoot))return e.path;let t=relative(e.appRoot,e.path);return t.length===0?e.runtimeAppRoot:join(e.runtimeAppRoot,t)}async function writeDevelopmentRuntimeArtifactsPointer(e){let t=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),n={appRoot:e.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:e.snapshot.runtimeAppRoot,snapshotRoot:e.snapshot.snapshotRoot,version:2};await writeDevelopmentRuntimeArtifactsPointerSource(t,`${JSON.stringify(n,null,2)}\n`)}async function writeDevelopmentRuntimeArtifactsPointerSource(t,r){let a=`${t}.${randomUUID()}.tmp`;await mkdir(dirname(t),{recursive:!0}),await writeFile(a,r);try{await renameWithTransientBusyRetry(a,t)}catch(e){throw await rm(a,{force:!0}).catch(()=>{}),e}}async function readOptionalFile(e){try{return await readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}async function rollbackFailedActivation(e){let t=await restoreDevelopmentRuntimeArtifactsActivation(e);return t===void 0?e.cause:AggregateError([e.cause,t],`Development runtime activation and rollback failed.`,{cause:e.cause})}async function restoreDevelopmentRuntimeArtifactsActivation(e){let t=(await Promise.allSettled([e.previousPointerSource===void 0?rm(e.pointerPath,{force:!0}):writeDevelopmentRuntimeArtifactsPointerSource(e.pointerPath,e.previousPointerSource),rm(e.markerPath,{force:!0})])).flatMap(e=>e.status===`rejected`?[e.reason]:[]);if(t.length!==0)return AggregateError(t,`Failed to restore development runtime activation.`)}async function validateSnapshotCompiledManifestRoots(e){let t=collectManifestRootPaths(JSON.parse(await readFile(e.manifestPath,`utf8`)));for(let n of t)if(!isPathInsideOrEqual(n,e.runtimeAppRoot))throw Error(`Development runtime snapshot manifest root "${n}" is outside runtime app root "${e.runtimeAppRoot}".`)}function collectManifestRootPaths(e){if(Array.isArray(e))return e.flatMap(e=>collectManifestRootPaths(e));if(typeof e!=`object`||!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if((n===`appRoot`||n===`agentRoot`)&&typeof r==`string`){t.push(r);continue}t.push(...collectManifestRootPaths(r))}return t}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{activateDevelopmentRuntimeArtifactsSnapshot,activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,readActiveDevelopmentRuntimeArtifactsSnapshot,readDevelopmentRuntimeArtifactsRevision,readDevelopmentRuntimeArtifactsSnapshotRoot,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot};
1
+ import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,symlink,writeFile}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{resolvePackageRoot}from"#internal/application/package.js";import{existsSync,readFileSync}from"node:fs";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";import{copyDevelopmentSourceSnapshot}from"#internal/nitro/dev-runtime-source-snapshot-copy.js";import{resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createDevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts-retention.js";const DEV_RUNTIME_ARTIFACTS_DIRECTORY=`dev-runtime`;function resolveDevelopmentRuntimeArtifactsPointerPath(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`current.json`)}function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`snapshots`)}function isDevelopmentRuntimeArtifactsSnapshotRoot(e,t){return dirname(resolve(t))===resolve(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e))}async function stageDevelopmentRuntimeArtifactsSnapshot(n){let r=join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(n.project.appRoot),`${Date.now().toString(36)}-${randomUUID()}`),a=await createDevelopmentSourceSnapshotPlan({appRoot:n.project.appRoot,authoredSourceRoots:collectExtensionMountSourceRoots(n.manifest),snapshotRoot:r});try{await copyDevelopmentSourceSnapshot(a),await mountFrameworkPackage(a.runtimeAppRoot),await mountExtensionExternalDependencies({manifest:n.manifest,runtimeAppRoot:a.runtimeAppRoot}),await cp(n.paths.compileDirectoryPath,join(a.runtimeAppRoot,`.eve`,`compile`),{recursive:!0}),await rewriteSnapshotCompiledManifest({appRoot:n.project.appRoot,manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}),await validateSnapshotCompiledManifestRoots({manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot}),await writeFile(join(r,`generation.json`),`${JSON.stringify({runtimeAppRoot:a.runtimeAppRoot})}\n`)}catch(e){throw await rm(r,{force:!0,recursive:!0}).catch(()=>{}),e}return{runtimeAppRoot:a.runtimeAppRoot,snapshotRoot:r,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}}async function mountFrameworkPackage(e){let t=join(e,`node_modules`,`eve`);await mkdir(dirname(t),{recursive:!0}),await rm(t,{force:!0,recursive:!0}),await symlink(resolvePackageRoot(),t,`junction`)}async function mountExtensionExternalDependencies(e){if(e.manifest===void 0)return;let t=[e.manifest,...(e.manifest.subagents??[]).map(e=>e.agent)].flatMap(e=>e.extensionMounts??[]).filter(e=>(e.externalDependencies??[]).length>0);for(let[r,o]of Object.entries(resolveExtensionExternalDependencyPaths(t))){let t=findPackageRoot(o,r),c=join(e.runtimeAppRoot,`node_modules`,...r.split(`/`));await mkdir(dirname(c),{recursive:!0}),await rm(c,{force:!0,recursive:!0}),await symlink(t,c,`junction`)}}function findPackageRoot(e,t){let n=dirname(e);for(;;){let e=join(n,`package.json`);if(existsSync(e))try{if(JSON.parse(readFileSync(e,`utf8`)).name===t)return n}catch{}let r=dirname(n);if(r===n)throw Error(`Cannot locate package root for extension external dependency "${t}".`);n=r}}async function activateDevelopmentRuntimeArtifactsSnapshot(e){(await activateDevelopmentRuntimeArtifactsSnapshotTransaction(e)).commit()}async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(e){let t=await readMaterializedAuthoredModuleIndex(e.snapshot.runtimeAppRoot);if(t===void 0||!existsSync(join(e.snapshot.runtimeAppRoot,`.eve`,`compile`,t.moduleMap)))throw Error(`Cannot activate development runtime generation "${e.snapshot.snapshotRoot}" before its authored modules are materialized.`);let n=join(e.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER),r=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),i=readDevelopmentRuntimeArtifactsPointer(r),a=await readOptionalFile(r);try{await writeFile(n,``),await writeDevelopmentRuntimeArtifactsPointer(e),i?.version===2&&i.snapshotRoot!==e.snapshot.snapshotRoot&&isDevelopmentRuntimeArtifactsSnapshotRoot(e.appRoot,i.snapshotRoot)&&await recordRetiredDevelopmentRuntimeArtifactsSnapshot(i.snapshotRoot).catch(e=>{console.warn(`[eve:dev] failed to record retired runtime generation "${i.snapshotRoot}": ${String(e)}`)})}catch(e){throw await rollbackFailedActivation({cause:e,markerPath:n,pointerPath:r,previousPointerSource:a})}let s=!1;return{commit(){s=!0},async rollback(){if(s)return;s=!0;let e=await restoreDevelopmentRuntimeArtifactsActivation({markerPath:n,pointerPath:r,previousPointerSource:a});if(e!==void 0)throw e}}}function readDevelopmentRuntimeArtifactsSnapshotRoot(e){let t=readDevelopmentRuntimeArtifactsPointer(e);if(t!==void 0)return t.version===1?t.appRoot:t.runtimeAppRoot}function readActiveDevelopmentRuntimeArtifactsSnapshot(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e));if(!(t===void 0||t.version===1))return{runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot}}function readDevelopmentRuntimeArtifactsRevision(e){return{revision:readDevelopmentRuntimeArtifactsSnapshotRoot(resolveDevelopmentRuntimeArtifactsPointerPath(e))??e}}async function pruneDevelopmentRuntimeArtifactsSnapshots(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot));await pruneDevelopmentRuntimeArtifactsSnapshotDirectory({activeSnapshotRoot:t?.version===2?t.snapshotRoot:void 0,gracePeriodMs:e.gracePeriodMs,now:e.now,protectAll:t?.version===1,retainCount:e.retainCount,snapshotsDirectory:resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.appRoot)})}function collectExtensionMountSourceRoots(e){return e===void 0?[]:[e,...(e.subagents??[]).map(e=>e.agent)].flatMap(e=>(e.extensionMounts??[]).map(e=>e.sourceRoot))}function readDevelopmentRuntimeArtifactsPointer(e){if(!(e===void 0||!existsSync(e)))try{let t=JSON.parse(readFileSync(e,`utf8`));return t.kind!==`eve-dev-runtime-artifacts-pointer`||typeof t.version!=`number`?void 0:t.version===1&&typeof t.appRoot==`string`&&t.appRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,version:1}:t.version===2&&typeof t.appRoot==`string`&&typeof t.runtimeAppRoot==`string`&&t.runtimeAppRoot.length>0&&typeof t.snapshotRoot==`string`&&t.snapshotRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot,version:2}:void 0}catch{return}}async function rewriteSnapshotCompiledManifest(e){let t=JSON.parse(await readFile(e.manifestPath,`utf8`)),n=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t});await writeFile(e.manifestPath,`${JSON.stringify(n,null,2)}\n`)}function rewriteManifestRoots(e){if(Array.isArray(e.value))return e.value.map(t=>rewriteManifestRoots({...e,value:t}));if(e.value===null||typeof e.value!=`object`)return e.value;let t={};for(let[n,r]of Object.entries(e.value)){if(typeof r==`string`&&(n===`appRoot`||n===`agentRoot`)){t[n]=rewritePathWithinAppRoot({appRoot:e.appRoot,path:r,runtimeAppRoot:e.runtimeAppRoot});continue}if(typeof r==`string`&&n===`sourceRoot`){t[n]=rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}t[n]=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:r})}return t}function rewritePathWithinSourceRoot(e){return isPathInsideOrEqual(e.path,e.sourceRoot)?toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:e.path,sourceRoot:e.sourceRoot}):e.path}function rewritePathWithinAppRoot(e){if(!isPathInsideOrEqual(e.path,e.appRoot))return e.path;let t=relative(e.appRoot,e.path);return t.length===0?e.runtimeAppRoot:join(e.runtimeAppRoot,t)}async function writeDevelopmentRuntimeArtifactsPointer(e){let t=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),n={appRoot:e.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:e.snapshot.runtimeAppRoot,snapshotRoot:e.snapshot.snapshotRoot,version:2};await writeDevelopmentRuntimeArtifactsPointerSource(t,`${JSON.stringify(n,null,2)}\n`)}async function writeDevelopmentRuntimeArtifactsPointerSource(t,r){let a=`${t}.${randomUUID()}.tmp`;await mkdir(dirname(t),{recursive:!0}),await writeFile(a,r);try{await renameWithTransientBusyRetry(a,t)}catch(e){throw await rm(a,{force:!0}).catch(()=>{}),e}}async function readOptionalFile(e){try{return await readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}async function rollbackFailedActivation(e){let t=await restoreDevelopmentRuntimeArtifactsActivation(e);return t===void 0?e.cause:AggregateError([e.cause,t],`Development runtime activation and rollback failed.`,{cause:e.cause})}async function restoreDevelopmentRuntimeArtifactsActivation(e){let t=(await Promise.allSettled([e.previousPointerSource===void 0?rm(e.pointerPath,{force:!0}):writeDevelopmentRuntimeArtifactsPointerSource(e.pointerPath,e.previousPointerSource),rm(e.markerPath,{force:!0})])).flatMap(e=>e.status===`rejected`?[e.reason]:[]);if(t.length!==0)return AggregateError(t,`Failed to restore development runtime activation.`)}async function validateSnapshotCompiledManifestRoots(e){let t=collectManifestRootPaths(JSON.parse(await readFile(e.manifestPath,`utf8`)));for(let n of t)if(!isPathInsideOrEqual(n,e.runtimeAppRoot))throw Error(`Development runtime snapshot manifest root "${n}" is outside runtime app root "${e.runtimeAppRoot}".`)}function collectManifestRootPaths(e){if(Array.isArray(e))return e.flatMap(e=>collectManifestRootPaths(e));if(typeof e!=`object`||!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if((n===`appRoot`||n===`agentRoot`)&&typeof r==`string`){t.push(r);continue}t.push(...collectManifestRootPaths(r))}return t}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{activateDevelopmentRuntimeArtifactsSnapshot,activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,readActiveDevelopmentRuntimeArtifactsSnapshot,readDevelopmentRuntimeArtifactsRevision,readDevelopmentRuntimeArtifactsSnapshotRoot,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot};
@@ -1,7 +1,6 @@
1
1
  import type { NormalizedChannelCorsOptions } from "#channel/cors.js";
2
2
  import type { CompiledAgentManifest } from "#compiler/manifest.js";
3
3
  import type { ChannelRouteMethod } from "#public/definitions/channel.js";
4
- export type ApplicationRouteMethod = ChannelRouteMethod | "ALL" | "HEAD" | "OPTIONS";
5
4
  export interface ApplicationChannelRouteRegistration {
6
5
  readonly method: ChannelRouteMethod;
7
6
  readonly route: string;
@@ -27,60 +26,22 @@ export type ApplicationRouteRegistration = ApplicationChannelPreflightRoute | Ap
27
26
  readonly kind: "development-schedule";
28
27
  readonly method: "POST";
29
28
  readonly path: string;
30
- } | {
31
- readonly kind: "health";
32
- readonly method: "GET" | "HEAD";
33
- readonly path: string;
34
- } | {
35
- readonly kind: "home";
36
- readonly method: "GET";
37
- readonly path: string;
38
29
  } | {
39
30
  readonly kind: "workflow";
40
31
  readonly method: "ALL";
41
32
  readonly path: string;
42
33
  };
43
34
  export interface ApplicationRouteRegistry {
44
- /** Active channel bindings after framework override and route deduplication. */
45
35
  readonly channelRegistrations: readonly ApplicationChannelRouteRegistration[];
46
- /** Channel and preflight routes accepted by the application-wide registry. */
47
36
  readonly channelRoutes: readonly (ApplicationChannelPreflightRoute | ApplicationChannelRoute)[];
48
- /** Globally deduplicated method/path bindings in Nitro registration order. */
49
37
  readonly routes: readonly ApplicationRouteRegistration[];
50
38
  }
51
39
  interface ApplicationRouteRegistryHost {
52
40
  readonly compileResult: {
53
- readonly manifest: Pick<CompiledAgentManifest, "channels">;
41
+ readonly manifest: Pick<CompiledAgentManifest, "channelRoutes">;
54
42
  };
55
43
  }
56
- type ApplicationChannelManifestEntry = {
57
- readonly kind: "channel";
58
- readonly name: string;
59
- readonly method: ChannelRouteMethod;
60
- readonly urlPath: string;
61
- readonly cors?: NormalizedChannelCorsOptions;
62
- } | {
63
- readonly kind: "disabled";
64
- readonly name: string;
65
- };
66
- interface ApplicationFrameworkChannelDefinition {
67
- readonly name: string;
68
- readonly method: ChannelRouteMethod;
69
- readonly urlPath: string;
70
- readonly cors?: NormalizedChannelCorsOptions;
71
- }
72
- interface MergeApplicationChannelRoutesInput {
73
- readonly frameworkChannelNames: ReadonlySet<string>;
74
- readonly frameworkChannels: readonly ApplicationFrameworkChannelDefinition[];
75
- readonly manifestChannels: readonly ApplicationChannelManifestEntry[];
76
- }
77
- interface CreateApplicationRouteRegistryInput extends MergeApplicationChannelRoutesInput {
78
- readonly development?: boolean;
79
- }
80
- /** Applies authored-name overrides before deduplicating framework-first route bindings. */
81
- export declare function mergeApplicationChannelRouteRegistrations(input: MergeApplicationChannelRoutesInput): readonly ApplicationChannelRouteRegistration[];
82
- /** Compiles route identity, precedence, and deduplication without importing Nitro. */
83
- export declare function createApplicationRouteRegistryFromInput(input: CreateApplicationRouteRegistryInput): ApplicationRouteRegistry;
44
+ /** Projects the compiler-owned route plan into Nitro registration records. */
84
45
  export declare function createApplicationRouteRegistry(preparedHost: ApplicationRouteRegistryHost, options?: {
85
46
  readonly development?: boolean;
86
47
  }): ApplicationRouteRegistry;
@@ -1 +1 @@
1
- import{EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH,EVE_HEALTH_ROUTE_PATH}from"#protocol/routes.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{EVE_WORKFLOW_FLOW_ROUTE_PATH}from"#internal/workflow-bundle/eve-service-route-output.js";const PACKAGE_ROUTES=[{kind:`home`,method:`GET`,path:`/`},{kind:`health`,method:`GET`,path:EVE_HEALTH_ROUTE_PATH},{kind:`health`,method:`HEAD`,path:EVE_HEALTH_ROUTE_PATH}];function createMethodPathKey(e){return`${e.method} ${e.path}`}function mergeApplicationChannelRouteRegistrations(e){let t=new Set,n=[],r=new Set;for(let i of e.manifestChannels){if(i.kind===`disabled`){if(!e.frameworkChannelNames.has(i.name))throw Error(`agent/channels/${i.name}.ts exports disableRoute() but "${i.name}" is not a framework channel. Rename the file to one of: ${[...e.frameworkChannelNames].sort().join(`, `)}.`);r.add(i.name);continue}t.add(i.name),n.push({cors:i.cors,method:i.method,route:i.urlPath})}let i=e.frameworkChannels.filter(e=>!t.has(e.name)&&!r.has(e.name)).map(e=>({cors:e.cors,method:e.method,route:e.urlPath})),a=new Set,o=[];for(let e of[...i,...n]){let t=createMethodPathKey({method:e.method,path:e.route});a.has(t)||(a.add(t),o.push(e))}return o}function createApplicationRouteRegistryFromInput(n){let r=[],i=[],s=[],c=new Set,addRoute=e=>{let t=createMethodPathKey(e);return c.has(t)?!1:(c.add(t),r.push(e),!0)};for(let e of PACKAGE_ROUTES)addRoute(e);let l=new Set;for(let e of mergeApplicationChannelRouteRegistrations(n)){let t={cors:e.cors,kind:`channel`,method:e.method,path:e.route};if(addRoute(t)&&(s.push(e),i.push(t),e.method!==`WEBSOCKET`&&e.cors!==void 0&&!l.has(e.route))){l.add(e.route);let t={cors:e.cors,kind:`channel-preflight`,method:`OPTIONS`,path:e.route};addRoute(t)&&i.push(t)}}return n.development===!0&&(addRoute({kind:`development-artifacts`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}),addRoute({kind:`development-schedule`,method:`POST`,path:EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN})),addRoute({kind:`workflow`,method:`ALL`,path:EVE_WORKFLOW_FLOW_ROUTE_PATH}),{channelRegistrations:s,channelRoutes:i,routes:r}}function createApplicationRouteRegistry(e,t={}){return createApplicationRouteRegistryFromInput({development:t.development,frameworkChannelNames:getAllFrameworkChannelNames(),frameworkChannels:getFrameworkChannelDefinitions(),manifestChannels:e.compileResult.manifest.channels})}function computeApplicationChannelRouteRegistrations(e){return mergeApplicationChannelRouteRegistrations({frameworkChannelNames:getAllFrameworkChannelNames(),frameworkChannels:getFrameworkChannelDefinitions(),manifestChannels:e.compileResult.manifest.channels})}export{computeApplicationChannelRouteRegistrations,createApplicationRouteRegistry,createApplicationRouteRegistryFromInput,mergeApplicationChannelRouteRegistrations};
1
+ import{EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}from"#protocol/routes.js";import{EVE_WORKFLOW_FLOW_ROUTE_PATH}from"#internal/workflow-bundle/eve-service-route-output.js";function createApplicationRouteRegistry(t,n={}){let r=t.compileResult.manifest.channelRoutes,i=r.effective.map(e=>({cors:e.cors,method:e.method,route:e.urlPath})),a=[...r.effective.map(e=>({cors:e.cors,kind:`channel`,method:e.method,path:e.urlPath})),...r.preflight.map(e=>({cors:e.cors,kind:`channel-preflight`,method:`OPTIONS`,path:e.urlPath}))],o=[...a];return n.development===!0&&o.push({kind:`development-artifacts`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH},{kind:`development-schedule`,method:`POST`,path:EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN}),o.push({kind:`workflow`,method:`ALL`,path:EVE_WORKFLOW_FLOW_ROUTE_PATH}),{channelRegistrations:i,channelRoutes:a,routes:o}}function computeApplicationChannelRouteRegistrations(e){return createApplicationRouteRegistry(e).channelRegistrations}export{computeApplicationChannelRouteRegistrations,createApplicationRouteRegistry};
@@ -1,2 +1,2 @@
1
1
  import{mkdir,mkdtemp,rm}from"node:fs/promises";import{join,relative,resolve}from"node:path";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{discoverAgent}from"#discover/discover-agent.js";import{createDiskProjectSource}from"#discover/project-source.js";import{discoverFlatModuleSource,readSortedDirectoryEntries}from"#discover/grammar.js";import{EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,writeExtensionCompatibilityManifest}from"#compiler/extension-compatibility.js";import{ensureExtensionExports,tryReadExtensionBuildConfig}from"#internal/nitro/host/extension-build-config.js";import{deriveExtensionCapabilityRequirements}from"#internal/nitro/host/extension-capability-requirements.js";import{ExtensionOutputRestoreError,emitExtensionDistribution,replaceExtensionBuildOutput}from"#internal/nitro/host/extension-distribution.js";async function buildExtensionPackage(t,n){let r=resolve(t),i=createDiskProjectSource(),{diagnostics:a,manifest:o}=await discoverAgent({agentRoot:n.sourceRoot,appRoot:r,source:i,role:`extension`}),s=a.filter(e=>e.severity===`error`);if(s.length>0)throw Error(`Cannot build extension "${n.packageName}":\n${s.map(e=>` - ${e.message}`).join(`
2
- `)}`);let c=discoverFlatModuleSource({rootEntries:await readSortedDirectoryEntries(i,n.sourceRoot),rootPath:n.sourceRoot,slotName:`extension`}).module;if(c===void 0)throw Error(`Cannot build extension "${n.packageName}": its source root "${n.sourceRoot}" is missing an "extension.<ext>" declaration. Add \`export default defineExtension(...)\` there (with or without config).`);let l=await mkdtemp(join(r,`.eve-extension-build-`)),u=join(l,`output`),d=join(u,relative(n.outDir,n.distRoot)),f=!1;try{return await mkdir(d,{recursive:!0}),await emitExtensionDistribution({appRoot:r,declarationModule:c,declarationsRoot:join(l,`declarations`),manifest:o,runtimeDependencies:n.runtimeDependencies,shortName:n.shortName,sourceRoot:n.sourceRoot,stagedDistRoot:d,stagedOutDir:u,transactionRoot:l}),await writeExtensionCompatibilityManifest(d,{kind:EXTENSION_COMPATIBILITY_MANIFEST_KIND,formatVersion:EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,builtWithEve:resolveInstalledPackageInfo().version,...n.externalDependencies.length===0?{}:{build:{externalDependencies:n.externalDependencies}},requires:await deriveExtensionCapabilityRequirements({declarationModule:c,manifest:o,runtimeDependencies:n.runtimeDependencies,sourceRoot:n.sourceRoot})}),await ensureExtensionExports(r,n.outDir),await replaceExtensionBuildOutput({outDir:n.outDir,stagedOutDir:u,transactionRoot:l}),n.outDir}catch(e){throw f=e instanceof ExtensionOutputRestoreError,e}finally{f||await rm(l,{force:!0,recursive:!0})}}export{buildExtensionPackage,tryReadExtensionBuildConfig};
2
+ `)}`);let c=discoverFlatModuleSource({rootEntries:await readSortedDirectoryEntries(i,n.sourceRoot),rootPath:n.sourceRoot,slotName:`extension`}).module;if(c===void 0)throw Error(`Cannot build extension "${n.packageName}": its source root "${n.sourceRoot}" is missing an "extension.<ext>" declaration. Add \`export default defineExtension(...)\` there (with or without config).`);let l=await mkdtemp(join(r,`.eve-extension-build-`)),u=join(l,`output`),d=join(u,relative(n.outDir,n.distRoot)),f=!1;try{return await mkdir(d,{recursive:!0}),await emitExtensionDistribution({appRoot:r,declarationModule:c,declarationsRoot:join(l,`declarations`),manifest:o,runtimeDependencies:n.runtimeDependencies,shortName:n.shortName,sourceRoot:n.sourceRoot,stagedDistRoot:d,stagedOutDir:u,transactionRoot:l}),await writeExtensionCompatibilityManifest(d,{kind:EXTENSION_COMPATIBILITY_MANIFEST_KIND,formatVersion:EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,builtWithEve:resolveInstalledPackageInfo().version,...n.externalDependencies.length===0?{}:{build:{externalDependencies:n.externalDependencies}},requires:await deriveExtensionCapabilityRequirements({declarationModule:c,manifest:o,packageName:n.packageName,runtimeDependencies:n.runtimeDependencies,shortName:n.shortName,sourceRoot:n.sourceRoot})}),await ensureExtensionExports(r,n.outDir),await replaceExtensionBuildOutput({outDir:n.outDir,stagedOutDir:u,transactionRoot:l}),n.outDir}catch(e){throw f=e instanceof ExtensionOutputRestoreError,e}finally{f||await rm(l,{force:!0,recursive:!0})}}export{buildExtensionPackage,tryReadExtensionBuildConfig};
@@ -1 +1 @@
1
- import{mkdir,writeFile}from"node:fs/promises";import{dirname}from"node:path";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{VERCEL_EVE_AGENT_SUMMARY_KIND,VERCEL_EVE_AGENT_SUMMARY_VERSION,normalizeChannelKindForDisplay}from"#internal/vercel-agent-summary.js";function buildVercelAgentSummary(e){let{manifest:t}=e;return{kind:VERCEL_EVE_AGENT_SUMMARY_KIND,schemaVersion:VERCEL_EVE_AGENT_SUMMARY_VERSION,generatorVersion:e.generatorVersion??resolveInstalledPackageInfo().version,agent:t.config.dynamicModel===void 0?{name:t.config.name,description:t.config.description,modelId:t.config.model.id}:{name:t.config.name,description:t.config.description,modelRouting:{kind:`dynamic`}},instructions:t.instructions.map(toInstructionsEntry),schedules:t.schedules.map(toScheduleEntry),tools:t.tools.map(toToolEntry),skills:t.skills.map(toSkillEntry),connections:t.connections.map(toConnectionEntry),channels:t.channels.filter(isActiveChannel).map(toChannelEntry),sandbox:t.sandbox===null?null:{logicalPath:t.sandbox.logicalPath},subagents:t.subagents.map(toSubagentEntry),diagnostics:{errors:t.diagnosticsSummary.errors,warnings:t.diagnosticsSummary.warnings}}}async function emitVercelAgentSummary(n){let r=buildVercelAgentSummary({generatorVersion:n.generatorVersion,manifest:n.manifest});return await mkdir(dirname(n.outputPath),{recursive:!0}),await writeFile(n.outputPath,`${JSON.stringify(r,null,2)}\n`),n.outputPath}function isActiveChannel(e){return e.kind===`channel`}function toInstructionsEntry(e){return{content:e.content,logicalPath:e.logicalPath,role:e.role,sourceKind:e.sourceKind}}function toScheduleEntry(e){return{name:e.name,cron:e.cron,logicalPath:e.logicalPath}}function toToolEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath}}function toSkillEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath,sourceKind:e.sourceKind}}function toConnectionEntry(e){let t={name:e.connectionName,description:e.description,url:e.url,logicalPath:e.logicalPath,type:e.protocol};return e.vercelConnect===void 0?t:{...t,vercelConnect:{connector:e.vercelConnect.connector}}}function toChannelEntry(e){let t={name:e.name,method:e.method,urlPath:e.urlPath,type:normalizeChannelKindForDisplay(e.adapterKind),logicalPath:e.logicalPath};return e.adapterKind===void 0?t:{...t,adapterKind:e.adapterKind}}function toSubagentEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath}}export{buildVercelAgentSummary,emitVercelAgentSummary};
1
+ import{mkdir,writeFile}from"node:fs/promises";import{dirname}from"node:path";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{VERCEL_EVE_AGENT_SUMMARY_KIND,VERCEL_EVE_AGENT_SUMMARY_VERSION,normalizeChannelKindForDisplay}from"#internal/vercel-agent-summary.js";function buildVercelAgentSummary(e){let{manifest:t}=e;return{kind:VERCEL_EVE_AGENT_SUMMARY_KIND,schemaVersion:VERCEL_EVE_AGENT_SUMMARY_VERSION,generatorVersion:e.generatorVersion??resolveInstalledPackageInfo().version,agent:t.config.dynamicModel===void 0?{name:t.config.name,description:t.config.description,modelId:t.config.model.id}:{name:t.config.name,description:t.config.description,modelRouting:{kind:`dynamic`}},instructions:t.instructions.map(toInstructionsEntry),schedules:t.schedules.map(toScheduleEntry),tools:t.tools.map(toToolEntry),skills:t.skills.map(toSkillEntry),connections:t.connections.map(toConnectionEntry),channels:t.channelRoutes.effective.map(toChannelEntry),sandbox:t.sandbox===null?null:{logicalPath:t.sandbox.logicalPath},subagents:t.subagents.map(toSubagentEntry),diagnostics:{errors:t.diagnosticsSummary.errors,warnings:t.diagnosticsSummary.warnings}}}async function emitVercelAgentSummary(n){let r=buildVercelAgentSummary({generatorVersion:n.generatorVersion,manifest:n.manifest});return await mkdir(dirname(n.outputPath),{recursive:!0}),await writeFile(n.outputPath,`${JSON.stringify(r,null,2)}\n`),n.outputPath}function toInstructionsEntry(e){return{content:e.content,logicalPath:e.logicalPath,role:e.role,sourceKind:e.sourceKind}}function toScheduleEntry(e){return{name:e.name,cron:e.cron,logicalPath:e.logicalPath}}function toToolEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath}}function toSkillEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath,sourceKind:e.sourceKind}}function toConnectionEntry(e){let t={name:e.connectionName,description:e.description,url:e.url,logicalPath:e.logicalPath,type:e.protocol};return e.vercelConnect===void 0?t:{...t,vercelConnect:{connector:e.vercelConnect.connector}}}function toChannelEntry(e){let t={name:e.name,method:e.method,urlPath:e.urlPath,type:normalizeChannelKindForDisplay(e.adapterKind),logicalPath:e.logicalPath};return e.adapterKind===void 0?t:{...t,adapterKind:e.adapterKind}}function toSubagentEntry(e){return{name:e.name,description:e.description,logicalPath:e.logicalPath}}export{buildVercelAgentSummary,emitVercelAgentSummary};
@@ -1,4 +1,3 @@
1
- import{mkdir,writeFile}from"node:fs/promises";import{dirname,join,relative}from"node:path";import{resolvePackageRoot,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{isVercelBuildEnvironment}from"#internal/application/paths.js";import{normalizeEsmImportSpecifier,stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";import{usesParentDevelopmentWorkflowWorld}from"#internal/workflow/development-world-protocol.js";import{createApplicationRouteRegistry}from"#internal/nitro/host/application-route-registry.js";import{WorkflowBundleBuilder}from"#internal/workflow-bundle/builder.js";import{createDevelopmentNitroArtifactsConfig,createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{deriveEveWorkflowQueuePrefix}from"#internal/workflow/queue-namespace.js";import{registerChannelVirtualHandlers}from"#internal/nitro/host/channel-routes.js";function registerHandler(e,t){let n=`#eve-route-handler/${t.method??`ALL`} ${t.route}`,r=stringifyEsmImportSpecifier(t.handlerPath);e.options.handlers.push({handler:n,method:t.method,route:t.route}),e.options.virtual[n]=[`import handler from ${r};`,`export default handler;`].join(`
2
- `)}function resolveNitroWorkflowBuildDirectory(e){return join(e.options.buildDir,`workflow`)}function createRelativeImportSpecifier(e,t){let n=relative(e,t).replaceAll(`\\`,`/`);return n.startsWith(`.`)?n:`./${n}`}async function addWorkflowFileHandler(i,a){let o=join(resolveNitroWorkflowBuildDirectory(i),`${a.bundleName}-handler.mjs`),s=dirname(o),c=createRelativeImportSpecifier(s,a.bundlePath),l=a.directHandlers??[],u=l.length>0&&a.workflowWorldPluginPath!==void 0?createRelativeImportSpecifier(s,a.workflowWorldPluginPath):void 0,d=l.map(e=>{let t=createRelativeImportSpecifier(s,e.bundlePath);return{importSpecifier:t,isOwnBundle:t===c,queuePrefix:e.queuePrefix}});await mkdir(s,{recursive:!0}),await writeFile(o,buildWorkflowFileHandlerSource({bundlePath:c,directHandlers:d,runtimeImportSpecifier:a.runtimeImportSpecifier,workflowWorldPluginImportSpecifier:u})),i.options.handlers.push({handler:o,route:a.route})}function buildWorkflowFileHandlerSource(e){let t=[`// Generated by eve. Do not edit by hand.`,`import { POST } from ${JSON.stringify(e.bundlePath)};`];if(e.directHandlers.length>0&&e.runtimeImportSpecifier!==void 0){let n=0,r=e.directHandlers.map(e=>{if(e.isOwnBundle)return{...e,binding:`POST`};let t=`__eveWorkflowDirectHandler${n}`;return n+=1,{...e,binding:t}});for(let e of r)e.isOwnBundle||t.push(`import { POST as ${e.binding} } from ${JSON.stringify(e.importSpecifier)};`);e.workflowWorldPluginImportSpecifier!==void 0&&t.push(`import ${JSON.stringify(e.workflowWorldPluginImportSpecifier)};`),t.push(`import { getWorld as __eveGetWorkflowWorld } from ${JSON.stringify(e.runtimeImportSpecifier)};`,``,`try {`,` const __eveWorkflowWorld = await __eveGetWorkflowWorld();`,` if (typeof __eveWorkflowWorld?.registerHandler === "function") {`);for(let e of r)t.push(` __eveWorkflowWorld.registerHandler(${JSON.stringify(e.queuePrefix)}, ${e.binding});`);t.push(` }`,`} catch (err) {`,` console.warn("[eve] Failed to register direct workflow queue handlers:", err);`,`}`)}return t.push(``,`export default async ({ req }) => {`,` return await POST(req);`,`};`,``),t.join(`
3
- `)}function addFrameworkVirtualHandler(e,t){let n=`#eve-route${t.route}`,r=stringifyEsmImportSpecifier(t.modulePath);e.options.handlers.push({handler:n,method:t.method,route:t.route}),e.options.virtual[n]=[`import { ${t.handlerExport} } from ${r};`,`export default async (event) => ${t.handlerExport}(${t.args}, event.req);`].join(`
4
- `)}async function registerWorkflowArtifactBuildHook(e,t){let n=!0;await t(),e.hooks.hook(`build:before`,async()=>{if(n){n=!1;return}await t()})}function registerApplicationRoutes(e,t,n,r){for(let i of r.routes)switch(i.kind){case`home`:addFrameworkVirtualHandler(e,{args:JSON.stringify({agentName:t.compileResult.manifest.config.name}),handlerExport:`handleHomePageRequest`,method:i.method,modulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/index.ts`),route:i.path});break;case`health`:registerHandler(e,{handlerPath:resolvePackageSourceFilePath(`src/internal/nitro/routes/health.ts`),method:i.method,route:i.path});break;case`channel`:case`channel-preflight`:registerChannelVirtualHandlers(e,{artifactsConfig:n,routes:[i]});break;case`development-artifacts`:addFrameworkVirtualHandler(e,{args:JSON.stringify({appRoot:n.appRoot}),handlerExport:`handleDevRuntimeArtifactsRequest`,method:i.method,modulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/dev-runtime-artifacts.ts`),route:i.path});break;case`development-schedule`:addFrameworkVirtualHandler(e,{args:JSON.stringify(n),handlerExport:`handleDevScheduleDispatchRequest`,method:i.method,modulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/dev-schedule-dispatch.ts`),route:i.path});break;case`workflow`:break}}function findWorkflowRoute(e){return e.routes.find(e=>e.kind===`workflow`)?.path}function createWorkflowDirectHandlerEntry(e,t){return{bundlePath:t,queuePrefix:deriveEveWorkflowQueuePrefix(e.compileResult.manifest.config.name)}}async function registerWorkflowRoute(e,t,n,r,i){await addWorkflowFileHandler(e,{bundleName:`workflows`,bundlePath:n,directHandlers:r,route:i,runtimeImportSpecifier:r.length===0?void 0:normalizeEsmImportSpecifier(resolveWorkflowModulePath(`workflow/runtime`)),workflowWorldPluginPath:t.compiledArtifacts.workflowWorldPluginPath})}async function configureDevelopmentNitroRoutes(e,t){let n=resolveNitroWorkflowBuildDirectory(e),i=new WorkflowBundleBuilder({agentName:t.compileResult.manifest.config.name,appRoot:t.appRoot,compiledArtifactsBootstrapPath:t.compiledArtifacts.bootstrapPath,outDir:t.workflowBuildDir,rootDir:resolvePackageRoot(),watch:!0});await registerWorkflowArtifactBuildHook(e,async()=>{await i.build({nitroStepOutfile:join(n,`steps.mjs`),nitroWorkflowOutfile:join(n,`workflows.mjs`)})});let o=createDevelopmentNitroArtifactsConfig({appRoot:t.appRoot,configuredWorld:t.compileResult.manifest.config.experimental?.workflow?.world}),s=createApplicationRouteRegistry(t,{development:!0});registerApplicationRoutes(e,t,o,s);let c=join(n,`workflows.mjs`),l=[];usesParentDevelopmentWorkflowWorld(t.compileResult.manifest.config.experimental?.workflow?.world)||l.push(createWorkflowDirectHandlerEntry(t,c));let u=findWorkflowRoute(s);u!==void 0&&await registerWorkflowRoute(e,t,c,l,u),e.routing.sync()}async function configureProductionNitroRoutes(e,t){let n=new WorkflowBundleBuilder({agentName:t.compileResult.manifest.config.name,appRoot:t.appRoot,compiledArtifactsBootstrapPath:t.compiledArtifacts.bootstrapPath,outDir:t.workflowBuildDir,rootDir:resolvePackageRoot(),watch:!1});await registerWorkflowArtifactBuildHook(e,async()=>{await n.build({nitroStepOutfile:join(resolveNitroWorkflowBuildDirectory(e),`steps.mjs`)})});let i=createApplicationRouteRegistry(t);registerApplicationRoutes(e,t,createProductionNitroArtifactsConfig(),i);let o=join(t.workflowBuildDir,`workflows.mjs`),s=t.compileResult.manifest.config.experimental?.workflow?.world!==void 0,l=!isVercelBuildEnvironment()&&s?[createWorkflowDirectHandlerEntry(t,o)]:[],u=findWorkflowRoute(i);u!==void 0&&await registerWorkflowRoute(e,t,o,l,u),e.routing.sync()}export{configureDevelopmentNitroRoutes,configureProductionNitroRoutes};
1
+ import{mkdir,writeFile}from"node:fs/promises";import{dirname,join,relative}from"node:path";import{resolvePackageRoot,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{isVercelBuildEnvironment}from"#internal/application/paths.js";import{normalizeEsmImportSpecifier,stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";import{usesParentDevelopmentWorkflowWorld}from"#internal/workflow/development-world-protocol.js";import{createApplicationRouteRegistry}from"#internal/nitro/host/application-route-registry.js";import{WorkflowBundleBuilder}from"#internal/workflow-bundle/builder.js";import{createDevelopmentNitroArtifactsConfig,createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{deriveEveWorkflowQueuePrefix}from"#internal/workflow/queue-namespace.js";import{registerChannelVirtualHandlers}from"#internal/nitro/host/channel-routes.js";function resolveNitroWorkflowBuildDirectory(e){return join(e.options.buildDir,`workflow`)}function createRelativeImportSpecifier(e,t){let n=relative(e,t).replaceAll(`\\`,`/`);return n.startsWith(`.`)?n:`./${n}`}async function addWorkflowFileHandler(i,a){let o=join(resolveNitroWorkflowBuildDirectory(i),`${a.bundleName}-handler.mjs`),s=dirname(o),c=createRelativeImportSpecifier(s,a.bundlePath),l=a.directHandlers??[],u=l.length>0&&a.workflowWorldPluginPath!==void 0?createRelativeImportSpecifier(s,a.workflowWorldPluginPath):void 0,d=l.map(e=>{let t=createRelativeImportSpecifier(s,e.bundlePath);return{importSpecifier:t,isOwnBundle:t===c,queuePrefix:e.queuePrefix}});await mkdir(s,{recursive:!0}),await writeFile(o,buildWorkflowFileHandlerSource({bundlePath:c,directHandlers:d,runtimeImportSpecifier:a.runtimeImportSpecifier,workflowWorldPluginImportSpecifier:u})),i.options.handlers.push({handler:o,route:a.route})}function buildWorkflowFileHandlerSource(e){let t=[`// Generated by eve. Do not edit by hand.`,`import { POST } from ${JSON.stringify(e.bundlePath)};`];if(e.directHandlers.length>0&&e.runtimeImportSpecifier!==void 0){let n=0,r=e.directHandlers.map(e=>{if(e.isOwnBundle)return{...e,binding:`POST`};let t=`__eveWorkflowDirectHandler${n}`;return n+=1,{...e,binding:t}});for(let e of r)e.isOwnBundle||t.push(`import { POST as ${e.binding} } from ${JSON.stringify(e.importSpecifier)};`);e.workflowWorldPluginImportSpecifier!==void 0&&t.push(`import ${JSON.stringify(e.workflowWorldPluginImportSpecifier)};`),t.push(`import { getWorld as __eveGetWorkflowWorld } from ${JSON.stringify(e.runtimeImportSpecifier)};`,``,`try {`,` const __eveWorkflowWorld = await __eveGetWorkflowWorld();`,` if (typeof __eveWorkflowWorld?.registerHandler === "function") {`);for(let e of r)t.push(` __eveWorkflowWorld.registerHandler(${JSON.stringify(e.queuePrefix)}, ${e.binding});`);t.push(` }`,`} catch (err) {`,` console.warn("[eve] Failed to register direct workflow queue handlers:", err);`,`}`)}return t.push(``,`export default async ({ req }) => {`,` return await POST(req);`,`};`,``),t.join(`
2
+ `)}function addHostVirtualHandler(e,t){let n=`#eve-route${t.route}`,r=stringifyEsmImportSpecifier(t.modulePath);e.options.handlers.push({handler:n,method:t.method,route:t.route}),e.options.virtual[n]=[`import { ${t.handlerExport} } from ${r};`,`export default async (event) => ${t.handlerExport}(${t.args}, event.req);`].join(`
3
+ `)}async function registerWorkflowArtifactBuildHook(e,t){let n=!0;await t(),e.hooks.hook(`build:before`,async()=>{if(n){n=!1;return}await t()})}function registerApplicationRoutes(e,t,n){for(let r of n.routes)switch(r.kind){case`channel`:case`channel-preflight`:registerChannelVirtualHandlers(e,{artifactsConfig:t,routes:[r]});break;case`development-artifacts`:addHostVirtualHandler(e,{args:JSON.stringify({appRoot:t.appRoot}),handlerExport:`handleDevRuntimeArtifactsRequest`,method:r.method,modulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/dev-runtime-artifacts.ts`),route:r.path});break;case`development-schedule`:addHostVirtualHandler(e,{args:JSON.stringify(t),handlerExport:`handleDevScheduleDispatchRequest`,method:r.method,modulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/dev-schedule-dispatch.ts`),route:r.path});break;case`workflow`:break}}function findWorkflowRoute(e){return e.routes.find(e=>e.kind===`workflow`)?.path}function createWorkflowDirectHandlerEntry(e,t){return{bundlePath:t,queuePrefix:deriveEveWorkflowQueuePrefix(e.compileResult.manifest.config.name)}}async function registerWorkflowRoute(e,t,n,r,i){await addWorkflowFileHandler(e,{bundleName:`workflows`,bundlePath:n,directHandlers:r,route:i,runtimeImportSpecifier:r.length===0?void 0:normalizeEsmImportSpecifier(resolveWorkflowModulePath(`workflow/runtime`)),workflowWorldPluginPath:t.compiledArtifacts.workflowWorldPluginPath})}async function configureDevelopmentNitroRoutes(e,t){let n=resolveNitroWorkflowBuildDirectory(e),i=new WorkflowBundleBuilder({agentName:t.compileResult.manifest.config.name,appRoot:t.appRoot,compiledArtifactsBootstrapPath:t.compiledArtifacts.bootstrapPath,outDir:t.workflowBuildDir,rootDir:resolvePackageRoot(),watch:!0});await registerWorkflowArtifactBuildHook(e,async()=>{await i.build({nitroStepOutfile:join(n,`steps.mjs`),nitroWorkflowOutfile:join(n,`workflows.mjs`)})});let o=createDevelopmentNitroArtifactsConfig({appRoot:t.appRoot,configuredWorld:t.compileResult.manifest.config.experimental?.workflow?.world}),s=createApplicationRouteRegistry(t,{development:!0});registerApplicationRoutes(e,o,s);let c=join(n,`workflows.mjs`),l=[];usesParentDevelopmentWorkflowWorld(t.compileResult.manifest.config.experimental?.workflow?.world)||l.push(createWorkflowDirectHandlerEntry(t,c));let u=findWorkflowRoute(s);u!==void 0&&await registerWorkflowRoute(e,t,c,l,u),e.routing.sync()}async function configureProductionNitroRoutes(e,t){let n=new WorkflowBundleBuilder({agentName:t.compileResult.manifest.config.name,appRoot:t.appRoot,compiledArtifactsBootstrapPath:t.compiledArtifacts.bootstrapPath,outDir:t.workflowBuildDir,rootDir:resolvePackageRoot(),watch:!1});await registerWorkflowArtifactBuildHook(e,async()=>{await n.build({nitroStepOutfile:join(resolveNitroWorkflowBuildDirectory(e),`steps.mjs`)})});let i=createApplicationRouteRegistry(t);registerApplicationRoutes(e,createProductionNitroArtifactsConfig(),i);let o=join(t.workflowBuildDir,`workflows.mjs`),s=t.compileResult.manifest.config.experimental?.workflow?.world!==void 0,l=!isVercelBuildEnvironment()&&s?[createWorkflowDirectHandlerEntry(t,o)]:[],u=findWorkflowRoute(i);u!==void 0&&await registerWorkflowRoute(e,t,o,l,u),e.routing.sync()}export{configureDevelopmentNitroRoutes,configureProductionNitroRoutes};
@@ -1 +1 @@
1
- import{readFile}from"node:fs/promises";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{resolvePackageRoot,resolvePackageSourceDirectoryPath,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{fileURLToPath}from"node:url";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{createExtensionScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{createExtensionExternalDependencyPlugin,resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createNitro}from"nitro/builder";import{prepareEveVersionedCacheDirectory,writeEveVersionedCacheMetadata}from"#internal/application/cache-metadata.js";import{createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{createCompiledSandboxBackendPrunePlugin}from"#internal/nitro/host/compiled-sandbox-backend-prune-plugin.js";import{configureDevelopmentNitroRoutes,configureProductionNitroRoutes}from"#internal/nitro/host/configure-nitro-routes.js";import{applyEveCronHandlerRoute}from"#internal/nitro/host/cron-handler-route.js";import{createNitroBundlerConfig}from"#internal/nitro/host/nitro-bundler-config.js";import{OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME,createOptionalEngineDependencyPlugin}from"#internal/nitro/host/optional-engine-dependency-plugin.js";import{addNitroRoutingImportSpecifierPlugin}from"#internal/nitro/host/nitro-routing-import-specifier-plugin.js";import{registerScheduleTaskHandlers}from"#internal/nitro/host/schedule-task-routes.js";import{createEveVercelOptions}from"#internal/nitro/host/vercel-build-output-config.js";import{applyWorkflowTransform}from"#internal/workflow-bundle/workflow-builders.js";const WORKFLOW_ALIAS_SPECIFIERS=[`workflow`,`workflow/api`,`workflow/errors`,`workflow/internal/builtins`,`workflow/internal/private`,`workflow/runtime`],WORKFLOW_TRANSFORM_PATCHED=Symbol(`eve.workflow-transform-patched`),FRAMEWORK_HOSTED_EXTERNAL_PACKAGES=[`@napi-rs/keyring`],LOCAL_SANDBOX_BACKEND_NAMES=new Set([`docker`,...Object.keys(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME)]);function resolveWorkflowAliases(){let e={};for(let t of WORKFLOW_ALIAS_SPECIFIERS)e[t]=resolveWorkflowModulePath(t);return e}function resolveProductionNitroPreset(){return process.env.VERCEL?`vercel`:void 0}function manifestEnablesWorkflow(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>e.workflowTool!==void 0)}function manifestHasWebSocketChannel(e){return e.channels.some(e=>e.kind===`channel`&&e.method===`WEBSOCKET`)}function collectHostedTraceDependencies(e,t){let n=new Set(collectExtensionExternalDependencies(e.compileResult.manifest)),r=[...e.compileResult.manifest.config.build?.externalDependencies??[],...e.compileResult.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])];return[...new Set([...FRAMEWORK_HOSTED_EXTERNAL_PACKAGES,...t,...r,...[...n].map(e=>`${e}*`)])].filter(e=>e!==EVE_PACKAGE_NAME&&e!==`${EVE_PACKAGE_NAME}*`)}function collectExtensionExternalDependencies(e){return[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.flatMap(e=>e.externalDependencies))}function collectConfiguredSandboxBackendNames(e){let t=[e,...e.subagents.map(e=>e.agent)];return new Set(t.map(e=>e.sandbox?.backendName).filter(e=>typeof e==`string`))}function shouldPruneLocalSandboxBackends(e){return e.preset===`vercel`&&![...e.configuredBackendNames].some(e=>LOCAL_SANDBOX_BACKEND_NAMES.has(e))}function createDevelopmentWatchOptions(e){return{ignored:[e,join(e,`**`)]}}function normalizePath(e){return e.replaceAll(`\\`,`/`)}function stripPathQueryAndHash(e){let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?e:e.slice(0,r)}function stripFileSystemPrefix(e){return e.startsWith(`/@fs/`)?e.slice(4):e}function resolveNitroModuleComparisonPath(e,t){return t.startsWith(`file://`)?normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(fileURLToPath(t)))):isAbsolute(t)?normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(t))):normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(resolve(e,t))))}function isWorkflowBundlePath(e,t){let n=normalizePath(e);return n.startsWith(t)||n.includes(`/.eve/workflow-cache/`)}function normalizeStepTransformComparisonPath(e){let t=normalizePath(e);return process.platform===`win32`?t.toLowerCase():t}function parseImportedModuleSpecifiers(e){let t=/^\s*import\s+(?:.+?\s+from\s+)?["']([^"']+)["'];?\s*$/gm,n=[];for(let r of e.matchAll(t)){let e=r[1];e!==void 0&&n.push(e)}return n}function resolveNitroImportPath(e,n,r){return n.startsWith(`workflow`)?resolveWorkflowModulePath(n):n.startsWith(`.`)||n.startsWith(`/`)||n.startsWith(`file://`)?resolveNitroModuleComparisonPath(r===void 0?e:dirname(resolveNitroModuleComparisonPath(e,r)),n):null}async function collectNitroStepTransformTargets(t,n){let r=await readFile(t,`utf8`),i=new Set;for(let e of parseImportedModuleSpecifiers(r)){let r=resolveNitroImportPath(n,e,t);r!==null&&i.add(normalizeStepTransformComparisonPath(r))}return i}async function addNitroStepNoExternals(e,t){if(e.options.noExternals===!0)return;let n;try{n=await collectNitroStepTransformTargets(t,e.options.rootDir)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let r=Array.isArray(e.options.noExternals)?[...e.options.noExternals]:[];e.options.noExternals=[...new Set([...r,...n])]}function createRelativeTransformFilename(e,t){let n=createPackageRelativeTransformFilename(t);if(n!==void 0)return n;let r=normalizePath(e).replace(/\/$/,``),a=normalizePath(t),o=r.toLowerCase(),s=a.toLowerCase();if(s.startsWith(`${o}/`))return a.slice(r.length+1);if(s===o)return`.`;let c=relative(r,a).replaceAll(`\\`,`/`);if(c.startsWith(`../`)&&(c=c.split(`/`).filter(e=>e!==`..`).join(`/`)),c.includes(`:`)||c.startsWith(`/`)){let e=a.split(`/`).pop();return e===void 0||e.length===0?`unknown.ts`:e}return c}function createPackageRelativeTransformFilename(e){let t=normalizePath(resolvePackageRoot()).replace(/\/$/,``),n=normalizePath(e),r=t.toLowerCase(),i=n.toLowerCase(),a=`${t}/src/`,s=`${r}/src/`,c=`${t}/dist/src/`,l=`${r}/dist/src/`;if(i.startsWith(s))return`src/${n.slice(a.length)}`;if(i.startsWith(l))return`src/${n.slice(c.length)}`}function addWorkflowModuleSideEffectsPlugin(e,t){let n=[t,join(e.options.buildDir,`workflow`)].map(t=>resolveNitroModuleComparisonPath(e.options.rootDir,t));e.hooks.hook(`rollup:before`,(t,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({name:`eve:workflow-module-side-effects`,resolveId(t,r){let i=resolveNitroImportPath(e.options.rootDir,t,r)??resolveNitroModuleComparisonPath(e.options.rootDir,t);return n.some(e=>isWorkflowBundlePath(i,e))?{id:i,moduleSideEffects:`no-treeshake`}:null}})})}function addNitroStepModuleSideEffectsPlugin(e,t){let n=null,getStepTransformTargets=async()=>(n===null&&(n=await collectNitroStepTransformTargets(t.stepEntrypointPath,e.options.rootDir)),n),clearCachedStepTransformTargets=()=>{n=null};return e.hooks.hook(`build:before`,clearCachedStepTransformTargets),e.hooks.hook(`rollup:before`,(t,n)=>{Array.isArray(n.plugins)&&n.plugins.unshift({name:`eve:workflow-step-module-side-effects`,async resolveId(t,n){let r=resolveNitroImportPath(e.options.rootDir,t,n);return r===null||!(await getStepTransformTargets()).has(normalizeStepTransformComparisonPath(r))?null:{id:r,moduleSideEffects:`no-treeshake`}}})}),clearCachedStepTransformTargets}function addNitroStepTransformPlugin(e,t){let n=null,getStepTransformTargets=async()=>(n===null&&(n=await collectNitroStepTransformTargets(t.stepEntrypointPath,e.options.rootDir)),n),clearCachedStepTransformTargets=()=>{n=null};return e.hooks.hook(`build:before`,clearCachedStepTransformTargets),e.hooks.hook(`rollup:before`,(t,n)=>{Array.isArray(n.plugins)&&n.plugins.unshift({async transform(t,n){let r=await getStepTransformTargets(),i=resolveNitroModuleComparisonPath(e.options.rootDir,n);return r.has(normalizeStepTransformComparisonPath(i))?{code:(await applyWorkflowTransform(createRelativeTransformFilename(e.options.rootDir,i),t,`step`,i,e.options.rootDir)).code,map:null}:null},name:`eve:workflow-step-transform`})}),clearCachedStepTransformTargets}function addDynamicCapabilityTransformPlugin(e){e.hooks.hook(`rollup:before`,(e,t)=>{Array.isArray(t.plugins)&&t.plugins.unshift(createDynamicCapabilityTransformPlugin())})}function addInstrumentationModuleSideEffectsPlugin(e,t){let n=new Set(t.map(normalizePath));e.hooks.hook(`rollup:before`,(e,t)=>{Array.isArray(t.plugins)&&t.plugins.unshift({name:`eve:instrumentation-module-side-effects`,resolveId(e){return n.has(normalizePath(e))?{id:e,moduleSideEffects:`no-treeshake`}:null}})})}function patchWorkflowTransformExcludePath(e,t){let n=normalizePath(t);e.hooks.hook(`rollup:before`,(e,t)=>{if(Array.isArray(t.plugins))for(let e of t.plugins){if(typeof e!=`object`||!e)continue;let t=e;if(t.name!==`workflow:transform`||t[WORKFLOW_TRANSFORM_PATCHED]===!0||typeof t.transform!=`function`)continue;let r=t.transform;t.transform=function(e,t,...i){return isWorkflowBundlePath(t,n)?null:r.call(this,e,t,...i)},t[WORKFLOW_TRANSFORM_PATCHED]=!0}})}function createApplicationNitroBundlerConfiguration(e,t){let n=collectConfiguredSandboxBackendNames(e.compileResult.manifest),r=shouldPruneLocalSandboxBackends({configuredBackendNames:n,preset:t})?createCompiledSandboxBackendPrunePlugin():null,i=[],a=[];for(let[e,t]of Object.entries(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME))(n.has(e)?i:a).push(t);let o=createExtensionScopePlugin([e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({sourceRoot:e.sourceRoot,packageNamespace:e.packageNamespace})))),s=[e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),c=[r,createOptionalEngineDependencyPlugin(a),createExtensionExternalDependencyPlugin(s),o].filter(e=>e!==null);return{nitroRolldownConfig:createNitroBundlerConfig(c),nitroRollupConfig:createNitroBundlerConfig(c),tracedAppDependencies:collectHostedTraceDependencies(e,i),tracedAppDependencyPaths:resolveExtensionExternalDependencyPaths(s)}}function createApplicationNitroPlugins(e){let t=[e.compiledArtifacts.bootstrapPath,e.compiledArtifacts.workflowWorldPluginPath];return manifestEnablesWorkflow(e.compileResult.manifest)&&t.push(resolvePackageSourceFilePath(`src/internal/nitro/host/workflow-sandbox-runtime-plugin.ts`)),e.compiledArtifacts.instrumentationPluginPath!==void 0&&t.push(e.compiledArtifacts.instrumentationPluginPath),t}function configureSharedApplicationNitro(e,t){addNitroRoutingImportSpecifierPlugin(e);let n=resolveWorkflowAliases();for(let[t,r]of Object.entries(n))e.options.alias[t]=r;addWorkflowModuleSideEffectsPlugin(e,t.workflowBuildDir),patchWorkflowTransformExcludePath(e,t.workflowBuildDir),addDynamicCapabilityTransformPlugin(e),t.compiledArtifacts.instrumentationSourcePaths!==void 0&&addInstrumentationModuleSideEffectsPlugin(e,t.compiledArtifacts.instrumentationSourcePaths)}function configureNitroStepPlugins(e,t){return[addNitroStepModuleSideEffectsPlugin(e,{stepEntrypointPath:t}),addNitroStepTransformPlugin(e,{stepEntrypointPath:t})]}function externalizeDevelopmentWorkflowBundle(e,t){let n=new Set([normalizePath(join(t.workflowBuildDir,`workflows.mjs`))]);e.hooks.hook(`rollup:before`,(e,t)=>{let r=t.external;t.external=(e,...t)=>{if(n.has(normalizePath(e)))return!0;if(typeof r==`function`)return r(e,...t)}})}async function createDevelopmentApplicationNitro(e){let t=e.workspace.nitroBuildDir,n=createApplicationNitroBundlerConfiguration(e,void 0),i=createApplicationNitroPlugins(e);e.compiledArtifacts.instrumentationPluginPath===void 0&&i.unshift(resolvePackageSourceFilePath(`src/internal/nitro/host/local-tracing-runtime-plugin.ts`)),await prepareEveVersionedCacheDirectory(t);let a=await createNitro({_cli:{command:`dev`},buildDir:t,dev:!0,features:{websocket:!0},logLevel:1,output:{dir:e.workspace.nitroOutputDir},plugins:i,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:n.nitroRolldownConfig,rollupConfig:n.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:n.tracedAppDependencies,traceOpts:{nft:{paths:n.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:!1}),watchOptions:createDevelopmentWatchOptions(e.appRoot)},{watch:!0});await writeEveVersionedCacheMetadata(t);let o=join(a.options.buildDir,`workflow`,`steps.mjs`);configureSharedApplicationNitro(a,e);let l=configureNitroStepPlugins(a,o);return a.hooks.hook(`dev:reload`,()=>{for(let e of l)e()}),externalizeDevelopmentWorkflowBundle(a,e),await configureDevelopmentNitroRoutes(a,e),await addNitroStepNoExternals(a,o),a}async function createProductionApplicationNitro(e,t){let n=resolveProductionNitroPreset(),i=createApplicationNitroBundlerConfiguration(e,n),a=createApplicationNitroPlugins(e);a.push(resolvePackageSourceFilePath(`src/internal/nitro/host/sandbox-shutdown-plugin.ts`)),await prepareEveVersionedCacheDirectory(t.buildDir);let o=await createNitro({_cli:{command:`build`},buildDir:t.buildDir,dev:!1,features:{websocket:manifestHasWebSocketChannel(e.compileResult.manifest)},output:{dir:t.outputDir},preset:n,plugins:a,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:i.nitroRolldownConfig,rollupConfig:i.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:i.tracedAppDependencies,traceOpts:{nft:{paths:i.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:n===`vercel`,publicRoutePrefix:t.publicRoutePrefix})});return await writeEveVersionedCacheMetadata(t.buildDir),configureSharedApplicationNitro(o,e),configureNitroStepPlugins(o,join(e.workflowBuildDir,`steps.mjs`)),e.scheduleRegistrations.length>0&&(applyEveCronHandlerRoute(o),registerScheduleTaskHandlers(o,{artifactsConfig:createProductionNitroArtifactsConfig(),dispatchModulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/schedule-task.ts`),registrations:e.scheduleRegistrations})),await configureProductionNitroRoutes(o,e),await addNitroStepNoExternals(o,join(e.workflowBuildDir,`steps.mjs`)),o}export{createDevelopmentApplicationNitro,createProductionApplicationNitro,shouldPruneLocalSandboxBackends};
1
+ import{readFile}from"node:fs/promises";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{resolvePackageRoot,resolvePackageSourceDirectoryPath,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{fileURLToPath}from"node:url";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{createExtensionScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{createExtensionExternalDependencyPlugin,resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createNitro}from"nitro/builder";import{prepareEveVersionedCacheDirectory,writeEveVersionedCacheMetadata}from"#internal/application/cache-metadata.js";import{createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{createCompiledSandboxBackendPrunePlugin}from"#internal/nitro/host/compiled-sandbox-backend-prune-plugin.js";import{configureDevelopmentNitroRoutes,configureProductionNitroRoutes}from"#internal/nitro/host/configure-nitro-routes.js";import{applyEveCronHandlerRoute}from"#internal/nitro/host/cron-handler-route.js";import{createNitroBundlerConfig}from"#internal/nitro/host/nitro-bundler-config.js";import{OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME,createOptionalEngineDependencyPlugin}from"#internal/nitro/host/optional-engine-dependency-plugin.js";import{addNitroRoutingImportSpecifierPlugin}from"#internal/nitro/host/nitro-routing-import-specifier-plugin.js";import{registerScheduleTaskHandlers}from"#internal/nitro/host/schedule-task-routes.js";import{createEveVercelOptions}from"#internal/nitro/host/vercel-build-output-config.js";import{applyWorkflowTransform}from"#internal/workflow-bundle/workflow-builders.js";const WORKFLOW_ALIAS_SPECIFIERS=[`workflow`,`workflow/api`,`workflow/errors`,`workflow/internal/builtins`,`workflow/internal/private`,`workflow/runtime`],WORKFLOW_TRANSFORM_PATCHED=Symbol(`eve.workflow-transform-patched`),FRAMEWORK_HOSTED_EXTERNAL_PACKAGES=[`@napi-rs/keyring`],LOCAL_SANDBOX_BACKEND_NAMES=new Set([`docker`,...Object.keys(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME)]);function resolveWorkflowAliases(){let e={};for(let t of WORKFLOW_ALIAS_SPECIFIERS)e[t]=resolveWorkflowModulePath(t);return e}function resolveProductionNitroPreset(){return process.env.VERCEL?`vercel`:void 0}function manifestEnablesWorkflow(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>e.workflowTool!==void 0)}function manifestHasWebSocketChannel(e){return e.channelRoutes.effective.some(e=>e.method===`WEBSOCKET`)}function collectHostedTraceDependencies(e,t){let n=new Set(collectExtensionExternalDependencies(e.compileResult.manifest)),r=[...e.compileResult.manifest.config.build?.externalDependencies??[],...e.compileResult.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])];return[...new Set([...FRAMEWORK_HOSTED_EXTERNAL_PACKAGES,...t,...r,...[...n].map(e=>`${e}*`)])].filter(e=>e!==EVE_PACKAGE_NAME&&e!==`${EVE_PACKAGE_NAME}*`)}function collectExtensionExternalDependencies(e){return[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.flatMap(e=>e.externalDependencies))}function collectConfiguredSandboxBackendNames(e){let t=[e,...e.subagents.map(e=>e.agent)];return new Set(t.map(e=>e.sandbox?.backendName).filter(e=>typeof e==`string`))}function shouldPruneLocalSandboxBackends(e){return e.preset===`vercel`&&![...e.configuredBackendNames].some(e=>LOCAL_SANDBOX_BACKEND_NAMES.has(e))}function createDevelopmentWatchOptions(e){return{ignored:[e,join(e,`**`)]}}function normalizePath(e){return e.replaceAll(`\\`,`/`)}function stripPathQueryAndHash(e){let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?e:e.slice(0,r)}function stripFileSystemPrefix(e){return e.startsWith(`/@fs/`)?e.slice(4):e}function resolveNitroModuleComparisonPath(e,t){return t.startsWith(`file://`)?normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(fileURLToPath(t)))):isAbsolute(t)?normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(t))):normalizePath(stripFileSystemPrefix(stripPathQueryAndHash(resolve(e,t))))}function isWorkflowBundlePath(e,t){let n=normalizePath(e);return n.startsWith(t)||n.includes(`/.eve/workflow-cache/`)}function normalizeStepTransformComparisonPath(e){let t=normalizePath(e);return process.platform===`win32`?t.toLowerCase():t}function parseImportedModuleSpecifiers(e){let t=/^\s*import\s+(?:.+?\s+from\s+)?["']([^"']+)["'];?\s*$/gm,n=[];for(let r of e.matchAll(t)){let e=r[1];e!==void 0&&n.push(e)}return n}function resolveNitroImportPath(e,n,r){return n.startsWith(`workflow`)?resolveWorkflowModulePath(n):n.startsWith(`.`)||n.startsWith(`/`)||n.startsWith(`file://`)?resolveNitroModuleComparisonPath(r===void 0?e:dirname(resolveNitroModuleComparisonPath(e,r)),n):null}async function collectNitroStepTransformTargets(t,n){let r=await readFile(t,`utf8`),i=new Set;for(let e of parseImportedModuleSpecifiers(r)){let r=resolveNitroImportPath(n,e,t);r!==null&&i.add(normalizeStepTransformComparisonPath(r))}return i}async function addNitroStepNoExternals(e,t){if(e.options.noExternals===!0)return;let n;try{n=await collectNitroStepTransformTargets(t,e.options.rootDir)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let r=Array.isArray(e.options.noExternals)?[...e.options.noExternals]:[];e.options.noExternals=[...new Set([...r,...n])]}function createRelativeTransformFilename(e,t){let n=createPackageRelativeTransformFilename(t);if(n!==void 0)return n;let r=normalizePath(e).replace(/\/$/,``),a=normalizePath(t),o=r.toLowerCase(),s=a.toLowerCase();if(s.startsWith(`${o}/`))return a.slice(r.length+1);if(s===o)return`.`;let c=relative(r,a).replaceAll(`\\`,`/`);if(c.startsWith(`../`)&&(c=c.split(`/`).filter(e=>e!==`..`).join(`/`)),c.includes(`:`)||c.startsWith(`/`)){let e=a.split(`/`).pop();return e===void 0||e.length===0?`unknown.ts`:e}return c}function createPackageRelativeTransformFilename(e){let t=normalizePath(resolvePackageRoot()).replace(/\/$/,``),n=normalizePath(e),r=t.toLowerCase(),i=n.toLowerCase(),a=`${t}/src/`,s=`${r}/src/`,c=`${t}/dist/src/`,l=`${r}/dist/src/`;if(i.startsWith(s))return`src/${n.slice(a.length)}`;if(i.startsWith(l))return`src/${n.slice(c.length)}`}function addWorkflowModuleSideEffectsPlugin(e,t){let n=[t,join(e.options.buildDir,`workflow`)].map(t=>resolveNitroModuleComparisonPath(e.options.rootDir,t));e.hooks.hook(`rollup:before`,(t,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({name:`eve:workflow-module-side-effects`,resolveId(t,r){let i=resolveNitroImportPath(e.options.rootDir,t,r)??resolveNitroModuleComparisonPath(e.options.rootDir,t);return n.some(e=>isWorkflowBundlePath(i,e))?{id:i,moduleSideEffects:`no-treeshake`}:null}})})}function addNitroStepModuleSideEffectsPlugin(e,t){let n=null,getStepTransformTargets=async()=>(n===null&&(n=await collectNitroStepTransformTargets(t.stepEntrypointPath,e.options.rootDir)),n),clearCachedStepTransformTargets=()=>{n=null};return e.hooks.hook(`build:before`,clearCachedStepTransformTargets),e.hooks.hook(`rollup:before`,(t,n)=>{Array.isArray(n.plugins)&&n.plugins.unshift({name:`eve:workflow-step-module-side-effects`,async resolveId(t,n){let r=resolveNitroImportPath(e.options.rootDir,t,n);return r===null||!(await getStepTransformTargets()).has(normalizeStepTransformComparisonPath(r))?null:{id:r,moduleSideEffects:`no-treeshake`}}})}),clearCachedStepTransformTargets}function addNitroStepTransformPlugin(e,t){let n=null,getStepTransformTargets=async()=>(n===null&&(n=await collectNitroStepTransformTargets(t.stepEntrypointPath,e.options.rootDir)),n),clearCachedStepTransformTargets=()=>{n=null};return e.hooks.hook(`build:before`,clearCachedStepTransformTargets),e.hooks.hook(`rollup:before`,(t,n)=>{Array.isArray(n.plugins)&&n.plugins.unshift({async transform(t,n){let r=await getStepTransformTargets(),i=resolveNitroModuleComparisonPath(e.options.rootDir,n);return r.has(normalizeStepTransformComparisonPath(i))?{code:(await applyWorkflowTransform(createRelativeTransformFilename(e.options.rootDir,i),t,`step`,i,e.options.rootDir)).code,map:null}:null},name:`eve:workflow-step-transform`})}),clearCachedStepTransformTargets}function addDynamicCapabilityTransformPlugin(e){e.hooks.hook(`rollup:before`,(e,t)=>{Array.isArray(t.plugins)&&t.plugins.unshift(createDynamicCapabilityTransformPlugin())})}function addInstrumentationModuleSideEffectsPlugin(e,t){let n=new Set(t.map(normalizePath));e.hooks.hook(`rollup:before`,(e,t)=>{Array.isArray(t.plugins)&&t.plugins.unshift({name:`eve:instrumentation-module-side-effects`,resolveId(e){return n.has(normalizePath(e))?{id:e,moduleSideEffects:`no-treeshake`}:null}})})}function patchWorkflowTransformExcludePath(e,t){let n=normalizePath(t);e.hooks.hook(`rollup:before`,(e,t)=>{if(Array.isArray(t.plugins))for(let e of t.plugins){if(typeof e!=`object`||!e)continue;let t=e;if(t.name!==`workflow:transform`||t[WORKFLOW_TRANSFORM_PATCHED]===!0||typeof t.transform!=`function`)continue;let r=t.transform;t.transform=function(e,t,...i){return isWorkflowBundlePath(t,n)?null:r.call(this,e,t,...i)},t[WORKFLOW_TRANSFORM_PATCHED]=!0}})}function createApplicationNitroBundlerConfiguration(e,t){let n=collectConfiguredSandboxBackendNames(e.compileResult.manifest),r=shouldPruneLocalSandboxBackends({configuredBackendNames:n,preset:t})?createCompiledSandboxBackendPrunePlugin():null,i=[],a=[];for(let[e,t]of Object.entries(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME))(n.has(e)?i:a).push(t);let o=createExtensionScopePlugin([e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({sourceRoot:e.sourceRoot,packageNamespace:e.packageNamespace})))),s=[e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),c=[r,createOptionalEngineDependencyPlugin(a),createExtensionExternalDependencyPlugin(s),o].filter(e=>e!==null);return{nitroRolldownConfig:createNitroBundlerConfig(c),nitroRollupConfig:createNitroBundlerConfig(c),tracedAppDependencies:collectHostedTraceDependencies(e,i),tracedAppDependencyPaths:resolveExtensionExternalDependencyPaths(s)}}function createApplicationNitroPlugins(e){let t=[e.compiledArtifacts.bootstrapPath,e.compiledArtifacts.workflowWorldPluginPath];return manifestEnablesWorkflow(e.compileResult.manifest)&&t.push(resolvePackageSourceFilePath(`src/internal/nitro/host/workflow-sandbox-runtime-plugin.ts`)),e.compiledArtifacts.instrumentationPluginPath!==void 0&&t.push(e.compiledArtifacts.instrumentationPluginPath),t}function configureSharedApplicationNitro(e,t){addNitroRoutingImportSpecifierPlugin(e);let n=resolveWorkflowAliases();for(let[t,r]of Object.entries(n))e.options.alias[t]=r;addWorkflowModuleSideEffectsPlugin(e,t.workflowBuildDir),patchWorkflowTransformExcludePath(e,t.workflowBuildDir),addDynamicCapabilityTransformPlugin(e),t.compiledArtifacts.instrumentationSourcePaths!==void 0&&addInstrumentationModuleSideEffectsPlugin(e,t.compiledArtifacts.instrumentationSourcePaths)}function configureNitroStepPlugins(e,t){return[addNitroStepModuleSideEffectsPlugin(e,{stepEntrypointPath:t}),addNitroStepTransformPlugin(e,{stepEntrypointPath:t})]}function externalizeDevelopmentWorkflowBundle(e,t){let n=new Set([normalizePath(join(t.workflowBuildDir,`workflows.mjs`))]);e.hooks.hook(`rollup:before`,(e,t)=>{let r=t.external;t.external=(e,...t)=>{if(n.has(normalizePath(e)))return!0;if(typeof r==`function`)return r(e,...t)}})}async function createDevelopmentApplicationNitro(e){let t=e.workspace.nitroBuildDir,n=createApplicationNitroBundlerConfiguration(e,void 0),i=createApplicationNitroPlugins(e);e.compiledArtifacts.instrumentationPluginPath===void 0&&i.unshift(resolvePackageSourceFilePath(`src/internal/nitro/host/local-tracing-runtime-plugin.ts`)),await prepareEveVersionedCacheDirectory(t);let a=await createNitro({_cli:{command:`dev`},buildDir:t,dev:!0,features:{websocket:!0},logLevel:1,output:{dir:e.workspace.nitroOutputDir},plugins:i,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:n.nitroRolldownConfig,rollupConfig:n.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:n.tracedAppDependencies,traceOpts:{nft:{paths:n.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:!1}),watchOptions:createDevelopmentWatchOptions(e.appRoot)},{watch:!0});await writeEveVersionedCacheMetadata(t);let o=join(a.options.buildDir,`workflow`,`steps.mjs`);configureSharedApplicationNitro(a,e);let l=configureNitroStepPlugins(a,o);return a.hooks.hook(`dev:reload`,()=>{for(let e of l)e()}),externalizeDevelopmentWorkflowBundle(a,e),await configureDevelopmentNitroRoutes(a,e),await addNitroStepNoExternals(a,o),a}async function createProductionApplicationNitro(e,t){let n=resolveProductionNitroPreset(),i=createApplicationNitroBundlerConfiguration(e,n),a=createApplicationNitroPlugins(e);a.push(resolvePackageSourceFilePath(`src/internal/nitro/host/sandbox-shutdown-plugin.ts`)),await prepareEveVersionedCacheDirectory(t.buildDir);let o=await createNitro({_cli:{command:`build`},buildDir:t.buildDir,dev:!1,features:{websocket:manifestHasWebSocketChannel(e.compileResult.manifest)},output:{dir:t.outputDir},preset:n,plugins:a,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:i.nitroRolldownConfig,rollupConfig:i.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:i.tracedAppDependencies,traceOpts:{nft:{paths:i.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:n===`vercel`,publicRoutePrefix:t.publicRoutePrefix})});return await writeEveVersionedCacheMetadata(t.buildDir),configureSharedApplicationNitro(o,e),configureNitroStepPlugins(o,join(e.workflowBuildDir,`steps.mjs`)),e.scheduleRegistrations.length>0&&(applyEveCronHandlerRoute(o),registerScheduleTaskHandlers(o,{artifactsConfig:createProductionNitroArtifactsConfig(),dispatchModulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/schedule-task.ts`),registrations:e.scheduleRegistrations})),await configureProductionNitroRoutes(o,e),await addNitroStepNoExternals(o,join(e.workflowBuildDir,`steps.mjs`)),o}export{createDevelopmentApplicationNitro,createProductionApplicationNitro,shouldPruneLocalSandboxBackends};
@@ -1 +1 @@
1
- import{createHash}from"node:crypto";import{readFile}from"node:fs/promises";import{readDevelopmentEnvironmentHostValues}from"#cli/dev/environment.js";import{computeChannelRouteRegistrations}from"#internal/nitro/host/channel-routes.js";async function computeDevelopmentHostFingerprint(t){let i=t.compileResult.manifest,a=[i,...i.subagents.map(e=>e.agent)],o={agentName:i.config.name,bundler:{externalDependencies:[...new Set([...i.config.build?.externalDependencies??[],...i.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])])].sort((e,t)=>e.localeCompare(t)),extensionScopes:a.flatMap(e=>e.extensionMounts).map(e=>({packageNamespace:e.packageNamespace,sourceRoot:e.sourceRoot})).sort((e,t)=>e.sourceRoot.localeCompare(t.sourceRoot)),sandboxBackends:[...new Set(a.map(e=>e.sandbox?.backendName).filter(e=>e!==void 0))].sort((e,t)=>e.localeCompare(t))},channels:computeChannelRouteRegistrations(t),environment:readDevelopmentEnvironmentHostValues(t.appRoot),instrumentation:await readInstrumentationSource(t),workflow:{enabled:a.some(e=>e.workflowTool!==void 0),world:i.config.experimental?.workflow?.world??`local`}};return createHash(`sha256`).update(JSON.stringify(o)).digest(`hex`)}async function readInstrumentationSource(e){let n=e.compiledArtifacts.instrumentationSourcePaths,r=e.compiledArtifacts.instrumentationLayout;if(n===void 0||r===void 0)return null;let i=await Promise.all(n.map(async e=>await readFile(e,`utf8`)));return{kind:r.kind,modules:i.map((e,t)=>({slot:r.kind===`directory`?r.slots[t]??null:null,source:e}))}}export{computeDevelopmentHostFingerprint};
1
+ import{createHash}from"node:crypto";import{readFile}from"node:fs/promises";import{readDevelopmentEnvironmentHostValues}from"#cli/dev/environment.js";import{resolveCompiledModuleExtensionScopeNamespace}from"#compiler/module-map.js";import{bundleAuthoredModuleForGeneration}from"#internal/authored-module-loader.js";import{computeChannelRouteRegistrations}from"#internal/nitro/host/channel-routes.js";async function computeDevelopmentHostFingerprint(t){let r=t.compileResult.manifest,i=[r,...r.subagents.map(e=>e.agent)],o={agentName:r.config.name,bundler:{externalDependencies:[...new Set([...r.config.build?.externalDependencies??[],...r.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])])].sort((e,t)=>e.localeCompare(t)),extensionScopes:i.flatMap(e=>e.extensionMounts).map(e=>({packageNamespace:e.packageNamespace,sourceRoot:e.sourceRoot})).sort((e,t)=>e.sourceRoot.localeCompare(t.sourceRoot)),sandboxBackends:[...new Set(i.map(e=>e.sandbox?.backendName).filter(e=>e!==void 0))].sort((e,t)=>e.localeCompare(t))},channels:computeChannelRouteRegistrations(t),environment:readDevelopmentEnvironmentHostValues(t.appRoot),instrumentation:await readInstrumentationSource(t),workflow:{enabled:i.some(e=>e.workflowTool!==void 0),world:r.config.experimental?.workflow?.world??`local`}};return createHash(`sha256`).update(JSON.stringify(o)).digest(`hex`)}async function readInstrumentationSource(e){let n=e.compileResult.manifest.instrumentation;if(n!==void 0){let t=e.compileResult.manifest.bindings[n.sourceId];if(t===void 0)throw Error(`Compiled instrumentation source "${n.sourceId}" has no binding.`);return{kind:`file`,modules:[{slot:null,source:t.backing.kind===`filesystem`?await bundleAuthoredModuleForGeneration(t.backing.sourcePath,{externalDependencies:t.backing.externalDependencies,extensionScopeNamespace:resolveCompiledModuleExtensionScopeNamespace(t)}):JSON.stringify(t.backing)}]}}let a=e.compiledArtifacts.instrumentationSourcePaths,o=e.compiledArtifacts.instrumentationLayout;if(a===void 0||o===void 0)return null;let s=await Promise.all(a.map(async e=>await readFile(e,`utf8`)));return{kind:o.kind,modules:s.map((e,t)=>({slot:o.kind===`directory`?o.slots[t]??null:null,source:e}))}}export{computeDevelopmentHostFingerprint};
@@ -5,6 +5,8 @@ import type { ModuleSourceRef } from "#shared/source-ref.js";
5
5
  export declare function deriveExtensionCapabilityRequirements(input: {
6
6
  readonly declarationModule: ModuleSourceRef;
7
7
  readonly manifest: AgentSourceManifest;
8
+ readonly packageName: string;
8
9
  readonly runtimeDependencies: readonly string[];
10
+ readonly shortName: string;
9
11
  readonly sourceRoot: string;
10
12
  }): Promise<ExtensionCapabilityRequirements>;
@@ -1 +1 @@
1
- import{join}from"node:path";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileToolEntry}from"#compiler/normalize-tool.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";import{EXTENSION_CAPABILITY_VERSIONS}from"#compiler/extension-compatibility.js";import{extensionUsesState}from"#internal/nitro/host/extension-state-usage.js";async function deriveExtensionCapabilityRequirements(r){let i=new Set([`extension`]),a={externalDependencies:r.runtimeDependencies},o=collectSubagentManifests(r.manifest),[s,c,l,u,d]=await Promise.all([Promise.all(o.flatMap(e=>e.tools.map(t=>compileToolEntry(e.agentRoot,t,a)))),Promise.all(o.flatMap(e=>e.skills.map(t=>compileSkillSource(e.agentRoot,t,a)))),Promise.all(o.flatMap(e=>e.instructions.map(n=>compileInstructionsEntry(e.agentRoot,n,a)))),loadAuthoredModuleNamespace(join(r.sourceRoot,r.declarationModule.logicalPath),{externalDependencies:r.runtimeDependencies}),extensionUsesState(r.sourceRoot)]);s.length>0&&i.add(`tool`),s.some(e=>e.kind===`dynamic-tool`)&&i.add(`dynamicTool`),o.some(e=>e.channels.length>0)&&i.add(`channel`),o.some(e=>e.connections.length>0)&&i.add(`connection`),o.some(e=>e.hooks.length>0)&&i.add(`hook`),o.some(e=>e.schedules.length>0)&&i.add(`schedule`),o.some(e=>e.subagents.length>0)&&i.add(`subagent`),c.length>0&&i.add(`skill`),c.some(e=>e.kind===`dynamic-skill`)&&i.add(`dynamicSkill`),l.length>0&&i.add(`instructions`),l.some(e=>e.kind===`dynamic-instructions`)&&i.add(`dynamicInstructions`);let f=u[r.declarationModule.exportName??`default`];return(typeof f==`function`||typeof f==`object`&&f)&&`schema`in f&&f.schema!==void 0&&i.add(`config`),d&&i.add(`state`),Object.fromEntries(Object.keys(EXTENSION_CAPABILITY_VERSIONS).filter(e=>i.has(e)).map(e=>[e,EXTENSION_CAPABILITY_VERSIONS[e]]))}function collectSubagentManifests(e){return[e,...e.subagents.flatMap(e=>collectSubagentManifests(e.manifest))]}export{deriveExtensionCapabilityRequirements};
1
+ import{join}from"node:path";import{createCompiledBindingNamespaceLoader}from"#compiler/load-binding-namespace.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileToolEntry}from"#compiler/normalize-tool.js";import{EXTENSION_CAPABILITY_VERSIONS}from"#compiler/extension-compatibility.js";import{extensionUsesState}from"#internal/nitro/host/extension-state-usage.js";async function deriveExtensionCapabilityRequirements(t){let s=new Set([`extension`]),c=collectSubagentManifests(t.manifest),[l,u,d,f,p]=await Promise.all([Promise.all(c.flatMap(e=>e.tools.map(n=>compileToolEntry(e.agentRoot,n,createLoadOptions(t,n,e.agentRoot))))),Promise.all(c.flatMap(e=>e.skills.map(n=>compileSkillSource(e.agentRoot,n,createLoadOptions(t,n,e.agentRoot))))),Promise.all(c.flatMap(e=>e.instructions.map(n=>compileInstructionsEntry(e.agentRoot,n,createLoadOptions(t,n,e.agentRoot))))),loadAuthoredModuleNamespace(join(t.sourceRoot,t.declarationModule.logicalPath),{externalDependencies:t.runtimeDependencies}),extensionUsesState(t.sourceRoot)]);l.length>0&&s.add(`tool`),l.some(e=>e.kind===`dynamic-tool`)&&s.add(`dynamicTool`),c.some(e=>e.channels.length>0)&&s.add(`channel`),c.some(e=>e.connections.length>0)&&s.add(`connection`),c.some(e=>e.hooks.length>0)&&s.add(`hook`),c.some(e=>e.schedules.length>0)&&s.add(`schedule`),c.some(e=>e.subagents.length>0)&&s.add(`subagent`),u.length>0&&s.add(`skill`),u.some(e=>e.kind===`dynamic-skill`)&&s.add(`dynamicSkill`),d.length>0&&s.add(`instructions`),d.some(e=>e.kind===`dynamic-instructions`)&&s.add(`dynamicInstructions`);let m=f[t.declarationModule.exportName??`default`];return(typeof m==`function`||typeof m==`object`&&m)&&`schema`in m&&m.schema!==void 0&&s.add(`config`),p&&s.add(`state`),Object.fromEntries(Object.keys(EXTENSION_CAPABILITY_VERSIONS).filter(e=>s.has(e)).map(e=>[e,EXTENSION_CAPABILITY_VERSIONS[e]]))}function createLoadOptions(n,r,i){let a={kind:`extension`,namespace:n.shortName,packageName:n.packageName},o={backing:{externalDependencies:n.runtimeDependencies,extensionScope:{namespace:n.shortName,sourceRoot:n.sourceRoot},kind:`filesystem`,sourcePath:join(i,r.logicalPath)},logicalPath:r.logicalPath,owner:a};return{binding:o,loadNamespace:createCompiledBindingNamespaceLoader({bindings:{[r.sourceId]:o},registries:[]}),owner:a}}function collectSubagentManifests(e){return[e,...e.subagents.flatMap(e=>collectSubagentManifests(e.manifest))]}export{deriveExtensionCapabilityRequirements};
@@ -1,2 +1,2 @@
1
- import{randomBytes}from"node:crypto";import{EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH}from"#protocol/routes.js";import{isLoopbackServerUrl}from"#shared/network-address.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveDiscoveryProject}from"#discover/project.js";import{eveDevArguments}from"#setup/primitives/index.js";import{detectPackageManager}from"#setup/package-manager.js";import{EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV,createDevelopmentSandboxRunId}from"#execution/sandbox/development-run.js";import{pruneLocalSandboxTemplatesInBackground,stopDevelopmentSandboxResources}from"#execution/sandbox/bindings/local.js";import{EVE_DEV_ENV_FLAG}from"#internal/application/optional-package-install.js";import{toErrorMessage}from"#shared/errors.js";import{startDevelopmentSandboxPrewarmInBackground}from"#execution/sandbox/development-prewarm.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{createDevelopmentApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{prepareDevelopmentApplicationHost}from"#internal/nitro/host/prepare-application-host.js";import{createDevelopmentNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{buildDevelopmentHostCandidate}from"#internal/nitro/host/dev-host-candidate.js";import{removeDevelopmentHostWorkspace}from"#internal/nitro/host/dev-host-workspace.js";import{DrainedNitroDevServer}from"#internal/nitro/host/drained-nitro-dev-server.js";import{activateDevelopmentGeneration,discardDevelopmentGeneration}from"#internal/nitro/development-generation.js";import{resolveNitroCompiledArtifactsSource}from"#internal/nitro/routes/runtime-artifacts.js";import{DEFAULT_DEVELOPMENT_SERVER_HOST,normalizeDevelopmentServerClientUrl}from"#internal/nitro/host/dev-server-url.js";import{createDevelopmentAuthoredRebuildCoordinator}from"#internal/nitro/host/dev-authored-rebuild-coordinator.js";import{DevelopmentServerState}from"#internal/nitro/host/dev-server-state.js";import{isEveServerHealthy}from"#shared/eve-server-health.js";import{handleDevRuntimeArtifactsRequest}from"#internal/nitro/routes/dev-runtime-artifacts.js";import{DEFAULT_DEVELOPMENT_SERVER_PORT,MAX_DEVELOPMENT_SERVER_PORT_ATTEMPTS}from"#internal/nitro/host/ports.js";import{createDevelopmentWorkflowWorld,installWorkflowLocalQueueEnvironment,installWorkflowTransportEnvironment}from"#internal/nitro/host/dev-workflow-world-setup.js";const MAX_ALLOWED_DEVELOPMENT_SERVER_PORT=65535,PORT_ENV=`PORT`;async function isActiveDevelopmentServerForApp(e){try{let t=await new DevelopmentServerState(await resolveDiscoveryProject(e.appRoot)).read();return t===void 0||!isLoopbackServerUrl(t)||!await isEveServerHealthy(t)?!1:new URL(t).origin===new URL(normalizeDevelopmentServerClientUrl(e.serverUrl)).origin}catch{return!1}}function isAddressInUseError(e){return e instanceof Error&&`code`in e&&e.code===`EADDRINUSE`}function resolveDevelopmentServerPort(e){let t=typeof e==`string`?Number(e):e??DEFAULT_DEVELOPMENT_SERVER_PORT;if(!Number.isInteger(t)||t<0||t>MAX_ALLOWED_DEVELOPMENT_SERVER_PORT)throw Error(`Invalid development server port "${String(e)}". Expected an integer between 0 and ${MAX_ALLOWED_DEVELOPMENT_SERVER_PORT}.`);return t}function readEnvironmentPort(){let e=process.env[PORT_ENV];if(e===void 0||e.trim()===``)return;let t=Number(e);if(!Number.isInteger(t)||t<0||t>MAX_ALLOWED_DEVELOPMENT_SERVER_PORT)throw Error(`Invalid ${PORT_ENV} environment variable "${e}". Expected an integer between 0 and ${MAX_ALLOWED_DEVELOPMENT_SERVER_PORT}.`);return t}async function detectDevelopmentCommandPackageManager(e){try{return(await detectPackageManager(e)).kind}catch{return`pnpm`}}async function formatDevelopmentServerConnectCommand(e,t){let n=await detectDevelopmentCommandPackageManager(e);return[n,...eveDevArguments(n),t].join(` `)}async function createDevelopmentServerAlreadyRunningError(e,t){let n=await formatDevelopmentServerConnectCommand(e,t);return Error([`A dev server is already running for this eve agent.`,`To connect to the existing instance, run: ${n}`].join(`
2
- `))}function resolveDevelopmentServerPorts(e){let t=resolveDevelopmentServerPort(e.port);if(t===0||!e.retryOnAddressInUse)return[t];let n=[];for(let e=0;e<MAX_DEVELOPMENT_SERVER_PORT_ATTEMPTS;e+=1){let r=t+e;if(r>65535)break;n.push(r)}return n}function addDevelopmentControlHandler(e){e.devServer.setControlHandler(async a=>{let o=await e.workflowWorld?.handleRequest(a);if(o!==void 0)return o;let s=new URL(a.url);if(s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH&&a.method===`GET`)return handleDevRuntimeArtifactsRequest({appRoot:e.appRoot});let c=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH&&a.method===`POST`,l=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH&&a.method===`POST`,u=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH&&(a.method===`GET`||a.method===`POST`);if(!c&&!l&&!u)return;let d=e.getWatcher();return d===void 0?Response.json({error:`The development server is still starting.`},{status:503}):c?(await d.suspend(),Response.json({suspended:!0})):l?(await d.resume({silent:s.searchParams.get(`silent`)===`1`}),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot})):(s.searchParams.get(`force`)===`1`?await d.rebuild():await d.flush(),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot}))})}async function closeDevelopmentServerResources(e){let t=[],attempt=async e=>{try{return await e(),!0}catch(e){return t.push(e),!1}},n=e.authoredSourceWatcher;n!==void 0&&await attempt(()=>n.close());let r=e.workflowWorld;r!==void 0&&await attempt(()=>r.close());let i=e.devServer,a=i===void 0||await attempt(()=>i.close()),o=e.nitro;return o!==void 0&&await attempt(()=>o.close()),await attempt(()=>stopDevelopmentSandboxResources({appRoot:e.appRoot,devRunId:e.developmentSandboxRunId,log:e=>console.warn(`[eve:dev] ${e}`)})),{errors:t,listenerClosed:a}}function createDevelopmentServerCleanupError(e){if(e.length!==0){if(e.length===1){let t=e[0];return t instanceof Error?t:Error(`Failed to close the development server: ${toErrorMessage(t)}`,{cause:t})}return AggregateError(e,`Multiple development-server resources failed to close.`)}}function createDevelopmentServerStartupCleanupError(e,t){return AggregateError([e,...t],`${toErrorMessage(e)} Cleanup also failed.`,{cause:e})}async function listenForDevelopmentServer(e){let t=resolveDevelopmentServerPorts({port:e.port,retryOnAddressInUse:e.retryOnAddressInUse}),n;for(let r of t){let t=e.devServer.listen({hostname:e.host,port:r});try{return await t.ready(),t}catch(r){if(n=r,await t.close().catch(()=>{}),!isAddressInUseError(r)||!e.retryOnAddressInUse)throw r}}throw Error(`Failed to start Nitro dev server after ${t.length} attempts. Tried ports ${t.join(`, `)}.`,{cause:n})}async function startNitroDevelopmentServer(t,n){process.env[EVE_DEV_ENV_FLAG]??=`1`;let r=await resolveDiscoveryProject(t);loadDevelopmentEnvironmentFiles(r.appRoot);let i=readEnvironmentPort(),c=n.port??i,l=n.host!==void 0||n.port!==void 0||i!==void 0,f=new DevelopmentServerState(r),m=await f.read();if(m!==void 0&&isLoopbackServerUrl(m)&&await isEveServerHealthy(m)){if(n.existing===`attach-if-unconfigured`&&!l)return{handle:{kind:`existing`,appRoot:r.appRoot,url:m},close:void 0};throw await createDevelopmentServerAlreadyRunningError(r.appRoot,m)}let v=process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV],y=createDevelopmentSandboxRunId();process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=y;let b,x,S,C,w,T,E,D=!1,O=!1;try{let t=await devBootPhase(`compiling agent`,()=>prepareDevelopmentApplicationHost(r.appRoot),n.onBootProgress);E=t;let i=resolveNitroCompiledArtifactsSource(createDevelopmentNitroArtifactsConfig({appRoot:t.appRoot,configuredWorld:t.compileResult.manifest.config.experimental?.workflow?.world}));pruneLocalSandboxTemplatesInBackground(t.appRoot);let a=await devBootPhase(`creating dev server`,()=>createDevelopmentApplicationNitro(t),n.onBootProgress);b=a,x=new DrainedNitroDevServer(a.logger);let o=x,s=randomBytes(32).toString(`base64url`);o.setClientAddressSecret(s),C=installWorkflowTransportEnvironment(r.appRoot,s),w=createDevelopmentWorkflowWorld({appRoot:r.appRoot,preparedHost:t,transportSecret:s}),addDevelopmentControlHandler({appRoot:r.appRoot,devServer:o,getWatcher:()=>T,workflowWorld:w});let l=n.host??a.options.devServer.hostname??DEFAULT_DEVELOPMENT_SERVER_HOST,u=c===void 0,d=await devBootPhase(`binding port`,()=>listenForDevelopmentServer({devServer:o,host:l,port:c,retryOnAddressInUse:u}),n.onBootProgress);if(!d.url)throw Error(`Nitro dev server did not expose a URL.`);let p=normalizeDevelopmentServerClientUrl(d.url);S=installWorkflowLocalQueueEnvironment(p),await devBootPhase(`building dev bundle`,async()=>{let e=await buildDevelopmentHostCandidate({host:t,nitro:a});b=void 0;let n=t.workspace;O=!0,await o.replaceWorker({dispose:async()=>await removeDevelopmentHostWorkspace(n),entry:e.entry,workerData:e.workerData}),await activateDevelopmentGeneration({appRoot:t.appRoot,generation:t.generation}),D=!0},n.onBootProgress),await w?.start(),startDevelopmentSandboxPrewarmInBackground({appRoot:t.appRoot,compiledArtifactsSource:i});let m=await createDevelopmentAuthoredRebuildCoordinator({devServer:o,initialHost:t});T=await devBootPhase(`starting file watcher`,async()=>{let{startAuthoredSourceWatcher:e}=await import(`#internal/nitro/host/dev-authored-source-watcher.js`);return e({coordinator:m,preparedHost:t})},n.onBootProgress),await f.write(p);let h=S;if(h===void 0)throw Error(`Workflow local queue environment was not initialized.`);let g=T,_=x,k=w,A=C,j;return{handle:{kind:`started`,appRoot:r.appRoot,url:p},close:()=>(j??=(async()=>{let e=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:g,devServer:_,developmentSandboxRunId:y,nitro:void 0,workflowWorld:k});e.listenerClosed&&await f.remove().catch(()=>{});try{let t=createDevelopmentServerCleanupError(e.errors);if(t!==void 0)throw t}finally{h(),A?.(),restoreDevelopmentSandboxRunId(v)}})(),j)}}catch(e){let t=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:T,devServer:x,developmentSandboxRunId:y,nitro:b,workflowWorld:w}),n=[...t.errors];throw E!==void 0&&!D&&await discardDevelopmentGeneration(E.generation).catch(e=>{n.push(e)}),E!==void 0&&!O&&await removeDevelopmentHostWorkspace(E.workspace).catch(e=>{n.push(e)}),S?.(),C?.(),t.listenerClosed&&await f.remove().catch(()=>{}),restoreDevelopmentSandboxRunId(v),n.length>0?createDevelopmentServerStartupCleanupError(e,n):e}}function createDevelopmentServer(e,t={}){let n,r;return{start(){if(n!==void 0)throw Error(`DevelopmentServer.start() was already called.`);return n=startNitroDevelopmentServer(e,t).then(({handle:e,close:t})=>(r=t,e)),n},async close(){n!==void 0&&(await n.catch(()=>void 0),await r?.())}}}function restoreDevelopmentSandboxRunId(e){if(e===void 0){delete process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV];return}process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=e}export{createDevelopmentServer,isActiveDevelopmentServerForApp,normalizeDevelopmentServerClientUrl};
1
+ import{randomBytes}from"node:crypto";import{EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH}from"#protocol/routes.js";import{isLoopbackServerUrl}from"#shared/network-address.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveDiscoveryProject}from"#discover/project.js";import{eveDevArguments}from"#setup/primitives/index.js";import{detectPackageManager}from"#setup/package-manager.js";import{EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV,createDevelopmentSandboxRunId}from"#execution/sandbox/development-run.js";import{pruneLocalSandboxTemplatesInBackground,stopDevelopmentSandboxResources}from"#execution/sandbox/bindings/local.js";import{EVE_DEV_ENV_FLAG}from"#internal/application/optional-package-install.js";import{toErrorMessage}from"#shared/errors.js";import{startDevelopmentSandboxPrewarmInBackground}from"#execution/sandbox/development-prewarm.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{readDevelopmentRuntimeArtifactsRevision}from"#services/dev-client/runtime-artifacts.js";import{createDevelopmentApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{prepareDevelopmentApplicationHost}from"#internal/nitro/host/prepare-application-host.js";import{createDevelopmentNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{buildDevelopmentHostCandidate}from"#internal/nitro/host/dev-host-candidate.js";import{removeDevelopmentHostWorkspace}from"#internal/nitro/host/dev-host-workspace.js";import{DrainedNitroDevServer}from"#internal/nitro/host/drained-nitro-dev-server.js";import{activateDevelopmentGeneration,discardDevelopmentGeneration}from"#internal/nitro/development-generation.js";import{resolveNitroCompiledArtifactsSource}from"#internal/nitro/routes/runtime-artifacts.js";import{DEFAULT_DEVELOPMENT_SERVER_HOST,normalizeDevelopmentServerClientUrl}from"#internal/nitro/host/dev-server-url.js";import{createDevelopmentAuthoredRebuildCoordinator}from"#internal/nitro/host/dev-authored-rebuild-coordinator.js";import{DevelopmentServerState}from"#internal/nitro/host/dev-server-state.js";import{handleDevRuntimeArtifactsRequest}from"#internal/nitro/routes/dev-runtime-artifacts.js";import{DEFAULT_DEVELOPMENT_SERVER_PORT,MAX_DEVELOPMENT_SERVER_PORT_ATTEMPTS}from"#internal/nitro/host/ports.js";import{createDevelopmentWorkflowWorld,installWorkflowLocalQueueEnvironment,installWorkflowTransportEnvironment}from"#internal/nitro/host/dev-workflow-world-setup.js";const MAX_ALLOWED_DEVELOPMENT_SERVER_PORT=65535,PORT_ENV=`PORT`;async function isActiveDevelopmentServerForApp(e){try{let t=await new DevelopmentServerState(await resolveDiscoveryProject(e.appRoot)).read();return t===void 0||!isLoopbackServerUrl(t)||!await isDevelopmentServerReady(t)?!1:new URL(t).origin===new URL(normalizeDevelopmentServerClientUrl(e.serverUrl)).origin}catch{return!1}}async function isDevelopmentServerReady(e){return await readDevelopmentRuntimeArtifactsRevision({serverUrl:e,timeoutMs:1e3})!==void 0}function isAddressInUseError(e){return e instanceof Error&&`code`in e&&e.code===`EADDRINUSE`}function resolveDevelopmentServerPort(e){let t=typeof e==`string`?Number(e):e??DEFAULT_DEVELOPMENT_SERVER_PORT;if(!Number.isInteger(t)||t<0||t>MAX_ALLOWED_DEVELOPMENT_SERVER_PORT)throw Error(`Invalid development server port "${String(e)}". Expected an integer between 0 and ${MAX_ALLOWED_DEVELOPMENT_SERVER_PORT}.`);return t}function readEnvironmentPort(){let e=process.env[PORT_ENV];if(e===void 0||e.trim()===``)return;let t=Number(e);if(!Number.isInteger(t)||t<0||t>MAX_ALLOWED_DEVELOPMENT_SERVER_PORT)throw Error(`Invalid ${PORT_ENV} environment variable "${e}". Expected an integer between 0 and ${MAX_ALLOWED_DEVELOPMENT_SERVER_PORT}.`);return t}async function detectDevelopmentCommandPackageManager(e){try{return(await detectPackageManager(e)).kind}catch{return`pnpm`}}async function formatDevelopmentServerConnectCommand(e,t){let n=await detectDevelopmentCommandPackageManager(e);return[n,...eveDevArguments(n),t].join(` `)}async function createDevelopmentServerAlreadyRunningError(e,t){let n=await formatDevelopmentServerConnectCommand(e,t);return Error([`A dev server is already running for this eve agent.`,`To connect to the existing instance, run: ${n}`].join(`
2
+ `))}function resolveDevelopmentServerPorts(e){let t=resolveDevelopmentServerPort(e.port);if(t===0||!e.retryOnAddressInUse)return[t];let n=[];for(let e=0;e<MAX_DEVELOPMENT_SERVER_PORT_ATTEMPTS;e+=1){let r=t+e;if(r>65535)break;n.push(r)}return n}function addDevelopmentControlHandler(e){e.devServer.setControlHandler(async a=>{let o=await e.workflowWorld?.handleRequest(a);if(o!==void 0)return o;let s=new URL(a.url);if(s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH&&a.method===`GET`)return handleDevRuntimeArtifactsRequest({appRoot:e.appRoot});let c=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH&&a.method===`POST`,l=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH&&a.method===`POST`,u=s.pathname===EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH&&(a.method===`GET`||a.method===`POST`);if(!c&&!l&&!u)return;let d=e.getWatcher();return d===void 0?Response.json({error:`The development server is still starting.`},{status:503}):c?(await d.suspend(),Response.json({suspended:!0})):l?(await d.resume({silent:s.searchParams.get(`silent`)===`1`}),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot})):(s.searchParams.get(`force`)===`1`?await d.rebuild():await d.flush(),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot}))})}async function closeDevelopmentServerResources(e){let t=[],attempt=async e=>{try{return await e(),!0}catch(e){return t.push(e),!1}},n=e.authoredSourceWatcher;n!==void 0&&await attempt(()=>n.close());let r=e.workflowWorld;r!==void 0&&await attempt(()=>r.close());let i=e.devServer,a=i===void 0||await attempt(()=>i.close()),o=e.nitro;return o!==void 0&&await attempt(()=>o.close()),await attempt(()=>stopDevelopmentSandboxResources({appRoot:e.appRoot,devRunId:e.developmentSandboxRunId,log:e=>console.warn(`[eve:dev] ${e}`)})),{errors:t,listenerClosed:a}}function createDevelopmentServerCleanupError(e){if(e.length!==0){if(e.length===1){let t=e[0];return t instanceof Error?t:Error(`Failed to close the development server: ${toErrorMessage(t)}`,{cause:t})}return AggregateError(e,`Multiple development-server resources failed to close.`)}}function createDevelopmentServerStartupCleanupError(e,t){return AggregateError([e,...t],`${toErrorMessage(e)} Cleanup also failed.`,{cause:e})}async function listenForDevelopmentServer(e){let t=resolveDevelopmentServerPorts({port:e.port,retryOnAddressInUse:e.retryOnAddressInUse}),n;for(let r of t){let t=e.devServer.listen({hostname:e.host,port:r});try{return await t.ready(),t}catch(r){if(n=r,await t.close().catch(()=>{}),!isAddressInUseError(r)||!e.retryOnAddressInUse)throw r}}throw Error(`Failed to start Nitro dev server after ${t.length} attempts. Tried ports ${t.join(`, `)}.`,{cause:n})}async function startNitroDevelopmentServer(t,n){process.env[EVE_DEV_ENV_FLAG]??=`1`;let r=await resolveDiscoveryProject(t);loadDevelopmentEnvironmentFiles(r.appRoot);let i=readEnvironmentPort(),c=n.port??i,l=n.host!==void 0||n.port!==void 0||i!==void 0,f=new DevelopmentServerState(r),m=await f.read();if(m!==void 0&&isLoopbackServerUrl(m)&&await isDevelopmentServerReady(m)){if(n.existing===`attach-if-unconfigured`&&!l)return{handle:{kind:`existing`,appRoot:r.appRoot,url:m},close:void 0};throw await createDevelopmentServerAlreadyRunningError(r.appRoot,m)}let h=process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV],v=createDevelopmentSandboxRunId();process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=v;let y,b,x,S,C,w,T,E=!1,D=!1;try{let t=await devBootPhase(`compiling agent`,()=>prepareDevelopmentApplicationHost(r.appRoot),n.onBootProgress);T=t;let i=resolveNitroCompiledArtifactsSource(createDevelopmentNitroArtifactsConfig({appRoot:t.appRoot,configuredWorld:t.compileResult.manifest.config.experimental?.workflow?.world}));pruneLocalSandboxTemplatesInBackground(t.appRoot);let a=await devBootPhase(`creating dev server`,()=>createDevelopmentApplicationNitro(t),n.onBootProgress);y=a,b=new DrainedNitroDevServer(a.logger);let o=b,s=randomBytes(32).toString(`base64url`);o.setClientAddressSecret(s),S=installWorkflowTransportEnvironment(r.appRoot,s),C=createDevelopmentWorkflowWorld({appRoot:r.appRoot,preparedHost:t,transportSecret:s}),addDevelopmentControlHandler({appRoot:r.appRoot,devServer:o,getWatcher:()=>w,workflowWorld:C});let l=n.host??a.options.devServer.hostname??DEFAULT_DEVELOPMENT_SERVER_HOST,u=c===void 0,d=await devBootPhase(`binding port`,()=>listenForDevelopmentServer({devServer:o,host:l,port:c,retryOnAddressInUse:u}),n.onBootProgress);if(!d.url)throw Error(`Nitro dev server did not expose a URL.`);let p=normalizeDevelopmentServerClientUrl(d.url);x=installWorkflowLocalQueueEnvironment(p),await devBootPhase(`building dev bundle`,async()=>{let e=await buildDevelopmentHostCandidate({host:t,nitro:a});y=void 0;let n=t.workspace;D=!0,await o.replaceWorker({dispose:async()=>await removeDevelopmentHostWorkspace(n),entry:e.entry,workerData:e.workerData}),await activateDevelopmentGeneration({appRoot:t.appRoot,generation:t.generation}),E=!0},n.onBootProgress),await C?.start(),startDevelopmentSandboxPrewarmInBackground({appRoot:t.appRoot,compiledArtifactsSource:i});let m=await createDevelopmentAuthoredRebuildCoordinator({devServer:o,initialHost:t});w=await devBootPhase(`starting file watcher`,async()=>{let{startAuthoredSourceWatcher:e}=await import(`#internal/nitro/host/dev-authored-source-watcher.js`);return e({coordinator:m,preparedHost:t})},n.onBootProgress),await f.write(p);let g=x;if(g===void 0)throw Error(`Workflow local queue environment was not initialized.`);let _=w,O=b,k=C,A=S,j;return{handle:{kind:`started`,appRoot:r.appRoot,url:p},close:()=>(j??=(async()=>{let e=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:_,devServer:O,developmentSandboxRunId:v,nitro:void 0,workflowWorld:k});e.listenerClosed&&await f.remove().catch(()=>{});try{let t=createDevelopmentServerCleanupError(e.errors);if(t!==void 0)throw t}finally{g(),A?.(),restoreDevelopmentSandboxRunId(h)}})(),j)}}catch(e){let t=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:w,devServer:b,developmentSandboxRunId:v,nitro:y,workflowWorld:C}),n=[...t.errors];throw T!==void 0&&!E&&await discardDevelopmentGeneration(T.generation).catch(e=>{n.push(e)}),T!==void 0&&!D&&await removeDevelopmentHostWorkspace(T.workspace).catch(e=>{n.push(e)}),x?.(),S?.(),t.listenerClosed&&await f.remove().catch(()=>{}),restoreDevelopmentSandboxRunId(h),n.length>0?createDevelopmentServerStartupCleanupError(e,n):e}}function createDevelopmentServer(e,t={}){let n,r;return{start(){if(n!==void 0)throw Error(`DevelopmentServer.start() was already called.`);return n=startNitroDevelopmentServer(e,t).then(({handle:e,close:t})=>(r=t,e)),n},async close(){n!==void 0&&(await n.catch(()=>void 0),await r?.())}}}function restoreDevelopmentSandboxRunId(e){if(e===void 0){delete process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV];return}process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=e}export{createDevelopmentServer,isActiveDevelopmentServerForApp,normalizeDevelopmentServerClientUrl};
@@ -1,3 +1,3 @@
1
- import{EVE_HEALTH_ROUTE_PATH}from"#protocol/routes.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{join,resolve}from"node:path";import{existsSync}from"node:fs";import{spawn}from"node:child_process";import{setTimeout}from"node:timers/promises";import{prewarmBuiltAppSandboxes}from"#execution/sandbox/prewarm.js";import{createServer}from"node:net";const HEALTH_TIMEOUT_MS=6e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,WILDCARD_LISTEN_HOSTNAMES=new Set([`[::]`,`::`,`0.0.0.0`]);function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function isAddressInUseError(e){return e instanceof Error&&`code`in e&&e.code===`EADDRINUSE`}function resolveOutputServerEntry(e){return join(resolve(e),`.output`,`server`,`index.mjs`)}function readEnvironmentPort(){let e=process.env.PORT;if(e===void 0||e.trim()===``)return;let t=Number(e);if(!Number.isInteger(t)||t<0||t>65535)throw Error(`Invalid PORT environment variable "${e}". Expected an integer between 0 and 65535.`);return t}function normalizeServerClientUrl(e){let t=new URL(e);return WILDCARD_LISTEN_HOSTNAMES.has(t.hostname)&&(t.hostname=`127.0.0.1`),t.toString()}function formatClientHost(e){return WILDCARD_LISTEN_HOSTNAMES.has(e)?`127.0.0.1`:e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}function createKnownPortUrl(e){return`http://${formatClientHost(e.host)}:${String(e.port)}/`}async function resolveListenPort(e){if(e.port!==0)return e.port;let t=createServer();return await new Promise((n,r)=>{t.once(`error`,r),t.listen(0,e.host,()=>{let e=t.address();t.close(t=>{if(t){r(t);return}if(e===null||typeof e==`string`){r(Error(`Failed to resolve an available port for eve start.`));return}n(e.port)})})})}function parseServerUrlFromOutput(e){let t=LOCAL_SERVER_URL_PATTERN.exec(e);if(t!==null)return normalizeServerClientUrl(t[0])}async function waitForHealth(t){let{child:n,url:r}=t,i=new URL(EVE_HEALTH_ROUTE_PATH,r).toString(),a=Date.now()+HEALTH_TIMEOUT_MS;for(;Date.now()<a;){let e=t.getStartError();if(e!==void 0)throw e;if(n.exitCode!==null||n.signalCode!==null)throw Error(`Built server process exited (code=${String(n.exitCode)}, signal=${String(n.signalCode)}) before becoming healthy.`);try{if((await fetch(i,{signal:AbortSignal.timeout(2e3)})).ok)return new URL(r).toString()}catch(e){if(isAddressInUseError(e))throw e}await setTimeout(250)}throw Error(`Built server did not become healthy within ${HEALTH_TIMEOUT_MS/1e3}s at ${i}.`)}async function waitForReady(e){let t=Date.now()+HEALTH_TIMEOUT_MS;for(;Date.now()<t;){let t=e.getStartError();if(t!==void 0)throw t;let n=parseServerUrlFromOutput(e.getOutput())??e.knownUrl;if(n!==void 0)return await waitForHealth({child:e.child,getStartError:e.getStartError,url:n});if(e.child.exitCode!==null||e.child.signalCode!==null)throw Error(`Built server process exited (code=${String(e.child.exitCode)}, signal=${String(e.child.signalCode)}) before printing its URL.`);await setTimeout(250)}throw Error([`Built server did not become ready within ${HEALTH_TIMEOUT_MS/1e3}s.`,`Output:`,e.getOutput()].join(`
2
- `))}async function terminate(e){e.exitCode!==null||e.killed||(e.kill(`SIGTERM`),await Promise.race([once(e,`exit`),setTimeout(2e4).then(()=>`timeout`)])===`timeout`&&e.exitCode===null&&(e.kill(`SIGKILL`),await once(e,`exit`)),e.stdout?.destroy(),e.stderr?.destroy())}function once(e,t){return new Promise(n=>{e.once(t,()=>n())})}async function startProductionServer(e,n={}){let o=resolve(e),s=resolveOutputServerEntry(o);if(!existsSync(s))throw Error(`Missing eve build output at ${s}. Run "eve build" before "eve start".`);loadDevelopmentEnvironmentFiles(o),await prewarmBuiltAppSandboxes({appRoot:o,log:e=>console.log(e)});let c=n.host??`0.0.0.0`,l=await resolveListenPort({host:c,port:n.port??readEnvironmentPort()??3e3}),u=createKnownPortUrl({host:c,port:l}),d=``,f=!1,p,m=spawn(process.execPath,[s],{cwd:o,env:{...process.env,HOST:c,NITRO_HOST:c,NITRO_PORT:String(l),PORT:String(l)},stdio:[`ignore`,`pipe`,`pipe`]});m.stdout?.on(`data`,e=>{d+=e.toString(`utf8`),process.stdout.write(e)}),m.stderr?.on(`data`,e=>{d+=e.toString(`utf8`),process.stderr.write(e)});let h=new Promise((e,t)=>{m.once(`error`,e=>{p=e,t(e)}),m.once(`exit`,(n,r)=>{if(f||n===0){e();return}t(Error([`Built server process exited unexpectedly (code=${String(n)}, signal=${String(r)}).`,d].join(`
3
- `)))})});h.catch(()=>void 0);try{return{async close(){f=!0,await terminate(m)},url:await waitForReady({child:m,getStartError:()=>p,getOutput:()=>d,knownUrl:u}),async wait(){await h}}}catch(e){throw f=!0,await terminate(m),isRecord(e)&&e.name===`AbortError`?Error(`Timed out waiting for built eve server to respond.`,{cause:e}):e}}export{startProductionServer};
1
+ import{createConnection,createServer}from"node:net";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{join,resolve}from"node:path";import{existsSync}from"node:fs";import{spawn}from"node:child_process";import{setTimeout}from"node:timers/promises";import{prewarmBuiltAppSandboxes}from"#execution/sandbox/prewarm.js";const HEALTH_TIMEOUT_MS=6e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,WILDCARD_LISTEN_HOSTNAMES=new Set([`[::]`,`::`,`0.0.0.0`]);function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveOutputServerEntry(e){return join(resolve(e),`.output`,`server`,`index.mjs`)}function readEnvironmentPort(){let e=process.env.PORT;if(e===void 0||e.trim()===``)return;let t=Number(e);if(!Number.isInteger(t)||t<0||t>65535)throw Error(`Invalid PORT environment variable "${e}". Expected an integer between 0 and 65535.`);return t}function normalizeServerClientUrl(e){let t=new URL(e);return WILDCARD_LISTEN_HOSTNAMES.has(t.hostname)&&(t.hostname=`127.0.0.1`),t.toString()}function formatClientHost(e){return WILDCARD_LISTEN_HOSTNAMES.has(e)?`127.0.0.1`:e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}function createKnownPortUrl(e){return`http://${formatClientHost(e.host)}:${String(e.port)}/`}async function resolveListenPort(e){if(e.port!==0)return e.port;let n=createServer();return await new Promise((t,r)=>{n.once(`error`,r),n.listen(0,e.host,()=>{let e=n.address();n.close(n=>{if(n){r(n);return}if(e===null||typeof e==`string`){r(Error(`Failed to resolve an available port for eve start.`));return}t(e.port)})})})}function parseServerUrlFromOutput(e){let t=LOCAL_SERVER_URL_PATTERN.exec(e);if(t!==null)return normalizeServerClientUrl(t[0])}async function isListening(t){let n=new URL(t),r=Number(n.port||(n.protocol===`https:`?443:80));return await new Promise(t=>{let i=createConnection({host:n.hostname,port:r}),finish=e=>{i.destroy(),t(e)};i.setTimeout(2e3,()=>finish(!1)),i.once(`connect`,()=>finish(!0)),i.once(`error`,()=>finish(!1))})}async function waitForReady(e){let t=Date.now()+HEALTH_TIMEOUT_MS;for(;Date.now()<t;){let t=e.getStartError();if(t!==void 0)throw t;let n=parseServerUrlFromOutput(e.getOutput()),r=n??e.knownUrl;if(r!==void 0&&(n!==void 0||await isListening(r)))return new URL(r).toString();if(e.child.exitCode!==null||e.child.signalCode!==null)throw Error(`Built server process exited (code=${String(e.child.exitCode)}, signal=${String(e.child.signalCode)}) before printing its URL.`);await setTimeout(250)}throw Error([`Built server did not become ready within ${HEALTH_TIMEOUT_MS/1e3}s.`,`Output:`,e.getOutput()].join(`
2
+ `))}async function terminate(e){e.exitCode!==null||e.killed||(e.kill(`SIGTERM`),await Promise.race([once(e,`exit`),setTimeout(2e4).then(()=>`timeout`)])===`timeout`&&e.exitCode===null&&(e.kill(`SIGKILL`),await once(e,`exit`)),e.stdout?.destroy(),e.stderr?.destroy())}function once(e,t){return new Promise(n=>{e.once(t,()=>n())})}async function startProductionServer(e,t={}){let r=resolve(e),a=resolveOutputServerEntry(r);if(!existsSync(a))throw Error(`Missing eve build output at ${a}. Run "eve build" before "eve start".`);loadDevelopmentEnvironmentFiles(r),await prewarmBuiltAppSandboxes({appRoot:r,log:e=>console.log(e)});let o=t.host??`0.0.0.0`,s=await resolveListenPort({host:o,port:t.port??readEnvironmentPort()??3e3}),c=createKnownPortUrl({host:o,port:s}),l=``,u=!1,d,f=spawn(process.execPath,[a],{cwd:r,env:{...process.env,HOST:o,NITRO_HOST:o,NITRO_PORT:String(s),PORT:String(s)},stdio:[`ignore`,`pipe`,`pipe`]});f.stdout?.on(`data`,e=>{l+=e.toString(`utf8`),process.stdout.write(e)}),f.stderr?.on(`data`,e=>{l+=e.toString(`utf8`),process.stderr.write(e)});let p=new Promise((e,t)=>{f.once(`error`,e=>{d=e,t(e)}),f.once(`exit`,(n,r)=>{if(u||n===0){e();return}t(Error([`Built server process exited unexpectedly (code=${String(n)}, signal=${String(r)}).`,l].join(`
3
+ `)))})});p.catch(()=>void 0);try{return{async close(){u=!0,await terminate(f)},url:await waitForReady({child:f,getStartError:()=>d,getOutput:()=>l,knownUrl:c}),async wait(){await p}}}catch(e){throw u=!0,await terminate(f),isRecord(e)&&e.name===`AbortError`?Error(`Timed out waiting for built eve server to respond.`,{cause:e}):e}}export{startProductionServer};