eve 0.51.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/src/channel/session.d.ts +2 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +4 -1
- package/dist/src/chunks/{use-eve-agent-C3vUG5g2.js → use-eve-agent-3DZuvuWE.js} +17 -6
- package/dist/src/chunks/{use-eve-agent-B4xN7-fK.js → use-eve-agent-D7apPojZ.js} +17 -6
- package/dist/src/cli/agent-command.js +1 -1
- package/dist/src/cli/commands/agent-instructions.d.ts +3 -1
- package/dist/src/cli/commands/agent-instructions.js +1 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init-repl.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/commands/preconditions.js +1 -1
- package/dist/src/cli/commands/register-project-commands.d.ts +1 -1
- package/dist/src/cli/commands/register-project-commands.js +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/boot-progress.d.ts +3 -0
- package/dist/src/cli/dev/boot-progress.js +1 -0
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +3 -1
- package/dist/src/cli/dev/tui/setup-commands.js +1 -1
- package/dist/src/cli/run.d.ts +4 -0
- package/dist/src/cli/run.js +3 -3
- package/dist/src/cli/telemetry/command.d.ts +9 -0
- package/dist/src/cli/telemetry/command.js +1 -0
- package/dist/src/cli/telemetry/flush.d.ts +2 -0
- package/dist/src/cli/telemetry/flush.js +1 -0
- package/dist/src/cli/telemetry/identity.d.ts +13 -0
- package/dist/src/cli/telemetry/identity.js +1 -0
- package/dist/src/cli/telemetry/index.d.ts +25 -0
- package/dist/src/cli/telemetry/index.js +3 -0
- package/dist/src/cli/telemetry/preference.d.ts +9 -0
- package/dist/src/cli/telemetry/preference.js +1 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-controls.d.ts +3 -0
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session.d.ts +4 -1
- package/dist/src/client/types.d.ts +3 -2
- package/dist/src/compiled/.vendor-stamp.json +11 -11
- package/dist/src/compiled/@clack/core/LICENSE +9 -0
- package/dist/src/compiled/@clack/core/index.d.ts +363 -0
- package/dist/src/compiled/@clack/core/index.js +20 -0
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +1 -0
- package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +34 -92
- package/dist/src/compiled/@vercel/sandbox/api-client/base-client.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/index.d.ts +1 -1
- package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +13 -29
- package/dist/src/compiled/@vercel/sandbox/constants.d.ts +11 -1
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -3
- package/dist/src/compiled/@vercel/sandbox/index.js +9 -9
- package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +5 -6
- package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +79 -67
- package/dist/src/compiled/@vercel/sandbox/session.d.ts +5 -3
- package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-client.d.ts +86 -1
- package/dist/src/compiled/@vercel/sandbox-drives/api-client/index.d.ts +2 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/validators.d.ts +26 -1
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/constants.d.ts +2 -2
- package/dist/src/compiled/@vercel/{sandbox → sandbox-drives}/drive.d.ts +10 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/index.d.ts +3 -2
- package/dist/src/compiled/@vercel/sandbox-drives/index.js +9 -0
- package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox.d.ts +35 -6
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.d.ts +2 -4
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +9 -7
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +13 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +54 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +24 -2
- 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/error-codes.d.ts +2 -0
- package/dist/src/compiled/@workflow/errors/index.d.ts +19 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +46 -2
- package/dist/src/compiled/@workflow/world/events.d.ts +26 -1
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/runs.d.ts +2 -2
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/node/{auth-BSKyPAEP.js → auth-Bx1Aoyfo.js} +1 -1
- package/dist/src/compiled/_chunks/node/{auth-YpKlwhP1.js → auth-CA8ZMfB8.js} +1 -1
- package/dist/src/compiled/_chunks/node/esm-CE0tAvRh.js +7 -0
- package/dist/src/compiled/_chunks/node/version-BC6t2Txc.js +1 -0
- package/dist/src/compiled/_chunks/node/version-DSQqVZ5T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BwAadFfB.js → attribute-changes-03lzo29R.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-BIdMK5N8.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DMQ3CtWt.js +3 -0
- package/dist/src/compiled/_chunks/workflow/frames-Boesh7kU.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{private-CZFMABEf.js → private-CKx3PkSS.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-BToMtPbH.js → resume-hook-C6eL-S_T.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/run-BV0S6Zc2.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Bh3jP9ii.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-l-cwfJvm.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js} +1 -1
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +38 -20
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-channel.js +1 -1
- package/dist/src/compiler/normalize-schedule.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/discover/extensions.d.ts +2 -0
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/filesystem.d.ts +1 -0
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/discover/project.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/session-cleanup.d.ts +7 -0
- package/dist/src/evals/session-cleanup.js +1 -0
- package/dist/src/evals/session.d.ts +4 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +1 -0
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/execution/activity-collector.js +1 -1
- package/dist/src/execution/activity-work.d.ts +8 -0
- package/dist/src/execution/activity-work.js +1 -1
- package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +6 -0
- package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -0
- package/dist/src/execution/continuation-conflict-step.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +2 -2
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -1
- package/dist/src/execution/inline-turn.d.ts +4 -2
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +0 -3
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/run-session-limits.d.ts +5 -5
- package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-sdk-types.d.ts +4 -4
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/session-activity-projection.js +1 -1
- package/dist/src/execution/session-activity.js +1 -1
- package/dist/src/execution/session-timeout-workflow.js +1 -1
- package/dist/src/execution/session.d.ts +1 -0
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +19 -1
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +2 -0
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +2 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +26 -0
- package/dist/src/execution/tasks/parent/subagent-task-projection.js +1 -0
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.d.ts +3 -0
- package/dist/src/execution/tools/sleep-workflow.js +1 -0
- package/dist/src/execution/tools/sleep.d.ts +1 -5
- package/dist/src/execution/tools/sleep.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -7
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
- package/dist/src/execution/tools/workflow/ask.d.ts +1 -2
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/body.d.ts +6 -1
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/cancel.js +1 -1
- package/dist/src/execution/tools/workflow/messages.d.ts +9 -8
- package/dist/src/execution/tools/workflow/messages.js +1 -1
- package/dist/src/execution/tools/workflow/owner-inbox.d.ts +2 -2
- package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
- package/dist/src/execution/tools/workflow/owner.d.ts +5 -11
- package/dist/src/execution/tools/workflow/owner.js +1 -1
- package/dist/src/execution/tools/workflow/run-control.d.ts +0 -4
- package/dist/src/execution/tools/workflow/run-control.js +1 -1
- package/dist/src/execution/tools/workflow/start.d.ts +5 -14
- package/dist/src/execution/tools/workflow/start.js +1 -1
- package/dist/src/execution/tools/workflow/workflow.d.ts +1 -1
- package/dist/src/execution/tools/workflow/workflow.js +1 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +1 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +1 -0
- package/dist/src/execution/turn-control-receiver.d.ts +3 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +2 -0
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-workflow-tool-run.d.ts +2 -8
- package/dist/src/execution/turn-workflow-tool-run.js +1 -1
- package/dist/src/execution/turn-workflow.d.ts +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +10 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +341 -0
- package/dist/src/execution/wire/session-inbox-wire.v6.js +1 -0
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/emission-state.js +1 -1
- package/dist/src/harness/session-limit-continuation.d.ts +5 -5
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +4 -4
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/session-usage-limits.d.ts +48 -0
- package/dist/src/harness/session-usage-limits.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/turn-client-context.d.ts +9 -0
- package/dist/src/harness/turn-client-context.js +1 -0
- package/dist/src/harness/turn-tag-state.d.ts +17 -20
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +5 -0
- package/dist/src/harness/workflow-tool-runs.d.ts +0 -1
- package/dist/src/harness/workflow-tool-runs.js +1 -1
- package/dist/src/internal/application/build-output-environment.d.ts +1 -0
- package/dist/src/internal/application/build-output-environment.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/eve-project-root.d.ts +8 -0
- package/dist/src/internal/eve-project-root.js +1 -0
- package/dist/src/internal/invocation/workflow-execution.js +1 -1
- package/dist/src/internal/mcp/streamable-http-server.d.ts +29 -1
- package/dist/src/internal/mcp/streamable-http-server.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +1 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/project-context.d.ts +13 -8
- package/dist/src/internal/project-context.js +1 -1
- package/dist/src/internal/vercel/build-agent-workspace.d.ts +1 -1
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
- package/dist/src/internal/vercel/eve-service-contribution.d.ts +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
- package/dist/src/internal/workflow/reference.d.ts +2 -0
- package/dist/src/internal/workflow/reference.js +1 -0
- package/dist/src/internal/workflow/runtime.d.ts +6 -0
- package/dist/src/internal/workflow/runtime.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +1 -3
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +1 -11
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -3
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +2 -2
- package/dist/src/protocol/message.d.ts +3 -2
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/public/channels/slack/activity-plan.d.ts +4 -0
- package/dist/src/public/channels/slack/activity-plan.js +1 -0
- package/dist/src/public/channels/slack/activity.d.ts +45 -2
- package/dist/src/public/channels/slack/activity.js +2 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/memory/index.js +1 -1
- package/dist/src/public/models/openai/chatgpt/model.js +2 -2
- package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
- package/dist/src/public/nuxt/index.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +3 -2
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +9 -5
- package/dist/src/public/sandbox/vercel.d.ts +1 -1
- package/dist/src/public/sandbox/vercel.js +1 -1
- package/dist/src/public/tools/index.d.ts +3 -1
- package/dist/src/public/tools/index.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/self-modification/agent.d.ts +22 -0
- package/dist/src/self-modification/agent.js +1 -0
- package/dist/src/self-modification/extension/classify-registry-item.d.ts +19 -0
- package/dist/src/self-modification/extension/classify-registry-item.js +1 -0
- package/dist/src/self-modification/extension/eve-add.d.ts +56 -0
- package/dist/src/self-modification/extension/eve-add.js +2 -0
- package/dist/src/self-modification/extension/extension.d.ts +2 -0
- package/dist/src/self-modification/extension/extension.js +1 -0
- package/dist/src/self-modification/extension/instructions.d.ts +4 -0
- package/dist/src/self-modification/extension/instructions.js +23 -0
- package/dist/src/self-modification/extension/source-lock.d.ts +2 -0
- package/dist/src/self-modification/extension/source-lock.js +1 -0
- package/dist/src/self-modification/extension/tools/edit_file.d.ts +16 -0
- package/dist/src/self-modification/extension/tools/edit_file.js +1 -0
- package/dist/src/self-modification/extension/tools/registry_add.d.ts +52 -0
- package/dist/src/self-modification/extension/tools/registry_add.js +1 -0
- package/dist/src/self-modification/extension/tools/search_models.d.ts +22 -0
- package/dist/src/self-modification/extension/tools/search_models.js +1 -0
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +103 -0
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -0
- package/dist/src/self-modification/filesystem.d.ts +6 -0
- package/dist/src/self-modification/filesystem.js +1 -0
- package/dist/src/self-modification/sandbox.d.ts +2 -0
- package/dist/src/self-modification/sandbox.js +1 -0
- package/dist/src/services/dev-client/target.d.ts +3 -1
- package/dist/src/setup/boxes/select-model.d.ts +3 -21
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/prompt-ui.js +4 -4
- package/dist/src/setup/cli/select-component.d.ts +1 -1
- package/dist/src/setup/cli/select-component.js +1 -1
- package/dist/src/setup/flows/model.d.ts +3 -0
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/web-options.js +1 -1
- package/dist/src/shared/action-types.d.ts +35 -22
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +13 -0
- package/dist/src/shared/agent-turn-outcome.d.ts +2 -0
- package/dist/src/shared/agent-turn-outcome.js +1 -1
- package/dist/src/shared/extension-package-contract.d.ts +2 -0
- package/dist/src/shared/extension-package-contract.js +1 -1
- package/dist/src/shared/gateway-model-catalog.d.ts +21 -0
- package/dist/src/shared/gateway-model-catalog.js +1 -0
- package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
- package/dist/src/shared/token-usage.d.ts +11 -15
- package/dist/src/shared/token-usage.js +1 -1
- package/dist/src/shared/workflow-tool-context.d.ts +2 -0
- package/dist/src/shared/workflow-tool-context.js +1 -0
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/event-proxy-step.js +1 -1
- package/dist/src/subagents/start-remote.js +1 -1
- package/dist/src/subagents/token-budget.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/types.d.ts +18 -1
- package/dist/src/tasks/types.js +1 -1
- package/dist/src/tools/behavior.d.ts +5 -0
- package/dist/src/tools/definition.d.ts +16 -12
- package/dist/src/tools/definition.js +1 -1
- package/dist/src/tools/dynamic.d.ts +2 -2
- package/dist/src/tools/provided/sleep.d.ts +4 -4
- package/dist/src/tools/provided/sleep.js +1 -1
- package/dist/src/tools/task.d.ts +28 -80
- package/dist/src/tools/task.js +1 -1
- package/dist/src/tools/workflow-definition.d.ts +60 -0
- package/dist/src/tools/workflow-definition.js +1 -0
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +24 -19
- package/docs/channels/eve.mdx +1 -1
- package/docs/channels/mcp.mdx +25 -3
- package/docs/concepts/built-in-tools.md +1 -1
- package/docs/concepts/execution-model-and-durability.mdx +13 -2
- package/docs/concepts/sessions-runs-and-streaming.md +9 -1
- package/docs/guides/client/messages.mdx +1 -1
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/deployment/vercel.mdx +3 -1
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/memory/overview.mdx +41 -12
- package/docs/reference/cli.md +31 -33
- package/docs/reference/meta.json +1 -4
- package/docs/reference/telemetry.md +56 -0
- package/docs/reference/typescript-api.md +38 -35
- package/docs/sandbox.mdx +1 -1
- package/docs/tools/overview.mdx +59 -18
- package/docs/tools/workflows.mdx +146 -70
- package/package.json +38 -19
- package/dist/src/compiled/@vercel/sandbox-delete/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-delete/index.js +0 -9
- package/dist/src/compiled/@vercel/sandbox-stable/LICENSE +0 -201
- package/dist/src/compiled/@vercel/sandbox-stable/_async-retry.d.ts +0 -8
- package/dist/src/compiled/@vercel/sandbox-stable/_workflow-serde.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-client.d.ts +0 -1456
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/api-error.d.ts +0 -29
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/base-client.d.ts +0 -39
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/file-writer.d.ts +0 -66
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/index.d.ts +0 -2
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/validators.d.ts +0 -899
- package/dist/src/compiled/@vercel/sandbox-stable/api-client/with-retry.d.ts +0 -10
- package/dist/src/compiled/@vercel/sandbox-stable/auth/error.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/auth/file.d.ts +0 -18
- package/dist/src/compiled/@vercel/sandbox-stable/auth/index.d.ts +0 -6
- package/dist/src/compiled/@vercel/sandbox-stable/auth/oauth.d.ts +0 -111
- package/dist/src/compiled/@vercel/sandbox-stable/auth/poll-for-token.d.ts +0 -28
- package/dist/src/compiled/@vercel/sandbox-stable/auth/project.d.ts +0 -40
- package/dist/src/compiled/@vercel/sandbox-stable/command.d.ts +0 -292
- package/dist/src/compiled/@vercel/sandbox-stable/constants.d.ts +0 -5
- package/dist/src/compiled/@vercel/sandbox-stable/execution-context.d.ts +0 -116
- package/dist/src/compiled/@vercel/sandbox-stable/filesystem.d.ts +0 -258
- package/dist/src/compiled/@vercel/sandbox-stable/index.d.ts +0 -12
- package/dist/src/compiled/@vercel/sandbox-stable/index.js +0 -1
- package/dist/src/compiled/@vercel/sandbox-stable/network-policy.d.ts +0 -169
- package/dist/src/compiled/@vercel/sandbox-stable/proxy.d.ts +0 -55
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox-user.d.ts +0 -212
- package/dist/src/compiled/@vercel/sandbox-stable/sandbox.d.ts +0 -1216
- package/dist/src/compiled/@vercel/sandbox-stable/session.d.ts +0 -433
- package/dist/src/compiled/@vercel/sandbox-stable/snapshot.d.ts +0 -229
- package/dist/src/compiled/@vercel/sandbox-stable/utils/get-credentials.d.ts +0 -21
- package/dist/src/compiled/@vercel/sandbox-stable/utils/paginator.d.ts +0 -16
- package/dist/src/compiled/@vercel/sandbox-stable/utils/resolveSignal.d.ts +0 -15
- package/dist/src/compiled/@vercel/sandbox-stable/utils/sandbox-snapshot.d.ts +0 -11
- package/dist/src/compiled/@vercel/sandbox-stable/utils/types.d.ts +0 -11
- package/dist/src/compiled/_chunks/node/decode_jwt-Col8JOnf.js +0 -7
- package/dist/src/compiled/_chunks/node/version-BYHw-SDY.js +0 -1
- package/dist/src/compiled/_chunks/node/version-DH6yRy-M.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +0 -40
- package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +0 -3
- package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +0 -3
- package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +0 -15
- package/dist/src/harness/session-token-limits.d.ts +0 -41
- package/dist/src/harness/session-token-limits.js +0 -1
- package/dist/src/harness/turn-sleep.d.ts +0 -12
- package/dist/src/harness/turn-sleep.js +0 -1
- package/dist/src/internal/agent-workspace.d.ts +0 -15
- package/dist/src/internal/agent-workspace.js +0 -1
- package/dist/src/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +0 -16
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js +0 -5
- package/dist/src/node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js +0 -1
- package/dist/src/public/workflow/index.d.ts +0 -5
- package/dist/src/public/workflow/index.js +0 -1
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/LICENSE +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_async-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/_workflow-serde.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/api-error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/base-client.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/file-writer.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/api-client/with-retry.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/error.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/file.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/index.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/oauth.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/poll-for-token.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/auth/project.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/command.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/execution-context.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/filesystem.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/network-policy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/proxy.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/sandbox-user.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/session.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/get-credentials.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/paginator.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/resolveSignal.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/sandbox-snapshot.d.ts +0 -0
- /package/dist/src/compiled/@vercel/{sandbox-delete → sandbox-drives}/utils/types.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./global-singleton-BNinwFrL.js";import{$n as t,A as n,B as r,C as i,Dr as a,F as o,J as s,N as c,On as l,Pr as u,S as d,Un as ee,Vn as te,Y as f,Z as p,Zn as m,_n as ne,ar as h,c as re,cr as ie,dr as ae,er as oe,ft as g,ht as se,ir as _,kn as ce,lr as le,n as v,o as y,sr as ue,t as de,ur as b,ut as fe,z as x}from"./wait-until-l-cwfJvm.js";import{A as S,D as C,E as w,O as T,S as E,T as D,g as O,h as k,j as A,k as j,l as M,p as N,r as P,s as F,t as I,v as L,w as R}from"./dist-DMQ3CtWt.js";import{t as pe}from"./attribute-changes-03lzo29R.js";import{O as z,c as B,i as me,o as V,ot as H,st as U}from"./dist-BIdMK5N8.js";const W=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,A.WORLD_CONTRACT_ERROR]),he=new Set([`TRANSPORT`,`TIMEOUT`,A.STREAM_ERROR]),ge=[j.is,k.is,R.is,N.is];function G(e){if(!S.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&W.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 K(e){return L.is(e)?!0:O.is(e)?e.status===void 0||e.status>=500:S.is(e)?e.status!==void 0&&e.status>=500||e.code!==void 0&&he.has(e.code):!1}function _e(e){if(M.is(e))return A.REPLAY_DIVERGENCE;if(I.is(e))return A.CORRUPTED_EVENT_LOG;if(F.is(e))return A.MAX_EVENTS_EXCEEDED;if(E.is(e))return A.DEPLOYMENT_MISMATCH;if(O.is(e))return A.STREAM_ERROR;if(G(e)||K(e))return A.WORLD_CONTRACT_ERROR;for(let t of ge)if(t(e))return A.RUNTIME_ERROR;return A.USER_ERROR}const q=[`node`,`quickjs`];function J(e=process.env){let t=e.WORKFLOW_VM;if(!(t===void 0||t===``)){if(q.includes(t))return t;throw new j(`Invalid WORKFLOW_VM value: "${t}". Expected one of: ${q.join(`, `)}.`)}}function ve(e){let t=e.executionContext?.workflowVm;if(t!==void 0){if(!q.includes(t))throw new j(`Invalid executionContext.workflowVm value: "${t}". Expected one of: ${q.join(`, `)}.`);return t===`quickjs`}return J()===`quickjs`}const ye=V();function be(){let e=f.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[U]:e.rootRunId??t,[H]:t}}const Y=e(`@workflow/core//latestNoOpWarning`,1,()=>({warned:!1}));async function X(e,r,o){"use step";return await v(()=>{let s=e?.workflowId;if(!s)throw new j(`'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 g(`workflow.start ${u(s)}`,async e=>{e?.setAttributes({...l(s),...ce(`start`)});let c=[],u=o??{};Array.isArray(r)?c=r:typeof r==`object`&&(u=r),e?.setAttributes({...ne(c.length)});let f=u.world??await b();ae(f);let m=await f.getDeploymentId(),h=u.deploymentId??m;h===`latest`&&(f.resolveLatestDeploymentId?h=await f.resolveLatestDeploymentId():(Y.warned||(Y.warned=!0,p.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:m})),h=m));let g=`wrun_${f.createRunId?f.createRunId(u):ye()}`,_,v,x,S;if(h===m)_=!0,v=!0,x=1;else if(typeof f.streams?.get!=`function`)_=!1,v=!1,x=void 0;else{let e=await re(f,{deploymentId:h,runId:g,timeout:2e3,namespace:u.namespace}).catch(()=>void 0);S=e?.encryptionPublicKey;let t=i(e?.workflowCoreVersion);_=t.framedByteStreams,v=t.supportedFormats.has(oe.GZIP),x=e?.hookResumeInputVersion}let C=[],w=await fe(),T=u.specVersion??f.specVersion,E=B(T),D=u.allowReservedAttributes===!0,O;if(u.attributes&&Object.keys(u.attributes).length>0){if(T<4)throw new j(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(u.attributes))if(typeof t!=`string`)throw new j(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=pe(u.attributes,{allowReservedAttributes:D});O=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let k=T>=4?be():void 0,A=k?{...k,...O}:O,M=A?{attributes:A,...D||k!=null?{allowReservedAttributes:!0}:{}}:{};if(u.replayedFromRunId!==void 0&&!me.safeParse(u.replayedFromRunId).success)throw new j(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(u.replayedFromRunId).slice(0,64))}.`);let N=ie(S),F,I;if(N)F=t(N),I=S;else{let e=await f.getEncryptionKeyForRun?.(g,{...u,deploymentId:h});F=e?await a(e):void 0,I=e?ue((await le(e)).publicKey):void 0}let L=await n(c,g,F,C,globalThis,E,_,v&&T>=5),R=f.getEnvironment?.(),z=J(),V={traceCarrier:w,workflowCoreVersion:d,features:{encryption:!!F},...x===void 0?{}:{hookResumeInputVersion:x},...z?{workflowVm:z}:{},...u.replayedFromRunId?{replayedFromRunId:u.replayedFromRunId}:{}},[H,U]=await Promise.allSettled([f.events.create(g,{eventType:`run_created`,specVersion:T,eventData:{deploymentId:h,workflowName:s,input:L,executionContext:V,...I?{encryptionPublicKey:I}:{},...M}},{v1Compat:E}),f.queue(y(s,u.namespace),{runId:g,traceCarrier:w,...T>=3?{runInput:{input:L,deploymentId:h,workflowName:s,specVersion:T,executionContext:V,...I?{encryptionPublicKey:I}:{},...R===void 0?{}:{environment:R},...M}}:{}},{deploymentId:h,specVersion:T,...u.region===void 0?{}:{region:u.region}})]);if(U.status===`rejected`)throw U.reason;let W=!1;if(H.status===`rejected`){let e=H.reason;if(!P.is(e))if(K(e))W=!0,p.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:g,error:e.message});else throw e}else{let e=H.value;if(!E&&e.run.runId!==g)throw new j(`Server returned different runId than requested: expected ${g}, got ${e.run.runId}`)}return de(Promise.all(C),e=>{p.warn(`Background flush of workflow argument streams failed`,{workflowRunId:g,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...te(g),...se(h),...H.status===`fulfilled`?ee(H.value.run.status):{}}),new $(g,{resilientStart:W})})})}const xe=e=>Array.isArray(e)?e:[e];async function Se(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await m(i):void 0,o=xe(await x(r.input,t,a,globalThis)),s=n.specVersion??r.specVersion??1,c=n.deploymentId??r.deploymentId;return(await X({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 Z(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=B(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 Ce(e,t,n){if(t.length===0)throw Error(`cancelRuns requires at least one run ID.`);if(t.length>500)throw Error(`cancelRuns accepts at most 500 run IDs (received ${t.length}).`);if(new Set(t).size!==t.length)throw Error(`cancelRuns requires unique run IDs (duplicates found).`);if(e.runs.cancelMany)return e.runs.cancelMany({runIds:t,...n?.cancelReason===void 0?{}:{cancelReason:n.cancelReason}});let r=Array(t.length),i=0,a=async()=>{for(;;){let a=i++;if(a>=t.length)return;let o=t[a];try{await Z(e,o,n),r[a]={runId:o,outcome:`cancelled`}}catch{r[a]={runId:o,outcome:`failed`,code:`internal_error`,retryable:!0}}}},o=Math.min(20,t.length);await Promise.all(Array.from({length:o},()=>a()));let s={requested:t.length,cancelled:0,alreadyCancelled:0,notCancellable:0,notFound:0,failed:0};for(let e of r)switch(e.outcome){case`cancelled`:s.cancelled++;break;case`already_cancelled`:s.alreadyCancelled++;break;case`not_cancellable`:s.notCancellable++;break;case`not_found`:s.notFound++;break;case`failed`:s.failed++;break}return{summary:s,results:r}}async function we(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(y(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=B(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{sortOrder:`asc`,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),l=s.filter(e=>!c.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);l=l.filter(t=>t.correlationId&&e.has(t.correlationId))}let u=[],d=0;for(let n of l){if(!n.correlationId)continue;let a=i?{eventType:`wait_completed`,correlationId:n.correlationId}:{eventType:`wait_completed`,correlationId:n.correlationId,specVersion:r.specVersion,eventData:{resumeAt:n.eventData.resumeAt}};try{await e.events.create(t,a,{v1Compat:i}),d++}catch(e){P.is(e)?d++:u.push(e instanceof Error?e:Error(String(e)))}}if(d>0&&await e.queue(y(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),u.length>0)throw AggregateError(u,`Failed to complete ${u.length}/${l.length} pending wait(s) for run ${t}`);return{stoppedCount:d}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Te(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw O.is(e)?e:new O(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Ee(e,t){try{return await e.streams.list(t)}catch(e){throw O.is(e)?e:new O(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}const De=new Set([`completed`,`failed`]);function Oe(){return z(`WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`,1e3,{integer:!0,min:1})}function ke(){return z(`WORKFLOW_RETURN_VALUE_WAIT_MS`,5e4,{integer:!0,min:1})}function Ae(){return z(`WORKFLOW_RETURN_VALUE_MAX_LONG_POLLS`,10,{integer:!0,min:1})}function je(){let e=process.env.WORKFLOW_RETURN_VALUE_LONG_POLL;return e===void 0||e===``||!(e===`0`||e.toLowerCase()===`false`)}var $=class e{static[h](e){return{runId:e.runId,resilientStart:e.#r}}static[_](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=b(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(e){return this.#n||=(async()=>{let t=await this.#t,n=e??await t.runs.get(this.runId),r=await t.getEncryptionKeyForRun?.(n);return r?await m(r):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:7,...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,{resolveData:`none`}).then(e=>e.status))}get returnValue(){"use step";return this.#s()}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=s(this.runId,i),o=this.#a(),l=c(n,t,this.runId,a,r,o),u=this.#t,d=this.runId;return Object.assign(l,{getTailIndex:async()=>(await(await u).streams.getInfo(d,a)).tailIndex})}async#o(e){if(e.status===`completed`){let t=await this.#i(e);return await r(e.output,this.runId,t)}if(e.status===`cancelled`)throw new D(this.runId);if(e.status===`failed`){let t=await this.#i(e),n;try{n=await o(e.error,this.runId,t)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new w(this.runId,n,{errorCode:e.errorCode})}throw new C(this.runId,e.status)}async#s(){let e=await this.#t,t=0,n=this.#r?3:0,r=[1e3,3e3,6e3],i=je()?e.runs.waitForTerminalStatus?.bind(e.runs):void 0,a=0,o=Ae();for(;;){let s=Date.now();try{let t=i&&a<o;t&&a++;let n=t?await i(this.runId,{timeoutMs:ke(),resolveData:`none`}):await e.runs.get(this.runId,{resolveData:`none`});if(n.status===`cancelled`)throw new D(this.runId);if(De.has(n.status)){let t=await e.runs.get(this.runId,{resolveData:`all`});return await this.#o(t)}throw new C(this.runId,n.status)}catch(e){if(C.is(e)){let e=Oe()-(Date.now()-s);e>0&&await new Promise(t=>setTimeout(t,e));continue}if(T.is(e)&&t<n){let e=r[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}}};function Me(e){return new $(e)}export{Ee as a,we as c,ve as d,_e as f,Ce as i,Q as l,G as m,Me as n,Te as o,K as p,Z as r,Se as s,$ as t,X as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Tr as e}from"./wait-until-l-cwfJvm.js";import{i as t}from"./attribute-changes-03lzo29R.js";async function n(r){let i=globalThis[e];return i||t(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-8V8biNmG.js";import{t as n}from"./global-singleton-BNinwFrL.js";import{A as r,P as i,_ as a,a as o,c as s,g as c,i as l,j as u,k as d,l as f,m as p,p as m,u as h}from"./dist-DMQ3CtWt.js";import{a as g,d as _,f as v,n as y,t as b,u as ee}from"./private-CKx3PkSS.js";import{D as x,O as S,T as te,b as ne,et as re,nt as ie,o as ae,p as oe}from"./dist-BIdMK5N8.js";import{types as C}from"node:util";import{AsyncLocalStorage as se}from"node:async_hooks";function ce(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function le(e){return ce(`workflow`,e)}function ue(e){return ce(`step`,e)}function de(e){return ge(ue(e),e)}function fe(e){return ge(le(e),e)}function pe(e){return le(e)?.shortName??he(`workflow`,e)??e}function me(e){return ue(e)?.shortName??he(`step`,e)??e}function he(e,t){if(!t.startsWith(`${e}--`))return null;let n=t.split(`--`).filter(Boolean),r=n.at(-1)?.split(`-`).filter(Boolean).at(-1)??``;if([`default`,`__default`].includes(r)){let t=n.at(-2)?.split(`-`).filter(Boolean).at(-1);t&&t!==e&&(r=t)}return r||null}function ge(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}const _e=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:!e.env.NO_COLOR&&!!e.stdout?.isTTY:!1})(),ve=(e,t)=>n=>_e?`\x1b[${e}m${n}\x1b[${t}m`:n,w={bold:ve(1,22),dim:ve(2,22),italic:ve(3,23),red:ve(31,39),blue:ve(34,39),cyan:ve(36,39),yellow:ve(33,39),magenta:ve(35,39)},ye={info:w.blue,help:w.cyan,warn:w.yellow,error:w.red};function be(e){let t=Array.isArray(e)?e.join(`
|
|
2
|
+
`):e;return ye.info(`${w.bold(`hint:`)} ${t}`)}function xe(e){return ye.info(`${w.bold(`docs:`)} ${e}`)}function Se(e){return w.italic(`${w.dim("`")}${e}${w.dim("`")}`)}function T(e){return w.dim(e)}function Ce(e){return w.bold(e)}function we(e){return w.red(e)}function Te(e){return w.magenta(e)}function Ee(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
|
+
`)}var De=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}})),Oe=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):()=>{}})),ke=t(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=De(),a=Oe();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*$`)})),Ae=t(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),je=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)}})),E=t(((e,t)=>{let n=Oe(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=De(),{safeRe:a,t:o}=ke(),s=Ae(),{compareIdentifiers:c}=je();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}}})),Me=t(((e,t)=>{let n=E();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}}})),Ne=t(((e,t)=>{let n=Me();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Pe=t(((e,t)=>{let n=Me();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Fe=t(((e,t)=>{let n=E();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}}})),Ie=t(((e,t)=>{let n=Me();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`}})),Le=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).major})),Re=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).minor})),ze=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).patch})),Be=t(((e,t)=>{let n=Me();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),D=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ve=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(t,e,r)})),He=t(((e,t)=>{let n=D();t.exports=(e,t)=>n(e,t,!0)})),Ue=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),We=t(((e,t)=>{let n=Ue();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Ge=t(((e,t)=>{let n=Ue();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Ke=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)>0})),qe=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)<0})),Je=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)===0})),Ye=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)!==0})),Xe=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)>=0})),Ze=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)<=0})),Qe=t(((e,t)=>{let n=Je(),r=Ye(),i=Ke(),a=Xe(),o=qe(),s=Ze();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}`)}}})),$e=t(((e,t)=>{let n=E(),r=Me(),{safeRe:i,t:a}=ke();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],c=o[3]||`0`,l=o[4]||`0`,u=t.includePrerelease&&o[5]?`-${o[5]}`:``,d=t.includePrerelease&&o[6]?`+${o[6]}`:``;return r(`${s}.${c}.${l}${u}${d}`,t)}})),et=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}}})),O=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,ae(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=>ie(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 b=[..._.values()];return r.set(t,b),b}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(oe(this.set[t],e,this.options))return!0;return!1}};let r=new(et()),i=Ae(),a=tt(),o=Oe(),s=E(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=ke(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=De(),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=x(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=te(e,t),o(`xrange`,e),e=re(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>ee(e,t)).join(` `),ee=(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})},x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(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})},te=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ne(e,t)).join(` `)),ne=(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})},re=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ie=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),ae=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()),oe=(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}})),tt=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===``||new l(t.value,n).test(this.value):t.operator===``?t.value===``||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=Ae(),{safeRe:i,t:a}=ke(),o=Qe(),s=Oe(),c=E(),l=O()})),nt=t(((e,t)=>{let n=O();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),rt=t(((e,t)=>{let n=O();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),it=t(((e,t)=>{let n=E(),r=O();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}})),at=t(((e,t)=>{let n=E(),r=O();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}})),ot=t(((e,t)=>{let n=E(),r=O(),i=Ke();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}})),st=t(((e,t)=>{let n=O();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),ct=t(((e,t)=>{let n=E(),r=tt(),{ANY:i}=r,a=O(),o=nt(),s=Ke(),c=qe(),l=Ze(),u=Xe();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}})),lt=t(((e,t)=>{let n=ct();t.exports=(e,t,r)=>n(e,t,`>`,r)})),ut=t(((e,t)=>{let n=ct();t.exports=(e,t,r)=>n(e,t,`<`,r)})),dt=t(((e,t)=>{let n=O();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),ft=t(((e,t)=>{let n=nt(),r=D();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}})),pt=t(((e,t)=>{let n=O(),r=tt(),{ANY:i}=r,a=nt(),o=D(),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})),mt=t(((e,t)=>{let n=ke(),r=De(),i=E(),a=je();t.exports={parse:Me(),valid:Ne(),clean:Pe(),inc:Fe(),diff:Ie(),major:Le(),minor:Re(),patch:ze(),prerelease:Be(),compare:D(),rcompare:Ve(),compareLoose:He(),compareBuild:Ue(),sort:We(),rsort:Ge(),gt:Ke(),lt:qe(),eq:Je(),neq:Ye(),gte:Xe(),lte:Ze(),cmp:Qe(),coerce:$e(),Comparator:tt(),Range:O(),satisfies:nt(),toComparators:rt(),maxSatisfying:it(),minSatisfying:at(),minVersion:ot(),validRange:st(),outside:ct(),gtr:lt(),ltr:ut(),intersects:dt(),simplifyRange:ft(),subset:pt(),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}}));const ht=2**32-1,gt=ht-1;var k=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};const _t=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function vt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===_t}function yt(e){return Object.prototype.toString.call(e).slice(8,-1)}function bt(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
|
|
5
|
+
`: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 xt(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 St(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}const Ct=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function wt(e){return Ct.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function Tt(e){return!(!Number.isInteger(e)||e<0||e>gt)}function Et(e){return!(!Number.isInteger(e)||e<0||e>ht)}function Dt(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 Tt(+e)}function Ot(e){for(var t=e.length-1;t>=0&&!Dt(e[t]);t--);return t+1}function kt(e){let t=Object.keys(e);return t.length=Ot(t),t}function At(e){return new Uint8Array(e).toBase64()}function jt(e){return Uint8Array.fromBase64(e).buffer}function Mt(e){return Buffer.from(e).toString(`base64`)}function Nt(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Pt(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 Ft(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 It=typeof Uint8Array.fromBase64==`function`,Lt=typeof process==`object`&&process.versions?.node!==void 0,Rt=It?At:Lt?Mt:Pt,zt=It?jt:Lt?Nt:Ft;function Bt(e,t){if(!t)return e;let n={};for(let r of Object.keys(e))n[r]=t[r]??e[r];return n}const Vt=Object.freeze({kind:`not-plain`}),Ht=Object.freeze({kind:`symbol-keys`}),Ut=Object.freeze({identify:e=>e,typeOf:e=>e===null?`null`:typeof e,toPrimitive:e=>e,tagOf:e=>yt(e),isThenable:e=>typeof e.then==`function`,toPromise:e=>Promise.resolve(e),unbox:e=>e.valueOf(),toISOString:e=>isNaN(e.getDate())?``:e.toISOString(),toStringValue:e=>e.toString(),regExpInfo:e=>({source:e.source,flags:e.flags}),valuesOf:e=>e,entriesOf:e=>e,viewInfo:e=>({buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,length:e.length,bufferByteLength:e.buffer.byteLength}),toArrayBuffer:e=>e,lengthOf:e=>e.length,hasOwn:(e,t)=>Object.hasOwn(e,t),indicesOf:e=>kt(e),shapeOf:e=>vt(e)?St(e).length>0?Ht:{kind:Object.getPrototypeOf(e)===null?`null-proto`:`plain`,keys:Object.keys(e)}:Vt,get:(e,t)=>e[t]}),Wt=Object.freeze({fromPrimitive:e=>e,fromISOString:e=>new Date(e),fromStringValue:(e,t)=>e===`URL`?new URL(t):e===`URLSearchParams`?new URLSearchParams(t):Temporal[e.slice(9)].from(t),fromArrayBuffer:e=>e,fromRegExpInfo:(e,t)=>new RegExp(e,t),fromViewInfo:(e,t,n,r)=>{let i=globalThis[e];return n===void 0?new i(t):new i(t,n,r)},box:e=>Object(e),createArray:e=>Array(e),createSparseArray:e=>{let t=[];return t[gt]=void 0,delete t[gt],t.length=e,t},createObject:()=>({}),createNullPrototypeObject:()=>Object.create(null),createSet:()=>new Set,createMap:()=>new Map,set:(e,t,n)=>{e[t]=n},addValue:(e,t)=>{e.add(t)},addEntry:(e,t,n)=>{e.set(t,n)}});function Gt(e,t,n){return Kt(JSON.parse(e),t,n)}function Kt(e,t,n){let r=Bt(Wt,n?.operations);if(typeof e==`number`)return s(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let i=e,a=Array(i.length),o=null;function s(e,n=!1){if(e===-1)return r.fromPrimitive(void 0);if(e===-3)return r.fromPrimitive(NaN);if(e===-4)return r.fromPrimitive(1/0);if(e===-5)return r.fromPrimitive(-1/0);if(e===-6)return r.fromPrimitive(-0);if(n||typeof e!=`number`)throw Error(`Invalid input`);if(e in a)return a[e];let c=i[e];if(!c||typeof c!=`object`)a[e]=r.fromPrimitive(c);else if(Array.isArray(c))if(typeof c[0]==`string`){let n=c[0],l=t&&Object.hasOwn(t,n)?t[n]:void 0;if(l){let t=c[1];if(typeof t!=`number`&&(t=i.push(c[1])-1),Object.hasOwn(a,t))return a[e]=l(a[t]);if(o??=new Set,o.has(t))throw Error(`Invalid circular reference`);return o.add(t),a[e]=l(s(t)),o.delete(t),a[e]}switch(n){case`Date`:a[e]=r.fromISOString(c[1]);break;case`Set`:let t=r.createSet();a[e]=t;for(let e=1;e<c.length;e+=1)r.addValue(t,s(c[e]));break;case`Map`:let o=r.createMap();a[e]=o;for(let e=1;e<c.length;e+=2)r.addEntry(o,s(c[e]),s(c[e+1]));break;case`RegExp`:a[e]=r.fromRegExpInfo(c[1],c[2]);break;case`Object`:{let t=c[1];if(typeof i[t]==`object`&&i[t][0]!==`BigInt`)throw Error(`Invalid input`);a[e]=r.box(s(t));break}case`BigInt`:a[e]=r.fromPrimitive(BigInt(c[1]));break;case`null`:let l=r.createNullPrototypeObject();a[e]=l;for(let e=1;e<c.length;e+=2){if(c[e]===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(l,c[e],s(c[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(i[c[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=s(c[1]);a[e]=r.fromViewInfo(n,t,c[2],c[3]);break}case`ArrayBuffer`:{let t=c[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);a[e]=r.fromArrayBuffer(zt(t));break}case`URL`:case`URLSearchParams`:case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:a[e]=r.fromStringValue(n,c[1]);break;default:throw Error(`Unknown type ${n}`)}}else if(c[0]===-7){let t=c[1];if(!Et(t))throw Error(`Invalid input`);let n=r.createSparseArray(t);a[e]=n;for(let e=2;e<c.length;e+=2){let i=c[e];if(!Tt(i)||i>=t)throw Error(`Invalid input`);r.set(n,i,s(c[e+1]))}}else{let t=r.createArray(c.length);a[e]=t;for(let e=0;e<c.length;e+=1){let n=c[e];n!==-2&&r.set(t,e,s(n))}}else{let t=r.createObject();a[e]=t;for(let e of Object.keys(c)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(t,e,s(c[e]))}}return a[e]}return s(0)}function qt(e,t,n){let r=Jt(!1,e,t,n);return typeof r==`string`?r:`[${r.join(`,`)}]`}function Jt(e,t,n,r){let i=Bt(Ut,r?.operations),a=[],o=new Map,s=[];if(n)for(let e of Object.getOwnPropertyNames(n))s.push({key:e,fn:n[e]});let c=[],l=0;function u(n,r){let d=i.typeOf(n);if(d===`undefined`)return-1;let f;if(d===`number`){if(f=i.toPrimitive(n),Number.isNaN(f))return-3;if(f===1/0)return-4;if(f===-1/0)return-5;if(f===0&&1/f<0)return-6}let p=i.identify(n);if(o.has(p))return o.get(p);r??=l++,o.set(p,r);for(let{key:e,fn:t}of s){let i=t(n);if(i)return a[r]=`["${e}",${u(i)}]`,r}if(d===`function`)throw new k(`Cannot stringify a function`,c,n,t);if(d===`symbol`)throw new k(`Cannot stringify a Symbol primitive`,c,n,t);let m=``;if(d!==`object`)m=Yt(d===`number`?f:i.toPrimitive(n));else if(i.isThenable(n)){if(!e)throw new k(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,c,n,t);m=i.toPromise(n).then(e=>{let t=u(e,r);t<0&&(a[r]=t)})}else{let e=i.tagOf(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:m=`["Object",${u(i.unbox(n))}]`;break;case`Date`:m=`["Date","${i.toISOString(n)}"]`;break;case`URL`:m=`["URL",${xt(i.toStringValue(n))}]`;break;case`URLSearchParams`:m=`["URLSearchParams",${xt(i.toStringValue(n))}]`;break;case`RegExp`:let{source:r,flags:a}=i.regExpInfo(n);m=a?`["RegExp",${xt(r)},"${a}"]`:`["RegExp",${xt(r)}]`;break;case`Array`:{let e=!1,t=i.lengthOf(n);m=`[`;for(let r=0;r<t;r+=1)if(r>0&&(m+=`,`),i.hasOwn(n,r))c.push(`[${r}]`),m+=u(i.get(n,r)),c.pop();else if(e)m+=-2;else{let r=i.indicesOf(n),a=r.length,o=String(t).length;if((t-a)*3>4+o+a*(o+1)){m=`[-7,`+t;for(let e=0;e<r.length;e++){let t=r[e];c.push(`[${t}]`),m+=`,`+t+`,`+u(i.get(n,t)),c.pop()}break}else e=!0,m+=-2}m+=`]`;break}case`Set`:m=`["Set"`;for(let e of i.valuesOf(n))m+=`,${u(e)}`;m+=`]`;break;case`Map`:m=`["Map"`;for(let[e,t]of i.entriesOf(n)){let n=i.typeOf(e),r=n!==`object`&&n!==`function`&&n!==`symbol`;c.push(`.get(${r?Yt(i.toPrimitive(e)):`...`})`),m+=`,${u(e)},${u(t)}`,c.pop()}m+=`]`;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`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.length}`),m+=`]`;break}case`DataView`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.byteLength}`),m+=`]`;break}case`ArrayBuffer`:m=`["ArrayBuffer","${Rt(i.toArrayBuffer(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`:m=`["${e}",${xt(i.toStringValue(n))}]`;break;default:{let e=i.shapeOf(n);if(e.kind===`not-plain`)throw new k(`Cannot stringify arbitrary non-POJOs`,c,n,t);if(e.kind===`symbol-keys`)throw new k(`Cannot stringify POJOs with symbolic keys`,c,n,t);if(e.kind===`null-proto`){m=`["null"`;for(let r of e.keys){if(r===`__proto__`)throw new k(`Cannot stringify objects with __proto__ keys`,c,n,t);c.push(wt(r)),m+=`,${xt(r)},${u(i.get(n,r))}`,c.pop()}m+=`]`}else{m=`{`;let r=!1;for(let a of e.keys){if(a===`__proto__`)throw new k(`Cannot stringify objects with __proto__ keys`,c,n,t);r&&(m+=`,`),r=!0,c.push(wt(a)),m+=`${xt(a)}:${u(i.get(n,a))}`,c.pop()}m+=`}`}}}}return a[r]=m,r}let d=u(t);return d<0?`${d}`:a}function Yt(e){let t=typeof e;return t===`string`?xt(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var Xt=e(mt(),1);async function Zt(e,t=[`encrypt`,`decrypt`]){if(e.byteLength!==32)throw new d(`Encryption key must be exactly 32 bytes, got ${e.byteLength}`);return globalThis.crypto.subtle.importKey(`raw`,e,`AES-GCM`,!1,t)}async function Qt(e,t,n){let r=globalThis.crypto.getRandomValues(new Uint8Array(12)),i;try{i=await globalThis.crypto.subtle.encrypt({name:`AES-GCM`,iv:r,tagLength:128,...n?{additionalData:n}:{}},e,t)}catch(e){throw new m(`AES-256-GCM encryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`encrypt`,byteLength:t.byteLength}})}let a=new Uint8Array(12+i.byteLength);return a.set(r,0),a.set(new Uint8Array(i),12),a}async function $t(e,t,n){if(t.byteLength<28)throw new m(`Encrypted data too short: expected at least 28 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let r=t.subarray(0,12),i=t.subarray(12),a;try{a=await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:r,tagLength:128,...n?{additionalData:n}:{}},e,i)}catch(e){throw new m(`AES-256-GCM decryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return new Uint8Array(a)}const en=Symbol.for(`WORKFLOW_USE_STEP`),tn=Symbol.for(`WORKFLOW_SET_ATTRIBUTES`),nn=Symbol.for(`WORKFLOW_CREATE_HOOK`),rn=Symbol.for(`WORKFLOW_SLEEP`),an=Symbol.for(`WORKFLOW_GET_STREAM_ID`),on=Symbol.for(`WORKFLOW_STABLE_ULID`),A=Symbol.for(`WORKFLOW_STREAM_NAME`),sn=Symbol.for(`WORKFLOW_STREAM_TYPE`),cn=Symbol.for(`WORKFLOW_STREAM_FRAMING`),ln=Symbol.for(`WORKFLOW_STREAM_SERVER_RUN_ID`),un=Symbol.for(`WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID`),dn=Symbol.for(`WORKFLOW_STREAM_SERVER_PUBLIC_KEY`),fn=Symbol.for(`WORKFLOW_STREAM_DRAIN`),pn=Symbol.for(`BODY_INIT`),mn=Symbol.for(`WEBHOOK_RESPONSE_WRITABLE`),hn=Symbol.for(`workflow-class-registry`),j=Symbol.for(`WORKFLOW_ABORT_STREAM_NAME`),M=Symbol.for(`WORKFLOW_ABORT_HOOK_TOKEN`),gn=Symbol.for(`WORKFLOW_ABORT_LISTENER_ATTACHED`),_n=Symbol.for(`WORKFLOW_ABORT_READER_CANCEL`),vn=()=>S(`WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`,1e3,{integer:!0,min:1}),yn=()=>S(`WORKFLOW_STREAM_MAX_CHUNKS_PER_BATCH`,1e3,{integer:!0,min:1}),bn=()=>S(`WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`,1048576,{integer:!0,min:1}),xn=()=>S(`WORKFLOW_STREAM_MAX_BUFFERED_BYTES`,8388608,{integer:!0,min:1}),Sn=()=>S(`WORKFLOW_LOCK_POLL_INTERVAL_MS`,10,{integer:!0,min:1});function Cn(){let e={...v(),pendingOps:0,doneResolved:!1,streamEnded:!1};return e.promise.catch(()=>{}),e}function wn(e){if(e.locked)return!1;let t;try{t=e.getWriter()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function Tn(e){if(e.locked)return!1;let t;try{t=e.getReader()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function En(e){let t=e.drainBarrier;if(!t){e.resolve();return}t().then(()=>e.resolve(),t=>e.reject(t))}function Dn(e,t){if(t.writablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.writablePollingInterval=void 0;return}wn(e)&&t.pendingOps===0&&(t.doneResolved=!0,clearInterval(n),t.writablePollingInterval=void 0,En(t))},Sn());t.writablePollingInterval=n}function On(e,t){if(t.readablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.readablePollingInterval=void 0;return}Tn(e)&&t.pendingOps===0&&(t.doneResolved=!0,clearInterval(n),t.readablePollingInterval=void 0,En(t))},Sn());t.readablePollingInterval=n}function kn(e,t,n){let r=t[fn];return typeof r==`function`&&(n.drainBarrier=r),An(e,t,n)}async function An(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 d(`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.drainBarrier&&await n.drainBarrier().catch(()=>{}),n.doneResolved||(n.doneResolved=!0,n.reject(e)),e}finally{r.cancel(a).catch(()=>{}),r.releaseLock(),i.releaseLock()}}function jn(e){let t=e.specVersion;if(!(t!=null&&t>=6&&t<=7))throw new d(`This Workflow runtime supports Worlds with spec version 6 through 7, but the configured World declares spec version ${t??`none`}. Install a World package version compatible with the current Workflow runtime.`)}const Mn=Symbol.for(`@workflow/world//cache`),Nn=Symbol.for(`@workflow/world//cachePromise`),Pn=Symbol.for(`@workflow/world//getWorldFn`);async function N(){let e=globalThis;if(e[Mn])return jn(e[Mn]),e[Mn];if(e[Nn])return e[Mn]=await e[Nn],jn(e[Mn]),e[Mn];let t=e[Pn];if(t){let e=await t();return jn(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 Fn=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),In=new TextEncoder;function Ln(e){if(e.byteLength!==32)throw new d(`Run key material must be exactly 32 bytes, got ${e.byteLength}`)}function Rn(e,t){if(e.byteLength!==32)throw new d(`${t} must be exactly 32 bytes, got ${e.byteLength}`)}async function zn(e){Ln(e);let t=await globalThis.crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),n=await globalThis.crypto.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:In.encode(`workflow/encp/x25519/v1`)},t,256),r=new Uint8Array(n);return{scalar:r,publicKey:await Bn(r)}}async function Bn(e){let t=await Vn(e,!0),n=await globalThis.crypto.subtle.exportKey(`jwk`,t);if(!n.x)throw new d(`X25519 JWK export did not include a public key component ("x")`);let r=Kn(n.x);if(r.byteLength!==32)throw new d(`X25519 JWK export produced a ${r.byteLength}-byte public key, expected 32`);return r}async function Vn(e,t){let n=new Uint8Array(Fn.length+e.byteLength);return n.set(Fn,0),n.set(e,Fn.length),globalThis.crypto.subtle.importKey(`pkcs8`,n,{name:`X25519`},t,[`deriveBits`])}function Hn(e){return globalThis.crypto.subtle.importKey(`raw`,e,{name:`X25519`},!0,[])}const Un=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Wn(e){let t=``;for(let n=0;n<e.length;n+=3){let r=e[n],i=n+1<e.length?e[n+1]:0,a=n+2<e.length?e[n+2]:0;t+=Un[r>>2&63],t+=Un[(r&3)<<4|i>>4&15],t+=n+1<e.length?Un[(i&15)<<2|a>>6&3]:`=`,t+=n+2<e.length?Un[a&63]:`=`}return t}function Gn(e){let t=e.length;for(;t>0&&e[t-1]===`=`;)t--;let n=e.slice(0,t);if(n.includes(`=`)||n.length%4==1||t!==e.length&&e.length%4!=0)return;let r=0,i=0,a=[];for(let e=0;e<n.length;e++){let t=Un.indexOf(n[e]);if(t===-1)return;r=r<<6|t,i+=6,i>=8&&(i-=8,a.push(r>>i&255))}if(!(i>0&&r&(1<<i)-1))return new Uint8Array(a)}function Kn(e){let t=0,n=0,r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a===`=`)break;let o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`.indexOf(a);if(o===-1)throw new d(`Invalid base64url character "${a}" in X25519 JWK key component`);t=t<<6|o,n+=6,n>=8&&(n-=8,r.push(t>>n&255))}return new Uint8Array(r)}async function qn(e,t,n,r){let i=In.encode(`workflow/encp/aes256gcm/v1`),a=new Uint8Array(i.length+t.length+n.length);a.set(i,0),a.set(t,i.length),a.set(n,i.length+t.length);let o=await globalThis.crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),s=await globalThis.crypto.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:a},o,256);return globalThis.crypto.subtle.importKey(`raw`,new Uint8Array(s),`AES-GCM`,!1,r)}async function Jn(e){Rn(e,`Recipient public key`);let t;try{t=await Hn(e)}catch(e){throw new d(`Invalid X25519 recipient public key: ${e instanceof Error?e.message:String(e)}`,{cause:e})}let n=await globalThis.crypto.subtle.generateKey({name:`X25519`},!0,[`deriveBits`]),r=new Uint8Array(await globalThis.crypto.subtle.exportKey(`raw`,n.publicKey)),i;try{i=await globalThis.crypto.subtle.deriveBits({name:`X25519`,public:t},n.privateKey,256)}catch(e){throw new d(`X25519 key agreement failed: the recipient public key is not a valid curve point (low-order point or corrupted key material)`,{cause:e})}return{ephemeralPublicKey:r,contentKey:await qn(new Uint8Array(i),r,e,[`encrypt`])}}async function Yn(e,t){if(t.byteLength!==32)throw new m(`Sealed payload has a malformed ephemeral public key: expected 32 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let n;try{let[r,i]=await Promise.all([Vn(e.scalar,!1),Hn(t)]);n=await globalThis.crypto.subtle.deriveBits({name:`X25519`,public:i},r,256)}catch(e){throw new m(`X25519 key agreement failed while opening a sealed payload: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return qn(new Uint8Array(n),t,e.publicKey,[`decrypt`])}async function Xn(e,t,n){let{ephemeralPublicKey:r,contentKey:i}=await Jn(e),a=await Qt(i,t,n),o=new Uint8Array(r.byteLength+a.byteLength);return o.set(r,0),o.set(a,r.byteLength),o}async function Zn(e,t,n){if(t.byteLength<60)throw new m(`Sealed payload too short: expected at least 60 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let r=t.subarray(0,32),i=t.subarray(32);return $t(await Yn(e,r),i,n)}function Qn(e,t){let n;return{async seal(r){n??=Jn(e);let{ephemeralPublicKey:i,contentKey:a}=await n,o=await Qt(a,r,t),s=new Uint8Array(i.byteLength+o.byteLength);return s.set(i,0),s.set(o,i.byteLength),s}}}function $n(e,t){let n,r;return{async open(i){if(i.byteLength<60)throw new m(`Sealed payload too short: expected at least 60 bytes, got ${i.byteLength}`,{context:{operation:`decrypt`,byteLength:i.byteLength}});let a=i.subarray(0,32),o=i.subarray(32),s=er(a);(s!==n||!r)&&(n=s,r=Yn(e,a));let c;try{c=await r}catch(e){throw n=void 0,r=void 0,e}return $t(c,o,t)}}}function er(e){let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return t}function tr(e){if(!e)return;let t=Gn(e);if(!(!t||t.byteLength!==32))return t}let P=null,nr=null;function rr(e,t){let n=P,r=nr;P=e??null,nr=e?new WeakSet:null;try{return t()}finally{P=n,nr=r}}const ir=n(`@workflow/core//useStepClosures.fns`,1,()=>({fns:new WeakSet}));function ar(e){return ir.fns.add(e),e}function or(e){return typeof e==`function`&&ir.fns.has(e)}function sr(e,t){if(!P||(P.totalExecutions=(P.totalExecutions??P.executions.length)+1,P.executions.length>=5))return;let n={kind:e};t!==void 0&&(n.detail=t),P.executions.push(n)}function F(e){!P||!nr||nr.has(e)||(nr.add(e),sr(`proxy`))}const I=Function.prototype.bind.bind(Function.prototype.call);function L(e,t){let n=Object.getOwnPropertyDescriptor(e,t)?.get;if(!n)throw Error(`Missing intrinsic getter: ${String(t)}`);return I(n)}const cr=I(Date.prototype.getDate),lr=I(Date.prototype.getTime),ur=I(Date.prototype.toISOString),dr=L(RegExp.prototype,`source`),fr=L(RegExp.prototype,`flags`),pr=L(ArrayBuffer.prototype,`byteLength`),mr=I(Map.prototype.entries),hr=I(Set.prototype.values),gr=I(Number.prototype.valueOf),_r=I(String.prototype.valueOf),vr=I(Boolean.prototype.valueOf),yr=I(BigInt.prototype.valueOf),br=Object.getPrototypeOf(Uint8Array.prototype),xr=L(br,Symbol.toStringTag),Sr=L(br,`buffer`),Cr=L(br,`byteOffset`),wr=L(br,`byteLength`),Tr=L(br,`length`),Er=L(DataView.prototype,`buffer`),Dr=L(DataView.prototype,`byteOffset`),Or=L(DataView.prototype,`byteLength`),kr=L(SharedArrayBuffer.prototype,`byteLength`),Ar=I(Headers.prototype[Symbol.iterator]),jr=L(URL.prototype,`href`),Mr=I(URLSearchParams.prototype.toString),{isProxy:R}=C,Nr=I(Function.prototype.toString);function Pr(e){if(R(e))return!1;let t=Object.getOwnPropertyDescriptor(e,`name`)?.value;return typeof t==`string`&&t.startsWith(`bound `)?!1:Nr(e).endsWith(`{ [native code] }`)||Reflect.getPrototypeOf(e)===Function.prototype}function z(e,t){if(e===null||typeof e!=`object`&&typeof e!=`function`)return;if(R(e))return F(e),e[t];let n=e;for(;n!==null;){if(R(n))return F(n),e[t];let r=Object.getOwnPropertyDescriptor(n,t);if(r)return`value`in r?r.value:r.get?(Pr(r.get)||sr(`getter`,String(t)),r.get.call(e)):void 0;n=Reflect.getPrototypeOf(n)}}function Fr(e,t){if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;if(R(e))return F(e),t in e;let n=e;for(;n!==null;){if(R(n))return F(n),t in e;if(Object.getOwnPropertyDescriptor(n,t))return!0;n=Reflect.getPrototypeOf(n)}return!1}function B(e,t){if(!t||typeof e!=`object`||!e)return!1;R(e)&&F(e);let n=Reflect.getPrototypeOf(e);for(;n!==null;){if(n===t)return!0;R(n)&&F(n),n=Reflect.getPrototypeOf(n)}return!1}function Ir(e){return R(e)?(F(e),e.href):jr(e)}function Lr(e){return R(e)?(F(e),String(e)):Mr(e)}function Rr(e){return R(e)?(F(e),Array.from(e)):[...Ar(e)]}function zr(e){return[...mr(e)]}function Br(e){return[...hr(e)]}function Vr(e){return C.isDataView(e)?{buffer:Er(e),byteOffset:Dr(e),byteLength:Or(e)}:{buffer:Sr(e),byteOffset:Cr(e),byteLength:wr(e)}}const Hr=new Set([`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Float16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]),Ur=new Set([`Date`,`RegExp`,`Map`,`Set`,`Array`,`DataView`,`ArrayBuffer`,`SharedArrayBuffer`,`Number`,`String`,`Boolean`,`BigInt`,`URL`,`URLSearchParams`,...Hr]);function Wr(e){if(C.isDate(e))return`Date`;if(C.isRegExp(e))return`RegExp`;if(C.isMap(e))return`Map`;if(C.isSet(e))return`Set`;if(Array.isArray(e))return`Array`;if(C.isTypedArray(e)){let t=xr(e);return t!==void 0&&Hr.has(t)?t:void 0}if(C.isDataView(e))return`DataView`;if(C.isArrayBuffer(e))return`ArrayBuffer`;if(C.isSharedArrayBuffer(e))return`SharedArrayBuffer`;if(C.isNumberObject(e))return`Number`;if(C.isStringObject(e))return`String`;if(C.isBooleanObject(e))return`Boolean`;if(C.isBigIntObject(e))return`BigInt`;if(B(e,URL.prototype))return`URL`;if(B(e,URLSearchParams.prototype))return`URLSearchParams`}function Gr(e){let t=z(e,Symbol.toStringTag);return typeof t==`string`?t:void 0}const Kr={tagOf:e=>{if(R(e))return F(e),Ut.tagOf(e);let t=Wr(e);if(t!==void 0)return t;let n=Gr(e);return n===void 0||Ur.has(n)?`Object`:n},isThenable:e=>C.isPromise(e)?!0:typeof z(e,`then`)==`function`,unbox:e=>C.isNumberObject(e)?gr(e):C.isStringObject(e)?_r(e):C.isBooleanObject(e)?vr(e):yr(e),toISOString:e=>Number.isNaN(cr(e))?``:ur(e),toStringValue:e=>B(e,URL.prototype)?Ir(e):B(e,URLSearchParams.prototype)?Lr(e):(sr(`method`,`toString (${Gr(e)??`unknown`})`),e.toString()),regExpInfo:e=>({source:dr(e),flags:fr(e)}),valuesOf:e=>Br(e),entriesOf:e=>zr(e),viewInfo:e=>{let t=Vr(e);return{...t,length:C.isDataView(e)?0:Tr(e),bufferByteLength:C.isSharedArrayBuffer(t.buffer)?kr(t.buffer):pr(t.buffer)}},shapeOf:e=>(R(e)&&F(e),Ut.shapeOf(e)),get:(e,t)=>z(e,t)},qr=Symbol.for(`workflow-serialize`),Jr=Symbol.for(`workflow-deserialize`);function Yr(e=globalThis){let t=e,n=t[hn];return n||(n=new Map,t[hn]=n),n}const Xr=`class//workflow//Run`;function Zr(e,t,n=globalThis){Yr(n).set(e,t)}function Qr(e,t){return Yr(t).get(e)}function $r(){return{Class:e=>{if(typeof e!=`function`)return!1;let t=z(e,`classId`);return typeof t==`string`&&{classId:t}},Instance:e=>{if(typeof e!=`object`||!e)return!1;let t=z(e,`constructor`);if(!t||typeof t!=`function`)return!1;let n=z(t,qr);if(typeof n!=`function`)return!1;let r=z(t,`classId`);if(typeof r!=`string`)throw Error(`Class "${String(z(t,`name`))}" with ${String(qr)} must have a static "classId" property.`);return sr(`method`,`[WORKFLOW_SERIALIZE] (${r})`),{classId:r,data:n.call(t,e)}}}}function ei(e=globalThis){return{Class:t=>{let n=t.classId,r=Qr(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=Qr(n,e);if(!i)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);let a=i[Jr];if(typeof a!=`function`)throw Error(`Class "${n}" does not have a static ${String(Jr)} method.`);return a.call(i,r)}}}function ti(e,t,n){if(n===0)return`.`;let r=new Uint8Array(e,t,n);return Buffer.from(r).toString(`base64`)}function V(e){let t=Vr(e);return ti(t.buffer,t.byteOffset,t.byteLength)}function H(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 ni(e){return JSON.parse(e)}function ri(e){let t=Object.getOwnPropertyDescriptor(e,`stack`);return t&&`value`in t?t.value:(sr(`getter`,`stack`),t?.get?t.get.call(e):z(e,`stack`))}function ii(e){if(!C.isNativeError(e))return!1;let t={message:z(e,`message`),stack:ri(e)};return Fr(e,`cause`)&&(t.cause=z(e,`cause`)),t}function ai(e,t){return!C.isNativeError(t)||z(t,`name`)!==e?!1:ii(t)}function oi(e){return t=>ai(e,t)||!1}function si(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 ci(e=globalThis){return{ArrayBuffer:e=>C.isArrayBuffer(e)&&ti(e,0,pr(e)),BigInt:e=>typeof e==`bigint`&&String(e),BigInt64Array:e=>C.isBigInt64Array(e)&&V(e),BigUint64Array:e=>C.isBigUint64Array(e)&&V(e),Date:e=>C.isDate(e)?Number.isNaN(cr(e))?`.`:ur(e):!1,DOMException:e=>{if(typeof e!=`object`||!e)return!1;let t=z(e,`constructor`);if(!t||z(t,`name`)!==`DOMException`)return!1;let n={message:z(e,`message`),name:z(e,`name`),stack:ri(e)};return Fr(e,`cause`)&&(n.cause=z(e,`cause`)),n},EvalError:oi(`EvalError`),FatalError:oi(`FatalError`),HookConflictError:e=>{let t=ai(`HookConflictError`,e);if(!t)return!1;let n={...t,token:z(e,`token`)},r=z(e,`conflictingRunId`);return r!==void 0&&(n.conflictingRunId=r),n},RangeError:oi(`RangeError`),ReferenceError:oi(`ReferenceError`),RetryableError:e=>{let t=ai(`RetryableError`,e);if(!t)return!1;let n=z(e,`retryAfter`),r;if(C.isDate(n)){let e=lr(n);r=Number.isNaN(e)?Date.now()+1e3:e}else if(n&&typeof n==`object`){let e=z(n,`getTime`);if(typeof e==`function`){sr(`method`,`getTime`);let t=e.call(n);r=Number.isNaN(t)?Date.now()+1e3:t}else r=Date.now()+1e3}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=ai(`RuntimeDecryptionError`,e);if(!t)return!1;let n={...t},r=z(e,`context`);return r!==void 0&&(n.context=r),n},StreamError:e=>{let t=ai(`StreamError`,e);if(!t)return!1;let n={...t},r=z(e,`status`),i=z(e,`url`);return typeof r==`number`&&(n.status=r),typeof i==`string`&&(n.url=i),n},SyntaxError:oi(`SyntaxError`),TypeError:oi(`TypeError`),URIError:oi(`URIError`),AggregateError:e=>{let t=ai(`AggregateError`,e);return t?{...t,errors:z(e,`errors`)}:!1},Error:e=>{if(!C.isNativeError(e))return!1;let t={name:z(e,`name`),message:z(e,`message`),stack:ri(e)};return Fr(e,`cause`)&&(t.cause=z(e,`cause`)),t},Float32Array:e=>C.isFloat32Array(e)&&V(e),Float64Array:e=>C.isFloat64Array(e)&&V(e),Headers:e=>B(e,Headers.prototype)&&Rr(e),Int8Array:e=>C.isInt8Array(e)&&V(e),Int16Array:e=>C.isInt16Array(e)&&V(e),Int32Array:e=>C.isInt32Array(e)&&V(e),Map:e=>C.isMap(e)&&zr(e),RegExp:e=>C.isRegExp(e)&&{source:dr(e),flags:fr(e)},Set:e=>C.isSet(e)&&Br(e),URL:e=>B(e,URL.prototype)&&Ir(e),WorkflowFunction:e=>{if(typeof e!=`function`)return!1;let t=z(e,`workflowId`);return typeof t==`string`&&{workflowId:t}},URLSearchParams:e=>{if(!B(e,URLSearchParams.prototype))return!1;let t=Lr(e);return t===``?`.`:t},Uint8Array:e=>C.isUint8Array(e)&&V(e),Uint8ClampedArray:e=>C.isUint8ClampedArray(e)&&V(e),Uint16Array:e=>C.isUint16Array(e)&&V(e),Uint32Array:e=>C.isUint32Array(e)&&V(e)}}function li(e=globalThis){return{ArrayBuffer:t=>H(t,e),BigInt:t=>e.BigInt(t),BigInt64Array:t=>new e.BigInt64Array(H(t,e)),BigUint64Array:t=>new e.BigUint64Array(H(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:si(e,`EvalError`),FatalError:t=>{let n=new(e[Symbol.for(`@workflow/errors//FatalError`)]??l)(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`)]??o)(t.token,t.conflictingRunId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RangeError:si(e,`RangeError`),ReferenceError:si(e,`ReferenceError`),RetryableError:t=>{let n=new(e[Symbol.for(`@workflow/errors//RetryableError`)]??h)(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`)]??m,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},StreamError:t=>{let n=new(e[Symbol.for(`@workflow/errors//StreamError`)]??c)(t.message,{...`cause`in t?{cause:t.cause}:{},status:t.status,url:t.url});return t.stack!==void 0&&(n.stack=t.stack),n},SyntaxError:si(e,`SyntaxError`),TypeError:si(e,`TypeError`),URIError:si(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(H(t,e)),Float64Array:t=>new e.Float64Array(H(t,e)),Headers:t=>new e.Headers(t),Int8Array:t=>new e.Int8Array(H(t,e)),Int16Array:t=>new e.Int16Array(H(t,e)),Int32Array:t=>new e.Int32Array(H(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(H(t,e)),Uint8ClampedArray:t=>new e.Uint8ClampedArray(H(t,e)),Uint16Array:t=>new e.Uint16Array(H(t,e)),Uint32Array:t=>new e.Uint32Array(H(t,e))}}function ui(){return{StepFunction:e=>{if(typeof e!=`function`)return!1;let t=z(e,`stepId`);if(typeof t!=`string`)return!1;let n=z(e,`__closureVarsFn`),r;typeof n==`function`&&(or(n)||sr(`method`,`__closureVarsFn`),r=n());let i=Fr(e,`__boundThis`),a=i?z(e,`__boundThis`):void 0,o=z(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 di(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 fi(e){return e.length===4&&/^[a-z0-9]{4}$/.test(e)}const U={DEVALUE_V1:`devl`,ENCRYPTED:`encr`,SEALED:`encp`,GZIP:`gzip`,ZSTD:`zstd`},pi=new TextEncoder,mi=new TextDecoder,hi=1e5,gi={operations:{createSparseArray(e){if(e>hi)throw RangeError(`Sparse array length ${e} exceeds the maximum of ${hi}`);return Wt.createSparseArray(e)}}};function _i(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...$r(),...ui(),...ci(t)};break;case`step`:r={...$r(),...ci(t)};break;case`client`:r={...$r(),...ci(t)};break}return n?{...r,...n}:r}function vi(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...ei(t),...di(t),...li(t)};break;case`step`:r={...ei(t),...li(t)};break;case`client`:r={...ei(t),...li(t),StepFunction:()=>{throw Error(`Step functions cannot be deserialized in client context.`)}};break}return n?{...r,...n}:r}const W={formatPrefix:U.DEVALUE_V1,serialize(e,t,n){let r=_i(t,n?.global,n?.extraReducers),i=rr(n?.guestCodeStats,()=>qt(e,r,{operations:Kr}));return pi.encode(i)},deserialize(e,t,n){let r=vi(t,n?.global,n?.extraRevivers);return Gt(mi.decode(e),r,gi)},deserializeLegacy(e,t,n){return Kt(e,vi(t,n?.global,n?.extraRevivers),gi)}},yi=new TextEncoder,bi=new TextDecoder;function G(e,t){if(!(t instanceof Uint8Array))return t;let n=yi.encode(e),r=new Uint8Array(4+t.length);return r.set(n,0),r.set(t,4),r}function xi(e){if(!(e instanceof Uint8Array)||e.length<4)return null;let t=e.subarray(0,4),n=bi.decode(t);return fi(n)?n:null}function K(e){if(!(e instanceof Uint8Array))return{format:U.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=bi.decode(t);if(!fi(n))throw Error(`Invalid format prefix: "${n}". Must be 4 characters of [a-z0-9].`);return{format:n,payload:e.subarray(4)}}function Si(){try{return typeof process<`u`&&process.env?.WORKFLOW_DISABLE_COMPRESSION===`1`}catch{return!1}}function Ci(){try{let e=process.env?.WORKFLOW_COMPRESSION_CODEC;return e===`gzip`||e===`zstd`?e:void 0}catch{return}}function wi(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function Ti(){let e=wi();return typeof e?.zstdCompressSync==`function`&&typeof e?.zstdDecompressSync==`function`}function Ei(){return typeof CompressionStream==`function`&&typeof DecompressionStream==`function`}async function Di(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 Oi(e){return Di(e,new CompressionStream(`gzip`))}async function ki(e){return Di(e,new DecompressionStream(`gzip`))}function Ai(e){let t=wi(),n=t?.constants?.ZSTD_c_compressionLevel,r=n===void 0?void 0:{params:{[n]:3}};return new Uint8Array(t.zstdCompressSync(e,r))}function ji(e){let t=wi();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 Mi(e,t,n,r){e&&(e.recorded=!0,e.compressed=t!==`none`,e.codec=t,e.uncompressedBytes=n,e.storedBytes=r)}function Ni(){return Ci()===`gzip`?Ei()?`gzip`:`none`:Ti()?`zstd`:Ei()?`gzip`:`none`}async function Pi(e,t,n){if(!(e instanceof Uint8Array))return e;if(!t||e.length<1024||Si())return Mi(n,`none`,e.length,e.length),e;let r=Ni();if(r===`none`)return Mi(n,`none`,e.length,e.length),e;let i=r===`zstd`?Ai(e):await Oi(e),a=r===`zstd`?U.ZSTD:U.GZIP,o=4+i.length;return o>=e.length*.95?(Mi(n,`none`,e.length,e.length),e):(Mi(n,r,e.length,o),G(a,i))}async function Fi(e,t){if(!(e instanceof Uint8Array))return e;let n=xi(e);if(n===U.ZSTD){let{payload:n}=K(e),r=ji(n);return Mi(t,`zstd`,r.length,e.length),r}if(n===U.GZIP){if(!Ei())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}=K(e),r=await ki(n);return Mi(t,`gzip`,r.length,e.length),r}return Mi(t,`none`,e.length,e.length),e}const Ii=Symbol.for(`workflow.serialization.sealTarget`),Li=Symbol.for(`workflow.serialization.runKeys`);function Ri(e,t){return{[Ii]:!0,recipientPublicKey:e,aad:t}}function zi(e,t,n){return{[Li]:!0,aes:e,keyPair:t,aad:n}}async function Bi(e){let[t,n]=await Promise.all([Zt(e),zn(e)]);return zi(t,n)}function Vi(e){return typeof e==`object`&&!!e&&e[Ii]===!0}function Hi(e){return typeof e==`object`&&!!e&&e[Li]===!0}function Ui(e){if(e){if(Hi(e))return e.aes;if(!Vi(e))return e}}async function Wi(e){return typeof e==`function`?e():e}async function Gi(e,t){if(!t||!(e instanceof Uint8Array))return e;if(Vi(t)){let n=await Xn(t.recipientPublicKey,e,t.aad);return G(U.SEALED,n)}let n=await Qt(Hi(t)?t.aes:t,e);return G(U.ENCRYPTED,n)}async function Ki(e,t){if(!Hi(t))throw new m(`Sealed data encountered but no run keypair is available. Opening a sealed payload requires the run's own encryption key material; a symmetric key or a seal-only target cannot decrypt it.`,{context:{operation:`decrypt`,byteLength:e.byteLength,formatPrefix:`encp`}});let{payload:n}=K(e);try{return await Zn(t.keyPair,n,t.aad)}catch(e){throw m.is(e)&&e.context&&(e.context.formatPrefix=U.SEALED),e}}async function qi(e,t){if(!(e instanceof Uint8Array))return e;let n=xi(e);if(n===U.SEALED)return Ki(e,t);if(n!==U.ENCRYPTED)return e;let r=Ui(t);if(!r)throw new m(`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`}});let{payload:i}=K(e);try{return await $t(r,i)}catch(e){throw m.is(e)&&e.context&&(e.context.formatPrefix=n),e}}function Ji(e,t,n){let[r,...i]=t.split(`
|
|
6
|
+
`),a=i.join(`
|
|
7
|
+
`),o=Yi(r??``,n),s=Xi(a),c=[`${e} ${r??``}`];return o&&c.push(o),s&&c.push(s),c.join(`
|
|
8
|
+
`)}function Yi(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 r=new Set([`workflowRunId`,`workflowName`,`stepId`,`stepName`,`errorAttribution`,`errorCode`,`errorName`,`errorMessage`,`errorStack`,`hint`,`attempt`,`retryCount`]),i=[],a=q(t,`errorName`),o=q(t,`errorAttribution`);if(a||o){let e=o?o===`sdk`?Te(`sdk error`):we(`user error`):``,t=a?Ce(a):``,n=e&&t?T(` · `):``;i.push(` ${e}${n}${t}`)}let s=q(t,`workflowRunId`),c=q(t,`workflowName`);s?i.push($i(`run`,s,c,fe)):c&&i.push($i(`run`,null,c,fe));let l=q(t,`stepId`),u=q(t,`stepName`);if((l||u)&&i.push($i(`step`,l,u,de)),t.attempt!==void 0||t.retryCount!==void 0){let e=t.attempt,n=t.retryCount;e!==void 0&&n!==void 0?i.push(` ${Qi(`retry`)} ${e} ${T(`attempts ·`)} ${n} ${T(`max retries`)}`):e!==void 0&&i.push(` ${Qi(`retry`)} ${e} ${T(`attempts`)}`)}let d=q(t,`errorCode`);d&&d!==a&&i.push(` ${Qi(`code`)} ${T(d)}`);let f=q(t,`hint`);f&&i.push(` ${be(f)}`);let p=Object.entries(t).filter(([e,t])=>!r.has(e)&&!n.has(e)&&t!=null).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of p)i.push(` ${Qi(e)} ${ea(t)}`);return i.length?i.join(`
|
|
9
|
+
`):null}function Xi(e){if(!e)return null;let t=e.split(`
|
|
10
|
+
`),n=[],r=0,i=0,a=0,o=()=>{r>0&&(n.push(T(` … ${r} more ${r===1?`frame`:`frames`} in framework internals`)),r=0)};for(let e of t){let t=e.trimStart().startsWith(`at `);if(t&&Zi(e)){r++;continue}if(t&&i>=6){a++;continue}o(),n.push(e),t&&i++}return o(),a>0&&n.push(T(` … ${a} more ${a===1?`frame`:`frames`} (run \`pnpm wf inspect run <id>\` for the full stack)`)),n.join(`
|
|
11
|
+
`)}function Zi(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 q(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Qi(e){return T(e.padEnd(6))}function $i(e,t,n,r){let i=t||T(`—`),a=n&&(e===`run`?le(n):ue(n))?`${T(`·`)} ${r(n)}`:``;return` ${Qi(e)} ${i}${a?` `+a:``}`}function ea(e){if(typeof e==`string`)return e.includes(`
|
|
12
|
+
`)?e.split(`
|
|
13
|
+
`).map((e,t)=>t===0?e:` ${e}`).join(`
|
|
14
|
+
`):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function J(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const ta=J(`workflow.name`),na=J(`workflow.operation`),ra=J(`workflow.run.id`),ia=J(`workflow.run.status`),aa=J(`workflow.started_at`),oa=J(`workflow.events.count`),sa=J(`workflow.execution.mode`),ca=J(`workflow.bundle.compile.cache_hit`),la=J(`workflow.replay.load.source`),ua=J(`workflow.events.parked.count`),da=J(`workflow.events.parked.event_id`),fa=J(`workflow.events.parked.event_type`),pa=J(`workflow.arguments.count`),ma=J(`workflow.result.type`),ha=J(`workflow.trace.propagated`),ga=J(`workflow.trace.mode`),_a=J(`workflow.turbo`),va=J(`workflow.error.name`),ya=J(`workflow.error.message`),ba=J(`workflow.error.code`),xa=J(`workflow.steps.created`),Sa=J(`workflow.hooks.created`),Ca=J(`workflow.waits.created`),wa=J(`workflow.steps.failed_serialization`),Ta=J(`workflow.inline_ownership.owned_recovery_steps`),Ea=J(`workflow.inline_ownership.backstop_wakes_armed`),Da=J(`workflow.route.type`),Oa=J(`workflow.route.handler_cached`),ka=J(`workflow.route.invocation_count`),Aa=J(`workflow.route.entrypoint_age_ms`),ja=J(`workflow.route.module_body_init_ms`),Ma=J(`faas.instance`),Na=J(`step.name`),Pa=J(`step.id`),Fa=J(`step.attempt`),Ia=J(`step.status`),La=J(`step.max_retries`),Ra=J(`step.ttfs_ms`),za=J(`step.stso_ms`),Ba=J(`step.rsfs_ms`),Va=J(`step.final_scheduling_replay_ms`),Ha=J(`step.latency_optimizations`),Ua=J(`step.skipped`),Wa=J(`step.skip_reason`),Ga=J(`step.arguments.count`),Ka=J(`step.result.type`),qa=J(`step.error.name`),Ja=J(`step.error.message`),Ya=J(`step.fatal_error`),Xa=J(`step.retry.exhausted`),Za=J(`step.retry.timeout_seconds`),Qa=J(`step.retry.will_retry`),$a=J(`messaging.system`),eo=J(`messaging.destination.name`),to=J(`messaging.message.id`),no=J(`messaging.operation.type`),ro=J(`workflow.queue.overhead_ms`),io=J(`deployment.id`),ao=J(`workflow.deployment.pinned_id`),oo=J(`workflow.deployment_mismatch.retry_count`),so=J(`workflow.deployment_mismatch.recovered`),co=J(`workflow.hook.token`),lo=J(`workflow.hook.id`),uo=J(`workflow.hook.found`),fo=J(`workflow.hook.resume_committed`),po=J(`workflow.hook.wake_published`),mo=J(`workflow.hook.resilient_resume_materialized`),ho=J(`workflow.resume_setup_source`),go=J(`workflow.step.resilient_dispatch_recovered`),_o=J(`workflow.step.resilient_dispatch_materialized`),vo=J(`workflow.resume.total_ms`),yo=J(`workflow.resume.phase.producer_prep_ms`),bo=J(`workflow.resume.phase.queue_delivery_ms`),xo=J(`workflow.resume.phase.resume_setup_ms`),So=J(`workflow.resume.phase.replay_ms`),Co=J(`workflow.resume.phase.step_dispatch_ms`),wo=J(`workflow.resume.phase.step_claim_ms`),To=J(`workflow.resume.phase.step_prepare_ms`),Eo=J(`workflow.resume.trigger`),Do=J(`workflow.resume.strategy`),Oo=J(`workflow.resume.setup_source`),ko=J(`workflow.resume.step_execution`),Ao=J(`workflow.suspension.state`),jo=J(`workflow.suspension.hook_count`),Mo=J(`workflow.suspension.step_count`),No=J(`workflow.suspension.wait_count`),Po=J(`http.request.method`),Fo=J(`http.route`),Io=J(`http.response.status_code`),Lo=J(`error.type`),Ro=J(`workflow.events.pages_loaded`),zo=J(`workflow.queue.deserialize_time_ms`),Bo=J(`workflow.queue.execution_time_ms`),Vo=J(`workflow.queue.serialize_time_ms`),Ho=J(`workflow.serialization.operation`),Uo=J(`workflow.serialization.compressed`),Wo=J(`workflow.serialization.codec`),Go=J(`workflow.serialization.uncompressed_bytes`),Ko=J(`workflow.serialization.stored_bytes`),qo=J(`workflow.serialization.compression_ratio`),Jo=J(`workflow.serialization.guest_code_executions`),Yo=J(`workflow.serialization.guest_code_details`),Xo=J(`peer.service`),Zo=J(`rpc.system`),Qo=J(`rpc.service`),$o=J(`rpc.method`),es=J(`error.retryable`),ts=J(`error.category`),ns=n(`@workflow/core//traceModeWarnings`,1,()=>({unrecognized:new Set}));function rs(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!ns.unrecognized.has(e)&&(ns.unrecognized.add(e),Ms.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function is(e){return e!==void 0&&Object.keys(e).length>0}function as(e,t){return e===`linked`&&is(t)?Promise.resolve(t):ss()}async function os(e,t){if(e!==`linked`)return Es();let n=await Ds(is(t)?t:void 0);return n?[n]:void 0}async function ss(){let e=await Y.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function cs(e){let t=await Y.value;if(t)return t.propagation.extract(t.context.active(),e)}async function ls(e,t){if(!e)return t();let n=await Y.value;if(!n)return t();let r=await cs(e);return r?n.context.with(r,async()=>await t()):t()}const Y=_(async()=>{try{return await import(`../../@opentelemetry/api/index.js`)}catch{return Ms.info(`OpenTelemetry not available, tracing will be disabled`),null}}),us=_(async()=>{let e=await Y.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return ms(e,t),t}),ds=_(async()=>{let e=await Y.value;return e?e.metrics.getMeter(`workflow`).createHistogram(`workflow.step.execute.duration`,{description:`Duration of user step execution`,unit:`ms`}):null});let fs=!1;function ps(e){try{return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:String(e)}catch{return`Unknown error`}}function ms(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(fs||!n)){fs=!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 hs(e,...t){let[n,r]=await Promise.all([us.value,Y.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 ee.is(t)?(e.setStatus({code:r.SpanStatusCode.OK}),xs(t,e)):e.setStatus({code:r.SpanStatusCode.ERROR,message:ps(t)}),t}finally{e.end()}})}async function gs(e){let[t,n]=await Promise.all([us.value,Y.value]);if(!t||!n)return{end(){},fail(){}};let r=t.startSpan(e),i=!1,a=e=>{i||(i=!0,r.setStatus(e),r.end())};return{end:()=>a({code:n.SpanStatusCode.OK}),fail:e=>a({code:n.SpanStatusCode.ERROR,message:ps(e)})}}async function _s(e){let t=await Y.value;return t?t.context.bind(t.context.active(),e):e}async function vs(){let e=await Y.value;if(!e)return{refresh(){},run:e=>e()};let t=e.context.active(),n={getValue:e=>t.getValue(e),setValue:(e,n)=>t.setValue(e,n),deleteValue:e=>t.deleteValue(e)};return{refresh:()=>{t=e.context.active()},run:t=>e.context.with(n,t)}}async function ys(e,t,n){let r=await us.value;r&&r.startSpan(e,{...n,startTime:t}).end()}async function bs(e,t){(await ds.value)?.record(e,{"workflow.step.status":t})}function xs(e,t){t.setAttributes({...Ao(`suspended`),...Mo(e.stepCount),...jo(e.hookCount),...No(e.waitCount)})}async function Ss(e){let[t,n]=await Promise.all([cs(e),Y.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function Cs(){return await Ts(e=>e.trace.getActiveSpan())}async function ws(e){return Ts(t=>t.SpanKind[e])}async function Ts(e){let t=await Y.value;if(t)return await e(t)}function Es(){return Ts(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function Ds(e){if(!e)return;let[t,n]=await Promise.all([Ss(e),Y.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function Os(e,t){let n=await Y.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 ks(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 As(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)(Ji(`[workflow-sdk]`,i,c)),ks(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),Cs().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 js=As(`step`),Ms=As(`runtime`),Ns=As(`webhook`),X=As(`events`);As(`adapter`),As(`build`,{debugNamespace:`workflow:build`});function Ps(e){if(m.is(e))throw e}function Z(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof k&&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 k&&t.value!==void 0&&Ms.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function Fs(e,t,n){try{let r=W.serialize(e,`client`,n);return Gi(await Pi(G(U.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){Ps(e);let{message:t,hint:n}=Z(`client value`,e);throw new p(t,{hint:n,cause:e})}}async function Is(e,t,n){let r=await Fi(await qi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(W.deserializeLegacy)return W.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=K(r);if(i===U.DEVALUE_V1)return W.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function Ls(e,t,n){try{let r=W.serialize(e,`step`,n);return Gi(await Pi(G(U.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){Ps(e);let{message:t,hint:n}=Z(`step value`,e);throw new p(t,{hint:n,cause:e})}}async function Rs(e,t,n){let r=await Fi(await qi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(W.deserializeLegacy)return W.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=K(r);if(i===U.DEVALUE_V1)return W.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function zs(e,t){if(!(e instanceof Uint8Array)){if(W.deserializeLegacy)return W.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=K(e);if(n===U.DEVALUE_V1)return W.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const Bs=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),Vs=(()=>{let e=globalThis;return e[Bs]??=new se,e[Bs]})();function Hs(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${i(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${i(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${i(`timer`,`timers`,n)}`);let a=[];e>0&&a.push(`steps are completed`),t>0&&a.push(`hooks are received`),n>0&&a.push(`timers have elapsed`);let o=a.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function Us(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function Ws(e){return`strm_${e}_system_abort`}function Gs(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return Ws(e.slice(5))}const Ks=()=>S(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10}),qs=new Set([`hook_received`,`hook_conflict`,`wait_completed`,`attr_set`,`run_cancelled`]),Js=new Set([`wait_completed`]);function Ys(e,t){return`${e}:${t}`}const Xs=new Set([`run_completed`,`run_failed`,`run_cancelled`]);var Q;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Q||={});var Zs=class{eventIndex;events;callbacks=[];parked=[];resolved=new Set;seenEventClasses=new Map;onConsumedEvent;onUnconsumedEvent;onDuplicateEvent;getPromiseQueue;isDeliveryIdle;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;constructor(e,t){this.events=[...e],this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.onDuplicateEvent=t.onDuplicateEvent,this.getPromiseQueue=t.getPromiseQueue,this.isDeliveryIdle=t.isDeliveryIdle}get strandedEvent(){return this.parked[0]?.event}get parkedSummary(){let e=this.parked[0]?.event;if(e)return{count:this.parked.length,eventId:e.eventId,eventType:e.eventType}}append(e){for(let t of e)this.events.push(t);process.nextTick(this.consume)}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){X.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){this.drainParked();let e=this.events[this.eventIndex]??null;if(e!==null&&ie(e)){this.skipSealedNoop(e);continue}let t=this.offer(e);if(t&&this.eventIndex++,e===null){t||this.handleEndOfLog();return}if(!t){let t=this.firstEventTypeOfClass(e);if(t!==void 0){this.skipDuplicateEvent(e,t);continue}this.scheduleUnconsumedCheck(e,!0);return}}};offer(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Q.NotConsumed;try{r=n(e)}catch(e){X.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Q.Consumed&&r!==Q.Finished))return e!==null&&(e.correlationId&&Js.has(e.eventType)&&this.resolved.add(Ys(e.eventType,e.correlationId)),this.recordEventClass(e),this.notifyConsumedEvent(e)),r===Q.Finished&&this.callbacks.splice(t,1),!0}return!1}drainParked(){let e=this.parked.length>0;for(;e;){e=!1,this.dropParkedDuplicates();for(let t=0;t<this.parked.length;t++){let n=this.parked[t],r=this.eventIndex;this.eventIndex=n.index;let i;try{i=this.offer(n.event)}finally{this.eventIndex=r}if(i){this.parked.splice(t,1),e=this.parked.length>0;break}}}}dropParkedDuplicates(){for(let e=this.parked.length-1;e>=0;e--){let t=this.parked[e].event,n=this.firstEventTypeOfClass(t);if(n!==void 0){this.parked.splice(e,1),X.debug(`Releasing a parked event that repeats a class already in the log`,{eventId:t.eventId,eventType:t.eventType,firstEventType:n,correlationId:t.correlationId});try{this.onDuplicateEvent?.(t,n)}catch(e){X.error(`onDuplicateEvent callback threw an error`,{error:e})}}}}park(e){return!qs.has(e.eventType)||e.correlationId&&this.resolved.has(Ys(e.eventType,e.correlationId))?!1:(this.parked.push({event:e,index:this.eventIndex}),this.eventIndex++,X.debug(`Parked an unclaimed event for later delivery`,{eventId:e.eventId,eventType:e.eventType,correlationId:e.correlationId,parked:this.parked.length}),!0)}eventClassKey(e){let t=re(e);return t===void 0?void 0:`${t.eventClass}:${t.entity}`}recordEventClass(e){let t=this.eventClassKey(e);t!==void 0&&!this.seenEventClasses.has(t)&&this.seenEventClasses.set(t,e.eventType)}firstEventTypeOfClass(e){let t=this.eventClassKey(e);return t===void 0?void 0:this.seenEventClasses.get(t)}skipSealedNoop(e){this.eventIndex++,X.debug(`Skipping sealed-log noop event`,{eventId:e.eventId})}skipDuplicateEvent(e,t){this.eventIndex++,X.debug(`Skipping event that repeats a class already in the log`,{eventId:e.eventId,eventType:e.eventType,firstEventType:t,correlationId:e.correlationId});try{this.onDuplicateEvent?.(e,t)}catch(e){X.error(`onDuplicateEvent callback threw an error`,{error:e})}}handleEndOfLog(){if(this.parked.length===0)return;let e=this.events.at(-1);if(!e||!Xs.has(e.eventType)){X.debug(`Reached the end of the log still holding events`,{eventId:this.parked[0].event.eventId,eventType:this.parked[0].event.eventType,correlationId:this.parked[0].event.correlationId,parked:this.parked.length});return}this.scheduleUnconsumedCheck(this.parked[0].event,!1)}scheduleUnconsumedCheck(e,t){let n=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.whenDeliveryIdle(n,()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===n&&(this.pendingUnconsumedCheck=null,this.resolveUnconsumedEvent(e,t))},Ks())})})}resolveUnconsumedEvent(e,t){if(t){if(this.events[this.eventIndex]!==e)return;if(this.park(e)){this.consume();return}}this.onUnconsumedEvent(e)}whenDeliveryIdle(e,t){let n=()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===e){if(this.isDeliveryIdle()){t();return}this.getPromiseQueue().then(()=>{this.unconsumedCheckVersion===e&&(this.pendingUnconsumedTimeout=setTimeout(n,0))})}};n()}},Qs=class{aborted=!1;reason=void 0;[j];[M];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[j]=e,this[M]=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 $s(e){return class{signal;[j];[M];constructor(){let t=e.generateUlid(),n=Ws(t),r=`abrt_${t}`;this[j]=n,this[M]=r,this.signal=new Qs(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 Q.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[M])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new f(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[M]}"`,{eventId:t.eventId}))}),Q.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Q.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload,r=e.eventsConsumer.eventIndex,a=g(e,r,`hook`),o=b(e,r,`hook`);return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let r;try{if(n!==void 0)try{let i=await e.replayPayloadCache.prepareEventPayload(t.eventId,`payload`,n),a=await nl(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}}finally{e.pendingDeliveries--}o.then(()=>{a.markDelivered(),this.signal._setAborted(r)})}),e.invocationsQueue.delete(i),Q.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Q.Finished):Q.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[M]){n.abortRequested=!0,n.abortReason=t;break}}}}}function ec(){return{abort(e){let t=new Qs(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new Qs(``,``),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 tc=ae();function nc(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function rc(e){return Ps(e),e instanceof p&&e.cause!==void 0||e instanceof d&&e.cause!==void 0?e.cause:e}async function $(e,t){if(e.recorded)try{let n=await Cs();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...Ho(t),...Uo(e.compressed??!1),...Wo(e.codec??`none`),...Go(r),...Ko(i),...e.compressed&&r>0?qo(1-i/r):{}})}catch{}}async function ic(e){let t=e.totalExecutions??e.executions.length;if(t!==0)try{let n=await Cs();if(!n)return;let r=[...new Set(e.executions.map(e=>e.detail?`${e.kind} (${e.detail})`:e.kind))];n.setAttributes({...Jo(t),...Yo(r)})}catch{}}function ac(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0},i;return new TransformStream({async transform(a,o){try{r.resolved||(r.key=await Wi(t),r.resolved=!0,Vi(r.key)&&(i=Qn(r.key.recipientPublicKey,r.key.aad)));let s=qt(a,e),c=n.encode(s),l=G(U.DEVALUE_V1,c);i?l=G(U.SEALED,await i.seal(l)):r.key&&(l=await Gi(l,r.key));let u=new Uint8Array(4+l.length);new DataView(u.buffer).setUint32(0,l.length,!1),u.set(l,4),o.enqueue(u)}catch(e){if(m.is(e)){o.error(e);return}let{message:t,hint:n}=Z(`stream chunk`,e);o.error(new p(t,{hint:n,cause:e}))}}})}function oc(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0},a;function o(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function s(o){for(i.resolved||(i.key=await Wi(t),i.resolved=!0,Hi(i.key)&&(a=$n(i.key.keyPair,i.key.aad)));r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let s=r.slice(4,4+t);r=r.slice(4+t);let{format:c,payload:l}=K(s);if(c===U.ENCRYPTED||c===U.SEALED){let e=c===U.SEALED;if(!(e?Hi(i.key):Ui(i.key)!==void 0)){o.error(new m(e?`Sealed stream data encountered but no run keypair is available. Opening a sealed frame requires the run's own encryption key material.`:`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:l.byteLength,formatPrefix:e?`encp`:`encr`}}));return}let t;try{t=e?await a.open(K(s).payload):await qi(s,i.key)}catch(e){throw m.is(e)&&e.context&&(e.context.formatPrefix=c),e}({format:c,payload:l}=K(t))}if(c===U.DEVALUE_V1){let t=n.decode(l);o.enqueue(Gt(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){o(t),await s(i);return}}else if(r.length>0){o(t),await s(i);return}let a=n.decode(t).split(`
|
|
15
|
+
`);for(let t of a)t.length>0&&i.enqueue(Gt(t,e))},async flush(e){r.length>0&&await s(e)}})}const sc=1e8;function cc(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>sc){t.error(new d(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${sc}). 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 lc(){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>sc){r.error(new d(`Byte-stream frame length ${t} exceeds maximum (${sc}). 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 d(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function uc(e,t,n,r,i){(async()=>{await ys(`workflow.stream.read`,e,{kind:await ws(`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 dc(e,t,n,r){(async()=>{await ys(`workflow.stream.read.resolve_key`,e,{kind:await ws(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.read.key_succeeded":r}})})()}function fc(e,t,n,r,i,a){(async()=>{await ys(`workflow.stream.read.complete`,e,{kind:await ws(`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 pc=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new d(`"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 N(),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&&fc(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,uc(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 mc=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),hc=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function gc(e,t,n,r=async()=>void 0){let i=n===void 0||n>=0,o=n??0,s=0,l=0,u=0,d,f=!1,p,m=new Uint8Array,h,g,_=!1,v=0,y=0,b=!1;function ee(){if(b)return;b=!0;let n=Date.now();r().then(r=>{r&&dc(n,e,t,!0)},()=>dc(n,e,t,!1))}async function x(){if(f)return!1;let r=await N();if(f)return!1;let a=i?o+s:n,c=Date.now(),l=await r.streams.get(e,t,a);return f?(await l.cancel(p).catch(()=>{}),!1):(g===void 0&&(g=Date.now()-c),d=l.getReader(),!0)}async function S(){try{let n=await(await N()).streams.getInfo(e,t);return n.done&&o+s>n.tailIndex}catch{return!0}}async function te(){if(f||(d&&=(await d.cancel().catch(()=>{}),void 0),f))return!1;o+=s,s=0,m=new Uint8Array;let e=mc(),n=hc();for(;;){if(l++,u++,l>e)throw new c(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(u>n)throw new c(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{return!!await x()}catch(e){if(f)return!1;if(a.is(e))throw e}}}return new ReadableStream({pull:async r=>{if(!f)for(h===void 0&&(h=Date.now()),ee();;){if(!d)try{if(!await x())return}catch(e){if(f)return;r.error(e);return}let a;try{a=await d.read()}catch(e){if(f)return;if(!i){r.error(e);return}try{if(!await te())return}catch(e){r.error(e);return}continue}if(f)return;if(a.done||!a.value){d=void 0;let n=!i||await S();if(f)return;if(!n){try{if(!await te())return}catch(e){r.error(e);return}continue}h!==void 0&&fc(h,e,t,v,y,u),r.close();return}let o=a.value;if(o.length>0){let e=new Uint8Array(m.length+o.length);e.set(m,0),e.set(o,m.length),m=e}let c=!1;for(;m.length>=4;){let i=4+new DataView(m.buffer,m.byteOffset,m.byteLength).getUint32(0,!1);if(m.length<i)break;r.enqueue(m.slice(0,i)),m=m.slice(i),s++,v++,y+=i,!_&&h!==void 0&&(_=!0,uc(h,e,t,n,g)),c=!0}if(c){l=0;return}}},cancel:async e=>{f=!0,p=e;let t=d;d=void 0,t&&await t.cancel(e).catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)})}})}const _c=()=>{let e=S(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,NaN,{integer:!0});return Number.isNaN(e)?void 0:e};function vc(e,t,n,r,i,a,o){(async()=>{await ys(`workflow.stream.flush`,e,{kind:await ws(`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 yc(e,t,n){(async()=>{await ys(`workflow.stream.close`,e,{kind:await ws(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var bc=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new d(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new d(`"name" is required, got "${t}"`);let r=N(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=0,c=0,l=0,u=null,f=null,p,m=_c(),h=null,g=yn(),_=bn(),v=vn(),y=xn(),b,ee=[],x=[],S=e=>{let t=[...ee,...x];ee=[],x=[];for(let n of t)n.reject(e)},te=()=>{let e=0,t=0;for(let n of o){if(e>=g||e>0&&t+n.byteLength>_)break;e++,t+=n.byteLength}let n=o.slice(0,e);return o=o.slice(e),s-=t,{group:n,bytes:t}},ne=async(n,i,o)=>{await a();let s=await r,c=Date.now();if(typeof s.streams.writeMulti==`function`&&n.length>1)await s.streams.writeMulti(e,t,n);else for(let r of n)await s.streams.write(e,t,r);o!==void 0&&vc(o,c,e,t,n.length,i,Date.now()-c)},re=async()=>{for(;o.length>0;){u&&=(clearTimeout(u),null);let e=b,t=Date.now(),{group:n,bytes:r}=te();c=n.length,l=r,b=o.length>0?t:void 0;try{await ne(n,r,e),c=0,l=0}catch(t){throw o=n.concat(o),s+=r,c=0,l=0,b=e!==void 0&&b!==void 0?Math.min(e,b):e??b,t}let i=ee;ee=[];for(let e of i)e.resolve()}},ie=()=>{f||p!==void 0||o.length===0||(f=re().then(()=>{if(f=null,o.length>0){ie();return}let e=x;x=[];for(let t of e)t.resolve()},e=>{f=null,p??=e,S(p)}))},ae=()=>{if(!(u||f)){if(m===void 0){h??=Promise.resolve(r).then(e=>{m=e.streamFlushIntervalMs??0},()=>{m=0}).then(()=>{o.length>0&&ae()});return}if(m<=0){ie();return}u=setTimeout(()=>{u=null,ie()},m)}},oe=async()=>{for(;;){if(p!==void 0)throw p;if(o.length===0&&!f)return;ie(),await new Promise((e,t)=>{x.push({resolve:e,reject:t})})}};super({async write(e){if(p!==void 0)throw p;for(b===void 0&&(b=Date.now()),o.push(e),s+=e.byteLength,o.length>=g||s>=_?ie():ae();p===void 0&&(o.length+c>=v||s+l>=y);)ie(),await new Promise((e,t)=>{ee.push({resolve:e,reject:t})});if(p!==void 0)throw p},async close(){await oe(),await a();let n=await r,i=Date.now();await n.streams.close(e,t),yc(i,e,t)},async abort(e){try{await oe()}catch{}u&&=(clearTimeout(u),null),o=[],s=0,p??=e??Error(`Stream aborted`),S(p)}}),Object.defineProperty(this,fn,{value:oe,enumerable:!1,writable:!1})}};function xc(e=globalThis){let t=_(()=>Ec(e,`Request`)),n=_(()=>Ec(e,`Response`));return{...$r(),...ui(),...ci(e),Request:e=>{if(!B(e,t.value))return!1;let n={method:z(e,`method`),url:z(e,`url`),headers:z(e,`headers`),body:z(e,`body`),duplex:z(e,`duplex`)},r=z(e,mn);r&&(n.responseWritable=r);let i=z(e,`signal`);return i&&(z(i,`aborted`)||z(i,j))&&(n.signal=i),n},Response:e=>B(e,n.value)?{type:z(e,`type`),url:z(e,`url`),status:z(e,`status`),statusText:z(e,`statusText`),headers:z(e,`headers`),body:z(e,`body`),redirected:z(e,`redirected`)}:!1}}function Sc(e,t,n,r,i,a){let o=t[j],s=t[M];if(!o){let e=(n[on]||tc)();o=Ws(e),s=`abrt_${e}`,t[j]=o,t[M]=s,t.signal&&(t.signal[j]=o,t.signal[M]=s)}return wc(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function Cc(e,t){let n=t[j]??t.signal?.[j],r=t[M]??t.signal?.[M];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 wc(e,t,n,r,i){e.aborted||e[gn]||(e[gn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await Wi(r),a=await Yc({aborted:!0,reason:e.reason},n,i),o=new bc(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function Tc(e=globalThis,t,n,r,i=!1,a,o=t){return{...xc(e),ReadableStream:s=>{if(!(s instanceof e.ReadableStream))return!1;if(s.locked)throw new p(`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 c=`strm_${(e[on]||tc)()}`,l=nc(s),u=new bc(n,c,a);l===`bytes`?i?t.push(s.pipeThrough(cc()).pipeTo(u)):t.push(s.pipeTo(u)):t.push(s.pipeThrough(ac(Tc(e,t,n,r,i,a,o),r)).pipeTo(u));let d={name:c};return l&&(d.type=l),l===`bytes`&&i&&(d.framing=`framed-v1`),d},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let r=t[A],i=t[ln];if(typeof r==`string`&&typeof i==`string`){let e={name:r,runId:i},n=t[dn];typeof n==`string`&&(e.encryptionPublicKey=n);let a=t[un];return typeof a==`string`&&(e.deploymentId=a),e}let a=`strm_${(e[on]||tc)()}`,s=new pc(n,a);return o.push(s.pipeTo(t)),{name:a}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Sc(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Sc(i,i,e,t,n,r)}}function Ec(e,t){let n=z(e,t)??z(globalThis,t);if(typeof n==`function`)return z(n,`prototype`)}function Dc(e=globalThis){let t=_(()=>Ec(e,`ReadableStream`)),n=_(()=>Ec(e,`WritableStream`)),r=_(()=>Ec(e,`AbortController`)),i=_(()=>Ec(e,`AbortSignal`));return{...xc(e),ReadableStream:e=>{if(!B(e,t.value))return!1;let n=z(e,pn);if(n!==void 0)return{bodyInit:n};let r=z(e,A);if(!r)throw new d("ReadableStream `name` is not set");let i={name:r},a=z(e,sn);a&&(i.type=a);let o=z(e,cn);return o&&(i.framing=o),i},WritableStream:e=>{if(!B(e,n.value))return!1;let t=z(e,A);if(!t)throw new d("WritableStream `name` is not set");let r={name:t},i=z(e,ln);typeof i==`string`&&(r.runId=i);let a=z(e,un);typeof a==`string`&&(r.deploymentId=a);let o=z(e,dn);return typeof o==`string`&&(r.encryptionPublicKey=o),r},AbortController:e=>{if(typeof e!=`object`||!e)return!1;let t=e,n=z(e,j),i=B(e,r.value);if(n===void 0&&!i){let t=z(e,`signal`);if(typeof t!=`object`||!t||z(t,j)===void 0)return!1}let a=z(e,`signal`);return a?Cc(a,t):!1},AbortSignal:e=>{if(typeof e!=`object`||!e)return!1;let t=z(e,j)!==void 0,n=B(e,i.value);return!t&&!n?!1:Cc(e,e)}}}function Oc(e=globalThis,t,n,r,i=!1,a,o=t){return{...xc(e),ReadableStream:s=>{if(!(s instanceof e.ReadableStream))return!1;if(s.locked)throw new p(`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 c=s[A],l=s[sn],u=s[cn];if(!c){c=`strm_${(e[on]||tc)()}`,l=nc(s),u=l===`bytes`&&i?`framed-v1`:u;let d=new bc(n,c,a);l===`bytes`?u===`framed-v1`?t.push(s.pipeThrough(cc()).pipeTo(d)):t.push(s.pipeTo(d)):t.push(s.pipeThrough(ac(Oc(e,t,n,r,i,a,o),r)).pipeTo(d))}let d={name:c};return l&&(d.type=l),u&&(d.framing=u),d},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let i=t[A],a=t[ln];i||(i=`strm_${(e[on]||tc)()}`,o.push(new pc(n,i).pipeThrough(oc(Bc(e,o,n,r),r)).pipeTo(t)));let s={name:i};typeof a==`string`&&(s.runId=a);let c=t[dn];typeof c==`string`&&(s.encryptionPublicKey=c);let l=t[un];return typeof l==`string`&&(s.deploymentId=l),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Sc(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Sc(i,i,e,t,n,r)}}function kc(...e){let t=new WeakSet;function n(e){let t=e[_n];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 Ac(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new pc(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=Vs.getStore(),r=await Xc(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function jc(e,t,n){let r=e,i=e.signal;r[j]=t.streamName,r[M]=t.hookToken,i[j]=t.streamName,i[M]=t.hookToken,n&&(r[_n]=n,i[_n]=n)}function Mc(e,t){let n=e,r=t;n[j]!==void 0&&(r[j]=n[j]),n[M]!==void 0&&(r[M]=n[M]),n[_n]!==void 0&&(r[_n]=n[_n])}function Nc(e,t,n){let r=new AbortController;e.aborted?(jc(r,e),r.abort(e.reason)):e.streamName?jc(r,e,Ac(r,n,e.streamName,t)):jc(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=Vs.getStore();if(n&&(n.ops.push((async()=>{try{let r=await Yc({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new bc(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-C6eL-S_T.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function Pc(e,t,n){let r=new AbortController;return e.aborted?(jc(r,e),r.abort(e.reason)):e.streamName?jc(r,e,Ac(r,n,e.streamName,t)):jc(r,e),r.signal}function Fc(e=globalThis){return{...ei(e),...li(e)}}async function Ic(e,t,n){let r=tr(n);if(r)return Ri(r);let i=await N();if(!i.getEncryptionKeyForRun)return;let a=t?await i.getEncryptionKeyForRun(e,{deploymentId:t}):await i.getEncryptionKeyForRun(await i.runs.get(e));return a?await Zt(a,[`encrypt`]):void 0}function Lc(e,t,n,r,i,a){let o,s,c=!1,l;return l=new ReadableStream({async pull(u){try{o||(o=Rc(e,t,n,a,{onReadableState:e=>{s=e}}).ReadableStream({name:r,startIndex:i}).getReader(),s&&!c&&(c=!0,On(l,s)));let d=await o.read();d.done?u.close():u.enqueue(d.value)}catch(e){u.error(e)}},async cancel(e){await o?.cancel(e).catch(()=>{})}},{highWaterMark:0}),l}function Rc(e=globalThis,t,n,r,i){return{...Fc(e),StepFunction:()=>{throw new p(`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 p(`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&&Mc(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:a=>{if(`bodyInit`in a){let t=a.bodyInit;return new e.Response(t).body}if(a.type===`bytes`){let r=new pc(n,a.name,a.startIndex),o=Cn();t.push(o.promise);let{readable:s,writable:c}=a.framing===`framed-v1`?lc():new e.TransformStream;return kn(r,c,o).catch(()=>{}),i?.onReadableState?i.onReadableState(o):On(s,o),s}else{let o,s=()=>(o??=Wi(r),o),c=gc(n,a.name,a.startIndex,s),l=oc(Rc(e,t,n,s),s),u=Cn();return t.push(u.promise),kn(c,l.writable,u).catch(()=>{}),i?.onReadableState?i.onReadableState(u):On(l.readable,u),l.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:Ic(a,i.deploymentId,i.encryptionPublicKey),s=ac(Tc(e,t,a,o),o),c=new bc(a,i.name),l=Cn();return t.push(l.promise),kn(s.readable,c,l).catch(()=>{}),Dn(s.writable,l),Object.defineProperty(s.writable,A,{value:i.name,writable:!1}),Object.defineProperty(s.writable,ln,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,un,{value:i.deploymentId,writable:!1}),typeof i.encryptionPublicKey==`string`&&Object.defineProperty(s.writable,dn,{value:i.encryptionPublicKey,writable:!1}),s.writable},AbortController:e=>Nc(e,t,n),AbortSignal:e=>Pc(e,t,n)}}function zc(e=globalThis){return{...Fc(e),...di(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[mn]=n,delete t.responseWritable,t.respondWith=()=>{throw new p("`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 p(`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,{[pn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[A]:{value:t.name,writable:!1},[sn]:{value:t.type,writable:!1},[cn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[A]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[ln]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[un]={value:t.deploymentId,writable:!1}),typeof t.encryptionPublicKey==`string`&&(n[dn]={value:t.encryptionPublicKey,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new Qs(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[j]:e.streamName,[M]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new Qs(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function Bc(e=globalThis,t,n,r,i){return{...Fc(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=y(t);if(!o)throw new p(`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=Vs.getStore();if(!e)throw new d(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return Vs.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 p(`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&&Mc(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 pc(n,a.name);if(a.type===`bytes`){let n=Cn();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?lc():new e.TransformStream;return kn(o,i,n).catch(()=>{}),On(r,n),r}else{let a=oc(Bc(e,t,n,r,i),r),s=Cn();return t.push(s.promise),kn(o,a.writable,s).catch(()=>{}),On(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:Ic(o,s,a.encryptionPublicKey),l=ac(Oc(e,t,o,c),c),u=new bc(o,a.name),d=Cn();return t.push(d.promise),kn(l.readable,u,d).catch(()=>{}),Dn(l.writable,d),Object.defineProperty(l.writable,A,{value:a.name,writable:!1}),Object.defineProperty(l.writable,ln,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,un,{value:s,writable:!1}),typeof a.encryptionPublicKey!=`string`&&o===n&&Hi(r)&&Object.defineProperty(l.writable,dn,{value:Wn(r.keyPair.publicKey),writable:!1}),typeof a.encryptionPublicKey==`string`&&Object.defineProperty(l.writable,dn,{value:a.encryptionPublicKey,writable:!1}),l.writable},AbortController:e=>Nc(e,t,n),AbortSignal:e=>Pc(e,t,n)}}async function Vc(e,t){return await Gi(e,t)}const Hc=async(e,t)=>{let n={},r=await Fi(await qi(e,t),n);return await $(n,`deserialize`),{data:r}};function Uc(e,t=globalThis,n={}){return zs(e.data,{global:t,extraRevivers:{...al(zc(t)),...n}})}function Wc(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Kt(r,{...zc(t),...n});let{format:i,payload:a}=K(r);if(i===U.DEVALUE_V1)return Gt(new TextDecoder().decode(a),{...zc(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function Gc(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c=r){if(a)return ni(qt(e,Tc(i,r,t,n,o,void 0,c)));try{let a={},l=await Fs(e,n,{global:i,extraReducers:il(Tc(i,r,t,n,o,void 0,c)),compression:s,compressionStats:a});return await $(a,`serialize`),l}catch(e){let t=rc(e),{message:n,hint:r}=Z(`workflow arguments`,t);throw new p(n,{hint:r,cause:t})}}async function Kc(e,t,n,r=globalThis,i={},a){return Uc(a??await Hc(e,n),r,i)}async function qc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(qt(e,Dc(r)));try{let t={},i=o??{executions:[]},s=await Ls(e,n,{global:r,extraReducers:il(Dc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await ic(i),s}catch(e){let t=rc(e),{message:n,hint:r}=Z(`workflow return value`,t);throw new p(n,{hint:r,cause:t})}}async function Jc(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Is(e,n,{global:i,extraRevivers:{...al(Rc(i,r,t,n)),...a},compressionStats:o});return await $(o,`deserialize`),s}async function Yc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(qt(e,Dc(r)));try{let t={},i=o??{executions:[]},s=await Ls(e,n,{global:r,extraReducers:il(Dc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await ic(i),s}catch(e){let t=rc(e),{message:n,hint:r}=Z(`step arguments`,t);throw new p(n,{hint:r,cause:t})}}async function Xc(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await Rs(e,n,{global:i,extraRevivers:{...al(Bc(i,r,t,n,o)),...a},compressionStats:s});return await $(s,`deserialize`),c}async function Zc(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c,l=r){if(a)return ni(qt(e,Oc(i,r,t,n,o,c,l)));try{let a={},u=await Ls(e,n,{global:i,extraReducers:il(Oc(i,r,t,n,o,c,l)),compression:s,compressionStats:a});return await $(a,`serialize`),u}catch(e){let t=rc(e),{message:n,hint:r}=Z(`step return value`,t);throw new p(n,{hint:r,cause:t})}}async function Qc(e,t,n,r=[],i=globalThis,a=!1){try{let o=qt(e,Oc(i,r,t,n)),s=new TextEncoder().encode(o),c=G(U.DEVALUE_V1,s),l={},u=await Vc(await Pi(c,a,l),n);return await $(l,`serialize`),u}catch(e){let t=rc(e),{message:n,hint:r}=Z(`step error`,t);throw new p(n,{hint:r,cause:t})}}async function $c(e,t,n,r=globalThis,i={},a){return Wc(a??await Hc(e,n),r,i)}async function el(e,t,n,r=globalThis,i=!1){try{let t=qt(e,Dc(r)),a=new TextEncoder().encode(t),o=G(U.DEVALUE_V1,a),s={},c=await Vc(await Pi(o,i,s),n);return await $(s,`serialize`),c}catch(e){let t=rc(e),{message:n,hint:r}=Z(`run error`,t);throw new p(n,{hint:r,cause:t})}}async function tl(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Fi(await qi(e,n),o);if(await $(o,`deserialize`),!(s instanceof Uint8Array))return Kt(s,{...Rc(i,r,t,n),...a});let{format:c,payload:l}=K(s);if(c===U.DEVALUE_V1)return Gt(new TextDecoder().decode(l),{...Rc(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function nl(e,t,n,r=globalThis,i={},a){return Uc(a??await Hc(e,n),r,i)}const rl=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function il(e){let t={};for(let n of rl)n in e&&(t[n]=e[n]);return t}function al(e){let t={};for(let n of rl)n in e&&(t[n]=e[n]);return t}const ol=[{format:U.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:U.GZIP,minVersion:`5.0.0-beta.18`},{format:U.ZSTD,minVersion:`5.0.0-beta.18`},{format:U.SEALED,minVersion:`5.0.0-beta.37`}],sl=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],cl=new Set([U.DEVALUE_V1]);function ll(e){if(!e||!Xt.default.valid(e))return{supportedFormats:cl,framedByteStreams:!1};let t=new Set(cl);for(let{format:n,minVersion:r}of ol)Xt.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of sl)Xt.default.gte(e,r)&&(n[t]=!0);return n}const ul=`5.0.0-beta.48`,dl=/^[a-zA-Z0-9_\-./@]+$/;function fl(e,t){if(!dl.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${te(`workflow`,x(t))}${e}`}const pl=ae();function ml(e){return`__health_check__${e}`}function hl(e){let t=ne.safeParse(e);if(t.success)return t.data}function gl(e){return`wrun_hc_${e}`}async function _l(e,t){let n=await N(),r=ml(e.correlationId),i;if(e.runId)try{let t=await n.getEncryptionKeyForRun?.(e.runId);t&&(i=Wn((await zn(t)).publicKey))}catch(t){Ms.warn(`Health check could not derive a run public key; the caller will fall back to a key lookup`,{correlationId:e.correlationId,error:t instanceof Error?t.message:String(t)})}let a=JSON.stringify({healthy:!0,correlationId:e.correlationId,specVersion:t??7,workflowCoreVersion:ul,hookResumeInputVersion:1,...i?{encryptionPublicKey:i}:{},timestamp:Date.now()}),o=gl(e.correlationId);await n.streams.write(o,r,a),await n.streams.close(o,r)}function vl(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 yl(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 bl(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),typeof o.encryptionPublicKey==`string`&&(s.encryptionPublicKey=o.encryptionPublicKey),typeof o.hookResumeInputVersion==`number`&&(s.hookResumeInputVersion=o.hookResumeInputVersion),s}async function xl(e,t){let n=t?.timeout??3e4,r=e.createRunId?.()??pl(),i=ml(r),a=`${te(`workflow`,x(t?.namespace))}health_check`,o=Date.now();try{for(await e.queue(a,{__healthCheck:!0,correlationId:r,...t?.runId?{runId:t.runId}:{}},{specVersion:1,deploymentId:t?.deploymentId});Date.now()-o<n;)try{let t=n-(Date.now()-o),a=(await vl(e.streams.get(gl(r),i),t)).getReader(),{chunks:s,timedOut:c}=await yl(a,500);if(c){try{a.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=bl(s);if(l)return{...l,latencyMs:Date.now()-o};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${n}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function Sl(e,t){return new r(`Event pagination ${t} for workflow run "${e}".`,{code:u.WORLD_CONTRACT_ERROR})}function Cl(e,t,n){if(t){if(n.has(t))throw Sl(e,`did not advance`);n.add(t)}}function wl(e,t,n){if(t.length===0)return;let r=n??new Set(e.map(e=>e.eventId));for(let n of t)r.has(n.eventId)||(r.add(n.eventId),e.push(n))}function Tl(e,t){let n=e.length;for(;n>0;){let r=e[n-1];if(r.eventId===t.eventId)return;if(r.eventId<t.eventId)break;n--}e.splice(n,0,t)}function El(e,t,n,r){if(t){if(n===null)throw Sl(e,`returned more pages without a cursor`);if(r.has(n))throw Sl(e,`repeated a cursor`)}}function Dl(e,t,n){return t!==null&&!n&&r.is(e)&&e.status===400}async function Ol(e,t){let n=t!==void 0;return hs(`workflow.replay.load`,async r=>{r?.setAttributes({...ra(e),...la(n?`events_list_incremental`:`events_list`)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await N(),f=Date.now();for(;c;){let t=Date.now(),r=s;Cl(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(Dl(t,r,u)){Ms.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}wl(i,f.data,a),c=f.hasMore,El(e,c,f.cursor,o),s=f.cursor??s,l++,Ms.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return Ms.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...oa(i.length),...Ro(l)}),{events:i,cursor:s}})}function kl(e,t){wl(e.events,t.events),e.cursor=t.cursor??e.cursor}function Al(){return process.env.WORKFLOW_SLOT_GAP_CHECK!==`0`}function jl(e,t){let n=e.length;wl(e,t);let r=e.length-n;return r>0&&e.sort((e,t)=>e.eventId<t.eventId?-1:+(e.eventId>t.eventId)),r}function Ml(e,t){let n=t.events?.length??0;return n===0?{added:0,offered:0,truncated:!1}:t.hasMore===!0?{added:0,offered:n,truncated:!0}:{added:jl(e,t.events??[]),offered:n,truncated:!1}}function Nl(e){let t;for(let n of e){let e=oe(n.eventId);(t===void 0||e>t)&&(t=e)}return t}function Pl(e){let t=new Set,n=0;for(let r of e){let e=oe(r.eventId);t.add(e),e>n&&(n=e)}if(n===0)return;let r=t.has(1)?1:2;if(t.size===n-r+1)return;let i,a=0;for(let e=r;e<=n;e++)t.has(e)||(i??=e,a++);if(i!==void 0)return{firstMissingSlot:i,missingCount:a,maxSlot:n}}async function Fl(e,t){let n=t,r=Pl(n.events);for(let t=0;r!==void 0&&t<3;t++)await new Promise(e=>setTimeout(e,25*2**t)),n=await Ol(e),r=Pl(n.events);return{log:n,gap:r}}function Il(e){let t=Nl(e);return t===void 0?{}:{eventCount:t}}function Ll(e,t){if(!s.is(e))return null;let n=e.details;if(typeof n!=`object`||!n)return null;let{events:r,cursor:i}=n;if(!Array.isArray(r)||r.length===0)return null;for(let e of r)if(typeof e!=`object`||!e||typeof e.eventId!=`string`||e.runId!==t)return null;return{events:r,cursor:typeof i==`string`?i:null}}const Rl={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function zl(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:Rl}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??7,workflowCoreVersion:ul}),{status:200,headers:{"Content-Type":`application/json`,...Rl}}):await e(n)}}function Bl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function Vl(e,t){return`${e}:${Bl(t)}`}async function Hl(e,...t){let n=t[0];await hs(`queue.publish`,{attributes:{...$a(`vercel-queue`),...eo(n),...no(`publish`),...Xo(`vercel-queue`),...Zo(`vercel-queue`),...Qo(`vqs`),...$o(`publish`)},kind:await ws(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(to(r))})}function Ul(e){if(e.requestedAt)try{return ro(Date.now()-e.requestedAt.getTime())}catch{return}}async function Wl(e,t,n){let r=typeof t==`string`?await e.getEncryptionKeyForRun?.(t,n):await e.getEncryptionKeyForRun?.(t);return r?await Bi(r):void 0}function Gl(e,t){let n;return()=>(n||=Wl(e,t),n)}function Kl(t){import(`./functions-DAYiHNti.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function ql(e,t){Kl(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function Jl(e){let t=e();return Kl(t.catch(()=>{})),t}export{Ns as $,Ri as $n,Ya as $t,Gc as A,Ta as An,xe as Ar,eo as At,Jc as B,Da as Bn,xo as Bt,ll as C,ya as Cn,an as Cr,fo as Ct,Yc as D,Sa as Dn,Zt as Dr,Po as Dt,el as E,sa as En,en as Er,po as Et,tl as F,ma as Fn,Bo as Ft,Zs as G,xa as Gn,To as Gt,ec as H,ao as Hn,wo as Ht,Xc as I,Aa as In,Vo as It,Us as J,ha as Jn,Eo as Jt,Hs as K,wa as Kn,Do as Kt,$c as L,Oa as Ln,yo as Lt,Tc as M,fa as Mn,le as Mr,no as Mt,Lc as N,ua as Nn,me as Nr,$a as Nt,Qc as O,ta as On,Se as Or,Io as Ot,ac as P,la as Pn,pe as Pr,zo as Pt,js as Q,Hi as Qn,qa as Qt,nl as R,ka as Rn,bo as Rt,ul as S,ba as Sn,nn as Sr,mo as St,kc as T,oa as Tn,rn as Tr,co as Tt,$s as U,ia as Un,Co as Ut,Hc as V,ra as Vn,Oo as Vt,Q as W,aa as Wn,ko as Wt,Z as X,Ca as Xn,Fa as Xt,Vs as Y,_a as Yn,Ga as Yt,Ms as Z,Bi as Zn,Ja as Zt,Wl as _,pa as _n,A as _r,es as _t,Ul as a,_o as an,qr as ar,ws as at,Vl as b,so as bn,ln as br,uo as bt,xl as c,Xa as cn,tr as cr,Ds as ct,Ol as d,Ba as dn,jn as dr,gs as dt,Va as en,U as er,xs as et,Nl as f,Wa as fn,Cn as fr,hs as ft,Hl as g,Ra as gn,on as gr,ts as gt,Ll as h,za as hn,pn as hr,io as ht,kl as i,Na as in,Jr as ir,as as it,qc as j,da as jn,Ee as jr,to as jt,Zc as k,na as kn,T as kr,Fo as kt,Tl as l,Za as ln,zn as lr,bs as lt,hl as m,Ia as mn,Dn as mr,Os as mt,Jl as n,Ha as nn,Zr as nr,os as nt,fl as o,go as on,ar as or,rs as ot,Gl as p,Ua as pn,kn as pr,ls as pt,Gs as q,ga as qn,vo as qt,Ml as r,La as rn,Qr as rr,vs as rt,_l as s,Ka as sn,Wn as sr,is as st,ql as t,Pa as tn,Xr as tr,_s as tt,Al as u,Qa as un,N as ur,ss as ut,Fl as v,Ea as vn,un as vr,Lo as vt,bc as w,va as wn,tn as wr,ho as wt,zl as x,oo as xn,mn as xr,lo as xt,Il as y,ca as yn,dn as yr,Ma as yt,Kc as z,ja as zn,So as zt};
|
package/dist/src/compiled/_chunks/workflow/{ws-transport-PnVVxT0R.js → ws-transport-BagXNxCE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./debug-log-CVPstO1D.js";import{t}from"./global-singleton-BNinwFrL.js";import{
|
|
1
|
+
import{t as e}from"./debug-log-CVPstO1D.js";import{t}from"./global-singleton-BNinwFrL.js";import{B as n,C as r,F as i,Q as a,T as o,W as s,_ as c,a as l,l as u,m as d,r as f,tt as p,u as m,w as h}from"./frames-Boesh7kU.js";import{n as g,t as _}from"./wrapper-CQNxP9mU.js";var v=p();g();var y=class extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.name=`WsTransportError`}};function b(e){for(let[t,n]of Object.entries(e))if(t.toLowerCase()===`authorization`)return n;return null}async function x(e){let t=(async function*(){yield e})();for await(let e of f(t))return e;throw Error(`ws-transport: received an empty/unframed message`)}function S(e){if(e.byteLength===0)return`(no message)`;let t=new TextDecoder().decode(e);try{let e=JSON.parse(t);return typeof e.message==`string`?e.message:t}catch{return t}}function C(e){return e instanceof Error?e.message:String(e)}var w=class{wsUrl;getHeaders;connection=null;connecting=null;reconnectAttempts=0;reconnectTimer=null;openCount=0;closed=!1;lastDrainReason=null;needsFreshToken=!1;lastAuthorization=null;constructor(e,t){this.wsUrl=e,this.getHeaders=t}async request(e){if(this.closed)throw new y(`workflow-server events WS channel for ${this.wsUrl} is closed`);let t=await this.ensureConnected(),n=t.nextReqId++,r=e(n),i=d(),a;try{return await new Promise((e,o)=>{t.pending.set(n,{resolve:e,reject:o}),a=setTimeout(()=>{t.pending.delete(n)&&(o(new y(`workflow-server events WS request ${n} to ${this.wsUrl} timed out after ${i}ms with no reply`)),this.failConnection(t,`workflow-server events WS connection to ${this.wsUrl} abandoned after request ${n} timed out`))},i),a.unref?.(),t.ws.send(r,e=>{e&&t.pending.delete(n)&&o(new y(`workflow-server events WS send failed: ${C(e)}`,{cause:e}))})})}finally{a!==void 0&&clearTimeout(a)}}open(){this.closed||(this.openCount++,!(this.connection!==null||this.connecting!==null)&&this.ensureConnected().catch(()=>{this.close(`connect failed`)}))}release(e){this.openCount!==0&&(this.openCount--,this.openCount===0&&this.close(e))}close(e){if(this.closed)return;this.closed=!0,this.openCount=0,this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),T.transports.get(this.wsUrl)===this&&T.transports.delete(this.wsUrl);let t=this.connection;this.connection=null,t?.ws.close(1e3,e)}ensureConnected(){let e=this.connection;return e&&e.ws.readyState===_.default.OPEN?Promise.resolve(e):(this.connecting??=this.connectWithSpan().finally(()=>{this.connecting=null}),this.connecting)}async resolveUpgradeHeaders(){let e=this.needsFreshToken,t=await this.getHeaders({forceRefresh:e}),n=b(t);if(e&&n===this.lastAuthorization)throw new y(`workflow-server events WS connection to ${this.wsUrl} drained for auth expiry, but re-resolving the bearer produced the same token. Not reconnecting with a token the server has already rejected; the next event write will retry.`);this.lastAuthorization=n,this.needsFreshToken=!1;let r=new Headers;return await s(r),r.forEach((e,n)=>{t[n]=e}),t}consumeDrainReason(){let e=this.lastDrainReason;this.lastDrainReason=null,e===`auth_expiry`&&(this.needsFreshToken=!0)}connectWithSpan(){return r({method:`GET`,url:this.wsUrl,spanName:`workflow.events.ws.connect`,attributes:{...i(`ws`),...o(`websocket`),...n(this.reconnectAttempts)}},async e=>{try{return await this.connect()}catch(t){throw e?.setAttributes({...h(`TRANSPORT`)}),t instanceof Error&&e?.recordException?.(t),t}})}connect(){return new Promise((e,t)=>{(async()=>{let n;try{let e=await this.resolveUpgradeHeaders(),t=new _.default(this.wsUrl,{headers:e});t.binaryType=`nodebuffer`,n={ws:t,nextReqId:1,pending:new Map}}catch(e){console.error(`world-vercel: ws events transport could not open a connection to ${this.wsUrl}: ${C(e)}`),t(e instanceof y?e:new y(`workflow-server events WS connection to ${this.wsUrl} could not be opened: ${C(e)}`,{cause:e}));return}let{ws:r}=n,i=!1;r.on(`open`,()=>{if(i=!0,this.closed){r.close(1e3,`released while connecting`),t(new y(`workflow-server events WS connection to ${this.wsUrl} was released while connecting`));return}this.connection=n,this.reconnectAttempts=0,e(n)}),r.on(`message`,e=>{this.handleMessage(n,new Uint8Array(e))}),r.on(`error`,e=>{if(console.error(`world-vercel: ws events transport socket error (${this.wsUrl}): ${C(e)}`),!i){t(e);return}r.close()}),r.on(`close`,e=>{this.connection===n&&(this.connection=null),this.consumeDrainReason(),i||t(new y(`workflow-server events WS connection to ${this.wsUrl} closed before opening (code ${e})`)),this.failAllPending(n,new y(`workflow-server events WS connection closed (code ${e})`)),(i||this.reconnectAttempts>0)&&this.scheduleReconnect(e)})})()})}scheduleReconnect(e){if(this.closed||this.connection!==null||this.reconnectTimer!==null)return;if(this.reconnectAttempts>=5){console.error(`world-vercel: ws events transport giving up eager reconnect to ${this.wsUrl} after 5 attempts (last close code ${e}); the next event write will retry.`);return}let t=Math.min(100*2**this.reconnectAttempts,5e3);this.reconnectAttempts++;let n=setTimeout(()=>{this.reconnectTimer=null,this.ensureConnected().catch(()=>{})},t);n.unref?.(),this.reconnectTimer=n}async handleMessage(t,n){let r;try{r=await x(n)}catch(e){let r=`could not decode a ${n.byteLength}-byte reply frame from ${this.wsUrl}: ${C(e)}`;console.error(`world-vercel: ws events transport ${r}`),this.failConnection(t,`workflow-server events WS transport ${r}`);return}if(r.meta.type===`drain`){let t=r.meta.reason===`auth_expiry`?`auth_expiry`:`max_duration`;this.lastDrainReason=t,e(`world-vercel: ws events transport received a drain notice (reason: ${t}, graceMs: ${r.meta.graceMs??`unspecified`}); connection will close soon.`);return}let i=r.meta.reqId;if(i===-1){let e=`received a malformed-frame error from ${this.wsUrl} (reserved reqId -1, status ${String(r.meta.status??`unknown`)}): ${S(r.body)}. The server could not parse a frame this client sent, so the originating write cannot be identified`;console.error(`world-vercel: ws events transport ${e}.`),this.failConnection(t,`workflow-server events WS transport ${e}`);return}if(typeof i!=`number`){let e=`received a reply frame with no numeric reqId from ${this.wsUrl} (type: ${String(r.meta.type??`absent`)})`;console.error(`world-vercel: ws events transport ${e}.`),this.failConnection(t,`workflow-server events WS transport ${e}`);return}let a=t.pending.get(i);if(!a){console.error(`world-vercel: ws events transport received a reply for unknown reqId ${i} from ${this.wsUrl} (already settled, or the request was failed by a send error or its deadline); dropping it.`);return}t.pending.delete(i),a.resolve({meta:r.meta,body:r.body})}failAllPending(e,t){for(let n of e.pending.values())n.reject(t);e.pending.clear()}failConnection(e,t){this.failAllPending(e,new y(t)),this.connection===e&&(this.connection=null),e.ws.close()}};const T=t(`@workflow/world-vercel//wsEventsTransports@${a}`,1,()=>({transports:new Map,loggedWsProxyFallback:!1,loggedWsInUse:!1}));function E(e,t){let n=T.transports.get(e);return n||(n=new w(e,t),T.transports.set(e,n)),n}function D(e,t){let n=new URL(e);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.pathname=`${n.pathname.replace(/\/$/,``)}/websockets/v1/runs/${encodeURIComponent(t)}`,n.toString()}function O(t,n){if(!l())return;let r=A(t,n);if(!r)return;T.loggedWsInUse||(T.loggedWsInUse=!0,e(`world-vercel: using ws events transport (${r}).`));let i=E(r,async({forceRefresh:e})=>{e&&await k();let{headers:t}=await u(n);return c(t)});i.open();let a=!1;return()=>{a||(a=!0,i.release(`invocation complete`))}}async function k(){try{await(0,v.getVercelOidcToken)({expirationBufferMs:864e5})}catch{}}function A(t,n){let{baseUrl:r,usingProxy:i}=m(n);return i?(T.loggedWsProxyFallback||(T.loggedWsProxyFallback=!0,e(`world-vercel: ws events transport unavailable for a World with projectConfig (api-workflow proxy, resolved baseUrl: ${r}) — falling back to HTTP.`)),null):D(r,t)}function j(e,t){let n=A(e,t);if(!n)return null;let r=T.transports.get(n);return r?{transport:r,wsUrl:n}:null}export{O as openWsChannel,j as resolveWsTransport};
|
|
@@ -13,6 +13,7 @@ export interface CompileFromMemoryInput {
|
|
|
13
13
|
readonly limits?: {
|
|
14
14
|
readonly maxInputTokensPerSession?: number | false;
|
|
15
15
|
readonly maxOutputTokensPerSession?: number | false;
|
|
16
|
+
readonly maxTokenCostUsdPerSession?: number | false;
|
|
16
17
|
readonly sessionTimeoutMs?: number | false;
|
|
17
18
|
};
|
|
18
19
|
readonly outputSchema?: JsonObject;
|
|
@@ -11,36 +11,54 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
11
11
|
readonly dropped: {};
|
|
12
12
|
};
|
|
13
13
|
readonly tool: {
|
|
14
|
-
readonly current:
|
|
15
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
|
14
|
+
readonly current: 29;
|
|
15
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 28, 29];
|
|
16
16
|
readonly dropped: {
|
|
17
|
+
readonly 14: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
17
18
|
readonly 15: "TaskExec replaces stageEffect with send";
|
|
19
|
+
readonly 16: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
20
|
+
readonly 17: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
21
|
+
readonly 18: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
22
|
+
readonly 19: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
23
|
+
readonly 20: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
24
|
+
readonly 21: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
25
|
+
readonly 22: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
26
|
+
readonly 23: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
27
|
+
readonly 24: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
28
|
+
readonly 25: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
29
|
+
readonly 26: "Background tools now use task yield descriptors";
|
|
30
|
+
readonly 27: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
18
31
|
};
|
|
19
32
|
};
|
|
20
33
|
readonly dynamicTool: {
|
|
21
|
-
readonly current:
|
|
22
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22,
|
|
34
|
+
readonly current: 28;
|
|
35
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 28];
|
|
23
36
|
readonly dropped: {
|
|
24
37
|
readonly 21: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
38
|
+
readonly 23: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
39
|
+
readonly 24: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
40
|
+
readonly 25: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
41
|
+
readonly 26: "Background tools now use task yield descriptors";
|
|
42
|
+
readonly 27: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
25
43
|
};
|
|
26
44
|
};
|
|
27
45
|
readonly channel: {
|
|
28
|
-
readonly current:
|
|
29
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14];
|
|
46
|
+
readonly current: 17;
|
|
47
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17];
|
|
30
48
|
readonly dropped: {
|
|
31
49
|
readonly 12: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
32
50
|
};
|
|
33
51
|
};
|
|
34
52
|
readonly schedule: {
|
|
35
|
-
readonly current:
|
|
36
|
-
readonly supported: readonly [1, 2, 3, 4, 6, 7];
|
|
53
|
+
readonly current: 9;
|
|
54
|
+
readonly supported: readonly [1, 2, 3, 4, 6, 7, 8, 9];
|
|
37
55
|
readonly dropped: {
|
|
38
56
|
readonly 5: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
39
57
|
};
|
|
40
58
|
};
|
|
41
59
|
readonly subagent: {
|
|
42
|
-
readonly current:
|
|
43
|
-
readonly supported: readonly [3, 4, 6, 7];
|
|
60
|
+
readonly current: 8;
|
|
61
|
+
readonly supported: readonly [3, 4, 6, 7, 8];
|
|
44
62
|
readonly dropped: {
|
|
45
63
|
readonly 1: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
|
|
46
64
|
readonly 2: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
|
|
@@ -48,16 +66,16 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
48
66
|
};
|
|
49
67
|
};
|
|
50
68
|
readonly connection: {
|
|
51
|
-
readonly current:
|
|
52
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 11, 12];
|
|
69
|
+
readonly current: 14;
|
|
70
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14];
|
|
53
71
|
readonly dropped: {
|
|
54
72
|
readonly 9: "Dynamic connection resolvers no longer receive conversation or channel continuation data";
|
|
55
73
|
readonly 10: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
56
74
|
};
|
|
57
75
|
};
|
|
58
76
|
readonly hook: {
|
|
59
|
-
readonly current:
|
|
60
|
-
readonly supported: readonly [10, 11, 12, 13, 14, 15, 17, 18];
|
|
77
|
+
readonly current: 20;
|
|
78
|
+
readonly supported: readonly [10, 11, 12, 13, 14, 15, 17, 18, 19, 20];
|
|
61
79
|
readonly dropped: {
|
|
62
80
|
readonly 1: "Model identity moved from session.started runtime metadata to step.started call attribution.";
|
|
63
81
|
readonly 2: "Model identity moved from session.started runtime metadata to step.started call attribution.";
|
|
@@ -77,8 +95,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
77
95
|
readonly dropped: {};
|
|
78
96
|
};
|
|
79
97
|
readonly dynamicSkill: {
|
|
80
|
-
readonly current:
|
|
81
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15];
|
|
98
|
+
readonly current: 16;
|
|
99
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16];
|
|
82
100
|
readonly dropped: {
|
|
83
101
|
readonly 13: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
84
102
|
};
|
|
@@ -89,8 +107,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
89
107
|
readonly dropped: {};
|
|
90
108
|
};
|
|
91
109
|
readonly dynamicInstructions: {
|
|
92
|
-
readonly current:
|
|
93
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16];
|
|
110
|
+
readonly current: 17;
|
|
111
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17];
|
|
94
112
|
readonly dropped: {
|
|
95
113
|
readonly 14: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
96
114
|
};
|
|
@@ -101,8 +119,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
101
119
|
readonly dropped: {};
|
|
102
120
|
};
|
|
103
121
|
readonly state: {
|
|
104
|
-
readonly current:
|
|
105
|
-
readonly supported: readonly [1, 2, 3, 4];
|
|
122
|
+
readonly current: 5;
|
|
123
|
+
readonly supported: readonly [1, 2, 3, 4, 5];
|
|
106
124
|
readonly dropped: {};
|
|
107
125
|
};
|
|
108
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:
|
|
1
|
+
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:29,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,28,29],dropped:{14:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,15:`TaskExec replaces stageEffect with send`,16:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,17:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,18:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,19:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,20:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,21:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,22:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`}},dynamicTool:{current:28,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,28],dropped:{21:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`}},channel:{current:17,supported:[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17],dropped:{12:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},schedule:{current:9,supported:[1,2,3,4,6,7,8,9],dropped:{5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},subagent:{current:8,supported:[3,4,6,7,8],dropped:{1:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,2:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},connection:{current:14,supported:[1,2,3,4,5,6,7,8,11,12,13,14],dropped:{9:`Dynamic connection resolvers no longer receive conversation or channel continuation data`,10:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},hook:{current:20,supported:[10,11,12,13,14,15,17,18,19,20],dropped:{1:`Model identity moved from session.started runtime metadata to step.started call attribution.`,2:`Model identity moved from session.started runtime metadata to step.started call attribution.`,3:`Model identity moved from session.started runtime metadata to step.started call attribution.`,4:`Model identity moved from session.started runtime metadata to step.started call attribution.`,5:`Model identity moved from session.started runtime metadata to step.started call attribution.`,6:`Model identity moved from session.started runtime metadata to step.started call attribution.`,7:`Model identity moved from session.started runtime metadata to step.started call attribution.`,8:`Model identity moved from session.started runtime metadata to step.started call attribution.`,9:`Model identity moved from session.started runtime metadata to step.started call attribution.`,16:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},skill:{current:1,supported:[1],dropped:{}},dynamicSkill:{current:16,supported:[1,2,3,4,5,6,7,8,9,10,11,12,14,15,16],dropped:{13:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},instructions:{current:2,supported:[1,2],dropped:{}},dynamicInstructions:{current:17,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17],dropped:{14:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},config:{current:1,supported:[1],dropped:{}},state:{current:5,supported:[1,2,3,4,5],dropped:{}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestV1Schema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict(),extensionCompatibilityManifestV2Schema=extensionCompatibilityManifestV1Schema.extend({formatVersion:z.literal(2),build:z.object({externalDependencies:z.array(z.string().min(1)).readonly()}).strict().optional()}),extensionCompatibilityManifestSchema=z.union([extensionCompatibilityManifestV1Schema,extensionCompatibilityManifestV2Schema]);function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(t){return parseExtensionCompatibilityManifest(await readFile(t,`utf8`),t)}async function writeExtensionCompatibilityManifest(e,n){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(n),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
|
|
@@ -22,7 +22,7 @@ export declare const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
|
|
|
22
22
|
/**
|
|
23
23
|
* Current compiled manifest schema version.
|
|
24
24
|
*/
|
|
25
|
-
export declare const COMPILED_AGENT_MANIFEST_VERSION =
|
|
25
|
+
export declare const COMPILED_AGENT_MANIFEST_VERSION = 48;
|
|
26
26
|
/**
|
|
27
27
|
* Compiled channel entry preserved in the compiled manifest.
|
|
28
28
|
*/
|
|
@@ -721,7 +721,7 @@ export declare const compiledAgentManifestSchema: z.ZodObject<{
|
|
|
721
721
|
sourceId: z.ZodString;
|
|
722
722
|
sourceKind: z.ZodLiteral<"module">;
|
|
723
723
|
}, z.core.$strict>>;
|
|
724
|
-
version: z.ZodLiteral<
|
|
724
|
+
version: z.ZodLiteral<48>;
|
|
725
725
|
workspaceResourceRoot: z.ZodObject<{
|
|
726
726
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
727
727
|
logicalPath: z.ZodString;
|