eve 0.82.0 → 0.83.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 (480) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/NOTICE +1 -1
  3. package/dist/src/channel/pending-authorization.d.ts +5 -0
  4. package/dist/src/channel/pending-authorization.js +1 -1
  5. package/dist/src/channel/session.d.ts +2 -0
  6. package/dist/src/channel/session.js +1 -1
  7. package/dist/src/channel/types.d.ts +5 -0
  8. package/dist/src/chunks/{use-eve-agent-DlznYwQk.js → use-eve-agent-3-WRmJkd.js} +40 -5
  9. package/dist/src/chunks/{use-eve-agent-DTu78IAF.js → use-eve-agent-Ci5dr0aR.js} +40 -5
  10. package/dist/src/cli/dev/local-server-child.js +1 -1
  11. package/dist/src/cli/dev/local-server-cleanup.js +1 -1
  12. package/dist/src/cli/dev/tui/question-panel.d.ts +4 -1
  13. package/dist/src/cli/dev/tui/question-panel.js +1 -1
  14. package/dist/src/cli/dev/tui/terminal-renderer.js +4 -4
  15. package/dist/src/client/eve-agent-store.d.ts +1 -1
  16. package/dist/src/client/eve-agent-store.js +1 -1
  17. package/dist/src/client/index.d.ts +1 -0
  18. package/dist/src/client/session-controls.d.ts +6 -0
  19. package/dist/src/client/session-controls.js +1 -1
  20. package/dist/src/client/session.d.ts +4 -0
  21. package/dist/src/client/session.js +1 -1
  22. package/dist/src/compiled/.vendor-stamp.json +8 -8
  23. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  24. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +2 -0
  25. package/dist/src/compiled/@workflow/core/index.js +2 -2
  26. package/dist/src/compiled/@workflow/core/private.d.ts +5 -3
  27. package/dist/src/compiled/@workflow/core/private.js +1 -1
  28. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +1 -37
  29. package/dist/src/compiled/@workflow/core/runtime/event-limit-warning.d.ts +32 -0
  30. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +5 -6
  31. package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
  32. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +8 -0
  33. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +16 -0
  34. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -18
  35. package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +20 -0
  36. package/dist/src/compiled/@workflow/core/runtime.js +4 -4
  37. package/dist/src/compiled/@workflow/core/seeded-nanoid.d.ts +2 -0
  38. package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +14 -3
  39. package/dist/src/compiled/@workflow/core/serialization.d.ts +1 -1
  40. package/dist/src/compiled/@workflow/core/serialization.js +1 -1
  41. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +0 -18
  42. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  43. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  44. package/dist/src/compiled/@workflow/errors/index.d.ts +48 -0
  45. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  46. package/dist/src/compiled/@workflow/world/env-config.d.ts +24 -0
  47. package/dist/src/compiled/@workflow/world/events.d.ts +126 -7
  48. package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
  49. package/dist/src/compiled/@workflow/world/interfaces.d.ts +59 -8
  50. package/dist/src/compiled/@workflow/world/queue.d.ts +71 -9
  51. package/dist/src/compiled/@workflow/world/recovery.d.ts +6 -0
  52. package/dist/src/compiled/@workflow/world/test-support/duplicate-event-fixtures.d.ts +3 -0
  53. package/dist/src/compiled/@workflow/world/test-support/in-band-fence-conformance.d.ts +46 -0
  54. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  55. package/dist/src/compiled/@workflow/world-vercel/index.js +18 -18
  56. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BW-kbMMn.js → attribute-changes-7se_SE2q.js} +3 -3
  57. package/dist/src/compiled/_chunks/workflow/dist-CcnNPAp4.js +1 -0
  58. package/dist/src/compiled/_chunks/workflow/dist-S9cZRway.js +3 -0
  59. package/dist/src/compiled/_chunks/workflow/helpers-CxNRXH0a.js +1 -0
  60. package/dist/src/compiled/_chunks/workflow/private-DLYTSBbu.js +1 -0
  61. package/dist/src/compiled/_chunks/workflow/resume-hook-CPiIfe8r.js +1 -0
  62. package/dist/src/compiled/_chunks/workflow/{run-DzdAqdb1.js → run-BJSLCXR4.js} +6 -6
  63. package/dist/src/compiled/_chunks/workflow/serialization-B9gneT9Z.js +15 -0
  64. package/dist/src/compiled/_chunks/workflow/sleep-BL0oQs3R.js +1 -0
  65. package/dist/src/compiled/_chunks/workflow/{wait-until-xbRRDuUf.js → wait-until-BPou0RGO.js} +1 -1
  66. package/dist/src/compiled/_chunks/workflow/workflow-routes-BaljomCk.js +1 -0
  67. package/dist/src/compiled/{@ai-sdk/code-mode → run}/LICENSE +1 -1
  68. package/dist/src/compiled/run/index.d.ts +384 -0
  69. package/dist/src/compiled/run/index.js +650 -0
  70. package/dist/src/compiler/extension-compatibility.d.ts +21 -14
  71. package/dist/src/compiler/extension-compatibility.js +1 -1
  72. package/dist/src/compiler/manifest.js +1 -1
  73. package/dist/src/compiler/normalize-agent-config.js +1 -1
  74. package/dist/src/compiler/normalize-manifest.js +1 -1
  75. package/dist/src/compiler/normalize-sandbox.js +1 -1
  76. package/dist/src/compiler/workspace-resources.js +1 -1
  77. package/dist/src/context/build-callback-context.js +1 -1
  78. package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
  79. package/dist/src/context/providers/sandbox.js +1 -1
  80. package/dist/src/discover/extension-specifier.d.ts +1 -0
  81. package/dist/src/discover/extension-specifier.js +1 -1
  82. package/dist/src/evals/cli/eval.js +2 -2
  83. package/dist/src/evals/runner/artifacts.js +1 -1
  84. package/dist/src/evals/runner/derive-run-facts.d.ts +12 -0
  85. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  86. package/dist/src/evals/runner/execute-task.js +1 -1
  87. package/dist/src/evals/types.d.ts +3 -2
  88. package/dist/src/eve-channel/index.js +1 -1
  89. package/dist/src/eve-channel/request.d.ts +0 -1
  90. package/dist/src/eve-channel/request.js +2 -2
  91. package/dist/src/execution/agent-sessions/context.d.ts +1 -1
  92. package/dist/src/execution/agent-sessions/context.js +1 -1
  93. package/dist/src/execution/coordination-dispatch-shared.d.ts +3 -0
  94. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  95. package/dist/src/execution/dynamic-workflow/program-step.d.ts +7 -7
  96. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  97. package/dist/src/execution/dynamic-workflow/schema.d.ts +18 -11
  98. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  99. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  100. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  101. package/dist/src/execution/eve-workflow-attributes.d.ts +3 -1
  102. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  103. package/dist/src/execution/invoke-tool.js +1 -1
  104. package/dist/src/execution/sandbox/abort-bound-session.js +1 -1
  105. package/dist/src/execution/sandbox/active-connections.d.ts +28 -0
  106. package/dist/src/execution/sandbox/active-connections.js +1 -0
  107. package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +10 -2
  108. package/dist/src/execution/sandbox/bindings/docker-cli.js +2 -2
  109. package/dist/src/execution/sandbox/bindings/docker-connection.d.ts +15 -0
  110. package/dist/src/execution/sandbox/bindings/docker-connection.js +2 -0
  111. package/dist/src/execution/sandbox/bindings/docker-container.d.ts +2 -0
  112. package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
  113. package/dist/src/execution/sandbox/bindings/docker-network.d.ts +5 -0
  114. package/dist/src/execution/sandbox/bindings/docker-network.js +1 -1
  115. package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
  116. package/dist/src/execution/sandbox/bindings/docker.d.ts +12 -15
  117. package/dist/src/execution/sandbox/bindings/docker.js +1 -1
  118. package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +19 -29
  119. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  120. package/dist/src/execution/sandbox/bindings/just-bash.d.ts +2 -4
  121. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  122. package/dist/src/execution/sandbox/bindings/local-provider-utils.d.ts +0 -20
  123. package/dist/src/execution/sandbox/bindings/local-provider-utils.js +1 -1
  124. package/dist/src/execution/sandbox/bindings/local.d.ts +4 -6
  125. package/dist/src/execution/sandbox/bindings/local.js +1 -1
  126. package/dist/src/execution/sandbox/bindings/vercel-base-runtime.d.ts +2 -0
  127. package/dist/src/execution/sandbox/bindings/vercel-base-runtime.js +2 -2
  128. package/dist/src/execution/sandbox/bindings/vercel-errors.js +2 -2
  129. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +7 -5
  130. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  131. package/dist/src/execution/sandbox/bindings/vercel.d.ts +5 -11
  132. package/dist/src/execution/sandbox/bindings/vercel.js +1 -2
  133. package/dist/src/execution/sandbox/development-cleanup.d.ts +0 -1
  134. package/dist/src/execution/sandbox/development-cleanup.js +1 -1
  135. package/dist/src/execution/sandbox/development-lazy-prewarm.js +1 -1
  136. package/dist/src/execution/sandbox/development-run.d.ts +0 -2
  137. package/dist/src/execution/sandbox/development-run.js +1 -1
  138. package/dist/src/execution/sandbox/dockerfile.d.ts +0 -4
  139. package/dist/src/execution/sandbox/dockerfile.js +1 -1
  140. package/dist/src/execution/sandbox/ensure.d.ts +23 -11
  141. package/dist/src/execution/sandbox/ensure.js +1 -1
  142. package/dist/src/execution/sandbox/glob-tool.js +3 -3
  143. package/dist/src/execution/sandbox/grep-tool.js +1 -1
  144. package/dist/src/execution/sandbox/logging-session.js +1 -1
  145. package/dist/src/execution/sandbox/prewarm.d.ts +23 -3
  146. package/dist/src/execution/sandbox/prewarm.js +2 -1
  147. package/dist/src/execution/sandbox/read-file.js +1 -1
  148. package/dist/src/execution/sandbox/require-sandbox.d.ts +3 -2
  149. package/dist/src/execution/sandbox/require-sandbox.js +1 -1
  150. package/dist/src/execution/sandbox/ripgrep-probe.js +1 -1
  151. package/dist/src/execution/sandbox/session.d.ts +10 -20
  152. package/dist/src/execution/sandbox/session.js +2 -2
  153. package/dist/src/execution/session/admission.js +1 -1
  154. package/dist/src/execution/session/checkpoint-migrations.js +1 -1
  155. package/dist/src/execution/session/entry-input.d.ts +5 -4
  156. package/dist/src/execution/session/entry.js +1 -1
  157. package/dist/src/execution/session/handoff-state.d.ts +5 -0
  158. package/dist/src/execution/session/handoff-state.js +1 -0
  159. package/dist/src/execution/session/handoff-steps.d.ts +0 -5
  160. package/dist/src/execution/session/handoff-steps.js +1 -1
  161. package/dist/src/execution/session/handoff.d.ts +2 -1
  162. package/dist/src/execution/session/handoff.js +1 -1
  163. package/dist/src/execution/session/input-queue.d.ts +3 -0
  164. package/dist/src/execution/session/input-queue.js +1 -1
  165. package/dist/src/execution/session/next-input.d.ts +3 -0
  166. package/dist/src/execution/session/next-input.js +1 -1
  167. package/dist/src/execution/session/program.js +1 -1
  168. package/dist/src/execution/session/timeout-control.d.ts +4 -0
  169. package/dist/src/execution/session/timeout-control.js +1 -1
  170. package/dist/src/execution/session/turn-control.d.ts +5 -2
  171. package/dist/src/execution/session/turn-control.js +1 -1
  172. package/dist/src/execution/session/turn.js +1 -1
  173. package/dist/src/execution/session-inbox/inbox.d.ts +9 -1
  174. package/dist/src/execution/session-inbox/inbox.js +1 -1
  175. package/dist/src/execution/session-inbox/protocol.d.ts +2 -1
  176. package/dist/src/execution/session-inbox/protocol.js +1 -1
  177. package/dist/src/execution/session-inbox/resume.d.ts +2 -1
  178. package/dist/src/execution/session-inbox/resume.js +1 -1
  179. package/dist/src/execution/session-prewarm.d.ts +8 -0
  180. package/dist/src/execution/session-prewarm.js +1 -0
  181. package/dist/src/execution/skills/instructions.js +1 -1
  182. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  183. package/dist/src/execution/tools/workflow/body.js +1 -1
  184. package/dist/src/execution/tools/workflow/step-context.d.ts +11 -0
  185. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  186. package/dist/src/execution/tools/workflow/step.js +1 -1
  187. package/dist/src/execution/workflow-runtime.js +1 -1
  188. package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
  189. package/dist/src/framework/sources/modules/sandbox.d.ts +1 -1
  190. package/dist/src/harness/attachment-staging.d.ts +0 -7
  191. package/dist/src/harness/attachment-staging.js +1 -1
  192. package/dist/src/harness/hitl/index.d.ts +2 -1
  193. package/dist/src/harness/hitl/index.js +1 -1
  194. package/dist/src/harness/hitl/view.d.ts +1 -0
  195. package/dist/src/harness/hitl/view.js +1 -0
  196. package/dist/src/harness/model-call/run.js +1 -1
  197. package/dist/src/harness/semantic-errors/rules/sandbox.d.ts +3 -5
  198. package/dist/src/harness/semantic-errors/rules/sandbox.js +1 -1
  199. package/dist/src/harness/step/prompt.js +1 -1
  200. package/dist/src/harness/tool-history-repair.d.ts +9 -0
  201. package/dist/src/harness/tool-history-repair.js +1 -0
  202. package/dist/src/harness/tool-model-output.d.ts +19 -3
  203. package/dist/src/harness/tool-model-output.js +1 -1
  204. package/dist/src/internal/application/compiled-artifacts.js +8 -4
  205. package/dist/src/internal/application/optional-package-import.d.ts +10 -0
  206. package/dist/src/internal/application/optional-package-import.js +1 -1
  207. package/dist/src/internal/application/stamped-package-version.js +1 -1
  208. package/dist/src/internal/attachments/limited-read.d.ts +2 -2
  209. package/dist/src/internal/authored-module-build-options.d.ts +6 -0
  210. package/dist/src/internal/authored-module-build-options.js +1 -1
  211. package/dist/src/internal/authored-module-cache.d.ts +10 -0
  212. package/dist/src/internal/authored-module-cache.js +1 -0
  213. package/dist/src/internal/authored-module-graph.js +1 -1
  214. package/dist/src/internal/authored-module-loader.js +1 -1
  215. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  216. package/dist/src/internal/bundler/nitro-rolldown.d.ts +3 -1
  217. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  218. package/dist/src/internal/bundler/pseudo-packages.d.ts +11 -0
  219. package/dist/src/internal/bundler/pseudo-packages.js +1 -0
  220. package/dist/src/internal/nitro/host/build-extension.d.ts +6 -0
  221. package/dist/src/internal/nitro/host/build-extension.js +2 -2
  222. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.d.ts +3 -1
  223. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.js +3 -5
  224. package/dist/src/internal/nitro/host/create-application-nitro.d.ts +2 -3
  225. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  226. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +2 -0
  227. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  228. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  229. package/dist/src/internal/nitro/host/dev-build-host.d.ts +83 -0
  230. package/dist/src/internal/nitro/host/dev-build-host.js +1 -0
  231. package/dist/src/internal/nitro/host/dev-build-operations.d.ts +6 -0
  232. package/dist/src/internal/nitro/host/dev-build-operations.js +1 -0
  233. package/dist/src/internal/nitro/host/dev-build-process.d.ts +1 -0
  234. package/dist/src/internal/nitro/host/dev-build-process.js +1 -0
  235. package/dist/src/internal/nitro/host/development-runtime-prune-plugin.d.ts +4 -1
  236. package/dist/src/internal/nitro/host/development-runtime-prune-plugin.js +3 -2
  237. package/dist/src/internal/nitro/host/drained-nitro-dev-server.d.ts +13 -0
  238. package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
  239. package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.js +1 -1
  240. package/dist/src/internal/nitro/host/prepare-application-host.d.ts +3 -0
  241. package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
  242. package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
  243. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  244. package/dist/src/internal/nitro/host/start-production-server.js +3 -3
  245. package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -1
  246. package/dist/src/internal/nitro/host.js +1 -1
  247. package/dist/src/internal/workflow/local-world-delivery-auth.d.ts +17 -0
  248. package/dist/src/internal/workflow/local-world-delivery-auth.js +1 -0
  249. package/dist/src/internal/workflow/queue-namespace.d.ts +2 -0
  250. package/dist/src/internal/workflow/queue-namespace.js +1 -1
  251. package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -1
  252. package/dist/src/internal/workflow-bundle/builder-support.js +2 -2
  253. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  254. package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +1 -1
  255. package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
  256. package/dist/src/protocol/prewarm-session.d.ts +14 -0
  257. package/dist/src/protocol/prewarm-session.js +1 -0
  258. package/dist/src/protocol/routes.d.ts +2 -2
  259. package/dist/src/public/channels/discord/authorization.d.ts +45 -0
  260. package/dist/src/public/channels/discord/authorization.js +3 -0
  261. package/dist/src/public/channels/discord/defaults.d.ts +14 -3
  262. package/dist/src/public/channels/discord/defaults.js +2 -2
  263. package/dist/src/public/channels/discord/discordChannel.d.ts +15 -1
  264. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  265. package/dist/src/public/channels/discord/gateway/connection.d.ts +26 -0
  266. package/dist/src/public/channels/discord/gateway/connection.js +1 -0
  267. package/dist/src/public/channels/discord/gateway/forwarder.d.ts +14 -0
  268. package/dist/src/public/channels/discord/gateway/forwarder.js +1 -0
  269. package/dist/src/public/channels/discord/gateway/index.d.ts +59 -0
  270. package/dist/src/public/channels/discord/gateway/index.js +1 -0
  271. package/dist/src/public/channels/discord/inbound.d.ts +10 -3
  272. package/dist/src/public/channels/discord/inbound.js +2 -2
  273. package/dist/src/public/channels/discord/index.d.ts +3 -2
  274. package/dist/src/public/channels/discord/index.js +1 -1
  275. package/dist/src/public/channels/discord/messages.d.ts +116 -0
  276. package/dist/src/public/channels/discord/messages.js +2 -0
  277. package/dist/src/public/channels/github/checkout.js +1 -1
  278. package/dist/src/public/channels/linq/linqChannel.d.ts +4 -1
  279. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  280. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  281. package/dist/src/public/channels/same-environment-oidc.d.ts +7 -0
  282. package/dist/src/public/channels/same-environment-oidc.js +1 -0
  283. package/dist/src/public/definitions/channel.js +1 -1
  284. package/dist/src/public/definitions/sandbox.d.ts +1 -1
  285. package/dist/src/public/next/server.js +1 -1
  286. package/dist/src/public/sandbox/docker-sandbox.d.ts +6 -1
  287. package/dist/src/public/sandbox/docker.d.ts +1 -8
  288. package/dist/src/public/sandbox/index.d.ts +3 -3
  289. package/dist/src/public/sandbox/just-bash-sandbox.d.ts +87 -7
  290. package/dist/src/public/sandbox/just-bash.d.ts +1 -1
  291. package/dist/src/public/sandbox/provider.d.ts +5 -1
  292. package/dist/src/public/sandbox/provider.js +1 -1
  293. package/dist/src/public/sandbox/vercel-sandbox.d.ts +16 -9
  294. package/dist/src/public/sandbox/vercel.d.ts +0 -1
  295. package/dist/src/public/sandbox/vercel.js +1 -1
  296. package/dist/src/public/tools/agent.d.ts +8 -1
  297. package/dist/src/public/tools/agent.js +1 -1
  298. package/dist/src/react/use-eve-agent.d.ts +1 -1
  299. package/dist/src/runtime/agent/resolve-model.js +1 -1
  300. package/dist/src/runtime/connections/openapi-client.d.ts +2 -0
  301. package/dist/src/runtime/connections/openapi-client.js +1 -1
  302. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  303. package/dist/src/runtime/resolve-agent.js +1 -1
  304. package/dist/src/runtime/resolve-channel.js +1 -1
  305. package/dist/src/runtime/resolve-sandbox.js +1 -1
  306. package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
  307. package/dist/src/runtime/sandbox/registry.d.ts +2 -0
  308. package/dist/src/runtime/sandbox/registry.js +1 -1
  309. package/dist/src/runtime/subagents/workflow.d.ts +6 -0
  310. package/dist/src/runtime/subagents/workflow.js +1 -1
  311. package/dist/src/runtime/workspace/seed-files.d.ts +9 -12
  312. package/dist/src/runtime/workspace/seed-files.js +1 -1
  313. package/dist/src/runtime/workspace/spec.d.ts +1 -1
  314. package/dist/src/runtime/workspace/spec.js +1 -1
  315. package/dist/src/runtime/workspace/types.d.ts +2 -6
  316. package/dist/src/sandbox/provider.d.ts +185 -0
  317. package/dist/src/sandbox/provider.js +1 -0
  318. package/dist/src/sandbox/providers/default.d.ts +20 -19
  319. package/dist/src/sandbox/providers/default.js +1 -1
  320. package/dist/src/sandbox/providers/docker.d.ts +5 -2
  321. package/dist/src/sandbox/providers/docker.js +1 -1
  322. package/dist/src/sandbox/providers/just-bash.d.ts +4 -3
  323. package/dist/src/sandbox/providers/just-bash.js +1 -1
  324. package/dist/src/sandbox/providers/vercel.d.ts +4 -10
  325. package/dist/src/sandbox/providers/vercel.js +1 -1
  326. package/dist/src/sandbox/providers.d.ts +0 -1
  327. package/dist/src/sandbox/providers.js +1 -1
  328. package/dist/src/sandbox/state.d.ts +44 -0
  329. package/dist/src/sandbox/state.js +1 -1
  330. package/dist/src/self-modification/deployed-sandbox.d.ts +4 -9
  331. package/dist/src/self-modification/deployed-sandbox.js +1 -1
  332. package/dist/src/self-modification/filesystem.d.ts +3 -3
  333. package/dist/src/self-modification/remote/config.d.ts +2 -2
  334. package/dist/src/self-modification/remote/config.js +1 -1
  335. package/dist/src/self-modification/setup.d.ts +0 -1
  336. package/dist/src/self-modification/setup.js +8 -8
  337. package/dist/src/setup/integrations/discord/api.d.ts +7 -0
  338. package/dist/src/setup/integrations/discord/api.js +1 -1
  339. package/dist/src/setup/integrations/discord/daemon.d.ts +18 -0
  340. package/dist/src/setup/integrations/discord/daemon.js +21 -0
  341. package/dist/src/setup/integrations/discord/setup.d.ts +24 -4
  342. package/dist/src/setup/integrations/discord/setup.js +5 -4
  343. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  344. package/dist/src/setup/scaffold/create/project.js +1 -1
  345. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  346. package/dist/src/setup/scaffold/version-tokens.d.ts +0 -1
  347. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  348. package/dist/src/shared/agent-definition.d.ts +2 -0
  349. package/dist/src/shared/built-server-start-failure.d.ts +12 -0
  350. package/dist/src/shared/built-server-start-failure.js +3 -0
  351. package/dist/src/shared/framework-eve-server.d.ts +2 -0
  352. package/dist/src/shared/framework-eve-server.js +2 -2
  353. package/dist/src/shared/sandbox-environment.d.ts +4 -10
  354. package/dist/src/shared/sandbox-environment.js +1 -1
  355. package/dist/src/shared/sandbox-network-policy.d.ts +45 -9
  356. package/dist/src/shared/sandbox-provider.d.ts +0 -103
  357. package/dist/src/shared/sandbox-provider.js +1 -1
  358. package/dist/src/shared/sandbox-recorded-data-error.d.ts +4 -0
  359. package/dist/src/shared/sandbox-recorded-data-error.js +1 -0
  360. package/dist/src/shared/sandbox-session-gone-error.d.ts +12 -0
  361. package/dist/src/shared/sandbox-session-gone-error.js +1 -0
  362. package/dist/src/shared/sandbox-session.d.ts +97 -83
  363. package/dist/src/shared/sandbox-template-error.d.ts +19 -4
  364. package/dist/src/shared/sandbox-template-error.js +1 -1
  365. package/dist/src/shared/sandbox-tool-session-error.d.ts +4 -0
  366. package/dist/src/shared/sandbox-tool-session-error.js +1 -0
  367. package/dist/src/shared/skill-package.js +1 -1
  368. package/dist/src/shared/skill-paths.d.ts +4 -5
  369. package/dist/src/shared/skill-paths.js +2 -2
  370. package/dist/src/shared/workflow-sandbox.d.ts +4 -41
  371. package/dist/src/shared/workflow-sandbox.js +1 -1
  372. package/dist/src/svelte/index.js +1 -1
  373. package/dist/src/svelte/use-eve-agent.d.ts +1 -1
  374. package/dist/src/svelte/use-eve-agent.js +1 -1
  375. package/dist/src/tools/model-output.d.ts +23 -5
  376. package/dist/src/tools/model-output.js +1 -1
  377. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  378. package/dist/src/tools/provided/glob.js +1 -1
  379. package/dist/src/tools/provided/grep.js +1 -1
  380. package/dist/src/tools/provided/read-file.js +1 -1
  381. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  382. package/dist/src/tools/provided/workflow.js +1 -1
  383. package/dist/src/tools/provided/write-file.js +1 -1
  384. package/dist/src/tools/workflow-definition.d.ts +19 -4
  385. package/dist/src/vue/index.js +1 -1
  386. package/dist/src/vue/use-eve-agent.d.ts +1 -1
  387. package/dist/src/vue/use-eve-agent.js +1 -1
  388. package/docs/channels/custom.mdx +3 -3
  389. package/docs/channels/discord.mdx +279 -7
  390. package/docs/channels/eve.mdx +13 -2
  391. package/docs/channels/linq.mdx +2 -2
  392. package/docs/channels/mcp.mdx +2 -2
  393. package/docs/channels/overview.mdx +1 -1
  394. package/docs/channels/photon.mdx +1 -1
  395. package/docs/concepts/built-in-tools.md +31 -8
  396. package/docs/concepts/execution-model-and-durability.mdx +6 -101
  397. package/docs/concepts/security-model.md +2 -0
  398. package/docs/concepts/sessions-runs-and-streaming.md +44 -36
  399. package/docs/connections/openapi.mdx +2 -0
  400. package/docs/evals/reporters.mdx +1 -1
  401. package/docs/evals/running.mdx +1 -1
  402. package/docs/guides/client/messages.mdx +1 -1
  403. package/docs/guides/deployment/overview.md +4 -4
  404. package/docs/guides/deployment/self-hosting.md +50 -1
  405. package/docs/guides/dev-tui.md +1 -1
  406. package/docs/guides/dynamic-capabilities.md +1 -1
  407. package/docs/guides/frontend/overview.mdx +26 -6
  408. package/docs/guides/instrumentation/agent-runs.mdx +16 -0
  409. package/docs/guides/self-modification.md +1 -1
  410. package/docs/guides/session-context.md +1 -1
  411. package/docs/instructions.mdx +1 -1
  412. package/docs/reference/agent-files.md +3 -3
  413. package/docs/reference/cli.md +7 -2
  414. package/docs/reference/typescript-api.md +9 -3
  415. package/docs/sandbox/custom-providers.mdx +254 -0
  416. package/docs/sandbox/default.mdx +71 -4
  417. package/docs/sandbox/docker.mdx +15 -3
  418. package/docs/sandbox/index.mdx +27 -103
  419. package/docs/sandbox/just-bash.mdx +54 -0
  420. package/docs/sandbox/meta.json +9 -1
  421. package/docs/sandbox/troubleshooting.mdx +215 -0
  422. package/docs/sandbox/vercel.mdx +48 -7
  423. package/docs/skills.mdx +1 -1
  424. package/docs/subagents/index.mdx +2 -2
  425. package/docs/tools/overview.mdx +19 -0
  426. package/docs/tools/workflows.mdx +73 -5
  427. package/docs/tutorial/run-analysis.mdx +2 -2
  428. package/package.json +14 -20
  429. package/dist/src/compiled/@ai-sdk/code-mode/_run.d.ts +0 -1
  430. package/dist/src/compiled/@ai-sdk/code-mode/index.d.ts +0 -325
  431. package/dist/src/compiled/@ai-sdk/code-mode/index.js +0 -660
  432. package/dist/src/compiled/_chunks/workflow/dist-CyBgVS7g.js +0 -1
  433. package/dist/src/compiled/_chunks/workflow/dist-T5NnW-0k.js +0 -3
  434. package/dist/src/compiled/_chunks/workflow/helpers-DlLD3ov_.js +0 -1
  435. package/dist/src/compiled/_chunks/workflow/private-tQUuwBoQ.js +0 -1
  436. package/dist/src/compiled/_chunks/workflow/resume-hook-DMsV_b4n.js +0 -1
  437. package/dist/src/compiled/_chunks/workflow/serialization-DPdYS_w2.js +0 -16
  438. package/dist/src/compiled/_chunks/workflow/sleep-BY6leHh8.js +0 -1
  439. package/dist/src/compiled/_chunks/workflow/workflow-routes-CwqB063q.js +0 -1
  440. package/dist/src/execution/sandbox/active-handles.d.ts +0 -32
  441. package/dist/src/execution/sandbox/active-handles.js +0 -1
  442. package/dist/src/execution/sandbox/bindings/docker-session.d.ts +0 -6
  443. package/dist/src/execution/sandbox/bindings/docker-session.js +0 -2
  444. package/dist/src/execution/sandbox/bindings/immutable-resources.d.ts +0 -15
  445. package/dist/src/execution/sandbox/bindings/immutable-resources.js +0 -2
  446. package/dist/src/execution/sandbox/bindings/microsandbox-create.d.ts +0 -12
  447. package/dist/src/execution/sandbox/bindings/microsandbox-create.js +0 -1
  448. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +0 -42
  449. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +0 -1
  450. package/dist/src/execution/sandbox/bindings/microsandbox-metadata.d.ts +0 -29
  451. package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +0 -1
  452. package/dist/src/execution/sandbox/bindings/microsandbox-network.d.ts +0 -18
  453. package/dist/src/execution/sandbox/bindings/microsandbox-network.js +0 -1
  454. package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +0 -37
  455. package/dist/src/execution/sandbox/bindings/microsandbox-options.js +0 -1
  456. package/dist/src/execution/sandbox/bindings/microsandbox-platform.d.ts +0 -21
  457. package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +0 -21
  458. package/dist/src/execution/sandbox/bindings/microsandbox-process.d.ts +0 -3
  459. package/dist/src/execution/sandbox/bindings/microsandbox-process.js +0 -1
  460. package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.d.ts +0 -11
  461. package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.js +0 -1
  462. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +0 -82
  463. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +0 -1
  464. package/dist/src/execution/sandbox/bindings/microsandbox-templates.d.ts +0 -12
  465. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +0 -1
  466. package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +0 -16
  467. package/dist/src/execution/sandbox/bindings/microsandbox.js +0 -1
  468. package/dist/src/execution/sandbox/provider-host-development.d.ts +0 -2
  469. package/dist/src/execution/sandbox/provider-host-development.js +0 -1
  470. package/dist/src/execution/sandbox/provider-host.d.ts +0 -2
  471. package/dist/src/execution/sandbox/provider-host.js +0 -1
  472. package/dist/src/execution/tool-session/sandbox.d.ts +0 -22
  473. package/dist/src/execution/tool-session/sandbox.js +0 -1
  474. package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +0 -48
  475. package/dist/src/public/sandbox/microsandbox-sandbox.js +0 -1
  476. package/dist/src/public/sandbox/microsandbox.d.ts +0 -9
  477. package/dist/src/public/sandbox/microsandbox.js +0 -1
  478. package/dist/src/sandbox/providers/microsandbox.d.ts +0 -12
  479. package/dist/src/sandbox/providers/microsandbox.js +0 -1
  480. package/docs/sandbox/microsandbox.mdx +0 -31
@@ -0,0 +1,2 @@
1
+ export declare function createSeededNanoid(random: () => number): () => string;
2
+ //# sourceMappingURL=seeded-nanoid.d.ts.map
@@ -45,6 +45,15 @@ export declare const COMPRESSION_MIN_BYTES = 1024;
45
45
  * data paying a permanent decompression tax for a negligible win.
46
46
  */
47
47
  export declare const COMPRESSION_MIN_SAVINGS_RATIO = 0.05;
48
+ /**
49
+ * Payloads below this size are compressed synchronously even when the
50
+ * caller asks for the threadpool (`preferAsync`). Handing a buffer to the
51
+ * threadpool and back costs ~0.5 ms of wall time regardless of size,
52
+ * while sync zstd at level 3 blocks the loop for ~0.1 ms at 2 KiB and
53
+ * ~0.4 ms at 64 KiB; the trade only pays off once the sync call would
54
+ * block for longer than the round trip.
55
+ */
56
+ export declare const COMPRESSION_ASYNC_MIN_BYTES: number;
48
57
  /** Which codec compressed a payload (or `none` when stored uncompressed). */
49
58
  export type CompressionCodec = 'zstd' | 'gzip' | 'none';
50
59
  /**
@@ -108,9 +117,11 @@ export declare function compress(data: Uint8Array | unknown, mode: CompressionMo
108
117
  /**
109
118
  * Compress off the event loop where the codec supports it (zstd via
110
119
  * the libuv threadpool; gzip is stream-based and already async).
111
- * For multi-MB payloads compressed while a response is flushing —
112
- * the sync zstd path would block the loop for the whole compression.
113
- * Output bytes are identical either way.
120
+ * For payloads compressed on a latency-sensitive path, where the
121
+ * sync zstd call would block the loop for the whole compression.
122
+ * Only applied from {@link COMPRESSION_ASYNC_MIN_BYTES} up: below
123
+ * that the threadpool round trip costs more wall time than the sync
124
+ * call blocks. The result decodes identically either way.
114
125
  */
115
126
  preferAsync?: boolean;
116
127
  }): Promise<Uint8Array | unknown>;
@@ -320,7 +320,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
320
320
  };
321
321
  /**
322
322
  * Resolves the owner's encryption key, preferring its public key, then its
323
- * deployment, and finally its run record.
323
+ * deployment, and finally the deployment on its run record.
324
324
  * @internal
325
325
  */
326
326
  export declare function getForwardedWritableEncryptionKey(runId: string, deploymentId: string | undefined, encryptionPublicKey: string | undefined): Promise<PayloadKey | undefined>;
@@ -1 +1 @@
1
- import{A as e,Ar as t,C as n,Cr as r,D as i,Dr as a,E as o,Er as s,F as c,I as l,L as u,M as d,Mr as f,N as p,Nr as m,O as h,Or as g,P as _,R as v,S as y,Sr as b,T as x,Tr as S,_ as C,a as w,b as T,br as E,c as D,d as O,f as k,g as A,h as j,i as M,j as N,jr as P,k as F,kr as I,l as L,m as R,n as z,o as B,p as V,r as H,s as U,t as W,u as G,v as K,vr as q,w as J,wr as Y,x as X,xr as Z,y as Q,yr as $,z as ee}from"../../_chunks/workflow/serialization-DPdYS_w2.js";export{W as FRAMED_STREAM_MAX_RECONNECTS,z as FRAMED_STREAM_MAX_TOTAL_RECONNECTS,f as SerializationFormat,H as WorkflowServerReadableStream,M as WorkflowServerWritableStream,q as aesKeyOf,w as cancelAbortReaders,s as compress,B as createForwardedWritable,U as createReconnectingFramedStream,g as decodeFormatPrefix,a as decompress,$ as decrypt,D as dehydrateDynamicWorkflowCode,L as dehydrateRunError,G as dehydrateStepArguments,O as dehydrateStepError,k as dehydrateStepReturnValue,V as dehydrateWorkflowArguments,R as dehydrateWorkflowReturnValue,E as deriveRunPayloadKeys,j as deserializePreparedReplayPayload,A as deserializePreparedStepError,I as encodeWithFormatPrefix,Z as encrypt,C as getByteFramingStream,K as getByteUnframingStream,Q as getCommonRevivers,T as getDeserializeStream,X as getExternalReducers,y as getExternalRevivers,n as getForwardedWritableEncryptionKey,J as getRunReadableStream,x as getSerializeStream,o as getStreamType,i as getWorkflowReducers,h as getWorkflowRevivers,F as hydrateDynamicWorkflowCode,e as hydrateRunError,N as hydrateStepArguments,d as hydrateStepError,p as hydrateStepReturnValue,_ as hydrateWorkflowArguments,c as hydrateWorkflowReturnValue,t as isEncrypted,m as isFormatPrefix,b as isRunPayloadKeys,r as isSealTarget,l as maybeDecrypt,u as maybeEncrypt,P as peekFormatPrefix,v as prepareReplayPayload,Y as runPayloadKeys,S as sealTo,ee as tagForwardedWritableTarget};
1
+ import{A as e,Ar as t,C as n,Cr as r,D as i,Dr as a,E as o,Er as s,F as c,I as l,L as u,M as d,N as f,O as p,Or as m,P as h,R as g,S as _,Sr as v,T as y,Tr as b,_ as x,_r as S,a as C,b as w,br as T,c as E,d as D,f as O,g as k,gr as A,h as j,i as M,j as N,jr as P,k as F,kr as I,l as L,m as R,n as z,o as B,p as V,r as H,s as U,t as W,u as G,v as K,vr as q,w as J,wr as Y,x as X,xr as Z,y as Q,yr as $,z as ee}from"../../_chunks/workflow/serialization-B9gneT9Z.js";export{W as FRAMED_STREAM_MAX_RECONNECTS,z as FRAMED_STREAM_MAX_TOTAL_RECONNECTS,t as SerializationFormat,H as WorkflowServerReadableStream,M as WorkflowServerWritableStream,A as aesKeyOf,C as cancelAbortReaders,Y as compress,B as createForwardedWritable,U as createReconnectingFramedStream,s as decodeFormatPrefix,b as decompress,S as decrypt,E as dehydrateDynamicWorkflowCode,L as dehydrateRunError,G as dehydrateStepArguments,D as dehydrateStepError,O as dehydrateStepReturnValue,V as dehydrateWorkflowArguments,R as dehydrateWorkflowReturnValue,q as deriveRunPayloadKeys,j as deserializePreparedReplayPayload,k as deserializePreparedStepError,a as encodeWithFormatPrefix,$ as encrypt,x as getByteFramingStream,K as getByteUnframingStream,Q as getCommonRevivers,w as getDeserializeStream,X as getExternalReducers,_ as getExternalRevivers,n as getForwardedWritableEncryptionKey,J as getRunReadableStream,y as getSerializeStream,o as getStreamType,i as getWorkflowReducers,p as getWorkflowRevivers,F as hydrateDynamicWorkflowCode,e as hydrateRunError,N as hydrateStepArguments,d as hydrateStepError,f as hydrateStepReturnValue,h as hydrateWorkflowArguments,c as hydrateWorkflowReturnValue,m as isEncrypted,P as isFormatPrefix,T as isRunPayloadKeys,Z as isSealTarget,l as maybeDecrypt,u as maybeEncrypt,I as peekFormatPrefix,g as prepareReplayPayload,v as runPayloadKeys,r as sealTo,ee as tagForwardedWritableTarget};
@@ -566,24 +566,6 @@ export declare const HookResilientResumeMaterialized: (value: boolean) => {
566
566
  export declare const HookResumeSetupSource: (value: string) => {
567
567
  [k: string]: string;
568
568
  };
569
- /**
570
- * Producer-side signal (on the suspension span) counting steps whose direct
571
- * `step_created` write failed transiently while their `stepInput`-carrying
572
- * queue publish succeeded, so step creation is recovered via the consumer's
573
- * re-ensure. Mirrors {@link HookResilientResume}.
574
- */
575
- export declare const StepResilientDispatchRecovered: (value: number) => {
576
- [k: string]: number;
577
- };
578
- /**
579
- * Consumer-side signal (on the workflow execution span) that this delivery
580
- * materialized the `step_created` event from the queue message's `stepInput`
581
- * because the producer's direct write had not landed, which completes the
582
- * recovery path {@link StepResilientDispatchRecovered} began.
583
- */
584
- export declare const StepResilientDispatchMaterialized: (value: boolean) => {
585
- [k: string]: boolean;
586
- };
587
569
  /**
588
570
  * How the queued-step consumer resolved the run identity for this execution:
589
571
  * `run_context` — carried on the dispatch message, no `runs.get` before the
@@ -1,2 +1,2 @@
1
- export declare const version = "5.2.0";
1
+ export declare const version = "5.2.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- import{Fr as e,Pr as t,Zr as n,ii as r,ni as i,ri as a}from"../../_chunks/workflow/serialization-DPdYS_w2.js";import{d as o,i as s}from"../../_chunks/workflow/dist-T5NnW-0k.js";import{i as c}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{c as l,i as u,o as d,r as f,t as p}from"../../_chunks/workflow/attribute-changes-BW-kbMMn.js";import{t as m}from"../../_chunks/workflow/sleep-BY6leHh8.js";import{t as h}from"../../_chunks/workflow/run-DzdAqdb1.js";e(t,h);function g(e){let t=globalThis[i];return t||u(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),t(e)}function _(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always generated for you. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let a=g({...r,metadata:i,isWebhook:!0}),{url:o}=l();return a.url=c(o,{type:`webhook`,token:a.token}),a}function v(){function e(t,n){d(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}async function y(e,t={}){let n=p(e,t);if(n.length===0)return;let i=t.allowReservedAttributes===!0,a=globalThis[r];if(!a)throw new s("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(n,i?{allowReservedAttributes:!0}:{})}function b(e={}){let{namespace:t}=e,r=globalThis[a](t);return Object.create(globalThis.WritableStream.prototype,{[n]:{value:r,writable:!1}})}function x(){f(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,x)}function S(){d(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,S)}export{s as FatalError,o as RetryableError,g as createHook,_ as createWebhook,v as defineHook,x as getStepMetadata,l as getWorkflowMetadata,b as getWritable,S as resumeHook,y as setAttributes,m as sleep};
1
+ import{Mr as e,Nr as t,Yr as n,ei as r,ni as i,ti as a}from"../../_chunks/workflow/serialization-B9gneT9Z.js";import{i as o,m as s}from"../../_chunks/workflow/dist-S9cZRway.js";import{a as c}from"../../_chunks/workflow/workflow-routes-BaljomCk.js";import{c as l,i as u,o as d,r as f,t as p}from"../../_chunks/workflow/attribute-changes-7se_SE2q.js";import{t as m}from"../../_chunks/workflow/sleep-BL0oQs3R.js";import{t as h}from"../../_chunks/workflow/run-BJSLCXR4.js";t(e,h);function g(e){let t=globalThis[r];return t||u(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),t(e)}function _(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always generated for you. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let a=g({...r,metadata:i,isWebhook:!0}),{url:o}=l();return a.url=c(o,{type:`webhook`,token:a.token}),a}function v(){function e(t,n){d(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}async function y(e,t={}){let n=p(e,t);if(n.length===0)return;let r=t.allowReservedAttributes===!0,a=globalThis[i];if(!a)throw new o("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(n,r?{allowReservedAttributes:!0}:{})}function b(e={}){let{namespace:t}=e,r=globalThis[a](t);return Object.create(globalThis.WritableStream.prototype,{[n]:{value:r,writable:!1}})}function x(){f(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,x)}function S(){d(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,S)}export{o as FatalError,s as RetryableError,g as createHook,_ as createWebhook,v as defineHook,x as getStepMetadata,l as getWorkflowMetadata,b as getWritable,S as resumeHook,y as setAttributes,m as sleep};
@@ -1,4 +1,21 @@
1
1
  import type { StringValue } from './_ms.js';
2
+ /**
3
+ * @internal
4
+ * Format an error message with framed `hint:` / `docs:` details, for errors
5
+ * raised as plain classes (e.g. `FatalError`) that can't take a slug.
6
+ */
7
+ export declare function formatErrorMessageWithDetails(title: string, details: {
8
+ hint?: string;
9
+ slug?: ErrorSlug;
10
+ }): string;
11
+ /**
12
+ * @internal
13
+ * Shared remediation text for runs that outgrow the default event-count
14
+ * ceiling or replay budget. QuickJS runs with snapshotting are exempt from
15
+ * the default ceiling, and resume from a snapshot instead of replaying the
16
+ * full event log.
17
+ */
18
+ export declare const QUICKJS_SNAPSHOT_REMEDIATION: string;
2
19
  /**
3
20
  * @internal
4
21
  * All the slugs of the errors used for documentation links.
@@ -19,6 +36,8 @@ export declare const ERROR_SLUGS: {
19
36
  readonly WORKFLOW_NOT_REGISTERED: "workflow-not-registered";
20
37
  readonly RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed";
21
38
  readonly DEPLOYMENT_MISMATCH: "deployment-mismatch";
39
+ readonly MAX_EVENTS_EXCEEDED: "max-events-exceeded";
40
+ readonly REPLAY_TIMEOUT: "replay-timeout";
22
41
  };
23
42
  type ErrorSlug = (typeof ERROR_SLUGS)[keyof typeof ERROR_SLUGS];
24
43
  interface WorkflowErrorOptions extends ErrorOptions {
@@ -599,6 +618,35 @@ export declare class PreconditionFailedError extends WorkflowWorldError {
599
618
  });
600
619
  static is(value: unknown): value is PreconditionFailedError;
601
620
  }
621
+ /** Error code a World uses for an {@link InBandSupersededError} refusal. */
622
+ export declare const IN_BAND_SUPERSEDED_CODE = "in-band-superseded";
623
+ /**
624
+ * Thrown when a World refuses an in-band write (a write made by the run's
625
+ * orchestrator) because another orchestrator invocation of the same run has
626
+ * written in-band since this one loaded the log (HTTP 412,
627
+ * `in-band-superseded`).
628
+ *
629
+ * The in-band fence keeps a run to one orchestrator writer: the World counts
630
+ * the positions it allocated to in-band writes, and accepts an in-band write
631
+ * only when the writer's expected count matches. Nothing is written or
632
+ * allocated for a refused write.
633
+ *
634
+ * @property seq - The run's allocated position count at the time of the
635
+ * refusal, when the World reports it. Diagnostic only.
636
+ * @property seqInBand - The run's in-band position count at the time of the
637
+ * refusal, when the World reports it. Diagnostic only: a client must never
638
+ * adopt it as its own count, since that would make it a writer without
639
+ * having seen the events the count stands for.
640
+ */
641
+ export declare class InBandSupersededError extends WorkflowWorldError {
642
+ readonly seq?: number;
643
+ readonly seqInBand?: number;
644
+ constructor(message: string, options?: {
645
+ seq?: number;
646
+ seqInBand?: number;
647
+ });
648
+ static is(value: unknown): value is InBandSupersededError;
649
+ }
602
650
  /**
603
651
  * Thrown when awaiting `run.returnValue` on a workflow run that was cancelled.
604
652
  *
@@ -1 +1 @@
1
- import{A as e,C as t,D as n,E as r,M as i,O as a,S as o,T as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,j as _,k as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D,v as O,w as k,x as A,y as j}from"../../_chunks/workflow/dist-T5NnW-0k.js";export{E as CorruptedEventLogError,x as ERROR_SLUGS,w as EntityConflictError,g as FatalError,l as HookConflictError,S as HookForceClaimedError,T as HookNotFoundError,d as MaxEventsExceededError,y as PreconditionFailedError,i as RUN_ERROR_CODES,D as ReplayDivergenceError,f as RetryableError,p as RunExpiredError,C as RunNotSupportedError,b as RuntimeDecryptionError,h as SerializationError,m as StepNotRegisteredError,c as StreamError,O as StreamExpiredError,j as ThrottleError,u as TooEarlyError,A as VERCEL_403_ERROR_MESSAGE,o as WorkflowBuildError,t as WorkflowDeploymentMismatchError,k as WorkflowError,s as WorkflowNotRegisteredError,r as WorkflowRunCancelledError,n as WorkflowRunFailedError,a as WorkflowRunNotCompletedError,v as WorkflowRunNotFoundError,e as WorkflowRuntimeError,_ as WorkflowWorldError};
1
+ import{A as e,C as t,D as n,E as r,F as i,I as a,M as o,N as s,O as c,P as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"../../_chunks/workflow/dist-S9cZRway.js";export{A as CorruptedEventLogError,T as ERROR_SLUGS,O as EntityConflictError,b as FatalError,p as HookConflictError,E as HookForceClaimedError,k as HookNotFoundError,h as IN_BAND_SUPERSEDED_CODE,C as InBandSupersededError,j as MaxEventsExceededError,g as PreconditionFailedError,_ as QUICKJS_SNAPSHOT_REMEDIATION,a as RUN_ERROR_CODES,D as ReplayDivergenceError,w as RetryableError,y as RunExpiredError,v as RunNotSupportedError,f as RuntimeDecryptionError,M as SerializationError,F as StepNotRegisteredError,m as StreamError,P as StreamExpiredError,u as ThrottleError,t as TooEarlyError,N as VERCEL_403_ERROR_MESSAGE,d as WorkflowBuildError,r as WorkflowDeploymentMismatchError,n as WorkflowError,c as WorkflowNotRegisteredError,S as WorkflowRunCancelledError,e as WorkflowRunFailedError,x as WorkflowRunNotCompletedError,o as WorkflowRunNotFoundError,s as WorkflowRuntimeError,l as WorkflowWorldError,i as formatErrorMessageWithDetails};
@@ -40,6 +40,30 @@ export declare function envNumber(name: string, fallback: number, options?: EnvN
40
40
  */
41
41
  export declare function envFlag(name: string, fallback: boolean, env?: Record<string, string | undefined>): boolean;
42
42
  export declare function getMaxEventsPerRun(): number;
43
+ /**
44
+ * Whether a run is exempt from the default per-run event ceiling: its
45
+ * persisted `executionContext` selects the QuickJS VM with a positive
46
+ * safe-integer `snapshotThreshold`. Snapshotting keeps resume cost bounded
47
+ * regardless of log length, so these runs don't need the ceiling.
48
+ *
49
+ * Mirrors the Vercel World's server-side policy so runs behave the same
50
+ * locally and in production.
51
+ */
52
+ export declare function isEventLimitExemptRun(run?: {
53
+ executionContext?: unknown;
54
+ }): boolean;
55
+ /**
56
+ * The event ceiling a World advertises (as `maxEvents`) for a specific
57
+ * run. Exempt runs (see {@link isEventLimitExemptRun}) get
58
+ * `Number.MAX_SAFE_INTEGER`, which is effectively unlimited while staying a
59
+ * positive integer for SDKs that validate one. Other runs get
60
+ * {@link getMaxEventsPerRun}.
61
+ *
62
+ * Use {@link getMaxEventsPerRun} (not this) for page sizes and scan bounds.
63
+ */
64
+ export declare function getMaxEventsForRun(run?: {
65
+ executionContext?: unknown;
66
+ }): number;
43
67
  /**
44
68
  * Reset the warn-once cache. Test-only, exported so unit tests can exercise
45
69
  * the warning path repeatedly without sharing state across cases.
@@ -1,7 +1,7 @@
1
1
  import { z } from '#compiled/zod/index.js';
2
2
  import type { Hook } from './hooks.js';
3
3
  import type { StartedWorkflowRun, WorkflowRun } from './runs.js';
4
- import type { EventsResolveData, PaginationOptions, ResolveData } from './shared.js';
4
+ import type { EventsResolveData, PaginatedResponse, PaginationOptions, ResolveData } from './shared.js';
5
5
  import type { StartedStep, Step } from './steps.js';
6
6
  import type { Wait } from './waits.js';
7
7
  export * from './event-metadata.js';
@@ -617,6 +617,56 @@ export type RunCreatedEventRequest = z.infer<typeof RunCreatedEventSchema>;
617
617
  export type CreateEventRequest = Exclude<AnyEventRequest, RunCreatedEventRequest>;
618
618
  export interface CreateEventParams {
619
619
  v1Compat?: boolean;
620
+ /**
621
+ * Whether the run's orchestrator is making this write, for the in-band
622
+ * writer fence. Optional World support: a World that implements the fence
623
+ * counts the positions it allocates to in-band writes, and accepts an
624
+ * in-band write only when {@link expectedSeqInBand} equals that count,
625
+ * refusing it otherwise with `InBandSupersededError` (HTTP 412,
626
+ * `in-band-superseded`) before anything is written or allocated.
627
+ * Out-of-band writes (`false` or absent) are never refused by the fence and
628
+ * never move the in-band count.
629
+ *
630
+ * Only the orchestrator's own writes may set it. Writes made from outside
631
+ * the run's orchestrator (cancellation, hook resumption, step execution,
632
+ * dispatch re-ensures) stay out-of-band, since they can come from a newer
633
+ * SDK than the run's own and must never be refused on its behalf. A
634
+ * fenced `step_created` must not be published to the step queue in parallel
635
+ * with its write (resilient step dispatch): the dispatch's out-of-band
636
+ * re-ensure would materialize a step the fence refused. A World may revoke
637
+ * such a dispatch on refusal, but only as a best-effort backstop.
638
+ *
639
+ * A World may refuse an in-band write on a run whose stamped spec version
640
+ * predates the sealed log (`SPEC_VERSION_SUPPORTS_SEALED_LOG`), rather than
641
+ * accept it unfenced. A caller must therefore decide from the run's stamped
642
+ * spec version, never from its own SDK version: the same SDK still executes
643
+ * runs stamped below it (the `WORKFLOW_SEALED_LOG` opt-out, and
644
+ * cross-deployment starts, which are stamped with the lower of the caller's
645
+ * and the target's version).
646
+ *
647
+ * The runtime does not set it yet.
648
+ */
649
+ inBand?: boolean;
650
+ /**
651
+ * The writer's count of in-band positions, required with `inBand: true`
652
+ * and only allowed with it. `run_created` counts as the run's first in-band
653
+ * position, so the lowest valid value is 1.
654
+ *
655
+ * The count is the World's, not the client's: a writer starts from a count
656
+ * the World reports (a snapshot read with the log it loaded) and advances
657
+ * it by the in-band positions the World reports a write allocated. It must
658
+ * never be derived by counting events or writes, because the two diverge:
659
+ *
660
+ * - a single create can allocate more than one position, when one of its
661
+ * own positions is sealed and it allocates again;
662
+ * - a write the World rejects after allocating (for example a 409 on a
663
+ * duplicate entity) may still have advanced the count;
664
+ * - a World may reset the count when it loses its counter, and only a
665
+ * World-provided snapshot reflects that.
666
+ *
667
+ * A writer that holds no World-provided count must not send the fence.
668
+ */
669
+ expectedSeqInBand?: number;
620
670
  /**
621
671
  * `'skip-step-inputs'` applies only to the event-log page this create
622
672
  * returns (the `sinceCursor` delta or a replay preload), never to the
@@ -651,11 +701,11 @@ export interface CreateEventParams {
651
701
  * parallelized with the queue publish and may have failed. Only meaningful
652
702
  * for `step_created`.
653
703
  *
654
- * Advisory. Parallelizing a create with its publish is opt-in and off by
655
- * default (`WORKFLOW_RESILIENT_STEP_DISPATCH`), precisely because a create
656
- * can come back refused while the message carrying its payload is already
657
- * out. A deployment that opts in accepts that window, and a backend MAY use
658
- * this flag to narrow it: refuse the re-ensure (world-vercel surfaces the
704
+ * Advisory, and not set by the current `@workflow/core` runtime, which
705
+ * publishes a step's queue message only after its create. A producer that
706
+ * parallelizes the two accepts that a create can come back refused while
707
+ * the message carrying its payload is already out, and a backend MAY use
708
+ * this flag to narrow that window: refuse the re-ensure (world-vercel surfaces the
659
709
  * backend's 410 as `RunExpiredError`, which the consumer treats as "nothing
660
710
  * left to execute" and acks the message) when it has recorded a refusal for
661
711
  * this correlation id and no step entity exists. Best-effort by nature (a
@@ -690,7 +740,11 @@ export interface CreateEventParams {
690
740
  * the replay loop and the suspension handler, which merge the report below
691
741
  * back into their loaded log. Omitted by callers with no loaded log to be
692
742
  * stale against, the step executor included: for those the report would be
693
- * a read the World does for no one.
743
+ * a read the World does for no one. Independent concurrent hook registrations
744
+ * in a hooks-only suspension also omit it deliberately: the runtime verifies
745
+ * their committed events together after every write settles, and reloads if
746
+ * they do not form a complete suffix. Absence does not imply no loaded log;
747
+ * without a count there is no evidence for count-based stale rejection.
694
748
  *
695
749
  * A World's slots are dense and 1-based (see `Storage.events`), so a count
696
750
  * and a position are the same number. An id that is not a position does not
@@ -849,6 +903,18 @@ export interface CreateEventParams {
849
903
  export type EventResult<T extends EventType = EventType> = {
850
904
  /** The created event (optional for legacy compatibility) */
851
905
  event?: Event;
906
+ /**
907
+ * Optional ascending events.list cursor immediately after `event`, minted
908
+ * by the World that owns the cursor format. This does not attest that the
909
+ * caller holds any earlier events. The runtime may advance to it only after
910
+ * proving that its loaded prefix plus committed responses covers every slot
911
+ * through this event. Worlds that omit it retain the normal reload path.
912
+ * When supplied, `event` MUST match what ascending events.list returns for
913
+ * that slot with the same resolveData option, including stored timestamps,
914
+ * normalized retention, metadata bytes, and hook-conflict details. The
915
+ * runtime uses this stored event as replay input, not an echo of the request.
916
+ */
917
+ eventCursor?: string;
852
918
  /** The workflow run entity (for run_* events) */
853
919
  run?: WorkflowRun;
854
920
  /** The step entity (for step_* events) */
@@ -871,6 +937,14 @@ export type EventResult<T extends EventType = EventType> = {
871
937
  stepCreated?: true;
872
938
  /** Server-owned max event count for the run (run-lifecycle responses); the runtime enforces it. */
873
939
  maxEvents?: number;
940
+ /**
941
+ * How many positions this write allocated to the run's log, when the World
942
+ * reports it: 1 for a create that appended its event, 0 for one that
943
+ * converged on an event the log already held. A World implementing the
944
+ * in-band fence advances the run's in-band count by this number for an
945
+ * accepted in-band write. Absent from a World that does not report it.
946
+ */
947
+ allocated?: number;
874
948
  } & ({
875
949
  /**
876
950
  * Events with data resolved. Five producers populate this:
@@ -947,6 +1021,18 @@ export interface CreateEventBatchParams {
947
1021
  * attribution its single-path twin would.
948
1022
  */
949
1023
  requestId?: string;
1024
+ /**
1025
+ * The in-band fence for the whole batch, as {@link CreateEventParams.inBand}.
1026
+ * Every event of a batch shares it.
1027
+ */
1028
+ inBand?: boolean;
1029
+ /**
1030
+ * The writer's in-band count for the whole block, as
1031
+ * {@link CreateEventParams.expectedSeqInBand}. The block's positions are
1032
+ * allocated in one fenced allocation, and the count the World reports for
1033
+ * it covers the whole block even when some of its events are rejected.
1034
+ */
1035
+ expectedSeqInBand?: number;
950
1036
  }
951
1037
  /**
952
1038
  * One event's outcome in a batch response, index-aligned with the submitted
@@ -1011,6 +1097,39 @@ export interface EventBatchResult {
1011
1097
  /** One entry per submitted event, in request order. */
1012
1098
  results: BatchEventItemResult[];
1013
1099
  }
1100
+ /**
1101
+ * The sequencer state a World read before it listed a run's log, for the
1102
+ * in-band writer fence ({@link CreateEventParams.inBand}). Positions are
1103
+ * slots.
1104
+ */
1105
+ export interface EventLogSnapshot {
1106
+ /** Highest position allocated to any write when the list began. */
1107
+ seq: number;
1108
+ /** Number of positions allocated to in-band writes when the list began. */
1109
+ seqInBand: number;
1110
+ }
1111
+ /**
1112
+ * A run's in-band count right after its creation, before any other write:
1113
+ * `run_created` counts as the run's first in-band position, so the run's
1114
+ * first fenced orchestrator write expects this value.
1115
+ */
1116
+ export declare const IN_BAND_SEQ_AT_RUN_CREATION = 1;
1117
+ /**
1118
+ * Result of {@link Storage.events.list}.
1119
+ *
1120
+ * `snapshot` is set by a World that implements the in-band writer fence
1121
+ * (`WorldCapabilities.inBandFence`), on every page of a slot-numbered run's
1122
+ * log where the World reads one. It is read before the listing, so a full
1123
+ * load (following `cursor` until `hasMore` is false) covers every position
1124
+ * up to the FIRST page's `snapshot.seq`. A fenced writer takes its
1125
+ * {@link CreateEventParams.expectedSeqInBand} from the first page's
1126
+ * `snapshot.seqInBand`, never from counting events: a count cannot tell
1127
+ * which positions were in-band. A fencing World that lists no snapshot
1128
+ * reports the counters on a refusal (`InBandSupersededError`) instead.
1129
+ */
1130
+ export type EventListResponse = PaginatedResponse<Event> & {
1131
+ snapshot?: EventLogSnapshot;
1132
+ };
1014
1133
  export interface GetEventParams {
1015
1134
  resolveData?: ResolveData;
1016
1135
  }
@@ -2,16 +2,16 @@ export type * from './analytics.js';
2
2
  export { ANALYTICS_EVENTS_GET_MANY_LIMIT, ANALYTICS_MAX_ATTRIBUTE_FILTERS, ANALYTICS_PAGE_LIMIT, ANALYTICS_RUN_SCOPED_PAGE_LIMIT, AnalyticsAttributeKeySchema, AnalyticsEventSchema, AnalyticsHookSchema, AnalyticsRunSchema, AnalyticsStepSchema, AnalyticsWaitSchema, } from './analytics.js';
3
3
  export type * from './attributes.js';
4
4
  export { ATTRIBUTE_EVENT_DATA_MAX_BYTES, ATTRIBUTE_KEY_MAX_LENGTH, ATTRIBUTE_MAX_PER_RUN, ATTRIBUTE_VALUE_MAX_BYTES, AttributeChangeSchema, AttributeChangesSchema, AttributeKeySchema, AttributeValidationError, AttributeValueSchema, applyAttributeChanges, PARENT_RUN_ID_ATTRIBUTE, purgesUserDataOnFinish, RESERVED_ATTRIBUTE_KEY_PREFIX, RETENTION_ATTRIBUTE, RETENTION_DEFAULT, RETENTION_ZERO, type ResolvedRunRetention, ROOT_RUN_ID_ATTRIBUTE, type RunRetention, readRunRetention, validateAttributeChanges, validateAttributeEventDataSize, } from './attributes.js';
5
- export { _resetEnvWarnCacheForTests, type EnvNumberOptions, envFlag, envNumber, getMaxEventsPerRun, } from './env-config.js';
5
+ export { _resetEnvWarnCacheForTests, type EnvNumberOptions, envFlag, envNumber, getMaxEventsForRun, getMaxEventsPerRun, isEventLimitExemptRun, } from './env-config.js';
6
6
  export type * from './events.js';
7
- export { BaseEventSchema, CHILD_ENTITY_CREATION_EVENT_TYPES, CreateEventSchema, classifyEntityEvent, EventSchema, EventTypeSchema, entityEventClass, getEventDataPayloadField, getEventDataRefFields, HOOK_EVENTS_REQUIRING_EXISTENCE, HOOK_LIFECYCLE_EVENT_TYPES, HookCreatedEventSchema, isChildEntityCreationEvent, isChildEntityCreationEventType, isHookEventRequiringExistence, isHookLifecycleEventType, isRunEventType, isSealedNoopEvent, isStepEventType, isTerminalRunEventType, isTerminalStepEventType, isWaitEventType, RUN_ENTITY_KEY, RUN_EVENT_TYPES, STEP_EVENT_TYPES, stripEventDataRefs, TERMINAL_EVENT_CLASSES, TERMINAL_RUN_EVENT_TYPES, TERMINAL_STEP_EVENT_TYPES, TerminalRunEventTypeSchema, WAIT_EVENT_TYPES, } from './events.js';
7
+ export { BaseEventSchema, CHILD_ENTITY_CREATION_EVENT_TYPES, CreateEventSchema, classifyEntityEvent, EventSchema, EventTypeSchema, entityEventClass, getEventDataPayloadField, getEventDataRefFields, HOOK_EVENTS_REQUIRING_EXISTENCE, HOOK_LIFECYCLE_EVENT_TYPES, HookCreatedEventSchema, IN_BAND_SEQ_AT_RUN_CREATION, isChildEntityCreationEvent, isChildEntityCreationEventType, isHookEventRequiringExistence, isHookLifecycleEventType, isRunEventType, isSealedNoopEvent, isStepEventType, isTerminalRunEventType, isTerminalStepEventType, isWaitEventType, RUN_ENTITY_KEY, RUN_EVENT_TYPES, STEP_EVENT_TYPES, stripEventDataRefs, TERMINAL_EVENT_CLASSES, TERMINAL_RUN_EVENT_TYPES, TERMINAL_STEP_EVENT_TYPES, TerminalRunEventTypeSchema, WAIT_EVENT_TYPES, } from './events.js';
8
8
  export type * from './hooks.js';
9
9
  export { HOOK_RESUME_DEDUP_VERSION, HOOK_RESUME_INPUT_VERSION, HookClaimedFromSchema, HookResumeCapabilitiesSchema, HookSchema, } from './hooks.js';
10
10
  export type * from './interfaces.js';
11
11
  export type { InvocationOutcome, SerializedWorkflowError, } from './invocation.js';
12
12
  export { isNodeHttpEnabled, NODE_HTTP_DEFAULT, NODE_HTTP_ENV_VAR, } from './node-http-flag.js';
13
13
  export type * from './queue.js';
14
- export { getQueueTopicPrefix, HealthCheckPayloadSchema, MessageId, parseQueueName, QueuePayloadSchema, QueuePrefix, RunInputSchema, resolveQueueNamespace, ValidQueueName, WorkflowInvokePayloadSchema, } from './queue.js';
14
+ export { getQueueTopicPrefix, getRunQueueNamespace, HealthCheckPayloadSchema, MessageId, parseQueueName, parseQueueRoute, QueuePayloadSchema, QueuePrefix, RunInputSchema, resolveQueueNamespace, ValidQueueName, WORKFLOW_FLOW_ROUTE, WorkflowInvokePayloadSchema, } from './queue.js';
15
15
  export { reenqueueActiveRuns } from './recovery.js';
16
16
  export type * from './runs.js';
17
17
  export { BULK_CANCEL_MAX_RUN_IDS, BulkCancelWorkflowRunResultSchema, BulkCancelWorkflowRunsRequestSchema, BulkCancelWorkflowRunsResultSchema, isTerminalWorkflowRunStatus, TERMINAL_WORKFLOW_RUN_STATUSES, TerminalWorkflowRunStatusSchema, WorkflowRunBaseSchema, WorkflowRunSchema, WorkflowRunStatusSchema, } from './runs.js';
@@ -1,6 +1,6 @@
1
1
  import type { Analytics } from './analytics.js';
2
2
  import type { AttributeChange, ExperimentalSetAttributesResult } from './attributes.js';
3
- import type { BatchEventRequest, CreateEventBatchParams, CreateEventParams, CreateEventRequest, Event, EventBatchResult, EventResult, GetEventParams, ListEventsByCorrelationIdParams, ListEventsParams, RunCreatedEventRequest } from './events.js';
3
+ import type { BatchEventRequest, CreateEventBatchParams, CreateEventParams, CreateEventRequest, Event, EventBatchResult, EventListResponse, EventResult, GetEventParams, ListEventsByCorrelationIdParams, ListEventsParams, RunCreatedEventRequest } from './events.js';
4
4
  import type { GetHookParams, Hook, ListHooksParams } from './hooks.js';
5
5
  import type { Queue } from './queue.js';
6
6
  import type { BulkCancelWorkflowRunsRequest, BulkCancelWorkflowRunsResult, GetWorkflowRunParams, ListWorkflowRunsParams, WaitForTerminalRunStatusParams, WorkflowRun, WorkflowRunWithoutData } from './runs.js';
@@ -344,7 +344,7 @@ export interface Storage {
344
344
  */
345
345
  createBatch?(runId: string, events: BatchEventRequest[], params?: CreateEventBatchParams): Promise<EventBatchResult>;
346
346
  get(runId: string, eventId: string, params?: GetEventParams): Promise<Event>;
347
- list(params: ListEventsParams): Promise<PaginatedResponse<Event>>;
347
+ list(params: ListEventsParams): Promise<EventListResponse>;
348
348
  listByCorrelationId(params: ListEventsByCorrelationIdParams): Promise<PaginatedResponse<Event>>;
349
349
  };
350
350
  hooks: {
@@ -465,6 +465,42 @@ export interface WorldCapabilities {
465
465
  * combined with it (and so Worlds document the contract explicitly).
466
466
  */
467
467
  maxConcurrency?: boolean;
468
+ /**
469
+ * The World implements the in-band writer fence
470
+ * ({@link CreateEventParams.inBand}). Optional: the runtime does not send
471
+ * the fence yet, and a World without it stays fully supported.
472
+ *
473
+ * Declaring it commits the World to all of:
474
+ *
475
+ * - **A per-run in-band count.** Next to the position counter its sequencer
476
+ * allocates from (`seq`), the World counts the positions allocated to
477
+ * in-band writes (`seqInBand`). A new run's `run_created` counts as
478
+ * in-band and is never fenced itself, so a fresh run holds
479
+ * `seq = 1, seqInBand = IN_BAND_SEQ_AT_RUN_CREATION`.
480
+ * - **The counters, from a list or a refusal.** `events.list` on a
481
+ * slot-numbered run returns `snapshot: { seq, seqInBand }`
482
+ * ({@link EventListResponse.snapshot}), read before the listing, on
483
+ * every page where the World reads one. A World may list none
484
+ * (world-vercel lists one only where its backend reports it); its
485
+ * refusals then carry both counters, read together
486
+ * (`InBandSupersededError.seq` and `.seqInBand`), and a writer takes its
487
+ * count from a refusal instead. Building a World's in-band fence section
488
+ * says how.
489
+ * - **Fenced in-band creates.** A create with `inBand: true` carries
490
+ * {@link CreateEventParams.expectedSeqInBand}. The World checks it
491
+ * against `seqInBand` and advances both counters by the positions it
492
+ * allocates in one atomic step. On a mismatch it throws
493
+ * `InBandSupersededError` (HTTP 412, `in-band-superseded`) and writes and
494
+ * allocates nothing. An in-band write without an expected count is a 400.
495
+ * A batch is one fenced allocation for the whole block.
496
+ * - **Unfenced out-of-band creates.** Writes with `inBand: false` (or
497
+ * absent) move `seq` and never `seqInBand`, and are never refused by the
498
+ * fence.
499
+ *
500
+ * `@workflow/world`'s `test-support/in-band-fence-conformance.ts` checks
501
+ * each of these against a World's `events` storage.
502
+ */
503
+ inBandFence?: boolean;
468
504
  /**
469
505
  * The World's `events.create` deduplicates concurrent `hook_received` writes
470
506
  * that carry the same `(runId, resumeId)`, collapsing them onto a single
@@ -630,17 +666,20 @@ export interface World extends Queue, Streamer, Storage {
630
666
  *
631
667
  * Two overloads:
632
668
  *
633
- * - `getEncryptionKeyForRun(run)`: Preferred. Pass a `WorkflowRun` when
634
- * the run entity already exists. The World reads any context it needs
635
- * (e.g., `deploymentId`) directly from the run.
669
+ * - `getEncryptionKeyForRun(run)`: Used when the runtime already holds
670
+ * the `WorkflowRun` entity. The World reads any context it needs (e.g.,
671
+ * `deploymentId`) directly from the run.
636
672
  *
637
- * - `getEncryptionKeyForRun(runId, context?)`: Used when the run entity
638
- * is not locally available, such as `start()` before run creation or a
639
- * forwarded writable stream carrying its owning deployment context. The
673
+ * - `getEncryptionKeyForRun(runId, context?)`: Used everywhere else: when
674
+ * the run does not exist yet (`start()` before run creation), and when
675
+ * the runtime has a run id but no reason to load the run's payloads
676
+ * (stream reads, forwarded writable streams, hook resumption). The
640
677
  * `context` parameter carries opaque world-specific data (e.g.,
641
678
  * `{ deploymentId }` for world-vercel) needed to resolve the correct key.
642
679
  * When `context` is omitted, the World assumes the current deployment.
643
680
  *
681
+ * Implementations must resolve the same key from either form.
682
+ *
644
683
  * When not implemented, encryption is disabled: data is stored unencrypted.
645
684
  */
646
685
  getEncryptionKeyForRun?(run: WorkflowRun): Promise<Uint8Array | undefined>;
@@ -667,6 +706,18 @@ export interface World extends Queue, Streamer, Storage {
667
706
  * tolerate `undefined` for direct callers.
668
707
  */
669
708
  createRunId?(options?: Readonly<Record<string, unknown>>): string;
709
+ /**
710
+ * The region an existing run's data lives in, derived from its run ID
711
+ * alone (no I/O, never throws).
712
+ *
713
+ * The counterpart of {@link createRunId} for worlds that embed a region in
714
+ * the IDs they mint. Callers that create a run on behalf of an existing one
715
+ * (e.g. `recreateRunFromExisting()`) pass the result to `start({ region })`
716
+ * so the new run is placed where the original was, rather than wherever the
717
+ * calling process happens to execute. Return `null` when the ID is not one
718
+ * this world recognizes. Worlds without a regional dimension omit this.
719
+ */
720
+ regionForRunId?(runId: string): string | null;
670
721
  /**
671
722
  * Upload a dynamic run's serialized workflow VM code to the World's blob
672
723
  * storage ahead of `run_created`, returning the ref key to attach to the