eve 0.37.0 → 0.38.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 (410) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/src/channel/routes.d.ts +13 -3
  3. package/dist/src/channel/routes.js +1 -1
  4. package/dist/src/channel/session-callback.js +1 -1
  5. package/dist/src/channel/session.d.ts +2 -1
  6. package/dist/src/channel/session.js +1 -1
  7. package/dist/src/channel/types.d.ts +41 -0
  8. package/dist/src/chunks/{use-eve-agent-COmP-H8R.js → use-eve-agent-BbSsu99c.js} +79 -32
  9. package/dist/src/chunks/{use-eve-agent-CnppTEFk.js → use-eve-agent-Dt8Y5QtW.js} +78 -31
  10. package/dist/src/cli/acp/command.d.ts +2 -1
  11. package/dist/src/cli/acp/command.js +2 -2
  12. package/dist/src/cli/application-command.d.ts +8 -0
  13. package/dist/src/cli/application-command.js +1 -0
  14. package/dist/src/cli/application-root.d.ts +8 -0
  15. package/dist/src/cli/application-root.js +1 -0
  16. package/dist/src/cli/commands/build.d.ts +2 -1
  17. package/dist/src/cli/commands/build.js +1 -1
  18. package/dist/src/cli/commands/init-git.js +1 -1
  19. package/dist/src/cli/commands/init-recovery.d.ts +3 -0
  20. package/dist/src/cli/commands/init-recovery.js +3 -0
  21. package/dist/src/cli/commands/init-repl.js +1 -1
  22. package/dist/src/cli/commands/init-target.d.ts +21 -0
  23. package/dist/src/cli/commands/init-target.js +1 -0
  24. package/dist/src/cli/commands/init.js +1 -1
  25. package/dist/src/cli/commands/register-integration-commands.d.ts +2 -1
  26. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  27. package/dist/src/cli/commands/register-project-commands.d.ts +2 -1
  28. package/dist/src/cli/commands/register-project-commands.js +1 -1
  29. package/dist/src/cli/commands/register-registry-commands.d.ts +2 -1
  30. package/dist/src/cli/commands/register-registry-commands.js +4 -1
  31. package/dist/src/cli/commands/registry-recovery.d.ts +14 -0
  32. package/dist/src/cli/commands/registry-recovery.js +1 -0
  33. package/dist/src/cli/commands/registry.d.ts +2 -5
  34. package/dist/src/cli/commands/registry.js +1 -1
  35. package/dist/src/cli/dev/diagnostic-dump.js +1 -1
  36. package/dist/src/cli/dev/environment.js +1 -1
  37. package/dist/src/cli/dev/tui/runner.d.ts +8 -0
  38. package/dist/src/cli/dev/tui/runner.js +1 -1
  39. package/dist/src/cli/dev/tui/subagent-pump.d.ts +27 -22
  40. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  41. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +16 -0
  42. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  43. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  44. package/dist/src/cli/invoke/command.d.ts +3 -2
  45. package/dist/src/cli/invoke/command.js +1 -1
  46. package/dist/src/cli/run.d.ts +3 -2
  47. package/dist/src/cli/run.js +3 -3
  48. package/dist/src/client/eve-agent-store.d.ts +15 -3
  49. package/dist/src/client/eve-agent-store.js +2 -2
  50. package/dist/src/client/message-response.d.ts +10 -2
  51. package/dist/src/client/message-response.js +1 -1
  52. package/dist/src/client/open-stream.d.ts +2 -0
  53. package/dist/src/client/open-stream.js +1 -1
  54. package/dist/src/client/session.js +1 -1
  55. package/dist/src/compiled/.vendor-stamp.json +5 -1
  56. package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
  57. package/dist/src/compiled/@chat-adapter/slack/index.js +25 -25
  58. package/dist/src/compiled/@modelcontextprotocol/server/LICENSE +216 -0
  59. package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +98 -0
  60. package/dist/src/compiled/@modelcontextprotocol/server/index.js +80 -0
  61. package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
  62. package/dist/src/compiled/@opentelemetry/otlp-transformer/index.js +1 -1
  63. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +61 -61
  64. package/dist/src/compiled/@vercel/oidc/index.js +14 -14
  65. package/dist/src/compiled/@vercel/otel/index.js +1 -1
  66. package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
  67. package/dist/src/compiled/@workflow/core/index.js +1 -1
  68. package/dist/src/compiled/@workflow/core/private.js +1 -1
  69. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  70. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  71. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  72. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  73. package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
  74. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BoH7JsWp.js → attribute-changes-DZtQkszH.js} +1 -1
  75. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-B_3nkJFi.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/{chunk-NWCAEW5Y-Oxw40oRR.js → chunk-NWCAEW5Y-BgbcH0OK.js} +1 -1
  77. package/dist/src/compiled/_chunks/workflow/{dist-DlFv0aHY.js → dist-CPlyFOVo.js} +1 -1
  78. package/dist/src/compiled/_chunks/workflow/{dist-tJoQXAF6.js → dist-DpYyXbJv.js} +1 -1
  79. package/dist/src/compiled/_chunks/workflow/{dist-CRTn4Sg8.js → dist-xQXN70ED.js} +1 -1
  80. package/dist/src/compiled/_chunks/workflow/esm-seIr7a6j.js +1 -0
  81. package/dist/src/compiled/_chunks/workflow/{frames-CTpeJYEQ.js → frames-BBs-9k1d.js} +2 -2
  82. package/dist/src/compiled/_chunks/workflow/{functions-CeeNvKsq.js → functions-DAYiHNti.js} +1 -1
  83. package/dist/src/compiled/_chunks/workflow/{getMachineId-bsd-WEBNKY2R-CEYkx6Nv.js → getMachineId-bsd-WEBNKY2R-BTaxrQ52.js} +1 -1
  84. package/dist/src/compiled/_chunks/workflow/{getMachineId-darwin-LT47KAXP-DPwWlhif.js → getMachineId-darwin-LT47KAXP-DhYmwE_R.js} +1 -1
  85. package/dist/src/compiled/_chunks/workflow/{getMachineId-linux-LTVQO6VW-DAFXHwZp.js → getMachineId-linux-LTVQO6VW-Dru_L5ru.js} +1 -1
  86. package/dist/src/compiled/_chunks/workflow/{getMachineId-unsupported-UKWBA27G-BZKOI8mG.js → getMachineId-unsupported-UKWBA27G-DGfoqVW1.js} +1 -1
  87. package/dist/src/compiled/_chunks/workflow/{getMachineId-win-NLJKOPY6-r7_CJB5o.js → getMachineId-win-NLJKOPY6-CLM98q4X.js} +1 -1
  88. package/dist/src/compiled/_chunks/workflow/{private-tvMBynnC.js → private-UQtz8ZcW.js} +1 -1
  89. package/dist/src/compiled/_chunks/workflow/{resume-hook-BPQHjeY5.js → resume-hook-CYtSorp6.js} +1 -1
  90. package/dist/src/compiled/_chunks/workflow/{rolldown-runtime-DaDcL9Zw.js → rolldown-runtime-8V8biNmG.js} +1 -1
  91. package/dist/src/compiled/_chunks/workflow/{run-DQ5dOyjm.js → run-Cjo0A3NO.js} +1 -1
  92. package/dist/src/compiled/_chunks/workflow/{signal-exit-C8vsI6zj.js → signal-exit-o3IPQwwv.js} +1 -1
  93. package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +1 -0
  94. package/dist/src/compiled/_chunks/workflow/{token-DHD-q-fS.js → token-DGzfw-Vb.js} +1 -1
  95. package/dist/src/compiled/_chunks/workflow/{token-DtCUEpJs.js → token-DNbxVpeq.js} +1 -1
  96. package/dist/src/compiled/_chunks/workflow/token-util-BneBe0g5.js +27 -0
  97. package/dist/src/compiled/_chunks/workflow/{token-util-Ldar52H7.js → token-util-DjMgNdXS.js} +1 -1
  98. package/dist/src/compiled/_chunks/workflow/{undici-CUIybhQ2.js → undici-BBG5cZTy.js} +1 -1
  99. package/dist/src/compiled/_chunks/workflow/{wait-until-DK2lnH6U.js → wait-until-CT1ve8qB.js} +3 -3
  100. package/dist/src/compiled/_chunks/workflow/{wrapper-CMGju7QA.js → wrapper-CQNxP9mU.js} +3 -3
  101. package/dist/src/compiled/_chunks/workflow/{ws-transport-Csi6Cydc.js → ws-transport-beXxD0s_.js} +1 -1
  102. package/dist/src/compiled/env-runner/node-worker.js +1 -1
  103. package/dist/src/compiled/jose/index.js +1 -1
  104. package/dist/src/compiled/shadcn-registry/index.js +403 -403
  105. package/dist/src/compiler/artifacts.js +1 -1
  106. package/dist/src/compiler/compile-agent.js +2 -2
  107. package/dist/src/compiler/extension-compatibility.d.ts +20 -10
  108. package/dist/src/compiler/extension-compatibility.js +1 -1
  109. package/dist/src/compiler/manifest.js +1 -1
  110. package/dist/src/compiler/normalize-agent-config.js +1 -1
  111. package/dist/src/compiler/normalize-extension.d.ts +8 -5
  112. package/dist/src/compiler/normalize-extension.js +1 -1
  113. package/dist/src/compiler/normalize-manifest.js +1 -1
  114. package/dist/src/compiler/normalize-subagent.d.ts +1 -1
  115. package/dist/src/compiler/normalize-subagent.js +1 -1
  116. package/dist/src/context/serialized-dynamic-model-selection.d.ts +2 -0
  117. package/dist/src/context/serialized-dynamic-model-selection.js +1 -0
  118. package/dist/src/discover/discover-agent.js +1 -1
  119. package/dist/src/discover/extensions.d.ts +0 -6
  120. package/dist/src/discover/extensions.js +1 -1
  121. package/dist/src/evals/cli/eval.d.ts +1 -1
  122. package/dist/src/evals/cli/eval.js +1 -1
  123. package/dist/src/execution/agent-handle-dispatch.d.ts +15 -1
  124. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  125. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  126. package/dist/src/execution/delegated-parent-notification.d.ts +17 -0
  127. package/dist/src/execution/delegated-parent-notification.js +1 -1
  128. package/dist/src/execution/deliver-payloads.js +1 -1
  129. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +155 -0
  130. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -0
  131. package/dist/src/execution/dispatch-runtime-actions-step.d.ts +18 -14
  132. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  133. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +7 -2
  134. package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
  135. package/dist/src/execution/effective-output-schema.d.ts +21 -0
  136. package/dist/src/execution/effective-output-schema.js +1 -0
  137. package/dist/src/execution/eve-workflow-attributes.d.ts +2 -0
  138. package/dist/src/execution/node-step.js +1 -1
  139. package/dist/src/execution/parked-delivery-wait.d.ts +8 -12
  140. package/dist/src/execution/parked-delivery-wait.js +1 -1
  141. package/dist/src/execution/{route-proxied-deliver-step.d.ts → proxied-deliver-step.d.ts} +7 -4
  142. package/dist/src/execution/proxied-deliver-step.js +1 -0
  143. package/dist/src/execution/remote-agent-dispatch.d.ts +32 -0
  144. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  145. package/dist/src/execution/remote-agent-route-url.d.ts +2 -0
  146. package/dist/src/execution/remote-agent-route-url.js +1 -0
  147. package/dist/src/execution/route-child-delivery.d.ts +2 -1
  148. package/dist/src/execution/route-child-delivery.js +1 -1
  149. package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
  150. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  151. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  152. package/dist/src/execution/sandbox/prewarm.js +1 -1
  153. package/dist/src/execution/session-callback-step.d.ts +11 -0
  154. package/dist/src/execution/session-callback-step.js +1 -1
  155. package/dist/src/execution/session-command-wire.js +1 -1
  156. package/dist/src/execution/session-state-cursor.d.ts +25 -0
  157. package/dist/src/execution/session-state-cursor.js +1 -0
  158. package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -0
  159. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  160. package/dist/src/execution/subagent-event-proxy-step.d.ts +15 -0
  161. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  162. package/dist/src/execution/subagent-hitl-proxy.d.ts +14 -7
  163. package/dist/src/execution/subagent-hitl-proxy.js +1 -1
  164. package/dist/src/execution/subagent-start-local.d.ts +29 -0
  165. package/dist/src/execution/subagent-start-local.js +1 -0
  166. package/dist/src/execution/subagent-start-remote.d.ts +23 -0
  167. package/dist/src/execution/subagent-start-remote.js +1 -0
  168. package/dist/src/execution/task-event-callback.d.ts +13 -0
  169. package/dist/src/execution/task-event-callback.js +1 -0
  170. package/dist/src/execution/task-input-capability.d.ts +4 -0
  171. package/dist/src/execution/task-input-capability.js +1 -0
  172. package/dist/src/execution/tasks/child/steps.d.ts +46 -0
  173. package/dist/src/execution/tasks/child/steps.js +1 -0
  174. package/dist/src/execution/tasks/child/workflow.d.ts +31 -0
  175. package/dist/src/execution/tasks/child/workflow.js +1 -0
  176. package/dist/src/execution/tasks/parent/agent-identity.d.ts +13 -0
  177. package/dist/src/execution/tasks/parent/agent-identity.js +1 -0
  178. package/dist/src/execution/tasks/parent/agent-views.d.ts +6 -0
  179. package/dist/src/execution/tasks/parent/agent-views.js +1 -0
  180. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +37 -0
  181. package/dist/src/execution/tasks/parent/continuation-dispatch.js +1 -0
  182. package/dist/src/execution/tasks/parent/control-shared.d.ts +36 -0
  183. package/dist/src/execution/tasks/parent/control-shared.js +1 -0
  184. package/dist/src/execution/tasks/parent/delegate.d.ts +70 -0
  185. package/dist/src/execution/tasks/parent/delegate.js +1 -0
  186. package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +19 -0
  187. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -0
  188. package/dist/src/execution/tasks/parent/dispatch.d.ts +33 -0
  189. package/dist/src/execution/tasks/parent/dispatch.js +1 -0
  190. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +29 -0
  191. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -0
  192. package/dist/src/execution/tasks/parent/run-parent.d.ts +72 -0
  193. package/dist/src/execution/tasks/parent/run-parent.js +1 -0
  194. package/dist/src/execution/tasks/parent/send.d.ts +25 -0
  195. package/dist/src/execution/tasks/parent/send.js +1 -0
  196. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  197. package/dist/src/execution/tasks/workflow-target.js +1 -0
  198. package/dist/src/execution/terminate-child-sessions-step.d.ts +1 -0
  199. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  200. package/dist/src/execution/turn-control-receiver.d.ts +10 -0
  201. package/dist/src/execution/turn-control-receiver.js +1 -1
  202. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  203. package/dist/src/execution/turn-dispatch.js +1 -1
  204. package/dist/src/execution/turn-execution-cursor.d.ts +2 -8
  205. package/dist/src/execution/turn-execution-cursor.js +1 -1
  206. package/dist/src/execution/turn-workflow.js +1 -1
  207. package/dist/src/execution/workflow-callback-url.d.ts +5 -0
  208. package/dist/src/execution/workflow-callback-url.js +1 -1
  209. package/dist/src/execution/workflow-entry.js +1 -1
  210. package/dist/src/execution/workflow-runtime.d.ts +9 -0
  211. package/dist/src/execution/workflow-runtime.js +1 -1
  212. package/dist/src/execution/workflow-steps.d.ts +7 -21
  213. package/dist/src/execution/workflow-steps.js +1 -1
  214. package/dist/src/harness/advertised-tools.js +1 -1
  215. package/dist/src/harness/authorization.js +1 -1
  216. package/dist/src/harness/execute-tool.d.ts +7 -0
  217. package/dist/src/harness/handles/prompt.d.ts +12 -0
  218. package/dist/src/harness/handles/prompt.js +2 -1
  219. package/dist/src/harness/handles/query.js +1 -1
  220. package/dist/src/harness/handles/store.d.ts +9 -2
  221. package/dist/src/harness/handles/store.js +1 -1
  222. package/dist/src/harness/handles/transitions.d.ts +10 -1
  223. package/dist/src/harness/handles/transitions.js +1 -1
  224. package/dist/src/harness/instrumentation/providers.js +1 -1
  225. package/dist/src/harness/instrumentation/runtime-context.d.ts +2 -0
  226. package/dist/src/harness/instrumentation/runtime-context.js +1 -1
  227. package/dist/src/harness/instrumentation/runtime.d.ts +3 -1
  228. package/dist/src/harness/proxy-input-requests.d.ts +21 -4
  229. package/dist/src/harness/proxy-input-requests.js +1 -1
  230. package/dist/src/harness/runtime-actions.d.ts +2 -0
  231. package/dist/src/harness/runtime-actions.js +1 -1
  232. package/dist/src/harness/session-limit-enforcement.js +1 -1
  233. package/dist/src/harness/tool-loop.js +2 -2
  234. package/dist/src/harness/workflow-runtime-action-state.js +1 -1
  235. package/dist/src/internal/application/cache-metadata.js +1 -1
  236. package/dist/src/internal/application/compiled-artifacts.js +2 -2
  237. package/dist/src/internal/application/optional-package-install.js +1 -1
  238. package/dist/src/internal/application/output-publication-lock.js +1 -1
  239. package/dist/src/internal/application/package.js +1 -1
  240. package/dist/src/internal/application/paths.js +1 -1
  241. package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
  242. package/dist/src/internal/authored-definition/core.js +1 -1
  243. package/dist/src/internal/authored-module-evaluation-error.js +4 -4
  244. package/dist/src/internal/authored-module-loader.js +3 -3
  245. package/dist/src/internal/authored-package-boundary.js +1 -1
  246. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  247. package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
  248. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  249. package/dist/src/internal/instrumentation-layout.js +1 -1
  250. package/dist/src/internal/invocation/agent-invocation.d.ts +54 -0
  251. package/dist/src/internal/invocation/agent-invocation.js +1 -0
  252. package/dist/src/internal/invocation/attributes.d.ts +2 -0
  253. package/dist/src/internal/invocation/attributes.js +1 -0
  254. package/dist/src/internal/invocation/metadata.d.ts +9 -0
  255. package/dist/src/internal/invocation/metadata.js +1 -0
  256. package/dist/src/internal/invocation/workflow-execution.d.ts +32 -0
  257. package/dist/src/internal/invocation/workflow-execution.js +1 -0
  258. package/dist/src/internal/materialized-authored-modules.js +1 -1
  259. package/dist/src/internal/mcp/http-security.d.ts +12 -0
  260. package/dist/src/internal/mcp/http-security.js +1 -0
  261. package/dist/src/internal/mcp/protected-resource.d.ts +9 -0
  262. package/dist/src/internal/mcp/protected-resource.js +1 -0
  263. package/dist/src/internal/mcp/streamable-http-server.d.ts +51 -0
  264. package/dist/src/internal/mcp/streamable-http-server.js +1 -0
  265. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  266. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  267. package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
  268. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
  269. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  270. package/dist/src/internal/nitro/host/application-route-registry.d.ts +88 -0
  271. package/dist/src/internal/nitro/host/application-route-registry.js +1 -0
  272. package/dist/src/internal/nitro/host/build-application.js +1 -1
  273. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  274. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  275. package/dist/src/internal/nitro/host/channel-routes.d.ts +4 -11
  276. package/dist/src/internal/nitro/host/channel-routes.js +3 -3
  277. package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
  278. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  279. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  280. package/dist/src/internal/nitro/host/dev-runner.js +1 -1
  281. package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
  282. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  283. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  284. package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
  285. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  286. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  287. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  288. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  289. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +14 -0
  290. package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
  291. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -0
  292. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  293. package/dist/src/internal/process/pnpm.js +1 -1
  294. package/dist/src/internal/vercel-agent-summary.d.ts +1 -1
  295. package/dist/src/internal/workflow/development-world-client.js +1 -1
  296. package/dist/src/internal/workflow/development-world-server.js +1 -1
  297. package/dist/src/internal/workflow-bundle/builder-support.d.ts +12 -8
  298. package/dist/src/internal/workflow-bundle/builder-support.js +8 -7
  299. package/dist/src/internal/workflow-bundle/builder.d.ts +1 -1
  300. package/dist/src/internal/workflow-bundle/builder.js +2 -3
  301. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  302. package/dist/src/protocol/message.d.ts +28 -0
  303. package/dist/src/protocol/message.js +2 -2
  304. package/dist/src/protocol/routes.d.ts +14 -0
  305. package/dist/src/protocol/routes.js +1 -1
  306. package/dist/src/public/channels/auth.d.ts +36 -0
  307. package/dist/src/public/channels/auth.js +1 -1
  308. package/dist/src/public/channels/discord/discordChannel.d.ts +2 -0
  309. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  310. package/dist/src/public/channels/eve.d.ts +2 -0
  311. package/dist/src/public/channels/eve.js +1 -1
  312. package/dist/src/public/channels/github/dispatch.js +1 -1
  313. package/dist/src/public/channels/github/githubChannel.d.ts +2 -0
  314. package/dist/src/public/channels/linear/linearChannel.d.ts +2 -0
  315. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  316. package/dist/src/public/channels/mcp.d.ts +19 -0
  317. package/dist/src/public/channels/mcp.js +1 -0
  318. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +2 -0
  319. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  320. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
  321. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  322. package/dist/src/public/channels/teams/teamsChannel.d.ts +2 -0
  323. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  324. package/dist/src/public/channels/telegram/telegramChannel.d.ts +2 -0
  325. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  326. package/dist/src/public/channels/twilio/twilioChannel.d.ts +2 -0
  327. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  328. package/dist/src/public/definitions/channel.d.ts +2 -2
  329. package/dist/src/public/definitions/channel.js +1 -1
  330. package/dist/src/public/instrumentation/index.d.ts +9 -3
  331. package/dist/src/public/next/server.js +1 -1
  332. package/dist/src/public/nuxt/dev-server.js +1 -1
  333. package/dist/src/public/sveltekit/dev-server.js +1 -1
  334. package/dist/src/react/use-eve-agent.d.ts +4 -4
  335. package/dist/src/react/use-eve-agent.js +1 -1
  336. package/dist/src/runtime/actions/types.d.ts +9 -0
  337. package/dist/src/runtime/actions/types.js +1 -1
  338. package/dist/src/runtime/agent/bootstrap.js +1 -1
  339. package/dist/src/runtime/connections/authorization-complete-page.js +70 -28
  340. package/dist/src/runtime/framework-channels/index.js +1 -1
  341. package/dist/src/runtime/framework-tools/index.js +1 -1
  342. package/dist/src/runtime/framework-tools/tasks.d.ts +95 -0
  343. package/dist/src/runtime/framework-tools/tasks.js +1 -0
  344. package/dist/src/runtime/prompt/compose.d.ts +1 -0
  345. package/dist/src/runtime/prompt/compose.js +1 -1
  346. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  347. package/dist/src/runtime/resolve-agent.js +1 -1
  348. package/dist/src/runtime/session-callback-route.js +1 -1
  349. package/dist/src/runtime/task-input-response-route.d.ts +5 -0
  350. package/dist/src/runtime/task-input-response-route.js +1 -0
  351. package/dist/src/services/inspect-application.js +1 -1
  352. package/dist/src/setup/primitives/pm/pnpm.js +2 -2
  353. package/dist/src/setup/primitives/run-vercel.js +1 -1
  354. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  355. package/dist/src/setup/scaffold/create/extension.js +1 -1
  356. package/dist/src/setup/scaffold/create/project.js +1 -1
  357. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  358. package/dist/src/setup/scaffold/create/web-template.js +8 -86
  359. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  360. package/dist/src/setup/scaffold/workspace-root.js +1 -1
  361. package/dist/src/shared/agent-definition.d.ts +7 -0
  362. package/dist/src/svelte/index.js +1 -1
  363. package/dist/src/svelte/use-eve-agent.d.ts +3 -3
  364. package/dist/src/svelte/use-eve-agent.js +1 -1
  365. package/dist/src/tasks/json.d.ts +88 -0
  366. package/dist/src/tasks/json.js +1 -0
  367. package/dist/src/tasks/session-index.d.ts +48 -0
  368. package/dist/src/tasks/session-index.js +1 -0
  369. package/dist/src/tasks/task-id.d.ts +34 -0
  370. package/dist/src/tasks/task-id.js +1 -0
  371. package/dist/src/tasks/transitions.d.ts +23 -0
  372. package/dist/src/tasks/transitions.js +1 -0
  373. package/dist/src/tasks/types.d.ts +295 -0
  374. package/dist/src/tasks/types.js +1 -0
  375. package/dist/src/tasks/wire.d.ts +26 -0
  376. package/dist/src/tasks/wire.js +1 -0
  377. package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -1
  378. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  379. package/dist/src/tracing/otel-declaration.d.ts +32 -3
  380. package/dist/src/tracing/otel-declaration.js +1 -1
  381. package/dist/src/tracing/otel-registration.js +1 -1
  382. package/dist/src/vue/index.js +1 -1
  383. package/dist/src/vue/use-eve-agent.d.ts +3 -3
  384. package/dist/src/vue/use-eve-agent.js +1 -1
  385. package/docs/channels/custom.mdx +1 -1
  386. package/docs/channels/discord.mdx +1 -1
  387. package/docs/channels/eve.mdx +15 -2
  388. package/docs/channels/github.mdx +1 -1
  389. package/docs/channels/linear.mdx +1 -1
  390. package/docs/channels/overview.mdx +1 -1
  391. package/docs/channels/photon.mdx +1 -1
  392. package/docs/channels/slack.mdx +1 -1
  393. package/docs/channels/teams.mdx +1 -1
  394. package/docs/channels/telegram.mdx +1 -1
  395. package/docs/channels/twilio.mdx +1 -1
  396. package/docs/extensions.md +10 -6
  397. package/docs/guides/client/streaming.mdx +7 -6
  398. package/docs/guides/frontend/overview.mdx +10 -8
  399. package/docs/guides/frontend/use-eve-agent-svelte.mdx +10 -10
  400. package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
  401. package/docs/install-integrations.mdx +4 -0
  402. package/docs/reference/cli.md +1 -1
  403. package/docs/schedules.mdx +2 -2
  404. package/docs/tools/human-in-the-loop.md +3 -1
  405. package/package.json +7 -1
  406. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-CaJgXkVg.js +0 -1
  407. package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +0 -1
  408. package/dist/src/compiled/_chunks/workflow/src-Cj3P1ChQ.js +0 -1
  409. package/dist/src/compiled/_chunks/workflow/token-util-DNwIAn_u.js +0 -27
  410. package/dist/src/execution/route-proxied-deliver-step.js +0 -1
@@ -1 +1 @@
1
- import{c as e,i as t,n,r,s as i}from"./chunk-5MU5Z6L3-CaJgXkVg.js";import{fileURLToPath as a}from"url";import{createRequire as o}from"module";import s from"path";o(import.meta.url);const c=a(import.meta.url);s.dirname(c);var l=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var a=r(`fs`),o=(n(),i(e));async function s(){for(let e of[`/etc/machine-id`,`/var/lib/dbus/machine-id`])try{return(await a.promises.readFile(e,{encoding:`utf8`})).trim()}catch(e){o.diag.debug(`error reading machine id: ${e}`)}}t.getMachineId=s})();export{l as default};
1
+ import{c as e,i as t,n,r,s as i}from"./chunk-5MU5Z6L3-B_3nkJFi.js";import{fileURLToPath as a}from"url";import{createRequire as o}from"module";import s from"path";o(import.meta.url);const c=a(import.meta.url);s.dirname(c);var l=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var a=r(`fs`),o=(n(),i(e));async function s(){for(let e of[`/etc/machine-id`,`/var/lib/dbus/machine-id`])try{return(await a.promises.readFile(e,{encoding:`utf8`})).trim()}catch(e){o.diag.debug(`error reading machine id: ${e}`)}}t.getMachineId=s})();export{l as default};
@@ -1 +1 @@
1
- import{c as e,i as t,n,s as r}from"./chunk-5MU5Z6L3-CaJgXkVg.js";import{fileURLToPath as i}from"url";import{createRequire as a}from"module";import o from"path";a(import.meta.url);const s=i(import.meta.url);o.dirname(s);var c=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var i=(n(),r(e));async function a(){i.diag.debug(`could not read machine-id: unsupported platform`)}t.getMachineId=a})();export{c as default};
1
+ import{c as e,i as t,n,s as r}from"./chunk-5MU5Z6L3-B_3nkJFi.js";import{fileURLToPath as i}from"url";import{createRequire as a}from"module";import o from"path";a(import.meta.url);const s=i(import.meta.url);o.dirname(s);var c=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var i=(n(),r(e));async function a(){i.diag.debug(`could not read machine-id: unsupported platform`)}t.getMachineId=a})();export{c as default};
@@ -1 +1 @@
1
- import{c as e,i as t,n,r,s as i}from"./chunk-5MU5Z6L3-CaJgXkVg.js";import{t as a}from"./chunk-NWCAEW5Y-Oxw40oRR.js";import{fileURLToPath as o}from"url";import{createRequire as s}from"module";import c from"path";s(import.meta.url);const l=o(import.meta.url);c.dirname(l);var u=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var o=r(`process`),s=a(),c=(n(),i(e));async function l(){let e=`%windir%\\System32\\REG.exe`;o.arch===`ia32`&&`PROCESSOR_ARCHITEW6432`in o.env&&(e=`%windir%\\sysnative\\cmd.exe /c `+e);try{let t=(await(0,s.execAsync)(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split(`REG_SZ`);if(t.length===2)return t[1].trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}t.getMachineId=l})();export{u as default};
1
+ import{c as e,i as t,n,r,s as i}from"./chunk-5MU5Z6L3-B_3nkJFi.js";import{t as a}from"./chunk-NWCAEW5Y-BgbcH0OK.js";import{fileURLToPath as o}from"url";import{createRequire as s}from"module";import c from"path";s(import.meta.url);const l=o(import.meta.url);c.dirname(l);var u=t(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMachineId=void 0;var o=r(`process`),s=a(),c=(n(),i(e));async function l(){let e=`%windir%\\System32\\REG.exe`;o.arch===`ia32`&&`PROCESSOR_ARCHITEW6432`in o.env&&(e=`%windir%\\sysnative\\cmd.exe /c `+e);try{let t=(await(0,s.execAsync)(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split(`REG_SZ`);if(t.length===2)return t[1].trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}t.getMachineId=l})();export{u as default};
@@ -1 +1 @@
1
- import"./dist-tJoQXAF6.js";function e(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function t(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}const n=Symbol.for(`@workflow/core//registeredSteps`),r=globalThis,i=r[n]??=new Map,a=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function o(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function s(e){if(a.has(e)){for(let[t,n]of i.entries())if(t.endsWith(`//${e}`))return n}}function c(e,t){i.set(e,t),t.stepId=e}function l(e){let t=i.get(e);if(t)return t;for(let t of o(e)){let e=i.get(t);if(e)return e}let n=s(e);if(n)return n}const u={hook:[`wait`,`step`],wait:[`hook`,`step`],step:[`wait`,`hook`,`step`]};function d(e,t,n,r){return n>=t||!u[e].includes(r.kind)?!1:!(e===`step`&&!r.armed)}function f(e,t,n,r){let i=r.get(t);if(i!==void 0)return i;let a=p(e,t,n,r);return r.set(t,a),a}function p(e,t,n,r){if(!n.armed)return!1;for(let[i,a]of e)if(d(n.kind,t,i,a)&&!f(e,i,a,r))return!1;return!0}async function m(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=e.pendingDeliveryBarriers,i=[];for(let[e,a]of r)d(n,t,e,a)&&i.push(a.delivered);i.length>0&&(await Promise.all(i),await new Promise(e=>setTimeout(e,0)))}function h(t,n,r,i={}){let a=t.pendingDeliveryBarriers;if(!a||n===void 0)return{markDelivered:()=>{},arm:()=>{}};let o=!1,{promise:s,resolve:c}=e(),l={kind:r,delivered:s,armed:i.armed??!0};a.set(n,l);let u=()=>{o||(o=!0,a.get(n)===l&&a.delete(n),c())};return v(t,u),{markDelivered:u,arm:()=>{l.armed=!0}}}function g(e){let t=e.pendingDeliveryBarriers;if(!t||t.size===0)return!1;let n=new Map;for(let[e,r]of t)if(f(t,e,r,n))return!0;return!1}function _(e){return e.pendingDeliveries===0&&!g(e)}function v(e,t){let n=()=>{_(e)?t():e.promiseQueue.then(()=>{setTimeout(n,0)})};setTimeout(n,0)}export{h as a,t as c,_ as i,e as l,l as n,c as o,g as r,v as s,m as t};
1
+ import"./dist-DpYyXbJv.js";function e(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function t(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}const n=Symbol.for(`@workflow/core//registeredSteps`),r=globalThis,i=r[n]??=new Map,a=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function o(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function s(e){if(a.has(e)){for(let[t,n]of i.entries())if(t.endsWith(`//${e}`))return n}}function c(e,t){i.set(e,t),t.stepId=e}function l(e){let t=i.get(e);if(t)return t;for(let t of o(e)){let e=i.get(t);if(e)return e}let n=s(e);if(n)return n}const u={hook:[`wait`,`step`],wait:[`hook`,`step`],step:[`wait`,`hook`,`step`]};function d(e,t,n,r){return n>=t||!u[e].includes(r.kind)?!1:!(e===`step`&&!r.armed)}function f(e,t,n,r){let i=r.get(t);if(i!==void 0)return i;let a=p(e,t,n,r);return r.set(t,a),a}function p(e,t,n,r){if(!n.armed)return!1;for(let[i,a]of e)if(d(n.kind,t,i,a)&&!f(e,i,a,r))return!1;return!0}async function m(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=e.pendingDeliveryBarriers,i=[];for(let[e,a]of r)d(n,t,e,a)&&i.push(a.delivered);i.length>0&&(await Promise.all(i),await new Promise(e=>setTimeout(e,0)))}function h(t,n,r,i={}){let a=t.pendingDeliveryBarriers;if(!a||n===void 0)return{markDelivered:()=>{},arm:()=>{}};let o=!1,{promise:s,resolve:c}=e(),l={kind:r,delivered:s,armed:i.armed??!0};a.set(n,l);let u=()=>{o||(o=!0,a.get(n)===l&&a.delete(n),c())};return v(t,u),{markDelivered:u,arm:()=>{l.armed=!0}}}function g(e){let t=e.pendingDeliveryBarriers;if(!t||t.size===0)return!1;let n=new Map;for(let[e,r]of t)if(f(t,e,r,n))return!0;return!1}function _(e){return e.pendingDeliveries===0&&!g(e)}function v(e,t){let n=()=>{_(e)?t():e.promiseQueue.then(()=>{setTimeout(n,0)})};setTimeout(n,0)}export{h as a,t as c,_ as i,e as l,l as n,c as o,g as r,v as s,m as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,Hn as n,L as r,Nn as i,Pn as a,S as o,Wn as s,Z as c,_t as l,a as u,bn as ee,cn as d,ct as f,gt as p,jn as m,n as h,ot as g,sr as _,t as v,tr as y,vt as b,w as x,xt as S}from"./wait-until-DK2lnH6U.js";import{D as C,d as w,n as T,o as E,r as D}from"./dist-CRTn4Sg8.js";import{I as O,o as k}from"./dist-DlFv0aHY.js";import{t as A}from"./spec-version-DBUVfF_R.js";var j=e({getHookByToken:()=>R,resumeHook:()=>z,resumeWebhook:()=>V});const M=k();async function N(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}function P(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function F(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await s()).runs.get(e.runId);return{resumeContext:P(t),source:`run_fallback`,run:t}}async function I(e,t){let n=await s(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await _(r):void 0}async function L(e){let t=await s(),n=await t.hooks.getByToken(e),i;if(n.metadata!==void 0){let e=await F(n),a=e.run?await t.getEncryptionKeyForRun?.(e.run):await t.getEncryptionKeyForRun?.(n.runId,{deploymentId:e.resumeContext.deploymentId});i=a?await m(a):void 0,n.metadata=await r(n.metadata,n.runId,i)}return{hook:n,encryptionKey:i}}async function R(e){let{hook:t}=await L(e);return t}async function z(e,t,n){return B(e,t,n,!1)}async function B(e,r,m,_){return await h(()=>f(`hook.resume`,async f=>{let h=await s();try{let s=typeof e==`string`,p=s?await h.hooks.getByToken(e):e,y=s||_,C=await F(p),{resumeContext:T}=C;if(f?.setAttributes({...S(p.token),...l(p.hookId),...ee(p.runId),"workflow.hook.resume_context_source":C.source}),C.run&&O(C.run.status))throw new E(p.token);let k=x(T.workflowCoreVersion),j,P=m?void 0:n(T.encryptionPublicKey);if(P)j=i(P);else{let e=m??await I(p,C);k.supportedFormats.has(a.ENCRYPTED)||(e=void 0),j=e}let L=(T.runSpecVersion??0)>=5&&k.supportedFormats.has(a.GZIP),R=[],z=A(p.specVersion),B=await t(r,p.runId,j,R,globalThis,z,k.framedByteStreams,L);v(Promise.all(R),e=>{e!==void 0&&c.warn(`Background flush of hook payload ops failed`,{workflowRunId:p.runId,hookId:p.hookId,error:e instanceof Error?e.message:String(e)})}),f?.setAttributes({...d(T.workflowName)});let V=await g(T.traceCarrier);V&&f?.addLink?.(V);let H={...z?{}:{token:p.token},payload:B},U=u(T.workflowName),W={deploymentId:T.deploymentId,specVersion:T.runSpecVersion??1},G=process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME===`1`,K=(y?p.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||h.capabilities?.hookResumeDedup===!0,q=G?`disabled`:K?(T.hookResumeInputVersion??0)<1?`consumer_unsupported`:z?`legacy`:(T.runSpecVersion??0)<3?`non_cbor_transport`:B instanceof Uint8Array?B.byteLength>131072?`oversized`:null:`non_bytes`:`backend_unsupported`,J=q===null;f?.setAttributes({"workflow.hook.resume_strategy":J?`parallel`:`sequential`,...q?{"workflow.hook.resume_fallback_reason":q}:{}});let te=e=>E.is(e)||D.is(e)||w.is(e);if(!J){try{await h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z})}catch(e){throw te(e)?new E(p.token):e}return await h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0},W),p}let Y=M(),X=await N(B);f?.setAttributes({"workflow.hook.resume_id":Y});let[Z,Q]=await Promise.allSettled([h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z,resumeId:Y,resumePayloadDigest:X}),h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0,hookInput:{resumeId:Y,hookId:p.hookId,token:p.token,payload:B,payloadDigest:X,deploymentId:T.deploymentId}},W)]);if(Q.status===`rejected`)throw Q.reason;let $=!1;if(Z.status===`rejected`){let e=Z.reason;if(E.is(e)||w.is(e))throw new E(p.token);if(D.is(e)||o(e))$=!0,f?.setAttributes({...b(!0),"workflow.hook.resume_event_write_recovered":!0,"workflow.hook.resume_event_write_error":e instanceof Error?e.name:`unknown`}),c.warn(`Hook resume event write failed, but the run was re-triggered via the queue. The hook_received event will be ensured by the queue consumer.`,{workflowRunId:p.runId,hookId:p.hookId,resumeId:Y,error:e instanceof Error?e.message:String(e)});else throw e}return $?{...p,resilientResume:!0}:p}catch(t){throw f?.setAttributes({...S(typeof e==`string`?e:e.token),...p(!1)}),t}}))}async function V(e,t){let{hook:n,encryptionKey:r}=await L(e);if(n.isWebhook===!1)throw new E(e);let i,a;if(n.metadata&&typeof n.metadata==`object`&&`respondWith`in n.metadata)if(n.metadata.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;a=e,t[y]=n}else if(n.metadata.respondWith instanceof Response)i=n.metadata.respondWith;else throw new C(`Invalid \`respondWith\` value: ${n.metadata.respondWith}`,{slug:T.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else i=new Response(null,{status:202});if(await B(n,t,r,!0),a){let e=a.getReader(),t=await e.read();t.value&&(i=t.value),e.cancel()}if(!i)throw new C(`Workflow run did not send a response`,{slug:T.WEBHOOK_RESPONSE_NOT_SENT});return i}export{j as i,z as n,V as r,R as t};
1
+ import{r as e}from"./rolldown-runtime-8V8biNmG.js";import{A as t,Hn as n,L as r,Nn as i,Pn as a,S as o,Wn as s,Z as c,_t as l,a as u,bn as ee,cn as d,ct as f,gt as p,jn as m,n as h,ot as g,sr as _,t as v,tr as y,vt as b,w as x,xt as S}from"./wait-until-CT1ve8qB.js";import{D as C,d as w,n as T,o as E,r as D}from"./dist-xQXN70ED.js";import{I as O,o as k}from"./dist-CPlyFOVo.js";import{t as A}from"./spec-version-DBUVfF_R.js";var j=e({getHookByToken:()=>R,resumeHook:()=>z,resumeWebhook:()=>V});const M=k();async function N(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}function P(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function F(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await s()).runs.get(e.runId);return{resumeContext:P(t),source:`run_fallback`,run:t}}async function I(e,t){let n=await s(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await _(r):void 0}async function L(e){let t=await s(),n=await t.hooks.getByToken(e),i;if(n.metadata!==void 0){let e=await F(n),a=e.run?await t.getEncryptionKeyForRun?.(e.run):await t.getEncryptionKeyForRun?.(n.runId,{deploymentId:e.resumeContext.deploymentId});i=a?await m(a):void 0,n.metadata=await r(n.metadata,n.runId,i)}return{hook:n,encryptionKey:i}}async function R(e){let{hook:t}=await L(e);return t}async function z(e,t,n){return B(e,t,n,!1)}async function B(e,r,m,_){return await h(()=>f(`hook.resume`,async f=>{let h=await s();try{let s=typeof e==`string`,p=s?await h.hooks.getByToken(e):e,y=s||_,C=await F(p),{resumeContext:T}=C;if(f?.setAttributes({...S(p.token),...l(p.hookId),...ee(p.runId),"workflow.hook.resume_context_source":C.source}),C.run&&O(C.run.status))throw new E(p.token);let k=x(T.workflowCoreVersion),j,P=m?void 0:n(T.encryptionPublicKey);if(P)j=i(P);else{let e=m??await I(p,C);k.supportedFormats.has(a.ENCRYPTED)||(e=void 0),j=e}let L=(T.runSpecVersion??0)>=5&&k.supportedFormats.has(a.GZIP),R=[],z=A(p.specVersion),B=await t(r,p.runId,j,R,globalThis,z,k.framedByteStreams,L);v(Promise.all(R),e=>{e!==void 0&&c.warn(`Background flush of hook payload ops failed`,{workflowRunId:p.runId,hookId:p.hookId,error:e instanceof Error?e.message:String(e)})}),f?.setAttributes({...d(T.workflowName)});let V=await g(T.traceCarrier);V&&f?.addLink?.(V);let H={...z?{}:{token:p.token},payload:B},U=u(T.workflowName),W={deploymentId:T.deploymentId,specVersion:T.runSpecVersion??1},G=process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME===`1`,K=(y?p.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||h.capabilities?.hookResumeDedup===!0,q=G?`disabled`:K?(T.hookResumeInputVersion??0)<1?`consumer_unsupported`:z?`legacy`:(T.runSpecVersion??0)<3?`non_cbor_transport`:B instanceof Uint8Array?B.byteLength>131072?`oversized`:null:`non_bytes`:`backend_unsupported`,J=q===null;f?.setAttributes({"workflow.hook.resume_strategy":J?`parallel`:`sequential`,...q?{"workflow.hook.resume_fallback_reason":q}:{}});let te=e=>E.is(e)||D.is(e)||w.is(e);if(!J){try{await h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z})}catch(e){throw te(e)?new E(p.token):e}return await h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0},W),p}let Y=M(),X=await N(B);f?.setAttributes({"workflow.hook.resume_id":Y});let[Z,Q]=await Promise.allSettled([h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z,resumeId:Y,resumePayloadDigest:X}),h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0,hookInput:{resumeId:Y,hookId:p.hookId,token:p.token,payload:B,payloadDigest:X,deploymentId:T.deploymentId}},W)]);if(Q.status===`rejected`)throw Q.reason;let $=!1;if(Z.status===`rejected`){let e=Z.reason;if(E.is(e)||w.is(e))throw new E(p.token);if(D.is(e)||o(e))$=!0,f?.setAttributes({...b(!0),"workflow.hook.resume_event_write_recovered":!0,"workflow.hook.resume_event_write_error":e instanceof Error?e.name:`unknown`}),c.warn(`Hook resume event write failed, but the run was re-triggered via the queue. The hook_received event will be ensured by the queue consumer.`,{workflowRunId:p.runId,hookId:p.hookId,resumeId:Y,error:e instanceof Error?e.message:String(e)});else throw e}return $?{...p,resilientResume:!0}:p}catch(t){throw f?.setAttributes({...S(typeof e==`string`?e:e.token),...p(!1)}),t}}))}async function V(e,t){let{hook:n,encryptionKey:r}=await L(e);if(n.isWebhook===!1)throw new E(e);let i,a;if(n.metadata&&typeof n.metadata==`object`&&`respondWith`in n.metadata)if(n.metadata.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;a=e,t[y]=n}else if(n.metadata.respondWith instanceof Response)i=n.metadata.respondWith;else throw new C(`Invalid \`respondWith\` value: ${n.metadata.respondWith}`,{slug:T.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else i=new Response(null,{status:202});if(await B(n,t,r,!0),a){let e=a.getReader(),t=await e.read();t.value&&(i=t.value),e.cancel()}if(!i)throw new C(`Workflow run did not send a response`,{slug:T.WEBHOOK_RESPONSE_NOT_SENT});return i}export{j as i,z as n,V as r,R as t};
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>o.call(e,`module.exports`)?e[`module.exports`]:u(n({},`__esModule`,{value:!0}),e),p=e(import.meta.url);export{f as a,p as i,s as n,d as o,l as r,c as t};
1
+ import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=e(import.meta.url);export{d as a,f as i,s as n,l as r,c as t};
@@ -1 +1 @@
1
- import{B as e,Gn as t,Hn as n,I as r,Nn as i,P as a,Pn as o,Qt as s,Rn as c,S as l,Sn as u,Un as d,V as f,Vn as ee,Wn as p,X as m,Y as h,Z as g,a as _,b as te,bn as ne,cn as re,ct as v,dt as ie,j as y,jn as b,ln as ae,mr as x,n as S,s as C,sr as oe,st as se,t as ce,w as le,zn as w}from"./wait-until-DK2lnH6U.js";import{C as T,D as E,E as D,T as O,r as k,w as A}from"./dist-CRTn4Sg8.js";import{t as j}from"./attribute-changes-BoH7JsWp.js";import{J as M,Y as N,i as ue,o as P}from"./dist-DlFv0aHY.js";import{t as F}from"./env-config-DxamfI7T.js";import{t as I}from"./spec-version-DBUVfF_R.js";const L=[`node`,`quickjs`];function R(e=process.env){let t=e.WORKFLOW_VM;if(!(t===void 0||t===``)){if(L.includes(t))return t;throw new E(`Invalid WORKFLOW_VM value: "${t}". Expected one of: ${L.join(`, `)}.`)}}function z(e){let t=e.executionContext?.workflowVm;if(t!==void 0){if(!L.includes(t))throw new E(`Invalid executionContext.workflowVm value: "${t}". Expected one of: ${L.join(`, `)}.`);return t===`quickjs`}return R()===`quickjs`}const de=P();function B(){let e=m.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[N]:e.rootRunId??t,[M]:t}}let V=!1;async function H(e,r,a){"use step";return await S(()=>{let c=e?.workflowId;if(!c)throw new E(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`,{slug:`start-invalid-workflow-function`});return v(`workflow.start ${x(c)}`,async e=>{e?.setAttributes({...re(c),...ae(`start`)});let f=[],m=a??{};Array.isArray(r)?f=r:typeof r==`object`&&(m=r),e?.setAttributes({...s(f.length)});let h=m.world??await p();t(h);let v=await h.getDeploymentId(),b=m.deploymentId??v;b===`latest`&&(h.resolveLatestDeploymentId?b=await h.resolveLatestDeploymentId():(V||(V=!0,g.warn(`deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.`,{currentDeploymentId:v})),b=v));let x=`wrun_${h.createRunId?h.createRunId(m):de()}`,S,w,T,D;if(b===v)S=!0,w=!0,T=1;else if(typeof h.streams?.get!=`function`)S=!1,w=!1,T=void 0;else{let e=await C(h,{deploymentId:b,runId:x,timeout:2e3,namespace:m.namespace}).catch(()=>void 0);D=e?.encryptionPublicKey;let t=le(e?.workflowCoreVersion);S=t.framedByteStreams,w=t.supportedFormats.has(o.GZIP),T=e?.hookResumeInputVersion}let O=[],A=await se(),M=m.specVersion??h.specVersion,N=I(M),P=m.allowReservedAttributes===!0,F;if(m.attributes&&Object.keys(m.attributes).length>0){if(M<4)throw new E(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(m.attributes))if(typeof t!=`string`)throw new E(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=j(m.attributes,{allowReservedAttributes:P});F=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let L=M>=4?B():void 0,z=L?{...L,...F}:F,H=z?{attributes:z,...P||L!=null?{allowReservedAttributes:!0}:{}}:{};if(m.replayedFromRunId!==void 0&&!ue.safeParse(m.replayedFromRunId).success)throw new E(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(m.replayedFromRunId).slice(0,64))}.`);let U=n(D),W,G;if(U)W=i(U),G=D;else{let e=await h.getEncryptionKeyForRun?.(x,{...m,deploymentId:b});W=e?await oe(e):void 0,G=e?ee((await d(e)).publicKey):void 0}let K=await y(f,x,W,O,globalThis,N,S,w&&M>=5),q=h.getEnvironment?.(),J=R(),Y={traceCarrier:A,workflowCoreVersion:te,features:{encryption:!!W},...T===void 0?{}:{hookResumeInputVersion:T},...J?{workflowVm:J}:{},...m.replayedFromRunId?{replayedFromRunId:m.replayedFromRunId}:{}},[X,Z]=await Promise.allSettled([h.events.create(x,{eventType:`run_created`,specVersion:M,eventData:{deploymentId:b,workflowName:c,input:K,executionContext:Y,...G?{encryptionPublicKey:G}:{},...H}},{v1Compat:N}),h.queue(_(c,m.namespace),{runId:x,traceCarrier:A,...M>=3?{runInput:{input:K,deploymentId:b,workflowName:c,specVersion:M,executionContext:Y,...G?{encryptionPublicKey:G}:{},...q===void 0?{}:{environment:q},...H}}:{}},{deploymentId:b,specVersion:M,...m.region===void 0?{}:{region:m.region}})]);if(Z.status===`rejected`)throw Z.reason;let $=!1;if(X.status===`rejected`){let e=X.reason;if(!k.is(e))if(l(e))$=!0,g.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:x,error:e.message});else throw e}else{let e=X.value;if(!N&&e.run.runId!==x)throw new E(`Server returned different runId than requested: expected ${x}, got ${e.run.runId}`)}return ce(Promise.all(O),e=>{g.warn(`Background flush of workflow argument streams failed`,{workflowRunId:x,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...ne(x),...ie(b),...X.status===`fulfilled`?u(X.value.run.status):{}}),new Q(x,{resilientStart:$})})})}const U=e=>Array.isArray(e)?e:[e];async function W(t,n,r={}){try{let i=await t.runs.get(n,{resolveData:`all`}),a=await t.getEncryptionKeyForRun?.(i),o=a?await b(a):void 0,s=U(await e(i.input,n,o,globalThis)),c=r.specVersion??i.specVersion??1,l=r.deploymentId??i.deploymentId;return(await H({workflowId:i.workflowName},s,{deploymentId:l,world:t,specVersion:c,replayedFromRunId:n,namespace:r.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function G(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=I(r),a={eventType:`run_cancelled`,specVersion:r,...n?.cancelReason===void 0?{}:{eventData:{cancelReason:n.cancelReason}}};await e.events.create(t,a,{v1Compat:i})}catch(e){throw Error(`Failed to cancel run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function K(e,t,n){if(t.length===0)throw Error(`cancelRuns requires at least one run ID.`);if(t.length>500)throw Error(`cancelRuns accepts at most 500 run IDs (received ${t.length}).`);if(new Set(t).size!==t.length)throw Error(`cancelRuns requires unique run IDs (duplicates found).`);if(e.runs.cancelMany)return e.runs.cancelMany({runIds:t,...n?.cancelReason===void 0?{}:{cancelReason:n.cancelReason}});let r=Array(t.length),i=0,a=async()=>{for(;;){let a=i++;if(a>=t.length)return;let o=t[a];try{await G(e,o,n),r[a]={runId:o,outcome:`cancelled`}}catch{r[a]={runId:o,outcome:`failed`,code:`internal_error`,retryable:!0}}}},o=Math.min(20,t.length);await Promise.all(Array.from({length:o},()=>a()));let s={requested:t.length,cancelled:0,alreadyCancelled:0,notCancellable:0,notFound:0,failed:0};for(let e of r)switch(e.outcome){case`cancelled`:s.cancelled++;break;case`already_cancelled`:s.alreadyCancelled++;break;case`not_cancellable`:s.notCancellable++;break;case`not_found`:s.notFound++;break;case`failed`:s.failed++;break}return{summary:s,results:r}}async function q(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1})}catch(e){throw Error(`Failed to re-enqueue run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function J(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=I(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{sortOrder:`asc`,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),l=s.filter(e=>!c.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);l=l.filter(t=>t.correlationId&&e.has(t.correlationId))}let u=[],d=0;for(let n of l){if(!n.correlationId)continue;let a=i?{eventType:`wait_completed`,correlationId:n.correlationId}:{eventType:`wait_completed`,correlationId:n.correlationId,specVersion:r.specVersion,eventData:{resumeAt:n.eventData.resumeAt}};try{await e.events.create(t,a,{v1Compat:i}),d++}catch(e){k.is(e)?d++:u.push(e instanceof Error?e:Error(String(e)))}}if(d>0&&await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),u.length>0)throw AggregateError(u,`Failed to complete ${u.length}/${l.length} pending wait(s) for run ${t}`);return{stoppedCount:d}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Y(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function X(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}function Z(){return F(`WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`,1e3,{integer:!0,min:1})}var Q=class e{static[w](e){return{runId:e.runId,resilientStart:e.#r}}static[c](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=p(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await b(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return J(await this.#t,this.runId,e)}async cancel(e){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5,...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(D.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,o=h(this.runId,i),s=this.#a(),c=a(n,t,this.runId,s).ReadableStream({name:o,startIndex:r}),l=this.#t,u=this.runId;return Object.assign(c,{getTailIndex:async()=>(await(await l).streams.getInfo(u,o)).tailIndex})}async#o(){let e=await this.#t,t=0,n=this.#r?3:0,i=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await f(t.output,this.runId,e)}if(t.status===`cancelled`)throw new T(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await r(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new A(this.runId,n,{errorCode:t.errorCode})}throw new O(this.runId,t.status)}catch(e){if(O.is(e)){await new Promise(e=>setTimeout(e,Z()));continue}if(D.is(e)&&t<n){let e=i[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function $(e){return new Q(e)}export{X as a,q as c,z as d,K as i,J as l,$ as n,Y as o,G as r,W as s,Q as t,H as u};
1
+ import{B as e,Gn as t,Hn as n,I as r,Nn as i,P as a,Pn as o,Qt as s,Rn as c,S as l,Sn as u,Un as d,V as f,Vn as ee,Wn as p,X as m,Y as h,Z as g,a as _,b as te,bn as ne,cn as re,ct as v,dt as ie,j as y,jn as b,ln as ae,mr as x,n as S,s as C,sr as oe,st as se,t as ce,w as le,zn as w}from"./wait-until-CT1ve8qB.js";import{C as T,D as E,E as D,T as O,r as k,w as A}from"./dist-xQXN70ED.js";import{t as j}from"./attribute-changes-DZtQkszH.js";import{J as M,Y as N,i as ue,o as P}from"./dist-CPlyFOVo.js";import{t as F}from"./env-config-DxamfI7T.js";import{t as I}from"./spec-version-DBUVfF_R.js";const L=[`node`,`quickjs`];function R(e=process.env){let t=e.WORKFLOW_VM;if(!(t===void 0||t===``)){if(L.includes(t))return t;throw new E(`Invalid WORKFLOW_VM value: "${t}". Expected one of: ${L.join(`, `)}.`)}}function z(e){let t=e.executionContext?.workflowVm;if(t!==void 0){if(!L.includes(t))throw new E(`Invalid executionContext.workflowVm value: "${t}". Expected one of: ${L.join(`, `)}.`);return t===`quickjs`}return R()===`quickjs`}const de=P();function B(){let e=m.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[N]:e.rootRunId??t,[M]:t}}let V=!1;async function H(e,r,a){"use step";return await S(()=>{let c=e?.workflowId;if(!c)throw new E(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`,{slug:`start-invalid-workflow-function`});return v(`workflow.start ${x(c)}`,async e=>{e?.setAttributes({...re(c),...ae(`start`)});let f=[],m=a??{};Array.isArray(r)?f=r:typeof r==`object`&&(m=r),e?.setAttributes({...s(f.length)});let h=m.world??await p();t(h);let v=await h.getDeploymentId(),b=m.deploymentId??v;b===`latest`&&(h.resolveLatestDeploymentId?b=await h.resolveLatestDeploymentId():(V||(V=!0,g.warn(`deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.`,{currentDeploymentId:v})),b=v));let x=`wrun_${h.createRunId?h.createRunId(m):de()}`,S,w,T,D;if(b===v)S=!0,w=!0,T=1;else if(typeof h.streams?.get!=`function`)S=!1,w=!1,T=void 0;else{let e=await C(h,{deploymentId:b,runId:x,timeout:2e3,namespace:m.namespace}).catch(()=>void 0);D=e?.encryptionPublicKey;let t=le(e?.workflowCoreVersion);S=t.framedByteStreams,w=t.supportedFormats.has(o.GZIP),T=e?.hookResumeInputVersion}let O=[],A=await se(),M=m.specVersion??h.specVersion,N=I(M),P=m.allowReservedAttributes===!0,F;if(m.attributes&&Object.keys(m.attributes).length>0){if(M<4)throw new E(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(m.attributes))if(typeof t!=`string`)throw new E(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=j(m.attributes,{allowReservedAttributes:P});F=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let L=M>=4?B():void 0,z=L?{...L,...F}:F,H=z?{attributes:z,...P||L!=null?{allowReservedAttributes:!0}:{}}:{};if(m.replayedFromRunId!==void 0&&!ue.safeParse(m.replayedFromRunId).success)throw new E(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(m.replayedFromRunId).slice(0,64))}.`);let U=n(D),W,G;if(U)W=i(U),G=D;else{let e=await h.getEncryptionKeyForRun?.(x,{...m,deploymentId:b});W=e?await oe(e):void 0,G=e?ee((await d(e)).publicKey):void 0}let K=await y(f,x,W,O,globalThis,N,S,w&&M>=5),q=h.getEnvironment?.(),J=R(),Y={traceCarrier:A,workflowCoreVersion:te,features:{encryption:!!W},...T===void 0?{}:{hookResumeInputVersion:T},...J?{workflowVm:J}:{},...m.replayedFromRunId?{replayedFromRunId:m.replayedFromRunId}:{}},[X,Z]=await Promise.allSettled([h.events.create(x,{eventType:`run_created`,specVersion:M,eventData:{deploymentId:b,workflowName:c,input:K,executionContext:Y,...G?{encryptionPublicKey:G}:{},...H}},{v1Compat:N}),h.queue(_(c,m.namespace),{runId:x,traceCarrier:A,...M>=3?{runInput:{input:K,deploymentId:b,workflowName:c,specVersion:M,executionContext:Y,...G?{encryptionPublicKey:G}:{},...q===void 0?{}:{environment:q},...H}}:{}},{deploymentId:b,specVersion:M,...m.region===void 0?{}:{region:m.region}})]);if(Z.status===`rejected`)throw Z.reason;let $=!1;if(X.status===`rejected`){let e=X.reason;if(!k.is(e))if(l(e))$=!0,g.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:x,error:e.message});else throw e}else{let e=X.value;if(!N&&e.run.runId!==x)throw new E(`Server returned different runId than requested: expected ${x}, got ${e.run.runId}`)}return ce(Promise.all(O),e=>{g.warn(`Background flush of workflow argument streams failed`,{workflowRunId:x,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...ne(x),...ie(b),...X.status===`fulfilled`?u(X.value.run.status):{}}),new Q(x,{resilientStart:$})})})}const U=e=>Array.isArray(e)?e:[e];async function W(t,n,r={}){try{let i=await t.runs.get(n,{resolveData:`all`}),a=await t.getEncryptionKeyForRun?.(i),o=a?await b(a):void 0,s=U(await e(i.input,n,o,globalThis)),c=r.specVersion??i.specVersion??1,l=r.deploymentId??i.deploymentId;return(await H({workflowId:i.workflowName},s,{deploymentId:l,world:t,specVersion:c,replayedFromRunId:n,namespace:r.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function G(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=I(r),a={eventType:`run_cancelled`,specVersion:r,...n?.cancelReason===void 0?{}:{eventData:{cancelReason:n.cancelReason}}};await e.events.create(t,a,{v1Compat:i})}catch(e){throw Error(`Failed to cancel run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function K(e,t,n){if(t.length===0)throw Error(`cancelRuns requires at least one run ID.`);if(t.length>500)throw Error(`cancelRuns accepts at most 500 run IDs (received ${t.length}).`);if(new Set(t).size!==t.length)throw Error(`cancelRuns requires unique run IDs (duplicates found).`);if(e.runs.cancelMany)return e.runs.cancelMany({runIds:t,...n?.cancelReason===void 0?{}:{cancelReason:n.cancelReason}});let r=Array(t.length),i=0,a=async()=>{for(;;){let a=i++;if(a>=t.length)return;let o=t[a];try{await G(e,o,n),r[a]={runId:o,outcome:`cancelled`}}catch{r[a]={runId:o,outcome:`failed`,code:`internal_error`,retryable:!0}}}},o=Math.min(20,t.length);await Promise.all(Array.from({length:o},()=>a()));let s={requested:t.length,cancelled:0,alreadyCancelled:0,notCancellable:0,notFound:0,failed:0};for(let e of r)switch(e.outcome){case`cancelled`:s.cancelled++;break;case`already_cancelled`:s.alreadyCancelled++;break;case`not_cancellable`:s.notCancellable++;break;case`not_found`:s.notFound++;break;case`failed`:s.failed++;break}return{summary:s,results:r}}async function q(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1})}catch(e){throw Error(`Failed to re-enqueue run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function J(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=I(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{sortOrder:`asc`,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),l=s.filter(e=>!c.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);l=l.filter(t=>t.correlationId&&e.has(t.correlationId))}let u=[],d=0;for(let n of l){if(!n.correlationId)continue;let a=i?{eventType:`wait_completed`,correlationId:n.correlationId}:{eventType:`wait_completed`,correlationId:n.correlationId,specVersion:r.specVersion,eventData:{resumeAt:n.eventData.resumeAt}};try{await e.events.create(t,a,{v1Compat:i}),d++}catch(e){k.is(e)?d++:u.push(e instanceof Error?e:Error(String(e)))}}if(d>0&&await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),u.length>0)throw AggregateError(u,`Failed to complete ${u.length}/${l.length} pending wait(s) for run ${t}`);return{stoppedCount:d}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Y(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function X(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}function Z(){return F(`WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`,1e3,{integer:!0,min:1})}var Q=class e{static[w](e){return{runId:e.runId,resilientStart:e.#r}}static[c](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=p(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await b(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return J(await this.#t,this.runId,e)}async cancel(e){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5,...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(D.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,o=h(this.runId,i),s=this.#a(),c=a(n,t,this.runId,s).ReadableStream({name:o,startIndex:r}),l=this.#t,u=this.runId;return Object.assign(c,{getTailIndex:async()=>(await(await l).streams.getInfo(u,o)).tailIndex})}async#o(){let e=await this.#t,t=0,n=this.#r?3:0,i=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await f(t.output,this.runId,e)}if(t.status===`cancelled`)throw new T(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await r(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new A(this.runId,n,{errorCode:t.errorCode})}throw new O(this.runId,t.status)}catch(e){if(O.is(e)){await new Promise(e=>setTimeout(e,Z()));continue}if(D.is(e)&&t<n){let e=i[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function $(e){return new Q(e)}export{X as a,q as c,z as d,K as i,J as l,$ as n,Y as o,G as r,W as s,Q as t,H as u};
@@ -1 +1 @@
1
- import{i as e,t}from"./rolldown-runtime-DaDcL9Zw.js";var n=t(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),r=t(((t,r)=>{var i=global.process;let a=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!a(i))r.exports=function(){return function(){}};else{var o=e(`assert`),s=n(),c=/^win/i.test(i.platform),l=e(`events`);typeof l!=`function`&&(l=l.EventEmitter);var u;i.__signal_exit_emitter__?u=i.__signal_exit_emitter__:(u=i.__signal_exit_emitter__=new l,u.count=0,u.emitted={}),u.infinite||(u.setMaxListeners(1/0),u.infinite=!0),r.exports=function(e,t){if(!a(global.process))return function(){};o.equal(typeof e,`function`,`a callback must be provided for exit handler`),m===!1&&h();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),u.on(n,e),function(){u.removeListener(n,e),u.listeners(`exit`).length===0&&u.listeners(`afterexit`).length===0&&d()}};var d=function(){!m||!a(global.process)||(m=!1,s.forEach(function(e){try{i.removeListener(e,p[e])}catch{}}),i.emit=v,i.reallyExit=g,--u.count)};r.exports.unload=d;var f=function(e,t,n){u.emitted[e]||(u.emitted[e]=!0,u.emit(e,t,n))},p={};s.forEach(function(e){p[e]=function(){a(global.process)&&i.listeners(e).length===u.count&&(d(),f(`exit`,null,e),f(`afterexit`,null,e),c&&e===`SIGHUP`&&(e=`SIGINT`),i.kill(i.pid,e))}}),r.exports.signals=function(){return s};var m=!1,h=function(){m||!a(global.process)||(m=!0,u.count+=1,s=s.filter(function(e){try{return i.on(e,p[e]),!0}catch{return!1}}),i.emit=y,i.reallyExit=_)};r.exports.load=h;var g=i.reallyExit,_=function(e){a(global.process)&&(i.exitCode=e||0,f(`exit`,i.exitCode,null),f(`afterexit`,i.exitCode,null),g.call(i,i.exitCode))},v=i.emit,y=function(e,t){if(e===`exit`&&a(global.process)){t!==void 0&&(i.exitCode=t);var n=v.apply(this,arguments);return f(`exit`,i.exitCode,null),f(`afterexit`,i.exitCode,null),n}else return v.apply(this,arguments)}}}));export{r as t};
1
+ import{i as e,t}from"./rolldown-runtime-8V8biNmG.js";var n=t(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),r=t(((t,r)=>{var i=global.process;let a=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!a(i))r.exports=function(){return function(){}};else{var o=e(`assert`),s=n(),c=/^win/i.test(i.platform),l=e(`events`);typeof l!=`function`&&(l=l.EventEmitter);var u;i.__signal_exit_emitter__?u=i.__signal_exit_emitter__:(u=i.__signal_exit_emitter__=new l,u.count=0,u.emitted={}),u.infinite||(u.setMaxListeners(1/0),u.infinite=!0),r.exports=function(e,t){if(!a(global.process))return function(){};o.equal(typeof e,`function`,`a callback must be provided for exit handler`),m===!1&&h();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),u.on(n,e),function(){u.removeListener(n,e),u.listeners(`exit`).length===0&&u.listeners(`afterexit`).length===0&&d()}};var d=function(){!m||!a(global.process)||(m=!1,s.forEach(function(e){try{i.removeListener(e,p[e])}catch{}}),i.emit=v,i.reallyExit=g,--u.count)};r.exports.unload=d;var f=function(e,t,n){u.emitted[e]||(u.emitted[e]=!0,u.emit(e,t,n))},p={};s.forEach(function(e){p[e]=function(){a(global.process)&&i.listeners(e).length===u.count&&(d(),f(`exit`,null,e),f(`afterexit`,null,e),c&&e===`SIGHUP`&&(e=`SIGINT`),i.kill(i.pid,e))}}),r.exports.signals=function(){return s};var m=!1,h=function(){m||!a(global.process)||(m=!0,u.count+=1,s=s.filter(function(e){try{return i.on(e,p[e]),!0}catch{return!1}}),i.emit=y,i.reallyExit=_)};r.exports.load=h;var g=i.reallyExit,_=function(e){a(global.process)&&(i.exitCode=e||0,f(`exit`,i.exitCode,null),f(`afterexit`,i.exitCode,null),g.call(i,i.exitCode))},v=i.emit,y=function(e,t){if(e===`exit`&&a(global.process)){t!==void 0&&(i.exitCode=t);var n=v.apply(this,arguments);return f(`exit`,i.exitCode,null),f(`afterexit`,i.exitCode,null),n}else return v.apply(this,arguments)}}}));export{r as t};
@@ -0,0 +1 @@
1
+ import{ar as e}from"./wait-until-CT1ve8qB.js";import{i as t}from"./attribute-changes-DZtQkszH.js";async function n(r){let i=globalThis[e];return i||t(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DaDcL9Zw.js";import{r as t,t as n}from"./token-util-Ldar52H7.js";var r=e(((e,r)=>{var i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of o(t))!s.call(e,c)&&c!==n&&i(e,c,{get:()=>t[c],enumerable:!(r=a(t,c))||r.enumerable});return e},u=e=>l(i({},`__esModule`,{value:!0}),e),d={};c(d,{refreshToken:()=>m}),r.exports=u(d);var f=t(),p=n();async function m(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,p.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,p.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new f.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,p.loadToken)(t);if(!r||(0,p.isExpired)((0,p.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=await(0,p.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});if(r=await(0,p.getVercelOidcToken)(i,t,n),!r)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,p.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(r.exports={refreshToken:m})}));export default r();export{};
1
+ import{t as e}from"./rolldown-runtime-8V8biNmG.js";import{r as t,t as n}from"./token-util-DjMgNdXS.js";var r=e(((e,r)=>{var i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of o(t))!s.call(e,c)&&c!==n&&i(e,c,{get:()=>t[c],enumerable:!(r=a(t,c))||r.enumerable});return e},u=e=>l(i({},`__esModule`,{value:!0}),e),d={};c(d,{refreshToken:()=>m}),r.exports=u(d);var f=t(),p=n();async function m(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,p.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,p.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new f.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,p.loadToken)(t);if(!r||(0,p.isExpired)((0,p.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=await(0,p.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});if(r=await(0,p.getVercelOidcToken)(i,t,n),!r)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,p.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(r.exports={refreshToken:m})}));export default r();export{};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,t as r}from"./token-util-DNwIAn_u.js";var i=e(((e,i)=>{var a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!c.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},d=e=>u(a({},`__esModule`,{value:!0}),e),f={};l(f,{refreshToken:()=>g}),i.exports=d(f);var p=n(),m=t(),h=r();async function g(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,h.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,h.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new m.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,h.loadToken)(t);if(!r||(0,h.isExpired)((0,h.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=(0,p.getGlobalPathConfig)();if((0,p.getLikelyEffectiveCredStorage)(i)===`keyring`)r=await(0,h.getVercelOidcTokenFromCli)(t,n);else{let i=await(0,h.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});r=await(0,h.getVercelOidcToken)(i,t,n)}if(!r)throw new m.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,h.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(i.exports={refreshToken:g})}));export default i();export{};
1
+ import{t as e}from"./rolldown-runtime-8V8biNmG.js";import{i as t,n,t as r}from"./token-util-BneBe0g5.js";var i=e(((e,i)=>{var a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!c.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},d=e=>u(a({},`__esModule`,{value:!0}),e),f={};l(f,{refreshToken:()=>g}),i.exports=d(f);var p=n(),m=t(),h=r();async function g(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,h.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,h.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new m.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,h.loadToken)(t);if(!r||(0,h.isExpired)((0,h.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=(0,p.getGlobalPathConfig)();if((0,p.getLikelyEffectiveCredStorage)(i)===`keyring`)r=await(0,h.getVercelOidcTokenFromCli)(t,n);else{let i=await(0,h.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});r=await(0,h.getVercelOidcToken)(i,t,n)}if(!r)throw new m.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,h.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(i.exports={refreshToken:g})}));export default i();export{};