eve 0.67.2 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1116) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/bin/eve.js +15 -0
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/approval/definition.d.ts +19 -5
  5. package/dist/src/channel/adapter.d.ts +2 -0
  6. package/dist/src/channel/auth/oidc.js +1 -1
  7. package/dist/src/channel/channel-address.d.ts +1 -4
  8. package/dist/src/channel/channel-address.js +1 -1
  9. package/dist/src/channel/channel-operations.d.ts +4 -11
  10. package/dist/src/channel/channel-operations.js +1 -1
  11. package/dist/src/channel/compiled-channel.d.ts +0 -2
  12. package/dist/src/channel/compiled-channel.js +2 -2
  13. package/dist/src/channel/cross-channel-receive.d.ts +1 -3
  14. package/dist/src/channel/cross-channel-receive.js +1 -1
  15. package/dist/src/channel/forwarded-principal.js +1 -1
  16. package/dist/src/channel/schedule-auth.d.ts +16 -0
  17. package/dist/src/channel/schedule-auth.js +1 -1
  18. package/dist/src/channel/session-callback.js +1 -1
  19. package/dist/src/channel/session.d.ts +3 -8
  20. package/dist/src/channel/session.js +1 -1
  21. package/dist/src/channel/task-card.d.ts +121 -0
  22. package/dist/src/channel/task-card.js +1 -0
  23. package/dist/src/channel/types.d.ts +12 -54
  24. package/dist/src/chunks/{use-eve-agent-DXcE_8Ja.js → use-eve-agent-D_5129A9.js} +295 -205
  25. package/dist/src/chunks/{use-eve-agent-D4HVZBjn.js → use-eve-agent-Dab2MnT2.js} +295 -205
  26. package/dist/src/cli/commands/info.d.ts +11 -0
  27. package/dist/src/cli/commands/info.js +1 -1
  28. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  29. package/dist/src/cli/commands/init.js +1 -1
  30. package/dist/src/cli/dev/command-options.d.ts +3 -2
  31. package/dist/src/cli/dev/command.js +1 -1
  32. package/dist/src/cli/dev/local-server-process.js +1 -1
  33. package/dist/src/cli/dev/tui/blocks.d.ts +19 -18
  34. package/dist/src/cli/dev/tui/blocks.js +3 -3
  35. package/dist/src/cli/dev/tui/command-typeahead.d.ts +3 -6
  36. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +10 -0
  37. package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
  38. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +2 -0
  39. package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
  40. package/dist/src/cli/dev/tui/rail.d.ts +1 -1
  41. package/dist/src/cli/dev/tui/runner.d.ts +25 -2
  42. package/dist/src/cli/dev/tui/runner.js +3 -3
  43. package/dist/src/cli/dev/tui/status-line.d.ts +4 -2
  44. package/dist/src/cli/dev/tui/status-line.js +1 -1
  45. package/dist/src/cli/dev/tui/subagent-pump.d.ts +44 -52
  46. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  47. package/dist/src/cli/dev/tui/task-activity.d.ts +55 -0
  48. package/dist/src/cli/dev/tui/task-activity.js +1 -0
  49. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +13 -30
  50. package/dist/src/cli/dev/tui/terminal-renderer.js +11 -11
  51. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  52. package/dist/src/cli/dev/tui/theme.js +1 -1
  53. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +6 -9
  54. package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
  55. package/dist/src/cli/dev/tui/tool-presentation.d.ts +16 -3
  56. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  57. package/dist/src/cli/dev/tui/traces/trace-conversation.js +3 -1
  58. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  59. package/dist/src/cli/dev/tui/tui.js +1 -1
  60. package/dist/src/cli/dev/tui/types.d.ts +11 -5
  61. package/dist/src/cli/dev/ui-options.d.ts +2 -2
  62. package/dist/src/cli/option-parsers.d.ts +3 -1
  63. package/dist/src/cli/option-parsers.js +1 -1
  64. package/dist/src/cli/ui/terminal-text.js +1 -1
  65. package/dist/src/client/agent-info-schema.d.ts +150 -9
  66. package/dist/src/client/agent-info-schema.js +1 -1
  67. package/dist/src/client/agent-session.d.ts +28 -0
  68. package/dist/src/client/agent-session.js +1 -0
  69. package/dist/src/client/eve-agent-store-helpers.d.ts +1 -1
  70. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  71. package/dist/src/client/eve-agent-store.js +1 -1
  72. package/dist/src/client/index.d.ts +2 -1
  73. package/dist/src/client/index.js +1 -1
  74. package/dist/src/client/message-action-parts.js +1 -1
  75. package/dist/src/client/message-reducer.js +1 -1
  76. package/dist/src/client/message-task-parts.d.ts +8 -0
  77. package/dist/src/client/message-task-parts.js +1 -0
  78. package/dist/src/client/optimistic-message-submissions.js +1 -1
  79. package/dist/src/client/session-controls.d.ts +0 -1
  80. package/dist/src/client/session-utils.d.ts +10 -0
  81. package/dist/src/client/session-utils.js +1 -1
  82. package/dist/src/client/session.d.ts +8 -16
  83. package/dist/src/client/session.js +1 -1
  84. package/dist/src/client/stream-version.js +1 -1
  85. package/dist/src/client/types.d.ts +2 -4
  86. package/dist/src/compiled/.vendor-stamp.json +3 -2
  87. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  88. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +55 -55
  89. package/dist/src/compiled/@vercel/blob/index.js +1 -1
  90. package/dist/src/compiled/@vercel/connect/LICENSE +202 -0
  91. package/dist/src/compiled/@vercel/connect/authorization-details.d.ts +11 -0
  92. package/dist/src/compiled/@vercel/connect/authorization.d.ts +47 -0
  93. package/dist/src/compiled/@vercel/connect/connector.d.ts +32 -0
  94. package/dist/src/compiled/@vercel/connect/index.d.ts +5 -0
  95. package/dist/src/compiled/@vercel/connect/index.js +26 -0
  96. package/dist/src/compiled/@vercel/connect/installation.d.ts +48 -0
  97. package/dist/src/compiled/@vercel/connect/token.d.ts +137 -0
  98. package/dist/src/compiled/@vercel/oidc/index.js +1 -1
  99. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  100. package/dist/src/compiled/@workflow/world-vercel/index.js +1 -1
  101. package/dist/src/compiler/bundled-extension.d.ts +7 -1
  102. package/dist/src/compiler/bundled-extension.js +1 -1
  103. package/dist/src/compiler/default-tool-policy.d.ts +2 -2
  104. package/dist/src/compiler/default-tool-policy.js +1 -1
  105. package/dist/src/compiler/development-extensions.js +1 -1
  106. package/dist/src/compiler/extension-compatibility.d.ts +54 -18
  107. package/dist/src/compiler/extension-compatibility.js +1 -1
  108. package/dist/src/compiler/extension-mount-bindings.d.ts +5 -0
  109. package/dist/src/compiler/extension-mount-bindings.js +1 -0
  110. package/dist/src/compiler/load-binding-namespace.d.ts +10 -2
  111. package/dist/src/compiler/load-binding-namespace.js +1 -1
  112. package/dist/src/compiler/manifest.d.ts +19 -17
  113. package/dist/src/compiler/manifest.js +1 -1
  114. package/dist/src/compiler/module-lifecycle.d.ts +2 -2
  115. package/dist/src/compiler/module-lifecycle.js +1 -1
  116. package/dist/src/compiler/module-map.d.ts +1 -1
  117. package/dist/src/compiler/module-map.js +3 -3
  118. package/dist/src/compiler/normalize-manifest-helpers.d.ts +18 -1
  119. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  120. package/dist/src/compiler/normalize-manifest-types.d.ts +2 -0
  121. package/dist/src/compiler/normalize-manifest.js +1 -1
  122. package/dist/src/compiler/normalize-subagent.js +1 -1
  123. package/dist/src/compiler/normalize-tool.js +1 -1
  124. package/dist/src/compiler/project-sources.d.ts +4 -0
  125. package/dist/src/compiler/project-sources.js +1 -1
  126. package/dist/src/compiler/remote-agent-node.js +1 -1
  127. package/dist/src/compiler/source-graph.d.ts +5 -0
  128. package/dist/src/compiler/source-graph.js +1 -1
  129. package/dist/src/computer-use/extension/extension.d.ts +2 -0
  130. package/dist/src/computer-use/extension/extension.js +1 -0
  131. package/dist/src/computer-use/extension/lib/command-failure.d.ts +7 -0
  132. package/dist/src/computer-use/extension/lib/command-failure.js +2 -0
  133. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.d.ts +8 -0
  134. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.js +3 -3
  135. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.d.ts +2 -0
  136. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.js +2 -1
  137. package/dist/src/computer-use/extension/lib/sandbox.d.ts +1 -0
  138. package/dist/src/computer-use/extension/lib/sandbox.js +1 -0
  139. package/dist/src/computer-use/extension/lib/shell.d.ts +1 -0
  140. package/dist/src/computer-use/extension/lib/shell.js +1 -0
  141. package/dist/src/computer-use/extension/tools/computer_use.js +1 -0
  142. package/dist/src/computer-use/tools.d.ts +1 -0
  143. package/dist/src/computer-use/tools.js +1 -0
  144. package/dist/src/context/build-dynamic-tools.js +1 -1
  145. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +5 -0
  146. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  147. package/dist/src/context/dynamic-tool-lifecycle.d.ts +1 -1
  148. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  149. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  150. package/dist/src/context/hook-lifecycle.d.ts +4 -3
  151. package/dist/src/context/hook-lifecycle.js +1 -1
  152. package/dist/src/context/key-names.d.ts +0 -1
  153. package/dist/src/context/key-names.js +1 -1
  154. package/dist/src/context/keys.d.ts +8 -14
  155. package/dist/src/context/keys.js +1 -1
  156. package/dist/src/context/memory-lifecycle.js +1 -1
  157. package/dist/src/context/memory-tools.d.ts +0 -1
  158. package/dist/src/context/provider.d.ts +1 -3
  159. package/dist/src/context/run-step.d.ts +2 -3
  160. package/dist/src/context/run-step.js +1 -1
  161. package/dist/src/context/serialize.js +1 -1
  162. package/dist/src/discover/bundled-extension.js +1 -1
  163. package/dist/src/discover/discover-agent.js +1 -1
  164. package/dist/src/discover/extensions.d.ts +0 -7
  165. package/dist/src/discover/extensions.js +1 -1
  166. package/dist/src/discover/manifest.d.ts +4 -0
  167. package/dist/src/evals/assertions/run.d.ts +4 -3
  168. package/dist/src/evals/assertions/run.js +1 -1
  169. package/dist/src/evals/index.d.ts +1 -1
  170. package/dist/src/evals/match.d.ts +4 -4
  171. package/dist/src/evals/mock-model.js +1 -1
  172. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  173. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  174. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +19 -0
  175. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -0
  176. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  177. package/dist/src/evals/runner/reporters/datadog-client.d.ts +123 -0
  178. package/dist/src/evals/runner/reporters/datadog-client.js +4 -0
  179. package/dist/src/evals/runner/reporters/datadog.d.ts +9 -98
  180. package/dist/src/evals/runner/reporters/datadog.js +2 -3
  181. package/dist/src/evals/session-content.js +1 -1
  182. package/dist/src/evals/session.d.ts +4 -4
  183. package/dist/src/evals/session.js +2 -2
  184. package/dist/src/evals/types.d.ts +18 -15
  185. package/dist/src/eve-channel/create-request.d.ts +5 -4
  186. package/dist/src/eve-channel/create-request.js +1 -1
  187. package/dist/src/eve-channel/index.d.ts +0 -9
  188. package/dist/src/eve-channel/index.js +1 -1
  189. package/dist/src/eve-channel/request.d.ts +3 -7
  190. package/dist/src/eve-channel/request.js +1 -1
  191. package/dist/src/eve-channel/support.d.ts +15 -5
  192. package/dist/src/eve-channel/support.js +1 -1
  193. package/dist/src/eve-channel/turn-policy-request.d.ts +2 -0
  194. package/dist/src/eve-channel/turn-policy-request.js +1 -0
  195. package/dist/src/eve-channel/types.d.ts +4 -0
  196. package/dist/src/execution/agent-sessions/context.d.ts +60 -0
  197. package/dist/src/execution/agent-sessions/context.js +1 -0
  198. package/dist/src/{subagents/remote-dispatch.d.ts → execution/agent-sessions/remote.d.ts} +17 -40
  199. package/dist/src/execution/agent-sessions/remote.js +1 -0
  200. package/dist/src/execution/agent-sessions/requests.d.ts +20 -0
  201. package/dist/src/execution/agent-sessions/requests.js +1 -0
  202. package/dist/src/execution/agent-sessions/session.d.ts +12 -0
  203. package/dist/src/execution/agent-sessions/session.js +1 -0
  204. package/dist/src/execution/agent-sessions/steps.d.ts +59 -0
  205. package/dist/src/execution/agent-sessions/steps.js +1 -0
  206. package/dist/src/execution/agent-sessions/target.d.ts +45 -0
  207. package/dist/src/execution/agent-sessions/target.js +1 -0
  208. package/dist/src/execution/agent-sessions/usage.d.ts +18 -0
  209. package/dist/src/execution/agent-sessions/usage.js +1 -0
  210. package/dist/src/execution/authorization-callback-match.d.ts +2 -4
  211. package/dist/src/execution/authorization-callback-match.js +1 -1
  212. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -5
  213. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  214. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  215. package/dist/src/execution/connection-announcement.d.ts +7 -0
  216. package/dist/src/execution/connection-announcement.js +4 -0
  217. package/dist/src/execution/continuation-conflict-step.d.ts +2 -3
  218. package/dist/src/execution/continuation-conflict-step.js +1 -1
  219. package/dist/src/execution/coordination-dispatch-shared.d.ts +9 -27
  220. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  221. package/dist/src/execution/coordination-dispatch-step.d.ts +3 -2
  222. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  223. package/dist/src/execution/create-session-step.d.ts +0 -1
  224. package/dist/src/execution/create-session-step.js +1 -1
  225. package/dist/src/execution/deliver-payloads.js +1 -1
  226. package/dist/src/execution/durable-session-store.d.ts +0 -1
  227. package/dist/src/execution/dynamic-connections.js +1 -1
  228. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  229. package/dist/src/execution/dynamic-workflow/schema.d.ts +1 -3
  230. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  231. package/dist/src/execution/dynamic-workflow/tool.d.ts +1 -1
  232. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  233. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  234. package/dist/src/execution/forward-session-input.d.ts +4 -0
  235. package/dist/src/execution/forward-session-input.js +1 -0
  236. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +41 -0
  237. package/dist/src/execution/legacy-remote-agent/protocol.js +1 -0
  238. package/dist/src/execution/legacy-session/authorization.js +1 -1
  239. package/dist/src/execution/legacy-session/completion-step.js +1 -1
  240. package/dist/src/execution/legacy-session/inbox.js +1 -1
  241. package/dist/src/execution/legacy-session/input.js +1 -1
  242. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  243. package/dist/src/execution/model-call-batching.js +1 -1
  244. package/dist/src/execution/node-step.d.ts +1 -1
  245. package/dist/src/execution/node-step.js +1 -1
  246. package/dist/src/execution/proxied-deliver-step.d.ts +9 -6
  247. package/dist/src/execution/proxied-deliver-step.js +1 -1
  248. package/dist/src/execution/publish-session-events.d.ts +130 -0
  249. package/dist/src/execution/publish-session-events.js +1 -0
  250. package/dist/src/execution/route-child-delivery.d.ts +5 -4
  251. package/dist/src/execution/route-child-delivery.js +1 -3
  252. package/dist/src/execution/runtime-context.js +1 -1
  253. package/dist/src/execution/sandbox/prewarm.js +1 -1
  254. package/dist/src/execution/session/admission.d.ts +1 -12
  255. package/dist/src/execution/session/admission.js +1 -1
  256. package/dist/src/execution/session/entry-input.d.ts +0 -2
  257. package/dist/src/execution/session/entry.js +1 -1
  258. package/dist/src/execution/session/finalization.js +1 -1
  259. package/dist/src/execution/session/handoff-steps.d.ts +13 -2
  260. package/dist/src/execution/session/handoff-steps.js +1 -1
  261. package/dist/src/execution/session/handoff.d.ts +17 -3
  262. package/dist/src/execution/session/handoff.js +1 -1
  263. package/dist/src/execution/session/input-queue.d.ts +27 -28
  264. package/dist/src/execution/session/input-queue.js +1 -1
  265. package/dist/src/execution/session/next-input.d.ts +5 -0
  266. package/dist/src/execution/session/next-input.js +1 -1
  267. package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
  268. package/dist/src/execution/session/pending-turn-state.js +1 -1
  269. package/dist/src/execution/session/principal.d.ts +14 -0
  270. package/dist/src/execution/session/principal.js +1 -0
  271. package/dist/src/execution/session/program.js +1 -1
  272. package/dist/src/execution/session/route-selected-delivery.js +1 -1
  273. package/dist/src/execution/session/state-cursor.d.ts +17 -15
  274. package/dist/src/execution/session/state-cursor.js +1 -1
  275. package/dist/src/execution/session/state-delta.d.ts +33 -0
  276. package/dist/src/execution/session/state-delta.js +1 -0
  277. package/dist/src/execution/session/timeout-steps.js +1 -1
  278. package/dist/src/execution/session/turn-event-handler.d.ts +27 -0
  279. package/dist/src/execution/session/turn-event-handler.js +1 -0
  280. package/dist/src/execution/session/turn-step-result.d.ts +1 -3
  281. package/dist/src/execution/session/turn-step-result.js +1 -1
  282. package/dist/src/execution/session/turn-step-types.d.ts +24 -15
  283. package/dist/src/execution/session/turn-step.d.ts +2 -2
  284. package/dist/src/execution/session/turn-step.js +1 -1
  285. package/dist/src/execution/session/turn-waiting-step.d.ts +4 -0
  286. package/dist/src/execution/session/turn-waiting-step.js +1 -0
  287. package/dist/src/execution/session/turn.d.ts +33 -2
  288. package/dist/src/execution/session/turn.js +1 -1
  289. package/dist/src/execution/session-callback-request.js +1 -1
  290. package/dist/src/execution/session-event-stream.d.ts +33 -0
  291. package/dist/src/execution/session-event-stream.js +1 -0
  292. package/dist/src/execution/session-inbox/inbox.d.ts +2 -0
  293. package/dist/src/execution/session-inbox/inbox.js +1 -1
  294. package/dist/src/execution/session-inbox/protocol.js +1 -1
  295. package/dist/src/execution/session-inbox/release-step.js +1 -1
  296. package/dist/src/execution/session-inbox/resume.js +1 -1
  297. package/dist/src/execution/session-workflow-tool-run.d.ts +11 -2
  298. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  299. package/dist/src/execution/session.d.ts +0 -1
  300. package/dist/src/execution/session.js +2 -2
  301. package/dist/src/execution/settle-cancelled-turn-step.d.ts +21 -9
  302. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  303. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  304. package/dist/src/execution/stable-workflow-names.js +1 -1
  305. package/dist/src/execution/tasks/calls.d.ts +42 -0
  306. package/dist/src/execution/tasks/calls.js +1 -0
  307. package/dist/src/execution/tasks/model-step.d.ts +58 -0
  308. package/dist/src/execution/tasks/model-step.js +1 -0
  309. package/dist/src/execution/tasks/render.d.ts +66 -0
  310. package/dist/src/execution/tasks/render.js +8 -0
  311. package/dist/src/execution/tasks/session.d.ts +19 -0
  312. package/dist/src/execution/tasks/session.js +1 -0
  313. package/dist/src/execution/tasks/start.d.ts +34 -0
  314. package/dist/src/execution/tasks/start.js +1 -0
  315. package/dist/src/execution/tasks/steps.d.ts +31 -0
  316. package/dist/src/execution/tasks/steps.js +1 -0
  317. package/dist/src/execution/tasks/table.d.ts +192 -0
  318. package/dist/src/execution/tasks/table.js +1 -0
  319. package/dist/src/execution/tasks/task-id-input.d.ts +19 -0
  320. package/dist/src/execution/tasks/task-id-input.js +1 -0
  321. package/dist/src/execution/tasks/tool-entry-point.d.ts +11 -0
  322. package/dist/src/execution/tasks/tool-entry-point.js +1 -0
  323. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  324. package/dist/src/execution/tasks/workflow-target.js +1 -1
  325. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  326. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  327. package/dist/src/execution/terminate-child-sessions-step.d.ts +2 -9
  328. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  329. package/dist/src/execution/tool-auth.js +1 -1
  330. package/dist/src/execution/tools/agent-router-workflow.d.ts +1 -1
  331. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  332. package/dist/src/execution/tools/agent-router.d.ts +1 -1
  333. package/dist/src/execution/tools/agent-router.js +1 -1
  334. package/dist/src/execution/tools/connection-approval.d.ts +25 -0
  335. package/dist/src/execution/tools/connection-approval.js +1 -0
  336. package/dist/src/execution/tools/connection-search-rank.d.ts +21 -0
  337. package/dist/src/execution/tools/connection-search-rank.js +1 -0
  338. package/dist/src/execution/tools/connection-target.d.ts +13 -0
  339. package/dist/src/execution/tools/connection-target.js +1 -0
  340. package/dist/src/execution/tools/connection-tools.d.ts +10 -0
  341. package/dist/src/execution/tools/connection-tools.js +2 -0
  342. package/dist/src/execution/tools/load-skill.js +1 -1
  343. package/dist/src/execution/tools/workflow/answer.d.ts +10 -4
  344. package/dist/src/execution/tools/workflow/answer.js +1 -1
  345. package/dist/src/execution/tools/workflow/ask.d.ts +73 -10
  346. package/dist/src/execution/tools/workflow/ask.js +1 -1
  347. package/dist/src/execution/tools/workflow/body.d.ts +60 -19
  348. package/dist/src/execution/tools/workflow/body.js +1 -1
  349. package/dist/src/execution/tools/workflow/cancel.d.ts +7 -2
  350. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  351. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +10 -4
  352. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  353. package/dist/src/execution/tools/workflow/{background.d.ts → harness-definition.d.ts} +6 -6
  354. package/dist/src/execution/tools/workflow/harness-definition.js +1 -0
  355. package/dist/src/execution/tools/workflow/interrupt.d.ts +6 -0
  356. package/dist/src/execution/tools/workflow/interrupt.js +1 -0
  357. package/dist/src/execution/tools/workflow/messages.d.ts +135 -10
  358. package/dist/src/execution/tools/workflow/messages.js +1 -1
  359. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  360. package/dist/src/execution/tools/workflow/owner.d.ts +15 -4
  361. package/dist/src/execution/tools/workflow/owner.js +1 -1
  362. package/dist/src/execution/tools/workflow/serve.d.ts +3 -0
  363. package/dist/src/execution/tools/workflow/serve.js +1 -0
  364. package/dist/src/execution/tools/workflow/start.d.ts +18 -11
  365. package/dist/src/execution/tools/workflow/start.js +1 -1
  366. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  367. package/dist/src/execution/tools/workflow/step.js +1 -1
  368. package/dist/src/execution/tools/workflow/types.d.ts +0 -10
  369. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +31 -0
  370. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -0
  371. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +3 -5
  372. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
  373. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  374. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  375. package/dist/src/execution/web-fetch/request.js +1 -1
  376. package/dist/src/execution/workflow-callback-url.d.ts +0 -5
  377. package/dist/src/execution/workflow-callback-url.js +1 -1
  378. package/dist/src/execution/workflow-runtime.d.ts +3 -5
  379. package/dist/src/execution/workflow-runtime.js +1 -1
  380. package/dist/src/execution/workflow-webhook-route.js +1 -1
  381. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  382. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  383. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  384. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +3 -2
  385. package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
  386. package/dist/src/extensions/code/extension/lib/signed-commit.d.ts +1 -1
  387. package/dist/src/extensions/code/extension/lib/signed-commit.js +2 -2
  388. package/dist/src/extensions/code/tools.d.ts +2 -1
  389. package/dist/src/extensions/code/tools.js +1 -1
  390. package/dist/src/framework/sources/modules/agent.d.ts +1 -0
  391. package/dist/src/framework/sources/modules/agent.js +1 -1
  392. package/dist/src/framework/sources/registry.js +1 -1
  393. package/dist/src/harness/action-presentation.js +1 -1
  394. package/dist/src/harness/action-result-helpers.d.ts +1 -0
  395. package/dist/src/harness/action-result-helpers.js +1 -1
  396. package/dist/src/harness/advertised-tools.d.ts +1 -1
  397. package/dist/src/harness/advertised-tools.js +1 -1
  398. package/dist/src/harness/announcements.d.ts +22 -0
  399. package/dist/src/harness/announcements.js +1 -0
  400. package/dist/src/harness/approval-candidates.d.ts +10 -2
  401. package/dist/src/harness/approval-candidates.js +1 -1
  402. package/dist/src/harness/approval-delivery-coordinator.d.ts +4 -5
  403. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  404. package/dist/src/harness/approval-recheck.d.ts +7 -0
  405. package/dist/src/harness/approval-recheck.js +1 -0
  406. package/dist/src/harness/authorization-event-fields.d.ts +13 -0
  407. package/dist/src/harness/authorization-event-fields.js +1 -0
  408. package/dist/src/harness/authorization.d.ts +2 -1
  409. package/dist/src/harness/authorization.js +1 -1
  410. package/dist/src/harness/coordination.d.ts +31 -27
  411. package/dist/src/harness/coordination.js +1 -1
  412. package/dist/src/harness/current-messages.d.ts +6 -1
  413. package/dist/src/harness/current-messages.js +1 -1
  414. package/dist/src/harness/emission.d.ts +7 -1
  415. package/dist/src/harness/emission.js +1 -1
  416. package/dist/src/harness/execute-tool.d.ts +4 -15
  417. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +2 -0
  418. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  419. package/dist/src/harness/input-request-resolution.d.ts +5 -2
  420. package/dist/src/harness/input-request-resolution.js +1 -1
  421. package/dist/src/harness/input-requests.js +1 -1
  422. package/dist/src/harness/messages.d.ts +11 -3
  423. package/dist/src/harness/messages.js +1 -1
  424. package/dist/src/harness/nested-actions.d.ts +23 -0
  425. package/dist/src/harness/nested-actions.js +1 -0
  426. package/dist/src/harness/pending-input-batches.d.ts +8 -6
  427. package/dist/src/harness/pending-input-batches.js +1 -1
  428. package/dist/src/harness/provider-tool-history.d.ts +7 -2
  429. package/dist/src/harness/provider-tool-history.js +1 -1
  430. package/dist/src/harness/proxy-input-requests.d.ts +41 -36
  431. package/dist/src/harness/proxy-input-requests.js +1 -1
  432. package/dist/src/harness/session-limit-enforcement.js +1 -1
  433. package/dist/src/harness/stale-input-responses.js +1 -1
  434. package/dist/src/harness/step-hooks.js +1 -1
  435. package/dist/src/harness/tool-loop.js +2 -2
  436. package/dist/src/harness/tool-model-output.js +1 -1
  437. package/dist/src/harness/tool-presentation.js +1 -1
  438. package/dist/src/harness/tools.d.ts +1 -5
  439. package/dist/src/harness/tools.js +1 -1
  440. package/dist/src/harness/turn-tag-state.d.ts +6 -5
  441. package/dist/src/harness/types.d.ts +7 -15
  442. package/dist/src/harness/workflow-dispatch.d.ts +30 -0
  443. package/dist/src/harness/workflow-dispatch.js +1 -0
  444. package/dist/src/harness/workflow-tool-runs.d.ts +5 -65
  445. package/dist/src/harness/workflow-tool-runs.js +1 -1
  446. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  447. package/dist/src/instrumentation/lifecycle.d.ts +5 -2
  448. package/dist/src/instrumentation/lifecycle.js +1 -1
  449. package/dist/src/instrumentation/native-events.d.ts +0 -7
  450. package/dist/src/instrumentation/native-events.js +1 -1
  451. package/dist/src/instrumentation/runtime.d.ts +1 -4
  452. package/dist/src/instrumentation/runtime.js +1 -1
  453. package/dist/src/instrumentation/state.d.ts +0 -6
  454. package/dist/src/instrumentation/state.js +1 -1
  455. package/dist/src/internal/application/package.js +1 -1
  456. package/dist/src/internal/authored-definition/schema-backed.d.ts +10 -0
  457. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  458. package/dist/src/internal/authored-module-loader.d.ts +12 -6
  459. package/dist/src/internal/authored-module-loader.js +2 -2
  460. package/dist/src/internal/authored-module-map-loader.js +1 -1
  461. package/dist/src/internal/authored-package-boundary.d.ts +3 -0
  462. package/dist/src/internal/authored-package-boundary.js +1 -1
  463. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +14 -0
  464. package/dist/src/internal/bundler/extension-mount-plugin.js +1 -0
  465. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +8 -11
  466. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -3
  467. package/dist/src/internal/invocation/workflow-execution.d.ts +2 -2
  468. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  469. package/dist/src/internal/mount-state.d.ts +1 -0
  470. package/dist/src/internal/mount-state.js +1 -0
  471. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +2 -2
  472. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  473. package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +2 -4
  474. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  475. package/dist/src/internal/nitro/dev-runtime-generation-metadata.d.ts +13 -0
  476. package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -0
  477. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  478. package/dist/src/internal/nitro/development-generation.js +1 -1
  479. package/dist/src/internal/nitro/host/build-application.js +1 -1
  480. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  481. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +1 -0
  482. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  483. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  484. package/dist/src/internal/nitro/host/dev-workflow-world-setup.d.ts +1 -0
  485. package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -1
  486. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  487. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  488. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  489. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  490. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  491. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  492. package/dist/src/internal/workflow/cancel-expired-development-run.d.ts +2 -0
  493. package/dist/src/internal/workflow/cancel-expired-development-run.js +1 -0
  494. package/dist/src/internal/workflow/development-runtime-compatibility.d.ts +12 -0
  495. package/dist/src/internal/workflow/development-runtime-compatibility.js +1 -0
  496. package/dist/src/internal/workflow/development-world-client.js +1 -1
  497. package/dist/src/internal/workflow/development-world-protocol.d.ts +9 -0
  498. package/dist/src/internal/workflow/development-world-server.d.ts +2 -0
  499. package/dist/src/internal/workflow/development-world-server.js +1 -1
  500. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  501. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -0
  502. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +4 -3
  503. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  504. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  505. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  506. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  507. package/dist/src/models/auto.d.ts +6 -0
  508. package/dist/src/models/auto.js +2 -2
  509. package/dist/src/protocol/message-version.d.ts +1 -0
  510. package/dist/src/protocol/message-version.js +1 -1
  511. package/dist/src/protocol/message.d.ts +126 -67
  512. package/dist/src/protocol/message.js +2 -2
  513. package/dist/src/protocol/remote-agent-protocol.d.ts +16 -0
  514. package/dist/src/protocol/remote-agent-protocol.js +1 -0
  515. package/dist/src/protocol/routes.d.ts +0 -6
  516. package/dist/src/protocol/routes.js +1 -1
  517. package/dist/src/protocol/task-tools.d.ts +21 -0
  518. package/dist/src/protocol/task-tools.js +1 -0
  519. package/dist/src/public/channels/auth.js +1 -1
  520. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +25 -16
  521. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  522. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  523. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -0
  524. package/dist/src/public/channels/chat-sdk/input-actions.js +1 -0
  525. package/dist/src/public/channels/index.d.ts +1 -1
  526. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  527. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  528. package/dist/src/public/channels/slack/action-status.d.ts +11 -12
  529. package/dist/src/public/channels/slack/action-status.js +1 -1
  530. package/dist/src/public/channels/slack/api.js +1 -1
  531. package/dist/src/public/channels/slack/attachments.js +1 -1
  532. package/dist/src/public/channels/slack/auth.d.ts +3 -0
  533. package/dist/src/public/channels/slack/auth.js +1 -1
  534. package/dist/src/public/channels/slack/connections.d.ts +6 -6
  535. package/dist/src/public/channels/slack/connections.js +1 -1
  536. package/dist/src/public/channels/slack/defaults.d.ts +13 -19
  537. package/dist/src/public/channels/slack/defaults.js +4 -4
  538. package/dist/src/public/channels/slack/hitl.d.ts +22 -13
  539. package/dist/src/public/channels/slack/hitl.js +2 -2
  540. package/dist/src/public/channels/slack/index.d.ts +4 -3
  541. package/dist/src/public/channels/slack/index.js +1 -1
  542. package/dist/src/public/channels/slack/input-response.d.ts +1 -5
  543. package/dist/src/public/channels/slack/input-response.js +1 -1
  544. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  545. package/dist/src/public/channels/slack/interactions.js +1 -1
  546. package/dist/src/public/channels/slack/renderers.d.ts +76 -0
  547. package/dist/src/public/channels/slack/renderers.js +1 -0
  548. package/dist/src/public/channels/slack/session-operations.d.ts +6 -0
  549. package/dist/src/public/channels/slack/session-operations.js +1 -1
  550. package/dist/src/public/channels/slack/slackChannel.d.ts +47 -103
  551. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  552. package/dist/src/public/channels/slack/task-card.d.ts +24 -0
  553. package/dist/src/public/channels/slack/task-card.js +1 -0
  554. package/dist/src/public/channels/telegram/hitl.d.ts +7 -1
  555. package/dist/src/public/channels/telegram/hitl.js +2 -1
  556. package/dist/src/public/channels/telegram/state.js +1 -1
  557. package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -0
  558. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  559. package/dist/src/public/definitions/channel.d.ts +6 -1
  560. package/dist/src/public/definitions/channel.js +1 -1
  561. package/dist/src/public/definitions/connections/mcp.d.ts +4 -6
  562. package/dist/src/public/definitions/connections/openapi.d.ts +7 -8
  563. package/dist/src/public/definitions/extension.d.ts +2 -2
  564. package/dist/src/public/definitions/extension.js +1 -1
  565. package/dist/src/public/definitions/hook.d.ts +16 -4
  566. package/dist/src/public/definitions/state.d.ts +4 -2
  567. package/dist/src/public/definitions/state.js +1 -1
  568. package/dist/src/public/memory/index.d.ts +0 -1
  569. package/dist/src/public/models/openai/index.d.ts +1 -1
  570. package/dist/src/public/models/openai/index.js +1 -1
  571. package/dist/src/public/schedules/index.d.ts +1 -0
  572. package/dist/src/public/schedules/index.js +1 -1
  573. package/dist/src/public/server/index.d.ts +28 -0
  574. package/dist/src/public/server/index.js +1 -0
  575. package/dist/src/public/tools/index.d.ts +3 -2
  576. package/dist/src/public/tools/index.js +1 -1
  577. package/dist/src/public/tools/no-reply.d.ts +1 -0
  578. package/dist/src/public/tools/no-reply.js +1 -0
  579. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +6 -7
  580. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  581. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  582. package/dist/src/runtime/agent/bootstrap.js +1 -1
  583. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  584. package/dist/src/runtime/agent/mock-model-fixtures.d.ts +1 -1
  585. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  586. package/dist/src/runtime/channels/registry.js +1 -1
  587. package/dist/src/runtime/connections/mcp-client.d.ts +1 -2
  588. package/dist/src/runtime/connections/openapi-client.js +1 -1
  589. package/dist/src/runtime/connections/scoped-authorization.d.ts +1 -1
  590. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  591. package/dist/src/runtime/connections/tool-result.d.ts +27 -0
  592. package/dist/src/runtime/connections/tool-result.js +2 -0
  593. package/dist/src/runtime/connections/tool-signature.d.ts +14 -0
  594. package/dist/src/runtime/connections/tool-signature.js +1 -0
  595. package/dist/src/runtime/local-dev-capability.js +1 -1
  596. package/dist/src/runtime/prompt/compose.d.ts +1 -3
  597. package/dist/src/runtime/prompt/compose.js +3 -3
  598. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  599. package/dist/src/runtime/resolve-tool.js +1 -1
  600. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  601. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  602. package/dist/src/runtime/sessions/turn.d.ts +1 -16
  603. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  604. package/dist/src/runtime/subagents/registry.js +1 -1
  605. package/dist/src/runtime/subagents/workflow-reference.d.ts +6 -3
  606. package/dist/src/runtime/subagents/workflow-reference.js +1 -1
  607. package/dist/src/runtime/subagents/workflow.d.ts +12 -6
  608. package/dist/src/runtime/subagents/workflow.js +1 -1
  609. package/dist/src/runtime/tools/registry.js +1 -1
  610. package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -0
  611. package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
  612. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  613. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  614. package/dist/src/self-modification/extension/subagents/agent/instructions.js +7 -7
  615. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  616. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.d.ts +2 -0
  617. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
  618. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  619. package/dist/src/self-modification/scaffold.d.ts +2 -0
  620. package/dist/src/self-modification/scaffold.js +7 -0
  621. package/dist/src/self-modification/setup.js +1 -7
  622. package/dist/src/setup/boxes/model-capabilities.d.ts +2 -2
  623. package/dist/src/setup/boxes/model-capabilities.js +1 -1
  624. package/dist/src/setup/boxes/select-model.js +1 -1
  625. package/dist/src/setup/integrations/shopify/templates.d.ts +1 -1
  626. package/dist/src/setup/integrations/shopify/templates.js +31 -19
  627. package/dist/src/setup/integrations/web/setup.d.ts +0 -2
  628. package/dist/src/setup/integrations/web/setup.js +3 -3
  629. package/dist/src/setup/scaffold/create/agent-paths.d.ts +5 -0
  630. package/dist/src/setup/scaffold/create/agent-paths.js +1 -0
  631. package/dist/src/setup/scaffold/create/instructions-template.d.ts +1 -0
  632. package/dist/src/setup/scaffold/create/instructions-template.js +8 -0
  633. package/dist/src/setup/scaffold/create/project.js +3 -10
  634. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  635. package/dist/src/setup/scaffold/create/web-template.js +1 -1
  636. package/dist/src/shared/action-request-name.d.ts +3 -0
  637. package/dist/src/shared/action-request-name.js +1 -0
  638. package/dist/src/shared/action-types.d.ts +49 -21
  639. package/dist/src/shared/action-types.js +1 -1
  640. package/dist/src/shared/agent-definition.d.ts +0 -7
  641. package/dist/src/shared/chatgpt-model.d.ts +1 -1
  642. package/dist/src/shared/chatgpt-model.js +1 -1
  643. package/dist/src/shared/connection-types.d.ts +2 -3
  644. package/dist/src/shared/default-agent-model.d.ts +10 -1
  645. package/dist/src/shared/default-agent-model.js +1 -1
  646. package/dist/src/shared/extension-mount.d.ts +2 -0
  647. package/dist/src/shared/extension-mount.js +1 -0
  648. package/dist/src/shared/format-duration.d.ts +2 -0
  649. package/dist/src/shared/format-duration.js +1 -0
  650. package/dist/src/shared/gateway-model-catalog.d.ts +25 -2
  651. package/dist/src/shared/gateway-model-catalog.js +1 -1
  652. package/dist/src/shared/input.d.ts +1 -0
  653. package/dist/src/shared/memory-state.d.ts +1 -0
  654. package/dist/src/shared/memory-state.js +1 -1
  655. package/dist/src/shared/model-helper.d.ts +2 -2
  656. package/dist/src/shared/model-helper.js +1 -1
  657. package/dist/src/shared/model-summary.d.ts +2 -6
  658. package/dist/src/shared/model-summary.js +1 -1
  659. package/dist/src/shared/presentation-text.d.ts +5 -0
  660. package/dist/src/shared/presentation-text.js +1 -1
  661. package/dist/src/shared/serialized-observability-state.d.ts +0 -4
  662. package/dist/src/shared/serialized-observability-state.js +1 -1
  663. package/dist/src/shared/value-delta.d.ts +39 -0
  664. package/dist/src/shared/value-delta.js +1 -0
  665. package/dist/src/subagents/adapter-state.d.ts +0 -2
  666. package/dist/src/subagents/adapter-state.js +1 -1
  667. package/dist/src/subagents/adapter.js +1 -1
  668. package/dist/src/subagents/callback-route.js +1 -1
  669. package/dist/src/subagents/event-proxy-step.d.ts +16 -29
  670. package/dist/src/subagents/event-proxy-step.js +1 -1
  671. package/dist/src/subagents/hitl-proxy.d.ts +35 -17
  672. package/dist/src/subagents/hitl-proxy.js +1 -1
  673. package/dist/src/subagents/invocation.d.ts +1 -2
  674. package/dist/src/subagents/parent-notification.d.ts +2 -1
  675. package/dist/src/subagents/parent-notification.js +1 -1
  676. package/dist/src/subagents/token-budget.d.ts +8 -9
  677. package/dist/src/subagents/token-budget.js +1 -1
  678. package/dist/src/subagents/tool.d.ts +6 -12
  679. package/dist/src/subagents/tool.js +1 -1
  680. package/dist/src/svelte/index.js +1 -1
  681. package/dist/src/svelte/use-eve-agent.js +1 -1
  682. package/dist/src/tools/behavior.d.ts +5 -5
  683. package/dist/src/tools/definition.d.ts +58 -14
  684. package/dist/src/tools/definition.js +1 -1
  685. package/dist/src/tools/durable-callbacks.d.ts +1 -1
  686. package/dist/src/tools/dynamic.d.ts +6 -0
  687. package/dist/src/tools/framework/agent-contract.d.ts +2 -5
  688. package/dist/src/tools/framework/agent-contract.js +1 -1
  689. package/dist/src/tools/framework/agent.d.ts +2 -5
  690. package/dist/src/tools/framework/agent.js +1 -1
  691. package/dist/src/tools/framework/connection-tools.d.ts +3 -0
  692. package/dist/src/tools/framework/connection-tools.js +1 -0
  693. package/dist/src/tools/provided/agent-router.d.ts +6 -3
  694. package/dist/src/tools/provided/agent-router.js +1 -1
  695. package/dist/src/{execution/tools → tools/provided}/ask-question-workflow.d.ts +3 -4
  696. package/dist/src/tools/provided/ask-question-workflow.js +1 -0
  697. package/dist/src/tools/provided/ask-question.d.ts +20 -5
  698. package/dist/src/tools/provided/ask-question.js +2 -1
  699. package/dist/src/tools/provided/interrupted.d.ts +18 -0
  700. package/dist/src/tools/provided/interrupted.js +1 -0
  701. package/dist/src/tools/provided/no-reply.d.ts +19 -0
  702. package/dist/src/tools/provided/no-reply.js +1 -0
  703. package/dist/src/tools/provided/sleep-workflow.d.ts +4 -0
  704. package/dist/src/tools/provided/sleep-workflow.js +1 -0
  705. package/dist/src/tools/provided/sleep.d.ts +11 -5
  706. package/dist/src/tools/provided/sleep.js +1 -1
  707. package/dist/src/tools/provided/task-cancel.d.ts +6 -0
  708. package/dist/src/tools/provided/task-cancel.js +1 -0
  709. package/dist/src/tools/provided/task-wait.d.ts +9 -0
  710. package/dist/src/tools/provided/task-wait.js +1 -0
  711. package/dist/src/tools/provided/workflow.d.ts +2 -2
  712. package/dist/src/tools/provided/workflow.js +1 -1
  713. package/dist/src/tools/schema-emission.d.ts +23 -0
  714. package/dist/src/tools/schema-emission.js +1 -0
  715. package/dist/src/tools/schema.d.ts +22 -8
  716. package/dist/src/tools/schema.js +1 -1
  717. package/dist/src/tools/workflow-definition.d.ts +187 -85
  718. package/dist/src/tools/workflow-definition.js +1 -1
  719. package/dist/src/tools/workflow-entry-point.d.ts +3 -0
  720. package/dist/src/tools/workflow-entry-point.js +1 -0
  721. package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -3
  722. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  723. package/dist/src/tracing/agent-invocation-coordinator.d.ts +9 -18
  724. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  725. package/dist/src/tracing/agent-otel-content.d.ts +0 -2
  726. package/dist/src/tracing/agent-otel-content.js +3 -3
  727. package/dist/src/tracing/agent-otel-provider.js +2 -2
  728. package/dist/src/tracing/agent-otel-runtime-context.d.ts +20 -0
  729. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  730. package/dist/src/tracing/agent-otel-usage.js +1 -1
  731. package/dist/src/tracing/agent-span-contract.d.ts +1 -1
  732. package/dist/src/tracing/agent-span-contract.js +1 -1
  733. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  734. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  735. package/dist/src/tracing/agent-trace-context-codec.d.ts +1 -2
  736. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  737. package/dist/src/tracing/agent-trace-context-store.d.ts +2 -27
  738. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  739. package/dist/src/tracing/agent-trace-state.d.ts +1 -19
  740. package/dist/src/tracing/content-attributes.js +1 -1
  741. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  742. package/dist/src/vue/index.js +1 -1
  743. package/dist/src/vue/use-eve-agent.js +1 -1
  744. package/docs/agent-config.md +36 -13
  745. package/docs/channels/chat-sdk.mdx +15 -4
  746. package/docs/channels/custom.mdx +89 -17
  747. package/docs/channels/eve.mdx +1 -1
  748. package/docs/channels/mcp.mdx +1 -1
  749. package/docs/channels/overview.mdx +14 -56
  750. package/docs/channels/slack.mdx +230 -35
  751. package/docs/channels/telegram.mdx +2 -0
  752. package/docs/concepts/built-in-tools.md +36 -28
  753. package/docs/concepts/context-control.md +2 -2
  754. package/docs/concepts/execution-model-and-durability.mdx +10 -11
  755. package/docs/concepts/project-structure.mdx +1 -1
  756. package/docs/concepts/sessions-runs-and-streaming.md +67 -47
  757. package/docs/connections/mcp.mdx +4 -4
  758. package/docs/connections/openapi.mdx +2 -2
  759. package/docs/connections/overview.mdx +2 -2
  760. package/docs/evals/assertions.mdx +5 -5
  761. package/docs/evals/cases.mdx +1 -1
  762. package/docs/evals/reporters.mdx +6 -4
  763. package/docs/extensions.md +11 -2
  764. package/docs/guides/auth-and-route-protection.md +1 -1
  765. package/docs/guides/client/streaming.mdx +31 -11
  766. package/docs/guides/deployment/vercel.mdx +1 -1
  767. package/docs/guides/dev-tui.md +13 -3
  768. package/docs/guides/dynamic-capabilities.md +15 -10
  769. package/docs/guides/evaluate.md +29 -2
  770. package/docs/guides/frontend/overview.mdx +5 -7
  771. package/docs/guides/hooks.md +48 -12
  772. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  773. package/docs/guides/remote-agents.md +12 -14
  774. package/docs/guides/self-modification.md +10 -0
  775. package/docs/install-integrations.mdx +1 -1
  776. package/docs/instructions.mdx +1 -1
  777. package/docs/patterns/multi-tenant-approvals.md +1 -1
  778. package/docs/protocols/ucp.mdx +20 -16
  779. package/docs/reference/cli.md +96 -22
  780. package/docs/reference/typescript-api.md +43 -41
  781. package/docs/schedules.mdx +14 -34
  782. package/docs/subagents/index.mdx +24 -56
  783. package/docs/tools/human-in-the-loop.md +50 -13
  784. package/docs/tools/meta.json +1 -1
  785. package/docs/tools/overview.mdx +79 -59
  786. package/docs/tools/tasks-upgrade.md +201 -0
  787. package/docs/tools/tasks.md +315 -0
  788. package/docs/tools/workflows.mdx +368 -154
  789. package/package.json +41 -14
  790. package/dist/src/channel/activity-renderer.d.ts +0 -21
  791. package/dist/src/channel/activity-renderer.js +0 -1
  792. package/dist/src/channel/activity-sink.d.ts +0 -2
  793. package/dist/src/channel/activity-sink.js +0 -1
  794. package/dist/src/eve-channel/activity-observer-request.d.ts +0 -7
  795. package/dist/src/eve-channel/activity-observer-request.js +0 -1
  796. package/dist/src/eve-channel/delivery-policy-request.d.ts +0 -4
  797. package/dist/src/eve-channel/delivery-policy-request.js +0 -1
  798. package/dist/src/execution/activity-cohort.d.ts +0 -20
  799. package/dist/src/execution/activity-cohort.js +0 -1
  800. package/dist/src/execution/activity-collector.d.ts +0 -12
  801. package/dist/src/execution/activity-collector.js +0 -1
  802. package/dist/src/execution/activity-events.d.ts +0 -8
  803. package/dist/src/execution/activity-events.js +0 -1
  804. package/dist/src/execution/activity-route.d.ts +0 -2
  805. package/dist/src/execution/activity-route.js +0 -1
  806. package/dist/src/execution/activity-work-id.d.ts +0 -9
  807. package/dist/src/execution/activity-work-id.js +0 -1
  808. package/dist/src/execution/activity-work.d.ts +0 -30
  809. package/dist/src/execution/activity-work.js +0 -1
  810. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +0 -7
  811. package/dist/src/execution/cancel-indexed-session-tasks-step.js +0 -1
  812. package/dist/src/execution/dispatch-action-failures.d.ts +0 -8
  813. package/dist/src/execution/dispatch-action-failures.js +0 -1
  814. package/dist/src/execution/dispatch-start-operation.d.ts +0 -15
  815. package/dist/src/execution/dispatch-start-operation.js +0 -1
  816. package/dist/src/execution/publish-channel-event.d.ts +0 -23
  817. package/dist/src/execution/publish-channel-event.js +0 -1
  818. package/dist/src/execution/scheduled-launch-delivery.d.ts +0 -7
  819. package/dist/src/execution/scheduled-launch-delivery.js +0 -1
  820. package/dist/src/execution/session/event-sink.d.ts +0 -26
  821. package/dist/src/execution/session/event-sink.js +0 -1
  822. package/dist/src/execution/session-activity-projection.d.ts +0 -16
  823. package/dist/src/execution/session-activity-projection.js +0 -1
  824. package/dist/src/execution/session-activity-renderer-step.d.ts +0 -15
  825. package/dist/src/execution/session-activity-renderer-step.js +0 -1
  826. package/dist/src/execution/session-activity.d.ts +0 -3
  827. package/dist/src/execution/session-activity.js +0 -1
  828. package/dist/src/execution/submit-activity.d.ts +0 -7
  829. package/dist/src/execution/submit-activity.js +0 -1
  830. package/dist/src/execution/task-event-callback.d.ts +0 -12
  831. package/dist/src/execution/task-event-callback.js +0 -1
  832. package/dist/src/execution/task-input-capability.d.ts +0 -4
  833. package/dist/src/execution/task-input-capability.js +0 -1
  834. package/dist/src/execution/task-input-response-route.d.ts +0 -2
  835. package/dist/src/execution/task-input-response-route.js +0 -1
  836. package/dist/src/execution/tasks/child/notify.d.ts +0 -44
  837. package/dist/src/execution/tasks/child/notify.js +0 -1
  838. package/dist/src/execution/tasks/parent/control-shared.d.ts +0 -23
  839. package/dist/src/execution/tasks/parent/control-shared.js +0 -1
  840. package/dist/src/execution/tasks/parent/delegate.d.ts +0 -35
  841. package/dist/src/execution/tasks/parent/delegate.js +0 -1
  842. package/dist/src/execution/tasks/parent/dispatch.d.ts +0 -22
  843. package/dist/src/execution/tasks/parent/dispatch.js +0 -1
  844. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +0 -27
  845. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +0 -1
  846. package/dist/src/execution/tasks/parent/run-parent.d.ts +0 -58
  847. package/dist/src/execution/tasks/parent/run-parent.js +0 -1
  848. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +0 -26
  849. package/dist/src/execution/tasks/parent/subagent-task-projection.js +0 -1
  850. package/dist/src/execution/tasks/parent/task-cancel.d.ts +0 -12
  851. package/dist/src/execution/tasks/parent/task-cancel.js +0 -1
  852. package/dist/src/execution/tasks/parent/tool-execution.d.ts +0 -45
  853. package/dist/src/execution/tasks/parent/tool-execution.js +0 -1
  854. package/dist/src/execution/terminal-session-event.d.ts +0 -13
  855. package/dist/src/execution/terminal-session-event.js +0 -1
  856. package/dist/src/execution/tools/ask-question-workflow.js +0 -1
  857. package/dist/src/execution/tools/ask-question.d.ts +0 -19
  858. package/dist/src/execution/tools/ask-question.js +0 -2
  859. package/dist/src/execution/tools/connection-search.d.ts +0 -2
  860. package/dist/src/execution/tools/connection-search.js +0 -2
  861. package/dist/src/execution/tools/sleep-workflow.d.ts +0 -3
  862. package/dist/src/execution/tools/sleep-workflow.js +0 -1
  863. package/dist/src/execution/tools/sleep.d.ts +0 -10
  864. package/dist/src/execution/tools/sleep.js +0 -1
  865. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +0 -7
  866. package/dist/src/execution/tools/subagent/accept-event-step.js +0 -1
  867. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +0 -12
  868. package/dist/src/execution/tools/subagent/emit-event-step.js +0 -1
  869. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +0 -42
  870. package/dist/src/execution/tools/subagent/invoke-agent.js +0 -1
  871. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +0 -44
  872. package/dist/src/execution/tools/subagent/invoke-preparation.js +0 -1
  873. package/dist/src/execution/tools/subagent/invoke-step.d.ts +0 -64
  874. package/dist/src/execution/tools/subagent/invoke-step.js +0 -1
  875. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +0 -11
  876. package/dist/src/execution/tools/subagent/receipt-identity.js +0 -1
  877. package/dist/src/execution/tools/subagent/start.d.ts +0 -51
  878. package/dist/src/execution/tools/subagent/start.js +0 -1
  879. package/dist/src/execution/tools/subagent/steer.d.ts +0 -13
  880. package/dist/src/execution/tools/subagent/steer.js +0 -1
  881. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -24
  882. package/dist/src/execution/tools/subagent/task-agent-requests.js +0 -1
  883. package/dist/src/execution/tools/subagent/task-cancel.d.ts +0 -10
  884. package/dist/src/execution/tools/subagent/task-cancel.js +0 -1
  885. package/dist/src/execution/tools/tasks.d.ts +0 -3
  886. package/dist/src/execution/tools/tasks.js +0 -1
  887. package/dist/src/execution/tools/workflow/background.js +0 -1
  888. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +0 -14
  889. package/dist/src/execution/tools/workflow/workflow-owner-background.js +0 -1
  890. package/dist/src/extensions/code/extension/tools/computer_use.js +0 -1
  891. package/dist/src/harness/background-tools.d.ts +0 -45
  892. package/dist/src/harness/background-tools.js +0 -1
  893. package/dist/src/instrumentation/background-task-runtime.d.ts +0 -18
  894. package/dist/src/instrumentation/background-task-runtime.js +0 -1
  895. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.3.0/node_modules/@vercel/cli-config/dist/index.js +0 -21
  896. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  897. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  898. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  899. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  900. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  901. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  902. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  903. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  904. 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/authorization.js +0 -1
  905. 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 +0 -1
  906. 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/index.js +0 -1
  907. 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/installation.js +0 -1
  908. 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/internal/base-url.js +0 -1
  909. 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/internal/default-scopes.js +0 -1
  910. 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/internal/env.js +0 -1
  911. 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/internal/url-validation.js +0 -1
  912. 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/token.js +0 -1
  913. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  914. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  915. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  916. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  917. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  918. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/index.js +0 -1
  919. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  920. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  921. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  922. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  923. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token.js +0 -1
  924. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  925. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/version.js +0 -1
  926. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  927. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  928. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  929. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  930. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  931. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  932. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  933. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  934. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  935. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  936. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  937. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  938. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  939. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  940. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  941. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  942. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  943. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  944. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  945. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  946. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  947. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  948. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  949. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  950. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  951. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  952. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  953. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  954. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  955. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  956. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  957. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  958. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  959. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  960. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  961. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  962. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  963. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  964. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  965. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  966. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  967. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  968. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  969. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  970. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  971. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  972. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  973. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  974. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  975. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  976. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  977. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  978. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  979. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  980. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  981. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  982. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  983. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  984. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  985. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  986. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  987. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  988. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  989. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  990. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  991. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  992. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  993. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  994. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  995. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  996. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  997. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  998. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  999. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  1000. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  1001. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  1002. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  1003. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  1004. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  1005. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  1006. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  1007. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  1008. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  1009. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  1010. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  1011. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  1012. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  1013. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  1014. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  1015. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  1016. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  1017. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  1018. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  1019. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  1020. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  1021. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  1022. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  1023. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  1024. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  1025. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  1026. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  1027. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  1028. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  1029. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  1030. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  1031. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  1032. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  1033. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  1034. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  1035. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  1036. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  1037. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  1038. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  1039. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  1040. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  1041. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  1042. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  1043. package/dist/src/protocol/activity.d.ts +0 -112
  1044. package/dist/src/protocol/activity.js +0 -1
  1045. package/dist/src/protocol/agent-handle-error.d.ts +0 -13
  1046. package/dist/src/protocol/agent-handle-error.js +0 -1
  1047. package/dist/src/public/channels/slack/activity-plan.d.ts +0 -5
  1048. package/dist/src/public/channels/slack/activity-plan.js +0 -1
  1049. package/dist/src/public/channels/slack/activity.d.ts +0 -63
  1050. package/dist/src/public/channels/slack/activity.js +0 -2
  1051. package/dist/src/public/tools/connection-search.d.ts +0 -1
  1052. package/dist/src/public/tools/connection-search.js +0 -1
  1053. package/dist/src/public/tools/task-cancel.d.ts +0 -1
  1054. package/dist/src/public/tools/task-cancel.js +0 -1
  1055. package/dist/src/runtime/prompt/connections.d.ts +0 -9
  1056. package/dist/src/runtime/prompt/connections.js +0 -2
  1057. package/dist/src/shared/boundary-hook-error.d.ts +0 -4
  1058. package/dist/src/shared/boundary-hook-error.js +0 -1
  1059. package/dist/src/shared/empty-delivery.d.ts +0 -3
  1060. package/dist/src/shared/empty-delivery.js +0 -1
  1061. package/dist/src/subagents/agent-handle-errors.d.ts +0 -25
  1062. package/dist/src/subagents/agent-handle-errors.js +0 -1
  1063. package/dist/src/subagents/callback-step.d.ts +0 -11
  1064. package/dist/src/subagents/callback-step.js +0 -1
  1065. package/dist/src/subagents/continuation-bundle.d.ts +0 -13
  1066. package/dist/src/subagents/continuation-bundle.js +0 -1
  1067. package/dist/src/subagents/handle-dispatch.d.ts +0 -65
  1068. package/dist/src/subagents/handle-dispatch.js +0 -1
  1069. package/dist/src/subagents/handles/operation-id.d.ts +0 -15
  1070. package/dist/src/subagents/handles/operation-id.js +0 -1
  1071. package/dist/src/subagents/handles/prompt.d.ts +0 -52
  1072. package/dist/src/subagents/handles/prompt.js +0 -3
  1073. package/dist/src/subagents/handles/query.d.ts +0 -41
  1074. package/dist/src/subagents/handles/query.js +0 -1
  1075. package/dist/src/subagents/handles/state-key.d.ts +0 -8
  1076. package/dist/src/subagents/handles/state-key.js +0 -1
  1077. package/dist/src/subagents/handles/store.d.ts +0 -217
  1078. package/dist/src/subagents/handles/store.js +0 -1
  1079. package/dist/src/subagents/handles/transitions.d.ts +0 -103
  1080. package/dist/src/subagents/handles/transitions.js +0 -1
  1081. package/dist/src/subagents/remote-dispatch.js +0 -1
  1082. package/dist/src/subagents/start-local.d.ts +0 -29
  1083. package/dist/src/subagents/start-local.js +0 -1
  1084. package/dist/src/subagents/start-remote.d.ts +0 -21
  1085. package/dist/src/subagents/start-remote.js +0 -1
  1086. package/dist/src/tasks/delivery-context.d.ts +0 -32
  1087. package/dist/src/tasks/delivery-context.js +0 -4
  1088. package/dist/src/tasks/delivery-policy.d.ts +0 -14
  1089. package/dist/src/tasks/delivery-policy.js +0 -1
  1090. package/dist/src/tasks/json.d.ts +0 -88
  1091. package/dist/src/tasks/json.js +0 -1
  1092. package/dist/src/tasks/notification.d.ts +0 -10
  1093. package/dist/src/tasks/notification.js +0 -1
  1094. package/dist/src/tasks/task-id.d.ts +0 -31
  1095. package/dist/src/tasks/task-id.js +0 -1
  1096. package/dist/src/tasks/task-inbox-token.d.ts +0 -2
  1097. package/dist/src/tasks/task-inbox-token.js +0 -1
  1098. package/dist/src/tasks/transitions.d.ts +0 -17
  1099. package/dist/src/tasks/transitions.js +0 -1
  1100. package/dist/src/tasks/types.d.ts +0 -136
  1101. package/dist/src/tasks/types.js +0 -1
  1102. package/dist/src/tools/framework/connection-search.d.ts +0 -3
  1103. package/dist/src/tools/framework/connection-search.js +0 -1
  1104. package/dist/src/tools/framework/task-cancel.d.ts +0 -4
  1105. package/dist/src/tools/framework/task-cancel.js +0 -1
  1106. package/dist/src/tools/framework/task-contract.d.ts +0 -19
  1107. package/dist/src/tools/framework/task-contract.js +0 -1
  1108. package/dist/src/tools/native-definition.d.ts +0 -7
  1109. package/dist/src/tools/native-definition.js +0 -1
  1110. package/dist/src/tracing/agent-invocation-terminal.d.ts +0 -18
  1111. package/dist/src/tracing/agent-invocation-terminal.js +0 -1
  1112. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.d.ts +0 -0
  1113. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.js +0 -0
  1114. /package/dist/src/{extensions/code → computer-use}/extension/tools/computer_use.d.ts +0 -0
  1115. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.d.ts +0 -0
  1116. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.js +0 -0
@@ -1 +1 @@
1
- import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";import{readWorkflowFunctionId}from"#internal/workflow/reference.js";import{assertResolverOnlyDynamicSentinel,isDynamicSentinel}from"#dynamic/definition.js";import{isWorkflowToolDefinition}from"#tools/workflow-definition.js";import{shouldRebindDynamicCallbacks}from"#internal/dynamic-tool-rebind.js";import{isDisabledToolSentinel}from"#tools/definition.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{isWebSearchToolDefinition}from"#tools/provided/web-search.js";import{readToolBehavior}from"#tools/behavior.js";import{readWorkflowProgramOptions}from"#tools/workflow-program-input.js";function normalizeToolDefinition(e,t){if(isDynamicSentinel(e))return assertResolverOnlyDynamicSentinel(e,t),{kind:`dynamic-tool`,eventNames:Object.keys(e.events),rebindMissingCallbacks:shouldRebindDynamicCallbacks(e)};if(isDisabledToolSentinel(e))return{kind:`disabled`};if(isWebSearchToolDefinition(e)){let n=expectObjectRecord(e,t);expectOnlyKnownKeys(n,[`kind`,`provider`],t);let r=expectString(n.provider,t);if(r!==`exa`&&r!==`parallel`)throw Error(`${t} Expected "provider" to be one of: exa, parallel.`);return{kind:`web-search-tool`,provider:r}}let n=expectObjectRecord(e,t),r=readWorkflowFunctionId(n.execute);if(isWorkflowToolDefinition(e)){if(r===void 0)throw Error(`${t} defineWorkflowTool() requires a compiled workflow executor. Start execute with "use workflow" and export defineWorkflowTool() as the default export of a static tool module.`)}else if(r!==void 0)throw Error(`${t} Workflow executors require defineWorkflowTool() from "eve/tools". Replace defineTool() or the bare tool object with defineWorkflowTool().`);expectOnlyKnownKeys(n,[`availableInSubagents`,`label`,`auth`,`description`,`execute`,`execution`,`inputSchema`,`approval`,`approvalKey`,`outputSchema`,`toModelOutput`],t);let i=n.inputSchema===void 0?null:serializeInputSchema(n.inputSchema),a=serializeOutputSchema(n.outputSchema),o=readToolBehavior(e),s=readWorkflowProgramOptions(e),c=n.execute!==void 0;!c&&o?.handling?.kind!==`dispatch`&&expectFunction(n.execute,t);let l={availableInSubagents:n.availableInSubagents===void 0?void 0:expectBoolean(n.availableInSubagents,t),description:expectString(n.description,t),hasApproval:n.approval!==void 0,hasExecute:c,hasModelOutputProjection:n.toModelOutput!==void 0,inputSchema:i};if(o!==void 0&&(l.behavior=o),s!==void 0&&(l.workflowProgram=s),c&&(l.execute=expectFunction(n.execute,t)),n.execution!==void 0){if(!c)throw Error(`${t} Execute-less native tools cannot use background execution.`);let e=expectString(n.execution,t);if(e!==`background`)throw Error(`${t} Expected "execution" to be "background".`);l.execution=e}if(a!==void 0&&(l.outputSchema=a),n.label!==void 0){let e=expectObjectRecord(n.label,t);expectOnlyKnownKeys(e,[`start`,`complete`,`delta`],t),expectFunction(e.start,t),e.complete!==void 0&&expectFunction(e.complete,t),e.delta!==void 0&&expectFunction(e.delta,t)}if(n.approval!==void 0&&normalizeApproval(n.approval,t),n.approvalKey!==void 0&&expectFunction(n.approvalKey,t),n.toModelOutput!==void 0&&expectFunction(n.toModelOutput,t),n.auth!==void 0){let e=expectObjectRecord(n.auth,t);expectFunction(e.getToken,t)}return{kind:`tool`,definition:l}}export{normalizeToolDefinition};
1
+ import{isObject}from"#shared/guards.js";import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{UNSPECIFIED_INPUT_SCHEMA,serializeInputSchema,serializeModelInputSchema,serializeOutputSchema,toInputSchema}from"#tools/schema.js";import{readWorkflowFunctionId}from"#internal/workflow/reference.js";import{assertResolverOnlyDynamicSentinel,isDynamicSentinel}from"#dynamic/definition.js";import{isWorkflowToolDefinition,readWorkflowToolEntryPoints}from"#tools/workflow-definition.js";import{shouldRebindDynamicCallbacks}from"#internal/dynamic-tool-rebind.js";import{TASK_ID_INPUT,withTaskIdSchema}from"#execution/tasks/task-id-input.js";import{isDisabledToolSentinel}from"#tools/definition.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{isWebSearchToolDefinition}from"#tools/provided/web-search.js";import{readToolBehavior}from"#tools/behavior.js";import{readWorkflowProgramOptions}from"#tools/workflow-program-input.js";function normalizeToolDefinition(e,t){if(isDynamicSentinel(e))return assertResolverOnlyDynamicSentinel(e,t),{kind:`dynamic-tool`,eventNames:Object.keys(e.events),rebindMissingCallbacks:shouldRebindDynamicCallbacks(e)};if(isDisabledToolSentinel(e))return{kind:`disabled`};if(isWebSearchToolDefinition(e)){let n=expectObjectRecord(e,t);expectOnlyKnownKeys(n,[`kind`,`provider`],t);let r=expectString(n.provider,t);if(r!==`exa`&&r!==`parallel`)throw Error(`${t} Expected "provider" to be one of: exa, parallel.`);return{kind:`web-search-tool`,provider:r}}let n=expectObjectRecord(e,t),r=isWorkflowToolDefinition(e)?readCompiledWorkflowEntry(n,t):void 0;if(r===void 0&&readWorkflowFunctionId(n.execute)!==void 0)throw Error(`${t} Workflow executors require defineWorkflowTool() from "eve/tools". Replace defineTool() or the bare tool object with defineWorkflowTool().`);if(r!==void 0&&n.endsTurn!==void 0)throw Error(`${t} "endsTurn" is not supported on defineWorkflowTool(). Workflow tools resume the turn when they finish; use defineTool() for a tool that ends the turn.`);expectOnlyKnownKeys(n,[`availableInSubagents`,`endsTurn`,`label`,`auth`,`description`,`execute`,`inputSchema`,`approval`,`approvalKey`,`outputSchema`,`toModelOutput`,...r===void 0?[]:[r.entryPoint]],t);let i=n.inputSchema===void 0?null:serializeInputSchema(n.inputSchema);r?.entryPoint===`serve`&&assertNoOwnTaskIdInput(i,t);let a=serializeOutputSchema(n.outputSchema),o=readToolBehavior(e),s=readWorkflowProgramOptions(e),c=r!==void 0||n.execute!==void 0;!c&&o?.handling?.kind!==`dispatch`&&expectFunction(n.execute,t);let l={availableInSubagents:n.availableInSubagents===void 0?void 0:expectBoolean(n.availableInSubagents,t),description:expectString(n.description,t),endsTurn:n.endsTurn===void 0||typeof n.endsTurn==`boolean`?n.endsTurn:expectFunction(n.endsTurn,t),hasApproval:n.approval!==void 0,hasExecute:c,hasModelOutputProjection:n.toModelOutput!==void 0,inputSchema:i,modelInputSchema:modelInputSchemaOf(n.inputSchema,r?.entryPoint===`serve`||o?.handling?.kind===`dispatch`)};if(o!==void 0&&(l.behavior=o),s!==void 0&&(l.workflowProgram=s),r===void 0?c&&(l.execute=expectFunction(n.execute,t)):l.workflow=r,a!==void 0&&(l.outputSchema=a),n.label!==void 0){let e=expectObjectRecord(n.label,t);expectOnlyKnownKeys(e,[`start`,`complete`,`delta`],t),expectFunction(e.start,t),e.complete!==void 0&&expectFunction(e.complete,t),e.delta!==void 0&&expectFunction(e.delta,t)}if(n.approval!==void 0&&normalizeApproval(n.approval,t),n.approvalKey!==void 0&&expectFunction(n.approvalKey,t),n.toModelOutput!==void 0&&expectFunction(n.toModelOutput,t),n.auth!==void 0){let e=expectObjectRecord(n.auth,t);expectFunction(e.getToken,t)}return{kind:`tool`,definition:l}}function readCompiledWorkflowEntry(e,t){let[n]=readWorkflowToolEntryPoints(e),r=n===void 0?void 0:readWorkflowFunctionId(e[n]);if(n===void 0||r===void 0)throw Error(`${t} defineWorkflowTool() requires a compiled workflow executor. Start execute, task, or serve with "use workflow" and export defineWorkflowTool() as the default export of a static tool module.`);return{entryPoint:n,workflowId:r}}function modelInputSchemaOf(e,t){let n=toInputSchema(e)??UNSPECIFIED_INPUT_SCHEMA;return serializeModelInputSchema(t?withTaskIdSchema(n):n)}function assertNoOwnTaskIdInput(e,t){let n=e?.properties;if(isObject(n)&&TASK_ID_INPUT in n)throw Error(`${t} inputSchema declares "${TASK_ID_INPUT}", which eve adds to a serve tool's model input to send a call to a running task. Rename the field.`)}export{normalizeToolDefinition};
@@ -2,12 +2,17 @@ import type { CompiledAgentManifest } from "#compiler/manifest.js";
2
2
  import type { AuthoredWorkflowModules } from "#internal/workflow-bundle/builder-support.js";
3
3
  export interface AuthoredModuleLoadOptions {
4
4
  readonly externalDependencies?: readonly string[];
5
- /**
6
- * When set, the module being loaded is extension-owned: its
7
- * `defineState`/`defineExtension` calls (and those of its same-package
8
- * dependencies bundled with it) are scoped to this namespace at bundle time.
9
- */
10
- readonly extensionScopeNamespace?: string;
5
+ readonly extension?: {
6
+ readonly mountId: string;
7
+ /** Only filesystem mounts need a synthetic entry to bind their configuration. */
8
+ readonly entry?: {
9
+ readonly mountSourcePath: string;
10
+ readonly packageName: string;
11
+ readonly sourceRoot: string;
12
+ readonly specifier: string;
13
+ };
14
+ readonly evaluationId?: string;
15
+ };
11
16
  }
12
17
  /**
13
18
  * Loads one authored module namespace from disk during compile-time
@@ -62,6 +67,7 @@ export declare function bundleAuthoredModuleMapForGeneration(input: {
62
67
  readonly appRoot: string;
63
68
  readonly manifest: CompiledAgentManifest;
64
69
  readonly moduleMapPath: string;
70
+ readonly resolveExternalPaths?: boolean;
65
71
  }): Promise<AuthoredModuleMapBundle>;
66
72
  export declare function resolveAuthoredTsConfigPath(packageRoot: string): string | false;
67
73
  export declare function resolveAuthoredPackageRoot(modulePath: string): string;
@@ -1,3 +1,3 @@
1
- import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync,mkdirSync,realpathSync,writeFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";import{buildSingleRolldownChunk,buildWithNitroRolldown}from"#internal/bundler/nitro-rolldown.js";import{createAuthoredAssetImportPlugin}from"#internal/authored-asset-import-plugin.js";import{authoredModuleConditions}from"#internal/authored-module-conditions.js";import{createAuthoredModuleBundleError}from"#internal/authored-module-bundle.js";import{createAuthoredModuleEvaluationError}from"#internal/authored-module-evaluation-error.js";import{createAuthoredPackageTsConfigPathsPlugin}from"#internal/authored-package-tsconfig-paths.js";import{createAuthoredRelativeExtensionResolverPlugin}from"#internal/authored-relative-extension-resolver.js";import{createExtensionScopePlugin,createFixedNamespaceScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,normalizeExternalDependencies}from"#internal/authored-package-boundary.js";import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{prepareAuthoredWorkflowDirectives}from"#internal/workflow-bundle/authored-workflow-directives.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{applyWorkflowTransform,isAuthoredApplicationModule}from"#internal/workflow-bundle/workflow-builders.js";const AUTHORED_BUNDLED_MODULE_EXTENSION=/\.[cm]?[jt]sx?$/,AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH=join(`node_modules`,`.cache`,`eve`,`authored-modules`),inFlightModuleLoads=new Map;function loadAuthoredModuleNamespace(e,t={}){let n=createInFlightModuleLoadKey(resolve(e),t),r=inFlightModuleLoads.get(n);if(r!==void 0)return r;let i=(async()=>{try{return await doLoadAuthoredModuleNamespace(e,t)}finally{inFlightModuleLoads.delete(n)}})();return inFlightModuleLoads.set(n,i),i}async function doLoadAuthoredModuleNamespace(e,t){let n=AUTHORED_BUNDLED_MODULE_EXTENSION.test(e)?await loadBundledAuthoredModule(e,t):await import(createFileImportSpecifier(e));return expectObjectRecord(n,`Expected "${e}" to export a module namespace object.`)}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}async function bundleAuthoredModuleCode(e,t={}){let n=resolveAuthoredPackageRoot(e);return await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createRuntimeLoaderPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:n}),plugins:[createAuthoredWorkflowDirectivePlugin({appRoot:n})],sourcemap:`inline`})}async function bundleAuthoredModuleForGeneration(e,t={}){return removeRolldownModuleRegionComments(await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createGenerationPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[createAuthoredDirectiveGuardPlugin()],sourcemap:!1}))}async function bundleExtensionDistributionGraph(e){let t=[createAuthoredDirectiveGuardPlugin(),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:e.packageRoot}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:e.packageRoot,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createDistributionPackageBoundaryPlugin({packageRoot:e.packageRoot,runtimeDependencies:e.runtimeDependencies})];try{let n=await buildWithNitroRolldown({cwd:e.packageRoot,input:Object.fromEntries(e.entries.map(e=>[e.name,e.path])),platform:`node`,plugins:t,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(e.packageRoot),write:!1,output:{chunkFileNames:`_chunks/[name]-[hash].mjs`,codeSplitting:!0,comments:!1,entryFileNames:`[name].mjs`,format:`esm`,sourcemap:!1}}),r=new Map,i=new Set;for(let e of n.output)if(e.type===`chunk`){r.set(e.fileName,removeRolldownModuleRegionComments(e.code));for(let t of[...e.imports,...e.dynamicImports])i.add(t)}return{files:r,imports:[...i]}}catch(t){throw createAuthoredModuleBundleError(e.packageRoot,t)}}async function bundleAuthoredModuleMapForGeneration(e){let t=resolveAuthoredPackageRoot(e.manifest.agentRoot),n=resolvePackageSourceFilePath(usesDevelopmentExtensionModules(e.manifest)?`src/internal/development-programmatic-source-loader.ts`:`src/internal/programmatic-source-loader.ts`),r=normalizeExternalDependencies([...e.manifest.config.build?.externalDependencies??[],...e.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])]),i=createCompiledModuleMapSource({manifest:e.manifest,moduleMapPath:e.moduleMapPath,programmaticLoaderImportSpecifier:n}),a=createExtensionScopePlugin([e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({packageNamespace:e.packageNamespace,sourceRoot:e.sourceRoot})))),o=new AuthoredWorkflowSourceRecorder(e.appRoot),s=[createVirtualGenerationModuleMapPlugin({id:e.moduleMapPath,source:i}),createExternalRuntimeImportPlugin(n),createAuthoredWorkflowDirectivePlugin({appRoot:e.appRoot,recorder:o}),createDynamicCapabilityTransformPlugin({workflowFunctions:e=>o.workflowFunctions(e)}),o.graphPlugin(),a,createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:t}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:t,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createGenerationPackageBoundaryPlugin({externalDependencies:r,packageRoot:t})].filter(e=>e!==null);try{let n=await buildSingleRolldownChunk(`authored module map`,{cwd:t,input:e.moduleMapPath,platform:`node`,plugins:s,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(t),output:{comments:!1,format:`esm`,sourcemap:!1}});return{authoredWorkflowModules:o.modules(),code:removeRolldownModuleRegionComments(n.code),workflowSourceFingerprint:o.fingerprint()}}catch(t){throw createAuthoredModuleBundleError(e.moduleMapPath,t)}}function usesDevelopmentExtensionModules(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>Object.values(e.bindings).some(e=>e.backing.kind===`programmatic`&&e.backing.registryId.startsWith(`eve:development-extension:`)))}function createExternalRuntimeImportPlugin(e){let t=normalizeEsmImportSpecifier(e);return{name:`eve-external-runtime-import`,resolveId(e){return e===t?{external:!0,id:t}:void 0}}}var AuthoredWorkflowSourceRecorder=class{#e;#t=new Set;#n=new Map;#r=new Map;#i=new Map;constructor(e){this.#e=e}record(e,t,n){this.#r.set(e,t),(n.steps!==void 0||n.workflows!==void 0)&&this.#t.add(e);let r=Object.values(n.workflows??{})[0];r!==void 0&&this.#i.set(e,new Set(Object.keys(r)))}workflowFunctions(e){return this.#i.get(e)}graphPlugin(){let e=this.#n;return{name:`eve-authored-module-graph`,buildEnd(){for(let t of this.getModuleIds()){let n=this.getModuleInfo(t);n!==null&&e.set(t,[...n.importedIds,...n.dynamicallyImportedIds])}}}}modules(){return{directiveModules:[...this.#t].sort(),workflowModules:[...this.#i.keys()].sort()}}fingerprint(){if(this.#t.size===0)return;let e=new Set,t=[...this.#t];for(let n=t.shift();n!==void 0;n=t.shift())!e.has(n)&&this.#r.has(n)&&(e.add(n),t.push(...this.#n.get(n)??[]));let n=createHash(`sha256`);for(let t of[...e].sort())n.update(relative(this.#e,t).split(sep).join(`/`)).update(`\0`).update(this.#r.get(t)??``).update(`\0`);return n.digest(`hex`)}};function createVirtualGenerationModuleMapPlugin(e){return{name:`eve-generation-module-map`,resolveId(t){return t===e.id?t:void 0},load(t){return t===e.id?{code:e.source,moduleType:`js`}:void 0}}}async function buildAuthoredModuleBundle(e,t,n){let r=resolveAuthoredPackageRoot(e),i=resolveAuthoredTsConfigPath(r),a=[...n.plugins,t.extensionScopeNamespace===void 0?null:createFixedNamespaceScopePlugin(t.extensionScopeNamespace),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:r}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:r,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),n.packageBoundaryPlugin].filter(e=>e!==null);try{return(await buildSingleRolldownChunk(`authored module for "${e}"`,{cwd:r,input:e,platform:`node`,plugins:a,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:i,output:{comments:!1,format:`esm`,sourcemap:n.sourcemap}})).code}catch(t){throw createAuthoredModuleBundleError(e,t)}}function createAuthoredDirectiveGuardPlugin(){return{name:`eve-authored-directive-guard`,async transform(e,t){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(t)||isNodeModulesPath(t))return;let{hasDirectives:n}=await prepareAuthoredWorkflowDirectives({filePath:t,source:e});if(n)throw Error(`Module "${t}" uses Workflow directives ("use step" or "use workflow"). Workflow directives are supported in application modules only, not in extensions or instrumentation.`)}}}function createAuthoredWorkflowDirectivePlugin(e){return{name:`eve-authored-workflow-directives`,async transform(t,n){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(n)||isNodeModulesPath(n)||!isAuthoredApplicationModule(n,e.appRoot))return;let r=await applyWorkflowTransform(n,t,`client`,n,e.appRoot);return e.recorder?.record(n,t,r.workflowManifest),r.code===t?void 0:{code:r.code,map:null}}}}function removeRolldownModuleRegionComments(e){return e.split(`
1
+ import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{existsSync,mkdirSync,realpathSync,writeFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{extensionOverridePaths}from"#compiler/extension-mount-bindings.js";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";import{buildSingleRolldownChunk,buildWithNitroRolldown}from"#internal/bundler/nitro-rolldown.js";import{createAuthoredAssetImportPlugin}from"#internal/authored-asset-import-plugin.js";import{createExtensionMountPlugin}from"#internal/bundler/extension-mount-plugin.js";import{authoredModuleConditions}from"#internal/authored-module-conditions.js";import{createAuthoredModuleBundleError}from"#internal/authored-module-bundle.js";import{createAuthoredModuleEvaluationError}from"#internal/authored-module-evaluation-error.js";import{createAuthoredPackageTsConfigPathsPlugin}from"#internal/authored-package-tsconfig-paths.js";import{createAuthoredRelativeExtensionResolverPlugin}from"#internal/authored-relative-extension-resolver.js";import{createExtensionScopePlugin,createFixedMountScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,normalizeExternalDependencies}from"#internal/authored-package-boundary.js";import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{prepareAuthoredWorkflowDirectives}from"#internal/workflow-bundle/authored-workflow-directives.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";import{applyWorkflowTransform,isAuthoredApplicationModule}from"#internal/workflow-bundle/workflow-builders.js";const AUTHORED_BUNDLED_MODULE_EXTENSION=/\.[cm]?[jt]sx?$/,AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH=join(`node_modules`,`.cache`,`eve`,`authored-modules`),inFlightModuleLoads=new Map;function loadAuthoredModuleNamespace(e,t={}){let n=createInFlightModuleLoadKey(resolve(e),t),r=inFlightModuleLoads.get(n);if(r!==void 0)return r;let i=(async()=>{try{return await doLoadAuthoredModuleNamespace(e,t)}finally{inFlightModuleLoads.delete(n)}})();return inFlightModuleLoads.set(n,i),i}async function doLoadAuthoredModuleNamespace(e,t){let n=AUTHORED_BUNDLED_MODULE_EXTENSION.test(e)?await loadBundledAuthoredModule(e,t):await import(createFileImportSpecifier(e));return expectObjectRecord(n,`Expected "${e}" to export a module namespace object.`)}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}async function bundleAuthoredModuleCode(e,t={}){let n=resolveAuthoredPackageRoot(e),r=t.extension?.entry,i=t.extension?.mountId;return await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createRuntimeLoaderPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:n,extensionSpecifier:r?.specifier}),plugins:[...r===void 0?[]:[{name:`eve-compile-mount-entry`,resolveId(e){return e===`\0eve-compile-mount-entry`?e:void 0},load(t){if(t!==`\0eve-compile-mount-entry`)return;let n=`${r.mountSourcePath}?eve-mount=${encodeURIComponent(i)}`,a=`${e}?eve-mount=${encodeURIComponent(i)}`;return`import ${JSON.stringify(n)}; export * from ${JSON.stringify(a)}; import entry from ${JSON.stringify(a)}; export default entry;`}}],createAuthoredWorkflowDirectivePlugin({appRoot:n}),...r===void 0?[]:[createExtensionMountPlugin([{...r,mountId:i}])]],sourcemap:`inline`})}async function bundleAuthoredModuleForGeneration(e,t={}){return removeRolldownModuleRegionComments(await buildAuthoredModuleBundle(e,t,{packageBoundaryPlugin:createGenerationPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[createAuthoredDirectiveGuardPlugin()],sourcemap:!1}))}async function bundleExtensionDistributionGraph(e){let t=[createAuthoredDirectiveGuardPlugin(),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:e.packageRoot}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:e.packageRoot,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createDistributionPackageBoundaryPlugin({packageRoot:e.packageRoot,runtimeDependencies:e.runtimeDependencies})];try{let n=await buildWithNitroRolldown({cwd:e.packageRoot,input:Object.fromEntries(e.entries.map(e=>[e.name,e.path])),platform:`node`,plugins:t,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(e.packageRoot),write:!1,output:{chunkFileNames:`_chunks/[name]-[hash].mjs`,codeSplitting:!0,comments:!1,entryFileNames:`[name].mjs`,format:`esm`,sourcemap:!1}}),r=new Map,i=new Set;for(let e of n.output)if(e.type===`chunk`){r.set(e.fileName,removeRolldownModuleRegionComments(e.code));for(let t of[...e.imports,...e.dynamicImports])i.add(t)}return{files:r,imports:[...i]}}catch(t){throw createAuthoredModuleBundleError(e.packageRoot,t)}}async function bundleAuthoredModuleMapForGeneration(e){let t=resolveAuthoredPackageRoot(e.manifest.agentRoot),n=resolvePackageSourceFilePath(usesDevelopmentExtensionModules(e.manifest)?`src/internal/development-programmatic-source-loader.ts`:`src/internal/programmatic-source-loader.ts`),r=normalizeExternalDependencies([...e.manifest.config.build?.externalDependencies??[],...e.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])]),i=createCompiledModuleMapSource({manifest:e.manifest,moduleMapPath:e.moduleMapPath,programmaticLoaderImportSpecifier:n}),a=[e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts),o=createExtensionScopePlugin([e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({mountId:e.mountId,sourceRoot:e.sourceRoot})))),s=new AuthoredWorkflowSourceRecorder(e.appRoot),c=[createVirtualGenerationModuleMapPlugin({id:e.moduleMapPath,source:i}),createExternalRuntimeImportPlugin(n),createAuthoredWorkflowDirectivePlugin({appRoot:e.appRoot,recorder:s}),createDynamicCapabilityTransformPlugin({workflowFunctions:e=>s.workflowFunctions(e)}),s.graphPlugin(),createExtensionMountPlugin(a,extensionOverridePaths(e.manifest)),o,createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:t}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:t,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createGenerationPackageBoundaryPlugin({externalDependencies:r,packageRoot:t,extensionSpecifiers:new Set(a.map(e=>e.specifier)),resolveExternalPaths:e.resolveExternalPaths})].filter(e=>e!==null);try{let n=await buildSingleRolldownChunk(`authored module map`,{cwd:t,input:e.moduleMapPath,platform:`node`,plugins:c,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(t),output:{comments:!1,format:`esm`,sourcemap:!1}});return{authoredWorkflowModules:s.modules(),code:removeRolldownModuleRegionComments(n.code),workflowSourceFingerprint:s.fingerprint()}}catch(t){throw createAuthoredModuleBundleError(e.moduleMapPath,t)}}function usesDevelopmentExtensionModules(e){return[e,...e.subagents.map(e=>e.agent)].some(e=>Object.values(e.bindings).some(e=>e.backing.kind===`programmatic`&&e.backing.registryId.startsWith(`eve:development-extension:`)))}function createExternalRuntimeImportPlugin(e){let t=normalizeEsmImportSpecifier(e);return{name:`eve-external-runtime-import`,resolveId(e){return e===t?{external:!0,id:t}:void 0}}}var AuthoredWorkflowSourceRecorder=class{#e;#t=new Set;#n=new Map;#r=new Map;#i=new Map;constructor(e){this.#e=e}record(e,t,n){this.#r.set(e,t),(n.steps!==void 0||n.workflows!==void 0)&&this.#t.add(e);let r=Object.values(n.workflows??{})[0];r!==void 0&&this.#i.set(e,new Set(Object.keys(r)))}workflowFunctions(e){return this.#i.get(e)}graphPlugin(){let e=this.#n;return{name:`eve-authored-module-graph`,buildEnd(){for(let t of this.getModuleIds()){let n=this.getModuleInfo(t);n!==null&&e.set(t,[...n.importedIds,...n.dynamicallyImportedIds])}}}}modules(){return{directiveModules:[...this.#t].sort(),workflowModules:[...this.#i.keys()].sort()}}fingerprint(){if(this.#t.size===0)return;let e=new Set,t=[...this.#t];for(let n=t.shift();n!==void 0;n=t.shift())!e.has(n)&&this.#r.has(n)&&(e.add(n),t.push(...this.#n.get(n)??[]));let n=createHash(`sha256`);for(let t of[...e].sort())n.update(relative(this.#e,t).split(sep).join(`/`)).update(`\0`).update(this.#r.get(t)??``).update(`\0`);return n.digest(`hex`)}};function createVirtualGenerationModuleMapPlugin(e){return{name:`eve-generation-module-map`,resolveId(t){return t===e.id?t:void 0},load(t){return t===e.id?{code:e.source,moduleType:`js`}:void 0}}}async function buildAuthoredModuleBundle(e,t,n){let r=resolveAuthoredPackageRoot(e),i=resolveAuthoredTsConfigPath(r),a=[...n.plugins,t.extension===void 0?null:createFixedMountScopePlugin(t.extension.mountId),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin({packageRoot:r}),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:r,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),n.packageBoundaryPlugin].filter(e=>e!==null);try{return(await buildSingleRolldownChunk(`authored module for "${e}"`,{cwd:r,input:t.extension?.entry===void 0?e:`\0eve-compile-mount-entry`,platform:`node`,plugins:a,resolve:{conditionNames:authoredModuleConditions(),extensions:[...RESOLVE_EXTENSIONS]},tsconfig:i,output:{comments:!1,format:`esm`,sourcemap:n.sourcemap}})).code}catch(t){throw createAuthoredModuleBundleError(e,t)}}function createAuthoredDirectiveGuardPlugin(){return{name:`eve-authored-directive-guard`,async transform(e,t){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(t)||isNodeModulesPath(t))return;let{hasDirectives:n}=await prepareAuthoredWorkflowDirectives({filePath:t,source:e});if(n)throw Error(`Module "${t}" uses Workflow directives ("use step" or "use workflow"). Workflow directives are supported in application modules only, not in extensions or instrumentation.`)}}}function createAuthoredWorkflowDirectivePlugin(e){return{name:`eve-authored-workflow-directives`,async transform(t,n){if(!AUTHORED_BUNDLED_MODULE_EXTENSION.test(n)||isNodeModulesPath(n)||!isAuthoredApplicationModule(n,e.appRoot))return;let r=await applyWorkflowTransform(n,t,`client`,n,e.appRoot);return e.recorder?.record(n,t,r.workflowManifest),r.code===t?void 0:{code:r.code,map:null}}}}function removeRolldownModuleRegionComments(e){return e.split(`
2
2
  `).filter(e=>!e.startsWith(`//#region `)&&e!==`//#endregion`).join(`
3
- `)}async function loadBundledAuthoredModule(e,t){let n=await bundleAuthoredModuleCode(e,t),r=normalizeExternalDependencies(t.externalDependencies),i=createHash(`sha1`).update(e).update(`\0`).update(r.join(`\0`)).update(`\0`).update(t.extensionScopeNamespace??``).update(`\0`).update(n).digest(`hex`),a=join(resolveAuthoredPackageRoot(e),AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH),o=join(a,`${i}.mjs`);existsSync(o)||(mkdirSync(a,{recursive:!0}),writeFileSync(o,n));try{return await import(`${createFileImportSpecifier(o)}?v=${i}`)}catch(t){throw createAuthoredModuleEvaluationError(e,t)}}function createInFlightModuleLoadKey(e,t){return`${e}\0${normalizeExternalDependencies(t.externalDependencies).join(`\0`)}\0${t.extensionScopeNamespace??``}`}function resolveAuthoredTsConfigPath(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let n=join(e,t);if(existsSync(n))return n}return!1}function resolveAuthoredPackageRoot(e){let t=dirname(e);for(;;){if(existsSync(join(t,`package.json`)))return realpathSync(t);let n=dirname(t);if(n===t)throw Error(`Failed to resolve the authored package root for "${e}".`);t=n}}export{bundleAuthoredModuleCode,bundleAuthoredModuleForGeneration,bundleAuthoredModuleMapForGeneration,bundleExtensionDistributionGraph,loadAuthoredModuleNamespace,resolveAuthoredPackageRoot,resolveAuthoredTsConfigPath};
3
+ `)}async function loadBundledAuthoredModule(e,t){let n=await bundleAuthoredModuleCode(e,t),r=normalizeExternalDependencies(t.externalDependencies),i=createHash(`sha1`).update(e).update(`\0`).update(r.join(`\0`)).update(`\0`).update(t.extension?.mountId??``).update(`\0`).update(n).digest(`hex`),a=join(resolveAuthoredPackageRoot(e),AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH),o=join(a,`${i}.mjs`);existsSync(o)||(mkdirSync(a,{recursive:!0}),writeFileSync(o,n));try{let e=t.extension?.evaluationId??``;return await import(`${createFileImportSpecifier(o)}?v=${i}&instance=${encodeURIComponent(e)}`)}catch(t){throw createAuthoredModuleEvaluationError(e,t)}}function createInFlightModuleLoadKey(e,t){return`${e}\0${normalizeExternalDependencies(t.externalDependencies).join(`\0`)}\0${t.extension?.mountId??``}\0${t.extension?.evaluationId??``}`}function resolveAuthoredTsConfigPath(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let n=join(e,t);if(existsSync(n))return n}return!1}function resolveAuthoredPackageRoot(e){let t=dirname(e);for(;;){if(existsSync(join(t,`package.json`)))return realpathSync(t);let n=dirname(t);if(n===t)throw Error(`Failed to resolve the authored package root for "${e}".`);t=n}}export{bundleAuthoredModuleCode,bundleAuthoredModuleForGeneration,bundleAuthoredModuleMapForGeneration,bundleExtensionDistributionGraph,loadAuthoredModuleNamespace,resolveAuthoredPackageRoot,resolveAuthoredTsConfigPath};
@@ -1 +1 @@
1
- import{join,relative,resolve}from"node:path";import{pathToFileURL}from"node:url";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{collectRuntimeModuleBindingsForManifest,compiledModuleMapSchema,resolveCompiledModuleExtensionScopeNamespace}from"#compiler/module-map.js";import{memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";import{formatValidationError}from"#runtime/validation.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";import{loadFrameworkProgrammaticModule}from"#framework/sources/registry.js";import{loadCompiledManifest}from"#runtime/loaders/manifest.js";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";const EXT_CONFIG_SCOPE=Symbol.for(`eve.ext-config-scope`);async function loadCompiledModuleMapFromAuthoredSource(e){return await hydrateCompiledModuleMapFromManifest(await loadCompiledManifest({compiledArtifactsSource:e.compiledArtifactsSource}),e.compiledArtifactsSource.appRoot,e.authoredAppRoot)}async function hydrateCompiledModuleMapFromManifest(e,t,n=e.appRoot){let r=await readMaterializedAuthoredModuleIndex(t);if(r!==void 0)return await loadMaterializedCompiledModuleMap({moduleMapPath:r.moduleMap,runtimeAppRoot:t});let i={},a=[{manifest:e,nodeId:ROOT_COMPILED_AGENT_NODE_ID},...[...e.subagents].sort((e,t)=>e.nodeId.localeCompare(t.nodeId)).map(e=>({manifest:e.agent,nodeId:e.nodeId}))];for(let t of a)i[t.nodeId]={modules:await hydrateCompiledNodeScope(t.manifest,t=>resolve(n,relative(e.appRoot,t)))};return{nodes:i}}async function hydrateCompiledNodeScope(e,t){let n=new Map(e.extensionMounts.map(e=>[e.mountSourceId,e.packageNamespace])),r=globalThis,i={};for(let{binding:a,sourceId:o}of collectRuntimeModuleBindingsForManifest(e)){let e=n.get(o);e!==void 0&&(r[EXT_CONFIG_SCOPE]=e);try{i[o]=a.backing.kind===`programmatic`?await loadFrameworkProgrammaticModule(a.backing,Object.fromEntries(Object.entries(a.backing.dependencies??{}).map(([e,t])=>[e,i[t]]))):memoizeModuleNamespaceFactories(await loadAuthoredModuleNamespace(t(a.backing.sourcePath),{externalDependencies:a.backing.externalDependencies,extensionScopeNamespace:resolveCompiledModuleExtensionScopeNamespace(a)}))}finally{e!==void 0&&(r[EXT_CONFIG_SCOPE]=void 0)}}return i}async function loadMaterializedCompiledModuleMap(e){let t=join(e.runtimeAppRoot,`.eve`,`compile`,e.moduleMapPath),n=await import(`${pathToFileURL(t).href}?generation=${encodeURIComponent(e.moduleMapPath)}`),r=compiledModuleMapSchema.safeParse(n.moduleMap??n.default);if(!r.success)throw Error(`Expected materialized authored module map "${t}" to export a valid compiled eve module map. ${formatValidationError(r.error)}`);return r.data}export{loadCompiledModuleMapFromAuthoredSource};
1
+ import{createHash,randomUUID}from"node:crypto";import{link,mkdir,unlink,writeFile}from"node:fs/promises";import{join,relative,resolve}from"node:path";import{pathToFileURL}from"node:url";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{collectRuntimeModuleBindingsForManifest,compiledModuleMapSchema,resolveExtensionBindingMountId}from"#compiler/module-map.js";import{memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";import{formatValidationError}from"#runtime/validation.js";import{bundleAuthoredModuleMapForGeneration,loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";import{loadFrameworkProgrammaticModule}from"#framework/sources/registry.js";import{loadCompiledManifest}from"#runtime/loaders/manifest.js";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";async function loadCompiledModuleMapFromAuthoredSource(e){return await hydrateCompiledModuleMapFromManifest(await loadCompiledManifest({compiledArtifactsSource:e.compiledArtifactsSource}),e.compiledArtifactsSource.appRoot,e.authoredAppRoot)}async function hydrateCompiledModuleMapFromManifest(e,t,n=e.appRoot){let r=await readMaterializedAuthoredModuleIndex(t);if(r!==void 0)return await loadMaterializedCompiledModuleMap({moduleMapPath:r.moduleMap,runtimeAppRoot:t});if([e,...e.subagents.map(e=>e.agent)].some(e=>e.extensionMounts.length>0)){let r=join(t,`.eve`,`compile`,`authored-module-map.mjs`),{code:i}=await bundleAuthoredModuleMapForGeneration({appRoot:n,manifest:e,moduleMapPath:r,resolveExternalPaths:!0}),a=`authored-module-map-${createHash(`sha256`).update(i).digest(`hex`)}.mjs`,o=join(t,`.eve`,`compile`,a);await mkdir(join(t,`.eve`,`compile`),{recursive:!0});let s=`${o}.${randomUUID()}.tmp`;try{await writeFile(s,i,{flag:`wx`});try{await link(s,o)}catch(e){if(e.code!==`EEXIST`)throw e}}finally{await unlink(s).catch(e=>{if(e.code!==`ENOENT`)throw e})}return await loadMaterializedCompiledModuleMap({moduleMapPath:a,runtimeAppRoot:t,instanceId:randomUUID()})}let i={},a=[{manifest:e,nodeId:ROOT_COMPILED_AGENT_NODE_ID},...[...e.subagents].sort((e,t)=>e.nodeId.localeCompare(t.nodeId)).map(e=>({manifest:e.agent,nodeId:e.nodeId}))];for(let t of a)i[t.nodeId]={modules:await hydrateCompiledNodeScope(t.manifest,t=>resolve(n,relative(e.appRoot,t)))};return{nodes:i}}async function hydrateCompiledNodeScope(e,t){let n={};for(let{binding:r,sourceId:i}of collectRuntimeModuleBindingsForManifest(e))n[i]=r.backing.kind===`programmatic`?await loadFrameworkProgrammaticModule(r.backing,Object.fromEntries(Object.entries(r.backing.dependencies??{}).map(([e,t])=>[e,n[t]]))):memoizeModuleNamespaceFactories(await loadAuthoredModuleNamespace(t(r.backing.sourcePath),{externalDependencies:r.backing.externalDependencies,extension:(()=>{let e=resolveExtensionBindingMountId(r);return e===void 0?void 0:{mountId:e}})()}));return n}async function loadMaterializedCompiledModuleMap(e){let t=join(e.runtimeAppRoot,`.eve`,`compile`,e.moduleMapPath),n=await import(`${pathToFileURL(t).href}?generation=${encodeURIComponent(e.instanceId??e.moduleMapPath)}`),r=compiledModuleMapSchema.safeParse(n.moduleMap??n.default);if(!r.success)throw Error(`Expected materialized authored module map "${t}" to export a valid compiled eve module map. ${formatValidationError(r.error)}`);return r.data}export{loadCompiledModuleMapFromAuthoredSource};
@@ -11,10 +11,13 @@ export type RolldownResolveContext = {
11
11
  export declare function createGenerationPackageBoundaryPlugin(input: {
12
12
  readonly externalDependencies: readonly string[];
13
13
  readonly packageRoot: string;
14
+ readonly extensionSpecifiers?: ReadonlySet<string>;
15
+ readonly resolveExternalPaths?: boolean;
14
16
  }): Record<string, unknown>;
15
17
  export declare function createRuntimeLoaderPackageBoundaryPlugin(input: {
16
18
  readonly externalDependencies: readonly string[];
17
19
  readonly packageRoot: string;
20
+ readonly extensionSpecifier?: string;
18
21
  }): Record<string, unknown>;
19
22
  /**
20
23
  * Keeps package imports external in an extension distribution while enforcing
@@ -1 +1 @@
1
- import{createRequire,isBuiltin}from"node:module";import{resolvePackageDependencyPath,resolveWorkflowModulePath}from"#internal/application/package.js";import{existsSync,readFileSync,realpathSync}from"node:fs";import{dirname,join,resolve,sep}from"node:path";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const RESOLVE_EXTENSIONS=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`];function createGenerationPackageBoundaryPlugin(e){return{name:`eve-generation-package-boundary`,async resolveId(t,n,r){if(isPackageImport(t)){if(isFrameworkRuntimeImport(t,n))return{external:!0,id:resolveFrameworkRuntimeImport(t)};if(t.startsWith(`#`)){let r=resolvePackageImport(t,n,e.packageRoot);if(r!==void 0)return{id:r}}if(await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:n,kind:r.kind,packageRoot:e.packageRoot,source:t})!==void 0)return{external:!0,id:t}}}}}function createRuntimeLoaderPackageBoundaryPlugin(e){let t=toCanonicalPath(e.packageRoot);return{name:`eve-runtime-loader-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n))return;if(isFrameworkRuntimeImport(n,r))return{external:!0,id:resolveRuntimeLoaderFrameworkImport(n)};if(n.startsWith(`#`)){let t=resolvePackageImport(n,r,e.packageRoot);if(t!==void 0)return{id:t}}let a=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:r,kind:i.kind,packageRoot:e.packageRoot,source:n});if(a!==void 0){let e=resolveExistingExternalFilePath(a.resolvedId)??a.resolvedId;return{external:!0,id:normalizeEsmImportSpecifier(e)}}let o=r===void 0||r.startsWith(`\0`)?void 0:resolve(r);if(o!==void 0&&isPathInsideOrEqual(toCanonicalPath(o),t)){let e=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(e===null||typeof e.id!=`string`)throw Error(`Cannot resolve package "${n}" imported from "${o}". Install it with your package manager (e.g. \`pnpm install\`); a running \`eve dev\` retries on the next rebuild.`);if(isNodeModulesPath(e.id))return{external:!0,id:n}}}}}function createDistributionPackageBoundaryPlugin(e){let t=new Set(e.runtimeDependencies);return{name:`eve-extension-distribution-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n))return;if(n.startsWith(`#`)){let a=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(a!==null&&typeof a.id==`string`&&!isPathInsideOrEqual(toCanonicalPath(a.id),toCanonicalPath(e.packageRoot))){let e=nearestPackageName(a.id);if(e!==void 0&&!t.has(e))throw Error(`Package import "${n}" resolves to undeclared package "${e}". Add "${e}" to dependencies, optionalDependencies, or peerDependencies.`)}return}if(isBuiltin(n))return{external:!0,id:n};let a=packageImportName(n);if(!t.has(a))throw Error(`Package "${n}" is not declared by the extension. Add "${a}" to dependencies, optionalDependencies, or peerDependencies.`);let o=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(o===null&&(o=await this.resolve(n,join(e.packageRoot,`package.json`),{kind:i.kind,skipSelf:!0})),o===null||typeof o.id!=`string`)throw Error(`Cannot resolve declared package "${n}". Install the extension's dependencies before building.`);return{external:!0,id:n}}}}async function resolveConfiguredExternalModule(e){let t=resolveConfiguredExternalDependency(e.source,e.externalDependencies);if(t===void 0)return;let n=await this.resolve(e.source,e.importer,{kind:e.kind,skipSelf:!0});if(n===null&&(n=await this.resolve(e.source,join(e.packageRoot,`package.json`),{kind:e.kind,skipSelf:!0})),n===null||typeof n.id!=`string`)throw Error(`Cannot resolve external package "${e.source}".`);return{packageName:t,resolvedId:n.id}}function normalizeExternalDependencies(e=[]){return[...new Set(e)].sort()}function resolveConfiguredExternalDependency(e,t){return t.find(t=>e===t||e.startsWith(`${t}/`))}function packageImportName(e){return e.startsWith(`@`)?e.split(`/`,2).join(`/`):e.split(`/`,1)[0]}function nearestPackageName(e){let t=nearestPackageRoot(e);if(t!==void 0)try{let e=JSON.parse(readFileSync(join(t,`package.json`),`utf8`));return typeof e.name==`string`&&e.name.length>0?e.name:void 0}catch{return}}function nearestPackageRoot(e){let t=dirname(toCanonicalPath(e));for(;;){if(existsSync(join(t,`package.json`)))return t;let e=dirname(t);if(e===t)return;t=e}}function resolvePackageImport(e,t,n){let r=t===void 0||t.startsWith(`\0`)?n:nearestPackageRoot(t)??n;try{let t=createRequire(join(r,`package.json`)).resolve(e);return isPathInsideOrEqual(toCanonicalPath(t),toCanonicalPath(r))?t:void 0}catch{return}}function resolveExistingExternalFilePath(e){if(existsSync(e))return e;for(let t of RESOLVE_EXTENSIONS){let n=`${e}${t}`;if(existsSync(n))return n}}function isPackageImport(e){return isPathImport(e)||/^(?:node|data|file):/.test(e)?!1:!e.startsWith(`@/`)}function isPathImport(e){return e.startsWith(`.`)||e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function isFrameworkRuntimeImport(e,t){return e===`eve/self-modification`?!1:e===`eve`||e.startsWith(`eve/`)?!0:e===`workflow`||e.startsWith(`workflow/`)||e.startsWith(`@workflow/`)?t===void 0||!isNodeModulesPath(t):!1}function resolveFrameworkRuntimeImport(e){return e===`eve`||e.startsWith(`eve/`)?e:normalizeEsmImportSpecifier(resolveWorkflowModulePath(e))}function resolveRuntimeLoaderFrameworkImport(e){return e===`eve`||e.startsWith(`eve/`)?normalizeEsmImportSpecifier(resolvePackageDependencyPath(e)):resolveFrameworkRuntimeImport(e)}function isNodeModulesPath(e){return e.replaceAll(`\\`,`/`).includes(`/node_modules/`)}function toCanonicalPath(e){try{return realpathSync(e)}catch{return resolve(e)}}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,isPathImport,normalizeExternalDependencies};
1
+ import{createRequire,isBuiltin}from"node:module";import{resolvePackageDependencyPath,resolvePackageRoot,resolveWorkflowModulePath}from"#internal/application/package.js";import{existsSync,readFileSync,realpathSync}from"node:fs";import{dirname,join,resolve,sep}from"node:path";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const RESOLVE_EXTENSIONS=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`];function createGenerationPackageBoundaryPlugin(e){return{name:`eve-generation-package-boundary`,async resolveId(t,n,r){if(!isPackageImport(t)||e.extensionSpecifiers?.has(t))return;if(isFrameworkRuntimeImport(t,n))return e.extensionSpecifiers?.has(t)?void 0:{external:!0,id:resolveFrameworkRuntimeImport(t)};if(t.startsWith(`#`)){let r=resolvePackageImport(t,n,e.packageRoot);if(r!==void 0)return{id:r}}let i=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:n,kind:r.kind,packageRoot:e.packageRoot,source:t});if(i!==void 0)return{external:!0,id:e.resolveExternalPaths?normalizeEsmImportSpecifier(i.resolvedId):t}}}}function createRuntimeLoaderPackageBoundaryPlugin(e){let t=toCanonicalPath(e.packageRoot);return{name:`eve-runtime-loader-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n)||n===e.extensionSpecifier)return;if(isFrameworkRuntimeImport(n,r))return{external:!0,id:resolveRuntimeLoaderFrameworkImport(n)};if(n.startsWith(`#`)){let t=resolvePackageImport(n,r,e.packageRoot);if(t!==void 0)return isFrameworkPackagePath(t)?{external:!0,id:normalizeEsmImportSpecifier(t)}:{id:t}}let a=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:r,kind:i.kind,packageRoot:e.packageRoot,source:n});if(a!==void 0){let e=resolveExistingExternalFilePath(a.resolvedId)??a.resolvedId;return{external:!0,id:normalizeEsmImportSpecifier(e)}}let o=r===void 0||r.startsWith(`\0`)?void 0:resolve(r);if(o!==void 0&&isPathInsideOrEqual(toCanonicalPath(o),t)){let e=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(e===null||typeof e.id!=`string`)throw Error(`Cannot resolve package "${n}" imported from "${o}". Install it with your package manager (e.g. \`pnpm install\`); a running \`eve dev\` retries on the next rebuild.`);if(isNodeModulesPath(e.id))return{external:!0,id:n}}}}}function createDistributionPackageBoundaryPlugin(e){let t=new Set(e.runtimeDependencies);return{name:`eve-extension-distribution-package-boundary`,async resolveId(n,r,i){if(!isPackageImport(n))return;if(n.startsWith(`#`)){let a=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(a!==null&&typeof a.id==`string`&&!isPathInsideOrEqual(toCanonicalPath(a.id),toCanonicalPath(e.packageRoot))){let e=nearestPackageName(a.id);if(e!==void 0&&!t.has(e))throw Error(`Package import "${n}" resolves to undeclared package "${e}". Add "${e}" to dependencies, optionalDependencies, or peerDependencies.`)}return}if(isBuiltin(n))return{external:!0,id:n};let a=packageImportName(n);if(!t.has(a))throw Error(`Package "${n}" is not declared by the extension. Add "${a}" to dependencies, optionalDependencies, or peerDependencies.`);let o=await this.resolve(n,r,{kind:i.kind,skipSelf:!0});if(o===null&&(o=await this.resolve(n,join(e.packageRoot,`package.json`),{kind:i.kind,skipSelf:!0})),o===null||typeof o.id!=`string`)throw Error(`Cannot resolve declared package "${n}". Install the extension's dependencies before building.`);return{external:!0,id:n}}}}async function resolveConfiguredExternalModule(e){let t=resolveConfiguredExternalDependency(e.source,e.externalDependencies);if(t===void 0)return;let n=await this.resolve(e.source,e.importer,{kind:e.kind,skipSelf:!0});if(n===null&&(n=await this.resolve(e.source,join(e.packageRoot,`package.json`),{kind:e.kind,skipSelf:!0})),n===null||typeof n.id!=`string`)throw Error(`Cannot resolve external package "${e.source}".`);return{packageName:t,resolvedId:n.id}}function normalizeExternalDependencies(e=[]){return[...new Set(e)].sort()}function resolveConfiguredExternalDependency(e,t){return t.find(t=>e===t||e.startsWith(`${t}/`))}function packageImportName(e){return e.startsWith(`@`)?e.split(`/`,2).join(`/`):e.split(`/`,1)[0]}function nearestPackageName(e){let t=nearestPackageRoot(e);if(t!==void 0)try{let e=JSON.parse(readFileSync(join(t,`package.json`),`utf8`));return typeof e.name==`string`&&e.name.length>0?e.name:void 0}catch{return}}function nearestPackageRoot(e){let t=dirname(toCanonicalPath(e));for(;;){if(existsSync(join(t,`package.json`)))return t;let e=dirname(t);if(e===t)return;t=e}}function resolvePackageImport(e,t,n){let r=t===void 0||t.startsWith(`\0`)?n:nearestPackageRoot(t)??n;try{let t=createRequire(join(r,`package.json`)).resolve(e);return isPathInsideOrEqual(toCanonicalPath(t),toCanonicalPath(r))?t:void 0}catch{return}}let canonicalFrameworkPackageRoot;function isFrameworkPackagePath(e){return canonicalFrameworkPackageRoot??=toCanonicalPath(resolvePackageRoot()),nearestPackageRoot(e)===canonicalFrameworkPackageRoot}function resolveExistingExternalFilePath(e){if(existsSync(e))return e;for(let t of RESOLVE_EXTENSIONS){let n=`${e}${t}`;if(existsSync(n))return n}}function isPackageImport(e){return isPathImport(e)||/^(?:node|data|file):/.test(e)?!1:!e.startsWith(`@/`)}function isPathImport(e){return e.startsWith(`.`)||e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function isFrameworkRuntimeImport(e,t){return e===`eve/self-modification`?!1:e===`eve`||e.startsWith(`eve/`)?!0:e===`workflow`||e.startsWith(`workflow/`)||e.startsWith(`@workflow/`)?t===void 0||!isNodeModulesPath(t):!1}function resolveFrameworkRuntimeImport(e){return e===`eve`||e.startsWith(`eve/`)?e:normalizeEsmImportSpecifier(resolveWorkflowModulePath(e))}function resolveRuntimeLoaderFrameworkImport(e){return e===`eve`||e.startsWith(`eve/`)?normalizeEsmImportSpecifier(resolvePackageDependencyPath(e)):resolveFrameworkRuntimeImport(e)}function isNodeModulesPath(e){return e.replaceAll(`\\`,`/`).includes(`/node_modules/`)}function toCanonicalPath(e){try{return realpathSync(e)}catch{return resolve(e)}}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,isPathImport,normalizeExternalDependencies};
@@ -0,0 +1,14 @@
1
+ interface Mount {
2
+ readonly mountId: string;
3
+ readonly sourceRoot: string;
4
+ readonly packageName: string;
5
+ readonly specifier?: string;
6
+ readonly mountSourcePath?: string;
7
+ readonly programmaticImport?: {
8
+ readonly specifier: string;
9
+ readonly entryPath: string;
10
+ };
11
+ }
12
+ /** Isolates extension-owned source modules, but leaves ordinary dependencies shared. */
13
+ export declare function createExtensionMountPlugin(mounts: readonly Mount[], overridePaths?: ReadonlyMap<string, string>): Record<string, unknown> | null;
14
+ export {};
@@ -0,0 +1 @@
1
+ import{readFileSync,realpathSync}from"node:fs";import{resolve,sep}from"node:path";const MOUNT_QUERY=`?eve-mount=`;function canonicalize(e){try{return realpathSync(e)}catch{return resolve(e)}}function within(e,t){return e===t||e.startsWith(`${t}${sep}`)}function createExtensionMountPlugin(e,t=new Map){if(e.length===0)return null;let n=new Map,canonical=e=>{let t=n.get(e);return t===void 0&&(t=canonicalize(e),n.set(e,t)),t},r=e.map(e=>({...e,root:canonical(e.sourceRoot)})),i=new Map(r.filter(e=>e.mountSourcePath!==void 0).map(e=>[canonical(resolve(e.mountSourcePath)),e])),a=new Map(r.map(e=>[e.mountId,e])),o=new Map([...t].map(([e,t])=>[canonical(e),a.get(t)]));return{name:`eve-extension-mount`,async resolveId(e,t){if(e===`eve/context`)return;let n=e.indexOf(MOUNT_QUERY),s=n>=0?decodeURIComponent(e.slice(n+11)):void 0,c=t?.indexOf(MOUNT_QUERY)??-1,l=c>=0?decodeURIComponent(t.slice(c+11)):void 0,u=n>=0?e.slice(0,n):e,d=c>=0?t.slice(0,c):t,f=d===void 0?void 0:canonical(d),p=f===void 0?void 0:i.get(f),m=f===void 0?void 0:o.get(f),h=s??l??p?.mountId??m?.mountId,g=h===void 0?void 0:a.get(h);if(h!==void 0&&g===void 0)throw Error(`Unknown extension mount "${h}".`);let _=g!==void 0&&f!==void 0&&!within(f,g.root)&&o.get(f)===g,v=g!==void 0&&(u===g.specifier||u===g.programmaticImport?.specifier)?g:void 0,y=await this.resolve(v?.programmaticImport?.entryPath??u,d,{skipSelf:!0,kind:`import-statement`});if(y===null||y.id.startsWith(`\0`))return y;if(y.external){if(v===void 0)return y;throw Error(`Extension export "${u}" for mount "${h}" was externalized; it must be bundled to isolate its configuration.`)}if(!/\.(?:[cm]?[jt]sx?|json)$/.test(y.id))return y;let b=canonical(y.id);if(g!==void 0&&(v!==void 0||!_&&within(b,g.root)))return{id:`${y.id}${MOUNT_QUERY}${encodeURIComponent(h)}`};if(g!==void 0)return y;if(t===void 0||t.startsWith(`\0`))return;let x=r.filter(e=>within(b,e.root));if(x.length>1)throw Error(`Import "${e}" from "${t}" refers to multiple extension mounts (${x.map(e=>e.mountId).join(`, `)}). Import it from an owned mount or contribution instead.`);return x.length===1?{id:`${y.id}${MOUNT_QUERY}${encodeURIComponent(x[0].mountId)}`}:void 0},load(e){let t=e.indexOf(MOUNT_QUERY);if(t<0)return;let n=e.slice(0,t);if(!/\.(?:[cm]?[jt]sx?|json)$/.test(n))return;let r=n.slice(n.lastIndexOf(`.`)+1),i=r===`json`?`json`:r===`tsx`?`tsx`:r===`jsx`?`jsx`:[`ts`,`mts`,`cts`].includes(r)?`ts`:`js`;return{code:readFileSync(n,`utf8`),moduleType:i}}}}export{createExtensionMountPlugin};
@@ -1,12 +1,10 @@
1
1
  /**
2
- * One extension's on-disk source root paired with the namespace its durable
3
- * state keys and config binding must be scoped to.
2
+ * One extension's on-disk source root paired with its logical mount identity.
4
3
  */
5
4
  interface ExtensionScope {
6
5
  /** Absolute path to the extension's source root. */
7
6
  readonly sourceRoot: string;
8
- /** Package-derived namespace (e.g. `acme-crm`). */
9
- readonly packageNamespace: string;
7
+ readonly mountId: string;
10
8
  }
11
9
  /** The subset of the rolldown/rollup plugin shape this plugin implements. */
12
10
  export interface ExtensionScopeBundlerPlugin {
@@ -20,19 +18,18 @@ export interface ExtensionScopeBundlerPlugin {
20
18
  /**
21
19
  * Path-containment scope plugin for the whole-application bundle (the production
22
20
  * build). Any module physically under an extension's source root has its
23
- * `eve/context`/`eve/extension` imports redirected to a generated shim that
24
- * bakes the extension's package namespace into `defineState`/`defineExtension`.
21
+ * `eve/context` imports redirected to a mount-owned state shim.
25
22
  *
26
23
  * Returns `null` when there are no extensions, so consumer-only builds carry no
27
24
  * extra plugin and their output is byte-identical to a non-extension build.
28
25
  */
29
26
  export declare function createExtensionScopePlugin(scopes: readonly ExtensionScope[]): ExtensionScopeBundlerPlugin | null;
30
27
  /**
31
- * Fixed-namespace scope plugin for a single extension-owned module bundle (the
32
- * dev/eval per-module loader). The compiler already knows the loaded module is
33
- * extension-owned and under which namespace, so every module in the bundle —
34
- * the entry plus its same-package dependencies — is scoped, with no reliance on
28
+ * Fixed-mount scope plugin for a single extension-owned module bundle (the
29
+ * dev/eval per-module loader). The compiler already knows the owning mount,
30
+ * so every module in the bundle — the entry plus its same-package dependencies —
31
+ * is scoped, with no reliance on
35
32
  * filesystem path matching (which is unreliable under workspace symlinks).
36
33
  */
37
- export declare function createFixedNamespaceScopePlugin(namespace: string): ExtensionScopeBundlerPlugin;
34
+ export declare function createFixedMountScopePlugin(mountId: string): ExtensionScopeBundlerPlugin;
38
35
  export {};
@@ -1,3 +1,2 @@
1
- import{realpathSync}from"node:fs";import{resolve,sep}from"node:path";const VIRTUAL_PREFIX=`\0eve-ext-scope:`,SCOPED_FRAMEWORK_MODULES={"eve/context":`context`,"eve/extension":`extension`};function canonicalize(e){try{return realpathSync(e)}catch{return resolve(e)}}function importerPath(e){let t=e.indexOf(`?`);return canonicalize(t===-1?e:e.slice(0,t))}function isUnder(e,t){return e===t||e.startsWith(`${t}${sep}`)}function shimSource(e,t){let n=JSON.stringify(t);return e===`context`?[`import { defineState as __eveScopedDefineState } from "eve/context";`,`export function defineState(name, initial) {`,` return __eveScopedDefineState(${n} + "." + name, initial);`,`}`,``].join(`
2
- `):[`import { defineExtension as __eveScopedDefineExtension } from "eve/extension";`,`export function defineExtension(options, namespace) {`,` return __eveScopedDefineExtension(options, namespace === undefined ? ${n} : namespace);`,`}`,``].join(`
3
- `)}function scopeHooks(e,t){return{name:e,resolveId(e,n){let r=SCOPED_FRAMEWORK_MODULES[e];if(r===void 0||n===void 0||n.startsWith(`\0`))return;let i=t(n);if(i!==void 0)return`${VIRTUAL_PREFIX}${r}:${i}`},load(e){if(!e.startsWith(VIRTUAL_PREFIX))return;let t=e.slice(15),n=t.indexOf(`:`);return{code:shimSource(t.slice(0,n),t.slice(n+1)),moduleType:`js`}}}}function createExtensionScopePlugin(e){if(e.length===0)return null;let t=e.map(e=>({root:canonicalize(e.sourceRoot),packageNamespace:e.packageNamespace}));return scopeHooks(`eve-extension-scope`,e=>{let n=importerPath(e);for(let e of t)if(isUnder(n,e.root))return e.packageNamespace})}function createFixedNamespaceScopePlugin(e){return scopeHooks(`eve-extension-scope-fixed`,()=>e)}export{createExtensionScopePlugin,createFixedNamespaceScopePlugin};
1
+ import{realpathSync}from"node:fs";import{resolve,sep}from"node:path";const VIRTUAL_PREFIX=`\0eve-ext-scope:`;function canonicalize(e){try{return realpathSync(e)}catch{return resolve(e)}}function importerPath(e){let t=e.indexOf(`?`);return canonicalize(t===-1?e:e.slice(0,t))}function isUnder(e,t){return e===t||e.startsWith(`${t}${sep}`)}function shimSource(e){return[`import { defineMountedState } from "eve/internal/mount-state";`,`export function defineState(name, initial) {`,` return defineMountedState(${JSON.stringify(e)}, name, initial);`,`}`,``].join(`
2
+ `)}function scopeHooks(e,t){return{name:e,resolveId(e,n){if(e!==`eve/context`||n===void 0||n.startsWith(`\0`))return;let r=t(n);if(r!==void 0)return`${VIRTUAL_PREFIX}context:${encodeURIComponent(r)}`},load(e){if(!e.startsWith(VIRTUAL_PREFIX))return;let t=e.slice(15),n=t.indexOf(`:`);return t.slice(0,n)===`context`?{code:shimSource(decodeURIComponent(t.slice(n+1))),moduleType:`js`}:void 0}}}function createExtensionScopePlugin(e){if(e.length===0)return null;let t=e.map(e=>({root:canonicalize(e.sourceRoot),mountId:e.mountId}));return scopeHooks(`eve-extension-scope`,e=>{let n=e.indexOf(`?eve-mount=`);if(n>=0){let r=decodeURIComponent(e.slice(n+11)),i=t.find(e=>e.mountId===r);if(i===void 0)throw Error(`Unknown extension mount "${r}".`);return isUnder(importerPath(e),i.root)?i.mountId:void 0}let r=importerPath(e),i=t.filter(e=>isUnder(r,e.root));if(i.length!==0){if(i.length>1)throw Error(`Ambiguous extension scope for "${r}".`);return i[0].mountId}})}function createFixedMountScopePlugin(e){return scopeHooks(`eve-extension-scope-fixed`,()=>e)}export{createExtensionScopePlugin,createFixedMountScopePlugin};
@@ -1,9 +1,9 @@
1
1
  import type { UserContent } from "ai";
2
2
  import type { SessionAuthContext } from "#channel/types.js";
3
- import { type ChannelFrom } from "#channel/channel-operations.js";
3
+ import type { ChannelFrom } from "#channel/channel-operations.js";
4
4
  import type { AgentInvocation, AgentInvocationMutationResult } from "#internal/invocation/agent-invocation.js";
5
5
  import type { RouteSessionCreator } from "#internal/nitro/routes/channel-route-context.js";
6
- import type { InputResponse } from "#shared/input.js";
6
+ import { type InputResponse } from "#shared/input.js";
7
7
  export declare class WorkflowAgentInvocationExecution {
8
8
  #private;
9
9
  constructor(input: {
@@ -1 +1 @@
1
- import{INTERNAL_CHANNEL_DELIVER}from"#channel/channel-operations.js";import{parseJsonValue}from"#shared/json.js";import{getRun,getWorld}from"#internal/workflow/runtime.js";import{RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{parseNdjsonStream}from"#execution/ndjson-stream.js";import{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE,invocationInputRequestId,invocationOwnerKey}from"#internal/invocation/metadata.js";var WorkflowAgentInvocationExecution=class{#e;#t;constructor(e){this.#e=e.createSession,this.#t=e.from}async create(e){let t=`invocation:${crypto.randomUUID()}`,n=await this.#e({auth:e.auth,capabilities:{requestInput:!0},continuationToken:t,externalInvocation:{continuationToken:t,ownerKey:invocationOwnerKey(e.auth)},input:{message:e.message}}),r=await this.#n(n.sessionId,e.auth);if(r===void 0)throw Error(`Invocation run was unavailable after durable creation.`);return workingInvocation(n.sessionId,r.createdAt.toISOString(),r.expiredAt?.toISOString())}async read(e){let t=await this.#n(e.invocationId,e.auth);if(t===void 0)return;let n={createdAt:t.createdAt.toISOString(),expiresAt:t.expiredAt?.toISOString(),invocationId:t.runId};return t.status===`cancelled`?{...n,status:`cancelled`}:projectInvocation(n,t.status,await readRecentPersistedEvents(e.invocationId))}async update(e){let t=await this.read(e);if(t===void 0)return{type:`not_found`};if(t.status!==`input_required`)return replaysResolvedBatch(await readRecentPersistedEvents(e.invocationId),e.responses)?{invocation:t,type:`success`}:conflict(`Invocation is not waiting for input.`);let n=await this.#n(e.invocationId,e.auth);if(n===void 0)return{type:`not_found`};let r=latestPendingInputBatch(await readRecentPersistedEvents(e.invocationId));if(r===void 0)return conflict(`Invocation input changed before the update could be applied.`);let i=new Set,a=[];for(let t of e.responses){let e=r.rawRequestIds[t.requestId];if(e===void 0)return conflict(`Unknown input request: ${t.requestId}`);i.add(t.requestId),a.push({...t,requestId:e})}if(i.size!==e.responses.length||i.size!==Object.keys(r.requests).length)return conflict(`Responses must answer the complete pending input batch exactly once.`);let o=n.attributes[INVOCATION_TOKEN_ATTRIBUTE];if(o===void 0)return{type:`not_found`};try{await this.#t(o)[INTERNAL_CHANNEL_DELIVER]({inputResponses:a},{auth:e.auth})}catch(e){if(RunExpiredError.is(e))return{type:`not_found`};throw e}return{invocation:workingInvocation(e.invocationId,t.createdAt,t.expiresAt),type:`success`}}async cancel(e){let t=await this.read(e);if(t===void 0||isTerminal(t.status))return t;try{await getRun(e.invocationId).cancel()}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}return await this.read(e)}async#n(e,t){let n=await getWorld();try{let r=await n.runs.get(e);return r.attributes[INVOCATION_TOKEN_ATTRIBUTE]===void 0?void 0:r.attributes[INVOCATION_OWNER_ATTRIBUTE]===invocationOwnerKey(t)?r:void 0}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}}};async function readRecentPersistedEvents(e){let t=getRun(e).getReadable({startIndex:-64}),n=await t.getTailIndex();if(n<0)return await t.cancel(`invocation event stream is empty`).catch(()=>{}),[];let r=Math.min(n+1,64),i=parseNdjsonStream(()=>t).getReader(),a=[];try{for(;a.length<r;){let{done:e,value:t}=await i.read();if(e)break;a.push(t)}}finally{await i.cancel(`invocation event window read complete`).catch(()=>{}),i.releaseLock()}return a}function pendingInputBatch(e){let t={},n={};for(let r of e.data.requests){let i=invocationInputRequestId(e.meta.id,r.requestId);t[i]=r.requestId,n[i]={...r,requestId:i}}return{id:e.meta.id,rawRequestIds:t,requests:n}}function withoutResolved(e,t){let n=new Set(t.map(e=>e.requestId)),r={},i={};for(let[t,a]of Object.entries(e.rawRequestIds)){if(n.has(a))continue;r[t]=a;let o=e.requests[t];o!==void 0&&(i[t]=o)}return Object.keys(r).length===0?void 0:{id:e.id,rawRequestIds:r,requests:i}}function foldInputBatches(e){let t,n,r;for(let i of e)if(i.type===`input.requested`)n=pendingInputBatch(i),t=n;else if(i.type===`input.resolved`){if(n===void 0)continue;let e=new Map;for(let t of i.data.resolutions)e.set(t.requestId,t.response);r={batch:n,responses:e},t!==void 0&&(t=withoutResolved(t,i.data.resolutions))}else i.type===`turn.started`&&(t=void 0);return{pending:t,resolved:r}}function latestPendingInputBatch(e){return foldInputBatches(e).pending}function replaysResolvedBatch(e,t){let n=foldInputBatches(e).resolved;if(n===void 0||t.length!==n.responses.size)return!1;let r=new Set;for(let e of t){let t=n.batch.rawRequestIds[e.requestId];if(t===void 0||r.has(t)||(r.add(t),!n.responses.has(t)))return!1;let i=n.responses.get(t);if(i?.optionId!==e.optionId||i?.text!==e.text)return!1}return!0}function projectInvocation(e,t,n){let r=new Map,i,a,o;for(let e of n)switch(e.type){case`turn.started`:r.clear(),i=void 0,a=void 0,o=void 0;break;case`input.requested`:i=pendingInputBatch(e);break;case`input.resolved`:i!==void 0&&(i=withoutResolved(i,e.data.resolutions)),o=void 0;break;case`authorization.required`:{let t={description:e.data.description,name:e.data.name};e.data.authorization!==void 0&&(t.authorization=e.data.authorization),e.data.webhookUrl!==void 0&&(t.webhookUrl=e.data.webhookUrl),r.set(e.data.name,t);break}case`authorization.completed`:r.delete(e.data.name),o=void 0;break;case`message.completed`:e.data.finishReason!==`tool-calls`&&e.data.message!==null&&(a=safeJson(e.data.message));break;case`turn.completed`:o=`completed`;break;case`turn.cancelled`:o=`cancelled`;break;case`turn.failed`:case`session.failed`:o=e}let s=typeof o==`object`?o:void 0,failed=()=>({...e,error:publicInvocationFailure(e.invocationId,s),status:`failed`});if(t===`failed`||s?.type===`session.failed`)return failed();if(t===`completed`)return{...e,result:a,status:`completed`};let c=[...r.values()];return c.length>0?{...e,authorizations:c,pollAfterMs:1e3,result:a,status:`authorization_required`}:i===void 0?s===void 0?o===`cancelled`?{...e,status:`cancelled`}:o===`completed`?{...e,result:a,status:`completed`}:{...e,pollAfterMs:1e3,result:a,status:`working`}:failed():{...e,inputRequests:i.requests,result:a,status:`input_required`}}function workingInvocation(e,t,n){return{createdAt:t,expiresAt:n,invocationId:e,pollAfterMs:1e3,status:`working`}}function safeJson(e){try{return parseJsonValue(e)}catch{return String(e)}}function publicInvocationFailure(e,t){let n={runId:e};t!==void 0&&(n.eveCode=t.data.code);let r=vercelDeploymentId();r!==void 0&&(n.vercelDeploymentId=r),typeof t?.data.details?.errorId==`string`&&(n.errorId=t.data.details.errorId);let i=t===void 0?null:semanticFailure(t.data);if(i===null){let e=t===void 0?null:fallbackFailure(t.data);return e===null?{code:-32603,data:n,message:`Invocation failed.`}:(e.name!==void 0&&(n.name=e.name),{code:-32603,data:n,message:e.message})}return n.semanticErrorId=i.id,n.name=i.name,i.hint!==void 0&&(n.hint=i.hint),{code:-32603,data:n,message:i.message}}function semanticFailure(e){let t=e.details;if(typeof t?.semanticErrorId!=`string`||t.semanticErrorId.trim().length===0||typeof t.name!=`string`||t.name.trim().length===0)return null;let n=typeof t.message==`string`&&t.message.trim().length>0?t.message.trim():e.message.trim();if(n.length===0)return null;let r=typeof t.hint==`string`&&t.hint.trim().length>0?t.hint.trim():void 0,i={id:t.semanticErrorId,message:n,name:t.name};return r!==void 0&&(i.hint=r),i}function fallbackFailure(e){let t=e.message.trim(),n=typeof e.details?.name==`string`?e.details.name.trim():``;if(t.length===0&&n.length===0)return null;let r={message:t.length===0?n:truncateForDisplay(t)};return n.length>0&&(r.name=n),r}function truncateForDisplay(e,t=160){return e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`}function vercelDeploymentId(){if(process.env.VERCEL!==`1`)return;let e=process.env.VERCEL_DEPLOYMENT_ID?.trim();return e&&e.length>0?e:void 0}function conflict(e){return{message:e,type:`conflict`}}function isTerminal(e){return e===`completed`||e===`failed`||e===`cancelled`}export{WorkflowAgentInvocationExecution};
1
+ import{parseInputResponses}from"#shared/input.js";import{parseJsonValue}from"#shared/json.js";import{RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{getRun,getWorld}from"#internal/workflow/runtime.js";import{parseNdjsonStream}from"#execution/ndjson-stream.js";import{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE,invocationInputRequestId,invocationOwnerKey}from"#internal/invocation/metadata.js";var WorkflowAgentInvocationExecution=class{#e;#t;constructor(e){this.#e=e.createSession,this.#t=e.from}async create(e){let t=`invocation:${crypto.randomUUID()}`,n=await this.#e({auth:e.auth,capabilities:{requestInput:!0},continuationToken:t,externalInvocation:{continuationToken:t,ownerKey:invocationOwnerKey(e.auth)},input:{message:e.message}}),r=await this.#n(n.sessionId,e.auth);if(r===void 0)throw Error(`Invocation run was unavailable after durable creation.`);return workingInvocation(n.sessionId,r.createdAt.toISOString(),r.expiredAt?.toISOString())}async read(e){let t=await this.#n(e.invocationId,e.auth);if(t===void 0)return;let n={createdAt:t.createdAt.toISOString(),expiresAt:t.expiredAt?.toISOString(),invocationId:t.runId};return t.status===`cancelled`?{...n,status:`cancelled`}:projectInvocation(n,t.status,await readRecentPersistedEvents(e.invocationId))}async update(e){let t=await this.read(e);if(t===void 0)return{type:`not_found`};if(t.status!==`input_required`)return replaysResolvedBatch(await readRecentPersistedEvents(e.invocationId),e.responses)?{invocation:t,type:`success`}:conflict(`Invocation is not waiting for input.`);let n=await this.#n(e.invocationId,e.auth);if(n===void 0)return{type:`not_found`};let r=latestPendingInputBatch(await readRecentPersistedEvents(e.invocationId));if(r===void 0)return conflict(`Invocation input changed before the update could be applied.`);let i=new Set,a=[];for(let t of e.responses){let e=r.rawRequestIds[t.requestId];if(e===void 0)return conflict(`Unknown input request: ${t.requestId}`);i.add(t.requestId),a.push({...t,requestId:e})}if(i.size!==e.responses.length||i.size!==Object.keys(r.requests).length)return conflict(`Responses must answer the complete pending input batch exactly once.`);let o=n.attributes[INVOCATION_TOKEN_ATTRIBUTE];if(o===void 0)return{type:`not_found`};try{await this.#t(o).respond(parseInputResponses(a),{auth:e.auth})}catch(e){if(RunExpiredError.is(e))return{type:`not_found`};throw e}return{invocation:workingInvocation(e.invocationId,t.createdAt,t.expiresAt),type:`success`}}async cancel(e){let t=await this.read(e);if(t===void 0||isTerminal(t.status))return t;try{await getRun(e.invocationId).cancel()}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}return await this.read(e)}async#n(e,t){let n=await getWorld();try{let r=await n.runs.get(e);return r.attributes[INVOCATION_TOKEN_ATTRIBUTE]===void 0?void 0:r.attributes[INVOCATION_OWNER_ATTRIBUTE]===invocationOwnerKey(t)?r:void 0}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}}};async function readRecentPersistedEvents(e){let t=getRun(e).getReadable({startIndex:-64}),n=await t.getTailIndex();if(n<0)return await t.cancel(`invocation event stream is empty`).catch(()=>{}),[];let r=Math.min(n+1,64),i=parseNdjsonStream(()=>t).getReader(),a=[];try{for(;a.length<r;){let{done:e,value:t}=await i.read();if(e)break;a.push(t)}}finally{await i.cancel(`invocation event window read complete`).catch(()=>{}),i.releaseLock()}return a}function pendingInputBatch(e){let t={},n={};for(let r of e.data.requests){let i=invocationInputRequestId(e.meta.id,r.requestId);t[i]=r.requestId,n[i]={...r,requestId:i}}return{id:e.meta.id,rawRequestIds:t,requests:n}}function withoutResolved(e,t){let n=new Set(t.map(e=>e.requestId)),r={},i={};for(let[t,a]of Object.entries(e.rawRequestIds)){if(n.has(a))continue;r[t]=a;let o=e.requests[t];o!==void 0&&(i[t]=o)}return Object.keys(r).length===0?void 0:{id:e.id,rawRequestIds:r,requests:i}}function foldInputBatches(e){let t,n,r;for(let i of e)if(i.type===`input.requested`)n=pendingInputBatch(i),t=n;else if(i.type===`input.resolved`){if(n===void 0)continue;let e=new Map;for(let t of i.data.resolutions)e.set(t.requestId,t.response);r={batch:n,responses:e},t!==void 0&&(t=withoutResolved(t,i.data.resolutions))}else i.type===`turn.started`&&(t=void 0);return{pending:t,resolved:r}}function latestPendingInputBatch(e){return foldInputBatches(e).pending}function replaysResolvedBatch(e,t){let n=foldInputBatches(e).resolved;if(n===void 0||t.length!==n.responses.size)return!1;let r=new Set;for(let e of t){let t=n.batch.rawRequestIds[e.requestId];if(t===void 0||r.has(t)||(r.add(t),!n.responses.has(t)))return!1;let i=n.responses.get(t);if(i?.optionId!==e.optionId||i?.text!==e.text)return!1}return!0}function projectInvocation(e,t,n){let r=new Map,i,a,o;for(let e of n)switch(e.type){case`turn.started`:r.clear(),i=void 0,a=void 0,o=void 0;break;case`input.requested`:i=pendingInputBatch(e);break;case`input.resolved`:i!==void 0&&(i=withoutResolved(i,e.data.resolutions)),o=void 0;break;case`authorization.required`:{let t={description:e.data.description,name:e.data.name};e.data.authorization!==void 0&&(t.authorization=e.data.authorization),e.data.webhookUrl!==void 0&&(t.webhookUrl=e.data.webhookUrl),r.set(e.data.name,t);break}case`authorization.completed`:r.delete(e.data.name),o=void 0;break;case`message.completed`:e.data.finishReason!==`tool-calls`&&(a=safeJson(e.data.message));break;case`turn.waiting`:a=void 0;break;case`turn.completed`:o=`completed`;break;case`turn.cancelled`:o=`cancelled`;break;case`turn.failed`:case`session.failed`:o=e}let s=typeof o==`object`?o:void 0,failed=()=>({...e,error:publicInvocationFailure(e.invocationId,s),status:`failed`});if(t===`failed`||s?.type===`session.failed`)return failed();if(t===`completed`)return{...e,result:a,status:`completed`};let c=[...r.values()];return c.length>0?{...e,authorizations:c,pollAfterMs:1e3,result:a,status:`authorization_required`}:i===void 0?s===void 0?o===`cancelled`?{...e,status:`cancelled`}:o===`completed`?{...e,result:a,status:`completed`}:{...e,pollAfterMs:1e3,result:a,status:`working`}:failed():{...e,inputRequests:i.requests,result:a,status:`input_required`}}function workingInvocation(e,t,n){return{createdAt:t,expiresAt:n,invocationId:e,pollAfterMs:1e3,status:`working`}}function safeJson(e){try{return parseJsonValue(e)}catch{return String(e)}}function publicInvocationFailure(e,t){let n={runId:e};t!==void 0&&(n.eveCode=t.data.code);let r=vercelDeploymentId();r!==void 0&&(n.vercelDeploymentId=r),typeof t?.data.details?.errorId==`string`&&(n.errorId=t.data.details.errorId);let i=t===void 0?null:semanticFailure(t.data);if(i===null){let e=t===void 0?null:fallbackFailure(t.data);return e===null?{code:-32603,data:n,message:`Invocation failed.`}:(e.name!==void 0&&(n.name=e.name),{code:-32603,data:n,message:e.message})}return n.semanticErrorId=i.id,n.name=i.name,i.hint!==void 0&&(n.hint=i.hint),{code:-32603,data:n,message:i.message}}function semanticFailure(e){let t=e.details;if(typeof t?.semanticErrorId!=`string`||t.semanticErrorId.trim().length===0||typeof t.name!=`string`||t.name.trim().length===0)return null;let n=typeof t.message==`string`&&t.message.trim().length>0?t.message.trim():e.message.trim();if(n.length===0)return null;let r=typeof t.hint==`string`&&t.hint.trim().length>0?t.hint.trim():void 0,i={id:t.semanticErrorId,message:n,name:t.name};return r!==void 0&&(i.hint=r),i}function fallbackFailure(e){let t=e.message.trim(),n=typeof e.details?.name==`string`?e.details.name.trim():``;if(t.length===0&&n.length===0)return null;let r={message:t.length===0?n:truncateForDisplay(t)};return n.length>0&&(r.name=n),r}function truncateForDisplay(e,t=160){return e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`}function vercelDeploymentId(){if(process.env.VERCEL!==`1`)return;let e=process.env.VERCEL_DEPLOYMENT_ID?.trim();return e&&e.length>0?e:void 0}function conflict(e){return{message:e,type:`conflict`}}function isTerminal(e){return e===`completed`||e===`failed`||e===`cancelled`}export{WorkflowAgentInvocationExecution};
@@ -0,0 +1 @@
1
+ export { defineMountedState } from "#public/definitions/state.js";
@@ -0,0 +1 @@
1
+ import{defineMountedState}from"#public/definitions/state.js";export{defineMountedState};
@@ -1,7 +1,7 @@
1
1
  export declare const DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER = "activated";
2
2
  /** Records the instant at which an activated generation stopped being current. */
3
3
  export declare function recordRetiredDevelopmentRuntimeArtifactsSnapshot(snapshotRoot: string, retiredAt?: number): Promise<void>;
4
- /** Applies the bounded retention policy within one dev snapshot directory. */
4
+ /** Applies retention and reports whether any snapshots were removed. */
5
5
  export declare function pruneDevelopmentRuntimeArtifactsSnapshotDirectory(input: {
6
6
  readonly activeSnapshotRoot: string | undefined;
7
7
  readonly gracePeriodMs?: number;
@@ -9,4 +9,4 @@ export declare function pruneDevelopmentRuntimeArtifactsSnapshotDirectory(input:
9
9
  readonly protectAll: boolean;
10
10
  readonly retainCount?: number;
11
11
  readonly snapshotsDirectory: string;
12
- }): Promise<void>;
12
+ }): Promise<boolean>;
@@ -1 +1 @@
1
- import{readFile,readdir,rm,stat,writeFile}from"node:fs/promises";import{existsSync}from"node:fs";import{join,resolve}from"node:path";const DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER=`activated`,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA=`retired.json`;async function recordRetiredDevelopmentRuntimeArtifactsSnapshot(e,t=Date.now()){await writeFile(join(e,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`${JSON.stringify({retiredAt:t})}\n`)}async function pruneDevelopmentRuntimeArtifactsSnapshotDirectory(e){if(e.protectAll)return;let t=e.now??Date.now(),n=Math.max(0,e.gracePeriodMs??18e5),r=Math.max(0,Math.trunc(e.retainCount??5)),i;try{i=await readdir(e.snapshotsDirectory,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let a=e.activeSnapshotRoot===void 0?void 0:resolve(e.activeSnapshotRoot),o=await Promise.all(i.filter(e=>e.isDirectory()).map(async n=>{let r=join(e.snapshotsDirectory,n.name),i=a===resolve(r),o=existsSync(join(r,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER)),s;if(o&&!i)try{s=await readRetiredAt(r),s===void 0&&(await recordRetiredDevelopmentRuntimeArtifactsSnapshot(r,t),s=t)}catch(e){console.warn(`[eve:dev] failed to read or initialize runtime generation retirement metadata for "${r}": ${String(e)}`)}return{activated:o,active:i,path:r,retiredAt:s,mtimeMs:(await stat(r)).mtimeMs}})),s=new Set(o.flatMap(e=>e.retiredAt===void 0?[]:[{path:e.path,retiredAt:e.retiredAt}]).sort((e,t)=>t.retiredAt-e.retiredAt).slice(0,r).map(e=>e.path)),c=new Set(o.filter(e=>!e.activated).sort((e,t)=>t.mtimeMs-e.mtimeMs).slice(0,r).map(e=>e.path));await Promise.all(o.map(async e=>{e.active||e.activated&&e.retiredAt===void 0||s.has(e.path)||c.has(e.path)||e.retiredAt!==void 0&&t-e.retiredAt<=n||!e.activated&&t-e.mtimeMs<=n||await rm(e.path,{force:!0,recursive:!0})}))}async function readRetiredAt(e){let t;try{t=await readFile(join(e,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let n;try{n=JSON.parse(t)}catch{return}if(typeof n==`object`&&n&&!Array.isArray(n)&&`retiredAt`in n&&typeof n.retiredAt==`number`&&Number.isFinite(n.retiredAt)&&n.retiredAt>=0)return n.retiredAt}export{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot};
1
+ import{readFile,readdir,rm,stat,writeFile}from"node:fs/promises";import{existsSync}from"node:fs";import{join,resolve}from"node:path";const DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER=`activated`,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA=`retired.json`;async function recordRetiredDevelopmentRuntimeArtifactsSnapshot(e,t=Date.now()){await writeFile(join(e,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`${JSON.stringify({retiredAt:t})}\n`)}async function pruneDevelopmentRuntimeArtifactsSnapshotDirectory(e){if(e.protectAll)return!1;let t=e.now??Date.now(),n=Math.max(0,e.gracePeriodMs??18e5),r=Math.max(0,Math.trunc(e.retainCount??5)),i;try{i=await readdir(e.snapshotsDirectory,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}let a=e.activeSnapshotRoot===void 0?void 0:resolve(e.activeSnapshotRoot),o=await Promise.all(i.filter(e=>e.isDirectory()).map(async n=>{let r=join(e.snapshotsDirectory,n.name),i=a===resolve(r),o=existsSync(join(r,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER)),s;if(o&&!i)try{s=await readRetiredAt(r),s===void 0&&(await recordRetiredDevelopmentRuntimeArtifactsSnapshot(r,t),s=t)}catch(e){console.warn(`[eve:dev] failed to read or initialize runtime generation retirement metadata for "${r}": ${String(e)}`)}return{activated:o,active:i,path:r,retiredAt:s,mtimeMs:(await stat(r)).mtimeMs}})),s=new Set(o.flatMap(e=>e.retiredAt===void 0?[]:[{path:e.path,retiredAt:e.retiredAt}]).sort((e,t)=>t.retiredAt-e.retiredAt).slice(0,r).map(e=>e.path)),c=new Set(o.filter(e=>!e.activated).sort((e,t)=>t.mtimeMs-e.mtimeMs).slice(0,r).map(e=>e.path));return(await Promise.all(o.map(async e=>e.active||e.activated&&e.retiredAt===void 0||s.has(e.path)||c.has(e.path)||e.retiredAt!==void 0&&t-e.retiredAt<=n||!e.activated&&t-e.mtimeMs<=n?!1:(await rm(e.path,{force:!0,recursive:!0}),!0)))).some(Boolean)}async function readRetiredAt(e){let t;try{t=await readFile(join(e,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let n;try{n=JSON.parse(t)}catch{return}if(typeof n==`object`&&n&&!Array.isArray(n)&&`retiredAt`in n&&typeof n.retiredAt==`number`&&Number.isFinite(n.retiredAt)&&n.retiredAt>=0)return n.retiredAt}export{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot};
@@ -38,9 +38,7 @@ export declare function activateDevelopmentRuntimeArtifactsSnapshotTransaction(i
38
38
  */
39
39
  export declare function readDevelopmentRuntimeArtifactsSnapshotRoot(pointerPath: string | undefined): string | undefined;
40
40
  export declare function readActiveDevelopmentRuntimeArtifactsSnapshot(appRoot: string): ActiveDevelopmentRuntimeArtifactsSnapshot | undefined;
41
- /**
42
- * Reads a revision token for the latest dev runtime artifact snapshot.
43
- */
41
+ /** Reads a revision token for the latest dev runtime artifact snapshot. */
44
42
  export declare function readDevelopmentRuntimeArtifactsRevision(appRoot: string): DevelopmentRuntimeArtifactsRevision;
45
43
  /**
46
44
  * Bounds dev snapshot storage without consulting a Workflow World. The active
@@ -52,4 +50,4 @@ export declare function pruneDevelopmentRuntimeArtifactsSnapshots(input: {
52
50
  readonly gracePeriodMs?: number;
53
51
  readonly now?: number;
54
52
  readonly retainCount?: number;
55
- }): Promise<void>;
53
+ }): Promise<boolean>;
@@ -1 +1 @@
1
- import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,symlink,writeFile}from"node:fs/promises";import{resolvePackageRoot}from"#internal/application/package.js";import{existsSync,readFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";import{copyDevelopmentSourceSnapshot}from"#internal/nitro/dev-runtime-source-snapshot-copy.js";import{resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createDevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts-retention.js";const DEV_RUNTIME_ARTIFACTS_DIRECTORY=`dev-runtime`;function resolveDevelopmentRuntimeArtifactsPointerPath(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`current.json`)}function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`snapshots`)}function isDevelopmentRuntimeArtifactsSnapshotRoot(e,t){return dirname(resolve(t))===resolve(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e))}async function stageDevelopmentRuntimeArtifactsSnapshot(e){let t=join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.project.appRoot),`${Date.now().toString(36)}-${randomUUID()}`),n=await createDevelopmentSourceSnapshotPlan({appRoot:e.project.appRoot,authoredSourceRoots:collectExtensionMountSourceRoots(e.manifest),snapshotRoot:t});try{await copyDevelopmentSourceSnapshot(n),await mountFrameworkPackage(n.runtimeAppRoot),await mountExtensionExternalDependencies({manifest:e.manifest,runtimeAppRoot:n.runtimeAppRoot}),await cp(e.paths.compileDirectoryPath,join(n.runtimeAppRoot,`.eve`,`compile`),{recursive:!0}),await rewriteSnapshotCompiledManifest({appRoot:e.project.appRoot,extensionPackageRoots:(e.manifest?.subagents??[]).flatMap(e=>e.owner.kind===`extension`?[{sourceRoot:e.agent.appRoot,packageName:e.owner.packageName}]:[]),manifestPath:join(n.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:n.runtimeAppRoot,snapshotSourceRoot:n.snapshotSourceRoot,sourceRoot:n.sourceRoot}),await validateSnapshotCompiledManifestRoots({manifestPath:join(n.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),snapshotSourceRoot:n.snapshotSourceRoot}),await writeFile(join(t,`generation.json`),`${JSON.stringify({runtimeAppRoot:n.runtimeAppRoot})}\n`)}catch(e){throw await rm(t,{force:!0,recursive:!0}).catch(()=>{}),e}return{sourceWatchPaths:n.watchPaths,runtimeAppRoot:n.runtimeAppRoot,snapshotRoot:t,snapshotSourceRoot:n.snapshotSourceRoot,sourceRoot:n.sourceRoot}}async function mountFrameworkPackage(e){let t=join(e,`node_modules`,`eve`);await mkdir(dirname(t),{recursive:!0}),await rm(t,{force:!0,recursive:!0}),await symlink(resolvePackageRoot(),t,`junction`)}async function mountExtensionExternalDependencies(e){if(e.manifest===void 0)return;let t=[e.manifest,...(e.manifest.subagents??[]).map(e=>e.agent)].flatMap(e=>e.extensionMounts??[]).filter(e=>(e.externalDependencies??[]).length>0);for(let[n,r]of Object.entries(resolveExtensionExternalDependencyPaths(t))){let t=findPackageRoot(r,n),i=join(e.runtimeAppRoot,`node_modules`,...n.split(`/`));await mkdir(dirname(i),{recursive:!0}),await rm(i,{force:!0,recursive:!0}),await symlink(t,i,`junction`)}}function findPackageRoot(e,t){let n=dirname(e);for(;;){let e=join(n,`package.json`);if(existsSync(e))try{if(JSON.parse(readFileSync(e,`utf8`)).name===t)return n}catch{}let r=dirname(n);if(r===n)throw Error(`Cannot locate package root for extension external dependency "${t}".`);n=r}}async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(e){let t=await readMaterializedAuthoredModuleIndex(e.snapshot.runtimeAppRoot);if(t===void 0||!existsSync(join(e.snapshot.runtimeAppRoot,`.eve`,`compile`,t.moduleMap)))throw Error(`Cannot activate development runtime generation "${e.snapshot.snapshotRoot}" before its authored modules are materialized.`);let n=join(e.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER),r=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),i=readDevelopmentRuntimeArtifactsPointer(r),a=await readOptionalFile(r);try{await writeFile(n,``),await writeDevelopmentRuntimeArtifactsPointer(e),i?.version===2&&i.snapshotRoot!==e.snapshot.snapshotRoot&&isDevelopmentRuntimeArtifactsSnapshotRoot(e.appRoot,i.snapshotRoot)&&await recordRetiredDevelopmentRuntimeArtifactsSnapshot(i.snapshotRoot).catch(e=>{console.warn(`[eve:dev] failed to record retired runtime generation "${i.snapshotRoot}": ${String(e)}`)})}catch(e){throw await rollbackFailedActivation({cause:e,markerPath:n,pointerPath:r,previousPointerSource:a})}let o=!1;return{commit(){o=!0},async rollback(){if(o)return;o=!0;let e=await restoreDevelopmentRuntimeArtifactsActivation({markerPath:n,pointerPath:r,previousPointerSource:a});if(e!==void 0)throw e}}}function readDevelopmentRuntimeArtifactsSnapshotRoot(e){let t=readDevelopmentRuntimeArtifactsPointer(e);if(t!==void 0)return t.version===1?t.appRoot:t.runtimeAppRoot}function readActiveDevelopmentRuntimeArtifactsSnapshot(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e));if(t!==void 0&&t.version!==1)return{runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot}}function readDevelopmentRuntimeArtifactsRevision(e){return{revision:readDevelopmentRuntimeArtifactsSnapshotRoot(resolveDevelopmentRuntimeArtifactsPointerPath(e))??e}}async function pruneDevelopmentRuntimeArtifactsSnapshots(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot));await pruneDevelopmentRuntimeArtifactsSnapshotDirectory({activeSnapshotRoot:t?.version===2?t.snapshotRoot:void 0,gracePeriodMs:e.gracePeriodMs,now:e.now,protectAll:t?.version===1,retainCount:e.retainCount,snapshotsDirectory:resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.appRoot)})}function collectExtensionMountSourceRoots(e){return e===void 0?[]:[e,...(e.subagents??[]).map(e=>e.agent)].flatMap(e=>(e.extensionMounts??[]).map(e=>e.sourceRoot))}function readDevelopmentRuntimeArtifactsPointer(e){if(e!==void 0&&existsSync(e))try{let t=JSON.parse(readFileSync(e,`utf8`));return t.kind!==`eve-dev-runtime-artifacts-pointer`||typeof t.version!=`number`?void 0:t.version===1&&typeof t.appRoot==`string`&&t.appRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,version:1}:t.version===2&&typeof t.appRoot==`string`&&typeof t.runtimeAppRoot==`string`&&t.runtimeAppRoot.length>0&&typeof t.snapshotRoot==`string`&&t.snapshotRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot,version:2}:void 0}catch{return}}async function rewriteSnapshotCompiledManifest(e){let t=JSON.parse(await readFile(e.manifestPath,`utf8`)),n=rewriteManifestRoots({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t});await writeFile(e.manifestPath,`${JSON.stringify(n,null,2)}\n`)}function rewriteManifestRoots(e){if(Array.isArray(e.value))return e.value.map(t=>rewriteManifestRoots({...e,value:t}));if(e.value===null||typeof e.value!=`object`)return e.value;let t={};for(let[n,r]of Object.entries(e.value)){if(typeof r==`string`&&(n===`appRoot`||n===`agentRoot`)){t[n]=isPathInsideOrEqual(r,e.appRoot)||e.extensionPackageRoots.some(e=>isPathInsideOrEqual(r,e.sourceRoot))?rewritePathWithinAppRoot({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,path:r,runtimeAppRoot:e.runtimeAppRoot}):rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}if(typeof r==`string`&&n===`sourceRoot`){t[n]=rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}t[n]=rewriteManifestRoots({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:r})}return t}function rewritePathWithinSourceRoot(e){return isPathInsideOrEqual(e.path,e.sourceRoot)?toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:e.path,sourceRoot:e.sourceRoot}):e.path}function rewritePathWithinAppRoot(e){if(!isPathInsideOrEqual(e.path,e.appRoot)){let t=e.extensionPackageRoots.find(t=>isPathInsideOrEqual(e.path,t.sourceRoot));return t===void 0?e.path:join(e.runtimeAppRoot,`node_modules`,t.packageName,relative(t.sourceRoot,e.path))}let t=relative(e.appRoot,e.path);return t.length===0?e.runtimeAppRoot:join(e.runtimeAppRoot,t)}async function writeDevelopmentRuntimeArtifactsPointer(e){let t=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),n={appRoot:e.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:e.snapshot.runtimeAppRoot,snapshotRoot:e.snapshot.snapshotRoot,version:2};await writeDevelopmentRuntimeArtifactsPointerSource(t,`${JSON.stringify(n,null,2)}\n`)}async function writeDevelopmentRuntimeArtifactsPointerSource(e,t){let n=`${e}.${randomUUID()}.tmp`;await mkdir(dirname(e),{recursive:!0}),await writeFile(n,t);try{await renameWithTransientBusyRetry(n,e)}catch(e){throw await rm(n,{force:!0}).catch(()=>{}),e}}async function readOptionalFile(e){try{return await readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}async function rollbackFailedActivation(e){let t=await restoreDevelopmentRuntimeArtifactsActivation(e);return t===void 0?e.cause:AggregateError([e.cause,t],`Development runtime activation and rollback failed.`,{cause:e.cause})}async function restoreDevelopmentRuntimeArtifactsActivation(e){let t=(await Promise.allSettled([e.previousPointerSource===void 0?rm(e.pointerPath,{force:!0}):writeDevelopmentRuntimeArtifactsPointerSource(e.pointerPath,e.previousPointerSource),rm(e.markerPath,{force:!0})])).flatMap(e=>e.status===`rejected`?[e.reason]:[]);if(t.length!==0)return AggregateError(t,`Failed to restore development runtime activation.`)}async function validateSnapshotCompiledManifestRoots(e){let t=collectManifestRootPaths(JSON.parse(await readFile(e.manifestPath,`utf8`)));for(let n of t)if(!isPathInsideOrEqual(n,e.snapshotSourceRoot))throw Error(`Development runtime snapshot manifest root "${n}" is outside runtime snapshot source root "${e.snapshotSourceRoot}".`)}function collectManifestRootPaths(e){if(Array.isArray(e))return e.flatMap(e=>collectManifestRootPaths(e));if(typeof e!=`object`||!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if((n===`appRoot`||n===`agentRoot`)&&typeof r==`string`){t.push(r);continue}t.push(...collectManifestRootPaths(r))}return t}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,readActiveDevelopmentRuntimeArtifactsSnapshot,readDevelopmentRuntimeArtifactsRevision,readDevelopmentRuntimeArtifactsSnapshotRoot,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot};
1
+ import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,symlink,writeFile}from"node:fs/promises";import{resolvePackageRoot}from"#internal/application/package.js";import{existsSync,readFileSync}from"node:fs";import{dirname,join,relative,resolve,sep}from"node:path";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";import{copyDevelopmentSourceSnapshot}from"#internal/nitro/dev-runtime-source-snapshot-copy.js";import{resolveExtensionExternalDependencyPaths}from"#internal/nitro/host/extension-external-dependency-plugin.js";import{createDevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts-retention.js";import{resolveDevelopmentRuntimeArtifactsSnapshotsDirectory}from"#internal/nitro/dev-runtime-generation-metadata.js";function resolveDevelopmentRuntimeArtifactsPointerPath(e){return join(e,`.eve`,`dev-runtime`,`current.json`)}function isDevelopmentRuntimeArtifactsSnapshotRoot(e,t){return dirname(resolve(t))===resolve(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e))}async function stageDevelopmentRuntimeArtifactsSnapshot(e){let t=join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.project.appRoot),`${Date.now().toString(36)}-${randomUUID()}`),n=await createDevelopmentSourceSnapshotPlan({appRoot:e.project.appRoot,authoredSourceRoots:collectExtensionMountSourceRoots(e.manifest),snapshotRoot:t});try{await copyDevelopmentSourceSnapshot(n),await mountFrameworkPackage(n.runtimeAppRoot),await mountExtensionExternalDependencies({manifest:e.manifest,runtimeAppRoot:n.runtimeAppRoot}),await cp(e.paths.compileDirectoryPath,join(n.runtimeAppRoot,`.eve`,`compile`),{recursive:!0}),await rewriteSnapshotCompiledManifest({appRoot:e.project.appRoot,extensionPackageRoots:(e.manifest?.subagents??[]).flatMap(e=>e.owner.kind===`extension`?[{sourceRoot:e.agent.appRoot,packageName:e.owner.packageName}]:[]),manifestPath:join(n.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:n.runtimeAppRoot,snapshotSourceRoot:n.snapshotSourceRoot,sourceRoot:n.sourceRoot}),await validateSnapshotCompiledManifestRoots({manifestPath:join(n.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),snapshotSourceRoot:n.snapshotSourceRoot}),await writeFile(join(t,`generation.json`),`${JSON.stringify({runtimeAppRoot:n.runtimeAppRoot})}\n`)}catch(e){throw await rm(t,{force:!0,recursive:!0}).catch(()=>{}),e}return{sourceWatchPaths:n.watchPaths,runtimeAppRoot:n.runtimeAppRoot,snapshotRoot:t,snapshotSourceRoot:n.snapshotSourceRoot,sourceRoot:n.sourceRoot}}async function mountFrameworkPackage(e){let t=join(e,`node_modules`,`eve`);await mkdir(dirname(t),{recursive:!0}),await rm(t,{force:!0,recursive:!0}),await symlink(resolvePackageRoot(),t,`junction`)}async function mountExtensionExternalDependencies(e){if(e.manifest===void 0)return;let t=[e.manifest,...(e.manifest.subagents??[]).map(e=>e.agent)].flatMap(e=>e.extensionMounts??[]).filter(e=>(e.externalDependencies??[]).length>0);for(let[n,r]of Object.entries(resolveExtensionExternalDependencyPaths(t))){let t=findPackageRoot(r,n),i=join(e.runtimeAppRoot,`node_modules`,...n.split(`/`));await mkdir(dirname(i),{recursive:!0}),await rm(i,{force:!0,recursive:!0}),await symlink(t,i,`junction`)}}function findPackageRoot(e,t){let n=dirname(e);for(;;){let e=join(n,`package.json`);if(existsSync(e))try{if(JSON.parse(readFileSync(e,`utf8`)).name===t)return n}catch{}let r=dirname(n);if(r===n)throw Error(`Cannot locate package root for extension external dependency "${t}".`);n=r}}async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(e){let t=await readMaterializedAuthoredModuleIndex(e.snapshot.runtimeAppRoot);if(t===void 0||!existsSync(join(e.snapshot.runtimeAppRoot,`.eve`,`compile`,t.moduleMap)))throw Error(`Cannot activate development runtime generation "${e.snapshot.snapshotRoot}" before its authored modules are materialized.`);let n=join(e.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER),r=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),i=readDevelopmentRuntimeArtifactsPointer(r),a=await readOptionalFile(r);try{await writeFile(n,``),await writeDevelopmentRuntimeArtifactsPointer(e),i?.version===2&&i.snapshotRoot!==e.snapshot.snapshotRoot&&isDevelopmentRuntimeArtifactsSnapshotRoot(e.appRoot,i.snapshotRoot)&&await recordRetiredDevelopmentRuntimeArtifactsSnapshot(i.snapshotRoot).catch(e=>{console.warn(`[eve:dev] failed to record retired runtime generation "${i.snapshotRoot}": ${String(e)}`)})}catch(e){throw await rollbackFailedActivation({cause:e,markerPath:n,pointerPath:r,previousPointerSource:a})}let o=!1;return{commit(){o=!0},async rollback(){if(o)return;o=!0;let e=await restoreDevelopmentRuntimeArtifactsActivation({markerPath:n,pointerPath:r,previousPointerSource:a});if(e!==void 0)throw e}}}function readDevelopmentRuntimeArtifactsSnapshotRoot(e){let t=readDevelopmentRuntimeArtifactsPointer(e);if(t!==void 0)return t.version===1?t.appRoot:t.runtimeAppRoot}function readActiveDevelopmentRuntimeArtifactsSnapshot(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e));if(t!==void 0&&t.version!==1)return{runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot}}function readDevelopmentRuntimeArtifactsRevision(e){return{revision:readDevelopmentRuntimeArtifactsSnapshotRoot(resolveDevelopmentRuntimeArtifactsPointerPath(e))??e}}async function pruneDevelopmentRuntimeArtifactsSnapshots(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot));return await pruneDevelopmentRuntimeArtifactsSnapshotDirectory({activeSnapshotRoot:t?.version===2?t.snapshotRoot:void 0,gracePeriodMs:e.gracePeriodMs,now:e.now,protectAll:t?.version===1,retainCount:e.retainCount,snapshotsDirectory:resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.appRoot)})}function collectExtensionMountSourceRoots(e){return e===void 0?[]:[e,...(e.subagents??[]).map(e=>e.agent)].flatMap(e=>(e.extensionMounts??[]).map(e=>e.sourceRoot))}function readDevelopmentRuntimeArtifactsPointer(e){if(e!==void 0&&existsSync(e))try{let t=JSON.parse(readFileSync(e,`utf8`));return t.kind!==`eve-dev-runtime-artifacts-pointer`||typeof t.version!=`number`?void 0:t.version===1&&typeof t.appRoot==`string`&&t.appRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,version:1}:t.version===2&&typeof t.appRoot==`string`&&typeof t.runtimeAppRoot==`string`&&t.runtimeAppRoot.length>0&&typeof t.snapshotRoot==`string`&&t.snapshotRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot,version:2}:void 0}catch{return}}async function rewriteSnapshotCompiledManifest(e){let t=JSON.parse(await readFile(e.manifestPath,`utf8`)),n=rewriteManifestRoots({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t});await writeFile(e.manifestPath,`${JSON.stringify(n,null,2)}\n`)}function rewriteManifestRoots(e){if(Array.isArray(e.value))return e.value.map(t=>rewriteManifestRoots({...e,value:t}));if(e.value===null||typeof e.value!=`object`)return e.value;let t={};for(let[n,r]of Object.entries(e.value)){if(typeof r==`string`&&(n===`appRoot`||n===`agentRoot`)){t[n]=isPathInsideOrEqual(r,e.appRoot)||e.extensionPackageRoots.some(e=>isPathInsideOrEqual(r,e.sourceRoot))?rewritePathWithinAppRoot({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,path:r,runtimeAppRoot:e.runtimeAppRoot}):rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}if(typeof r==`string`&&n===`sourceRoot`){t[n]=rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}t[n]=rewriteManifestRoots({appRoot:e.appRoot,extensionPackageRoots:e.extensionPackageRoots,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:r})}return t}function rewritePathWithinSourceRoot(e){return isPathInsideOrEqual(e.path,e.sourceRoot)?toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:e.path,sourceRoot:e.sourceRoot}):e.path}function rewritePathWithinAppRoot(e){if(!isPathInsideOrEqual(e.path,e.appRoot)){let t=e.extensionPackageRoots.find(t=>isPathInsideOrEqual(e.path,t.sourceRoot));return t===void 0?e.path:join(e.runtimeAppRoot,`node_modules`,t.packageName,relative(t.sourceRoot,e.path))}let t=relative(e.appRoot,e.path);return t.length===0?e.runtimeAppRoot:join(e.runtimeAppRoot,t)}async function writeDevelopmentRuntimeArtifactsPointer(e){let t=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),n={appRoot:e.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:e.snapshot.runtimeAppRoot,snapshotRoot:e.snapshot.snapshotRoot,version:2};await writeDevelopmentRuntimeArtifactsPointerSource(t,`${JSON.stringify(n,null,2)}\n`)}async function writeDevelopmentRuntimeArtifactsPointerSource(e,t){let n=`${e}.${randomUUID()}.tmp`;await mkdir(dirname(e),{recursive:!0}),await writeFile(n,t);try{await renameWithTransientBusyRetry(n,e)}catch(e){throw await rm(n,{force:!0}).catch(()=>{}),e}}async function readOptionalFile(e){try{return await readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}async function rollbackFailedActivation(e){let t=await restoreDevelopmentRuntimeArtifactsActivation(e);return t===void 0?e.cause:AggregateError([e.cause,t],`Development runtime activation and rollback failed.`,{cause:e.cause})}async function restoreDevelopmentRuntimeArtifactsActivation(e){let t=(await Promise.allSettled([e.previousPointerSource===void 0?rm(e.pointerPath,{force:!0}):writeDevelopmentRuntimeArtifactsPointerSource(e.pointerPath,e.previousPointerSource),rm(e.markerPath,{force:!0})])).flatMap(e=>e.status===`rejected`?[e.reason]:[]);if(t.length!==0)return AggregateError(t,`Failed to restore development runtime activation.`)}async function validateSnapshotCompiledManifestRoots(e){let t=collectManifestRootPaths(JSON.parse(await readFile(e.manifestPath,`utf8`)));for(let n of t)if(!isPathInsideOrEqual(n,e.snapshotSourceRoot))throw Error(`Development runtime snapshot manifest root "${n}" is outside runtime snapshot source root "${e.snapshotSourceRoot}".`)}function collectManifestRootPaths(e){if(Array.isArray(e))return e.flatMap(e=>collectManifestRootPaths(e));if(typeof e!=`object`||!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if((n===`appRoot`||n===`agentRoot`)&&typeof r==`string`){t.push(r);continue}t.push(...collectManifestRootPaths(r))}return t}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,readActiveDevelopmentRuntimeArtifactsSnapshot,readDevelopmentRuntimeArtifactsRevision,readDevelopmentRuntimeArtifactsSnapshotRoot,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot};
@@ -0,0 +1,13 @@
1
+ export interface DevelopmentGenerationMetadata {
2
+ readonly runtimeAppRoot: string;
3
+ }
4
+ export declare function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(appRoot: string): string;
5
+ export declare function listDevelopmentGenerationIds(appRoot: string): Promise<string[]>;
6
+ export declare function readDevelopmentGenerationMetadata(appRoot: string, generationId: string): Promise<{
7
+ readonly kind: "ready";
8
+ readonly metadata: DevelopmentGenerationMetadata;
9
+ } | {
10
+ readonly kind: "missing";
11
+ } | {
12
+ readonly kind: "invalid";
13
+ }>;
@@ -0,0 +1 @@
1
+ import{readFile,readdir}from"node:fs/promises";import{basename,join}from"node:path";function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e){return join(e,`.eve`,`dev-runtime`,`snapshots`)}async function listDevelopmentGenerationIds(e){try{return(await readdir(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e),{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return[];throw e}}async function readDevelopmentGenerationMetadata(e,t){if(!t||t===`.`||t===`..`||basename(t)!==t)throw Error(`Workflow run references an invalid development generation.`);let n;try{n=await readFile(join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e),t,`generation.json`),`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{kind:`missing`};throw e}let r;try{r=JSON.parse(n)}catch{return{kind:`invalid`}}return typeof r!=`object`||!r||Array.isArray(r)||!(`runtimeAppRoot`in r)||typeof r.runtimeAppRoot!=`string`||r.runtimeAppRoot.length===0?{kind:`invalid`}:{kind:`ready`,metadata:{runtimeAppRoot:r.runtimeAppRoot}}}export{listDevelopmentGenerationIds,readDevelopmentGenerationMetadata,resolveDevelopmentRuntimeArtifactsSnapshotsDirectory};
@@ -11,9 +11,11 @@ export declare function stageDevelopmentGeneration(compileResult: CompileAgentRe
11
11
  export declare function activateDevelopmentGeneration(input: {
12
12
  readonly appRoot: string;
13
13
  readonly generation: DevelopmentGeneration;
14
+ readonly onRuntimePruned?: () => Promise<void>;
14
15
  }): Promise<void>;
15
16
  export declare function activateDevelopmentGenerationTransaction(input: {
16
17
  readonly appRoot: string;
17
18
  readonly generation: DevelopmentGeneration;
19
+ readonly onRuntimePruned?: () => Promise<void>;
18
20
  }): Promise<DevelopmentRuntimeArtifactsActivation>;
19
21
  export declare function discardDevelopmentGeneration(generation: DevelopmentGeneration): Promise<void>;
@@ -1 +1 @@
1
- import{rm}from"node:fs/promises";import{prepareAuthoredRuntimeModules}from"#internal/authored-runtime-modules.js";import{writeMaterializedAuthoredModules}from"#internal/materialized-authored-modules.js";import{activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,stageDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts.js";const developmentGenerationPruneStates=new Map;async function stageDevelopmentGeneration(e){let[t,n]=await Promise.allSettled([prepareAuthoredRuntimeModules({appRoot:e.project.appRoot,manifest:e.manifest,moduleMapPath:e.paths.moduleMapPath}),stageDevelopmentRuntimeArtifactsSnapshot(e)]);if(n.status===`rejected`)throw t.status===`rejected`?AggregateError([t.reason,n.reason],`Failed to stage development generation.`):n.reason;let r=n.value;try{if(t.status===`rejected`)throw t.reason;let e=t.value,n=await writeMaterializedAuthoredModules({prepared:e,runtimeAppRoot:r.runtimeAppRoot});return e.workflowSourceFingerprint===void 0?{...r,authoredWorkflowModules:e.authoredWorkflowModules,fingerprint:n.fingerprint}:{...r,authoredWorkflowModules:e.authoredWorkflowModules,fingerprint:n.fingerprint,workflowSourceFingerprint:e.workflowSourceFingerprint}}catch(e){try{await rm(r.snapshotRoot,{force:!0,recursive:!0})}catch(t){throw AggregateError([e,t],`Failed to materialize and discard development generation "${r.snapshotRoot}".`)}throw e}}async function activateDevelopmentGeneration(e){(await activateDevelopmentGenerationTransaction(e)).commit()}async function activateDevelopmentGenerationTransaction(e){let t=await activateDevelopmentRuntimeArtifactsSnapshotTransaction({appRoot:e.appRoot,snapshot:e.generation}),n=!1;return{commit(){n||(n=!0,t.commit(),requestDevelopmentGenerationPrune(e.appRoot))},async rollback(){n||(n=!0,await t.rollback())}}}async function discardDevelopmentGeneration(e){await rm(e.snapshotRoot,{force:!0,recursive:!0})}function requestDevelopmentGenerationPrune(e){let t=developmentGenerationPruneStates.get(e)??{requested:!1,running:void 0};developmentGenerationPruneStates.set(e,t),t.requested=!0,t.running===void 0&&startDevelopmentGenerationPruning(e,t)}function startDevelopmentGenerationPruning(e,t){t.running=(async()=>{for(;t.requested;)t.requested=!1,await pruneDevelopmentRuntimeArtifactsSnapshots({appRoot:e})})().catch(e=>{console.warn(`[eve:dev] failed to prune runtime generations: ${String(e)}`)}).finally(()=>{t.running=void 0,t.requested?startDevelopmentGenerationPruning(e,t):developmentGenerationPruneStates.delete(e)})}export{activateDevelopmentGeneration,activateDevelopmentGenerationTransaction,discardDevelopmentGeneration,stageDevelopmentGeneration};
1
+ import{rm}from"node:fs/promises";import{prepareAuthoredRuntimeModules}from"#internal/authored-runtime-modules.js";import{writeMaterializedAuthoredModules}from"#internal/materialized-authored-modules.js";import{activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,stageDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts.js";const developmentGenerationPruneStates=new Map;async function stageDevelopmentGeneration(e){let[t,n]=await Promise.allSettled([prepareAuthoredRuntimeModules({appRoot:e.project.appRoot,manifest:e.manifest,moduleMapPath:e.paths.moduleMapPath}),stageDevelopmentRuntimeArtifactsSnapshot(e)]);if(n.status===`rejected`)throw t.status===`rejected`?AggregateError([t.reason,n.reason],`Failed to stage development generation.`):n.reason;let r=n.value;try{if(t.status===`rejected`)throw t.reason;let e=t.value,n=await writeMaterializedAuthoredModules({prepared:e,runtimeAppRoot:r.runtimeAppRoot});return e.workflowSourceFingerprint===void 0?{...r,authoredWorkflowModules:e.authoredWorkflowModules,fingerprint:n.fingerprint}:{...r,authoredWorkflowModules:e.authoredWorkflowModules,fingerprint:n.fingerprint,workflowSourceFingerprint:e.workflowSourceFingerprint}}catch(e){try{await rm(r.snapshotRoot,{force:!0,recursive:!0})}catch(t){throw AggregateError([e,t],`Failed to materialize and discard development generation "${r.snapshotRoot}".`)}throw e}}async function activateDevelopmentGeneration(e){(await activateDevelopmentGenerationTransaction(e)).commit()}async function activateDevelopmentGenerationTransaction(e){let t=await activateDevelopmentRuntimeArtifactsSnapshotTransaction({appRoot:e.appRoot,snapshot:e.generation}),n=!1;return{commit(){n||(n=!0,t.commit(),requestDevelopmentGenerationPrune(e.appRoot,e.onRuntimePruned))},async rollback(){n||(n=!0,await t.rollback())}}}async function discardDevelopmentGeneration(e){await rm(e.snapshotRoot,{force:!0,recursive:!0})}function requestDevelopmentGenerationPrune(e,t){let n=developmentGenerationPruneStates.get(e)??{requested:!1,reconciliationPending:!1,running:void 0};developmentGenerationPruneStates.set(e,n),n.requested=!0,n.onRuntimePruned=t,n.running===void 0&&startDevelopmentGenerationPruning(e,n)}function startDevelopmentGenerationPruning(e,t){t.running=(async()=>{for(;t.requested;){t.requested=!1;let n=t.onRuntimePruned,r;try{r=await pruneDevelopmentRuntimeArtifactsSnapshots({appRoot:e})}catch(e){throw t.reconciliationPending||=n!==void 0,e}t.reconciliationPending||=r&&n!==void 0;try{t.reconciliationPending&&n!==void 0&&(await n(),t.reconciliationPending=!1)}catch(e){console.warn(`[eve:dev] failed to reconcile expired Workflow runs: ${String(e)}`)}}})().catch(e=>{console.warn(`[eve:dev] failed to prune runtime generations: ${String(e)}`)}).finally(()=>{t.running=void 0,t.requested?startDevelopmentGenerationPruning(e,t):t.reconciliationPending?t.onRuntimePruned=void 0:developmentGenerationPruneStates.delete(e)})}export{activateDevelopmentGeneration,activateDevelopmentGenerationTransaction,discardDevelopmentGeneration,stageDevelopmentGeneration};
@@ -1 +1 @@
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
+ import{readFile}from"node:fs/promises";import{isObject}from"#shared/guards.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.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};