eve 0.72.1 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/src/_virtual/_rolldown/runtime.js +1 -1
- package/dist/src/channel/agent-description.d.ts +49 -9
- package/dist/src/channel/agent-description.js +1 -1
- package/dist/src/channel/invoke-tool.d.ts +26 -4
- package/dist/src/channel/invoke-tool.js +1 -1
- package/dist/src/channel/principal-identity.d.ts +9 -0
- package/dist/src/channel/principal-identity.js +1 -0
- package/dist/src/channel/prompt-queue.d.ts +31 -0
- package/dist/src/channel/prompt-queue.js +1 -0
- package/dist/src/channel/routes.d.ts +19 -4
- package/dist/src/channel/schedule.d.ts +20 -6
- package/dist/src/channel/schedule.js +1 -1
- package/dist/src/channel/skill-files.d.ts +114 -0
- package/dist/src/channel/skill-files.js +1 -0
- package/dist/src/channel/types.d.ts +4 -0
- package/dist/src/chunks/{use-eve-agent-C1GYGCtb.js → use-eve-agent-DOOXadF0.js} +13 -3
- package/dist/src/chunks/{use-eve-agent-hZJ7CB8t.js → use-eve-agent-mP0M7SrL.js} +13 -3
- package/dist/src/cli/commands/agent-instructions.js +1 -1
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init-project.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/diagnostic-dump.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +6 -0
- package/dist/src/cli/dev/tui/blocks.js +2 -2
- package/dist/src/cli/dev/tui/markdown.d.ts +5 -0
- package/dist/src/cli/dev/tui/markdown.js +2 -2
- package/dist/src/cli/dev/tui/stream-format.js +2 -2
- package/dist/src/cli/dev/tui/transcript-parts.d.ts +4 -1
- package/dist/src/cli/dev/tui/transcript-parts.js +2 -2
- package/dist/src/cli/dev/tui/transcript.js +1 -1
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +9 -8
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +68 -7
- package/dist/src/compiled/@vercel/schedules/index.d.ts +158 -0
- package/dist/src/compiled/@vercel/schedules/index.js +17 -0
- package/dist/src/compiled/@workflow/core/capabilities.d.ts +33 -6
- package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/index.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +8 -8
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +13 -5
- package/dist/src/compiled/@workflow/core/serialization.d.ts +9 -9
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/index.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +11 -0
- package/dist/src/compiled/@workflow/world/hooks.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +6 -0
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-VaTKT4K8.js → attribute-changes-CSqvJx6j.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{dist-B7NC1c9-.js → dist-DmXynLVH.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-T5NnW-0k.js +3 -0
- package/dist/src/compiled/_chunks/workflow/helpers-BXCuoPUb.js +1 -0
- package/dist/src/compiled/_chunks/workflow/private-Dlf90Zvn.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-CvENCrxc.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{run-DYKeqbob.js → run-8pLWuR2U.js} +6 -6
- package/dist/src/compiled/_chunks/workflow/serialization-vDozzDhh.js +16 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BMqbraZM.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-A344L2AG.js +1 -0
- package/dist/src/compiled/shadcn-registry/index.js +3408 -35163
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/compile-agent.js +1 -1
- package/dist/src/compiler/development-extensions.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/load-binding-namespace.d.ts +5 -0
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/compiler/manifest.d.ts +39 -0
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/memory-wrapper-candidates.d.ts +2 -0
- package/dist/src/compiler/memory-wrapper-candidates.js +1 -0
- package/dist/src/compiler/module-lifecycle.d.ts +1 -1
- package/dist/src/compiler/module-lifecycle.js +1 -1
- package/dist/src/compiler/module-map.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-schedule-collection.d.ts +3 -0
- package/dist/src/compiler/normalize-schedule-collection.js +1 -0
- package/dist/src/compiler/normalize-schedule.d.ts +2 -2
- package/dist/src/compiler/normalize-schedule.js +1 -1
- package/dist/src/compiler/resolve-workspace-subagent.js +1 -1
- package/dist/src/compiler/schedule-collection-wrapper-candidates.d.ts +2 -0
- package/dist/src/compiler/schedule-collection-wrapper-candidates.js +1 -0
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/dynamic-resolve-context.js +1 -1
- package/dist/src/context/key-names.d.ts +1 -0
- package/dist/src/context/key-names.js +1 -1
- package/dist/src/context/keys.d.ts +2 -0
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/providers/session.js +1 -1
- package/dist/src/context/schedule-collection-tools.d.ts +9 -0
- package/dist/src/context/schedule-collection-tools.js +1 -0
- package/dist/src/context/session-context.d.ts +4 -1
- package/dist/src/context/session-schedule.d.ts +9 -0
- package/dist/src/context/session-schedule.js +1 -0
- package/dist/src/context/turn-principals.d.ts +12 -0
- package/dist/src/context/turn-principals.js +1 -0
- package/dist/src/dynamic/definition.d.ts +1 -0
- package/dist/src/evals/cli/eval-client.js +1 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/execution/agent-sessions/context.d.ts +2 -0
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/agent-sessions/steps.js +1 -1
- package/dist/src/execution/cancelled-model-call-batch.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/invoke-tool.d.ts +6 -2
- package/dist/src/execution/invoke-tool.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/node-step.d.ts +1 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/publish-session-events.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-errors.d.ts +11 -0
- package/dist/src/execution/sandbox/bindings/vercel-errors.js +2 -1
- package/dist/src/execution/sandbox/bindings/vercel-tool-sessions.d.ts +7 -0
- package/dist/src/execution/sandbox/bindings/vercel-tool-sessions.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/development-lazy-prewarm.js +1 -1
- package/dist/src/execution/sandbox/ensure.d.ts +14 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/session/active-turn.d.ts +2 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/entry.d.ts +10 -1
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/program.d.ts +4 -0
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/timeout-control.d.ts +1 -2
- package/dist/src/execution/session/timeout-control.js +1 -1
- package/dist/src/execution/session/turn-control.d.ts +7 -0
- package/dist/src/execution/session/turn-control.js +1 -0
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.d.ts +2 -0
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session-inbox/protocol.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/tool-session/id.d.ts +22 -0
- package/dist/src/execution/tool-session/id.js +1 -0
- package/dist/src/execution/tool-session/sandbox.d.ts +22 -0
- package/dist/src/execution/tool-session/sandbox.js +1 -0
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/connection-tools.js +1 -1
- package/dist/src/framework/sources/modules/schedule-collection-wrapper.d.ts +2 -0
- package/dist/src/framework/sources/modules/schedule-collection-wrapper.js +1 -0
- package/dist/src/framework/sources/registry.d.ts +1 -0
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/compaction/step.js +1 -1
- package/dist/src/harness/emission.d.ts +1 -0
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/hitl/approvals.d.ts +1 -1
- package/dist/src/harness/hitl/approvals.js +1 -1
- package/dist/src/harness/hitl/delivery.d.ts +9 -2
- package/dist/src/harness/hitl/delivery.js +1 -1
- package/dist/src/harness/hitl/intake.js +1 -1
- package/dist/src/harness/model-call/call.d.ts +5 -0
- package/dist/src/harness/model-call/call.js +1 -1
- package/dist/src/harness/model-call/usage.js +1 -1
- package/dist/src/harness/open-input-request.d.ts +8 -0
- package/dist/src/harness/open-input-request.js +1 -0
- package/dist/src/harness/session-machine/current.js +1 -1
- package/dist/src/harness/session-machine/transitions.d.ts +13 -0
- package/dist/src/harness/session-machine/transitions.js +1 -1
- package/dist/src/harness/stream-actions.d.ts +6 -1
- package/dist/src/harness/stream-actions.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/types.d.ts +2 -0
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +1 -0
- package/dist/src/internal/application/cache-metadata.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/application/runtime-compiled-artifacts-source.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/schedule-collection.d.ts +2 -0
- package/dist/src/internal/authored-definition/schedule-collection.js +1 -0
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +7 -0
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-runtime-modules.d.ts +1 -0
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/invocation/metadata.js +1 -1
- package/dist/src/internal/mcp/forwarded-principal-header.d.ts +31 -0
- package/dist/src/internal/mcp/forwarded-principal-header.js +1 -0
- package/dist/src/internal/mcp/published-tools.d.ts +9 -2
- package/dist/src/internal/mcp/published-tools.js +1 -1
- package/dist/src/internal/mcp/skills.d.ts +57 -0
- package/dist/src/internal/mcp/skills.js +1 -0
- package/dist/src/internal/mcp/streamable-http-server.d.ts +38 -6
- package/dist/src/internal/mcp/streamable-http-server.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/artifacts-config.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.js +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-runner.js +1 -1
- package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
- package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/host/skill-server-assets.d.ts +29 -0
- package/dist/src/internal/nitro/host/skill-server-assets.js +1 -0
- package/dist/src/internal/nitro/host/start-production-server.js +1 -1
- package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +12 -0
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.d.ts +4 -0
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-collection-consumer.d.ts +3 -0
- package/dist/src/internal/nitro/routes/schedule-collection-consumer.js +1 -0
- package/dist/src/internal/schedules/consumer-route.d.ts +17 -0
- package/dist/src/internal/schedules/consumer-route.js +1 -0
- package/dist/src/internal/schedules/verify-delivery.d.ts +25 -0
- package/dist/src/internal/schedules/verify-delivery.js +1 -0
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/validate-world.js +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/cli-config.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/cred-storage.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/schema.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/schema.zod.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/types.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/envpath.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/errors.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/errutils.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/exec.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/fsutils.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/lookup.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/safety.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/auth-errors.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-context.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/oauth.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-error.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-io.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-util.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/version.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_queue@0.5.1_@opentelemetry_api@1.9.1/node_modules/@vercel/queue/dist/index.js +36 -0
- package/dist/src/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js +1 -0
- package/dist/src/node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +2 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +1 -0
- package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +1 -0
- package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +1 -0
- package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +1 -0
- package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js +1 -0
- package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js +1 -0
- package/dist/src/node_modules/.pnpm/mixpart@0.0.6/node_modules/mixpart/dist/index.js +7 -0
- package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +1 -0
- package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +1 -0
- package/dist/src/node_modules/.pnpm/os-paths@4.4.0/node_modules/os-paths/src/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +1 -0
- package/dist/src/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js +1 -0
- package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +1 -0
- package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +1 -0
- package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +1 -0
- package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +1 -0
- package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +2 -0
- package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +1 -0
- package/dist/src/node_modules/.pnpm/xdg-app-paths@5.5.1/node_modules/xdg-app-paths/src/lib/index.js +1 -0
- package/dist/src/node_modules/.pnpm/xdg-portable@7.3.0/node_modules/xdg-portable/src/lib/index.js +1 -0
- package/dist/src/public/channels/chat-sdk/authorization.js +1 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +7 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
- package/dist/src/public/channels/discord/defaults.d.ts +8 -7
- package/dist/src/public/channels/discord/discordChannel.d.ts +21 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/discord/index.d.ts +1 -1
- package/dist/src/public/channels/github/defaults.js +3 -3
- package/dist/src/public/channels/github/githubChannel.d.ts +4 -1
- package/dist/src/public/channels/github/state.d.ts +2 -1
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/linear/defaults.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.d.ts +4 -1
- package/dist/src/public/channels/mcp.d.ts +26 -5
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -0
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +6 -0
- package/dist/src/public/channels/twilio/defaults.js +2 -4
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +4 -1
- package/dist/src/public/definitions/channel.d.ts +1 -1
- package/dist/src/public/definitions/connections/mcp.d.ts +11 -0
- package/dist/src/public/experimental/schedules/client.d.ts +7 -0
- package/dist/src/public/experimental/schedules/client.js +1 -0
- package/dist/src/public/experimental/schedules/index.d.ts +5 -0
- package/dist/src/public/experimental/schedules/index.js +1 -0
- package/dist/src/public/experimental/schedules/testing.d.ts +2 -0
- package/dist/src/public/experimental/schedules/testing.js +1 -0
- package/dist/src/public/experimental/schedules/vercel.d.ts +2 -0
- package/dist/src/public/experimental/schedules/vercel.js +1 -0
- package/dist/src/public/memory/scope.js +1 -1
- package/dist/src/public/schedules/provider-types.d.ts +16 -0
- package/dist/src/public/schedules/provider-types.js +1 -0
- package/dist/src/public/schedules/providers/in-memory.d.ts +5 -0
- package/dist/src/public/schedules/providers/in-memory.js +1 -0
- package/dist/src/public/schedules/providers/vercel.d.ts +10 -0
- package/dist/src/public/schedules/providers/vercel.js +1 -0
- package/dist/src/public/schedules/scope.d.ts +2 -0
- package/dist/src/public/schedules/scope.js +1 -0
- package/dist/src/public/schedules/subscription.d.ts +259 -0
- package/dist/src/public/schedules/subscription.js +1 -0
- package/dist/src/public/schedules/testing.d.ts +1 -0
- package/dist/src/public/schedules/testing.js +1 -0
- package/dist/src/public/sveltekit/dev-server.js +1 -1
- package/dist/src/runtime/cache-key.js +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/loaders/compile-metadata.js +1 -1
- package/dist/src/runtime/loaders/manifest.js +1 -1
- package/dist/src/runtime/loaders/module-map.js +1 -1
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
- package/dist/src/runtime/schedules/collection-client.d.ts +20 -0
- package/dist/src/runtime/schedules/collection-client.js +1 -0
- package/dist/src/runtime/schedules/dispatch-occurrence.d.ts +12 -0
- package/dist/src/runtime/schedules/dispatch-occurrence.js +1 -0
- package/dist/src/runtime/schedules/load-collection.d.ts +14 -0
- package/dist/src/runtime/schedules/load-collection.js +1 -0
- package/dist/src/runtime/schedules/payload.d.ts +24 -0
- package/dist/src/runtime/schedules/payload.js +1 -0
- package/dist/src/runtime/schedules/provider-types.d.ts +1 -0
- package/dist/src/runtime/schedules/provider-types.js +1 -0
- package/dist/src/runtime/schedules/queue-namespace.d.ts +2 -0
- package/dist/src/runtime/schedules/queue-namespace.js +1 -0
- package/dist/src/runtime/schedules/record.d.ts +4 -0
- package/dist/src/runtime/schedules/record.js +1 -0
- package/dist/src/runtime/schedules/validation.d.ts +6 -0
- package/dist/src/runtime/schedules/validation.js +1 -0
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
- package/dist/src/runtime/sessions/runtime-session.d.ts +10 -0
- package/dist/src/runtime/sessions/runtime-session.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -0
- package/dist/src/self-modification/config.d.ts +4 -63
- package/dist/src/self-modification/config.js +1 -1
- package/dist/src/self-modification/credentials.d.ts +1 -1
- package/dist/src/self-modification/deployed-sandbox.d.ts +14 -0
- package/dist/src/self-modification/deployed-sandbox.js +1 -0
- package/dist/src/self-modification/extension/config-schema.d.ts +2 -17
- package/dist/src/self-modification/extension/config-schema.js +1 -1
- package/dist/src/self-modification/extension/local-only.d.ts +1 -1
- package/dist/src/self-modification/extension/local-only.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
- package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/instructions.js +3 -35
- package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.d.ts +3 -31
- package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
- package/dist/src/self-modification/git-workspace.d.ts +1 -2
- package/dist/src/self-modification/git-workspace.js +1 -1
- package/dist/src/self-modification/github-publisher.d.ts +1 -1
- package/dist/src/self-modification/mode.d.ts +4 -4
- package/dist/src/self-modification/mode.js +1 -1
- package/dist/src/self-modification/proposal.js +1 -1
- package/dist/src/self-modification/remote/config-schema.d.ts +20 -0
- package/dist/src/self-modification/remote/config-schema.js +1 -0
- package/dist/src/self-modification/remote/config.d.ts +66 -0
- package/dist/src/self-modification/remote/config.js +1 -0
- package/dist/src/self-modification/remote/extension.d.ts +5 -0
- package/dist/src/self-modification/remote/extension.js +1 -0
- package/dist/src/self-modification/remote/production-registry-add.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/agent.d.ts +4 -0
- package/dist/src/self-modification/remote/subagents/agent/agent.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/instructions.d.ts +2 -0
- package/dist/src/self-modification/remote/subagents/agent/instructions.js +5 -0
- package/dist/src/self-modification/remote/subagents/agent/sandbox.d.ts +2 -0
- package/dist/src/self-modification/remote/subagents/agent/sandbox.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/edit_file.d.ts +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/edit_file.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/publish.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/registry_add.d.ts +32 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/registry_add.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/search_models.d.ts +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/search_models.js +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/search_registry.d.ts +1 -0
- package/dist/src/self-modification/remote/subagents/agent/tools/search_registry.js +1 -0
- package/dist/src/self-modification/sandbox.d.ts +1 -6
- package/dist/src/self-modification/sandbox.js +1 -1
- package/dist/src/self-modification/scaffold.js +1 -1
- package/dist/src/self-modification/setup.d.ts +6 -0
- package/dist/src/self-modification/setup.js +46 -48
- package/dist/src/self-modification/subagent-guidance.d.ts +15 -0
- package/dist/src/self-modification/subagent-guidance.js +29 -0
- package/dist/src/services/dev-client/request-headers.js +1 -1
- package/dist/src/setup/flows/model-source-change.js +1 -1
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/verified-remote-client.d.ts +3 -0
- package/dist/src/setup/verified-remote-client.js +1 -1
- package/dist/src/shared/framework-eve-server.js +1 -1
- package/dist/src/shared/principal-scope.d.ts +2 -0
- package/dist/src/shared/principal-scope.js +1 -0
- package/dist/src/shared/schedule-collection-definition.d.ts +11 -0
- package/dist/src/shared/schedule-collection-definition.js +1 -0
- package/dist/src/shared/schedule-collection-tools.d.ts +1 -0
- package/dist/src/shared/schedule-collection-tools.js +1 -0
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/subagents/tool.d.ts +1 -0
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/framework/agent.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/read-file.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tracing/agent-otel-content.d.ts +2 -0
- package/dist/src/tracing/agent-otel-content.js +2 -2
- package/dist/src/tracing/agent-otel-provider.js +1 -1
- package/dist/src/tracing/invoke-tool-span.d.ts +1 -0
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/chat-sdk.mdx +27 -0
- package/docs/channels/custom.mdx +5 -2
- package/docs/channels/discord.mdx +22 -0
- package/docs/channels/mcp.mdx +102 -4
- package/docs/channels/slack.mdx +1 -1
- package/docs/connections/mcp.mdx +19 -0
- package/docs/evals/targets.mdx +5 -1
- package/docs/guides/self-modification.md +50 -3
- package/docs/tools/human-in-the-loop.md +14 -2
- package/docs/tools/workflows.mdx +6 -4
- package/docs/tutorial/guard-the-spend.mdx +1 -1
- package/package.json +46 -8
- package/dist/src/compiled/@workflow/core/runtime/vm-serde-bundle.generated.d.ts +0 -14
- package/dist/src/compiled/_chunks/workflow/dist-CaNNONeg.js +0 -3
- package/dist/src/compiled/_chunks/workflow/global-DKbOgrts.js +0 -1
- package/dist/src/compiled/_chunks/workflow/helpers-CP9TjeO8.js +0 -1
- package/dist/src/compiled/_chunks/workflow/logger-oqfblE3p.js +0 -14
- package/dist/src/compiled/_chunks/workflow/resume-hook-yq-NAdBu.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-APSKphN5.js +0 -3
- package/dist/src/compiled/_chunks/workflow/sleep-Ba8SExMt.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wait-until-Dc9s3yyP.js +0 -1
- package/dist/src/self-modification/extension/production-registry-add.js +0 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/publish.js +0 -1
- /package/dist/src/self-modification/{extension → remote}/production-registry-add.d.ts +0 -0
- /package/dist/src/self-modification/{extension → remote}/subagents/agent/tools/publish.d.ts +0 -0
package/docs/connections/mcp.mdx
CHANGED
|
@@ -159,6 +159,25 @@ Return `"user-approval"` (or `true`) to pause for a person and `"not-applicable"
|
|
|
159
159
|
|
|
160
160
|
[Human-in-the-loop](/docs/human-in-the-loop#approvals) covers the full set of statuses, how `approvedTools` and `session.auth` factor in, and how a gated call pauses and resumes durably.
|
|
161
161
|
|
|
162
|
+
## Forward the caller to an eve agent
|
|
163
|
+
|
|
164
|
+
When the server is another eve agent's [`mcpChannel`](../channels/mcp), set `forwardPrincipal: true` so its published tools run as the user of the current turn instead of as this deployment:
|
|
165
|
+
|
|
166
|
+
```ts title="agent/connections/specialist.ts"
|
|
167
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
168
|
+
|
|
169
|
+
export default defineMcpClientConnection({
|
|
170
|
+
url: "https://specialist.example.com/eve/v1/mcp",
|
|
171
|
+
description: "The specialist agent's tools.",
|
|
172
|
+
headers: { authorization: `Bearer ${process.env.SPECIALIST_TOKEN}` },
|
|
173
|
+
forwardPrincipal: true,
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
eve sends the turn's user, and its initiator when that differs, in the `eve-forwarded-principal` header on every request. A turn with no caller, or an anonymous one, sends no header. The server must trust this deployment's route-authenticated identity in `trustedForwarders`; otherwise it refuses the request with `403`. See [Forwarded principals](../channels/mcp#forwarded-principals). A request carrying the header fails rather than follow a redirect, so the header never reaches another host. A principal over 16 KiB encoded fails the call before it is sent; trim its attributes.
|
|
178
|
+
|
|
179
|
+
Authenticate the connection as this deployment, with a stable service credential, like the token above, not with user-scoped `connect("...")` or a per-caller resolver. eve resolves `auth` and `headers` once when it opens the client, but one client can serve turns from different users in a shared session, so the header is what names the user on each request. The server trusts the forwarder by that service identity, and grants the user's own access to downstream services itself.
|
|
180
|
+
|
|
162
181
|
## Control result size
|
|
163
182
|
|
|
164
183
|
`connection_execute` returns an MCP tool's `structuredContent` when the server sends it. Otherwise it returns the result's text, parsed as JSON when the tool declares no output schema. Image, audio, and resource content reaches the model as file parts, and a result with `isError: true` fails the call with its text. MCP connections do not expose a per-result transform equivalent to an authored tool's [`toModelOutput`](/docs/tools#shape-what-the-model-sees-with-tomodeloutput).
|
package/docs/evals/targets.mdx
CHANGED
|
@@ -36,7 +36,11 @@ These helpers handle the session protocol, retries, and event collection for the
|
|
|
36
36
|
|
|
37
37
|
## Authentication
|
|
38
38
|
|
|
39
|
-
Local targets send no auth: `eve eval` owns the dev server it boots.
|
|
39
|
+
Local targets send no auth: `eve eval` owns the dev server it boots.
|
|
40
|
+
|
|
41
|
+
For a remote `--url`, eve gets the expected Vercel owner and project from `VERCEL_ORG_ID` and `VERCEL_PROJECT_ID` when both values are nonblank. Otherwise it reads the local Vercel project link: `.vercel/project.json`, or the matching project in `.vercel/repo.json` for a linked monorepo.
|
|
42
|
+
|
|
43
|
+
With a project reference, eve looks up the exact HTTPS origin under that owner, regardless of the Vercel CLI's current team. The deployment's project ID must match before eve sends ambient credentials. Without a project reference, eve verifies the URL under the CLI's current scope. URLs that Vercel cannot verify remain anonymous.
|
|
40
44
|
|
|
41
45
|
After verification, eve sends the available Vercel credentials:
|
|
42
46
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Self-Modification"
|
|
3
|
-
description: "Ask your agent to update its own
|
|
3
|
+
description: "Ask your agent to update its own authored files during local development, or let a deployed agent propose changes as draft pull requests."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
When `eve dev` starts a local server, it mounts the bundled self-modification extension by default. Ask your agent to change its instructions, tools, skills, or other files under `agent/`; eve delegates the source work to the `self-modification__agent` subagent. Connecting to an existing server with `eve remote connect --url <url>` does not add the bundled extension to that server.
|
|
7
7
|
|
|
8
|
-
The bundled extension is for local development and is not included in production builds.
|
|
8
|
+
The bundled extension is `eve/self-modification/local`. It is for local development and is not included in production builds. To let a deployed agent propose source changes, mount the separate [`eve/self-modification/remote`](#propose-changes-from-a-deployed-agent) extension.
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
11
|
eve dev
|
|
@@ -27,7 +27,54 @@ The subagent uses your agent's model by default. To give it a different model or
|
|
|
27
27
|
Switch the self-modification subagent to openai/gpt-6-sol with low reasoning.
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
The first time, this creates `agent/extensions/self-modification/extension.ts` with those settings. After that file exists, later changes edit it. You can also edit the file yourself: it accepts `model` and `
|
|
30
|
+
The first time, this creates `agent/extensions/self-modification/extension.ts` with those settings. After that file exists, later changes edit it. You can also edit the file yourself: it accepts `model`, `reasoning`, and `local.enabled` options.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
// agent/extensions/self-modification/extension.ts
|
|
34
|
+
import selfModification from "eve/self-modification/local";
|
|
35
|
+
|
|
36
|
+
export default selfModification({
|
|
37
|
+
model: "openai/gpt-6-sol",
|
|
38
|
+
reasoning: "low",
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Mounts that import `eve/self-modification` still work; that specifier is an alias for `eve/self-modification/local`. Neither specifier accepts a `deployed` option. If your mount sets `deployed`, eve rejects it and asks you to move that configuration to an `eve/self-modification/remote` mount.
|
|
43
|
+
|
|
44
|
+
## Propose changes from a deployed agent
|
|
45
|
+
|
|
46
|
+
`eve/self-modification/remote` is a separate extension for deployed agents. It adds a subagent that checks out your repository in a sandbox, edits the authored source, and opens a draft pull request against a target branch. It never changes the running deployment. Changes take effect only after you review, merge, and redeploy.
|
|
47
|
+
|
|
48
|
+
Mount it under its own namespace so it does not replace the local extension:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// agent/extensions/self-modification-remote/extension.ts
|
|
52
|
+
import selfModification from "eve/self-modification/remote";
|
|
53
|
+
|
|
54
|
+
export default selfModification({
|
|
55
|
+
source: {
|
|
56
|
+
git: {
|
|
57
|
+
repository: "github.com/acme/agents",
|
|
58
|
+
directory: "apps/support",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
target: { branch: "main" },
|
|
62
|
+
credentials: { pat: true },
|
|
63
|
+
authorize: ({ channel, principal }) =>
|
|
64
|
+
channel.kind === "http" && principal?.principalId === "release-bot",
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| Option | Description |
|
|
69
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| `source.git.repository` | GitHub repository in `github.com/owner/repo` form. |
|
|
71
|
+
| `source.git.directory` | Application directory relative to the repository root. Use `"."` for the root. |
|
|
72
|
+
| `target.branch` | Branch that is checked out and targeted by draft pull requests. |
|
|
73
|
+
| `authorize` | Required. Receives the requesting `channel` and `principal` and returns whether that caller can use the subagent. The subagent is hidden when it returns `false` or throws. |
|
|
74
|
+
| `credentials` | Required. An object with a `resolve({ capability, repository })` function that returns a GitHub token, or `{ pat: true }` to read `EVE_SELF_MODIFICATION_GITHUB_TOKEN` from the deployment environment. |
|
|
75
|
+
| `model`, `reasoning` | Optional model and reasoning level for the deployed subagent. It defaults to the parent agent's model. |
|
|
76
|
+
|
|
77
|
+
The deployed subagent is never offered during `eve dev`. In a deployment, it needs a sandbox provider that supports runtime credential transforms: Vercel Sandbox on Vercel, or microsandbox on a supported self-hosted system. eve applies the GitHub token as a sandbox network credential only while it checks out or publishes, so commands in the sandbox cannot read it.
|
|
31
78
|
|
|
32
79
|
## Run without self-modification
|
|
33
80
|
|
|
@@ -158,7 +158,9 @@ export default defineTool({
|
|
|
158
158
|
});
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
When a response
|
|
161
|
+
When the policy refuses a response, the approval stays pending and the turn stays held. The stream emits `approval.candidate` with `outcome: "pending"`, then `approval.candidate` with `outcome: "rejected"` and the policy's `reason`, then `turn.waiting` with `on: "input"` for the same `turnId`. It does not emit `session.waiting`, so a client that stops reading at a session boundary keeps reading through a refusal. The client finishes the submission and the approval prompt stays answerable. Submitting an answer does not confirm approval: `approval.settled` or `input.resolved` records the server's decision.
|
|
162
|
+
|
|
163
|
+
Every response a policy evaluates starts the same way, not only refusals. eve first records the response as an `approval.candidate` with `outcome: "pending"`, then runs the policy so slow policy work cannot lose the response. An allowed response then emits `approval.settled` and `input.resolved`. An approval without a `response` policy settles directly and emits no `approval.candidate`. A candidate can also end with `failed`, `timed-out`, or `stale`; inspect `approval.candidate` events for the reason.
|
|
162
164
|
|
|
163
165
|
### Skipping approval for schedule-dispatched turns
|
|
164
166
|
|
|
@@ -217,7 +219,7 @@ Approvals and questions share one protocol:
|
|
|
217
219
|
3. The run parks durably, for as long as it takes. The turn stays open: the stream emits `turn.waiting`, and after the answer the turn resumes under the same `turnId`. That `turn.waiting` carries `on: "input"`, since a person must act.
|
|
218
220
|
4. The client answers with `inputResponses` (structured, keyed by `requestId`) or a normal follow-up `message`. A follow-up whose text matches an option ID, option label, or numeric option index resolves automatically, including approval options such as `approve` and `cancel`.
|
|
219
221
|
|
|
220
|
-
For `ctx.ask()` questions from tools, a follow-up message answers the
|
|
222
|
+
For `ctx.ask()` questions from tools, a follow-up message answers the first open request, as described in [Several requests at once](#several-requests-at-once). The message must match an option, or the question must allow free text. Otherwise the message follows the session's `turnPolicy`. A steering message, the default, aborts the `ctx.abortSignal` of each `execute` workflow tool call the turn waits on, so a question such a call asked, such as `ask_question`'s, is withdrawn and resolves as `cancelled`. The model reads the message once those calls settle. Questions from subagents need a structured response.
|
|
221
223
|
|
|
222
224
|
Each request includes a `kind` discriminator: `tool-approval`, `question`, or
|
|
223
225
|
`session-limit`. Clients should use `kind` to choose behavior and presentation.
|
|
@@ -232,6 +234,16 @@ If a tool is approved by another user, only the approved call runs with that use
|
|
|
232
234
|
|
|
233
235
|
For approval requests, a follow-up message that doesn't match an option steers the turn instead of answering it. eve cancels the turn's pending approval, so the call doesn't run and `input.resolved` reports `outcome: "ignored"`, and the model reads the message next. This happens even when the message is sent with `turnPolicy: "queue"`, because a turn held on a person can't end until they act. Calls the person already approved in the same batch still run. A message from someone other than the person the turn serves waits until the turn ends. Cancelling the turn withdraws its approval: the call doesn't run, `input.resolved` reports `outcome: "cancelled"`, and a later answer to it approves nothing.
|
|
234
236
|
|
|
237
|
+
### Several requests at once
|
|
238
|
+
|
|
239
|
+
A turn can wait on more than one request, such as two `ctx.ask()` questions a workflow tool asks with `Promise.all`, or approvals for two tool calls the model made in one step. A follow-up message answers only the first open request: a [runtime limit](/docs/agent-config#runtime-limits) continuation prompt if one is open, and otherwise the request eve asked for first, in the order of its `input.requested` events.
|
|
240
|
+
|
|
241
|
+
The message answers that request when it matches one of its options, or when the request accepts free text. Otherwise the message is not an answer and follows the rules above. To answer several requests by text, send one message per request.
|
|
242
|
+
|
|
243
|
+
An approval for a tool call made in the same step as a workflow tool call, such as `ask_question`, is not requested until the workflow tool call finishes, because the approved call can't run before then. The person answers the question first, then sees the approval.
|
|
244
|
+
|
|
245
|
+
Channels that show only text show one request at a time, in this order, and post the next once the current one is answered, so a reply answers the request the person sees. Twilio, GitHub, Linear, and Chat SDK channels work this way. Chat SDK can't tell whether an adapter shows buttons, so every Chat SDK channel shows requests one at a time, including Linq, Photon, and adapters with buttons. Native channels with buttons, such as Slack, show every open request so a person can press any of them, and a typed reply still answers the first.
|
|
246
|
+
|
|
235
247
|
See [Sessions, runs & streaming](/docs/concepts/sessions-runs-and-streaming) for the full event and resume contract that this builds on.
|
|
236
248
|
|
|
237
249
|
## Answering from a client or channel
|
package/docs/tools/workflows.mdx
CHANGED
|
@@ -107,10 +107,12 @@ channel or schedule, use the [channel operations](/docs/channels/custom#channel-
|
|
|
107
107
|
or [schedule handler](/docs/schedules#handler-form-run) APIs.
|
|
108
108
|
|
|
109
109
|
Workflow imports resolve `paths` aliases from your application's `tsconfig.json` or
|
|
110
|
-
`jsconfig.json`, including when the application is a workspace package.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
`jsconfig.json`, including when the application is a workspace package. A member of an
|
|
111
|
+
[agent workspace](/docs/concepts/project-structure#several-root-agents) can also import
|
|
112
|
+
workflow and step modules from the shared root package, such as a root `lib/` directory.
|
|
113
|
+
eve includes only workflow and step modules reachable from the agent's runtime modules.
|
|
114
|
+
Unrelated workflows in the host application stay outside the agent bundle. An unresolved
|
|
115
|
+
workflow import fails the build with the missing import in the error.
|
|
114
116
|
|
|
115
117
|
### Add a runtime-generated workflow tool
|
|
116
118
|
|
|
@@ -51,7 +51,7 @@ Ask for something that forces a large unfiltered scan:
|
|
|
51
51
|
Total revenue across all customers, all time, broken out by day.
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
The model proposes the query, `approval` returns `"user-approval"`, and the turn parks. The stream emits `input.requested`, then `
|
|
54
|
+
The model proposes the query, `approval` returns `"user-approval"`, and the turn parks. The stream emits `input.requested`, then `turn.waiting` with `on: "input"`, and the turn stays open until someone answers. How the prompt looks depends on the channel, whether buttons in the TUI, Block Kit in Slack, or a UI control on the web. Approve it and the run resumes from exactly that step, then the query runs. Deny it and the tool is skipped, with the model told why.
|
|
55
55
|
|
|
56
56
|
Each session has exactly one active continuation. Answer an approval against a stale handle and it's rejected, so there's no way to double-resume the same parked turn.
|
|
57
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -333,6 +333,18 @@
|
|
|
333
333
|
"import": "./dist/src/self-modification/extension/extension.js",
|
|
334
334
|
"default": "./dist/src/self-modification/extension/extension.js"
|
|
335
335
|
},
|
|
336
|
+
"./self-modification/local": {
|
|
337
|
+
"eve-source": "./dist/src/self-modification/extension/extension.js",
|
|
338
|
+
"types": "./dist/src/self-modification/extension/extension.d.ts",
|
|
339
|
+
"import": "./dist/src/self-modification/extension/extension.js",
|
|
340
|
+
"default": "./dist/src/self-modification/extension/extension.js"
|
|
341
|
+
},
|
|
342
|
+
"./self-modification/remote": {
|
|
343
|
+
"eve-source": "./dist/src/self-modification/remote/extension.js",
|
|
344
|
+
"types": "./dist/src/self-modification/remote/extension.d.ts",
|
|
345
|
+
"import": "./dist/src/self-modification/remote/extension.js",
|
|
346
|
+
"default": "./dist/src/self-modification/remote/extension.js"
|
|
347
|
+
},
|
|
336
348
|
"./self-modification/agent": {
|
|
337
349
|
"eve-source": "./dist/src/self-modification/agent.js",
|
|
338
350
|
"types": "./dist/src/self-modification/agent.d.ts",
|
|
@@ -412,6 +424,24 @@
|
|
|
412
424
|
"import": "./dist/src/public/server/index.js",
|
|
413
425
|
"default": "./dist/src/public/server/index.js"
|
|
414
426
|
},
|
|
427
|
+
"./experimental/schedules/testing": {
|
|
428
|
+
"eve-source": "./src/public/experimental/schedules/testing.ts",
|
|
429
|
+
"types": "./dist/src/public/experimental/schedules/testing.d.ts",
|
|
430
|
+
"import": "./dist/src/public/experimental/schedules/testing.js",
|
|
431
|
+
"default": "./dist/src/public/experimental/schedules/testing.js"
|
|
432
|
+
},
|
|
433
|
+
"./experimental/schedules": {
|
|
434
|
+
"eve-source": "./src/public/experimental/schedules/index.ts",
|
|
435
|
+
"types": "./dist/src/public/experimental/schedules/index.d.ts",
|
|
436
|
+
"import": "./dist/src/public/experimental/schedules/index.js",
|
|
437
|
+
"default": "./dist/src/public/experimental/schedules/index.js"
|
|
438
|
+
},
|
|
439
|
+
"./experimental/schedules/vercel": {
|
|
440
|
+
"eve-source": "./src/public/experimental/schedules/vercel.ts",
|
|
441
|
+
"types": "./dist/src/public/experimental/schedules/vercel.d.ts",
|
|
442
|
+
"import": "./dist/src/public/experimental/schedules/vercel.js",
|
|
443
|
+
"default": "./dist/src/public/experimental/schedules/vercel.js"
|
|
444
|
+
},
|
|
415
445
|
"./channels": {
|
|
416
446
|
"types": "./dist/src/public/channels/index.d.ts",
|
|
417
447
|
"import": "./dist/src/public/channels/index.js",
|
|
@@ -534,6 +564,7 @@
|
|
|
534
564
|
"@opentelemetry/otlp-transformer": "0.214.0",
|
|
535
565
|
"@opentelemetry/sdk-trace-base": "2.6.1",
|
|
536
566
|
"@photon-ai/chat-adapter-imessage": "3.2.0",
|
|
567
|
+
"@shadcn/registry": "0.1.3",
|
|
537
568
|
"@slack/web-api": "7.19.0",
|
|
538
569
|
"@standard-schema/spec": "1.1.0",
|
|
539
570
|
"@sveltejs/kit": "^2.0.0",
|
|
@@ -545,14 +576,16 @@
|
|
|
545
576
|
"@vercel/detect-agent": "1.2.3",
|
|
546
577
|
"@vercel/oidc": "3.8.0",
|
|
547
578
|
"@vercel/otel": "2.1.3",
|
|
579
|
+
"@vercel/queue": "0.5.1",
|
|
548
580
|
"@vercel/sandbox": "3.3.0",
|
|
581
|
+
"@vercel/schedules": "0.0.0-alpha.11",
|
|
549
582
|
"@vercel/sdk": "1.28.8",
|
|
550
|
-
"@workflow/core": "5.0
|
|
551
|
-
"@workflow/errors": "5.0.
|
|
583
|
+
"@workflow/core": "5.1.0",
|
|
584
|
+
"@workflow/errors": "5.0.2",
|
|
552
585
|
"@workflow/serde": "5.0.0",
|
|
553
|
-
"@workflow/world": "5.0.
|
|
554
|
-
"@workflow/world-local": "5.0.
|
|
555
|
-
"@workflow/world-vercel": "5.0
|
|
586
|
+
"@workflow/world": "5.0.2",
|
|
587
|
+
"@workflow/world-local": "5.0.2",
|
|
588
|
+
"@workflow/world-vercel": "5.1.0",
|
|
556
589
|
"ai": "^7.0.128",
|
|
557
590
|
"chat": "4.41.0",
|
|
558
591
|
"chokidar": "5.0.0",
|
|
@@ -575,7 +608,6 @@
|
|
|
575
608
|
"react-test-renderer": "19.2.6",
|
|
576
609
|
"run": "2.1.2",
|
|
577
610
|
"semver": "7.8.4",
|
|
578
|
-
"shadcn": "4.18.0",
|
|
579
611
|
"svelte": "^5.0.0",
|
|
580
612
|
"turndown": "7.2.4",
|
|
581
613
|
"vite": "^8.3.1",
|
|
@@ -621,6 +653,12 @@
|
|
|
621
653
|
"./self-modification": {
|
|
622
654
|
"dist": "./dist/src/self-modification/extension"
|
|
623
655
|
},
|
|
656
|
+
"./self-modification/local": {
|
|
657
|
+
"dist": "./dist/src/self-modification/extension"
|
|
658
|
+
},
|
|
659
|
+
"./self-modification/remote": {
|
|
660
|
+
"dist": "./dist/src/self-modification/remote"
|
|
661
|
+
},
|
|
624
662
|
"./extensions/code": {
|
|
625
663
|
"dist": "./dist/src/extensions/code/extension"
|
|
626
664
|
},
|
|
@@ -638,7 +676,7 @@
|
|
|
638
676
|
"check:bin-runtime-dependencies": "node ./scripts/check-bin-runtime-dependencies.mjs",
|
|
639
677
|
"dev": "pnpm run build:compiled && node ./scripts/copy-runtime-assets.mjs && tsc -p tsconfig.dev.json --watch --preserveWatchOutput",
|
|
640
678
|
"test": "pnpm run test:unit && pnpm run test:integration",
|
|
641
|
-
"test:
|
|
679
|
+
"test:webchat": "pnpm run build:js && vitest run --config vitest.browser.config.ts",
|
|
642
680
|
"test:framework-fixtures": "pnpm run build:compiled && vitest run --config vitest.framework-fixtures.config.ts",
|
|
643
681
|
"test:integration": "pnpm run build:js && vitest run --config vitest.integration.config.ts",
|
|
644
682
|
"test:scenario": "pnpm run build:compiled && vitest run --config vitest.scenario.config.ts",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-generated by scripts/build-vm-serde-bundle.js
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*
|
|
5
|
-
* This is the VM serialization bundle — a self-contained IIFE that sets up
|
|
6
|
-
* the serialize/deserialize functions inside the QuickJS WASM VM. It
|
|
7
|
-
* includes devalue and all workflow-mode reducers/revivers. (TextEncoder,
|
|
8
|
-
* TextDecoder, and Headers are provided by quickjs-wasi's native C
|
|
9
|
-
* extensions — no JS polyfills are bundled.)
|
|
10
|
-
*
|
|
11
|
-
* Size: 25.6 KB minified
|
|
12
|
-
*/
|
|
13
|
-
export declare const VM_SERDE_BUNDLE: string;
|
|
14
|
-
//# sourceMappingURL=vm-serde-bundle.generated.d.ts.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{s as e,t}from"./rolldown-runtime-B_knIduE.js";function n(e,t,n){return n===1?e:t}var r=t(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),i=e(r(),1);function a(e){if(typeof e==`string`){let t=(0,i.default)(e);if(typeof t!=`number`||t<0)throw Error(`Invalid duration: "${e}". Expected a valid duration string like "1s", "1m", "1h", etc.`);return new Date(Date.now()+t)}if(typeof e==`number`){if(e<0||!Number.isFinite(e))throw Error(`Invalid duration: ${e}. Expected a non-negative finite number of milliseconds.`);return new Date(Date.now()+e)}if(e instanceof Date||e&&typeof e==`object`&&typeof e.getTime==`function`)return e instanceof Date?e:new Date(e.getTime());throw Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`)}const o={USER_ERROR:`USER_ERROR`,RUNTIME_ERROR:`RUNTIME_ERROR`,CORRUPTED_EVENT_LOG:`CORRUPTED_EVENT_LOG`,REPLAY_DIVERGENCE:`REPLAY_DIVERGENCE`,MAX_DELIVERIES_EXCEEDED:`MAX_DELIVERIES_EXCEEDED`,MAX_EVENTS_EXCEEDED:`MAX_EVENTS_EXCEEDED`,REPLAY_TIMEOUT:`REPLAY_TIMEOUT`,STREAM_ERROR:`STREAM_ERROR`,WORLD_CONTRACT_ERROR:`WORLD_CONTRACT_ERROR`,DEPLOYMENT_MISMATCH:`DEPLOYMENT_MISMATCH`};function s(e){return typeof e==`object`&&!!e&&`name`in e&&`message`in e}function c(e,t){if(t.length===0)return e;let n=[e];return t.forEach((e,r)=>{let i=r===t.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;`${e.label}: ${e.value}`.split(`
|
|
2
|
-
`).forEach((e,t)=>{n.push(`${t===0?a:o}${e}`)})}),n.join(`
|
|
3
|
-
`)}function l(e,t){let n=[];return e&&n.push({label:`hint`,value:e}),t&&n.push({label:`docs`,value:`https://workflow-sdk.dev/err/${t}`}),n}const u={NODE_JS_MODULE_IN_WORKFLOW:`node-js-module-in-workflow`,START_INVALID_WORKFLOW_FUNCTION:`start-invalid-workflow-function`,SERIALIZATION_FAILED:`serialization-failed`,WEBHOOK_INVALID_RESPOND_WITH_VALUE:`webhook-invalid-respond-with-value`,WEBHOOK_RESPONSE_NOT_SENT:`webhook-response-not-sent`,FETCH_IN_WORKFLOW_FUNCTION:`fetch-in-workflow`,TIMEOUT_FUNCTIONS_IN_WORKFLOW:`timeout-in-workflow`,HOOK_CONFLICT:`hook-conflict`,HOOK_FORCE_CLAIMED:`hook-force-claimed`,CORRUPTED_EVENT_LOG:`corrupted-event-log`,REPLAY_DIVERGENCE:`replay-divergence`,STEP_NOT_REGISTERED:`step-not-registered`,WORKFLOW_NOT_REGISTERED:`workflow-not-registered`,RUNTIME_DECRYPTION_FAILED:`runtime-decryption-failed`,DEPLOYMENT_MISMATCH:`deployment-mismatch`};var d=class extends Error{cause;constructor(e,t){let n=c(e,l(void 0,t?.slug));super(n,{cause:t?.cause}),t?.cause!==void 0&&(this.cause=t.cause),t?.cause instanceof Error&&(this.stack=`${this.stack}\nCaused by: ${t.cause.stack}`)}static is(e){return s(e)&&e.name===`WorkflowError`}},f=class extends d{status;code;url;retryAfter;field;constructor(e,t){super(e,{cause:t?.cause}),this.name=`WorkflowWorldError`,this.status=t?.status,this.code=t?.code,this.url=t?.url,this.retryAfter=t?.retryAfter,this.field=t?.field}static is(e){return s(e)&&e.name===`WorkflowWorldError`}},p=class extends d{fatal=!0;runId;errorCode;constructor(e,t,n={}){let r=t instanceof Error?t.message:typeof t==`string`?t:t&&typeof t==`object`&&`message`in t?String(t.message):`Unknown error`;super(`Workflow run "${e}" failed: ${r}`,{cause:t}),this.name=`WorkflowRunFailedError`,this.runId=e,n.errorCode!==void 0&&(this.errorCode=n.errorCode)}static is(e){return s(e)&&e.name===`WorkflowRunFailedError`}},m=class extends d{runId;status;constructor(e,t){super(`Workflow run "${e}" has not completed`,{}),this.name=`WorkflowRunNotCompletedError`,this.runId=e,this.status=t}static is(e){return s(e)&&e.name===`WorkflowRunNotCompletedError`}},h=class extends d{constructor(e,t){super(e,{...t}),this.name=`WorkflowRuntimeError`}static is(e){return s(e)&&e.name===`WorkflowRuntimeError`}},g=class extends h{constructor(e,t){super(e,{...t,slug:u.CORRUPTED_EVENT_LOG}),this.name=`CorruptedEventLogError`}static is(e){return s(e)&&e.name===`CorruptedEventLogError`}},_=class extends h{eventId;constructor(e,t){super(e,{...t,slug:u.REPLAY_DIVERGENCE}),this.name=`ReplayDivergenceError`,this.eventId=t.eventId}static is(e){return s(e)&&e.name===`ReplayDivergenceError`&&typeof e.eventId==`string`}},v=class extends d{eventCount;limit;constructor(e,t,n){super(`Workflow exceeded the maximum of ${t} events per run`,n),this.name=`MaxEventsExceededError`,this.eventCount=e,this.limit=t}static is(e){return s(e)&&e.name===`MaxEventsExceededError`}},y=class extends h{constructor(e,t){super(e,{cause:t?.cause,slug:u.RUNTIME_DECRYPTION_FAILED}),this.name=`RuntimeDecryptionError`,t?.context!==void 0&&(this.context=t.context)}static is(e){return s(e)&&e.name===`RuntimeDecryptionError`}},b=class extends d{hint;constructor(e,t){let n=c(e,l(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`WorkflowBuildError`,this.hint=t?.hint}static is(e){return s(e)&&e.name===`WorkflowBuildError`}},x=class extends d{hint;fatal=!0;constructor(e,t){let n=c(e,l(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`SerializationError`,this.hint=t?.hint}static is(e){return s(e)&&e.name===`SerializationError`}},S=class extends h{stepName;constructor(e){super(`Step "${e}" is not registered in the current deployment. This usually indicates a build or bundling issue that caused the step to not be included in the deployment.`,{slug:u.STEP_NOT_REGISTERED}),this.name=`StepNotRegisteredError`,this.stepName=e}static is(e){return s(e)&&e.name===`StepNotRegisteredError`}},C=class extends h{workflowName;constructor(e){super(`Workflow "${e}" is not registered in the current deployment. This usually means a run was started against a deployment that does not have this workflow, or there was a build/bundling issue.`,{slug:u.WORKFLOW_NOT_REGISTERED}),this.name=`WorkflowNotRegisteredError`,this.workflowName=e}static is(e){return s(e)&&e.name===`WorkflowNotRegisteredError`}},w=class extends h{runId;expectedDeploymentId;actualDeploymentId;recoveryAttempts;constructor(e,t,r,i){let a=i?.recoveryAttempts??0,o=a>0?` The runtime re-routed the message to "${t}" ${a} ${n(`time`,`times`,a)} and it kept arriving elsewhere, so the run was stopped to protect against code-skew errors.`:` The run was stopped to protect against code-skew errors.`;super(`Workflow run "${e}" is pinned to deployment "${t}", but was received by deployment "${r}".${o} Verify that the run's deployment is still available and that queue callbacks are routed to it.`,{slug:u.DEPLOYMENT_MISMATCH,cause:i?.cause}),this.name=`WorkflowDeploymentMismatchError`,this.runId=e,this.expectedDeploymentId=t,this.actualDeploymentId=r,this.recoveryAttempts=a}static is(e){return s(e)&&e.name===`WorkflowDeploymentMismatchError`}},T=class extends d{runId;constructor(e){super(`Workflow run "${e}" not found`,{}),this.name=`WorkflowRunNotFoundError`,this.runId=e}static is(e){return s(e)&&e.name===`WorkflowRunNotFoundError`}},E=class extends d{token;conflictingRunId;constructor(e,t){super(`Hook token "${e}" is already in use by another workflow${t?` (run "${t}")`:``}`,{slug:u.HOOK_CONFLICT}),this.name=`HookConflictError`,this.token=e,t!==void 0&&(this.conflictingRunId=t)}static is(e){return s(e)&&e.name===`HookConflictError`}},D=class extends d{token;claimedByRunId;claimedByHookId;constructor(e,t,n){super(`Hook token "${e}" was force-claimed by another workflow (run "${t}")`,{slug:u.HOOK_FORCE_CLAIMED}),this.name=`HookForceClaimedError`,this.token=e,this.claimedByRunId=t,n!==void 0&&(this.claimedByHookId=n)}static is(e){return s(e)&&e.name===`HookForceClaimedError`}},O=class extends d{token;constructor(e){super(`Hook not found`,{}),this.name=`HookNotFoundError`,this.token=e}static is(e){return s(e)&&e.name===`HookNotFoundError`}},k=class extends f{constructor(e){super(e),this.name=`EntityConflictError`}static is(e){return s(e)&&e.name===`EntityConflictError`}},A=class extends f{runId;runStatus;expiredAt;constructor(e,t,n,r){super(e,{status:410,code:`run-expired`}),this.runId=t,this.runStatus=n,this.expiredAt=r,this.name=`RunExpiredError`}static is(e){return s(e)&&e.name===`RunExpiredError`}},j=class extends f{constructor(e,t){super(e,{code:o.STREAM_ERROR,cause:t?.cause,url:t?.url,status:t?.status}),this.name=`StreamError`}static is(e){return s(e)&&e.name===`StreamError`}},M=class extends f{runId;streamId;expiredAt;constructor(e,t,n,r){super(e,{status:410,code:`stream-expired`}),this.runId=t,this.streamId=n,this.expiredAt=r,this.name=`StreamExpiredError`}static is(e){return s(e)&&e.name===`StreamExpiredError`}},N=class extends f{constructor(e,t){super(e,{retryAfter:t?.retryAfter}),this.name=`TooEarlyError`}static is(e){return s(e)&&e.name===`TooEarlyError`}},P=class extends f{retryAfter;constructor(e,t){super(e),this.name=`ThrottleError`,this.retryAfter=t?.retryAfter}static is(e){return s(e)&&e.name===`ThrottleError`}},F=class extends f{details;constructor(e,t){super(e,{status:412,retryAfter:t?.retryAfter}),this.name=`PreconditionFailedError`,this.details=t?.details}static is(e){return s(e)&&e.name===`PreconditionFailedError`}},I=class extends d{fatal=!0;runId;constructor(e){super(`Workflow run "${e}" cancelled`,{}),this.name=`WorkflowRunCancelledError`,this.runId=e}static is(e){return s(e)&&e.name===`WorkflowRunCancelledError`}},L=class extends d{runSpecVersion;worldSpecVersion;constructor(e,t){super(`Run requires spec version ${e}, but world supports version ${t}. Please upgrade 'workflow' package.`),this.name=`RunNotSupportedError`,this.runSpecVersion=e,this.worldSpecVersion=t}static is(e){return s(e)&&e.name===`RunNotSupportedError`}},R=class extends Error{fatal=!0;constructor(e){super(e),this.name=`FatalError`}static is(e){return s(e)?e.name===`FatalError`||e.fatal===!0:!1}},z=class extends Error{retryAfter;constructor(e,t={}){super(e),this.name=`RetryableError`,this.retryAfter=t.retryAfter===void 0?new Date(Date.now()+1e3):a(t.retryAfter)}static is(e){return s(e)&&e.name===`RetryableError`}};const B="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.",V=Symbol.for(`@workflow/errors//FatalError`),H=Symbol.for(`@workflow/errors//RetryableError`),U=Symbol.for(`@workflow/errors//HookConflictError`),W=Symbol.for(`@workflow/errors//HookForceClaimedError`),G=Symbol.for(`@workflow/errors//RuntimeDecryptionError`),K=Symbol.for(`@workflow/errors//StreamError`);typeof globalThis<`u`&&(Object.hasOwn(globalThis,V)||Object.defineProperty(globalThis,V,{value:R,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,H)||Object.defineProperty(globalThis,H,{value:z,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,U)||Object.defineProperty(globalThis,U,{value:E,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,W)||Object.defineProperty(globalThis,W,{value:D,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,G)||Object.defineProperty(globalThis,G,{value:y,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,K)||Object.defineProperty(globalThis,K,{value:j,writable:!1,enumerable:!1,configurable:!1}));export{h as A,w as C,p as D,I as E,n as F,o as M,a as N,m as O,r as P,b as S,C as T,j as _,E as a,N as b,v as c,z as d,A as f,S as g,x as h,R as i,f as j,T as k,F as l,y as m,u as n,D as o,L as p,k as r,O as s,g as t,_ as u,M as v,d as w,B as x,P as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,F as t}from"./dist-CaNNONeg.js";function n(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function r(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}var i=class e extends Error{items;steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,n){let r=[...e.values()],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of r)e.type===`step`?i++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:a++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];i>0&&u.push(`${i} ${t(`step`,`steps`,i)}`),a>0&&u.push(`${a} ${t(`hook`,`hooks`,a)}`),o>0&&u.push(`${o} ${t(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${t(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${t(`disposal`,`disposals`,c)}`);let d=i+a+o+s+c,f=t(`has`,`have`,d),p=+(i>0)+ +(a>0)+ +(o>0)+ +(s>0)+ +(c>0),m;m=p>1?`processed`:i>0?`run`:a>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let h=u.length>0?`${u.join(` and `)} ${f} not been ${m} yet`:`0 steps have not been run yet`;super(h),this.name=`WorkflowSuspension`,this.items=r,this.steps=r,this.globalThis=n,this.stepCount=i,this.hookCount=a,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function a(){throw new e(`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.`)}export{n as i,i as n,r,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,T as t,_t as n,b as r,f as i,ht as a,pt as o,st as s}from"./dist-B7NC1c9-.js";import{B as c,G as l,H as u,L as d,Ln as f,R as p,V as m,Xn as ee,at as h,d as g,er as _,fn as te,n as v,nn as ne,ot as y,rn as re,st as b,tr as x,y as S,yn as ie,z as ae}from"./logger-oqfblE3p.js";import{M as C,j as w,l as oe}from"./dist-CaNNONeg.js";const T=`5.0.1`;function se(){return a(`WORKFLOW_MAX_QUEUE_DELIVERIES`,48,{integer:!0,min:1,max:48})}const E=24e4,D=3e4,O=78e4,k=n(`@workflow/core//envWarnings`,1,()=>({replayTimeoutValues:new Set,maxInlineStepsValues:new Set,maxEventsValues:new Set}));function A(e,t,n){k.replayTimeoutValues.has(e)||(k.replayTimeoutValues.add(e),v.warn(t,n))}function ce(){let e=process.env.WORKFLOW_REPLAY_TIMEOUT_MS;if(!e)return E;let t=Number(e);return!Number.isFinite(t)||t<=0?(A(e,`Ignoring WORKFLOW_REPLAY_TIMEOUT_MS: not a positive finite number; using default`,{raw:e,defaultMs:E}),E):t<3e4?(A(e,`WORKFLOW_REPLAY_TIMEOUT_MS below minimum; clamped`,{raw:e,clampedMs:D,minMs:D}),D):t>78e4?(A(e,`WORKFLOW_REPLAY_TIMEOUT_MS above maximum; clamped`,{raw:e,clampedMs:O,maxMs:O}),O):t}function le(){return a(`WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`,3,{integer:!0})}function ue(){let e=process.env.WORKFLOW_MAX_INLINE_STEPS;if(!e)return 3;let t=Number(e);return!Number.isInteger(t)||t<=0?(k.maxInlineStepsValues.has(e)||(k.maxInlineStepsValues.add(e),v.warn(`Ignoring WORKFLOW_MAX_INLINE_STEPS: not a positive integer; using default`,{raw:e,defaultValue:3})),3):t<1?1:t>16?(k.maxInlineStepsValues.has(e)||(k.maxInlineStepsValues.add(e),v.warn(`WORKFLOW_MAX_INLINE_STEPS above maximum; clamped`,{raw:e,clampedValue:16,maxValue:16})),16):t}const de=131072;function fe(){return process.env.WORKFLOW_RESILIENT_STEP_DISPATCH===`1`}function pe(){let e=process.env.WORKFLOW_BATCH_TRANSITIONS;return e===void 0||e===``||e!==`0`&&e.toLowerCase()!==`false`}function me(){let e=process.env.WORKFLOW_MAX_EVENTS_OVERRIDE;if(!e)return;let t=Number(e);if(!Number.isInteger(t)||t<=0){k.maxEventsValues.has(e)||(k.maxEventsValues.add(e),v.warn(`Ignoring WORKFLOW_MAX_EVENTS_OVERRIDE: not a positive integer; using server limit`,{raw:e}));return}return t}function j(){let e=process.env.WORKFLOW_OPTIMISTIC_INLINE_START;return e===void 0||e===``?!1:e===`1`||e.toLowerCase()===`true`}function M(){let e=process.env.WORKFLOW_OPTIMISTIC_INLINE_START;return e===void 0||e===``?!1:e===`0`||e.toLowerCase()===`false`}function N(){let e=process.env.WORKFLOW_TURBO;return e===void 0||e===``||e!==`0`&&e.toLowerCase()!==`false`}function P(){let e=process.env.WORKFLOW_RETAINED_VM;return e===void 0||e===``||e!==`0`&&e.toLowerCase()!==`false`}const F=`WORKFLOW_EXPERIMENTAL_DYNAMIC_WORKFLOWS`;function I(){let e=process.env[F];return e===void 0?!1:e===`1`||e.toLowerCase()===`true`}function L(){let e=process.env.WORKFLOW_INLINE_OWNERSHIP;return e===void 0||e===``||e!==`0`&&e.toLowerCase()!==`false`}function R(){return a(`WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`,860,{integer:!0,min:1,max:900})}function z(){return a(`WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`,3,{integer:!0})}function he(){return a(`WORKFLOW_OPEN_WAIT_CLOCK_SKEW_MS`,3e4,{integer:!0})}function ge(){return a(`WORKFLOW_PRECONDITION_MAX_INPROCESS_RESTARTS`,3,{integer:!0})}function _e(){return a(`WORKFLOW_PRECONDITION_MAX_REINVOCATIONS`,5,{integer:!0})}function ve(){return a(`WORKFLOW_PRECONDITION_REINVOKE_DELAY_SECONDS`,2,{integer:!0})}function ye(){return a(`WORKFLOW_DEPLOYMENT_MISMATCH_MAX_RETRIES`,3,{integer:!0,min:0})}const be=/^[a-zA-Z0-9_\-./@()[\]]+$/;function xe(n,r){if(!be.test(n))throw Error(`Invalid workflow name "${n}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, at signs, parentheses, or square brackets`);return`${t(`workflow`,e(r))}${n}`}const Se=o();function B(e){return`__health_check__${e}`}const Ce=1;function we(e){let t=r.safeParse(e);if(t.success)return t.data}function V(e){return`wrun_hc_${e}`}async function Te(e,t){let n=await x(),r=B(e.correlationId),i;if(e.runId)try{let t=await n.getEncryptionKeyForRun?.(e.runId);t&&(i=ee((await _(t)).publicKey))}catch(t){v.warn(`Health check could not derive a run public key; the caller will fall back to a key lookup`,{correlationId:e.correlationId,error:t instanceof Error?t.message:String(t)})}let a=JSON.stringify({healthy:!0,correlationId:e.correlationId,specVersion:t??8,workflowCoreVersion:T,hookResumeInputVersion:1,...I()?{dynamicWorkflowVersion:1}:{},...i?{encryptionPublicKey:i}:{},timestamp:Date.now()}),o=V(e.correlationId);await n.streams.write(o,r,a),await n.streams.close(o,r)}function Ee(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 De(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 Oe(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,format:`text`}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy,format:`json`};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),typeof o.encryptionPublicKey==`string`&&(s.encryptionPublicKey=o.encryptionPublicKey),typeof o.hookResumeInputVersion==`number`&&(s.hookResumeInputVersion=o.hookResumeInputVersion),typeof o.dynamicWorkflowVersion==`number`&&(s.dynamicWorkflowVersion=o.dynamicWorkflowVersion),s}async function ke(n,r){let i=r?.timeout??3e4,a=n.createRunId?.()??Se(),o=B(a),s=`${t(`workflow`,e(r?.namespace))}health_check`,c=Date.now();try{for(await n.queue(s,{__healthCheck:!0,correlationId:a,...r?.runId?{runId:r.runId}:{}},{specVersion:1,deploymentId:r?.deploymentId});Date.now()-c<i;)try{let e=i-(Date.now()-c),t=(await Ee(n.streams.get(V(a),o),e)).getReader(),{chunks:r,timedOut:s}=await De(t,500);if(s){try{t.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=Oe(r);if(l)return{...l,latencyMs:Date.now()-c};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${i}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function H(e,t){return new w(`Event pagination ${t} for workflow run "${e}".`,{code:C.WORLD_CONTRACT_ERROR})}function Ae(e,t,n){if(t){if(n.has(t))throw H(e,`did not advance`);n.add(t)}}function U(e,t,n){if(t.length===0)return;let r=n??new Set(e.map(e=>e.eventId));for(let n of t)r.has(n.eventId)||(r.add(n.eventId),e.push(n))}function je(e,t){let n=e.length;for(;n>0;){let r=e[n-1];if(r.eventId===t.eventId)return;if(r.eventId<t.eventId)break;n--}e.splice(n,0,t)}function Me(e,t,n,r){if(t){if(n===null)throw H(e,`returned more pages without a cursor`);if(r.has(n))throw H(e,`repeated a cursor`)}}function Ne(e,t,n){return t!==null&&!n&&w.is(e)&&e.status===400}const W=`skip-step-inputs`;function Pe(e){return e?.sinceCursor===void 0?e:{resolveData:W,...e}}async function G(e,t){let n=t!==void 0;return S(`workflow.replay.load`,async r=>{r?.setAttributes({...ie(e),...te(n?`events_list_incremental`:`events_list`)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await x(),f=Date.now();for(;c;){let t=Date.now(),r=s;Ae(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0},resolveData:W})}catch(t){if(Ne(t,r,u)){v.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}U(i,f.data,a),c=f.hasMore,Me(e,c,f.cursor,o),s=f.cursor??s,l++,v.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return v.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...ne(i.length),...re(l)}),{events:i,cursor:s}})}function Fe(e,t){U(e.events,t.events),e.cursor=t.cursor??e.cursor}function Ie(){return process.env.WORKFLOW_SLOT_GAP_CHECK!==`0`}function K(e,t){let n=e.length;U(e,t);let r=e.length-n;return r>0&&e.sort((e,t)=>e.eventId<t.eventId?-1:+(e.eventId>t.eventId)),r}function Le(e,t){let n=t.events?.length??0;return n===0?{added:0,offered:0,truncated:!1}:t.hasMore===!0?{added:0,offered:n,truncated:!0}:{added:K(e,t.events??[]),offered:n,truncated:!1}}function q(e){let t;for(let n of e){let e=i(n.eventId);(t===void 0||e>t)&&(t=e)}return t}function J(e){let t=new Set,n=0;for(let r of e){let e=i(r.eventId);t.add(e),e>n&&(n=e)}if(n===0)return;let r=t.has(1)?1:2;if(t.size===n-r+1)return;let a,o=0;for(let e=r;e<=n;e++)t.has(e)||(a??=e,o++);if(a!==void 0)return{firstMissingSlot:a,missingCount:o,maxSlot:n}}const Re=3;async function Y(e,t){let n=t,r=J(n.events);for(let t=0;r!==void 0&&t<3;t++)await new Promise(e=>setTimeout(e,25*2**t)),n=await G(e),r=J(n.events);return{log:n,gap:r}}function ze(e){let t=q(e);return t===void 0?{}:{eventCount:t}}function Be(e,t){if(!oe.is(e))return null;let n=e.details;if(typeof n!=`object`||!n)return null;let{events:r,cursor:i}=n;if(!Array.isArray(r)||r.length===0)return null;for(let e of r)if(typeof e!=`object`||!e||typeof e.eventId!=`string`||e.runId!==t)return null;return{events:r,cursor:typeof i==`string`?i:null}}const X={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function Ve(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:X}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??8,workflowCoreVersion:T}),{status:200,headers:{"Content-Type":`application/json`,...X}}):await e(n)}}function Z(e,t){return e?.[s]??t}function He(e){return{deploymentId:e.deploymentId,specVersion:e.specVersion??0,...e.startedAt?{startedAt:+e.startedAt}:{},rootRunId:Z(e.attributes,e.runId)}}function Ue(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function We(e,t){return`${e}:${Ue(t)}`}async function Q(e,...t){let n=t[0];await S(`queue.publish`,{attributes:{...m(`vercel-queue`),...p(n),...c(`publish`),...u(`vercel-queue`),...b(`vercel-queue`),...y(`vqs`),...h(`publish`)},kind:await g(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(ae(r))})}async function Ge(e,t,n){if(n.length===0)return;let r=e.queueBatch?.bind(e);if(!r){await Promise.all(n.map(n=>Q(e,t,n.message,n.opts)));return}await S(`queue.publish`,{attributes:{...m(`vercel-queue`),...p(t),...c(`publish`),...d(n.length),...u(`vercel-queue`),...b(`vercel-queue`),...y(`vqs`),...h(`publishBatch`)},kind:await g(`PRODUCER`)},async()=>{let e=await r(t,n);if(e.length!==n.length)throw Object.assign(Error(`Queue batch for ${t} returned ${e.length} result(s) for ${n.length} message(s)`),{retryable:!0});let i=e.filter(e=>e.error!==void 0);if(i.length===0)return;let a=i.some(e=>e.error!==void 0&&e.retryable),o=Error(`Failed to publish ${i.length} of ${n.length} queue message(s) to ${t}: ${i[0]?.error}`);throw Object.assign(o,{retryable:a}),o})}function Ke(e){if(e.requestedAt)try{return l(Date.now()-e.requestedAt.getTime())}catch{return}}async function $(e,t,n){let r=typeof t==`string`?await e.getEncryptionKeyForRun?.(t,n):await e.getEncryptionKeyForRun?.(t);return r?await f(r):void 0}function qe(e,t){let n;return()=>(n||=$(e,t),n)}export{F as A,ve as B,Z as C,We as D,ze as E,ue as F,I as G,le as H,se as I,M as J,L as K,he as L,ye as M,R as N,Ve as O,me as P,T as Q,ge as R,$ as S,Y as T,ce as U,z as V,pe as W,N as X,fe as Y,P as Z,K as _,Fe as a,Q as b,Ke as c,ke as d,je as f,qe as g,q as h,Le as i,de as j,Pe as k,xe as l,G as m,W as n,U as o,Ie as p,j as q,Re as r,J as s,Ce as t,Te as u,we as v,He as w,Ge as x,Be as y,_e as z};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{_t as e}from"./dist-B7NC1c9-.js";import{A as t,m as n}from"./dist-CaNNONeg.js";import{n as r,r as i}from"./global-DKbOgrts.js";function a(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function o(e){return a(`workflow`,e)}function s(e){return a(`step`,e)}function c(e){return p(s(e),e)}function l(e){return p(o(e),e)}function u(e){return o(e)?.shortName??f(`workflow`,e)??e}function d(e){return s(e)?.shortName??f(`step`,e)??e}function f(e,t){if(!t.startsWith(`${e}--`))return null;let n=t.split(`--`).filter(Boolean),r=n.at(-1)?.split(`-`).filter(Boolean).at(-1)??``;if([`default`,`__default`].includes(r)){let t=n.at(-2)?.split(`-`).filter(Boolean).at(-1);t&&t!==e&&(r=t)}return r||null}function p(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}async function m(e,n=[`encrypt`,`decrypt`]){if(e.byteLength!==32)throw new t(`Encryption key must be exactly 32 bytes, got ${e.byteLength}`);return globalThis.crypto.subtle.importKey(`raw`,e,`AES-GCM`,!1,n)}async function h(e,t,r){let i=globalThis.crypto.getRandomValues(new Uint8Array(12)),a;try{a=await globalThis.crypto.subtle.encrypt({name:`AES-GCM`,iv:i,tagLength:128,...r?{additionalData:r}:{}},e,t)}catch(e){throw new n(`AES-256-GCM encryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`encrypt`,byteLength:t.byteLength}})}let o=new Uint8Array(12+a.byteLength);return o.set(i,0),o.set(new Uint8Array(a),12),o}async function g(e,t,r){if(t.byteLength<28)throw new n(`Encrypted data too short: expected at least 28 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let i=t.subarray(0,12),a=t.subarray(12),o;try{o=await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:i,tagLength:128,...r?{additionalData:r}:{}},e,a)}catch(e){let r=e instanceof Error?e.message:String(e);throw new n(`AES-256-GCM decryption failed: ${r}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return new Uint8Array(o)}function _(e){let n=e.specVersion;if(!(n!=null&&n>=6&&n<=8))throw new t(`This Workflow runtime supports Worlds with spec version 6 through 8, but the configured World declares spec version ${n??`none`}. Install a World package version compatible with the current Workflow runtime.`)}const v=Symbol.for(`@workflow/world//cache`),y=Symbol.for(`@workflow/world//cachePromise`),ee=Symbol.for(`@workflow/world//getWorldFn`);async function te(){let e=globalThis;if(e[v])return _(e[v]),e[v];if(e[y])return e[v]=await e[y],_(e[v]),e[v];let t=e[ee];if(t){let e=await t();return _(e),e}throw Error("Workflow world runtime was not initialized. Import from the host workflow entrypoints (`workflow`, `workflow/api`, or `workflow/runtime`) so @workflow/core/runtime/world-init can register getWorld before getWorldLazy() is used.")}const b=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),ne=new TextEncoder;function re(e){if(e.byteLength!==32)throw new t(`Run key material must be exactly 32 bytes, got ${e.byteLength}`)}function ie(e,n){if(e.byteLength!==32)throw new t(`${n} must be exactly 32 bytes, got ${e.byteLength}`)}async function ae(e){re(e);let t=await globalThis.crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),n=await globalThis.crypto.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:ne.encode(`workflow/encp/x25519/v1`)},t,256),r=new Uint8Array(n);return{scalar:r,publicKey:await oe(r)}}async function oe(e){let n=await x(e,!0),r=await globalThis.crypto.subtle.exportKey(`jwk`,n);if(!r.x)throw new t(`X25519 JWK export did not include a public key component ("x")`);let i=le(r.x);if(i.byteLength!==32)throw new t(`X25519 JWK export produced a ${i.byteLength}-byte public key, expected 32`);return i}async function x(e,t){let n=new Uint8Array(b.length+e.byteLength);return n.set(b,0),n.set(e,b.length),globalThis.crypto.subtle.importKey(`pkcs8`,n,{name:`X25519`},t,[`deriveBits`])}function S(e){return globalThis.crypto.subtle.importKey(`raw`,e,{name:`X25519`},!0,[])}const C=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function se(e){let t=``;for(let n=0;n<e.length;n+=3){let r=e[n],i=n+1<e.length?e[n+1]:0,a=n+2<e.length?e[n+2]:0;t+=C[r>>2&63],t+=C[(r&3)<<4|i>>4&15],t+=n+1<e.length?C[(i&15)<<2|a>>6&3]:`=`,t+=n+2<e.length?C[a&63]:`=`}return t}function ce(e){let t=e.length;for(;t>0&&e[t-1]===`=`;)t--;let n=e.slice(0,t);if(n.includes(`=`)||n.length%4==1||t!==e.length&&e.length%4!=0)return;let r=0,i=0,a=[];for(let e=0;e<n.length;e++){let t=C.indexOf(n[e]);if(t===-1)return;r=r<<6|t,i+=6,i>=8&&(i-=8,a.push(r>>i&255))}if(!(i>0&&r&(1<<i)-1))return new Uint8Array(a)}function le(e){let n=0,r=0,i=[];for(let a=0;a<e.length;a++){let o=e[a];if(o===`=`)break;let s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`.indexOf(o);if(s===-1)throw new t(`Invalid base64url character "${o}" in X25519 JWK key component`);n=n<<6|s,r+=6,r>=8&&(r-=8,i.push(n>>r&255))}return new Uint8Array(i)}async function w(e,t,n,r){let i=ne.encode(`workflow/encp/aes256gcm/v1`),a=new Uint8Array(i.length+t.length+n.length);a.set(i,0),a.set(t,i.length),a.set(n,i.length+t.length);let o=await globalThis.crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),s=await globalThis.crypto.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:a},o,256);return globalThis.crypto.subtle.importKey(`raw`,new Uint8Array(s),`AES-GCM`,!1,r)}async function T(e){ie(e,`Recipient public key`);let n;try{n=await S(e)}catch(e){throw new t(`Invalid X25519 recipient public key: ${e instanceof Error?e.message:String(e)}`,{cause:e})}let r=await globalThis.crypto.subtle.generateKey({name:`X25519`},!0,[`deriveBits`]),i=new Uint8Array(await globalThis.crypto.subtle.exportKey(`raw`,r.publicKey)),a;try{a=await globalThis.crypto.subtle.deriveBits({name:`X25519`,public:n},r.privateKey,256)}catch(e){throw new t(`X25519 key agreement failed: the recipient public key is not a valid curve point (low-order point or corrupted key material)`,{cause:e})}return{ephemeralPublicKey:i,contentKey:await w(new Uint8Array(a),i,e,[`encrypt`])}}async function ue(e,t){if(t.byteLength!==32)throw new n(`Sealed payload has a malformed ephemeral public key: expected 32 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let r;try{let[n,i]=await Promise.all([x(e.scalar,!1),S(t)]);r=await globalThis.crypto.subtle.deriveBits({name:`X25519`,public:i},n,256)}catch(e){throw new n(`X25519 key agreement failed while opening a sealed payload: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return w(new Uint8Array(r),t,e.publicKey,[`decrypt`])}async function de(e,t,n){let{ephemeralPublicKey:r,contentKey:i}=await T(e),a=await h(i,t,n),o=new Uint8Array(r.byteLength+a.byteLength);return o.set(r,0),o.set(a,r.byteLength),o}async function fe(e,t,r){if(t.byteLength<60)throw new n(`Sealed payload too short: expected at least 60 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let i=t.subarray(0,32),a=t.subarray(32);return g(await ue(e,i),a,r)}function pe(e,t){let n;return{async seal(r){n??=T(e);let{ephemeralPublicKey:i,contentKey:a}=await n,o=await h(a,r,t),s=new Uint8Array(i.byteLength+o.byteLength);return s.set(i,0),s.set(o,i.byteLength),s}}}function me(e,t){let r,i;return{async open(a){if(a.byteLength<60)throw new n(`Sealed payload too short: expected at least 60 bytes, got ${a.byteLength}`,{context:{operation:`decrypt`,byteLength:a.byteLength}});let o=a.subarray(0,32),s=a.subarray(32),c=he(o);(c!==r||!i)&&(r=c,i=ue(e,o));let l;try{l=await i}catch(e){throw r=void 0,i=void 0,e}return g(l,s,t)}}}function he(e){let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return t}function ge(e){if(!e)return;let t=ce(e);if(t&&t.byteLength===32)return t}function E(e){return e.length===4&&/^[a-z0-9]{4}$/.test(e)}const D={DEVALUE_V1:`devl`,ENCRYPTED:`encr`,SEALED:`encp`,GZIP:`gzip`,ZSTD:`zstd`},_e=new TextEncoder,ve=new TextDecoder;function O(e,t){if(!(t instanceof Uint8Array))return t;let n=_e.encode(e),r=new Uint8Array(4+t.length);return r.set(n,0),r.set(t,4),r}function k(e){if(!(e instanceof Uint8Array)||e.length<4)return null;let t=e.subarray(0,4),n=ve.decode(t);return E(n)?n:null}function ye(e){return k(e)===D.ENCRYPTED}function A(e){if(!(e instanceof Uint8Array))return{format:D.DEVALUE_V1,payload:new TextEncoder().encode(JSON.stringify(e))};if(e.length<4)throw Error(`Data too short to contain format prefix: expected at least 4 bytes, got ${e.length}`);let t=e.subarray(0,4),n=ve.decode(t);if(!E(n))throw Error(`Invalid format prefix: "${n}". Must be 4 characters of [a-z0-9].`);return{format:n,payload:e.subarray(4)}}const j=Symbol.for(`workflow.serialization.sealTarget`),M=Symbol.for(`workflow.serialization.runKeys`);function be(e,t){return{[j]:!0,recipientPublicKey:e,aad:t}}function N(e,t,n){return{[M]:!0,aes:e,keyPair:t,aad:n}}async function xe(e){let[t,n]=await Promise.all([m(e),ae(e)]);return N(t,n)}function P(e){return typeof e==`object`&&!!e&&e[j]===!0}function F(e){return typeof e==`object`&&!!e&&e[M]===!0}function Se(e){if(e){if(F(e))return e.aes;if(!P(e))return e}}async function Ce(e){return typeof e==`function`?e():e}async function we(e,t){if(!t||!(e instanceof Uint8Array))return e;if(P(t)){let n=await de(t.recipientPublicKey,e,t.aad);return O(D.SEALED,n)}let n=await h(F(t)?t.aes:t,e);return O(D.ENCRYPTED,n)}async function Te(e,t){if(!F(t))throw new n(`Sealed data encountered but no run keypair is available. Opening a sealed payload requires the run's own encryption key material; a symmetric key or a seal-only target cannot decrypt it.`,{context:{operation:`decrypt`,byteLength:e.byteLength,formatPrefix:`encp`}});let{payload:r}=A(e);try{return await fe(t.keyPair,r,t.aad)}catch(e){throw n.is(e)&&e.context&&(e.context.formatPrefix=D.SEALED),e}}async function Ee(e,t){if(!(e instanceof Uint8Array))return e;let r=k(e);if(r===D.SEALED)return Te(e,t);if(r!==D.ENCRYPTED)return e;let i=Se(t);if(!i)throw new n(`Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:e.byteLength,formatPrefix:`encr`}});let{payload:a}=A(e);try{return await g(i,a)}catch(e){throw n.is(e)&&e.context&&(e.context.formatPrefix=r),e}}const De=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:!e.env.NO_COLOR&&!!e.stdout?.isTTY:!1})(),I=(e,t)=>n=>De?`\x1b[${e}m${n}\x1b[${t}m`:n,L={bold:I(1,22),dim:I(2,22),italic:I(3,23),red:I(31,39),blue:I(34,39),cyan:I(36,39),yellow:I(33,39),magenta:I(35,39)},Oe={info:L.blue,help:L.cyan,warn:L.yellow,error:L.red};function ke(e){let t=Array.isArray(e)?e.join(`
|
|
2
|
-
`):e;return Oe.info(`${L.bold(`hint:`)} ${t}`)}function Ae(e){return Oe.info(`${L.bold(`docs:`)} ${e}`)}function je(e){return L.italic(`${L.dim("`")}${e}${L.dim("`")}`)}function R(e){return L.dim(e)}function Me(e){return L.bold(e)}function Ne(e){return L.red(e)}function Pe(e){return L.magenta(e)}function Fe(e,t){let n=[e];return t.forEach((e,r)=>{let i=e.split(`
|
|
3
|
-
`),a=r===t.length-1,o=a?`╰▶ `:`├▶ `,s=a?` `:`│ `,c=i.map((e,t)=>`${t===0?o:s}${e}`);n.push(...c)}),n.join(`
|
|
4
|
-
`)}function Ie(e,t,n){let[r,...i]=t.split(`
|
|
5
|
-
`),a=i.join(`
|
|
6
|
-
`),o=a.trim()?a:z(n??{},`errorStack`)??``,s=Le(r??``,o,n),c=Re(o),l=[`${e} ${r??``}`];return s&&l.push(s),c&&l.push(c),l.join(`
|
|
7
|
-
`)}function Le(e,t,n){if(!n||Object.keys(n).length===0)return null;let r=new Set;r.add(`errorStack`);let i=z(n,`errorMessage`);i&&(e.includes(i)||t.includes(i))&&r.add(`errorMessage`);let a=new Set([`workflowRunId`,`workflowName`,`stepId`,`stepName`,`errorAttribution`,`errorCode`,`errorName`,`errorMessage`,`errorStack`,`errorCause`,`hint`,`attempt`,`retryCount`]),o=[],s=z(n,`errorName`),u=z(n,`errorAttribution`),d=s!==null&&Be(t,s);if(u||s&&!d){let e=u?u===`sdk`?Pe(`sdk error`):Ne(`user error`):``,t=s?Me(s):``,n=e&&t?R(` · `):``;o.push(` ${e}${n}${t}`)}let f=z(n,`workflowRunId`),p=z(n,`workflowName`);f?o.push(V(`run`,f,p,l)):p&&o.push(V(`run`,null,p,l));let m=z(n,`stepId`),h=z(n,`stepName`);if((m||h)&&o.push(V(`step`,m,h,c)),n.attempt!==void 0||n.retryCount!==void 0){let e=n.attempt,t=n.retryCount;e!==void 0&&t!==void 0?o.push(` ${B(`retry`)} ${e} ${R(`attempts ·`)} ${t} ${R(`max retries`)}`):e!==void 0&&o.push(` ${B(`retry`)} ${e} ${R(`attempts`)}`)}let g=z(n,`errorCode`);g&&g!==s&&o.push(` ${B(`code`)} ${R(g)}`),i&&!r.has(`errorMessage`)&&o.push(` ${B(`error`)} ${H(i)}`);let _=z(n,`errorCause`);_&&!t.includes(_)&&o.push(` ${B(`cause`)} ${H(_)}`);let v=z(n,`hint`);v&&o.push(` ${ke(v)}`);let y=Object.entries(n).filter(([e,t])=>!a.has(e)&&!r.has(e)&&t!=null).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of y)o.push(` ${B(e)} ${H(t)}`);return o.length?o.join(`
|
|
8
|
-
`):null}function Re(e){if(!e)return null;let t=e.split(`
|
|
9
|
-
`),n=[],r=0,i=0,a=0,o=()=>{r>0&&(n.push(R(` … ${r} more ${r===1?`frame`:`frames`} in framework internals`)),r=0)};for(let e of t){let t=e.trimStart().startsWith(`at `);if(t&&ze(e)){r++;continue}if(t&&i>=6){a++;continue}o(),n.push(e),t&&i++}return o(),a>0&&n.push(R(` … ${a} more ${a===1?`frame`:`frames`} (run \`pnpm wf inspect run <id>\` for the full stack)`)),n.join(`
|
|
10
|
-
`)}function ze(e){let t=e.trimStart();return t.startsWith(`at `)?!!(t.includes(`node:internal/`)||t.includes(`node_modules/.pnpm/`)||t.includes(`node_modules__pnpm_`)||t.includes(`_next_dist_`)||t.includes(`node_modules/next/`)||t.includes(`node_modules/@opentelemetry/`)||t.includes(`node_modules/vitest/`)||t.includes(`node_modules/@vitest/`)):!1}function Be(e,t){let n=e.split(`
|
|
11
|
-
`,1)[0]?.trim()??``;return n===t||n.startsWith(`${t}:`)}function z(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function B(e){return R(e.padEnd(6))}function V(e,t,n,r){let i=t||R(`—`),a=n&&(e===`run`?o(n):s(n))?`${R(`·`)} ${r(n)}`:``;return` ${B(e)} ${i}${a?` `+a:``}`}function H(e){if(typeof e==`string`)return e.includes(`
|
|
12
|
-
`)?e.split(`
|
|
13
|
-
`).map((e,t)=>t===0?e:` ${e}`).join(`
|
|
14
|
-
`):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function U(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const Ve=U(`workflow.name`),He=U(`workflow.operation`),Ue=U(`workflow.run.id`),We=U(`workflow.run.status`),Ge=U(`workflow.started_at`),Ke=U(`workflow.events.count`),qe=U(`workflow.execution.mode`),Je=U(`workflow.dynamic`),Ye=U(`workflow.dynamic.source_hash`),Xe=U(`workflow.dynamic.code_bytes`),Ze=U(`workflow.dynamic.code_storage`),Qe=U(`workflow.bundle.compile.cache_hit`),$e=U(`workflow.replay.load.source`),et=U(`workflow.events.parked.count`),tt=U(`workflow.events.parked.event_id`),nt=U(`workflow.events.parked.event_type`),rt=U(`workflow.arguments.count`),it=U(`workflow.result.type`),at=U(`workflow.trace.propagated`),ot=U(`workflow.trace.mode`),st=U(`workflow.turbo`),ct=U(`workflow.error.name`),lt=U(`workflow.error.message`),ut=U(`workflow.error.code`),dt=U(`workflow.steps.created`),ft=U(`workflow.hooks.created`),pt=U(`workflow.waits.created`),mt=U(`workflow.steps.failed_serialization`),ht=U(`workflow.inline_ownership.owned_recovery_steps`),gt=U(`workflow.inline_ownership.backstop_wakes_armed`),_t=U(`workflow.dispatch.republish_skipped`),vt=U(`workflow.route.type`),yt=U(`workflow.route.handler_cached`),bt=U(`workflow.route.invocation_count`),xt=U(`workflow.route.entrypoint_age_ms`),St=U(`workflow.route.module_body_init_ms`),Ct=U(`faas.instance`),wt=U(`step.name`),Tt=U(`step.id`),Et=U(`step.attempt`),Dt=U(`step.status`),Ot=U(`step.max_retries`),kt=U(`step.ttfs_ms`),At=U(`step.stso_ms`),jt=U(`step.rsfs_ms`),Mt=U(`step.final_scheduling_replay_ms`),Nt=U(`step.latency_optimizations`),Pt=U(`workflow.step_start.strategy`),Ft=U(`step.skipped`),It=U(`step.skip_reason`),Lt=U(`step.arguments.count`),Rt=U(`step.result.type`),zt=U(`step.error.name`),Bt=U(`step.error.message`),Vt=U(`step.fatal_error`),Ht=U(`step.retry.exhausted`),Ut=U(`step.retry.timeout_seconds`),Wt=U(`step.retry.will_retry`),Gt=U(`messaging.system`),Kt=U(`messaging.destination.name`),qt=U(`messaging.message.id`),Jt=U(`messaging.operation.type`),Yt=U(`messaging.batch.message_count`),Xt=U(`workflow.queue.overhead_ms`),Zt=U(`deployment.id`),Qt=U(`workflow.deployment.pinned_id`),$t=U(`workflow.deployment_mismatch.retry_count`),en=U(`workflow.deployment_mismatch.recovered`),tn=U(`workflow.run.spec_version`),nn=U(`workflow.run.spec_version_source`),rn=U(`workflow.capability_probe.latency_ms`),an=U(`workflow.capability_probe.cached`),on=U(`workflow.capability_probe.error`),sn=U(`workflow.hook.token`),cn=U(`workflow.hook.id`),ln=U(`workflow.hook.found`),un=U(`workflow.hook.resume_committed`),dn=U(`workflow.hook.wake_published`),fn=U(`workflow.hook.resilient_resume_materialized`),pn=U(`workflow.resume_setup_source`),mn=U(`workflow.step.resilient_dispatch_recovered`),hn=U(`workflow.step.resilient_dispatch_materialized`),gn=U(`workflow.step.dispatch_prologue`),_n=U(`workflow.resume.total_ms`),vn=U(`workflow.resume.phase.producer_prep_ms`),yn=U(`workflow.resume.phase.queue_delivery_ms`),bn=U(`workflow.resume.phase.resume_setup_ms`),xn=U(`workflow.resume.phase.replay_ms`),Sn=U(`workflow.resume.phase.step_dispatch_ms`),Cn=U(`workflow.resume.phase.step_claim_ms`),wn=U(`workflow.resume.phase.step_prepare_ms`),Tn=U(`workflow.resume.trigger`),En=U(`workflow.resume.strategy`),Dn=U(`workflow.resume.setup_source`),On=U(`workflow.resume.step_execution`),kn=U(`workflow.suspension.state`),An=U(`workflow.suspension.hook_count`),jn=U(`workflow.suspension.step_count`),Mn=U(`workflow.suspension.wait_count`),Nn=U(`http.request.method`),Pn=U(`http.route`),Fn=U(`http.response.status_code`),In=U(`error.type`),Ln=U(`workflow.events.pages_loaded`),Rn=U(`workflow.queue.deserialize_time_ms`),zn=U(`workflow.queue.execution_time_ms`),Bn=U(`workflow.queue.serialize_time_ms`),Vn=U(`workflow.serialization.operation`),Hn=U(`workflow.serialization.compressed`),Un=U(`workflow.serialization.codec`),Wn=U(`workflow.serialization.uncompressed_bytes`),Gn=U(`workflow.serialization.stored_bytes`),Kn=U(`workflow.serialization.compression_ratio`),qn=U(`workflow.serialization.guest_code_executions`),Jn=U(`workflow.serialization.guest_code_details`),Yn=U(`peer.service`),Xn=U(`rpc.system`),Zn=U(`rpc.service`),Qn=U(`rpc.method`),$n=U(`error.retryable`),er=U(`error.category`),W=e(`@workflow/core//traceModeWarnings`,1,()=>({unrecognized:new Set}));function tr(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!W.unrecognized.has(e)&&(W.unrecognized.add(e),$.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function G(e){return e!==void 0&&Object.keys(e).length>0}function nr(e,t){return e===`linked`&&G(t)?Promise.resolve(t):K()}async function rr(e,t){if(e!==`linked`)return vr();let n=await yr(G(t)?t:void 0);return n?[n]:void 0}async function K(){let e=await J.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function q(e){let t=await J.value;if(t)return t.propagation.extract(t.context.active(),e)}async function ir(e,t){if(!e)return t();let n=await J.value;if(!n)return t();let r=await q(e);return r?n.context.with(r,async()=>await t()):t()}const J=i(async()=>{try{return await import(`../../@opentelemetry/api/index.js`)}catch{return $.info(`OpenTelemetry not available, tracing will be disabled`),null}}),Y=i(async()=>{let e=await J.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return cr(e,t),t}),ar=i(async()=>{let e=await J.value;return e?e.metrics.getMeter(`workflow`).createHistogram(`workflow.step.execute.duration`,{description:`Duration of user step execution`,unit:`ms`}):null});let or=!1;function sr(e){try{return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:String(e)}catch{return`Unknown error`}}function cr(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!or&&n){or=!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 lr(e,...t){let[n,i]=await Promise.all([Y.value,J.value]),{fn:a,opts:o}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!a)throw Error(`Function to trace must be provided`);return!n||!i?await a():n.startActiveSpan(e,o,async e=>{try{let t=await a(e);return e.setStatus({code:i.SpanStatusCode.OK}),t}catch(t){throw r.is(t)?(e.setStatus({code:i.SpanStatusCode.OK}),X(t,e)):e.setStatus({code:i.SpanStatusCode.ERROR,message:sr(t)}),t}finally{e.end()}})}async function ur(e){let[t,n]=await Promise.all([Y.value,J.value]);if(!t||!n)return{end(){},fail(){}};let r=t.startSpan(e),i=!1,a=e=>{i||(i=!0,r.setStatus(e),r.end())};return{end:()=>a({code:n.SpanStatusCode.OK}),fail:e=>a({code:n.SpanStatusCode.ERROR,message:sr(e)})}}async function dr(e){let t=await J.value;return t?t.context.bind(t.context.active(),e):e}async function fr(){let e=await J.value;if(!e)return{refresh(){},run:e=>e()};let t=e.context.active(),n={getValue:e=>t.getValue(e),setValue:(e,n)=>t.setValue(e,n),deleteValue:e=>t.deleteValue(e)};return{refresh:()=>{t=e.context.active()},run:t=>e.context.with(n,t)}}async function pr(e,t,n){let r=await Y.value;r&&r.startSpan(e,{...n,startTime:t}).end()}async function mr(e,t){(await ar.value)?.record(e,{"workflow.step.status":t})}function X(e,t){t.setAttributes({...kn(`suspended`),...jn(e.stepCount),...An(e.hookCount),...Mn(e.waitCount)})}async function hr(e){let[t,n]=await Promise.all([q(e),J.value]);if(t&&n)return n.trace.getSpanContext(t)}async function gr(){return await Z(e=>e.trace.getActiveSpan())}async function _r(e){return Z(t=>t.SpanKind[e])}async function Z(e){let t=await J.value;if(t)return await e(t)}function vr(){return Z(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function yr(e){if(!e)return;let[t,n]=await Promise.all([hr(e),J.value]);if(t&&n&&n.trace.isSpanContextValid(t))return{context:t}}async function br(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 xr(e,t){if(typeof t!=`string`||!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 Q(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)(Ie(`[workflow-sdk]`,i,c)),xr(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),gr().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 Sr=Q(`step`),$=Q(`runtime`),Cr=Q(`webhook`),wr=Q(`events`);Q(`adapter`),Q(`build`,{debugNamespace:`workflow:build`});export{Sn as $,ge as $n,ut as $t,un as A,pt as An,Ht as At,Jt as B,P as Bn,rt as Bt,er as C,We as Cn,Tt as Ct,ln as D,ot as Dn,hn as Dt,Ct as E,mt as En,wt as Et,Fn as F,Se as Fn,Ft,Xt as G,O as Gn,rn as Gt,Yn as H,N as Hn,Qe as Ht,Pn as I,Ee as In,Pt as It,yn as J,D as Jn,_t as Jt,Bn as K,ye as Kn,en as Kt,Yt as L,xe as Ln,Dt as Lt,sn as M,R as Mn,Wt as Mt,dn as N,Ae as Nn,jt as Nt,cn as O,at as On,mn as Ot,Nn as P,Fe as Pn,It as Pt,Cn as Q,pe as Qn,Ye as Qt,Kt as R,we as Rn,At as Rt,Zt as S,nn as Sn,Mt as St,In as T,dt as Tn,Ot as Tt,Rn as U,be as Un,an as Ut,Gt as V,Ce as Vn,gt as Vt,zn as W,A as Wn,on as Wt,bn as X,se as Xn,Xe as Xt,xn as Y,E as Yn,Je as Yt,Dn as Z,me as Zn,Ze as Zt,K as _,St as _n,Et as _t,X as a,ft as an,d as ar,Qn as at,ir as b,Qt as bn,zt as bt,fr as c,ht as cn,Un as ct,_r as d,et as dn,Jn as dt,lt as en,ae as er,On as et,tr as f,$e as fn,qn as ft,mr as g,bt as gn,Lt as gt,pr as h,yt as hn,Wn as ht,Cr as i,qe as in,o as ir,Tn as it,pn as j,je as jn,Ut as jt,fn as k,st as kn,Rt as kt,gr as l,tt as ln,Hn as lt,yr as m,xt as mn,Gn as mt,$ as n,Ke as nn,_ as nr,En as nt,dr as o,Ve as on,u as or,Zn as ot,G as p,it as pn,Vn as pt,vn as q,k as qn,$t as qt,Sr as r,Ln as rn,m as rr,_n as rt,rr as s,He as sn,Xn as st,wr as t,ct as tn,te as tr,wn as tt,nr as u,nt as un,Kn as ut,ur as v,vt as vn,gn as vt,$n as w,Ge as wn,Nt as wt,br as x,tn as xn,Vt as xt,lr as y,Ue as yn,Bt as yt,qt as z,F as zn,kt as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-B_knIduE.js";import{H as t,a as n,b as r,lt as i,pt as a,w as o}from"./dist-B7NC1c9-.js";import{$n as s,A as c,D as l,Jn as u,Ln as d,M as f,N as p,O as m,Un as h,m as ee,n as g,on as te,rr as _,tr as v,y,yn as b}from"./logger-oqfblE3p.js";import{A as x,f as S,j as C,k as w,n as T,o as E,s as D}from"./dist-CaNNONeg.js";import{f as ne,j as O,pt as k}from"./serialization-APSKphN5.js";import{l as A}from"./helpers-CP9TjeO8.js";import{i as re,n as j,r as ie,t as ae}from"./wait-until-Dc9s3yyP.js";import{z as M}from"#compiled/zod/index.js";const N=[25,100];function P(e,t){if(t?.(e))return!1;let n=e??{},r=n.status??n.statusCode;if(typeof r==`number`)return r>=500||r===408||r===429;let i=e?.name;return i!==`BadRequestError`&&i!==`UnauthorizedError`&&i!==`ForbiddenError`}async function F(e,t){let n;for(let r=0;r<=N.length;r++)try{await e();return}catch(e){if(n=e,!P(e,t))break;let i=N[r];i!==void 0&&await new Promise(e=>setTimeout(e,i))}throw D.is(n)?new x(`The hook resume was committed, but its workflow wake could not be published`,{cause:n}):n}async function I(e,t,n){let r=n.claimedFrom;if(!r||r.runId===t)return`skipped`;if(r.workflowName===void 0)return g.warn(`Force-claimed a hook from a run whose workflow name is unknown; not waking it`,{workflowRunId:t,victimRunId:r.runId}),`skipped`;try{return await F(()=>e.queue(A(r.workflowName),{runId:r.runId},{...r.deploymentId!==void 0&&{deploymentId:r.deploymentId},specVersion:r.runSpecVersion??1,idempotencyKey:`hook-force-claim-${n.hookId}`}),e.isDeploymentUnavailableError?.bind(e)),`published`}catch(e){return g.error(`Force-claimed a hook token but could not wake the run it was taken from; it will read the disposal on its next invocation`,{workflowRunId:t,victimRunId:r.runId,error:e instanceof Error?e.message:String(e)}),`failed`}}function L(e,t=Date.now()){let n=[];if(!e)return n;for(let r of e){if(r.eventType!==`hook_created`||r.eventData?.forceClaimedFrom===void 0)continue;let e=new Date(r.createdAt).getTime();(Number.isNaN(e)||t-e<864e5)&&n.push(r)}return n}async function R(e,t,n,r={}){let{alreadyWoken:i}=r,a=L(n,r.nowMs).filter(e=>{let n=e.eventData.forceClaimedFrom;return n.runId!==t&&n.workflowName!==void 0&&!i?.has(e.correlationId)});a.length!==0&&await Promise.all(a.map(async n=>{i?.add(n.correlationId);let r=n.eventData.forceClaimedFrom,a=await I(e,t,{hookId:n.correlationId,claimedFrom:r});g.debug(`Republished the wake of a force-claimed hook victim`,{workflowRunId:t,hookId:n.correlationId,victimRunId:r.runId,victimWake:a})}))}const z=M.object({type:M.literal(`hook_resume`),version:M.literal(1),hookId:M.string(),token:M.string(),payload:M.instanceof(Uint8Array)}),oe=M.discriminatedUnion(`status`,[M.object({status:M.literal(`accepted`)}),M.object({status:M.literal(`rejected`),code:M.enum([`HOOK_NOT_FOUND`,`INVALID_INPUT`])})]);async function B(e,n,r,a){let o=z.safeParse(a);if(!o.success||!r)throw new C(`Invalid invocation input`,{status:400,code:`INVALID_INPUT`});let s=o.data,c=Buffer.from(await crypto.subtle.digest(`SHA-256`,s.payload)).toString(`hex`);try{let r=await e.hooks.get(s.hookId);if(r.runId!==n||r.token!==s.token)throw new D(s.token);let i=await e.runs.get(n,{resolveData:`none`});if(t(i.status))throw new D(s.token)}catch(a){if(!V(a))throw a;let o=await e.runs.get(n,{resolveData:`none`});if(o.expiredAt||t(o.status)&&i(o.attributes).mode===`none`)throw new C(`Invocation data has expired under the run retention policy`,{status:410,code:`INVOCATION_DATA_EXPIRED`});if(!e.capabilities?.hookResumeDedup||!await H(e,n,s.hookId,r))throw a}return await e.events.create(n,{eventType:`hook_received`,correlationId:s.hookId,specVersion:8,eventData:{token:s.token,payload:s.payload}},{...e.capabilities?.hookResumeDedup?{resumeId:r,resumePayloadDigest:c}:{}}),{status:`accepted`}}function V(e){return D.is(e)||S.is(e)||w.is(e)}async function H(e,t,n,r){let i=null;do{let a=await e.events.listByCorrelationId({runId:t,correlationId:n,resolveData:`none`,pagination:{limit:100,...i?{cursor:i}:{}}});if(a.data.some(e=>e.eventType===`hook_received`&&e.resumeId===r))return!0;i=a.hasMore?a.cursor:null}while(i);return!1}var U=class{revision=0;listeners=new Set;notify(){this.revision++;for(let e of this.listeners)e()}async waitForActivity(e,t=100){return this.revision!==e||(await new Promise(e=>{let n=()=>{clearTimeout(r),this.listeners.delete(n),e()},r=setTimeout(n,t);this.listeners.add(n)}),this.revision!==e)}};function W(e){return t=>{let n=new Map;return async(i,a)=>{if(r.safeParse(i).success)return t(i,a);let s=o.safeParse(i);if(!e.capabilities?.invoke||!s.success||s.data.stepId)return t(i,a);let c=s.data,l=n.get(c.runId);l||(l={activity:new U,admission:Promise.resolve(),references:0},n.set(c.runId,l));let u=l;u.references++;try{if(c.invoke){if(!c.requestId)throw new x(`Invocation requestId is required`);let t=c.requestId,n=u.admission.then(()=>y(`workflow.invoke.receive`,async n=>{n?.setAttributes({...b(c.runId),"workflow.invocation.id":t});let r=await B(e,c.runId,t,c.input);return r.status===`accepted`&&u.activity.notify(),r}));return u.admission=n.catch(()=>{}),await n}if(u.execution)return await u.execution;let n=t(i,a,u.activity);u.execution=n;try{return await n}finally{u.execution===n&&(u.execution=void 0)}}finally{u.references--,u.references===0&&n.get(c.runId)===u&&n.delete(c.runId)}}}}var G=e({getHookByToken:()=>X,resumeHook:()=>Z,resumeWebhook:()=>fe});const K=a();async function se(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}function ce(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function q(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await v()).runs.get(e.runId);return{resumeContext:ce(t),source:`run_fallback`,run:t}}async function le(e,t){let n=await v(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await _(r):void 0}function ue(e){let t=Object.getOwnPropertyDescriptor(e,`metadata`);return t!==void 0&&typeof t.get==`function`}function J(e){let t=e.metadata,n,r,i=async()=>{let n=await v(),i=await q(e),a=i.run?await n.getEncryptionKeyForRun?.(i.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:i.resumeContext.deploymentId});return r=a?await d(a):void 0,await O(t,e.runId,r)},a=e;return Object.defineProperty(a,"metadata",{get:()=>n??=t===void 0?Promise.resolve(void 0):i(),enumerable:!1,configurable:!0}),{hook:a,metadataEncryptionKey:()=>r}}function Y(e){return ue(e)?e:J(e).hook}async function X(e){return J(await(await v()).hooks.getByToken(e)).hook}async function Z(e,t,n){return $(e,t,n,!1,Date.now())}const Q=new WeakMap;async function $(e,t,n,r,i,a=!1){return await j(()=>y(`hook.resume`,async o=>{let s=await v(),c=typeof e==`string`?e:e.token,l=e,u=r,d=n,f=0,p=0,m=K(),h=e=>{if(t instanceof Request&&t.body!==null&&t.bodyUsed)throw o?.setAttributes({"workflow.hook.resume_redirect_unresendable":!0}),new x(`Hook token "${c}" changed owner while this webhook request was being delivered; a request body can be sent only once and it was not delivered anywhere — retry the request, which will reach the token's new owner`,{cause:e})};for(;;)try{return await de(s,o,l,t,d,u,i,m,a)}catch(e){if(typeof e==`object`&&e&&Q.get(e)===`not-webhook`)throw e;if(f>=3)throw E.is(e)?(o?.setAttributes({"workflow.hook.resume_redirects_exhausted":!0}),new x(`Hook token "${c}" changed owner ${f} times while this resume was in flight; nothing was delivered — retry the resume`,{cause:e})):e;if(E.is(e)){h(e),f++,o?.setAttributes({"workflow.hook.resume_redirects":f,"workflow.hook.resume_redirect_to_run":e.claimedByRunId}),l=c,u=!0,d=void 0,p=0;continue}if(D.is(e)&&f>0&&typeof l==`string`&&p<5){h(e),p++,await new Promise(e=>setTimeout(e,50));continue}if(D.is(e)&&Q.get(e)!==`lookup`){let t=typeof l==`string`?void 0:l.hookId,n;try{n=await s.hooks.getByToken(c)}catch(e){D.is(e)||g.warn(`Hook resume: re-resolving the token after a not-found failed; surfacing the original error`,{token:c,error:e instanceof Error?e.message:String(e)})}if(n?.claimedFrom!==void 0&&n.hookId!==t&&(t===void 0||n.claimedFrom.hookId===t)&&!(a&&n.isWebhook===!1)){h(e),f++,o?.setAttributes({"workflow.hook.resume_redirects":f,"workflow.hook.resume_redirect_to_run":n.runId}),l=n,u=!0,d=void 0;continue}}throw e}}))}async function de(e,r,i,a,o,d,_,v,y){try{let l=typeof i==`string`,C;if(l)try{C=await e.hooks.getByToken(i)}catch(e){throw D.is(e)&&Q.set(e,`lookup`),e}else C=i;if(y&&C.isWebhook===!1){let e=new D(C.token);throw Q.set(e,`not-webhook`),e}let w=l||d,T=await q(C),{resumeContext:O}=T;if(r?.setAttributes({...f(C.token),...m(C.hookId),...b(C.runId),"workflow.hook.resume_context_source":T.source}),T.run&&t(T.run.status))throw new D(C.token);let k=re(O.workflowCoreVersion),j,M=o?void 0:s(O.encryptionPublicKey);if(M)j=h(M);else{let e=o??await le(C,T);k.supportedFormats.has(u.ENCRYPTED)||(e=void 0),j=e}let N=(O.runSpecVersion??0)>=5&&k.supportedFormats.has(u.GZIP),P=[],I=[],L=n(C.specVersion),R=await ne(a,C.runId,j,P,globalThis,L,k.framedByteStreams,N,void 0,I);if(await Promise.all(P.map(e=>e.catch(e=>{if(e!==void 0)throw e}))),ae(Promise.all(I),e=>{e!==void 0&&g.warn(`Background readback of hook payload failed`,{workflowRunId:C.runId,hookId:C.hookId,error:e instanceof Error?e.message:String(e)})}),e.capabilities?.invoke===!0&&!L&&R instanceof Uint8Array){if(!e.invoke)throw new x(`World advertises invoke without implementing it`);r?.setAttributes({"workflow.hook.resume_strategy":`invoke`});let t=oe.parse(await e.invoke(C.runId,{type:`hook_resume`,version:1,hookId:C.hookId,token:C.token,payload:R},{idempotencyKey:v}));if(t.status===`rejected`)throw t.code===`HOOK_NOT_FOUND`?new D(C.token):new x(`Executor rejected the hook invocation input`);return r?.setAttributes(c(!0)),Y(C)}r?.setAttributes({...te(O.workflowName)});let z=await ee(O.traceCarrier);z&&r?.addLink?.(z);let B=A(O.workflowName),V={deploymentId:O.deploymentId,specVersion:O.runSpecVersion??1},H=((w?C.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||e.capabilities?.hookResumeDedup===!0)&&!L&&R instanceof Uint8Array;r?.setAttributes({"workflow.hook.resume_strategy":`sequential`});let U=H?v:void 0,W=H?await se(R):void 0;U&&r?.setAttributes({"workflow.hook.resume_id":U});let G=e=>D.is(e)||S.is(e);try{await e.events.create(C.runId,{eventType:`hook_received`,specVersion:ie(O.runSpecVersion),correlationId:C.hookId,eventData:{...L?{}:{token:C.token},payload:R}},{v1Compat:L,...U&&W?{resumeId:U,resumePayloadDigest:W}:{}})}catch(e){throw E.is(e)?e:G(e)?new D(C.token):e}r?.setAttributes(c(!0));let K=Date.now();return await F(()=>e.queue(B,{runId:C.runId,traceCarrier:O.traceCarrier??void 0,hookResumeTiming:{resumeRequestedAtMs:_,queuePublishRequestedAtMs:K,strategy:`sequential`}},{...V,...U?{idempotencyKey:`hook-${U}`}:{}}),e.isDeploymentUnavailableError?.bind(e)),r?.setAttributes(p(!0)),Y(C)}catch(e){throw r?.setAttributes({...f(typeof i==`string`?i:i.token),...l(!1)}),e}}async function fe(e,t){let n=Date.now(),{hook:r,metadataEncryptionKey:i}=J(await(await v()).hooks.getByToken(e));if(r.isWebhook===!1)throw new D(e);let a=await r.metadata,o,s;if(a&&typeof a==`object`&&`respondWith`in a){if(a.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;s=e,t[k]=n}else if(a.respondWith instanceof Response)o=a.respondWith;else throw new x(`Invalid \`respondWith\` value: ${a.respondWith}`,{slug:T.WEBHOOK_INVALID_RESPOND_WITH_VALUE})}else o=new Response(null,{status:202});if(await $(r,t,i(),!0,n,!0),s){let e=s.getReader(),t=await e.read();t.value&&(o=t.value),e.cancel()}if(!o)throw new x(`Workflow run did not send a response`,{slug:T.WEBHOOK_RESPONSE_NOT_SENT});return o}export{W as a,G as i,Z as n,I as o,fe as r,R as s,X as t};
|