eve 0.27.5 → 0.27.7
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 +18 -0
- package/dist/src/channel/forwarded-principal.d.ts +74 -0
- package/dist/src/channel/forwarded-principal.js +1 -0
- package/dist/src/channel/routes.d.ts +7 -0
- package/dist/src/channel/send.js +1 -1
- package/dist/src/channel/session.d.ts +5 -0
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +7 -0
- package/dist/src/chunks/{use-eve-agent-BtkhbY2I.js → use-eve-agent-JPfBHZJr.js} +37 -7
- package/dist/src/chunks/{use-eve-agent-NUjD28Iu.js → use-eve-agent-r5tkzjmt.js} +37 -7
- package/dist/src/cli/commands/channels.d.ts +5 -2
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/dev/local-server-child.d.ts +1 -0
- package/dist/src/cli/dev/local-server-child.js +1 -0
- package/dist/src/cli/dev/local-server-cleanup.d.ts +5 -0
- package/dist/src/cli/dev/local-server-cleanup.js +1 -0
- package/dist/src/cli/dev/local-server-process.d.ts +35 -0
- package/dist/src/cli/dev/local-server-process.js +1 -0
- package/dist/src/cli/dev/tui/remote-auth.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +4 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tui.d.ts +2 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/wait-for-ui.d.ts +13 -0
- package/dist/src/cli/dev/wait-for-ui.js +1 -0
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/shutdown.d.ts +23 -0
- package/dist/src/cli/shutdown.js +1 -0
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/open-stream.d.ts +17 -2
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.d.ts +5 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +9 -1
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-Dk1fP6vt.js → attribute-changes-CB7nRYoY.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{functions-Dv8dc_-I.js → functions-DareOZz_.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-czpG5xnP.js → resume-hook-g1vh0WRC.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-6zaMjFY6.js → run-lsS-QDok.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{sleep-B2u06FWc.js → sleep-BXg5I9l2.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-DnoQohyD.js +8 -0
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/evals/autoevals-client.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/expect/index.js +1 -1
- package/dist/src/evals/judge.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +5 -1
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/sandbox/bash-tool.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/development-cleanup.js +1 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/subagent-invocation.d.ts +10 -0
- package/dist/src/execution/subagent-invocation.js +2 -2
- package/dist/src/execution/subagent-tool.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +4 -0
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/tool-call-input-errors.d.ts +20 -0
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/internal/application/build-workspace.d.ts +0 -1
- package/dist/src/internal/application/build-workspace.js +1 -1
- package/dist/src/internal/application/optional-package-install.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.d.ts +1 -6
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.d.ts +4 -4
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +11 -7
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/types.d.ts +0 -4
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +29 -1
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/workflow/queue-namespace.d.ts +8 -0
- package/dist/src/internal/workflow/queue-namespace.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -5
- package/dist/src/internal/workflow-bundle/builder.d.ts +0 -5
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +0 -51
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -3
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +0 -7
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/node_modules/.pnpm/{autoevals@0.0.132_ws@8.21.1 → autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_}/node_modules/autoevals/jsdist/index.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/message.d.ts +1 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/public/channels/eve.d.ts +20 -0
- package/dist/src/public/channels/eve.js +2 -2
- package/dist/src/public/definitions/remote-agent.d.ts +15 -0
- package/dist/src/public/sandbox/backends/default.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/types.d.ts +1 -0
- package/dist/src/setup/boxes/add-channels.d.ts +9 -7
- package/dist/src/setup/boxes/add-channels.js +2 -2
- package/dist/src/setup/boxes/select-channels.d.ts +4 -5
- package/dist/src/setup/channel-setup-deployment.d.ts +11 -0
- package/dist/src/setup/channel-setup-deployment.js +1 -0
- package/dist/src/setup/channel-setup-environment.d.ts +16 -0
- package/dist/src/setup/channel-setup-environment.js +1 -0
- package/dist/src/setup/channel-setup-integration.d.ts +31 -0
- package/dist/src/setup/channel-setup-integration.js +1 -0
- package/dist/src/setup/channel-setup-integrations.d.ts +7 -0
- package/dist/src/setup/channel-setup-integrations.js +1 -0
- package/dist/src/setup/channel-setup-runner.d.ts +7 -0
- package/dist/src/setup/channel-setup-runner.js +1 -0
- package/dist/src/setup/channel-setup-slack.d.ts +3 -0
- package/dist/src/setup/channel-setup-slack.js +1 -0
- package/dist/src/setup/channel-setup-ui.d.ts +18 -0
- package/dist/src/setup/channel-setup-ui.js +2 -0
- package/dist/src/setup/channel-setup-web.d.ts +3 -0
- package/dist/src/setup/channel-setup-web.js +1 -0
- package/dist/src/setup/flows/channels.d.ts +5 -10
- package/dist/src/setup/flows/channels.js +1 -1
- package/dist/src/setup/flows/install-vercel-cli.js +1 -1
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/scaffold/channels-catalog.d.ts +0 -2
- package/dist/src/setup/scaffold/channels-catalog.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/channels.d.ts +5 -3
- package/dist/src/setup/scaffold/update/channels.js +5 -2
- package/dist/src/setup/slack-connect-lifecycle.d.ts +3 -2
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slack-connect.d.ts +2 -0
- package/dist/src/setup/slack-connect.js +1 -1
- package/dist/src/setup/slackbot.d.ts +4 -0
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +21 -20
- package/docs/channels/custom.mdx +1 -1
- package/docs/channels/overview.mdx +2 -0
- package/docs/channels/slack.mdx +2 -0
- package/docs/concepts/{execution-model-and-durability.md → execution-model-and-durability.mdx} +16 -0
- package/docs/concepts/security-model.md +2 -0
- package/docs/concepts/sessions-runs-and-streaming.md +9 -0
- package/docs/getting-started.mdx +13 -196
- package/docs/guides/auth-and-route-protection.md +20 -0
- package/docs/guides/client/overview.mdx +2 -0
- package/docs/guides/client/streaming.mdx +15 -0
- package/docs/guides/remote-agents.md +31 -8
- package/docs/installation.mdx +60 -0
- package/docs/meta.json +7 -6
- package/docs/project-structure.mdx +53 -0
- package/docs/reference/cli.md +1 -1
- package/docs/tutorial/meta.json +1 -1
- package/package.json +1 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-Cc2otuUR.js +0 -6
- package/docs/introduction.mdx +0 -103
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/_vendor/partial-json-parser/parser.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/auth/workload-identity-auth.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/azure.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/client.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/api-promise.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/error.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/pagination.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/resource.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/streaming.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/core/uploads.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/error.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/decoders/line.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/detect-platform.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/errors.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/headers.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/parse.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/qs/formats.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/qs/stringify.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/qs/utils.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/request-options.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/shims.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/to-file.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/tslib.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/uploads.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/base64.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/bytes.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/env.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/log.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/path.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/query.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/sleep.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/uuid.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils/values.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/internal/utils.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/AbstractChatCompletionRunner.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/AssistantStream.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/ChatCompletionRunner.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/ChatCompletionStream.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/ChatCompletionStreamingRunner.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/EventStream.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/ResponsesParser.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/RunnableFunction.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/Util.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/chatCompletionUtils.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/parser.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/lib/responses/ResponseStream.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/admin.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/admin-api-keys.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/audit-logs.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/certificates.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/data-retention.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/groups/groups.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/groups/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/groups/users.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/invites.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/organization.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/api-keys.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/certificates.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/data-retention.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/groups/groups.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/groups/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/model-permissions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/projects.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/rate-limits.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/service-accounts.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/spend-alerts.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/users/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/projects/users/users.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/spend-alerts.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/usage.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/users/roles.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/admin/organization/users/users.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/audio/audio.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/audio/speech.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/audio/transcriptions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/audio/translations.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/batches.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/assistants.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/beta.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/chatkit/chatkit.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/chatkit/sessions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/chatkit/threads.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/realtime/realtime.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/realtime/sessions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/realtime/transcription-sessions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/threads/messages.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/threads/runs/runs.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/threads/runs/steps.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/beta/threads/threads.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/chat/chat.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/chat/completions/completions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/chat/completions/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/chat/completions/messages.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/chat/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/completions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/containers/containers.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/containers/files/content.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/containers/files/files.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/conversations/conversations.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/conversations/items.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/embeddings.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/evals/evals.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/evals/runs/output-items.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/evals/runs/runs.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/files.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/alpha/alpha.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/alpha/graders.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/checkpoints/permissions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/fine-tuning.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/jobs/jobs.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/fine-tuning/methods.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/graders/grader-models.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/graders/graders.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/images.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/models.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/moderations.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/realtime/calls.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/realtime/client-secrets.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/realtime/realtime.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/responses/input-items.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/responses/input-tokens.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/responses/responses.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/shared.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/skills/content.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/skills/skills.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/skills/versions/content.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/skills/versions/versions.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/uploads/parts.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/uploads/uploads.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/vector-stores/file-batches.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/vector-stores/files.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/vector-stores/vector-stores.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/videos.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/webhooks/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/webhooks/webhooks.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/resources/webhooks.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/streaming.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.1_zod@3.25.76 → openai@6.39.1_ws@8.21.1_bufferutil@4.1.0__zod@3.25.76}/node_modules/openai/version.js +0 -0
|
@@ -17,4 +17,4 @@ import{o as e,t}from"./chunk-BTyA9uPd.js";import{c as n,d as r,f as i,l as a,p a
|
|
|
17
17
|
`)?e.split(`
|
|
18
18
|
`).map((e,t)=>t===0?e:` ${e}`).join(`
|
|
19
19
|
`):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var jr=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let n=[...e.values()],r=0,i=0,o=0,s=0,c=0,l=0;for(let e of n)e.type===`step`?r++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:i++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];r>0&&u.push(`${r} ${a(`step`,`steps`,r)}`),i>0&&u.push(`${i} ${a(`hook`,`hooks`,i)}`),o>0&&u.push(`${o} ${a(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${a(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${a(`disposal`,`disposals`,c)}`);let d=a(`has`,`have`,r+i+o+s+c),f=+(r>0)+ +(i>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:r>0?`run`:i>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.steps=n,this.globalThis=t,this.stepCount=r,this.hookCount=i,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function Mr(){throw new u(`This API is not available inside a workflow function. Workflow functions run in a deterministic VM; move the call to a step function for full Node.js access.`)}function q(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const Nr=q(`workflow.name`),Pr=q(`workflow.operation`),Fr=q(`workflow.run.id`),Ir=q(`workflow.run.status`),Lr=q(`workflow.started_at`),Rr=q(`workflow.events.count`),zr=q(`workflow.arguments.count`),Br=q(`workflow.result.type`),Vr=q(`workflow.trace.propagated`),Hr=q(`workflow.trace.mode`),Ur=q(`workflow.turbo`),Wr=q(`workflow.error.name`),Gr=q(`workflow.error.message`),Kr=q(`workflow.error.code`),qr=q(`workflow.steps.created`),Jr=q(`workflow.hooks.created`),Yr=q(`workflow.waits.created`),Xr=q(`workflow.inline_ownership.owned_recovery_steps`),Zr=q(`workflow.inline_ownership.backstop_wakes_armed`),Qr=q(`workflow.route.type`),$r=q(`workflow.route.handler_cached`),ei=q(`workflow.route.invocation_count`),ti=q(`workflow.route.entrypoint_age_ms`),ni=q(`workflow.route.module_body_init_ms`),ri=q(`step.name`),ii=q(`step.id`),ai=q(`step.attempt`),oi=q(`step.status`),si=q(`step.max_retries`),ci=q(`step.ttfs_ms`),li=q(`step.stso_ms`),ui=q(`step.rsfs_ms`),di=q(`step.final_scheduling_replay_ms`),fi=q(`step.latency_optimizations`),pi=q(`step.skipped`),mi=q(`step.skip_reason`),hi=q(`step.arguments.count`),gi=q(`step.result.type`),_i=q(`step.error.name`),vi=q(`step.error.message`),yi=q(`step.fatal_error`),bi=q(`step.retry.exhausted`),xi=q(`step.retry.timeout_seconds`),Si=q(`step.retry.will_retry`),Ci=q(`messaging.system`),wi=q(`messaging.destination.name`),Ti=q(`messaging.message.id`),Ei=q(`messaging.operation.type`),Di=q(`workflow.queue.overhead_ms`),Oi=q(`deployment.id`),ki=q(`workflow.hook.token`),Ai=q(`workflow.hook.id`),ji=q(`workflow.hook.found`),Mi=q(`workflow.suspension.state`),Ni=q(`workflow.suspension.hook_count`),Pi=q(`workflow.suspension.step_count`),Fi=q(`workflow.suspension.wait_count`),Ii=q(`http.request.method`),Li=q(`http.route`),Ri=q(`http.response.status_code`),zi=q(`error.type`),Bi=q(`workflow.events.pages_loaded`),Vi=q(`workflow.queue.deserialize_time_ms`),Hi=q(`workflow.queue.execution_time_ms`),Ui=q(`workflow.queue.serialize_time_ms`),Wi=q(`workflow.serialization.operation`),Gi=q(`workflow.serialization.compressed`),Ki=q(`workflow.serialization.codec`),qi=q(`workflow.serialization.uncompressed_bytes`),Ji=q(`workflow.serialization.stored_bytes`),Yi=q(`workflow.serialization.compression_ratio`),Xi=q(`peer.service`),Zi=q(`rpc.system`),Qi=q(`rpc.service`),$i=q(`rpc.method`),ea=q(`error.retryable`),ta=q(`error.category`),na=new Set;function ra(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!na.has(e)&&(na.add(e),Y.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function ia(e){return e!==void 0&&Object.keys(e).length>0}function aa(e,t){return e===`linked`&&ia(t)?Promise.resolve(t):sa()}async function oa(e,t){if(e!==`linked`)return ba();let n=await xa(ia(t)?t:void 0);return n?[n]:void 0}async function sa(){let e=await J.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function ca(e){let t=await J.value;if(t)return t.propagation.extract(t.context.active(),e)}async function la(e,t){if(!e)return t();let n=await J.value;if(!n)return t();let r=await ca(e);return r?n.context.with(r,async()=>await t()):t()}const J=s(async()=>{try{return await import(`./src-D1EltLDA.js`).then(t=>e(t.t(),1))}catch{return Y.info(`OpenTelemetry not available, tracing will be disabled`),null}}),ua=s(async()=>{let e=await J.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return fa(e,t),t});let da=!1;function fa(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(da||!n)){da=!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 pa(e,...t){let[n,r]=await Promise.all([ua.value,J.value]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),ha(t,r,e),t}finally{e.end()}})}async function ma(e,t,n){let r=await ua.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function ha(e,t,n){!e||!jr.is(e)||(n.setStatus({code:t.SpanStatusCode.OK}),n.setAttributes({...Mi(`suspended`),...Pi(e.stepCount),...Ni(e.hookCount),...Fi(e.waitCount)}))}async function ga(e){let[t,n]=await Promise.all([ca(e),J.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function _a(){return await ya(e=>e.trace.getActiveSpan())}async function va(e){return ya(t=>t.SpanKind[e])}async function ya(e){let t=await J.value;if(t)return await e(t)}function ba(){return ya(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function xa(e){if(!e)return;let[t,n]=await Promise.all([ga(e),J.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function Sa(e,t){let n=await J.value;if(!n)return t();let r=n.propagation.createBaggage({"workflow.run_id":{value:e.workflowRunId},"workflow.name":{value:e.workflowName}}),i=n.propagation.setBaggage(n.context.active(),r);return n.context.with(i,()=>t())}function Ca(e,t){if(!t)return!1;let n=!1;for(let r of t.split(`,`)){let t=r.trim();if(!t)continue;let i=t.startsWith(`-`),a=i?t.slice(1):t;RegExp(`^${a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`)}$`).test(e)&&(n=!i)}return n}function wa(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)(wr(`[workflow-sdk]`,i,c)),Ca(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),_a().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 Ta=wa(`step`),Y=wa(`runtime`),Ea=wa(`webhook`),Da=wa(`events`);wa(`adapter`),wa(`build`,{debugNamespace:`workflow:build`});function Oa(e){if(_.is(e))throw e}function X(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof D&&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 D&&t.value!==void 0&&Y.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function ka(e,t,n){try{let r=H.serialize(e,`client`,n);return Sr(await yr(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){Oa(e);let{message:t,hint:n}=X(`client value`,e);throw new g(t,{hint:n,cause:e})}}async function Aa(e,t,n){let r=await br(await Cr(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ja(e,t,n){try{let r=H.serialize(e,`step`,n);return Sr(await yr(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){Oa(e);let{message:t,hint:n}=X(`step value`,e);throw new g(t,{hint:n,cause:e})}}async function Ma(e,t,n){let r=await br(await Cr(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function Na(e,t){if(!(e instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=W(e);if(n===V.DEVALUE_V1)return H.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const Pa=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),Fa=globalThis[Pa]??(globalThis[Pa]=new ce);function Ia(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${a(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${a(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${a(`timer`,`timers`,n)}`);let i=[];e>0&&i.push(`steps are completed`),t>0&&i.push(`hooks are received`),n>0&&i.push(`timers have elapsed`);let o=i.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function La(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function Ra(e){return`strm_${e}_system_abort`}function za(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return Ra(e.slice(5))}const Ba=()=>b(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10});var Z;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Z||={});var Va=class{eventIndex;events=[];callbacks=[];onConsumedEvent;onUnconsumedEvent;getPromiseQueue;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;constructor(e,t){this.events=e,this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.getPromiseQueue=t.getPromiseQueue}subscribe(e){this.callbacks.push(e),this.pendingUnconsumedCheck!==null&&(this.unconsumedCheckVersion++,this.pendingUnconsumedCheck=null,this.pendingUnconsumedTimeout!==null&&(clearTimeout(this.pendingUnconsumedTimeout),this.pendingUnconsumedTimeout=null)),process.nextTick(this.consume)}notifyConsumedEvent(e){if(this.onConsumedEvent)try{this.onConsumedEvent(e)}catch(e){Da.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){let e=this.events[this.eventIndex]??null;if(!this.consumeOne(e)){this.handleUnconsumed(e);return}}};consumeOne(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Z.NotConsumed;try{r=n(e)}catch(e){Da.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Z.Consumed&&r!==Z.Finished))return e!==null&&this.notifyConsumedEvent(e),this.eventIndex++,r===Z.Finished&&this.callbacks.splice(t,1),e!==null}return!1}handleUnconsumed(e){if(e!==null){let t=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===t&&(this.pendingUnconsumedCheck=null,this.onUnconsumedEvent(e))},Ba())})}}},Ha=class{aborted=!1;reason=void 0;[N];[P];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[N]=e,this[P]=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 Ua(e){return class{signal;[N];[P];constructor(){let t=e.generateUlid(),n=Ra(t),r=`abrt_${t}`;this[N]=n,this[P]=r,this.signal=new Ha(n,r);let i=`hook_${e.generateUlid()}`;e.invocationsQueue.set(i,{type:`hook`,correlationId:i,token:r,isWebhook:!1,isSystem:!0}),e.eventsConsumer.subscribe(t=>{if(!t||t.correlationId!==i)return Z.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[P])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new h(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[P]}"`,{eventId:t.eventId}))}),Z.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Z.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload;return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let r;try{if(n!==void 0)try{let i=await e.replayPayloadCache.prepareEventPayload(t.eventId,`payload`,n),a=await Ho(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}this.signal._setAborted(r)}finally{e.pendingDeliveries--}}),e.invocationsQueue.delete(i),Z.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Z.Finished):Z.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[P]){n.abortRequested=!0,n.abortReason=t;break}}}}}function Wa(){return{abort(e){let t=new Ha(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new Ha(``,``),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 Ga=ie();function Ka(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function qa(e){return Oa(e),e instanceof g&&e.cause!==void 0||e instanceof u&&e.cause!==void 0?e.cause:e}async function Q(e,t){if(e.recorded)try{let n=await _a();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...Wi(t),...Gi(e.compressed??!1),...Ki(e.codec??`none`),...qi(r),...Ji(i),...e.compressed&&r>0?Yi(1-i/r):{}})}catch{}}function Ja(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0};return new TransformStream({async transform(i,a){try{r.resolved||=(r.key=await xr(t),!0);let o=k(i,e),s=n.encode(o),c=U(V.DEVALUE_V1,s);if(r.key){let e=await tn(r.key,c);c=U(V.ENCRYPTED,e)}let l=new Uint8Array(4+c.length);new DataView(l.buffer).setUint32(0,c.length,!1),l.set(c,4),a.enqueue(l)}catch(e){if(_.is(e)){a.error(e);return}let{message:t,hint:n}=X(`stream chunk`,e);a.error(new g(t,{hint:n,cause:e}))}}})}function Ya(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0};function a(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function o(a){for(i.resolved||=(i.key=await xr(t),!0);r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let o=r.slice(4,4+t);r=r.slice(4+t);let{format:s,payload:c}=W(o);if(s===V.ENCRYPTED){if(!i.key){a.error(new _(`Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:c.byteLength,formatPrefix:`encr`}}));return}let e;try{e=await nn(i.key,c)}catch(e){throw _.is(e)&&e.context&&(e.context.formatPrefix=s),e}({format:s,payload:c}=W(e))}if(s===V.DEVALUE_V1){let t=n.decode(c);a.enqueue(Yt(t,e))}}}return new TransformStream({async transform(t,i){if(r.length===0&&t.length>=4){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!1);if(e>0&&e<1e8){a(t),await o(i);return}}else if(r.length>0){a(t),await o(i);return}let s=n.decode(t).split(`
|
|
20
|
-
`);for(let t of s)t.length>0&&i.enqueue(Yt(t,e))},async flush(e){r.length>0&&await o(e)}})}const Xa=1e8;function Za(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Xa){t.error(new u(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Xa}). 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 Qa(){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>Xa){r.error(new u(`Byte-stream frame length ${t} exceeds maximum (${Xa}). 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 u(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function $a(e,t,n,r,i){(async()=>{await ma(`workflow.stream.read`,e,{kind:await va(`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 eo(e,t,n,r,i,a){(async()=>{await ma(`workflow.stream.read.complete`,e,{kind:await va(`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 to=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new u(`"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 L(),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&&eo(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,$a(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 no=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),ro=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function io(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array,u,d,f=!1,p=0,m=0;async function h(){let o=await L(),s=r?i+a:n,l=Date.now(),u=await o.streams.get(e,t,s);d===void 0&&(d=Date.now()-l),c=u.getReader()}async function g(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=no(),n=ro();for(;;){if(o++,s++,o>e)throw Error(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(s>n)throw Error(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{await h();return}catch{}}}return new ReadableStream({pull:async i=>{for(u===void 0&&(u=Date.now());;){if(!c)try{await h()}catch(e){i.error(e);return}let _;try{_=await c.read()}catch(e){if(!r){i.error(e);return}try{await g()}catch(e){i.error(e);return}continue}if(_.done||!_.value){c=void 0,u!==void 0&&eo(u,e,t,p,m,s),i.close();return}let v=_.value;if(v.length>0){let e=new Uint8Array(l.length+v.length);e.set(l,0),e.set(v,l.length),l=e}let y=!1;for(;l.length>=4;){let r=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<r)break;i.enqueue(l.slice(0,r)),l=l.slice(r),a++,p++,m+=r,!f&&u!==void 0&&(f=!0,$a(u,e,t,n,d)),y=!0}if(y){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const ao=()=>b(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function oo(e,t,n,r,i,a,o){(async()=>{await ma(`workflow.stream.flush`,e,{kind:await va(`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 so(e,t,n){(async()=>{await ma(`workflow.stream.close`,e,{kind:await va(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var $=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new u(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new u(`"name" is required, got "${t}"`);let r=L(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,d,f=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=d;d=void 0;let c=Date.now(),u=await r;l===void 0&&(l=u.streamFlushIntervalMs??ao());let f=Date.now();try{if(typeof u.streams.writeMulti==`function`&&n.length>1)await u.streams.writeMulti(e,t,n);else for(let r of n)await u.streams.write(e,t,r)}catch(e){throw i!==void 0&&(d=d===void 0?i:Math.min(d,i)),e}i!==void 0&&oo(i,c,e,t,n.length,n.reduce((e,t)=>e+t.byteLength,0),Date.now()-f),o=[]},p=[],m=()=>{s||=setTimeout(()=>{s=null;let e=p;p=[],c=f().then(()=>{for(let t of e)t.resolve()},t=>{for(let n of e)n.reject(t)})},l??ao())};super({async write(e){d===void 0&&(d=Date.now()),c&&=(await c,null),o.push(e),m(),await new Promise((e,t)=>{p.push({resolve:e,reject:t})})},async close(){c&&=(await c,null),await f(),await a();let n=await r,i=Date.now();await n.streams.close(e,t),so(i,e,t)},abort(e){s&&=(clearTimeout(s),null),o=[];let t=p;p=[];let n=e??Error(`Stream aborted`);for(let e of t)e.reject(n)}}),Object.defineProperty(this,fn,{value:async e=>{if(e.length!==0){d===void 0&&(d=Date.now());for(let t of e)o.push(t);await f()}},enumerable:!1,writable:!1})}};function co(e=globalThis){return{...Un(),...Qn(),...Xn(e),Request:t=>{if(!(t instanceof e.Request))return!1;let n={method:t.method,url:t.url,headers:t.headers,body:t.body,duplex:t.duplex},r=t[mn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[N])&&(n.signal=t.signal),n},Response:t=>t instanceof e.Response?{type:t.type,url:t.url,status:t.status,statusText:t.statusText,headers:t.headers,body:t.body,redirected:t.redirected}:!1}}function lo(e,t,n,r,i,a){let o=t[N],s=t[P];if(!o){let e=(n[ln]||Ga)();o=Ra(e),s=`abrt_${e}`,t[N]=o,t[P]=s,t.signal&&(t.signal[N]=o,t.signal[P]=s)}return fo(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function uo(e,t){let n=t[N]??t.signal?.[N],r=t[P]??t.signal?.[P];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 fo(e,t,n,r,i){e.aborted||e[gn]||(e[gn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await xr(r),a=await Fo({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function po(e=globalThis,t,n,r,i=!1,a){return{...co(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new g(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[ln]||Ga)()}`,c=Ka(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Za()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Ja(po(e,t,n,r,i,a),r)).pipeTo(l));let u={name:s};return c&&(u.type=c),c===`bytes`&&i&&(u.framing=`framed-v1`),u},WritableStream:r=>{if(!(r instanceof e.WritableStream))return!1;let i=r[A],a=r[j];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[M];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[ln]||Ga)()}`,s=new to(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:lo(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:lo(i,i,e,t,n,r)}}function mo(e=globalThis){return{...co(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[pn];if(n!==void 0)return{bodyInit:n};let r=t[A];if(!r)throw new u("ReadableStream `name` is not set");let i={name:r},a=t[un];a&&(i.type=a);let o=t[dn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[A];if(!n)throw new u("WritableStream `name` is not set");let r={name:n},i=t[j];typeof i==`string`&&(r.runId=i);let a=t[M];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[N]??n.signal?.[N],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:uo(t.signal,n)},AbortSignal:t=>{let n=t?.[N],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:uo(t,t)}}}function ho(e=globalThis,t,n,r,i=!1,a){return{...co(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new g(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[A],c=o[un],l=o[dn];if(!s){s=`strm_${(e[ln]||Ga)()}`,c=Ka(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Za()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Ja(ho(e,t,n,r,i,a),r)).pipeTo(u))}let u={name:s};return c&&(u.type=c),l&&(u.framing=l),u},WritableStream:i=>{if(!(i instanceof e.WritableStream))return!1;let a=i[A],o=i[j];a||(a=`strm_${(e[ln]||Ga)()}`,t.push(new to(n,a).pipeThrough(Ya(Eo(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[M];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:lo(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:lo(i,i,e,t,n,r)}}function go(...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 _o(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new to(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=Fa.getStore(),r=await Io(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function vo(e,t,n){let r=e,i=e.signal;r[N]=t.streamName,r[P]=t.hookToken,i[N]=t.streamName,i[P]=t.hookToken,n&&(r[_n]=n,i[_n]=n)}function yo(e,t){let n=e,r=t;n[N]!==void 0&&(r[N]=n[N]),n[P]!==void 0&&(r[P]=n[P]),n[_n]!==void 0&&(r[_n]=n[_n])}function bo(e,t,n){let r=new AbortController;e.aborted?(vo(r,e),r.abort(e.reason)):e.streamName?vo(r,e,_o(r,n,e.streamName,t)):vo(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=Fa.getStore();if(n&&(n.ops.push((async()=>{try{let r=await Fo({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new $(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-czpG5xnP.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function xo(e,t,n){let r=new AbortController;return e.aborted?(vo(r,e),r.abort(e.reason)):e.streamName?vo(r,e,_o(r,n,e.streamName,t)):vo(r,e),r.signal}function So(e=globalThis){return{...Wn(e),...Zn(e)}}async function Co(e,t){let n=await L();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await en(r,[`encrypt`]):void 0}function wo(e=globalThis,t,n,r){return{...So(e),StepFunction:()=>{throw new g(`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 g(`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&&yo(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:i=>{if(`bodyInit`in i){let t=i.bodyInit;return new e.Response(t).body}if(i.type===`bytes`){let r=new to(n,i.name,i.startIndex),a=F();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Qa():new e.TransformStream;return I(r,s,a).catch(()=>{}),Tn(o,a),o}else{let a=io(n,i.name,i.startIndex),o=Ya(wo(e,t,n,r),r),s=F();return t.push(s.promise),I(a,o.writable,s).catch(()=>{}),Tn(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:Co(a,i.deploymentId),s=Ja(po(e,t,a,o),o),c=new $(a,i.name),l=F();return t.push(l.promise),I(s.readable,c,l).catch(()=>{}),wn(s.writable,l),Object.defineProperty(s.writable,A,{value:i.name,writable:!1}),Object.defineProperty(s.writable,j,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,M,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>bo(e,t,n),AbortSignal:e=>xo(e,t,n)}}function To(e=globalThis){return{...So(e),...$n(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 g("`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 g(`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},[un]:{value:t.type,writable:!1},[dn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[A]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[j]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[M]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new Ha(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[N]:e.streamName,[P]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new Ha(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function Eo(e=globalThis,t,n,r,i){return{...So(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=oe(t);if(!o)throw new g(`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=Fa.getStore();if(!e)throw new u(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return Fa.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 g(`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&&yo(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 to(n,a.name);if(a.type===`bytes`){let n=F();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?Qa():new e.TransformStream;return I(o,i,n).catch(()=>{}),Tn(r,n),r}else{let a=Ya(Eo(e,t,n,r,i),r),s=F();return t.push(s.promise),I(o,a.writable,s).catch(()=>{}),Tn(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:Co(o,s),l=Ja(ho(e,t,o,c),c),u=new $(o,a.name),d=F();return t.push(d.promise),I(l.readable,u,d).catch(()=>{}),wn(l.writable,d),Object.defineProperty(l.writable,A,{value:a.name,writable:!1}),Object.defineProperty(l.writable,j,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,M,{value:s,writable:!1}),l.writable},AbortController:e=>bo(e,t,n),AbortSignal:e=>xo(e,t,n)}}async function Do(e,t){return await Sr(e,t)}const Oo=async(e,t)=>{let n={},r=await br(await Cr(e,t),n);return await Q(n,`deserialize`),{data:r}};function ko(e,t=globalThis,n={}){return Na(e.data,{global:t,extraRevivers:{...Go(To(t)),...n}})}function Ao(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Xt(r,{...To(t),...n});let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return Yt(new TextDecoder().decode(a),{...To(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function jo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return Kn(k(e,po(i,r,t,n,o)));try{let a={},c=await ka(e,n,{global:i,extraReducers:Wo(po(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=qa(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new g(n,{hint:r,cause:t})}}async function Mo(e,t,n,r=globalThis,i={},a){return ko(a??await Oo(e,n),r,i)}async function No(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Kn(k(e,mo(r)));try{let t={},i=await ja(e,n,{global:r,extraReducers:Wo(mo(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=qa(e),{message:n,hint:r}=X(`workflow return value`,t);throw new g(n,{hint:r,cause:t})}}async function Po(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Aa(e,n,{global:i,extraRevivers:{...Go(wo(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function Fo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Kn(k(e,mo(r)));try{let t={},i=await ja(e,n,{global:r,extraReducers:Wo(mo(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=qa(e),{message:n,hint:r}=X(`step arguments`,t);throw new g(n,{hint:r,cause:t})}}async function Io(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await Ma(e,n,{global:i,extraRevivers:{...Go(Eo(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function Lo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return Kn(k(e,ho(i,r,t,n,o,c)));try{let a={},l=await ja(e,n,{global:i,extraReducers:Wo(ho(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=qa(e),{message:n,hint:r}=X(`step return value`,t);throw new g(n,{hint:r,cause:t})}}async function Ro(e,t,n,r=[],i=globalThis,a=!1){try{let o=k(e,ho(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await Do(await yr(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=qa(e),{message:n,hint:r}=X(`step error`,t);throw new g(n,{hint:r,cause:t})}}async function zo(e,t,n,r=globalThis,i={},a){return Ao(a??await Oo(e,n),r,i)}async function Bo(e,t,n,r=globalThis,i=!1){try{let t=k(e,mo(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await Do(await yr(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=qa(e),{message:n,hint:r}=X(`run error`,t);throw new g(n,{hint:r,cause:t})}}async function Vo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await br(await Cr(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Xt(s,{...wo(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return Yt(new TextDecoder().decode(l),{...wo(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function Ho(e,t,n,r=globalThis,i={},a){return ko(a??await Oo(e,n),r,i)}const Uo=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Wo(e){let t={};for(let n of Uo)n in e&&(t[n]=e[n]);return t}function Go(e){let t={};for(let n of Uo)n in e&&(t[n]=e[n]);return t}const Ko=[{format:V.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:V.GZIP,minVersion:`5.0.0-beta.18`},{format:V.ZSTD,minVersion:`5.0.0-beta.18`}],qo=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Jo=new Set([V.DEVALUE_V1]);function Yo(e){if(!e||!$t.default.valid(e))return{supportedFormats:Jo,framedByteStreams:!1};let t=new Set(Jo);for(let{format:n,minVersion:r}of Ko)$t.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of qo)$t.default.gte(e,r)&&(n[t]=!0);return n}const Xo=`5.0.0-beta.36`,Zo=/^[a-zA-Z0-9_\-./@]+$/;function Qo(e,t){if(!Zo.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${te(`workflow`,ae(t))}${e}`}const $o=ie();function es(e){return`__health_check__${e}`}function ts(e){let t=ne.safeParse(e);if(t.success)return t.data}function ns(e){return`wrun_hc_${e}`}async function rs(e,t,n){let r=await L(),i=es(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:Xo,timestamp:Date.now()}),o=ns(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function is(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 as(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 os(e){if(e.length===0)return null;let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=new TextDecoder().decode(n),a;try{a=JSON.parse(i)}catch{return i.length>0?{healthy:!0}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),s}async function ss(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??$o(),a=es(i),o=`${te(t,ae(n?.namespace))}health_check`,s=Date.now();try{for(await e.queue(o,{__healthCheck:!0,correlationId:i},{specVersion:1,deploymentId:n?.deploymentId});Date.now()-s<r;)try{let t=r-(Date.now()-s),n=(await is(e.streams.get(ns(i),a),t)).getReader(),{chunks:o,timedOut:c}=await as(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=os(o);if(l)return{...l,latencyMs:Date.now()-s};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${r}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function cs(e,t){return new l(`Event pagination ${t} for workflow run "${e}".`,{code:d.WORLD_CONTRACT_ERROR})}function ls(e,t,n){if(t){if(n.has(t))throw cs(e,`did not advance`);n.add(t)}}function us(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function ds(e,t,n,r){if(t){if(n===null)throw cs(e,`returned more pages without a cursor`);if(r.has(n))throw cs(e,`repeated a cursor`)}}function fs(e,t,n){return t!==null&&!n&&l.is(e)&&e.status===400}async function ps(e,t){let n=t!==void 0;return pa(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...Fr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await L(),f=Date.now();for(;c;){let t=Date.now(),r=s;ls(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(fs(t,r,u)){Y.warn(`Event cursor was rejected; retrying with a full event reload.`,{workflowRunId:e}),i.length=0,a.clear(),o.clear(),s=null,u=!0;continue}throw t}us(i,a,f.data),c=f.hasMore,ds(e,c,f.cursor,o),s=f.cursor??s,l++,Y.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return Y.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...Rr(i.length),...Bi(l)}),{events:i,cursor:s}})}function ms(){return process.env.WORKFLOW_PRECONDITION_GUARD!==`0`}function hs(e){let t=e[e.length-1];if(!t)return;let n=t.eventId,r=n.lastIndexOf(`_`),i=re(r===-1?n:n.slice(r+1))?.getTime();if(i===void 0){Y.debug(`Precondition guard: latest event id is not a decodable ULID; sending no snapshot`,{eventId:n});return}return i}function gs(e){return ms()?hs(e):void 0}async function _s(e,t,n){for(let r=0;;r++)try{return await n(gs(t.events))}catch(n){if(!p.is(n)||r>=2)throw n;Y.info(`Event creation rejected as stale; reloading event log and retrying`,{workflowRunId:e,attempt:r+1,maxRetries:2});let i=await ps(e,t.cursor??void 0);us(t.events,new Set(t.events.map(e=>e.eventId)),i.events),t.cursor=i.cursor??t.cursor}}const vs={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function ys(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:vs}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Xo}),{status:200,headers:{"Content-Type":`application/json`,...vs}}):await e(n)}}async function bs(e,...t){let n=t[0];await pa(`queue.publish`,{attributes:{...Ci(`vercel-queue`),...wi(n),...Ei(`publish`),...Xi(`vercel-queue`),...Zi(`vercel-queue`),...Qi(`vqs`),...$i(`publish`)},kind:await va(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(Ti(r))})}function xs(e){if(e.requestedAt)try{return Di(Date.now()-e.requestedAt.getTime())}catch{return}}function Ss(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await en(n):void 0})(),n)}function Cs(t){import(`./functions-Dv8dc_-I.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function ws(e,t){Cs(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function Ts(e){let t=e();return Cs(t.catch(()=>{})),t}function Es(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new m(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{ee(n,{allowReservedAttributes:r})}catch(e){throw e instanceof y?new m(e.message):e}return n}export{sa as $,ei as $t,Io as A,cn as An,gi as At,Ia as B,Ae as Bn,zr as Bt,Lo as C,pn as Cn,_i as Ct,wo as D,j as Dn,fi as Dt,po as E,M as En,ii as Et,Oo as F,Me as Fn,mi as Ft,Ta as G,Rr as Gt,La as H,Oe as Hn,Kr as Ht,Wa as I,Pe as In,pi as It,aa as J,Pr as Jt,Ea as K,Jr as Kt,Ua as L,Ne as Ln,oi as Lt,Ho as M,sn as Mn,xi as Mt,Mo as N,rn as Nn,Si as Nt,Ja as O,mn as On,si as Ot,Po as P,en as Pn,ui as Pt,xa as Q,$r as Qt,Z as R,Fe as Rn,li as Rt,Ro as S,wn as Sn,vi as St,No as T,A as Tn,di as Tt,Fa as U,De as Un,Gr as Ut,za as V,je as Vn,Zr as Vt,Y as W,ke as Wn,Wr as Wt,ra as X,Br as Xt,va as Y,Xr as Yt,ia as Z,ti as Zt,Yo as _,Ln as _n,Vi as _t,Qo as a,qr as an,ea as at,Bo as b,F as bn,hi as bt,ms as c,Ur as cn,Ai as ct,ts as d,jr as dn,Ri as dt,ni as en,pa as et,bs as f,V as fn,Li as ft,Xo as g,Rn as gn,Ci as gt,_s as h,Hn as hn,Ei as ht,xs as i,Lr as in,ta as it,zo as j,an as jn,bi as jt,Vo as k,on as kn,ri as kt,ps as l,Yr as ln,ki as lt,ys as m,Vn as mn,Ti as mt,ws as n,Fr as nn,Sa as nt,rs as o,Hr as on,zi as ot,gs as p,Bn as pn,wi as pt,oa as q,Nr as qt,Ts as r,Ir as rn,Oi as rt,ss as s,Vr as sn,ji as st,Es as t,Qr as tn,la as tt,Ss as u,Mr as un,Ii as ut,$ as v,L as vn,Hi as vt,jo as w,ln as wn,yi as wt,Fo as x,I as xn,ai as xt,go as y,Nn as yn,Ui as yt,Va as z,Ie as zn,ci as zt};
|
|
20
|
+
`);for(let t of s)t.length>0&&i.enqueue(Yt(t,e))},async flush(e){r.length>0&&await o(e)}})}const Xa=1e8;function Za(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Xa){t.error(new u(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Xa}). 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 Qa(){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>Xa){r.error(new u(`Byte-stream frame length ${t} exceeds maximum (${Xa}). 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 u(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function $a(e,t,n,r,i){(async()=>{await ma(`workflow.stream.read`,e,{kind:await va(`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 eo(e,t,n,r,i,a){(async()=>{await ma(`workflow.stream.read.complete`,e,{kind:await va(`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 to=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new u(`"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 L(),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&&eo(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,$a(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 no=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),ro=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function io(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array,u,d,f=!1,p=0,m=0;async function h(){let o=await L(),s=r?i+a:n,l=Date.now(),u=await o.streams.get(e,t,s);d===void 0&&(d=Date.now()-l),c=u.getReader()}async function g(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=no(),n=ro();for(;;){if(o++,s++,o>e)throw Error(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(s>n)throw Error(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{await h();return}catch{}}}return new ReadableStream({pull:async i=>{for(u===void 0&&(u=Date.now());;){if(!c)try{await h()}catch(e){i.error(e);return}let _;try{_=await c.read()}catch(e){if(!r){i.error(e);return}try{await g()}catch(e){i.error(e);return}continue}if(_.done||!_.value){c=void 0,u!==void 0&&eo(u,e,t,p,m,s),i.close();return}let v=_.value;if(v.length>0){let e=new Uint8Array(l.length+v.length);e.set(l,0),e.set(v,l.length),l=e}let y=!1;for(;l.length>=4;){let r=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<r)break;i.enqueue(l.slice(0,r)),l=l.slice(r),a++,p++,m+=r,!f&&u!==void 0&&(f=!0,$a(u,e,t,n,d)),y=!0}if(y){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const ao=()=>b(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function oo(e,t,n,r,i,a,o){(async()=>{await ma(`workflow.stream.flush`,e,{kind:await va(`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 so(e,t,n){(async()=>{await ma(`workflow.stream.close`,e,{kind:await va(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var $=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new u(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new u(`"name" is required, got "${t}"`);let r=L(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,d,f=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=d;d=void 0;let c=Date.now(),u=await r;l===void 0&&(l=u.streamFlushIntervalMs??ao());let f=Date.now();try{if(typeof u.streams.writeMulti==`function`&&n.length>1)await u.streams.writeMulti(e,t,n);else for(let r of n)await u.streams.write(e,t,r)}catch(e){throw i!==void 0&&(d=d===void 0?i:Math.min(d,i)),e}i!==void 0&&oo(i,c,e,t,n.length,n.reduce((e,t)=>e+t.byteLength,0),Date.now()-f),o=[]},p=[],m=()=>{s||=setTimeout(()=>{s=null;let e=p;p=[],c=f().then(()=>{for(let t of e)t.resolve()},t=>{for(let n of e)n.reject(t)})},l??ao())};super({async write(e){d===void 0&&(d=Date.now()),c&&=(await c,null),o.push(e),m(),await new Promise((e,t)=>{p.push({resolve:e,reject:t})})},async close(){c&&=(await c,null),await f(),await a();let n=await r,i=Date.now();await n.streams.close(e,t),so(i,e,t)},abort(e){s&&=(clearTimeout(s),null),o=[];let t=p;p=[];let n=e??Error(`Stream aborted`);for(let e of t)e.reject(n)}}),Object.defineProperty(this,fn,{value:async e=>{if(e.length!==0){d===void 0&&(d=Date.now());for(let t of e)o.push(t);await f()}},enumerable:!1,writable:!1})}};function co(e=globalThis){return{...Un(),...Qn(),...Xn(e),Request:t=>{if(!(t instanceof e.Request))return!1;let n={method:t.method,url:t.url,headers:t.headers,body:t.body,duplex:t.duplex},r=t[mn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[N])&&(n.signal=t.signal),n},Response:t=>t instanceof e.Response?{type:t.type,url:t.url,status:t.status,statusText:t.statusText,headers:t.headers,body:t.body,redirected:t.redirected}:!1}}function lo(e,t,n,r,i,a){let o=t[N],s=t[P];if(!o){let e=(n[ln]||Ga)();o=Ra(e),s=`abrt_${e}`,t[N]=o,t[P]=s,t.signal&&(t.signal[N]=o,t.signal[P]=s)}return fo(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function uo(e,t){let n=t[N]??t.signal?.[N],r=t[P]??t.signal?.[P];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 fo(e,t,n,r,i){e.aborted||e[gn]||(e[gn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await xr(r),a=await Fo({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function po(e=globalThis,t,n,r,i=!1,a){return{...co(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new g(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[ln]||Ga)()}`,c=Ka(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Za()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Ja(po(e,t,n,r,i,a),r)).pipeTo(l));let u={name:s};return c&&(u.type=c),c===`bytes`&&i&&(u.framing=`framed-v1`),u},WritableStream:r=>{if(!(r instanceof e.WritableStream))return!1;let i=r[A],a=r[j];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[M];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[ln]||Ga)()}`,s=new to(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:lo(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:lo(i,i,e,t,n,r)}}function mo(e=globalThis){return{...co(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[pn];if(n!==void 0)return{bodyInit:n};let r=t[A];if(!r)throw new u("ReadableStream `name` is not set");let i={name:r},a=t[un];a&&(i.type=a);let o=t[dn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[A];if(!n)throw new u("WritableStream `name` is not set");let r={name:n},i=t[j];typeof i==`string`&&(r.runId=i);let a=t[M];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[N]??n.signal?.[N],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:uo(t.signal,n)},AbortSignal:t=>{let n=t?.[N],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:uo(t,t)}}}function ho(e=globalThis,t,n,r,i=!1,a){return{...co(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new g(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[A],c=o[un],l=o[dn];if(!s){s=`strm_${(e[ln]||Ga)()}`,c=Ka(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Za()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Ja(ho(e,t,n,r,i,a),r)).pipeTo(u))}let u={name:s};return c&&(u.type=c),l&&(u.framing=l),u},WritableStream:i=>{if(!(i instanceof e.WritableStream))return!1;let a=i[A],o=i[j];a||(a=`strm_${(e[ln]||Ga)()}`,t.push(new to(n,a).pipeThrough(Ya(Eo(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[M];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:lo(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:lo(i,i,e,t,n,r)}}function go(...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 _o(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new to(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=Fa.getStore(),r=await Io(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function vo(e,t,n){let r=e,i=e.signal;r[N]=t.streamName,r[P]=t.hookToken,i[N]=t.streamName,i[P]=t.hookToken,n&&(r[_n]=n,i[_n]=n)}function yo(e,t){let n=e,r=t;n[N]!==void 0&&(r[N]=n[N]),n[P]!==void 0&&(r[P]=n[P]),n[_n]!==void 0&&(r[_n]=n[_n])}function bo(e,t,n){let r=new AbortController;e.aborted?(vo(r,e),r.abort(e.reason)):e.streamName?vo(r,e,_o(r,n,e.streamName,t)):vo(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=Fa.getStore();if(n&&(n.ops.push((async()=>{try{let r=await Fo({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new $(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-g1vh0WRC.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function xo(e,t,n){let r=new AbortController;return e.aborted?(vo(r,e),r.abort(e.reason)):e.streamName?vo(r,e,_o(r,n,e.streamName,t)):vo(r,e),r.signal}function So(e=globalThis){return{...Wn(e),...Zn(e)}}async function Co(e,t){let n=await L();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await en(r,[`encrypt`]):void 0}function wo(e=globalThis,t,n,r){return{...So(e),StepFunction:()=>{throw new g(`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 g(`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&&yo(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:i=>{if(`bodyInit`in i){let t=i.bodyInit;return new e.Response(t).body}if(i.type===`bytes`){let r=new to(n,i.name,i.startIndex),a=F();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Qa():new e.TransformStream;return I(r,s,a).catch(()=>{}),Tn(o,a),o}else{let a=io(n,i.name,i.startIndex),o=Ya(wo(e,t,n,r),r),s=F();return t.push(s.promise),I(a,o.writable,s).catch(()=>{}),Tn(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:Co(a,i.deploymentId),s=Ja(po(e,t,a,o),o),c=new $(a,i.name),l=F();return t.push(l.promise),I(s.readable,c,l).catch(()=>{}),wn(s.writable,l),Object.defineProperty(s.writable,A,{value:i.name,writable:!1}),Object.defineProperty(s.writable,j,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,M,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>bo(e,t,n),AbortSignal:e=>xo(e,t,n)}}function To(e=globalThis){return{...So(e),...$n(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 g("`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 g(`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},[un]:{value:t.type,writable:!1},[dn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[A]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[j]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[M]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new Ha(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[N]:e.streamName,[P]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new Ha(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function Eo(e=globalThis,t,n,r,i){return{...So(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=oe(t);if(!o)throw new g(`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=Fa.getStore();if(!e)throw new u(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return Fa.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 g(`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&&yo(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 to(n,a.name);if(a.type===`bytes`){let n=F();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?Qa():new e.TransformStream;return I(o,i,n).catch(()=>{}),Tn(r,n),r}else{let a=Ya(Eo(e,t,n,r,i),r),s=F();return t.push(s.promise),I(o,a.writable,s).catch(()=>{}),Tn(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:Co(o,s),l=Ja(ho(e,t,o,c),c),u=new $(o,a.name),d=F();return t.push(d.promise),I(l.readable,u,d).catch(()=>{}),wn(l.writable,d),Object.defineProperty(l.writable,A,{value:a.name,writable:!1}),Object.defineProperty(l.writable,j,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,M,{value:s,writable:!1}),l.writable},AbortController:e=>bo(e,t,n),AbortSignal:e=>xo(e,t,n)}}async function Do(e,t){return await Sr(e,t)}const Oo=async(e,t)=>{let n={},r=await br(await Cr(e,t),n);return await Q(n,`deserialize`),{data:r}};function ko(e,t=globalThis,n={}){return Na(e.data,{global:t,extraRevivers:{...Go(To(t)),...n}})}function Ao(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Xt(r,{...To(t),...n});let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return Yt(new TextDecoder().decode(a),{...To(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function jo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return Kn(k(e,po(i,r,t,n,o)));try{let a={},c=await ka(e,n,{global:i,extraReducers:Wo(po(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=qa(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new g(n,{hint:r,cause:t})}}async function Mo(e,t,n,r=globalThis,i={},a){return ko(a??await Oo(e,n),r,i)}async function No(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Kn(k(e,mo(r)));try{let t={},i=await ja(e,n,{global:r,extraReducers:Wo(mo(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=qa(e),{message:n,hint:r}=X(`workflow return value`,t);throw new g(n,{hint:r,cause:t})}}async function Po(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Aa(e,n,{global:i,extraRevivers:{...Go(wo(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function Fo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Kn(k(e,mo(r)));try{let t={},i=await ja(e,n,{global:r,extraReducers:Wo(mo(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=qa(e),{message:n,hint:r}=X(`step arguments`,t);throw new g(n,{hint:r,cause:t})}}async function Io(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await Ma(e,n,{global:i,extraRevivers:{...Go(Eo(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function Lo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return Kn(k(e,ho(i,r,t,n,o,c)));try{let a={},l=await ja(e,n,{global:i,extraReducers:Wo(ho(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=qa(e),{message:n,hint:r}=X(`step return value`,t);throw new g(n,{hint:r,cause:t})}}async function Ro(e,t,n,r=[],i=globalThis,a=!1){try{let o=k(e,ho(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await Do(await yr(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=qa(e),{message:n,hint:r}=X(`step error`,t);throw new g(n,{hint:r,cause:t})}}async function zo(e,t,n,r=globalThis,i={},a){return Ao(a??await Oo(e,n),r,i)}async function Bo(e,t,n,r=globalThis,i=!1){try{let t=k(e,mo(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await Do(await yr(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=qa(e),{message:n,hint:r}=X(`run error`,t);throw new g(n,{hint:r,cause:t})}}async function Vo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await br(await Cr(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Xt(s,{...wo(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return Yt(new TextDecoder().decode(l),{...wo(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function Ho(e,t,n,r=globalThis,i={},a){return ko(a??await Oo(e,n),r,i)}const Uo=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Wo(e){let t={};for(let n of Uo)n in e&&(t[n]=e[n]);return t}function Go(e){let t={};for(let n of Uo)n in e&&(t[n]=e[n]);return t}const Ko=[{format:V.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:V.GZIP,minVersion:`5.0.0-beta.18`},{format:V.ZSTD,minVersion:`5.0.0-beta.18`}],qo=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Jo=new Set([V.DEVALUE_V1]);function Yo(e){if(!e||!$t.default.valid(e))return{supportedFormats:Jo,framedByteStreams:!1};let t=new Set(Jo);for(let{format:n,minVersion:r}of Ko)$t.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of qo)$t.default.gte(e,r)&&(n[t]=!0);return n}const Xo=`5.0.0-beta.36`,Zo=/^[a-zA-Z0-9_\-./@]+$/;function Qo(e,t){if(!Zo.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${te(`workflow`,ae(t))}${e}`}const $o=ie();function es(e){return`__health_check__${e}`}function ts(e){let t=ne.safeParse(e);if(t.success)return t.data}function ns(e){return`wrun_hc_${e}`}async function rs(e,t,n){let r=await L(),i=es(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:Xo,timestamp:Date.now()}),o=ns(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function is(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 as(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 os(e){if(e.length===0)return null;let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=new TextDecoder().decode(n),a;try{a=JSON.parse(i)}catch{return i.length>0?{healthy:!0}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),s}async function ss(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??$o(),a=es(i),o=`${te(t,ae(n?.namespace))}health_check`,s=Date.now();try{for(await e.queue(o,{__healthCheck:!0,correlationId:i},{specVersion:1,deploymentId:n?.deploymentId});Date.now()-s<r;)try{let t=r-(Date.now()-s),n=(await is(e.streams.get(ns(i),a),t)).getReader(),{chunks:o,timedOut:c}=await as(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=os(o);if(l)return{...l,latencyMs:Date.now()-s};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${r}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function cs(e,t){return new l(`Event pagination ${t} for workflow run "${e}".`,{code:d.WORLD_CONTRACT_ERROR})}function ls(e,t,n){if(t){if(n.has(t))throw cs(e,`did not advance`);n.add(t)}}function us(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function ds(e,t,n,r){if(t){if(n===null)throw cs(e,`returned more pages without a cursor`);if(r.has(n))throw cs(e,`repeated a cursor`)}}function fs(e,t,n){return t!==null&&!n&&l.is(e)&&e.status===400}async function ps(e,t){let n=t!==void 0;return pa(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...Fr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await L(),f=Date.now();for(;c;){let t=Date.now(),r=s;ls(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(fs(t,r,u)){Y.warn(`Event cursor was rejected; retrying with a full event reload.`,{workflowRunId:e}),i.length=0,a.clear(),o.clear(),s=null,u=!0;continue}throw t}us(i,a,f.data),c=f.hasMore,ds(e,c,f.cursor,o),s=f.cursor??s,l++,Y.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return Y.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...Rr(i.length),...Bi(l)}),{events:i,cursor:s}})}function ms(){return process.env.WORKFLOW_PRECONDITION_GUARD!==`0`}function hs(e){let t=e[e.length-1];if(!t)return;let n=t.eventId,r=n.lastIndexOf(`_`),i=re(r===-1?n:n.slice(r+1))?.getTime();if(i===void 0){Y.debug(`Precondition guard: latest event id is not a decodable ULID; sending no snapshot`,{eventId:n});return}return i}function gs(e){return ms()?hs(e):void 0}async function _s(e,t,n){for(let r=0;;r++)try{return await n(gs(t.events))}catch(n){if(!p.is(n)||r>=2)throw n;Y.info(`Event creation rejected as stale; reloading event log and retrying`,{workflowRunId:e,attempt:r+1,maxRetries:2});let i=await ps(e,t.cursor??void 0);us(t.events,new Set(t.events.map(e=>e.eventId)),i.events),t.cursor=i.cursor??t.cursor}}const vs={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function ys(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:vs}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Xo}),{status:200,headers:{"Content-Type":`application/json`,...vs}}):await e(n)}}async function bs(e,...t){let n=t[0];await pa(`queue.publish`,{attributes:{...Ci(`vercel-queue`),...wi(n),...Ei(`publish`),...Xi(`vercel-queue`),...Zi(`vercel-queue`),...Qi(`vqs`),...$i(`publish`)},kind:await va(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(Ti(r))})}function xs(e){if(e.requestedAt)try{return Di(Date.now()-e.requestedAt.getTime())}catch{return}}function Ss(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await en(n):void 0})(),n)}function Cs(t){import(`./functions-DareOZz_.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function ws(e,t){Cs(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function Ts(e){let t=e();return Cs(t.catch(()=>{})),t}function Es(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new m(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{ee(n,{allowReservedAttributes:r})}catch(e){throw e instanceof y?new m(e.message):e}return n}export{sa as $,ei as $t,Io as A,cn as An,gi as At,Ia as B,Ae as Bn,zr as Bt,Lo as C,pn as Cn,_i as Ct,wo as D,j as Dn,fi as Dt,po as E,M as En,ii as Et,Oo as F,Me as Fn,mi as Ft,Ta as G,Rr as Gt,La as H,Oe as Hn,Kr as Ht,Wa as I,Pe as In,pi as It,aa as J,Pr as Jt,Ea as K,Jr as Kt,Ua as L,Ne as Ln,oi as Lt,Ho as M,sn as Mn,xi as Mt,Mo as N,rn as Nn,Si as Nt,Ja as O,mn as On,si as Ot,Po as P,en as Pn,ui as Pt,xa as Q,$r as Qt,Z as R,Fe as Rn,li as Rt,Ro as S,wn as Sn,vi as St,No as T,A as Tn,di as Tt,Fa as U,De as Un,Gr as Ut,za as V,je as Vn,Zr as Vt,Y as W,ke as Wn,Wr as Wt,ra as X,Br as Xt,va as Y,Xr as Yt,ia as Z,ti as Zt,Yo as _,Ln as _n,Vi as _t,Qo as a,qr as an,ea as at,Bo as b,F as bn,hi as bt,ms as c,Ur as cn,Ai as ct,ts as d,jr as dn,Ri as dt,ni as en,pa as et,bs as f,V as fn,Li as ft,Xo as g,Rn as gn,Ci as gt,_s as h,Hn as hn,Ei as ht,xs as i,Lr as in,ta as it,zo as j,an as jn,bi as jt,Vo as k,on as kn,ri as kt,ps as l,Yr as ln,ki as lt,ys as m,Vn as mn,Ti as mt,ws as n,Fr as nn,Sa as nt,rs as o,Hr as on,zi as ot,gs as p,Bn as pn,wi as pt,oa as q,Nr as qt,Ts as r,Ir as rn,Oi as rt,ss as s,Vr as sn,ji as st,Es as t,Qr as tn,la as tt,Ss as u,Mr as un,Ii as ut,$ as v,L as vn,Hi as vt,jo as w,ln as wn,yi as wt,Fo as x,I as xn,ai as xt,go as y,Nn as yn,Ui as yt,Va as z,Ie as zn,ci as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./chunk-BTyA9uPd.js";var t=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{CITY_HEADER_NAME:()=>u,COUNTRY_HEADER_NAME:()=>d,EMOJI_FLAG_UNICODE_STARTING_POSITION:()=>v,IP_HEADER_NAME:()=>f,LATITUDE_HEADER_NAME:()=>p,LONGITUDE_HEADER_NAME:()=>m,POSTAL_CODE_HEADER_NAME:()=>g,REGION_HEADER_NAME:()=>h,REQUEST_ID_HEADER_NAME:()=>_,geolocation:()=>w,ipAddress:()=>S}),t.exports=c(l);let u=`x-vercel-ip-city`,d=`x-vercel-ip-country`,f=`x-real-ip`,p=`x-vercel-ip-latitude`,m=`x-vercel-ip-longitude`,h=`x-vercel-ip-country-region`,g=`x-vercel-ip-postal-code`,_=`x-vercel-id`,v=127397;function y(e,t){return e.get(t)??void 0}function b(e,t){let n=y(e.headers,t);return n?decodeURIComponent(n):void 0}function x(e){let t=RegExp(`^[A-Z]{2}$`).test(e);if(!(!e||!t))return String.fromCodePoint(...e.split(``).map(e=>v+e.charCodeAt(0)))}function S(e){return y(`headers`in e?e.headers:e,f)}function C(e){return e?e.split(`:`)[0]:`dev1`}function w(e){return{city:b(e,u),country:y(e.headers,d),flag:x(y(e.headers,d)),countryRegion:y(e.headers,h),region:C(y(e.headers,_)),latitude:y(e.headers,p),longitude:y(e.headers,m),postalCode:y(e.headers,g)}}0&&(t.exports={CITY_HEADER_NAME:u,COUNTRY_HEADER_NAME:d,EMOJI_FLAG_UNICODE_STARTING_POSITION:v,IP_HEADER_NAME:f,LATITUDE_HEADER_NAME:p,LONGITUDE_HEADER_NAME:m,POSTAL_CODE_HEADER_NAME:g,REGION_HEADER_NAME:h,REQUEST_ID_HEADER_NAME:_,geolocation:w,ipAddress:S})})),n=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getEnv:()=>u}),t.exports=c(l);let u=(e=process.env)=>({VERCEL:d(e,`VERCEL`),CI:d(e,`CI`),VERCEL_ENV:d(e,`VERCEL_ENV`),VERCEL_URL:d(e,`VERCEL_URL`),VERCEL_BRANCH_URL:d(e,`VERCEL_BRANCH_URL`),VERCEL_PROJECT_PRODUCTION_URL:d(e,`VERCEL_PROJECT_PRODUCTION_URL`),VERCEL_REGION:d(e,`VERCEL_REGION`),VERCEL_DEPLOYMENT_ID:d(e,`VERCEL_DEPLOYMENT_ID`),VERCEL_SKEW_PROTECTION_ENABLED:d(e,`VERCEL_SKEW_PROTECTION_ENABLED`),VERCEL_AUTOMATION_BYPASS_SECRET:d(e,`VERCEL_AUTOMATION_BYPASS_SECRET`),VERCEL_GIT_PROVIDER:d(e,`VERCEL_GIT_PROVIDER`),VERCEL_GIT_REPO_SLUG:d(e,`VERCEL_GIT_REPO_SLUG`),VERCEL_GIT_REPO_OWNER:d(e,`VERCEL_GIT_REPO_OWNER`),VERCEL_GIT_REPO_ID:d(e,`VERCEL_GIT_REPO_ID`),VERCEL_GIT_COMMIT_REF:d(e,`VERCEL_GIT_COMMIT_REF`),VERCEL_GIT_COMMIT_SHA:d(e,`VERCEL_GIT_COMMIT_SHA`),VERCEL_GIT_COMMIT_MESSAGE:d(e,`VERCEL_GIT_COMMIT_MESSAGE`),VERCEL_GIT_COMMIT_AUTHOR_LOGIN:d(e,`VERCEL_GIT_COMMIT_AUTHOR_LOGIN`),VERCEL_GIT_COMMIT_AUTHOR_NAME:d(e,`VERCEL_GIT_COMMIT_AUTHOR_NAME`),VERCEL_GIT_PREVIOUS_SHA:d(e,`VERCEL_GIT_PREVIOUS_SHA`),VERCEL_GIT_PULL_REQUEST_ID:d(e,`VERCEL_GIT_PULL_REQUEST_ID`)}),d=(e,t)=>{let n=e[t];return n===``?void 0:n};0&&(t.exports={getEnv:u})})),r=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),i=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{waitUntil:()=>f}),t.exports=l(u);var d=r();let f=e=>{if(typeof e!=`object`||!e||typeof e.then!=`function`)throw TypeError(`waitUntil can only be called with a Promise, got ${typeof e}`);return(0,d.getContext)().waitUntil?.(e)};0&&(t.exports={waitUntil:f})})),a=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{next:()=>f,rewrite:()=>d}),t.exports=c(l);function u(e,t){if(e?.request?.headers){if(!(e.request.headers instanceof Headers))throw Error(`request.headers must be an instance of Headers`);let n=[];for(let[r,i]of e.request.headers)t.set(`x-middleware-request-`+r,i),n.push(r);t.set(`x-middleware-override-headers`,n.join(`,`))}}function d(e,t){let n=new Headers(t?.headers??{});return n.set(`x-middleware-rewrite`,String(e)),u(t,n),new Response(null,{...t,headers:n})}function f(e){let t=new Headers(e?.headers??{});return t.set(`x-middleware-next`,`1`),u(e,t),new Response(null,{...e,headers:t})}0&&(t.exports={next:f,rewrite:d})})),o=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{InMemoryCache:()=>u}),t.exports=c(l);var u=class{constructor(){this.cache={}}async get(e){let t=this.cache[e];return t?t.ttl&&t.lastModified+t.ttl*1e3<Date.now()?(await this.delete(e),null):JSON.parse(t.value):null}async set(e,t,n){let r=JSON.stringify(t??null);this.cache[e]={value:r,lastModified:Date.now(),ttl:n?.ttl,tags:new Set(n?.tags||[])}}async delete(e){delete this.cache[e]}async expireTag(e){let t=Array.isArray(e)?e:[e];for(let e in this.cache)if(Object.prototype.hasOwnProperty.call(this.cache,e)){let n=this.cache[e];t.some(e=>n.tags.has(e))&&delete this.cache[e]}}};0&&(t.exports={InMemoryCache:u})})),s=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},l=e=>s(n({},`__esModule`,{value:!0}),e),u={};o(u,{BuildCache:()=>f}),t.exports=l(u);var d=c(),f=class{constructor({endpoint:e,headers:t,onError:n,timeout:r=500}){this.get=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{headers:this.headers,method:`GET`,signal:t.signal});if(r.status===404)return clearTimeout(n),null;if(r.status===200){if(r.headers.get(d.HEADERS_VERCEL_CACHE_STATE)!==d.PkgCacheState.Fresh)return r.body?.cancel?.(),clearTimeout(n),null;let e=await r.json();return clearTimeout(n),e}else throw clearTimeout(n),Error(`Failed to get cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e);return null}},this.set=async(e,t,n)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),this.timeout);try{let a={};n?.ttl&&(a[d.HEADERS_VERCEL_REVALIDATE]=n.ttl.toString()),n?.tags&&n.tags.length>0&&(a[d.HEADERS_VERCEL_CACHE_TAGS]=n.tags.join(`,`)),n?.name&&(a[d.HEADERS_VERCEL_CACHE_ITEM_NAME]=n.name);let o=await fetch(`${this.endpoint}${e}`,{method:`POST`,headers:{...this.headers,...a},body:JSON.stringify(t),signal:r.signal});if(clearTimeout(i),o.status!==200)throw Error(`Failed to set cache: ${o.status} ${o.statusText}`)}catch(e){if(clearTimeout(i),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.delete=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{method:`DELETE`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to delete cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.expireTag=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{Array.isArray(e)&&(e=e.join(`,`));let r=await fetch(`${this.endpoint}revalidate?tags=${e}`,{method:`POST`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to revalidate tag: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.endpoint=e,this.headers=t,this.onError=n,this.timeout=r}};0&&(t.exports={BuildCache:f})})),c=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of a(t))!c.call(e,s)&&s!==r&&n(e,s,{get:()=>t[s],enumerable:!(o=i(t,s))||o.enumerable});return e},d=e=>u(n({},`__esModule`,{value:!0}),e),f={};l(f,{HEADERS_VERCEL_CACHE_ITEM_NAME:()=>O,HEADERS_VERCEL_CACHE_STATE:()=>T,HEADERS_VERCEL_CACHE_TAGS:()=>D,HEADERS_VERCEL_REVALIDATE:()=>E,PkgCacheState:()=>w,getCache:()=>y}),t.exports=d(f);var p=r(),m=o(),h=s();let g=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)},_=null,v=null,y=e=>x(()=>{let e;return e=(0,p.getContext)().cache?(0,p.getContext)().cache:C(process.env.SUSPENSE_CACHE_DEBUG===`true`),e},b(e));function b(e){let t=e?.keyHashFunction||g;return n=>{if(!e?.namespace)return t(n);let r=e.namespaceSeparator||`$`;return`${e.namespace}${r}${t(n)}`}}function x(e,t){return{get:n=>e().get(t(n)),set:(n,r,i)=>e().set(t(n),r,{...i,name:i?.name??n}),delete:n=>e().delete(t(n)),expireTag:t=>e().expireTag(t)}}let S=!1;function C(e){if(_||=new m.InMemoryCache,process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE===`true`)return e&&console.log(`Using InMemoryCache as build cache is disabled`),_;let{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}=process.env;if(e&&console.log(`Runtime cache environment variables:`,{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}),!t||!n)return S||=(console.warn(`Runtime Cache unavailable in this environment. Falling back to in-memory cache.`),!0),_;if(!v){let e={};try{e=JSON.parse(n)}catch(e){return console.error(`Failed to parse RUNTIME_CACHE_HEADERS:`,e),_}let r=500;if(process.env.RUNTIME_CACHE_TIMEOUT){let e=parseInt(process.env.RUNTIME_CACHE_TIMEOUT,10);!isNaN(e)&&e>0?r=e:console.warn(`Invalid RUNTIME_CACHE_TIMEOUT value: "${process.env.RUNTIME_CACHE_TIMEOUT}". Using default: ${r}ms`)}v=new h.BuildCache({endpoint:t,headers:e,onError:e=>console.error(e),timeout:r})}return v}var w=(e=>(e.Fresh=`fresh`,e.Stale=`stale`,e.Expired=`expired`,e.NotFound=`notFound`,e.Error=`error`,e))(w||{});let T=`x-vercel-cache-state`,E=`x-vercel-revalidate`,D=`x-vercel-cache-tags`,O=`x-vercel-cache-item-name`;0&&(t.exports={HEADERS_VERCEL_CACHE_ITEM_NAME:O,HEADERS_VERCEL_CACHE_STATE:T,HEADERS_VERCEL_CACHE_TAGS:D,HEADERS_VERCEL_REVALIDATE:E,PkgCacheState:w,getCache:y})})),l=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{attachDatabasePool:()=>v,experimental_attachDatabasePool:()=>y}),t.exports=l(u);var d=r();let f=!!process.env.DEBUG;function p(e){if(`options`in e&&e.options){if(`idleTimeoutMillis`in e.options)return typeof e.options.idleTimeoutMillis==`number`?e.options.idleTimeoutMillis:1e4;if(`maxIdleTimeMS`in e.options)return typeof e.options.maxIdleTimeMS==`number`?e.options.maxIdleTimeMS:0;if(`status`in e)return 5e3;if(`connect`in e&&`execute`in e)return 3e4}if(`config`in e&&e.config){if(`connectionConfig`in e.config&&e.config.connectionConfig)return e.config.connectionConfig.idleTimeout||6e4;if(`idleTimeout`in e.config)return typeof e.config.idleTimeout==`number`?e.config.idleTimeout:6e4}return`poolTimeout`in e?typeof e.poolTimeout==`number`?e.poolTimeout:6e4:`idleTimeout`in e?typeof e.idleTimeout==`number`?e.idleTimeout:0:1e4}let m=null,h=()=>{},g=Date.now();function _(e){if(!process.env.VERCEL_URL||!process.env.VERCEL_REGION)return;m&&(clearTimeout(m),h());let t=new Promise(e=>{h=e}),n=Math.min(p(e)+100,Math.max(100,899e3-(Date.now()-g)));m=setTimeout(()=>{h?.(),f&&console.log(`Database pool idle timeout reached. Releasing connections.`)},n);let r=(0,d.getContext)();r?.waitUntil?r.waitUntil(t):console.warn(`Pool release event triggered outside of request scope.`)}function v(e){if(m&&(h?.(),clearTimeout(m)),`on`in e&&e.on&&`options`in e&&`idleTimeoutMillis`in e.options){e.on(`release`,()=>{f&&console.log(`Client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`connectionConfig`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`idleTimeout`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL2/MariaDB client released from pool`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`maxIdleTimeMS`in e.options){e.on(`connectionCheckedOut`,()=>{f&&console.log(`MongoDB connection checked out`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`socket`in e.options){e.on(`end`,()=>{f&&console.log(`Redis connection ended`),_(e)});return}throw Error(`Unsupported database pool type`)}let y=v;0&&(t.exports={attachDatabasePool:v,experimental_attachDatabasePool:y})})),u=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{dangerouslyDeleteBySrcImage:()=>h,dangerouslyDeleteByTag:()=>p,invalidateBySrcImage:()=>m,invalidateByTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateByTag(e):Promise.resolve()},p=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteByTag(e,t):Promise.resolve()},m=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateBySrcImage(e):Promise.resolve()},h=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteBySrcImage(e,t):Promise.resolve()};0&&(t.exports={dangerouslyDeleteBySrcImage:h,dangerouslyDeleteByTag:p,invalidateBySrcImage:m,invalidateByTag:f})})),d=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{addCacheTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().addCacheTag;return t?t(e):Promise.resolve()};0&&(t.exports={addCacheTag:f})})),f=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{experimental_upgradeWebSocket:()=>p}),t.exports=l(u);var d=r();async function f(){try{return(await import(`./wrapper-Cc2otuUR.js`)).WebSocketServer}catch{throw Error(`The "ws" package is required for experimental_upgradeWebSocket(). Install it with: npm install ws`)}}async function p(e,t={}){let n=(0,d.getContext)();if(typeof n.upgradeWebSocket!=`function`)throw Error(`experimental_upgradeWebSocket is not available in the current runtime environment. This feature requires a Vercel runtime that supports WebSocket upgrades.`);let r=await f(),{req:i,socket:a,head:o}=n.upgradeWebSocket(),s=new r({noServer:!0,maxPayload:t.maxPayload??262144}),c=await new Promise((e,t)=>{let n=()=>{a.removeListener(`error`,l),a.removeListener(`close`,u)},r=e=>{if(n(),e instanceof Error){t(e);return}let r=Error(`WebSocket upgrade failed`);r.cause=e,t(r)},c=t=>{n(),e(t)},l=e=>r(e),u=()=>r(Error(`socket closed before the WebSocket upgrade completed`));a.once(`error`,l),a.once(`close`,u);try{s.handleUpgrade(i,a,o,c)}catch(e){r(e)}});try{await e(c)}catch(e){throw c.close(1011,`WebSocket handler failed`),e}return new Response(null,{status:204})}0&&(t.exports={experimental_upgradeWebSocket:p})})),p=e(((e,r)=>{var o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.prototype.hasOwnProperty,h=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of p(t))!m.call(e,i)&&i!==n&&o(e,i,{get:()=>t[i],enumerable:!(r=s(t,i))||r.enumerable});return e},_=e=>g(o({},`__esModule`,{value:!0}),e),v={};h(v,{addCacheTag:()=>E.addCacheTag,attachDatabasePool:()=>w.attachDatabasePool,dangerouslyDeleteBySrcImage:()=>T.dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag:()=>T.dangerouslyDeleteByTag,experimental_attachDatabasePool:()=>w.experimental_attachDatabasePool,experimental_upgradeWebSocket:()=>D.experimental_upgradeWebSocket,geolocation:()=>y.geolocation,getCache:()=>C.getCache,getEnv:()=>b.getEnv,invalidateBySrcImage:()=>T.invalidateBySrcImage,invalidateByTag:()=>T.invalidateByTag,ipAddress:()=>y.ipAddress,next:()=>S.next,rewrite:()=>S.rewrite,waitUntil:()=>x.waitUntil}),r.exports=_(v);var y=t(),b=n(),x=i(),S=a(),C=c(),w=l(),T=u(),E=d(),D=f();0&&(r.exports={addCacheTag,attachDatabasePool,dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag,experimental_attachDatabasePool,experimental_upgradeWebSocket,geolocation,getCache,getEnv,invalidateBySrcImage,invalidateByTag,ipAddress,next,rewrite,waitUntil})}));export default p();export{};
|
|
1
|
+
import{t as e}from"./chunk-BTyA9uPd.js";var t=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{CITY_HEADER_NAME:()=>u,COUNTRY_HEADER_NAME:()=>d,EMOJI_FLAG_UNICODE_STARTING_POSITION:()=>v,IP_HEADER_NAME:()=>f,LATITUDE_HEADER_NAME:()=>p,LONGITUDE_HEADER_NAME:()=>m,POSTAL_CODE_HEADER_NAME:()=>g,REGION_HEADER_NAME:()=>h,REQUEST_ID_HEADER_NAME:()=>_,geolocation:()=>w,ipAddress:()=>S}),t.exports=c(l);let u=`x-vercel-ip-city`,d=`x-vercel-ip-country`,f=`x-real-ip`,p=`x-vercel-ip-latitude`,m=`x-vercel-ip-longitude`,h=`x-vercel-ip-country-region`,g=`x-vercel-ip-postal-code`,_=`x-vercel-id`,v=127397;function y(e,t){return e.get(t)??void 0}function b(e,t){let n=y(e.headers,t);return n?decodeURIComponent(n):void 0}function x(e){let t=RegExp(`^[A-Z]{2}$`).test(e);if(!(!e||!t))return String.fromCodePoint(...e.split(``).map(e=>v+e.charCodeAt(0)))}function S(e){return y(`headers`in e?e.headers:e,f)}function C(e){return e?e.split(`:`)[0]:`dev1`}function w(e){return{city:b(e,u),country:y(e.headers,d),flag:x(y(e.headers,d)),countryRegion:y(e.headers,h),region:C(y(e.headers,_)),latitude:y(e.headers,p),longitude:y(e.headers,m),postalCode:y(e.headers,g)}}0&&(t.exports={CITY_HEADER_NAME:u,COUNTRY_HEADER_NAME:d,EMOJI_FLAG_UNICODE_STARTING_POSITION:v,IP_HEADER_NAME:f,LATITUDE_HEADER_NAME:p,LONGITUDE_HEADER_NAME:m,POSTAL_CODE_HEADER_NAME:g,REGION_HEADER_NAME:h,REQUEST_ID_HEADER_NAME:_,geolocation:w,ipAddress:S})})),n=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getEnv:()=>u}),t.exports=c(l);let u=(e=process.env)=>({VERCEL:d(e,`VERCEL`),CI:d(e,`CI`),VERCEL_ENV:d(e,`VERCEL_ENV`),VERCEL_URL:d(e,`VERCEL_URL`),VERCEL_BRANCH_URL:d(e,`VERCEL_BRANCH_URL`),VERCEL_PROJECT_PRODUCTION_URL:d(e,`VERCEL_PROJECT_PRODUCTION_URL`),VERCEL_REGION:d(e,`VERCEL_REGION`),VERCEL_DEPLOYMENT_ID:d(e,`VERCEL_DEPLOYMENT_ID`),VERCEL_SKEW_PROTECTION_ENABLED:d(e,`VERCEL_SKEW_PROTECTION_ENABLED`),VERCEL_AUTOMATION_BYPASS_SECRET:d(e,`VERCEL_AUTOMATION_BYPASS_SECRET`),VERCEL_GIT_PROVIDER:d(e,`VERCEL_GIT_PROVIDER`),VERCEL_GIT_REPO_SLUG:d(e,`VERCEL_GIT_REPO_SLUG`),VERCEL_GIT_REPO_OWNER:d(e,`VERCEL_GIT_REPO_OWNER`),VERCEL_GIT_REPO_ID:d(e,`VERCEL_GIT_REPO_ID`),VERCEL_GIT_COMMIT_REF:d(e,`VERCEL_GIT_COMMIT_REF`),VERCEL_GIT_COMMIT_SHA:d(e,`VERCEL_GIT_COMMIT_SHA`),VERCEL_GIT_COMMIT_MESSAGE:d(e,`VERCEL_GIT_COMMIT_MESSAGE`),VERCEL_GIT_COMMIT_AUTHOR_LOGIN:d(e,`VERCEL_GIT_COMMIT_AUTHOR_LOGIN`),VERCEL_GIT_COMMIT_AUTHOR_NAME:d(e,`VERCEL_GIT_COMMIT_AUTHOR_NAME`),VERCEL_GIT_PREVIOUS_SHA:d(e,`VERCEL_GIT_PREVIOUS_SHA`),VERCEL_GIT_PULL_REQUEST_ID:d(e,`VERCEL_GIT_PULL_REQUEST_ID`)}),d=(e,t)=>{let n=e[t];return n===``?void 0:n};0&&(t.exports={getEnv:u})})),r=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),i=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{waitUntil:()=>f}),t.exports=l(u);var d=r();let f=e=>{if(typeof e!=`object`||!e||typeof e.then!=`function`)throw TypeError(`waitUntil can only be called with a Promise, got ${typeof e}`);return(0,d.getContext)().waitUntil?.(e)};0&&(t.exports={waitUntil:f})})),a=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{next:()=>f,rewrite:()=>d}),t.exports=c(l);function u(e,t){if(e?.request?.headers){if(!(e.request.headers instanceof Headers))throw Error(`request.headers must be an instance of Headers`);let n=[];for(let[r,i]of e.request.headers)t.set(`x-middleware-request-`+r,i),n.push(r);t.set(`x-middleware-override-headers`,n.join(`,`))}}function d(e,t){let n=new Headers(t?.headers??{});return n.set(`x-middleware-rewrite`,String(e)),u(t,n),new Response(null,{...t,headers:n})}function f(e){let t=new Headers(e?.headers??{});return t.set(`x-middleware-next`,`1`),u(e,t),new Response(null,{...e,headers:t})}0&&(t.exports={next:f,rewrite:d})})),o=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{InMemoryCache:()=>u}),t.exports=c(l);var u=class{constructor(){this.cache={}}async get(e){let t=this.cache[e];return t?t.ttl&&t.lastModified+t.ttl*1e3<Date.now()?(await this.delete(e),null):JSON.parse(t.value):null}async set(e,t,n){let r=JSON.stringify(t??null);this.cache[e]={value:r,lastModified:Date.now(),ttl:n?.ttl,tags:new Set(n?.tags||[])}}async delete(e){delete this.cache[e]}async expireTag(e){let t=Array.isArray(e)?e:[e];for(let e in this.cache)if(Object.prototype.hasOwnProperty.call(this.cache,e)){let n=this.cache[e];t.some(e=>n.tags.has(e))&&delete this.cache[e]}}};0&&(t.exports={InMemoryCache:u})})),s=e(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},l=e=>s(n({},`__esModule`,{value:!0}),e),u={};o(u,{BuildCache:()=>f}),t.exports=l(u);var d=c(),f=class{constructor({endpoint:e,headers:t,onError:n,timeout:r=500}){this.get=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{headers:this.headers,method:`GET`,signal:t.signal});if(r.status===404)return clearTimeout(n),null;if(r.status===200){if(r.headers.get(d.HEADERS_VERCEL_CACHE_STATE)!==d.PkgCacheState.Fresh)return r.body?.cancel?.(),clearTimeout(n),null;let e=await r.json();return clearTimeout(n),e}else throw clearTimeout(n),Error(`Failed to get cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e);return null}},this.set=async(e,t,n)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),this.timeout);try{let a={};n?.ttl&&(a[d.HEADERS_VERCEL_REVALIDATE]=n.ttl.toString()),n?.tags&&n.tags.length>0&&(a[d.HEADERS_VERCEL_CACHE_TAGS]=n.tags.join(`,`)),n?.name&&(a[d.HEADERS_VERCEL_CACHE_ITEM_NAME]=n.name);let o=await fetch(`${this.endpoint}${e}`,{method:`POST`,headers:{...this.headers,...a},body:JSON.stringify(t),signal:r.signal});if(clearTimeout(i),o.status!==200)throw Error(`Failed to set cache: ${o.status} ${o.statusText}`)}catch(e){if(clearTimeout(i),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.delete=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{let r=await fetch(`${this.endpoint}${e}`,{method:`DELETE`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to delete cache: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.expireTag=async e=>{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{Array.isArray(e)&&(e=e.join(`,`));let r=await fetch(`${this.endpoint}revalidate?tags=${e}`,{method:`POST`,headers:this.headers,signal:t.signal});if(clearTimeout(n),r.status!==200)throw Error(`Failed to revalidate tag: ${r.statusText}`)}catch(e){if(clearTimeout(n),e.name===`AbortError`){let t=Error(`Cache request timed out after ${this.timeout}ms`);t.stack=e.stack,this.onError?.(t)}else this.onError?.(e)}},this.endpoint=e,this.headers=t,this.onError=n,this.timeout=r}};0&&(t.exports={BuildCache:f})})),c=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of a(t))!c.call(e,s)&&s!==r&&n(e,s,{get:()=>t[s],enumerable:!(o=i(t,s))||o.enumerable});return e},d=e=>u(n({},`__esModule`,{value:!0}),e),f={};l(f,{HEADERS_VERCEL_CACHE_ITEM_NAME:()=>O,HEADERS_VERCEL_CACHE_STATE:()=>T,HEADERS_VERCEL_CACHE_TAGS:()=>D,HEADERS_VERCEL_REVALIDATE:()=>E,PkgCacheState:()=>w,getCache:()=>y}),t.exports=d(f);var p=r(),m=o(),h=s();let g=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)},_=null,v=null,y=e=>x(()=>{let e;return e=(0,p.getContext)().cache?(0,p.getContext)().cache:C(process.env.SUSPENSE_CACHE_DEBUG===`true`),e},b(e));function b(e){let t=e?.keyHashFunction||g;return n=>{if(!e?.namespace)return t(n);let r=e.namespaceSeparator||`$`;return`${e.namespace}${r}${t(n)}`}}function x(e,t){return{get:n=>e().get(t(n)),set:(n,r,i)=>e().set(t(n),r,{...i,name:i?.name??n}),delete:n=>e().delete(t(n)),expireTag:t=>e().expireTag(t)}}let S=!1;function C(e){if(_||=new m.InMemoryCache,process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE===`true`)return e&&console.log(`Using InMemoryCache as build cache is disabled`),_;let{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}=process.env;if(e&&console.log(`Runtime cache environment variables:`,{RUNTIME_CACHE_ENDPOINT:t,RUNTIME_CACHE_HEADERS:n}),!t||!n)return S||=(console.warn(`Runtime Cache unavailable in this environment. Falling back to in-memory cache.`),!0),_;if(!v){let e={};try{e=JSON.parse(n)}catch(e){return console.error(`Failed to parse RUNTIME_CACHE_HEADERS:`,e),_}let r=500;if(process.env.RUNTIME_CACHE_TIMEOUT){let e=parseInt(process.env.RUNTIME_CACHE_TIMEOUT,10);!isNaN(e)&&e>0?r=e:console.warn(`Invalid RUNTIME_CACHE_TIMEOUT value: "${process.env.RUNTIME_CACHE_TIMEOUT}". Using default: ${r}ms`)}v=new h.BuildCache({endpoint:t,headers:e,onError:e=>console.error(e),timeout:r})}return v}var w=(e=>(e.Fresh=`fresh`,e.Stale=`stale`,e.Expired=`expired`,e.NotFound=`notFound`,e.Error=`error`,e))(w||{});let T=`x-vercel-cache-state`,E=`x-vercel-revalidate`,D=`x-vercel-cache-tags`,O=`x-vercel-cache-item-name`;0&&(t.exports={HEADERS_VERCEL_CACHE_ITEM_NAME:O,HEADERS_VERCEL_CACHE_STATE:T,HEADERS_VERCEL_CACHE_TAGS:D,HEADERS_VERCEL_REVALIDATE:E,PkgCacheState:w,getCache:y})})),l=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{attachDatabasePool:()=>v,experimental_attachDatabasePool:()=>y}),t.exports=l(u);var d=r();let f=!!process.env.DEBUG;function p(e){if(`options`in e&&e.options){if(`idleTimeoutMillis`in e.options)return typeof e.options.idleTimeoutMillis==`number`?e.options.idleTimeoutMillis:1e4;if(`maxIdleTimeMS`in e.options)return typeof e.options.maxIdleTimeMS==`number`?e.options.maxIdleTimeMS:0;if(`status`in e)return 5e3;if(`connect`in e&&`execute`in e)return 3e4}if(`config`in e&&e.config){if(`connectionConfig`in e.config&&e.config.connectionConfig)return e.config.connectionConfig.idleTimeout||6e4;if(`idleTimeout`in e.config)return typeof e.config.idleTimeout==`number`?e.config.idleTimeout:6e4}return`poolTimeout`in e?typeof e.poolTimeout==`number`?e.poolTimeout:6e4:`idleTimeout`in e?typeof e.idleTimeout==`number`?e.idleTimeout:0:1e4}let m=null,h=()=>{},g=Date.now();function _(e){if(!process.env.VERCEL_URL||!process.env.VERCEL_REGION)return;m&&(clearTimeout(m),h());let t=new Promise(e=>{h=e}),n=Math.min(p(e)+100,Math.max(100,899e3-(Date.now()-g)));m=setTimeout(()=>{h?.(),f&&console.log(`Database pool idle timeout reached. Releasing connections.`)},n);let r=(0,d.getContext)();r?.waitUntil?r.waitUntil(t):console.warn(`Pool release event triggered outside of request scope.`)}function v(e){if(m&&(h?.(),clearTimeout(m)),`on`in e&&e.on&&`options`in e&&`idleTimeoutMillis`in e.options){e.on(`release`,()=>{f&&console.log(`Client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`connectionConfig`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL client released from pool`),_(e)});return}else if(`on`in e&&e.on&&`config`in e&&e.config&&`idleTimeout`in e.config){e.on(`release`,()=>{f&&console.log(`MySQL2/MariaDB client released from pool`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`maxIdleTimeMS`in e.options){e.on(`connectionCheckedOut`,()=>{f&&console.log(`MongoDB connection checked out`),_(e)});return}if(`on`in e&&e.on&&`options`in e&&e.options&&`socket`in e.options){e.on(`end`,()=>{f&&console.log(`Redis connection ended`),_(e)});return}throw Error(`Unsupported database pool type`)}let y=v;0&&(t.exports={attachDatabasePool:v,experimental_attachDatabasePool:y})})),u=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{dangerouslyDeleteBySrcImage:()=>h,dangerouslyDeleteByTag:()=>p,invalidateBySrcImage:()=>m,invalidateByTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateByTag(e):Promise.resolve()},p=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteByTag(e,t):Promise.resolve()},m=e=>{let t=(0,d.getContext)().purge;return t?t.invalidateBySrcImage(e):Promise.resolve()},h=(e,t)=>{let n=(0,d.getContext)().purge;return n?n.dangerouslyDeleteBySrcImage(e,t):Promise.resolve()};0&&(t.exports={dangerouslyDeleteBySrcImage:h,dangerouslyDeleteByTag:p,invalidateBySrcImage:m,invalidateByTag:f})})),d=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{addCacheTag:()=>f}),t.exports=l(u);var d=r();let f=e=>{let t=(0,d.getContext)().addCacheTag;return t?t(e):Promise.resolve()};0&&(t.exports={addCacheTag:f})})),f=e(((e,t)=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c=(e,t,r,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==r&&n(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(n({},`__esModule`,{value:!0}),e),u={};s(u,{experimental_upgradeWebSocket:()=>p}),t.exports=l(u);var d=r();async function f(){try{return(await import(`./wrapper-DnoQohyD.js`)).WebSocketServer}catch{throw Error(`The "ws" package is required for experimental_upgradeWebSocket(). Install it with: npm install ws`)}}async function p(e,t={}){let n=(0,d.getContext)();if(typeof n.upgradeWebSocket!=`function`)throw Error(`experimental_upgradeWebSocket is not available in the current runtime environment. This feature requires a Vercel runtime that supports WebSocket upgrades.`);let r=await f(),{req:i,socket:a,head:o}=n.upgradeWebSocket(),s=new r({noServer:!0,maxPayload:t.maxPayload??262144}),c=await new Promise((e,t)=>{let n=()=>{a.removeListener(`error`,l),a.removeListener(`close`,u)},r=e=>{if(n(),e instanceof Error){t(e);return}let r=Error(`WebSocket upgrade failed`);r.cause=e,t(r)},c=t=>{n(),e(t)},l=e=>r(e),u=()=>r(Error(`socket closed before the WebSocket upgrade completed`));a.once(`error`,l),a.once(`close`,u);try{s.handleUpgrade(i,a,o,c)}catch(e){r(e)}});try{await e(c)}catch(e){throw c.close(1011,`WebSocket handler failed`),e}return new Response(null,{status:204})}0&&(t.exports={experimental_upgradeWebSocket:p})})),p=e(((e,r)=>{var o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.prototype.hasOwnProperty,h=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of p(t))!m.call(e,i)&&i!==n&&o(e,i,{get:()=>t[i],enumerable:!(r=s(t,i))||r.enumerable});return e},_=e=>g(o({},`__esModule`,{value:!0}),e),v={};h(v,{addCacheTag:()=>E.addCacheTag,attachDatabasePool:()=>w.attachDatabasePool,dangerouslyDeleteBySrcImage:()=>T.dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag:()=>T.dangerouslyDeleteByTag,experimental_attachDatabasePool:()=>w.experimental_attachDatabasePool,experimental_upgradeWebSocket:()=>D.experimental_upgradeWebSocket,geolocation:()=>y.geolocation,getCache:()=>C.getCache,getEnv:()=>b.getEnv,invalidateBySrcImage:()=>T.invalidateBySrcImage,invalidateByTag:()=>T.invalidateByTag,ipAddress:()=>y.ipAddress,next:()=>S.next,rewrite:()=>S.rewrite,waitUntil:()=>x.waitUntil}),r.exports=_(v);var y=t(),b=n(),x=i(),S=a(),C=c(),w=l(),T=u(),E=d(),D=f();0&&(r.exports={addCacheTag,attachDatabasePool,dangerouslyDeleteBySrcImage,dangerouslyDeleteByTag,experimental_attachDatabasePool,experimental_upgradeWebSocket,geolocation,getCache,getEnv,invalidateBySrcImage,invalidateByTag,ipAddress,next,rewrite,waitUntil})}));export default p();export{};
|
package/dist/src/compiled/_chunks/workflow/{resume-hook-czpG5xnP.js → resume-hook-g1vh0WRC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-BTyA9uPd.js";import{E as t,n,o as r}from"./dist-B3qkUnLJ.js";import{A as i,C as a,On as o,Pn as s,Q as c,W as l,_ as u,a as d,ct as f,et as p,fn as m,lt as h,n as g,nn as _,qt as v,r as y,st as b,vn as x}from"./attribute-changes-
|
|
1
|
+
import{r as e}from"./chunk-BTyA9uPd.js";import{E as t,n,o as r}from"./dist-B3qkUnLJ.js";import{A as i,C as a,On as o,Pn as s,Q as c,W as l,_ as u,a as d,ct as f,et as p,fn as m,lt as h,n as g,nn as _,qt as v,r as y,st as b,vn as x}from"./attribute-changes-CB7nRYoY.js";import{N as S,s as C}from"./dist-BX517Nmz.js";var w=e({getHookByToken:()=>D,resumeHook:()=>O,resumeWebhook:()=>k});async function T(e){let t=await x(),n=await t.hooks.getByToken(e);return{hook:n,run:await t.runs.get(n.runId)}}async function E(e){let{hook:t,run:n}=await T(e),r=await(await x()).getEncryptionKeyForRun?.(n),a=r?await s(r):void 0;return t.metadata!==void 0&&(t.metadata=await i(t.metadata,t.runId,a)),{hook:t,encryptionKey:a}}async function D(e){let{hook:t}=await E(e);return t}async function O(e,t,n){return await y(()=>p(`hook.resume`,async i=>{let o=await x();try{let p,y;if(typeof e==`string`){let t=await T(e);p=t.hook,y=t.run}else p=e,y=await o.runs.get(p.runId);if(i?.setAttributes({...h(p.token),...f(p.hookId),..._(p.runId)}),S(y.status))throw new r(p.token);let b=n;if(!b){let e=await o.getEncryptionKeyForRun?.(y);b=e?await s(e):void 0}let x=y.executionContext?.workflowCoreVersion,w=u(typeof x==`string`?x:void 0);w.supportedFormats.has(m.ENCRYPTED)||(b=void 0);let E=(y.specVersion??0)>=5&&w.supportedFormats.has(m.GZIP),D=[],O=C(p.specVersion),k=await a(t,p.runId,b,D,globalThis,O,w.framedByteStreams,E);g(Promise.all(D),e=>{e!==void 0&&l.warn(`Background flush of hook payload ops failed`,{workflowRunId:p.runId,hookId:p.hookId,error:e instanceof Error?e.message:String(e)})}),await o.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:{...O?{}:{token:p.token},payload:k}},{v1Compat:O}),i?.setAttributes({...v(y.workflowName)});let A=await c(y.executionContext?.traceCarrier);return A&&i?.addLink?.(A),await o.queue(d(y.workflowName),{runId:p.runId,traceCarrier:y.executionContext?.traceCarrier??void 0},{deploymentId:y.deploymentId,specVersion:y.specVersion??1}),p}catch(t){throw i?.setAttributes({...h(typeof e==`string`?e:e.token),...b(!1)}),t}}))}async function k(e,i){let{hook:a,encryptionKey:s}=await E(e);if(a.isWebhook===!1)throw new r(e);let c,l;if(a.metadata&&typeof a.metadata==`object`&&`respondWith`in a.metadata)if(a.metadata.respondWith===`manual`){let{readable:e,writable:t}=new TransformStream;l=e,i[o]=t}else if(a.metadata.respondWith instanceof Response)c=a.metadata.respondWith;else throw new t(`Invalid \`respondWith\` value: ${a.metadata.respondWith}`,{slug:n.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else c=new Response(null,{status:202});if(await O(a,i,s),l){let e=l.getReader(),t=await e.read();t.value&&(c=t.value),e.cancel()}if(!c)throw new t(`Workflow run did not send a response`,{slug:n.WEBHOOK_RESPONSE_NOT_SENT});return c}export{w as i,O as n,k as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./dist-CrxV2rsR.js";import{C as t,D as n,E as r,O as i,S as a,T as o,g as s,h as c,l,p as u,r as d,s as f,t as p,w as m,x as h}from"./dist-B3qkUnLJ.js";import{$ as ee,Bt as g,D as _,H as v,Jt as y,N as b,P as x,Pn as S,U as C,W as w,_ as T,_n as E,a as D,et as O,fn as k,g as A,gn as j,k as M,n as N,nn as P,qt as te,r as F,rn as ne,rt as re,s as ie,t as ae,vn as I,w as L,yn as R}from"./attribute-changes-Dk1fP6vt.js";import{J as z,i as B,o as V,q as H,s as U}from"./dist-BX517Nmz.js";const W=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,i.WORLD_CONTRACT_ERROR]),G=new Set([`TRANSPORT`,`TIMEOUT`]),K=[r.is,c.is,h.is,u.is];function q(e){if(!n.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 J(e){return s.is(e)?!0:n.is(e)?e.status!==void 0&&e.status>=500?!0:e.code!==void 0&&G.has(e.code):!1}function oe(e){if(l.is(e))return i.REPLAY_DIVERGENCE;if(p.is(e))return i.CORRUPTED_EVENT_LOG;if(f.is(e))return i.MAX_EVENTS_EXCEEDED;if(q(e)||J(e))return i.WORLD_CONTRACT_ERROR;for(let t of K)if(t(e))return i.RUNTIME_ERROR;return i.USER_ERROR}const se=V();function ce(){let e=C.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[z]:e.rootRunId??t,[H]:t}}let Y=!1;async function X(t,n,i){"use step";return await F(()=>{let a=t?.workflowId;if(!a)throw new r(`'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 O(`workflow.start ${e(a)}`,async e=>{e?.setAttributes({...te(a),...y(`start`)});let t=[],o=i??{};Array.isArray(n)?t=n:typeof n==`object`&&(o=n),e?.setAttributes({...g(t.length)});let s=o.world??await I();R(s);let c=await s.getDeploymentId(),l=o.deploymentId??c;l===`latest`&&(s.resolveLatestDeploymentId?l=await s.resolveLatestDeploymentId():(Y||(Y=!0,w.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:c})),l=c));let u,f;if(l===c)u=!0,f=!0;else if(typeof s.streams?.get!=`function`)u=!1,f=!1;else{let e=T((await ie(s,`workflow`,{deploymentId:l,timeout:2e3,namespace:o.namespace}).catch(()=>void 0))?.workflowCoreVersion);u=e.framedByteStreams,f=e.supportedFormats.has(k.GZIP)}let p=[],m=`wrun_${s.createRunId?s.createRunId(o):se()}`,h=await ee(),_=o.specVersion??s.specVersion,v=U(_),b=o.allowReservedAttributes===!0,x;if(o.attributes&&Object.keys(o.attributes).length>0){if(_<4)throw new r(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(o.attributes))if(typeof t!=`string`)throw new r(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=ae(o.attributes,{allowReservedAttributes:b});x=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let C=_>=4?ce():void 0,E=C?{...C,...x}:x,O=E?{attributes:E,...b||C!=null?{allowReservedAttributes:!0}:{}}:{};if(o.replayedFromRunId!==void 0&&!B.safeParse(o.replayedFromRunId).success)throw new r(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(o.replayedFromRunId).slice(0,64))}.`);let j=await s.getEncryptionKeyForRun?.(m,{...o,deploymentId:l}),M=j?await S(j):void 0,F=await L(t,m,M,p,globalThis,v,u,f&&_>=5),z={traceCarrier:h,workflowCoreVersion:A,features:{encryption:!!M},...o.replayedFromRunId?{replayedFromRunId:o.replayedFromRunId}:{}},[V,H]=await Promise.allSettled([s.events.create(m,{eventType:`run_created`,specVersion:_,eventData:{deploymentId:l,workflowName:a,input:F,executionContext:z,...O}},{v1Compat:v}),s.queue(D(a,o.namespace),{runId:m,traceCarrier:h,..._>=3?{runInput:{input:F,deploymentId:l,workflowName:a,specVersion:_,executionContext:z,...O}}:{}},{deploymentId:l,specVersion:_,...o.region===void 0?{}:{region:o.region}})]);if(H.status===`rejected`)throw H.reason;let W=!1;if(V.status===`rejected`){let e=V.reason;if(!d.is(e))if(J(e))W=!0,w.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:m,error:e.message});else throw e}else{let e=V.value;if(!e.run)throw new r(`Missing 'run' in server response for 'run_created' event`);if(!v&&e.run.runId!==m)throw new r(`Server returned different runId than requested: expected ${m}, got ${e.run.runId}`)}return N(Promise.all(p),e=>{w.warn(`Background flush of workflow argument streams failed`,{workflowRunId:m,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...P(m),...re(l),...V.status===`fulfilled`&&V.value.run?ne(V.value.run.status):{}}),new $(m,{resilientStart:W})})})}const Z=e=>Array.isArray(e)?e:[e];async function le(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await S(i):void 0,o=Z(await b(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 ue(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=U(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 de(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(D(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=U(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{limit:1e3,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),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=[],f=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}),f++}catch(e){d.is(e)?f++:u.push(e instanceof Error?e:Error(String(e)))}}if(f>0&&await e.queue(D(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:f}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function fe(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function pe(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}var $=class e{static[E](e){return{runId:e.runId,resilientStart:e.#r}}static[j](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=I(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await S(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return Q(await this.#t,this.runId,e)}async cancel(e){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5,...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(o.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,a=v(this.runId,i),o=this.#a(),s=_(n,t,this.runId,o).ReadableStream({name:a,startIndex:r}),c=this.#t,l=this.runId;return Object.assign(s,{getTailIndex:async()=>(await(await c).streams.getInfo(l,a)).tailIndex})}async#o(){let e=await this.#t,n=0,r=this.#r?3:0,i=[1e3,3e3,6e3];for(;;)try{let n=await e.runs.get(this.runId);if(n.status===`completed`){let e=await this.#i();return await x(n.output,this.runId,e)}if(n.status===`cancelled`)throw new a(this.runId);if(n.status===`failed`){let e=await this.#i(),r;try{r=await M(n.error,this.runId,e)}catch{r=Error(`Failed to hydrate workflow run error`)}throw new t(this.runId,r,{errorCode:n.errorCode})}throw new m(this.runId,n.status)}catch(e){if(m.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(o.is(e)&&n<r){let e=i[n];n++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function me(e){return new $(e)}export{fe as a,Q as c,J as d,q as f,pe as i,X as l,me as n,le as o,ue as r,de as s,$ as t,oe as u};
|
|
1
|
+
import{h as e}from"./dist-CrxV2rsR.js";import{C as t,D as n,E as r,O as i,S as a,T as o,g as s,h as c,l,p as u,r as d,s as f,t as p,w as m,x as h}from"./dist-B3qkUnLJ.js";import{$ as ee,Bt as g,D as _,H as v,Jt as y,N as b,P as x,Pn as S,U as C,W as w,_ as T,_n as E,a as D,et as O,fn as k,g as A,gn as j,k as M,n as N,nn as P,qt as te,r as F,rn as ne,rt as re,s as ie,t as ae,vn as I,w as L,yn as R}from"./attribute-changes-CB7nRYoY.js";import{J as z,i as B,o as V,q as H,s as U}from"./dist-BX517Nmz.js";const W=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,i.WORLD_CONTRACT_ERROR]),G=new Set([`TRANSPORT`,`TIMEOUT`]),K=[r.is,c.is,h.is,u.is];function q(e){if(!n.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 J(e){return s.is(e)?!0:n.is(e)?e.status!==void 0&&e.status>=500?!0:e.code!==void 0&&G.has(e.code):!1}function oe(e){if(l.is(e))return i.REPLAY_DIVERGENCE;if(p.is(e))return i.CORRUPTED_EVENT_LOG;if(f.is(e))return i.MAX_EVENTS_EXCEEDED;if(q(e)||J(e))return i.WORLD_CONTRACT_ERROR;for(let t of K)if(t(e))return i.RUNTIME_ERROR;return i.USER_ERROR}const se=V();function ce(){let e=C.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[z]:e.rootRunId??t,[H]:t}}let Y=!1;async function X(t,n,i){"use step";return await F(()=>{let a=t?.workflowId;if(!a)throw new r(`'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 O(`workflow.start ${e(a)}`,async e=>{e?.setAttributes({...te(a),...y(`start`)});let t=[],o=i??{};Array.isArray(n)?t=n:typeof n==`object`&&(o=n),e?.setAttributes({...g(t.length)});let s=o.world??await I();R(s);let c=await s.getDeploymentId(),l=o.deploymentId??c;l===`latest`&&(s.resolveLatestDeploymentId?l=await s.resolveLatestDeploymentId():(Y||(Y=!0,w.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:c})),l=c));let u,f;if(l===c)u=!0,f=!0;else if(typeof s.streams?.get!=`function`)u=!1,f=!1;else{let e=T((await ie(s,`workflow`,{deploymentId:l,timeout:2e3,namespace:o.namespace}).catch(()=>void 0))?.workflowCoreVersion);u=e.framedByteStreams,f=e.supportedFormats.has(k.GZIP)}let p=[],m=`wrun_${s.createRunId?s.createRunId(o):se()}`,h=await ee(),_=o.specVersion??s.specVersion,v=U(_),b=o.allowReservedAttributes===!0,x;if(o.attributes&&Object.keys(o.attributes).length>0){if(_<4)throw new r(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(o.attributes))if(typeof t!=`string`)throw new r(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=ae(o.attributes,{allowReservedAttributes:b});x=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let C=_>=4?ce():void 0,E=C?{...C,...x}:x,O=E?{attributes:E,...b||C!=null?{allowReservedAttributes:!0}:{}}:{};if(o.replayedFromRunId!==void 0&&!B.safeParse(o.replayedFromRunId).success)throw new r(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(o.replayedFromRunId).slice(0,64))}.`);let j=await s.getEncryptionKeyForRun?.(m,{...o,deploymentId:l}),M=j?await S(j):void 0,F=await L(t,m,M,p,globalThis,v,u,f&&_>=5),z={traceCarrier:h,workflowCoreVersion:A,features:{encryption:!!M},...o.replayedFromRunId?{replayedFromRunId:o.replayedFromRunId}:{}},[V,H]=await Promise.allSettled([s.events.create(m,{eventType:`run_created`,specVersion:_,eventData:{deploymentId:l,workflowName:a,input:F,executionContext:z,...O}},{v1Compat:v}),s.queue(D(a,o.namespace),{runId:m,traceCarrier:h,..._>=3?{runInput:{input:F,deploymentId:l,workflowName:a,specVersion:_,executionContext:z,...O}}:{}},{deploymentId:l,specVersion:_,...o.region===void 0?{}:{region:o.region}})]);if(H.status===`rejected`)throw H.reason;let W=!1;if(V.status===`rejected`){let e=V.reason;if(!d.is(e))if(J(e))W=!0,w.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:m,error:e.message});else throw e}else{let e=V.value;if(!e.run)throw new r(`Missing 'run' in server response for 'run_created' event`);if(!v&&e.run.runId!==m)throw new r(`Server returned different runId than requested: expected ${m}, got ${e.run.runId}`)}return N(Promise.all(p),e=>{w.warn(`Background flush of workflow argument streams failed`,{workflowRunId:m,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...P(m),...re(l),...V.status===`fulfilled`&&V.value.run?ne(V.value.run.status):{}}),new $(m,{resilientStart:W})})})}const Z=e=>Array.isArray(e)?e:[e];async function le(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await S(i):void 0,o=Z(await b(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 ue(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=U(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 de(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(D(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=U(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{limit:1e3,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),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=[],f=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}),f++}catch(e){d.is(e)?f++:u.push(e instanceof Error?e:Error(String(e)))}}if(f>0&&await e.queue(D(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:f}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function fe(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function pe(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}var $=class e{static[E](e){return{runId:e.runId,resilientStart:e.#r}}static[j](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=I(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await S(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return Q(await this.#t,this.runId,e)}async cancel(e){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5,...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(o.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,a=v(this.runId,i),o=this.#a(),s=_(n,t,this.runId,o).ReadableStream({name:a,startIndex:r}),c=this.#t,l=this.runId;return Object.assign(s,{getTailIndex:async()=>(await(await c).streams.getInfo(l,a)).tailIndex})}async#o(){let e=await this.#t,n=0,r=this.#r?3:0,i=[1e3,3e3,6e3];for(;;)try{let n=await e.runs.get(this.runId);if(n.status===`completed`){let e=await this.#i();return await x(n.output,this.runId,e)}if(n.status===`cancelled`)throw new a(this.runId);if(n.status===`failed`){let e=await this.#i(),r;try{r=await M(n.error,this.runId,e)}catch{r=Error(`Failed to hydrate workflow run error`)}throw new t(this.runId,r,{errorCode:n.errorCode})}throw new m(this.runId,n.status)}catch(e){if(m.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(o.is(e)&&n<r){let e=i[n];n++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function me(e){return new $(e)}export{fe as a,Q as c,J as d,q as f,pe as i,X as l,me as n,le as o,ue as r,de as s,$ as t,oe as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ln as e,Mn as t}from"./attribute-changes-
|
|
1
|
+
import{Ln as e,Mn as t}from"./attribute-changes-CB7nRYoY.js";async function n(r){let i=globalThis[t];return i||e(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e,n as t,o as n,t as r}from"./chunk-BTyA9uPd.js";var i=r(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),a=r(((t,n)=>{var r=e(`fs`),i=e(`path`),a=e(`os`),o=typeof __webpack_require__==`function`?__non_webpack_require__:e,s=process.config&&process.config.variables||{},c=!!process.env.PREBUILDS_ONLY,l=process.versions.modules,u=O()?`electron`:D()?`node-webkit`:`node`,d=process.env.npm_config_arch||a.arch(),f=process.env.npm_config_platform||a.platform(),p=process.env.LIBC||(k(f)?`musl`:`glibc`),m=process.env.ARM_VERSION||(d===`arm64`?`8`:s.arm_version)||``,h=(process.versions.uv||``).split(`.`)[0];n.exports=g;function g(e){return o(g.resolve(e))}g.resolve=g.path=function(e){e=i.resolve(e||`.`);try{var t=o(i.join(e,`package.json`)).name.toUpperCase().replace(/-/g,`_`);process.env[t+`_PREBUILD`]&&(e=process.env[t+`_PREBUILD`])}catch{}if(!c){var n=v(i.join(e,`build/Release`),y);if(n)return n;var r=v(i.join(e,`build/Debug`),y);if(r)return r}var a=T(e);if(a)return a;var s=T(i.dirname(process.execPath));if(s)return s;var g=[`platform=`+f,`arch=`+d,`runtime=`+u,`abi=`+l,`uv=`+h,m?`armv=`+m:``,`libc=`+p,`node=`+process.versions.node,process.versions.electron?`electron=`+process.versions.electron:``,typeof __webpack_require__==`function`?`webpack=true`:``].filter(Boolean).join(` `);throw Error(`No native build was found for `+g+`
|
|
2
|
+
loaded from: `+e+`
|
|
3
|
+
`);function T(e){var t=_(i.join(e,`prebuilds`)).map(b).filter(x(f,d)).sort(S)[0];if(t){var n=i.join(e,`prebuilds`,t.name),r=_(n).map(C).filter(w(u,l)).sort(E(u))[0];if(r)return i.join(n,r.file)}}};function _(e){try{return r.readdirSync(e)}catch{return[]}}function v(e,t){var n=_(e).filter(t);return n[0]&&i.join(e,n[0])}function y(e){return/\.node$/.test(e)}function b(e){var t=e.split(`-`);if(t.length===2){var n=t[0],r=t[1].split(`+`);if(n&&r.length&&r.every(Boolean))return{name:e,platform:n,architectures:r}}}function x(e,t){return function(n){return n==null||n.platform!==e?!1:n.architectures.includes(t)}}function S(e,t){return e.architectures.length-t.architectures.length}function C(e){var t=e.split(`.`),n=t.pop(),r={file:e,specificity:0};if(n===`node`){for(var i=0;i<t.length;i++){var a=t[i];if(a===`node`||a===`electron`||a===`node-webkit`)r.runtime=a;else if(a===`napi`)r.napi=!0;else if(a.slice(0,3)===`abi`)r.abi=a.slice(3);else if(a.slice(0,2)===`uv`)r.uv=a.slice(2);else if(a.slice(0,4)===`armv`)r.armv=a.slice(4);else if(a===`glibc`||a===`musl`)r.libc=a;else continue;r.specificity++}return r}}function w(e,t){return function(n){return!(n==null||n.runtime&&n.runtime!==e&&!T(n)||n.abi&&n.abi!==t&&!n.napi||n.uv&&n.uv!==h||n.armv&&n.armv!==m||n.libc&&n.libc!==p)}}function T(e){return e.runtime===`node`&&e.napi}function E(e){return function(t,n){return t.runtime===n.runtime?t.abi===n.abi?t.specificity===n.specificity?0:t.specificity>n.specificity?-1:1:t.abi?-1:1:t.runtime===e?-1:1}}function D(){return!!(process.versions&&process.versions.nw)}function O(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<`u`&&window.process&&window.process.type===`renderer`}function k(e){return e===`linux`&&r.existsSync(`/etc/alpine-release`)}g.parseTags=C,g.matchTags=w,g.compareTags=E,g.parseTuple=b,g.matchTuple=x,g.compareTuples=S})),o=r(((t,n)=>{let r=typeof __webpack_require__==`function`?__non_webpack_require__:e;typeof r.addon==`function`?n.exports=r.addon.bind(r):n.exports=a()})),s=r(((e,t)=>{t.exports={mask:(e,t,n,r,i)=>{for(var a=0;a<i;a++)n[r+a]=e[a]^t[a&3]},unmask:(e,t)=>{let n=e.length;for(var r=0;r<n;r++)e[r]^=t[r&3]}}})),c=r(((e,t)=>{try{t.exports=o()(__dirname)}catch{t.exports=s()}})),l=r(((e,t)=>{let{EMPTY_BUFFER:n}=i(),r=Buffer[Symbol.species];function a(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function l(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function u(e){if(u.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),u.readOnly=!1),t}if(t.exports={concat:a,mask:o,toArrayBuffer:l,toBuffer:u,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=c();t.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},t.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),u=r(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),d=r(((t,n)=>{let r=e(`zlib`),a=l(),o=u(),{kStatusCode:s}=i(),c=Buffer[Symbol.species],d=Buffer.from([0,0,255,255]),f=Symbol(`permessage-deflate`),p=Symbol(`total-length`),m=Symbol(`callback`),h=Symbol(`buffers`),g=Symbol(`error`),_;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,_||=new o(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[m];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){_.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){_.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let i=this._isServer?`client`:`server`;if(!this._inflate){let e=`${i}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[f]=this,this._inflate[p]=0,this._inflate[h]=[],this._inflate.on(`error`,b),this._inflate.on(`data`,y)}this._inflate[m]=n,this._inflate.write(e),t&&this._inflate.write(d),this._inflate.flush(()=>{let e=this._inflate[g];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=a.concat(this._inflate[h],this._inflate[p]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[p]=0,this._inflate[h]=[],t&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let i=this._isServer?`server`:`client`;if(!this._deflate){let e=`${i}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[p]=0,this._deflate[h]=[],this._deflate.on(`data`,v)}this._deflate[m]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=a.concat(this._deflate[h],this._deflate[p]);t&&(e=new c(e.buffer,e.byteOffset,e.length-4)),this._deflate[m]=null,this._deflate[p]=0,this._deflate[h]=[],t&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function v(e){this[h].push(e),this[p]+=e.length}function y(e){if(this[p]+=e.length,this[f]._maxPayload<1||this[p]<=this[f]._maxPayload){this[h].push(e);return}this[g]=RangeError(`Max payload size exceeded`),this[g].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[g][s]=1009,this.removeListener(`data`,y),this.reset()}function b(e){if(this[f]._inflate=null,this[g]){this[m](this[g]);return}e[s]=1007,this[m](e)}})),f=r(((t,n)=>{let{isUtf8:r}=e(`buffer`),{hasBlob:a}=i(),o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function s(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function c(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function l(e){return a&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:l,isValidStatusCode:s,isValidUTF8:c,tokenChars:o},r)n.exports.isValidUTF8=function(e){return e.length<24?c(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=e(`utf-8-validate`);n.exports.isValidUTF8=function(e){return e.length<32?c(e):t(e)}}catch{}})),p=r(((t,n)=>{let{Writable:r}=e(`stream`),a=d(),{BINARY_TYPES:o,EMPTY_BUFFER:s,kStatusCode:c,kWebSocket:u}=i(),{concat:p,toArrayBuffer:m,unmask:h}=l(),{isValidStatusCode:g,isValidUTF8:_}=f(),v=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[u]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new v(t.buffer,t.byteOffset+e,t.length-e),new v(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new v(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[a.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=s;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&h(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[a.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?p(n,t):this._binaryType===`arraybuffer`?m(p(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=p(n,t);if(!this._skipUTF8Validation&&!_(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,s),this.end();else{let n=e.readUInt16BE(0);if(!g(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new v(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!_(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[c]=r,a}}})),m=r(((t,n)=>{let{Duplex:r}=e(`stream`),{randomFillSync:a}=e(`crypto`),{types:{isUint8Array:o}}=e(`util`),s=d(),{EMPTY_BUFFER:c,kWebSocket:u,NOOP:p}=i(),{isBlob:m,isValidStatusCode:h}=f(),{mask:g,toBuffer:_}=l(),v=Symbol(`kByteLength`),y=Buffer.alloc(4),b=8*1024,x,S=b;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=p,this[u]=void 0}static frame(e,t){let n,r=!1,i=2,o=!1;t.mask&&(n=t.maskBuffer||y,t.generateMask?t.generateMask(n):(S===b&&(x===void 0&&(x=Buffer.alloc(b)),a(x,0,b),S=0),n[0]=x[S++],n[1]=x[S++],n[2]=x[S++],n[3]=x[S++]),o=(n[0]|n[1]|n[2]|n[3])===0,i=6);let s;typeof e==`string`?(!t.mask||o)&&t[v]!==void 0?s=t[v]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(i+=8,c=127):s>125&&(i+=2,c=126);let l=Buffer.allocUnsafe(r?s+i:i);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[i-4]=n[0],l[i-3]=n[1],l[i-2]=n[2],l[i-1]=n[3],o)?[l,e]:r?(g(e,n,l,i,s),[l]):(g(e,n,e,0,s),[l,e])}close(t,n,r,i){let a;if(t===void 0)a=c;else if(typeof t!=`number`||!h(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(a=Buffer.allocUnsafe(2+e),a.writeUInt16BE(t,0),typeof n==`string`)a.write(n,2);else if(o(n))a.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let s={[v]:a.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(a,s),i):this.enqueue([this.dispatch,a,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):m(t)?(i=t.size,a=!1):(t=_(t),i=t.length,a=_.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[v]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};m(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):m(t)?(i=t.size,a=!1):(t=_(t),i=t.length,a=_.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[v]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};m(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[s.extensionName],i=t.binary?2:1,a=t.compress,o,c;typeof e==`string`?(o=Buffer.byteLength(e),c=!1):m(e)?(o=e.size,c=!1):(e=_(e),o=e.length,c=_.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=o>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[v]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};m(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[v],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(C,this,e,i);return}this._bufferedBytes-=r[v];let a=_(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[s.extensionName];this._bufferedBytes+=r[v],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);C(this,e,i);return}this._bufferedBytes-=r[v],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][v],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][v],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function C(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function w(e,t,n){C(e,t,n),e.onerror(t)}})),h=r(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=i(),a=Symbol(`kCode`),o=Symbol(`kData`),s=Symbol(`kError`),c=Symbol(`kMessage`),l=Symbol(`kReason`),u=Symbol(`kTarget`),d=Symbol(`kType`),f=Symbol(`kWasClean`);var p=class{constructor(e){this[u]=null,this[d]=e}get target(){return this[u]}get type(){return this[d]}};Object.defineProperty(p.prototype,"target",{enumerable:!0}),Object.defineProperty(p.prototype,"type",{enumerable:!0});var m=class extends p{constructor(e,t={}){super(e),this[a]=t.code===void 0?0:t.code,this[l]=t.reason===void 0?``:t.reason,this[f]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[a]}get reason(){return this[l]}get wasClean(){return this[f]}};Object.defineProperty(m.prototype,"code",{enumerable:!0}),Object.defineProperty(m.prototype,"reason",{enumerable:!0}),Object.defineProperty(m.prototype,"wasClean",{enumerable:!0});var h=class extends p{constructor(e,t={}){super(e),this[s]=t.error===void 0?null:t.error,this[c]=t.message===void 0?``:t.message}get error(){return this[s]}get message(){return this[c]}};Object.defineProperty(h.prototype,"error",{enumerable:!0}),Object.defineProperty(h.prototype,"message",{enumerable:!0});var g=class extends p{constructor(e,t={}){super(e),this[o]=t.data===void 0?null:t.data}get data(){return this[o]}};Object.defineProperty(g.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:m,ErrorEvent:h,Event:p,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new g(`message`,{data:n?e:e.toString()});r[u]=this,_(t,this,r)};else if(e===`close`)a=function(e,n){let r=new m(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[u]=this,_(t,this,r)};else if(e===`error`)a=function(e){let n=new h(`error`,{error:e,message:e.message});n[u]=this,_(t,this,n)};else if(e===`open`)a=function(){let e=new p(`open`);e[u]=this,_(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:g};function _(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),g=r(((e,t)=>{let{tokenChars:n}=f();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),_=r(((t,n)=>{let r=e(`events`),a=e(`https`),o=e(`http`),s=e(`net`),c=e(`tls`),{randomBytes:u,createHash:_}=e(`crypto`),{Duplex:v,Readable:y}=e(`stream`),{URL:b}=e(`url`),x=d(),S=p(),C=m(),{isBlob:w}=f(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=i(),{EventTarget:{addEventListener:P,removeEventListener:ee}}=h(),{format:te,parse:ne}=g(),{toBuffer:F}=l(),I=Symbol(`kAborted`),L=[8,13],R=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],z=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var B=class e extends r{constructor(t,n,r){super(),this._binaryType=T[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=D,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),V(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){T.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new S({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new C(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[M]=this,a[M]=this,t[M]=this,i.on(`conclude`,re),i.on(`drain`,ie),i.on(`error`,ae),i.on(`message`,oe),i.on(`ping`,se),i.on(`pong`,ce),a.onerror=le,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,X),t.on(`data`,Z),t.on(`end`,Q),t.on(`error`,$),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[x.extensionName]&&this._extensions[x.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){G(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){K(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||D,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){K(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||D,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){K(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[x.extensionName]||(i.compress=!1),this._sender.send(t||D,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){G(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(B,"CONNECTING",{enumerable:!0,value:R.indexOf(`CONNECTING`)}),Object.defineProperty(B.prototype,"CONNECTING",{enumerable:!0,value:R.indexOf(`CONNECTING`)}),Object.defineProperty(B,"OPEN",{enumerable:!0,value:R.indexOf(`OPEN`)}),Object.defineProperty(B.prototype,"OPEN",{enumerable:!0,value:R.indexOf(`OPEN`)}),Object.defineProperty(B,"CLOSING",{enumerable:!0,value:R.indexOf(`CLOSING`)}),Object.defineProperty(B.prototype,"CLOSING",{enumerable:!0,value:R.indexOf(`CLOSING`)}),Object.defineProperty(B,"CLOSED",{enumerable:!0,value:R.indexOf(`CLOSED`)}),Object.defineProperty(B.prototype,"CLOSED",{enumerable:!0,value:R.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(B.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(B.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[k])return t[A];return null},set(t){for(let t of this.listeners(e))if(t[k]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[k]:!0})}})}),B.prototype.addEventListener=P,B.prototype.removeEventListener=ee,n.exports=B;function V(e,t,n,r){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:L[1],maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,e._closeTimeout=i.closeTimeout,!L.includes(i.protocolVersion))throw RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${L.join(`, `)})`);let s;if(t instanceof b)s=t;else try{s=new b(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let c=s.protocol===`wss:`,l=s.protocol===`ws+unix:`,d;if(s.protocol!==`ws:`&&!c&&!l?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:l&&!s.pathname?d=`The URL's pathname is empty`:s.hash&&(d=`The URL contains a fragment identifier`),d){let t=SyntaxError(d);if(e._redirects===0)throw t;H(e,t);return}let f=c?443:80,p=u(16).toString(`base64`),m=c?a.request:o.request,h=new Set,g;if(i.createConnection=i.createConnection||(c?W:U),i.defaultPort=i.defaultPort||f,i.port=s.port||f,i.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":p,Connection:`Upgrade`,Upgrade:`websocket`},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(g=new x({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers[`Sec-WebSocket-Extensions`]=te({[x.extensionName]:g.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!z.test(e)||h.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);h.add(e)}i.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(i.origin&&(i.protocolVersion<13?i.headers[`Sec-WebSocket-Origin`]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),l){let e=i.path.split(`:`);i.socketPath=e[0],i.path=e[1]}let v;if(i.followRedirects){if(e._redirects===0){e._originalIpc=l,e._originalSecure=c,e._originalHostOrSocketPath=l?i.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=l?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!c)&&(delete i.headers.authorization,delete i.headers.cookie,t||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(i.auth).toString(`base64`)),v=e._req=m(i),e._redirects&&e.emit(`redirect`,e.url,v)}else v=e._req=m(i);i.timeout&&v.on(`timeout`,()=>{G(e,v,`Opening handshake has timed out`)}),v.on(`error`,t=>{v===null||v[I]||(v=e._req=null,H(e,t))}),v.on(`response`,a=>{let o=a.headers.location,s=a.statusCode;if(o&&i.followRedirects&&s>=300&&s<400){if(++e._redirects>i.maxRedirects){G(e,v,`Maximum redirects exceeded`);return}v.abort();let a;try{a=new b(o,t)}catch{H(e,SyntaxError(`Invalid URL: ${o}`));return}V(e,a,n,r)}else e.emit(`unexpected-response`,v,a)||G(e,v,`Unexpected server response: ${a.statusCode}`)}),v.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==B.CONNECTING)return;v=e._req=null;let a=t.headers.upgrade;if(a===void 0||a.toLowerCase()!==`websocket`){G(e,n,`Invalid Upgrade header`);return}let o=_(`sha1`).update(p+O).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==o){G(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?h.size&&(c=`Server sent no subprotocol`):h.size?h.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){G(e,n,c);return}s&&(e._protocol=s);let l=t.headers[`sec-websocket-extensions`];if(l!==void 0){if(!g){G(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ne(l)}catch{G(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==x.extensionName){G(e,n,`Server indicated an extension that was not requested`);return}try{g.accept(t[x.extensionName])}catch{G(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[x.extensionName]=g}e.setSocket(n,r,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(v,e):v.end()}function H(e,t){e._readyState=B.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function U(e){return e.path=e.socketPath,s.connect(e)}function W(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=s.isIP(e.host)?``:e.host),c.connect(e)}function G(e,t,n){e._readyState=B.CLOSING;let r=Error(n);Error.captureStackTrace(r,G),t.setHeader?(t[I]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(H,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function K(e,t,n){if(t){let n=w(t)?t.size:F(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${R[e.readyState]})`);process.nextTick(n,t)}}function re(e,t){let n=this[M];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[M]!==void 0&&(n._socket.removeListener(`data`,Z),process.nextTick(J,n._socket),e===1005?n.close():n.close(e,t))}function ie(){let e=this[M];e.isPaused||e._socket.resume()}function ae(e){let t=this[M];t._socket[M]!==void 0&&(t._socket.removeListener(`data`,Z),process.nextTick(J,t._socket),t.close(e[j])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function q(){this[M].emitClose()}function oe(e,t){this[M].emit(`message`,e,t)}function se(e){let t=this[M];t._autoPong&&t.pong(e,!this._isServer,N),t.emit(`ping`,e)}function ce(e){this[M].emit(`pong`,e)}function J(e){e.resume()}function le(e){let t=this[M];t.readyState!==B.CLOSED&&(t.readyState===B.OPEN&&(t._readyState=B.CLOSING,Y(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function Y(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function X(){let e=this[M];if(this.removeListener(`close`,X),this.removeListener(`data`,Z),this.removeListener(`end`,Q),e._readyState=B.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[M]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,q),e._receiver.on(`finish`,q))}function Z(e){this[M]._receiver.write(e)||this.pause()}function Q(){let e=this[M];e._readyState=B.CLOSING,e._receiver.end(),this.end()}function $(){let e=this[M];this.removeListener(`error`,$),this.on(`error`,N),e&&(e._readyState=B.CLOSING,this.destroy())}})),v=r(((t,n)=>{_();let{Duplex:r}=e(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),y=r(((e,t)=>{let{tokenChars:n}=f();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),b=r(((t,n)=>{let r=e(`events`),a=e(`http`),{Duplex:o}=e(`stream`),{createHash:s}=e(`crypto`),c=g(),l=d(),u=y(),f=_(),{CLOSE_TIMEOUT:p,GUID:m,kWebSocket:h}=i(),v=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:p,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:f,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=a.createServer((e,t)=>{let n=a.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=b(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(x,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(x,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{x(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,S);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){w(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){w(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!v.test(i)){w(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){w(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){C(t,400);return}let s=e.headers[`sec-websocket-protocol`],d=new Set;if(s!==void 0)try{d=u.parse(s)}catch{w(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=c.parse(f);e[l.extensionName]&&(n.accept(e[l.extensionName]),p[l.extensionName]=n)}catch{w(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return C(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return C(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,o){if(!i.readable||!i.writable)return i.destroy();if(i[h])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return C(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${s(`sha1`).update(t+m).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,n=c.format({[l.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
4
|
+
`).join(`\r
|
|
5
|
+
`)),i.removeListener(`error`,S),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(x,this)})),o(d,r)}};function b(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function x(e){e._state=2,e.emit(`close`)}function S(){this.destroy()}function C(e,t,n,r){n||=a.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${a.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
|
|
6
|
+
`)+`\r
|
|
7
|
+
\r
|
|
8
|
+
`+n)}function w(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,w),e.emit(`wsClientError`,r,n,t)}else C(n,r,i,a)}})),x;t((()=>{v(),g(),d(),p(),m(),y(),_(),x=n(b(),1)}))();var S=x.default;export{S as WebSocketServer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_CREATE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{serializeOutputSchema}from"#shared/tool-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{createPathDerivedSourceId}from"#discover/manifest.js";async function compileSubagentGraph(e){let t=[],n=[],r=[];for(let i of e.subagents){let a=await compileSubagentDefinition({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:e.externalDependencies,parentNodeId:e.parentNodeId,source:i});if(a.kind===`remote`){r.push(a.node);continue}t.push(a.node,...a.descendants.nodes),n.push({childNodeId:a.node.nodeId,parentNodeId:e.parentNodeId},...a.descendants.edges)}return{edges:n,nodes:t,remoteAgents:r}}async function compileSubagentDefinition(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Subagent "${e.source.logicalPath}" is missing an agent config module.`);let n=createSubagentConfigModuleSourceRef(e.source,t),r=await loadModuleBackedDefinition({agentRoot:e.source.manifest.agentRoot,displayPath:n.logicalPath,externalDependencies:e.externalDependencies,kind:`subagent config`,source:t});return readAgentDefinitionKind(r)===`remote`?{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})}:{kind:`local`,...await compileLocalSubagent(e)}}async function compileSubagent(e){let t=createCompiledSubagentNodeId(e.parentNodeId,e.source.sourceId),n=e.source.subagentId,r=await e.compileAgentNodeManifest({...e.source.manifest,appRoot:e.appRoot},e.context,{allowWorkflowConfig:!1,externalDependencies:e.externalDependencies}),i=r.config.description;if(!i)throw Error(`Local subagent "${e.source.logicalPath}" is missing a "description" field on its agent config. Add \`description\` to \`defineAgent({ ... })\` so the parent agent can decide when to delegate to this subagent.`);let
|
|
1
|
+
import{expectBoolean,expectObjectRecord,expectOnlyKnownKeys,expectString}from"#internal/authored-module.js";import{EVE_CREATE_SESSION_ROUTE_PATH}from"#protocol/routes.js";import{serializeOutputSchema}from"#shared/tool-schema.js";import{createCompiledSubagentNodeId}from"#compiler/manifest.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{createPathDerivedSourceId}from"#discover/manifest.js";async function compileSubagentGraph(e){let t=[],n=[],r=[];for(let i of e.subagents){let a=await compileSubagentDefinition({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:e.externalDependencies,parentNodeId:e.parentNodeId,source:i});if(a.kind===`remote`){r.push(a.node);continue}t.push(a.node,...a.descendants.nodes),n.push({childNodeId:a.node.nodeId,parentNodeId:e.parentNodeId},...a.descendants.edges)}return{edges:n,nodes:t,remoteAgents:r}}async function compileSubagentDefinition(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Subagent "${e.source.logicalPath}" is missing an agent config module.`);let n=createSubagentConfigModuleSourceRef(e.source,t),r=await loadModuleBackedDefinition({agentRoot:e.source.manifest.agentRoot,displayPath:n.logicalPath,externalDependencies:e.externalDependencies,kind:`subagent config`,source:t});return readAgentDefinitionKind(r)===`remote`?{kind:`remote`,node:compileRemoteAgent({source:e.source,value:r})}:{kind:`local`,...await compileLocalSubagent(e)}}async function compileSubagent(e){let t=createCompiledSubagentNodeId(e.parentNodeId,e.source.sourceId),n=e.source.subagentId,r=await e.compileAgentNodeManifest({...e.source.manifest,appRoot:e.appRoot},e.context,{allowWorkflowConfig:!1,externalDependencies:e.externalDependencies}),i=r.config.description;if(!i)throw Error(`Local subagent "${e.source.logicalPath}" is missing a "description" field on its agent config. Add \`description\` to \`defineAgent({ ... })\` so the parent agent can decide when to delegate to this subagent.`);let a=await compileSubagentGraph({appRoot:e.appRoot,compileAgentNodeManifest:e.compileAgentNodeManifest,context:e.context,externalDependencies:r.config.build?.externalDependencies,parentNodeId:t,subagents:e.source.manifest.subagents});return{descendants:a,node:{agent:{...r,remoteAgents:[...a.remoteAgents]},description:i,entryPath:e.source.entryPath,logicalPath:e.source.logicalPath,name:n,nodeId:t,rootPath:e.source.rootPath,sourceId:e.source.sourceId,sourceKind:`module`}}}const compileLocalSubagent=compileSubagent;function compileRemoteAgent(e){let t=e.source.manifest.configModule;if(t===void 0)throw Error(`Remote agent "${e.source.logicalPath}" is missing a config module.`);assertRemoteAgentDefinitionHasNoLocalPackageEntries(e.source);let n=createSubagentConfigModuleSourceRef(e.source,t),r=normalizeRemoteAgentDefinition(e.value,`Expected the remote agent config export "${t.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`),i={...n,description:r.description,entryPath:e.source.entryPath,name:e.source.subagentId,nodeId:e.source.sourceId,outputSchema:r.outputSchema,path:r.path,rootPath:e.source.rootPath};return r.url===void 0?i:{...i,url:r.url}}function createSubagentConfigModuleSourceRef(e,t){let n=e.logicalPath===t.logicalPath?t.logicalPath:`${e.logicalPath}/${t.logicalPath}`,r={logicalPath:n,sourceId:createPathDerivedSourceId(n),sourceKind:`module`};return t.exportName!==void 0&&(r.exportName=t.exportName),r}function readAgentDefinitionKind(e){return typeof e!=`object`||!e?`local`:e.kind===`remote`?`remote`:`local`}function normalizeRemoteAgentDefinition(o,s){let c=expectObjectRecord(o,s);if(expectOnlyKnownKeys(c,[`auth`,`description`,`forwardPrincipal`,`headers`,`kind`,`outputSchema`,`path`,`url`],s),c.kind!==`remote`)throw Error(`${s} Expected "kind" to be "remote".`);return c.forwardPrincipal!==void 0&&expectBoolean(c.forwardPrincipal,`${s} Expected "forwardPrincipal" to be a boolean.`),{description:expectString(c.description,s),outputSchema:serializeOutputSchema(c.outputSchema),path:c.path===void 0?EVE_CREATE_SESSION_ROUTE_PATH:expectString(c.path,s),url:typeof c.url==`function`?void 0:expectString(c.url,s)}}function assertRemoteAgentDefinitionHasNoLocalPackageEntries(e){let t=e.manifest,n=[t.connections.length>0?`connections/`:void 0,t.hooks.length>0?`hooks/`:void 0,t.instructions.length>0?`instructions`:void 0,t.lib.length>0?`lib/`:void 0,t.sandbox===null?void 0:`sandbox/`,t.sandboxWorkspaces.length>0?`sandbox/workspace/`:void 0,t.schedules.length>0?`schedules/`:void 0,t.skills.length>0?`skills/`:void 0,t.subagents.length>0?`subagents/`:void 0,t.tools.length>0?`tools/`:void 0].filter(e=>e!==void 0);if(n.length!==0)throw Error(`Remote subagent definition "${e.logicalPath}" cannot include local package entries. Remove unsupported entries: ${n.join(`, `)}.`)}export{compileSubagentGraph};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1/node_modules/autoevals/jsdist/index.js";import{toInputSchema}from"#shared/tool-schema.js";import{resolveProviderHeaders}from"#internal/gateway.js";import{generateText}from"ai";function createAutoevalsClient(e){return{chat:{completions:{create:t=>createChatCompletion(t,e)}}}}async function createChatCompletion(e,r){let i=convertTools(e.tools),a=await generateText({headers:resolveProviderHeaders(r.languageModel),model:r.languageModel,messages:convertMessages(e.messages??[]),tools:Object.keys(i).length>0?i:void 0,toolChoice:convertToolChoice(e.tool_choice),providerOptions:r.providerOptions}),o=a.toolCalls.map(e=>({id:e.toolCallId,type:`function`,function:{name:e.toolName,arguments:JSON.stringify(e.input??{})}}));return{choices:[{index:0,finish_reason:o.length>0?`tool_calls`:`stop`,message:{role:`assistant`,content:a.text||null,tool_calls:o.length>0?o:void 0}}]}}function convertMessages(e){return e.map(e=>{let t=contentToText(e.content);switch(e.role){case`assistant`:return{role:`assistant`,content:t};case`developer`:case`system`:return{role:`system`,content:t};default:return{role:`user`,content:t}}})}function contentToText(e){return e==null?``:typeof e==`string`?e:e.map(e=>e.text??``).filter(Boolean).join(`
|
|
1
|
+
import"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{toInputSchema}from"#shared/tool-schema.js";import{resolveProviderHeaders}from"#internal/gateway.js";import{generateText}from"ai";function createAutoevalsClient(e){return{chat:{completions:{create:t=>createChatCompletion(t,e)}}}}async function createChatCompletion(e,r){let i=convertTools(e.tools),a=await generateText({headers:resolveProviderHeaders(r.languageModel),model:r.languageModel,messages:convertMessages(e.messages??[]),tools:Object.keys(i).length>0?i:void 0,toolChoice:convertToolChoice(e.tool_choice),providerOptions:r.providerOptions}),o=a.toolCalls.map(e=>({id:e.toolCallId,type:`function`,function:{name:e.toolName,arguments:JSON.stringify(e.input??{})}}));return{choices:[{index:0,finish_reason:o.length>0?`tool_calls`:`stop`,message:{role:`assistant`,content:a.text||null,tool_calls:o.length>0?o:void 0}}]}}function convertMessages(e){return e.map(e=>{let t=contentToText(e.content);switch(e.role){case`assistant`:return{role:`assistant`,content:t};case`developer`:case`system`:return{role:`system`,content:t};default:return{role:`user`,content:t}}})}function contentToText(e){return e==null?``:typeof e==`string`?e:e.map(e=>e.text??``).filter(Boolean).join(`
|
|
2
2
|
`)}function convertTools(t){let n={};for(let r of t??[])r.type!==`function`||r.function?.name===void 0||(n[r.function.name]={description:r.function.description,inputSchema:toInputSchema(r.function.parameters??{})});return n}function convertToolChoice(e){if(e!==void 0)return typeof e==`string`?e:{type:`tool`,toolName:e.function.name}}export{createAutoevalsClient};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{basename,join}from"node:path";import{readFile}from"node:fs/promises";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{shutdownActiveSandboxHandles}from"#execution/sandbox/active-handles.js";import{
|
|
1
|
+
import{basename,join}from"node:path";import{readFile}from"node:fs/promises";import{createDevelopmentServer}from"#internal/nitro/host.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{shutdownActiveSandboxHandles}from"#execution/sandbox/active-handles.js";import{createEvalClient}from"#evals/cli/eval-client.js";import{discoverAndImportEvals,discoverEvalConfig,findMisplacedEvalDirs}from"#evals/runner/discover.js";import{runEvals}from"#evals/runner/run-evals.js";import{Console}from"#evals/runner/reporters/console.js";import{JUnit}from"#evals/runner/reporters/junit.js";import{resolveEvalTargetHandle}from"#evals/target.js";async function runEvalCommand(e,t,n){let s=resolveApplicationRoot();loadDevelopmentEnvironmentFiles(s);let c=e.length>0?e:void 0,l=await discoverAndImportEvals(s,c);if(l.length===0){let e=await findMisplacedEvalDirs(s);e.length>0?n.error(`No evals found under evals/, but eval files are present inside agent/:
|
|
2
2
|
`+e.map(e=>` - ${e}`).join(`
|
|
3
3
|
`)+`
|
|
4
|
-
eve eval only scans the top-level evals/ directory (a sibling of agent/). Move these files there.`):
|
|
4
|
+
eve eval only scans the top-level evals/ directory (a sibling of agent/). Move these files there.`):c?n.error(`No evals found matching: ${c.join(`, `)}`):n.error(`No evals found. Create files under evals/ with the *.eval.ts extension.`),process.exitCode=2;return}let u=filterEvalsByTag(l,t.tag??[]);if(u.length===0){n.error(`No evals matched the provided tags (${(t.tag??[]).join(`, `)}).`),process.exitCode=2;return}let d,f;try{d=parsePositiveInteger(t.maxConcurrency,`--max-concurrency`),f=parseNonNegativeInteger(t.timeout,`--timeout`)}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=2;return}if(t.list===!0){printEvalList(u,t.json===!0,n);return}let p;try{p=await discoverEvalConfig(s)}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=2;return}let m,h,g;try{if(t.url)g=await createEvalClient({kind:`remote`,url:t.url},{workspaceRoot:s}),h=await resolveEvalTargetHandle({client:g,expectedAgentName:await readExpectedAgentName(s),kind:`remote`,url:t.url});else{m=createDevelopmentServer(s,{host:`127.0.0.1`,port:0});let e=await m.start();g=await createEvalClient({kind:`local`,url:e.url}),h=await resolveEvalTargetHandle({client:g,expectedAgentName:await readExpectedAgentName(s),kind:`local`,url:e.url})}let e=t.json===!0?[]:[Console()];t.junit!==void 0&&e.push(JUnit({filePath:t.junit}));let i=await runEvals({evaluations:u,config:p,target:h,client:g,appRoot:s,reporters:e,includeEvalReporters:t.skipReport!==!0,maxConcurrency:d,timeoutMs:f,onEvalLog:t.verbose===!0?(e,t)=>n.log(`[${e}] ${t}`):void 0});t.json&&n.log(JSON.stringify(i,null,2));let a=i.failed>0,o=t.strict===!0&&i.scored>0;(a||o)&&(process.exitCode=1)}finally{m&&(await m.close(),await shutdownActiveSandboxHandles({log:e=>n.error(e)}))}let _=typeof process.exitCode==`number`?process.exitCode:0;process.exit(_)}function parsePositiveInteger(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<1)throw Error(`${t} must be a positive integer; got "${e}".`);return n}function parseNonNegativeInteger(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw Error(`${t} must be a non-negative integer; got "${e}".`);return n}function filterEvalsByTag(e,t){return t.length===0?[...e]:e.filter(e=>e.tags?.some(e=>t.includes(e))??!1)}function printEvalList(e,t,n){if(t){let t=e.map(e=>({id:e.id,description:e.description,tags:e.tags}));n.log(JSON.stringify(t,null,2));return}for(let t of e){let e=t.description===void 0?``:` — ${t.description}`,r=t.tags!==void 0&&t.tags.length>0?` [${t.tags.join(`, `)}]`:``;n.log(`${t.id}${r}${e}`)}}async function readExpectedAgentName(r){try{let i=JSON.parse(await readFile(join(r,`package.json`),`utf8`));return typeof i.name==`string`&&i.name.length>0?i.name:basename(r)}catch{return basename(r)}}export{runEvalCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Levenshtein}from"../../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1/node_modules/autoevals/jsdist/index.js";import{deepEquals,testRegExp}from"#evals/match.js";function makeAssertion(e){return{name:e.name,severity:e.severity,threshold:e.threshold,score:e.score,gate(t){return makeAssertion({...e,severity:`gate`,threshold:t})},soft(t){return makeAssertion({...e,severity:`soft`,threshold:t})},atLeast(t){return makeAssertion({...e,severity:`soft`,threshold:t})}}}function includes(e){return makeAssertion({name:`includes(${e})`,severity:`gate`,score:t=>{let r=String(t??``);return(typeof e==`string`?r.includes(e):testRegExp(e,r))?1:0}})}function satisfies(e,t){if(t.trim().length===0)throw Error(`satisfies() requires a non-empty label.`);return makeAssertion({name:`satisfies(${t})`,severity:`gate`,score:t=>+!!e(t)})}function equals(e){return makeAssertion({name:`equals`,severity:`gate`,score:n=>+!!deepEquals(n,e)})}function matches(e){return makeAssertion({name:`matches`,severity:`gate`,score:async t=>{let n=await e[`~standard`].validate(t);return+(!(`issues`in n)||n.issues===void 0)}})}function similarity(t){return makeAssertion({name:`similarity`,severity:`soft`,score:async n=>(await Levenshtein({output:String(n??``),expected:t})).score??0})}export{equals,includes,matches,satisfies,similarity};
|
|
1
|
+
import{Levenshtein}from"../../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{deepEquals,testRegExp}from"#evals/match.js";function makeAssertion(e){return{name:e.name,severity:e.severity,threshold:e.threshold,score:e.score,gate(t){return makeAssertion({...e,severity:`gate`,threshold:t})},soft(t){return makeAssertion({...e,severity:`soft`,threshold:t})},atLeast(t){return makeAssertion({...e,severity:`soft`,threshold:t})}}}function includes(e){return makeAssertion({name:`includes(${e})`,severity:`gate`,score:t=>{let r=String(t??``);return(typeof e==`string`?r.includes(e):testRegExp(e,r))?1:0}})}function satisfies(e,t){if(t.trim().length===0)throw Error(`satisfies() requires a non-empty label.`);return makeAssertion({name:`satisfies(${t})`,severity:`gate`,score:t=>+!!e(t)})}function equals(e){return makeAssertion({name:`equals`,severity:`gate`,score:n=>+!!deepEquals(n,e)})}function matches(e){return makeAssertion({name:`matches`,severity:`gate`,score:async t=>{let n=await e[`~standard`].validate(t);return+(!(`issues`in n)||n.issues===void 0)}})}function similarity(t){return makeAssertion({name:`similarity`,severity:`soft`,score:async n=>(await Levenshtein({output:String(n??``),expected:t})).score??0})}export{equals,includes,matches,satisfies,similarity};
|
package/dist/src/evals/judge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ClosedQA,Factuality,Sql,Summary}from"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1/node_modules/autoevals/jsdist/index.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{createAutoevalsClient}from"#evals/autoevals-client.js";function buildJudgeContext(a){function grade(e,t,n){let r=t?.on??a.getReply(),o=String(r??``),s=a.getInput(),c=t?.model??a.judge?.model,l=t?.modelOptions??a.judge?.modelOptions;return a.collector.recordValue({name:e,severity:`soft`,score:async()=>{if(c===void 0)throw Error(`${e} needs a judge model. Set \`judge\` on the eval or in evals.config.ts, or pass { model } to the call.`);return{score:(await n({input:s,output:o,model:c,modelOptions:l})).score??0,metadata:{judge:formatLanguageModelGatewayId(c)}}}})}return{autoevals:{factuality:(e,n)=>grade(`judge.autoevals.factuality`,n,({input:n,output:r,model:i,modelOptions:a})=>Factuality({input:n,output:r,expected:e,...client(i,a)})),summarizes:(e,t)=>grade(`judge.autoevals.summarizes`,t,({input:t,output:n,model:i,modelOptions:a})=>Summary({input:t,output:n,expected:e,...client(i,a)})),closedQA:(t,n)=>grade(`judge.autoevals.closedQA`,n,({input:n,output:r,model:i,modelOptions:a})=>ClosedQA({input:n,output:r,criteria:t,...client(i,a)})),sql:(e,t)=>grade(`judge.autoevals.sql`,t,({input:t,output:r,model:i,modelOptions:a})=>Sql({input:t,output:r,expected:e,...client(i,a)}))}}}function client(e,t){return{model:formatLanguageModelGatewayId(e),client:createAutoevalsClient({languageModel:e,providerOptions:t?.providerOptions})}}export{buildJudgeContext};
|
|
1
|
+
import{ClosedQA,Factuality,Sql,Summary}from"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1_bufferutil@4.1.0_/node_modules/autoevals/jsdist/index.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{createAutoevalsClient}from"#evals/autoevals-client.js";function buildJudgeContext(a){function grade(e,t,n){let r=t?.on??a.getReply(),o=String(r??``),s=a.getInput(),c=t?.model??a.judge?.model,l=t?.modelOptions??a.judge?.modelOptions;return a.collector.recordValue({name:e,severity:`soft`,score:async()=>{if(c===void 0)throw Error(`${e} needs a judge model. Set \`judge\` on the eval or in evals.config.ts, or pass { model } to the call.`);return{score:(await n({input:s,output:o,model:c,modelOptions:l})).score??0,metadata:{judge:formatLanguageModelGatewayId(c)}}}})}return{autoevals:{factuality:(e,n)=>grade(`judge.autoevals.factuality`,n,({input:n,output:r,model:i,modelOptions:a})=>Factuality({input:n,output:r,expected:e,...client(i,a)})),summarizes:(e,t)=>grade(`judge.autoevals.summarizes`,t,({input:t,output:n,model:i,modelOptions:a})=>Summary({input:t,output:n,expected:e,...client(i,a)})),closedQA:(t,n)=>grade(`judge.autoevals.closedQA`,n,({input:n,output:r,model:i,modelOptions:a})=>ClosedQA({input:n,output:r,criteria:t,...client(i,a)})),sql:(e,t)=>grade(`judge.autoevals.sql`,t,({input:t,output:r,model:i,modelOptions:a})=>Sql({input:t,output:r,expected:e,...client(i,a)}))}}}function client(e,t){return{model:formatLanguageModelGatewayId(e),client:createAutoevalsClient({languageModel:e,providerOptions:t?.providerOptions})}}export{buildJudgeContext};
|