eve 0.51.0 → 0.52.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 (462) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/src/channel/session.d.ts +2 -1
  3. package/dist/src/channel/session.js +1 -1
  4. package/dist/src/channel/types.d.ts +4 -1
  5. package/dist/src/chunks/{use-eve-agent-C3vUG5g2.js → use-eve-agent-3DZuvuWE.js} +17 -6
  6. package/dist/src/chunks/{use-eve-agent-B4xN7-fK.js → use-eve-agent-D7apPojZ.js} +17 -6
  7. package/dist/src/cli/agent-command.js +1 -1
  8. package/dist/src/cli/commands/agent-instructions.d.ts +3 -1
  9. package/dist/src/cli/commands/agent-instructions.js +1 -1
  10. package/dist/src/cli/commands/build.js +1 -1
  11. package/dist/src/cli/commands/deploy.js +1 -1
  12. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  13. package/dist/src/cli/commands/init-repl.js +1 -1
  14. package/dist/src/cli/commands/init.js +1 -1
  15. package/dist/src/cli/commands/integration-connect.js +1 -1
  16. package/dist/src/cli/commands/link.js +1 -1
  17. package/dist/src/cli/commands/preconditions.js +1 -1
  18. package/dist/src/cli/commands/register-project-commands.d.ts +1 -1
  19. package/dist/src/cli/commands/register-project-commands.js +1 -1
  20. package/dist/src/cli/commands/registry.js +1 -1
  21. package/dist/src/cli/dev/boot-progress.d.ts +3 -0
  22. package/dist/src/cli/dev/boot-progress.js +1 -0
  23. package/dist/src/cli/dev/environment.js +1 -1
  24. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  25. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  26. package/dist/src/cli/dev/tui/setup-commands.d.ts +3 -1
  27. package/dist/src/cli/dev/tui/setup-commands.js +1 -1
  28. package/dist/src/cli/run.d.ts +4 -0
  29. package/dist/src/cli/run.js +3 -3
  30. package/dist/src/cli/telemetry/command.d.ts +9 -0
  31. package/dist/src/cli/telemetry/command.js +1 -0
  32. package/dist/src/cli/telemetry/flush.d.ts +2 -0
  33. package/dist/src/cli/telemetry/flush.js +1 -0
  34. package/dist/src/cli/telemetry/identity.d.ts +13 -0
  35. package/dist/src/cli/telemetry/identity.js +1 -0
  36. package/dist/src/cli/telemetry/index.d.ts +25 -0
  37. package/dist/src/cli/telemetry/index.js +3 -0
  38. package/dist/src/cli/telemetry/preference.d.ts +9 -0
  39. package/dist/src/cli/telemetry/preference.js +1 -0
  40. package/dist/src/client/open-stream.js +1 -1
  41. package/dist/src/client/session-controls.d.ts +3 -0
  42. package/dist/src/client/session-controls.js +1 -1
  43. package/dist/src/client/session.d.ts +4 -1
  44. package/dist/src/client/types.d.ts +3 -2
  45. package/dist/src/compiled/.vendor-stamp.json +11 -11
  46. package/dist/src/compiled/@clack/core/LICENSE +9 -0
  47. package/dist/src/compiled/@clack/core/index.d.ts +363 -0
  48. package/dist/src/compiled/@clack/core/index.js +20 -0
  49. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  50. package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +1 -0
  51. package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +34 -92
  52. package/dist/src/compiled/@vercel/sandbox/api-client/base-client.d.ts +1 -1
  53. package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
  54. package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +13 -29
  55. package/dist/src/compiled/@vercel/sandbox/constants.d.ts +11 -1
  56. package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -3
  57. package/dist/src/compiled/@vercel/sandbox/index.js +9 -9
  58. package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +5 -6
  59. package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +79 -67
  60. package/dist/src/compiled/@vercel/sandbox/session.d.ts +5 -3
  61. package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +9 -0
  62. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-client.d.ts +86 -1
  63. package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +2 -0
  64. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/validators.d.ts +26 -1
  65. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/constants.d.ts +2 -2
  66. package/dist/src/compiled/@vercel/{sandbox → sandbox-drives}/drive.d.ts +10 -0
  67. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/index.d.ts +3 -2
  68. package/dist/src/compiled/@vercel/sandbox-drives/index.js +9 -0
  69. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox.d.ts +35 -6
  70. package/dist/src/compiled/@workflow/core/index.js +1 -1
  71. package/dist/src/compiled/@workflow/core/private.d.ts +2 -4
  72. package/dist/src/compiled/@workflow/core/private.js +1 -1
  73. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +9 -7
  74. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +13 -0
  75. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +54 -1
  76. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  77. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +7 -0
  78. package/dist/src/compiled/@workflow/core/serialization.d.ts +24 -2
  79. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  80. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  81. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
  82. package/dist/src/compiled/@workflow/errors/index.d.ts +19 -0
  83. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  84. package/dist/src/compiled/@workflow/world/analytics.d.ts +46 -2
  85. package/dist/src/compiled/@workflow/world/events.d.ts +26 -1
  86. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  87. package/dist/src/compiled/@workflow/world/runs.d.ts +2 -2
  88. package/dist/src/compiled/@workflow/world-local/index.js +3 -3
  89. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  90. package/dist/src/compiled/_chunks/node/{auth-BSKyPAEP.js → auth-Bx1Aoyfo.js} +1 -1
  91. package/dist/src/compiled/_chunks/node/{auth-YpKlwhP1.js → auth-CA8ZMfB8.js} +1 -1
  92. package/dist/src/compiled/_chunks/node/esm-CE0tAvRh.js +7 -0
  93. package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +1 -0
  94. package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +1 -0
  95. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BwAadFfB.js → attribute-changes-03lzo29R.js} +1 -1
  96. package/dist/src/compiled/_chunks/workflow/dist-BIdMK5N8.js +40 -0
  97. package/dist/src/compiled/_chunks/workflow/dist-DMQ3CtWt.js +3 -0
  98. package/dist/src/compiled/_chunks/workflow/frames-Boesh7kU.js +3 -0
  99. package/dist/src/compiled/_chunks/workflow/{private-CZFMABEf.js → private-CKx3PkSS.js} +1 -1
  100. package/dist/src/compiled/_chunks/workflow/{resume-hook-BToMtPbH.js → resume-hook-C6eL-S_T.js} +1 -1
  101. package/dist/src/compiled/_chunks/workflow/run-BV0S6Zc2.js +1 -0
  102. package/dist/src/compiled/_chunks/workflow/sleep-Bh3jP9ii.js +1 -0
  103. package/dist/src/compiled/_chunks/workflow/wait-until-l-cwfJvm.js +15 -0
  104. package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js} +1 -1
  105. package/dist/src/compiler/compile-from-memory.d.ts +1 -0
  106. package/dist/src/compiler/extension-compatibility.d.ts +38 -20
  107. package/dist/src/compiler/extension-compatibility.js +1 -1
  108. package/dist/src/compiler/manifest.d.ts +2 -2
  109. package/dist/src/compiler/manifest.js +1 -1
  110. package/dist/src/compiler/normalize-agent-config.js +1 -1
  111. package/dist/src/compiler/normalize-channel.js +1 -1
  112. package/dist/src/compiler/normalize-schedule.js +1 -1
  113. package/dist/src/compiler/normalize-tool.js +1 -1
  114. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  115. package/dist/src/discover/extensions.d.ts +2 -0
  116. package/dist/src/discover/extensions.js +1 -1
  117. package/dist/src/discover/filesystem.d.ts +1 -0
  118. package/dist/src/discover/filesystem.js +1 -1
  119. package/dist/src/discover/project.js +1 -1
  120. package/dist/src/evals/runner/execute-task.js +1 -1
  121. package/dist/src/evals/session-cleanup.d.ts +7 -0
  122. package/dist/src/evals/session-cleanup.js +1 -0
  123. package/dist/src/evals/session.d.ts +4 -0
  124. package/dist/src/evals/session.js +1 -1
  125. package/dist/src/eve-channel/index.js +1 -1
  126. package/dist/src/eve-channel/request.d.ts +1 -0
  127. package/dist/src/eve-channel/request.js +1 -1
  128. package/dist/src/execution/activity-collector.js +1 -1
  129. package/dist/src/execution/activity-work.d.ts +8 -0
  130. package/dist/src/execution/activity-work.js +1 -1
  131. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +6 -0
  132. package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -0
  133. package/dist/src/execution/continuation-conflict-step.js +1 -1
  134. package/dist/src/execution/coordination-dispatch-shared.d.ts +2 -2
  135. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  136. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  137. package/dist/src/execution/create-session-step.js +1 -1
  138. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -1
  139. package/dist/src/execution/inline-turn.d.ts +4 -2
  140. package/dist/src/execution/inline-turn.js +1 -1
  141. package/dist/src/execution/next-driver-action.d.ts +0 -3
  142. package/dist/src/execution/parked-delivery-wait.js +1 -1
  143. package/dist/src/execution/proxied-deliver-step.js +1 -1
  144. package/dist/src/execution/run-session-limits.d.ts +5 -5
  145. package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
  146. package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +4 -4
  147. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  148. package/dist/src/execution/session-activity-projection.js +1 -1
  149. package/dist/src/execution/session-activity.js +1 -1
  150. package/dist/src/execution/session-timeout-workflow.js +1 -1
  151. package/dist/src/execution/session.d.ts +1 -0
  152. package/dist/src/execution/session.js +1 -1
  153. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  154. package/dist/src/execution/tasks/child/steps.d.ts +19 -1
  155. package/dist/src/execution/tasks/child/steps.js +1 -1
  156. package/dist/src/execution/tasks/child/workflow.d.ts +2 -0
  157. package/dist/src/execution/tasks/child/workflow.js +1 -1
  158. package/dist/src/execution/tasks/parent/control-shared.js +1 -1
  159. package/dist/src/execution/tasks/parent/delegate.d.ts +2 -0
  160. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  161. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  162. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +26 -0
  163. package/dist/src/execution/tasks/parent/subagent-task-projection.js +1 -0
  164. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  165. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  166. package/dist/src/execution/tools/sleep-workflow.d.ts +3 -0
  167. package/dist/src/execution/tools/sleep-workflow.js +1 -0
  168. package/dist/src/execution/tools/sleep.d.ts +1 -5
  169. package/dist/src/execution/tools/sleep.js +1 -1
  170. package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
  171. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -7
  172. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  173. package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
  174. package/dist/src/execution/tools/workflow/ask.d.ts +1 -2
  175. package/dist/src/execution/tools/workflow/ask.js +1 -1
  176. package/dist/src/execution/tools/workflow/body.d.ts +6 -1
  177. package/dist/src/execution/tools/workflow/body.js +1 -1
  178. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  179. package/dist/src/execution/tools/workflow/messages.d.ts +9 -8
  180. package/dist/src/execution/tools/workflow/messages.js +1 -1
  181. package/dist/src/execution/tools/workflow/owner-inbox.d.ts +2 -2
  182. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  183. package/dist/src/execution/tools/workflow/owner.d.ts +5 -11
  184. package/dist/src/execution/tools/workflow/owner.js +1 -1
  185. package/dist/src/execution/tools/workflow/run-control.d.ts +0 -4
  186. package/dist/src/execution/tools/workflow/run-control.js +1 -1
  187. package/dist/src/execution/tools/workflow/start.d.ts +5 -14
  188. package/dist/src/execution/tools/workflow/start.js +1 -1
  189. package/dist/src/execution/tools/workflow/workflow.d.ts +1 -1
  190. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  191. package/dist/src/execution/turn-cancellation-control.d.ts +1 -0
  192. package/dist/src/execution/turn-cancellation-control.js +1 -1
  193. package/dist/src/execution/turn-cancellation-token.d.ts +1 -0
  194. package/dist/src/execution/turn-control-receiver.d.ts +3 -0
  195. package/dist/src/execution/turn-control-receiver.js +1 -1
  196. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  197. package/dist/src/execution/turn-dispatch.js +1 -1
  198. package/dist/src/execution/turn-workflow-tool-run.d.ts +2 -8
  199. package/dist/src/execution/turn-workflow-tool-run.js +1 -1
  200. package/dist/src/execution/turn-workflow.d.ts +1 -0
  201. package/dist/src/execution/turn-workflow.js +1 -1
  202. package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
  203. package/dist/src/execution/wire/session-inbox-contract.js +1 -1
  204. package/dist/src/execution/wire/session-inbox-encoder.d.ts +10 -2
  205. package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
  206. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  207. package/dist/src/execution/wire/session-inbox-wire.js +1 -1
  208. package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +341 -0
  209. package/dist/src/execution/wire/session-inbox-wire.v5.js +1 -0
  210. package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +3 -0
  211. package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +1 -0
  212. package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +341 -0
  213. package/dist/src/execution/wire/session-inbox-wire.v6.js +1 -0
  214. package/dist/src/execution/workflow-entry.js +1 -1
  215. package/dist/src/execution/workflow-runtime.js +1 -1
  216. package/dist/src/execution/workflow-steps.js +1 -1
  217. package/dist/src/harness/emission-state.js +1 -1
  218. package/dist/src/harness/session-limit-continuation.d.ts +5 -5
  219. package/dist/src/harness/session-limit-continuation.js +1 -1
  220. package/dist/src/harness/session-limit-enforcement.d.ts +4 -4
  221. package/dist/src/harness/session-limit-enforcement.js +1 -1
  222. package/dist/src/harness/session-usage-limits.d.ts +48 -0
  223. package/dist/src/harness/session-usage-limits.js +1 -0
  224. package/dist/src/harness/tool-loop.js +2 -2
  225. package/dist/src/harness/turn-client-context.d.ts +9 -0
  226. package/dist/src/harness/turn-client-context.js +1 -0
  227. package/dist/src/harness/turn-tag-state.d.ts +17 -20
  228. package/dist/src/harness/turn-tag-state.js +1 -1
  229. package/dist/src/harness/types.d.ts +5 -0
  230. package/dist/src/harness/workflow-tool-runs.d.ts +0 -1
  231. package/dist/src/harness/workflow-tool-runs.js +1 -1
  232. package/dist/src/internal/application/build-output-environment.d.ts +1 -0
  233. package/dist/src/internal/application/build-output-environment.js +1 -1
  234. package/dist/src/internal/application/package.js +1 -1
  235. package/dist/src/internal/application/paths.js +1 -1
  236. package/dist/src/internal/authored-definition/core.js +1 -1
  237. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  238. package/dist/src/internal/eve-project-root.d.ts +8 -0
  239. package/dist/src/internal/eve-project-root.js +1 -0
  240. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  241. package/dist/src/internal/mcp/streamable-http-server.d.ts +29 -1
  242. package/dist/src/internal/mcp/streamable-http-server.js +1 -1
  243. package/dist/src/internal/nitro/host/build-application.js +1 -1
  244. package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -0
  245. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  246. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  247. package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
  248. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  249. package/dist/src/internal/project-context.d.ts +13 -8
  250. package/dist/src/internal/project-context.js +1 -1
  251. package/dist/src/internal/vercel/build-agent-workspace.d.ts +1 -1
  252. package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
  253. package/dist/src/internal/vercel/eve-service-contribution.d.ts +1 -0
  254. package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
  255. package/dist/src/internal/workflow/reference.d.ts +2 -0
  256. package/dist/src/internal/workflow/reference.js +1 -0
  257. package/dist/src/internal/workflow/runtime.d.ts +6 -0
  258. package/dist/src/internal/workflow/runtime.js +1 -1
  259. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +1 -3
  260. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  261. package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +1 -11
  262. package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -1
  263. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  264. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  265. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -3
  266. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  267. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +1 -1
  268. package/dist/src/internal/workflow-bundle/workflow-transformer.js +2 -2
  269. package/dist/src/protocol/message.d.ts +3 -2
  270. package/dist/src/public/channels/mcp.js +1 -1
  271. package/dist/src/public/channels/slack/activity-plan.d.ts +4 -0
  272. package/dist/src/public/channels/slack/activity-plan.js +1 -0
  273. package/dist/src/public/channels/slack/activity.d.ts +45 -2
  274. package/dist/src/public/channels/slack/activity.js +2 -1
  275. package/dist/src/public/channels/slack/index.d.ts +1 -1
  276. package/dist/src/public/channels/slack/index.js +1 -1
  277. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  278. package/dist/src/public/memory/index.js +1 -1
  279. package/dist/src/public/models/openai/chatgpt/model.js +2 -2
  280. package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
  281. package/dist/src/public/nuxt/index.js +1 -1
  282. package/dist/src/public/nuxt/module.d.ts +3 -2
  283. package/dist/src/public/nuxt/module.js +1 -1
  284. package/dist/src/public/sandbox/vercel-sandbox.d.ts +9 -5
  285. package/dist/src/public/sandbox/vercel.d.ts +1 -1
  286. package/dist/src/public/sandbox/vercel.js +1 -1
  287. package/dist/src/public/tools/index.d.ts +3 -1
  288. package/dist/src/public/tools/index.js +1 -1
  289. package/dist/src/runtime/resolve-agent.js +1 -1
  290. package/dist/src/runtime/subagents/workflow.js +1 -1
  291. package/dist/src/self-modification/agent.d.ts +22 -0
  292. package/dist/src/self-modification/agent.js +1 -0
  293. package/dist/src/self-modification/extension/classify-registry-item.d.ts +19 -0
  294. package/dist/src/self-modification/extension/classify-registry-item.js +1 -0
  295. package/dist/src/self-modification/extension/eve-add.d.ts +56 -0
  296. package/dist/src/self-modification/extension/eve-add.js +2 -0
  297. package/dist/src/self-modification/extension/extension.d.ts +2 -0
  298. package/dist/src/self-modification/extension/extension.js +1 -0
  299. package/dist/src/self-modification/extension/instructions.d.ts +4 -0
  300. package/dist/src/self-modification/extension/instructions.js +23 -0
  301. package/dist/src/self-modification/extension/source-lock.d.ts +2 -0
  302. package/dist/src/self-modification/extension/source-lock.js +1 -0
  303. package/dist/src/self-modification/extension/tools/edit_file.d.ts +16 -0
  304. package/dist/src/self-modification/extension/tools/edit_file.js +1 -0
  305. package/dist/src/self-modification/extension/tools/registry_add.d.ts +52 -0
  306. package/dist/src/self-modification/extension/tools/registry_add.js +1 -0
  307. package/dist/src/self-modification/extension/tools/search_models.d.ts +22 -0
  308. package/dist/src/self-modification/extension/tools/search_models.js +1 -0
  309. package/dist/src/self-modification/extension/tools/search_registry.d.ts +103 -0
  310. package/dist/src/self-modification/extension/tools/search_registry.js +1 -0
  311. package/dist/src/self-modification/filesystem.d.ts +6 -0
  312. package/dist/src/self-modification/filesystem.js +1 -0
  313. package/dist/src/self-modification/sandbox.d.ts +2 -0
  314. package/dist/src/self-modification/sandbox.js +1 -0
  315. package/dist/src/services/dev-client/target.d.ts +3 -1
  316. package/dist/src/setup/boxes/select-model.d.ts +3 -21
  317. package/dist/src/setup/boxes/select-model.js +1 -1
  318. package/dist/src/setup/cli/prompt-ui.js +4 -4
  319. package/dist/src/setup/cli/select-component.d.ts +1 -1
  320. package/dist/src/setup/cli/select-component.js +1 -1
  321. package/dist/src/setup/flows/model.d.ts +3 -0
  322. package/dist/src/setup/flows/model.js +1 -1
  323. package/dist/src/setup/prompter.js +1 -1
  324. package/dist/src/setup/scaffold/create/project.js +1 -1
  325. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  326. package/dist/src/shared/action-types.d.ts +35 -22
  327. package/dist/src/shared/action-types.js +1 -1
  328. package/dist/src/shared/agent-definition.d.ts +13 -0
  329. package/dist/src/shared/agent-turn-outcome.d.ts +2 -0
  330. package/dist/src/shared/agent-turn-outcome.js +1 -1
  331. package/dist/src/shared/extension-package-contract.d.ts +2 -0
  332. package/dist/src/shared/extension-package-contract.js +1 -1
  333. package/dist/src/shared/gateway-model-catalog.d.ts +21 -0
  334. package/dist/src/shared/gateway-model-catalog.js +1 -0
  335. package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
  336. package/dist/src/shared/token-usage.d.ts +11 -15
  337. package/dist/src/shared/token-usage.js +1 -1
  338. package/dist/src/shared/workflow-tool-context.d.ts +2 -0
  339. package/dist/src/shared/workflow-tool-context.js +1 -0
  340. package/dist/src/subagents/callback-route.js +1 -1
  341. package/dist/src/subagents/event-proxy-step.js +1 -1
  342. package/dist/src/subagents/start-remote.js +1 -1
  343. package/dist/src/subagents/token-budget.js +1 -1
  344. package/dist/src/svelte/index.js +1 -1
  345. package/dist/src/svelte/use-eve-agent.js +1 -1
  346. package/dist/src/tasks/types.d.ts +18 -1
  347. package/dist/src/tasks/types.js +1 -1
  348. package/dist/src/tools/behavior.d.ts +5 -0
  349. package/dist/src/tools/definition.d.ts +16 -12
  350. package/dist/src/tools/definition.js +1 -1
  351. package/dist/src/tools/dynamic.d.ts +2 -2
  352. package/dist/src/tools/provided/sleep.d.ts +4 -4
  353. package/dist/src/tools/provided/sleep.js +1 -1
  354. package/dist/src/tools/task.d.ts +28 -80
  355. package/dist/src/tools/task.js +1 -1
  356. package/dist/src/tools/workflow-definition.d.ts +60 -0
  357. package/dist/src/tools/workflow-definition.js +1 -0
  358. package/dist/src/vue/index.js +1 -1
  359. package/dist/src/vue/use-eve-agent.js +1 -1
  360. package/docs/agent-config.md +24 -19
  361. package/docs/channels/eve.mdx +1 -1
  362. package/docs/channels/mcp.mdx +25 -3
  363. package/docs/concepts/built-in-tools.md +1 -1
  364. package/docs/concepts/execution-model-and-durability.mdx +13 -2
  365. package/docs/concepts/sessions-runs-and-streaming.md +9 -1
  366. package/docs/guides/client/messages.mdx +1 -1
  367. package/docs/guides/client/streaming.mdx +1 -1
  368. package/docs/guides/deployment/vercel.mdx +3 -1
  369. package/docs/guides/frontend/overview.mdx +1 -1
  370. package/docs/memory/overview.mdx +41 -12
  371. package/docs/reference/cli.md +31 -33
  372. package/docs/reference/meta.json +1 -4
  373. package/docs/reference/telemetry.md +56 -0
  374. package/docs/reference/typescript-api.md +38 -35
  375. package/docs/sandbox.mdx +1 -1
  376. package/docs/tools/overview.mdx +59 -18
  377. package/docs/tools/workflows.mdx +146 -70
  378. package/package.json +38 -19
  379. package/dist/src/compiled/@vercel/sandbox-delete/api-client/index.d.ts +0 -2
  380. package/dist/src/compiled/@vercel/sandbox-delete/index.js +0 -9
  381. package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +0 -201
  382. package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +0 -8
  383. package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +0 -5
  384. package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +0 -1456
  385. package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +0 -29
  386. package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +0 -39
  387. package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +0 -66
  388. package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +0 -2
  389. package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +0 -899
  390. package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +0 -10
  391. package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +0 -15
  392. package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +0 -18
  393. package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +0 -6
  394. package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +0 -111
  395. package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +0 -28
  396. package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +0 -40
  397. package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +0 -292
  398. package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +0 -5
  399. package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +0 -116
  400. package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +0 -258
  401. package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +0 -12
  402. package/dist/src/compiled/@vercel/sandbox-stable/index.js +0 -1
  403. package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +0 -169
  404. package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +0 -55
  405. package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +0 -212
  406. package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +0 -1216
  407. package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +0 -433
  408. package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +0 -229
  409. package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +0 -21
  410. package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +0 -16
  411. package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +0 -15
  412. package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +0 -11
  413. package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +0 -11
  414. package/dist/src/compiled/_chunks/node/decode_jwt-Col8JOnf.js +0 -7
  415. package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +0 -1
  416. package/dist/src/compiled/_chunks/node/version-DH6yRy-M.js +0 -1
  417. package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +0 -40
  418. package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +0 -3
  419. package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +0 -3
  420. package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +0 -1
  421. package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +0 -1
  422. package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +0 -15
  423. package/dist/src/harness/session-token-limits.d.ts +0 -41
  424. package/dist/src/harness/session-token-limits.js +0 -1
  425. package/dist/src/harness/turn-sleep.d.ts +0 -12
  426. package/dist/src/harness/turn-sleep.js +0 -1
  427. package/dist/src/internal/agent-workspace.d.ts +0 -15
  428. package/dist/src/internal/agent-workspace.js +0 -1
  429. package/dist/src/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +0 -16
  430. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js +0 -1
  431. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js +0 -1
  432. package/dist/src/node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js +0 -1
  433. package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js +0 -5
  434. package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js +0 -1
  435. package/dist/src/public/workflow/index.d.ts +0 -5
  436. package/dist/src/public/workflow/index.js +0 -1
  437. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/LICENSE +0 -0
  438. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_async-retry.d.ts +0 -0
  439. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_workflow-serde.d.ts +0 -0
  440. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-error.d.ts +0 -0
  441. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/base-client.d.ts +0 -0
  442. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/file-writer.d.ts +0 -0
  443. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/with-retry.d.ts +0 -0
  444. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/error.d.ts +0 -0
  445. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/file.d.ts +0 -0
  446. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/index.d.ts +0 -0
  447. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/oauth.d.ts +0 -0
  448. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/poll-for-token.d.ts +0 -0
  449. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/project.d.ts +0 -0
  450. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/command.d.ts +0 -0
  451. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/execution-context.d.ts +0 -0
  452. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/filesystem.d.ts +0 -0
  453. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/network-policy.d.ts +0 -0
  454. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/proxy.d.ts +0 -0
  455. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox-user.d.ts +0 -0
  456. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/session.d.ts +0 -0
  457. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/snapshot.d.ts +0 -0
  458. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/get-credentials.d.ts +0 -0
  459. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/paginator.d.ts +0 -0
  460. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/resolveSignal.d.ts +0 -0
  461. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/sandbox-snapshot.d.ts +0 -0
  462. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/types.d.ts +0 -0
@@ -1 +1 @@
1
- import{TextPrompt as ht,isCancel as q,settings as h}from"../node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js";import{WizardCancelledError}from"./step.js";import{initialQuitGuardState,quitHintNote,reduceQuitGuard}from"./quit-guard.js";import pc from"#compiled/picocolors/index.js";import{cornerFor,createRailLog,formatPromptCancellation,formatPromptHeader,formatPromptOpener,formatPromptOutro,formatPromptSubmission,formatRailLine,railFor,runSelectComponent}from"#setup/cli/index.js";var PlannerNavigationError=class extends Error{direction;values;constructor(e,t){super(`Planner requested ${e} navigation.`),this.name=`PlannerNavigationError`,this.direction=e,this.values=t}};function guardCancel(e){if(q(e))throw process.stdout.write(formatPromptCancellation(`Setup cancelled.`,pc)),new WizardCancelledError;return e}let escapeCancelDisabled=!1;function disableEscapeCancel(){escapeCancelDisabled||=(h.aliases.delete(`escape`),!0)}function attachQuitGuard(e){let t=initialQuitGuardState;return e.on(`key`,(n,r)=>{let{state:i,action:a}=reduceQuitGuard(t,r?.name===`escape`?{type:`escape`}:{type:`other-key`});t=i,a===`quit`&&(e.state=`cancel`)}),{note:()=>quitHintNote(t,pc)}}function toPromptState(e){return e}function railForState(e){return railFor(toPromptState(e),pc)}function cornerForState(e){return cornerFor(toPromptState(e),pc)}function header(e,t,n){return formatPromptHeader(toPromptState(e),t,{colors:pc,leadingRail:n===0?`white`:`green`})}const REDACTED_DISPLAY=`••••••••`;function textPrompt(t,n){let r,i=new ht({validate:n.validate?e=>n.validate?.(e??``):void 0,placeholder:n.placeholder,defaultValue:n.defaultValue,initialValue:n.defaultValue,render(){let e=header(this.state,n.message,t),i=n.placeholder?pc.inverse(n.placeholder[0])+pc.dim(n.placeholder.slice(1)):pc.inverse(pc.hidden(`_`)),a=this.value?`•`.repeat(this.value.length):i,o=i;switch(n.mask?o=a:this.value&&(o=this.userInputWithCursor),this.state){case`error`:return`${e.trim()}\n${railForState(this.state)} ${o}\n${cornerForState(this.state)} ${pc.red(this.error)}\n`;case`submit`:{let e=this.value||n.placeholder||``;return n.mask&&(e=this.value?REDACTED_DISPLAY:n.placeholder??``),formatPromptSubmission(this.state,n.message,e,{colors:pc,leadingRail:t===0?`white`:`green`})}case`cancel`:return`${e}${railForState(this.state)} ${pc.strikethrough(pc.dim(n.mask&&this.value?REDACTED_DISPLAY:this.value??``))}${this.value?.trim()?`\n${railForState(this.state)}`:``}`;default:return`${e}${railForState(this.state)} ${o}\n${cornerForState(this.state)}${cornerNote(r?.note())}\n`}}});return r=attachQuitGuard(i),i.prompt()}function cornerNote(e){return e?` ${e}`:``}function createPrompter(){disableEscapeCancel();let e=0,t=createRailLog({colors:pc,output:process.stdout});function printNotices(e){for(let n of e??[])n.tone===`success`?t.success(n.text):n.tone===`warning`?t.warning(n.text):n.tone===`error`?t.error(n.text):t.message(n.text)}return{async text(n){t.settle(),printNotices(n.notices);let r=guardCancel(await textPrompt(e,n));return e+=1,r??``},async password(n){t.settle();let r=guardCancel(await textPrompt(e,{message:n.message,mask:!0,validate:n.validate}));return e+=1,r??``},async select(n){t.settle(),printNotices(n.notices),n.description!==void 0&&process.stdout.write(formatRailLine(pc.dim(n.description),pc,process.stdout));for(let{label:e,value:t}of n.metadata??[])process.stdout.write(formatRailLine(`${pc.dim(`${e}:`)} ${t}`,pc,process.stdout));let r=guardCancel(await runSelectComponent({message:n.message,options:n.options,multiple:n.multiple===!0,search:n.search??!1,searchAction:n.multiple===!0?void 0:n.searchAction,required:n.required??!1,placeholder:n.placeholder,defaultValue:n.multiple===!0?void 0:n.initialValue,initialValues:n.multiple===!0?n.initialValues:void 0,leadingRail:e===0?`white`:`green`,attachGuard:e=>attachQuitGuard(e)}));return e+=1,r},async acknowledge(e){t.settle(),process.stdout.write(formatRailLine(pc.bold(e.message),pc,process.stdout));for(let t of e.lines??[])process.stdout.write(formatRailLine(pc.dim(t),pc,process.stdout))},note(e,n,r){t.settle();let i=r?.tone===`success`?pc.green:pc.red;n&&process.stdout.write(formatRailLine(i(pc.bold(n)),pc,process.stdout)),process.stdout.write(formatRailLine(i(e),pc,process.stdout))},intro(e,n=`Production-grade agent framework.`){t.settle(),process.stdout.write(formatPromptOpener(e,n,pc))},outro(e){t.settle(),process.stdout.write(formatPromptOutro(e,pc))},log:t}}export{PlannerNavigationError,createPrompter};
1
+ import{WizardCancelledError}from"./step.js";import{initialQuitGuardState,quitHintNote,reduceQuitGuard}from"./quit-guard.js";import pc from"#compiled/picocolors/index.js";import{cornerFor,createRailLog,formatPromptCancellation,formatPromptHeader,formatPromptOpener,formatPromptOutro,formatPromptSubmission,formatRailLine,railFor,runSelectComponent}from"#setup/cli/index.js";import{TextPrompt,isCancel,settings}from"#compiled/@clack/core/index.js";var PlannerNavigationError=class extends Error{direction;values;constructor(e,t){super(`Planner requested ${e} navigation.`),this.name=`PlannerNavigationError`,this.direction=e,this.values=t}};function guardCancel(t){if(isCancel(t))throw process.stdout.write(formatPromptCancellation(`Setup cancelled.`,pc)),new WizardCancelledError;return t}let escapeCancelDisabled=!1;function disableEscapeCancel(){escapeCancelDisabled||=(settings.aliases.delete(`escape`),!0)}function attachQuitGuard(e){let a=initialQuitGuardState;return e.on(`key`,(t,n)=>{let{state:i,action:o}=reduceQuitGuard(a,n?.name===`escape`?{type:`escape`}:{type:`other-key`});a=i,o===`quit`&&(e.state=`cancel`)}),{note:()=>quitHintNote(a,pc)}}function toPromptState(e){return e}function railForState(e){return railFor(toPromptState(e),pc)}function cornerForState(e){return cornerFor(toPromptState(e),pc)}function header(e,t,n){return formatPromptHeader(toPromptState(e),t,{colors:pc,leadingRail:n===0?`white`:`green`})}const REDACTED_DISPLAY=`••••••••`;function textPrompt(e,t){let n,r=new TextPrompt({validate:t.validate?e=>t.validate?.(e??``):void 0,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.defaultValue,render(){let r=header(this.state,t.message,e),a=t.placeholder?pc.inverse(t.placeholder[0])+pc.dim(t.placeholder.slice(1)):pc.inverse(pc.hidden(`_`)),o=this.value?`•`.repeat(this.value.length):a,s=a;switch(t.mask?s=o:this.value&&(s=this.userInputWithCursor),this.state){case`error`:return`${r.trim()}\n${railForState(this.state)} ${s}\n${cornerForState(this.state)} ${pc.red(this.error)}\n`;case`submit`:{let n=this.value||t.placeholder||``;return t.mask&&(n=this.value?REDACTED_DISPLAY:t.placeholder??``),formatPromptSubmission(this.state,t.message,n,{colors:pc,leadingRail:e===0?`white`:`green`})}case`cancel`:return`${r}${railForState(this.state)} ${pc.strikethrough(pc.dim(t.mask&&this.value?REDACTED_DISPLAY:this.value??``))}${this.value?.trim()?`\n${railForState(this.state)}`:``}`;default:return`${r}${railForState(this.state)} ${s}\n${cornerForState(this.state)}${cornerNote(n?.note())}\n`}}});return n=attachQuitGuard(r),r.prompt()}function cornerNote(e){return e?` ${e}`:``}function createPrompter(){disableEscapeCancel();let e=0,t=createRailLog({colors:pc,output:process.stdout});function printNotices(e){for(let n of e??[])n.tone===`success`?t.success(n.text):n.tone===`warning`?t.warning(n.text):n.tone===`error`?t.error(n.text):t.message(n.text)}return{async text(n){t.settle(),printNotices(n.notices);let r=guardCancel(await textPrompt(e,n));return e+=1,r??``},async password(n){t.settle();let r=guardCancel(await textPrompt(e,{message:n.message,mask:!0,validate:n.validate}));return e+=1,r??``},async select(n){t.settle(),printNotices(n.notices),n.description!==void 0&&process.stdout.write(formatRailLine(pc.dim(n.description),pc,process.stdout));for(let{label:e,value:t}of n.metadata??[])process.stdout.write(formatRailLine(`${pc.dim(`${e}:`)} ${t}`,pc,process.stdout));let r=guardCancel(await runSelectComponent({message:n.message,options:n.options,multiple:n.multiple===!0,search:n.search??!1,searchAction:n.multiple===!0?void 0:n.searchAction,required:n.required??!1,placeholder:n.placeholder,defaultValue:n.multiple===!0?void 0:n.initialValue,initialValues:n.multiple===!0?n.initialValues:void 0,leadingRail:e===0?`white`:`green`,attachGuard:e=>attachQuitGuard(e)}));return e+=1,r},async acknowledge(e){t.settle(),process.stdout.write(formatRailLine(pc.bold(e.message),pc,process.stdout));for(let t of e.lines??[])process.stdout.write(formatRailLine(pc.dim(t),pc,process.stdout))},note(e,n,r){t.settle();let a=r?.tone===`success`?pc.green:pc.red;n&&process.stdout.write(formatRailLine(a(pc.bold(n)),pc,process.stdout)),process.stdout.write(formatRailLine(a(e),pc,process.stdout))},intro(e,n=`Production-grade agent framework.`){t.settle(),process.stdout.write(formatPromptOpener(e,n,pc))},outro(e){t.settle(),process.stdout.write(formatPromptOutro(e,pc))},log:t}}export{PlannerNavigationError,createPrompter};
@@ -1,4 +1,4 @@
1
- import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.82`,DEFAULT_CONNECT_PACKAGE_VERSION=`1.0.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.51.0`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{"agent/agent.ts":renderAgentTemplate(e,t),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,n){let r=parseChatGptModelSelection(e);return r===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(r)}),\n${reasoningTemplateLine(n)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,n){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(n.model)!==void 0?renderAgentTemplate(n.model,n.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,n.appName).replaceAll(`__EVE_INIT_MODEL__`,n.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(n.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(n.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(n.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,n.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,n.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,n.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,n.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,n.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,n.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
1
+ import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.82`,DEFAULT_CONNECT_PACKAGE_VERSION=`1.0.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.52.0`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{"agent/agent.ts":renderAgentTemplate(e,t),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,n){let r=parseChatGptModelSelection(e);return r===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(r)}),\n${reasoningTemplateLine(n)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,n){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(n.model)!==void 0?renderAgentTemplate(n.model,n.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,n.appName).replaceAll(`__EVE_INIT_MODEL__`,n.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(n.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(n.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(n.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(n.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,n.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,n.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,n.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,n.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,n.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,n.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
2
2
 
3
3
  export default defineAgent({
4
4
  model: "__EVE_INIT_MODEL__",
@@ -1 +1 @@
1
- import{DEFAULT_EVE_PACKAGE_CONTRACT}from"../create/project.js";function resolveWebPackageVersions(e,t){return{evePackage:e?.evePackage??DEFAULT_EVE_PACKAGE_CONTRACT,aiPackageVersion:e?.aiPackageVersion??`^7.0.82`,betterAuthPackageVersion:e?.betterAuthPackageVersion??`1.6.26`,nextPackageVersion:e?.nextPackageVersion??(t===`sign-in-with-vercel`?`16.3.0`:`16.3.0-preview.6`),reactPackageVersion:e?.reactPackageVersion??`19.2.6`,reactDomPackageVersion:e?.reactDomPackageVersion??`19.2.6`,streamdownPackageVersion:e?.streamdownPackageVersion??`2.5.0`,zodPackageVersion:e?.zodPackageVersion??`4.5.4`,typesReactPackageVersion:e?.typesReactPackageVersion??`19.2.15`,typesReactDomPackageVersion:e?.typesReactDomPackageVersion??`19.2.3`}}export{resolveWebPackageVersions};
1
+ import{DEFAULT_EVE_PACKAGE_CONTRACT}from"../create/project.js";function resolveWebPackageVersions(e,t){return{evePackage:e?.evePackage??DEFAULT_EVE_PACKAGE_CONTRACT,aiPackageVersion:e?.aiPackageVersion??`^7.0.82`,betterAuthPackageVersion:e?.betterAuthPackageVersion??`1.6.26`,nextPackageVersion:e?.nextPackageVersion??(t===`sign-in-with-vercel`?`16.3.0`:`16.3.4`),reactPackageVersion:e?.reactPackageVersion??`19.2.6`,reactDomPackageVersion:e?.reactDomPackageVersion??`19.2.6`,streamdownPackageVersion:e?.streamdownPackageVersion??`2.5.0`,zodPackageVersion:e?.zodPackageVersion??`4.5.4`,typesReactPackageVersion:e?.typesReactPackageVersion??`19.2.15`,typesReactDomPackageVersion:e?.typesReactDomPackageVersion??`19.2.3`}}export{resolveWebPackageVersions};
@@ -11,7 +11,7 @@ export type RuntimeToolCallActionRequest = z.infer<typeof runtimeToolCallActionR
11
11
  */
12
12
  export declare const runtimeToolCallActionRequestSchema: z.ZodObject<{
13
13
  callId: z.ZodString;
14
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
14
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
15
15
  kind: z.ZodLiteral<"tool-call">;
16
16
  toolName: z.ZodString;
17
17
  }, z.core.$strict>;
@@ -19,7 +19,7 @@ export type RuntimeSubagentCallActionRequest = z.infer<typeof runtimeSubagentCal
19
19
  declare const runtimeSubagentCallActionRequestSchema: z.ZodObject<{
20
20
  callId: z.ZodString;
21
21
  description: z.ZodString;
22
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
22
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
23
23
  kind: z.ZodLiteral<"subagent-call">;
24
24
  name: z.ZodString;
25
25
  nodeId: z.ZodString;
@@ -29,7 +29,7 @@ export type RuntimeRemoteAgentCallActionRequest = z.infer<typeof runtimeRemoteAg
29
29
  export declare const runtimeRemoteAgentCallActionRequestSchema: z.ZodObject<{
30
30
  callId: z.ZodString;
31
31
  description: z.ZodString;
32
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
32
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
33
33
  kind: z.ZodLiteral<"remote-agent-call">;
34
34
  name: z.ZodString;
35
35
  nodeId: z.ZodString;
@@ -38,7 +38,7 @@ export declare const runtimeRemoteAgentCallActionRequestSchema: z.ZodObject<{
38
38
  export type RuntimeWorkflowToolCallActionRequest = z.infer<typeof runtimeWorkflowToolCallActionRequestSchema>;
39
39
  declare const runtimeWorkflowToolCallActionRequestSchema: z.ZodObject<{
40
40
  callId: z.ZodString;
41
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
41
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
42
42
  kind: z.ZodLiteral<"workflow-tool-call">;
43
43
  toolName: z.ZodString;
44
44
  workflowId: z.ZodString;
@@ -56,7 +56,7 @@ export type RuntimeSubagentDispatchRequest = z.infer<typeof runtimeSubagentDispa
56
56
  declare const runtimeSubagentDispatchRequestSchema: z.ZodObject<{
57
57
  callId: z.ZodString;
58
58
  description: z.ZodString;
59
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
59
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
60
60
  kind: z.ZodLiteral<"subagent-call">;
61
61
  name: z.ZodString;
62
62
  nodeId: z.ZodString;
@@ -72,7 +72,7 @@ export type RuntimeRemoteAgentDispatchRequest = z.infer<typeof runtimeRemoteAgen
72
72
  export declare const runtimeRemoteAgentDispatchRequestSchema: z.ZodObject<{
73
73
  callId: z.ZodString;
74
74
  description: z.ZodString;
75
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
75
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
76
76
  kind: z.ZodLiteral<"remote-agent-call">;
77
77
  name: z.ZodString;
78
78
  nodeId: z.ZodString;
@@ -89,8 +89,8 @@ export declare const runtimeRemoteAgentDispatchRequestSchema: z.ZodObject<{
89
89
  export type RuntimeWorkflowTaskRequest = z.infer<typeof runtimeWorkflowTaskRequestSchema>;
90
90
  export declare const runtimeWorkflowTaskRequestSchema: z.ZodObject<{
91
91
  callId: z.ZodString;
92
- executeInput: z.ZodOptional<z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>>;
93
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
92
+ executeInput: z.ZodOptional<z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>>;
93
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
94
94
  kind: z.ZodLiteral<"workflow-task">;
95
95
  nodeId: z.ZodOptional<z.ZodString>;
96
96
  resultKind: z.ZodOptional<z.ZodEnum<{
@@ -109,7 +109,7 @@ type RuntimeLoadSkillActionRequest = z.infer<typeof runtimeLoadSkillActionReques
109
109
  */
110
110
  declare const runtimeLoadSkillActionRequestSchema: z.ZodObject<{
111
111
  callId: z.ZodString;
112
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
112
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
113
113
  kind: z.ZodLiteral<"load-skill">;
114
114
  }, z.core.$strict>;
115
115
  /**
@@ -127,12 +127,12 @@ export type RuntimeAgentDispatchRequest = RuntimeRemoteAgentDispatchRequest | Ru
127
127
  */
128
128
  export declare const runtimeActionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
129
129
  callId: z.ZodString;
130
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
130
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
131
131
  kind: z.ZodLiteral<"load-skill">;
132
132
  }, z.core.$strict>, z.ZodObject<{
133
133
  callId: z.ZodString;
134
134
  description: z.ZodString;
135
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
135
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
136
136
  kind: z.ZodLiteral<"remote-agent-call">;
137
137
  name: z.ZodString;
138
138
  nodeId: z.ZodString;
@@ -140,19 +140,19 @@ export declare const runtimeActionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodO
140
140
  }, z.core.$strict>, z.ZodObject<{
141
141
  callId: z.ZodString;
142
142
  description: z.ZodString;
143
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
143
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
144
144
  kind: z.ZodLiteral<"subagent-call">;
145
145
  name: z.ZodString;
146
146
  nodeId: z.ZodString;
147
147
  subagentName: z.ZodString;
148
148
  }, z.core.$strict>, z.ZodObject<{
149
149
  callId: z.ZodString;
150
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
150
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
151
151
  kind: z.ZodLiteral<"tool-call">;
152
152
  toolName: z.ZodString;
153
153
  }, z.core.$strict>, z.ZodObject<{
154
154
  callId: z.ZodString;
155
- input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonObject, unknown>>;
155
+ input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>;
156
156
  kind: z.ZodLiteral<"workflow-tool-call">;
157
157
  toolName: z.ZodString;
158
158
  workflowId: z.ZodString;
@@ -168,7 +168,7 @@ declare const runtimeToolResultActionResultSchema: z.ZodObject<{
168
168
  callId: z.ZodString;
169
169
  isError: z.ZodOptional<z.ZodBoolean>;
170
170
  kind: z.ZodLiteral<"tool-result">;
171
- output: z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>;
171
+ output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>;
172
172
  toolName: z.ZodString;
173
173
  }, z.core.$strict>;
174
174
  /**
@@ -197,10 +197,21 @@ declare const runtimeToolResultActionResultSchema: z.ZodObject<{
197
197
  * the child settles. Stream consumers use the marker to keep child lifecycle
198
198
  * open while still recording the receipt as the tool result.
199
199
  */
200
- export type RuntimeSubagentChildResult = z.infer<typeof runtimeSubagentChildResultSchema>;
201
- /**
202
- * Zod schema for one child-produced subagent result.
203
- */
200
+ export interface RuntimeSubagentChildResult {
201
+ readonly backgroundTask?: {
202
+ readonly status: "working";
203
+ readonly taskId: string;
204
+ };
205
+ readonly callId: string;
206
+ readonly isError?: boolean;
207
+ readonly kind: "subagent-result";
208
+ readonly origin: "child";
209
+ readonly outcome: import("#shared/agent-turn-outcome.js").AgentTurnOutcome;
210
+ readonly output: import("#shared/json.js").JsonValue;
211
+ readonly subagentName: string;
212
+ readonly usage?: import("#shared/token-usage.js").TokenUsage;
213
+ }
214
+ /** Token-only subagent result schema retained for historical wire formats. */
204
215
  export declare const runtimeSubagentChildResultSchema: z.ZodObject<{
205
216
  backgroundTask: z.ZodOptional<z.ZodObject<{
206
217
  status: z.ZodLiteral<"working">;
@@ -211,7 +222,7 @@ export declare const runtimeSubagentChildResultSchema: z.ZodObject<{
211
222
  kind: z.ZodLiteral<"subagent-result">;
212
223
  origin: z.ZodLiteral<"child">;
213
224
  outcome: z.ZodType<import("#shared/agent-turn-outcome.js").AgentTurnOutcome, unknown, z.core.$ZodTypeInternals<import("#shared/agent-turn-outcome.js").AgentTurnOutcome, unknown>>;
214
- output: z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>;
225
+ output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>;
215
226
  subagentName: z.ZodString;
216
227
  usage: z.ZodOptional<z.ZodObject<{
217
228
  cacheReadTokens: z.ZodNumber;
@@ -220,6 +231,8 @@ export declare const runtimeSubagentChildResultSchema: z.ZodObject<{
220
231
  outputTokens: z.ZodNumber;
221
232
  }, z.core.$strip>>;
222
233
  }, z.core.$strict>;
234
+ /** Current subagent result schema, including optional model token cost. */
235
+ export declare const runtimeSubagentChildResultWithCostSchema: z.ZodType<RuntimeSubagentChildResult>;
223
236
  /**
224
237
  * Subagent failure synthesized on the parent side when no child produced a
225
238
  * result: dispatch rejections, start failures, and agentId-continuation
@@ -235,7 +248,7 @@ declare const runtimeSubagentDispatchFailureSchema: z.ZodObject<{
235
248
  isError: z.ZodLiteral<true>;
236
249
  kind: z.ZodLiteral<"subagent-result">;
237
250
  origin: z.ZodLiteral<"dispatch">;
238
- output: z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>;
251
+ output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>;
239
252
  subagentName: z.ZodString;
240
253
  }, z.core.$strict>;
241
254
  /**
@@ -259,7 +272,7 @@ declare const runtimeLoadSkillActionResultSchema: z.ZodObject<{
259
272
  callId: z.ZodString;
260
273
  isError: z.ZodOptional<z.ZodBoolean>;
261
274
  kind: z.ZodLiteral<"load-skill-result">;
262
- output: z.ZodType<import("./json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./json.ts").JsonValue, unknown>>;
275
+ output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>;
263
276
  name: z.ZodOptional<z.ZodString>;
264
277
  }, z.core.$strict>;
265
278
  /**
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{tokenUsageSchema}from"#shared/token-usage.js";import{agentTurnOutcomeSchema}from"#shared/agent-turn-outcome.js";const runtimeToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`tool-call`),toolName:z.string()}).strict(),runtimeSubagentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict(),runtimeRemoteAgentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`workflow-tool-call`),toolName:z.string(),workflowId:z.string()}).strict();z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict();const runtimeRemoteAgentDispatchRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowTaskRequestSchema=z.object({callId:z.string(),executeInput:jsonValueSchema.optional(),input:jsonObjectSchema,kind:z.literal(`workflow-task`),nodeId:z.string().optional(),resultKind:z.enum([`subagent`,`tool`]).optional(),toolName:z.string(),workflowId:z.string()}).strict(),runtimeLoadSkillActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`load-skill`)}).strict(),runtimeActionRequestSchema=z.discriminatedUnion(`kind`,[runtimeLoadSkillActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeSubagentCallActionRequestSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowToolCallActionRequestSchema]);z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`tool-result`),output:jsonValueSchema,toolName:z.string()}).strict();const runtimeSubagentChildResultSchema=z.object({backgroundTask:z.strictObject({status:z.literal(`working`),taskId:z.string()}).optional(),callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),origin:z.literal(`child`),outcome:agentTurnOutcomeSchema,output:jsonValueSchema,subagentName:z.string(),usage:tokenUsageSchema.optional()}).strict();z.object({callId:z.string(),isError:z.literal(!0),kind:z.literal(`subagent-result`),origin:z.literal(`dispatch`),output:jsonValueSchema,subagentName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`load-skill-result`),output:jsonValueSchema,name:z.string().optional()}).strict();export{runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeRemoteAgentDispatchRequestSchema,runtimeSubagentChildResultSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowTaskRequestSchema};
1
+ import{z}from"#compiled/zod/index.js";import{jsonObjectSchema,jsonValueSchema}from"#shared/json-schemas.js";import{tokenUsageSchema,tokenUsageWithCostSchema}from"#shared/token-usage.js";import{agentTurnOutcomeSchema,agentTurnOutcomeWithCostSchema}from"#shared/agent-turn-outcome.js";const runtimeToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`tool-call`),toolName:z.string()}).strict(),runtimeSubagentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict(),runtimeRemoteAgentCallActionRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowToolCallActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`workflow-tool-call`),toolName:z.string(),workflowId:z.string()}).strict();z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`subagent-call`),name:z.string(),nodeId:z.string(),subagentName:z.string()}).strict();const runtimeRemoteAgentDispatchRequestSchema=z.object({callId:z.string(),description:z.string(),input:jsonObjectSchema,kind:z.literal(`remote-agent-call`),name:z.string(),nodeId:z.string(),remoteAgentName:z.string()}).strict(),runtimeWorkflowTaskRequestSchema=z.object({callId:z.string(),executeInput:jsonValueSchema.optional(),input:jsonObjectSchema,kind:z.literal(`workflow-task`),nodeId:z.string().optional(),resultKind:z.enum([`subagent`,`tool`]).optional(),toolName:z.string(),workflowId:z.string()}).strict(),runtimeLoadSkillActionRequestSchema=z.object({callId:z.string(),input:jsonObjectSchema,kind:z.literal(`load-skill`)}).strict(),runtimeActionRequestSchema=z.discriminatedUnion(`kind`,[runtimeLoadSkillActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeSubagentCallActionRequestSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowToolCallActionRequestSchema]);z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`tool-result`),output:jsonValueSchema,toolName:z.string()}).strict();const runtimeSubagentChildResultFields={backgroundTask:z.strictObject({status:z.literal(`working`),taskId:z.string()}).optional(),callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),origin:z.literal(`child`),output:jsonValueSchema,subagentName:z.string()},runtimeSubagentChildResultSchema=z.object({backgroundTask:z.strictObject({status:z.literal(`working`),taskId:z.string()}).optional(),callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`subagent-result`),origin:z.literal(`child`),outcome:agentTurnOutcomeSchema,output:jsonValueSchema,subagentName:z.string(),usage:tokenUsageSchema.optional()}).strict(),runtimeSubagentChildResultWithCostSchema=z.object({...runtimeSubagentChildResultFields,outcome:agentTurnOutcomeWithCostSchema,usage:tokenUsageWithCostSchema.optional()}).strict();z.object({callId:z.string(),isError:z.literal(!0),kind:z.literal(`subagent-result`),origin:z.literal(`dispatch`),output:jsonValueSchema,subagentName:z.string()}).strict(),z.object({callId:z.string(),isError:z.boolean().optional(),kind:z.literal(`load-skill-result`),output:jsonValueSchema,name:z.string().optional()}).strict();export{runtimeActionRequestSchema,runtimeRemoteAgentCallActionRequestSchema,runtimeRemoteAgentDispatchRequestSchema,runtimeSubagentChildResultSchema,runtimeSubagentChildResultWithCostSchema,runtimeToolCallActionRequestSchema,runtimeWorkflowTaskRequestSchema};
@@ -157,6 +157,19 @@ export interface AgentLimitsDefinition {
157
157
  * inherit the parent's remaining output quota when the parent has one.
158
158
  */
159
159
  readonly maxOutputTokensPerSession?: number | false;
160
+ /**
161
+ * Maximum provider-reported model token cost accumulated by one durable
162
+ * session, in US dollars.
163
+ *
164
+ * eve checks this before starting each model call. The model call that
165
+ * crosses the limit is allowed to finish because providers report cost only
166
+ * after the call completes; later model calls in the same session are
167
+ * blocked.
168
+ *
169
+ * `false` disables the limit. Unset by default; delegated subagent sessions
170
+ * inherit the parent's remaining token-cost quota when the parent has one.
171
+ */
172
+ readonly maxTokenCostUsdPerSession?: number | false;
160
173
  }
161
174
  /**
162
175
  * Experimental, opt-in agent capabilities authored in `agent.ts`.
@@ -45,3 +45,5 @@ export type AgentTurnOutcome = {
45
45
  * callbacks). Local notification paths construct the type directly.
46
46
  */
47
47
  export declare const agentTurnOutcomeSchema: z.ZodType<AgentTurnOutcome>;
48
+ /** Current outcome schema, including optional model token cost. */
49
+ export declare const agentTurnOutcomeWithCostSchema: z.ZodType<AgentTurnOutcome>;
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{tokenUsageSchema}from"#shared/token-usage.js";const jsonValueSchema=z.lazy(()=>z.union([z.null(),z.boolean(),z.number(),z.string(),z.array(jsonValueSchema),z.record(z.string(),jsonValueSchema)])),agentTurnResultSchema=z.discriminatedUnion(`kind`,[z.strictObject({kind:z.literal(`succeeded`),output:jsonValueSchema}),z.strictObject({error:jsonValueSchema,kind:z.literal(`failed`)}),z.strictObject({kind:z.literal(`cancelled`)})]),agentTurnOutcomeSchema=z.discriminatedUnion(`kind`,[z.strictObject({kind:z.literal(`parked`),result:agentTurnResultSchema,usageDelta:tokenUsageSchema}),z.strictObject({kind:z.literal(`terminal`),result:agentTurnResultSchema,usageDelta:tokenUsageSchema})]);export{agentTurnOutcomeSchema};
1
+ import{z}from"#compiled/zod/index.js";import{tokenUsageSchema,tokenUsageWithCostSchema}from"#shared/token-usage.js";const jsonValueSchema=z.lazy(()=>z.union([z.null(),z.boolean(),z.number(),z.string(),z.array(jsonValueSchema),z.record(z.string(),jsonValueSchema)])),agentTurnResultSchema=z.discriminatedUnion(`kind`,[z.strictObject({kind:z.literal(`succeeded`),output:jsonValueSchema}),z.strictObject({error:jsonValueSchema,kind:z.literal(`failed`)}),z.strictObject({kind:z.literal(`cancelled`)})]),agentTurnOutcomeSchema=z.discriminatedUnion(`kind`,[z.strictObject({kind:z.literal(`parked`),result:agentTurnResultSchema,usageDelta:tokenUsageSchema}),z.strictObject({kind:z.literal(`terminal`),result:agentTurnResultSchema,usageDelta:tokenUsageSchema})]),agentTurnOutcomeWithCostSchema=z.discriminatedUnion(`kind`,[z.strictObject({kind:z.literal(`parked`),result:agentTurnResultSchema,usageDelta:tokenUsageWithCostSchema}),z.strictObject({kind:z.literal(`terminal`),result:agentTurnResultSchema,usageDelta:tokenUsageWithCostSchema})]);export{agentTurnOutcomeSchema,agentTurnOutcomeWithCostSchema};
@@ -11,3 +11,5 @@ export interface ExtensionPackageRoots {
11
11
  }
12
12
  /** Parses the strict `package.json#eve.extension` object contract. */
13
13
  export declare function parseExtensionPackageRoots(value: unknown): ExtensionPackageRoots | null;
14
+ /** Parses package-local extension distributions keyed by their export subpath. */
15
+ export declare function parseBuiltInExtensionPackageRoots(value: unknown, subpath: string): ExtensionPackageRoots | null;
@@ -1 +1 @@
1
- function parseExtensionPackageRoots(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(typeof t.dist!=`string`||t.dist.length===0)return null;let n=parseExternalDependencies(t.externalDependencies);if(n===null)return null;let r={dist:t.dist};return n!==void 0&&(r.externalDependencies=n),t.source===void 0?r:typeof t.source==`string`&&t.source.length>0?{...r,source:t.source}:null}function parseExternalDependencies(e){if(e===void 0)return;if(!Array.isArray(e))return null;let t=new Set;for(let n of e){if(typeof n!=`string`||n.length===0)return null;t.add(n)}return[...t]}export{parseExtensionPackageRoots};
1
+ function parseExtensionPackageRoots(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(typeof t.dist!=`string`||t.dist.length===0)return null;let n=parseExternalDependencies(t.externalDependencies);if(n===null)return null;let r={dist:t.dist};return n!==void 0&&(r.externalDependencies=n),t.source===void 0?r:typeof t.source==`string`&&t.source.length>0?{...r,source:t.source}:null}function parseBuiltInExtensionPackageRoots(e,t){return typeof e!=`object`||!e||Array.isArray(e)?null:parseExtensionPackageRoots(e[t])}function parseExternalDependencies(e){if(e===void 0)return;if(!Array.isArray(e))return null;let t=new Set;for(let n of e){if(typeof n!=`string`||n.length===0)return null;t.add(n)}return[...t]}export{parseBuiltInExtensionPackageRoots,parseExtensionPackageRoots};
@@ -0,0 +1,21 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ declare const gatewayCatalogModelSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ type: z.ZodString;
6
+ owned_by: z.ZodString;
7
+ released: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
8
+ tags: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodString>>>;
9
+ pricing: z.ZodCatch<z.ZodOptional<z.ZodObject<{
10
+ service_tiers: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
11
+ }, z.core.$strip>>>;
12
+ }, z.core.$strip>;
13
+ /** One model entry from the AI Gateway catalog response. */
14
+ export type GatewayCatalogModel = z.infer<typeof gatewayCatalogModelSchema>;
15
+ /**
16
+ * Validates a Gateway catalog response. A malformed payload throws, but a
17
+ * malformed entry is skipped so one experimental entry shape cannot discard
18
+ * the rest of the catalog.
19
+ */
20
+ export declare function parseGatewayModelCatalog(input: unknown): GatewayCatalogModel[];
21
+ export {};
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";const gatewayCatalogModelSchema=z.object({id:z.string(),name:z.string(),type:z.string(),owned_by:z.string(),released:z.number().finite().optional().catch(void 0),tags:z.array(z.string()).optional().catch(void 0),pricing:z.object({service_tiers:z.record(z.string(),z.unknown()).optional().catch(void 0)}).optional().catch(void 0)}),gatewayCatalogSchema=z.object({data:z.array(z.unknown())}).transform(({data:e})=>e.flatMap(e=>{let n=gatewayCatalogModelSchema.safeParse(e);return n.success?[n.data]:[]}));function parseGatewayModelCatalog(e){let t=gatewayCatalogSchema.safeParse(e);if(!t.success)throw Error(`AI Gateway returned an invalid model catalog.`);return t.data}export{parseGatewayModelCatalog};
@@ -1,4 +1,4 @@
1
- import type * as Vercel from "#compiled/@vercel/sandbox-stable/index.js";
1
+ import type * as Vercel from "#compiled/@vercel/sandbox/index.js";
2
2
  /**
3
3
  * Firewall network policy applied to a live sandbox session.
4
4
  *
@@ -1,22 +1,18 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
- /**
3
- * Provider-reported token usage totals.
4
- *
5
- * The single usage shape across eve: harness accumulation
6
- * (`turn-tag-state`), delegated subagent results, remote session
7
- * callbacks, and usage spans all carry this type.
8
- */
9
- export type TokenUsage = z.infer<typeof tokenUsageSchema>;
10
- /**
11
- * Zod schema for {@link TokenUsage}.
12
- *
13
- * Validates the `usage` field of remote session callbacks, which may come
14
- * from a callee on a different eve version — unknown keys are stripped
15
- * rather than rejected so a newer sender never voids the whole payload.
16
- */
2
+ /** Provider-reported token usage and optional model token cost totals. */
3
+ export type TokenUsage = z.infer<typeof tokenUsageWithCostSchema>;
4
+ /** Token-only schema retained for historical wire formats. */
17
5
  export declare const tokenUsageSchema: z.ZodObject<{
18
6
  cacheReadTokens: z.ZodNumber;
19
7
  cacheWriteTokens: z.ZodNumber;
20
8
  inputTokens: z.ZodNumber;
21
9
  outputTokens: z.ZodNumber;
22
10
  }, z.core.$strip>;
11
+ /** Current schema for provider-reported token usage and model token cost. */
12
+ export declare const tokenUsageWithCostSchema: z.ZodObject<{
13
+ cacheReadTokens: z.ZodNumber;
14
+ cacheWriteTokens: z.ZodNumber;
15
+ inputTokens: z.ZodNumber;
16
+ outputTokens: z.ZodNumber;
17
+ costUsd: z.ZodOptional<z.ZodNumber>;
18
+ }, z.core.$strip>;
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";const tokenUsageSchema=z.object({cacheReadTokens:z.number().int().nonnegative(),cacheWriteTokens:z.number().int().nonnegative(),inputTokens:z.number().int().nonnegative(),outputTokens:z.number().int().nonnegative()});export{tokenUsageSchema};
1
+ import{z}from"#compiled/zod/index.js";const tokenUsageSchema=z.object({cacheReadTokens:z.number().int().nonnegative(),cacheWriteTokens:z.number().int().nonnegative(),inputTokens:z.number().int().nonnegative(),outputTokens:z.number().int().nonnegative()}),tokenUsageWithCostSchema=tokenUsageSchema.extend({costUsd:z.number().finite().nonnegative().optional()});export{tokenUsageSchema,tokenUsageWithCostSchema};
@@ -0,0 +1,2 @@
1
+ export declare function workflowToolContextErrorMessage(helper: "agent" | "ask"): string;
2
+ export declare function workflowCallbackErrorMessage(kind: "channel" | "schedule"): string;
@@ -0,0 +1 @@
1
+ function workflowToolContextErrorMessage(e){return`ctx.${e}() requires a defineWorkflowTool() executor context. Call it inside the workflow tool body.`}function workflowCallbackErrorMessage(e){return`"use workflow" is not supported on ${e} callbacks. Use defineWorkflowTool() from "eve/tools" to author a workflow tool.`}export{workflowCallbackErrorMessage,workflowToolContextErrorMessage};
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{isInputRequest}from"#shared/input.js";import{jsonValueSchema}from"#shared/json-schemas.js";import{resumeHook}from"#internal/workflow/runtime.js";import{REMOTE_AGENT_FAILED}from"#subagents/agent-handle-errors.js";import{tokenUsageSchema}from"#shared/token-usage.js";import{agentTurnOutcomeSchema}from"#shared/agent-turn-outcome.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";const ZERO_TOKEN_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:0,outputTokens:0},eventCoordinateSchema=z.number().int().nonnegative(),authorizationChallengeSchema=z.looseObject({displayName:z.string().optional(),expiresAt:z.string().optional(),instructions:z.string().optional(),url:z.string().optional(),userCode:z.string().optional()}),taskInputEventSchema=z.looseObject({requests:z.array(jsonValueSchema.refine(isInputRequest)).min(1),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),taskAuthorizationEventSchema=z.discriminatedUnion(`type`,[z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),description:z.string(),name:z.string(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string(),webhookUrl:z.string().optional()}),type:z.literal(`authorization.required`)}),z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),name:z.string(),outcome:z.enum([`authorized`,`declined`,`failed`,`timed-out`]),reason:z.string().optional(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),type:z.literal(`authorization.completed`)})]),taskEventCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskInputEventSchema,kind:z.literal(`task.input-requested`),subagentName:z.string(),taskId:z.string()}),z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskAuthorizationEventSchema,kind:z.literal(`task.authorization`),subagentName:z.string(),taskId:z.string()})]),taskTurnStartedCallbackSchema=z.object({kind:z.literal(`turn.started`),sessionId:z.string().min(1),taskId:z.string().min(1),turnId:z.string().min(1)}),taskUpdateCallbackSchema=z.object({callId:z.string().min(1),kind:z.literal(`task.update`),message:z.string().min(1),taskId:z.string().min(1),updateEpoch:z.string().min(1),updateIndex:eventCoordinateSchema}),sessionResultCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string().min(1),kind:z.literal(`session.completed`),output:jsonValueSchema.optional(),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),error:jsonValueSchema.optional(),kind:z.literal(`session.failed`),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),kind:z.literal(`turn.completed`),outcome:agentTurnOutcomeSchema,output:jsonValueSchema.optional(),subagentName:z.string().min(1)}),z.object({callId:z.string().min(1),error:jsonValueSchema,kind:z.literal(`turn.failed`),outcome:agentTurnOutcomeSchema,subagentName:z.string().min(1)})]);async function handleSessionCallbackRequest(e,t){let n=t.params.token;if(typeof n!=`string`||n.length===0)return Response.json({error:`Missing callback token.`,ok:!1},{status:400});let i;try{i=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}let a=projectTaskEvent(i,n);if(a instanceof Response)return a;if(a!==void 0){try{await resumeHook(n,a)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let o=projectTaskUpdate(i,n);if(o instanceof Response)return o;if(o!==void 0){try{await resumeHook(n,o)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let s=rejectDirectTaskTurnStarted(i,n);if(s instanceof Response)return s;if(s!==void 0){try{await resumeHook(n,s)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let c=projectSessionCallbackResult(i);if(c instanceof Response)return c;try{await resumeHook(n,{kind:`runtime-action-result`,results:[c]})}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}function callbackKind(e){if(!(typeof e!=`object`||!e))return Reflect.get(e,`kind`)}function projectTaskEvent(e,t){let n=callbackKind(e);if(n!==`task.input-requested`&&n!==`task.authorization`)return;let r=taskEventCallbackSchema.safeParse(e);if(!r.success)return Response.json({error:`Invalid task event callback.`,ok:!1},{status:400});let i=r.data;if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,i.taskId);return e===void 0?Response.json({error:`Direct subagent task events are no longer accepted.`,ok:!1},{status:410}):e}return i.kind===`task.input-requested`?{callId:i.callId,childContinuationToken:i.childContinuationToken,childSessionId:i.childSessionId,event:i.event,kind:`subagent-input-request`,subagentName:i.subagentName}:{callId:i.callId,childSessionId:i.childSessionId,event:i.event,kind:`subagent-authorization-event`,subagentName:i.subagentName}}function rejectDirectTaskTurnStarted(e,t){if(callbackKind(e)!==`turn.started`)return;let n=taskTurnStartedCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task turn-start callback.`,ok:!1},{status:400});let r=rejectMismatchedTaskToken(t,n.data.taskId);return r===void 0?Response.json({error:`Direct subagent task turn callbacks are no longer accepted.`,ok:!1},{status:410}):r}function projectTaskUpdate(e,t){if(callbackKind(e)!==`task.update`)return;let n=taskUpdateCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task update callback.`,ok:!1},{status:400});if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,n.data.taskId);if(e!==void 0)return e}return{callId:n.data.callId,kind:`task-update`,message:n.data.message,updateEpoch:n.data.updateEpoch,updateIndex:n.data.updateIndex}}function rejectMismatchedTaskToken(e,t){return readTaskIdFromInboxToken(e)===t?void 0:Response.json({error:`Task callback token mismatch.`,ok:!1},{status:403})}function projectSessionCallbackResult(e){if(typeof e!=`object`||!e)return Response.json({error:`Expected a JSON object.`,ok:!1},{status:400});let t=callbackKind(e);if(t!==`session.completed`&&t!==`session.failed`&&t!==`turn.completed`&&t!==`turn.failed`)return Response.json({error:`Unsupported callback kind.`,ok:!1},{status:400});let n=sessionResultCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid session result callback.`,ok:!1},{status:400});let r=n.data;if(r.kind===`session.completed`){let e=r.output??``,t=parseCallbackUsage(r.usage),n={callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{kind:`succeeded`,output:e},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName};return t===void 0?n:{...n,usage:t}}if(r.kind===`session.failed`){let e=r.error===void 0?{code:REMOTE_AGENT_FAILED,message:`Remote agent failed.`}:r.error,t=parseCallbackUsage(r.usage);return{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{error:e,kind:`failed`},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName}}return r.kind===`turn.completed`?{callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.output??``,subagentName:r.subagentName,usage:r.outcome.usageDelta}:{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.error,subagentName:r.subagentName}}function parseCallbackUsage(e){if(e===void 0)return;let t=tokenUsageSchema.safeParse(e);return t.success?t.data:void 0}export{handleSessionCallbackRequest};
1
+ import{z}from"#compiled/zod/index.js";import{isInputRequest}from"#shared/input.js";import{jsonValueSchema}from"#shared/json-schemas.js";import{resumeHook}from"#internal/workflow/runtime.js";import{REMOTE_AGENT_FAILED}from"#subagents/agent-handle-errors.js";import{tokenUsageWithCostSchema}from"#shared/token-usage.js";import{agentTurnOutcomeWithCostSchema}from"#shared/agent-turn-outcome.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";const ZERO_TOKEN_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:0,outputTokens:0},eventCoordinateSchema=z.number().int().nonnegative(),authorizationChallengeSchema=z.looseObject({displayName:z.string().optional(),expiresAt:z.string().optional(),instructions:z.string().optional(),url:z.string().optional(),userCode:z.string().optional()}),taskInputEventSchema=z.looseObject({requests:z.array(jsonValueSchema.refine(isInputRequest)).min(1),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),taskAuthorizationEventSchema=z.discriminatedUnion(`type`,[z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),description:z.string(),name:z.string(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string(),webhookUrl:z.string().optional()}),type:z.literal(`authorization.required`)}),z.looseObject({data:z.looseObject({attemptId:z.string().optional(),authorization:authorizationChallengeSchema.optional(),name:z.string(),outcome:z.enum([`authorized`,`declined`,`failed`,`timed-out`]),reason:z.string().optional(),sequence:eventCoordinateSchema,stepIndex:eventCoordinateSchema,turnId:z.string()}),type:z.literal(`authorization.completed`)})]),taskEventCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskInputEventSchema,kind:z.literal(`task.input-requested`),subagentName:z.string(),taskId:z.string()}),z.object({callId:z.string(),childContinuationToken:z.string(),childSessionId:z.string(),event:taskAuthorizationEventSchema,kind:z.literal(`task.authorization`),subagentName:z.string(),taskId:z.string()})]),taskTurnStartedCallbackSchema=z.object({kind:z.literal(`turn.started`),sessionId:z.string().min(1),taskId:z.string().min(1),turnId:z.string().min(1)}),taskUpdateCallbackSchema=z.object({callId:z.string().min(1),kind:z.literal(`task.update`),message:z.string().min(1),taskId:z.string().min(1),updateEpoch:z.string().min(1),updateIndex:eventCoordinateSchema}),sessionResultCallbackSchema=z.discriminatedUnion(`kind`,[z.object({callId:z.string().min(1),kind:z.literal(`session.completed`),output:jsonValueSchema.optional(),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),error:jsonValueSchema.optional(),kind:z.literal(`session.failed`),subagentName:z.string().min(1),usage:z.unknown().optional()}),z.object({callId:z.string().min(1),kind:z.literal(`turn.completed`),outcome:agentTurnOutcomeWithCostSchema,output:jsonValueSchema.optional(),subagentName:z.string().min(1)}),z.object({callId:z.string().min(1),error:jsonValueSchema,kind:z.literal(`turn.failed`),outcome:agentTurnOutcomeWithCostSchema,subagentName:z.string().min(1)})]);async function handleSessionCallbackRequest(e,t){let n=t.params.token;if(typeof n!=`string`||n.length===0)return Response.json({error:`Missing callback token.`,ok:!1},{status:400});let i;try{i=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}let a=projectTaskEvent(i,n);if(a instanceof Response)return a;if(a!==void 0){try{await resumeHook(n,a)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let o=projectTaskUpdate(i,n);if(o instanceof Response)return o;if(o!==void 0){try{await resumeHook(n,o)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let s=rejectDirectTaskTurnStarted(i,n);if(s instanceof Response)return s;if(s!==void 0){try{await resumeHook(n,s)}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}let c=projectSessionCallbackResult(i);if(c instanceof Response)return c;try{await resumeHook(n,{kind:`runtime-action-result`,results:[c]})}catch{return Response.json({error:`Session callback not pending.`,ok:!1},{status:404})}return Response.json({ok:!0},{status:202})}function callbackKind(e){if(!(typeof e!=`object`||!e))return Reflect.get(e,`kind`)}function projectTaskEvent(e,t){let n=callbackKind(e);if(n!==`task.input-requested`&&n!==`task.authorization`)return;let r=taskEventCallbackSchema.safeParse(e);if(!r.success)return Response.json({error:`Invalid task event callback.`,ok:!1},{status:400});let i=r.data;if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,i.taskId);return e===void 0?Response.json({error:`Direct subagent task events are no longer accepted.`,ok:!1},{status:410}):e}return i.kind===`task.input-requested`?{callId:i.callId,childContinuationToken:i.childContinuationToken,childSessionId:i.childSessionId,event:i.event,kind:`subagent-input-request`,subagentName:i.subagentName}:{callId:i.callId,childSessionId:i.childSessionId,event:i.event,kind:`subagent-authorization-event`,subagentName:i.subagentName}}function rejectDirectTaskTurnStarted(e,t){if(callbackKind(e)!==`turn.started`)return;let n=taskTurnStartedCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task turn-start callback.`,ok:!1},{status:400});let r=rejectMismatchedTaskToken(t,n.data.taskId);return r===void 0?Response.json({error:`Direct subagent task turn callbacks are no longer accepted.`,ok:!1},{status:410}):r}function projectTaskUpdate(e,t){if(callbackKind(e)!==`task.update`)return;let n=taskUpdateCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid task update callback.`,ok:!1},{status:400});if(readTaskIdFromInboxToken(t)!==void 0){let e=rejectMismatchedTaskToken(t,n.data.taskId);if(e!==void 0)return e}return{callId:n.data.callId,kind:`task-update`,message:n.data.message,updateEpoch:n.data.updateEpoch,updateIndex:n.data.updateIndex}}function rejectMismatchedTaskToken(e,t){return readTaskIdFromInboxToken(e)===t?void 0:Response.json({error:`Task callback token mismatch.`,ok:!1},{status:403})}function projectSessionCallbackResult(e){if(typeof e!=`object`||!e)return Response.json({error:`Expected a JSON object.`,ok:!1},{status:400});let t=callbackKind(e);if(t!==`session.completed`&&t!==`session.failed`&&t!==`turn.completed`&&t!==`turn.failed`)return Response.json({error:`Unsupported callback kind.`,ok:!1},{status:400});let n=sessionResultCallbackSchema.safeParse(e);if(!n.success)return Response.json({error:`Invalid session result callback.`,ok:!1},{status:400});let r=n.data;if(r.kind===`session.completed`){let e=r.output??``,t=parseCallbackUsage(r.usage),n={callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{kind:`succeeded`,output:e},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName};return t===void 0?n:{...n,usage:t}}if(r.kind===`session.failed`){let e=r.error===void 0?{code:REMOTE_AGENT_FAILED,message:`Remote agent failed.`}:r.error,t=parseCallbackUsage(r.usage);return{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:{kind:`terminal`,result:{error:e,kind:`failed`},usageDelta:t??ZERO_TOKEN_USAGE},output:e,subagentName:r.subagentName}}return r.kind===`turn.completed`?{callId:r.callId,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.output??``,subagentName:r.subagentName,usage:r.outcome.usageDelta}:{callId:r.callId,isError:!0,kind:`subagent-result`,origin:`child`,outcome:r.outcome,output:r.error,subagentName:r.subagentName}}function parseCallbackUsage(e){if(e===void 0)return;let t=tokenUsageWithCostSchema.safeParse(e);return t.success?t.data:void 0}export{handleSessionCallbackRequest};
@@ -1 +1 @@
1
- import{callAdapterEventHandler}from"#channel/adapter.js";import{ModeKey}from"#context/keys.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{emitTurnEpilogue,getHarnessEmissionState,setHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{hydrateDurableSession}from"#execution/session.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{upsertProxyInputRequests}from"#harness/proxy-input-requests.js";import{emitProxiedInputRequest}from"#subagents/hitl-proxy.js";import{setChannelContext}from"#execution/channel-context.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";async function runProxySubagentEventStep(e){"use step";let t=await readDurableSession(e.sessionState),n=await deserializeContext(e.serializedContext);return emitProxiedSubagentEvent({answerHook:e.answerHook,ctx:n,durableSession:t,hookPayload:e.hookPayload,parentWritable:e.parentWritable})}async function emitRecordedTaskInputRequestStep(e){"use step";let t=await readDurableSession(e.sessionState);return await emitProxiedSubagentEvent({ctx:await deserializeContext(e.serializedContext),durableSession:t,hookPayload:{callId:e.request.taskId,childContinuationToken:e.request.replyTo,childSessionId:e.request.taskId,event:{requests:e.request.requests??[e.request.request],sequence:e.request.sequence,stepIndex:e.request.stepIndex,turnId:e.request.turnId},kind:`subagent-input-request`,subagentName:e.request.taskId},parentWritable:e.parentWritable,recordProxyInputRequests:!1})}async function emitProxiedSubagentEvent(i){let{ctx:a}=i,o=a.require(ChannelKey),s=resolveEffectiveAgentRuntime(a.require(BundleKey),a),c=hydrateDurableSession({compactionOverrides:{thresholdPercent:s.thresholdPercent},durable:i.durableSession,turnAgent:s.turnAgent}),l=buildAdapterContext(o,a),u=i.parentWritable.getWriter(),d,f;try{let emit=async t=>{let r=await callAdapterEventHandler(o,t,l);await u.write(encodeMessageStreamEvent(stampMessageStreamEvent(r)))},r=await withContextScope(a,c,async e=>{if(i.hookPayload.kind===`subagent-authorization-event`)return await emit(i.hookPayload.event),{result:void 0,session:await closeStandaloneAuthorizationEvent({emit,eventType:i.hookPayload.event.type,mode:a.require(ModeKey),session:e})};let n=await emitProxiedInputRequest({emit,hookPayload:i.hookPayload,mode:a.require(ModeKey),session:e});return{result:n.entries,session:n.session}});d=r.result,f=r.session}finally{u.releaseLock()}if(setChannelContext(a,{...o,state:{...l.state}}),i.recordProxyInputRequests!==!1&&d!==void 0&&i.hookPayload.kind===`subagent-input-request`){let e=i.answerHook;f=upsertProxyInputRequests({entries:e===void 0?d:d.map(([t,n])=>[t,{...n,answerHook:e}]),forChildContinuationToken:i.hookPayload.childContinuationToken,session:f})}let p=reconcileSessionContinuationToken(a,f);return{serializedContext:serializeContext(a),sessionState:createDurableSessionState({session:p})}}async function closeStandaloneAuthorizationEvent(e){if(e.mode!==`conversation`||e.eventType!==`authorization.required`&&e.eventType!==`authorization.completed`)return e.session;let t=getHarnessEmissionState(e.session.state),n=await emitTurnEpilogue(e.emit,t,e.mode);return setHarnessEmissionState(e.session,n)}export{emitProxiedSubagentEvent,emitRecordedTaskInputRequestStep,runProxySubagentEventStep};
1
+ import{callAdapterEventHandler}from"#channel/adapter.js";import{ModeKey}from"#context/keys.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{emitTurnEpilogue,getHarnessEmissionState,setHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{hydrateDurableSession}from"#execution/session.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{withContextScope}from"#context/run-step.js";import{upsertProxyInputRequests}from"#harness/proxy-input-requests.js";import{emitProxiedInputRequest}from"#subagents/hitl-proxy.js";import{setChannelContext}from"#execution/channel-context.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";async function runProxySubagentEventStep(e){"use step";let t=await readDurableSession(e.sessionState),n=await deserializeContext(e.serializedContext);return emitProxiedSubagentEvent({answerHook:e.answerHook,ctx:n,durableSession:t,hookPayload:e.hookPayload,parentWritable:e.parentWritable})}async function emitRecordedTaskInputRequestStep(e){"use step";let t=await readDurableSession(e.sessionState);return await emitProxiedSubagentEvent({ctx:await deserializeContext(e.serializedContext),durableSession:t,hookPayload:{callId:e.request.taskId,childContinuationToken:e.request.replyTo,childSessionId:e.request.taskId,event:{requests:e.request.requests??[e.request.request],sequence:e.request.sequence,stepIndex:e.request.stepIndex,turnId:e.request.turnId},kind:`subagent-input-request`,subagentName:e.request.taskId},parentWritable:e.parentWritable,recordProxyInputRequests:!1})}async function emitProxiedSubagentEvent(i){let{ctx:a}=i,o=a.require(ChannelKey),s=resolveEffectiveAgentRuntime(a.require(BundleKey),a),c=hydrateDurableSession({compactionOverrides:{thresholdPercent:s.thresholdPercent},durable:i.durableSession,turnAgent:s.turnAgent}),l=buildAdapterContext(o,a),u=i.parentWritable.getWriter(),d,f;try{let emit=async t=>{let r=await callAdapterEventHandler(o,t,l);await u.write(encodeMessageStreamEvent(stampMessageStreamEvent(r)))},r=await withContextScope(a,c,async e=>{if(i.hookPayload.kind===`subagent-authorization-event`)return await emit(i.hookPayload.event),{result:void 0,session:await closeStandaloneAuthorizationEvent({emit,eventType:i.hookPayload.event.type,mode:a.require(ModeKey),session:e})};let n=await emitProxiedInputRequest({emit,hookPayload:i.hookPayload,mode:a.require(ModeKey),session:e});return{result:n.entries,session:n.session}});d=r.result,f=r.session}finally{u.releaseLock()}if(setChannelContext(a,{...o,state:{...l.state}}),i.recordProxyInputRequests!==!1&&d!==void 0&&i.hookPayload.kind===`subagent-input-request`){let e=i.answerHook;f=upsertProxyInputRequests({entries:e===void 0?d:d.map(([t,n])=>[t,{...n,answerHook:e}]),forChildContinuationToken:i.hookPayload.childContinuationToken,session:f})}let p=reconcileSessionContinuationToken(a,f);return{serializedContext:serializeContext(a),sessionState:createDurableSessionState({session:p})}}async function closeStandaloneAuthorizationEvent(e){if(e.mode!==`conversation`||e.eventType!==`authorization.required`&&e.eventType!==`authorization.completed`)return e.session;let t=getHarnessEmissionState(e.session.state),n=await emitTurnEpilogue(e.emit,t,e.mode);return setHarnessEmissionState(e.session,n)}export{emitProxiedSubagentEvent,emitRecordedTaskInputRequestStep,runProxySubagentEventStep};
@@ -1 +1 @@
1
- import{createLogger,logError}from"#internal/logging.js";import{resolveRemoteAgentForAction,startRemoteAgentSession}from"#subagents/remote-dispatch.js";import{createRemoteAgentStartFailureResult}from"#execution/dispatch-action-failures.js";import{mintStartOperation}from"#execution/dispatch-start-operation.js";import{deriveChildActivityObserverConfig}from"#execution/activity-work.js";const log=createLogger(`execution.subagent-start-remote`);async function startRemoteSubagent(e){let{action:r}=e,i=deriveChildActivityObserverConfig({activityObserver:e.activityObserver,callId:r.callId,kind:`remote-agent`,name:r.remoteAgentName,parentSessionId:e.session.sessionId,parentTurnId:e.batchEvent.turnId}),a,o;try{if(e.callbackBaseUrl===void 0)throw Error(`Cannot dispatch remote agent without a callback base URL.`);a=e.callbackBaseUrl,o=resolveRemoteAgentForAction({dynamicRemoteAgent:e.dynamicRemoteAgent,nodeId:r.nodeId,remoteAgentName:r.remoteAgentName,registry:e.bundle.subagentRegistry.subagentsByNodeId})}catch(n){return logError(log,`remote agent start failed`,n,{remoteAgentName:r.remoteAgentName,nodeId:r.nodeId,callId:r.callId}),{kind:`error`,result:createRemoteAgentStartFailureResult({action:r,error:n}),session:e.currentSession}}let{operation:s}=mintStartOperation({callId:r.callId,name:r.remoteAgentName,nodeId:r.nodeId,parentSessionId:e.session.sessionId,parentTurnId:e.batchEvent.turnId}),c={resolverId:e.dynamicRemoteAgent===void 0?r.nodeId:e.dynamicRemoteAgent.credentialsStepId};try{let t=await startRemoteAgentSession({action:r,auth:e.auth,callbackBaseUrl:a,callbackToken:e.parentContinuationToken,originAudience:e.originAudience,initiatorAuth:e.initiatorAuth,operationId:s.id,parentTraceContext:e.parentTraceContext,activityObserver:i,remote:o,session:e.session,taskId:e.taskId});return{address:{callbackBaseUrl:a,credentialResolver:c,kind:`agent/remote`,sessionId:t.sessionId,url:o.url},callId:r.callId,kind:`called`,name:r.name,session:e.currentSession,toolName:r.remoteAgentName}}catch(n){return logError(log,`remote agent start failed`,n,{remoteAgentName:r.remoteAgentName,nodeId:r.nodeId,callId:r.callId}),{kind:`error`,result:createRemoteAgentStartFailureResult({action:r,error:n}),session:e.currentSession}}}export{startRemoteSubagent};
1
+ import{createLogger,logError}from"#internal/logging.js";import{resolveRemoteAgentForAction,startRemoteAgentSession}from"#subagents/remote-dispatch.js";import{deriveChildActivityObserverConfig}from"#execution/activity-work.js";import{createRemoteAgentStartFailureResult}from"#execution/dispatch-action-failures.js";import{mintStartOperation}from"#execution/dispatch-start-operation.js";const log=createLogger(`execution.subagent-start-remote`);async function startRemoteSubagent(e){let{action:r}=e,i=deriveChildActivityObserverConfig({activityObserver:e.activityObserver,callId:r.callId,kind:`remote-agent`,name:r.remoteAgentName,parentSessionId:e.session.sessionId,parentTurnId:e.batchEvent.turnId}),a,o;try{if(e.callbackBaseUrl===void 0)throw Error(`Cannot dispatch remote agent without a callback base URL.`);a=e.callbackBaseUrl,o=resolveRemoteAgentForAction({dynamicRemoteAgent:e.dynamicRemoteAgent,nodeId:r.nodeId,remoteAgentName:r.remoteAgentName,registry:e.bundle.subagentRegistry.subagentsByNodeId})}catch(n){return logError(log,`remote agent start failed`,n,{remoteAgentName:r.remoteAgentName,nodeId:r.nodeId,callId:r.callId}),{kind:`error`,result:createRemoteAgentStartFailureResult({action:r,error:n}),session:e.currentSession}}let{operation:s}=mintStartOperation({callId:r.callId,name:r.remoteAgentName,nodeId:r.nodeId,parentSessionId:e.session.sessionId,parentTurnId:e.batchEvent.turnId}),c={resolverId:e.dynamicRemoteAgent===void 0?r.nodeId:e.dynamicRemoteAgent.credentialsStepId};try{let t=await startRemoteAgentSession({action:r,auth:e.auth,callbackBaseUrl:a,callbackToken:e.parentContinuationToken,originAudience:e.originAudience,initiatorAuth:e.initiatorAuth,operationId:s.id,parentTraceContext:e.parentTraceContext,activityObserver:i,remote:o,session:e.session,taskId:e.taskId});return{address:{callbackBaseUrl:a,credentialResolver:c,kind:`agent/remote`,sessionId:t.sessionId,url:o.url},callId:r.callId,kind:`called`,name:r.name,session:e.currentSession,toolName:r.remoteAgentName}}catch(n){return logError(log,`remote agent start failed`,n,{remoteAgentName:r.remoteAgentName,nodeId:r.nodeId,callId:r.callId}),{kind:`error`,result:createRemoteAgentStartFailureResult({action:r,error:n}),session:e.currentSession}}}export{startRemoteSubagent};
@@ -1 +1 @@
1
- import{getSessionRemainingTokenQuota}from"#harness/turn-tag-state.js";function resolveRemainingSessionTokenLimits(t,n=1){let r=Math.max(1,Math.floor(n)),i=getSessionRemainingTokenQuota(t);return{maxInputTokensPerSession:grantShare(i.inputTokens,r),maxOutputTokensPerSession:grantShare(i.outputTokens,r)}}function grantShare(e,t){return e!==!1&&Math.floor(e/t)}export{resolveRemainingSessionTokenLimits};
1
+ import{getSessionRemainingUsageQuota}from"#harness/turn-tag-state.js";function resolveRemainingSessionTokenLimits(t,n=1){let r=Math.max(1,Math.floor(n)),i=getSessionRemainingUsageQuota(t),a={maxInputTokensPerSession:grantTokenShare(i.inputTokens,r),maxOutputTokensPerSession:grantTokenShare(i.outputTokens,r)},o=grantCostShare(i.costUsd,r);return o!==!1&&(a.maxTokenCostUsdPerSession=o),a}function grantTokenShare(e,t){return e!==!1&&Math.floor(e/t)}function grantCostShare(e,t){return e!==!1&&e/t}export{resolveRemainingSessionTokenLimits};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-C3vUG5g2.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-3DZuvuWE.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-C3vUG5g2.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-3DZuvuWE.js";
2
2
 
3
3
  export { useEveAgent };
@@ -23,6 +23,7 @@ export type TaskInputRequest = JsonValue;
23
23
  export interface TaskUsage {
24
24
  readonly cacheReadTokens: number;
25
25
  readonly cacheWriteTokens: number;
26
+ readonly costUsd?: number;
26
27
  readonly inputTokens: number;
27
28
  readonly outputTokens: number;
28
29
  }
@@ -96,6 +97,14 @@ export interface TaskCommandHookPayload {
96
97
  readonly kind: "task-command";
97
98
  readonly command: TaskCommand;
98
99
  }
100
+ /** One authored message delivered to the parent as a new turn. */
101
+ export interface TaskInboundMessage {
102
+ readonly callId: string;
103
+ readonly kind: "task-message";
104
+ readonly message: string;
105
+ readonly messageIndex: number;
106
+ readonly messageEpoch: string;
107
+ }
99
108
  /** Intermediate progress reported by an executor. */
100
109
  export interface TaskInboundUpdate {
101
110
  readonly callId: string;
@@ -126,7 +135,7 @@ export interface TaskInboundAnswerInput {
126
135
  readonly kind: "input-response";
127
136
  readonly taskId: string;
128
137
  }
129
- export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundAnswerInput | TaskInboundUpdate;
138
+ export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundAnswerInput | TaskInboundMessage | TaskInboundUpdate;
130
139
  /** Generic task-owned request sent through the parent session payload. */
131
140
  interface TaskInputRequestDeliveryBase {
132
141
  readonly replyTo: string;
@@ -161,6 +170,14 @@ export interface TaskAgentRequestDelivery {
161
170
  readonly request: WorkflowToolAgentRequest;
162
171
  readonly taskId: string;
163
172
  }
173
+ export interface TaskProgress {
174
+ readonly callId: string;
175
+ readonly kind: "task-progress";
176
+ readonly taskId: string;
177
+ readonly update: JsonValue;
178
+ readonly updateIndex: number;
179
+ }
180
+ export declare const TASK_PROGRESS_STREAM_NAMESPACE = "eve.task.progress";
164
181
  export declare const TASK_VIEW_STREAM_NAMESPACE = "eve.task";
165
182
  export declare function isTerminalTaskStatus(status: TaskStatus): boolean;
166
183
  export declare function isReadyTaskStatus(status: TaskStatus): boolean;
@@ -1 +1 @@
1
- import{jsonValuesEqual}from"#shared/json.js";function sameTaskMetadata(t,n){return jsonValuesEqual(t,n)}function readTaskUsage(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=readUsageAxis(e,`cacheReadTokens`),n=readUsageAxis(e,`cacheWriteTokens`),r=readUsageAxis(e,`inputTokens`),i=readUsageAxis(e,`outputTokens`);if(!(t===void 0||n===void 0||r===void 0||i===void 0))return{cacheReadTokens:t,cacheWriteTokens:n,inputTokens:r,outputTokens:i}}function readUsageAxis(e,t){let n=Reflect.get(e,t);return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:void 0}function readTaskInputRequestId(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`requestId`);return typeof t==`string`?t:void 0}const TASK_AUTHORIZATION_REQUEST_ID_PREFIX=`task:authorization`;function taskAuthorizationRequestId(e){return e.type===`approval.candidate`||e.type===`approval.settled`?`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.requestId}`:`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.attemptId??e.data.name}`}const TASK_VIEW_STREAM_NAMESPACE=`eve.task`;function isTerminalTaskStatus(e){return e===`completed`||e===`failed`||e===`cancelled`}function isReadyTaskStatus(e){return e===`input_required`||isTerminalTaskStatus(e)}export{TASK_VIEW_STREAM_NAMESPACE,isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId,readTaskUsage,sameTaskMetadata,taskAuthorizationRequestId};
1
+ import{jsonValuesEqual}from"#shared/json.js";function sameTaskMetadata(t,n){return jsonValuesEqual(t,n)}function readTaskUsage(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=readUsageAxis(e,`cacheReadTokens`),n=readUsageAxis(e,`cacheWriteTokens`),r=readUsageAxis(e,`costUsd`),i=readUsageAxis(e,`inputTokens`),a=readUsageAxis(e,`outputTokens`);if(t===void 0||n===void 0||i===void 0||a===void 0)return;let o={cacheReadTokens:t,cacheWriteTokens:n,inputTokens:i,outputTokens:a};return r!==void 0&&(o.costUsd=r),o}function readUsageAxis(e,t){let n=Reflect.get(e,t);return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:void 0}function readTaskInputRequestId(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`requestId`);return typeof t==`string`?t:void 0}const TASK_AUTHORIZATION_REQUEST_ID_PREFIX=`task:authorization`;function taskAuthorizationRequestId(e){return e.type===`approval.candidate`||e.type===`approval.settled`?`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.requestId}`:`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.attemptId??e.data.name}`}const TASK_PROGRESS_STREAM_NAMESPACE=`eve.task.progress`,TASK_VIEW_STREAM_NAMESPACE=`eve.task`;function isTerminalTaskStatus(e){return e===`completed`||e===`failed`||e===`cancelled`}function isReadyTaskStatus(e){return e===`input_required`||isTerminalTaskStatus(e)}export{TASK_PROGRESS_STREAM_NAMESPACE,TASK_VIEW_STREAM_NAMESPACE,isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId,readTaskUsage,sameTaskMetadata,taskAuthorizationRequestId};
@@ -16,10 +16,15 @@ export type CompiledToolHandling = {
16
16
  readonly workflowId: string;
17
17
  };
18
18
  /** Closed, serializable behavior carried by one selected compiled tool. */
19
+ export interface ToolExecutionShape {
20
+ readonly lifetime: "step" | "task";
21
+ readonly suspend: "none" | "workflow";
22
+ }
19
23
  export interface CompiledToolBehavior {
20
24
  readonly availability: readonly ToolAvailabilityCondition[];
21
25
  readonly handling?: CompiledToolHandling;
22
26
  readonly presentation?: "load-skill";
27
+ readonly shape?: ToolExecutionShape;
23
28
  }
24
29
  /** Concrete dispatch identity prepared before a tool reaches the harness. */
25
30
  export type PreparedDispatchTarget = {