eve 0.24.4 → 0.24.5
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.
- package/CHANGELOG.md +24 -0
- package/dist/src/channel/types.d.ts +13 -0
- package/dist/src/chunks/{use-eve-agent-Dwa2j1wE.js → use-eve-agent-8rerxDHY.js} +59 -6
- package/dist/src/chunks/{use-eve-agent-BP9FpQsJ.js → use-eve-agent-DhgdHzDG.js} +59 -6
- package/dist/src/cli/commands/build.d.ts +14 -0
- package/dist/src/cli/commands/build.js +1 -0
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/link.d.ts +6 -5
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/run.d.ts +3 -2
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/index.d.ts +1 -1
- package/dist/src/client/ndjson.js +1 -1
- package/dist/src/client/open-stream.d.ts +3 -2
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.d.ts +15 -3
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +8 -0
- package/dist/src/compiled/.vendor-stamp.json +5 -5
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +55 -0
- package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +9 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +70 -4
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +10 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +25 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +16 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/attributes.d.ts +7 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +16 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
- package/dist/src/compiled/_chunks/workflow/attribute-changes-DXbmITuI.js +20 -0
- package/dist/src/compiled/_chunks/workflow/{dist-DpDDcpTl.js → dist-BYo8Gno2.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-Blxnyb7-.js → dist-CSfKNxQW.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-DvvgYsRt.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-BdvQmV5a.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-DzxrwWTs.js +1 -0
- package/dist/src/evals/assertions/run.d.ts +3 -3
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/index.d.ts +2 -1
- package/dist/src/evals/match.d.ts +4 -0
- package/dist/src/evals/match.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/session.d.ts +10 -2
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +52 -2
- package/dist/src/execution/cancel-descendant-turns-step.d.ts +6 -0
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -0
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +6 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +0 -13
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +9 -0
- package/dist/src/execution/turn-cancellation-token.js +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +3 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +0 -1
- package/dist/src/harness/runtime-actions.d.ts +16 -12
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/internal/application/build-profile.d.ts +64 -0
- package/dist/src/internal/application/build-profile.js +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +10 -0
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/materialized-authored-modules.d.ts +2 -4
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +7 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.d.ts +3 -0
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
- package/dist/src/protocol/cancel-turn.d.ts +11 -0
- package/dist/src/protocol/cancel-turn.js +1 -0
- package/dist/src/protocol/routes.d.ts +10 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/eve.d.ts +2 -1
- package/dist/src/public/channels/eve.js +1 -1
- package/dist/src/public/channels/linear/api.d.ts +0 -1
- package/dist/src/public/channels/linear/api.js +17 -22
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +20 -10
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/resolve-eve-binary.d.ts +12 -0
- package/dist/src/public/next/resolve-eve-binary.js +1 -0
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/framework-tools/agent.d.ts +13 -0
- package/dist/src/runtime/framework-tools/agent.js +1 -0
- package/dist/src/runtime/framework-tools/index.d.ts +7 -2
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -1
- package/dist/src/setup/boxes/reconcile-host-framework-preset.d.ts +26 -0
- package/dist/src/setup/boxes/reconcile-host-framework-preset.js +1 -0
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/index.d.ts +1 -1
- package/dist/src/setup/scaffold/index.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +7 -1
- package/dist/src/setup/scaffold/update/channels.js +2 -2
- package/dist/src/setup/scaffold/update/connections.js +3 -3
- package/dist/src/setup/vercel-project-framework.d.ts +12 -0
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/eve.mdx +11 -1
- package/docs/concepts/default-harness.md +2 -0
- package/docs/concepts/sessions-runs-and-streaming.md +11 -0
- package/docs/evals/assertions.mdx +2 -2
- package/docs/evals/cases.mdx +31 -0
- package/docs/evals/overview.mdx +1 -1
- package/docs/evals/targets.mdx +2 -1
- package/docs/guides/client/continuations.mdx +2 -0
- package/docs/guides/client/streaming.mdx +17 -1
- package/docs/guides/frontend/overview.mdx +4 -2
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +2 -2
- package/docs/guides/frontend/use-eve-agent-vue.mdx +2 -2
- package/docs/guides/remote-agents.md +2 -0
- package/docs/reference/cli.md +15 -2
- package/docs/subagents.mdx +10 -0
- package/package.json +6 -6
- package/dist/src/compiled/_chunks/workflow/attribute-changes-MGTOG_uX.js +0 -20
- package/dist/src/compiled/_chunks/workflow/resume-hook-DHP5ql3-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-D8hv1ptT.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-uA9pS-PT.js +0 -1
package/docs/reference/cli.md
CHANGED
|
@@ -90,11 +90,24 @@ Run this first when something behaves unexpectedly. It confirms a file was disco
|
|
|
90
90
|
## `eve build`
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
eve build
|
|
93
|
+
eve build [--profile <path>] [--skip-sandbox-prewarm]
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Compiles and bundles in an invocation-owned directory under `.eve/builds/`, then publishes the completed host output and prints its path. Scratch workspaces are removed after success or failure.
|
|
97
97
|
|
|
98
|
+
| Flag | Type | Default | Description |
|
|
99
|
+
| ------------------------ | ------ | ------- | --------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `--profile <path>` | string | off | Best-effort versioned JSON report with build-phase timings and final output-size measurements |
|
|
101
|
+
| `--skip-sandbox-prewarm` | flag | off | Skip sandbox template prewarm for a Vercel build; the output might not be deployable |
|
|
102
|
+
|
|
103
|
+
Use a profile file to establish a repeatable baseline before changing the build pipeline:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
eve build --profile .eve/build-profiles/baseline.json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The report is attempted only after a successful build. It records total elapsed time, completed phase timings, and final regular-file totals for file count, raw bytes, and the sum of each file compressed with gzip. For Vercel output it also includes a subtotal for every real `.func` directory, so app and flow bundles can be compared separately. The profile path resolves from the app root and should be outside the published output directory; profile collection does not add a file to the deployment. If collection or writing fails, eve emits a warning but keeps the completed build successful.
|
|
110
|
+
|
|
98
111
|
Production builds do not write through the stable compiler, host, Nitro, or Workflow files owned by `eve dev`, so builds can run while a local dev server is active. A failed build leaves the last successful `.output/` and agent summary untouched. Concurrent completed builds serialize only the final publication window.
|
|
99
112
|
|
|
100
113
|
Useful stable artifacts written by inspection and development flows under `.eve/` include:
|
|
@@ -166,7 +179,7 @@ Local dev keeps immutable runtime source snapshots under `.eve/dev-runtime/snaps
|
|
|
166
179
|
eve link
|
|
167
180
|
```
|
|
168
181
|
|
|
169
|
-
Links the current directory to
|
|
182
|
+
Links the current directory to a Vercel project. After selecting a team, you can create a project named for the agent or link an existing project. The existing-project picker shows recent projects; type a project name and choose **Search for '<name>'** to search the rest of that team's projects. Vercel links the resolved project, eve verifies its project ID, and then pulls the project's environment so an AI Gateway credential (`VERCEL_OIDC_TOKEN` or `AI_GATEWAY_API_KEY`) lands in `.env.local`. Running it again re-links: the pickers always run, and the new choice wins. The command is interactive only; in CI, use `vercel link --project <name> --yes --non-interactive` instead. A running `eve dev` reloads env files automatically, so you don't need to restart after the pull.
|
|
170
183
|
|
|
171
184
|
## `eve deploy`
|
|
172
185
|
|
package/docs/subagents.mdx
CHANGED
|
@@ -22,6 +22,14 @@ The copy uses the root's instructions, connections, auth, and sandbox. It receiv
|
|
|
22
22
|
|
|
23
23
|
The parent transfers data to the child through the `message` input it gives the subagent. Do not include sensitive data in a subagent request unless that child and its inherited tools, connections, sandbox, and telemetry path are appropriate for that data.
|
|
24
24
|
|
|
25
|
+
To prevent the root session from delegating to a fresh copy of itself, disable `agent` the same way as any other built-in tool:
|
|
26
|
+
|
|
27
|
+
```ts title="agent/tools/agent.ts"
|
|
28
|
+
import { disableTool } from "eve/tools";
|
|
29
|
+
|
|
30
|
+
export default disableTool();
|
|
31
|
+
```
|
|
32
|
+
|
|
25
33
|
An authored root tool at `agent/tools/agent.ts` takes priority over the built-in.
|
|
26
34
|
|
|
27
35
|
## Declared subagents
|
|
@@ -98,6 +106,8 @@ Do not rely on subagent delegation by itself as an approval boundary. Put sensit
|
|
|
98
106
|
|
|
99
107
|
Each delegated subagent spins up its own child session and stream. The parent stream carries the control-plane events `subagent.called` and `subagent.completed`, plus interactive `input.requested`, `authorization.required`, and `authorization.completed` events proxied from descendants so the root channel can prompt the user. To follow the child's other progress, read `subagent.called.data.childSessionId` and subscribe at `GET /eve/v1/session/:childSessionId/stream`.
|
|
100
108
|
|
|
109
|
+
Cancelling a parent turn also requests cancellation of every active child it started, recursively through nested and remote subagents. Each affected session emits its own `turn.cancelled` → `session.waiting` boundary; the cancelled parent does not synthesize tool results or emit `subagent.completed`. A child that already completed or parked has no active turn and is a benign no-op.
|
|
110
|
+
|
|
101
111
|
Subagent model calls automatically retry classified transient provider failures, including overload errors delivered after a stream starts. eve makes at most three fresh model-call attempts, repeating only the current uncommitted call so completed earlier steps, tool results, and sandbox work remain available to the child. Other recoverable task errors fall back to Workflow's durable step retry from the last committed session snapshot. Exhausting the transient model-call attempts or the dedicated empty-response reissue returns one failed task result instead of stacking both retry budgets; terminal errors fail immediately.
|
|
102
112
|
|
|
103
113
|
## When to split
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -303,13 +303,13 @@
|
|
|
303
303
|
"@vercel/oidc": "3.5.0",
|
|
304
304
|
"@vercel/sandbox": "2.3.0",
|
|
305
305
|
"@vercel/sdk": "1.28.1",
|
|
306
|
-
"@workflow/core": "5.0.0-beta.
|
|
307
|
-
"@workflow/errors": "5.0.0-beta.
|
|
306
|
+
"@workflow/core": "5.0.0-beta.35",
|
|
307
|
+
"@workflow/errors": "5.0.0-beta.11",
|
|
308
308
|
"@workflow/serde": "5.0.0-beta.2",
|
|
309
309
|
"@workflow/utils": "5.0.0-beta.6",
|
|
310
|
-
"@workflow/world": "5.0.0-beta.
|
|
311
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
312
|
-
"@workflow/world-vercel": "5.0.0-beta.
|
|
310
|
+
"@workflow/world": "5.0.0-beta.21",
|
|
311
|
+
"@workflow/world-local": "5.0.0-beta.29",
|
|
312
|
+
"@workflow/world-vercel": "5.0.0-beta.31",
|
|
313
313
|
"ai": "^7.0.26",
|
|
314
314
|
"autoevals": "0.0.132",
|
|
315
315
|
"chat": "4.31.0",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./chunk-BHKSVoKr.js";import{c as n,d as r,f as i,l as a,p as o,s,u as c}from"./dist-CttsoN4D.js";import{E as l,T as u,a as d,c as f,d as p,f as m,i as h,s as g,w as _}from"./dist-DpDDcpTl.js";import{G as v,b as y,d as ee,g as te,o as ne,q as re,v as ie}from"./dist-Blxnyb7-.js";import{getStepFunction as ae}from"../../@workflow/core/private.js";import{types as oe}from"node:util";import{AsyncLocalStorage as se}from"node:async_hooks";function ce(e,t){let n=Error.captureStackTrace;n?.(e,t)}const le=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:e.env.NO_COLOR?!1:!!e.stdout?.isTTY:!1})(),b=(e,t)=>n=>le?`\x1b[${e}m${n}\x1b[${t}m`:n,x={bold:b(1,22),dim:b(2,22),italic:b(3,23),red:b(31,39),blue:b(34,39),cyan:b(36,39),yellow:b(33,39),magenta:b(35,39)},ue={info:x.blue,help:x.cyan,warn:x.yellow,error:x.red};function de(e){let t=Array.isArray(e)?e.join(`
|
|
2
|
-
`):e;return ue.info(`${x.bold(`hint:`)} ${t}`)}function fe(e){return ue.info(`${x.bold(`docs:`)} ${e}`)}function pe(e){return x.italic(`${x.dim("`")}${e}${x.dim("`")}`)}function S(e){return x.dim(e)}function me(e){return x.bold(e)}function he(e){return x.red(e)}function ge(e){return x.magenta(e)}function _e(e,t){let n=[e];return t.forEach((e,r)=>{let i=e.split(`
|
|
3
|
-
`),a=r===t.length-1,o=a?`╰▶ `:`├▶ `,s=a?` `:`│ `,c=i.map((e,t)=>`${t===0?o:s}${e}`);n.push(...c)}),n.join(`
|
|
4
|
-
`)}const ve=Symbol.for(`nodejs.util.inspect.custom`);function ye(e){return`code`in e?`\`${e.code}\``:`dim`in e?e.dim:e.text}function be(e){return`code`in e?pe(e.code):`dim`in e?S(e.dim):e.text}function xe(e){return e.type===`docs`?`docs: ${e.url}`:e.segments.map(ye).join(``)}function Se(e){return e.type===`docs`?fe(e.url):e.segments.map(be).join(``)}function Ce(e){let t=[e.title.map(ye).join(``)];return e.details.forEach((n,r)=>{let i=r===e.details.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;xe(n).split(`
|
|
5
|
-
`).forEach((e,n)=>t.push(`${n===0?a:o}${e}`))}),t.join(`
|
|
6
|
-
`)}function we(e){return _e(e.title.map(be).join(``),e.details.map(Se))}var Te=class extends Error{fatal=!0;#e;constructor(e){super(Ce(e)),this.#e=e}[ve](){let e=we(this.#e),t=this.message.split(`
|
|
7
|
-
`).length,n=(this.stack??``).split(`
|
|
8
|
-
`).slice(t).join(`
|
|
9
|
-
`);return n?`${this.name}: ${e}\n${n}`:`${this.name}: ${e}`}toString(){return`${this.name}: ${we(this.#e)}`}},Ee=class extends Te{name=`NotInWorkflowContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow function`}],details:[{type:`docs`,url:t}]})}},De=class extends Te{name=`NotInStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a step function`}],details:[{type:`docs`,url:t}]})}},Oe=class extends Te{name=`NotInWorkflowOrStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow or step function`}],details:[{type:`docs`,url:t}]})}};const ke=Symbol.for(`WORKFLOW_CONTEXT`);function Ae(){let e=globalThis[ke];if(!e){let e=new Oe(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`);throw ce(e,Ae),e}return e}var je=class extends Te{name=`UnavailableInWorkflowContextError`;constructor(e,t){let n=globalThis[ke]?.workflowName,r=(()=>{if(!n)return null;let e=n.match(/^(workflow\/|step\/)(.*)$/);return e?[{dim:e[1]},{text:e[2]}]:[{text:n}]})(),i=r?{type:`plain`,segments:[{text:`this call was made from the `},...r,{text:` workflow context.`}]}:{type:`plain`,segments:[{text:`this call was made from a workflow context.`}]};super({title:[{code:e},{text:` cannot be called from a workflow context.`}],details:[{type:`plain`,segments:[{text:`calling this in a workflow context can cause determinism issues.`}]},i,{type:`docs`,url:t}]})}};function Me(e,t,n){let r=new Ee(e,t);throw ce(r,n),r}function Ne(e,t,n){let r=new De(e,t);throw ce(r,n),r}function Pe(e,t,n){let r=new Oe(e,t);throw ce(r,n),r}function Fe(e,t,n){let r=new je(e,t);throw ce(r,n),r}var Ie=t(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Le=t(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),Re=t(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Ie(),a=Le();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),ze=t(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Be=t(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),C=t(((e,t)=>{let n=Le(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Ie(),{safeRe:a,t:o}=Re(),s=ze(),{compareIdentifiers:c}=Be();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Ve=t(((e,t)=>{let n=C();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),He=t(((e,t)=>{let n=Ve();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Ue=t(((e,t)=>{let n=Ve();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),We=t(((e,t)=>{let n=C();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Ge=t(((e,t)=>{let n=Ve();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Ke=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).major})),qe=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).minor})),Je=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).patch})),Ye=t(((e,t)=>{let n=Ve();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),w=t(((e,t)=>{let n=C();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Xe=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(t,e,r)})),Ze=t(((e,t)=>{let n=w();t.exports=(e,t)=>n(e,t,!0)})),Qe=t(((e,t)=>{let n=C();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),$e=t(((e,t)=>{let n=Qe();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),et=t(((e,t)=>{let n=Qe();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),tt=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)>0})),nt=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)<0})),rt=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)===0})),it=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)!==0})),at=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)>=0})),ot=t(((e,t)=>{let n=w();t.exports=(e,t,r)=>n(e,t,r)<=0})),st=t(((e,t)=>{let n=rt(),r=it(),i=tt(),a=at(),o=nt(),s=ot();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),ct=t(((e,t)=>{let n=C(),r=Ve(),{safeRe:i,t:a}=Re();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),lt=t(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),T=t(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,ce(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>se(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(le(this.set[t],e,this.options))return!0;return!1}};let r=new(lt()),i=ze(),a=ut(),o=Le(),s=C(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Re(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Ie(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ie(e,t),o(`xrange`,e),e=oe(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>re(e,t)).join(` `),re=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ie=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ae(e,t)).join(` `)),ae=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},oe=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),se=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),ce=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),le=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),ut=t(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=ze(),{safeRe:i,t:a}=Re(),o=st(),s=Le(),c=C(),l=T()})),dt=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),ft=t(((e,t)=>{let n=T();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),pt=t(((e,t)=>{let n=C(),r=T();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),mt=t(((e,t)=>{let n=C(),r=T();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),ht=t(((e,t)=>{let n=C(),r=T(),i=tt();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),gt=t(((e,t)=>{let n=T();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),_t=t(((e,t)=>{let n=C(),r=ut(),{ANY:i}=r,a=T(),o=dt(),s=tt(),c=nt(),l=ot(),u=at();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),vt=t(((e,t)=>{let n=_t();t.exports=(e,t,r)=>n(e,t,`>`,r)})),yt=t(((e,t)=>{let n=_t();t.exports=(e,t,r)=>n(e,t,`<`,r)})),bt=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),xt=t(((e,t)=>{let n=dt(),r=w();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),St=t(((e,t)=>{let n=T(),r=ut(),{ANY:i}=r,a=dt(),o=w(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Ct=t(((e,t)=>{let n=Re(),r=Ie(),i=C(),a=Be();t.exports={parse:Ve(),valid:He(),clean:Ue(),inc:We(),diff:Ge(),major:Ke(),minor:qe(),patch:Je(),prerelease:Ye(),compare:w(),rcompare:Xe(),compareLoose:Ze(),compareBuild:Qe(),sort:$e(),rsort:et(),gt:tt(),lt:nt(),eq:rt(),neq:it(),gte:at(),lte:ot(),cmp:st(),coerce:ct(),Comparator:ut(),Range:T(),satisfies:dt(),toComparators:ft(),maxSatisfying:pt(),minSatisfying:mt(),minVersion:ht(),validRange:gt(),outside:_t(),gtr:vt(),ltr:yt(),intersects:bt(),simplifyRange:xt(),subset:St(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}));function wt(e){return new Uint8Array(e).toBase64()}function Tt(e){return Uint8Array.fromBase64(e).buffer}function Et(e){return Buffer.from(e).toString(`base64`)}function Dt(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Ot(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r){let i=t.subarray(e,e+r);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function kt(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer}const At=typeof Uint8Array.fromBase64==`function`,jt=typeof process==`object`&&process.versions?.node!==void 0,Mt=At?wt:jt?Et:Ot,Nt=At?Tt:jt?Dt:kt,Pt=2**32-1,Ft=Pt-1;var E=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};function It(e){return e===null||typeof e!=`object`&&typeof e!=`function`}const Lt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Rt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===Lt}function zt(e){return Object.prototype.toString.call(e).slice(8,-1)}function Bt(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
|
|
10
|
-
`:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return e<` `?`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`:``}}function D(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=Bt(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function Vt(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}const Ht=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Ut(e){return Ht.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function Wt(e){return!(!Number.isInteger(e)||e<0||e>Ft)}function Gt(e){return!(!Number.isInteger(e)||e<0||e>Pt)}function Kt(e){if(e.length===0||e.length>1&&e.charCodeAt(0)===48)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return Wt(+e)}function qt(e){let t=Object.keys(e);for(var n=t.length-1;n>=0&&!Kt(t[n]);n--);return t.length=n+1,t}function Jt(e,t){return Yt(JSON.parse(e),t)}function Yt(e,t){if(typeof e==`number`)return a(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let n=e,r=Array(n.length),i=null;function a(e,o=!1){if(e===-1)return;if(e===-3)return NaN;if(e===-4)return 1/0;if(e===-5)return-1/0;if(e===-6)return-0;if(o||typeof e!=`number`)throw Error(`Invalid input`);if(e in r)return r[e];let s=n[e];if(!s||typeof s!=`object`)r[e]=s;else if(Array.isArray(s))if(typeof s[0]==`string`){let o=s[0],c=t&&Object.hasOwn(t,o)?t[o]:void 0;if(c){let t=s[1];if(typeof t!=`number`&&(t=n.push(s[1])-1),i??=new Set,i.has(t))throw Error(`Invalid circular reference`);return i.add(t),r[e]=c(a(t)),i.delete(t),r[e]}switch(o){case`Date`:r[e]=new Date(s[1]);break;case`Set`:let t=new Set;r[e]=t;for(let e=1;e<s.length;e+=1)t.add(a(s[e]));break;case`Map`:let i=new Map;r[e]=i;for(let e=1;e<s.length;e+=2)i.set(a(s[e]),a(s[e+1]));break;case`RegExp`:r[e]=new RegExp(s[1],s[2]);break;case`Object`:{let t=s[1];if(typeof n[t]==`object`&&n[t][0]!==`BigInt`)throw Error(`Invalid input`);r[e]=Object(a(t));break}case`BigInt`:r[e]=BigInt(s[1]);break;case`null`:let c=Object.create(null);r[e]=c;for(let e=1;e<s.length;e+=2){if(s[e]===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");c[s[e]]=a(s[e+1])}break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{if(n[s[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=globalThis[o],i=a(s[1]);r[e]=s[2]===void 0?new t(i):new t(i,s[2],s[3]);break}case`ArrayBuffer`:{let t=s[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);r[e]=Nt(t);break}case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:{let t=o.slice(9);r[e]=Temporal[t].from(s[1]);break}case`URL`:r[e]=new URL(s[1]);break;case`URLSearchParams`:r[e]=new URLSearchParams(s[1]);break;default:throw Error(`Unknown type ${o}`)}}else if(s[0]===-7){let t=s[1];if(!Gt(t))throw Error(`Invalid input`);let n=[];r[e]=n,n[Ft]=void 0,delete n[Ft];for(let e=2;e<s.length;e+=2){let r=s[e];if(!Wt(r)||r>=t)throw Error(`Invalid input`);n[r]=a(s[e+1])}n.length=t}else{let t=Array(s.length);r[e]=t;for(let e=0;e<s.length;e+=1){let n=s[e];n!==-2&&(t[e]=a(n))}}else{let t={};r[e]=t;for(let e of Object.keys(s)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");let n=s[e];t[e]=a(n)}}return r[e]}return a(0)}function O(e,t){let n=Xt(!1,e,t);return typeof n==`string`?n:`[${n.join(`,`)}]`}function Xt(e,t,n){let r=[],i=new Map,a=[];if(n)for(let e of Object.getOwnPropertyNames(n))a.push({key:e,fn:n[e]});let o=[],s=0;function c(n,l){if(n===void 0)return-1;if(Number.isNaN(n))return-3;if(n===1/0)return-4;if(n===-1/0)return-5;if(n===0&&1/n<0)return-6;if(i.has(n))return i.get(n);l??=s++,i.set(n,l);for(let{key:e,fn:t}of a){let i=t(n);if(i)return r[l]=`["${e}",${c(i)}]`,l}if(typeof n==`function`)throw new E(`Cannot stringify a function`,o,n,t);if(typeof n==`symbol`)throw new E(`Cannot stringify a Symbol primitive`,o,n,t);let u=``;if(It(n))u=Zt(n);else if(typeof n.then==`function`){if(!e)throw new E(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,o,n,t);u=Promise.resolve(n).then(e=>{let t=c(e,l);t<0&&(r[l]=t)})}else{let e=zt(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:u=`["Object",${c(n.valueOf())}]`;break;case`Date`:u=`["Date","${isNaN(n.getDate())?``:n.toISOString()}"]`;break;case`URL`:u=`["URL",${D(n.toString())}]`;break;case`URLSearchParams`:u=`["URLSearchParams",${D(n.toString())}]`;break;case`RegExp`:let{source:r,flags:i}=n;u=i?`["RegExp",${D(r)},"${i}"]`:`["RegExp",${D(r)}]`;break;case`Array`:{let e=!1;u=`[`;for(let t=0;t<n.length;t+=1)if(t>0&&(u+=`,`),Object.hasOwn(n,t))o.push(`[${t}]`),u+=c(n[t]),o.pop();else if(e)u+=-2;else{let t=qt(n),r=t.length,i=String(n.length).length;if((n.length-r)*3>4+i+r*(i+1)){u=`[-7,`+n.length;for(let e=0;e<t.length;e++){let r=t[e];o.push(`[${r}]`),u+=`,`+r+`,`+c(n[r]),o.pop()}break}else e=!0,u+=-2}u+=`]`;break}case`Set`:u=`["Set"`;for(let e of n)u+=`,${c(e)}`;u+=`]`;break;case`Map`:u=`["Map"`;for(let[e,t]of n)o.push(`.get(${It(e)?Zt(e):`...`})`),u+=`,${c(e)},${c(t)}`,o.pop();u+=`]`;break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{let t=n;u=`["`+e+`",`+c(t.buffer),t.byteLength!==t.buffer.byteLength&&(u+=`,${t.byteOffset},${t.length}`),u+=`]`;break}case`ArrayBuffer`:u=`["ArrayBuffer","${Mt(n)}"]`;break;case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:u=`["${e}",${D(n.toString())}]`;break;default:if(!Rt(n))throw new E(`Cannot stringify arbitrary non-POJOs`,o,n,t);if(Vt(n).length>0)throw new E(`Cannot stringify POJOs with symbolic keys`,o,n,t);if(Object.getPrototypeOf(n)===null){u=`["null"`;for(let e of Object.keys(n)){if(e===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,o,n,t);o.push(Ut(e)),u+=`,${D(e)},${c(n[e])}`,o.pop()}u+=`]`}else{u=`{`;let e=!1;for(let r of Object.keys(n)){if(r===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,o,n,t);e&&(u+=`,`),e=!0,o.push(Ut(r)),u+=`${D(r)}:${c(n[r])}`,o.pop()}u+=`}`}}}return r[l]=u,l}let l=c(t);return l<0?`${l}`:r}function Zt(e){let t=typeof e;return t===`string`?D(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var Qt=e(Ct(),1);async function $t(e,t=[`encrypt`,`decrypt`]){if(e.byteLength!==32)throw new _(`Encryption key must be exactly 32 bytes, got ${e.byteLength}`);return globalThis.crypto.subtle.importKey(`raw`,e,`AES-GCM`,!1,t)}async function en(e,t){let n=globalThis.crypto.getRandomValues(new Uint8Array(12)),r;try{r=await globalThis.crypto.subtle.encrypt({name:`AES-GCM`,iv:n,tagLength:128},e,t)}catch(e){throw new p(`AES-256-GCM encryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`encrypt`,byteLength:t.byteLength}})}let i=new Uint8Array(12+r.byteLength);return i.set(n,0),i.set(new Uint8Array(r),12),i}async function tn(e,t){if(t.byteLength<28)throw new p(`Encrypted data too short: expected at least 28 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let n=t.subarray(0,12),r=t.subarray(12),i;try{i=await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:n,tagLength:128},e,r)}catch(e){throw new p(`AES-256-GCM decryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return new Uint8Array(i)}const nn=()=>y(`WORKFLOW_LOCK_POLL_INTERVAL_MS`,10,{integer:!0,min:1});function k(){let e={...n(),pendingOps:0,doneResolved:!1,streamEnded:!1};return e.promise.catch(()=>{}),e}function rn(e){if(e.locked)return!1;let t;try{t=e.getWriter()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function an(e){if(e.locked)return!1;let t;try{t=e.getReader()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function on(e,t){if(t.writablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.writablePollingInterval=void 0;return}rn(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.writablePollingInterval=void 0)},nn());t.writablePollingInterval=n}function sn(e,t){if(t.readablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.readablePollingInterval=void 0;return}an(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.readablePollingInterval=void 0)},nn());t.readablePollingInterval=n}async function A(e,t,n){let r=e.getReader(),i=t.getWriter(),a;try{for(;;){if(n.streamEnded)return;let e=await Promise.race([r.read(),i.closed.then(()=>{throw new _(`Writable stream closed prematurely`)})]);if(n.streamEnded)return;if(e.done){n.streamEnded=!0,await i.close(),n.doneResolved||(n.doneResolved=!0,n.resolve());return}n.pendingOps++;try{await i.write(e.value)}finally{n.pendingOps--}}}catch(e){throw n.streamEnded=!0,a=e,n.doneResolved||(n.doneResolved=!0,n.reject(e)),e}finally{r.cancel(a).catch(()=>{}),r.releaseLock(),i.releaseLock()}}function cn(e){if(e.specVersion!==5)throw new _(`This Workflow runtime requires a World with matching spec version 5, but the configured World declares spec version ${e.specVersion??`none`}. Install a World package version compatible with the current Workflow runtime.`)}const j=Symbol.for(`@workflow/world//cache`),ln=Symbol.for(`@workflow/world//cachePromise`),un=Symbol.for(`@workflow/world//getWorldFn`);async function M(){let e=globalThis;if(e[j])return cn(e[j]),e[j];if(e[ln])return e[j]=await e[ln],cn(e[j]),e[j];let t=e[un];if(t){let e=await t();return cn(e),e}throw Error("Workflow world runtime was not initialized. Import from the host workflow entrypoints (`workflow`, `workflow/api`, or `workflow/runtime`) so @workflow/core/runtime/world-init can register getWorld before getWorldLazy() is used.")}const dn=Symbol.for(`workflow-serialize`),fn=Symbol.for(`workflow-deserialize`),pn=Symbol.for(`WORKFLOW_USE_STEP`),mn=Symbol.for(`WORKFLOW_SET_ATTRIBUTES`),hn=Symbol.for(`WORKFLOW_CREATE_HOOK`),gn=Symbol.for(`WORKFLOW_SLEEP`),_n=Symbol.for(`WORKFLOW_GET_STREAM_ID`),vn=Symbol.for(`WORKFLOW_STABLE_ULID`),N=Symbol.for(`WORKFLOW_STREAM_NAME`),yn=Symbol.for(`WORKFLOW_STREAM_TYPE`),bn=Symbol.for(`WORKFLOW_STREAM_FRAMING`),P=Symbol.for(`WORKFLOW_STREAM_SERVER_RUN_ID`),F=Symbol.for(`WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID`),xn=Symbol.for(`BODY_INIT`),Sn=Symbol.for(`WEBHOOK_RESPONSE_WRITABLE`),Cn=Symbol.for(`workflow-class-registry`),I=Symbol.for(`WORKFLOW_ABORT_STREAM_NAME`),L=Symbol.for(`WORKFLOW_ABORT_HOOK_TOKEN`),wn=Symbol.for(`WORKFLOW_ABORT_LISTENER_ATTACHED`),Tn=Symbol.for(`WORKFLOW_ABORT_READER_CANCEL`);function En(e=globalThis){let t=e,n=t[Cn];return n||(n=new Map,t[Cn]=n),n}const Dn=`class//workflow//Run`;function On(e,t,n=globalThis){En(n).set(e,t)}function kn(e,t){return En(t).get(e)}function An(){return{Class:e=>{if(typeof e!=`function`)return!1;let t=e.classId;return typeof t==`string`?{classId:t}:!1},Instance:e=>{if(typeof e!=`object`||!e)return!1;let t=e.constructor;if(!t||typeof t!=`function`)return!1;let n=t[dn];if(typeof n!=`function`)return!1;let r=t.classId;if(typeof r!=`string`)throw Error(`Class "${t.name}" with ${String(dn)} must have a static "classId" property.`);return{classId:r,data:n.call(t,e)}}}}function jn(e=globalThis){return{Class:t=>{let n=t.classId,r=kn(n,e);if(!r)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);return r},Instance:t=>{let n=t.classId,r=t.data,i=kn(n,e);if(!i)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);let a=i[fn];if(typeof a!=`function`)throw Error(`Class "${n}" does not have a static ${String(fn)} method.`);return a.call(i,r)}}}function Mn(e,t,n){if(n===0)return`.`;let r=new Uint8Array(e,t,n);return Buffer.from(r).toString(`base64`)}function R(e){return Mn(e.buffer,e.byteOffset,e.byteLength)}function z(e,t){let n=e===`.`?``:e,r=Buffer.from(n,`base64`),i=new t.ArrayBuffer(r.length);return new t.Uint8Array(i).set(r),i}function Nn(e){return JSON.parse(e)}function Pn(e){if(!oe.isNativeError(e))return!1;let t={message:e.message,stack:e.stack};return`cause`in e&&(t.cause=e.cause),t}function Fn(e,t){return!oe.isNativeError(t)||t.name!==e?!1:Pn(t)}function B(e){return t=>Fn(e,t)||!1}function In(e,t){return n=>{let r=n,i=`cause`in r?{cause:r.cause}:void 0,a=e[t],o=new a(r.message,i);return r.stack!==void 0&&(o.stack=r.stack),o}}function Ln(e=globalThis){return{ArrayBuffer:t=>t instanceof e.ArrayBuffer&&Mn(t,0,t.byteLength),BigInt:e=>typeof e==`bigint`&&e.toString(),BigInt64Array:t=>t instanceof e.BigInt64Array&&R(t),BigUint64Array:t=>t instanceof e.BigUint64Array&&R(t),Date:t=>t instanceof e.Date?Number.isNaN(t.getDate())?`.`:t.toISOString():!1,DOMException:e=>{if(typeof e!=`object`||!e||e.constructor?.name!==`DOMException`)return!1;let t=e,n={message:t.message,name:t.name,stack:t.stack};return`cause`in t&&(n.cause=t.cause),n},EvalError:B(`EvalError`),FatalError:B(`FatalError`),HookConflictError:e=>{let t=Fn(`HookConflictError`,e);if(!t)return!1;let n=e,r={...t,token:n.token};return n.conflictingRunId!==void 0&&(r.conflictingRunId=n.conflictingRunId),r},RangeError:B(`RangeError`),ReferenceError:B(`ReferenceError`),RetryableError:e=>{let t=Fn(`RetryableError`,e);if(!t)return!1;let n=e.retryAfter,r;if(n&&typeof n==`object`&&typeof n.getTime==`function`){let e=n.getTime();r=Number.isNaN(e)?Date.now()+1e3:e}else if(typeof n==`string`||typeof n==`number`){let e=new Date(n).getTime();r=Number.isNaN(e)?Date.now()+1e3:e}else r=Date.now()+1e3;return{...t,retryAfter:r}},RuntimeDecryptionError:e=>{let t=Fn(`RuntimeDecryptionError`,e);if(!t)return!1;let n={...t},r=e.context;return r!==void 0&&(n.context=r),n},SyntaxError:B(`SyntaxError`),TypeError:B(`TypeError`),URIError:B(`URIError`),AggregateError:e=>{let t=Fn(`AggregateError`,e);return t?{...t,errors:e.errors}:!1},Error:e=>{if(!oe.isNativeError(e))return!1;let t={name:e.name,message:e.message,stack:e.stack};return`cause`in e&&(t.cause=e.cause),t},Float32Array:t=>t instanceof e.Float32Array&&R(t),Float64Array:t=>t instanceof e.Float64Array&&R(t),Headers:t=>t instanceof e.Headers&&Array.from(t),Int8Array:t=>t instanceof e.Int8Array&&R(t),Int16Array:t=>t instanceof e.Int16Array&&R(t),Int32Array:t=>t instanceof e.Int32Array&&R(t),Map:t=>t instanceof e.Map&&Array.from(t),RegExp:t=>t instanceof e.RegExp&&{source:t.source,flags:t.flags},Set:t=>t instanceof e.Set&&Array.from(t),URL:t=>t instanceof e.URL&&t.href,WorkflowFunction:e=>{if(typeof e!=`function`)return!1;let t=e.workflowId;return typeof t==`string`?{workflowId:t}:!1},URLSearchParams:t=>t instanceof e.URLSearchParams?t.size===0?`.`:String(t):!1,Uint8Array:t=>t instanceof e.Uint8Array&&R(t),Uint8ClampedArray:t=>t instanceof e.Uint8ClampedArray&&R(t),Uint16Array:t=>t instanceof e.Uint16Array&&R(t),Uint32Array:t=>t instanceof e.Uint32Array&&R(t)}}function Rn(e=globalThis){return{ArrayBuffer:t=>z(t,e),BigInt:t=>e.BigInt(t),BigInt64Array:t=>new e.BigInt64Array(z(t,e)),BigUint64Array:t=>new e.BigUint64Array(z(t,e)),Date:t=>new e.Date(t),DOMException:t=>{let n=new e.DOMException(t.message,t.name);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},EvalError:In(e,`EvalError`),FatalError:t=>{let n=new(e[Symbol.for(`@workflow/errors//FatalError`)]??h)(t.message);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},HookConflictError:t=>{let n=new(e[Symbol.for(`@workflow/errors//HookConflictError`)]??d)(t.token,t.conflictingRunId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RangeError:In(e,`RangeError`),ReferenceError:In(e,`ReferenceError`),RetryableError:t=>{let n=new(e[Symbol.for(`@workflow/errors//RetryableError`)]??f)(t.message,{retryAfter:new e.Date(t.retryAfter)});return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RuntimeDecryptionError:t=>{let n=e[Symbol.for(`@workflow/errors//RuntimeDecryptionError`)]??p,r={};`cause`in t&&(r.cause=t.cause),t.context!==void 0&&(r.context=t.context);let i=new n(t.message,r);return t.stack!==void 0&&(i.stack=t.stack),i},SyntaxError:In(e,`SyntaxError`),TypeError:In(e,`TypeError`),URIError:In(e,`URIError`),AggregateError:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.AggregateError(t.errors,t.message,n);return t.stack!==void 0&&(r.stack=t.stack),r},Error:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.Error(t.message,n);return r.name=t.name,t.stack!==void 0&&(r.stack=t.stack),r},Float32Array:t=>new e.Float32Array(z(t,e)),Float64Array:t=>new e.Float64Array(z(t,e)),Headers:t=>new e.Headers(t),Int8Array:t=>new e.Int8Array(z(t,e)),Int16Array:t=>new e.Int16Array(z(t,e)),Int32Array:t=>new e.Int32Array(z(t,e)),Map:t=>new e.Map(t),RegExp:t=>new e.RegExp(t.source,t.flags),Set:t=>new e.Set(t),URL:t=>new e.URL(t),WorkflowFunction:e=>Object.assign(()=>{throw Error(`Workflow functions cannot be called directly. Use start() to invoke them.`)},{workflowId:e.workflowId}),URLSearchParams:t=>new e.URLSearchParams(t===`.`?``:t),Uint8Array:t=>new e.Uint8Array(z(t,e)),Uint8ClampedArray:t=>new e.Uint8ClampedArray(z(t,e)),Uint16Array:t=>new e.Uint16Array(z(t,e)),Uint32Array:t=>new e.Uint32Array(z(t,e))}}function zn(){return{StepFunction:e=>{if(typeof e!=`function`)return!1;let t=e.stepId;if(typeof t!=`string`)return!1;let n=e.__closureVarsFn,r=n&&typeof n==`function`?n():void 0,i=`__boundThis`in e,a=i?e.__boundThis:void 0,o=e.__boundArgs,s={stepId:t};return r!==void 0&&(s.closureVars=r),i&&(s.boundThis=a),Array.isArray(o)&&o.length>0&&(s.boundArgs=o),s}}}function Bn(e=globalThis){let t=e[Symbol.for(`WORKFLOW_USE_STEP`)];return{StepFunction:e=>{let n=e.stepId,r=e.closureVars;if(!t)throw Error(`WORKFLOW_USE_STEP not found on global object. Step functions cannot be deserialized outside workflow context.`);let i=r?t(n,()=>r):t(n);if(`boundThis`in e){let t=Array.isArray(e.boundArgs)?e.boundArgs:[];return i.bind(e.boundThis,...t)}return i}}}function Vn(e){return e.length===4&&/^[a-z0-9]{4}$/.test(e)}const V={DEVALUE_V1:`devl`,ENCRYPTED:`encr`,GZIP:`gzip`,ZSTD:`zstd`},Hn=new TextEncoder,Un=new TextDecoder;function Wn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...An(),...zn(),...Ln(t)};break;case`step`:r={...An(),...Ln(t)};break;case`client`:r={...An(),...Ln(t)};break}return n?{...r,...n}:r}function Gn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...jn(t),...Bn(t),...Rn(t)};break;case`step`:r={...jn(t),...Rn(t)};break;case`client`:r={...jn(t),...Rn(t),StepFunction:()=>{throw Error(`Step functions cannot be deserialized in client context.`)}};break}return n?{...r,...n}:r}const H={formatPrefix:V.DEVALUE_V1,serialize(e,t,n){let r=O(e,Wn(t,n?.global,n?.extraReducers));return Hn.encode(r)},deserialize(e,t,n){let r=Gn(t,n?.global,n?.extraRevivers);return Jt(Un.decode(e),r)},deserializeLegacy(e,t,n){return Yt(e,Gn(t,n?.global,n?.extraRevivers))}},Kn=new TextEncoder,qn=new TextDecoder;function U(e,t){if(!(t instanceof Uint8Array))return t;let n=Kn.encode(e),r=new Uint8Array(4+t.length);return r.set(n,0),r.set(t,4),r}function Jn(e){if(!(e instanceof Uint8Array)||e.length<4)return null;let t=e.subarray(0,4),n=qn.decode(t);return Vn(n)?n:null}function W(e){if(!(e instanceof Uint8Array))return{format:V.DEVALUE_V1,payload:new TextEncoder().encode(JSON.stringify(e))};if(e.length<4)throw Error(`Data too short to contain format prefix: expected at least 4 bytes, got ${e.length}`);let t=e.subarray(0,4),n=qn.decode(t);if(!Vn(n))throw Error(`Invalid format prefix: "${n}". Must be 4 characters of [a-z0-9].`);return{format:n,payload:e.subarray(4)}}function Yn(){try{return typeof process<`u`&&process.env?.WORKFLOW_DISABLE_COMPRESSION===`1`}catch{return!1}}function Xn(){try{let e=process.env?.WORKFLOW_COMPRESSION_CODEC;return e===`gzip`||e===`zstd`?e:void 0}catch{return}}function Zn(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function Qn(){let e=Zn();return typeof e?.zstdCompressSync==`function`&&typeof e?.zstdDecompressSync==`function`}function $n(){return typeof CompressionStream==`function`&&typeof DecompressionStream==`function`}async function er(e,t){let n=t.writable.getWriter(),r=n.write(e).then(()=>n.close());r.catch(()=>{});let i=[],a=0,o=t.readable.getReader();for(;;){let{done:e,value:t}=await o.read();if(e)break;i.push(t),a+=t.length}await r;let s=new Uint8Array(a),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function tr(e){return er(e,new CompressionStream(`gzip`))}async function nr(e){return er(e,new DecompressionStream(`gzip`))}function rr(e){let t=Zn(),n=t?.constants?.ZSTD_c_compressionLevel,r=n===void 0?void 0:{params:{[n]:3}};return new Uint8Array(t.zstdCompressSync(e,r))}function ir(e){let t=Zn();if(!t?.zstdDecompressSync)throw Error(`Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).`);return new Uint8Array(t.zstdDecompressSync(e))}function G(e,t,n,r){e&&(e.recorded=!0,e.compressed=t!==`none`,e.codec=t,e.uncompressedBytes=n,e.storedBytes=r)}function ar(){return Xn()===`gzip`?$n()?`gzip`:`none`:Qn()?`zstd`:$n()?`gzip`:`none`}async function or(e,t,n){if(!(e instanceof Uint8Array))return e;if(!t||e.length<1024||Yn())return G(n,`none`,e.length,e.length),e;let r=ar();if(r===`none`)return G(n,`none`,e.length,e.length),e;let i=r===`zstd`?rr(e):await tr(e),a=r===`zstd`?V.ZSTD:V.GZIP,o=4+i.length;return o>=e.length*.95?(G(n,`none`,e.length,e.length),e):(G(n,r,e.length,o),U(a,i))}async function sr(e,t){if(!(e instanceof Uint8Array))return e;let n=Jn(e);if(n===V.ZSTD){let{payload:n}=W(e),r=ir(n);return G(t,`zstd`,r.length,e.length),r}if(n===V.GZIP){if(!$n())throw Error(`Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.`);let{payload:n}=W(e),r=await nr(n);return G(t,`gzip`,r.length,e.length),r}return G(t,`none`,e.length,e.length),e}async function cr(e){return typeof e==`function`?e():e}async function lr(e,t){if(!t||!(e instanceof Uint8Array))return e;let n=await en(t,e);return U(V.ENCRYPTED,n)}async function ur(e,t){if(!(e instanceof Uint8Array))return e;let n=Jn(e);if(n===V.ENCRYPTED&&!t)throw new p(`Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:e.byteLength,formatPrefix:`encr`}});if(n!==V.ENCRYPTED)return e;let{payload:r}=W(e);try{return await tn(t,r)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=n),e}}function dr(e,t,n){let[r,...i]=t.split(`
|
|
11
|
-
`),a=i.join(`
|
|
12
|
-
`),o=fr(r??``,n),s=pr(a),c=[`${e} ${r??``}`];return o&&c.push(o),s&&c.push(s),c.join(`
|
|
13
|
-
`)}function fr(e,t){if(!t||Object.keys(t).length===0)return null;let n=new Set;n.add(`errorStack`),typeof t.errorMessage==`string`&&e.includes(t.errorMessage)&&n.add(`errorMessage`);let i=new Set([`workflowRunId`,`workflowName`,`stepId`,`stepName`,`errorAttribution`,`errorCode`,`errorName`,`errorMessage`,`errorStack`,`hint`,`attempt`,`retryCount`]),a=[],o=K(t,`errorName`),s=K(t,`errorAttribution`);if(o||s){let e=s?s===`sdk`?ge(`sdk error`):he(`user error`):``,t=o?me(o):``,n=e&&t?S(` · `):``;a.push(` ${e}${n}${t}`)}let l=K(t,`workflowRunId`),u=K(t,`workflowName`);l?a.push(gr(`run`,l,u,r)):u&&a.push(gr(`run`,null,u,r));let d=K(t,`stepId`),f=K(t,`stepName`);if((d||f)&&a.push(gr(`step`,d,f,c)),t.attempt!==void 0||t.retryCount!==void 0){let e=t.attempt,n=t.retryCount;e!==void 0&&n!==void 0?a.push(` ${hr(`retry`)} ${e} ${S(`attempts ·`)} ${n} ${S(`max retries`)}`):e!==void 0&&a.push(` ${hr(`retry`)} ${e} ${S(`attempts`)}`)}let p=K(t,`errorCode`);p&&p!==o&&a.push(` ${hr(`code`)} ${S(p)}`);let m=K(t,`hint`);m&&a.push(` ${de(m)}`);let h=Object.entries(t).filter(([e,t])=>!i.has(e)&&!n.has(e)&&t!=null).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of h)a.push(` ${hr(e)} ${_r(t)}`);return a.length?a.join(`
|
|
14
|
-
`):null}function pr(e){if(!e)return null;let t=e.split(`
|
|
15
|
-
`),n=[],r=0,i=0,a=0,o=()=>{r>0&&(n.push(S(` … ${r} more ${r===1?`frame`:`frames`} in framework internals`)),r=0)};for(let e of t){let t=e.trimStart().startsWith(`at `);if(t&&mr(e)){r++;continue}if(t&&i>=6){a++;continue}o(),n.push(e),t&&i++}return o(),a>0&&n.push(S(` … ${a} more ${a===1?`frame`:`frames`} (run \`pnpm wf inspect run <id>\` for the full stack)`)),n.join(`
|
|
16
|
-
`)}function mr(e){let t=e.trimStart();return t.startsWith(`at `)?!!(t.includes(`node:internal/`)||t.includes(`node_modules/.pnpm/`)||t.includes(`node_modules__pnpm_`)||t.includes(`_next_dist_`)||t.includes(`node_modules/next/`)||t.includes(`node_modules/@opentelemetry/`)||t.includes(`node_modules/vitest/`)||t.includes(`node_modules/@vitest/`)):!1}function K(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function hr(e){return S(e.padEnd(6))}function gr(e,t,n,r){let a=t||S(`—`),s=n&&(e===`run`?o(n):i(n))?`${S(`·`)} ${r(n)}`:``;return` ${hr(e)} ${a}${s?` `+s:``}`}function _r(e){if(typeof e==`string`)return e.includes(`
|
|
17
|
-
`)?e.split(`
|
|
18
|
-
`).map((e,t)=>t===0?e:` ${e}`).join(`
|
|
19
|
-
`):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var vr=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let n=[...e.values()],r=0,i=0,o=0,s=0,c=0,l=0;for(let e of n)e.type===`step`?r++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:i++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];r>0&&u.push(`${r} ${a(`step`,`steps`,r)}`),i>0&&u.push(`${i} ${a(`hook`,`hooks`,i)}`),o>0&&u.push(`${o} ${a(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${a(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${a(`disposal`,`disposals`,c)}`);let d=a(`has`,`have`,r+i+o+s+c),f=+(r>0)+ +(i>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:r>0?`run`:i>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.steps=n,this.globalThis=t,this.stepCount=r,this.hookCount=i,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function yr(){throw new _(`This API is not available inside a workflow function. Workflow functions run in a deterministic VM; move the call to a step function for full Node.js access.`)}function q(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const br=q(`workflow.name`),xr=q(`workflow.operation`),Sr=q(`workflow.run.id`),Cr=q(`workflow.run.status`),wr=q(`workflow.started_at`),Tr=q(`workflow.events.count`),Er=q(`workflow.arguments.count`),Dr=q(`workflow.result.type`),Or=q(`workflow.trace.propagated`),kr=q(`workflow.trace.mode`),Ar=q(`workflow.turbo`),jr=q(`workflow.error.name`),Mr=q(`workflow.error.message`),Nr=q(`workflow.error.code`),Pr=q(`workflow.steps.created`),Fr=q(`workflow.hooks.created`),Ir=q(`workflow.waits.created`),Lr=q(`workflow.inline_ownership.owned_recovery_steps`),Rr=q(`workflow.inline_ownership.backstop_wakes_armed`),zr=q(`workflow.route.type`),Br=q(`workflow.route.handler_cached`),Vr=q(`workflow.route.invocation_count`),Hr=q(`workflow.route.entrypoint_age_ms`),Ur=q(`workflow.route.module_body_init_ms`),Wr=q(`step.name`),Gr=q(`step.id`),Kr=q(`step.attempt`),qr=q(`step.status`),Jr=q(`step.max_retries`),Yr=q(`step.ttfs_ms`),Xr=q(`step.stso_ms`),Zr=q(`step.latency_optimizations`),Qr=q(`step.skipped`),$r=q(`step.skip_reason`),ei=q(`step.arguments.count`),ti=q(`step.result.type`),ni=q(`step.error.name`),ri=q(`step.error.message`),ii=q(`step.fatal_error`),ai=q(`step.retry.exhausted`),oi=q(`step.retry.timeout_seconds`),si=q(`step.retry.will_retry`),ci=q(`messaging.system`),li=q(`messaging.destination.name`),ui=q(`messaging.message.id`),di=q(`messaging.operation.type`),fi=q(`workflow.queue.overhead_ms`),pi=q(`deployment.id`),mi=q(`workflow.hook.token`),hi=q(`workflow.hook.id`),gi=q(`workflow.hook.found`),_i=q(`workflow.suspension.state`),vi=q(`workflow.suspension.hook_count`),yi=q(`workflow.suspension.step_count`),bi=q(`workflow.suspension.wait_count`),xi=q(`http.request.method`),Si=q(`http.route`),Ci=q(`http.response.status_code`),wi=q(`error.type`),Ti=q(`workflow.events.pages_loaded`),Ei=q(`workflow.queue.deserialize_time_ms`),Di=q(`workflow.queue.execution_time_ms`),Oi=q(`workflow.queue.serialize_time_ms`),ki=q(`workflow.serialization.operation`),Ai=q(`workflow.serialization.compressed`),ji=q(`workflow.serialization.codec`),Mi=q(`workflow.serialization.uncompressed_bytes`),Ni=q(`workflow.serialization.stored_bytes`),Pi=q(`workflow.serialization.compression_ratio`),Fi=q(`peer.service`),Ii=q(`rpc.system`),Li=q(`rpc.service`),Ri=q(`rpc.method`),zi=q(`error.retryable`),Bi=q(`error.category`),Vi=new Set;function Hi(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!Vi.has(e)&&(Vi.add(e),Y.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function Ui(e){return e!==void 0&&Object.keys(e).length>0}function Wi(e,t){return e===`linked`&&Ui(t)?Promise.resolve(t):Ki()}async function Gi(e,t){if(e!==`linked`)return aa();let n=await oa(Ui(t)?t:void 0);return n?[n]:void 0}async function Ki(){let e=await J.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function qi(e){let t=await J.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Ji(e,t){if(!e)return t();let n=await J.value;if(!n)return t();let r=await qi(e);return r?n.context.with(r,async()=>await t()):t()}const J=s(async()=>{try{return await import(`./src-CQuMexnO.js`).then(t=>e(t.t(),1))}catch{return Y.info(`OpenTelemetry not available, tracing will be disabled`),null}}),Yi=s(async()=>{let e=await J.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return Zi(e,t),t});let Xi=!1;function Zi(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(Xi||!n)){Xi=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.core`);console.warn(`[workflow:otel-diag] core`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] core failed:`,e instanceof Error?e.message:e)}}}async function Qi(e,...t){let[n,r]=await Promise.all([Yi.value,J.value]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),ea(t,r,e),t}finally{e.end()}})}async function $i(e,t,n){let r=await Yi.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function ea(e,t,n){!e||!vr.is(e)||(n.setStatus({code:t.SpanStatusCode.OK}),n.setAttributes({..._i(`suspended`),...yi(e.stepCount),...vi(e.hookCount),...bi(e.waitCount)}))}async function ta(e){let[t,n]=await Promise.all([qi(e),J.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function na(){return await ia(e=>e.trace.getActiveSpan())}async function ra(e){return ia(t=>t.SpanKind[e])}async function ia(e){let t=await J.value;if(t)return await e(t)}function aa(){return ia(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function oa(e){if(!e)return;let[t,n]=await Promise.all([ta(e),J.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function sa(e,t){let n=await J.value;if(!n)return t();let r=n.propagation.createBaggage({"workflow.run_id":{value:e.workflowRunId},"workflow.name":{value:e.workflowName}}),i=n.propagation.setBaggage(n.context.active(),r);return n.context.with(i,()=>t())}function ca(e,t){if(!t)return!1;let n=!1;for(let r of t.split(`,`)){let t=r.trim();if(!t)continue;let i=t.startsWith(`-`),a=i?t.slice(1):t;RegExp(`^${a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`)}$`).test(e)&&(n=!i)}return n}function la(e,t={}){let n=r=>{let i=n=>t.debugNamespace??`workflow:${e}:${n}`,a=t=>{let n=i(t);return(i,a)=>{let o=Object.keys(r).length>0,s=a&&Object.keys(a).length>0,c=o||s?{...r,...a??{}}:void 0;(t===`error`||t===`warn`)&&(t===`error`?console.error:console.warn)(dr(`[workflow-sdk]`,i,c)),ca(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),na().then(n=>{n?.addEvent(`${t}.${e}`,{message:i,...c})}).catch(()=>{}))}};return{debug:a(`debug`),info:a(`info`),warn:a(`warn`),error:a(`error`),child:e=>n({...r,...e}),forRun:(e,t,i)=>n({...r,workflowRunId:e,...t===void 0?{}:{workflowName:t},...i??{}})}};return n({})}const ua=la(`step`),Y=la(`runtime`),da=la(`webhook`),fa=la(`events`);la(`adapter`),la(`build`,{debugNamespace:`workflow:build`});function pa(e){if(p.is(e))throw e}function X(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof E&&t.path&&(r+=` at path "${t.path}"`);let i=`Ensure you're ${n} workflow serializable types. Check the serialization docs to see what's serializable: https://workflow-sdk.dev/docs/foundations/serialization`;return t instanceof E&&t.value!==void 0&&Y.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function ma(e,t,n){try{let r=H.serialize(e,`client`,n);return lr(await or(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){pa(e);let{message:t,hint:n}=X(`client value`,e);throw new m(t,{hint:n,cause:e})}}async function ha(e,t,n){let r=await sr(await ur(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ga(e,t,n){try{let r=H.serialize(e,`step`,n);return lr(await or(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){pa(e);let{message:t,hint:n}=X(`step value`,e);throw new m(t,{hint:n,cause:e})}}async function _a(e,t,n){let r=await sr(await ur(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function va(e,t){if(!(e instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=W(e);if(n===V.DEVALUE_V1)return H.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const ya=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),ba=globalThis[ya]??(globalThis[ya]=new se);function xa(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${a(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${a(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${a(`timer`,`timers`,n)}`);let i=[];e>0&&i.push(`steps are completed`),t>0&&i.push(`hooks are received`),n>0&&i.push(`timers have elapsed`);let o=i.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function Sa(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function Ca(e){return`strm_${e}_system_abort`}function wa(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return Ca(e.slice(5))}const Ta=()=>y(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10});var Z;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Z||={});var Ea=class{eventIndex;events=[];callbacks=[];onConsumedEvent;onUnconsumedEvent;getPromiseQueue;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;constructor(e,t){this.events=e,this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.getPromiseQueue=t.getPromiseQueue}subscribe(e){this.callbacks.push(e),this.pendingUnconsumedCheck!==null&&(this.unconsumedCheckVersion++,this.pendingUnconsumedCheck=null,this.pendingUnconsumedTimeout!==null&&(clearTimeout(this.pendingUnconsumedTimeout),this.pendingUnconsumedTimeout=null)),process.nextTick(this.consume)}notifyConsumedEvent(e){if(this.onConsumedEvent)try{this.onConsumedEvent(e)}catch(e){fa.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){let e=this.events[this.eventIndex]??null;if(!this.consumeOne(e)){this.handleUnconsumed(e);return}}};consumeOne(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Z.NotConsumed;try{r=n(e)}catch(e){fa.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Z.Consumed&&r!==Z.Finished))return e!==null&&this.notifyConsumedEvent(e),this.eventIndex++,r===Z.Finished&&this.callbacks.splice(t,1),e!==null}return!1}handleUnconsumed(e){if(e!==null){let t=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===t&&(this.pendingUnconsumedCheck=null,this.onUnconsumedEvent(e))},Ta())})}}},Da=class{aborted=!1;reason=void 0;[I];[L];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[I]=e,this[L]=t}_setAborted(e){if(!this.aborted){this.aborted=!0,this.reason=e,this.#t&&this.#t.call(this);for(let e of this.#e)e();this.#e=[]}}addEventListener(e,t){if(e===`abort`){if(this.aborted){t();return}this.#e.push(t)}}removeEventListener(e,t){e===`abort`&&(this.#e=this.#e.filter(e=>e!==t))}throwIfAborted(){if(this.aborted)throw this.reason??new DOMException(`The operation was aborted.`,`AbortError`)}};function Oa(e){return class{signal;[I];[L];constructor(){let t=e.generateUlid(),n=Ca(t),r=`abrt_${t}`;this[I]=n,this[L]=r,this.signal=new Da(n,r);let i=`hook_${e.generateUlid()}`;e.invocationsQueue.set(i,{type:`hook`,correlationId:i,token:r,isWebhook:!1,isSystem:!0}),e.eventsConsumer.subscribe(t=>{if(!t||t.correlationId!==i)return Z.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[L])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new g(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[L]}"`,{eventId:t.eventId}))}),Z.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Z.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload;return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let t;try{if(n!==void 0)try{let r=await To(n,e.runId,e.encryptionKey,e.globalThis);r&&typeof r==`object`&&`reason`in r&&(t=r.reason)}catch{}this.signal._setAborted(t)}finally{e.pendingDeliveries--}}),e.invocationsQueue.delete(i),Z.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Z.Finished):Z.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[L]){n.abortRequested=!0,n.abortReason=t;break}}}}}function ka(){return{abort(e){let t=new Da(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new Da(``,``),n=Array.from(e);for(let e of n)if(e.aborted)return t._setAborted(e.reason),t;let r=[],i=()=>{for(let{signal:e,listener:t}of r)e.removeEventListener&&e.removeEventListener(`abort`,t);r.length=0};for(let e of n){if(!e.addEventListener)continue;let n=()=>{t.aborted||(t._setAborted(e.reason),i())};r.push({signal:e,listener:n}),e.addEventListener(`abort`,n)}return t},timeout(){throw Error(`AbortSignal.timeout() is not supported in workflow functions. Use sleep() with an AbortController instead. See: /docs/errors/abort-signal-timeout-in-workflow`)}}}const Aa=ne();function ja(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Ma(e){return pa(e),e instanceof m&&e.cause!==void 0||e instanceof _&&e.cause!==void 0?e.cause:e}async function Q(e,t){if(e.recorded)try{let n=await na();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...ki(t),...Ai(e.compressed??!1),...ji(e.codec??`none`),...Mi(r),...Ni(i),...e.compressed&&r>0?Pi(1-i/r):{}})}catch{}}function Na(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0};return new TransformStream({async transform(i,a){try{r.resolved||=(r.key=await cr(t),!0);let o=O(i,e),s=n.encode(o),c=U(V.DEVALUE_V1,s);if(r.key){let e=await en(r.key,c);c=U(V.ENCRYPTED,e)}let l=new Uint8Array(4+c.length);new DataView(l.buffer).setUint32(0,c.length,!1),l.set(c,4),a.enqueue(l)}catch(e){if(p.is(e)){a.error(e);return}let{message:t,hint:n}=X(`stream chunk`,e);a.error(new m(t,{hint:n,cause:e}))}}})}function Pa(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0};function a(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function o(a){for(i.resolved||=(i.key=await cr(t),!0);r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let o=r.slice(4,4+t);r=r.slice(4+t);let{format:s,payload:c}=W(o);if(s===V.ENCRYPTED){if(!i.key){a.error(new p(`Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:c.byteLength,formatPrefix:`encr`}}));return}let e;try{e=await tn(i.key,c)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=s),e}({format:s,payload:c}=W(e))}if(s===V.DEVALUE_V1){let t=n.decode(c);a.enqueue(Jt(t,e))}}}return new TransformStream({async transform(t,i){if(r.length===0&&t.length>=4){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!1);if(e>0&&e<1e8){a(t),await o(i);return}}else if(r.length>0){a(t),await o(i);return}let s=n.decode(t).split(`
|
|
20
|
-
`);for(let t of s)t.length>0&&i.enqueue(Jt(t,e))},async flush(e){r.length>0&&await o(e)}})}const Fa=1e8;function Ia(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Fa){t.error(new _(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Fa}). Split the data into smaller chunks before writing.`,{slug:`serialization-failed`}));return}let n=new Uint8Array(4+e.length);new DataView(n.buffer).setUint32(0,e.length,!1),n.set(e,4),t.enqueue(n)}})}function La(){let e=new Uint8Array;function t(t){let n=new Uint8Array(e.length+t.length);n.set(e,0),n.set(t,e.length),e=n}return new TransformStream({transform(n,r){for(n.length>0&&t(n);e.length>=4;){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(t>Fa){r.error(new _(`Byte-stream frame length ${t} exceeds maximum (${Fa}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;r.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new _(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Ra(e,t,n,r,i){(async()=>{await $i(`workflow.stream.read`,e,{kind:await ra(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read`,"workflow.stream.read.ttfc_ms":Date.now()-e,...typeof i==`number`?{"workflow.stream.read.connect_ms":i}:{},...typeof r==`number`?{"workflow.stream.start_index":r}:{}}})})()}function za(e,t,n,r,i,a){(async()=>{await $i(`workflow.stream.read.complete`,e,{kind:await ra(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read_complete`,"workflow.stream.read.total_ms":Date.now()-e,"workflow.stream.read.chunks":r,"workflow.stream.read.bytes":i,...typeof a==`number`?{"workflow.stream.read.reconnects":a}:{}}})})()}var Ba=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new _(`"name" is required, got "${t}"`);let r,i=!1,a,o=0,s=0;super({type:`bytes`,pull:async c=>{let l=this.#e;if(!l){r===void 0&&(r=Date.now());let i=await M(),o=Date.now(),s=await i.streams.get(e,t,n);a=Date.now()-o,l=this.#e=s.getReader()}if(!l){c.error(Error(`Failed to get reader`));return}let u=await l.read();u.done?(this.#e=void 0,r!==void 0&&za(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,Ra(r,e,t,n,a)),o+=1,s+=u.value.byteLength,c.enqueue(u.value))},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const Va=()=>y(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Ha=()=>y(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function Ua(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array,u,d,f=!1,p=0,m=0;async function h(){let o=await M(),s=r?i+a:n,l=Date.now(),u=await o.streams.get(e,t,s);d===void 0&&(d=Date.now()-l),c=u.getReader()}async function g(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=Va(),n=Ha();for(;;){if(o++,s++,o>e)throw Error(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(s>n)throw Error(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{await h();return}catch{}}}return new ReadableStream({pull:async i=>{for(u===void 0&&(u=Date.now());;){if(!c)try{await h()}catch(e){i.error(e);return}let _;try{_=await c.read()}catch(e){if(!r){i.error(e);return}try{await g()}catch(e){i.error(e);return}continue}if(_.done||!_.value){c=void 0,u!==void 0&&za(u,e,t,p,m,s),i.close();return}let v=_.value;if(v.length>0){let e=new Uint8Array(l.length+v.length);e.set(l,0),e.set(v,l.length),l=e}let y=!1;for(;l.length>=4;){let r=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<r)break;i.enqueue(l.slice(0,r)),l=l.slice(r),a++,p++,m+=r,!f&&u!==void 0&&(f=!0,Ra(u,e,t,n,d)),y=!0}if(y){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const Wa=()=>y(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function Ga(e,t,n,r,i,a,o){(async()=>{await $i(`workflow.stream.flush`,e,{kind:await ra(`CLIENT`),attributes:{"workflow.run.id":n,"workflow.stream.name":r,"workflow.stream.operation":`flush`,"workflow.stream.flush.buffer_dwell_ms":t-e,"workflow.stream.flush.chunks":i,"workflow.stream.flush.bytes":a,"workflow.stream.write.chunk_rtt":o}})})()}function Ka(e,t,n){(async()=>{await $i(`workflow.stream.close`,e,{kind:await ra(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var $=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new _(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new _(`"name" is required, got "${t}"`);let r=M(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,u,d=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=u;u=void 0;let c=Date.now(),d=await r;l===void 0&&(l=d.streamFlushIntervalMs??Wa());let f=Date.now();try{if(typeof d.streams.writeMulti==`function`&&n.length>1)await d.streams.writeMulti(e,t,n);else for(let r of n)await d.streams.write(e,t,r)}catch(e){throw i!==void 0&&(u=u===void 0?i:Math.min(u,i)),e}i!==void 0&&Ga(i,c,e,t,n.length,n.reduce((e,t)=>e+t.byteLength,0),Date.now()-f),o=[]},f=[],p=()=>{s||=setTimeout(()=>{s=null;let e=f;f=[],c=d().then(()=>{for(let t of e)t.resolve()},t=>{for(let n of e)n.reject(t)})},l??Wa())};super({async write(e){u===void 0&&(u=Date.now()),c&&=(await c,null),o.push(e),p(),await new Promise((e,t)=>{f.push({resolve:e,reject:t})})},async close(){c&&=(await c,null),await d(),await a();let n=await r,i=Date.now();await n.streams.close(e,t),Ka(i,e,t)},abort(e){s&&=(clearTimeout(s),null),o=[];let t=f;f=[];let n=e??Error(`Stream aborted`);for(let e of t)e.reject(n)}})}};function qa(e=globalThis){return{...An(),...zn(),...Ln(e),Request:t=>{if(!(t instanceof e.Request))return!1;let n={method:t.method,url:t.url,headers:t.headers,body:t.body,duplex:t.duplex},r=t[Sn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[I])&&(n.signal=t.signal),n},Response:t=>t instanceof e.Response?{type:t.type,url:t.url,status:t.status,statusText:t.statusText,headers:t.headers,body:t.body,redirected:t.redirected}:!1}}function Ja(e,t,n,r,i,a){let o=t[I],s=t[L];if(!o){let e=(n[vn]||Aa)();o=Ca(e),s=`abrt_${e}`,t[I]=o,t[L]=s,t.signal&&(t.signal[I]=o,t.signal[L]=s)}return Xa(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function Ya(e,t){let n=t[I]??t.signal?.[I],r=t[L]??t.signal?.[L];if(!n)throw Error(`AbortController/AbortSignal stream name is not set`);return{streamName:n,hookToken:r,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function Xa(e,t,n,r,i){e.aborted||e[wn]||(e[wn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await cr(r),a=await vo({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function Za(e=globalThis,t,n,r,i=!1,a){return{...qa(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[vn]||Aa)()}`,c=ja(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Ia()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Na(Za(e,t,n,r,i,a),r)).pipeTo(l));let u={name:s};return c&&(u.type=c),c===`bytes`&&i&&(u.framing=`framed-v1`),u},WritableStream:r=>{if(!(r instanceof e.WritableStream))return!1;let i=r[N],a=r[P];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[F];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[vn]||Aa)()}`,s=new Ba(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Ja(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Ja(i,i,e,t,n,r)}}function Qa(e=globalThis){return{...qa(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[xn];if(n!==void 0)return{bodyInit:n};let r=t[N];if(!r)throw new _("ReadableStream `name` is not set");let i={name:r},a=t[yn];a&&(i.type=a);let o=t[bn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[N];if(!n)throw new _("WritableStream `name` is not set");let r={name:n},i=t[P];typeof i==`string`&&(r.runId=i);let a=t[F];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[I]??n.signal?.[I],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:Ya(t.signal,n)},AbortSignal:t=>{let n=t?.[I],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:Ya(t,t)}}}function $a(e=globalThis,t,n,r,i=!1,a){return{...qa(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[N],c=o[yn],l=o[bn];if(!s){s=`strm_${(e[vn]||Aa)()}`,c=ja(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Ia()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Na($a(e,t,n,r,i,a),r)).pipeTo(u))}let u={name:s};return c&&(u.type=c),l&&(u.framing=l),u},WritableStream:i=>{if(!(i instanceof e.WritableStream))return!1;let a=i[N],o=i[P];a||(a=`strm_${(e[vn]||Aa)()}`,t.push(new Ba(n,a).pipeThrough(Pa(uo(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[F];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Ja(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Ja(i,i,e,t,n,r)}}function eo(...e){let t=new WeakSet;function n(e){let t=e[Tn];t&&!t.signal.aborted&&t.abort()}function r(e){if(!(typeof e!=`object`||!e)&&!t.has(e)){if(t.add(e),e instanceof AbortController){n(e),n(e.signal);return}if(e instanceof AbortSignal){n(e);return}if(Array.isArray(e)){for(let t of e)r(t);return}if(e instanceof Map){for(let t of e.values())r(t);return}if(e instanceof Set){for(let t of e)r(t);return}if(typeof Request<`u`&&e instanceof Request){r(e.signal);return}for(let t of Object.values(e))r(t)}}for(let t of e)r(t)}function to(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Ba(t,n).getReader(),a=await Promise.race([r.read(),new Promise(e=>{if(i.signal.aborted){e({value:void 0,done:!0});return}i.signal.addEventListener(`abort`,()=>e({value:void 0,done:!0}),{once:!0})})]);if(a.value&&!a.done){try{r.releaseLock()}catch{}try{let n=ba.getStore(),r=await yo(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function no(e,t,n){let r=e,i=e.signal;r[I]=t.streamName,r[L]=t.hookToken,i[I]=t.streamName,i[L]=t.hookToken,n&&(r[Tn]=n,i[Tn]=n)}function ro(e,t){let n=e,r=t;n[I]!==void 0&&(r[I]=n[I]),n[L]!==void 0&&(r[L]=n[L]),n[Tn]!==void 0&&(r[Tn]=n[Tn])}function io(e,t,n){let r=new AbortController;e.aborted?(no(r,e),r.abort(e.reason)):e.streamName?no(r,e,to(r,n,e.streamName,t)):no(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=ba.getStore();if(n&&(n.ops.push((async()=>{try{let r=await vo({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new $(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-DHP5ql3-.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function ao(e,t,n){let r=new AbortController;return e.aborted?(no(r,e),r.abort(e.reason)):e.streamName?no(r,e,to(r,n,e.streamName,t)):no(r,e),r.signal}function oo(e=globalThis){return{...jn(e),...Rn(e)}}async function so(e,t){let n=await M();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await $t(r,[`encrypt`]):void 0}function co(e=globalThis,t,n,r){return{...oo(e),StepFunction:()=>{throw new m(`Step functions cannot be deserialized in client context. Step functions should not be returned from workflows.`,{hint:`A step function reference reached the client. Return a serializable value (e.g. the step result) instead of the step itself.`})},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(n.signal=t.signal);let r=new e.Request(t.url,n);return t.signal&&ro(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:i=>{if(`bodyInit`in i){let t=i.bodyInit;return new e.Response(t).body}if(i.type===`bytes`){let r=new Ba(n,i.name,i.startIndex),a=k();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?La():new e.TransformStream;return A(r,s,a).catch(()=>{}),sn(o,a),o}else{let a=Ua(n,i.name,i.startIndex),o=Pa(co(e,t,n,r),r),s=k();return t.push(s.promise),A(a,o.writable,s).catch(()=>{}),sn(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:so(a,i.deploymentId),s=Na(Za(e,t,a,o),o),c=new $(a,i.name),l=k();return t.push(l.promise),A(s.readable,c,l).catch(()=>{}),on(s.writable,l),Object.defineProperty(s.writable,N,{value:i.name,writable:!1}),Object.defineProperty(s.writable,P,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,F,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>io(e,t,n),AbortSignal:e=>ao(e,t,n)}}function lo(e=globalThis){return{...oo(e),...Bn(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[Sn]=n,delete t.responseWritable,t.respondWith=()=>{throw new m("`respondWith()` must be called from within a step function.",{hint:'Move the `respondWith(...)` call inside a `"use step"` function — it cannot be invoked from a workflow context.'})}),t},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Response:t=>(Object.setPrototypeOf(t,e.Response.prototype),t),ReadableStream:t=>`bodyInit`in t?Object.create(e.ReadableStream.prototype,{[xn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[N]:{value:t.name,writable:!1},[yn]:{value:t.type,writable:!1},[bn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[N]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[P]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[F]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new Da(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[I]:e.streamName,[L]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new Da(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function uo(e=globalThis,t,n,r,i){return{...oo(e),StepFunction:e=>{let t=e.stepId,n=e.closureVars,r=`boundThis`in e,i=r?e.boundThis:void 0,a=Array.isArray(e.boundArgs)?e.boundArgs:[],o=ae(t);if(!o)throw new m(`Step function "${t}" not found. Make sure the step function is registered.`,{hint:`Make sure the step file is included in your build (i.e. it is listed in the workflow manifest), and that the SWC plugin is configured for the file.`});if(!n&&!r&&a.length===0)return o;let s=function(...e){let t=r?i:this,s=a.length>0?[...a,...e]:e;if(n){let e=ba.getStore();if(!e)throw new _(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return ba.run(r,()=>o.apply(t,s))}return o.apply(t,s)};return Object.defineProperty(s,"name",{value:o.name}),Object.defineProperty(s,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),o.maxRetries!==void 0&&(s.maxRetries=o.maxRetries),s},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n=t.responseWritable,r={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(r.signal=t.signal);let i=new e.Request(t.url,r);return t.signal&&ro(t.signal,i.signal),n&&(i.respondWith=async e=>{let t=n.getWriter();await t.write(e),await t.close()}),i},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:a=>{if(`bodyInit`in a){let t=a.bodyInit;return new e.Response(t).body}let o=new Ba(n,a.name);if(a.type===`bytes`){let n=k();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?La():new e.TransformStream;return A(o,i,n).catch(()=>{}),sn(r,n),r}else{let a=Pa(uo(e,t,n,r,i),r),s=k();return t.push(s.promise),A(o,a.writable,s).catch(()=>{}),sn(a.readable,s),a.readable}},WritableStream:a=>{let o=typeof a.runId==`string`?a.runId:n,s=typeof a.deploymentId==`string`?a.deploymentId:o===n?i:void 0,c=o===n?r:so(o,s),l=Na($a(e,t,o,c),c),u=new $(o,a.name),d=k();return t.push(d.promise),A(l.readable,u,d).catch(()=>{}),on(l.writable,d),Object.defineProperty(l.writable,N,{value:a.name,writable:!1}),Object.defineProperty(l.writable,P,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,F,{value:s,writable:!1}),l.writable},AbortController:e=>io(e,t,n),AbortSignal:e=>ao(e,t,n)}}async function fo(e,t){return await lr(e,t)}async function po(e,t){return ur(e,t)}async function mo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return Nn(O(e,Za(i,r,t,n,o)));try{let a={},c=await ma(e,n,{global:i,extraReducers:Do(Za(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=Ma(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new m(n,{hint:r,cause:t})}}async function ho(e,t,n,r=globalThis,i={}){let a={},o=await sr(await po(e,n),a);return await Q(a,`deserialize`),va(o,{global:r,extraRevivers:{...Oo(lo(r)),...i}})}async function go(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Nn(O(e,Qa(r)));try{let t={},i=await ga(e,n,{global:r,extraReducers:Do(Qa(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ma(e),{message:n,hint:r}=X(`workflow return value`,t);throw new m(n,{hint:r,cause:t})}}async function _o(e,t,n,r=[],i=globalThis,a={}){let o={},s=await ha(e,n,{global:i,extraRevivers:{...Oo(co(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function vo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Nn(O(e,Qa(r)));try{let t={},i=await ga(e,n,{global:r,extraReducers:Do(Qa(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ma(e),{message:n,hint:r}=X(`step arguments`,t);throw new m(n,{hint:r,cause:t})}}async function yo(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await _a(e,n,{global:i,extraRevivers:{...Oo(uo(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function bo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return Nn(O(e,$a(i,r,t,n,o,c)));try{let a={},l=await ga(e,n,{global:i,extraReducers:Do($a(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=Ma(e),{message:n,hint:r}=X(`step return value`,t);throw new m(n,{hint:r,cause:t})}}async function xo(e,t,n,r=[],i=globalThis,a=!1){try{let o=O(e,$a(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await fo(await or(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=Ma(e),{message:n,hint:r}=X(`step error`,t);throw new m(n,{hint:r,cause:t})}}async function So(e,t,n,r=globalThis,i={}){let a={},o=await sr(await po(e,n),a);if(await Q(a,`deserialize`),!(o instanceof Uint8Array))return Yt(o,{...lo(r),...i});let{format:s,payload:c}=W(o);if(s===V.DEVALUE_V1)return Jt(new TextDecoder().decode(c),{...lo(r),...i});throw Error(`Unsupported serialization format: ${s}`)}async function Co(e,t,n,r=globalThis,i=!1){try{let t=O(e,Qa(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await fo(await or(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=Ma(e),{message:n,hint:r}=X(`run error`,t);throw new m(n,{hint:r,cause:t})}}async function wo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await sr(await po(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Yt(s,{...co(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return Jt(new TextDecoder().decode(l),{...co(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function To(e,t,n,r=globalThis,i={}){let a={},o=await sr(await po(e,n),a);return await Q(a,`deserialize`),va(o,{global:r,extraRevivers:{...Oo(lo(r)),...i}})}const Eo=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Do(e){let t={};for(let n of Eo)n in e&&(t[n]=e[n]);return t}function Oo(e){let t={};for(let n of Eo)n in e&&(t[n]=e[n]);return t}const ko=[{format:V.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:V.GZIP,minVersion:`5.0.0-beta.18`},{format:V.ZSTD,minVersion:`5.0.0-beta.18`}],Ao=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],jo=new Set([V.DEVALUE_V1]);function Mo(e){if(!e||!Qt.default.valid(e))return{supportedFormats:jo,framedByteStreams:!1};let t=new Set(jo);for(let{format:n,minVersion:r}of ko)Qt.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of Ao)Qt.default.gte(e,r)&&(n[t]=!0);return n}const No=`5.0.0-beta.34`,Po=/^[a-zA-Z0-9_\-./@]+$/;function Fo(e,t){if(!Po.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${te(`workflow`,ie(t))}${e}`}const Io=ne();function Lo(e){return`__health_check__${e}`}function Ro(e){let t=ee.safeParse(e);if(t.success)return t.data}function zo(e){return`wrun_hc_${e}`}async function Bo(e,t,n){let r=await M(),i=Lo(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:No,timestamp:Date.now()}),o=zo(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function Vo(e,t){let n;return Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(Error(`Operation timed out after ${t}ms`)),t)})]).finally(()=>clearTimeout(n))}async function Ho(e,t){let n=[],r=!1,i=!1;for(;!r&&!i;){let a=e.read(),o=new Promise(e=>setTimeout(()=>{i=!0,e({done:!0,value:void 0})},t)),s=await Promise.race([a,o]);r=s.done,s.value&&n.push(s.value)}return{chunks:n,timedOut:i}}function Uo(e){if(e.length===0)return null;let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=new TextDecoder().decode(n),a;try{a=JSON.parse(i)}catch{return i.length>0?{healthy:!0}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),s}async function Wo(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??Io(),a=Lo(i),o=`${te(t,ie(n?.namespace))}health_check`,s=Date.now();try{for(await e.queue(o,{__healthCheck:!0,correlationId:i},{specVersion:1,deploymentId:n?.deploymentId});Date.now()-s<r;)try{let t=r-(Date.now()-s),n=(await Vo(e.streams.get(zo(i),a),t)).getReader(),{chunks:o,timedOut:c}=await Ho(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=Uo(o);if(l)return{...l,latencyMs:Date.now()-s};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${r}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function Go(e,t){return new u(`Event pagination ${t} for workflow run "${e}".`,{code:l.WORLD_CONTRACT_ERROR})}function Ko(e,t,n){if(t){if(n.has(t))throw Go(e,`did not advance`);n.add(t)}}function qo(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function Jo(e,t,n,r){if(t){if(n===null)throw Go(e,`returned more pages without a cursor`);if(r.has(n))throw Go(e,`repeated a cursor`)}}function Yo(e,t,n){return t!==null&&!n&&u.is(e)&&e.status===400}async function Xo(e,t){let n=t!==void 0;return Qi(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...Sr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await M(),f=Date.now();for(;c;){let t=Date.now(),r=s;Ko(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(Yo(t,r,u)){Y.warn(`Event cursor was rejected; retrying with a full event reload.`,{workflowRunId:e}),i.length=0,a.clear(),o.clear(),s=null,u=!0;continue}throw t}qo(i,a,f.data),c=f.hasMore,Jo(e,c,f.cursor,o),s=f.cursor??s,l++,Y.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return Y.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...Tr(i.length),...Ti(l)}),{events:i,cursor:s}})}const Zo={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function Qo(e,t){return async n=>{let r=new URL(n.url);return r.searchParams.has(`__health`)?n.method===`OPTIONS`?new Response(null,{status:204,headers:Zo}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:No}),{status:200,headers:{"Content-Type":`application/json`,...Zo}}):await e(n)}}async function $o(e,...t){let n=t[0];await Qi(`queue.publish`,{attributes:{...ci(`vercel-queue`),...li(n),...di(`publish`),...Fi(`vercel-queue`),...Ii(`vercel-queue`),...Li(`vqs`),...Ri(`publish`)},kind:await ra(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(ui(r))})}function es(e){if(e.requestedAt)try{return fi(Date.now()-e.requestedAt.getTime())}catch{return}}function ts(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await $t(n):void 0})(),n)}function ns(t){import(`./functions-BCMO8vbf.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function rs(e,t){ns(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function is(e){let t=e();return ns(t.catch(()=>{})),t}function as(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new h(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{re(n,{allowReservedAttributes:r})}catch(e){throw e instanceof v?new h(e.message):e}return n}export{pi as $,Pr as $t,ho as A,Ne as An,Qr as At,Y as B,Fr as Bt,Za as C,M as Cn,Jr as Ct,yo as D,on as Dn,oi as Dt,wo as E,A as En,ai as Et,Ea as F,Ae as Fn,Rr as Ft,ra as G,Hr as Gt,da as H,xr as Ht,xa as I,De as In,Nr as It,oa as J,Ur as Jt,Hi as K,Br as Kt,wa as L,Ee as Ln,Mr as Lt,ka as M,Pe as Mn,Xr as Mt,Oa as N,Fe as Nn,Yr as Nt,So as O,$t as On,si as Ot,Z as P,ke as Pn,Er as Pt,sa as Q,wr as Qt,Sa as R,Oe as Rn,jr as Rt,go as S,dn as Sn,Zr as St,Na as T,k as Tn,ti as Tt,Gi as U,Lr as Ut,ua as V,br as Vt,Wi as W,Dr as Wt,Qi as X,Sr as Xt,Ki as Y,zr as Yt,Ji as Z,Cr as Zt,Co as _,_n,Kr as _t,Fo as a,vr as an,mi as at,bo as b,pn as bn,ii as bt,Xo as c,On as cn,Si as ct,$o as d,vn as dn,di as dt,kr as en,Bi as et,Qo as f,N as fn,ci as ft,eo as g,hn as gn,ei as gt,$ as h,Sn as hn,Oi as ht,es as i,yr as in,hi as it,_o as j,Me as jn,qr as jt,To as k,je as kn,$r as kt,ts as l,kn as ln,li as lt,Mo as m,P as mn,Di as mt,rs as n,Ar as nn,wi as nt,Bo as o,V as on,xi as ot,No as p,F as pn,Ei as pt,Ui as q,Vr as qt,is as r,Ir as rn,gi as rt,Wo as s,Dn as sn,Ci as st,as as t,Or as tn,zi as tt,Ro as u,xn as un,ui as ut,vo as v,mn as vn,ri as vt,co as w,cn as wn,Wr as wt,mo as x,fn as xn,Gr as xt,xo as y,gn as yn,ni as yt,ba as z,Tr as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-BHKSVoKr.js";import{n as t,o as n,w as r}from"./dist-DpDDcpTl.js";import{B as i,Cn as a,D as o,J as s,On as c,Vt as l,X as u,Xt as d,a as f,at as p,b as m,hn as h,it as g,m as _,n as v,on as y,r as b,rt as x}from"./attribute-changes-MGTOG_uX.js";import{s as S}from"./dist-Blxnyb7-.js";var C=e({getHookByToken:()=>T,resumeHook:()=>E,resumeWebhook:()=>D});async function w(e){let t=await a(),n=await t.hooks.getByToken(e),r=await t.runs.get(n.runId),i=await t.getEncryptionKeyForRun?.(r),s=i?await c(i):void 0;return n.metadata!==void 0&&(n.metadata=await o(n.metadata,n.runId,s)),{hook:n,run:r,encryptionKey:s}}async function T(e){let{hook:t}=await w(e);return t}async function E(e,t,n){return await b(()=>u(`hook.resume`,async r=>{let o=await a();try{let a,u,h;if(typeof e==`string`){let t=await w(e);a=t.hook,u=t.run,h=n??t.encryptionKey}else if(a=e,u=await o.runs.get(a.runId),n)h=n;else{let e=await o.getEncryptionKeyForRun?.(u);h=e?await c(e):void 0}r?.setAttributes({...p(a.token),...g(a.hookId),...d(a.runId)});let b=u.executionContext?.workflowCoreVersion,x=_(typeof b==`string`?b:void 0);x.supportedFormats.has(y.ENCRYPTED)||(h=void 0);let C=(u.specVersion??0)>=5&&x.supportedFormats.has(y.GZIP),T=[],E=S(a.specVersion),D=await m(t,a.runId,h,T,globalThis,E,x.framedByteStreams,C);v(Promise.all(T),e=>{e!==void 0&&i.warn(`Background flush of hook payload ops failed`,{workflowRunId:a.runId,hookId:a.hookId,error:e instanceof Error?e.message:String(e)})}),await o.events.create(a.runId,{eventType:`hook_received`,specVersion:5,correlationId:a.hookId,eventData:{...E?{}:{token:a.token},payload:D}},{v1Compat:E}),r?.setAttributes({...l(u.workflowName)});let O=await s(u.executionContext?.traceCarrier);return O&&r?.addLink?.(O),await o.queue(f(u.workflowName),{runId:a.runId,traceCarrier:u.executionContext?.traceCarrier??void 0},{deploymentId:u.deploymentId,specVersion:u.specVersion??1}),a}catch(t){throw r?.setAttributes({...p(typeof e==`string`?e:e.token),...x(!1)}),t}}))}async function D(e,i){let{hook:a,encryptionKey:o}=await w(e);if(a.isWebhook===!1)throw new n(e);let s,c;if(a.metadata&&typeof a.metadata==`object`&&`respondWith`in a.metadata)if(a.metadata.respondWith===`manual`){let{readable:e,writable:t}=new TransformStream;c=e,i[h]=t}else if(a.metadata.respondWith instanceof Response)s=a.metadata.respondWith;else throw new r(`Invalid \`respondWith\` value: ${a.metadata.respondWith}`,{slug:t.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else s=new Response(null,{status:202});if(await E(a,i,o),c){let e=c.getReader(),t=await e.read();t.value&&(s=t.value),e.cancel()}if(!s)throw new r(`Workflow run did not send a response`,{slug:t.WEBHOOK_RESPONSE_NOT_SENT});return s}export{C as i,E as n,D as r,T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./dist-CttsoN4D.js";import{C as t,E as n,S as r,T as i,b as a,d as o,m as s,p as c,r as l,s as u,t as d,w as f,x as p,y as m}from"./dist-DpDDcpTl.js";import{$ as h,A as g,B as _,Cn as v,E as y,Ht as b,On as x,Pt as S,R as C,Sn as w,Vt as T,X as E,Xt as D,Y as O,Zt as k,a as A,j,m as M,n as N,on as ee,p as P,r as F,s as I,t as L,w as R,wn as z,x as B,xn as V}from"./attribute-changes-MGTOG_uX.js";import{i as H,o as U,s as W}from"./dist-Blxnyb7-.js";const G=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,n.WORLD_CONTRACT_ERROR]),K=new Set([`TRANSPORT`,`TIMEOUT`]),q=[f.is,c.is,m.is,o.is];function J(e){if(!i.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&G.has(e.code)||e.message.startsWith(`Failed to parse response body for `)||e.message.startsWith(`Schema validation failed for `)||typeof t==`object`&&!!t&&`name`in t&&t.name===`ZodError`}function Y(e){return s.is(e)?!0:i.is(e)?e.status!==void 0&&e.status>=500?!0:e.code!==void 0&&K.has(e.code):!1}function te(e){if(u.is(e))return n.REPLAY_DIVERGENCE;if(d.is(e))return n.CORRUPTED_EVENT_LOG;if(J(e)||Y(e))return n.WORLD_CONTRACT_ERROR;for(let t of q)if(t(e))return n.RUNTIME_ERROR;return n.USER_ERROR}const ne=U();let X=!1;async function Z(t,n,r){"use step";return await F(()=>{let i=t?.workflowId;if(!i)throw new f(`'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 E(`workflow.start ${e(i)}`,async e=>{e?.setAttributes({...T(i),...b(`start`)});let t=[],a=r??{};Array.isArray(n)?t=n:typeof n==`object`&&(a=n),e?.setAttributes({...S(t.length)});let o=a.world??await v();z(o);let s=await o.getDeploymentId(),c=a.deploymentId??s;c===`latest`&&(o.resolveLatestDeploymentId?c=await o.resolveLatestDeploymentId():(X||(X=!0,_.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:s})),c=s));let u,d;if(c===s)u=!0,d=!0;else if(typeof o.streams?.get!=`function`)u=!1,d=!1;else{let e=M((await I(o,`workflow`,{deploymentId:c,timeout:2e3,namespace:a.namespace}).catch(()=>void 0))?.workflowCoreVersion);u=e.framedByteStreams,d=e.supportedFormats.has(ee.GZIP)}let p=[],m=`wrun_${o.createRunId?o.createRunId(a):ne()}`,g=await O(),y=a.specVersion??o.specVersion,C=W(y),w=a.allowReservedAttributes===!0,E;if(a.attributes&&Object.keys(a.attributes).length>0){if(y<4)throw new f(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(a.attributes))if(typeof t!=`string`)throw new f(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=L(a.attributes,{allowReservedAttributes:w});E=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let j=E?{attributes:E,...w?{allowReservedAttributes:!0}:{}}:{};if(a.replayedFromRunId!==void 0&&!H.safeParse(a.replayedFromRunId).success)throw new f(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(a.replayedFromRunId).slice(0,64))}.`);let F=await o.getEncryptionKeyForRun?.(m,{...a,deploymentId:c}),R=F?await x(F):void 0,V=await B(t,m,R,p,globalThis,C,u,d&&y>=5),U={traceCarrier:g,workflowCoreVersion:P,features:{encryption:!!R},...a.replayedFromRunId?{replayedFromRunId:a.replayedFromRunId}:{}},[G,K]=await Promise.allSettled([o.events.create(m,{eventType:`run_created`,specVersion:y,eventData:{deploymentId:c,workflowName:i,input:V,executionContext:U,...j}},{v1Compat:C}),o.queue(A(i,a.namespace),{runId:m,traceCarrier:g,...y>=3?{runInput:{input:V,deploymentId:c,workflowName:i,specVersion:y,executionContext:U,...j}}:{}},{deploymentId:c,specVersion:y,...a.region===void 0?{}:{region:a.region}})]);if(K.status===`rejected`)throw K.reason;let q=!1;if(G.status===`rejected`){let e=G.reason;if(!l.is(e))if(Y(e))q=!0,_.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:m,error:e.message});else throw e}else{let e=G.value;if(!e.run)throw new f(`Missing 'run' in server response for 'run_created' event`);if(!C&&e.run.runId!==m)throw new f(`Server returned different runId than requested: expected ${m}, got ${e.run.runId}`)}return N(Promise.all(p),e=>{_.warn(`Background flush of workflow argument streams failed`,{workflowRunId:m,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...D(m),...h(c),...G.status===`fulfilled`&&G.value.run?k(G.value.run.status):{}}),new $(m,{resilientStart:q})})})}const re=e=>Array.isArray(e)?e:[e];async function ie(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await x(i):void 0,o=re(await g(r.input,t,a,globalThis)),s=n.specVersion??r.specVersion??1,c=n.deploymentId??r.deploymentId;return(await Z({workflowId:r.workflowName},o,{deploymentId:c,world:e,specVersion:s,replayedFromRunId:t,namespace:n.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function ae(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=W(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 oe(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(A(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 Q(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=W(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{limit:1e3,...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)),u=s.filter(e=>!c.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);u=u.filter(t=>t.correlationId&&e.has(t.correlationId))}let d=[],f=0;for(let n of u){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}),f++}catch(e){l.is(e)?f++:d.push(e instanceof Error?e:Error(String(e)))}}if(f>0&&await e.queue(A(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),d.length>0)throw AggregateError(d,`Failed to complete ${d.length}/${u.length} pending wait(s) for run ${t}`);return{stoppedCount:f}}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 se(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 ce(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})}}var $=class e{static[w](e){return{runId:e.runId,resilientStart:e.#r}}static[V](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=v(),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 x(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return Q(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(t.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,a=C(this.runId,i),o=this.#a(),s=R(n,t,this.runId,o).ReadableStream({name:a,startIndex:r}),c=this.#t,l=this.runId;return Object.assign(s,{getTailIndex:async()=>(await(await c).streams.getInfo(l,a)).tailIndex})}async#o(){let e=await this.#t,n=0,i=this.#r?3:0,o=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await j(t.output,this.runId,e)}if(t.status===`cancelled`)throw new a(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await y(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new p(this.runId,n,{errorCode:t.errorCode})}throw new r(this.runId,t.status)}catch(e){if(r.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(t.is(e)&&n<i){let e=o[n];n++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function le(e){return new $(e)}export{se as a,Q as c,Y as d,J as f,ce as i,Z as l,le as n,ie as o,ae as r,oe as s,$ as t,te as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jn as e,yn as t}from"./attribute-changes-MGTOG_uX.js";async function n(r){let i=globalThis[t];return i||e(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|