eve 0.50.0 → 0.51.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (734) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/src/acp/adapter.js +1 -1
  3. package/dist/src/channel/session.d.ts +2 -1
  4. package/dist/src/channel/session.js +1 -1
  5. package/dist/src/channel/types.d.ts +16 -20
  6. package/dist/src/chunks/{use-eve-agent-B5I-k6Ek.js → use-eve-agent-3DZuvuWE.js} +21 -10
  7. package/dist/src/chunks/{use-eve-agent-DUMU6dap.js → use-eve-agent-D7apPojZ.js} +21 -10
  8. package/dist/src/cli/acp/command.d.ts +1 -1
  9. package/dist/src/cli/acp/command.js +2 -2
  10. package/dist/src/cli/agent-command.d.ts +5 -0
  11. package/dist/src/cli/agent-command.js +1 -0
  12. package/dist/src/cli/application-command.d.ts +2 -0
  13. package/dist/src/cli/commands/agent-instructions.d.ts +3 -1
  14. package/dist/src/cli/commands/agent-instructions.js +1 -1
  15. package/dist/src/cli/commands/build.d.ts +1 -1
  16. package/dist/src/cli/commands/build.js +1 -1
  17. package/dist/src/cli/commands/deploy.d.ts +2 -0
  18. package/dist/src/cli/commands/deploy.js +1 -1
  19. package/dist/src/cli/commands/init-agent-workspace.d.ts +14 -0
  20. package/dist/src/cli/commands/init-agent-workspace.js +1 -0
  21. package/dist/src/cli/commands/init.d.ts +2 -13
  22. package/dist/src/cli/commands/init.js +1 -1
  23. package/dist/src/cli/commands/link.d.ts +2 -0
  24. package/dist/src/cli/commands/link.js +1 -1
  25. package/dist/src/cli/commands/preconditions.d.ts +15 -0
  26. package/dist/src/cli/commands/preconditions.js +1 -1
  27. package/dist/src/cli/commands/register-integration-commands.d.ts +1 -1
  28. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  29. package/dist/src/cli/commands/register-project-commands.d.ts +1 -1
  30. package/dist/src/cli/commands/register-project-commands.js +1 -1
  31. package/dist/src/cli/commands/register-registry-commands.js +2 -2
  32. package/dist/src/cli/dev/environment.d.ts +1 -1
  33. package/dist/src/cli/dev/environment.js +1 -1
  34. package/dist/src/cli/dev/local-server-process.js +1 -1
  35. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  36. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  37. package/dist/src/cli/dev/tui/runner.js +1 -1
  38. package/dist/src/cli/dev/tui/setup-commands.d.ts +3 -1
  39. package/dist/src/cli/dev/tui/setup-commands.js +1 -1
  40. package/dist/src/cli/invoke/command.d.ts +1 -1
  41. package/dist/src/cli/invoke/command.js +1 -1
  42. package/dist/src/cli/option-parsers.d.ts +1 -0
  43. package/dist/src/cli/option-parsers.js +1 -1
  44. package/dist/src/cli/run.js +3 -3
  45. package/dist/src/client/agent-info-schema.d.ts +0 -1
  46. package/dist/src/client/agent-info-schema.js +1 -1
  47. package/dist/src/client/message-action-parts.js +1 -1
  48. package/dist/src/client/open-stream.js +1 -1
  49. package/dist/src/client/session-controls.d.ts +3 -0
  50. package/dist/src/client/session-controls.js +1 -1
  51. package/dist/src/client/session.d.ts +4 -1
  52. package/dist/src/compiled/.vendor-stamp.json +11 -11
  53. package/dist/src/compiled/@clack/core/LICENSE +9 -0
  54. package/dist/src/compiled/@clack/core/index.d.ts +363 -0
  55. package/dist/src/compiled/@clack/core/index.js +20 -0
  56. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  57. package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +34 -92
  58. package/dist/src/compiled/@vercel/sandbox/api-client/base-client.d.ts +1 -1
  59. package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
  60. package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +13 -29
  61. package/dist/src/compiled/@vercel/sandbox/constants.d.ts +11 -1
  62. package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -3
  63. package/dist/src/compiled/@vercel/sandbox/index.js +9 -9
  64. package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +5 -6
  65. package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +79 -67
  66. package/dist/src/compiled/@vercel/sandbox/session.d.ts +5 -3
  67. package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +9 -0
  68. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-client.d.ts +86 -1
  69. package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +2 -0
  70. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/validators.d.ts +26 -1
  71. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/constants.d.ts +2 -2
  72. package/dist/src/compiled/@vercel/{sandbox → sandbox-drives}/drive.d.ts +10 -0
  73. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/index.d.ts +3 -2
  74. package/dist/src/compiled/@vercel/sandbox-drives/index.js +9 -0
  75. package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox.d.ts +35 -6
  76. package/dist/src/compiled/@workflow/core/index.js +1 -1
  77. package/dist/src/compiled/@workflow/core/private.d.ts +2 -4
  78. package/dist/src/compiled/@workflow/core/private.js +1 -1
  79. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +9 -7
  80. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +13 -0
  81. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +54 -1
  82. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  83. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +7 -0
  84. package/dist/src/compiled/@workflow/core/serialization.d.ts +24 -2
  85. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  86. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  87. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
  88. package/dist/src/compiled/@workflow/errors/index.d.ts +19 -0
  89. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  90. package/dist/src/compiled/@workflow/world/analytics.d.ts +46 -2
  91. package/dist/src/compiled/@workflow/world/events.d.ts +26 -1
  92. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  93. package/dist/src/compiled/@workflow/world/runs.d.ts +2 -2
  94. package/dist/src/compiled/@workflow/world-local/index.js +3 -3
  95. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  96. package/dist/src/compiled/_chunks/node/{auth-BSKyPAEP.js → auth-Bx1Aoyfo.js} +1 -1
  97. package/dist/src/compiled/_chunks/node/{auth-YpKlwhP1.js → auth-CA8ZMfB8.js} +1 -1
  98. package/dist/src/compiled/_chunks/node/esm-CE0tAvRh.js +7 -0
  99. package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +1 -0
  100. package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +1 -0
  101. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BwAadFfB.js → attribute-changes-03lzo29R.js} +1 -1
  102. package/dist/src/compiled/_chunks/workflow/dist-BIdMK5N8.js +40 -0
  103. package/dist/src/compiled/_chunks/workflow/dist-DMQ3CtWt.js +3 -0
  104. package/dist/src/compiled/_chunks/workflow/frames-Boesh7kU.js +3 -0
  105. package/dist/src/compiled/_chunks/workflow/{private-CZFMABEf.js → private-CKx3PkSS.js} +1 -1
  106. package/dist/src/compiled/_chunks/workflow/{resume-hook-BToMtPbH.js → resume-hook-C6eL-S_T.js} +1 -1
  107. package/dist/src/compiled/_chunks/workflow/run-BV0S6Zc2.js +1 -0
  108. package/dist/src/compiled/_chunks/workflow/sleep-Bh3jP9ii.js +1 -0
  109. package/dist/src/compiled/_chunks/workflow/wait-until-l-cwfJvm.js +15 -0
  110. package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js} +1 -1
  111. package/dist/src/compiler/compile-from-memory.d.ts +1 -0
  112. package/dist/src/compiler/extension-compatibility.d.ts +20 -20
  113. package/dist/src/compiler/extension-compatibility.js +1 -1
  114. package/dist/src/compiler/manifest.d.ts +2 -2
  115. package/dist/src/compiler/manifest.js +1 -1
  116. package/dist/src/compiler/normalize-agent-config.js +1 -1
  117. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  118. package/dist/src/compiler/normalize-manifest.js +1 -1
  119. package/dist/src/compiler/normalize-tool.js +1 -1
  120. package/dist/src/context/build-dynamic-tools.js +1 -1
  121. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  122. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  123. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
  124. package/dist/src/context/keys.d.ts +0 -3
  125. package/dist/src/context/keys.js +1 -1
  126. package/dist/src/discover/extensions.d.ts +2 -0
  127. package/dist/src/discover/extensions.js +1 -1
  128. package/dist/src/discover/filesystem.d.ts +1 -0
  129. package/dist/src/discover/filesystem.js +1 -1
  130. package/dist/src/discover/project.js +1 -1
  131. package/dist/src/evals/cli/eval.js +1 -1
  132. package/dist/src/evals/mock-model.js +1 -1
  133. package/dist/src/evals/runner/execute-task.js +1 -1
  134. package/dist/src/evals/session-cleanup.d.ts +7 -0
  135. package/dist/src/evals/session-cleanup.js +1 -0
  136. package/dist/src/evals/session.d.ts +4 -0
  137. package/dist/src/evals/session.js +1 -1
  138. package/dist/src/eve-channel/index.js +1 -1
  139. package/dist/src/eve-channel/request.d.ts +1 -0
  140. package/dist/src/eve-channel/request.js +1 -1
  141. package/dist/src/execution/activity-collector.js +1 -1
  142. package/dist/src/execution/activity-work-id.js +1 -1
  143. package/dist/src/execution/activity-work.d.ts +8 -0
  144. package/dist/src/execution/activity-work.js +1 -1
  145. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  146. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +6 -0
  147. package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -0
  148. package/dist/src/execution/channel-context.js +1 -1
  149. package/dist/src/execution/coordination-dispatch-shared.d.ts +103 -0
  150. package/dist/src/execution/coordination-dispatch-shared.js +1 -0
  151. package/dist/src/execution/coordination-dispatch-step.d.ts +7 -0
  152. package/dist/src/execution/coordination-dispatch-step.js +1 -0
  153. package/dist/src/execution/create-session-step.d.ts +1 -2
  154. package/dist/src/execution/create-session-step.js +1 -1
  155. package/dist/src/execution/deliver-payloads.js +1 -1
  156. package/dist/src/execution/dispatch-action-failures.d.ts +5 -5
  157. package/dist/src/execution/dispatch-action-failures.js +1 -1
  158. package/dist/src/execution/dispatch-start-operation.d.ts +1 -1
  159. package/dist/src/execution/dispatch-start-operation.js +1 -1
  160. package/dist/src/execution/durable-session-store.d.ts +1 -1
  161. package/dist/src/execution/eve-workflow-attributes.d.ts +1 -1
  162. package/dist/src/execution/inline-turn.d.ts +2 -0
  163. package/dist/src/execution/inline-turn.js +1 -1
  164. package/dist/src/execution/next-driver-action.d.ts +7 -13
  165. package/dist/src/execution/node-step.d.ts +1 -2
  166. package/dist/src/execution/node-step.js +1 -1
  167. package/dist/src/execution/parked-delivery-wait.js +1 -1
  168. package/dist/src/execution/pending-turn-state.d.ts +1 -2
  169. package/dist/src/execution/pending-turn-state.js +1 -1
  170. package/dist/src/execution/proxied-deliver-step.js +1 -1
  171. package/dist/src/execution/route-child-delivery.js +1 -1
  172. package/dist/src/execution/run-session-limits.d.ts +5 -5
  173. package/dist/src/execution/runtime-context.js +1 -1
  174. package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
  175. package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +4 -4
  176. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  177. package/dist/src/execution/session-activity-projection.js +1 -1
  178. package/dist/src/execution/session-activity.js +1 -1
  179. package/dist/src/execution/session-command-inbox.d.ts +2 -3
  180. package/dist/src/execution/session-timeout-workflow.js +1 -1
  181. package/dist/src/execution/session.d.ts +2 -1
  182. package/dist/src/execution/session.js +2 -2
  183. package/dist/src/execution/settle-cancelled-turn-step.d.ts +1 -1
  184. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  185. package/dist/src/execution/stable-workflow-names.d.ts +1 -1
  186. package/dist/src/execution/stable-workflow-names.js +1 -1
  187. package/dist/src/execution/task-event-callback.js +1 -1
  188. package/dist/src/execution/tasks/child/steps.d.ts +19 -11
  189. package/dist/src/execution/tasks/child/steps.js +1 -1
  190. package/dist/src/execution/tasks/child/update-step.d.ts +6 -0
  191. package/dist/src/execution/tasks/child/update-step.js +1 -0
  192. package/dist/src/execution/tasks/child/update.d.ts +7 -10
  193. package/dist/src/execution/tasks/child/update.js +1 -1
  194. package/dist/src/execution/tasks/child/workflow.d.ts +21 -27
  195. package/dist/src/execution/tasks/child/workflow.js +1 -1
  196. package/dist/src/execution/tasks/parent/control-shared.d.ts +6 -17
  197. package/dist/src/execution/tasks/parent/control-shared.js +1 -1
  198. package/dist/src/execution/tasks/parent/delegate.d.ts +15 -48
  199. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  200. package/dist/src/execution/tasks/parent/dispatch.d.ts +19 -34
  201. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  202. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +5 -15
  203. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  204. package/dist/src/execution/tasks/parent/run-parent.d.ts +2 -2
  205. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +26 -0
  206. package/dist/src/execution/tasks/parent/subagent-task-projection.js +1 -0
  207. package/dist/src/execution/tasks/parent/task-cancel.d.ts +11 -0
  208. package/dist/src/execution/tasks/parent/task-cancel.js +1 -0
  209. package/dist/src/execution/tasks/parent/tool-execution.d.ts +2 -3
  210. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  211. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  212. package/dist/src/execution/tools/sleep-workflow.d.ts +3 -0
  213. package/dist/src/execution/tools/sleep-workflow.js +1 -0
  214. package/dist/src/execution/tools/sleep.d.ts +1 -5
  215. package/dist/src/execution/tools/sleep.js +1 -1
  216. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +7 -0
  217. package/dist/src/execution/tools/subagent/accept-event-step.js +1 -0
  218. package/dist/src/execution/tools/subagent/emit-called-step.d.ts +9 -0
  219. package/dist/src/execution/tools/subagent/emit-called-step.js +1 -0
  220. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +51 -0
  221. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -0
  222. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +37 -0
  223. package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -0
  224. package/dist/src/execution/tools/subagent/invoke-step.d.ts +55 -0
  225. package/dist/src/execution/tools/subagent/invoke-step.js +1 -0
  226. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +11 -0
  227. package/dist/src/execution/tools/subagent/receipt-identity.js +1 -0
  228. package/dist/src/execution/{dispatch-runtime-actions-start.d.ts → tools/subagent/start.d.ts} +17 -5
  229. package/dist/src/execution/tools/subagent/start.js +1 -0
  230. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +24 -0
  231. package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -0
  232. package/dist/src/execution/tools/subagent/task-cancel.d.ts +10 -0
  233. package/dist/src/execution/tools/subagent/task-cancel.js +1 -0
  234. package/dist/src/execution/tools/tasks.d.ts +10 -0
  235. package/dist/src/execution/tools/tasks.js +1 -0
  236. package/dist/src/execution/{tool-run → tools/workflow}/answer.d.ts +1 -1
  237. package/dist/src/execution/tools/workflow/answer.js +1 -0
  238. package/dist/src/execution/tools/workflow/ask.d.ts +22 -0
  239. package/dist/src/execution/tools/workflow/ask.js +1 -0
  240. package/dist/src/execution/tools/workflow/background.d.ts +18 -0
  241. package/dist/src/execution/tools/workflow/background.js +1 -0
  242. package/dist/src/execution/tools/workflow/body.d.ts +25 -0
  243. package/dist/src/execution/tools/workflow/body.js +1 -0
  244. package/dist/src/execution/tools/workflow/cancel.d.ts +11 -0
  245. package/dist/src/execution/tools/workflow/cancel.js +1 -0
  246. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +7 -0
  247. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -0
  248. package/dist/src/execution/tools/workflow/messages.d.ts +88 -0
  249. package/dist/src/execution/tools/workflow/messages.js +1 -0
  250. package/dist/src/execution/tools/workflow/owner-inbox.d.ts +13 -0
  251. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -0
  252. package/dist/src/execution/tools/workflow/owner.d.ts +13 -0
  253. package/dist/src/execution/tools/workflow/owner.js +1 -0
  254. package/dist/src/execution/tools/workflow/run-control.d.ts +18 -0
  255. package/dist/src/execution/tools/workflow/run-control.js +1 -0
  256. package/dist/src/execution/tools/workflow/start.d.ts +33 -0
  257. package/dist/src/execution/tools/workflow/start.js +1 -0
  258. package/dist/src/execution/tools/workflow/types.d.ts +26 -0
  259. package/dist/src/execution/tools/workflow/types.js +1 -0
  260. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -0
  261. package/dist/src/execution/tools/workflow/workflow.js +1 -0
  262. package/dist/src/execution/turn-cancellation-control.d.ts +1 -0
  263. package/dist/src/execution/turn-cancellation-control.js +1 -1
  264. package/dist/src/execution/turn-cancellation-token.d.ts +1 -0
  265. package/dist/src/execution/turn-control-receiver.d.ts +3 -0
  266. package/dist/src/execution/turn-control-receiver.js +1 -1
  267. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  268. package/dist/src/execution/turn-dispatch.js +1 -1
  269. package/dist/src/execution/turn-workflow-tool-run.d.ts +16 -0
  270. package/dist/src/execution/turn-workflow-tool-run.js +1 -0
  271. package/dist/src/execution/turn-workflow.js +1 -1
  272. package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
  273. package/dist/src/execution/wire/session-inbox-contract.js +1 -1
  274. package/dist/src/execution/wire/session-inbox-encoder.d.ts +14 -2
  275. package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
  276. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  277. package/dist/src/execution/wire/session-inbox-wire.d.ts +3 -3
  278. package/dist/src/execution/wire/session-inbox-wire.js +1 -1
  279. package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
  280. package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +267 -0
  281. package/dist/src/execution/wire/session-inbox-wire.v4.js +1 -0
  282. package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +3 -0
  283. package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +1 -0
  284. package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +341 -0
  285. package/dist/src/execution/wire/session-inbox-wire.v5.js +1 -0
  286. package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +3 -0
  287. package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +1 -0
  288. package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +341 -0
  289. package/dist/src/execution/wire/session-inbox-wire.v6.js +1 -0
  290. package/dist/src/execution/workflow-entry-finalization.d.ts +6 -0
  291. package/dist/src/execution/workflow-entry-finalization.js +1 -1
  292. package/dist/src/execution/workflow-entry.d.ts +2 -1
  293. package/dist/src/execution/workflow-entry.js +1 -1
  294. package/dist/src/execution/workflow-runtime.d.ts +1 -1
  295. package/dist/src/execution/workflow-runtime.js +1 -1
  296. package/dist/src/execution/workflow-steps.js +1 -1
  297. package/dist/src/framework/sources/registry.js +1 -1
  298. package/dist/src/harness/advertised-tools.d.ts +1 -7
  299. package/dist/src/harness/advertised-tools.js +1 -1
  300. package/dist/src/harness/background-tools.d.ts +8 -2
  301. package/dist/src/harness/{runtime-actions.d.ts → coordination.d.ts} +40 -27
  302. package/dist/src/harness/coordination.js +1 -0
  303. package/dist/src/harness/emission.d.ts +9 -2
  304. package/dist/src/harness/emission.js +1 -1
  305. package/dist/src/harness/execute-tool.d.ts +52 -0
  306. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  307. package/dist/src/harness/input-requests.js +1 -1
  308. package/dist/src/harness/proxy-input-requests.d.ts +6 -2
  309. package/dist/src/harness/session-limit-continuation.d.ts +5 -5
  310. package/dist/src/harness/session-limit-continuation.js +1 -1
  311. package/dist/src/harness/session-limit-enforcement.d.ts +4 -4
  312. package/dist/src/harness/session-limit-enforcement.js +1 -1
  313. package/dist/src/harness/session-usage-limits.d.ts +48 -0
  314. package/dist/src/harness/session-usage-limits.js +1 -0
  315. package/dist/src/harness/stale-input-responses.js +1 -1
  316. package/dist/src/harness/step-hooks.d.ts +1 -2
  317. package/dist/src/harness/step-hooks.js +1 -1
  318. package/dist/src/harness/tool-call-action.js +1 -1
  319. package/dist/src/harness/tool-call-input-errors.js +1 -1
  320. package/dist/src/harness/tool-loop.js +2 -2
  321. package/dist/src/harness/tools.js +1 -1
  322. package/dist/src/harness/turn-tag-state.d.ts +20 -21
  323. package/dist/src/harness/turn-tag-state.js +1 -1
  324. package/dist/src/harness/types.d.ts +9 -7
  325. package/dist/src/harness/workflow-interrupt-state.js +1 -1
  326. package/dist/src/harness/workflow-lifecycle.d.ts +10 -0
  327. package/dist/src/harness/workflow-lifecycle.js +1 -1
  328. package/dist/src/harness/workflow-sandbox.d.ts +1 -1
  329. package/dist/src/harness/workflow-sandbox.js +2 -2
  330. package/dist/src/harness/workflow-subagent-limit.d.ts +7 -7
  331. package/dist/src/harness/workflow-subagent-limit.js +1 -1
  332. package/dist/src/harness/workflow-task-state.d.ts +9 -0
  333. package/dist/src/harness/workflow-task-state.js +1 -0
  334. package/dist/src/harness/workflow-tool-runs.d.ts +27 -0
  335. package/dist/src/harness/workflow-tool-runs.js +1 -0
  336. package/dist/src/instrumentation/native-events.js +1 -1
  337. package/dist/src/instrumentation/parent-lineage.js +1 -1
  338. package/dist/src/internal/agent-name.d.ts +4 -0
  339. package/dist/src/internal/agent-name.js +1 -0
  340. package/dist/src/internal/application/build-output-environment.d.ts +1 -0
  341. package/dist/src/internal/application/build-output-environment.js +1 -1
  342. package/dist/src/internal/application/package.js +1 -1
  343. package/dist/src/internal/application/paths.js +1 -1
  344. package/dist/src/internal/authored-definition/core.js +1 -1
  345. package/dist/src/internal/eve-project-root.d.ts +8 -0
  346. package/dist/src/internal/eve-project-root.js +1 -0
  347. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  348. package/dist/src/internal/nitro/host/build-application.js +1 -1
  349. package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -0
  350. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  351. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  352. package/dist/src/internal/nitro/host/start-production-server.js +3 -3
  353. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  354. package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
  355. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  356. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  357. package/dist/src/internal/project-context.d.ts +31 -0
  358. package/dist/src/internal/project-context.js +1 -0
  359. package/dist/src/internal/vercel/assemble-eve-services.d.ts +17 -0
  360. package/dist/src/internal/vercel/assemble-eve-services.js +1 -0
  361. package/dist/src/internal/vercel/build-agent-workspace.d.ts +3 -0
  362. package/dist/src/internal/vercel/build-agent-workspace.js +1 -0
  363. package/dist/src/internal/vercel/build-command.d.ts +4 -0
  364. package/dist/src/internal/vercel/build-command.js +1 -0
  365. package/dist/src/internal/vercel/eve-service-contribution.d.ts +28 -0
  366. package/dist/src/internal/vercel/eve-service-contribution.js +1 -0
  367. package/dist/src/internal/vercel/vercel-service-config-operations.d.ts +18 -0
  368. package/dist/src/internal/vercel/vercel-service-config-operations.js +1 -0
  369. package/dist/src/internal/vercel/vercel-service-name.d.ts +6 -0
  370. package/dist/src/internal/vercel/vercel-service-name.js +1 -0
  371. package/dist/src/internal/vercel/vercel-services-config.d.ts +53 -0
  372. package/dist/src/internal/vercel/vercel-services-config.js +1 -0
  373. package/dist/src/internal/workflow/reference.d.ts +2 -0
  374. package/dist/src/internal/workflow/reference.js +1 -0
  375. package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +0 -9
  376. package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -1
  377. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  378. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
  379. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  380. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +1 -1
  381. package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
  382. package/dist/src/protocol/message.d.ts +2 -0
  383. package/dist/src/protocol/message.js +1 -1
  384. package/dist/src/public/channels/slack/action-status.js +1 -1
  385. package/dist/src/public/channels/slack/activity-plan.d.ts +4 -0
  386. package/dist/src/public/channels/slack/activity-plan.js +1 -0
  387. package/dist/src/public/channels/slack/activity.d.ts +45 -2
  388. package/dist/src/public/channels/slack/activity.js +2 -1
  389. package/dist/src/public/channels/slack/index.d.ts +1 -1
  390. package/dist/src/public/channels/slack/index.js +1 -1
  391. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  392. package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
  393. package/dist/src/public/memory/index.js +1 -1
  394. package/dist/src/public/next/index.js +1 -1
  395. package/dist/src/public/next/vercel-output-config.js +1 -1
  396. package/dist/src/public/nuxt/index.js +1 -1
  397. package/dist/src/public/nuxt/module.d.ts +3 -2
  398. package/dist/src/public/nuxt/module.js +1 -1
  399. package/dist/src/public/sandbox/vercel-sandbox.d.ts +9 -5
  400. package/dist/src/public/sandbox/vercel.d.ts +1 -1
  401. package/dist/src/public/sandbox/vercel.js +1 -1
  402. package/dist/src/public/workflow/index.d.ts +3 -1
  403. package/dist/src/public/workflow/index.js +1 -1
  404. package/dist/src/runtime/actions/results.d.ts +3 -3
  405. package/dist/src/runtime/actions/results.js +1 -1
  406. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  407. package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
  408. package/dist/src/runtime/agent/bootstrap.js +1 -1
  409. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  410. package/dist/src/runtime/channels/registry.js +1 -1
  411. package/dist/src/runtime/prompt/compose.d.ts +0 -1
  412. package/dist/src/runtime/prompt/compose.js +1 -1
  413. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  414. package/dist/src/runtime/resolve-agent.js +1 -1
  415. package/dist/src/runtime/sessions/turn.d.ts +16 -1
  416. package/dist/src/runtime/subagents/registry.js +1 -1
  417. package/dist/src/runtime/subagents/workflow-reference.d.ts +5 -0
  418. package/dist/src/runtime/subagents/workflow-reference.js +1 -0
  419. package/dist/src/runtime/subagents/workflow.d.ts +8 -0
  420. package/dist/src/runtime/subagents/workflow.js +1 -0
  421. package/dist/src/runtime/tools/registry.js +1 -1
  422. package/dist/src/self-modification/agent.d.ts +22 -0
  423. package/dist/src/self-modification/agent.js +1 -0
  424. package/dist/src/self-modification/extension/classify-registry-item.d.ts +19 -0
  425. package/dist/src/self-modification/extension/classify-registry-item.js +1 -0
  426. package/dist/src/self-modification/extension/eve-add.d.ts +56 -0
  427. package/dist/src/self-modification/extension/eve-add.js +2 -0
  428. package/dist/src/self-modification/extension/extension.d.ts +2 -0
  429. package/dist/src/self-modification/extension/extension.js +1 -0
  430. package/dist/src/self-modification/extension/instructions.d.ts +4 -0
  431. package/dist/src/self-modification/extension/instructions.js +23 -0
  432. package/dist/src/self-modification/extension/source-lock.d.ts +2 -0
  433. package/dist/src/self-modification/extension/source-lock.js +1 -0
  434. package/dist/src/self-modification/extension/tools/edit_file.d.ts +16 -0
  435. package/dist/src/self-modification/extension/tools/edit_file.js +1 -0
  436. package/dist/src/self-modification/extension/tools/registry_add.d.ts +52 -0
  437. package/dist/src/self-modification/extension/tools/registry_add.js +1 -0
  438. package/dist/src/self-modification/extension/tools/search_models.d.ts +22 -0
  439. package/dist/src/self-modification/extension/tools/search_models.js +1 -0
  440. package/dist/src/self-modification/extension/tools/search_registry.d.ts +103 -0
  441. package/dist/src/self-modification/extension/tools/search_registry.js +1 -0
  442. package/dist/src/self-modification/filesystem.d.ts +6 -0
  443. package/dist/src/self-modification/filesystem.js +1 -0
  444. package/dist/src/self-modification/sandbox.d.ts +2 -0
  445. package/dist/src/self-modification/sandbox.js +1 -0
  446. package/dist/src/services/dev-client/target.d.ts +3 -1
  447. package/dist/src/setup/boxes/select-model.d.ts +3 -21
  448. package/dist/src/setup/boxes/select-model.js +1 -1
  449. package/dist/src/setup/cli/prompt-ui.js +4 -4
  450. package/dist/src/setup/cli/select-component.d.ts +1 -1
  451. package/dist/src/setup/cli/select-component.js +1 -1
  452. package/dist/src/setup/flows/model.d.ts +3 -0
  453. package/dist/src/setup/flows/model.js +1 -1
  454. package/dist/src/setup/integrations/discord/setup.js +1 -1
  455. package/dist/src/setup/integrations/file-memory/vercel.js +1 -1
  456. package/dist/src/setup/integrations/linear/setup.js +1 -1
  457. package/dist/src/setup/integrations/linq/setup.js +3 -3
  458. package/dist/src/setup/integrations/shopify/setup.js +1 -1
  459. package/dist/src/setup/prompter.js +1 -1
  460. package/dist/src/setup/scaffold/create/project.js +1 -1
  461. package/dist/src/setup/scaffold/update/channels.d.ts +4 -12
  462. package/dist/src/setup/scaffold/update/channels.js +1 -1
  463. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  464. package/dist/src/shared/action-types.d.ts +103 -30
  465. package/dist/src/shared/action-types.js +1 -1
  466. package/dist/src/shared/agent-definition.d.ts +13 -0
  467. package/dist/src/shared/agent-turn-outcome.d.ts +2 -0
  468. package/dist/src/shared/agent-turn-outcome.js +1 -1
  469. package/dist/src/shared/extension-package-contract.d.ts +2 -0
  470. package/dist/src/shared/extension-package-contract.js +1 -1
  471. package/dist/src/shared/gateway-model-catalog.d.ts +21 -0
  472. package/dist/src/shared/gateway-model-catalog.js +1 -0
  473. package/dist/src/shared/json.js +1 -1
  474. package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
  475. package/dist/src/shared/token-usage.d.ts +11 -15
  476. package/dist/src/shared/token-usage.js +1 -1
  477. package/dist/src/shared/workflow-sandbox.d.ts +1 -1
  478. package/dist/src/{execution/subagent-adapter-state.d.ts → subagents/adapter-state.d.ts} +2 -0
  479. package/dist/src/{execution/subagent-adapter-state.js → subagents/adapter-state.js} +1 -1
  480. package/dist/src/subagents/adapter.js +1 -0
  481. package/dist/src/{harness → subagents}/agent-handle-errors.d.ts +6 -0
  482. package/dist/src/subagents/agent-handle-errors.js +1 -0
  483. package/dist/src/subagents/callback-route.js +1 -0
  484. package/dist/src/subagents/callback-step.js +1 -0
  485. package/dist/src/{execution/agent-continuation-bundle.d.ts → subagents/continuation-bundle.d.ts} +1 -1
  486. package/dist/src/subagents/continuation-bundle.js +1 -0
  487. package/dist/src/{execution/subagent-event-proxy-step.d.ts → subagents/event-proxy-step.d.ts} +2 -8
  488. package/dist/src/subagents/event-proxy-step.js +1 -0
  489. package/dist/src/subagents/handle-dispatch.d.ts +54 -0
  490. package/dist/src/subagents/handle-dispatch.js +1 -0
  491. package/dist/src/{harness → subagents}/handles/prompt.d.ts +4 -4
  492. package/dist/src/{harness → subagents}/handles/prompt.js +1 -1
  493. package/dist/src/{harness → subagents}/handles/query.d.ts +8 -2
  494. package/dist/src/subagents/handles/query.js +1 -0
  495. package/dist/src/subagents/handles/rebase.d.ts +4 -0
  496. package/dist/src/subagents/handles/rebase.js +1 -0
  497. package/dist/src/{harness → subagents}/handles/store.d.ts +90 -15
  498. package/dist/src/subagents/handles/store.js +1 -0
  499. package/dist/src/subagents/handles/transitions.d.ts +103 -0
  500. package/dist/src/subagents/handles/transitions.js +1 -0
  501. package/dist/src/{execution/delegated-parent-notification.d.ts → subagents/parent-notification.d.ts} +1 -7
  502. package/dist/src/subagents/parent-notification.js +1 -0
  503. package/dist/src/subagents/parent-result.js +1 -0
  504. package/dist/src/{execution/remote-agent-dispatch.d.ts → subagents/remote-dispatch.d.ts} +3 -2
  505. package/dist/src/subagents/remote-dispatch.js +1 -0
  506. package/dist/src/{execution/subagent-start-local.d.ts → subagents/start-local.d.ts} +5 -6
  507. package/dist/src/subagents/start-local.js +1 -0
  508. package/dist/src/{execution/subagent-start-remote.d.ts → subagents/start-remote.d.ts} +5 -5
  509. package/dist/src/subagents/start-remote.js +1 -0
  510. package/dist/src/subagents/token-budget.js +1 -0
  511. package/dist/src/{execution/subagent-tool.d.ts → subagents/tool.d.ts} +5 -3
  512. package/dist/src/subagents/tool.js +1 -0
  513. package/dist/src/svelte/index.js +1 -1
  514. package/dist/src/svelte/use-eve-agent.js +1 -1
  515. package/dist/src/tasks/json.js +1 -1
  516. package/dist/src/tasks/session-index.d.ts +2 -3
  517. package/dist/src/tasks/session-index.js +1 -1
  518. package/dist/src/tasks/task-id.d.ts +3 -4
  519. package/dist/src/tasks/task-id.js +1 -1
  520. package/dist/src/tasks/transitions.d.ts +3 -47
  521. package/dist/src/tasks/transitions.js +1 -1
  522. package/dist/src/tasks/types.d.ts +70 -247
  523. package/dist/src/tasks/types.js +1 -1
  524. package/dist/src/tools/dynamic.d.ts +3 -1
  525. package/dist/src/tools/framework/agent.d.ts +18 -2
  526. package/dist/src/tools/framework/agent.js +1 -1
  527. package/dist/src/tools/framework/task-cancel.d.ts +2 -6
  528. package/dist/src/tools/framework/task-contract.d.ts +44 -65
  529. package/dist/src/tools/framework/task-contract.js +1 -1
  530. package/dist/src/tools/framework/task-update.d.ts +1 -0
  531. package/dist/src/tools/framework/task-update.js +1 -1
  532. package/dist/src/tools/provided/sleep.d.ts +2 -2
  533. package/dist/src/vue/index.js +1 -1
  534. package/dist/src/vue/use-eve-agent.js +1 -1
  535. package/docs/agent-config.md +24 -19
  536. package/docs/channels/eve.mdx +1 -1
  537. package/docs/concepts/built-in-tools.md +10 -91
  538. package/docs/concepts/context-control.md +2 -2
  539. package/docs/concepts/execution-model-and-durability.mdx +1 -1
  540. package/docs/concepts/sessions-runs-and-streaming.md +11 -3
  541. package/docs/guides/client/streaming.mdx +1 -1
  542. package/docs/guides/deployment/vercel.mdx +20 -2
  543. package/docs/guides/dynamic-capabilities.md +2 -2
  544. package/docs/guides/frontend/overview.mdx +1 -1
  545. package/docs/guides/instrumentation-providers.md +242 -0
  546. package/docs/guides/instrumentation.md +2 -0
  547. package/docs/guides/meta.json +1 -0
  548. package/docs/guides/remote-agents.md +8 -9
  549. package/docs/memory/overview.mdx +1 -1
  550. package/docs/reference/cli.md +5 -2
  551. package/docs/sandbox.mdx +3 -1
  552. package/docs/subagents/index.mdx +9 -8
  553. package/docs/tools/overview.mdx +11 -10
  554. package/docs/tools/workflows.mdx +52 -18
  555. package/package.json +38 -13
  556. package/dist/src/compiled/@vercel/sandbox-delete/api-client/index.d.ts +0 -2
  557. package/dist/src/compiled/@vercel/sandbox-delete/index.js +0 -9
  558. package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +0 -201
  559. package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +0 -8
  560. package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +0 -5
  561. package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +0 -1456
  562. package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +0 -29
  563. package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +0 -39
  564. package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +0 -66
  565. package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +0 -2
  566. package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +0 -899
  567. package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +0 -10
  568. package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +0 -15
  569. package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +0 -18
  570. package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +0 -6
  571. package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +0 -111
  572. package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +0 -28
  573. package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +0 -40
  574. package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +0 -292
  575. package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +0 -5
  576. package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +0 -116
  577. package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +0 -258
  578. package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +0 -12
  579. package/dist/src/compiled/@vercel/sandbox-stable/index.js +0 -1
  580. package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +0 -169
  581. package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +0 -55
  582. package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +0 -212
  583. package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +0 -1216
  584. package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +0 -433
  585. package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +0 -229
  586. package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +0 -21
  587. package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +0 -16
  588. package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +0 -15
  589. package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +0 -11
  590. package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +0 -11
  591. package/dist/src/compiled/_chunks/node/decode_jwt-Col8JOnf.js +0 -7
  592. package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +0 -1
  593. package/dist/src/compiled/_chunks/node/version-DH6yRy-M.js +0 -1
  594. package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +0 -40
  595. package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +0 -3
  596. package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +0 -3
  597. package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +0 -1
  598. package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +0 -1
  599. package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +0 -15
  600. package/dist/src/execution/agent-continuation-bundle.js +0 -1
  601. package/dist/src/execution/agent-handle-dispatch.d.ts +0 -79
  602. package/dist/src/execution/agent-handle-dispatch.js +0 -1
  603. package/dist/src/execution/delegated-parent-notification.js +0 -1
  604. package/dist/src/execution/delegated-parent-result.js +0 -1
  605. package/dist/src/execution/delegation-tool.d.ts +0 -10
  606. package/dist/src/execution/delegation-tool.js +0 -1
  607. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +0 -165
  608. package/dist/src/execution/dispatch-runtime-actions-shared.js +0 -1
  609. package/dist/src/execution/dispatch-runtime-actions-start.js +0 -1
  610. package/dist/src/execution/dispatch-runtime-actions-step.d.ts +0 -18
  611. package/dist/src/execution/dispatch-runtime-actions-step.js +0 -1
  612. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +0 -18
  613. package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +0 -1
  614. package/dist/src/execution/finalize-terminal-session.d.ts +0 -17
  615. package/dist/src/execution/finalize-terminal-session.js +0 -1
  616. package/dist/src/execution/prepared-agent-action.d.ts +0 -7
  617. package/dist/src/execution/prepared-agent-action.js +0 -1
  618. package/dist/src/execution/remote-agent-dispatch.js +0 -1
  619. package/dist/src/execution/session-callback-route.js +0 -1
  620. package/dist/src/execution/session-callback-step.js +0 -1
  621. package/dist/src/execution/subagent-adapter.js +0 -1
  622. package/dist/src/execution/subagent-event-proxy-step.js +0 -1
  623. package/dist/src/execution/subagent-start-local.js +0 -1
  624. package/dist/src/execution/subagent-start-remote.js +0 -1
  625. package/dist/src/execution/subagent-tool.js +0 -1
  626. package/dist/src/execution/tasks/child/instructions.d.ts +0 -3
  627. package/dist/src/execution/tasks/child/instructions.js +0 -1
  628. package/dist/src/execution/tasks/parent/agent-identity.d.ts +0 -13
  629. package/dist/src/execution/tasks/parent/agent-identity.js +0 -1
  630. package/dist/src/execution/tasks/parent/agent-views.d.ts +0 -7
  631. package/dist/src/execution/tasks/parent/agent-views.js +0 -1
  632. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +0 -43
  633. package/dist/src/execution/tasks/parent/continuation-dispatch.js +0 -1
  634. package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +0 -19
  635. package/dist/src/execution/tasks/parent/dispatch-task-step.js +0 -1
  636. package/dist/src/execution/tool-run/answer.js +0 -1
  637. package/dist/src/execution/tool-run/background.d.ts +0 -14
  638. package/dist/src/execution/tool-run/background.js +0 -1
  639. package/dist/src/execution/tool-run/cancel.d.ts +0 -7
  640. package/dist/src/execution/tool-run/cancel.js +0 -1
  641. package/dist/src/execution/tool-run/dispatch.d.ts +0 -24
  642. package/dist/src/execution/tool-run/dispatch.js +0 -1
  643. package/dist/src/execution/tool-run/emit-run-report-step.d.ts +0 -7
  644. package/dist/src/execution/tool-run/emit-run-report-step.js +0 -1
  645. package/dist/src/execution/tool-run/messages.d.ts +0 -70
  646. package/dist/src/execution/tool-run/messages.js +0 -1
  647. package/dist/src/execution/tool-run/owner-inbox.d.ts +0 -11
  648. package/dist/src/execution/tool-run/owner-inbox.js +0 -1
  649. package/dist/src/execution/tool-run/owner.d.ts +0 -13
  650. package/dist/src/execution/tool-run/owner.js +0 -1
  651. package/dist/src/execution/tool-run/run-control.d.ts +0 -18
  652. package/dist/src/execution/tool-run/run-control.js +0 -1
  653. package/dist/src/execution/tool-run/start.d.ts +0 -11
  654. package/dist/src/execution/tool-run/start.js +0 -1
  655. package/dist/src/execution/tool-run/types.d.ts +0 -21
  656. package/dist/src/execution/tool-run/types.js +0 -1
  657. package/dist/src/execution/tool-run/workflow.d.ts +0 -9
  658. package/dist/src/execution/tool-run/workflow.js +0 -1
  659. package/dist/src/execution/tools/subagent/local.d.ts +0 -40
  660. package/dist/src/execution/tools/subagent/local.js +0 -1
  661. package/dist/src/execution/tools/subagent/remote.d.ts +0 -26
  662. package/dist/src/execution/tools/subagent/remote.js +0 -1
  663. package/dist/src/harness/agent-handle-errors.js +0 -1
  664. package/dist/src/harness/handles/query.js +0 -1
  665. package/dist/src/harness/handles/store.js +0 -1
  666. package/dist/src/harness/handles/transitions.d.ts +0 -167
  667. package/dist/src/harness/handles/transitions.js +0 -1
  668. package/dist/src/harness/runtime-actions.js +0 -1
  669. package/dist/src/harness/session-token-limits.d.ts +0 -41
  670. package/dist/src/harness/session-token-limits.js +0 -1
  671. package/dist/src/harness/subagent-depth.d.ts +0 -10
  672. package/dist/src/harness/subagent-depth.js +0 -1
  673. package/dist/src/harness/subagent-token-budget.js +0 -1
  674. package/dist/src/harness/tool-runs.d.ts +0 -21
  675. package/dist/src/harness/tool-runs.js +0 -1
  676. package/dist/src/harness/turn-sleep.d.ts +0 -12
  677. package/dist/src/harness/turn-sleep.js +0 -1
  678. package/dist/src/harness/workflow-runtime-action-state.d.ts +0 -9
  679. package/dist/src/harness/workflow-runtime-action-state.js +0 -1
  680. package/dist/src/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +0 -16
  681. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js +0 -1
  682. package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js +0 -1
  683. package/dist/src/node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js +0 -1
  684. package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js +0 -5
  685. package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js +0 -1
  686. package/dist/src/runtime/actions/keys.d.ts +0 -14
  687. package/dist/src/runtime/actions/keys.js +0 -1
  688. package/dist/src/tasks/wire.d.ts +0 -25
  689. package/dist/src/tasks/wire.js +0 -1
  690. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/LICENSE +0 -0
  691. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_async-retry.d.ts +0 -0
  692. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_workflow-serde.d.ts +0 -0
  693. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-error.d.ts +0 -0
  694. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/base-client.d.ts +0 -0
  695. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/file-writer.d.ts +0 -0
  696. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/with-retry.d.ts +0 -0
  697. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/error.d.ts +0 -0
  698. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/file.d.ts +0 -0
  699. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/index.d.ts +0 -0
  700. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/oauth.d.ts +0 -0
  701. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/poll-for-token.d.ts +0 -0
  702. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/project.d.ts +0 -0
  703. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/command.d.ts +0 -0
  704. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/execution-context.d.ts +0 -0
  705. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/filesystem.d.ts +0 -0
  706. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/network-policy.d.ts +0 -0
  707. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/proxy.d.ts +0 -0
  708. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox-user.d.ts +0 -0
  709. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/session.d.ts +0 -0
  710. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/snapshot.d.ts +0 -0
  711. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/get-credentials.d.ts +0 -0
  712. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/paginator.d.ts +0 -0
  713. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/resolveSignal.d.ts +0 -0
  714. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/sandbox-snapshot.d.ts +0 -0
  715. /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/types.d.ts +0 -0
  716. /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.d.ts +0 -0
  717. /package/dist/src/execution/{tool-run → tools/workflow}/owner-channels.js +0 -0
  718. /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.d.ts +0 -0
  719. /package/dist/src/execution/{tool-run → tools/workflow}/resume-hook-step.js +0 -0
  720. /package/dist/src/{execution/subagent-adapter.d.ts → subagents/adapter.d.ts} +0 -0
  721. /package/dist/src/{execution/session-callback-route.d.ts → subagents/callback-route.d.ts} +0 -0
  722. /package/dist/src/{execution/session-callback-step.d.ts → subagents/callback-step.d.ts} +0 -0
  723. /package/dist/src/{harness → subagents}/handles/operation-id.d.ts +0 -0
  724. /package/dist/src/{harness → subagents}/handles/operation-id.js +0 -0
  725. /package/dist/src/{harness → subagents}/handles/state-key.d.ts +0 -0
  726. /package/dist/src/{harness → subagents}/handles/state-key.js +0 -0
  727. /package/dist/src/{execution/subagent-hitl-proxy.d.ts → subagents/hitl-proxy.d.ts} +0 -0
  728. /package/dist/src/{execution/subagent-hitl-proxy.js → subagents/hitl-proxy.js} +0 -0
  729. /package/dist/src/{execution/subagent-invocation.d.ts → subagents/invocation.d.ts} +0 -0
  730. /package/dist/src/{execution/subagent-invocation.js → subagents/invocation.js} +0 -0
  731. /package/dist/src/{execution/delegated-parent-result.d.ts → subagents/parent-result.d.ts} +0 -0
  732. /package/dist/src/{execution/remote-agent-route-url.d.ts → subagents/remote-route-url.d.ts} +0 -0
  733. /package/dist/src/{execution/remote-agent-route-url.js → subagents/remote-route-url.js} +0 -0
  734. /package/dist/src/{harness/subagent-token-budget.d.ts → subagents/token-budget.d.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ import type { VersionMigration } from "#execution/durable-session-migrations/chain.js";
2
+ /** Advances version-4 payloads to the additive token-cost schema. */
3
+ export declare const sessionInboxWireV4Migration: VersionMigration;
@@ -0,0 +1 @@
1
+ import{isObject}from"#shared/guards.js";const sessionInboxWireV4Migration={from:4,migrate(e){if(!isObject(e))throw Error(`session inbox wire v4 value is not an object.`);return{...e,version:5}},to:5};export{sessionInboxWireV4Migration};
@@ -0,0 +1,341 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
3
+ /** Version 6 adds session-owned task cancellation to the cancel command. */
4
+ export declare const sessionInboxWireV6Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ auth: z.ZodOptional<z.ZodNullable<z.ZodObject<{
6
+ attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
7
+ authenticator: z.ZodString;
8
+ issuer: z.ZodOptional<z.ZodString>;
9
+ principalId: z.ZodString;
10
+ principalType: z.ZodString;
11
+ subject: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>>>;
13
+ kind: z.ZodLiteral<"deliver">;
14
+ requestId: z.ZodOptional<z.ZodString>;
15
+ taskDeliveryId: z.ZodOptional<z.ZodString>;
16
+ turnPolicy: z.ZodOptional<z.ZodEnum<{
17
+ queue: "queue";
18
+ steer: "steer";
19
+ }>>;
20
+ caller: z.ZodOptional<z.ZodObject<{
21
+ callId: z.ZodString;
22
+ replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
23
+ kind: z.ZodLiteral<"hook">;
24
+ token: z.ZodString;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"callback">;
27
+ token: z.ZodString;
28
+ url: z.ZodString;
29
+ }, z.core.$strict>], "kind">;
30
+ subagentName: z.ZodString;
31
+ taskId: z.ZodOptional<z.ZodString>;
32
+ activityObserver: z.ZodOptional<z.ZodObject<{
33
+ sink: z.ZodObject<{
34
+ url: z.ZodString;
35
+ version: z.ZodLiteral<1>;
36
+ }, z.core.$strict>;
37
+ workIdentity: z.ZodOptional<z.ZodObject<{
38
+ callId: z.ZodOptional<z.ZodString>;
39
+ id: z.ZodString;
40
+ kind: z.ZodEnum<{
41
+ "remote-agent": "remote-agent";
42
+ "root-turn": "root-turn";
43
+ subagent: "subagent";
44
+ task: "task";
45
+ }>;
46
+ name: z.ZodOptional<z.ZodString>;
47
+ parentId: z.ZodOptional<z.ZodString>;
48
+ rootSessionId: z.ZodString;
49
+ rootTurnId: z.ZodString;
50
+ sessionId: z.ZodOptional<z.ZodString>;
51
+ turnId: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strict>>;
53
+ }, z.core.$strict>>;
54
+ }, z.core.$strict>>;
55
+ deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ channelKind: z.ZodString;
57
+ channelName: z.ZodString;
58
+ deliveryId: z.ZodString;
59
+ payloadIndex: z.ZodNumber;
60
+ requestId: z.ZodOptional<z.ZodString>;
61
+ requestTraceContext: z.ZodOptional<z.ZodObject<{
62
+ spanId: z.ZodString;
63
+ traceFlags: z.ZodNumber;
64
+ traceId: z.ZodString;
65
+ }, z.core.$strict>>;
66
+ acceptedDeploymentId: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strict>>>;
68
+ payload: z.ZodObject<{
69
+ context: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ optionId: z.ZodOptional<z.ZodString>;
72
+ requestId: z.ZodString;
73
+ text: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strict>>>;
75
+ message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
77
+ text: z.ZodString;
78
+ type: z.ZodLiteral<"text">;
79
+ }, z.core.$strict>, z.ZodObject<{
80
+ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
81
+ mediaType: z.ZodOptional<z.ZodString>;
82
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
83
+ type: z.ZodLiteral<"image">;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
86
+ filename: z.ZodOptional<z.ZodString>;
87
+ mediaType: z.ZodString;
88
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
89
+ type: z.ZodLiteral<"file">;
90
+ }, z.core.$strict>], "type">>]>>;
91
+ outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
92
+ task: z.ZodOptional<z.ZodObject<{
93
+ agentRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ replyTo: z.ZodString;
95
+ request: z.ZodDiscriminatedUnion<[z.ZodObject<{
96
+ input: z.ZodObject<{
97
+ agentId: z.ZodOptional<z.ZodString>;
98
+ message: z.ZodString;
99
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>>;
100
+ target: z.ZodString;
101
+ }, z.core.$strict>;
102
+ invocationId: z.ZodString;
103
+ kind: z.ZodLiteral<"agent-invoke">;
104
+ }, z.core.$strict>, z.ZodObject<{
105
+ kind: z.ZodLiteral<"agent-settled">;
106
+ result: z.ZodObject<{
107
+ backgroundTask: z.ZodOptional<z.ZodObject<{
108
+ status: z.ZodLiteral<"working">;
109
+ taskId: z.ZodString;
110
+ }, z.core.$strict>>;
111
+ callId: z.ZodString;
112
+ isError: z.ZodOptional<z.ZodBoolean>;
113
+ kind: z.ZodLiteral<"subagent-result">;
114
+ origin: z.ZodLiteral<"child">;
115
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ kind: z.ZodLiteral<"parked">;
117
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
118
+ kind: z.ZodLiteral<"succeeded">;
119
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
122
+ kind: z.ZodLiteral<"failed">;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ kind: z.ZodLiteral<"cancelled">;
125
+ }, z.core.$strict>], "kind">;
126
+ usageDelta: z.ZodObject<{
127
+ cacheReadTokens: z.ZodNumber;
128
+ cacheWriteTokens: z.ZodNumber;
129
+ inputTokens: z.ZodNumber;
130
+ outputTokens: z.ZodNumber;
131
+ costUsd: z.ZodOptional<z.ZodNumber>;
132
+ }, z.core.$strip>;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ kind: z.ZodLiteral<"terminal">;
135
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ kind: z.ZodLiteral<"succeeded">;
137
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
140
+ kind: z.ZodLiteral<"failed">;
141
+ }, z.core.$strict>, z.ZodObject<{
142
+ kind: z.ZodLiteral<"cancelled">;
143
+ }, z.core.$strict>], "kind">;
144
+ usageDelta: z.ZodObject<{
145
+ cacheReadTokens: z.ZodNumber;
146
+ cacheWriteTokens: z.ZodNumber;
147
+ inputTokens: z.ZodNumber;
148
+ outputTokens: z.ZodNumber;
149
+ costUsd: z.ZodOptional<z.ZodNumber>;
150
+ }, z.core.$strip>;
151
+ }, z.core.$strict>], "kind">;
152
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
153
+ subagentName: z.ZodString;
154
+ usage: z.ZodOptional<z.ZodObject<{
155
+ cacheReadTokens: z.ZodNumber;
156
+ cacheWriteTokens: z.ZodNumber;
157
+ inputTokens: z.ZodNumber;
158
+ outputTokens: z.ZodNumber;
159
+ costUsd: z.ZodOptional<z.ZodNumber>;
160
+ }, z.core.$strip>>;
161
+ }, z.core.$strict>;
162
+ }, z.core.$strict>], "kind">;
163
+ taskId: z.ZodString;
164
+ }, z.core.$strict>>>;
165
+ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
166
+ hookPayload: z.ZodObject<{
167
+ callId: z.ZodString;
168
+ childSessionId: z.ZodString;
169
+ event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
170
+ kind: z.ZodLiteral<"subagent-authorization-event">;
171
+ subagentName: z.ZodString;
172
+ }, z.core.$strict>;
173
+ taskId: z.ZodString;
174
+ }, z.core.$strict>>>;
175
+ inputRequests: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
176
+ replyTo: z.ZodString;
177
+ sequence: z.ZodNumber;
178
+ stepIndex: z.ZodNumber;
179
+ taskId: z.ZodString;
180
+ turnId: z.ZodString;
181
+ request: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
182
+ }, z.core.$loose>, z.ZodObject<{
183
+ replyTo: z.ZodString;
184
+ sequence: z.ZodNumber;
185
+ stepIndex: z.ZodNumber;
186
+ taskId: z.ZodString;
187
+ turnId: z.ZodString;
188
+ requests: z.ZodArray<z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>;
189
+ }, z.core.$loose>]>>>;
190
+ views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
191
+ }, z.core.$strict>>;
192
+ }, z.core.$loose>;
193
+ payloads: z.ZodArray<z.ZodObject<{
194
+ context: z.ZodOptional<z.ZodArray<z.ZodString>>;
195
+ inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
196
+ optionId: z.ZodOptional<z.ZodString>;
197
+ requestId: z.ZodString;
198
+ text: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strict>>>;
200
+ message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
201
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
202
+ text: z.ZodString;
203
+ type: z.ZodLiteral<"text">;
204
+ }, z.core.$strict>, z.ZodObject<{
205
+ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
206
+ mediaType: z.ZodOptional<z.ZodString>;
207
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
208
+ type: z.ZodLiteral<"image">;
209
+ }, z.core.$strict>, z.ZodObject<{
210
+ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
211
+ filename: z.ZodOptional<z.ZodString>;
212
+ mediaType: z.ZodString;
213
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
214
+ type: z.ZodLiteral<"file">;
215
+ }, z.core.$strict>], "type">>]>>;
216
+ outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
217
+ task: z.ZodOptional<z.ZodObject<{
218
+ agentRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
219
+ replyTo: z.ZodString;
220
+ request: z.ZodDiscriminatedUnion<[z.ZodObject<{
221
+ input: z.ZodObject<{
222
+ agentId: z.ZodOptional<z.ZodString>;
223
+ message: z.ZodString;
224
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>>;
225
+ target: z.ZodString;
226
+ }, z.core.$strict>;
227
+ invocationId: z.ZodString;
228
+ kind: z.ZodLiteral<"agent-invoke">;
229
+ }, z.core.$strict>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"agent-settled">;
231
+ result: z.ZodObject<{
232
+ backgroundTask: z.ZodOptional<z.ZodObject<{
233
+ status: z.ZodLiteral<"working">;
234
+ taskId: z.ZodString;
235
+ }, z.core.$strict>>;
236
+ callId: z.ZodString;
237
+ isError: z.ZodOptional<z.ZodBoolean>;
238
+ kind: z.ZodLiteral<"subagent-result">;
239
+ origin: z.ZodLiteral<"child">;
240
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
241
+ kind: z.ZodLiteral<"parked">;
242
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
243
+ kind: z.ZodLiteral<"succeeded">;
244
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
247
+ kind: z.ZodLiteral<"failed">;
248
+ }, z.core.$strict>, z.ZodObject<{
249
+ kind: z.ZodLiteral<"cancelled">;
250
+ }, z.core.$strict>], "kind">;
251
+ usageDelta: z.ZodObject<{
252
+ cacheReadTokens: z.ZodNumber;
253
+ cacheWriteTokens: z.ZodNumber;
254
+ inputTokens: z.ZodNumber;
255
+ outputTokens: z.ZodNumber;
256
+ costUsd: z.ZodOptional<z.ZodNumber>;
257
+ }, z.core.$strip>;
258
+ }, z.core.$strict>, z.ZodObject<{
259
+ kind: z.ZodLiteral<"terminal">;
260
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
261
+ kind: z.ZodLiteral<"succeeded">;
262
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
263
+ }, z.core.$strict>, z.ZodObject<{
264
+ error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
265
+ kind: z.ZodLiteral<"failed">;
266
+ }, z.core.$strict>, z.ZodObject<{
267
+ kind: z.ZodLiteral<"cancelled">;
268
+ }, z.core.$strict>], "kind">;
269
+ usageDelta: z.ZodObject<{
270
+ cacheReadTokens: z.ZodNumber;
271
+ cacheWriteTokens: z.ZodNumber;
272
+ inputTokens: z.ZodNumber;
273
+ outputTokens: z.ZodNumber;
274
+ costUsd: z.ZodOptional<z.ZodNumber>;
275
+ }, z.core.$strip>;
276
+ }, z.core.$strict>], "kind">;
277
+ output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
278
+ subagentName: z.ZodString;
279
+ usage: z.ZodOptional<z.ZodObject<{
280
+ cacheReadTokens: z.ZodNumber;
281
+ cacheWriteTokens: z.ZodNumber;
282
+ inputTokens: z.ZodNumber;
283
+ outputTokens: z.ZodNumber;
284
+ costUsd: z.ZodOptional<z.ZodNumber>;
285
+ }, z.core.$strip>>;
286
+ }, z.core.$strict>;
287
+ }, z.core.$strict>], "kind">;
288
+ taskId: z.ZodString;
289
+ }, z.core.$strict>>>;
290
+ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
291
+ hookPayload: z.ZodObject<{
292
+ callId: z.ZodString;
293
+ childSessionId: z.ZodString;
294
+ event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
295
+ kind: z.ZodLiteral<"subagent-authorization-event">;
296
+ subagentName: z.ZodString;
297
+ }, z.core.$strict>;
298
+ taskId: z.ZodString;
299
+ }, z.core.$strict>>>;
300
+ inputRequests: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
301
+ replyTo: z.ZodString;
302
+ sequence: z.ZodNumber;
303
+ stepIndex: z.ZodNumber;
304
+ taskId: z.ZodString;
305
+ turnId: z.ZodString;
306
+ request: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
307
+ }, z.core.$loose>, z.ZodObject<{
308
+ replyTo: z.ZodString;
309
+ sequence: z.ZodNumber;
310
+ stepIndex: z.ZodNumber;
311
+ taskId: z.ZodString;
312
+ turnId: z.ZodString;
313
+ requests: z.ZodArray<z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>;
314
+ }, z.core.$loose>]>>>;
315
+ views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
316
+ }, z.core.$strict>>;
317
+ }, z.core.$loose>>;
318
+ version: z.ZodLiteral<6>;
319
+ }, z.core.$strict>, z.ZodObject<{
320
+ kind: z.ZodLiteral<"session-timeout">;
321
+ version: z.ZodLiteral<6>;
322
+ }, z.core.$strict>, z.ZodObject<{
323
+ kind: z.ZodLiteral<"clear">;
324
+ version: z.ZodLiteral<6>;
325
+ }, z.core.$strict>, z.ZodObject<{
326
+ kind: z.ZodLiteral<"compact">;
327
+ version: z.ZodLiteral<6>;
328
+ }, z.core.$strict>, z.ZodObject<{
329
+ kind: z.ZodLiteral<"reset">;
330
+ reason: z.ZodOptional<z.ZodString>;
331
+ version: z.ZodLiteral<6>;
332
+ }, z.core.$strict>, z.ZodObject<{
333
+ kind: z.ZodLiteral<"cancel">;
334
+ taskId: z.ZodOptional<z.ZodString>;
335
+ turnId: z.ZodOptional<z.ZodString>;
336
+ tasks: z.ZodOptional<z.ZodBoolean>;
337
+ version: z.ZodLiteral<6>;
338
+ }, z.core.$strict>], "kind">;
339
+ export type SessionInboxWireV6 = z.infer<typeof sessionInboxWireV6Schema>;
340
+ /** Builds and validates one complete version-6 wire value. */
341
+ export declare function encodeSessionCommandV6(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV6;
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";import{formatValidationError}from"#runtime/validation.js";import{SessionInboxWireError}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV5,sessionInboxWireV5Schema}from"#execution/wire/session-inbox-wire.v5.js";const v5=sessionInboxWireV5Schema.options,v5Cancel=v5[5],version=z.literal(6),sessionInboxWireV6Schema=z.discriminatedUnion(`kind`,[v5[0].extend({version}),v5[1].extend({version}),v5[2].extend({version}),v5[3].extend({version}),v5[4].extend({version}),v5Cancel.extend({tasks:z.boolean().optional(),version})]);function encodeSessionCommandV6(e){let r={...encodeSessionCommandV5(withoutOwnedTaskCancellation(e)),version:6};e.kind===`cancel`&&(r.tasks=e.tasks);let i=sessionInboxWireV6Schema.safeParse(r);if(!i.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 6: ${formatValidationError(i.error)}`);return i.data}function withoutOwnedTaskCancellation(e){if(e.kind!==`cancel`||e.tasks===void 0)return e;let{tasks:t,...n}=e;return n}export{encodeSessionCommandV6,sessionInboxWireV6Schema};
@@ -8,6 +8,9 @@ export declare function finalizeExpiredSession(input: {
8
8
  readonly mode: RunMode;
9
9
  readonly serializedContext: Record<string, unknown>;
10
10
  readonly sessionState: DurableSessionState;
11
+ readonly terminalState?: {
12
+ terminalEmitted: boolean;
13
+ };
11
14
  }): Promise<{
12
15
  readonly output: unknown;
13
16
  }>;
@@ -17,6 +20,9 @@ export declare function finalizeDone(input: {
17
20
  };
18
21
  readonly caller: TurnCaller | undefined;
19
22
  readonly mode: RunMode;
23
+ readonly terminalState?: {
24
+ terminalEmitted: boolean;
25
+ };
20
26
  }): Promise<{
21
27
  readonly output: unknown;
22
28
  }>;
@@ -1 +1 @@
1
- import{notifyDelegatedParentStep,notifyTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult}from"#execution/delegated-parent-result.js";import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{emitTerminalSessionCompletionStep}from"#execution/terminal-session-completion-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";async function finalizeExpiredSession(t){return await terminateChildSessionsStep({serializedContext:t.serializedContext,sessionState:t.sessionState}),await emitTerminalSessionCompletionStep({parentWritable:t.driverWritable,serializedContext:t.serializedContext}),t.mode===`task`?(await fireSessionCallbackStep({output:``,serializedContext:t.serializedContext,status:`completed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentSuccessResult(t.serializedContext,``),serializedContext:t.serializedContext})):t.caller!==void 0&&await notifyTurnCallerStep({caller:t.caller,lifecycle:`terminal`,sessionId:t.sessionState.sessionId,settled:{output:``}}),{output:``}}async function finalizeDone(n){let{output:r,serializedContext:i}=n.action,a=n.action.isError===!0;if(await terminateChildSessionsStep({serializedContext:i,sessionState:n.action.sessionState}),n.mode===`task`)await fireSessionCallbackStep({error:a?r:void 0,output:a?void 0:r,serializedContext:i,status:a?`failed`:`completed`,usage:n.action.usage}),await notifyDelegatedParentStep({result:a?createDelegatedSubagentErrorResult(i,r):createDelegatedSubagentSuccessResult(i,r),serializedContext:i,usage:n.action.usage});else{let e={output:r,usage:n.action.usageDelta};a&&(e.isError=!0),n.caller!==void 0&&await notifyTurnCallerStep({caller:n.caller,lifecycle:`terminal`,sessionId:n.action.sessionState.sessionId,settled:e})}return{output:r}}export{finalizeDone,finalizeExpiredSession};
1
+ import{fireSessionCallbackStep}from"#subagents/callback-step.js";import{notifyDelegatedParentStep,notifyTurnCallerStep}from"#subagents/parent-notification.js";import{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult}from"#subagents/parent-result.js";import{emitTerminalSessionCompletionStep}from"#execution/terminal-session-completion-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";async function finalizeExpiredSession(t){return await terminateChildSessionsStep({serializedContext:t.serializedContext,sessionState:t.sessionState}),await emitTerminalSessionCompletionStep({parentWritable:t.driverWritable,serializedContext:t.serializedContext}),t.terminalState!==void 0&&(t.terminalState.terminalEmitted=!0),t.mode===`task`?(await fireSessionCallbackStep({output:``,serializedContext:t.serializedContext,status:`completed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentSuccessResult(t.serializedContext,``),serializedContext:t.serializedContext})):t.caller!==void 0&&await notifyTurnCallerStep({caller:t.caller,lifecycle:`terminal`,sessionId:t.sessionState.sessionId,settled:{output:``}}),{output:``}}async function finalizeDone(n){let{output:r,serializedContext:i}=n.action,a=n.action.isError===!0;if(await terminateChildSessionsStep({serializedContext:i,sessionState:n.action.sessionState}),n.terminalState!==void 0&&(n.terminalState.terminalEmitted=!0),n.mode===`task`)await fireSessionCallbackStep({error:a?r:void 0,output:a?void 0:r,serializedContext:i,status:a?`failed`:`completed`,usage:n.action.usage}),await notifyDelegatedParentStep({result:a?createDelegatedSubagentErrorResult(i,r):createDelegatedSubagentSuccessResult(i,r),serializedContext:i,usage:n.action.usage});else{let e={output:r,usage:n.action.usageDelta};a&&(e.isError=!0),n.caller!==void 0&&await notifyTurnCallerStep({caller:n.caller,lifecycle:`terminal`,sessionId:n.action.sessionState.sessionId,settled:e})}return{output:r}}export{finalizeDone,finalizeExpiredSession};
@@ -13,6 +13,7 @@ export interface WorkflowEntryInput {
13
13
  readonly limits?: RunInput["limits"];
14
14
  readonly sessionTimeoutMs?: number | false;
15
15
  readonly serializedContext: Record<string, unknown>;
16
+ readonly taskId?: string;
16
17
  }
17
18
  export interface WorkflowEntryResult {
18
19
  readonly output: unknown;
@@ -26,7 +27,7 @@ export interface WorkflowEntryResult {
26
27
  *
27
28
  * Owns the stable command inbox, its channel alias, and the session lifecycle; each turn-owned
28
29
  * turn resolves its own runtime actions in-line and reports back only
29
- * `done`/`park` via the closed `NextDriverAction` contract. The
30
+ * `done`/`park` via the closed-contract {@link NextDriverAction}. The
30
31
  * only session-shape flag the driver reads (besides identity) is
31
32
  * `hasProxyInputRequests`, the documented short-circuit for hook-payload
32
33
  * routing to any descendant still active when the parent parks.
@@ -1 +1 @@
1
- import{attachClientContext,readClientContext}from"#internal/client-context.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{CHANNEL_CONTEXT_KEY_NAME,SESSION_CALLBACK_CONTEXT_KEY_NAME}from"#context/key-names.js";import{getWorkflowMetadata,getWritable}from"#compiled/@workflow/core/index.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{isTaskOwnedSerializedContext}from"#execution/tasks/child/instructions.js";import{SUBAGENT_ADAPTER_KIND}from"#execution/subagent-adapter-state.js";import{activeTurnId}from"#harness/active-turn-id.js";import{readSerializedSubagentDepth}from"#harness/subagent-depth.js";import{readChannelRequestId,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{bindTurnCallerContextStep,notifyCancelledTaskCallerStep,notifyDelegatedParentStep,notifyTaskTurnStartedStep,notifyTurnCallerStep,resolveInitialTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult}from"#execution/delegated-parent-result.js";import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{nextTurnDelivery}from"#execution/parked-delivery-wait.js";import{dispatchAndAwaitTurn}from"#execution/turn-dispatch.js";import{finalizeDone}from"#execution/workflow-entry-finalization.js";import{createSessionStep}from"#execution/create-session-step.js";import{settleCancelledTurnStep}from"#execution/settle-cancelled-turn-step.js";import{emitTerminalSessionFailureStep}from"#execution/terminal-session-failure-step.js";import{finalizeTerminalSession}from"#execution/finalize-terminal-session.js";import{createSessionCommandInbox}from"#execution/session-command-inbox.js";import{DEFAULT_SESSION_TIMEOUT_MS}from"#execution/session-timeout.js";import{createSessionTimeoutControl}from"#execution/session-timeout-control.js";import{settleContinuationConflictStep}from"#execution/continuation-conflict-step.js";async function workflowEntry(r){"use workflow";let{workflowRunId:i,workflowStartedAt:l}=getWorkflowMetadata(),u=r.serializedContext[`eve.continuationToken`]||``,m=r.serializedContext[`eve.mode`],h=r.serializedContext[`eve.capabilities`],_=r.serializedContext[`eve.bundle`];r.serializedContext[`eve.sessionId`]=i;let S=getWritable(),w={activeTurnId:void 0,caller:void 0,callerResolved:!1,lastSessionState:void 0,serializedContext:r.serializedContext,terminalEmitted:!1};try{let a=readRootSessionId(r.serializedContext),o=readSerializedSubagentDepth(r.serializedContext),g=r.serializedContext[`eve.dynamicSubagentAgentConfig`],v=createSessionCommandInbox(),y=sessionCommandHookToken(i),b=`${i}:auth`,x,C;try{let[n,d,p,T]=await Promise.allSettled([createSessionStep({compiledArtifactsSource:_.source,continuationToken:u,dynamicSubagentAgentConfig:g,inheritedLimits:r.limits,nodeId:_.nodeId,outputSchema:r.input.outputSchema,rootSessionId:a,sessionId:i,subagentDepth:o,taskOwned:isTaskOwnedSerializedContext(r.serializedContext)}),v.claimStable(y),v.claimAuthorization(b),v.rekeyContinuation(u)]);if(n.status===`rejected`)throw n.reason;if(d.status===`rejected`)throw d.reason;if(p.status===`rejected`)throw p.reason;if(T.status===`rejected`){if(isHookConflictError(T.reason))return(r.activityCollectorRunId!==void 0||r.continuationConflictCommand!==void 0)&&await settleContinuationConflictStep({activityCollectorRunId:r.activityCollectorRunId,command:r.continuationConflictCommand,continuationToken:u,ownerSessionId:typeof T.reason.conflictingRunId==`string`?T.reason.conflictingRunId:void 0}),{output:``};throw T.reason}x=n.value.state,w.lastSessionState=x,hasGuaranteedRootLineage(r.serializedContext)||(w.caller=await resolveInitialTurnCallerStep({serializedContext:r.serializedContext})),w.callerResolved=!0,C=await runDriverLoop({capabilities:h,commandInbox:v,driverWritable:S,initialInput:{deliveryMetadata:r.serializedContext[`eve.channelDelivery`]===void 0?void 0:[{...r.serializedContext[`eve.channelDelivery`],payloadIndex:0}],kind:`deliver`,payloads:[attachClientContext({message:r.input.message,context:r.input.context,outputSchema:r.input.outputSchema},readClientContext(r.input))],requestId:readChannelRequestId(r.serializedContext)},crashCleanupState:w,mode:m,serializedContext:r.serializedContext,sessionState:x,sessionTimeoutDeadline:r.sessionTimeoutMs===!1?void 0:new Date(l.getTime()+(r.sessionTimeoutMs??DEFAULT_SESSION_TIMEOUT_MS)),stableCommandToken:y})}finally{await v.dispose()}return C.kind===`result`?C.result:await finalizeTerminalSession({caller:w.caller,driverWritable:S,mode:m,notifyCaller:C.notifyCaller,serializedContext:C.serializedContext,sessionState:C.sessionState,terminalState:w})}catch(e){if(w.lastSessionState!==void 0&&await terminateChildSessionsStep({serializedContext:w.serializedContext,sessionState:w.lastSessionState}),!w.terminalEmitted)if(await emitTerminalSessionFailureStep({error:normalizeSerializableError(e),parentWritable:S,serializedContext:w.serializedContext,turnId:w.activeTurnId}),m===`task`)await fireSessionCallbackStep({error:normalizeSerializableError(e),serializedContext:r.serializedContext,status:`failed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentErrorResult(r.serializedContext,e),serializedContext:r.serializedContext});else{let t=await resolveCallerForCrash(w,r.serializedContext);t!==void 0&&await notifyTurnCallerStep({caller:t,lifecycle:`terminal`,sessionId:i,settled:{isError:!0,output:e}})}throw createSafeOuterWorkflowError()}}async function resolveCallerForCrash(e,t){if(e.callerResolved)return e.caller;try{return await resolveInitialTurnCallerStep({serializedContext:t})}catch{return}}function createSafeOuterWorkflowError(){let e=Error(`Agent workflow failed. Inspect the private session trace for details.`);return e.name=`EveWorkflowFailure`,e}function hasGuaranteedRootLineage(e){if(e[SESSION_CALLBACK_CONTEXT_KEY_NAME]!==void 0||e[`eve.parentSession`]!==void 0||e[`eve.subagentDepth`]!==void 0)return!1;let t=e[CHANNEL_CONTEXT_KEY_NAME];if(typeof t!=`object`||!t)return!1;let n=Reflect.get(t,`kind`);return typeof n==`string`&&n!==SUBAGENT_ADAPTER_KIND}async function runDriverLoop(e){let t=e.commandInbox,n=new Map,nextParkedActivity=async r=>{let c=new Set(r.expectedAttemptIds);for(let e of n.keys())c.has(e)||n.delete(e);for(;;){if(c.size>0&&[...c].every(e=>n.has(e))){let e=[...c].map(e=>n.get(e));return n.clear(),{kind:`authorization-resume`,payloads:e}}let r=await nextTurnDelivery({awaitAuthorizationCallbacks:c.size>0,bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,commandInbox:t,deferDeliveries:e.mode===`task`&&c.size>0,driverWritable:e.driverWritable,seenTaskDeliveries:s,stateCursor:l});if(r.kind!==`authorization`)return r;for(let e of r.payloads){let t=e.authorizationCallback;typeof t?.attemptId==`string`&&c.has(t.attemptId)&&!n.has(t.attemptId)&&n.set(t.attemptId,e)}if(r.closed){let e=[...n.values()];return n.clear(),{kind:`authorization-resume`,payloads:e}}}},r=0,nextTurnControlToken=()=>`${e.sessionState.sessionId}:turn-control:${String(r++)}`,i=[],a=[],o=new Set,s=new Set,c=e.sessionTimeoutDeadline===void 0?void 0:createSessionTimeoutControl({deadline:e.sessionTimeoutDeadline,token:e.stableCommandToken}),l=new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),d,runTurn=async n=>{let r=e.crashCleanupState.caller;r?.taskId!==void 0&&(s.add(r.taskId),await notifyTaskTurnStartedStep({caller:r,childSessionId:l.sessionState.sessionId,childTurnId:activeTurnId(l.sessionState.emissionState)}));let c=r===void 0?l.serializedContext:await bindTurnCallerContextStep({caller:r,serializedContext:l.serializedContext}),f=activeTurnId(l.sessionState.emissionState);e.crashCleanupState.activeTurnId=f;let p=await dispatchAndAwaitTurn({bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,capabilities:e.capabilities,commandInbox:t,controlToken:nextTurnControlToken(),delivery:n,mode:e.mode,parentWritable:e.driverWritable,serializedContext:c,seenTaskDeliveries:s,sessionState:l.sessionState});return e.crashCleanupState.activeTurnId=p.action.kind===`park`&&p.action.cancelled===!0?f:void 0,e.crashCleanupState.lastSessionState=p.action.sessionState,e.crashCleanupState.serializedContext=p.action.serializedContext,p.action.kind===`done`&&(e.crashCleanupState.terminalEmitted=!0),await d?.(),d=p.dispose,l.adoptState(p.action),p.action};try{await c?.start();let n=await runTurn(e.initialInput);for(;;){if(n.kind===`done`)return{kind:`result`,result:await finalizeDone({action:n,caller:e.crashCleanupState.caller,mode:e.mode})};if(n.kind!==`park`)throw Error(`Driver received unexpected turn action "${n.kind}".`);if(n.cancelled===!0){let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),e.crashCleanupState.activeTurnId=void 0,e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext;let n={caller:e.crashCleanupState.caller,sessionId:l.sessionState.sessionId};await notifyCancelledTaskCallerStep(t.usage===void 0?n:{...n,usage:t.usage})}l.sessionState.continuationToken&&await t.rekeyContinuation(l.sessionState.continuationToken);let r=n.settled;n.cancelled!==!0&&r!==void 0?(e.crashCleanupState.caller!==void 0&&await notifyTurnCallerStep({caller:e.crashCleanupState.caller,lifecycle:`parked`,sessionId:l.sessionState.sessionId,settled:r}),e.crashCleanupState.caller=void 0):n.cancelled===!0&&(e.crashCleanupState.caller=void 0);let i=await nextParkedActivity({expectedAttemptIds:n.authorizationAttemptIds??[]});if(e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext,i.kind===`authorization-resume`){n=await runTurn({kind:`deliver`,payloads:i.payloads});continue}if(i.kind===`expired`)return{kind:`terminal`,notifyCaller:!0,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`reset`)return{kind:`terminal`,notifyCaller:!1,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`clear`||i.kind===`compact`){n=await runTurn({kind:i.kind});continue}if(i.kind===`closed`)return{kind:`terminal`,notifyCaller:!1,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`cancel-turn`){await cancelDescendantTurnsStep({serializedContext:l.serializedContext,sessionState:l.sessionState});let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),n={...n,settled:void 0},e.crashCleanupState.caller=void 0,e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext;continue}i.delivery.caller!==void 0&&(e.crashCleanupState.caller=i.delivery.caller),n=await runTurn(i.delivery)}}finally{await d?.(),await c?.dispose()}}export{workflowEntry};
1
+ import{attachClientContext,readClientContext}from"#internal/client-context.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{getWorkflowMetadata,getWritable}from"#compiled/@workflow/core/index.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{readChannelRequestId,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{fireSessionCallbackStep}from"#subagents/callback-step.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{bindTurnCallerContextStep,notifyCancelledTaskCallerStep,notifyDelegatedParentStep,notifyTurnCallerStep,resolveInitialTurnCallerStep}from"#subagents/parent-notification.js";import{createDelegatedSubagentErrorResult}from"#subagents/parent-result.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{nextTurnDelivery}from"#execution/parked-delivery-wait.js";import{rebaseTaskAgentHandleMutations}from"#subagents/handles/rebase.js";import{dispatchAndAwaitTurn}from"#execution/turn-dispatch.js";import{createSessionStep}from"#execution/create-session-step.js";import{settleCancelledTurnStep}from"#execution/settle-cancelled-turn-step.js";import{emitTerminalSessionFailureStep}from"#execution/terminal-session-failure-step.js";import{finalizeDone,finalizeExpiredSession}from"#execution/workflow-entry-finalization.js";import{createSessionCommandInbox}from"#execution/session-command-inbox.js";import{DEFAULT_SESSION_TIMEOUT_MS}from"#execution/session-timeout.js";import{createSessionTimeoutControl}from"#execution/session-timeout-control.js";import{settleContinuationConflictStep}from"#execution/continuation-conflict-step.js";async function workflowEntry(c){"use workflow";let{workflowRunId:d,workflowStartedAt:f}=getWorkflowMetadata(),p=c.serializedContext[`eve.continuationToken`]||``,v=c.serializedContext[`eve.mode`],y=c.serializedContext[`eve.capabilities`],b=c.serializedContext[`eve.bundle`];c.serializedContext[`eve.sessionId`]=d;let x=getWritable(),C={caller:void 0,callerResolved:!1,lastSessionState:void 0,serializedContext:c.serializedContext,terminalEmitted:!1};try{let r=readRootSessionId(c.serializedContext),i=c.serializedContext[`eve.dynamicSubagentAgentConfig`],l=createSessionCommandInbox(),u=sessionCommandHookToken(d),m=`${d}:auth`,h,g;try{let[n,s,_,S]=await Promise.allSettled([createSessionStep({compiledArtifactsSource:b.source,continuationToken:p,dynamicSubagentAgentConfig:i,inheritedLimits:c.limits,nodeId:b.nodeId,outputSchema:c.input.outputSchema,rootSessionId:r,sessionId:d,taskId:c.taskId}),l.claimStable(u),l.claimAuthorization(m),l.rekeyContinuation(p)]);if(n.status===`rejected`)throw n.reason;if(s.status===`rejected`)throw s.reason;if(_.status===`rejected`)throw _.reason;if(S.status===`rejected`){if(isHookConflictError(S.reason))return(c.activityCollectorRunId!==void 0||c.continuationConflictCommand!==void 0)&&await settleContinuationConflictStep({activityCollectorRunId:c.activityCollectorRunId,command:c.continuationConflictCommand,continuationToken:p,ownerSessionId:typeof S.reason.conflictingRunId==`string`?S.reason.conflictingRunId:void 0}),{output:``};throw S.reason}h=n.value.state,C.lastSessionState=h,C.caller=hasDelegatedCallerContext(c.serializedContext)?await resolveInitialTurnCallerStep({serializedContext:c.serializedContext}):void 0,C.callerResolved=!0,g=await runDriverLoop({capabilities:y,commandInbox:l,driverWritable:x,initialInput:{deliveryMetadata:c.serializedContext[`eve.channelDelivery`]===void 0?void 0:[{...c.serializedContext[`eve.channelDelivery`],payloadIndex:0}],kind:`deliver`,payloads:[attachClientContext({message:c.input.message,context:c.input.context,outputSchema:c.input.outputSchema},readClientContext(c.input))],requestId:readChannelRequestId(c.serializedContext)},crashCleanupState:C,mode:v,serializedContext:c.serializedContext,sessionState:h,sessionTimeoutDeadline:c.sessionTimeoutMs===!1?void 0:new Date(f.getTime()+(c.sessionTimeoutMs??DEFAULT_SESSION_TIMEOUT_MS)),stableCommandToken:u})}finally{await l.dispose()}return g.kind===`result`?g.result:await finalizeExpiredSession({caller:C.caller,driverWritable:x,mode:v,serializedContext:g.serializedContext,sessionState:g.sessionState,terminalState:C})}catch(e){let t=C.terminalEmitted;throw!C.terminalEmitted&&C.lastSessionState!==void 0&&await terminateChildSessionsStep({serializedContext:C.serializedContext,sessionState:C.lastSessionState}),C.terminalEmitted||=(await emitTerminalSessionFailureStep({error:normalizeSerializableError(e),parentWritable:x,serializedContext:C.serializedContext,turnId:C.turnId}),!0),t||(v===`task`?(await fireSessionCallbackStep({error:normalizeSerializableError(e),serializedContext:C.serializedContext,status:`failed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentErrorResult(C.serializedContext,e),serializedContext:C.serializedContext})):(C.caller!==void 0||!C.callerResolved)&&await notifyTurnCallerStep({caller:await resolveCallerForCrash(C,C.serializedContext),lifecycle:`terminal`,sessionId:d,settled:{isError:!0,output:e}})),createSafeOuterWorkflowError()}}function hasDelegatedCallerContext(e){if(e[`eve.sessionCallback`]!==void 0)return!0;let t=e[`eve.channel`];return typeof t==`object`&&!!t&&Reflect.get(t,`kind`)===`subagent`}async function resolveCallerForCrash(e,t){if(e.callerResolved)return e.caller;try{return await resolveInitialTurnCallerStep({serializedContext:t})}catch{return}}function createSafeOuterWorkflowError(){let e=Error(`Agent workflow failed. Inspect the private session trace for details.`);return e.name=`EveWorkflowFailure`,e}async function runDriverLoop(e){let t=e.commandInbox,n=new Map,nextParkedActivity=async r=>{let c=new Set(r.expectedAttemptIds);for(let e of n.keys())c.has(e)||n.delete(e);for(;;){if(c.size>0&&[...c].every(e=>n.has(e))){let e=[...c].map(e=>n.get(e));return n.clear(),{kind:`authorization-resume`,payloads:e}}let r=await nextTurnDelivery({awaitAuthorizationCallbacks:c.size>0,bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,commandInbox:t,deferDeliveries:e.mode===`task`&&c.size>0,driverWritable:e.driverWritable,seenTaskDeliveries:s,stateCursor:l});if(r.kind!==`authorization`)return r;for(let e of r.payloads){let t=e.authorizationCallback;typeof t?.attemptId==`string`&&c.has(t.attemptId)&&!n.has(t.attemptId)&&n.set(t.attemptId,e)}if(r.closed){let e=[...n.values()];return n.clear(),{kind:`authorization-resume`,payloads:e}}}},r=0,nextTurnControlToken=()=>`${e.sessionState.sessionId}:turn-control:${String(r++)}`,i=[],a=[],o=new Set,s=new Set,l=new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),u=e.sessionTimeoutDeadline===void 0?void 0:createSessionTimeoutControl({deadline:e.sessionTimeoutDeadline,token:e.stableCommandToken}),m,runTurn=async n=>{let c=l.sessionState,u=e.crashCleanupState.caller;u?.taskId!==void 0&&s.add(u.taskId);let d=u===void 0?l.serializedContext:await bindTurnCallerContextStep({caller:u,serializedContext:l.serializedContext});e.crashCleanupState.turnId=`turn_${String(r)}`;let p=await dispatchAndAwaitTurn({bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,capabilities:e.capabilities,commandInbox:t,controlToken:nextTurnControlToken(),delivery:n,mode:e.mode,parentWritable:e.driverWritable,serializedContext:d,seenTaskDeliveries:s,sessionState:l.sessionState,stateCursor:l});await m?.(),m=p.dispose;let h=l.sessionState===c?p.action:rebaseTaskAgentHandleMutations(p.action,l.sessionState,c);return l.adoptState(h),e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext,h};try{await u?.start();let n=await runTurn(e.initialInput);for(;;){if(n.kind===`done`)return{kind:`result`,result:await finalizeDone({action:n,caller:e.crashCleanupState.caller,mode:e.mode,terminalState:e.crashCleanupState})};if(n.kind!==`park`)throw Error(`Driver received unexpected turn action "${n.kind}".`);if(n.cancelled===!0){let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),e.crashCleanupState.serializedContext=l.serializedContext;let n={caller:e.crashCleanupState.caller,sessionId:l.sessionState.sessionId};await notifyCancelledTaskCallerStep(t.usage===void 0?n:{...n,usage:t.usage}),e.crashCleanupState.lastSessionState=l.sessionState}l.sessionState.continuationToken&&await t.rekeyContinuation(l.sessionState.continuationToken);let r=n.settled;n.cancelled!==!0&&r!==void 0?(e.crashCleanupState.caller!==void 0&&await notifyTurnCallerStep({caller:e.crashCleanupState.caller,lifecycle:`parked`,sessionId:l.sessionState.sessionId,settled:r}),e.crashCleanupState.caller=void 0):n.cancelled===!0&&(e.crashCleanupState.caller=void 0);let i=await nextParkedActivity({expectedAttemptIds:n.authorizationAttemptIds??[]});if(e.crashCleanupState.lastSessionState=l.sessionState,i.kind===`authorization-resume`){n=await runTurn({kind:`deliver`,payloads:i.payloads});continue}if(i.kind===`expired`)return{kind:`expired`,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`reset`)return{kind:`result`,result:await finalizeExpiredSession({caller:e.crashCleanupState.caller,driverWritable:e.driverWritable,mode:e.mode,serializedContext:l.serializedContext,sessionState:l.sessionState,terminalState:e.crashCleanupState})};if(i.kind===`clear`||i.kind===`compact`){n=await runTurn({kind:i.kind});continue}if(i.kind===`closed`)return{kind:`result`,result:await finalizeExpiredSession({caller:e.crashCleanupState.caller,driverWritable:e.driverWritable,mode:e.mode,serializedContext:l.serializedContext,sessionState:l.sessionState,terminalState:e.crashCleanupState})};if(i.kind===`cancel-turn`){await cancelDescendantTurnsStep({serializedContext:l.serializedContext,sessionState:l.sessionState});let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),e.crashCleanupState.serializedContext=l.serializedContext,n={...n,settled:void 0},e.crashCleanupState.caller=void 0,e.crashCleanupState.lastSessionState=l.sessionState;continue}i.delivery.caller!==void 0&&(e.crashCleanupState.caller=i.delivery.caller),n=await runTurn(i.delivery)}}finally{await m?.(),await u?.dispose()}}workflowEntry.workflowId=`workflow//eve//workflowEntry`;export{workflowEntry};
@@ -36,7 +36,7 @@ export declare const activityCollectorWorkflowReference: {
36
36
  workflowId: string;
37
37
  };
38
38
  /** Stable workflow reference for authored workflow tool runs. */
39
- export declare const toolRunWorkflowReference: {
39
+ export declare const workflowToolRunWorkflowReference: {
40
40
  workflowId: string;
41
41
  };
42
42
  /**
@@ -1 +1 @@
1
- import{randomBytes}from"node:crypto";import{createEveActivityRoutePath}from"#protocol/routes.js";import{createLogger,logError}from"#internal/logging.js";import{getChannelActivityPresentation}from"#channel/activity-renderer.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{ActivityObserverKey}from"#context/keys.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{walkCauseChain}from"#shared/errors.js";import{normalizePersistedMessageStreamEvent}from"#protocol/message-version.js";import{cancelRun,getHookByToken,getRun,getWorld,start}from"#internal/workflow/runtime.js";import{createWorkflowCallbackUrl,resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{serializeContext}from"#context/serialize.js";import{EntityConflictError,HookNotFoundError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{buildSessionAttributes,buildSubagentRootAttributes,readParentLineage}from"#execution/eve-workflow-attributes.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{initializeSessionInstrumentation}from"#instrumentation/runtime.js";import{context,trace}from"#compiled/@opentelemetry/api/index.js";import{buildRunContext}from"#execution/runtime-context.js";import{parseNdjsonStream}from"#execution/ndjson-stream.js";import{buildInvocationAttributes}from"#internal/invocation/metadata.js";import{isAgentTraceContext}from"#tracing/agent-trace-context.js";import{ACTIVITY_COLLECTOR_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,TASK_RUN_WORKFLOW_NAME,TOOL_RUN_WORKFLOW_NAME,TURN_WORKFLOW_NAME,WORKFLOW_ENTRY_NAME}from"#execution/stable-workflow-names.js";const EVE_PACKAGE_INFO=resolveInstalledPackageInfo(),COMMAND_HOOK_READY_TIMEOUT_MS=3e4,STABLE_ID_BASE=EVE_PACKAGE_INFO.name,log=createLogger(`execution.workflow-runtime`),workflowEntryReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_ENTRY_NAME}`},turnWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${TURN_WORKFLOW_NAME}`},sessionTimeoutWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${SESSION_TIMEOUT_WORKFLOW_NAME}`},taskRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${TASK_RUN_WORKFLOW_NAME}`},activityCollectorWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${ACTIVITY_COLLECTOR_WORKFLOW_NAME}`},toolRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${TOOL_RUN_WORKFLOW_NAME}`};function createWorkflowRuntime(n){return{async createSession(a){let o=await getCompiledRuntimeAgentBundle({compiledArtifactsSource:n.compiledArtifactsSource,nodeId:n.nodeId}),s=buildRunContext({bundle:o,dynamicSubagentAgentConfig:n.dynamicSubagentAgentConfig,run:a}),c=resolveEffectiveAgentRuntime(o,s);initializeSessionInstrumentation({agentName:c.turnAgent.id,ctx:s,parentTraceContext:a.parentTraceContext});let l=c.limits?.sessionTimeoutMs,u,d=a.activityObserver;if(a.parent===void 0&&d===void 0&&(getChannelActivityPresentation(a.adapter)?.renderers.length??0)>0){let n=serializeContext(s),r=randomBytes(32).toString(`base64url`),i={expiresAt:new Date(Date.now()+(typeof l==`number`?l:864e5)).toISOString(),serializedContext:n,token:r};try{u=(await startWorkflowOnCurrentDeployment(activityCollectorWorkflowReference,[i])).runId,d={sink:{url:createWorkflowCallbackUrl(resolveWorkflowCallbackBaseUrl(process.env.VERCEL_URL?`https://${process.env.VERCEL_URL}`:`http://localhost:3000`),createEveActivityRoutePath(r)),version:1}},s.set(ActivityObserverKey,d)}catch{await cancelActivityCollector(u),u=void 0,log.warn(`failed to start activity collector`)}}let f=serializeContext(s),p=readParentLineage(f),m={input:a.input,limits:a.limits,serializedContext:f};u!==void 0&&(m.activityCollectorRunId=u),a.continuationConflictCommand!==void 0&&(m.continuationConflictCommand=a.continuationConflictCommand),l!==void 0&&(m.sessionTimeoutMs=l);let h={...p.sessionId===void 0?buildSessionAttributes({inputMessage:a.title??a.input.message,serializedContext:f}):buildSubagentRootAttributes({identity:{nodeId:o.nodeId??ROOT_RUNTIME_AGENT_NODE_ID},parentCallId:p.callId,parentSessionId:p.sessionId,parentTurnId:p.turnId,rootSessionId:p.rootSessionId??p.sessionId,serializedContext:f}),...a.externalInvocation===void 0?{}:buildInvocationAttributes(a.externalInvocation)},g;try{g=await startWorkflowOnCurrentDeployment(workflowEntryReference,[m],{allowReservedAttributes:!0,attributes:normalizeEveAttributes(h)})}catch(e){throw await cancelActivityCollector(u),logError(log,`failed to start workflow run`,e,{continuationToken:a.continuationToken}),e}let _,getEvents=()=>(_??=parseNdjsonStream(()=>getRun(g.runId).getReadable(),normalizePersistedEvent),_);return{get events(){return getEvents()},sessionId:g.runId}},async dispatchContinuation(e){return await dispatchWorkflowCommand(e.continuationToken,e.command)},async dispatchSession(e){return await dispatchWorkflowCommand(sessionCommandHookToken(e.sessionId),e.command)},async getEventStream(e,t){return parseNdjsonStream(()=>getRun(e).getReadable({startIndex:t?.startIndex}),normalizePersistedEvent)},async getStreamTailIndex(e){let t=getRun(e).getReadable();try{return await t.getTailIndex()}finally{await t.cancel().catch(()=>{})}},async resolveContinuation(e){try{return{sessionId:(await getHookByToken(e)).runId}}catch(t){if(HookNotFoundError.is(t))return;throw logError(log,`failed to resolve session by continuation token`,t,{continuationToken:e}),t}}}}function normalizePersistedEvent(e){return normalizePersistedMessageStreamEvent(e)}async function cancelActivityCollector(e){if(e!==void 0)try{await cancelRun(await getWorld(),e,{cancelReason:`Root session creation did not complete`})}catch{log.warn(`failed to cancel unowned activity collector`)}}async function dispatchWorkflowCommand(e,t){let n;try{n=normalizeWorkflowHook(await resumeSessionInbox(e,t))}catch(n){if(isInactiveCommandTarget(n))return inactiveCommandResult(t);throw logError(log,`failed to dispatch session command`,n,{command:t.kind,token:e}),n}return t.kind===`reset`&&await waitForCommandHookRelease(sessionCommandHookToken(n.runId),n.runId),activeCommandResult(t,n.runId)}function activeCommandResult(e,t){return e.kind===`reset`?{previousSessionId:t,status:`reset`}:(e.kind,{sessionId:t,status:`accepted`})}function inactiveCommandResult(e){return e.kind===`send`?{status:`session_not_active`}:e.kind===`cancel`?{status:`no_active_turn`}:{status:`no_active_session`}}async function requestWorkflowTurnCancellation(e){let t={kind:`cancel`};return e.taskId!==void 0&&(t.taskId=e.taskId),e.turnId!==void 0&&(t.turnId=e.turnId),await dispatchWorkflowCommand(sessionCommandHookToken(e.sessionId),t)}function isInactiveCommandTarget(e){if(HookNotFoundError.is(e))return!0;for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t)||RunExpiredError.is(t)||EntityConflictError.is(t))return!0;return!1}async function waitForCommandHookOwner(e){let t=Date.now()+COMMAND_HOOK_READY_TIMEOUT_MS;for(;;)try{return normalizeWorkflowHook(await getHookByToken(e))}catch(e){if(!HookNotFoundError.is(e)||Date.now()>=t)throw e;await new Promise(e=>setTimeout(e,20))}}async function waitForCommandHookRelease(e,t){let n=Date.now()+COMMAND_HOOK_READY_TIMEOUT_MS;for(;;){try{if(normalizeWorkflowHook(await getHookByToken(e)).runId!==t)return}catch(e){if(HookNotFoundError.is(e))return;throw e}if(Date.now()>=n)throw Error(`Timed out waiting for session "${t}" to release its command inbox.`);await new Promise(e=>setTimeout(e,20))}}async function startWorkflowOnCurrentDeployment(e,t,n){return await startWorkflowOnDeployment(e,t,process.env.VERCEL_DEPLOYMENT_ID?.trim()||void 0,n)}async function startWorkflowOnAcceptedDeployment(e,t,n,r){return n===void 0?await startWorkflowOnCurrentDeployment(e,t,r):await startWorkflowOnDeployment(e,t,n,r)}async function startWorkflowOnDeployment(e,t,n,r){return await withWorkflowStartContext(async()=>n===void 0?r===void 0?await start(e,t):await start(e,t,r):await start(e,t,{...r,deploymentId:n}))}async function withWorkflowStartContext(e){let t=context.active(),n=isAgentTraceContext(t)?trace.deleteSpan(t):t;return await context.with(n,e)}function normalizeWorkflowHook(e){if(typeof e!=`object`||!e||!(`runId`in e))throw Error(`Workflow hook did not include a run id.`);let t=e.runId;if(typeof t!=`string`||t.length===0)throw Error(`Workflow hook did not include a run id.`);return{runId:t}}export{activityCollectorWorkflowReference,createWorkflowRuntime,requestWorkflowTurnCancellation,sessionTimeoutWorkflowReference,startWorkflowOnAcceptedDeployment,startWorkflowOnCurrentDeployment,taskRunWorkflowReference,toolRunWorkflowReference,turnWorkflowReference,waitForCommandHookOwner,workflowEntryReference};
1
+ import{randomBytes}from"node:crypto";import{createEveActivityRoutePath}from"#protocol/routes.js";import{createLogger,logError}from"#internal/logging.js";import{getChannelActivityPresentation}from"#channel/activity-renderer.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{ActivityObserverKey}from"#context/keys.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{walkCauseChain}from"#shared/errors.js";import{normalizePersistedMessageStreamEvent}from"#protocol/message-version.js";import{cancelRun,getHookByToken,getRun,getWorld,start}from"#internal/workflow/runtime.js";import{serializeContext}from"#context/serialize.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{EntityConflictError,HookNotFoundError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{buildSessionAttributes,buildSubagentRootAttributes,readParentLineage}from"#execution/eve-workflow-attributes.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{initializeSessionInstrumentation}from"#instrumentation/runtime.js";import{createWorkflowCallbackUrl,resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{context,trace}from"#compiled/@opentelemetry/api/index.js";import{buildRunContext}from"#execution/runtime-context.js";import{parseNdjsonStream}from"#execution/ndjson-stream.js";import{buildInvocationAttributes}from"#internal/invocation/metadata.js";import{isAgentTraceContext}from"#tracing/agent-trace-context.js";import{ACTIVITY_COLLECTOR_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,TASK_RUN_WORKFLOW_NAME,TURN_WORKFLOW_NAME,WORKFLOW_ENTRY_NAME,WORKFLOW_TOOL_RUN_WORKFLOW_NAME}from"#execution/stable-workflow-names.js";const EVE_PACKAGE_INFO=resolveInstalledPackageInfo(),COMMAND_HOOK_READY_TIMEOUT_MS=3e4,STABLE_ID_BASE=EVE_PACKAGE_INFO.name,log=createLogger(`execution.workflow-runtime`),workflowEntryReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_ENTRY_NAME}`},turnWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${TURN_WORKFLOW_NAME}`},sessionTimeoutWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${SESSION_TIMEOUT_WORKFLOW_NAME}`},taskRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${TASK_RUN_WORKFLOW_NAME}`},activityCollectorWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${ACTIVITY_COLLECTOR_WORKFLOW_NAME}`},workflowToolRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_TOOL_RUN_WORKFLOW_NAME}`};function createWorkflowRuntime(n){return{async createSession(a){let o=await getCompiledRuntimeAgentBundle({compiledArtifactsSource:n.compiledArtifactsSource,nodeId:n.nodeId}),s=buildRunContext({bundle:o,dynamicSubagentAgentConfig:n.dynamicSubagentAgentConfig,run:a}),c=resolveEffectiveAgentRuntime(o,s);initializeSessionInstrumentation({agentName:c.turnAgent.id,ctx:s,parentTraceContext:a.parentTraceContext});let l=c.limits?.sessionTimeoutMs,u,d=a.activityObserver;if(a.parent===void 0&&d===void 0&&(getChannelActivityPresentation(a.adapter)?.renderers.length??0)>0){let n=serializeContext(s),r=randomBytes(32).toString(`base64url`),i={expiresAt:new Date(Date.now()+(typeof l==`number`?l:864e5)).toISOString(),serializedContext:n,token:r};try{u=(await startWorkflowOnCurrentDeployment(activityCollectorWorkflowReference,[i])).runId,d={sink:{url:createWorkflowCallbackUrl(resolveWorkflowCallbackBaseUrl(process.env.VERCEL_URL?`https://${process.env.VERCEL_URL}`:`http://localhost:3000`),createEveActivityRoutePath(r)),version:1}},s.set(ActivityObserverKey,d)}catch{await cancelActivityCollector(u),u=void 0,log.warn(`failed to start activity collector`)}}let f=serializeContext(s),p=readParentLineage(f),m={input:a.input,limits:a.limits,serializedContext:f},h=a.taskId??a.callback?.taskId;h!==void 0&&(m.taskId=h),u!==void 0&&(m.activityCollectorRunId=u),a.continuationConflictCommand!==void 0&&(m.continuationConflictCommand=a.continuationConflictCommand),l!==void 0&&(m.sessionTimeoutMs=l);let g={...p.sessionId===void 0?buildSessionAttributes({inputMessage:a.title??a.input.message,serializedContext:f}):buildSubagentRootAttributes({identity:{nodeId:o.nodeId??ROOT_RUNTIME_AGENT_NODE_ID},parentCallId:p.callId,parentSessionId:p.sessionId,parentTurnId:p.turnId,rootSessionId:p.rootSessionId??p.sessionId,serializedContext:f}),...a.externalInvocation===void 0?{}:buildInvocationAttributes(a.externalInvocation)},_;try{_=await startWorkflowOnCurrentDeployment(workflowEntryReference,[m],{allowReservedAttributes:!0,attributes:normalizeEveAttributes(g)})}catch(e){throw await cancelActivityCollector(u),logError(log,`failed to start workflow run`,e,{continuationToken:a.continuationToken}),e}let v,getEvents=()=>(v??=parseNdjsonStream(()=>getRun(_.runId).getReadable(),normalizePersistedEvent),v);return{get events(){return getEvents()},sessionId:_.runId}},async dispatchContinuation(e){return await dispatchWorkflowCommand(e.continuationToken,e.command)},async dispatchSession(e){return await dispatchWorkflowCommand(sessionCommandHookToken(e.sessionId),e.command)},async getEventStream(e,t){return parseNdjsonStream(()=>getRun(e).getReadable({startIndex:t?.startIndex}),normalizePersistedEvent)},async getStreamTailIndex(e){let t=getRun(e).getReadable();try{return await t.getTailIndex()}finally{await t.cancel().catch(()=>{})}},async resolveContinuation(e){try{return{sessionId:(await getHookByToken(e)).runId}}catch(t){if(HookNotFoundError.is(t))return;throw logError(log,`failed to resolve session by continuation token`,t,{continuationToken:e}),t}}}}function normalizePersistedEvent(e){return normalizePersistedMessageStreamEvent(e)}async function cancelActivityCollector(e){if(e!==void 0)try{await cancelRun(await getWorld(),e,{cancelReason:`Root session creation did not complete`})}catch{log.warn(`failed to cancel unowned activity collector`)}}async function dispatchWorkflowCommand(e,t){let n;try{n=normalizeWorkflowHook(await resumeSessionInbox(e,t))}catch(n){if(isInactiveCommandTarget(n))return inactiveCommandResult(t);throw logError(log,`failed to dispatch session command`,n,{command:t.kind,token:e}),n}return t.kind===`reset`&&await waitForCommandHookRelease(sessionCommandHookToken(n.runId),n.runId),activeCommandResult(t,n.runId)}function activeCommandResult(e,t){return e.kind===`reset`?{previousSessionId:t,status:`reset`}:(e.kind,{sessionId:t,status:`accepted`})}function inactiveCommandResult(e){return e.kind===`send`?{status:`session_not_active`}:e.kind===`cancel`?{status:`no_active_turn`}:{status:`no_active_session`}}async function requestWorkflowTurnCancellation(e){let t={kind:`cancel`};return e.taskId!==void 0&&(t.taskId=e.taskId),e.tasks!==void 0&&(t.tasks=e.tasks),e.turnId!==void 0&&(t.turnId=e.turnId),await dispatchWorkflowCommand(sessionCommandHookToken(e.sessionId),t)}function isInactiveCommandTarget(e){if(HookNotFoundError.is(e))return!0;for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t)||RunExpiredError.is(t)||EntityConflictError.is(t))return!0;return!1}async function waitForCommandHookOwner(e){let t=Date.now()+COMMAND_HOOK_READY_TIMEOUT_MS;for(;;)try{return normalizeWorkflowHook(await getHookByToken(e))}catch(e){if(!HookNotFoundError.is(e)||Date.now()>=t)throw e;await new Promise(e=>setTimeout(e,20))}}async function waitForCommandHookRelease(e,t){let n=Date.now()+COMMAND_HOOK_READY_TIMEOUT_MS;for(;;){try{if(normalizeWorkflowHook(await getHookByToken(e)).runId!==t)return}catch(e){if(HookNotFoundError.is(e))return;throw e}if(Date.now()>=n)throw Error(`Timed out waiting for session "${t}" to release its command inbox.`);await new Promise(e=>setTimeout(e,20))}}async function startWorkflowOnCurrentDeployment(e,t,n){return await startWorkflowOnDeployment(e,t,process.env.VERCEL_DEPLOYMENT_ID?.trim()||void 0,n)}async function startWorkflowOnAcceptedDeployment(e,t,n,r){return n===void 0?await startWorkflowOnCurrentDeployment(e,t,r):await startWorkflowOnDeployment(e,t,n,r)}async function startWorkflowOnDeployment(e,t,n,r){return await withWorkflowStartContext(async()=>n===void 0?r===void 0?await start(e,t):await start(e,t,r):await start(e,t,{...r,deploymentId:n}))}async function withWorkflowStartContext(e){let t=context.active(),n=isAgentTraceContext(t)?trace.deleteSpan(t):t;return await context.with(n,e)}function normalizeWorkflowHook(e){if(typeof e!=`object`||!e||!(`runId`in e))throw Error(`Workflow hook did not include a run id.`);let t=e.runId;if(typeof t!=`string`||t.length===0)throw Error(`Workflow hook did not include a run id.`);return{runId:t}}export{activityCollectorWorkflowReference,createWorkflowRuntime,requestWorkflowTurnCancellation,sessionTimeoutWorkflowReference,startWorkflowOnAcceptedDeployment,startWorkflowOnCurrentDeployment,taskRunWorkflowReference,turnWorkflowReference,waitForCommandHookOwner,workflowEntryReference,workflowToolRunWorkflowReference};
@@ -1 +1 @@
1
- import{callAdapterEventHandler,defaultDeliverResult}from"#channel/adapter.js";import{contextStorage}from"#context/container.js";import{AuthKey,CapabilitiesKey,HandleEventKey,ModeKey,SessionDynamicSubagentRuntimeRevisionKey,SessionDynamicToolRuntimeRevisionKey,TasksEnabledKey,TurnTaskDeliveryKey,TurnTaskStateKey}from"#context/keys.js";import{createAuthorizationCompletedEvent,createSessionStartedEvent,createTurnStartedEvent,encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{emitTurnPreamble,getHarnessEmissionState,isHarnessBetweenTurns,setHarnessEmissionState}from"#harness/emission.js";import{createWorkflowRuntime}from"#execution/workflow-runtime.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{dispatchDynamicSubagentEvent,refreshDynamicSessionSubagentsForRuntimeRevision}from"#context/dynamic-subagent-lifecycle.js";import{coalesceTurnInputs}from"#harness/messages.js";import{hydrateDurableSession,refreshSessionFromTurnAgent}from"#execution/session.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{TASK_UPDATE_SESSION_INSTRUCTION,isTaskOwnedSerializedContext}from"#execution/tasks/child/instructions.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{activeTurnId}from"#harness/active-turn-id.js";import{preserveSerializedAgentTraceState}from"#tracing/agent-trace-context-store.js";import{deferMismatchedInlineTurnStep}from"#execution/accepted-delivery-deployment.js";import{getPendingWorkflowInterrupt}from"#harness/workflow-interrupt-state.js";import{getRuntimeActionKeysFromWorkflowInterrupt,isWorkflowRuntimeActionInterrupt}from"#harness/workflow-runtime-action-state.js";import{isTurnCancellation,throwIfTurnAborted}from"#harness/turn-cancellation.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{dispatchDynamicToolEvent,rebindMissingCompiledDynamicToolCallbacks,refreshDynamicSessionToolsForRuntimeRevision}from"#context/dynamic-tool-lifecycle.js";import{CallbackBaseUrlKey,PendingAuthorizationResultKey,clearPendingAuthorization,getPendingAuthorization}from"#harness/authorization.js";import{hasPendingInputBatch}from"#harness/input-requests.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{observeSessionActivity}from"#execution/session-activity-projection.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";import{bindSessionInstrumentation}from"#instrumentation/runtime.js";import{getTurnUsageState,takeSessionUsageDelta,toUsage}from"#harness/turn-tag-state.js";import{readTurnSleepDurationMs}from"#harness/turn-sleep.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{dispatchDynamicInstructionEvent,drainDynamicInstructionUserMessages,prepareDynamicInstructionPreamble}from"#context/dynamic-instruction-lifecycle.js";import{dispatchDynamicSkillEvent}from"#context/dynamic-skill-lifecycle.js";import{dispatchMemoryLifecycleEvent}from"#context/memory-event-lifecycle.js";import{preserveSerializedInstrumentationState}from"#instrumentation/state.js";import{RuntimeActionSettlementTimesKey}from"#harness/runtime-action-settlement-state.js";import{matchAuthorizationCallbacks}from"#execution/authorization-callback-match.js";import{derivePendingState}from"#execution/pending-turn-state.js";import{forwardTaskEventToSessionCallback}from"#execution/task-event-callback.js";import{resolveEffectiveOutputSchema}from"#execution/effective-output-schema.js";import{buildRuntimeIdentity,createExecutionNodeStep}from"#execution/node-step.js";import{appendTaskAgentAnnouncement}from"#execution/tasks/parent/agent-views.js";import{resolveInitiatingTaskContext,resolveTaskDeliveryContext}from"#tasks/delivery-context.js";import{readRetainedBackgroundToolResult,runBackgroundStep}from"#execution/tasks/parent/tool-execution.js";import{prepareWorkflowPreambleTrace}from"#execution/workflow-trace-context.js";import{createExecutionHistoryView}from"#execution/history-view.js";import{resolveRuntimeCompiledArtifactsVersionedCacheKey}from"#runtime/cache-key.js";import{bindDynamicConnections}from"#execution/dynamic-connections.js";import{preserveCancelledTurnMessage}from"#execution/cancelled-turn-message.js";function channelDeliveryErrorCode(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`&&t.length>0)return t}return`CHANNEL_DELIVERY_FAILED`}async function turnStep(a){"use step";let o=deferMismatchedInlineTurnStep(a);if(o!==void 0)return o;let s=a,c=await readDurableSession(s.sessionState),l=await deserializeContext(s.serializedContext);a.input?.kind===`deliver`&&(l.set(TurnTaskDeliveryKey,`none`),l.delete(TurnTaskStateKey));let u=l.require(ChannelKey),d=l.require(BundleKey),f=d.resolvedAgent.config?.experimental?.tasks===!0;l.set(TasksEnabledKey,f);let p=resolveEffectiveAgentRuntime(d,l),m=isTaskOwnedSerializedContext(s.serializedContext)&&f&&p.turnAgent.tools.some(e=>e.kind===`authored-tool`&&e.behavior?.handling?.kind===`dispatch`&&e.behavior.handling.target.kind===`task-update`);try{let{getWorkflowMetadata:e}=await import(`#compiled/@workflow/core/index.js`),t=e();typeof t.url==`string`&&l.set(CallbackBaseUrlKey,resolveWorkflowCallbackBaseUrl(t.url))}catch{}let h=getPendingAuthorization(c.state),g;if(h&&s.input?.kind===`deliver`){let{matches:e,remainingPayloads:t}=matchAuthorizationCallbacks(h,s.input.payloads);if(s={...s,input:{...s.input,payloads:t}},e.length>0){let n=e.map(e=>e.result);l.set(PendingAuthorizationResultKey,n),c={...c,state:clearPendingAuthorization(c.state,n.map(e=>e.attemptId??e.name))},g=e,t.length===0&&(s={...s,input:void 0})}}s.input?.kind===`deliver`&&s.input.auth!==void 0&&l.set(AuthKey,s.input.auth??null);let _=hydrateDurableSession({compactionOverrides:{thresholdPercent:p.thresholdPercent},durable:c,turnAgent:p.turnAgent}),v=createExecutionHistoryView(_),y=bindSessionInstrumentation({agentName:p.turnAgent.id,ctx:l,rootSessionId:_.rootSessionId??_.sessionId,sessionId:_.sessionId}),b=getHarnessEmissionState(_.state);a.input?.kind===`deliver`&&await contextStorage.run(l,()=>y?.instrumentChannelDelivery({agentName:d.turnAgent.id,ctx:l,delivery:a.input,rootSessionId:_.rootSessionId??_.sessionId,sequence:b.sequence,sessionId:_.sessionId,turnId:activeTurnId(b)}));let failChannelDeliveries=async e=>{await contextStorage.run(l,()=>y?.instrumentChannelDelivery({ctx:l,error:e,errorCode:channelDeliveryErrorCode(e),includeTurn:!1,outcome:`failed`})),await y?.flush()},x=buildAdapterContext(u,l),S;if(s.input?.kind===`deliver`){let e=[];try{for(let n of s.input.payloads){let r=u.deliver?await u.deliver(n,x):defaultDeliverResult(n);r!=null&&e.push(r)}}catch(e){throw await failChannelDeliveries(e),e}S=e.length===0?void 0:e.reduce(coalesceTurnInputs)}else s.input?.kind===`runtime-action-result`&&(s.input.acceptedAtMsByCallId!==void 0&&l.set(RuntimeActionSettlementTimesKey,s.input.acceptedAtMsByCallId),S={runtimeActionResults:s.input.results});if(S!==void 0&&a.input?.kind===`deliver`&&a.input.taskDeliveryId!==void 0){let e=resolveTaskDeliveryContext({state:c.state,taskDeliveryId:a.input.taskDeliveryId});e!==void 0&&(l.set(TurnTaskDeliveryKey,e.phase),S={...S,context:[...S.context??[],e.context]})}if(f&&l.get(TurnTaskDeliveryKey)===`none`){let e=resolveInitiatingTaskContext({state:c.state,turnId:activeTurnId(b)});e!==void 0&&(l.set(TurnTaskDeliveryKey,e.phase),l.set(TurnTaskStateKey,e.context))}if(s.input?.kind===`deliver`&&setChannelContext(l,{...u,state:{...x.state}}),s.input?.kind===`deliver`&&S===void 0){await contextStorage.run(l,()=>y?.instrumentChannelDelivery({ctx:l,includeTurn:!1,outcome:`completed`})),await y?.flush();let e=reconcileSessionContinuationToken(l,_),t=serializeContext(l),r=e===_?s.sessionState:createDurableSessionState({session:e});return{action:`park`,...derivePendingState(e),serializedContext:t,sessionState:r,tasksEnabled:f}}let C=d.hookRegistry,w=bindDynamicConnections(l,d.resolvedAgent),T=d.resolvedAgent.dynamicInstructionsResolvers??[],E=d.resolvedAgent.dynamicSkillResolvers??[],D=d.subagentRegistry.dynamicResolvers??[],O=d.resolvedAgent.dynamicToolResolvers??[],k={...d.graph.root,turnAgent:p.turnAgent},A=buildRuntimeIdentity(k);try{let e=process.env.VERCEL_DEPLOYMENT_ID?.trim(),t=e?`deployment:${e}`:await resolveRuntimeCompiledArtifactsVersionedCacheKey(d.compiledArtifactsSource);if(!b.sessionStarted)l.set(SessionDynamicSubagentRuntimeRevisionKey,t),l.set(SessionDynamicToolRuntimeRevisionKey,t);else{let e=createSessionStartedEvent({runtime:A});await Promise.all([refreshDynamicSessionSubagentsForRuntimeRevision({ctx:l,resolvers:D,event:e,messages:v.initial.messages,runtimeRevision:t}),refreshDynamicSessionToolsForRuntimeRevision({ctx:l,resolvers:O,event:e,messages:v.initial.messages,runtimeRevision:t})]),await rebindMissingCompiledDynamicToolCallbacks({ctx:l,event:createTurnStartedEvent({sequence:b.sequence,turnId:activeTurnId(b)}),messages:v.initial.messages,resolvers:O})}}catch(e){throw await failChannelDeliveries(e),e}let j=s.parentWritable.getWriter(),emit=async t=>{let n=await callAdapterEventHandler(u,t,x);setChannelContext(l,{...u,state:{...x.state}});let r=stampMessageStreamEvent(n);return await j.write(encodeMessageStreamEvent(r)),r},handleEvent=async(e,t)=>{let n=await forwardTaskEventToSessionCallback(l,e)?stampMessageStreamEvent(e):await emit(e),r=await dispatchMemoryLifecycleEvent({abortSignal:s.abortSignal,appRoot:k.agent?.metadata?.appRoot??``,ctx:l,event:e,memories:k.agent?.memories??[],messages:t,nodeId:d.nodeId??`__root__`});observeSessionActivity({ctx:l,event:n,sessionId:_.sessionId}),await dispatchStreamEventHooks({ctx:l,registry:C,event:n}),n.type!==`step.started`&&await dispatchDynamicModelEvent({ctx:l,dynamicModel:p.turnAgent.dynamicModel,event:n,messages:r,scope:{moduleMap:d.moduleMap,nodeId:d.nodeId}}),await w.dispatch(n),await dispatchDynamicSubagentEvent({ctx:l,resolvers:D,event:n,messages:r}),await dispatchDynamicToolEvent({ctx:l,resolvers:O,event:n,messages:r}),await dispatchDynamicSkillEvent({ctx:l,resolvers:E,event:n,messages:r}),await dispatchDynamicInstructionEvent({ctx:l,resolvers:T,event:n,messages:r})},M=l.require(ModeKey),N;try{throwIfTurnAborted(s.abortSignal),N=await runBackgroundStep(l,_,async e=>{l.setVirtualContext(HandleEventKey,handleEvent);let t=resolveEffectiveOutputSchema({agentOutputSchema:p.turnAgent.outputSchema,input:S,mode:M,session:e});if(await w.rehydrate(b,A,isHarnessBetweenTurns(t)),g){let e=getHarnessEmissionState(t.state);if(isHarnessBetweenTurns(t)){prepareDynamicInstructionPreamble(l,v.messages(t));let n=[],r=await prepareWorkflowPreambleTrace({emissionState:e,instrumentation:y});try{e=await emitTurnPreamble(handleEvent,{},e,A,r)}finally{n=drainDynamicInstructionUserMessages(l),t={...t,history:[...t.history,...n]}}t=setHarnessEmissionState(t,e)}for(let{authorization:t,result:n}of g){let r=h?.challenges.find(e=>e.attemptId===n.attemptId)?.candidateId;await handleEvent(createAuthorizationCompletedEvent({attemptId:n.attemptId,authorization:t,candidateId:r,name:n.name,outcome:`authorized`,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId}))}}let n=l.get(CapabilitiesKey);return(async(e,t)=>{let r=refreshSessionFromTurnAgent({compactionOverrides:{thresholdPercent:p.thresholdPercent},session:e,systemPromptAdditions:m?[TASK_UPDATE_SESSION_INSTRUCTION]:void 0,turnAgent:p.turnAgent}),i=f?await appendTaskAgentAnnouncement(r,v.messages(r)):r;return createExecutionNodeStep({abortSignal:s.abortSignal,capabilities:n,clearOnly:s.input?.kind===`clear`,compactOnly:s.input?.kind===`compact`,createRuntime:createWorkflowRuntime,handleEvent,historyProjector:v.projector,historyView:v.prepare(i),instrumentation:y,mode:M,modelResolutionScope:{moduleMap:d.moduleMap,nodeId:d.nodeId},node:k,workflowMaxSubagents:r.workflowMaxSubagents})(i,t)})(t,S)})}catch(e){if(!isTurnCancellation(e))throw await failChannelDeliveries(e),e;j.releaseLock();let t=serializeContext(l),n=readRetainedBackgroundToolResult(l),r=await preserveCancelledTurnMessage(n?.backgroundTaskSession??_,S);return{action:`cancelled`,...n===void 0?{}:{backgroundTaskState:createDurableSessionState({session:r}),backgroundTasks:n.backgroundTasks},serializedContext:preserveSerializedInstrumentationState(preserveSerializedAgentTraceState(preserveSerializedSessionDynamicModelSelection(s.serializedContext,t),t),t),sessionState:createDurableSessionState({session:r})}}let P=reconcileSessionContinuationToken(l,N.session),F=serializeContext(l);N={...N,session:P};let I=createDurableSessionState({session:N.session}),L=readTurnSleepDurationMs(l),R=L===void 0?{}:{sleepDurationMs:L},z=N.backgroundTasks===void 0||N.backgroundTaskSession===void 0?{}:{backgroundTaskState:createDurableSessionState({session:N.backgroundTaskSession}),backgroundTasks:N.backgroundTasks};if(N.next!==null&&typeof N.next==`object`&&`done`in N.next){if(M===`task`&&hasPendingInputBatch(N.session.state))throw j.releaseLock(),Error(`Task mode cannot complete while input requests remain pending.`);await j.close();let e=getTurnUsageState(N.session.state)?.session;return{action:`done`,...z,output:N.next.output,isError:N.next.isError,...R,serializedContext:F,sessionState:I,usage:e===void 0?void 0:toUsage(e),usageDelta:takeSessionUsageDelta(N.session).delta}}if(N.next===null){j.releaseLock();let e=getPendingWorkflowInterrupt(N.session.state);if(e!==void 0&&isWorkflowRuntimeActionInterrupt(e.interrupt))return{action:`dispatch-workflow-runtime-actions`,...z,pendingRuntimeActionKeys:getRuntimeActionKeysFromWorkflowInterrupt(e.interrupt),...R,serializedContext:F,sessionState:I};let t=derivePendingState(N.session);if(N.settledTurn!==void 0){let{delta:e,session:n}=takeSessionUsageDelta(N.session);return{action:`park`,...z,...t,...R,serializedContext:F,sessionState:createDurableSessionState({session:n}),settled:{output:N.settledTurn.output,isError:N.settledTurn.isError,usage:e},tasksEnabled:f}}return{action:`park`,...z,...t,...R,serializedContext:F,sessionState:I,tasksEnabled:f}}return j.releaseLock(),{action:`continue`,...z,...R,serializedContext:F,sessionState:I}}export{turnStep};
1
+ import{callAdapterEventHandler,defaultDeliverResult}from"#channel/adapter.js";import{contextStorage}from"#context/container.js";import{AuthKey,CapabilitiesKey,HandleEventKey,ModeKey,SessionDynamicSubagentRuntimeRevisionKey,SessionDynamicToolRuntimeRevisionKey,TurnTaskDeliveryKey,TurnTaskStateKey}from"#context/keys.js";import{createAuthorizationCompletedEvent,createSessionStartedEvent,createTurnStartedEvent,encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{emitTurnPreamble,getHarnessEmissionState,isHarnessBetweenTurns,setHarnessEmissionState}from"#harness/emission.js";import{createWorkflowRuntime}from"#execution/workflow-runtime.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{dispatchDynamicSubagentEvent,refreshDynamicSessionSubagentsForRuntimeRevision}from"#context/dynamic-subagent-lifecycle.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{hydrateDurableSession,refreshSessionFromTurnAgent}from"#execution/session.js";import{coalesceTurnInputs}from"#harness/messages.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{activeTurnId}from"#harness/active-turn-id.js";import{preserveSerializedAgentTraceState}from"#tracing/agent-trace-context-store.js";import{getPendingWorkflowInterrupt}from"#harness/workflow-interrupt-state.js";import{getWorkflowTaskCallIds,isWorkflowTaskInterrupt}from"#harness/workflow-task-state.js";import{TASK_UPDATE_SESSION_INSTRUCTION}from"#tools/framework/task-update.js";import{deferMismatchedInlineTurnStep}from"#execution/accepted-delivery-deployment.js";import{isTurnCancellation,throwIfTurnAborted}from"#harness/turn-cancellation.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{dispatchDynamicToolEvent,rebindMissingCompiledDynamicToolCallbacks,refreshDynamicSessionToolsForRuntimeRevision}from"#context/dynamic-tool-lifecycle.js";import{CallbackBaseUrlKey,PendingAuthorizationResultKey,clearPendingAuthorization,getPendingAuthorization}from"#harness/authorization.js";import{hasPendingInputBatch}from"#harness/input-requests.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{observeSessionActivity}from"#execution/session-activity-projection.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";import{bindSessionInstrumentation}from"#instrumentation/runtime.js";import{getTurnUsageState,takeSessionUsageDelta,toUsage}from"#harness/turn-tag-state.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{dispatchDynamicInstructionEvent,drainDynamicInstructionUserMessages,prepareDynamicInstructionPreamble}from"#context/dynamic-instruction-lifecycle.js";import{dispatchDynamicSkillEvent}from"#context/dynamic-skill-lifecycle.js";import{dispatchMemoryLifecycleEvent}from"#context/memory-event-lifecycle.js";import{preserveSerializedInstrumentationState}from"#instrumentation/state.js";import{RuntimeActionSettlementTimesKey}from"#harness/runtime-action-settlement-state.js";import{matchAuthorizationCallbacks}from"#execution/authorization-callback-match.js";import{derivePendingState}from"#execution/pending-turn-state.js";import{forwardTaskEventToSessionCallback}from"#execution/task-event-callback.js";import{resolveEffectiveOutputSchema}from"#execution/effective-output-schema.js";import{buildRuntimeIdentity,createExecutionNodeStep}from"#execution/node-step.js";import{resolveInitiatingTaskContext,resolveTaskDeliveryContext}from"#tasks/delivery-context.js";import{readRetainedBackgroundToolResult,runBackgroundStep}from"#execution/tasks/parent/tool-execution.js";import{prepareWorkflowPreambleTrace}from"#execution/workflow-trace-context.js";import{createExecutionHistoryView}from"#execution/history-view.js";import{resolveRuntimeCompiledArtifactsVersionedCacheKey}from"#runtime/cache-key.js";import{bindDynamicConnections}from"#execution/dynamic-connections.js";import{preserveCancelledTurnMessage}from"#execution/cancelled-turn-message.js";function channelDeliveryErrorCode(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`&&t.length>0)return t}return`CHANNEL_DELIVERY_FAILED`}async function turnStep(a){"use step";let o=deferMismatchedInlineTurnStep(a);if(o!==void 0)return o;let s=a,c=await readDurableSession(s.sessionState),l=await deserializeContext(s.serializedContext);a.input?.kind===`deliver`&&(l.set(TurnTaskDeliveryKey,`none`),l.delete(TurnTaskStateKey));let u=l.require(ChannelKey),d=l.require(BundleKey),f=resolveEffectiveAgentRuntime(d,l),p=c.taskId!==void 0&&f.turnAgent.tools.some(e=>e.kind===`authored-tool`&&e.behavior?.handling?.kind===`dispatch`&&e.behavior.handling.target.kind===`task-update`);try{let{getWorkflowMetadata:e}=await import(`#compiled/@workflow/core/index.js`),t=e();typeof t.url==`string`&&l.set(CallbackBaseUrlKey,resolveWorkflowCallbackBaseUrl(t.url))}catch{}let m=getPendingAuthorization(c.state),h;if(m&&s.input?.kind===`deliver`){let{matches:e,remainingPayloads:t}=matchAuthorizationCallbacks(m,s.input.payloads);if(s={...s,input:{...s.input,payloads:t}},e.length>0){let n=e.map(e=>e.result);l.set(PendingAuthorizationResultKey,n),c={...c,state:clearPendingAuthorization(c.state,n.map(e=>e.attemptId??e.name))},h=e,t.length===0&&(s={...s,input:void 0})}}s.input?.kind===`deliver`&&s.input.auth!==void 0&&l.set(AuthKey,s.input.auth??null);let g=hydrateDurableSession({compactionOverrides:{thresholdPercent:f.thresholdPercent},durable:c,turnAgent:f.turnAgent}),_=createExecutionHistoryView(g),v=bindSessionInstrumentation({agentName:f.turnAgent.id,ctx:l,rootSessionId:g.rootSessionId??g.sessionId,sessionId:g.sessionId}),y=getHarnessEmissionState(g.state);a.input?.kind===`deliver`&&await contextStorage.run(l,()=>v?.instrumentChannelDelivery({agentName:d.turnAgent.id,ctx:l,delivery:a.input,rootSessionId:g.rootSessionId??g.sessionId,sequence:y.sequence,sessionId:g.sessionId,turnId:activeTurnId(y)}));let failChannelDeliveries=async e=>{await contextStorage.run(l,()=>v?.instrumentChannelDelivery({ctx:l,error:e,errorCode:channelDeliveryErrorCode(e),includeTurn:!1,outcome:`failed`})),await v?.flush()},b=buildAdapterContext(u,l),x;if(s.input?.kind===`deliver`){let e=[];try{for(let n of s.input.payloads){let r=u.deliver?await u.deliver(n,b):defaultDeliverResult(n);r!=null&&e.push(r)}}catch(e){throw await failChannelDeliveries(e),e}x=e.length===0?void 0:e.reduce(coalesceTurnInputs)}else s.input?.kind===`runtime-action-result`&&(s.input.acceptedAtMsByCallId!==void 0&&l.set(RuntimeActionSettlementTimesKey,s.input.acceptedAtMsByCallId),x={runtimeActionResults:s.input.results});if(x!==void 0&&a.input?.kind===`deliver`&&a.input.taskDeliveryId!==void 0){let e=resolveTaskDeliveryContext({state:c.state,taskDeliveryId:a.input.taskDeliveryId});e!==void 0&&(l.set(TurnTaskDeliveryKey,e.phase),x={...x,context:[...x.context??[],e.context]})}if(l.get(TurnTaskDeliveryKey)===`none`){let e=resolveInitiatingTaskContext({state:c.state,turnId:activeTurnId(y)});e!==void 0&&(l.set(TurnTaskDeliveryKey,e.phase),l.set(TurnTaskStateKey,e.context))}if(s.input?.kind===`deliver`&&setChannelContext(l,{...u,state:{...b.state}}),s.input?.kind===`deliver`&&x===void 0){await contextStorage.run(l,()=>v?.instrumentChannelDelivery({ctx:l,includeTurn:!1,outcome:`completed`})),await v?.flush();let e=reconcileSessionContinuationToken(l,g),t=serializeContext(l),r=e===g?s.sessionState:createDurableSessionState({session:e});return{action:`park`,...derivePendingState(e),serializedContext:t,sessionState:r}}let S=d.hookRegistry,C=bindDynamicConnections(l,d.resolvedAgent),w=d.resolvedAgent.dynamicInstructionsResolvers??[],T=d.resolvedAgent.dynamicSkillResolvers??[],E=d.subagentRegistry.dynamicResolvers??[],D=d.resolvedAgent.dynamicToolResolvers??[],O={...d.graph.root,turnAgent:f.turnAgent},k=buildRuntimeIdentity(O);try{let e=process.env.VERCEL_DEPLOYMENT_ID?.trim(),t=e?`deployment:${e}`:await resolveRuntimeCompiledArtifactsVersionedCacheKey(d.compiledArtifactsSource);if(!y.sessionStarted)l.set(SessionDynamicSubagentRuntimeRevisionKey,t),l.set(SessionDynamicToolRuntimeRevisionKey,t);else{let e=createSessionStartedEvent({runtime:k});await Promise.all([refreshDynamicSessionSubagentsForRuntimeRevision({ctx:l,resolvers:E,event:e,messages:_.initial.messages,runtimeRevision:t}),refreshDynamicSessionToolsForRuntimeRevision({ctx:l,resolvers:D,event:e,messages:_.initial.messages,runtimeRevision:t})]),await rebindMissingCompiledDynamicToolCallbacks({ctx:l,event:createTurnStartedEvent({sequence:y.sequence,turnId:activeTurnId(y)}),messages:_.initial.messages,resolvers:D})}}catch(e){throw await failChannelDeliveries(e),e}let A=s.parentWritable.getWriter(),emit=async t=>{let n=await callAdapterEventHandler(u,t,b);setChannelContext(l,{...u,state:{...b.state}});let r=stampMessageStreamEvent(n);return await A.write(encodeMessageStreamEvent(r)),r},handleEvent=async(e,t)=>{let n=await forwardTaskEventToSessionCallback(l,e)?stampMessageStreamEvent(e):await emit(e),r=await dispatchMemoryLifecycleEvent({abortSignal:s.abortSignal,appRoot:O.agent?.metadata?.appRoot??``,ctx:l,event:e,memories:O.agent?.memories??[],messages:t,nodeId:d.nodeId??`__root__`});observeSessionActivity({ctx:l,event:n,sessionId:g.sessionId}),await dispatchStreamEventHooks({ctx:l,registry:S,event:n}),n.type!==`step.started`&&await dispatchDynamicModelEvent({ctx:l,dynamicModel:f.turnAgent.dynamicModel,event:n,messages:r,scope:{moduleMap:d.moduleMap,nodeId:d.nodeId}}),await C.dispatch(n),await dispatchDynamicSubagentEvent({ctx:l,resolvers:E,event:n,messages:r}),await dispatchDynamicToolEvent({ctx:l,resolvers:D,event:n,messages:r}),await dispatchDynamicSkillEvent({ctx:l,resolvers:T,event:n,messages:r}),await dispatchDynamicInstructionEvent({ctx:l,resolvers:w,event:n,messages:r})},j=l.require(ModeKey),M;try{throwIfTurnAborted(s.abortSignal),M=await runBackgroundStep(l,g,async e=>{l.setVirtualContext(HandleEventKey,handleEvent);let t=resolveEffectiveOutputSchema({agentOutputSchema:f.turnAgent.outputSchema,input:x,mode:j,session:e});if(await C.rehydrate(y,k,isHarnessBetweenTurns(t)),h){let e=getHarnessEmissionState(t.state);if(isHarnessBetweenTurns(t)){prepareDynamicInstructionPreamble(l,_.messages(t));let n=[],r=await prepareWorkflowPreambleTrace({emissionState:e,instrumentation:v});try{e=await emitTurnPreamble(handleEvent,{},e,k,r)}finally{n=drainDynamicInstructionUserMessages(l),t={...t,history:[...t.history,...n]}}t=setHarnessEmissionState(t,e)}for(let{authorization:t,result:n}of h){let r=m?.challenges.find(e=>e.attemptId===n.attemptId)?.candidateId;await handleEvent(createAuthorizationCompletedEvent({attemptId:n.attemptId,authorization:t,candidateId:r,name:n.name,outcome:`authorized`,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId}))}}let n=l.get(CapabilitiesKey);return(async(e,t)=>{let r=refreshSessionFromTurnAgent({compactionOverrides:{thresholdPercent:f.thresholdPercent},session:e,systemPromptAdditions:p?[TASK_UPDATE_SESSION_INSTRUCTION]:void 0,turnAgent:f.turnAgent}),i=r;return createExecutionNodeStep({abortSignal:s.abortSignal,capabilities:n,clearOnly:s.input?.kind===`clear`,compactOnly:s.input?.kind===`compact`,createRuntime:createWorkflowRuntime,handleEvent,historyProjector:_.projector,historyView:_.prepare(i),instrumentation:v,mode:j,modelResolutionScope:{moduleMap:d.moduleMap,nodeId:d.nodeId},node:O,workflowMaxSubagents:r.workflowMaxSubagents})(i,t)})(t,x)})}catch(e){if(!isTurnCancellation(e))throw await failChannelDeliveries(e),e;A.releaseLock();let t=serializeContext(l),n=readRetainedBackgroundToolResult(l),r=await preserveCancelledTurnMessage(n?.backgroundTaskSession??g,x);return{action:`cancelled`,...n===void 0?{}:{backgroundTaskState:createDurableSessionState({session:r}),backgroundTasks:n.backgroundTasks},serializedContext:preserveSerializedInstrumentationState(preserveSerializedAgentTraceState(preserveSerializedSessionDynamicModelSelection(s.serializedContext,t),t),t),sessionState:createDurableSessionState({session:r})}}let N=reconcileSessionContinuationToken(l,M.session),P=serializeContext(l);M={...M,session:N};let F=createDurableSessionState({session:M.session}),I=M.backgroundTasks===void 0||M.backgroundTaskSession===void 0?{}:{backgroundTaskState:createDurableSessionState({session:M.backgroundTaskSession}),backgroundTasks:M.backgroundTasks};if(M.next!==null&&typeof M.next==`object`&&`done`in M.next){if(j===`task`&&hasPendingInputBatch(M.session.state))throw A.releaseLock(),Error(`Task mode cannot complete while input requests remain pending.`);await A.close();let e=getTurnUsageState(M.session.state)?.session;return{action:`done`,...I,output:M.next.output,isError:M.next.isError,serializedContext:P,sessionState:F,usage:e===void 0?void 0:toUsage(e),usageDelta:takeSessionUsageDelta(M.session).delta}}if(M.next===null){A.releaseLock();let e=getPendingWorkflowInterrupt(M.session.state);if(e!==void 0&&isWorkflowTaskInterrupt(e.interrupt))return{action:`dispatch-workflow-tasks`,...I,pendingTaskCallIds:getWorkflowTaskCallIds(e.interrupt),serializedContext:P,sessionState:F};let t=derivePendingState(M.session);if(M.settledTurn!==void 0){let{delta:e,session:n}=takeSessionUsageDelta(M.session);return{action:`park`,...I,...t,serializedContext:P,sessionState:createDurableSessionState({session:n}),settled:{output:M.settledTurn.output,isError:M.settledTurn.isError,usage:e}}}return{action:`park`,...I,...t,serializedContext:P,sessionState:F}}return A.releaseLock(),{action:`continue`,...I,serializedContext:P,sessionState:F}}export{turnStep};
@@ -1 +1 @@
1
- import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createAgentSourceRegistry,defineProgrammaticAgentSource,loadProgrammaticModuleNamespace,memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";const revision=`eve@${resolveInstalledPackageInfo().version}:compiled-manifest-v46`,localDefaults=defineProgrammaticAgentSource({id:`eve:defaults`,revision,modules:[{logicalPath:`agent.ts`,loadNamespace:()=>import(`#framework/sources/modules/agent.js`)},{logicalPath:`sandbox.ts`,semanticRevision:`eve:default-sandbox:v1`,loadNamespace:()=>import(`#framework/sources/modules/sandbox.js`)},{logicalPath:`tools/bash.ts`,loadNamespace:()=>import(`#tools/provided/bash.js`)},{logicalPath:`tools/read_file.ts`,loadNamespace:()=>import(`#tools/provided/read-file.js`)},{logicalPath:`tools/write_file.ts`,loadNamespace:()=>import(`#tools/provided/write-file.js`)},{logicalPath:`tools/todo.ts`,loadNamespace:()=>import(`#tools/provided/todo.js`)},{logicalPath:`tools/web_fetch.ts`,loadNamespace:()=>import(`#tools/provided/web-fetch.js`)},{logicalPath:`tools/load_skill.ts`,loadNamespace:()=>import(`#tools/provided/load-skill.js`)},{logicalPath:`tools/connection_search.ts`,loadNamespace:()=>import(`#tools/framework/connection-search.js`)},{logicalPath:`tools/ask_question.ts`,loadNamespace:()=>import(`#tools/framework/ask-question.js`)},{logicalPath:`tools/web_search.ts`,loadNamespace:()=>import(`#tools/provided/web-search.js`)}]}),rootDefaults=defineProgrammaticAgentSource({id:`eve:root-defaults`,revision,modules:[{logicalPath:`tools/agent.ts`,loadNamespace:()=>import(`#tools/framework/agent.js`)},{logicalPath:`tools/task_update.ts`,loadNamespace:()=>import(`#tools/framework/task-update.js`)},{logicalPath:`tools/task_cancel.ts`,loadNamespace:()=>import(`#tools/framework/task-cancel.js`)},{logicalPath:`channels/eve.ts`,loadNamespace:()=>import(`#framework/sources/modules/eve-channel.js`)},{logicalPath:`channels/home.ts`,loadNamespace:()=>import(`#framework/sources/modules/home-channel.js`)}]}),memoryWrapperTemplateSource=defineProgrammaticAgentSource({id:`eve:memory-wrapper`,revision,modules:[{logicalPath:`tools/memory-wrapper.ts`,loadNamespace:async e=>{let{loadMemoryWrapperNamespace:t}=await import(`#framework/sources/modules/memory-wrapper.js`);return await t(e)}}]}),frameworkAgentSourceRegistry=createAgentSourceRegistry([{applyTo:`all-local-nodes`,source:localDefaults},{applyTo:`root`,source:rootDefaults}],{templates:[memoryWrapperTemplateSource]}),memoryWrapperTemplate=frameworkAgentSourceRegistry.templates.get(memoryWrapperTemplateSource.id);async function loadFrameworkProgrammaticModule(e,t){return memoizeModuleNamespaceFactories(await loadProgrammaticModuleNamespace({backing:e,dependencyNamespaces:t,registries:[frameworkAgentSourceRegistry]}))}export{frameworkAgentSourceRegistry,loadFrameworkProgrammaticModule,memoryWrapperTemplate};
1
+ import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createAgentSourceRegistry,defineProgrammaticAgentSource,loadProgrammaticModuleNamespace,memoizeModuleNamespaceFactories}from"#compiler/source-graph.js";const revision=`eve@${resolveInstalledPackageInfo().version}:compiled-manifest-v46`,localDefaults=defineProgrammaticAgentSource({id:`eve:defaults`,revision,modules:[{logicalPath:`agent.ts`,loadNamespace:()=>import(`#framework/sources/modules/agent.js`)},{logicalPath:`sandbox.ts`,semanticRevision:`eve:default-sandbox:v1`,loadNamespace:()=>import(`#framework/sources/modules/sandbox.js`)},{logicalPath:`tools/bash.ts`,loadNamespace:()=>import(`#tools/provided/bash.js`)},{logicalPath:`tools/read_file.ts`,loadNamespace:()=>import(`#tools/provided/read-file.js`)},{logicalPath:`tools/write_file.ts`,loadNamespace:()=>import(`#tools/provided/write-file.js`)},{logicalPath:`tools/todo.ts`,loadNamespace:()=>import(`#tools/provided/todo.js`)},{logicalPath:`tools/web_fetch.ts`,loadNamespace:()=>import(`#tools/provided/web-fetch.js`)},{logicalPath:`tools/load_skill.ts`,loadNamespace:()=>import(`#tools/provided/load-skill.js`)},{logicalPath:`tools/connection_search.ts`,loadNamespace:()=>import(`#tools/framework/connection-search.js`)},{logicalPath:`tools/ask_question.ts`,loadNamespace:()=>import(`#tools/framework/ask-question.js`)},{logicalPath:`tools/task_update.ts`,loadNamespace:()=>import(`#tools/framework/task-update.js`)},{logicalPath:`tools/task_cancel.ts`,loadNamespace:()=>import(`#tools/framework/task-cancel.js`)},{logicalPath:`tools/web_search.ts`,loadNamespace:()=>import(`#tools/provided/web-search.js`)}]}),rootDefaults=defineProgrammaticAgentSource({id:`eve:root-defaults`,revision,modules:[{logicalPath:`tools/agent.ts`,loadNamespace:()=>import(`#tools/framework/agent.js`)},{logicalPath:`channels/eve.ts`,loadNamespace:()=>import(`#framework/sources/modules/eve-channel.js`)},{logicalPath:`channels/home.ts`,loadNamespace:()=>import(`#framework/sources/modules/home-channel.js`)}]}),memoryWrapperTemplateSource=defineProgrammaticAgentSource({id:`eve:memory-wrapper`,revision,modules:[{logicalPath:`tools/memory-wrapper.ts`,loadNamespace:async e=>{let{loadMemoryWrapperNamespace:t}=await import(`#framework/sources/modules/memory-wrapper.js`);return await t(e)}}]}),frameworkAgentSourceRegistry=createAgentSourceRegistry([{applyTo:`all-local-nodes`,source:localDefaults},{applyTo:`root`,source:rootDefaults}],{templates:[memoryWrapperTemplateSource]}),memoryWrapperTemplate=frameworkAgentSourceRegistry.templates.get(memoryWrapperTemplateSource.id);async function loadFrameworkProgrammaticModule(e,t){return memoizeModuleNamespaceFactories(await loadProgrammaticModuleNamespace({backing:e,dependencyNamespaces:t,registries:[frameworkAgentSourceRegistry]}))}export{frameworkAgentSourceRegistry,loadFrameworkProgrammaticModule,memoryWrapperTemplate};