eve 0.66.3 → 0.67.1

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 (409) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/src/channel/channel-address.d.ts +0 -2
  3. package/dist/src/channel/channel-address.js +1 -1
  4. package/dist/src/channel/channel-operations.d.ts +0 -5
  5. package/dist/src/channel/channel-operations.js +1 -1
  6. package/dist/src/channel/compiled-channel.d.ts +8 -0
  7. package/dist/src/channel/compiled-channel.js +2 -2
  8. package/dist/src/channel/conversation-context.js +1 -1
  9. package/dist/src/channel/routes.d.ts +1 -2
  10. package/dist/src/channel/schedule-auth.d.ts +0 -2
  11. package/dist/src/channel/schedule-auth.js +1 -1
  12. package/dist/src/channel/schedule.d.ts +2 -2
  13. package/dist/src/channel/schedule.js +1 -1
  14. package/dist/src/channel/types.d.ts +8 -13
  15. package/dist/src/chunks/{use-eve-agent-Di1u2zKu.js → use-eve-agent-D4HVZBjn.js} +1 -6
  16. package/dist/src/chunks/{use-eve-agent-PbSMyJ6e.js → use-eve-agent-DXcE_8Ja.js} +1 -6
  17. package/dist/src/cli/acp/command.js +3 -3
  18. package/dist/src/cli/application-root.d.ts +0 -2
  19. package/dist/src/cli/application-root.js +1 -1
  20. package/dist/src/cli/commands/agent-instructions.d.ts +0 -4
  21. package/dist/src/cli/commands/agent-instructions.js +3 -3
  22. package/dist/src/cli/commands/extension-init.js +1 -1
  23. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  24. package/dist/src/cli/commands/init-project.d.ts +0 -1
  25. package/dist/src/cli/commands/init-project.js +1 -1
  26. package/dist/src/cli/commands/init.js +1 -1
  27. package/dist/src/cli/commands/logs.d.ts +3 -3
  28. package/dist/src/cli/commands/logs.js +1 -1
  29. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  30. package/dist/src/cli/commands/trace.js +1 -1
  31. package/dist/src/cli/dev/command.d.ts +9 -5
  32. package/dist/src/cli/dev/command.js +1 -3
  33. package/dist/src/cli/dev/diagnostic-dump.js +1 -1
  34. package/dist/src/cli/dev/environment.js +1 -1
  35. package/dist/src/cli/dev/run-interactive-ui.d.ts +0 -1
  36. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  37. package/dist/src/cli/dev/tui/blocks.js +1 -1
  38. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  39. package/dist/src/cli/dev/tui/question-panel.d.ts +4 -4
  40. package/dist/src/cli/dev/tui/question-panel.js +1 -1
  41. package/dist/src/cli/dev/tui/runner.d.ts +0 -1
  42. package/dist/src/cli/dev/tui/runner.js +2 -2
  43. package/dist/src/cli/dev/tui/terminal-renderer.js +8 -9
  44. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  45. package/dist/src/cli/dev/url-target.js +1 -1
  46. package/dist/src/cli/invoke/command.d.ts +2 -5
  47. package/dist/src/cli/invoke/command.js +1 -1
  48. package/dist/src/cli/invoke/invoke.d.ts +2 -2
  49. package/dist/src/cli/invoke/invoke.js +1 -1
  50. package/dist/src/cli/invoke/result.d.ts +14 -194
  51. package/dist/src/cli/invoke/result.js +1 -1
  52. package/dist/src/cli/run.d.ts +0 -4
  53. package/dist/src/cli/run.js +2 -2
  54. package/dist/src/cli/telemetry/index.js +1 -1
  55. package/dist/src/cli/ui/output.d.ts +0 -15
  56. package/dist/src/cli/ui/output.js +2 -5
  57. package/dist/src/client/eve-agent-store.js +1 -1
  58. package/dist/src/client/message-reducer.js +1 -1
  59. package/dist/src/compiled/.vendor-stamp.json +1 -1
  60. package/dist/src/compiler/artifacts.js +1 -1
  61. package/dist/src/compiler/compile-agent.js +1 -1
  62. package/dist/src/compiler/compile-from-memory.d.ts +0 -1
  63. package/dist/src/compiler/compile-from-memory.js +1 -1
  64. package/dist/src/compiler/extension-compatibility.d.ts +25 -18
  65. package/dist/src/compiler/extension-compatibility.js +1 -1
  66. package/dist/src/compiler/manifest.d.ts +48 -14
  67. package/dist/src/compiler/manifest.js +1 -1
  68. package/dist/src/compiler/normalize-agent-config.js +1 -1
  69. package/dist/src/compiler/normalize-channel.js +1 -1
  70. package/dist/src/compiler/normalize-connection.js +1 -1
  71. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  72. package/dist/src/compiler/normalize-subagent.d.ts +0 -2
  73. package/dist/src/compiler/normalize-subagent.js +1 -1
  74. package/dist/src/compiler/remote-agent-node.d.ts +0 -2
  75. package/dist/src/compiler/remote-agent-node.js +1 -1
  76. package/dist/src/compiler/workspace-resources.js +1 -1
  77. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  78. package/dist/src/context/keys.d.ts +0 -3
  79. package/dist/src/context/keys.js +1 -1
  80. package/dist/src/context/memory-lifecycle.d.ts +1 -0
  81. package/dist/src/context/memory-lifecycle.js +1 -1
  82. package/dist/src/discover/diagnostics.d.ts +0 -4
  83. package/dist/src/discover/diagnostics.js +1 -1
  84. package/dist/src/discover/project.js +1 -1
  85. package/dist/src/eve-channel/create-request.d.ts +0 -3
  86. package/dist/src/eve-channel/create-request.js +1 -1
  87. package/dist/src/eve-channel/index.js +1 -1
  88. package/dist/src/eve-channel/request.js +1 -1
  89. package/dist/src/eve-channel/types.d.ts +1 -1
  90. package/dist/src/execution/delegated-session-context.d.ts +2 -0
  91. package/dist/src/execution/delegated-session-context.js +1 -0
  92. package/dist/src/execution/dynamic-connections.d.ts +4 -1
  93. package/dist/src/execution/dynamic-connections.js +1 -1
  94. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  95. package/dist/src/execution/effective-agent-config.js +1 -1
  96. package/dist/src/execution/legacy-session/input.d.ts +0 -2
  97. package/dist/src/execution/legacy-session/input.js +1 -1
  98. package/dist/src/execution/legacy-session/prepare-step.d.ts +0 -1
  99. package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
  100. package/dist/src/execution/node-step.d.ts +4 -2
  101. package/dist/src/execution/node-step.js +1 -1
  102. package/dist/src/execution/proxied-deliver-step.js +1 -1
  103. package/dist/src/execution/publish-channel-event.d.ts +23 -0
  104. package/dist/src/execution/publish-channel-event.js +1 -0
  105. package/dist/src/execution/runtime-context.js +1 -1
  106. package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
  107. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  108. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  109. package/dist/src/execution/session/entry.js +1 -1
  110. package/dist/src/execution/session/event-sink.d.ts +1 -1
  111. package/dist/src/execution/session/event-sink.js +1 -1
  112. package/dist/src/execution/session/finalization.d.ts +1 -4
  113. package/dist/src/execution/session/finalization.js +1 -1
  114. package/dist/src/execution/session/handoff.d.ts +1 -3
  115. package/dist/src/execution/session/handoff.js +1 -1
  116. package/dist/src/execution/session/input-queue.d.ts +0 -1
  117. package/dist/src/execution/session/input-queue.js +1 -1
  118. package/dist/src/execution/session/next-input.d.ts +0 -1
  119. package/dist/src/execution/session/next-input.js +1 -1
  120. package/dist/src/execution/session/program.d.ts +0 -3
  121. package/dist/src/execution/session/program.js +1 -1
  122. package/dist/src/execution/session/turn-step-result.d.ts +1 -2
  123. package/dist/src/execution/session/turn-step-result.js +1 -1
  124. package/dist/src/execution/session/turn-step.js +1 -1
  125. package/dist/src/execution/session/turn.d.ts +2 -2
  126. package/dist/src/execution/session/turn.js +1 -1
  127. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  128. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  129. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  130. package/dist/src/execution/tools/agent-router.d.ts +0 -2
  131. package/dist/src/execution/tools/agent-router.js +1 -1
  132. package/dist/src/execution/tools/ask-question-workflow.js +1 -1
  133. package/dist/src/execution/tools/connection-search.d.ts +1 -0
  134. package/dist/src/execution/tools/connection-search.js +1 -1
  135. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  136. package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
  137. package/dist/src/execution/tools/subagent/start.js +1 -1
  138. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  139. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  140. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  141. package/dist/src/framework/sources/registry.js +1 -1
  142. package/dist/src/harness/approval-delivery-coordinator.d.ts +3 -13
  143. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  144. package/dist/src/harness/authorization.d.ts +0 -9
  145. package/dist/src/harness/authorization.js +1 -1
  146. package/dist/src/harness/emission.d.ts +2 -3
  147. package/dist/src/harness/emission.js +1 -1
  148. package/dist/src/harness/input-request-resolution.d.ts +2 -0
  149. package/dist/src/harness/input-request-resolution.js +1 -1
  150. package/dist/src/harness/input-requests.d.ts +3 -3
  151. package/dist/src/harness/input-requests.js +1 -1
  152. package/dist/src/harness/pending-input-batches.d.ts +3 -3
  153. package/dist/src/harness/pending-input-batches.js +1 -1
  154. package/dist/src/harness/provider-safety.d.ts +9 -0
  155. package/dist/src/harness/provider-safety.js +1 -1
  156. package/dist/src/harness/proxy-input-requests.d.ts +2 -0
  157. package/dist/src/harness/proxy-input-requests.js +1 -1
  158. package/dist/src/harness/session-limit-enforcement.d.ts +2 -3
  159. package/dist/src/harness/session-limit-enforcement.js +1 -1
  160. package/dist/src/harness/step-hooks.js +1 -1
  161. package/dist/src/harness/tool-loop.js +2 -2
  162. package/dist/src/harness/tools.js +1 -1
  163. package/dist/src/harness/turn-cancellation.d.ts +2 -7
  164. package/dist/src/harness/turn-cancellation.js +1 -1
  165. package/dist/src/harness/types.d.ts +11 -13
  166. package/dist/src/harness/workflow-stream-error.d.ts +0 -7
  167. package/dist/src/harness/workflow-stream-error.js +1 -1
  168. package/dist/src/instrumentation/runtime.js +1 -1
  169. package/dist/src/instrumentation/session-context.js +1 -1
  170. package/dist/src/instrumentation/session-init.js +1 -1
  171. package/dist/src/internal/application/cache-metadata.js +1 -1
  172. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  173. package/dist/src/internal/application/optional-package-import.js +1 -1
  174. package/dist/src/internal/application/optional-package-install.js +1 -1
  175. package/dist/src/internal/application/output-publication-lock.js +1 -1
  176. package/dist/src/internal/application/package.js +1 -1
  177. package/dist/src/internal/application/paths.js +1 -1
  178. package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
  179. package/dist/src/internal/authored-asset-import-plugin.js +1 -1
  180. package/dist/src/internal/authored-definition/core.js +1 -1
  181. package/dist/src/internal/authored-module-evaluation-error.js +1 -1
  182. package/dist/src/internal/authored-module-loader.js +1 -2
  183. package/dist/src/internal/authored-package-boundary.d.ts +0 -1
  184. package/dist/src/internal/authored-package-boundary.js +1 -1
  185. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  186. package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
  187. package/dist/src/internal/bundler/nitro-rolldown.d.ts +3 -1
  188. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  189. package/dist/src/internal/bundler/vendored-dependency-log.d.ts +7 -0
  190. package/dist/src/internal/bundler/vendored-dependency-log.js +1 -0
  191. package/dist/src/internal/external-resources-snapshot.d.ts +46 -0
  192. package/dist/src/internal/external-resources-snapshot.js +1 -0
  193. package/dist/src/internal/external-resources.d.ts +20 -0
  194. package/dist/src/internal/external-resources.js +1 -0
  195. package/dist/src/internal/gateway.d.ts +2 -0
  196. package/dist/src/internal/gateway.js +1 -1
  197. package/dist/src/internal/instrumentation-layout.js +1 -1
  198. package/dist/src/internal/invocation/workflow-execution.d.ts +0 -2
  199. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  200. package/dist/src/internal/materialized-authored-modules.js +1 -1
  201. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  202. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  203. package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
  204. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
  205. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  206. package/dist/src/internal/nitro/host/build-application.js +1 -1
  207. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  208. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  209. package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
  210. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  211. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  212. package/dist/src/internal/nitro/host/extension-external-dependency-plugin.js +1 -1
  213. package/dist/src/internal/nitro/host/instrumentation-entry.d.ts +3 -0
  214. package/dist/src/internal/nitro/host/instrumentation-entry.js +2 -0
  215. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  216. package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
  217. package/dist/src/internal/nitro/host/schedule-task-routes.d.ts +1 -25
  218. package/dist/src/internal/nitro/host/schedule-task-routes.js +2 -2
  219. package/dist/src/internal/nitro/host/start-development-server.d.ts +0 -8
  220. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  221. package/dist/src/internal/nitro/host/start-production-server.js +1 -1
  222. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  223. package/dist/src/internal/nitro/host.d.ts +1 -1
  224. package/dist/src/internal/nitro/host.js +1 -1
  225. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  226. package/dist/src/internal/nitro/routes/index.js +72 -3
  227. package/dist/src/internal/process/pnpm.js +1 -1
  228. package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
  229. package/dist/src/internal/workflow/development-world-client.js +1 -1
  230. package/dist/src/internal/workflow/development-world-server.js +1 -1
  231. package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
  232. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  233. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  234. package/dist/src/node_modules/.pnpm/{@vercel_cli-config@0.2.7 → @vercel_cli-config@0.3.0}/node_modules/@vercel/cli-config/dist/index.js +1 -1
  235. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/authorization.js +1 -1
  236. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +1 -0
  237. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/installation.js +1 -1
  238. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/token.js +1 -1
  239. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-util.js +1 -1
  240. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token.js +1 -1
  241. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/version.js +1 -1
  242. package/dist/src/protocol/message.d.ts +4 -0
  243. package/dist/src/protocol/message.js +1 -1
  244. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +0 -1
  245. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
  246. package/dist/src/public/channels/github/api.d.ts +0 -10
  247. package/dist/src/public/channels/github/api.js +1 -1
  248. package/dist/src/public/channels/mcp.js +1 -1
  249. package/dist/src/public/channels/slack/app-manifest.d.ts +9 -0
  250. package/dist/src/public/channels/slack/app-manifest.js +1 -0
  251. package/dist/src/public/channels/slack/hitl.d.ts +0 -4
  252. package/dist/src/public/channels/slack/hitl.js +2 -2
  253. package/dist/src/public/channels/slack/inbound-content.js +6 -3
  254. package/dist/src/public/channels/slack/mrkdwn.d.ts +0 -2
  255. package/dist/src/public/channels/slack/mrkdwn.js +1 -1
  256. package/dist/src/public/channels/slack/slackChannel.d.ts +4 -1
  257. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  258. package/dist/src/public/channels/upload-policy.d.ts +0 -11
  259. package/dist/src/public/channels/upload-policy.js +1 -1
  260. package/dist/src/public/definitions/remote-agent.d.ts +0 -9
  261. package/dist/src/public/definitions/workspace-agent.d.ts +0 -3
  262. package/dist/src/public/definitions/workspace-agent.js +1 -1
  263. package/dist/src/public/next/server.js +1 -1
  264. package/dist/src/public/nuxt/dev-server.js +1 -1
  265. package/dist/src/public/sveltekit/dev-server.js +1 -1
  266. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  267. package/dist/src/runtime/agent/bootstrap.js +1 -1
  268. package/dist/src/runtime/connections/mcp-client.js +1 -1
  269. package/dist/src/runtime/connections/mcp-tracing.d.ts +27 -0
  270. package/dist/src/runtime/connections/mcp-tracing.js +1 -0
  271. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  272. package/dist/src/runtime/resolve-agent.js +1 -1
  273. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +0 -2
  274. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  275. package/dist/src/runtime/subagents/dynamic-remote-agent-config.d.ts +0 -2
  276. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  277. package/dist/src/runtime/types.d.ts +1 -2
  278. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  279. package/dist/src/services/dev-client/vercel-auth-error.d.ts +1 -9
  280. package/dist/src/services/dev-client/vercel-auth-error.js +2 -3
  281. package/dist/src/setup/boxes/select-model.d.ts +2 -36
  282. package/dist/src/setup/boxes/select-model.js +1 -1
  283. package/dist/src/setup/flows/model-source-change.js +1 -1
  284. package/dist/src/setup/flows/provider.d.ts +2 -45
  285. package/dist/src/setup/flows/provider.js +1 -4
  286. package/dist/src/setup/primitives/pm/pnpm.js +1 -1
  287. package/dist/src/setup/primitives/run-vercel.js +1 -1
  288. package/dist/src/setup/project-resolution.d.ts +0 -2
  289. package/dist/src/setup/project-resolution.js +1 -1
  290. package/dist/src/setup/provider-settings.js +1 -1
  291. package/dist/src/setup/scaffold/connections/catalog.d.ts +0 -13
  292. package/dist/src/setup/scaffold/connections/catalog.js +1 -1
  293. package/dist/src/setup/scaffold/create/project.js +1 -1
  294. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  295. package/dist/src/setup/scaffold/workspace-root.js +1 -1
  296. package/dist/src/setup/vercel-api-failure.d.ts +0 -2
  297. package/dist/src/setup/vercel-api-failure.js +1 -1
  298. package/dist/src/setup/vercel-project.d.ts +2 -21
  299. package/dist/src/setup/vercel-project.js +0 -0
  300. package/dist/src/setup/verified-remote-agent.d.ts +1 -0
  301. package/dist/src/setup/verified-remote-agent.js +1 -1
  302. package/dist/src/shared/action-types.d.ts +2 -2
  303. package/dist/src/shared/agent-definition.d.ts +0 -9
  304. package/dist/src/shared/agent-turn-outcome.d.ts +1 -1
  305. package/dist/src/shared/channel-definition.d.ts +2 -2
  306. package/dist/src/shared/conversation-context.d.ts +0 -4
  307. package/dist/src/shared/conversation-context.js +1 -1
  308. package/dist/src/shared/conversation-identity.d.ts +2 -0
  309. package/dist/src/shared/conversation-identity.js +1 -0
  310. package/dist/src/shared/skill-paths.d.ts +0 -13
  311. package/dist/src/shared/skill-paths.js +2 -2
  312. package/dist/src/shared/validate-authorization.js +1 -1
  313. package/dist/src/shared/vercel-connect-metadata.d.ts +12 -0
  314. package/dist/src/shared/vercel-connect-metadata.js +1 -0
  315. package/dist/src/subagents/agent-handle-errors.d.ts +0 -4
  316. package/dist/src/subagents/agent-handle-errors.js +1 -1
  317. package/dist/src/subagents/callback-route.js +1 -1
  318. package/dist/src/subagents/callback-step.d.ts +0 -22
  319. package/dist/src/subagents/callback-step.js +1 -1
  320. package/dist/src/subagents/event-proxy-step.js +1 -1
  321. package/dist/src/subagents/hitl-proxy.d.ts +3 -5
  322. package/dist/src/subagents/hitl-proxy.js +1 -1
  323. package/dist/src/subagents/invocation.d.ts +5 -6
  324. package/dist/src/subagents/parent-notification.d.ts +1 -18
  325. package/dist/src/subagents/parent-notification.js +1 -1
  326. package/dist/src/subagents/remote-dispatch.js +1 -1
  327. package/dist/src/subagents/tool.d.ts +0 -3
  328. package/dist/src/subagents/tool.js +1 -1
  329. package/dist/src/svelte/index.js +1 -1
  330. package/dist/src/svelte/use-eve-agent.js +1 -1
  331. package/dist/src/tools/framework/agent-contract.d.ts +0 -2
  332. package/dist/src/tools/framework/agent-contract.js +1 -1
  333. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  334. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  335. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  336. package/dist/src/tracing/agent-memory-instrumentation.js +1 -1
  337. package/dist/src/tracing/agent-otel-attributes.js +1 -1
  338. package/dist/src/tracing/agent-otel-provider.js +2 -2
  339. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  340. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  341. package/dist/src/tracing/agent-tool-span-context.d.ts +15 -0
  342. package/dist/src/tracing/agent-tool-span-context.js +1 -0
  343. package/dist/src/tracing/agent-trace-context-store.d.ts +0 -2
  344. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  345. package/dist/src/tracing/conversation-context.d.ts +0 -2
  346. package/dist/src/tracing/conversation-context.js +1 -1
  347. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  348. package/dist/src/tracing/otel-declaration.d.ts +4 -9
  349. package/dist/src/vue/index.js +1 -1
  350. package/dist/src/vue/use-eve-agent.js +1 -1
  351. package/docs/agent-config.md +19 -13
  352. package/docs/channels/chat-sdk.mdx +1 -1
  353. package/docs/channels/custom.mdx +1 -1
  354. package/docs/channels/eve.mdx +4 -4
  355. package/docs/channels/mcp.mdx +10 -10
  356. package/docs/channels/slack.mdx +1 -1
  357. package/docs/concepts/sessions-runs-and-streaming.md +5 -6
  358. package/docs/connections/overview.mdx +22 -0
  359. package/docs/guides/deployment/overview.md +1 -1
  360. package/docs/guides/deployment/self-hosting.md +1 -1
  361. package/docs/guides/deployment/vercel.mdx +2 -2
  362. package/docs/guides/dev-tui.md +6 -6
  363. package/docs/guides/dynamic-capabilities.md +2 -2
  364. package/docs/guides/frontend/overview.mdx +5 -3
  365. package/docs/guides/hooks.md +4 -2
  366. package/docs/guides/instrumentation/agent-runs.mdx +7 -7
  367. package/docs/guides/instrumentation/instrumentation.mdx +22 -5
  368. package/docs/guides/instrumentation/otel.mdx +30 -0
  369. package/docs/guides/remote-agents.md +3 -4
  370. package/docs/guides/self-modification.md +1 -1
  371. package/docs/memory/custom-provider.md +1 -1
  372. package/docs/protocols/acp.md +1 -1
  373. package/docs/reference/cli.md +91 -97
  374. package/docs/schedules.mdx +4 -5
  375. package/docs/subagents/index.mdx +5 -7
  376. package/docs/tools/human-in-the-loop.md +4 -0
  377. package/docs/tools/overview.mdx +2 -0
  378. package/docs/tools/workflows.mdx +1 -1
  379. package/docs/tutorial/remember-definitions.mdx +1 -1
  380. package/docs/tutorial/ship-it.mdx +1 -1
  381. package/package.json +3 -2
  382. package/dist/src/cli/commands/channels.d.ts +0 -9
  383. package/dist/src/cli/commands/channels.js +0 -1
  384. package/dist/src/cli/commands/init-confirm.d.ts +0 -12
  385. package/dist/src/cli/commands/init-confirm.js +0 -1
  386. package/dist/src/execution/effective-output-schema.d.ts +0 -22
  387. package/dist/src/execution/effective-output-schema.js +0 -1
  388. package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff/node_modules/@vercel/connect/dist/connector.js +0 -1
  389. package/dist/src/setup/gateway-models.d.ts +0 -10
  390. package/dist/src/setup/gateway-models.js +0 -1
  391. package/dist/src/shared/run-mode.d.ts +0 -7
  392. package/dist/src/shared/run-mode.js +0 -1
  393. package/dist/src/subagents/parent-result.d.ts +0 -14
  394. package/dist/src/subagents/parent-result.js +0 -1
  395. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/index.js +0 -0
  396. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/base-url.js +0 -0
  397. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -0
  398. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/env.js +0 -0
  399. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -0
  400. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/auth-errors.js +0 -0
  401. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -0
  402. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-context.js +0 -0
  403. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -0
  404. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -0
  405. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/index.js +0 -0
  406. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/oauth.js +0 -0
  407. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-error.js +0 -0
  408. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-io.js +0 -0
  409. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -0
@@ -1 +1 @@
1
- import{lstat,readlink,realpath}from"node:fs/promises";import{dirname,join,relative,resolve}from"node:path";import{existsSync,readFileSync}from"node:fs";import{readTextFileIfExists,resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";import{isAuthoredSourcePath,isAuthoredSourcePath as isAuthoredSourcePath$1,isPathInsideOrEqual,resolveLocalTsConfigPathTargetRoots,resolveNearestPackageRoot}from"#internal/nitro/dev-runtime-source-snapshot-local-roots.js";const DEV_RUNTIME_SOURCE_DIRECTORY=`source`,SOURCE_ROOT_MARKER_NAMES=[`.git`,`pnpm-workspace.yaml`],WORKSPACE_METADATA_FILE_NAMES=[`package.json`,`pnpm-workspace.yaml`,`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`,`.npmrc`],PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`];var DevelopmentRuntimeSourceSnapshotError=class extends Error{constructor(e){super(e),this.name=`DevelopmentRuntimeSourceSnapshotError`}};async function createDevelopmentSourceSnapshotPlan(e){let t=resolve(e.appRoot),n=resolve(e.snapshotRoot),r=resolveDevelopmentSourceRoot(t),i=join(n,DEV_RUNTIME_SOURCE_DIRECTORY),a={appRoot:t,copyFiles:new Set,dependencyMountsByPath:new Map,localRootsToProcess:[t],processedLocalRoots:new Set,snapshotRoot:n,snapshotSourceRoot:i,sourceRoot:r,tsconfigPaths:new Set},o=join(t,`package.json`);for(existsSync(o)&&a.copyFiles.add(o),await addAuthoredSourceRoots(a,e.authoredSourceRoots??[]);a.localRootsToProcess.length>0;){let e=a.localRootsToProcess.shift();if(e===void 0)continue;let t=resolve(e);!a.processedLocalRoots.has(t)&&isAuthoredSourcePath$1(t,r)&&(a.processedLocalRoots.add(t),await addTsConfigDependenciesForRoot(a,t),await addDependencyMountsForRoot(a,t))}let s=[...a.copyFiles].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),c=[...a.tsconfigPaths].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),l=[...a.dependencyMountsByPath.values()].sort((e,t)=>e.mountPath.localeCompare(t.mountPath)),u=createWatchPaths({appRoot:t,copyFiles:s,dependencyMounts:l,localRoots:[...a.processedLocalRoots],sourceRoot:r,tsconfigPaths:c});return{appRoot:t,copyFiles:s,dependencyMounts:l,runtimeAppRoot:toSnapshotPath({sourcePath:t,sourceRoot:r,snapshotSourceRoot:i}),snapshotRoot:n,snapshotSourceRoot:i,sourceRoot:r,tsconfigPaths:c,watchPaths:u}}async function resolveDevelopmentSourceSnapshotWatchPaths(e){return[...(await createDevelopmentSourceSnapshotPlan({appRoot:e,snapshotRoot:join(resolve(e),`.eve`,`dev-runtime`,`__watch-plan__`)})).watchPaths]}function toDevelopmentSourceSnapshotPath(e){return toSnapshotPath(e)}function resolveDevelopmentSourceRoot(e){let t=resolve(e);for(;;){if(SOURCE_ROOT_MARKER_NAMES.some(e=>existsSync(join(t,e)))||isWorkspaceManifestRoot(t))return t;let n=dirname(t);if(n===t)return resolve(e);t=n}}async function addAuthoredSourceRoots(e,t){for(let n of t){let t=resolve(n);isAuthoredSourcePath$1(t,e.sourceRoot)&&enqueueLocalRoot(e,await resolveNearestPackageRoot(t,e.sourceRoot)??t)}}async function addTsConfigDependenciesForRoot(e,t){let n=await resolveTsConfigDependencyPaths(t);for(let t of n)if(isPathInsideOrEqual(t,e.sourceRoot)){e.tsconfigPaths.add(t);for(let n of await resolveLocalTsConfigPathTargetRoots({configPath:t,sourceRoot:e.sourceRoot}))enqueueLocalRoot(e,n)}}async function addDependencyMountsForRoot(e,t){let n=await readPackageDependencyNames(resolveDependencyDeclarationRoot(t,e.sourceRoot));for(let r of n)for(let n of listAncestorNodeModulesRoots(t,e.sourceRoot))await addDependencyMount(e,joinNodeModulesPackagePath(n,r))}function resolveDependencyDeclarationRoot(e,t){let n=resolve(e),r=resolve(t);for(;isPathInsideOrEqual(n,r);){if(existsSync(join(n,`package.json`)))return n;let e=dirname(n);if(e===n)break;n=e}return e}function listAncestorNodeModulesRoots(e,t){let n=resolve(t),r=new Set,i=resolve(e);for(;isPathInsideOrEqual(i,n);){r.add(i);let e=dirname(i);if(e===i)break;i=e}return r.add(resolve(e)),r.add(n),[...r]}function isWorkspaceManifestRoot(e){let t=join(e,`package.json`);if(!existsSync(t))return!1;try{let e=JSON.parse(readFileSync(t,`utf8`));return isObjectRecord(e)&&e.workspaces!==void 0}catch{return!1}}async function addDependencyMount(e,t){let n;try{n=await lstat(t)}catch{return}if(!n.isDirectory()&&!n.isSymbolicLink())return;let r=await resolveDependencySourcePathCandidates(t),i=r.find(t=>isAuthoredSourcePath$1(t,e.sourceRoot));if(i!==void 0){await addWorkspaceDependencyMount({mountPath:t,state:e,sourcePath:i});return}let a=r.find(e=>existsSync(e));a!==void 0&&e.dependencyMountsByPath.set(resolve(t),{mountPath:resolve(t),sourceKind:`installed`,sourcePath:a})}async function addWorkspaceDependencyMount(e){let t=await resolveNearestPackageRoot(e.sourcePath,e.state.sourceRoot);if(t===void 0||!isAuthoredSourcePath$1(t,e.state.sourceRoot))return;let{state:n}=e;enqueueLocalRoot(n,t),n.dependencyMountsByPath.set(resolve(e.mountPath),{mountPath:resolve(e.mountPath),sourceKind:`workspace`,sourcePath:t})}async function resolveDependencySourcePathCandidates(e){let t=new Set;try{let n=await readlink(e);t.add(resolve(dirname(e),n))}catch{}try{t.add(await realpath(e))}catch{}return[...t]}function enqueueLocalRoot(e,t){let n=resolve(t);e.processedLocalRoots.has(n)||e.localRootsToProcess.includes(n)||!isAuthoredSourcePath$1(n,e.sourceRoot)||e.localRootsToProcess.push(n)}async function readPackageDependencyNames(e){let t=join(e,`package.json`),n=await readTextFileIfExists(t);if(n===void 0)return[];let r;try{r=JSON.parse(n)}catch{return[]}if(!isObjectRecord(r))return[];let i=new Set;for(let e of PACKAGE_DEPENDENCY_FIELDS){let t=r[e];if(isObjectRecord(t))for(let e of Object.keys(t))i.add(e)}return[...i].sort((e,t)=>e.localeCompare(t))}function createWatchPaths(e){let t=new Set([join(e.appRoot,`package.json`),...e.copyFiles,...e.tsconfigPaths]);for(let n of e.localRoots)n!==e.appRoot&&t.add(n);for(let n of e.dependencyMounts)n.sourceKind===`workspace`&&n.sourcePath!==e.appRoot&&t.add(n.sourcePath);if(e.sourceRoot!==e.appRoot)for(let n of WORKSPACE_METADATA_FILE_NAMES){let r=join(e.sourceRoot,n);existsSync(r)&&t.add(r)}return[...t].sort((e,t)=>e.localeCompare(t))}function joinNodeModulesPackagePath(e,t){return join(e,`node_modules`,...t.split(`/`))}function toSnapshotPath(e){if(!isPathInsideOrEqual(e.sourcePath,e.sourceRoot))throw new DevelopmentRuntimeSourceSnapshotError(`Cannot map source path "${e.sourcePath}" into a development runtime snapshot because it is outside source root "${e.sourceRoot}".`);return join(e.snapshotSourceRoot,relative(e.sourceRoot,e.sourcePath))}function isObjectRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{DEV_RUNTIME_SOURCE_DIRECTORY,DevelopmentRuntimeSourceSnapshotError,createDevelopmentSourceSnapshotPlan,isAuthoredSourcePath,resolveDevelopmentSourceRoot,resolveDevelopmentSourceSnapshotWatchPaths,toDevelopmentSourceSnapshotPath};
1
+ import{lstat,readlink,realpath}from"node:fs/promises";import{existsSync,readFileSync}from"node:fs";import{dirname,join,relative,resolve}from"node:path";import{readTextFileIfExists,resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";import{isAuthoredSourcePath,isAuthoredSourcePath as isAuthoredSourcePath$1,isPathInsideOrEqual,resolveLocalTsConfigPathTargetRoots,resolveNearestPackageRoot}from"#internal/nitro/dev-runtime-source-snapshot-local-roots.js";const DEV_RUNTIME_SOURCE_DIRECTORY=`source`,SOURCE_ROOT_MARKER_NAMES=[`.git`,`pnpm-workspace.yaml`],WORKSPACE_METADATA_FILE_NAMES=[`package.json`,`pnpm-workspace.yaml`,`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`,`.npmrc`],PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`];var DevelopmentRuntimeSourceSnapshotError=class extends Error{constructor(e){super(e),this.name=`DevelopmentRuntimeSourceSnapshotError`}};async function createDevelopmentSourceSnapshotPlan(e){let t=resolve(e.appRoot),n=resolve(e.snapshotRoot),r=resolveDevelopmentSourceRoot(t),i=join(n,DEV_RUNTIME_SOURCE_DIRECTORY),a={appRoot:t,copyFiles:new Set,dependencyMountsByPath:new Map,localRootsToProcess:[t],processedLocalRoots:new Set,snapshotRoot:n,snapshotSourceRoot:i,sourceRoot:r,tsconfigPaths:new Set},o=join(t,`package.json`);for(existsSync(o)&&a.copyFiles.add(o),await addAuthoredSourceRoots(a,e.authoredSourceRoots??[]);a.localRootsToProcess.length>0;){let e=a.localRootsToProcess.shift();if(e===void 0)continue;let t=resolve(e);!a.processedLocalRoots.has(t)&&isAuthoredSourcePath$1(t,r)&&(a.processedLocalRoots.add(t),await addTsConfigDependenciesForRoot(a,t),await addDependencyMountsForRoot(a,t))}let s=[...a.copyFiles].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),c=[...a.tsconfigPaths].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),l=[...a.dependencyMountsByPath.values()].sort((e,t)=>e.mountPath.localeCompare(t.mountPath)),u=createWatchPaths({appRoot:t,copyFiles:s,dependencyMounts:l,localRoots:[...a.processedLocalRoots],sourceRoot:r,tsconfigPaths:c});return{appRoot:t,copyFiles:s,dependencyMounts:l,runtimeAppRoot:toSnapshotPath({sourcePath:t,sourceRoot:r,snapshotSourceRoot:i}),snapshotRoot:n,snapshotSourceRoot:i,sourceRoot:r,tsconfigPaths:c,watchPaths:u}}async function resolveDevelopmentSourceSnapshotWatchPaths(e){return[...(await createDevelopmentSourceSnapshotPlan({appRoot:e,snapshotRoot:join(resolve(e),`.eve`,`dev-runtime`,`__watch-plan__`)})).watchPaths]}function toDevelopmentSourceSnapshotPath(e){return toSnapshotPath(e)}function resolveDevelopmentSourceRoot(e){let t=resolve(e);for(;;){if(SOURCE_ROOT_MARKER_NAMES.some(e=>existsSync(join(t,e)))||isWorkspaceManifestRoot(t))return t;let n=dirname(t);if(n===t)return resolve(e);t=n}}async function addAuthoredSourceRoots(e,t){for(let n of t){let t=resolve(n);isAuthoredSourcePath$1(t,e.sourceRoot)&&enqueueLocalRoot(e,await resolveNearestPackageRoot(t,e.sourceRoot)??t)}}async function addTsConfigDependenciesForRoot(e,t){let n=await resolveTsConfigDependencyPaths(t);for(let t of n)if(isPathInsideOrEqual(t,e.sourceRoot)){e.tsconfigPaths.add(t);for(let n of await resolveLocalTsConfigPathTargetRoots({configPath:t,sourceRoot:e.sourceRoot}))enqueueLocalRoot(e,n)}}async function addDependencyMountsForRoot(e,t){let n=await readPackageDependencyNames(resolveDependencyDeclarationRoot(t,e.sourceRoot));for(let r of n)for(let n of listAncestorNodeModulesRoots(t,e.sourceRoot))await addDependencyMount(e,joinNodeModulesPackagePath(n,r))}function resolveDependencyDeclarationRoot(e,t){let n=resolve(e),r=resolve(t);for(;isPathInsideOrEqual(n,r);){if(existsSync(join(n,`package.json`)))return n;let e=dirname(n);if(e===n)break;n=e}return e}function listAncestorNodeModulesRoots(e,t){let n=resolve(t),r=new Set,i=resolve(e);for(;isPathInsideOrEqual(i,n);){r.add(i);let e=dirname(i);if(e===i)break;i=e}return r.add(resolve(e)),r.add(n),[...r]}function isWorkspaceManifestRoot(e){let t=join(e,`package.json`);if(!existsSync(t))return!1;try{let e=JSON.parse(readFileSync(t,`utf8`));return isObjectRecord(e)&&e.workspaces!==void 0}catch{return!1}}async function addDependencyMount(e,t){let n;try{n=await lstat(t)}catch{return}if(!n.isDirectory()&&!n.isSymbolicLink())return;let r=await resolveDependencySourcePathCandidates(t),i=r.find(t=>isAuthoredSourcePath$1(t,e.sourceRoot));if(i!==void 0){await addWorkspaceDependencyMount({mountPath:t,state:e,sourcePath:i});return}let a=r.find(e=>existsSync(e));a!==void 0&&e.dependencyMountsByPath.set(resolve(t),{mountPath:resolve(t),sourceKind:`installed`,sourcePath:a})}async function addWorkspaceDependencyMount(e){let t=await resolveNearestPackageRoot(e.sourcePath,e.state.sourceRoot);if(t===void 0||!isAuthoredSourcePath$1(t,e.state.sourceRoot))return;let{state:n}=e;enqueueLocalRoot(n,t),n.dependencyMountsByPath.set(resolve(e.mountPath),{mountPath:resolve(e.mountPath),sourceKind:`workspace`,sourcePath:t})}async function resolveDependencySourcePathCandidates(e){let t=new Set;try{let n=await readlink(e);t.add(resolve(dirname(e),n))}catch{}try{t.add(await realpath(e))}catch{}return[...t]}function enqueueLocalRoot(e,t){let n=resolve(t);e.processedLocalRoots.has(n)||e.localRootsToProcess.includes(n)||!isAuthoredSourcePath$1(n,e.sourceRoot)||e.localRootsToProcess.push(n)}async function readPackageDependencyNames(e){let t=join(e,`package.json`),n=await readTextFileIfExists(t);if(n===void 0)return[];let r;try{r=JSON.parse(n)}catch{return[]}if(!isObjectRecord(r))return[];let i=new Set;for(let e of PACKAGE_DEPENDENCY_FIELDS){let t=r[e];if(isObjectRecord(t))for(let e of Object.keys(t))i.add(e)}return[...i].sort((e,t)=>e.localeCompare(t))}function createWatchPaths(e){let t=new Set([join(e.appRoot,`package.json`),...e.copyFiles,...e.tsconfigPaths]);for(let n of e.localRoots)n!==e.appRoot&&t.add(n);for(let n of e.dependencyMounts)n.sourceKind===`workspace`&&n.sourcePath!==e.appRoot&&t.add(n.sourcePath);if(e.sourceRoot!==e.appRoot)for(let n of WORKSPACE_METADATA_FILE_NAMES){let r=join(e.sourceRoot,n);existsSync(r)&&t.add(r)}return[...t].sort((e,t)=>e.localeCompare(t))}function joinNodeModulesPackagePath(e,t){return join(e,`node_modules`,...t.split(`/`))}function toSnapshotPath(e){if(!isPathInsideOrEqual(e.sourcePath,e.sourceRoot))throw new DevelopmentRuntimeSourceSnapshotError(`Cannot map source path "${e.sourcePath}" into a development runtime snapshot because it is outside source root "${e.sourceRoot}".`);return join(e.snapshotSourceRoot,relative(e.sourceRoot,e.sourcePath))}function isObjectRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{DEV_RUNTIME_SOURCE_DIRECTORY,DevelopmentRuntimeSourceSnapshotError,createDevelopmentSourceSnapshotPlan,isAuthoredSourcePath,resolveDevelopmentSourceRoot,resolveDevelopmentSourceSnapshotWatchPaths,toDevelopmentSourceSnapshotPath};
@@ -1 +1 @@
1
- import{readFile}from"node:fs/promises";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{isObject}from"#shared/guards.js";import{dirname,isAbsolute,join,relative,resolve,sep}from"node:path";import{resolveDiscoveryProject}from"#discover/project.js";import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{normalizePublicRoutePrefix}from"#shared/public-route-prefix.js";import{tryReadExtensionBuildConfig}from"#internal/nitro/host/build-extension.js";import{toErrorMessage}from"#shared/errors.js";import{createDiskRuntimeCompiledArtifactsSource}from"#runtime/compiled-artifacts-source.js";import{build,copyPublicAssets,prepare,prerender}from"nitro/builder";import{prepareEveVersionedCacheDirectory,writeEveVersionedCacheMetadata}from"#internal/application/cache-metadata.js";import{createApplicationBuildWorkspace,removeApplicationBuildWorkspace}from"#internal/application/build-workspace.js";import{ApplicationBuildProfiler,createApplicationBuildProfile,measureApplicationBuildOutput,writeApplicationBuildProfile}from"#internal/application/build-profile.js";import{RecoverablePublicationError,publishApplicationBuildArtifacts}from"#internal/application/output-publication.js";import{stageProductionCompilerArtifacts}from"#internal/application/production-compiler-artifacts.js";import{materializeVercelWorkflowFunctionOutput,normalizeEveVercelFunctionOutput}from"#internal/workflow-bundle/vercel-workflow-output.js";import{createProductionApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{emitVercelAgentSummary}from"#internal/nitro/host/build-vercel-agent-summary.js";import{copyHostMiddlewareFunctions}from"#internal/nitro/host/copy-host-middleware.js";import{normalizeVercelServiceCrons}from"#internal/nitro/host/normalize-vercel-service-crons.js";import{prepareProductionApplicationHost,refreshProductionCompiledArtifacts}from"#internal/nitro/host/prepare-application-host.js";import{createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{runVercelBuildPrewarm}from"#internal/nitro/host/vercel-build-prewarm.js";import{prewarmAppSandboxes}from"#execution/sandbox/prewarm.js";import{findClosestVercelOutputDirectory}from"#shared/vercel-output-directory.js";import{resolveEveServicePrefixByRoot}from"#internal/vercel/vercel-service-config-operations.js";import{parseVercelServicesConfig}from"#internal/vercel/vercel-services-config.js";function trimTrailingSlash(e){return e.replace(/[\\/]+$/,``)}async function measureBuildPhase(e,t,n){return e===void 0?n():e.measure(t,n)}function isPathInside(e,t){let n=relative(e,t);return n.length===0||!n.startsWith(`..${sep}`)&&n!==`..`&&!isAbsolute(n)}function assertProfileOutputOutsideBuildOutput(e,t){if(e!==void 0&&isPathInside(t,e))throw Error(`Build profile path ${e} must be outside the published output directory ${t}.`)}async function writeOptionalApplicationBuildProfile(e){try{assertProfileOutputOutsideBuildOutput(e.profileOutputPath,e.outputDirectory);let t=e.profiler.finish(),n=await measureApplicationBuildOutput(e.outputDirectory);await writeApplicationBuildProfile(e.profileOutputPath,createApplicationBuildProfile({output:n,target:process.env.VERCEL?`vercel`:`local`,timing:t}))}catch(t){console.warn(`eve: failed to write optional build profile to ${e.profileOutputPath}; continuing with the published build output: ${toErrorMessage(t)}`)}}async function resolveEveServicePrefixForVercelFunctionOutput(e,t){let n=Array.from(new Set([resolve(e),resolve(t)])),r=await findClosestVercelOutputDirectory(e);if(r!==void 0)try{let e=join(r,`config.json`),t=parseVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),e),i=resolveEveServicePrefixByRoot({appRoots:n,configRoot:await resolveVercelOutputConfigRoot(r),config:t});if(i!==void 0)return i}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let i=e;for(;;){for(let e of[join(i,`vercel.json`),join(i,`.vercel`,`output`,`config.json`)])try{let t=parseVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),e),r=e.endsWith(`vercel.json`)?i:await resolveVercelOutputConfigRoot(dirname(e)),a=resolveEveServicePrefixByRoot({appRoots:n,configRoot:r,config:t});if(a!==void 0)return a}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let e=dirname(i);if(e===i)return;i=e}}async function resolveVercelOutputConfigRoot(e){let t=dirname(dirname(e));try{let e=JSON.parse(await readFile(join(t,`.vercel`,`project.json`),`utf8`));if(isObject(e)&&isObject(e.settings)){let n=e.settings.rootDirectory;if(typeof n==`string`&&n.trim().length>0)return resolve(t,n)}}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}return t}async function buildNitroOutput(e,t,n){let r=trimTrailingSlash(e.options.output.dir);return await measureBuildPhase(t,`${n}.cache.prepare`,()=>prepareEveVersionedCacheDirectory(r)),await measureBuildPhase(t,`${n}.prepare`,()=>prepare(e)),await measureBuildPhase(t,`${n}.public-assets`,()=>copyPublicAssets(e)),await measureBuildPhase(t,`${n}.prerender`,()=>prerender(e)),await measureBuildPhase(t,`${n}.bundle`,()=>build(e)),await measureBuildPhase(t,`${n}.cache.write`,()=>writeEveVersionedCacheMetadata(r)),r}async function buildApplication(e,t){let n=t.profileOutputPath===void 0?void 0:resolve(t.profileOutputPath),r=n===void 0?void 0:new ApplicationBuildProfiler,i=await measureBuildPhase(r,`extension.check`,()=>tryReadExtensionBuildConfig(e));if(i!==null)throw Error(`Package "${i.packageName}" is an eve extension. Run \`eve extension build\` instead of \`eve build\`.`);let a=await measureBuildPhase(r,`project.resolve`,()=>resolveDiscoveryProject(e)),o=await measureBuildPhase(r,`workspace.create`,()=>createApplicationBuildWorkspace(a.appRoot,t.vercelServiceOutput?.serviceOutputDirectory)),s=!1,c;try{c=await buildApplicationInWorkspace(o,t,r)}catch(e){throw s=e instanceof RecoverablePublicationError,e}finally{s||await measureBuildPhase(r,`workspace.remove`,()=>removeApplicationBuildWorkspace(o))}return r!==void 0&&n!==void 0&&await writeOptionalApplicationBuildProfile({outputDirectory:c,profileOutputPath:n,profiler:r}),c}async function buildApplicationInWorkspace(e,t,n){let r=await measureBuildPhase(n,`host.prepare`,()=>prepareProductionApplicationHost(e)),i=!!process.env.VERCEL,a=i?await measureBuildPhase(n,`vercel.service-prefix.resolve`,()=>resolveEveServicePrefixForVercelFunctionOutput(r.appRoot,r.compileResult.project.agentRoot)):void 0,o=normalizePublicRoutePrefix(a),s=o===EVE_ROUTE_PREFIX?void 0:o;if(t.publicRoutePrefix!==void 0&&s!==void 0&&t.publicRoutePrefix!==s)throw Error(`EVE_PUBLIC_ROUTE_PREFIX ${JSON.stringify(t.publicRoutePrefix)} conflicts with the configured Vercel service prefix ${JSON.stringify(a)}.`);let c=t.publicRoutePrefix??s,l=createProductionNitroArtifactsConfig(e.appRoot).sandboxScope,u=await measureBuildPhase(n,`nitro.create`,()=>createProductionApplicationNitro(r,{buildDir:e.nitro.buildDir,outputDir:e.publication.output.stagedDir,publicRoutePrefix:c,workspaceMember:t.workspaceMember}));try{if(!t.skipSandboxPrewarm){let t={appRoot:r.appRoot,compiledArtifactsSource:createDiskRuntimeCompiledArtifactsSource(e.compiler.rootDir,{moduleMapLoaderPath:resolvePackageSourceFilePath(`src/internal/authored-module-map-loader.ts`),sandboxAppRoot:r.appRoot,sandboxScope:l}),log(e){console.log(e)}};await measureBuildPhase(n,`sandbox.prewarm`,async()=>{i?await runVercelBuildPrewarm(t):await prewarmAppSandboxes(t)}),await refreshProductionCompiledArtifacts(r,e.host.artifactsDir)}await buildNitroOutput(u,n,`nitro`),i&&await measureBuildPhase(n,`vercel.workflow-function.materialize`,()=>materializeVercelWorkflowFunctionOutput(e.publication.output.stagedDir)),a!==void 0&&await measureBuildPhase(n,`vercel.functions.normalize`,()=>normalizeEveVercelFunctionOutput(e.publication.output.stagedDir,{servicePrefix:a}));let o=t.vercelServiceOutput;o!==void 0&&(await measureBuildPhase(n,`vercel.service-crons.normalize`,()=>normalizeVercelServiceCrons({publicRoutePrefix:c,serviceOutputDirectory:e.publication.output.stagedDir})),await measureBuildPhase(n,`vercel.host-middleware.copy`,()=>copyHostMiddlewareFunctions({hostOutputDirectory:o.hostOutputDirectory,serviceOutputDirectory:e.publication.output.stagedDir}))),await measureBuildPhase(n,`agent-summary.emit`,()=>emitVercelAgentSummary({manifest:r.compileResult.manifest,outputPath:e.publication.summary.stagedPath})),i||await measureBuildPhase(n,`compiler-artifacts.stage`,()=>stageProductionCompilerArtifacts({compilerArtifactsRoot:e.compiler.artifactsDir,outputDir:e.publication.output.stagedDir}))}finally{await measureBuildPhase(n,`nitro.close`,()=>u.close())}return await measureBuildPhase(n,`output.publish`,()=>publishCompletedApplicationBuild(e)),e.publication.output.finalDir}async function publishCompletedApplicationBuild(e){await publishApplicationBuildArtifacts({appRoot:e.appRoot,finalOutputDir:e.publication.output.finalDir,finalSummaryPath:e.publication.summary.finalPath,scratchDir:e.rootDir,stagedOutputDir:e.publication.output.stagedDir,stagedSummaryPath:e.publication.summary.stagedPath})}export{buildApplication};
1
+ import{readFile}from"node:fs/promises";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{isObject}from"#shared/guards.js";import{resolveDiscoveryProject}from"#discover/project.js";import{resolveInstalledPackageInfo,resolvePackageSourceFilePath}from"#internal/application/package.js";import{dirname,isAbsolute,join,relative,resolve,sep}from"node:path";import{normalizePublicRoutePrefix}from"#shared/public-route-prefix.js";import{tryReadExtensionBuildConfig}from"#internal/nitro/host/build-extension.js";import{toErrorMessage}from"#shared/errors.js";import{createDiskRuntimeCompiledArtifactsSource}from"#runtime/compiled-artifacts-source.js";import{build,copyPublicAssets,prepare,prerender}from"nitro/builder";import{prepareEveVersionedCacheDirectory,writeEveVersionedCacheMetadata}from"#internal/application/cache-metadata.js";import{createApplicationBuildWorkspace,removeApplicationBuildWorkspace}from"#internal/application/build-workspace.js";import{ApplicationBuildProfiler,createApplicationBuildProfile,measureApplicationBuildOutput,writeApplicationBuildProfile}from"#internal/application/build-profile.js";import{RecoverablePublicationError,publishApplicationBuildArtifacts}from"#internal/application/output-publication.js";import{stageProductionCompilerArtifacts}from"#internal/application/production-compiler-artifacts.js";import{materializeVercelWorkflowFunctionOutput,normalizeEveVercelFunctionOutput}from"#internal/workflow-bundle/vercel-workflow-output.js";import{createProductionApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{emitVercelAgentSummary}from"#internal/nitro/host/build-vercel-agent-summary.js";import{emitConnectManifest}from"#internal/external-resources.js";import{copyHostMiddlewareFunctions}from"#internal/nitro/host/copy-host-middleware.js";import{normalizeVercelServiceCrons}from"#internal/nitro/host/normalize-vercel-service-crons.js";import{prepareProductionApplicationHost,refreshProductionCompiledArtifacts}from"#internal/nitro/host/prepare-application-host.js";import{createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{runVercelBuildPrewarm}from"#internal/nitro/host/vercel-build-prewarm.js";import{prewarmAppSandboxes}from"#execution/sandbox/prewarm.js";import{findClosestVercelOutputDirectory}from"#shared/vercel-output-directory.js";import{resolveEveServicePrefixByRoot}from"#internal/vercel/vercel-service-config-operations.js";import{parseVercelServicesConfig}from"#internal/vercel/vercel-services-config.js";function trimTrailingSlash(e){return e.replace(/[\\/]+$/,``)}async function measureBuildPhase(e,t,n){return e===void 0?n():e.measure(t,n)}function isPathInside(e,t){let n=relative(e,t);return n.length===0||!n.startsWith(`..${sep}`)&&n!==`..`&&!isAbsolute(n)}function assertProfileOutputOutsideBuildOutput(e,t){if(e!==void 0&&isPathInside(t,e))throw Error(`Build profile path ${e} must be outside the published output directory ${t}.`)}async function writeOptionalApplicationBuildProfile(e){try{assertProfileOutputOutsideBuildOutput(e.profileOutputPath,e.outputDirectory);let t=e.profiler.finish(),n=await measureApplicationBuildOutput(e.outputDirectory);await writeApplicationBuildProfile(e.profileOutputPath,createApplicationBuildProfile({output:n,target:process.env.VERCEL?`vercel`:`local`,timing:t}))}catch(t){console.warn(`eve: failed to write optional build profile to ${e.profileOutputPath}; continuing with the published build output: ${toErrorMessage(t)}`)}}async function resolveEveServicePrefixForVercelFunctionOutput(e,t){let n=Array.from(new Set([resolve(e),resolve(t)])),r=await findClosestVercelOutputDirectory(e);if(r!==void 0)try{let e=join(r,`config.json`),t=parseVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),e),i=resolveEveServicePrefixByRoot({appRoots:n,configRoot:await resolveVercelOutputConfigRoot(r),config:t});if(i!==void 0)return i}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let i=e;for(;;){for(let e of[join(i,`vercel.json`),join(i,`.vercel`,`output`,`config.json`)])try{let t=parseVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),e),r=e.endsWith(`vercel.json`)?i:await resolveVercelOutputConfigRoot(dirname(e)),a=resolveEveServicePrefixByRoot({appRoots:n,configRoot:r,config:t});if(a!==void 0)return a}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let e=dirname(i);if(e===i)return;i=e}}async function resolveVercelOutputConfigRoot(e){let t=dirname(dirname(e));try{let e=JSON.parse(await readFile(join(t,`.vercel`,`project.json`),`utf8`));if(isObject(e)&&isObject(e.settings)){let n=e.settings.rootDirectory;if(typeof n==`string`&&n.trim().length>0)return resolve(t,n)}}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}return t}async function buildNitroOutput(e,t,n){let r=trimTrailingSlash(e.options.output.dir);return await measureBuildPhase(t,`${n}.cache.prepare`,()=>prepareEveVersionedCacheDirectory(r)),await measureBuildPhase(t,`${n}.prepare`,()=>prepare(e)),await measureBuildPhase(t,`${n}.public-assets`,()=>copyPublicAssets(e)),await measureBuildPhase(t,`${n}.prerender`,()=>prerender(e)),await measureBuildPhase(t,`${n}.bundle`,()=>build(e)),await measureBuildPhase(t,`${n}.cache.write`,()=>writeEveVersionedCacheMetadata(r)),r}async function buildApplication(e,t){let n=t.profileOutputPath===void 0?void 0:resolve(t.profileOutputPath),r=n===void 0?void 0:new ApplicationBuildProfiler,i=await measureBuildPhase(r,`extension.check`,()=>tryReadExtensionBuildConfig(e));if(i!==null)throw Error(`Package "${i.packageName}" is an eve extension. Run \`eve extension build\` instead of \`eve build\`.`);let a=await measureBuildPhase(r,`project.resolve`,()=>resolveDiscoveryProject(e)),o=await measureBuildPhase(r,`workspace.create`,()=>createApplicationBuildWorkspace(a.appRoot,t.vercelServiceOutput?.serviceOutputDirectory)),s=!1,c;try{c=await buildApplicationInWorkspace(o,t,r)}catch(e){throw s=e instanceof RecoverablePublicationError,e}finally{s||await measureBuildPhase(r,`workspace.remove`,()=>removeApplicationBuildWorkspace(o))}return r!==void 0&&n!==void 0&&await writeOptionalApplicationBuildProfile({outputDirectory:c,profileOutputPath:n,profiler:r}),c}async function buildApplicationInWorkspace(e,t,n){let r=await measureBuildPhase(n,`host.prepare`,()=>prepareProductionApplicationHost(e)),i=!!process.env.VERCEL,a=i?await measureBuildPhase(n,`vercel.service-prefix.resolve`,()=>resolveEveServicePrefixForVercelFunctionOutput(r.appRoot,r.compileResult.project.agentRoot)):void 0,o=normalizePublicRoutePrefix(a),s=o===EVE_ROUTE_PREFIX?void 0:o;if(t.publicRoutePrefix!==void 0&&s!==void 0&&t.publicRoutePrefix!==s)throw Error(`EVE_PUBLIC_ROUTE_PREFIX ${JSON.stringify(t.publicRoutePrefix)} conflicts with the configured Vercel service prefix ${JSON.stringify(a)}.`);let c=t.publicRoutePrefix??s,l=createProductionNitroArtifactsConfig(e.appRoot).sandboxScope,u=await measureBuildPhase(n,`nitro.create`,()=>createProductionApplicationNitro(r,{buildDir:e.nitro.buildDir,outputDir:e.publication.output.stagedDir,publicRoutePrefix:c,workspaceMember:t.workspaceMember}));try{if(!t.skipSandboxPrewarm){let t={appRoot:r.appRoot,compiledArtifactsSource:createDiskRuntimeCompiledArtifactsSource(e.compiler.rootDir,{moduleMapLoaderPath:resolvePackageSourceFilePath(`src/internal/authored-module-map-loader.ts`),sandboxAppRoot:r.appRoot,sandboxScope:l}),log(e){console.log(e)}};await measureBuildPhase(n,`sandbox.prewarm`,async()=>{i?await runVercelBuildPrewarm(t):await prewarmAppSandboxes(t)}),await refreshProductionCompiledArtifacts(r,e.host.artifactsDir)}await buildNitroOutput(u,n,`nitro`),i&&await measureBuildPhase(n,`vercel.workflow-function.materialize`,()=>materializeVercelWorkflowFunctionOutput(e.publication.output.stagedDir)),a!==void 0&&await measureBuildPhase(n,`vercel.functions.normalize`,()=>normalizeEveVercelFunctionOutput(e.publication.output.stagedDir,{servicePrefix:a}));let o=t.vercelServiceOutput;o!==void 0&&(await measureBuildPhase(n,`vercel.service-crons.normalize`,()=>normalizeVercelServiceCrons({publicRoutePrefix:c,serviceOutputDirectory:e.publication.output.stagedDir})),await measureBuildPhase(n,`vercel.host-middleware.copy`,()=>copyHostMiddlewareFunctions({hostOutputDirectory:o.hostOutputDirectory,serviceOutputDirectory:e.publication.output.stagedDir}))),await measureBuildPhase(n,`agent-summary.emit`,()=>emitVercelAgentSummary({manifest:r.compileResult.manifest,outputPath:e.publication.summary.stagedPath})),await measureBuildPhase(n,`connect-manifest.emit`,()=>emitConnectManifest({appRoot:r.appRoot,generatorVersion:resolveInstalledPackageInfo().version,manifest:r.compileResult.manifest,outputDirectory:e.publication.output.stagedDir,publicRoutePrefix:c})),i||await measureBuildPhase(n,`compiler-artifacts.stage`,()=>stageProductionCompilerArtifacts({compilerArtifactsRoot:e.compiler.artifactsDir,outputDir:e.publication.output.stagedDir}))}finally{await measureBuildPhase(n,`nitro.close`,()=>u.close())}return await measureBuildPhase(n,`output.publish`,()=>publishCompletedApplicationBuild(e)),e.publication.output.finalDir}async function publishCompletedApplicationBuild(e){await publishApplicationBuildArtifacts({appRoot:e.appRoot,finalOutputDir:e.publication.output.finalDir,finalSummaryPath:e.publication.summary.finalPath,scratchDir:e.rootDir,stagedOutputDir:e.publication.output.stagedDir,stagedSummaryPath:e.publication.summary.stagedPath})}export{buildApplication};
@@ -1,2 +1,2 @@
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(e,t){let n=resolve(e),r=createDiskProjectSource(),{diagnostics:i,manifest:a}=await discoverAgent({agentRoot:t.sourceRoot,appRoot:n,source:r,role:`extension`}),o=i.filter(e=>e.severity===`error`);if(o.length>0)throw Error(`Cannot build extension "${t.packageName}":\n${o.map(e=>` - ${e.message}`).join(`
1
+ import{mkdir,mkdtemp,rm}from"node:fs/promises";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{join,relative,resolve}from"node:path";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(e,t){let n=resolve(e),r=createDiskProjectSource(),{diagnostics:i,manifest:a}=await discoverAgent({agentRoot:t.sourceRoot,appRoot:n,source:r,role:`extension`}),o=i.filter(e=>e.severity===`error`);if(o.length>0)throw Error(`Cannot build extension "${t.packageName}":\n${o.map(e=>` - ${e.message}`).join(`
2
2
  `)}`);let s=discoverFlatModuleSource({rootEntries:await readSortedDirectoryEntries(r,t.sourceRoot),rootPath:t.sourceRoot,slotName:`extension`}).module;if(s===void 0)throw Error(`Cannot build extension "${t.packageName}": its source root "${t.sourceRoot}" is missing an "extension.<ext>" declaration. Add \`export default defineExtension(...)\` there (with or without config).`);let c=await mkdtemp(join(n,`.eve-extension-build-`)),l=join(c,`output`),u=join(l,relative(t.outDir,t.distRoot)),d=!1;try{await mkdir(u,{recursive:!0});let e=await emitExtensionDistribution({appRoot:n,declarationModule:s,declarationsRoot:join(c,`declarations`),manifest:a,runtimeDependencies:t.runtimeDependencies,shortName:t.shortName,sourceRoot:t.sourceRoot,stagedDistRoot:u,stagedOutDir:l,transactionRoot:c});return await ensureExtensionExports(n,t.outDir),await writeExtensionCompatibilityManifest(u,{kind:EXTENSION_COMPATIBILITY_MANIFEST_KIND,formatVersion:EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,builtWithEve:resolveInstalledPackageInfo().version,...t.externalDependencies.length===0?{}:{build:{externalDependencies:t.externalDependencies}},requires:await deriveExtensionCapabilityRequirements({runtimeImports:e,runtimeRoot:l,declarationModule:s,manifest:a,packageName:t.packageName,runtimeDependencies:t.runtimeDependencies,shortName:t.shortName,sourceRoot:t.sourceRoot})}),await replaceExtensionBuildOutput({outDir:t.outDir,stagedOutDir:l,transactionRoot:c}),t.outDir}catch(e){throw d=e instanceof ExtensionOutputRestoreError,e}finally{d||await rm(c,{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.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(e){let t=buildVercelAgentSummary({generatorVersion:e.generatorVersion,manifest:e.manifest});return await mkdir(dirname(e.outputPath),{recursive:!0}),await writeFile(e.outputPath,`${JSON.stringify(t,null,2)}\n`),e.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
+ import{mkdir,writeFile}from"node:fs/promises";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{dirname}from"node:path";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(e){let t=buildVercelAgentSummary({generatorVersion:e.generatorVersion,manifest:e.manifest});return await mkdir(dirname(e.outputPath),{recursive:!0}),await writeFile(e.outputPath,`${JSON.stringify(t,null,2)}\n`),e.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,3 +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{createDevelopmentNitroArtifactsConfig,createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{createApplicationRouteRegistry}from"#internal/nitro/host/application-route-registry.js";import{WorkflowBundleBuilder}from"#internal/workflow-bundle/builder.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(e,t){let n=join(resolveNitroWorkflowBuildDirectory(e),`${t.bundleName}-handler.mjs`),r=dirname(n),i=createRelativeImportSpecifier(r,t.bundlePath),a=t.directHandlers??[],o=a.length>0&&t.workflowWorldPluginPath!==void 0?createRelativeImportSpecifier(r,t.workflowWorldPluginPath):void 0,s=a.map(e=>{let t=createRelativeImportSpecifier(r,e.bundlePath);return{importSpecifier:t,isOwnBundle:t===i,queuePrefix:e.queuePrefix}});await mkdir(r,{recursive:!0}),await writeFile(n,buildWorkflowFileHandlerSource({bundlePath:i,directHandlers:s,runtimeImportSpecifier:t.runtimeImportSpecifier,workflowWorldPluginImportSpecifier:o})),e.options.handlers.push({handler:n,route:t.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(`
1
+ import{mkdir,writeFile}from"node:fs/promises";import{resolvePackageRoot,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{dirname,join,relative}from"node:path";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{createDevelopmentNitroArtifactsConfig,createProductionNitroArtifactsConfig}from"#internal/nitro/host/artifacts-config.js";import{createApplicationRouteRegistry}from"#internal/nitro/host/application-route-registry.js";import{WorkflowBundleBuilder}from"#internal/workflow-bundle/builder.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(e,t){let n=join(resolveNitroWorkflowBuildDirectory(e),`${t.bundleName}-handler.mjs`),r=dirname(n),i=createRelativeImportSpecifier(r,t.bundlePath),a=t.directHandlers??[],o=a.length>0&&t.workflowWorldPluginPath!==void 0?createRelativeImportSpecifier(r,t.workflowWorldPluginPath):void 0,s=a.map(e=>{let t=createRelativeImportSpecifier(r,e.bundlePath);return{importSpecifier:t,isOwnBundle:t===i,queuePrefix:e.queuePrefix}});await mkdir(r,{recursive:!0}),await writeFile(n,buildWorkflowFileHandlerSource({bundlePath:i,directHandlers:s,runtimeImportSpecifier:t.runtimeImportSpecifier,workflowWorldPluginImportSpecifier:o})),e.options.handlers.push({handler:n,route:t.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
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
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})}}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),r=new WorkflowBundleBuilder({authoredWorkflowModules:t.compiledArtifacts.authoredWorkflowModules,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 r.build({nitroStepOutfile:join(n,`steps.mjs`),nitroWorkflowOutfile:join(n,`workflows.mjs`)})});let i=createDevelopmentNitroArtifactsConfig({appRoot:t.appRoot,configuredWorld:t.compileResult.manifest.config.experimental?.workflow?.world}),a=createApplicationRouteRegistry(t,{development:!0});registerApplicationRoutes(e,i,a);let o=join(n,`workflows.mjs`),s=[];usesParentDevelopmentWorkflowWorld(t.compileResult.manifest.config.experimental?.workflow?.world)||s.push(createWorkflowDirectHandlerEntry(t,o));let c=findWorkflowRoute(a);c!==void 0&&await registerWorkflowRoute(e,t,o,s,c),e.routing.sync()}async function configureProductionNitroRoutes(e,t){let n=new WorkflowBundleBuilder({authoredWorkflowModules:t.compiledArtifacts.authoredWorkflowModules,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 r=createApplicationRouteRegistry(t);registerApplicationRoutes(e,createProductionNitroArtifactsConfig(t.appRoot),r);let i=join(t.workflowBuildDir,`workflows.mjs`),a=t.compileResult.manifest.config.experimental?.workflow?.world!==void 0,o=!isVercelBuildEnvironment()&&a?[createWorkflowDirectHandlerEntry(t,i)]:[],s=findWorkflowRoute(r);s!==void 0&&await registerWorkflowRoute(e,t,i,o,s),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{resolveAuthoredTsConfigPath}from"#internal/authored-module-loader.js";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{createExtensionScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{applyWorkflowTransform}from"#internal/workflow-bundle/workflow-builders.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{createCompiledSandboxProviderPrunePlugin}from"#internal/nitro/host/compiled-sandbox-provider-prune-plugin.js";import{createDevelopmentRuntimePrunePlugin}from"#internal/nitro/host/development-runtime-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";const WORKFLOW_ALIAS_SPECIFIERS=[`workflow`,`workflow/api`,`workflow/errors`,`workflow/internal/builtins`,`workflow/internal/private`,`workflow/runtime`],INSTRUMENTATION_ALIAS_PATHS={"eve/instrumentation":`src/public/instrumentation/index.ts`,"eve/instrumentation/otel":`src/public/instrumentation/otel.ts`},WORKFLOW_TRANSFORM_PATCHED=Symbol(`eve.workflow-transform-patched`),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 manifestHasWorkflowProgram(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>e.tools.some(e=>e.workflowProgram!==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([...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 collectConfiguredSandboxProviderNames(e){let t=[e,...e.subagents.map(e=>e.agent)];return new Set(t.map(e=>e.sandbox?.providerName).filter(e=>typeof e==`string`))}function shouldPruneLocalSandboxProviders(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,t,n){return t.startsWith(`workflow`)?resolveWorkflowModulePath(t):t.startsWith(`.`)||t.startsWith(`/`)||t.startsWith(`file://`)?resolveNitroModuleComparisonPath(n===void 0?e:dirname(resolveNitroModuleComparisonPath(e,n)),t):null}async function collectNitroStepTransformTargets(e,t){let n=await readFile(e,`utf8`),r=new Set;for(let i of parseImportedModuleSpecifiers(n)){let n=resolveNitroImportPath(t,i,e);n!==null&&r.add(normalizeStepTransformComparisonPath(n))}return r}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(/\/$/,``),i=normalizePath(t),a=r.toLowerCase(),o=i.toLowerCase();if(o.startsWith(`${a}/`))return i.slice(r.length+1);if(o===a)return`.`;let s=relative(r,i).replaceAll(`\\`,`/`);if(s.startsWith(`../`)&&(s=s.split(`/`).filter(e=>e!==`..`).join(`/`)),s.includes(`:`)||s.startsWith(`/`)){let e=i.split(`/`).pop();return e===void 0||e.length===0?`unknown.ts`:e}return s}function createPackageRelativeTransformFilename(e){let t=normalizePath(resolvePackageRoot()).replace(/\/$/,``),n=normalizePath(e),r=t.toLowerCase(),i=n.toLowerCase(),a=`${t}/src/`,o=`${r}/src/`,s=`${t}/dist/src/`,c=`${r}/dist/src/`;if(i.startsWith(o))return`src/${n.slice(a.length)}`;if(i.startsWith(c))return`src/${n.slice(s.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){e.hooks.hook(`rollup:before`,(n,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({name:`eve:workflow-step-module-side-effects`,async resolveId(n,r){let i=resolveNitroImportPath(e.options.rootDir,n,r);return i===null||!(await t()).has(normalizeStepTransformComparisonPath(i))?null:{id:i,moduleSideEffects:`no-treeshake`}}})})}function addNitroStepTransformPlugin(e,t){e.hooks.hook(`rollup:before`,(n,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({async transform(n,r){let i=await t(),a=resolveNitroModuleComparisonPath(e.options.rootDir,r);return i.has(normalizeStepTransformComparisonPath(a))?{code:(await applyWorkflowTransform(createRelativeTransformFilename(e.options.rootDir,a),n,`step`,a,e.options.rootDir)).code,map:null}:null},name:`eve:workflow-step-transform`})})}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{preset:n}=t,r=collectConfiguredSandboxProviderNames(e.compileResult.manifest),i=shouldPruneLocalSandboxProviders({configuredBackendNames:r,preset:n})?createCompiledSandboxProviderPrunePlugin():null,a=[],o=[];for(let[e,t]of Object.entries(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME))(r.has(e)?a:o).push(t);let s=createExtensionScopePlugin([e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({sourceRoot:e.sourceRoot,packageNamespace:e.packageNamespace})))),c=[e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),l=[t.development?null:createDevelopmentRuntimePrunePlugin(),i,createOptionalEngineDependencyPlugin(o),createExtensionExternalDependencyPlugin(c),s].filter(e=>e!==null);return{nitroRolldownConfig:{tsconfig:resolveAuthoredTsConfigPath(e.appRoot)},nitroRollupConfig:createNitroBundlerConfig(l),tracedAppDependencies:collectHostedTraceDependencies(e,a),tracedAppDependencyPaths:resolveExtensionExternalDependencyPaths(c)}}function createApplicationNitroPlugins(e){let t=[e.compiledArtifacts.bootstrapPath,e.compiledArtifacts.workflowWorldPluginPath];return manifestHasWorkflowProgram(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;for(let[t,n]of Object.entries(INSTRUMENTATION_ALIAS_PATHS))e.options.alias[t]=resolvePackageSourceFilePath(n);addWorkflowModuleSideEffectsPlugin(e,t.workflowBuildDir),patchWorkflowTransformExcludePath(e,t.workflowBuildDir),t.compiledArtifacts.instrumentationSourcePaths!==void 0&&addInstrumentationModuleSideEffectsPlugin(e,t.compiledArtifacts.instrumentationSourcePaths)}function configureNitroStepPlugins(e,t){let n,getTargets=()=>n??=collectNitroStepTransformTargets(t,e.options.rootDir),invalidate=()=>{n=void 0};return e.hooks.hook(`build:before`,invalidate),addNitroStepModuleSideEffectsPlugin(e,getTargets),addNitroStepTransformPlugin(e,getTargets),[invalidate]}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,{development:!0,preset:void 0}),r=createApplicationNitroPlugins(e);e.compiledArtifacts.instrumentationPluginPath===void 0&&r.unshift(resolvePackageSourceFilePath(`src/internal/nitro/host/local-tracing-runtime-plugin.ts`)),await prepareEveVersionedCacheDirectory(t);let i=await createNitro({_cli:{command:`dev`},buildDir:t,dev:!0,features:{websocket:!0},logLevel:1,output:{dir:e.workspace.nitroOutputDir},plugins:r,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 a=join(i.options.buildDir,`workflow`,`steps.mjs`);configureSharedApplicationNitro(i,e);let o=configureNitroStepPlugins(i,a);return i.hooks.hook(`dev:reload`,()=>{for(let e of o)e()}),externalizeDevelopmentWorkflowBundle(i,e),await configureDevelopmentNitroRoutes(i,e),await addNitroStepNoExternals(i,a),i}async function createProductionApplicationNitro(e,t){let n=resolveProductionNitroPreset(),r=createApplicationNitroBundlerConfiguration(e,{development:!1,preset:n}),i=createApplicationNitroPlugins(e);i.push(resolvePackageSourceFilePath(`src/internal/nitro/host/sandbox-shutdown-plugin.ts`)),await prepareEveVersionedCacheDirectory(t.buildDir);let a=await createNitro({_cli:{command:`build`},buildDir:t.buildDir,dev:!1,features:{websocket:manifestHasWebSocketChannel(e.compileResult.manifest)},output:{dir:t.outputDir},preset:n,plugins:i,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:r.nitroRolldownConfig,rollupConfig:r.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:r.tracedAppDependencies,traceOpts:{nft:{paths:r.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:n===`vercel`,publicRoutePrefix:t.publicRoutePrefix,workspaceMember:t.workspaceMember})});if(await writeEveVersionedCacheMetadata(t.buildDir),configureSharedApplicationNitro(a,e),configureNitroStepPlugins(a,join(e.workflowBuildDir,`steps.mjs`)),e.scheduleRegistrations.length>0){applyEveCronHandlerRoute(a);let t=createProductionNitroArtifactsConfig(e.appRoot);registerScheduleTaskHandlers(a,{artifactsConfig:t,dispatchModulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/schedule-task.ts`),registrations:e.scheduleRegistrations})}return await configureProductionNitroRoutes(a,e),await addNitroStepNoExternals(a,join(e.workflowBuildDir,`steps.mjs`)),a}export{createDevelopmentApplicationNitro,createProductionApplicationNitro,shouldPruneLocalSandboxProviders};
1
+ import{readFile}from"node:fs/promises";import{resolvePackageRoot,resolvePackageSourceDirectoryPath,resolvePackageSourceFilePath,resolveWorkflowModulePath}from"#internal/application/package.js";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{fileURLToPath}from"node:url";import{resolveAuthoredTsConfigPath}from"#internal/authored-module-loader.js";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{createExtensionScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{applyWorkflowTransform}from"#internal/workflow-bundle/workflow-builders.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{configureInstrumentationEntry}from"#internal/nitro/host/instrumentation-entry.js";import{createCompiledSandboxProviderPrunePlugin}from"#internal/nitro/host/compiled-sandbox-provider-prune-plugin.js";import{createDevelopmentRuntimePrunePlugin}from"#internal/nitro/host/development-runtime-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";const WORKFLOW_ALIAS_SPECIFIERS=[`workflow`,`workflow/api`,`workflow/errors`,`workflow/internal/builtins`,`workflow/internal/private`,`workflow/runtime`],INSTRUMENTATION_ALIAS_PATHS={"eve/instrumentation":`src/public/instrumentation/index.ts`,"eve/instrumentation/otel":`src/public/instrumentation/otel.ts`},WORKFLOW_TRANSFORM_PATCHED=Symbol(`eve.workflow-transform-patched`),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 manifestHasWorkflowProgram(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>e.tools.some(e=>e.workflowProgram!==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([...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 collectConfiguredSandboxProviderNames(e){let t=[e,...e.subagents.map(e=>e.agent)];return new Set(t.map(e=>e.sandbox?.providerName).filter(e=>typeof e==`string`))}function shouldPruneLocalSandboxProviders(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,t,n){return t.startsWith(`workflow`)?resolveWorkflowModulePath(t):t.startsWith(`.`)||t.startsWith(`/`)||t.startsWith(`file://`)?resolveNitroModuleComparisonPath(n===void 0?e:dirname(resolveNitroModuleComparisonPath(e,n)),t):null}async function collectNitroStepTransformTargets(e,t){let n=await readFile(e,`utf8`),r=new Set;for(let i of parseImportedModuleSpecifiers(n)){let n=resolveNitroImportPath(t,i,e);n!==null&&r.add(normalizeStepTransformComparisonPath(n))}return r}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(/\/$/,``),i=normalizePath(t),a=r.toLowerCase(),o=i.toLowerCase();if(o.startsWith(`${a}/`))return i.slice(r.length+1);if(o===a)return`.`;let s=relative(r,i).replaceAll(`\\`,`/`);if(s.startsWith(`../`)&&(s=s.split(`/`).filter(e=>e!==`..`).join(`/`)),s.includes(`:`)||s.startsWith(`/`)){let e=i.split(`/`).pop();return e===void 0||e.length===0?`unknown.ts`:e}return s}function createPackageRelativeTransformFilename(e){let t=normalizePath(resolvePackageRoot()).replace(/\/$/,``),n=normalizePath(e),r=t.toLowerCase(),i=n.toLowerCase(),a=`${t}/src/`,o=`${r}/src/`,s=`${t}/dist/src/`,c=`${r}/dist/src/`;if(i.startsWith(o))return`src/${n.slice(a.length)}`;if(i.startsWith(c))return`src/${n.slice(s.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){e.hooks.hook(`rollup:before`,(n,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({name:`eve:workflow-step-module-side-effects`,async resolveId(n,r){let i=resolveNitroImportPath(e.options.rootDir,n,r);return i===null||!(await t()).has(normalizeStepTransformComparisonPath(i))?null:{id:i,moduleSideEffects:`no-treeshake`}}})})}function addNitroStepTransformPlugin(e,t){e.hooks.hook(`rollup:before`,(n,r)=>{Array.isArray(r.plugins)&&r.plugins.unshift({async transform(n,r){let i=await t(),a=resolveNitroModuleComparisonPath(e.options.rootDir,r);return i.has(normalizeStepTransformComparisonPath(a))?{code:(await applyWorkflowTransform(createRelativeTransformFilename(e.options.rootDir,a),n,`step`,a,e.options.rootDir)).code,map:null}:null},name:`eve:workflow-step-transform`})})}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{preset:n}=t,r=collectConfiguredSandboxProviderNames(e.compileResult.manifest),i=shouldPruneLocalSandboxProviders({configuredBackendNames:r,preset:n})?createCompiledSandboxProviderPrunePlugin():null,a=[],o=[];for(let[e,t]of Object.entries(OPTIONAL_ENGINE_PACKAGES_BY_BACKEND_NAME))(r.has(e)?a:o).push(t);let s=createExtensionScopePlugin([e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({sourceRoot:e.sourceRoot,packageNamespace:e.packageNamespace})))),c=[e.compileResult.manifest,...e.compileResult.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),l=[t.development?null:createDevelopmentRuntimePrunePlugin(),i,createOptionalEngineDependencyPlugin(o),createExtensionExternalDependencyPlugin(c),s].filter(e=>e!==null);return{nitroRolldownConfig:{tsconfig:resolveAuthoredTsConfigPath(e.appRoot)},nitroRollupConfig:createNitroBundlerConfig(l),tracedAppDependencies:collectHostedTraceDependencies(e,a),tracedAppDependencyPaths:resolveExtensionExternalDependencyPaths(c)}}function createApplicationNitroPlugins(e){let t=[e.compiledArtifacts.bootstrapPath,e.compiledArtifacts.workflowWorldPluginPath];return manifestHasWorkflowProgram(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){t.compiledArtifacts.instrumentationPluginPath!==void 0&&configureInstrumentationEntry(e,t.compiledArtifacts.instrumentationPluginPath),addNitroRoutingImportSpecifierPlugin(e);let n=resolveWorkflowAliases();for(let[t,r]of Object.entries(n))e.options.alias[t]=r;for(let[t,n]of Object.entries(INSTRUMENTATION_ALIAS_PATHS))e.options.alias[t]=resolvePackageSourceFilePath(n);addWorkflowModuleSideEffectsPlugin(e,t.workflowBuildDir),patchWorkflowTransformExcludePath(e,t.workflowBuildDir),t.compiledArtifacts.instrumentationSourcePaths!==void 0&&addInstrumentationModuleSideEffectsPlugin(e,t.compiledArtifacts.instrumentationSourcePaths)}function configureNitroStepPlugins(e,t){let n,getTargets=()=>n??=collectNitroStepTransformTargets(t,e.options.rootDir),invalidate=()=>{n=void 0};return e.hooks.hook(`build:before`,invalidate),addNitroStepModuleSideEffectsPlugin(e,getTargets),addNitroStepTransformPlugin(e,getTargets),[invalidate]}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,{development:!0,preset:void 0}),r=createApplicationNitroPlugins(e);e.compiledArtifacts.instrumentationPluginPath===void 0&&r.unshift(resolvePackageSourceFilePath(`src/internal/nitro/host/local-tracing-runtime-plugin.ts`)),await prepareEveVersionedCacheDirectory(t);let i=await createNitro({_cli:{command:`dev`},buildDir:t,dev:!0,features:{websocket:!0},logLevel:1,output:{dir:e.workspace.nitroOutputDir},plugins:r,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 a=join(i.options.buildDir,`workflow`,`steps.mjs`);configureSharedApplicationNitro(i,e);let o=configureNitroStepPlugins(i,a);return i.hooks.hook(`dev:reload`,()=>{for(let e of o)e()}),externalizeDevelopmentWorkflowBundle(i,e),await configureDevelopmentNitroRoutes(i,e),await addNitroStepNoExternals(i,a),i}async function createProductionApplicationNitro(e,t){let n=resolveProductionNitroPreset(),r=createApplicationNitroBundlerConfiguration(e,{development:!1,preset:n}),i=createApplicationNitroPlugins(e);i.push(resolvePackageSourceFilePath(`src/internal/nitro/host/sandbox-shutdown-plugin.ts`)),await prepareEveVersionedCacheDirectory(t.buildDir);let a=await createNitro({_cli:{command:`build`},buildDir:t.buildDir,dev:!1,features:{websocket:manifestHasWebSocketChannel(e.compileResult.manifest)},output:{dir:t.outputDir},preset:n,plugins:i,publicAssets:[],scanDirs:[resolvePackageSourceDirectoryPath(`src/execution`)],rolldownConfig:r.nitroRolldownConfig,rollupConfig:r.nitroRollupConfig,rootDir:e.appRoot,serverDir:!1,traceDeps:r.tracedAppDependencies,traceOpts:{nft:{paths:r.tracedAppDependencyPaths}},vercel:createEveVercelOptions({agentName:e.compileResult.manifest.config.name,enabled:n===`vercel`,publicRoutePrefix:t.publicRoutePrefix,workspaceMember:t.workspaceMember})});if(await writeEveVersionedCacheMetadata(t.buildDir),configureSharedApplicationNitro(a,e),configureNitroStepPlugins(a,join(e.workflowBuildDir,`steps.mjs`)),e.scheduleRegistrations.length>0){applyEveCronHandlerRoute(a);let t=createProductionNitroArtifactsConfig(e.appRoot);registerScheduleTaskHandlers(a,{artifactsConfig:t,dispatchModulePath:resolvePackageSourceFilePath(`src/internal/nitro/routes/schedule-task.ts`),registrations:e.scheduleRegistrations})}return await configureProductionNitroRoutes(a,e),await addNitroStepNoExternals(a,join(e.workflowBuildDir,`steps.mjs`)),a}export{createDevelopmentApplicationNitro,createProductionApplicationNitro,shouldPruneLocalSandboxProviders};
@@ -1 +1 @@
1
- import{getDevelopmentEnvironmentFilePaths}from"#cli/dev/environment.js";import{dirname,join,normalize,resolve,sep}from"node:path";import{existsSync}from"node:fs";import{toErrorMessage}from"#shared/errors.js";import{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,STRUCTURAL_RELOAD_LOG_LINE,formatChangeDetectedLogLine}from"#internal/nitro/host/dev-watcher-log.js";import{resolveDevelopmentSourceSnapshotWatchPaths}from"#internal/nitro/dev-runtime-source-snapshot.js";import{resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";import{watch as watch$1}from"#compiled/chokidar/index.js";const WATCHED_LOCKFILE_NAMES=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`],WATCH_ROOT_MARKER_NAMES=[`.git`,`pnpm-workspace.yaml`],WATCHER_IGNORED_DIRECTORY_NAMES=new Set([`.devtools`,`.generated`,`.eve`,`.git`,`.next`,`.output`,`.turbo`,`.vercel`,`build`,`dist`,`node_modules`]);async function startAuthoredSourceWatcher(e){let t=e.preparedHost,n=!1,r=Promise.resolve(),i,a=!1,o=new Set,s=new Map,c=new Set,l=await resolveAuthoredWatchPaths(t),u=createWatchPathMap(l),d=watch$1(l,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:160},followSymlinks:!1,ignoreInitial:!0,ignored:e=>shouldIgnoreWatcherPath(e,t.workspaceExtensions)}),f=waitForWatcherReady(d),rebuild=async(i,a=!1)=>{n||o.size>0||(r=r.then(async()=>{if(n)return;let r=[...s.values()];if(!i&&r.length===0)return;let o=[...c];s.clear(),c.clear();let l=t;!a&&r.length>0&&console.log(formatChangeDetectedLogLine(l.appRoot,r));try{let n=await e.coordinator.rebuild({changedPaths:o});t=n.host,a||(n.kind===`structural`?console.log(STRUCTURAL_RELOAD_LOG_LINE):console.log(AUTHORED_ARTIFACTS_UPDATED_LOG_LINE)),u=syncWatcherPaths({nextWatchPaths:await resolveAuthoredWatchPaths(t),previousWatchPathsByKey:u,watcher:d})}catch(e){console.error(`[eve:dev] rebuild failed: ${toErrorMessage(e)}`)}}).catch(e=>{console.error(`[eve:dev] rebuild queue error: ${toErrorMessage(e)}`)}),await r)},flush=async()=>{i!==void 0&&(clearTimeout(i),i=void 0),await rebuild(!1)},forceRebuild=async(e=!1)=>{i!==void 0&&(clearTimeout(i),i=void 0),await rebuild(!0,e)};return d.on(`all`,(e,t)=>{!n&&a&&e!==`addDir`&&e!==`unlinkDir`&&(s.set(`${e}:${t}`,{event:e,path:t}),c.add(t),i!==void 0&&clearTimeout(i),i=setTimeout(()=>{i=void 0,flush()},120))}),await f,a=!0,{async close(){n=!0,i!==void 0&&(clearTimeout(i),i=void 0),await d.close(),await r},flush,rebuild:forceRebuild,async suspend(e){o.has(e)||(o.add(e),i!==void 0&&(clearTimeout(i),i=void 0),await r)},async resume(e,t){o.delete(e)&&o.size===0&&await forceRebuild(t?.silent)}}}async function waitForWatcherReady(e){await new Promise((t,n)=>{e.on(`ready`,()=>{t()}),e.on(`error`,e=>{n(e)})})}async function resolveAuthoredWatchPaths(e){let t=new Set([e.compileResult.project.agentRoot,join(e.appRoot,`package.json`),join(e.appRoot,`jsconfig.json`),join(e.appRoot,`tsconfig.json`),join(e.appRoot,`tsconfig.*.json`)]),n=await resolveTsConfigWatchPaths(e.appRoot),r=e.generation.sourceWatchPaths??await resolveDevelopmentSourceSnapshotWatchPaths(e.appRoot);for(let n of e.workspaceExtensions){t.add(n.config.sourceRoot);for(let e of n.buildConfigPaths)t.add(e)}for(let n of getDevelopmentEnvironmentFilePaths(e.appRoot))t.add(n);for(let e of r)t.add(e);for(let e of n)t.add(e);for(let n of resolveLockfileSearchDirectories(e.appRoot))for(let e of WATCHED_LOCKFILE_NAMES)t.add(join(n,e));return[...t].sort((e,t)=>e.localeCompare(t))}function createWatchPathMap(e){let t=new Map;for(let n of e)t.set(toWatchPathKey(n),n);return t}function syncWatcherPaths(e){let t=createWatchPathMap(e.nextWatchPaths),n=[],r=[];for(let[r,i]of t)e.previousWatchPathsByKey.has(r)||n.push(i);for(let[n,i]of e.previousWatchPathsByKey)t.has(n)||r.push(i);return n.length>0&&e.watcher.add(n),r.length>0&&e.watcher.unwatch(r),t}function toWatchPathKey(e){return normalize(resolve(e))}function resolveLockfileSearchDirectories(e){let t=resolve(e),n=[t],r=t;for(;;){if(hasWatchRootMarker(r))return n;let e=dirname(r);if(e===r)return[t];r=e,n.push(r)}}function hasWatchRootMarker(e){return WATCH_ROOT_MARKER_NAMES.some(t=>existsSync(join(e,t)))}async function resolveTsConfigWatchPaths(e){return await resolveTsConfigDependencyPaths(e)}function shouldIgnoreWatcherPath(e,t){return normalize(e).split(sep).filter(Boolean).some(e=>WATCHER_IGNORED_DIRECTORY_NAMES.has(e))||t.some(t=>isPathInsideOrEqual(e,t.config.outDir))}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{startAuthoredSourceWatcher};
1
+ import{getDevelopmentEnvironmentFilePaths}from"#cli/dev/environment.js";import{existsSync}from"node:fs";import{dirname,join,normalize,resolve,sep}from"node:path";import{toErrorMessage}from"#shared/errors.js";import{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,STRUCTURAL_RELOAD_LOG_LINE,formatChangeDetectedLogLine}from"#internal/nitro/host/dev-watcher-log.js";import{resolveDevelopmentSourceSnapshotWatchPaths}from"#internal/nitro/dev-runtime-source-snapshot.js";import{resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";import{watch as watch$1}from"#compiled/chokidar/index.js";const WATCHED_LOCKFILE_NAMES=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`],WATCH_ROOT_MARKER_NAMES=[`.git`,`pnpm-workspace.yaml`],WATCHER_IGNORED_DIRECTORY_NAMES=new Set([`.devtools`,`.generated`,`.eve`,`.git`,`.next`,`.output`,`.turbo`,`.vercel`,`build`,`dist`,`node_modules`]);async function startAuthoredSourceWatcher(e){let t=e.preparedHost,n=!1,r=Promise.resolve(),i,a=!1,o=new Set,s=new Map,c=new Set,l=await resolveAuthoredWatchPaths(t),u=createWatchPathMap(l),d=watch$1(l,{awaitWriteFinish:{pollInterval:50,stabilityThreshold:160},followSymlinks:!1,ignoreInitial:!0,ignored:e=>shouldIgnoreWatcherPath(e,t.workspaceExtensions)}),f=waitForWatcherReady(d),rebuild=async(i,a=!1)=>{n||o.size>0||(r=r.then(async()=>{if(n)return;let r=[...s.values()];if(!i&&r.length===0)return;let o=[...c];s.clear(),c.clear();let l=t;!a&&r.length>0&&console.log(formatChangeDetectedLogLine(l.appRoot,r));try{let n=await e.coordinator.rebuild({changedPaths:o});t=n.host,a||(n.kind===`structural`?console.log(STRUCTURAL_RELOAD_LOG_LINE):console.log(AUTHORED_ARTIFACTS_UPDATED_LOG_LINE)),u=syncWatcherPaths({nextWatchPaths:await resolveAuthoredWatchPaths(t),previousWatchPathsByKey:u,watcher:d})}catch(e){console.error(`[eve:dev] rebuild failed: ${toErrorMessage(e)}`)}}).catch(e=>{console.error(`[eve:dev] rebuild queue error: ${toErrorMessage(e)}`)}),await r)},flush=async()=>{i!==void 0&&(clearTimeout(i),i=void 0),await rebuild(!1)},forceRebuild=async(e=!1)=>{i!==void 0&&(clearTimeout(i),i=void 0),await rebuild(!0,e)};return d.on(`all`,(e,t)=>{!n&&a&&e!==`addDir`&&e!==`unlinkDir`&&(s.set(`${e}:${t}`,{event:e,path:t}),c.add(t),i!==void 0&&clearTimeout(i),i=setTimeout(()=>{i=void 0,flush()},120))}),await f,a=!0,{async close(){n=!0,i!==void 0&&(clearTimeout(i),i=void 0),await d.close(),await r},flush,rebuild:forceRebuild,async suspend(e){o.has(e)||(o.add(e),i!==void 0&&(clearTimeout(i),i=void 0),await r)},async resume(e,t){o.delete(e)&&o.size===0&&await forceRebuild(t?.silent)}}}async function waitForWatcherReady(e){await new Promise((t,n)=>{e.on(`ready`,()=>{t()}),e.on(`error`,e=>{n(e)})})}async function resolveAuthoredWatchPaths(e){let t=new Set([e.compileResult.project.agentRoot,join(e.appRoot,`package.json`),join(e.appRoot,`jsconfig.json`),join(e.appRoot,`tsconfig.json`),join(e.appRoot,`tsconfig.*.json`)]),n=await resolveTsConfigWatchPaths(e.appRoot),r=e.generation.sourceWatchPaths??await resolveDevelopmentSourceSnapshotWatchPaths(e.appRoot);for(let n of e.workspaceExtensions){t.add(n.config.sourceRoot);for(let e of n.buildConfigPaths)t.add(e)}for(let n of getDevelopmentEnvironmentFilePaths(e.appRoot))t.add(n);for(let e of r)t.add(e);for(let e of n)t.add(e);for(let n of resolveLockfileSearchDirectories(e.appRoot))for(let e of WATCHED_LOCKFILE_NAMES)t.add(join(n,e));return[...t].sort((e,t)=>e.localeCompare(t))}function createWatchPathMap(e){let t=new Map;for(let n of e)t.set(toWatchPathKey(n),n);return t}function syncWatcherPaths(e){let t=createWatchPathMap(e.nextWatchPaths),n=[],r=[];for(let[r,i]of t)e.previousWatchPathsByKey.has(r)||n.push(i);for(let[n,i]of e.previousWatchPathsByKey)t.has(n)||r.push(i);return n.length>0&&e.watcher.add(n),r.length>0&&e.watcher.unwatch(r),t}function toWatchPathKey(e){return normalize(resolve(e))}function resolveLockfileSearchDirectories(e){let t=resolve(e),n=[t],r=t;for(;;){if(hasWatchRootMarker(r))return n;let e=dirname(r);if(e===r)return[t];r=e,n.push(r)}}function hasWatchRootMarker(e){return WATCH_ROOT_MARKER_NAMES.some(t=>existsSync(join(e,t)))}async function resolveTsConfigWatchPaths(e){return await resolveTsConfigDependencyPaths(e)}function shouldIgnoreWatcherPath(e,t){return normalize(e).split(sep).filter(Boolean).some(e=>WATCHER_IGNORED_DIRECTORY_NAMES.has(e))||t.some(t=>isPathInsideOrEqual(e,t.config.outDir))}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{startAuthoredSourceWatcher};
@@ -1 +1 @@
1
- import{createRequire}from"node:module";import{dirname,join,resolve}from"node:path";import{existsSync,readFileSync,realpathSync}from"node:fs";function createExtensionExternalDependencyPlugin(e){let t=collectDependencyAnchors(e);return t.size===0?null:{name:`eve-extension-external-dependency`,resolveId(e){return[...t.keys()].find(t=>e===t||e.startsWith(`${t}/`))===void 0?null:{external:!0,id:e}}}}function resolveExtensionExternalDependencyPaths(e){let t={};for(let[n,r]of collectDependencyAnchors(e)){for(let e of r)try{t[n]=resolveDependencyEntry(n,e);break}catch{}if(t[n]===void 0)throw Error(`Cannot resolve extension external dependency "${n}" from its mounted extension package.`)}return t}function resolveDependencyEntry(e,t){let n=createRequire(t);try{return n.resolve(e)}catch(t){let r=n.resolve.paths(e)?.map(t=>join(t,e,`package.json`)).find(existsSync);if(r===void 0)throw t;let i=JSON.parse(readFileSync(r,`utf8`)),a=resolveImportExport(i.exports)??stringValue(i.module)??stringValue(i.main);if(a===void 0)throw t;return resolve(dirname(r),a)}}function resolveImportExport(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(resolveImportExport).find(e=>e!==void 0);if(typeof e!=`object`||!e)return;let t=e;if(`.`in t)return resolveImportExport(t[`.`]);for(let e of[`node`,`import`,`default`]){let n=resolveImportExport(t[e]);if(n!==void 0)return n}}function stringValue(e){return typeof e==`string`?e:void 0}function collectDependencyAnchors(e){let t=new Map;for(let n of e)for(let e of n.externalDependencies){let r=t.get(e)??[];r.push(join(realpathSync(n.sourceRoot),`_manifest.json`)),t.set(e,r)}return t}export{createExtensionExternalDependencyPlugin,resolveExtensionExternalDependencyPaths};
1
+ import{createRequire}from"node:module";import{existsSync,readFileSync,realpathSync}from"node:fs";import{dirname,join,resolve}from"node:path";function createExtensionExternalDependencyPlugin(e){let t=collectDependencyAnchors(e);return t.size===0?null:{name:`eve-extension-external-dependency`,resolveId(e){return[...t.keys()].find(t=>e===t||e.startsWith(`${t}/`))===void 0?null:{external:!0,id:e}}}}function resolveExtensionExternalDependencyPaths(e){let t={};for(let[n,r]of collectDependencyAnchors(e)){for(let e of r)try{t[n]=resolveDependencyEntry(n,e);break}catch{}if(t[n]===void 0)throw Error(`Cannot resolve extension external dependency "${n}" from its mounted extension package.`)}return t}function resolveDependencyEntry(e,t){let n=createRequire(t);try{return n.resolve(e)}catch(t){let r=n.resolve.paths(e)?.map(t=>join(t,e,`package.json`)).find(existsSync);if(r===void 0)throw t;let i=JSON.parse(readFileSync(r,`utf8`)),a=resolveImportExport(i.exports)??stringValue(i.module)??stringValue(i.main);if(a===void 0)throw t;return resolve(dirname(r),a)}}function resolveImportExport(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(resolveImportExport).find(e=>e!==void 0);if(typeof e!=`object`||!e)return;let t=e;if(`.`in t)return resolveImportExport(t[`.`]);for(let e of[`node`,`import`,`default`]){let n=resolveImportExport(t[e]);if(n!==void 0)return n}}function stringValue(e){return typeof e==`string`?e:void 0}function collectDependencyAnchors(e){let t=new Map;for(let n of e)for(let e of n.externalDependencies){let r=t.get(e)??[];r.push(join(realpathSync(n.sourceRoot),`_manifest.json`)),t.set(e,r)}return t}export{createExtensionExternalDependencyPlugin,resolveExtensionExternalDependencyPaths};
@@ -0,0 +1,3 @@
1
+ import type { Nitro } from "nitro/types";
2
+ /** Awaits instrumentation before importing the preset's server dependency graph. */
3
+ export declare function configureInstrumentationEntry(nitro: Nitro, instrumentationPath: string): void;
@@ -0,0 +1,2 @@
1
+ import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";const INSTRUMENTATION_ENTRY=`#eve/instrumentation-entry`;function configureInstrumentationEntry(e,t){e.options.inlineDynamicImports=!1,e.options.virtual[INSTRUMENTATION_ENTRY]=()=>[`await import(${stringifyEsmImportSpecifier(t)});`,`const { default: server } = await import(${stringifyEsmImportSpecifier(e.options.entry)});`,`export default server;`].join(`
2
+ `),e.hooks.hook(`rollup:before`,(e,t)=>{t.input=INSTRUMENTATION_ENTRY})}export{configureInstrumentationEntry};
@@ -1 +1 @@
1
- import{basename}from"node:path";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{DEVELOPMENT_WORKER_APP_ROOT_ENV}from"#internal/workflow/development-world-protocol.js";import{installLocalInstrumentationRuntime}from"#tracing/local-instrumentation-runtime.js";const appRoot=process.env[DEVELOPMENT_WORKER_APP_ROOT_ENV];if(appRoot===void 0)throw Error(`${DEVELOPMENT_WORKER_APP_ROOT_ENV} is required for local tracing.`);const runtime=installLocalInstrumentationRuntime({appRoot,frameworkVersion:resolveInstalledPackageInfo().version,serviceName:basename(appRoot)});function installLocalTracingRuntimePlugin(e){e?.hooks?.hook(`close`,()=>runtime.shutdown())}export{installLocalTracingRuntimePlugin as default};
1
+ import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{basename}from"node:path";import{DEVELOPMENT_WORKER_APP_ROOT_ENV}from"#internal/workflow/development-world-protocol.js";import{installLocalInstrumentationRuntime}from"#tracing/local-instrumentation-runtime.js";const appRoot=process.env[DEVELOPMENT_WORKER_APP_ROOT_ENV];if(appRoot===void 0)throw Error(`${DEVELOPMENT_WORKER_APP_ROOT_ENV} is required for local tracing.`);const runtime=installLocalInstrumentationRuntime({appRoot,frameworkVersion:resolveInstalledPackageInfo().version,serviceName:basename(appRoot)});function installLocalTracingRuntimePlugin(e){e?.hooks?.hook(`close`,()=>runtime.shutdown())}export{installLocalTracingRuntimePlugin as default};
@@ -1 +1 @@
1
- import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";function normalizePath(e){return e.replaceAll(`\\`,`/`)}function isNodeModulesPath(e){return normalizePath(e).split(`/`).includes(`node_modules`)}function hasPathSegments(e,t){let n=normalizePath(e).split(`/`).filter(Boolean);return n.some((e,r)=>t.every((e,t)=>n[r+t]===e))}function isCompiledVendorPath(e){return hasPathSegments(e,[`.generated`,`compiled`])||hasPathSegments(e,[`dist`,`src`,`compiled`])}function getLogFilePaths(e){if(typeof e!=`object`||!e)return[];let t=e,n=Array.isArray(t.ids)?t.ids:[];return[t.id,...n,t.loc?.file].filter(e=>typeof e==`string`)}function isVendoredDependencyWarning(e){let t=getLogFilePaths(e);return t.length>0&&t.every(e=>isNodeModulesPath(e)||isCompiledVendorPath(e))}function onNitroBundlerLog(e,t,n){e===`warn`&&isVendoredDependencyWarning(t)||n(e,t)}function createNitroBundlerConfig(e){return{onLog:onNitroBundlerLog,plugins:[createNodeEsmCompatBannerPlugin(),...e]}}export{createNitroBundlerConfig};
1
+ import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{onVendoredDependencyLog}from"#internal/bundler/vendored-dependency-log.js";function createNitroBundlerConfig(e){return{onLog:onVendoredDependencyLog,plugins:[createNodeEsmCompatBannerPlugin(),...e]}}export{createNitroBundlerConfig};
@@ -1,5 +1,5 @@
1
1
  import type { Nitro } from "nitro/types";
2
- import { type ScheduleRegistration } from "#runtime/schedules/register.js";
2
+ import type { ScheduleRegistration } from "#runtime/schedules/register.js";
3
3
  import type { NitroArtifactsConfig } from "#internal/nitro/routes/runtime-artifacts.js";
4
4
  interface ScheduleTaskNitro {
5
5
  options: Pick<Nitro["options"], "experimental" | "scheduledTasks" | "tasks" | "virtual">;
@@ -17,16 +17,6 @@ export interface RegisterScheduleTaskHandlersInput {
17
17
  readonly dispatchModulePath: string;
18
18
  readonly registrations: readonly ScheduleRegistration[];
19
19
  }
20
- /**
21
- * Inputs needed to reconcile schedule task handlers when authored sources
22
- * change in dev mode.
23
- */
24
- export interface SyncScheduleTaskHandlersInput {
25
- readonly artifactsConfig: NitroArtifactsConfig;
26
- readonly dispatchModulePath: string;
27
- readonly next: readonly ScheduleRegistration[];
28
- readonly previous: readonly ScheduleRegistration[];
29
- }
30
20
  /**
31
21
  * Registers compiled authored schedules as virtual Nitro task handlers.
32
22
  *
@@ -43,18 +33,4 @@ export interface SyncScheduleTaskHandlersInput {
43
33
  * the handler does not depend on a global runtime configuration store.
44
34
  */
45
35
  export declare function registerScheduleTaskHandlers(nitro: ScheduleTaskNitro, input: RegisterScheduleTaskHandlersInput): void;
46
- /**
47
- * Replaces the currently-registered eve schedule task handlers when the
48
- * compiled authored schedule set changes.
49
- *
50
- * Returns `true` when the registration set changed (and the caller should
51
- * trigger a Nitro rebuild reload), `false` when it was a structural no-op.
52
- */
53
- export declare function syncScheduleTaskHandlers(nitro: ScheduleTaskNitro, input: SyncScheduleTaskHandlersInput): boolean;
54
- /**
55
- * Removes every eve-owned schedule task entry, virtual handler module, and
56
- * cron entry from the Nitro options. Used by the dev watcher before
57
- * re-registering the latest compiled set.
58
- */
59
- export declare function removeScheduleTaskHandlers(nitro: ScheduleTaskNitro): void;
60
36
  export {};
@@ -1,2 +1,2 @@
1
- import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";import{EVE_SCHEDULE_TASK_NAME_PREFIX}from"#runtime/schedules/register.js";const EVE_SCHEDULE_TASK_VIRTUAL_ID_PREFIX=`#eve-schedule-task/`;function registerScheduleTaskHandlers(e,t){if(t.registrations.length!==0){e.options.experimental.tasks=!0;for(let n of t.registrations)addScheduleTaskVirtualHandler(e,{artifactsConfig:t.artifactsConfig,dispatchModulePath:t.dispatchModulePath,registration:n})}}function syncScheduleTaskHandlers(e,t){let n=!areScheduleRegistrationsEqual(t.previous,t.next);return removeScheduleTaskHandlers(e),registerScheduleTaskHandlers(e,{artifactsConfig:t.artifactsConfig,dispatchModulePath:t.dispatchModulePath,registrations:t.next}),n}function removeScheduleTaskHandlers(e){for(let t of Object.keys(e.options.tasks))t.startsWith(EVE_SCHEDULE_TASK_NAME_PREFIX)&&delete e.options.tasks[t];for(let t of Object.keys(e.options.virtual))t.startsWith(EVE_SCHEDULE_TASK_VIRTUAL_ID_PREFIX)&&delete e.options.virtual[t];for(let[t,n]of Object.entries(e.options.scheduledTasks)){let r=normalizeScheduledTasks(n).filter(e=>!e.startsWith(EVE_SCHEDULE_TASK_NAME_PREFIX));if(r.length===0){delete e.options.scheduledTasks[t];continue}if(r.length===1){let[n]=r;n!==void 0&&(e.options.scheduledTasks[t]=n);continue}e.options.scheduledTasks[t]=r}}function addScheduleTaskVirtualHandler(e,t){let n=`${EVE_SCHEDULE_TASK_VIRTUAL_ID_PREFIX}${t.registration.taskName}`,r=stringifyEsmImportSpecifier(t.dispatchModulePath);e.options.tasks[t.registration.taskName]={description:t.registration.description,handler:n},e.options.virtual[n]=[`import { dispatchScheduleTask } from ${r};`,`const config = ${JSON.stringify(t.artifactsConfig)};`,`export default {`,` meta: { description: ${JSON.stringify(t.registration.description)} },`,` async run(event) {`,` return { result: await dispatchScheduleTask(event.name, config) };`,` },`,`};`].join(`
2
- `),appendScheduledTask(e,t.registration.cron,t.registration.taskName)}function appendScheduledTask(e,t,n){let r=e.options.scheduledTasks[t];if(r===void 0){e.options.scheduledTasks[t]=n;return}if(typeof r==`string`){e.options.scheduledTasks[t]=[r,n];return}r.includes(n)||r.push(n)}function normalizeScheduledTasks(e){return typeof e==`string`?[e]:[...e]}function areScheduleRegistrationsEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r===void 0||i===void 0||r.cron!==i.cron||r.description!==i.description||r.logicalPath!==i.logicalPath||r.scheduleId!==i.scheduleId||r.sourceId!==i.sourceId||r.taskName!==i.taskName)return!1}return!0}export{registerScheduleTaskHandlers,removeScheduleTaskHandlers,syncScheduleTaskHandlers};
1
+ import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";function registerScheduleTaskHandlers(e,t){if(t.registrations.length!==0){e.options.experimental.tasks=!0;for(let n of t.registrations)addScheduleTaskVirtualHandler(e,{artifactsConfig:t.artifactsConfig,dispatchModulePath:t.dispatchModulePath,registration:n})}}function addScheduleTaskVirtualHandler(e,t){let n=`#eve-schedule-task/${t.registration.taskName}`,r=stringifyEsmImportSpecifier(t.dispatchModulePath);e.options.tasks[t.registration.taskName]={description:t.registration.description,handler:n},e.options.virtual[n]=[`import { dispatchScheduleTask } from ${r};`,`const config = ${JSON.stringify(t.artifactsConfig)};`,`export default {`,` meta: { description: ${JSON.stringify(t.registration.description)} },`,` async run(event) {`,` return { result: await dispatchScheduleTask(event.name, config) };`,` },`,`};`].join(`
2
+ `),appendScheduledTask(e,t.registration.cron,t.registration.taskName)}function appendScheduledTask(e,t,n){let r=e.options.scheduledTasks[t];if(r===void 0){e.options.scheduledTasks[t]=n;return}if(typeof r==`string`){e.options.scheduledTasks[t]=[r,n];return}r.includes(n)||r.push(n)}export{registerScheduleTaskHandlers};
@@ -1,14 +1,6 @@
1
1
  import type { DevelopmentServer, DevelopmentServerOptions, StartedDevelopmentServer } from "#internal/nitro/host/types.js";
2
2
  import { normalizeDevelopmentServerClientUrl } from "#internal/nitro/host/dev-server-url.js";
3
3
  export { normalizeDevelopmentServerClientUrl };
4
- /**
5
- * Returns whether a supplied URL identifies this app's healthy local development
6
- * server. Only that server receives the local TUI credential path.
7
- */
8
- export declare function isActiveDevelopmentServerForApp(input: {
9
- readonly appRoot: string;
10
- readonly serverUrl: string;
11
- }): Promise<boolean>;
12
4
  /**
13
5
  * Creates a development server for an eve application. Call `start()` to boot an
14
6
  * owned Nitro server or attach to a running owner, and `close()` to tear down a
@@ -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{defaultDevelopmentExtensions}from"#compiler/development-extensions.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{readDevelopmentRuntimeArtifactsRevision}from"#services/dev-client/runtime-artifacts.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{createDevelopmentApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{prepareDevelopmentApplicationHost}from"#internal/nitro/host/prepare-application-host.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{DEFAULT_DEVELOPMENT_SERVER_HOST,normalizeDevelopmentServerClientUrl}from"#internal/nitro/host/dev-server-url.js";import{handleDevelopmentModelCredentialRequest}from"#internal/model-auth/development-broker-server.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{installLocalDevCapabilityEnvironment}from"#runtime/local-dev-capability.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 resolveDiscoveryProject(e.appRoot),n=await new DevelopmentServerState(t).read();return n===void 0||!isLoopbackServerUrl(n)||!await isDevelopmentServerReady(n)?!1:new URL(n).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 t=>{let n=await handleDevelopmentModelCredentialRequest(t,{appRoot:e.appRoot,secret:e.transportSecret});if(n!==void 0)return n;let r=await e.workflowWorld?.handleRequest(t);if(r!==void 0)return r;let i=new URL(t.url);if(i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH&&t.method===`GET`)return handleDevRuntimeArtifactsRequest({appRoot:e.appRoot});let a=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH&&t.method===`POST`,o=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH&&t.method===`POST`,s=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH&&(t.method===`GET`||t.method===`POST`);if(!a&&!o&&!s)return;let c=e.getWatcher();if(c===void 0)return Response.json({error:`The development server is still starting.`},{status:503});let l=i.searchParams.get(`lease`);return(a||o)&&(l===null||l.length===0)?Response.json({error:`A suspension lease is required.`},{status:400}):a?(await c.suspend(l),Response.json({suspended:!0})):o?(await c.resume(l,{silent:i.searchParams.get(`silent`)===`1`}),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot})):(i.searchParams.get(`force`)===`1`?await c.rebuild():await c.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(e,t){process.env[EVE_DEV_ENV_FLAG]??=`1`;let n=t.developmentExtensions??defaultDevelopmentExtensions(),r=await resolveDiscoveryProject(e);await loadDevelopmentEnvironmentFiles(r.appRoot);let i=readEnvironmentPort(),a=t.port??i,o=t.developmentExtensions!==void 0||t.host!==void 0||t.port!==void 0||i!==void 0,s=new DevelopmentServerState(r),c=await s.read();if(c!==void 0&&isLoopbackServerUrl(c)&&await isDevelopmentServerReady(c)){if(t.existing===`attach-if-unconfigured`&&!o)return{handle:{kind:`existing`,appRoot:r.appRoot,url:c},close:void 0};throw await createDevelopmentServerAlreadyRunningError(r.appRoot,c)}let l=process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV],u=createDevelopmentSandboxRunId();process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=u;let d,f,p,m,h,g,_,v,y=!1,b=!1;try{let e=await devBootPhase(`compiling agent`,()=>prepareDevelopmentApplicationHost(r.appRoot,{developmentExtensions:n}),t.onBootProgress);v=e,pruneLocalSandboxTemplatesInBackground(e.appRoot);let i=await devBootPhase(`creating dev server`,()=>createDevelopmentApplicationNitro(e),t.onBootProgress);d=i,f=new DrainedNitroDevServer(i.logger);let o=f,c=randomBytes(32).toString(`base64url`);o.setClientAddressSecret(c),h=installWorkflowTransportEnvironment(r.appRoot,c),g=createDevelopmentWorkflowWorld({appRoot:r.appRoot,preparedHost:e,transportSecret:c}),addDevelopmentControlHandler({appRoot:r.appRoot,devServer:o,getWatcher:()=>_,workflowWorld:g,transportSecret:c});let x=t.host??i.options.devServer.hostname??DEFAULT_DEVELOPMENT_SERVER_HOST,S=a===void 0,C=await devBootPhase(`binding port`,()=>listenForDevelopmentServer({devServer:o,host:x,port:a,retryOnAddressInUse:S}),t.onBootProgress);if(!C.url)throw Error(`Nitro dev server did not expose a URL.`);let w=normalizeDevelopmentServerClientUrl(C.url);m=installWorkflowLocalQueueEnvironment(w),p=installLocalDevCapabilityEnvironment({appRoot:r.appRoot,serverUrl:w}),await devBootPhase(`building dev bundle`,async()=>{let t=await buildDevelopmentHostCandidate({host:e,nitro:i});d=void 0;let n=e.workspace;b=!0,await o.replaceWorker({dispose:async()=>await removeDevelopmentHostWorkspace(n),entry:t.entry,workerData:t.workerData}),await activateDevelopmentGeneration({appRoot:e.appRoot,generation:e.generation}),y=!0},t.onBootProgress),await g?.start();let T=await createDevelopmentAuthoredRebuildCoordinator({developmentExtensions:n,devServer:o,initialHost:e});_=await devBootPhase(`starting file watcher`,async()=>{let{startAuthoredSourceWatcher:t}=await import(`#internal/nitro/host/dev-authored-source-watcher.js`);return t({coordinator:T,preparedHost:e})},t.onBootProgress),await s.write(w);let E=m;if(E===void 0)throw Error(`Workflow local queue environment was not initialized.`);let D=_,O=f,k=g,A=h,j=p,M;return{handle:{kind:`started`,appRoot:r.appRoot,url:w},close:()=>(M??=(async()=>{let e=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:D,devServer:O,developmentSandboxRunId:u,nitro:void 0,workflowWorld:k});e.listenerClosed&&await s.remove().catch(()=>{});try{let t=createDevelopmentServerCleanupError(e.errors);if(t!==void 0)throw t}finally{E(),A?.(),j?.(),restoreDevelopmentSandboxRunId(l)}})(),M)}}catch(e){let t=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:_,devServer:f,developmentSandboxRunId:u,nitro:d,workflowWorld:g}),n=[...t.errors];throw v!==void 0&&!y&&await discardDevelopmentGeneration(v.generation).catch(e=>{n.push(e)}),v!==void 0&&!b&&await removeDevelopmentHostWorkspace(v.workspace).catch(e=>{n.push(e)}),m?.(),h?.(),p?.(),t.listenerClosed&&await s.remove().catch(()=>{}),restoreDevelopmentSandboxRunId(l),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{defaultDevelopmentExtensions}from"#compiler/development-extensions.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{readDevelopmentRuntimeArtifactsRevision}from"#services/dev-client/runtime-artifacts.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{createDevelopmentApplicationNitro}from"#internal/nitro/host/create-application-nitro.js";import{prepareDevelopmentApplicationHost}from"#internal/nitro/host/prepare-application-host.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{DEFAULT_DEVELOPMENT_SERVER_HOST,normalizeDevelopmentServerClientUrl}from"#internal/nitro/host/dev-server-url.js";import{handleDevelopmentModelCredentialRequest}from"#internal/model-auth/development-broker-server.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{installLocalDevCapabilityEnvironment}from"#runtime/local-dev-capability.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 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).slice(0,-1),`remote`,`connect`,`--url`,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 t=>{let n=await handleDevelopmentModelCredentialRequest(t,{appRoot:e.appRoot,secret:e.transportSecret});if(n!==void 0)return n;let r=await e.workflowWorld?.handleRequest(t);if(r!==void 0)return r;let i=new URL(t.url);if(i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH&&t.method===`GET`)return handleDevRuntimeArtifactsRequest({appRoot:e.appRoot});let a=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH&&t.method===`POST`,o=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH&&t.method===`POST`,s=i.pathname===EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH&&(t.method===`GET`||t.method===`POST`);if(!a&&!o&&!s)return;let c=e.getWatcher();if(c===void 0)return Response.json({error:`The development server is still starting.`},{status:503});let l=i.searchParams.get(`lease`);return(a||o)&&(l===null||l.length===0)?Response.json({error:`A suspension lease is required.`},{status:400}):a?(await c.suspend(l),Response.json({suspended:!0})):o?(await c.resume(l,{silent:i.searchParams.get(`silent`)===`1`}),handleDevRuntimeArtifactsRequest({appRoot:e.appRoot})):(i.searchParams.get(`force`)===`1`?await c.rebuild():await c.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(e,t){process.env[EVE_DEV_ENV_FLAG]??=`1`;let n=t.developmentExtensions??defaultDevelopmentExtensions(),r=await resolveDiscoveryProject(e);await loadDevelopmentEnvironmentFiles(r.appRoot);let i=readEnvironmentPort(),a=t.port??i,o=t.developmentExtensions!==void 0||t.host!==void 0||t.port!==void 0||i!==void 0,s=new DevelopmentServerState(r),c=await s.read();if(c!==void 0&&isLoopbackServerUrl(c)&&await isDevelopmentServerReady(c)){if(t.existing===`attach-if-unconfigured`&&!o)return{handle:{kind:`existing`,appRoot:r.appRoot,url:c},close:void 0};throw await createDevelopmentServerAlreadyRunningError(r.appRoot,c)}let l=process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV],u=createDevelopmentSandboxRunId();process.env[EVE_DEVELOPMENT_SANDBOX_RUN_ID_ENV]=u;let d,f,p,m,h,g,_,v,y=!1,b=!1;try{let e=await devBootPhase(`compiling agent`,()=>prepareDevelopmentApplicationHost(r.appRoot,{developmentExtensions:n}),t.onBootProgress);v=e,pruneLocalSandboxTemplatesInBackground(e.appRoot);let i=await devBootPhase(`creating dev server`,()=>createDevelopmentApplicationNitro(e),t.onBootProgress);d=i,f=new DrainedNitroDevServer(i.logger);let o=f,c=randomBytes(32).toString(`base64url`);o.setClientAddressSecret(c),h=installWorkflowTransportEnvironment(r.appRoot,c),g=createDevelopmentWorkflowWorld({appRoot:r.appRoot,preparedHost:e,transportSecret:c}),addDevelopmentControlHandler({appRoot:r.appRoot,devServer:o,getWatcher:()=>_,workflowWorld:g,transportSecret:c});let x=t.host??i.options.devServer.hostname??DEFAULT_DEVELOPMENT_SERVER_HOST,S=a===void 0,C=await devBootPhase(`binding port`,()=>listenForDevelopmentServer({devServer:o,host:x,port:a,retryOnAddressInUse:S}),t.onBootProgress);if(!C.url)throw Error(`Nitro dev server did not expose a URL.`);let w=normalizeDevelopmentServerClientUrl(C.url);m=installWorkflowLocalQueueEnvironment(w),p=installLocalDevCapabilityEnvironment({appRoot:r.appRoot,serverUrl:w}),await devBootPhase(`building dev bundle`,async()=>{let t=await buildDevelopmentHostCandidate({host:e,nitro:i});d=void 0;let n=e.workspace;b=!0,await o.replaceWorker({dispose:async()=>await removeDevelopmentHostWorkspace(n),entry:t.entry,workerData:t.workerData}),await activateDevelopmentGeneration({appRoot:e.appRoot,generation:e.generation}),y=!0},t.onBootProgress),await g?.start();let T=await createDevelopmentAuthoredRebuildCoordinator({developmentExtensions:n,devServer:o,initialHost:e});_=await devBootPhase(`starting file watcher`,async()=>{let{startAuthoredSourceWatcher:t}=await import(`#internal/nitro/host/dev-authored-source-watcher.js`);return t({coordinator:T,preparedHost:e})},t.onBootProgress),await s.write(w);let E=m;if(E===void 0)throw Error(`Workflow local queue environment was not initialized.`);let D=_,O=f,k=g,A=h,j=p,M;return{handle:{kind:`started`,appRoot:r.appRoot,url:w},close:()=>(M??=(async()=>{let e=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:D,devServer:O,developmentSandboxRunId:u,nitro:void 0,workflowWorld:k});e.listenerClosed&&await s.remove().catch(()=>{});try{let t=createDevelopmentServerCleanupError(e.errors);if(t!==void 0)throw t}finally{E(),A?.(),j?.(),restoreDevelopmentSandboxRunId(l)}})(),M)}}catch(e){let t=await closeDevelopmentServerResources({appRoot:r.appRoot,authoredSourceWatcher:_,devServer:f,developmentSandboxRunId:u,nitro:d,workflowWorld:g}),n=[...t.errors];throw v!==void 0&&!y&&await discardDevelopmentGeneration(v.generation).catch(e=>{n.push(e)}),v!==void 0&&!b&&await removeDevelopmentHostWorkspace(v.workspace).catch(e=>{n.push(e)}),m?.(),h?.(),p?.(),t.listenerClosed&&await s.remove().catch(()=>{}),restoreDevelopmentSandboxRunId(l),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,normalizeDevelopmentServerClientUrl};
@@ -1,3 +1,3 @@
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";const HEALTH_TIMEOUT_MS=6e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,WILDCARD_LISTEN_HOSTNAMES=new Set([`[::]`,`::`,`0.0.0.0`]);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 isListening(e){let t=new URL(e),n=Number(t.port||(t.protocol===`https:`?443:80));return await new Promise(e=>{let r=createConnection({host:t.hostname,port:n}),finish=t=>{r.destroy(),e(t)};r.setTimeout(2e3,()=>finish(!1)),r.once(`connect`,()=>finish(!0)),r.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(`
1
+ import{createConnection,createServer}from"node:net";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{existsSync}from"node:fs";import{join,resolve}from"node:path";import{spawn}from"node:child_process";import{setTimeout}from"node:timers/promises";const HEALTH_TIMEOUT_MS=6e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/,WILDCARD_LISTEN_HOSTNAMES=new Set([`[::]`,`::`,`0.0.0.0`]);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 isListening(e){let t=new URL(e),n=Number(t.port||(t.protocol===`https:`?443:80));return await new Promise(e=>{let r=createConnection({host:t.hostname,port:n}),finish=t=>{r.destroy(),e(t)};r.setTimeout(2e3,()=>finish(!1)),r.once(`connect`,()=>finish(!0)),r.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
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 n=resolve(e),r=resolveOutputServerEntry(n);if(!existsSync(r))throw Error(`Missing eve build output at ${r}. Run "eve build" before "eve start".`);await loadDevelopmentEnvironmentFiles(n);let i=t.host??`0.0.0.0`,a=await resolveListenPort({host:i,port:t.port??readEnvironmentPort()??3e3}),o=createKnownPortUrl({host:i,port:a}),s=``,c=!1,l,u=spawn(process.execPath,[r],{cwd:n,env:{...process.env,HOST:i,NITRO_HOST:i,NITRO_PORT:String(a),PORT:String(a)},stdio:[`ignore`,`pipe`,`pipe`]});u.stdout?.on(`data`,e=>{s+=e.toString(`utf8`),process.stdout.write(e)}),u.stderr?.on(`data`,e=>{s+=e.toString(`utf8`),process.stderr.write(e)});let d=new Promise((e,t)=>{u.once(`error`,e=>{l=e,t(e)}),u.once(`exit`,(n,r)=>{if(c||n===0){e();return}t(Error([`Built server process exited unexpectedly (code=${String(n)}, signal=${String(r)}).`,s].join(`
3
3
  `)))})});d.catch(()=>void 0);try{return{async close(){c=!0,await terminate(u)},url:await waitForReady({child:u,getStartError:()=>l,getOutput:()=>s,knownUrl:o}),async wait(){await d}}}catch(e){throw c=!0,await terminate(u),e instanceof Error&&e.name===`AbortError`?Error(`Timed out waiting for built eve server to respond.`,{cause:e}):e}}export{startProductionServer};
@@ -1 +1 @@
1
- import{readdir,realpath,stat}from"node:fs/promises";import{basename,dirname,join,resolve,sep}from"node:path";import{resolveDiscoveryProject}from"#discover/project.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{discoverExtensionMountDeclarations}from"#discover/discover-agent.js";import{buildExtensionPackage,tryReadExtensionBuildConfig}from"#internal/nitro/host/build-extension.js";import{withExtensionBuildLock}from"#internal/nitro/host/extension-build-lock.js";import{toErrorMessage}from"#shared/errors.js";import{locateExtensionMountPackage}from"#discover/extensions.js";import{createDiskProjectSource}from"#discover/project-source.js";import{EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,readExtensionCompatibilityManifest}from"#compiler/extension-compatibility.js";import{isAuthoredSourcePath,resolveDevelopmentSourceRoot}from"#internal/nitro/dev-runtime-source-snapshot.js";import{resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";async function prepareDevelopmentWorkspaceExtensions(e){let t=await discoverWorkspaceExtensions(e.appRoot),n=new Map(e.previousExtensions?.map(e=>[e.packageRoot,e])),r=e.changedPaths===void 0?void 0:await Promise.all(e.changedPaths.map(async e=>await toCanonicalPath(e))),i=e.previousExtensions===void 0||r?.length===0;return await Promise.all(t.map(async e=>{let t=n.get(e.packageRoot);(i===!0||t===void 0||!sameBuildInputs(t,e)||r?.some(t=>affectsExtensionBuild(t,e))===!0)&&await withExtensionBuildLock(e.packageRoot,async()=>{await buildExtensionPackage(e.packageRoot,e.config)})})),t}async function buildWorkspaceExtensions(e){let t=await discoverWorkspaceExtensions(e);await Promise.all(t.map(async e=>{if(!await isExtensionDistributionCurrent(e))try{await withExtensionBuildLock(e.packageRoot,async()=>{await isExtensionDistributionCurrent(e)||await buildExtensionPackage(e.packageRoot,e.config)})}catch(t){throw Error(`Failed to build workspace extension "${e.config.packageName}" at ${e.packageRoot}. Fix the error below, then rebuild the agent, or run \`eve extension build\` in that package directory to build it on its own.\n${toErrorMessage(t)}`)}}))}async function discoverWorkspaceExtensions(e){let t=resolve(e),n=await resolveDiscoveryProject(t),r=createDiskProjectSource(),i=await discoverExtensionMountGraph({agentRoot:n.agentRoot,source:r}),a=await toCanonicalPath(resolveDevelopmentSourceRoot(t)),o=new Map;for(let e of i){let n=await resolveWorkspaceExtension({appRoot:t,agentRoot:e.agentRoot,mount:e.mount,source:r,workspaceSourceRoot:a});n!==void 0&&o.set(n.packageRoot,n)}return[...o.values()].sort((e,t)=>e.packageRoot.localeCompare(t.packageRoot))}async function isExtensionDistributionCurrent(e){let t=join(e.config.distRoot,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),n;try{if((await readExtensionCompatibilityManifest(t)).builtWithEve!==resolveInstalledPackageInfo().version)return!1;n=(await stat(t)).mtimeMs}catch{return!1}let r=await readdir(e.config.sourceRoot,{recursive:!0}),i=[e.config.sourceRoot,...r.map(t=>join(e.config.sourceRoot,t)),...e.buildConfigPaths];return(await Promise.all(i.map(async e=>(await stat(e).catch(()=>void 0))?.mtimeMs??0))).every(e=>e<=n)}async function discoverExtensionMountGraph(e){let t=(await discoverExtensionMountDeclarations(e)).mounts.map(t=>({agentRoot:e.agentRoot,mount:t})),n=join(e.agentRoot,`subagents`);if(await e.source.stat(n)!==`directory`)return t;let r=await e.source.readDirectory(n),i=await Promise.all(r.filter(e=>e.isDirectory()).map(async t=>await discoverExtensionMountGraph({agentRoot:join(n,t.name),source:e.source})));return[...t,...i.flat()]}async function resolveWorkspaceExtension(e){let t=(await locateExtensionMountPackage({source:e.source,agentRoot:e.agentRoot,appRoot:e.appRoot,mount:e.mount.mountRef,namespace:e.mount.namespace})).location;if(t?.authoredSourceRoot===void 0)return;let n=await realpath(t.packageRoot).catch(()=>void 0);if(n===void 0||!isAuthoredSourcePath(n,e.workspaceSourceRoot)||(await stat(t.authoredSourceRoot).catch(()=>void 0))?.isDirectory()!==!0)return;let r=await tryReadExtensionBuildConfig(n);if(r===null)return;let i=[join(n,`package.json`),join(n,`tsconfig.json`),...await resolveTsConfigDependencyPaths(n)];return{config:r,packageRoot:n,buildConfigPaths:[...new Set(i.map(e=>resolve(e)))].sort((e,t)=>e.localeCompare(t))}}function affectsExtensionBuild(e,t){return isPathInsideOrEqual(e,t.config.sourceRoot)||t.buildConfigPaths.includes(e)}function sameBuildConfig(e,t){return e.sourceRoot===t.sourceRoot&&e.distRoot===t.distRoot&&e.outDir===t.outDir&&e.packageName===t.packageName&&e.shortName===t.shortName&&e.runtimeDependencies.length===t.runtimeDependencies.length&&e.runtimeDependencies.every((e,n)=>e===t.runtimeDependencies[n])}function sameBuildInputs(e,t){return sameBuildConfig(e.config,t.config)&&e.buildConfigPaths.length===t.buildConfigPaths.length&&e.buildConfigPaths.every((e,n)=>e===t.buildConfigPaths[n])}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}async function toCanonicalPath(e){let t=resolve(e),n=[];for(;;)try{return join(await realpath(t),...n.reverse())}catch{let r=dirname(t);if(r===t)return resolve(e);n.push(basename(t)),t=r}}export{buildWorkspaceExtensions,prepareDevelopmentWorkspaceExtensions};
1
+ import{readdir,realpath,stat}from"node:fs/promises";import{resolveDiscoveryProject}from"#discover/project.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{basename,dirname,join,resolve,sep}from"node:path";import{discoverExtensionMountDeclarations}from"#discover/discover-agent.js";import{buildExtensionPackage,tryReadExtensionBuildConfig}from"#internal/nitro/host/build-extension.js";import{withExtensionBuildLock}from"#internal/nitro/host/extension-build-lock.js";import{toErrorMessage}from"#shared/errors.js";import{locateExtensionMountPackage}from"#discover/extensions.js";import{createDiskProjectSource}from"#discover/project-source.js";import{EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,readExtensionCompatibilityManifest}from"#compiler/extension-compatibility.js";import{isAuthoredSourcePath,resolveDevelopmentSourceRoot}from"#internal/nitro/dev-runtime-source-snapshot.js";import{resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";async function prepareDevelopmentWorkspaceExtensions(e){let t=await discoverWorkspaceExtensions(e.appRoot),n=new Map(e.previousExtensions?.map(e=>[e.packageRoot,e])),r=e.changedPaths===void 0?void 0:await Promise.all(e.changedPaths.map(async e=>await toCanonicalPath(e))),i=e.previousExtensions===void 0||r?.length===0;return await Promise.all(t.map(async e=>{let t=n.get(e.packageRoot);(i===!0||t===void 0||!sameBuildInputs(t,e)||r?.some(t=>affectsExtensionBuild(t,e))===!0)&&await withExtensionBuildLock(e.packageRoot,async()=>{await buildExtensionPackage(e.packageRoot,e.config)})})),t}async function buildWorkspaceExtensions(e){let t=await discoverWorkspaceExtensions(e);await Promise.all(t.map(async e=>{if(!await isExtensionDistributionCurrent(e))try{await withExtensionBuildLock(e.packageRoot,async()=>{await isExtensionDistributionCurrent(e)||await buildExtensionPackage(e.packageRoot,e.config)})}catch(t){throw Error(`Failed to build workspace extension "${e.config.packageName}" at ${e.packageRoot}. Fix the error below, then rebuild the agent, or run \`eve extension build\` in that package directory to build it on its own.\n${toErrorMessage(t)}`)}}))}async function discoverWorkspaceExtensions(e){let t=resolve(e),n=await resolveDiscoveryProject(t),r=createDiskProjectSource(),i=await discoverExtensionMountGraph({agentRoot:n.agentRoot,source:r}),a=await toCanonicalPath(resolveDevelopmentSourceRoot(t)),o=new Map;for(let e of i){let n=await resolveWorkspaceExtension({appRoot:t,agentRoot:e.agentRoot,mount:e.mount,source:r,workspaceSourceRoot:a});n!==void 0&&o.set(n.packageRoot,n)}return[...o.values()].sort((e,t)=>e.packageRoot.localeCompare(t.packageRoot))}async function isExtensionDistributionCurrent(e){let t=join(e.config.distRoot,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),n;try{if((await readExtensionCompatibilityManifest(t)).builtWithEve!==resolveInstalledPackageInfo().version)return!1;n=(await stat(t)).mtimeMs}catch{return!1}let r=await readdir(e.config.sourceRoot,{recursive:!0}),i=[e.config.sourceRoot,...r.map(t=>join(e.config.sourceRoot,t)),...e.buildConfigPaths];return(await Promise.all(i.map(async e=>(await stat(e).catch(()=>void 0))?.mtimeMs??0))).every(e=>e<=n)}async function discoverExtensionMountGraph(e){let t=(await discoverExtensionMountDeclarations(e)).mounts.map(t=>({agentRoot:e.agentRoot,mount:t})),n=join(e.agentRoot,`subagents`);if(await e.source.stat(n)!==`directory`)return t;let r=await e.source.readDirectory(n),i=await Promise.all(r.filter(e=>e.isDirectory()).map(async t=>await discoverExtensionMountGraph({agentRoot:join(n,t.name),source:e.source})));return[...t,...i.flat()]}async function resolveWorkspaceExtension(e){let t=(await locateExtensionMountPackage({source:e.source,agentRoot:e.agentRoot,appRoot:e.appRoot,mount:e.mount.mountRef,namespace:e.mount.namespace})).location;if(t?.authoredSourceRoot===void 0)return;let n=await realpath(t.packageRoot).catch(()=>void 0);if(n===void 0||!isAuthoredSourcePath(n,e.workspaceSourceRoot)||(await stat(t.authoredSourceRoot).catch(()=>void 0))?.isDirectory()!==!0)return;let r=await tryReadExtensionBuildConfig(n);if(r===null)return;let i=[join(n,`package.json`),join(n,`tsconfig.json`),...await resolveTsConfigDependencyPaths(n)];return{config:r,packageRoot:n,buildConfigPaths:[...new Set(i.map(e=>resolve(e)))].sort((e,t)=>e.localeCompare(t))}}function affectsExtensionBuild(e,t){return isPathInsideOrEqual(e,t.config.sourceRoot)||t.buildConfigPaths.includes(e)}function sameBuildConfig(e,t){return e.sourceRoot===t.sourceRoot&&e.distRoot===t.distRoot&&e.outDir===t.outDir&&e.packageName===t.packageName&&e.shortName===t.shortName&&e.runtimeDependencies.length===t.runtimeDependencies.length&&e.runtimeDependencies.every((e,n)=>e===t.runtimeDependencies[n])}function sameBuildInputs(e,t){return sameBuildConfig(e.config,t.config)&&e.buildConfigPaths.length===t.buildConfigPaths.length&&e.buildConfigPaths.every((e,n)=>e===t.buildConfigPaths[n])}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}async function toCanonicalPath(e){let t=resolve(e),n=[];for(;;)try{return join(await realpath(t),...n.reverse())}catch{let r=dirname(t);if(r===t)return resolve(e);n.push(basename(t)),t=r}}export{buildWorkspaceExtensions,prepareDevelopmentWorkspaceExtensions};
@@ -1,4 +1,4 @@
1
1
  export { buildApplication } from "#internal/nitro/host/build-application.js";
2
- export { createDevelopmentServer, isActiveDevelopmentServerForApp, } from "#internal/nitro/host/start-development-server.js";
2
+ export { createDevelopmentServer } from "#internal/nitro/host/start-development-server.js";
3
3
  export { startProductionServer } from "#internal/nitro/host/start-production-server.js";
4
4
  export type { DevelopmentServer, DevelopmentServerHandle, DevelopmentServerOptions, ExistingDevelopmentServer, ProductionServerHandle, StartedDevelopmentServer, } from "#internal/nitro/host/types.js";
@@ -1 +1 @@
1
- import{createDevelopmentServer,isActiveDevelopmentServerForApp}from"#internal/nitro/host/start-development-server.js";import{buildApplication}from"#internal/nitro/host/build-application.js";import{startProductionServer}from"#internal/nitro/host/start-production-server.js";export{buildApplication,createDevelopmentServer,isActiveDevelopmentServerForApp,startProductionServer};
1
+ import{createDevelopmentServer}from"#internal/nitro/host/start-development-server.js";import{buildApplication}from"#internal/nitro/host/build-application.js";import{startProductionServer}from"#internal/nitro/host/start-production-server.js";export{buildApplication,createDevelopmentServer,startProductionServer};
@@ -1 +1 @@
1
- import{resolveModelEndpointStatus}from"#internal/resolve-model-endpoint-status.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";function toChatGptEndpoint(e){if(e===void 0)return;let t={state:e.kind};return e.kind===`ready`&&e.accountLabel!==void 0?{...t,accountLabel:e.accountLabel}:t}function buildAgentInfoResponse(e,t){let{manifest:n}=e,r=toModuleSource(n,n.config.source);if(r.binding===void 0)throw Error(`Compiled config source "${n.config.source.sourceId}" has no binding.`);let i=collectCompositionDiagnostics(n),a=collectRemoteAgents(n);return{agent:{agentRoot:n.agentRoot,appRoot:n.appRoot,config:{...r,binding:r.binding},description:n.config.description,model:n.config.dynamicModel===void 0?{contextWindowTokens:n.config.model.contextWindowTokens,endpoint:resolveModelEndpointStatus(n.config.model.routing,t.gatewayCredentials,toChatGptEndpoint(t.chatgptAuth)),id:n.config.model.id,providerOptions:sanitizeProviderOptionsForInfo(n.config.model.providerOptions),reasoning:n.config.reasoning,routing:n.config.model.routing,source:n.config.model.source===void 0?void 0:toModuleSource(n,n.config.model.source)}:{reasoning:n.config.reasoning,routing:{kind:`dynamic`,resolver:renderDynamicResolver(n,{...n.config.dynamicModel,slug:`model`})}},name:n.config.name,nodeId:ROOT_COMPILED_AGENT_NODE_ID,outputSchema:n.config.outputSchema},capabilities:{devRoutes:t.mode===`development`},channels:{routes:n.channelRoutes.effective.map(e=>({...toModuleSource(n,e),adapterKind:e.adapterKind,method:e.method,name:e.name,urlPath:e.urlPath})),shadowed:[...n.channelRoutes.shadowed]},composition:i,connections:n.connections.map(e=>({...toModuleSource(n,e),connectionName:e.connectionName,description:e.description,hasApproval:!1,hasAuthorization:e.vercelConnect!==void 0,hasHeaders:!1,protocol:e.protocol,url:e.url})),diagnostics:{discoveryErrors:n.diagnosticsSummary.errors,discoveryWarnings:n.diagnosticsSummary.warnings},hooks:n.hooks.map(e=>({...toModuleSource(n,e),eventNames:[...e.eventNames],slug:e.slug})),instructions:{dynamic:n.dynamicInstructions.map(e=>renderDynamicResolver(n,e)),static:n.instructions.map(e=>({...toOwnedSource(n,e),content:e.content,name:e.name,role:e.role}))},kernelEffects:projectPreparedKernelEffects(n),kind:`eve-agent-info`,memories:n.memories.map(e=>({...toModuleSource(n,e),description:e.description,slot:e.slot,visibility:e.visibility})),mode:t.mode,remoteAgents:{entries:a,total:a.length},sandbox:{...toModuleSource(n,n.sandbox),provider:n.sandbox.providerName,environmentExportName:n.sandbox.environmentExportName,revisionHash:n.sandbox.revisionHash},schedules:n.schedules.map(e=>({...toOwnedSource(n,e),cron:e.cron,hasRun:e.hasRun,markdown:e.markdown,name:e.name})),skills:{dynamic:n.dynamicSkills.map(e=>renderDynamicResolver(n,e)),static:n.skills.map(e=>({...toOwnedSource(n,e),description:e.description,license:e.license,markdown:e.markdown,metadata:e.metadata,name:e.name}))},subagents:{local:n.subagents.map(e=>{let t={...toOwnedSource(n,e),description:e.description,entryPath:e.entryPath,name:e.name,nodeId:e.nodeId,parentNodeId:e.parentNodeId,rootPath:e.rootPath,summary:summarizeNode(e.agent)};return e.configResolver===void 0?t:{...t,configResolver:renderDynamicResolver(e.agent,{...e.configResolver,slug:`config`})}}),total:n.subagents.length},tools:{dynamic:n.dynamicTools.map(e=>renderDynamicResolver(n,e)),static:n.tools.map(e=>({...toModuleSource(n,e),description:e.description,hasAuth:!1,hasExecute:e.hasExecute,hasModelOutputProjection:e.hasModelOutputProjection,hasOutputSchema:e.outputSchema!==void 0,inputSchema:e.inputSchema,name:e.name,outputSchema:e.outputSchema,requiresApproval:e.requiresApproval}))},version:5,workspace:{resourceRoot:n.workspaceResourceRoot,rootEntries:[...n.workspaceResourceRoot.rootEntries]}}}const CREDENTIAL_OPTION_KEY=/^(api[-_]?key|access[-_]?token|auth|authorization|bearer|client[-_]?secret|credentials?|headers|password|private[-_]?key|secret|token)$/i;function sanitizeProviderOptionsForInfo(e){if(e===void 0)return;let t={};for(let[n,r]of Object.entries(e))t[n]=redactCredentialOptions(r);return t}function redactCredentialOptions(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))if(n!==`byok`){if(CREDENTIAL_OPTION_KEY.test(n)){t[n]=`[redacted]`;continue}if(typeof r==`object`&&r){t[n]=Array.isArray(r)?r.map(e=>typeof e==`object`&&e&&!Array.isArray(e)?redactCredentialOptions(e):e):redactCredentialOptions(r);continue}t[n]=r}return t}function toModuleSource(e,t){let n=e.bindings[t.sourceId];if(n===void 0)throw Error(`Compiled source "${t.sourceId}" has no binding.`);return sourceProjection(t,n.owner,n)}function toOwnedSource(e,t){let n=e.bindings[t.sourceId],r=n?.owner??t.owner;if(r===void 0)throw Error(`Compiled source "${t.sourceId}" has no owner.`);return sourceProjection(t,r,n)}function sourceProjection(e,t,n){let r={logicalPath:e.logicalPath,owner:t,sourceId:e.sourceId,sourceKind:toAgentInfoSourceKind(e.sourceKind)},i=n===void 0?void 0:{backing:n.backing,logicalPath:n.logicalPath,owner:n.owner};return n!==void 0&&e.exportName!==void 0?{...r,binding:i,exportName:e.exportName}:n===void 0?e.exportName===void 0?r:{...r,exportName:e.exportName}:{...r,binding:i}}function toAgentInfoSourceKind(e){switch(e){case`markdown`:case`module`:case`skill-package`:return e;default:throw Error(`Unsupported compiled source kind "${e}".`)}}function renderDynamicResolver(e,t){return{...toModuleSource(e,t),eventNames:[...t.eventNames],slug:t.slug}}function summarizeNode(e){return{channels:e.channelRoutes.effective.length,connections:e.connections.length,hooks:e.hooks.length,instructions:e.instructions.length,memories:e.memories.length,schedules:e.schedules.length,skills:e.skills.length,tools:e.tools.length}}function collectRemoteAgents(e){return[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.remoteAgents.map(e=>({...sourceProjection(e,e.owner,e.binding),description:e.description,name:e.name,nodeId:e.nodeId,parentNodeId:e.parentNodeId,url:e.url})))}function collectCompositionDiagnostics(e){let t=[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.sourceComposition.entries).map(e=>{let t={kind:e.kind,logicalPath:e.source.logicalPath,owner:e.source.owner,sourceId:e.source.sourceId};return e.kind===`shadowed`?{...t,winnerSourceId:e.winnerSourceId}:t});return{disabled:t.filter(e=>e.kind===`disabled`),shadowed:t.filter(e=>e.kind===`shadowed`)}}function projectPreparedKernelEffects(e){let t=[];for(let n of e.tools){let e=n.behavior,r=e?.handling;if(e!==void 0&&r!==void 0)switch(r.kind){case`dispatch`:t.push({action:r.action===`self-agent`?`subagent-call`:r.action,audience:[...e.availability],kind:`dispatch`,sourceId:n.sourceId});break;case`provider-tool`:t.push({audience:[...e.availability],kind:`provider-tool`,sourceId:n.sourceId});break;case`workflow-tool`:t.push({action:`workflow-tool-call`,audience:[...e.availability],kind:`dispatch`,sourceId:n.sourceId});break;default:throw Error(`Unsupported compiled tool handling: ${String(r)}`)}}return t}export{buildAgentInfoResponse};
1
+ import{resolveModelEndpointStatus}from"#internal/resolve-model-endpoint-status.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";function toChatGptEndpoint(e){if(e===void 0)return;let t={state:e.kind};return e.kind===`ready`&&e.accountLabel!==void 0?{...t,accountLabel:e.accountLabel}:t}function buildAgentInfoResponse(e,t){let{manifest:n}=e,r=toModuleSource(n,n.config.source);if(r.binding===void 0)throw Error(`Compiled config source "${n.config.source.sourceId}" has no binding.`);let i=collectCompositionDiagnostics(n),a=collectRemoteAgents(n);return{agent:{agentRoot:n.agentRoot,appRoot:n.appRoot,config:{...r,binding:r.binding},description:n.config.description,model:n.config.dynamicModel===void 0?{contextWindowTokens:n.config.model.contextWindowTokens,endpoint:resolveModelEndpointStatus(n.config.model.routing,t.gatewayCredentials,toChatGptEndpoint(t.chatgptAuth)),id:n.config.model.id,providerOptions:projectProviderOptionsForInfo(n.config.model.providerOptions),reasoning:n.config.reasoning,routing:n.config.model.routing,source:n.config.model.source===void 0?void 0:toModuleSource(n,n.config.model.source)}:{reasoning:n.config.reasoning,routing:{kind:`dynamic`,resolver:renderDynamicResolver(n,{...n.config.dynamicModel,slug:`model`})}},name:n.config.name,nodeId:ROOT_COMPILED_AGENT_NODE_ID},capabilities:{devRoutes:t.mode===`development`},channels:{routes:n.channelRoutes.effective.map(e=>({...toModuleSource(n,e),adapterKind:e.adapterKind,method:e.method,name:e.name,urlPath:e.urlPath})),shadowed:[...n.channelRoutes.shadowed]},composition:i,connections:n.connections.map(e=>({...toModuleSource(n,e),connectionName:e.connectionName,description:e.description,hasApproval:!1,hasAuthorization:e.vercelConnect!==void 0,hasHeaders:!1,protocol:e.protocol,url:e.url})),diagnostics:{discoveryErrors:n.diagnosticsSummary.errors,discoveryWarnings:n.diagnosticsSummary.warnings},hooks:n.hooks.map(e=>({...toModuleSource(n,e),eventNames:[...e.eventNames],slug:e.slug})),instructions:{dynamic:n.dynamicInstructions.map(e=>renderDynamicResolver(n,e)),static:n.instructions.map(e=>({...toOwnedSource(n,e),content:e.content,name:e.name,role:e.role}))},kernelEffects:projectPreparedKernelEffects(n),kind:`eve-agent-info`,memories:n.memories.map(e=>({...toModuleSource(n,e),description:e.description,slot:e.slot,visibility:e.visibility})),mode:t.mode,remoteAgents:{entries:a,total:a.length},sandbox:{...toModuleSource(n,n.sandbox),provider:n.sandbox.providerName,environmentExportName:n.sandbox.environmentExportName,revisionHash:n.sandbox.revisionHash},schedules:n.schedules.map(e=>({...toOwnedSource(n,e),cron:e.cron,hasRun:e.hasRun,markdown:e.markdown,name:e.name})),skills:{dynamic:n.dynamicSkills.map(e=>renderDynamicResolver(n,e)),static:n.skills.map(e=>({...toOwnedSource(n,e),description:e.description,license:e.license,markdown:e.markdown,metadata:e.metadata,name:e.name}))},subagents:{local:n.subagents.map(e=>{let t={...toOwnedSource(n,e),description:e.description,entryPath:e.entryPath,name:e.name,nodeId:e.nodeId,parentNodeId:e.parentNodeId,rootPath:e.rootPath,summary:summarizeNode(e.agent)};return e.configResolver===void 0?t:{...t,configResolver:renderDynamicResolver(e.agent,{...e.configResolver,slug:`config`})}}),total:n.subagents.length},tools:{dynamic:n.dynamicTools.map(e=>renderDynamicResolver(n,e)),static:n.tools.map(e=>({...toModuleSource(n,e),description:e.description,hasAuth:!1,hasExecute:e.hasExecute,hasModelOutputProjection:e.hasModelOutputProjection,hasOutputSchema:e.outputSchema!==void 0,inputSchema:e.inputSchema,name:e.name,outputSchema:e.outputSchema,requiresApproval:e.requiresApproval}))},version:5,workspace:{resourceRoot:n.workspaceResourceRoot,rootEntries:[...n.workspaceResourceRoot.rootEntries]}}}function projectProviderOptionsForInfo(e){if(e?.gateway?.serviceTier===`priority`)return{gateway:{serviceTier:`priority`}}}function toModuleSource(e,t){let n=e.bindings[t.sourceId];if(n===void 0)throw Error(`Compiled source "${t.sourceId}" has no binding.`);return sourceProjection(t,n.owner,n)}function toOwnedSource(e,t){let n=e.bindings[t.sourceId],r=n?.owner??t.owner;if(r===void 0)throw Error(`Compiled source "${t.sourceId}" has no owner.`);return sourceProjection(t,r,n)}function sourceProjection(e,t,n){let r={logicalPath:e.logicalPath,owner:t,sourceId:e.sourceId,sourceKind:toAgentInfoSourceKind(e.sourceKind)},i=n===void 0?void 0:{backing:n.backing,logicalPath:n.logicalPath,owner:n.owner};return n!==void 0&&e.exportName!==void 0?{...r,binding:i,exportName:e.exportName}:n===void 0?e.exportName===void 0?r:{...r,exportName:e.exportName}:{...r,binding:i}}function toAgentInfoSourceKind(e){switch(e){case`markdown`:case`module`:case`skill-package`:return e;default:throw Error(`Unsupported compiled source kind "${e}".`)}}function renderDynamicResolver(e,t){return{...toModuleSource(e,t),eventNames:[...t.eventNames],slug:t.slug}}function summarizeNode(e){return{channels:e.channelRoutes.effective.length,connections:e.connections.length,hooks:e.hooks.length,instructions:e.instructions.length,memories:e.memories.length,schedules:e.schedules.length,skills:e.skills.length,tools:e.tools.length}}function collectRemoteAgents(e){return[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.remoteAgents.map(e=>({...sourceProjection(e,e.owner,e.binding),description:e.description,name:e.name,nodeId:e.nodeId,parentNodeId:e.parentNodeId,url:e.url})))}function collectCompositionDiagnostics(e){let t=[e,...e.subagents.map(e=>e.agent)].flatMap(e=>e.sourceComposition.entries).map(e=>{let t={kind:e.kind,logicalPath:e.source.logicalPath,owner:e.source.owner,sourceId:e.source.sourceId};return e.kind===`shadowed`?{...t,winnerSourceId:e.winnerSourceId}:t});return{disabled:t.filter(e=>e.kind===`disabled`),shadowed:t.filter(e=>e.kind===`shadowed`)}}function projectPreparedKernelEffects(e){let t=[];for(let n of e.tools){let e=n.behavior,r=e?.handling;if(e!==void 0&&r!==void 0)switch(r.kind){case`dispatch`:t.push({action:r.action===`self-agent`?`subagent-call`:r.action,audience:[...e.availability],kind:`dispatch`,sourceId:n.sourceId});break;case`provider-tool`:t.push({audience:[...e.availability],kind:`provider-tool`,sourceId:n.sourceId});break;case`workflow-tool`:t.push({action:`workflow-tool-call`,audience:[...e.availability],kind:`dispatch`,sourceId:n.sourceId});break;default:throw Error(`Unsupported compiled tool handling: ${String(r)}`)}}return t}export{buildAgentInfoResponse};