eve 0.56.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (559) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/src/channel/adapter-context.d.ts +1 -1
  3. package/dist/src/channel/adapter.d.ts +2 -2
  4. package/dist/src/channel/channel-address.js +1 -1
  5. package/dist/src/channel/session.d.ts +4 -3
  6. package/dist/src/channel/session.js +1 -1
  7. package/dist/src/channel/types.d.ts +7 -4
  8. package/dist/src/chunks/{use-eve-agent-RUGSwq8b.js → use-eve-agent-C2APNCdP.js} +45 -12
  9. package/dist/src/chunks/{use-eve-agent-CMdMlS7Y.js → use-eve-agent-D0YnDLi_.js} +45 -12
  10. package/dist/src/cli/commands/init.d.ts +2 -6
  11. package/dist/src/cli/commands/init.js +1 -1
  12. package/dist/src/cli/commands/trace-detail.js +1 -1
  13. package/dist/src/cli/dev/environment.js +1 -1
  14. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  15. package/dist/src/cli/dev/tui/agent-header.js +1 -1
  16. package/dist/src/cli/dev/tui/blocks.d.ts +1 -6
  17. package/dist/src/cli/dev/tui/blocks.js +1 -1
  18. package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
  19. package/dist/src/cli/dev/tui/message-queue.d.ts +11 -7
  20. package/dist/src/cli/dev/tui/message-queue.js +1 -1
  21. package/dist/src/cli/dev/tui/model-editor.d.ts +1 -1
  22. package/dist/src/cli/dev/tui/model-editor.js +1 -1
  23. package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +0 -3
  24. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  25. package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
  26. package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
  27. package/dist/src/cli/dev/tui/question-panel.js +1 -1
  28. package/dist/src/cli/dev/tui/remote-auth-result.js +1 -1
  29. package/dist/src/cli/dev/tui/remote-auth.js +1 -1
  30. package/dist/src/cli/dev/tui/remote-startup.d.ts +10 -0
  31. package/dist/src/cli/dev/tui/remote-startup.js +1 -0
  32. package/dist/src/cli/dev/tui/runner.d.ts +12 -18
  33. package/dist/src/cli/dev/tui/runner.js +3 -1
  34. package/dist/src/cli/dev/tui/setup-commands.d.ts +7 -13
  35. package/dist/src/cli/dev/tui/setup-commands.js +2 -2
  36. package/dist/src/cli/dev/tui/setup-issues.d.ts +1 -1
  37. package/dist/src/cli/dev/tui/setup-issues.js +1 -1
  38. package/dist/src/cli/dev/tui/setup-panel.d.ts +5 -17
  39. package/dist/src/cli/dev/tui/setup-panel.js +5 -6
  40. package/dist/src/cli/dev/tui/status-line.d.ts +1 -8
  41. package/dist/src/cli/dev/tui/status-line.js +1 -1
  42. package/dist/src/cli/dev/tui/steering-stream.d.ts +15 -0
  43. package/dist/src/cli/dev/tui/steering-stream.js +1 -0
  44. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -2
  45. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  46. package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +2 -2
  47. package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
  48. package/dist/src/cli/dev/tui/theme.d.ts +0 -2
  49. package/dist/src/cli/dev/tui/theme.js +1 -1
  50. package/dist/src/cli/dev/tui/vercel-status.d.ts +4 -2
  51. package/dist/src/cli/dev/tui/vercel-status.js +1 -1
  52. package/dist/src/cli/run.js +1 -1
  53. package/dist/src/cli/telemetry/index.d.ts +1 -1
  54. package/dist/src/cli/telemetry/index.js +1 -1
  55. package/dist/src/client/agent-info-schema.d.ts +2 -0
  56. package/dist/src/client/agent-info-schema.js +1 -1
  57. package/dist/src/client/eve-agent-store-state.d.ts +19 -0
  58. package/dist/src/client/eve-agent-store.js +1 -1
  59. package/dist/src/client/ndjson.d.ts +2 -0
  60. package/dist/src/client/ndjson.js +3 -3
  61. package/dist/src/client/open-stream.d.ts +1 -0
  62. package/dist/src/client/open-stream.js +1 -1
  63. package/dist/src/compiled/.vendor-stamp.json +1 -1
  64. package/dist/src/compiled/@workflow/core/index.js +2 -2
  65. package/dist/src/compiled/@workflow/core/private.js +1 -1
  66. package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -0
  67. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  68. package/dist/src/compiled/@workflow/core/serialization.js +1 -0
  69. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  70. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  71. package/dist/src/compiled/@workflow/world-vercel/index.js +2 -2
  72. package/dist/src/compiled/_chunks/workflow/attribute-changes-DTFAjP0J.js +6 -0
  73. package/dist/src/compiled/_chunks/workflow/{dist-PLkAQ-U7.js → dist-C5KCXSdI.js} +1 -1
  74. package/dist/src/compiled/_chunks/workflow/{frames-BvATzM2t.js → frames-DJw9L4rO.js} +3 -3
  75. package/dist/src/compiled/_chunks/workflow/global-DFW-hO6M.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/helpers-ClCA9Lmc.js +1 -0
  77. package/dist/src/compiled/_chunks/workflow/logger-D6vwIEf9.js +13 -0
  78. package/dist/src/compiled/_chunks/workflow/resume-hook-_baK8jaT.js +1 -0
  79. package/dist/src/compiled/_chunks/workflow/run-CRdL17z4.js +1 -0
  80. package/dist/src/compiled/_chunks/workflow/serialization-CWYPL4Eq.js +3 -0
  81. package/dist/src/compiled/_chunks/workflow/sleep-BL0kgJnT.js +1 -0
  82. package/dist/src/compiled/_chunks/workflow/wait-until-DyIt9lEx.js +1 -0
  83. package/dist/src/compiled/_chunks/workflow/{ws-transport-CVezyWwZ.js → ws-transport-Dl5FG4Sw.js} +1 -1
  84. package/dist/src/compiler/extension-compatibility.d.ts +15 -6
  85. package/dist/src/compiler/extension-compatibility.js +1 -1
  86. package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
  87. package/dist/src/context/keys.d.ts +3 -1
  88. package/dist/src/context/keys.js +1 -1
  89. package/dist/src/eve-channel/index.js +1 -1
  90. package/dist/src/eve-channel/request.js +4 -3
  91. package/dist/src/execution/activity-cohort.js +1 -1
  92. package/dist/src/execution/activity-collector.js +1 -1
  93. package/dist/src/execution/authorization-callback-match.d.ts +2 -1
  94. package/dist/src/execution/authorization-callback-match.js +1 -1
  95. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  96. package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -1
  97. package/dist/src/execution/cancelled-model-call-batch.d.ts +1 -1
  98. package/dist/src/execution/connections/callback-route.d.ts +1 -11
  99. package/dist/src/execution/connections/callback-route.js +1 -1
  100. package/dist/src/execution/continuation-conflict-step.d.ts +0 -1
  101. package/dist/src/execution/continuation-conflict-step.js +1 -1
  102. package/dist/src/execution/coordination-dispatch-shared.d.ts +1 -1
  103. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  104. package/dist/src/execution/create-session-step.d.ts +1 -1
  105. package/dist/src/execution/durable-session-store.d.ts +10 -48
  106. package/dist/src/execution/durable-session-store.js +1 -1
  107. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  108. package/dist/src/execution/eve-workflow-attributes.d.ts +0 -16
  109. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  110. package/dist/src/execution/hook-ownership.d.ts +2 -4
  111. package/dist/src/execution/hook-ownership.js +1 -1
  112. package/dist/src/execution/legacy-session/authorization.d.ts +9 -0
  113. package/dist/src/execution/legacy-session/authorization.js +1 -0
  114. package/dist/src/execution/legacy-session/completion-step.d.ts +10 -0
  115. package/dist/src/execution/legacy-session/completion-step.js +1 -0
  116. package/dist/src/execution/legacy-session/inbox.d.ts +24 -0
  117. package/dist/src/execution/legacy-session/inbox.js +1 -0
  118. package/dist/src/execution/legacy-session/input.d.ts +19 -0
  119. package/dist/src/execution/legacy-session/input.js +1 -0
  120. package/dist/src/execution/legacy-session/interrupt-step.d.ts +3 -0
  121. package/dist/src/execution/legacy-session/interrupt-step.js +1 -0
  122. package/dist/src/execution/legacy-session/prepare-step.d.ts +24 -0
  123. package/dist/src/execution/legacy-session/prepare-step.js +1 -0
  124. package/dist/src/execution/legacy-session/snapshot.d.ts +12 -0
  125. package/dist/src/execution/legacy-session/snapshot.js +1 -0
  126. package/dist/src/execution/legacy-session/turn-workflow.d.ts +8 -0
  127. package/dist/src/execution/legacy-session/turn-workflow.js +1 -0
  128. package/dist/src/execution/model-call-batching.d.ts +1 -0
  129. package/dist/src/execution/model-call-batching.js +1 -1
  130. package/dist/src/execution/node-step.d.ts +1 -0
  131. package/dist/src/execution/node-step.js +1 -1
  132. package/dist/src/execution/proxied-deliver-step.d.ts +2 -20
  133. package/dist/src/execution/proxied-deliver-step.js +1 -1
  134. package/dist/src/execution/reconcile-session-continuation-token.d.ts +1 -1
  135. package/dist/src/execution/report-dropped-wire-payload-step.d.ts +1 -1
  136. package/dist/src/execution/route-child-delivery.d.ts +2 -2
  137. package/dist/src/execution/route-child-delivery.js +1 -1
  138. package/dist/src/execution/runtime-context.js +1 -1
  139. package/dist/src/execution/sandbox/bindings/eve-image.js +1 -1
  140. package/dist/src/execution/session/accepted-deployment.d.ts +3 -0
  141. package/dist/src/execution/session/accepted-deployment.js +1 -0
  142. package/dist/src/execution/session/admission.d.ts +38 -0
  143. package/dist/src/execution/session/admission.js +1 -0
  144. package/dist/src/execution/session/entry-input.d.ts +42 -0
  145. package/dist/src/execution/session/entry-input.js +1 -0
  146. package/dist/src/execution/session/entry.d.ts +13 -0
  147. package/dist/src/execution/session/entry.js +1 -0
  148. package/dist/src/execution/session/event-sink.d.ts +31 -0
  149. package/dist/src/execution/session/event-sink.js +1 -0
  150. package/dist/src/execution/session/finalization.d.ts +33 -0
  151. package/dist/src/execution/session/finalization.js +1 -0
  152. package/dist/src/execution/session/handoff-steps.d.ts +22 -0
  153. package/dist/src/execution/session/handoff-steps.js +1 -0
  154. package/dist/src/execution/session/handoff.d.ts +69 -0
  155. package/dist/src/execution/session/handoff.js +1 -0
  156. package/dist/src/execution/session/hook-tokens.d.ts +11 -0
  157. package/dist/src/execution/session/hook-tokens.js +1 -0
  158. package/dist/src/execution/session/input-queue.d.ts +72 -0
  159. package/dist/src/execution/session/input-queue.js +1 -0
  160. package/dist/src/execution/session/next-input.d.ts +32 -0
  161. package/dist/src/execution/session/next-input.js +1 -0
  162. package/dist/src/execution/{pending-turn-state.d.ts → session/pending-turn-state.d.ts} +0 -1
  163. package/dist/src/execution/{pending-turn-state.js → session/pending-turn-state.js} +1 -1
  164. package/dist/src/execution/session/program.d.ts +47 -0
  165. package/dist/src/execution/session/program.js +1 -0
  166. package/dist/src/execution/session/route-selected-delivery.d.ts +9 -0
  167. package/dist/src/execution/session/route-selected-delivery.js +1 -0
  168. package/dist/src/execution/session/state-cursor.d.ts +31 -0
  169. package/dist/src/execution/session/state-cursor.js +1 -0
  170. package/dist/src/execution/{session-timeout-control.d.ts → session/timeout-control.d.ts} +1 -1
  171. package/dist/src/execution/session/timeout-control.js +1 -0
  172. package/dist/src/execution/{session-timeout-steps.d.ts → session/timeout-steps.d.ts} +3 -2
  173. package/dist/src/execution/session/timeout-steps.js +1 -0
  174. package/dist/src/execution/{session-timeout-workflow.d.ts → session/timeout-workflow.d.ts} +3 -1
  175. package/dist/src/execution/session/timeout-workflow.js +1 -0
  176. package/dist/src/execution/session/timeout.d.ts +3 -0
  177. package/dist/src/execution/session/timeout.js +1 -0
  178. package/dist/src/execution/session/turn-step-result.d.ts +4 -0
  179. package/dist/src/execution/session/turn-step-result.js +1 -0
  180. package/dist/src/execution/session/turn-step-types.d.ts +68 -0
  181. package/dist/src/execution/session/turn-step-types.js +1 -0
  182. package/dist/src/execution/{workflow-steps.d.ts → session/turn-step.d.ts} +1 -2
  183. package/dist/src/execution/session/turn-step.js +1 -0
  184. package/dist/src/execution/session/turn.d.ts +31 -0
  185. package/dist/src/execution/session/turn.js +1 -0
  186. package/dist/src/execution/session-inbox/address.d.ts +21 -0
  187. package/dist/src/execution/session-inbox/address.js +1 -0
  188. package/dist/src/execution/session-inbox/inbox.d.ts +54 -0
  189. package/dist/src/execution/session-inbox/inbox.js +1 -0
  190. package/dist/src/execution/session-inbox/protocol.d.ts +10 -0
  191. package/dist/src/execution/session-inbox/protocol.js +1 -0
  192. package/dist/src/execution/session-inbox/release-step.d.ts +5 -0
  193. package/dist/src/execution/session-inbox/release-step.js +1 -0
  194. package/dist/src/execution/session-inbox/resume.d.ts +21 -0
  195. package/dist/src/execution/session-inbox/resume.js +1 -0
  196. package/dist/src/execution/{turn-workflow-tool-run.d.ts → session-workflow-tool-run.d.ts} +2 -2
  197. package/dist/src/execution/session-workflow-tool-run.js +1 -0
  198. package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -2
  199. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  200. package/dist/src/execution/skills/instructions.js +1 -1
  201. package/dist/src/execution/stable-workflow-names.d.ts +1 -1
  202. package/dist/src/execution/stable-workflow-names.js +1 -1
  203. package/dist/src/execution/task-input-response-route.js +1 -1
  204. package/dist/src/execution/tasks/child/steps.d.ts +1 -1
  205. package/dist/src/execution/tasks/child/steps.js +1 -1
  206. package/dist/src/execution/tasks/child/workflow.js +1 -1
  207. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  208. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  209. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  210. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  211. package/dist/src/execution/terminal-session-completion-step.d.ts +1 -1
  212. package/dist/src/execution/terminal-session-event.d.ts +1 -1
  213. package/dist/src/execution/terminal-session-event.js +1 -1
  214. package/dist/src/execution/terminal-session-failure-step.d.ts +1 -1
  215. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  216. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  217. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  218. package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
  219. package/dist/src/execution/tools/subagent/emit-called-step.d.ts +1 -1
  220. package/dist/src/execution/tools/subagent/emit-called-step.js +1 -1
  221. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -1
  222. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  223. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +6 -0
  224. package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
  225. package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
  226. package/dist/src/execution/tools/subagent/steer.d.ts +13 -0
  227. package/dist/src/execution/tools/subagent/steer.js +1 -0
  228. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +1 -1
  229. package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
  230. package/dist/src/execution/tools/subagent/task-cancel.js +1 -1
  231. package/dist/src/execution/tools/workflow/ask.d.ts +0 -9
  232. package/dist/src/execution/tools/workflow/ask.js +1 -1
  233. package/dist/src/execution/tools/workflow/body.d.ts +0 -2
  234. package/dist/src/execution/tools/workflow/body.js +1 -1
  235. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +1 -1
  236. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  237. package/dist/src/execution/tools/workflow/messages.d.ts +0 -1
  238. package/dist/src/execution/tools/workflow/messages.js +1 -1
  239. package/dist/src/execution/tools/workflow/owner.d.ts +3 -1
  240. package/dist/src/execution/tools/workflow/owner.js +1 -1
  241. package/dist/src/execution/tools/workflow/resume-hook-step.d.ts +1 -1
  242. package/dist/src/execution/tools/workflow/step-context.d.ts +0 -1
  243. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  244. package/dist/src/execution/tools/workflow/step.js +1 -1
  245. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  246. package/dist/src/execution/workflow-runtime.d.ts +15 -18
  247. package/dist/src/execution/workflow-runtime.js +1 -1
  248. package/dist/src/harness/authorization.d.ts +5 -37
  249. package/dist/src/harness/authorization.js +1 -1
  250. package/dist/src/harness/compaction.js +1 -1
  251. package/dist/src/harness/coordination.js +1 -1
  252. package/dist/src/harness/emission-state.d.ts +1 -0
  253. package/dist/src/harness/emission.js +1 -1
  254. package/dist/src/harness/generation-steering.d.ts +22 -0
  255. package/dist/src/harness/generation-steering.js +1 -0
  256. package/dist/src/harness/messages.d.ts +1 -1
  257. package/dist/src/harness/messages.js +1 -1
  258. package/dist/src/harness/prompt-cache.js +1 -1
  259. package/dist/src/harness/proxy-input-requests.d.ts +1 -1
  260. package/dist/src/harness/proxy-input-requests.js +1 -1
  261. package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
  262. package/dist/src/harness/semantic-errors/signals.js +1 -1
  263. package/dist/src/harness/session-limit-enforcement.js +1 -1
  264. package/dist/src/harness/tool-loop.js +2 -2
  265. package/dist/src/harness/types.d.ts +2 -0
  266. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  267. package/dist/src/instrumentation/channel-delivery.js +1 -1
  268. package/dist/src/instrumentation/lifecycle.d.ts +1 -0
  269. package/dist/src/instrumentation/native-events.js +1 -1
  270. package/dist/src/internal/application/compiled-artifacts.js +3 -2
  271. package/dist/src/internal/application/package.js +1 -1
  272. package/dist/src/internal/gateway.d.ts +1 -0
  273. package/dist/src/internal/gateway.js +1 -1
  274. package/dist/src/internal/model-auth/api-key.d.ts +7 -0
  275. package/dist/src/internal/model-auth/api-key.js +1 -0
  276. package/dist/src/internal/model-auth/available-models.d.ts +2 -0
  277. package/dist/src/internal/model-auth/available-models.js +1 -0
  278. package/dist/src/internal/model-auth/development-broker-client.d.ts +3 -0
  279. package/dist/src/internal/model-auth/development-broker-client.js +1 -0
  280. package/dist/src/internal/model-auth/development-broker-protocol.d.ts +12 -0
  281. package/dist/src/internal/model-auth/development-broker-protocol.js +1 -0
  282. package/dist/src/internal/model-auth/development-broker-server.d.ts +4 -0
  283. package/dist/src/internal/model-auth/development-broker-server.js +1 -0
  284. package/dist/src/internal/model-auth/gateway-credential.d.ts +2 -0
  285. package/dist/src/internal/model-auth/gateway-credential.js +1 -0
  286. package/dist/src/internal/model-auth/store.d.ts +16 -0
  287. package/dist/src/internal/model-auth/store.js +1 -0
  288. package/dist/src/internal/model-auth/transport.d.ts +6 -0
  289. package/dist/src/internal/model-auth/transport.js +1 -0
  290. package/dist/src/internal/model-auth/vercel-cli.d.ts +7 -0
  291. package/dist/src/internal/model-auth/vercel-cli.js +1 -0
  292. package/dist/src/internal/model-auth/vercel-team.d.ts +3 -0
  293. package/dist/src/internal/model-auth/vercel-team.js +1 -0
  294. package/dist/src/internal/model-auth/vercel.d.ts +13 -0
  295. package/dist/src/internal/model-auth/vercel.js +1 -0
  296. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  297. package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
  298. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  299. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  300. package/dist/src/internal/nitro/routes/info.js +1 -1
  301. package/dist/src/internal/resolve-model-endpoint-status.d.ts +2 -0
  302. package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
  303. package/dist/src/internal/vercel/api-resource.d.ts +4 -0
  304. package/dist/src/internal/vercel/api-resource.js +1 -0
  305. package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
  306. package/dist/src/internal/vercel/vercel-services-config.d.ts +2 -0
  307. package/dist/src/internal/vercel/vercel-services-config.js +1 -1
  308. package/dist/src/internal/workflow/development-world-client.js +1 -1
  309. package/dist/src/internal/workflow/development-world-server.js +1 -1
  310. package/dist/src/internal/workflow/local-world-delivery-timeouts.d.ts +1 -1
  311. package/dist/src/internal/workflow/runtime.d.ts +1 -6
  312. package/dist/src/internal/workflow/runtime.js +1 -1
  313. package/dist/src/internal/workflow/vercel-world-defaults.d.ts +4 -0
  314. package/dist/src/internal/workflow/vercel-world-defaults.js +1 -0
  315. package/dist/src/protocol/activity.js +1 -1
  316. package/dist/src/protocol/message.d.ts +8 -0
  317. package/dist/src/protocol/message.js +2 -2
  318. package/dist/src/protocol/routes.d.ts +0 -2
  319. package/dist/src/protocol/routes.js +1 -1
  320. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  321. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  322. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  323. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  324. package/dist/src/public/definitions/channel.d.ts +1 -1
  325. package/dist/src/public/definitions/channel.js +1 -1
  326. package/dist/src/public/models/anthropic/index.d.ts +3 -0
  327. package/dist/src/public/models/anthropic/index.js +1 -0
  328. package/dist/src/public/models/openai/chatgpt/codex-app-server.js +1 -1
  329. package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -1
  330. package/dist/src/public/models/openai/chatgpt/oauth.js +1 -1
  331. package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
  332. package/dist/src/public/models/openai/index.d.ts +4 -2
  333. package/dist/src/public/models/openai/index.js +1 -1
  334. package/dist/src/public/sandbox/docker-sandbox.d.ts +1 -1
  335. package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +1 -1
  336. package/dist/src/public/sandbox/vercel-sandbox.d.ts +1 -1
  337. package/dist/src/public/vercel/index.d.ts +2 -1
  338. package/dist/src/public/vercel/index.js +1 -1
  339. package/dist/src/runtime/agent/resolve-model.js +1 -1
  340. package/dist/src/runtime/prompt/compose.js +1 -1
  341. package/dist/src/runtime/tools/registry.js +1 -1
  342. package/dist/src/self-modification/agent.js +1 -1
  343. package/dist/src/self-modification/setup.d.ts +9 -3
  344. package/dist/src/self-modification/setup.js +2 -2
  345. package/dist/src/setup/cli/option-row.d.ts +2 -1
  346. package/dist/src/setup/cli/option-row.js +1 -1
  347. package/dist/src/setup/cli/prompt-ui.d.ts +2 -0
  348. package/dist/src/setup/cli/prompt-ui.js +1 -1
  349. package/dist/src/setup/cli/select-state.d.ts +1 -1
  350. package/dist/src/setup/cli/select-state.js +1 -1
  351. package/dist/src/setup/flows/chatgpt-auth.js +1 -1
  352. package/dist/src/setup/flows/deploy.d.ts +4 -9
  353. package/dist/src/setup/flows/deploy.js +1 -1
  354. package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
  355. package/dist/src/setup/flows/install-vercel-cli.d.ts +2 -3
  356. package/dist/src/setup/flows/login.d.ts +3 -1
  357. package/dist/src/setup/flows/login.js +1 -1
  358. package/dist/src/setup/flows/model-login-connection.d.ts +36 -0
  359. package/dist/src/setup/flows/model-login-connection.js +1 -0
  360. package/dist/src/setup/flows/model-login-progress.d.ts +7 -0
  361. package/dist/src/setup/flows/model-login-progress.js +1 -0
  362. package/dist/src/setup/flows/model-login.d.ts +22 -0
  363. package/dist/src/setup/flows/model-login.js +1 -0
  364. package/dist/src/setup/flows/model-source-change.d.ts +7 -0
  365. package/dist/src/setup/flows/model-source-change.js +1 -1
  366. package/dist/src/setup/flows/model.d.ts +6 -24
  367. package/dist/src/setup/flows/model.js +1 -1
  368. package/dist/src/setup/flows/registry.d.ts +3 -19
  369. package/dist/src/setup/flows/registry.js +1 -1
  370. package/dist/src/setup/flows/vercel-model-login.d.ts +5 -0
  371. package/dist/src/setup/flows/vercel-model-login.js +1 -0
  372. package/dist/src/setup/integrations/self-modification/setup.d.ts +2 -0
  373. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  374. package/dist/src/setup/project-resolution.js +1 -1
  375. package/dist/src/setup/prompter.d.ts +3 -1
  376. package/dist/src/setup/provider-settings.d.ts +19 -6
  377. package/dist/src/setup/provider-settings.js +1 -1
  378. package/dist/src/setup/scaffold/create/project.js +1 -1
  379. package/dist/src/setup/vercel-project.js +0 -0
  380. package/dist/src/setup/with-spinner.d.ts +1 -1
  381. package/dist/src/setup/with-spinner.js +1 -1
  382. package/dist/src/shared/action-types.js +1 -1
  383. package/dist/src/shared/agent-definition.d.ts +6 -4
  384. package/dist/src/shared/chatgpt-model.d.ts +2 -2
  385. package/dist/src/shared/chatgpt-model.js +1 -1
  386. package/dist/src/shared/model-connection.d.ts +17 -0
  387. package/dist/src/shared/model-connection.js +1 -0
  388. package/dist/src/shared/model-endpoint-status.d.ts +2 -1
  389. package/dist/src/shared/model-helper.d.ts +26 -0
  390. package/dist/src/shared/model-helper.js +1 -0
  391. package/dist/src/shared/package-version.d.ts +2 -0
  392. package/dist/src/shared/package-version.js +1 -0
  393. package/dist/src/shared/vercel-services.d.ts +1 -0
  394. package/dist/src/shared/vercel-services.js +1 -1
  395. package/dist/src/source-change/agent-config-ast.d.ts +6 -0
  396. package/dist/src/source-change/agent-config-ast.js +1 -1
  397. package/dist/src/source-change/apply-model-selection.d.ts +3 -1
  398. package/dist/src/source-change/apply-model-selection.js +1 -2
  399. package/dist/src/source-change/static-source-change.js +1 -1
  400. package/dist/src/subagents/callback-route.js +1 -1
  401. package/dist/src/subagents/event-proxy-step.d.ts +3 -3
  402. package/dist/src/subagents/event-proxy-step.js +1 -1
  403. package/dist/src/subagents/handle-dispatch.d.ts +12 -2
  404. package/dist/src/subagents/handle-dispatch.js +1 -1
  405. package/dist/src/subagents/handles/operation-id.d.ts +1 -1
  406. package/dist/src/subagents/handles/query.d.ts +0 -6
  407. package/dist/src/subagents/handles/query.js +1 -1
  408. package/dist/src/subagents/handles/state-key.d.ts +1 -1
  409. package/dist/src/subagents/handles/store.d.ts +1 -1
  410. package/dist/src/subagents/handles/store.js +1 -1
  411. package/dist/src/subagents/hitl-proxy.d.ts +1 -1
  412. package/dist/src/subagents/parent-notification.d.ts +2 -2
  413. package/dist/src/subagents/parent-result.d.ts +1 -1
  414. package/dist/src/subagents/remote-dispatch.d.ts +1 -1
  415. package/dist/src/subagents/remote-dispatch.js +1 -1
  416. package/dist/src/subagents/start-local.js +1 -1
  417. package/dist/src/subagents/tool.js +1 -1
  418. package/dist/src/svelte/index.js +1 -1
  419. package/dist/src/svelte/use-eve-agent.js +1 -1
  420. package/dist/src/tasks/session-index.js +1 -1
  421. package/dist/src/tasks/types.d.ts +1 -1
  422. package/dist/src/tracing/agent-otel-provider.js +2 -2
  423. package/dist/src/tracing/agent-otel-usage.js +1 -1
  424. package/dist/src/tracing/agent-span-contract.d.ts +1 -0
  425. package/dist/src/tracing/agent-span-contract.js +1 -1
  426. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  427. package/dist/src/vue/index.js +1 -1
  428. package/dist/src/vue/use-eve-agent.js +1 -1
  429. package/docs/agent-config.md +22 -22
  430. package/docs/channels/chat-sdk.mdx +4 -2
  431. package/docs/channels/custom.mdx +16 -10
  432. package/docs/channels/eve.mdx +3 -1
  433. package/docs/channels/linq.mdx +1 -1
  434. package/docs/channels/overview.mdx +4 -2
  435. package/docs/channels/photon.mdx +4 -1
  436. package/docs/channels/slack.mdx +3 -1
  437. package/docs/concepts/execution-model-and-durability.mdx +62 -13
  438. package/docs/concepts/sessions-runs-and-streaming.md +14 -5
  439. package/docs/getting-started.mdx +7 -3
  440. package/docs/guides/deployment/vercel.mdx +1 -1
  441. package/docs/guides/dev-tui.md +54 -27
  442. package/docs/guides/frontend/overview.mdx +3 -1
  443. package/docs/guides/instrumentation/meta.json +1 -0
  444. package/docs/memory/custom-provider.md +1 -1
  445. package/docs/protocols/acp.md +1 -1
  446. package/docs/reference/cli.md +2 -2
  447. package/docs/reference/telemetry.md +1 -1
  448. package/docs/reference/typescript-api.md +12 -5
  449. package/docs/sandbox.mdx +3 -3
  450. package/docs/subagents/index.mdx +2 -2
  451. package/docs/tools/workflows.mdx +1 -1
  452. package/docs/tutorial/how-it-runs.mdx +1 -1
  453. package/package.json +6 -1
  454. package/dist/src/cli/commands/init-repl.d.ts +0 -80
  455. package/dist/src/cli/commands/init-repl.js +0 -1
  456. package/dist/src/cli/commands/init-self-modification.d.ts +0 -7
  457. package/dist/src/cli/commands/init-self-modification.js +0 -1
  458. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +0 -12
  459. package/dist/src/cli/dev/tui/prompt-placeholder.js +0 -1
  460. package/dist/src/cli/dev/tui/remote-auth-command.d.ts +0 -11
  461. package/dist/src/cli/dev/tui/remote-auth-command.js +0 -3
  462. package/dist/src/compiled/_chunks/workflow/attribute-changes-BAcgmlXp.js +0 -20
  463. package/dist/src/compiled/_chunks/workflow/private-CFJkQA7R.js +0 -1
  464. package/dist/src/compiled/_chunks/workflow/resume-hook-BEHe0Uut.js +0 -1
  465. package/dist/src/compiled/_chunks/workflow/run-ChHLjaCt.js +0 -1
  466. package/dist/src/compiled/_chunks/workflow/sleep-BB2HuVie.js +0 -1
  467. package/dist/src/execution/accepted-delivery-deployment.d.ts +0 -7
  468. package/dist/src/execution/accepted-delivery-deployment.js +0 -1
  469. package/dist/src/execution/dispatch-turn-step.d.ts +0 -5
  470. package/dist/src/execution/dispatch-turn-step.js +0 -1
  471. package/dist/src/execution/durable-session-migrations/chain.d.ts +0 -38
  472. package/dist/src/execution/durable-session-migrations/chain.js +0 -1
  473. package/dist/src/execution/durable-session-migrations/snapshot.d.ts +0 -6
  474. package/dist/src/execution/durable-session-migrations/snapshot.js +0 -1
  475. package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.d.ts +0 -12
  476. package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.js +0 -1
  477. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +0 -2
  478. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +0 -1
  479. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +0 -88
  480. package/dist/src/execution/durable-session-migrations/turn-workflow.js +0 -1
  481. package/dist/src/execution/forward-turn-cancellation-step.d.ts +0 -6
  482. package/dist/src/execution/forward-turn-cancellation-step.js +0 -1
  483. package/dist/src/execution/forward-turn-delivery-step.d.ts +0 -6
  484. package/dist/src/execution/forward-turn-delivery-step.js +0 -1
  485. package/dist/src/execution/inline-turn.d.ts +0 -31
  486. package/dist/src/execution/inline-turn.js +0 -1
  487. package/dist/src/execution/next-driver-action.d.ts +0 -85
  488. package/dist/src/execution/parked-delivery-wait.d.ts +0 -54
  489. package/dist/src/execution/parked-delivery-wait.js +0 -1
  490. package/dist/src/execution/session-command-inbox.d.ts +0 -52
  491. package/dist/src/execution/session-command-inbox.js +0 -1
  492. package/dist/src/execution/session-command-token.d.ts +0 -6
  493. package/dist/src/execution/session-command-token.js +0 -1
  494. package/dist/src/execution/session-state-cursor.d.ts +0 -25
  495. package/dist/src/execution/session-state-cursor.js +0 -1
  496. package/dist/src/execution/session-timeout-control.js +0 -1
  497. package/dist/src/execution/session-timeout-steps.js +0 -1
  498. package/dist/src/execution/session-timeout-workflow.js +0 -1
  499. package/dist/src/execution/session-timeout.d.ts +0 -2
  500. package/dist/src/execution/session-timeout.js +0 -1
  501. package/dist/src/execution/turn-cancellation-control.d.ts +0 -30
  502. package/dist/src/execution/turn-cancellation-control.js +0 -1
  503. package/dist/src/execution/turn-cancellation-token.d.ts +0 -10
  504. package/dist/src/execution/turn-cancellation-token.js +0 -1
  505. package/dist/src/execution/turn-control-protocol.d.ts +0 -36
  506. package/dist/src/execution/turn-control-protocol.js +0 -1
  507. package/dist/src/execution/turn-control-receiver.d.ts +0 -54
  508. package/dist/src/execution/turn-control-receiver.js +0 -1
  509. package/dist/src/execution/turn-dispatch.d.ts +0 -39
  510. package/dist/src/execution/turn-dispatch.js +0 -1
  511. package/dist/src/execution/turn-execution-cursor.d.ts +0 -49
  512. package/dist/src/execution/turn-execution-cursor.js +0 -1
  513. package/dist/src/execution/turn-workflow-tool-run.js +0 -1
  514. package/dist/src/execution/turn-workflow.d.ts +0 -13
  515. package/dist/src/execution/turn-workflow.js +0 -1
  516. package/dist/src/execution/wire/session-inbox-contract.d.ts +0 -38
  517. package/dist/src/execution/wire/session-inbox-contract.js +0 -1
  518. package/dist/src/execution/wire/session-inbox-encoder.d.ts +0 -47
  519. package/dist/src/execution/wire/session-inbox-encoder.js +0 -1
  520. package/dist/src/execution/wire/session-inbox-resume.d.ts +0 -12
  521. package/dist/src/execution/wire/session-inbox-resume.js +0 -1
  522. package/dist/src/execution/wire/session-inbox-wire.d.ts +0 -29
  523. package/dist/src/execution/wire/session-inbox-wire.js +0 -1
  524. package/dist/src/execution/wire/session-inbox-wire.v0.d.ts +0 -5
  525. package/dist/src/execution/wire/session-inbox-wire.v0.js +0 -1
  526. package/dist/src/execution/wire/session-inbox-wire.v1.d.ts +0 -237
  527. package/dist/src/execution/wire/session-inbox-wire.v1.js +0 -1
  528. package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
  529. package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +0 -1
  530. package/dist/src/execution/wire/session-inbox-wire.v2.d.ts +0 -478
  531. package/dist/src/execution/wire/session-inbox-wire.v2.js +0 -1
  532. package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +0 -3
  533. package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +0 -1
  534. package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +0 -480
  535. package/dist/src/execution/wire/session-inbox-wire.v3.js +0 -1
  536. package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +0 -3
  537. package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +0 -1
  538. package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +0 -267
  539. package/dist/src/execution/wire/session-inbox-wire.v4.js +0 -1
  540. package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +0 -3
  541. package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +0 -1
  542. package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +0 -341
  543. package/dist/src/execution/wire/session-inbox-wire.v5.js +0 -1
  544. package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +0 -3
  545. package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +0 -1
  546. package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +0 -341
  547. package/dist/src/execution/wire/session-inbox-wire.v6.js +0 -1
  548. package/dist/src/execution/wire/session-inbox-wire.v7.d.ts +0 -342
  549. package/dist/src/execution/wire/session-inbox-wire.v7.js +0 -1
  550. package/dist/src/execution/workflow-entry-crash.d.ts +0 -39
  551. package/dist/src/execution/workflow-entry-crash.js +0 -1
  552. package/dist/src/execution/workflow-entry-finalization.d.ts +0 -28
  553. package/dist/src/execution/workflow-entry-finalization.js +0 -1
  554. package/dist/src/execution/workflow-entry.d.ts +0 -37
  555. package/dist/src/execution/workflow-entry.js +0 -1
  556. package/dist/src/execution/workflow-steps.js +0 -1
  557. package/dist/src/subagents/handles/rebase.d.ts +0 -4
  558. package/dist/src/subagents/handles/rebase.js +0 -1
  559. /package/dist/src/{execution/next-driver-action.js → client/eve-agent-store-state.js} +0 -0
@@ -0,0 +1,3 @@
1
+ import type { PreparedLegacySession } from "./prepare-step.js";
2
+ /** Only the elected importer may stop work or append cancellation events. */
3
+ export declare function interruptLegacySessionStep(prepared: PreparedLegacySession): Promise<import("#execution/settle-cancelled-turn-step.js").CancelledTurnSettleResult>;
@@ -0,0 +1 @@
1
+ import{createLogger,logError}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{walkCauseChain}from"#shared/errors.js";import{cancelRun,getWorld}from"#internal/workflow/runtime.js";import{getWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{EntityConflictError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{settleCancelledTurnStep}from"#execution/settle-cancelled-turn-step.js";async function interruptLegacySessionStep(e){"use step";let t={...e.sessionState,snapshot:{session:{...e.originalSession,history:e.sessionState.snapshot.session.history}}};try{await terminateChildSessionsStep({sessionState:t,serializedContext:e.serializedContext})}catch(e){logError(createLogger(`execution.legacy-session`),`could not cooperatively stop legacy children`,e)}let n=await getWorld(),r=e.originalSession.state,i=new Set(getWorkflowToolRuns(r).map(e=>e.runId)),a=r?.[`eve.agent.handles`];if(isObject(a)&&Array.isArray(a.handles))for(let e of a.handles)isObject(e)&&isObject(e.address)&&(e.address.kind===`agent/local`||e.address.kind===`agent/self`)&&typeof e.address.sessionId==`string`&&i.add(e.address.sessionId);let o=r?.[`eve.tasks`];if(isObject(o)&&Array.isArray(o.tasks))for(let e of o.tasks)isObject(e)&&typeof e.taskRunId==`string`&&i.add(e.taskRunId);for(let t of i)if(t&&t!==e.sessionState.sessionId)try{await cancelRun(n,t,{cancelReason:`Session upgraded`})}catch(e){if(![...walkCauseChain(e)].some(e=>EntityConflictError.is(e)||RunExpiredError.is(e)||WorkflowRunNotFoundError.is(e)))throw e}return e.input.inputCommitted||e.sessionState.emissionState.turnId===``?{sessionState:e.sessionState,serializedContext:e.serializedContext}:await settleCancelledTurnStep({sessionWritable:e.input.sessionWritable,serializedContext:e.serializedContext,sessionState:e.sessionState})}export{interruptLegacySessionStep};
@@ -0,0 +1,24 @@
1
+ import { type LegacyTurnInput } from "./input.js";
2
+ /** Persist the import before publishing its current-generation inbox. */
3
+ export declare function prepareLegacySessionStep(rawInput: unknown): Promise<{
4
+ input: {
5
+ completionToken: string;
6
+ capabilities?: import("../../channel/types.ts").SessionCapabilities;
7
+ mode: import("../../shared/run-mode.ts").RunMode;
8
+ sessionWritable: WritableStream<Uint8Array>;
9
+ serializedContext: Record<string, unknown>;
10
+ sessionState: Record<string, unknown> & {
11
+ sessionId: string;
12
+ };
13
+ delivery: import("../../channel/types.ts").DeliverHookPayload | undefined;
14
+ inputCommitted: boolean;
15
+ retention: "default" | 0 | undefined;
16
+ };
17
+ originalSession: import("./snapshot.js").LegacySession;
18
+ sessionState: import("../durable-session-store.ts").DurableSessionState;
19
+ serializedContext: Record<string, unknown>;
20
+ sessionTimeoutMs: number | false;
21
+ deploymentId: string;
22
+ }>;
23
+ export type PreparedLegacySession = Awaited<ReturnType<typeof prepareLegacySessionStep>>;
24
+ export type { LegacyTurnInput };
@@ -0,0 +1 @@
1
+ import{readLegacyTurnInput}from"./input.js";import{importConversation,readLegacySnapshot}from"./snapshot.js";import{isObject}from"#shared/guards.js";import{SESSION_INBOX_CONTEXT_KEY}from"#execution/session-inbox/address.js";import{getWorld,resolveRunEncryptionKey}from"#internal/workflow/runtime.js";import{hydrateWorkflowArguments}from"#compiled/@workflow/core/serialization.js";import{DEFAULT_SESSION_TIMEOUT_MS}from"#execution/session/timeout.js";async function prepareLegacySessionStep(e){"use step";let t=readLegacyTurnInput(e),n=readLegacySnapshot(t.sessionState),r=importConversation(n),i=await getWorld(),a=await i.runs.get(r.sessionId),o=await hydrateWorkflowArguments(a.input,a.runId,await resolveRunEncryptionKey(i,a)),s=Array.isArray(o)&&isObject(o[0])?o[0]:void 0;if(s===void 0)throw Error(`Cannot read the original session timeout.`);let c=s.sessionTimeoutMs;if(c!==void 0&&c!==!1&&(typeof c!=`number`||!Number.isFinite(c)||c<0))throw Error(`Invalid original session timeout.`);let l=c??DEFAULT_SESSION_TIMEOUT_MS,u={...t.serializedContext,"eve.sessionId":r.sessionId,[SESSION_INBOX_CONTEXT_KEY]:{sessionId:r.sessionId}};delete u[`eve.sessionCallback`];let d=u[`eve.channel`];return isObject(d)&&d.kind===`subagent`&&isObject(d.state)&&(u[`eve.channel`]={...d,state:{...d.state,parentContinuationToken:``}}),{input:{...t,retention:t.retention??s.retention},originalSession:n,sessionState:r,serializedContext:u,sessionTimeoutMs:l,deploymentId:process.env.VERCEL_DEPLOYMENT_ID?.trim()||await i.getDeploymentId()}}export{prepareLegacySessionStep};
@@ -0,0 +1,12 @@
1
+ import type { ModelMessage } from "ai";
2
+ import type { DurableSession, DurableSessionState } from "#execution/durable-session-store.js";
3
+ export type LegacySession = Omit<DurableSession, "history"> & {
4
+ readonly history: ModelMessage[];
5
+ };
6
+ /** Reads the driver's embedded snapshot; every supported driver carries one. */
7
+ export declare function readLegacySnapshot(state: Record<string, unknown> & {
8
+ sessionId: string;
9
+ }): LegacySession;
10
+ /** Keep committed conversation data, but no pre-cutover execution registries. */
11
+ export declare function importConversation(session: LegacySession): DurableSessionState;
12
+ export declare function normalizeHistory(messages: readonly ModelMessage[]): import("#harness/messages.js").HarnessModelMessage[];
@@ -0,0 +1 @@
1
+ import{isObject}from"#shared/guards.js";import{isUserMessageKind,validateHarnessModelMessages}from"#harness/messages.js";import{getHarnessEmissionState}from"#harness/emission.js";const PRESERVED_FRAMEWORK_STATE=new Set([`eve.harness.emission`,`eve.harness.turnUsage`,`eve.harness.reportedSessionUsage`,`eve.harness.sessionRuntimeTokenLimit`]);function readLegacySnapshot(e){let t=e.snapshot;if(!isObject(t)||t.version!==1||!isObject(t.session)||t.session.sessionId!==e.sessionId||!Array.isArray(t.session.history))throw Error(`Unsupported legacy session snapshot.`);return t.session}function importConversation(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([e])=>!e.startsWith(`eve.`)||PRESERVED_FRAMEWORK_STATE.has(e))),n=normalizeHistory(e.history),r=getHarnessEmissionState(t),i={...e,history:n,state:t};return{version:1,sessionId:e.sessionId,continuationToken:e.continuationToken,hasProxyInputRequests:!1,emissionState:r,snapshot:{session:i}}}function normalizeHistory(e){let t=[],n=new Map,settle=()=>{n.size!==0&&(t.push({role:`tool`,content:[...n].map(([e,t])=>({type:`tool-result`,toolCallId:e,toolName:t,output:{type:`error-text`,value:`Interrupted by the session upgrade. Start this work again if it is still needed.`}}))}),n.clear())};for(let r of e){let e=r;if(e.role===`assistant`&&Array.isArray(e.content))e={...e,content:e.content.filter(e=>e.type!==`tool-approval-request`)};else if(e.role===`tool`&&(e={...e,content:e.content.filter(e=>e.type!==`tool-approval-response`)},e.content.length===0))continue;if(e.role!==`tool`&&settle(),e.role===`assistant`&&Array.isArray(e.content))for(let t of e.content)t.type===`tool-call`&&n.set(t.toolCallId,t.toolName);if(e.role===`tool`)for(let t of e.content)t.type===`tool-result`&&n.delete(t.toolCallId);let i=e.kind;t.push(e.role===`user`&&!isUserMessageKind(i)?{...e,kind:`user`}:e)}return settle(),validateHarnessModelMessages(t)}export{importConversation,normalizeHistory,readLegacySnapshot};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Historical dispatch name. Drivers from the former driver/turn execution
3
+ * model start this workflow for each turn. It imports the session once —
4
+ * persisting the conversation, claiming the current-generation inbox, and
5
+ * interrupting pending work — then runs the current owner program. The old
6
+ * driver stays parked as the stream anchor and hears the final result.
7
+ */
8
+ export declare function turnWorkflow(rawInput: unknown): Promise<void>;
@@ -0,0 +1 @@
1
+ import{completeLegacyDriverStep}from"./completion-step.js";import{interruptLegacySessionStep}from"./interrupt-step.js";import{prepareLegacySessionStep}from"./prepare-step.js";import{sessionCommandHookToken}from"#execution/session-inbox/address.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{sessionTimeoutDeadline}from"#execution/session/timeout.js";import{sessionHookTokens}from"#execution/session/hook-tokens.js";import{createSessionInbox}from"#execution/session-inbox/inbox.js";import{failSession,runPreparedSession}from"#execution/session/program.js";async function turnWorkflow(e){"use workflow";let t=await prepareLegacySessionStep(e),{sessionId:n}=t.sessionState,r=createSessionInbox(n);try{await r.claimSessionHook(sessionCommandHookToken(n))}catch(e){if(isHookConflictError(e))return;throw e}let{mode:i,sessionWritable:a}=t.input,o;try{await r.claimSessionHooks(sessionHookTokens(t)),o=await interruptLegacySessionStep(t)}catch(e){return await r.dispose(),await failSession({error:e,mode:i,serializedContext:t.serializedContext,sessionId:n,sessionState:t.sessionState,sessionWritable:a})}await runPreparedSession({anchor:{kind:`self`,notify:e=>completeLegacyDriverStep({completionToken:t.input.completionToken,result:e,serializedContext:t.serializedContext,sessionState:t.sessionState,sessionWritable:a})},caller:void 0,capabilities:t.input.capabilities,deploymentId:t.deploymentId,initialInput:t.input.delivery===void 0?void 0:{...t.input.delivery,caller:void 0},mode:i,retention:t.input.retention,serializedContext:o.serializedContext,sessionId:n,sessionState:o.sessionState,sessionTimeoutMs:t.sessionTimeoutMs,sessionTimeoutDeadline:sessionTimeoutDeadline(t.sessionTimeoutMs,Date.now()),sessionWritable:a},r)}turnWorkflow.workflowId=`workflow//eve//turnWorkflow`;export{turnWorkflow};
@@ -1,5 +1,6 @@
1
1
  import type { HarnessSession, StepInput, StepResult } from "#harness/types.js";
2
2
  export declare function runModelCallBatch(input: {
3
+ readonly steeringSignal?: AbortSignal;
3
4
  readonly initialInput: StepInput | undefined;
4
5
  readonly initialSession: HarnessSession;
5
6
  readonly modelCallsPerStep: number;
@@ -1 +1 @@
1
- import{derivePendingState}from"#execution/pending-turn-state.js";async function runModelCallBatch(e){let t=e.initialSession,n=e.initialInput,r=0;for(;;){let i=await e.runStep({firstCall:r===0,session:t,stepInput:n});if(r++,!shouldRunAnotherModelCall({completedModelCalls:r,modelCallsPerStep:e.modelCallsPerStep,result:i}))return i;t=i.session,n=void 0}}function shouldRunAnotherModelCall(e){if(e.completedModelCalls>=e.modelCallsPerStep||typeof e.result.next!=`function`||e.result.backgroundTaskSession!==void 0||e.result.backgroundTasks!==void 0)return!1;let t=derivePendingState(e.result.session);return!t.hasPendingAuthorization&&!t.hasPendingInputBatch&&(t.pendingCoordinationCallIds?.length??0)===0}export{runModelCallBatch};
1
+ import{derivePendingState}from"#execution/session/pending-turn-state.js";async function runModelCallBatch(e){let t=e.initialSession,n=e.initialInput,r=0;for(;;){let i=await e.runStep({firstCall:r===0,session:t,stepInput:n});if(r++,e.steeringSignal?.aborted===!0||i.steered===!0||!shouldRunAnotherModelCall({completedModelCalls:r,modelCallsPerStep:e.modelCallsPerStep,result:i}))return i;t=i.session,n=void 0}}function shouldRunAnotherModelCall(e){if(e.completedModelCalls>=e.modelCallsPerStep||typeof e.result.next!=`function`||e.result.backgroundTaskSession!==void 0||e.result.backgroundTasks!==void 0)return!1;let t=derivePendingState(e.result.session);return!t.hasPendingAuthorization&&!t.hasPendingInputBatch&&(t.pendingCoordinationCallIds?.length??0)===0}export{runModelCallBatch};
@@ -21,6 +21,7 @@ export type CreateRuntime = (config: {
21
21
  * Input for building a harness step for one resolved runtime node.
22
22
  */
23
23
  export interface CreateExecutionNodeStepInput {
24
+ readonly steeringSignal?: AbortSignal;
24
25
  /** Cancellation signal forwarded to the tool-loop harness. */
25
26
  readonly abortSignal?: AbortSignal;
26
27
  /**
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{UNSPECIFIED_INPUT_SCHEMA}from"#tools/schema.js";import{createToolExecuteWithAuth}from"#execution/tool-auth.js";import{resolveRuntimeModelReference}from"#runtime/agent/resolve-model.js";import{createPreparedWorkflowToolHarnessDefinition,createWorkflowToolHarnessDefinition}from"#execution/tools/workflow/background.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{preparePersistedStepDynamicToolMetadata}from"#context/dynamic-tool-lifecycle.js";import{createToolLoopHarness}from"#harness/tool-loop.js";import{createTaskToolHarnessDefinitions}from"#execution/tools/tasks.js";import{findRegisteredRuntimeTool}from"#runtime/tools/registry.js";import{preserveFrameworkStateOnCompaction}from"#execution/compaction.js";import{ASK_QUESTION_TOOL_NAME}from"#harness/request-input-tool.js";import{WEB_SEARCH_TOOL_NAME,resolveWebSearchActivityLabel}from"#harness/provider-tool-schemas.js";const log=createLogger(`execution.node-step`);function createExecutionNodeStep(e){let t=createRuntimeModelResolver(e.modelResolutionScope),n=e.node.turnAgent.dynamicModel===void 0?void 0:createRuntimeDynamicModelEventDispatcher(e.modelResolutionScope,e.node.turnAgent.dynamicModel),r=createNodeHarnessTools({node:e.node}),i=e.instrumentation,a=i?.prepareExecution(),o=createToolLoopHarness({abortSignal:e.abortSignal,capabilities:e.capabilities,clearOnly:e.clearOnly,compactOnly:e.compactOnly,handleEvent:e.handleEvent,historyProjector:e.historyProjector,historyView:e.historyView,instrumentation:a,mode:e.mode,onCompaction:preserveFrameworkStateOnCompaction,resolveStepDynamicTools:t=>preparePersistedStepDynamicToolMetadata({...t,resolvers:e.node.agent.dynamicToolResolvers??[]}),dispatchDynamicModelEvent:n,resolveModel:t,runtimeIdentity:buildRuntimeIdentity(e.node),tools:r});return i===void 0?o:async(e,t)=>{try{return await o(e,t)}finally{await i.flush()}}}function buildRuntimeIdentity(e){let t=resolveInstalledPackageInfo(),n={agentId:e.turnAgent.id,agentName:e.agent.config?.name,eveVersion:t.version},r=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),i=process.env.VERCEL_GIT_COMMIT_REF?.trim(),a=process.env.VERCEL_DEPLOYMENT_CREATED_AT?.trim();return r||i||a?{...n,build:{deployedAt:a||void 0,gitBranch:i||void 0,gitSha:r||void 0}}:n}function createRuntimeModelResolver(e){return t=>resolveRuntimeModelReference(t,e)}function createRuntimeDynamicModelEventDispatcher(e,t){return n=>dispatchDynamicModelEvent({ctx:n.ctx,dynamicModel:t,event:n.event,messages:n.messages,scope:e})}function createNodeHarnessTools(e){let t=new Map;for(let n of e.node.turnAgent.tools){let r=resolveHarnessToolDefinition({node:e.node,tool:n});r!==null&&t.set(n.name,r)}return t}function resolveHarnessToolDefinition(e){let t=findRegisteredRuntimeTool(e.node.toolRegistry,e.tool.name);return isPreparedRuntimeWorkflowTool(e.tool)?t===null?createPreparedWorkflowToolHarnessDefinition(e.tool):createWorkflowToolHarnessDefinition({executeInput:t.definition.executeInput,definition:createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly}),nodeId:e.tool.task.nodeId,resultKind:e.tool.task.resultKind,workflowId:e.tool.task.workflowId}):t===null?(log.warn(`declared tool is not registered — omitting from toolset`,{toolName:e.tool.name,nodeId:e.node.nodeId}),null):createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly})}function isPreparedRuntimeWorkflowTool(e){return e.task!==void 0}function createRegisteredHarnessToolDefinition(e){let t=e.definition;if(t.owner.kind===`framework`){let n=createTaskToolHarnessDefinitions().find(e=>e.name===t.name);if(n!==void 0)return{...n,behavior:e.behavior}}let n=t.execute,r=t.owner.kind===`framework`&&t.name===ASK_QUESTION_TOOL_NAME;return{label:t.label??(t.owner.kind===`framework`&&t.name===WEB_SEARCH_TOOL_NAME?{start:resolveWebSearchActivityLabel}:void 0),approvalKey:t.approvalKey,behavior:e.behavior,description:t.description,execution:t.execution,executeInput:t.executeInput,execute:r?void 0:resolveAuthoredExecute({rawExecute:n,scope:t.name}),frameworkAction:t.owner.kind===`framework`&&t.name===LOAD_SKILL_TOOL_NAME?`load-skill`:void 0,inputSchema:t.inputSchema??UNSPECIFIED_INPUT_SCHEMA,name:t.name,approval:t.approval,outputSchema:t.outputSchema,rootOnly:e.rootOnly,toModelOutput:t.toModelOutput}}function resolveAuthoredExecute(e){let{rawExecute:t,scope:n}=e;return t===void 0?void 0:createToolExecuteWithAuth({execute:t,scope:n})}export{buildRuntimeIdentity,createExecutionNodeStep,createNodeHarnessTools};
1
+ import{createLogger}from"#internal/logging.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{UNSPECIFIED_INPUT_SCHEMA}from"#tools/schema.js";import{createToolExecuteWithAuth}from"#execution/tool-auth.js";import{resolveRuntimeModelReference}from"#runtime/agent/resolve-model.js";import{createPreparedWorkflowToolHarnessDefinition,createWorkflowToolHarnessDefinition}from"#execution/tools/workflow/background.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{preparePersistedStepDynamicToolMetadata}from"#context/dynamic-tool-lifecycle.js";import{createToolLoopHarness}from"#harness/tool-loop.js";import{createTaskToolHarnessDefinitions}from"#execution/tools/tasks.js";import{findRegisteredRuntimeTool}from"#runtime/tools/registry.js";import{preserveFrameworkStateOnCompaction}from"#execution/compaction.js";import{ASK_QUESTION_TOOL_NAME}from"#harness/request-input-tool.js";import{WEB_SEARCH_TOOL_NAME,resolveWebSearchActivityLabel}from"#harness/provider-tool-schemas.js";const log=createLogger(`execution.node-step`);function createExecutionNodeStep(e){let t=createRuntimeModelResolver(e.modelResolutionScope),n=e.node.turnAgent.dynamicModel===void 0?void 0:createRuntimeDynamicModelEventDispatcher(e.modelResolutionScope,e.node.turnAgent.dynamicModel),r=createNodeHarnessTools({node:e.node}),i=e.instrumentation,a=i?.prepareExecution(),o=createToolLoopHarness({steeringSignal:e.steeringSignal,abortSignal:e.abortSignal,capabilities:e.capabilities,clearOnly:e.clearOnly,compactOnly:e.compactOnly,handleEvent:e.handleEvent,historyProjector:e.historyProjector,historyView:e.historyView,instrumentation:a,mode:e.mode,onCompaction:preserveFrameworkStateOnCompaction,resolveStepDynamicTools:t=>preparePersistedStepDynamicToolMetadata({...t,resolvers:e.node.agent.dynamicToolResolvers??[]}),dispatchDynamicModelEvent:n,resolveModel:t,runtimeIdentity:buildRuntimeIdentity(e.node),tools:r});return i===void 0?o:async(e,t)=>{try{return await o(e,t)}finally{await i.flush()}}}function buildRuntimeIdentity(e){let t=resolveInstalledPackageInfo(),n={agentId:e.turnAgent.id,agentName:e.agent.config?.name,eveVersion:t.version},r=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),i=process.env.VERCEL_GIT_COMMIT_REF?.trim(),a=process.env.VERCEL_DEPLOYMENT_CREATED_AT?.trim();return r||i||a?{...n,build:{deployedAt:a||void 0,gitBranch:i||void 0,gitSha:r||void 0}}:n}function createRuntimeModelResolver(e){return t=>resolveRuntimeModelReference(t,e)}function createRuntimeDynamicModelEventDispatcher(e,t){return n=>dispatchDynamicModelEvent({ctx:n.ctx,dynamicModel:t,event:n.event,messages:n.messages,scope:e})}function createNodeHarnessTools(e){let t=new Map;for(let n of e.node.turnAgent.tools){let r=resolveHarnessToolDefinition({node:e.node,tool:n});r!==null&&t.set(n.name,r)}return t}function resolveHarnessToolDefinition(e){let t=findRegisteredRuntimeTool(e.node.toolRegistry,e.tool.name);return isPreparedRuntimeWorkflowTool(e.tool)?t===null?createPreparedWorkflowToolHarnessDefinition(e.tool):createWorkflowToolHarnessDefinition({executeInput:t.definition.executeInput,definition:createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly}),nodeId:e.tool.task.nodeId,resultKind:e.tool.task.resultKind,workflowId:e.tool.task.workflowId}):t===null?(log.warn(`declared tool is not registered — omitting from toolset`,{toolName:e.tool.name,nodeId:e.node.nodeId}),null):createRegisteredHarnessToolDefinition({behavior:e.tool.behavior,definition:t.definition,rootOnly:e.tool.rootOnly})}function isPreparedRuntimeWorkflowTool(e){return e.task!==void 0}function createRegisteredHarnessToolDefinition(e){let t=e.definition;if(t.owner.kind===`framework`){let n=createTaskToolHarnessDefinitions().find(e=>e.name===t.name);if(n!==void 0)return{...n,behavior:e.behavior}}let n=t.execute,r=t.owner.kind===`framework`&&t.name===ASK_QUESTION_TOOL_NAME;return{label:t.label??(t.owner.kind===`framework`&&t.name===WEB_SEARCH_TOOL_NAME?{start:resolveWebSearchActivityLabel}:void 0),approvalKey:t.approvalKey,behavior:e.behavior,description:t.description,execution:t.execution,executeInput:t.executeInput,execute:r?void 0:resolveAuthoredExecute({rawExecute:n,scope:t.name}),frameworkAction:t.owner.kind===`framework`&&t.name===LOAD_SKILL_TOOL_NAME?`load-skill`:void 0,inputSchema:t.inputSchema??UNSPECIFIED_INPUT_SCHEMA,name:t.name,approval:t.approval,outputSchema:t.outputSchema,rootOnly:e.rootOnly,toModelOutput:t.toModelOutput}}function resolveAuthoredExecute(e){let{rawExecute:t,scope:n}=e;return t===void 0?void 0:createToolExecuteWithAuth({execute:t,scope:n})}export{buildRuntimeIdentity,createExecutionNodeStep,createNodeHarnessTools};
@@ -1,4 +1,4 @@
1
- import type { DeliverHookPayload, DeliverPayload, SessionAuthContext } from "#channel/types.js";
1
+ import type { DeliverHookPayload } from "#channel/types.js";
2
2
  import { type DurableSessionState } from "#execution/durable-session-store.js";
3
3
  export type RoutedDeliverResult = {
4
4
  readonly kind: "cancel-turn";
@@ -10,28 +10,10 @@ export type RoutedDeliverResult = {
10
10
  readonly serializedContext: Record<string, unknown>;
11
11
  readonly sessionState: DurableSessionState;
12
12
  };
13
- type LegacyRoutedDeliverResult = {
14
- readonly kind: "cancel-turn";
15
- readonly serializedContext: Record<string, unknown>;
16
- readonly sessionState: DurableSessionState;
17
- } | {
18
- readonly kind: "continue";
19
- readonly remainder: DeliverPayload | undefined;
20
- readonly serializedContext: Record<string, unknown>;
21
- readonly sessionState: DurableSessionState;
22
- };
23
13
  /** Splits an envelope and validates task routes before forwarding descendant input. */
24
14
  export declare function routeProxiedDeliverStep(input: {
25
15
  readonly delivery: DeliverHookPayload;
26
- readonly parentWritable: WritableStream<Uint8Array>;
16
+ readonly sessionWritable: WritableStream<Uint8Array>;
27
17
  readonly serializedContext?: Record<string, unknown>;
28
18
  readonly sessionState: DurableSessionState;
29
19
  }): Promise<RoutedDeliverResult>;
30
- export declare function routeProxiedDeliverStep(input: {
31
- readonly auth?: SessionAuthContext | null;
32
- readonly parentWritable: WritableStream<Uint8Array>;
33
- readonly payload: DeliverPayload;
34
- readonly serializedContext?: Record<string, unknown>;
35
- readonly sessionState: DurableSessionState;
36
- }): Promise<LegacyRoutedDeliverResult>;
37
- export {};
@@ -1 +1 @@
1
- import{readDurableSession,replaceDurableSessionSnapshot}from"#execution/durable-session-store.js";import{findSessionTaskEntry}from"#tasks/session-index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";import{createTaskInputRequestId,retireProxyInputRequests}from"#harness/proxy-input-requests.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeDeliverPayload}from"#subagents/hitl-proxy.js";import{sendTaskInboundPayload}from"#execution/tasks/parent/run-parent.js";import{resumeWorkflowToolRunAnswers}from"#execution/tools/workflow/answer.js";async function routeProxiedDeliverStep(e){"use step";let t=await readDurableSession(e.sessionState),n=!(`delivery`in e),r=`delivery`in e?e.delivery:{auth:e.auth,kind:`deliver`,payloads:[e.payload]},i=new Map,a=new Map,o;for(let[e,n]of r.payloads.entries()){let s=routeDeliverPayload({allowRoute:(e,n)=>n.taskId===void 0||findSessionTaskEntry(t.state,n.taskId)!==void 0,payload:n,state:t.state});o??=s.parentAction,s.forSelf!==void 0&&i.set(e,s.forSelf);for(let[t,n]of s.forChildren.entries()){let i=[n.childContinuationToken,n.childSessionInbox?.sessionId??``,n.childResponseUrl??``,n.taskId??``].join(`\0`),o=a.get(i)??{answerHook:n.answerHook,childContinuationToken:n.childContinuationToken,childSessionInbox:n.childSessionInbox,childResponseUrl:n.childResponseUrl,metadata:[],payloads:[],retireRequestIds:[],sourcePayloadIndexes:[],taskId:n.taskId},c=o.payloads.length;if(o.payloads.push(n.payload),o.retireRequestIds.push(...n.retireRequestIds),o.sourcePayloadIndexes.push(e),s.forSelf===void 0&&t===0)for(let t of r.deliveryMetadata??[])t.payloadIndex===e&&o.metadata.push({...t,payloadIndex:c});a.set(i,o)}}let s=!1;for(let e of a.values()){let n=e.taskId;if(n!==void 0){let a=findSessionTaskEntry(t.state,n);if(a===void 0){mergeStrandedResponses(i,e,n);continue}if(await sendTaskInboundPayload({taskInboxToken:a.taskInboxToken,payload:{auth:r.auth,childContinuationToken:e.childContinuationToken,childSessionInbox:e.childSessionInbox,childResponseUrl:e.childResponseUrl,inputResponses:coalesceDeliverPayloads(e.payloads).inputResponses??[],kind:`input-response`,taskId:n}})===`unreachable`){mergeStrandedResponses(i,e,n);continue}t=retireProxyInputRequests(t,e.retireRequestIds),s=!0;continue}if(e.answerHook!==void 0){await resumeWorkflowToolRunAnswers(e.childContinuationToken,coalesceDeliverPayloads(e.payloads).inputResponses),t=retireProxyInputRequests(t,e.retireRequestIds),s=!0;continue}let a={...r,deliveryMetadata:e.metadata.length===0?void 0:e.metadata,payloads:e.payloads};await resumeSessionInbox(e.childSessionInbox??e.childContinuationToken,a),t=retireProxyInputRequests(t,e.retireRequestIds),s=!0}let c={serializedContext:e.serializedContext??{},sessionState:s?replaceDurableSessionSnapshot({session:t,state:e.sessionState}):e.sessionState};if(o!==void 0)return{...c,...o};let l=[...i].sort(([e],[t])=>e-t),u=l.flatMap(([e],t)=>(r.deliveryMetadata??[]).filter(t=>t.payloadIndex===e).map(e=>({...e,payloadIndex:t}))),d=l.length===0?void 0:n?coalesceDeliverPayloads(l.map(([,e])=>e)):{...r,deliveryMetadata:u.length===0?void 0:u,payloads:l.map(([,e])=>e)};return{...c,kind:`continue`,remainder:d}}function mergeStrandedResponses(e,t,n){for(let[r,i]of t.payloads.entries()){let a=t.sourcePayloadIndexes[r];if(a===void 0)continue;let o=(i.inputResponses??[]).map(e=>({...e,requestId:createTaskInputRequestId(n,e.requestId)}));if(o.length===0)continue;let s=e.get(a);e.set(a,{...s,inputResponses:[...s?.inputResponses??[],...o]})}}export{routeProxiedDeliverStep};
1
+ import{readDurableSession,replaceDurableSessionSnapshot}from"#execution/durable-session-store.js";import{findSessionTaskEntry}from"#tasks/session-index.js";import{resumeSessionInbox}from"#execution/session-inbox/resume.js";import{createTaskInputRequestId,retireProxyInputRequests}from"#harness/proxy-input-requests.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeDeliverPayload}from"#subagents/hitl-proxy.js";import{sendTaskInboundPayload}from"#execution/tasks/parent/run-parent.js";import{resumeWorkflowToolRunAnswers}from"#execution/tools/workflow/answer.js";async function routeProxiedDeliverStep(e){"use step";let t=readDurableSession(e.sessionState),n=e.delivery,r=new Map,i=new Map,a;for(let[e,o]of n.payloads.entries()){let s=routeDeliverPayload({allowRoute:(e,n)=>n.taskId===void 0||findSessionTaskEntry(t.state,n.taskId)!==void 0,payload:o,state:t.state});a??=s.parentAction,s.forSelf!==void 0&&r.set(e,s.forSelf);for(let[t,r]of s.forChildren.entries()){let a=[r.childContinuationToken,r.childSessionInbox?.sessionId??``,r.childResponseUrl??``,r.taskId??``].join(`\0`),o=i.get(a)??{answerHook:r.answerHook,childContinuationToken:r.childContinuationToken,childSessionInbox:r.childSessionInbox,childResponseUrl:r.childResponseUrl,metadata:[],payloads:[],retireRequestIds:[],sourcePayloadIndexes:[],taskId:r.taskId},c=o.payloads.length;if(o.payloads.push(r.payload),o.retireRequestIds.push(...r.retireRequestIds),o.sourcePayloadIndexes.push(e),s.forSelf===void 0&&t===0)for(let t of n.deliveryMetadata??[])t.payloadIndex===e&&o.metadata.push({...t,payloadIndex:c});i.set(a,o)}}let o=!1;for(let e of i.values()){let i=e.taskId;if(i!==void 0){let a=findSessionTaskEntry(t.state,i);if(a===void 0){mergeStrandedResponses(r,e,i);continue}if(await sendTaskInboundPayload({taskInboxToken:a.taskInboxToken,payload:{auth:n.auth,childContinuationToken:e.childContinuationToken,childSessionInbox:e.childSessionInbox,childResponseUrl:e.childResponseUrl,inputResponses:coalesceDeliverPayloads(e.payloads).inputResponses??[],kind:`input-response`,taskId:i}})===`unreachable`){mergeStrandedResponses(r,e,i);continue}t=retireProxyInputRequests(t,e.retireRequestIds),o=!0;continue}if(e.answerHook!==void 0){await resumeWorkflowToolRunAnswers(e.childContinuationToken,coalesceDeliverPayloads(e.payloads).inputResponses),t=retireProxyInputRequests(t,e.retireRequestIds),o=!0;continue}let a={...n,deliveryMetadata:e.metadata.length===0?void 0:e.metadata,payloads:e.payloads};await resumeSessionInbox(e.childSessionInbox??e.childContinuationToken,a),t=retireProxyInputRequests(t,e.retireRequestIds),o=!0}let s={serializedContext:e.serializedContext??{},sessionState:o?replaceDurableSessionSnapshot({session:t,state:e.sessionState}):e.sessionState};if(a!==void 0)return{...s,...a};let c=[...r].sort(([e],[t])=>e-t),l=c.flatMap(([e],t)=>(n.deliveryMetadata??[]).filter(t=>t.payloadIndex===e).map(e=>({...e,payloadIndex:t}))),u=c.length===0?void 0:{...n,deliveryMetadata:l.length===0?void 0:l,payloads:c.map(([,e])=>e)};return{...s,kind:`continue`,remainder:u}}function mergeStrandedResponses(e,t,n){for(let[r,i]of t.payloads.entries()){let a=t.sourcePayloadIndexes[r];if(a===void 0)continue;let o=(i.inputResponses??[]).map(e=>({...e,requestId:createTaskInputRequestId(n,e.requestId)}));if(o.length===0)continue;let s=e.get(a);e.set(a,{...s,inputResponses:[...s?.inputResponses??[],...o]})}}export{routeProxiedDeliverStep};
@@ -1,4 +1,4 @@
1
1
  import type { ContextAccessor } from "#context/key.js";
2
2
  import type { HarnessSession } from "#harness/types.js";
3
- /** Re-stamps a session after a channel handler changes its continuation token. */
3
+ /** Re-stamps a session after a channel handler selects a new current continuation address. */
4
4
  export declare function reconcileSessionContinuationToken(ctx: ContextAccessor, session: HarnessSession): HarnessSession;
@@ -2,7 +2,7 @@
2
2
  * Surfaces a durable payload dropped by a wire codec's decode.
3
3
  *
4
4
  * Workflow-context consumers cannot log directly — the logging module pulls
5
- * Node builtins the workflow driver bundle must not contain — so the report
5
+ * Node builtins the session owner bundle must not contain — so the report
6
6
  * crosses a step boundary. The recorded step also leaves a durable trace in
7
7
  * the run's event log, which is the operator-visible half of the "drop
8
8
  * loudly, never reinterpret" wire contract.
@@ -8,12 +8,12 @@ import { type RoutedDeliverResult } from "#execution/proxied-deliver-step.js";
8
8
  *
9
9
  * Short-circuits via `hasProxyInputRequests` so the common no-active-descendant
10
10
  * path skips a durable step boundary. Lives in its own non-step module so both
11
- * the driver and the active turn can share it (a `"use step"` module cannot
11
+ * the owner and the active turn can share it (a `"use step"` module cannot
12
12
  * re-export plain helpers into a workflow body).
13
13
  */
14
14
  export declare function routeDeliverToChildren(input: {
15
15
  readonly delivery: DeliverHookPayload;
16
- readonly parentWritable: WritableStream<Uint8Array>;
16
+ readonly sessionWritable: WritableStream<Uint8Array>;
17
17
  readonly sessionState: DurableSessionState;
18
18
  readonly serializedContext: Record<string, unknown>;
19
19
  }): Promise<RoutedDeliverResult>;
@@ -1 +1 @@
1
- import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeProxiedDeliverStep}from"#execution/proxied-deliver-step.js";import{emitRecordedTaskInputRequestStep,runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{recordTaskInputRequestStep,recordTerminalTaskViewsStep}from"#execution/tasks/parent/hitl-proxy-steps.js";import{acceptTaskAuthorizationEventStep}from"#execution/tools/subagent/accept-event-step.js";import{applyTaskAgentRequest}from"#execution/tools/subagent/task-agent-requests.js";async function routeDeliverToChildren(e){let t=coalesceDeliverPayloads(e.delivery.payloads),n=e.serializedContext,r=e.sessionState;for(let i of t.task?.inputRequests??[]){let t=await recordTaskInputRequestStep({request:i,sessionState:r});if(r=t.sessionState,!t.accepted)continue;let a=await emitRecordedTaskInputRequestStep({parentWritable:e.parentWritable,request:t.request,serializedContext:n,sessionState:r});n=a.serializedContext,r=a.sessionState}for(let i of t.task?.agentRequests??[]){let t=await applyTaskAgentRequest({...i,ownerId:i.taskId},{parentWritable:e.parentWritable,serializedContext:n,sessionState:r});n=t.serializedContext,r=t.sessionState}for(let i of t.task?.authorizationEvents??[]){if(!await acceptTaskAuthorizationEventStep({delivery:i,sessionState:r}))continue;let t=await runProxySubagentEventStep({hookPayload:i.hookPayload,parentWritable:e.parentWritable,serializedContext:n,sessionState:r});n=t.serializedContext,r=t.sessionState}if((t.task?.views?.length??0)>0){let e=await recordTerminalTaskViewsStep({serializedContext:n,sessionState:r,views:t.task?.views??[]});n=e.serializedContext,r=e.sessionState}let i=[],a=[];for(let[t,n]of e.delivery.payloads.entries()){let r={...n};if(delete r.task,Object.keys(r).length===0)continue;let o=i.length;i.push(r);for(let n of e.delivery.deliveryMetadata??[])n.payloadIndex===t&&a.push({...n,payloadIndex:o})}let o=i.length===0?void 0:{...e.delivery,deliveryMetadata:a.length===0?void 0:a,payloads:i};return o===void 0?{kind:`continue`,remainder:void 0,serializedContext:n,sessionState:r}:r.hasProxyInputRequests?await routeProxiedDeliverStep({delivery:o,parentWritable:e.parentWritable,serializedContext:n,sessionState:r}):{kind:`continue`,remainder:o,serializedContext:n,sessionState:r}}export{routeDeliverToChildren};
1
+ import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{routeProxiedDeliverStep}from"#execution/proxied-deliver-step.js";import{emitRecordedTaskInputRequestStep,runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{recordTaskInputRequestStep,recordTerminalTaskViewsStep}from"#execution/tasks/parent/hitl-proxy-steps.js";import{acceptTaskAuthorizationEventStep}from"#execution/tools/subagent/accept-event-step.js";import{applyTaskAgentRequest}from"#execution/tools/subagent/task-agent-requests.js";async function routeDeliverToChildren(e){let t=coalesceDeliverPayloads(e.delivery.payloads),n=e.serializedContext,r=e.sessionState;for(let i of t.task?.inputRequests??[]){let t=await recordTaskInputRequestStep({request:i,sessionState:r});if(r=t.sessionState,!t.accepted)continue;let a=await emitRecordedTaskInputRequestStep({sessionWritable:e.sessionWritable,request:t.request,serializedContext:n,sessionState:r});n=a.serializedContext,r=a.sessionState}for(let i of t.task?.agentRequests??[]){let t=await applyTaskAgentRequest({...i,ownerId:i.taskId},{sessionWritable:e.sessionWritable,serializedContext:n,sessionState:r});n=t.serializedContext,r=t.sessionState}for(let i of t.task?.authorizationEvents??[]){if(!await acceptTaskAuthorizationEventStep({delivery:i,sessionState:r}))continue;let t=await runProxySubagentEventStep({hookPayload:i.hookPayload,sessionWritable:e.sessionWritable,serializedContext:n,sessionState:r});n=t.serializedContext,r=t.sessionState}if((t.task?.views?.length??0)>0){let e=await recordTerminalTaskViewsStep({serializedContext:n,sessionState:r,views:t.task?.views??[]});n=e.serializedContext,r=e.sessionState}let i=[],a=[];for(let[t,n]of e.delivery.payloads.entries()){let r={...n};if(delete r.task,Object.keys(r).length===0)continue;let o=i.length;i.push(r);for(let n of e.delivery.deliveryMetadata??[])n.payloadIndex===t&&a.push({...n,payloadIndex:o})}let o=i.length===0?void 0:{...e.delivery,deliveryMetadata:a.length===0?void 0:a,payloads:i};return o===void 0?{kind:`continue`,remainder:void 0,serializedContext:n,sessionState:r}:r.hasProxyInputRequests?await routeProxiedDeliverStep({delivery:o,sessionWritable:e.sessionWritable,serializedContext:n,sessionState:r}):{kind:`continue`,remainder:o,serializedContext:n,sessionState:r}}export{routeDeliverToChildren};
@@ -1 +1 @@
1
- import{ConversationContextKey}from"#shared/conversation-context.js";import{ContextContainer,contextStorage}from"#context/container.js";import{ActivityObserverKey,AuthKey,CapabilitiesKey,ChannelDeliveryKey,ChannelInstrumentationKey,ChannelRequestIdKey,ContinuationTokenKey,ConversationIdKey,DynamicSubagentAgentConfigKey,InitiatorAuthKey,ModeKey,ParentSessionKey,ParentTraceContextKey,ScheduleIdKey,SessionCallbackKey,SessionTitleKey}from"#context/keys.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{readConversationId}from"#tracing/conversation-context.js";import{deriveSessionTitle}from"#execution/eve-workflow-attributes.js";import{setChannelContext}from"#execution/channel-context.js";import{buildConversationContext}from"#channel/conversation-context.js";function buildRunContext(e){let{bundle:t,run:n}=e,r=new ContextContainer,i=n.auth,a=readConversationId(n.conversationId);if(a!==void 0&&r.set(ConversationIdKey,a),r.set(BundleKey,t),setChannelContext(r,n.adapter,{channelName:n.channelName}),r.set(ConversationContextKey,buildConversationContext(n,resolveInstrumentationEnvironment())),n.parent===void 0){let e=deriveSessionTitle(n.title??n.input.message);e!==void 0&&r.set(SessionTitleKey,e)}if(n.channelMetadata!==void 0){let e=r.get(ChannelInstrumentationKey);r.set(ChannelInstrumentationKey,{channelType:e?.channelType??n.channelMetadata.channelType,kind:e?.kind??n.channelMetadata.kind,metadata:n.channelMetadata.metadata})}n.continuationToken!==void 0&&r.set(ContinuationTokenKey,n.continuationToken),r.set(ModeKey,n.mode),r.set(AuthKey,i),r.set(InitiatorAuthKey,n.initiatorAuth??i),e.dynamicSubagentAgentConfig!==void 0&&r.set(DynamicSubagentAgentConfigKey,e.dynamicSubagentAgentConfig),n.capabilities!==void 0&&r.set(CapabilitiesKey,n.capabilities),n.requestId!==void 0&&r.set(ChannelRequestIdKey,n.requestId);let o=contextStorage.getStore()?.get(ScheduleIdKey);return o!==void 0&&r.set(ScheduleIdKey,o),n.delivery!==void 0&&r.set(ChannelDeliveryKey,n.delivery),n.callback!==void 0&&r.set(SessionCallbackKey,n.callback),n.activityObserver!==void 0&&r.set(ActivityObserverKey,n.activityObserver),n.parent!==void 0&&r.set(ParentSessionKey,n.parent),n.parentTraceContext!==void 0&&r.set(ParentTraceContextKey,n.parentTraceContext),r}export{buildRunContext};
1
+ import{ConversationContextKey}from"#shared/conversation-context.js";import{ContextContainer,contextStorage}from"#context/container.js";import{ActivityObserverKey,AuthKey,CapabilitiesKey,ChannelDeliveryKey,ChannelInstrumentationKey,ChannelRequestIdKey,ContinuationHookTokensKey,ContinuationTokenKey,ConversationIdKey,DynamicSubagentAgentConfigKey,InitiatorAuthKey,ModeKey,ParentSessionKey,ParentTraceContextKey,ScheduleIdKey,SessionCallbackKey,SessionTitleKey}from"#context/keys.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{readConversationId}from"#tracing/conversation-context.js";import{setChannelContext}from"#execution/channel-context.js";import{deriveSessionTitle}from"#execution/eve-workflow-attributes.js";import{buildConversationContext}from"#channel/conversation-context.js";function buildRunContext(e){let{bundle:t,run:n}=e,r=new ContextContainer,i=n.auth,a=readConversationId(n.conversationId);if(a!==void 0&&r.set(ConversationIdKey,a),r.set(BundleKey,t),setChannelContext(r,n.adapter,{channelName:n.channelName}),r.set(ConversationContextKey,buildConversationContext(n,resolveInstrumentationEnvironment())),n.parent===void 0){let e=deriveSessionTitle(n.title??n.input.message);e!==void 0&&r.set(SessionTitleKey,e)}if(n.channelMetadata!==void 0){let e=r.get(ChannelInstrumentationKey);r.set(ChannelInstrumentationKey,{channelType:e?.channelType??n.channelMetadata.channelType,kind:e?.kind??n.channelMetadata.kind,metadata:n.channelMetadata.metadata})}n.continuationToken!==void 0&&(r.set(ContinuationTokenKey,n.continuationToken),r.set(ContinuationHookTokensKey,[n.continuationToken])),r.set(ModeKey,n.mode),r.set(AuthKey,i),r.set(InitiatorAuthKey,n.initiatorAuth??i),e.dynamicSubagentAgentConfig!==void 0&&r.set(DynamicSubagentAgentConfigKey,e.dynamicSubagentAgentConfig),n.capabilities!==void 0&&r.set(CapabilitiesKey,n.capabilities),n.requestId!==void 0&&r.set(ChannelRequestIdKey,n.requestId);let o=contextStorage.getStore()?.get(ScheduleIdKey);return o!==void 0&&r.set(ScheduleIdKey,o),n.delivery!==void 0&&r.set(ChannelDeliveryKey,n.delivery),n.callback!==void 0&&r.set(SessionCallbackKey,n.callback),n.activityObserver!==void 0&&r.set(ActivityObserverKey,n.activityObserver),n.parent!==void 0&&r.set(ParentSessionKey,n.parent),n.parentTraceContext!==void 0&&r.set(ParentTraceContextKey,n.parentTraceContext),r}export{buildRunContext};
@@ -1 +1 @@
1
- import{resolveInstalledPackageInfo}from"#internal/application/package.js";function resolveEveSandboxImage(){return`ghcr.io/vercel/eve:${resolveEveSandboxImageTag()}`}function resolveVercelEveSandboxImage(){return`vcr.vercel.com/vercel/eve/base:${resolveEveSandboxImageTag()}`}function resolveEveSandboxImageTag(){let e=process.env.EVE_SANDBOX_IMAGE_TAG?.trim();return e!==void 0&&e.length>0?e:resolveInstalledPackageInfo().version}const DEFAULT_EVE_SANDBOX_IMAGE=resolveEveSandboxImage(),VERCEL_EVE_SANDBOX_IMAGE=resolveVercelEveSandboxImage();export{DEFAULT_EVE_SANDBOX_IMAGE,VERCEL_EVE_SANDBOX_IMAGE,resolveEveSandboxImage,resolveVercelEveSandboxImage};
1
+ import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{stripVersionBuildMetadata}from"#shared/package-version.js";function resolveEveSandboxImage(){return`ghcr.io/vercel/eve:${resolveEveSandboxImageTag()}`}function resolveVercelEveSandboxImage(){return`vcr.vercel.com/vercel/eve/base:${resolveEveSandboxImageTag()}`}function resolveEveSandboxImageTag(){let e=process.env.EVE_SANDBOX_IMAGE_TAG?.trim();return e!==void 0&&e.length>0?e:stripVersionBuildMetadata(resolveInstalledPackageInfo().version)}const DEFAULT_EVE_SANDBOX_IMAGE=resolveEveSandboxImage(),VERCEL_EVE_SANDBOX_IMAGE=resolveVercelEveSandboxImage();export{DEFAULT_EVE_SANDBOX_IMAGE,VERCEL_EVE_SANDBOX_IMAGE,resolveEveSandboxImage,resolveVercelEveSandboxImage};
@@ -0,0 +1,3 @@
1
+ import type { DeliverHookPayload } from "#channel/types.js";
2
+ /** Exact trusted deployment shared by every payload in a delivery. */
3
+ export declare function readAcceptedDeploymentId(delivery: DeliverHookPayload): string | undefined;
@@ -0,0 +1 @@
1
+ function readAcceptedDeploymentId(e){let t=e.deliveryMetadata?.[0]?.acceptedDeploymentId;if(t!==void 0&&t.length!==0&&t!==`latest`)return e.deliveryMetadata?.every(e=>e.acceptedDeploymentId===t)?t:void 0}export{readAcceptedDeploymentId};
@@ -0,0 +1,38 @@
1
+ import type { RuntimeActionResultHookPayload, SessionCommand } from "#channel/types.js";
2
+ import type { DeliveryAdmission, SessionInputQueue } from "#execution/session/input-queue.js";
3
+ import { type SessionInboxPayload } from "#execution/session-inbox/inbox.js";
4
+ import type { SessionStateCursor } from "#execution/session/state-cursor.js";
5
+ import type { WorkflowToolRunMessage } from "#execution/tools/workflow/messages.js";
6
+ export type SessionCancellation = Extract<SessionCommand, {
7
+ readonly kind: "cancel";
8
+ }>;
9
+ /** One canonical admission result, after wire decoding but before turn policy. */
10
+ export type SessionAdmission = {
11
+ readonly admission: DeliveryAdmission;
12
+ readonly kind: "delivery";
13
+ } | {
14
+ readonly command: SessionCancellation;
15
+ readonly kind: "cancel";
16
+ } | {
17
+ readonly kind: "consumed";
18
+ } | {
19
+ readonly kind: "runtime-action-result";
20
+ readonly payload: RuntimeActionResultHookPayload;
21
+ } | {
22
+ readonly kind: "workflow";
23
+ readonly message: WorkflowToolRunMessage;
24
+ };
25
+ /**
26
+ * Decodes and admits one inbox payload. This boundary never decides whether a
27
+ * delivery steers, starts a turn, or routes to a child; those are selection
28
+ * and delivery-routing policies owned by their respective layers.
29
+ */
30
+ export declare function admitSessionInboxPayload(value: SessionInboxPayload, input: {
31
+ readonly cursor: SessionStateCursor;
32
+ readonly queue: SessionInputQueue;
33
+ }): Promise<SessionAdmission>;
34
+ /** Applies accepted cancellation effects after the active-turn guard passes. */
35
+ export declare function applySessionCancellation(command: SessionCancellation, input: {
36
+ readonly cursor: SessionStateCursor;
37
+ readonly queue: SessionInputQueue;
38
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ import{getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{isWorkflowMessage}from"#execution/session-inbox/inbox.js";import{runProxySubagentEventStep}from"#subagents/event-proxy-step.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{SessionInboxPayloadError,decodeSessionInboxPayload}from"#execution/session-inbox/protocol.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{findRunningAgentHandle}from"#subagents/handles/query.js";async function admitSessionInboxPayload(e,t){if(e.kind===`runtime-action-result`)return{kind:`runtime-action-result`,payload:e};if(isWorkflowMessage(e))return{kind:`workflow`,message:e};if(e.kind===`authorization-callback`)return t.queue.enqueueAuthorization(e.payloads),{kind:`consumed`};if(e.kind===`subagent-input-request`||e.kind===`subagent-authorization-event`){let n=findRunningAgentHandle(t.cursor.sessionState.snapshot.session.state,{callId:e.callId});return n?.identity.name===e.subagentName&&n.address.sessionId===e.childSessionId&&await t.cursor.apply(await runProxySubagentEventStep({hookPayload:e,sessionWritable:t.cursor.sessionWritable,serializedContext:t.cursor.serializedContext,sessionState:t.cursor.sessionState})),{kind:`consumed`}}let n;try{n=decodeSessionInboxPayload(e)}catch(e){if(!(e instanceof SessionInboxPayloadError))throw e;return await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`}),{kind:`consumed`}}switch(n.kind){case`deliver`:{let e=t.queue.enqueueDelivery(n);return e===void 0?{kind:`consumed`}:{admission:e,kind:`delivery`}}case`clear`:case`compact`:return t.queue.enqueueControl(n.kind),{kind:`consumed`};case`session-timeout`:return n.ownerRunId===getWorkflowMetadata().workflowRunId&&t.queue.enqueueControl(`expired`),{kind:`consumed`};case`reset`:return t.queue.enqueueControl(`reset`),{command:{kind:`cancel`},kind:`cancel`};case`cancel`:return{command:n,kind:`cancel`}}}async function applySessionCancellation(e,t){e.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:t.cursor.serializedContext,sessionState:t.cursor.sessionState}),e.taskId!==void 0&&t.queue.cancelTask(e.taskId)}export{admitSessionInboxPayload,applySessionCancellation};
@@ -0,0 +1,42 @@
1
+ import type { TokenUsage } from "#shared/token-usage.js";
2
+ import type { DeliverHookPayload, RunInput, SessionCommand } from "#channel/types.js";
3
+ import type { SessionCheckpoint } from "#execution/session/handoff.js";
4
+ import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
5
+ /**
6
+ * Serializable workflow-entry input. All runtime state travels via
7
+ * `serializedContext`, which is produced by `serializeContext(ctx)`
8
+ * and deserialized at each `"use step"` boundary.
9
+ */
10
+ export interface InitialWorkflowEntryInput {
11
+ readonly activityCollectorRunId?: string;
12
+ readonly continuationConflictCommand?: Extract<SessionCommand, {
13
+ readonly kind: "send";
14
+ }>;
15
+ readonly input: RunInput["input"];
16
+ readonly kind: "initial";
17
+ readonly limits?: RunInput["limits"];
18
+ readonly ownerDeploymentId: string;
19
+ readonly retention?: AgentWorkflowRetentionDefinition;
20
+ readonly sessionTimeoutMs?: number | false;
21
+ readonly serializedContext: Record<string, unknown>;
22
+ readonly taskId?: string;
23
+ }
24
+ /** A successor owner started by a previous owner during a deployment handoff. */
25
+ export interface HandoffWorkflowEntryInput {
26
+ readonly activationToken: string;
27
+ readonly checkpoint: SessionCheckpoint;
28
+ /** The one delivery that triggered the handoff; processed before any later arrival. */
29
+ readonly delivery: DeliverHookPayload;
30
+ readonly kind: "handoff";
31
+ readonly ownerDeploymentId: string;
32
+ readonly sessionWritable: WritableStream<Uint8Array>;
33
+ /** Stable public identity; also the original run that anchors the stream. */
34
+ readonly sessionId: string;
35
+ }
36
+ export type WorkflowEntryInput = InitialWorkflowEntryInput | HandoffWorkflowEntryInput;
37
+ export interface WorkflowEntryResult {
38
+ readonly isError?: boolean;
39
+ readonly usage?: TokenUsage;
40
+ readonly usageDelta?: TokenUsage;
41
+ readonly output: unknown;
42
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,13 @@
1
+ import type { WorkflowEntryInput, WorkflowEntryResult } from "#execution/session/entry-input.js";
2
+ /**
3
+ * Long-lived workflow entrypoint. Handles both root sessions and
4
+ * delegated child sessions: root sessions expose only parent
5
+ * control-plane events; delegated children publish their full progress
6
+ * on a child stream and resume the parked parent with a
7
+ * `subagent-result` on completion.
8
+ *
9
+ * The current owner directly executes every turn. An idle owner can transfer
10
+ * its settled checkpoint and hooks to an exact successor deployment while the
11
+ * original run remains parked as the public stream anchor.
12
+ */
13
+ export declare function workflowEntry(input: WorkflowEntryInput): Promise<WorkflowEntryResult>;
@@ -0,0 +1 @@
1
+ import{attachClientContext,readClientContext}from"#internal/client-context.js";import{SESSION_INBOX_CONTEXT_KEY,sessionCommandHookToken}from"#execution/session-inbox/address.js";import{getWorkflowMetadata,getWritable}from"#compiled/@workflow/core/index.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{DEFAULT_SESSION_TIMEOUT_MS,sessionTimeoutDeadline}from"#execution/session/timeout.js";import{sessionHookTokens}from"#execution/session/hook-tokens.js";import{createSessionInbox}from"#execution/session-inbox/inbox.js";import{failSession,runPreparedSession}from"#execution/session/program.js";import{readChannelRequestId,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{resolveInitialTurnCallerStep}from"#subagents/parent-notification.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{createSessionStep}from"#execution/create-session-step.js";import{settleContinuationConflictStep}from"#execution/continuation-conflict-step.js";import{signalSessionOwnerActivationStep,validateSessionCheckpointStep}from"#execution/session/handoff-steps.js";async function workflowEntry(e){"use workflow";let t=e.kind===`initial`?await bootInitialOwner(e,getWorkflowMetadata().workflowRunId):await bootHandoffOwner(e);return t===void 0?{output:``}:{output:(await runPreparedSession(t.session,t.inbox)).output}}function stampSessionIdentity(e,t){return{...e,"eve.sessionId":t,[SESSION_INBOX_CONTEXT_KEY]:{sessionId:t}}}async function bootInitialOwner(e,t){let n=stampSessionIdentity(e.serializedContext,t),r=getWritable(),i=n[`eve.mode`],a=createSessionInbox(t),{workflowStartedAt:o}=getWorkflowMetadata(),s=e.sessionTimeoutMs??DEFAULT_SESSION_TIMEOUT_MS,c=n[`eve.continuationToken`]||``,l=n[`eve.bundle`];try{let[u,d,f]=await Promise.allSettled([createSessionStep({compiledArtifactsSource:l.source,continuationToken:c,dynamicSubagentAgentConfig:n[`eve.dynamicSubagentAgentConfig`],inheritedLimits:e.limits,nodeId:l.nodeId,outputSchema:e.input.outputSchema,rootSessionId:readRootSessionId(n),sessionId:t,taskId:e.taskId}),a.claimSessionHook(sessionCommandHookToken(t)),c===``?Promise.resolve():a.claimSessionHook(c)]);if(u.status===`rejected`)throw u.reason;if(d.status===`rejected`)throw d.reason;if(f.status===`rejected`){if(!isHookConflictError(f.reason))throw f.reason;(e.activityCollectorRunId!==void 0||e.continuationConflictCommand!==void 0)&&await settleContinuationConflictStep({activityCollectorRunId:e.activityCollectorRunId,command:e.continuationConflictCommand,continuationToken:c}),await a.dispose();return}return{inbox:a,session:{anchor:{kind:`self`},caller:hasDelegatedCallerContext(n)?await resolveInitialTurnCallerStep({serializedContext:n}):void 0,capabilities:n[`eve.capabilities`],deploymentId:e.ownerDeploymentId,initialInput:createInitialDelivery(e,n),mode:i,retention:e.retention,serializedContext:n,sessionId:t,sessionState:u.value.state,sessionTimeoutMs:s,sessionTimeoutDeadline:sessionTimeoutDeadline(s,o.getTime()),sessionWritable:r}}}catch(e){return await a.dispose(),await failSession({error:e,mode:i,serializedContext:n,sessionId:t,sessionState:void 0,sessionWritable:r})}}async function bootHandoffOwner(e){let{checkpoint:t,sessionId:n}=e,r=stampSessionIdentity(t.serializedContext,n),i=createSessionInbox(n);try{await validateSessionCheckpointStep({checkpoint:t}),await i.claimSessionHooks(sessionHookTokens({serializedContext:r,sessionState:t.sessionState})),await signalSessionOwnerActivationStep({activation:{kind:`active`},token:e.activationToken})}catch(t){let n=await i.release();await signalSessionOwnerActivationStep({activation:{error:normalizeSerializableError(t),kind:`failed`,payloads:n},token:e.activationToken});return}return{inbox:i,session:{anchor:{kind:`successor`},caller:e.delivery.caller,capabilities:t.capabilities,deploymentId:e.ownerDeploymentId,initialInput:e.delivery,mode:t.mode,retention:t.retention,serializedContext:r,sessionId:n,sessionState:t.sessionState,sessionTimeoutMs:t.sessionTimeoutMs,sessionTimeoutDeadline:sessionTimeoutDeadline(t.sessionTimeoutMs,Date.now()),sessionWritable:e.sessionWritable}}}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`}function createInitialDelivery(e,t){return{deliveryMetadata:t[`eve.channelDelivery`]===void 0?void 0:[{...t[`eve.channelDelivery`],payloadIndex:0}],kind:`deliver`,payloads:[attachClientContext({message:e.input.message,context:e.input.context,outputSchema:e.input.outputSchema},readClientContext(e.input))],requestId:readChannelRequestId(t)}}workflowEntry.workflowId=`workflow//eve//workflowEntry`;export{workflowEntry};
@@ -0,0 +1,31 @@
1
+ import { buildAdapterContext } from "#channel/adapter-context.js";
2
+ import { type ChannelAdapter } from "#channel/adapter.js";
3
+ import type { ContextContainer } from "#context/container.js";
4
+ import { bindDynamicConnections } from "#execution/dynamic-connections.js";
5
+ import type { resolveEffectiveAgentRuntime } from "#execution/effective-agent-config.js";
6
+ import type { HandleEventFn } from "#harness/types.js";
7
+ import type { ExecutionInstrumentation } from "#instrumentation/runtime.js";
8
+ import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
9
+ export interface SessionEventSinkInput {
10
+ readonly abortSignal: AbortSignal | undefined;
11
+ readonly adapter: ChannelAdapter;
12
+ readonly bundle: CompiledBundle;
13
+ readonly ctx: ContextContainer;
14
+ readonly effectiveAgent: ReturnType<typeof resolveEffectiveAgentRuntime>;
15
+ readonly instrumentation: ExecutionInstrumentation | undefined;
16
+ readonly isFirstTurn: boolean;
17
+ readonly sessionWritable: WritableStream<Uint8Array>;
18
+ readonly sessionId: string;
19
+ }
20
+ export interface SessionEventSink {
21
+ readonly adapterCtx: ReturnType<typeof buildAdapterContext>;
22
+ readonly dynamicConnections: ReturnType<typeof bindDynamicConnections>;
23
+ readonly effectiveNode: CompiledBundle["graph"]["root"];
24
+ readonly handleEvent: HandleEventFn;
25
+ /** Closes the parent stream; only a terminal `done` step does this. */
26
+ close(): Promise<void>;
27
+ /** Releases the writer lock so the next step can acquire it. Safe after `close()`. */
28
+ release(): void;
29
+ }
30
+ /** Binds adapter context, dynamic connections, and event fan-out to one step's stream writer. */
31
+ export declare function createSessionEventSink(input: SessionEventSinkInput): SessionEventSink;
@@ -0,0 +1 @@
1
+ import{callAdapterEventHandler}from"#channel/adapter.js";import{ScheduleIdKey,TurnDeliveryIdsKey,TurnTaskDeliveryKey}from"#context/keys.js";import{encodeMessageStreamEvent,stampMessageStreamEvent}from"#protocol/message.js";import{dispatchDynamicSubagentEvent}from"#context/dynamic-subagent-lifecycle.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{dispatchDynamicToolEvent}from"#context/dynamic-tool-lifecycle.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchDynamicInstructionEvent}from"#context/dynamic-instruction-lifecycle.js";import{dispatchDynamicSkillEvent}from"#context/dynamic-skill-lifecycle.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{dispatchMemoryLifecycleEvent}from"#context/memory-event-lifecycle.js";import*as activityCohort from"#execution/activity-cohort.js";import{bindDynamicConnections}from"#execution/dynamic-connections.js";import{observeSessionActivity}from"#execution/session-activity-projection.js";import{scheduledLaunchDeliveryEvent}from"#execution/scheduled-launch-delivery.js";import{forwardTaskEventToSessionCallback}from"#execution/task-event-callback.js";function createSessionEventSink(e){let{adapter:t,bundle:n,ctx:r,effectiveAgent:i,instrumentation:a}=e,o=buildAdapterContext(t,r),s=bindDynamicConnections(r,n.resolvedAgent),c={...n.graph.root,turnAgent:i.turnAgent},l=e.sessionWritable.getWriter(),emit=async n=>{let i=scheduledLaunchDeliveryEvent(n,{isFirstTurn:e.isFirstTurn,isScheduled:r.get(ScheduleIdKey)!==void 0,taskPhase:r.get(TurnTaskDeliveryKey)});if(i===void 0)return{event:stampMessageStreamEvent(n,r.get(TurnDeliveryIdsKey)),suppressed:!0};let a=await callAdapterEventHandler(t,i,o);setChannelContext(r,{...t,state:{...o.state}});let s=stampMessageStreamEvent(a,r.get(TurnDeliveryIdsKey));return await l.write(encodeMessageStreamEvent(s)),{event:s,suppressed:!1}},handleEvent=async(t,o)=>{activityCohort.updateActivityBlockers(r,t);let l=await forwardTaskEventToSessionCallback(r,t)?{event:stampMessageStreamEvent(t,r.get(TurnDeliveryIdsKey)),suppressed:!1}:await emit(t),u=await dispatchMemoryLifecycleEvent({abortSignal:e.abortSignal,appRoot:c.agent?.metadata?.appRoot??``,ctx:r,event:t,instrumentation:a?.memory,memories:c.agent?.memories??[],messages:o,nodeId:n.nodeId??`__root__`});observeSessionActivity({ctx:r,event:l.event,sessionId:e.sessionId}),l.suppressed||await dispatchStreamEventHooks({ctx:r,registry:n.hookRegistry,event:l.event}),l.event.type!==`step.started`&&await dispatchDynamicModelEvent({ctx:r,dynamicModel:i.turnAgent.dynamicModel,event:l.event,messages:u,scope:{moduleMap:n.moduleMap,nodeId:n.nodeId}}),await s.dispatch(l.event),await dispatchDynamicSubagentEvent({ctx:r,resolvers:n.subagentRegistry.dynamicResolvers??[],event:l.event,messages:u}),await dispatchDynamicToolEvent({ctx:r,resolvers:n.resolvedAgent.dynamicToolResolvers??[],event:l.event,messages:u}),await dispatchDynamicSkillEvent({ctx:r,resolvers:n.resolvedAgent.dynamicSkillResolvers??[],event:l.event,messages:u}),await dispatchDynamicInstructionEvent({ctx:r,resolvers:n.resolvedAgent.dynamicInstructionsResolvers??[],event:l.event,messages:u})},u=!1,release=()=>{u||(u=!0,l.releaseLock())};return{adapterCtx:o,close:async()=>{await l.close(),release()},dynamicConnections:s,effectiveNode:c,handleEvent,release}}export{createSessionEventSink};
@@ -0,0 +1,33 @@
1
+ import type { TurnCaller } from "#channel/types.js";
2
+ import type { DurableSessionState } from "#execution/durable-session-store.js";
3
+ import type { TurnOutcome } from "#execution/session/turn-step-types.js";
4
+ import type { WorkflowEntryResult } from "#execution/session/entry-input.js";
5
+ import type { RunMode } from "#shared/run-mode.js";
6
+ /** The three ways a session ends. `done` already emitted its terminal event inside the turn. */
7
+ export type SessionTerminalOutcome = {
8
+ readonly kind: "done";
9
+ readonly action: TurnOutcome & {
10
+ readonly kind: "done";
11
+ };
12
+ } | {
13
+ readonly kind: "expired";
14
+ } | {
15
+ readonly kind: "failed";
16
+ readonly error: unknown;
17
+ readonly turnId?: string;
18
+ };
19
+ export interface SessionFinalizationContext {
20
+ readonly caller: TurnCaller | undefined;
21
+ readonly cursor: {
22
+ readonly serializedContext: Record<string, unknown>;
23
+ readonly sessionState: DurableSessionState | undefined;
24
+ };
25
+ readonly mode: RunMode;
26
+ readonly sessionWritable: WritableStream<Uint8Array>;
27
+ }
28
+ /**
29
+ * Terminates descendants, emits the terminal protocol event when the turn has
30
+ * not already done so, then settles whoever is waiting on this session: the
31
+ * task callback and delegated parent in task mode, or the parked caller.
32
+ */
33
+ export declare function finalizeSession(outcome: SessionTerminalOutcome, context: SessionFinalizationContext): Promise<WorkflowEntryResult>;
@@ -0,0 +1 @@
1
+ import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{notifyDelegatedParentStep,notifyTurnCallerStep}from"#subagents/parent-notification.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{emitTerminalSessionCompletionStep}from"#execution/terminal-session-completion-step.js";import{emitTerminalSessionFailureStep}from"#execution/terminal-session-failure-step.js";import{fireSessionCallbackStep}from"#subagents/callback-step.js";import{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult}from"#subagents/parent-result.js";async function finalizeSession(e,t){let{serializedContext:n,sessionState:r}=t.cursor;r!==void 0&&await terminateChildSessionsStep({serializedContext:n,sessionState:r}),e.kind===`expired`?await emitTerminalSessionCompletionStep({sessionWritable:t.sessionWritable,serializedContext:n}):e.kind===`failed`&&await emitTerminalSessionFailureStep({error:normalizeSerializableError(e.error),sessionWritable:t.sessionWritable,serializedContext:n,turnId:e.turnId});let i=settledResult(e);if(t.mode===`task`)await fireSessionCallbackStep({error:i.isError?i.output:void 0,output:i.isError?void 0:i.output,serializedContext:n,status:i.isError?`failed`:`completed`,usage:i.sessionUsage}),await notifyDelegatedParentStep({result:i.isError?createDelegatedSubagentErrorResult(n,i.output):createDelegatedSubagentSuccessResult(n,i.output),serializedContext:n,usage:i.sessionUsage});else if(t.caller!==void 0){let e={output:i.output,usage:i.turnUsage};i.isError&&(e.isError=!0),await notifyTurnCallerStep({caller:t.caller,lifecycle:`terminal`,sessionId:r?.sessionId??n[`eve.sessionId`],settled:e})}return e.kind===`done`?{isError:e.action.isError,output:e.action.output,usage:e.action.usage,usageDelta:e.action.usageDelta}:{isError:i.isError,output:i.output}}function settledResult(e){switch(e.kind){case`done`:return{isError:e.action.isError===!0,output:e.action.output,sessionUsage:e.action.usage,turnUsage:e.action.usageDelta};case`expired`:return{isError:!1,output:``};case`failed`:return{isError:!0,output:normalizeSerializableError(e.error)}}}export{finalizeSession};
@@ -0,0 +1,22 @@
1
+ import { type DurableSessionState } from "#execution/durable-session-store.js";
2
+ import { type SessionCheckpoint, type SessionOwnerActivation } from "#execution/session/handoff.js";
3
+ /** Parses retained work with this deployment's code before deciding whether it can move. */
4
+ export declare function isSessionStateIdleForHandoff(sessionState: DurableSessionState): boolean;
5
+ /** Reads durable work using the source deployment's handoff contract. */
6
+ export declare function isSessionIdleForHandoffStep(input: {
7
+ readonly sessionState: DurableSessionState;
8
+ }): Promise<boolean>;
9
+ /** Validates a checkpoint and resolves the target deployment's compiled bundle. */
10
+ export declare function validateSessionCheckpointStep(input: {
11
+ readonly checkpoint: SessionCheckpoint;
12
+ }): Promise<void>;
13
+ export declare function signalSessionOwnerActivationStep(input: {
14
+ readonly activation: SessionOwnerActivation;
15
+ readonly token: string;
16
+ }): Promise<void>;
17
+ export declare function signalSessionAnchorStep(input: {
18
+ readonly result: {
19
+ readonly output: unknown;
20
+ };
21
+ readonly token: string;
22
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ import{isObject}from"#shared/guards.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{resumeHook}from"#internal/workflow/runtime.js";import{deserializeContext}from"#context/serialize.js";import{readDurableSession}from"#execution/durable-session-store.js";import{getAgentHandleStore}from"#subagents/handles/store.js";import{getSessionTaskIndex}from"#tasks/session-index.js";import{SESSION_CHECKPOINT_VERSION}from"#execution/session/handoff.js";function isSessionStateIdleForHandoff(e){let{state:t}=readDurableSession(e),n=getSessionTaskIndex(t),r=getAgentHandleStore(t);if([`eve.runtime.pendingAuthorization`,`eve.runtime.pendingInputBatch`,`eve.runtime.pendingCoordinationBatch`,`eve.runtime.deferredStepInput`,`eve.harness.pendingWorkflowInterrupt`].some(e=>t?.[e]!==void 0))return!1;for(let e of[`eve.runtime.pendingInputBatches`,`eve.runtime.workflowToolRuns`]){let n=t?.[e];if(n!==void 0&&(!Array.isArray(n)||n.length>0))return!1}let i=t?.[`eve.runtime.proxyInputRequests`];return i!==void 0&&(!isObject(i)||Object.keys(i).length>0)?!1:(r?.handles.length??0)===0&&n.every(e=>e.terminalView!==void 0)}async function isSessionIdleForHandoffStep(e){"use step";return isSessionStateIdleForHandoff(e.sessionState)}async function validateSessionCheckpointStep(e){"use step";let{checkpoint:t}=e;if(t.version!==SESSION_CHECKPOINT_VERSION)throw Error(`Unsupported session checkpoint version ${JSON.stringify(t.version)}; this deployment reads version ${SESSION_CHECKPOINT_VERSION}. Start a new session on this deployment.`);let n=t.sessionTimeoutMs;if(n!==!1&&(typeof n!=`number`||!Number.isFinite(n)||n<0))throw Error(`Session checkpoint contains an invalid timeout duration.`);if((await deserializeContext(t.serializedContext)).require(BundleKey),!isSessionStateIdleForHandoff(t.sessionState))throw Error(`Session checkpoint contains pending work and cannot be handed off.`)}async function signalSessionOwnerActivationStep(e){"use step";await resumeHook(e.token,e.activation)}async function signalSessionAnchorStep(e){"use step";await resumeHook(e.token,e.result)}export{isSessionIdleForHandoffStep,isSessionStateIdleForHandoff,signalSessionAnchorStep,signalSessionOwnerActivationStep,validateSessionCheckpointStep};
@@ -0,0 +1,69 @@
1
+ import type { SessionCapabilities } from "#channel/types.js";
2
+ import type { DurableSessionState } from "#execution/durable-session-store.js";
3
+ import type { SessionInboxHandle, SessionInboxPayload } from "#execution/session-inbox/inbox.js";
4
+ import type { TurnSelection } from "#execution/session/input-queue.js";
5
+ import type { WorkflowEntryResult } from "#execution/session/entry-input.js";
6
+ import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
7
+ import type { RunMode } from "#shared/run-mode.js";
8
+ /**
9
+ * Cross-deployment checkpoint contract. The successor may run a different eve
10
+ * build than the owner that produced it; bump when any field changes shape so
11
+ * an incompatible successor rejects the handoff instead of misreading state.
12
+ */
13
+ export declare const SESSION_CHECKPOINT_VERSION = 4;
14
+ /** Everything a successor needs to continue an idle session. Hooks are derived from the state. */
15
+ export interface SessionCheckpoint {
16
+ readonly version: typeof SESSION_CHECKPOINT_VERSION;
17
+ readonly capabilities?: SessionCapabilities;
18
+ readonly mode: RunMode;
19
+ readonly retention?: AgentWorkflowRetentionDefinition;
20
+ readonly serializedContext: Record<string, unknown>;
21
+ readonly sessionState: DurableSessionState;
22
+ readonly sessionTimeoutMs: number | false;
23
+ }
24
+ export type SessionOwnerActivation = {
25
+ readonly kind: "active";
26
+ } | {
27
+ readonly kind: "failed";
28
+ readonly error: unknown;
29
+ /** Commands accepted by partial successor claims before startup failed. */
30
+ readonly payloads: readonly SessionInboxPayload[];
31
+ };
32
+ export type SessionTransferOutcome = {
33
+ readonly kind: "transferred";
34
+ } | {
35
+ readonly kind: "retained";
36
+ readonly reason: "same-deployment" | "missing-deployment" | "not-idle" | "busy" | "accepted-during-release" | "activation-failed";
37
+ };
38
+ export interface SessionHandoffInput {
39
+ readonly checkpoint: Omit<SessionCheckpoint, "serializedContext" | "sessionState" | "version">;
40
+ readonly deploymentId: string;
41
+ readonly inbox: SessionInboxHandle;
42
+ readonly isInitialOwner: boolean;
43
+ readonly sessionId: string;
44
+ }
45
+ export declare function sessionAnchorToken(sessionId: string): string;
46
+ /**
47
+ * The sole boundary for moving an idle session to another exact deployment.
48
+ * Constructed once per owner; `tryTransfer()` is attempted per eligible selection.
49
+ * When the upstream atomic hook-handoff primitive lands, only this class changes.
50
+ */
51
+ export declare class SessionHandoff {
52
+ private readonly input;
53
+ private anchor;
54
+ constructor(input: SessionHandoffInput);
55
+ /**
56
+ * Attempts to move the session to the selected delivery's deployment. The
57
+ * outcome states whether the successor activated or this owner retained the
58
+ * session. Candidate failures recover locally rather than escaping.
59
+ */
60
+ tryTransfer(selection: TurnSelection, state: Pick<SessionCheckpoint, "serializedContext" | "sessionState">): Promise<SessionTransferOutcome>;
61
+ /** After a transfer, the original run parks until the final owner reports the session result. */
62
+ awaitAnchoredResult(): Promise<WorkflowEntryResult>;
63
+ disposeAnchor(): Promise<void>;
64
+ /** Starts the candidate and waits for it to activate or fail. */
65
+ private startAndActivate;
66
+ /** Reclaims the exact hook set and replays payloads accepted while it was released. */
67
+ private recover;
68
+ private ensureAnchor;
69
+ }
@@ -0,0 +1 @@
1
+ import{sessionHandoffMarkerToken}from"#execution/session-inbox/address.js";import{startSessionOwnerStep}from"#execution/workflow-runtime.js";import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook}from"#execution/hook-ownership.js";import{sessionHookTokens}from"#execution/session/hook-tokens.js";import{isSessionIdleForHandoffStep}from"#execution/session/handoff-steps.js";import{readAcceptedDeploymentId}from"#execution/session/accepted-deployment.js";const SESSION_CHECKPOINT_VERSION=4;function sessionAnchorToken(e){return`${e}:anchor`}var SessionHandoff=class{input;anchor;constructor(e){this.input=e}async tryTransfer(e,t){let{deploymentId:n,inbox:r}=this.input,i=readAcceptedDeploymentId(e.delivery);if(i===void 0)return{kind:`retained`,reason:`missing-deployment`};if(i===n)return{kind:`retained`,reason:`same-deployment`};if(!e.handoffEligible)return{kind:`retained`,reason:`busy`};if(!await isSessionIdleForHandoffStep(t))return{kind:`retained`,reason:`not-idle`};let a={...this.input.checkpoint,...t,version:4},o=sessionHookTokens(t);await this.ensureAnchor();let s=o.map(e=>createHook({token:sessionHandoffMarkerToken(e)}));await Promise.all(s.map(e=>claimHookOwnership(e)));try{let t=await r.release();if(t.length>0)return await this.recover(o,t),{kind:`retained`,reason:`accepted-during-release`};let n=[];try{let t=await this.startAndActivate(a,e.delivery,i);if(t.kind===`active`)return{kind:`transferred`};n=t.payloads}catch{}return await this.recover(o,n),{kind:`retained`,reason:`activation-failed`}}finally{await Promise.all(s.map(e=>disposeHook(e)))}}async awaitAnchoredResult(){if(this.anchor===void 0)throw Error(`Session anchor was never claimed.`);try{return await this.anchor}finally{await this.disposeAnchor()}}async disposeAnchor(){if(this.anchor===void 0)return;let e=this.anchor;this.anchor=void 0,await disposeHook(e)}async startAndActivate(e,t,n){let r=createHook({token:`${getWorkflowMetadata().workflowRunId}:handoff`});await claimHookOwnership(r);try{return await startSessionOwnerStep({activationToken:r.token,anchorRunId:this.input.sessionId,checkpoint:e,delivery:t,targetDeploymentId:n}),await r}finally{await disposeHook(r)}}async recover(e,t){await this.input.inbox.claimSessionHooks(e),this.input.inbox.restore(t)}async ensureAnchor(){this.input.isInitialOwner&&this.anchor===void 0&&(this.anchor=createHook({token:sessionAnchorToken(this.input.sessionId)}),await claimHookOwnership(this.anchor))}};export{SESSION_CHECKPOINT_VERSION,SessionHandoff,sessionAnchorToken};
@@ -0,0 +1,11 @@
1
+ import type { DurableSessionState } from "#execution/durable-session-store.js";
2
+ /**
3
+ * Every hook a session answers to, derived from its committed state: the
4
+ * stable command inbox plus each continuation alias a channel handler
5
+ * selected. This is the one source of truth for claims at boot, at every
6
+ * state transition, and across a deployment handoff.
7
+ */
8
+ export declare function sessionHookTokens(input: {
9
+ readonly serializedContext: Record<string, unknown>;
10
+ readonly sessionState: Pick<DurableSessionState, "continuationToken" | "sessionId">;
11
+ }): readonly string[];
@@ -0,0 +1 @@
1
+ import{sessionCommandHookToken}from"#execution/session-inbox/address.js";import{ContinuationHookTokensKey}from"#context/keys.js";function sessionHookTokens(e){let t=e.serializedContext[ContinuationHookTokensKey.name],n=new Set([sessionCommandHookToken(e.sessionState.sessionId)]);if(Array.isArray(t))for(let e of t)typeof e==`string`&&e.length>0&&n.add(e);return e.sessionState.continuationToken!==``&&n.add(e.sessionState.continuationToken),[...n]}export{sessionHookTokens};