eve 0.25.2 → 0.25.3
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 +6 -0
- package/dist/src/compiled/@chat-adapter/slack/index.js +26 -26
- package/dist/src/compiled/@vercel/sandbox/index.js +5 -5
- 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/node/{auth-BuQkq4Gr.js → auth-Cuszvn7l.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbmITuI.js → attribute-changes-CXiYB8h9.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{functions-BCMO8vbf.js → functions-PT9ri9Hu.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-DvvgYsRt.js → resume-hook-CHXbXuRZ.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-BdvQmV5a.js → run-BjtAGa3_.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{sleep-DzxrwWTs.js → sleep-BJAv0MFP.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-ulTvoTdW.js +6 -0
- package/dist/src/compiler/extension-compatibility.d.ts +61 -17
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/evals/autoevals-client.js +1 -1
- package/dist/src/evals/expect/index.js +1 -1
- package/dist/src/evals/judge.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.d.ts +5 -5
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
- package/dist/src/node_modules/.pnpm/{autoevals@0.0.132_ws@8.21.0 → autoevals@0.0.132_ws@8.21.1}/node_modules/autoevals/jsdist/index.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +2 -2
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/docs/extensions.md +14 -1
- package/package.json +1 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-CQmdlFyy.js +0 -6
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/azure.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/client.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/error.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/index.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_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.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/streaming.js +0 -0
- /package/dist/src/node_modules/.pnpm/{openai@6.39.1_ws@8.21.0_zod@3.25.76 → openai@6.39.1_ws@8.21.1_zod@3.25.76}/node_modules/openai/version.js +0 -0
|
@@ -17,4 +17,4 @@ import{a as e,t}from"./chunk-BHKSVoKr.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 br=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 xr(){throw new d(`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 Sr=q(`workflow.name`),Cr=q(`workflow.operation`),wr=q(`workflow.run.id`),Tr=q(`workflow.run.status`),Er=q(`workflow.started_at`),Dr=q(`workflow.events.count`),Or=q(`workflow.arguments.count`),kr=q(`workflow.result.type`),Ar=q(`workflow.trace.propagated`),jr=q(`workflow.trace.mode`),Mr=q(`workflow.turbo`),Nr=q(`workflow.error.name`),Pr=q(`workflow.error.message`),Fr=q(`workflow.error.code`),Ir=q(`workflow.steps.created`),Lr=q(`workflow.hooks.created`),Rr=q(`workflow.waits.created`),zr=q(`workflow.inline_ownership.owned_recovery_steps`),Br=q(`workflow.inline_ownership.backstop_wakes_armed`),Vr=q(`workflow.route.type`),Hr=q(`workflow.route.handler_cached`),Ur=q(`workflow.route.invocation_count`),Wr=q(`workflow.route.entrypoint_age_ms`),Gr=q(`workflow.route.module_body_init_ms`),Kr=q(`step.name`),qr=q(`step.id`),Jr=q(`step.attempt`),Yr=q(`step.status`),Xr=q(`step.max_retries`),Zr=q(`step.ttfs_ms`),Qr=q(`step.stso_ms`),$r=q(`step.rsfs_ms`),ei=q(`step.final_scheduling_replay_ms`),ti=q(`step.latency_optimizations`),ni=q(`step.skipped`),ri=q(`step.skip_reason`),ii=q(`step.arguments.count`),ai=q(`step.result.type`),oi=q(`step.error.name`),si=q(`step.error.message`),ci=q(`step.fatal_error`),li=q(`step.retry.exhausted`),ui=q(`step.retry.timeout_seconds`),di=q(`step.retry.will_retry`),fi=q(`messaging.system`),pi=q(`messaging.destination.name`),mi=q(`messaging.message.id`),hi=q(`messaging.operation.type`),gi=q(`workflow.queue.overhead_ms`),_i=q(`deployment.id`),vi=q(`workflow.hook.token`),yi=q(`workflow.hook.id`),bi=q(`workflow.hook.found`),xi=q(`workflow.suspension.state`),Si=q(`workflow.suspension.hook_count`),Ci=q(`workflow.suspension.step_count`),wi=q(`workflow.suspension.wait_count`),Ti=q(`http.request.method`),Ei=q(`http.route`),Di=q(`http.response.status_code`),Oi=q(`error.type`),ki=q(`workflow.events.pages_loaded`),Ai=q(`workflow.queue.deserialize_time_ms`),ji=q(`workflow.queue.execution_time_ms`),Mi=q(`workflow.queue.serialize_time_ms`),Ni=q(`workflow.serialization.operation`),Pi=q(`workflow.serialization.compressed`),Fi=q(`workflow.serialization.codec`),Ii=q(`workflow.serialization.uncompressed_bytes`),Li=q(`workflow.serialization.stored_bytes`),Ri=q(`workflow.serialization.compression_ratio`),zi=q(`peer.service`),Bi=q(`rpc.system`),Vi=q(`rpc.service`),Hi=q(`rpc.method`),Ui=q(`error.retryable`),Wi=q(`error.category`),Gi=new Set;function Ki(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!Gi.has(e)&&(Gi.add(e),Y.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function qi(e){return e!==void 0&&Object.keys(e).length>0}function Ji(e,t){return e===`linked`&&qi(t)?Promise.resolve(t):Xi()}async function Yi(e,t){if(e!==`linked`)return la();let n=await ua(qi(t)?t:void 0);return n?[n]:void 0}async function Xi(){let e=await J.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function Zi(e){let t=await J.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Qi(e,t){if(!e)return t();let n=await J.value;if(!n)return t();let r=await Zi(e);return r?n.context.with(r,async()=>await t()):t()}const J=s(async()=>{try{return await import(`./src-CQuMexnO.js`).then(t=>e(t.t(),1))}catch{return Y.info(`OpenTelemetry not available, tracing will be disabled`),null}}),$i=s(async()=>{let e=await J.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return ta(e,t),t});let ea=!1;function ta(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(ea||!n)){ea=!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 na(e,...t){let[n,r]=await Promise.all([$i.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}),ia(t,r,e),t}finally{e.end()}})}async function ra(e,t,n){let r=await $i.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function ia(e,t,n){!e||!br.is(e)||(n.setStatus({code:t.SpanStatusCode.OK}),n.setAttributes({...xi(`suspended`),...Ci(e.stepCount),...Si(e.hookCount),...wi(e.waitCount)}))}async function aa(e){let[t,n]=await Promise.all([Zi(e),J.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function oa(){return await ca(e=>e.trace.getActiveSpan())}async function sa(e){return ca(t=>t.SpanKind[e])}async function ca(e){let t=await J.value;if(t)return await e(t)}function la(){return ca(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function ua(e){if(!e)return;let[t,n]=await Promise.all([aa(e),J.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function da(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 fa(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 pa(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)(pr(`[workflow-sdk]`,i,c)),fa(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),oa().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 ma=pa(`step`),Y=pa(`runtime`),ha=pa(`webhook`),ga=pa(`events`);pa(`adapter`),pa(`build`,{debugNamespace:`workflow:build`});function _a(e){if(m.is(e))throw e}function X(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof E&&t.path&&(r+=` at path "${t.path}"`);let i=`Ensure you're ${n} workflow serializable types. Check the serialization docs to see what's serializable: https://workflow-sdk.dev/docs/foundations/serialization`;return t instanceof E&&t.value!==void 0&&Y.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function va(e,t,n){try{let r=H.serialize(e,`client`,n);return dr(await cr(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){_a(e);let{message:t,hint:n}=X(`client value`,e);throw new _(t,{hint:n,cause:e})}}async function ya(e,t,n){let r=await lr(await fr(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 ba(e,t,n){try{let r=H.serialize(e,`step`,n);return dr(await cr(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){_a(e);let{message:t,hint:n}=X(`step value`,e);throw new _(t,{hint:n,cause:e})}}async function xa(e,t,n){let r=await lr(await fr(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 Sa(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 Ca=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),wa=globalThis[Ca]??(globalThis[Ca]=new le);function Ta(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 Ea(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function Da(e){return`strm_${e}_system_abort`}function Oa(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return Da(e.slice(5))}const ka=()=>te(`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 Aa=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){ga.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){ga.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))},ka())})}}},ja=class{aborted=!1;reason=void 0;[F];[I];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[F]=e,this[I]=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 Ma(e){return class{signal;[F];[I];constructor(){let t=e.generateUlid(),n=Da(t),r=`abrt_${t}`;this[F]=n,this[I]=r,this.signal=new ja(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[I])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new p(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[I]}"`,{eventId:t.eventId}))}),Z.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Z.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload;return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let t;try{if(n!==void 0)try{let r=await ko(n,e.runId,e.encryptionKey,e.globalThis);r&&typeof r==`object`&&`reason`in r&&(t=r.reason)}catch{}this.signal._setAborted(t)}finally{e.pendingDeliveries--}}),e.invocationsQueue.delete(i),Z.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Z.Finished):Z.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[I]){n.abortRequested=!0,n.abortReason=t;break}}}}}function Na(){return{abort(e){let t=new ja(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new ja(``,``),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 Pa=ae();function Fa(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Ia(e){return _a(e),e instanceof _&&e.cause!==void 0||e instanceof d&&e.cause!==void 0?e.cause:e}async function Q(e,t){if(e.recorded)try{let n=await oa();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...Ni(t),...Pi(e.compressed??!1),...Fi(e.codec??`none`),...Ii(r),...Li(i),...e.compressed&&r>0?Ri(1-i/r):{}})}catch{}}function La(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 ur(t),!0);let o=O(i,e),s=n.encode(o),c=U(V.DEVALUE_V1,s);if(r.key){let e=await nn(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(m.is(e)){a.error(e);return}let{message:t,hint:n}=X(`stream chunk`,e);a.error(new _(t,{hint:n,cause:e}))}}})}function Ra(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 ur(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 m(`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 rn(i.key,c)}catch(e){throw m.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(Xt(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(Xt(t,e))},async flush(e){r.length>0&&await o(e)}})}const za=1e8;function Ba(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>za){t.error(new d(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${za}). 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 Va(){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>za){r.error(new d(`Byte-stream frame length ${t} exceeds maximum (${za}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;r.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new d(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Ha(e,t,n,r,i){(async()=>{await ra(`workflow.stream.read`,e,{kind:await sa(`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 Ua(e,t,n,r,i,a){(async()=>{await ra(`workflow.stream.read.complete`,e,{kind:await sa(`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 Wa=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new d(`"name" is required, got "${t}"`);let r,i=!1,a,o=0,s=0;super({type:`bytes`,pull:async c=>{let l=this.#e;if(!l){r===void 0&&(r=Date.now());let i=await j(),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&&Ua(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,Ha(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 Ga=()=>te(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Ka=()=>te(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function qa(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 j(),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=Ga(),n=Ka();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&&Ua(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,Ha(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 Ja=()=>te(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function Ya(e,t,n,r,i,a,o){(async()=>{await ra(`workflow.stream.flush`,e,{kind:await sa(`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 Xa(e,t,n){(async()=>{await ra(`workflow.stream.close`,e,{kind:await sa(`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 d(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new d(`"name" is required, got "${t}"`);let r=j(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,u,f=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=u;u=void 0;let c=Date.now(),d=await r;l===void 0&&(l=d.streamFlushIntervalMs??Ja());let f=Date.now();try{if(typeof d.streams.writeMulti==`function`&&n.length>1)await d.streams.writeMulti(e,t,n);else for(let r of n)await d.streams.write(e,t,r)}catch(e){throw i!==void 0&&(u=u===void 0?i:Math.min(u,i)),e}i!==void 0&&Ya(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??Ja())};super({async write(e){u===void 0&&(u=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),Xa(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)}})}};function Za(e=globalThis){return{...Nn(),...Vn(),...zn(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[Tn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[F])&&(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 Qa(e,t,n,r,i,a){let o=t[F],s=t[I];if(!o){let e=(n[xn]||Pa)();o=Da(e),s=`abrt_${e}`,t[F]=o,t[I]=s,t.signal&&(t.signal[F]=o,t.signal[I]=s)}return eo(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function $a(e,t){let n=t[F]??t.signal?.[F],r=t[I]??t.signal?.[I];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 eo(e,t,n,r,i){e.aborted||e[Dn]||(e[Dn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await ur(r),a=await So({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function to(e=globalThis,t,n,r,i=!1,a){return{...Za(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new _(`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[xn]||Pa)()}`,c=Fa(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Ba()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(La(to(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[M],a=r[N];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[P];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[xn]||Pa)()}`,s=new Wa(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qa(i,i,e,t,n,r)}}function no(e=globalThis){return{...Za(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[wn];if(n!==void 0)return{bodyInit:n};let r=t[M];if(!r)throw new d("ReadableStream `name` is not set");let i={name:r},a=t[Sn];a&&(i.type=a);let o=t[Cn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[M];if(!n)throw new d("WritableStream `name` is not set");let r={name:n},i=t[N];typeof i==`string`&&(r.runId=i);let a=t[P];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[F]??n.signal?.[F],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:$a(t.signal,n)},AbortSignal:t=>{let n=t?.[F],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:$a(t,t)}}}function ro(e=globalThis,t,n,r,i=!1,a){return{...Za(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new _(`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[M],c=o[Sn],l=o[Cn];if(!s){s=`strm_${(e[xn]||Pa)()}`,c=Fa(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Ba()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(La(ro(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[M],o=i[N];a||(a=`strm_${(e[xn]||Pa)()}`,t.push(new Wa(n,a).pipeThrough(Ra(ho(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[P];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qa(i,i,e,t,n,r)}}function io(...e){let t=new WeakSet;function n(e){let t=e[On];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 ao(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Wa(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=wa.getStore(),r=await Co(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function oo(e,t,n){let r=e,i=e.signal;r[F]=t.streamName,r[I]=t.hookToken,i[F]=t.streamName,i[I]=t.hookToken,n&&(r[On]=n,i[On]=n)}function so(e,t){let n=e,r=t;n[F]!==void 0&&(r[F]=n[F]),n[I]!==void 0&&(r[I]=n[I]),n[On]!==void 0&&(r[On]=n[On])}function co(e,t,n){let r=new AbortController;e.aborted?(oo(r,e),r.abort(e.reason)):e.streamName?oo(r,e,ao(r,n,e.streamName,t)):oo(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=wa.getStore();if(n&&(n.ops.push((async()=>{try{let r=await So({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-DvvgYsRt.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function lo(e,t,n){let r=new AbortController;return e.aborted?(oo(r,e),r.abort(e.reason)):e.streamName?oo(r,e,ao(r,n,e.streamName,t)):oo(r,e),r.signal}function uo(e=globalThis){return{...Pn(e),...Bn(e)}}async function fo(e,t){let n=await j();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await tn(r,[`encrypt`]):void 0}function po(e=globalThis,t,n,r){return{...uo(e),StepFunction:()=>{throw new _(`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 _(`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&&so(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 Wa(n,i.name,i.startIndex),a=k();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Va():new e.TransformStream;return A(r,s,a).catch(()=>{}),ln(o,a),o}else{let a=qa(n,i.name,i.startIndex),o=Ra(po(e,t,n,r),r),s=k();return t.push(s.promise),A(a,o.writable,s).catch(()=>{}),ln(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:fo(a,i.deploymentId),s=La(to(e,t,a,o),o),c=new $(a,i.name),l=k();return t.push(l.promise),A(s.readable,c,l).catch(()=>{}),cn(s.writable,l),Object.defineProperty(s.writable,M,{value:i.name,writable:!1}),Object.defineProperty(s.writable,N,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,P,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>co(e,t,n),AbortSignal:e=>lo(e,t,n)}}function mo(e=globalThis){return{...uo(e),...Hn(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[Tn]=n,delete t.responseWritable,t.respondWith=()=>{throw new _("`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 _(`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,{[wn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[M]:{value:t.name,writable:!1},[Sn]:{value:t.type,writable:!1},[Cn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[M]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[N]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[P]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new ja(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[F]:e.streamName,[I]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new ja(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function ho(e=globalThis,t,n,r,i){return{...uo(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=se(t);if(!o)throw new _(`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=wa.getStore();if(!e)throw new d(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return wa.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 _(`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&&so(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 Wa(n,a.name);if(a.type===`bytes`){let n=k();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?Va():new e.TransformStream;return A(o,i,n).catch(()=>{}),ln(r,n),r}else{let a=Ra(ho(e,t,n,r,i),r),s=k();return t.push(s.promise),A(o,a.writable,s).catch(()=>{}),ln(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:fo(o,s),l=La(ro(e,t,o,c),c),u=new $(o,a.name),d=k();return t.push(d.promise),A(l.readable,u,d).catch(()=>{}),cn(l.writable,d),Object.defineProperty(l.writable,M,{value:a.name,writable:!1}),Object.defineProperty(l.writable,N,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,P,{value:s,writable:!1}),l.writable},AbortController:e=>co(e,t,n),AbortSignal:e=>lo(e,t,n)}}async function go(e,t){return await dr(e,t)}async function _o(e,t){return fr(e,t)}async function vo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return In(O(e,to(i,r,t,n,o)));try{let a={},c=await va(e,n,{global:i,extraReducers:jo(to(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=Ia(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new _(n,{hint:r,cause:t})}}async function yo(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);return await Q(a,`deserialize`),Sa(o,{global:r,extraRevivers:{...Mo(mo(r)),...i}})}async function bo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return In(O(e,no(r)));try{let t={},i=await ba(e,n,{global:r,extraReducers:jo(no(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ia(e),{message:n,hint:r}=X(`workflow return value`,t);throw new _(n,{hint:r,cause:t})}}async function xo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await ya(e,n,{global:i,extraRevivers:{...Mo(po(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function So(e,t,n,r=globalThis,i=!1,a=!1){if(i)return In(O(e,no(r)));try{let t={},i=await ba(e,n,{global:r,extraReducers:jo(no(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step arguments`,t);throw new _(n,{hint:r,cause:t})}}async function Co(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await xa(e,n,{global:i,extraRevivers:{...Mo(ho(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function wo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return In(O(e,ro(i,r,t,n,o,c)));try{let a={},l=await ba(e,n,{global:i,extraReducers:jo(ro(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step return value`,t);throw new _(n,{hint:r,cause:t})}}async function To(e,t,n,r=[],i=globalThis,a=!1){try{let o=O(e,ro(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await go(await cr(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step error`,t);throw new _(n,{hint:r,cause:t})}}async function Eo(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);if(await Q(a,`deserialize`),!(o instanceof Uint8Array))return Zt(o,{...mo(r),...i});let{format:s,payload:c}=W(o);if(s===V.DEVALUE_V1)return Xt(new TextDecoder().decode(c),{...mo(r),...i});throw Error(`Unsupported serialization format: ${s}`)}async function Do(e,t,n,r=globalThis,i=!1){try{let t=O(e,no(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await go(await cr(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=Ia(e),{message:n,hint:r}=X(`run error`,t);throw new _(n,{hint:r,cause:t})}}async function Oo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await lr(await _o(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Zt(s,{...po(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return Xt(new TextDecoder().decode(l),{...po(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function ko(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);return await Q(a,`deserialize`),Sa(o,{global:r,extraRevivers:{...Mo(mo(r)),...i}})}const Ao=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function jo(e){let t={};for(let n of Ao)n in e&&(t[n]=e[n]);return t}function Mo(e){let t={};for(let n of Ao)n in e&&(t[n]=e[n]);return t}const No=[{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`}],Po=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Fo=new Set([V.DEVALUE_V1]);function Io(e){if(!e||!en.default.valid(e))return{supportedFormats:Fo,framedByteStreams:!1};let t=new Set(Fo);for(let{format:n,minVersion:r}of No)en.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of Po)en.default.gte(e,r)&&(n[t]=!0);return n}const Lo=`5.0.0-beta.35`,Ro=/^[a-zA-Z0-9_\-./@]+$/;function zo(e,t){if(!Ro.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${re(`workflow`,oe(t))}${e}`}const Bo=ae();function Vo(e){return`__health_check__${e}`}function Ho(e){let t=ne.safeParse(e);if(t.success)return t.data}function Uo(e){return`wrun_hc_${e}`}async function Wo(e,t,n){let r=await j(),i=Vo(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:Lo,timestamp:Date.now()}),o=Uo(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function Go(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 Ko(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 qo(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 Jo(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??Bo(),a=Vo(i),o=`${re(t,oe(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 Go(e.streams.get(Uo(i),a),t)).getReader(),{chunks:o,timedOut:c}=await Ko(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=qo(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 Yo(e,t){return new u(`Event pagination ${t} for workflow run "${e}".`,{code:l.WORLD_CONTRACT_ERROR})}function Xo(e,t,n){if(t){if(n.has(t))throw Yo(e,`did not advance`);n.add(t)}}function Zo(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function Qo(e,t,n,r){if(t){if(n===null)throw Yo(e,`returned more pages without a cursor`);if(r.has(n))throw Yo(e,`repeated a cursor`)}}function $o(e,t,n){return t!==null&&!n&&u.is(e)&&e.status===400}async function es(e,t){let n=t!==void 0;return na(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...wr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await j(),f=Date.now();for(;c;){let t=Date.now(),r=s;Xo(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if($o(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}Zo(i,a,f.data),c=f.hasMore,Qo(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({...Dr(i.length),...ki(l)}),{events:i,cursor:s}})}function ts(){return process.env.WORKFLOW_PRECONDITION_GUARD===`1`}function ns(e){let t=e[e.length-1];if(!t)return;let n=t.eventId,r=n.lastIndexOf(`_`);return ie(r===-1?n:n.slice(r+1))?.getTime()??void 0}function rs(e){return ts()?ns(e):void 0}async function is(e,t,n){for(let r=0;;r++)try{return await n(rs(t.events))}catch(n){if(!v.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 es(e,t.cursor??void 0);Zo(t.events,new Set(t.events.map(e=>e.eventId)),i.events),t.cursor=i.cursor??t.cursor}}const as={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function os(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:as}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Lo}),{status:200,headers:{"Content-Type":`application/json`,...as}}):await e(n)}}async function ss(e,...t){let n=t[0];await na(`queue.publish`,{attributes:{...fi(`vercel-queue`),...pi(n),...hi(`publish`),...zi(`vercel-queue`),...Bi(`vercel-queue`),...Vi(`vqs`),...Hi(`publish`)},kind:await sa(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(mi(r))})}function cs(e){if(e.requestedAt)try{return gi(Date.now()-e.requestedAt.getTime())}catch{return}}function ls(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await tn(n):void 0})(),n)}function us(t){import(`./functions-BCMO8vbf.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function ds(e,t){us(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function fs(e){let t=e();return us(t.catch(()=>{})),t}function ps(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new h(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{ee(n,{allowReservedAttributes:r})}catch(e){throw e instanceof y?new h(e.message):e}return n}export{Qi as $,Vr as $t,Eo as A,A as An,ui as At,Ea as B,ke as Bn,Fr as Bt,vo as C,yn as Cn,ei as Ct,La as D,j as Dn,Kr as Dt,po as E,mn as En,Xr as Et,Ma as F,Pe as Fn,Yr as Ft,Yi as G,Sr as Gt,Y as H,Ae as Hn,Nr as Ht,Z as I,Ie as In,Qr as It,Ki as J,kr as Jt,Ji as K,Cr as Kt,Aa as L,Le as Ln,Zr as Lt,yo as M,tn as Mn,$r as Mt,xo as N,Ne as Nn,ri as Nt,Oo as O,un as On,ai as Ot,Na as P,Fe as Pn,ni as Pt,na as Q,Gr as Qt,Ta as R,je as Rn,Or as Rt,wo as S,_n as Sn,ci as St,to as T,hn as Tn,ti as Tt,ma as U,Dr as Ut,wa as V,Oe as Vn,Pr as Vt,ha as W,Lr as Wt,ua as X,Hr as Xt,qi as Y,Wr as Yt,Xi as Z,Ur as Zt,$ as _,P as _n,Mi as _t,zo as a,Ar as an,bi as at,So as b,vn as bn,si as bt,es as c,xr as cn,Ti as ct,ss as d,An as dn,pi as dt,wr as en,da as et,rs as f,jn as fn,mi as ft,Io as g,M as gn,ji as gt,Lo as h,xn as hn,Ai as ht,cs as i,jr as in,Oi as it,ko as j,cn as jn,di as jt,Co as k,k as kn,li as kt,ls as l,br as ln,Di as lt,is as m,wn as mn,fi as mt,ds as n,Er as nn,Wi as nt,Wo as o,Mr as on,yi as ot,os as p,Mn as pn,hi as pt,sa as q,zr as qt,fs as r,Ir as rn,Ui as rt,Jo as s,Rr as sn,vi as st,ps as t,Tr as tn,_i as tt,Ho as u,V as un,Ei as ut,io as v,N as vn,ii as vt,bo as w,gn as wn,qr as wt,To as x,bn as xn,oi as xt,Do as y,Tn as yn,Jr as yt,Oa as z,Me as zn,Br as zt};
|
|
20
|
+
`);for(let t of s)t.length>0&&i.enqueue(Xt(t,e))},async flush(e){r.length>0&&await o(e)}})}const za=1e8;function Ba(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>za){t.error(new d(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${za}). 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 Va(){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>za){r.error(new d(`Byte-stream frame length ${t} exceeds maximum (${za}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;r.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new d(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Ha(e,t,n,r,i){(async()=>{await ra(`workflow.stream.read`,e,{kind:await sa(`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 Ua(e,t,n,r,i,a){(async()=>{await ra(`workflow.stream.read.complete`,e,{kind:await sa(`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 Wa=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new d(`"name" is required, got "${t}"`);let r,i=!1,a,o=0,s=0;super({type:`bytes`,pull:async c=>{let l=this.#e;if(!l){r===void 0&&(r=Date.now());let i=await j(),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&&Ua(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,Ha(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 Ga=()=>te(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Ka=()=>te(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function qa(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 j(),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=Ga(),n=Ka();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&&Ua(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,Ha(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 Ja=()=>te(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function Ya(e,t,n,r,i,a,o){(async()=>{await ra(`workflow.stream.flush`,e,{kind:await sa(`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 Xa(e,t,n){(async()=>{await ra(`workflow.stream.close`,e,{kind:await sa(`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 d(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new d(`"name" is required, got "${t}"`);let r=j(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,u,f=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=u;u=void 0;let c=Date.now(),d=await r;l===void 0&&(l=d.streamFlushIntervalMs??Ja());let f=Date.now();try{if(typeof d.streams.writeMulti==`function`&&n.length>1)await d.streams.writeMulti(e,t,n);else for(let r of n)await d.streams.write(e,t,r)}catch(e){throw i!==void 0&&(u=u===void 0?i:Math.min(u,i)),e}i!==void 0&&Ya(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??Ja())};super({async write(e){u===void 0&&(u=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),Xa(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)}})}};function Za(e=globalThis){return{...Nn(),...Vn(),...zn(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[Tn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[F])&&(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 Qa(e,t,n,r,i,a){let o=t[F],s=t[I];if(!o){let e=(n[xn]||Pa)();o=Da(e),s=`abrt_${e}`,t[F]=o,t[I]=s,t.signal&&(t.signal[F]=o,t.signal[I]=s)}return eo(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function $a(e,t){let n=t[F]??t.signal?.[F],r=t[I]??t.signal?.[I];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 eo(e,t,n,r,i){e.aborted||e[Dn]||(e[Dn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await ur(r),a=await So({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function to(e=globalThis,t,n,r,i=!1,a){return{...Za(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new _(`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[xn]||Pa)()}`,c=Fa(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Ba()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(La(to(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[M],a=r[N];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[P];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[xn]||Pa)()}`,s=new Wa(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qa(i,i,e,t,n,r)}}function no(e=globalThis){return{...Za(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[wn];if(n!==void 0)return{bodyInit:n};let r=t[M];if(!r)throw new d("ReadableStream `name` is not set");let i={name:r},a=t[Sn];a&&(i.type=a);let o=t[Cn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[M];if(!n)throw new d("WritableStream `name` is not set");let r={name:n},i=t[N];typeof i==`string`&&(r.runId=i);let a=t[P];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[F]??n.signal?.[F],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:$a(t.signal,n)},AbortSignal:t=>{let n=t?.[F],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:$a(t,t)}}}function ro(e=globalThis,t,n,r,i=!1,a){return{...Za(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new _(`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[M],c=o[Sn],l=o[Cn];if(!s){s=`strm_${(e[xn]||Pa)()}`,c=Fa(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Ba()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(La(ro(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[M],o=i[N];a||(a=`strm_${(e[xn]||Pa)()}`,t.push(new Wa(n,a).pipeThrough(Ra(ho(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[P];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qa(i,i,e,t,n,r)}}function io(...e){let t=new WeakSet;function n(e){let t=e[On];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 ao(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Wa(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=wa.getStore(),r=await Co(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function oo(e,t,n){let r=e,i=e.signal;r[F]=t.streamName,r[I]=t.hookToken,i[F]=t.streamName,i[I]=t.hookToken,n&&(r[On]=n,i[On]=n)}function so(e,t){let n=e,r=t;n[F]!==void 0&&(r[F]=n[F]),n[I]!==void 0&&(r[I]=n[I]),n[On]!==void 0&&(r[On]=n[On])}function co(e,t,n){let r=new AbortController;e.aborted?(oo(r,e),r.abort(e.reason)):e.streamName?oo(r,e,ao(r,n,e.streamName,t)):oo(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=wa.getStore();if(n&&(n.ops.push((async()=>{try{let r=await So({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-CHXbXuRZ.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function lo(e,t,n){let r=new AbortController;return e.aborted?(oo(r,e),r.abort(e.reason)):e.streamName?oo(r,e,ao(r,n,e.streamName,t)):oo(r,e),r.signal}function uo(e=globalThis){return{...Pn(e),...Bn(e)}}async function fo(e,t){let n=await j();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await tn(r,[`encrypt`]):void 0}function po(e=globalThis,t,n,r){return{...uo(e),StepFunction:()=>{throw new _(`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 _(`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&&so(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 Wa(n,i.name,i.startIndex),a=k();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Va():new e.TransformStream;return A(r,s,a).catch(()=>{}),ln(o,a),o}else{let a=qa(n,i.name,i.startIndex),o=Ra(po(e,t,n,r),r),s=k();return t.push(s.promise),A(a,o.writable,s).catch(()=>{}),ln(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:fo(a,i.deploymentId),s=La(to(e,t,a,o),o),c=new $(a,i.name),l=k();return t.push(l.promise),A(s.readable,c,l).catch(()=>{}),cn(s.writable,l),Object.defineProperty(s.writable,M,{value:i.name,writable:!1}),Object.defineProperty(s.writable,N,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,P,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>co(e,t,n),AbortSignal:e=>lo(e,t,n)}}function mo(e=globalThis){return{...uo(e),...Hn(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[Tn]=n,delete t.responseWritable,t.respondWith=()=>{throw new _("`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 _(`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,{[wn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[M]:{value:t.name,writable:!1},[Sn]:{value:t.type,writable:!1},[Cn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[M]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[N]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[P]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new ja(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[F]:e.streamName,[I]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new ja(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function ho(e=globalThis,t,n,r,i){return{...uo(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=se(t);if(!o)throw new _(`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=wa.getStore();if(!e)throw new d(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return wa.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 _(`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&&so(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 Wa(n,a.name);if(a.type===`bytes`){let n=k();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?Va():new e.TransformStream;return A(o,i,n).catch(()=>{}),ln(r,n),r}else{let a=Ra(ho(e,t,n,r,i),r),s=k();return t.push(s.promise),A(o,a.writable,s).catch(()=>{}),ln(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:fo(o,s),l=La(ro(e,t,o,c),c),u=new $(o,a.name),d=k();return t.push(d.promise),A(l.readable,u,d).catch(()=>{}),cn(l.writable,d),Object.defineProperty(l.writable,M,{value:a.name,writable:!1}),Object.defineProperty(l.writable,N,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,P,{value:s,writable:!1}),l.writable},AbortController:e=>co(e,t,n),AbortSignal:e=>lo(e,t,n)}}async function go(e,t){return await dr(e,t)}async function _o(e,t){return fr(e,t)}async function vo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return In(O(e,to(i,r,t,n,o)));try{let a={},c=await va(e,n,{global:i,extraReducers:jo(to(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=Ia(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new _(n,{hint:r,cause:t})}}async function yo(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);return await Q(a,`deserialize`),Sa(o,{global:r,extraRevivers:{...Mo(mo(r)),...i}})}async function bo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return In(O(e,no(r)));try{let t={},i=await ba(e,n,{global:r,extraReducers:jo(no(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ia(e),{message:n,hint:r}=X(`workflow return value`,t);throw new _(n,{hint:r,cause:t})}}async function xo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await ya(e,n,{global:i,extraRevivers:{...Mo(po(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function So(e,t,n,r=globalThis,i=!1,a=!1){if(i)return In(O(e,no(r)));try{let t={},i=await ba(e,n,{global:r,extraReducers:jo(no(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step arguments`,t);throw new _(n,{hint:r,cause:t})}}async function Co(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await xa(e,n,{global:i,extraRevivers:{...Mo(ho(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function wo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return In(O(e,ro(i,r,t,n,o,c)));try{let a={},l=await ba(e,n,{global:i,extraReducers:jo(ro(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step return value`,t);throw new _(n,{hint:r,cause:t})}}async function To(e,t,n,r=[],i=globalThis,a=!1){try{let o=O(e,ro(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await go(await cr(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=Ia(e),{message:n,hint:r}=X(`step error`,t);throw new _(n,{hint:r,cause:t})}}async function Eo(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);if(await Q(a,`deserialize`),!(o instanceof Uint8Array))return Zt(o,{...mo(r),...i});let{format:s,payload:c}=W(o);if(s===V.DEVALUE_V1)return Xt(new TextDecoder().decode(c),{...mo(r),...i});throw Error(`Unsupported serialization format: ${s}`)}async function Do(e,t,n,r=globalThis,i=!1){try{let t=O(e,no(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await go(await cr(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=Ia(e),{message:n,hint:r}=X(`run error`,t);throw new _(n,{hint:r,cause:t})}}async function Oo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await lr(await _o(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Zt(s,{...po(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return Xt(new TextDecoder().decode(l),{...po(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function ko(e,t,n,r=globalThis,i={}){let a={},o=await lr(await _o(e,n),a);return await Q(a,`deserialize`),Sa(o,{global:r,extraRevivers:{...Mo(mo(r)),...i}})}const Ao=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function jo(e){let t={};for(let n of Ao)n in e&&(t[n]=e[n]);return t}function Mo(e){let t={};for(let n of Ao)n in e&&(t[n]=e[n]);return t}const No=[{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`}],Po=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Fo=new Set([V.DEVALUE_V1]);function Io(e){if(!e||!en.default.valid(e))return{supportedFormats:Fo,framedByteStreams:!1};let t=new Set(Fo);for(let{format:n,minVersion:r}of No)en.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of Po)en.default.gte(e,r)&&(n[t]=!0);return n}const Lo=`5.0.0-beta.35`,Ro=/^[a-zA-Z0-9_\-./@]+$/;function zo(e,t){if(!Ro.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${re(`workflow`,oe(t))}${e}`}const Bo=ae();function Vo(e){return`__health_check__${e}`}function Ho(e){let t=ne.safeParse(e);if(t.success)return t.data}function Uo(e){return`wrun_hc_${e}`}async function Wo(e,t,n){let r=await j(),i=Vo(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:Lo,timestamp:Date.now()}),o=Uo(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function Go(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 Ko(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 qo(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 Jo(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??Bo(),a=Vo(i),o=`${re(t,oe(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 Go(e.streams.get(Uo(i),a),t)).getReader(),{chunks:o,timedOut:c}=await Ko(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=qo(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 Yo(e,t){return new u(`Event pagination ${t} for workflow run "${e}".`,{code:l.WORLD_CONTRACT_ERROR})}function Xo(e,t,n){if(t){if(n.has(t))throw Yo(e,`did not advance`);n.add(t)}}function Zo(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function Qo(e,t,n,r){if(t){if(n===null)throw Yo(e,`returned more pages without a cursor`);if(r.has(n))throw Yo(e,`repeated a cursor`)}}function $o(e,t,n){return t!==null&&!n&&u.is(e)&&e.status===400}async function es(e,t){let n=t!==void 0;return na(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...wr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await j(),f=Date.now();for(;c;){let t=Date.now(),r=s;Xo(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if($o(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}Zo(i,a,f.data),c=f.hasMore,Qo(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({...Dr(i.length),...ki(l)}),{events:i,cursor:s}})}function ts(){return process.env.WORKFLOW_PRECONDITION_GUARD===`1`}function ns(e){let t=e[e.length-1];if(!t)return;let n=t.eventId,r=n.lastIndexOf(`_`);return ie(r===-1?n:n.slice(r+1))?.getTime()??void 0}function rs(e){return ts()?ns(e):void 0}async function is(e,t,n){for(let r=0;;r++)try{return await n(rs(t.events))}catch(n){if(!v.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 es(e,t.cursor??void 0);Zo(t.events,new Set(t.events.map(e=>e.eventId)),i.events),t.cursor=i.cursor??t.cursor}}const as={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function os(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:as}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Lo}),{status:200,headers:{"Content-Type":`application/json`,...as}}):await e(n)}}async function ss(e,...t){let n=t[0];await na(`queue.publish`,{attributes:{...fi(`vercel-queue`),...pi(n),...hi(`publish`),...zi(`vercel-queue`),...Bi(`vercel-queue`),...Vi(`vqs`),...Hi(`publish`)},kind:await sa(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(mi(r))})}function cs(e){if(e.requestedAt)try{return gi(Date.now()-e.requestedAt.getTime())}catch{return}}function ls(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await tn(n):void 0})(),n)}function us(t){import(`./functions-PT9ri9Hu.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function ds(e,t){us(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function fs(e){let t=e();return us(t.catch(()=>{})),t}function ps(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new h(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{ee(n,{allowReservedAttributes:r})}catch(e){throw e instanceof y?new h(e.message):e}return n}export{Qi as $,Vr as $t,Eo as A,A as An,ui as At,Ea as B,ke as Bn,Fr as Bt,vo as C,yn as Cn,ei as Ct,La as D,j as Dn,Kr as Dt,po as E,mn as En,Xr as Et,Ma as F,Pe as Fn,Yr as Ft,Yi as G,Sr as Gt,Y as H,Ae as Hn,Nr as Ht,Z as I,Ie as In,Qr as It,Ki as J,kr as Jt,Ji as K,Cr as Kt,Aa as L,Le as Ln,Zr as Lt,yo as M,tn as Mn,$r as Mt,xo as N,Ne as Nn,ri as Nt,Oo as O,un as On,ai as Ot,Na as P,Fe as Pn,ni as Pt,na as Q,Gr as Qt,Ta as R,je as Rn,Or as Rt,wo as S,_n as Sn,ci as St,to as T,hn as Tn,ti as Tt,ma as U,Dr as Ut,wa as V,Oe as Vn,Pr as Vt,ha as W,Lr as Wt,ua as X,Hr as Xt,qi as Y,Wr as Yt,Xi as Z,Ur as Zt,$ as _,P as _n,Mi as _t,zo as a,Ar as an,bi as at,So as b,vn as bn,si as bt,es as c,xr as cn,Ti as ct,ss as d,An as dn,pi as dt,wr as en,da as et,rs as f,jn as fn,mi as ft,Io as g,M as gn,ji as gt,Lo as h,xn as hn,Ai as ht,cs as i,jr as in,Oi as it,ko as j,cn as jn,di as jt,Co as k,k as kn,li as kt,ls as l,br as ln,Di as lt,is as m,wn as mn,fi as mt,ds as n,Er as nn,Wi as nt,Wo as o,Mr as on,yi as ot,os as p,Mn as pn,hi as pt,sa as q,zr as qt,fs as r,Ir as rn,Ui as rt,Jo as s,Rr as sn,vi as st,ps as t,Tr as tn,_i as tt,Ho as u,V as un,Ei as ut,io as v,N as vn,ii as vt,bo as w,gn as wn,qr as wt,To as x,bn as xn,oi as xt,Do as y,Tn as yn,Jr as yt,Oa as z,Me as zn,Br as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./chunk-BHKSVoKr.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-CQmdlFyy.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-BHKSVoKr.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-ulTvoTdW.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-DvvgYsRt.js → resume-hook-CHXbXuRZ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-BHKSVoKr.js";import{T as t,n,o as r}from"./dist-BYo8Gno2.js";import{Dn as i,Gt as a,H as o,Mn as s,Q as c,S as l,X as u,a as d,at as f,en as p,g as m,k as h,n as g,ot as _,r as v,st as y,un as b,yn as x}from"./attribute-changes-
|
|
1
|
+
import{r as e}from"./chunk-BHKSVoKr.js";import{T as t,n,o as r}from"./dist-BYo8Gno2.js";import{Dn as i,Gt as a,H as o,Mn as s,Q as c,S as l,X as u,a as d,at as f,en as p,g as m,k as h,n as g,ot as _,r as v,st as y,un as b,yn as x}from"./attribute-changes-CXiYB8h9.js";import{s as S}from"./dist-CSfKNxQW.js";var C=e({getHookByToken:()=>T,resumeHook:()=>E,resumeWebhook:()=>D});async function w(e){let t=await i(),n=await t.hooks.getByToken(e),r=await t.runs.get(n.runId),a=await t.getEncryptionKeyForRun?.(r),o=a?await s(a):void 0;return n.metadata!==void 0&&(n.metadata=await h(n.metadata,n.runId,o)),{hook:n,run:r,encryptionKey:o}}async function T(e){let{hook:t}=await w(e);return t}async function E(e,t,n){return await v(()=>c(`hook.resume`,async r=>{let c=await i();try{let i,f,h;if(typeof e==`string`){let t=await w(e);i=t.hook,f=t.run,h=n??t.encryptionKey}else if(i=e,f=await c.runs.get(i.runId),n)h=n;else{let e=await c.getEncryptionKeyForRun?.(f);h=e?await s(e):void 0}r?.setAttributes({...y(i.token),..._(i.hookId),...p(i.runId)});let v=f.executionContext?.workflowCoreVersion,x=m(typeof v==`string`?v:void 0);x.supportedFormats.has(b.ENCRYPTED)||(h=void 0);let C=(f.specVersion??0)>=5&&x.supportedFormats.has(b.GZIP),T=[],E=S(i.specVersion),D=await l(t,i.runId,h,T,globalThis,E,x.framedByteStreams,C);g(Promise.all(T),e=>{e!==void 0&&o.warn(`Background flush of hook payload ops failed`,{workflowRunId:i.runId,hookId:i.hookId,error:e instanceof Error?e.message:String(e)})}),await c.events.create(i.runId,{eventType:`hook_received`,specVersion:5,correlationId:i.hookId,eventData:{...E?{}:{token:i.token},payload:D}},{v1Compat:E}),r?.setAttributes({...a(f.workflowName)});let O=await u(f.executionContext?.traceCarrier);return O&&r?.addLink?.(O),await c.queue(d(f.workflowName),{runId:i.runId,traceCarrier:f.executionContext?.traceCarrier??void 0},{deploymentId:f.deploymentId,specVersion:f.specVersion??1}),i}catch(t){throw r?.setAttributes({...y(typeof e==`string`?e:e.token),...f(!1)}),t}}))}async function D(e,i){let{hook:a,encryptionKey:o}=await w(e);if(a.isWebhook===!1)throw new r(e);let s,c;if(a.metadata&&typeof a.metadata==`object`&&`respondWith`in a.metadata)if(a.metadata.respondWith===`manual`){let{readable:e,writable:t}=new TransformStream;c=e,i[x]=t}else if(a.metadata.respondWith instanceof Response)s=a.metadata.respondWith;else throw new t(`Invalid \`respondWith\` value: ${a.metadata.respondWith}`,{slug:n.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else s=new Response(null,{status:202});if(await E(a,i,o),c){let e=c.getReader(),t=await e.read();t.value&&(s=t.value),e.cancel()}if(!s)throw new t(`Workflow run did not send a response`,{slug:n.WEBHOOK_RESPONSE_NOT_SENT});return s}export{C as i,E as n,D as r,T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./dist-CttsoN4D.js";import{C as t,D as n,E as r,S as i,T as a,b as o,c as s,f as c,h as l,m as u,r as d,t as f,w as p,x as m}from"./dist-BYo8Gno2.js";import{B as h,C as ee,Dn as g,E as _,En as v,Gt as y,H as b,Kt as x,M as S,Mn as C,N as w,O as T,On as E,Q as D,Rt as O,Tn as k,V as A,Z as j,a as M,en as N,g as P,h as F,n as te,r as I,s as ne,t as re,tn as ie,tt as L,un as R}from"./attribute-changes-DXbmITuI.js";import{K as z,i as B,o as V,q as H,s as U}from"./dist-CSfKNxQW.js";const W=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,n.WORLD_CONTRACT_ERROR]),G=new Set([`TRANSPORT`,`TIMEOUT`]),K=[a.is,u.is,o.is,c.is];function q(e){if(!r.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 l.is(e)?!0:r.is(e)?e.status!==void 0&&e.status>=500?!0:e.code!==void 0&&G.has(e.code):!1}function ae(e){if(s.is(e))return n.REPLAY_DIVERGENCE;if(f.is(e))return n.CORRUPTED_EVENT_LOG;if(q(e)||J(e))return n.WORLD_CONTRACT_ERROR;for(let t of K)if(t(e))return n.RUNTIME_ERROR;return n.USER_ERROR}const oe=V();function se(){let e=A.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[H]:e.rootRunId??t,[z]:t}}let Y=!1;async function X(t,n,r){"use step";return await I(()=>{let i=t?.workflowId;if(!i)throw new a(`'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 D(`workflow.start ${e(i)}`,async e=>{e?.setAttributes({...y(i),...x(`start`)});let t=[],o=r??{};Array.isArray(n)?t=n:typeof n==`object`&&(o=n),e?.setAttributes({...O(t.length)});let s=o.world??await g();E(s);let c=await s.getDeploymentId(),l=o.deploymentId??c;l===`latest`&&(s.resolveLatestDeploymentId?l=await s.resolveLatestDeploymentId():(Y||(Y=!0,b.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=P((await ne(s,`workflow`,{deploymentId:l,timeout:2e3,namespace:o.namespace}).catch(()=>void 0))?.workflowCoreVersion);u=e.framedByteStreams,f=e.supportedFormats.has(R.GZIP)}let p=[],m=`wrun_${s.createRunId?s.createRunId(o):oe()}`,h=await j(),_=o.specVersion??s.specVersion,v=U(_),S=o.allowReservedAttributes===!0,w;if(o.attributes&&Object.keys(o.attributes).length>0){if(_<4)throw new a(`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 a(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=re(o.attributes,{allowReservedAttributes:S});w=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let T=_>=4?se():void 0,D=T?{...T,...w}:w,k=D?{attributes:D,...S||T!=null?{allowReservedAttributes:!0}:{}}:{};if(o.replayedFromRunId!==void 0&&!B.safeParse(o.replayedFromRunId).success)throw new a(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(o.replayedFromRunId).slice(0,64))}.`);let A=await s.getEncryptionKeyForRun?.(m,{...o,deploymentId:l}),I=A?await C(A):void 0,z=await ee(t,m,I,p,globalThis,v,u,f&&_>=5),V={traceCarrier:h,workflowCoreVersion:F,features:{encryption:!!I},...o.replayedFromRunId?{replayedFromRunId:o.replayedFromRunId}:{}},[H,W]=await Promise.allSettled([s.events.create(m,{eventType:`run_created`,specVersion:_,eventData:{deploymentId:l,workflowName:i,input:z,executionContext:V,...k}},{v1Compat:v}),s.queue(M(i,o.namespace),{runId:m,traceCarrier:h,..._>=3?{runInput:{input:z,deploymentId:l,workflowName:i,specVersion:_,executionContext:V,...k}}:{}},{deploymentId:l,specVersion:_,...o.region===void 0?{}:{region:o.region}})]);if(W.status===`rejected`)throw W.reason;let G=!1;if(H.status===`rejected`){let e=H.reason;if(!d.is(e))if(J(e))G=!0,b.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=H.value;if(!e.run)throw new a(`Missing 'run' in server response for 'run_created' event`);if(!v&&e.run.runId!==m)throw new a(`Server returned different runId than requested: expected ${m}, got ${e.run.runId}`)}return te(Promise.all(p),e=>{b.warn(`Background flush of workflow argument streams failed`,{workflowRunId:m,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...N(m),...L(l),...H.status===`fulfilled`&&H.value.run?ie(H.value.run.status):{}}),new $(m,{resilientStart:G})})})}const ce=e=>Array.isArray(e)?e:[e];async function Z(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await C(i):void 0,o=ce(await S(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 le(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 ue(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(M(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(M(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 de(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 fe(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[v](e){return{runId:e.runId,resilientStart:e.#r}}static[k](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=g(),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 C(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(p.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=h(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,a=[1e3,3e3,6e3];for(;;)try{let n=await e.runs.get(this.runId);if(n.status===`completed`){let e=await this.#i();return await w(n.output,this.runId,e)}if(n.status===`cancelled`)throw new m(this.runId);if(n.status===`failed`){let e=await this.#i(),t;try{t=await T(n.error,this.runId,e)}catch{t=Error(`Failed to hydrate workflow run error`)}throw new i(this.runId,t,{errorCode:n.errorCode})}throw new t(this.runId,n.status)}catch(e){if(t.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(p.is(e)&&n<r){let e=a[n];n++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function pe(e){return new $(e)}export{de as a,Q as c,J as d,q as f,fe as i,X as l,pe as n,Z as o,le as r,ue as s,$ as t,ae as u};
|
|
1
|
+
import{h as e}from"./dist-CttsoN4D.js";import{C as t,D as n,E as r,S as i,T as a,b as o,c as s,f as c,h as l,m as u,r as d,t as f,w as p,x as m}from"./dist-BYo8Gno2.js";import{B as h,C as ee,Dn as g,E as _,En as v,Gt as y,H as b,Kt as x,M as S,Mn as C,N as w,O as T,On as E,Q as D,Rt as O,Tn as k,V as A,Z as j,a as M,en as N,g as P,h as F,n as te,r as I,s as ne,t as re,tn as ie,tt as L,un as R}from"./attribute-changes-CXiYB8h9.js";import{K as z,i as B,o as V,q as H,s as U}from"./dist-CSfKNxQW.js";const W=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,n.WORLD_CONTRACT_ERROR]),G=new Set([`TRANSPORT`,`TIMEOUT`]),K=[a.is,u.is,o.is,c.is];function q(e){if(!r.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 l.is(e)?!0:r.is(e)?e.status!==void 0&&e.status>=500?!0:e.code!==void 0&&G.has(e.code):!1}function ae(e){if(s.is(e))return n.REPLAY_DIVERGENCE;if(f.is(e))return n.CORRUPTED_EVENT_LOG;if(q(e)||J(e))return n.WORLD_CONTRACT_ERROR;for(let t of K)if(t(e))return n.RUNTIME_ERROR;return n.USER_ERROR}const oe=V();function se(){let e=A.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[H]:e.rootRunId??t,[z]:t}}let Y=!1;async function X(t,n,r){"use step";return await I(()=>{let i=t?.workflowId;if(!i)throw new a(`'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 D(`workflow.start ${e(i)}`,async e=>{e?.setAttributes({...y(i),...x(`start`)});let t=[],o=r??{};Array.isArray(n)?t=n:typeof n==`object`&&(o=n),e?.setAttributes({...O(t.length)});let s=o.world??await g();E(s);let c=await s.getDeploymentId(),l=o.deploymentId??c;l===`latest`&&(s.resolveLatestDeploymentId?l=await s.resolveLatestDeploymentId():(Y||(Y=!0,b.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=P((await ne(s,`workflow`,{deploymentId:l,timeout:2e3,namespace:o.namespace}).catch(()=>void 0))?.workflowCoreVersion);u=e.framedByteStreams,f=e.supportedFormats.has(R.GZIP)}let p=[],m=`wrun_${s.createRunId?s.createRunId(o):oe()}`,h=await j(),_=o.specVersion??s.specVersion,v=U(_),S=o.allowReservedAttributes===!0,w;if(o.attributes&&Object.keys(o.attributes).length>0){if(_<4)throw new a(`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 a(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=re(o.attributes,{allowReservedAttributes:S});w=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let T=_>=4?se():void 0,D=T?{...T,...w}:w,k=D?{attributes:D,...S||T!=null?{allowReservedAttributes:!0}:{}}:{};if(o.replayedFromRunId!==void 0&&!B.safeParse(o.replayedFromRunId).success)throw new a(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(o.replayedFromRunId).slice(0,64))}.`);let A=await s.getEncryptionKeyForRun?.(m,{...o,deploymentId:l}),I=A?await C(A):void 0,z=await ee(t,m,I,p,globalThis,v,u,f&&_>=5),V={traceCarrier:h,workflowCoreVersion:F,features:{encryption:!!I},...o.replayedFromRunId?{replayedFromRunId:o.replayedFromRunId}:{}},[H,W]=await Promise.allSettled([s.events.create(m,{eventType:`run_created`,specVersion:_,eventData:{deploymentId:l,workflowName:i,input:z,executionContext:V,...k}},{v1Compat:v}),s.queue(M(i,o.namespace),{runId:m,traceCarrier:h,..._>=3?{runInput:{input:z,deploymentId:l,workflowName:i,specVersion:_,executionContext:V,...k}}:{}},{deploymentId:l,specVersion:_,...o.region===void 0?{}:{region:o.region}})]);if(W.status===`rejected`)throw W.reason;let G=!1;if(H.status===`rejected`){let e=H.reason;if(!d.is(e))if(J(e))G=!0,b.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=H.value;if(!e.run)throw new a(`Missing 'run' in server response for 'run_created' event`);if(!v&&e.run.runId!==m)throw new a(`Server returned different runId than requested: expected ${m}, got ${e.run.runId}`)}return te(Promise.all(p),e=>{b.warn(`Background flush of workflow argument streams failed`,{workflowRunId:m,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...N(m),...L(l),...H.status===`fulfilled`&&H.value.run?ie(H.value.run.status):{}}),new $(m,{resilientStart:G})})})}const ce=e=>Array.isArray(e)?e:[e];async function Z(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),a=i?await C(i):void 0,o=ce(await S(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 le(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 ue(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(M(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(M(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 de(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 fe(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[v](e){return{runId:e.runId,resilientStart:e.#r}}static[k](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=g(),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 C(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(p.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=h(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,a=[1e3,3e3,6e3];for(;;)try{let n=await e.runs.get(this.runId);if(n.status===`completed`){let e=await this.#i();return await w(n.output,this.runId,e)}if(n.status===`cancelled`)throw new m(this.runId);if(n.status===`failed`){let e=await this.#i(),t;try{t=await T(n.error,this.runId,e)}catch{t=Error(`Failed to hydrate workflow run error`)}throw new i(this.runId,t,{errorCode:n.errorCode})}throw new t(this.runId,n.status)}catch(e){if(t.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(p.is(e)&&n<r){let e=a[n];n++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function pe(e){return new $(e)}export{de as a,Q as c,J as d,q as f,fe as i,X as l,pe as n,Z as o,le as r,ue as s,$ as t,ae as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Fn as t}from"./attribute-changes-
|
|
1
|
+
import{Cn as e,Fn as t}from"./attribute-changes-CXiYB8h9.js";async function n(r){let i=globalThis[e];return i||t(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as e,i as t,n,t as r}from"./chunk-BHKSVoKr.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(((e,n)=>{let{EMPTY_BUFFER:r}=i(),a=Buffer[Symbol.species];function o(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),i=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,i),i+=r.length}return i<t?new a(n.buffer,n.byteOffset,i):n}function s(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function c(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 a(e):ArrayBuffer.isView(e)?t=new a(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),u.readOnly=!1),t}if(n.exports={concat:o,mask:s,toArrayBuffer:l,toBuffer:u,unmask:c},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?s(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?c(t,n):e.unmask(t,n)}}catch{}})),o=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])}}}})),s=r(((e,n)=>{let r=t(`zlib`),s=a(),c=o(),{kStatusCode:l}=i(),u=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 c(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=s.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=s.concat(this._deflate[h],this._deflate[p]);t&&(e=new u(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][l]=1009,this.removeListener(`data`,y),this.reset()}function b(e){if(this[f]._inflate=null,this[g]){this[m](this[g]);return}e[l]=1007,this[m](e)}})),c=r(((e,n)=>{let{isUtf8:r}=t(`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 e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?c(t):e(t)}}catch{}})),l=r(((e,n)=>{let{Writable:r}=t(`stream`),o=s(),{BINARY_TYPES:l,EMPTY_BUFFER:u,kStatusCode:d,kWebSocket:f}=i(),{concat:p,toArrayBuffer:m,unmask:h}=a(),{isValidStatusCode:g,isValidUTF8:_}=c(),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||l[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[f]=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[o.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=u;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[o.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,u),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[d]=r,a}}})),u=r(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:o}=t(`crypto`),{types:{isUint8Array:l}}=t(`util`),u=s(),{EMPTY_BUFFER:d,kWebSocket:f,NOOP:p}=i(),{isBlob:m,isValidStatusCode:h}=c(),{mask:g,toBuffer:_}=a(),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[f]=void 0}static frame(e,t){let n,r=!1,i=2,a=!1;t.mask&&(n=t.maskBuffer||y,t.generateMask?t.generateMask(n):(S===b&&(x===void 0&&(x=Buffer.alloc(b)),o(x,0,b),S=0),n[0]=x[S++],n[1]=x[S++],n[2]=x[S++],n[3]=x[S++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let s;typeof e==`string`?(!t.mask||a)&&t[v]!==void 0?s=t[v]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!a);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],a)?[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=d;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(l(n))a.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let o={[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,o),i):this.enqueue([this.dispatch,a,!1,o,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[u.extensionName],i=t.binary?2:1,a=t.compress,o,s;typeof e==`string`?(o=Buffer.byteLength(e),s=!1):m(e)?(o=e.size,s=!1):(e=_(e),o=e.length,s=_.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 c={[v]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:s,rsv1:a};m(e)?this._state===0?this.getBlobData(e,this._compress,c,n):this.enqueue([this.getBlobData,e,this._compress,c,n]):this._state===0?this.dispatch(e,this._compress,c,n):this.enqueue([this.dispatch,e,this._compress,c,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[u.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)}})),d=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)}})),f=r(((e,t)=>{let{tokenChars:n}=c();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}})),p=r(((e,n)=>{let r=t(`events`),o=t(`https`),p=t(`http`),m=t(`net`),h=t(`tls`),{randomBytes:g,createHash:_}=t(`crypto`),{Duplex:v,Readable:y}=t(`stream`),{URL:b}=t(`url`),x=s(),S=l(),C=u(),{isBlob:w}=c(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=i(),{EventTarget:{addEventListener:ee,removeEventListener:te}}=d(),{format:P,parse:F}=f(),{toBuffer:I}=a(),L=Symbol(`kAborted`),R=[8,13],z=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],B=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var V=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]),H(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(V,"CONNECTING",{enumerable:!0,value:z.indexOf(`CONNECTING`)}),Object.defineProperty(V.prototype,"CONNECTING",{enumerable:!0,value:z.indexOf(`CONNECTING`)}),Object.defineProperty(V,"OPEN",{enumerable:!0,value:z.indexOf(`OPEN`)}),Object.defineProperty(V.prototype,"OPEN",{enumerable:!0,value:z.indexOf(`OPEN`)}),Object.defineProperty(V,"CLOSING",{enumerable:!0,value:z.indexOf(`CLOSING`)}),Object.defineProperty(V.prototype,"CLOSING",{enumerable:!0,value:z.indexOf(`CLOSING`)}),Object.defineProperty(V,"CLOSED",{enumerable:!0,value:z.indexOf(`CLOSED`)}),Object.defineProperty(V.prototype,"CLOSED",{enumerable:!0,value:z.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(V.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(V.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})}})}),V.prototype.addEventListener=ee,V.prototype.removeEventListener=te,n.exports=V;function H(e,t,n,r){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:R[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,!R.includes(i.protocolVersion))throw RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${R.join(`, `)})`);let a;if(t instanceof b)a=t;else try{a=new b(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}a.protocol===`http:`?a.protocol=`ws:`:a.protocol===`https:`&&(a.protocol=`wss:`),e._url=a.href;let s=a.protocol===`wss:`,c=a.protocol===`ws+unix:`,l;if(a.protocol!==`ws:`&&!s&&!c?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?l=`The URL's pathname is empty`:a.hash&&(l=`The URL contains a fragment identifier`),l){let t=SyntaxError(l);if(e._redirects===0)throw t;U(e,t);return}let u=s?443:80,d=g(16).toString(`base64`),f=s?o.request:p.request,m=new Set,h;if(i.createConnection=i.createConnection||(s?ne:W),i.defaultPort=i.defaultPort||u,i.port=a.port||u,i.host=a.hostname.startsWith(`[`)?a.hostname.slice(1,-1):a.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":d,Connection:`Upgrade`,Upgrade:`websocket`},i.path=a.pathname+a.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(h=new x({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers[`Sec-WebSocket-Extensions`]=P({[x.extensionName]:h.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!B.test(e)||m.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);m.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),(a.username||a.password)&&(i.auth=`${a.username}:${a.password}`),c){let e=i.path.split(`:`);i.socketPath=e[0],i.path=e[1]}let v;if(i.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?i.socketPath:a.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=c?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!s)&&(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=f(i),e._redirects&&e.emit(`redirect`,e.url,v)}else v=e._req=f(i);i.timeout&&v.on(`timeout`,()=>{G(e,v,`Opening handshake has timed out`)}),v.on(`error`,t=>{v===null||v[L]||(v=e._req=null,U(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{U(e,SyntaxError(`Invalid URL: ${o}`));return}H(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!==V.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(d+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?m.size&&(c=`Server sent no subprotocol`):m.size?m.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(!h){G(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=F(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{h.accept(t[x.extensionName])}catch{G(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[x.extensionName]=h}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 U(e,t){e._readyState=V.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function W(e){return e.path=e.socketPath,m.connect(e)}function ne(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=m.isIP(e.host)?``:e.host),h.connect(e)}function G(e,t,n){e._readyState=V.CLOSING;let r=Error(n);Error.captureStackTrace(r,G),t.setHeader?(t[L]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(U,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:I(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${z[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!==V.CLOSED&&(t.readyState===V.OPEN&&(t._readyState=V.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=V.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=V.CLOSING,e._receiver.end(),this.end()}function $(){let e=this[M];this.removeListener(`error`,$),this.on(`error`,N),e&&(e._readyState=V.CLOSING,this.destroy())}})),m=r(((e,n)=>{p();let{Duplex:r}=t(`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})),h=r(((e,t)=>{let{tokenChars:n}=c();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}})),g=r(((e,n)=>{let r=t(`events`),a=t(`http`),{Duplex:o}=t(`stream`),{createHash:c}=t(`crypto`),l=f(),u=s(),d=h(),m=p(),{CLOSE_TIMEOUT:g,GUID:_,kWebSocket:v}=i(),y=/^[+/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:g,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:m,...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||!y.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`],c=new Set;if(s!==void 0)try{c=d.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 u({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=l.parse(f);e[u.extensionName]&&(n.accept(e[u.extensionName]),p[u.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,l)=>{if(!a)return C(t,o||401,s,l);this.completeUpgrade(p,i,c,e,t,n,r)});return}if(!this.options.verifyClient(a))return C(t,401)}this.completeUpgrade(p,i,c,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,o){if(!i.readable||!i.writable)return i.destroy();if(i[v])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 s=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${c(`sha1`).update(t+_).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&&(s.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[u.extensionName]){let t=e[u.extensionName].params,n=l.format({[u.extensionName]:[t]});s.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,s,r),i.write(s.concat(`\r
|
|
2
|
+
`).join(`\r
|
|
3
|
+
`)),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
|
|
4
|
+
`)+`\r
|
|
5
|
+
\r
|
|
6
|
+
`+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)}})),_;n((()=>{m(),f(),s(),l(),u(),h(),p(),_=e(g(),1)}))();var v=_.default;export{v as WebSocketServer};
|
|
@@ -4,28 +4,71 @@ export declare const EXTENSION_COMPATIBILITY_MANIFEST_KIND = "eve-extension";
|
|
|
4
4
|
export declare const EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION = 1;
|
|
5
5
|
/** Filename emitted at the root of an extension's agent-shaped dist tree. */
|
|
6
6
|
export declare const EXTENSION_COMPATIBILITY_MANIFEST_FILENAME = "_manifest.json";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
|
|
7
|
+
declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
8
|
+
readonly extension: {
|
|
9
|
+
readonly current: 1;
|
|
10
|
+
readonly supported: readonly [1];
|
|
11
|
+
readonly dropped: {};
|
|
12
|
+
};
|
|
13
|
+
readonly tool: {
|
|
14
|
+
readonly current: 1;
|
|
15
|
+
readonly supported: readonly [1];
|
|
16
|
+
readonly dropped: {};
|
|
17
|
+
};
|
|
18
|
+
readonly dynamicTool: {
|
|
19
|
+
readonly current: 1;
|
|
20
|
+
readonly supported: readonly [1];
|
|
21
|
+
readonly dropped: {};
|
|
22
|
+
};
|
|
23
|
+
readonly connection: {
|
|
24
|
+
readonly current: 1;
|
|
25
|
+
readonly supported: readonly [1];
|
|
26
|
+
readonly dropped: {};
|
|
27
|
+
};
|
|
28
|
+
readonly hook: {
|
|
29
|
+
readonly current: 1;
|
|
30
|
+
readonly supported: readonly [1];
|
|
31
|
+
readonly dropped: {};
|
|
32
|
+
};
|
|
33
|
+
readonly skill: {
|
|
34
|
+
readonly current: 1;
|
|
35
|
+
readonly supported: readonly [1];
|
|
36
|
+
readonly dropped: {};
|
|
37
|
+
};
|
|
38
|
+
readonly dynamicSkill: {
|
|
39
|
+
readonly current: 1;
|
|
40
|
+
readonly supported: readonly [1];
|
|
41
|
+
readonly dropped: {};
|
|
42
|
+
};
|
|
43
|
+
readonly instructions: {
|
|
44
|
+
readonly current: 1;
|
|
45
|
+
readonly supported: readonly [1];
|
|
46
|
+
readonly dropped: {};
|
|
47
|
+
};
|
|
48
|
+
readonly dynamicInstructions: {
|
|
49
|
+
readonly current: 1;
|
|
50
|
+
readonly supported: readonly [1];
|
|
51
|
+
readonly dropped: {};
|
|
52
|
+
};
|
|
53
|
+
readonly config: {
|
|
54
|
+
readonly current: 1;
|
|
55
|
+
readonly supported: readonly [1];
|
|
56
|
+
readonly dropped: {};
|
|
57
|
+
};
|
|
58
|
+
readonly state: {
|
|
59
|
+
readonly current: 1;
|
|
60
|
+
readonly supported: readonly [1];
|
|
61
|
+
readonly dropped: {};
|
|
62
|
+
};
|
|
20
63
|
};
|
|
21
64
|
/** One independently versioned extension-facing contract. */
|
|
22
|
-
export type ExtensionCapability = keyof typeof
|
|
65
|
+
export type ExtensionCapability = keyof typeof EXTENSION_CAPABILITY_CONTRACTS;
|
|
66
|
+
/** Current producer contract version for each extension-facing capability. */
|
|
67
|
+
export declare const EXTENSION_CAPABILITY_VERSIONS: { readonly [TCapability in ExtensionCapability]: (typeof EXTENSION_CAPABILITY_CONTRACTS)[TCapability]["current"]; };
|
|
23
68
|
/** Capability requirements stamped by one extension build. */
|
|
24
69
|
export type ExtensionCapabilityRequirements = Partial<Record<ExtensionCapability, number>>;
|
|
25
70
|
/**
|
|
26
|
-
* Capability contract versions this eve release can consume.
|
|
27
|
-
* {@link EXTENSION_CAPABILITY_VERSIONS} so the version this release stamps is
|
|
28
|
-
* always one it accepts.
|
|
71
|
+
* Capability contract versions this eve release can consume.
|
|
29
72
|
*/
|
|
30
73
|
export declare const EXTENSION_CAPABILITY_SUPPORT: Readonly<Record<ExtensionCapability, readonly number[]>>;
|
|
31
74
|
/** Consumer support table used to validate one extension distribution. */
|
|
@@ -54,3 +97,4 @@ export declare function readExtensionCompatibilityManifest(manifestPath: string)
|
|
|
54
97
|
export declare function writeExtensionCompatibilityManifest(distRoot: string, manifest: ExtensionCompatibilityManifest): Promise<void>;
|
|
55
98
|
/** Finds unknown or unsupported capability requirements without executing extension code. */
|
|
56
99
|
export declare function findUnsupportedExtensionCapabilities(manifest: ExtensionCompatibilityManifest, support?: ExtensionCapabilitySupport): UnsupportedExtensionCapability[];
|
|
100
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{readFile,writeFile}from"node:fs/promises";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=1,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{readFile,writeFile}from"node:fs/promises";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=1,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:1,supported:[1],dropped:{}},dynamicTool:{current:1,supported:[1],dropped:{}},connection:{current:1,supported:[1],dropped:{}},hook:{current:1,supported:[1],dropped:{}},skill:{current:1,supported:[1],dropped:{}},dynamicSkill:{current:1,supported:[1],dropped:{}},instructions:{current:1,supported:[1],dropped:{}},dynamicInstructions:{current:1,supported:[1],dropped:{}},config:{current:1,supported:[1],dropped:{}},state:{current:1,supported:[1],dropped:{}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestSchema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict();function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(e){return parseExtensionCompatibilityManifest(await readFile(e,`utf8`),e)}async function writeExtensionCompatibilityManifest(e,n){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(n),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
|