eve 0.7.4 → 0.8.1
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 +45 -0
- package/README.md +11 -11
- package/dist/src/chunks/{use-eve-agent-DErQj5hs.js → use-eve-agent-BSXZSn-R.js} +6 -1
- package/dist/src/chunks/{use-eve-agent-DoR8C4i6.js → use-eve-agent-Dlut2Qzt.js} +6 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +1 -1
- package/dist/src/cli/dev/tui/blocks.js +4 -3
- package/dist/src/cli/dev/tui/command-typeahead.d.ts +13 -3
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/line-editor.d.ts +6 -0
- package/dist/src/cli/dev/tui/line-editor.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +2 -0
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +15 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +11 -7
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +72 -10
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.d.ts +91 -39
- package/dist/src/cli/dev/tui/setup-panel.js +3 -1
- package/dist/src/cli/dev/tui/setup-selection-input.d.ts +48 -0
- package/dist/src/cli/dev/tui/setup-selection-input.js +1 -0
- package/dist/src/cli/dev/tui/status-line.d.ts +13 -7
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/stream-format.d.ts +2 -0
- package/dist/src/cli/dev/tui/stream-format.js +2 -2
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +5 -2
- package/dist/src/cli/dev/tui/terminal-renderer.js +6 -5
- package/dist/src/cli/dev/tui/theme.d.ts +3 -1
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +6 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-status.d.ts +4 -4
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/run.d.ts +4 -3
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/session-utils.d.ts +1 -0
- package/dist/src/client/session-utils.js +1 -1
- package/dist/src/client/session.d.ts +1 -0
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +19 -0
- package/dist/src/compiled/.vendor-stamp.json +1 -2
- package/dist/src/compiler/compile-from-memory.js +1 -1
- package/dist/src/compiler/manifest.d.ts +28 -7
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/evals/cli/eval-client.js +1 -1
- package/dist/src/execution/sandbox/bash-tool.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-base-setup.d.ts +9 -0
- package/dist/src/execution/sandbox/bindings/docker-base-setup.js +2 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +77 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.js +2 -0
- package/dist/src/execution/sandbox/bindings/docker-container.d.ts +16 -0
- package/dist/src/execution/sandbox/bindings/docker-container.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-network.d.ts +8 -0
- package/dist/src/execution/sandbox/bindings/docker-network.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-options.d.ts +21 -0
- package/dist/src/execution/sandbox/bindings/docker-options.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-session.d.ts +7 -0
- package/dist/src/execution/sandbox/bindings/docker-session.js +2 -0
- package/dist/src/execution/sandbox/bindings/docker-templates.d.ts +35 -0
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-utils.d.ts +2 -0
- package/dist/src/execution/sandbox/bindings/docker-utils.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker.d.ts +33 -0
- package/dist/src/execution/sandbox/bindings/docker.js +1 -0
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +30 -0
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -0
- package/dist/src/execution/sandbox/bindings/just-bash.d.ts +33 -0
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -0
- package/dist/src/execution/sandbox/bindings/local-backend-utils.d.ts +23 -0
- package/dist/src/execution/sandbox/bindings/local-backend-utils.js +1 -0
- package/dist/src/execution/sandbox/bindings/local-template-prune.d.ts +16 -0
- package/dist/src/execution/sandbox/bindings/local-template-prune.js +1 -0
- package/dist/src/execution/sandbox/bindings/local.d.ts +16 -25
- package/dist/src/execution/sandbox/bindings/local.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +16 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.d.ts +21 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-network.d.ts +18 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-network.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +34 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-options.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.d.ts +22 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +178 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-process.d.ts +3 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-process.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +75 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.d.ts +13 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +22 -0
- package/dist/src/execution/sandbox/bindings/microsandbox.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel-create-api.d.ts +20 -0
- package/dist/src/execution/sandbox/bindings/vercel-create-api.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +7 -8
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/development-cleanup.d.ts +4 -0
- package/dist/src/execution/sandbox/development-cleanup.js +1 -0
- package/dist/src/execution/sandbox/development-prewarm.d.ts +15 -0
- package/dist/src/execution/sandbox/development-prewarm.js +1 -0
- package/dist/src/execution/sandbox/development-run.d.ts +8 -0
- package/dist/src/execution/sandbox/development-run.js +1 -0
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/lazy-backend.d.ts +1 -1
- package/dist/src/execution/sandbox/logging-session.d.ts +5 -0
- package/dist/src/execution/sandbox/logging-session.js +1 -0
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/sandbox/template-prewarm-lock.d.ts +8 -0
- package/dist/src/execution/sandbox/template-prewarm-lock.js +1 -0
- package/dist/src/internal/application/optional-package-install.d.ts +40 -0
- package/dist/src/internal/application/optional-package-install.js +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/sandbox.d.ts +1 -1
- package/dist/src/internal/authored-definition/sandbox.js +1 -1
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/classify-model-routing.d.ts +24 -0
- package/dist/src/internal/classify-model-routing.js +1 -0
- package/dist/src/internal/nitro/host/channel-routes.js +2 -2
- package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.d.ts +5 -2
- package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +10 -0
- 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-live-virtual-modules.d.ts +15 -0
- package/dist/src/internal/nitro/host/dev-live-virtual-modules.js +1 -0
- package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.d.ts +28 -0
- package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.js +1 -0
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.d.ts +2 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +4 -0
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.d.ts +23 -0
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/public/definitions/sandbox-backend.js +1 -1
- package/dist/src/public/sandbox/backends/default.d.ts +37 -10
- package/dist/src/public/sandbox/backends/default.js +1 -1
- package/dist/src/public/sandbox/backends/docker.d.ts +14 -0
- package/dist/src/public/sandbox/backends/docker.js +1 -0
- package/dist/src/public/sandbox/backends/just-bash.d.ts +17 -0
- package/dist/src/public/sandbox/backends/just-bash.js +1 -0
- package/dist/src/public/sandbox/backends/microsandbox.d.ts +17 -0
- package/dist/src/public/sandbox/backends/microsandbox.js +1 -0
- package/dist/src/public/sandbox/backends/vercel.d.ts +5 -2
- package/dist/src/public/sandbox/backends/vercel.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +45 -0
- package/dist/src/public/sandbox/index.d.ts +8 -4
- package/dist/src/public/sandbox/index.js +1 -1
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +17 -0
- package/dist/src/public/sandbox/just-bash-sandbox.js +1 -0
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +54 -0
- package/dist/src/public/sandbox/microsandbox-sandbox.js +1 -0
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +1 -1
- package/dist/src/runtime/compiled-artifacts-source.d.ts +11 -0
- package/dist/src/runtime/compiled-artifacts-source.js +1 -1
- package/dist/src/runtime/resolve-sandbox.js +1 -1
- package/dist/src/runtime/sandbox/keys.js +1 -1
- package/dist/src/runtime/sandbox/registry.d.ts +2 -2
- package/dist/src/runtime/types.d.ts +1 -1
- package/dist/src/runtime/workspace/spec.js +1 -1
- package/dist/src/setup/boxes/add-channels.d.ts +3 -2
- package/dist/src/setup/boxes/add-channels.js +2 -2
- package/dist/src/setup/boxes/apply-ai-gateway-credential.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/link-project.js +1 -1
- package/dist/src/setup/boxes/resolve-provisioning.d.ts +6 -0
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/boxes/select-model.d.ts +2 -2
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/channel-setup-prompter.d.ts +28 -0
- package/dist/src/setup/cli/channel-setup-prompter.js +1 -1
- package/dist/src/setup/cli/index.d.ts +2 -2
- package/dist/src/setup/cli/index.js +1 -1
- package/dist/src/setup/cli/option-row.d.ts +89 -0
- package/dist/src/setup/cli/option-row.js +1 -0
- package/dist/src/setup/cli/prompt-ui.d.ts +15 -29
- package/dist/src/setup/cli/prompt-ui.js +2 -2
- package/dist/src/setup/cli/select-component.d.ts +4 -3
- package/dist/src/setup/cli/select-component.js +1 -1
- package/dist/src/setup/cli/select-state.d.ts +3 -3
- package/dist/src/setup/cli/select-state.js +1 -1
- package/dist/src/setup/flows/channels.d.ts +29 -14
- package/dist/src/setup/flows/channels.js +1 -1
- package/dist/src/setup/flows/deploy.d.ts +1 -0
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/link.d.ts +1 -0
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/model.d.ts +30 -6
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/vercel.d.ts +4 -1
- package/dist/src/setup/flows/vercel.js +2 -2
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/primitives/open-url.d.ts +14 -0
- package/dist/src/setup/primitives/open-url.js +1 -0
- package/dist/src/setup/primitives/pm/pnpm.d.ts +9 -0
- package/dist/src/setup/primitives/pm/pnpm.js +2 -2
- package/dist/src/setup/primitives/pm/run.d.ts +12 -4
- package/dist/src/setup/primitives/pm/run.js +1 -1
- package/dist/src/setup/primitives/pm/types.d.ts +3 -0
- package/dist/src/setup/primitives/process-abort.d.ts +7 -0
- package/dist/src/setup/primitives/process-abort.js +1 -0
- package/dist/src/setup/primitives/run-vercel.d.ts +2 -0
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/project-resolution.d.ts +6 -3
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/prompter.d.ts +63 -6
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/run-vercel-link.d.ts +1 -1
- package/dist/src/setup/run-vercel-link.js +1 -1
- package/dist/src/setup/runner.d.ts +2 -0
- package/dist/src/setup/runner.js +1 -1
- package/dist/src/setup/scaffold/channels-catalog.d.ts +2 -0
- package/dist/src/setup/scaffold/channels-catalog.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.d.ts +1 -0
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.d.ts +2 -0
- package/dist/src/setup/scaffold/create/project.js +6 -3
- package/dist/src/setup/scaffold/update/channels.d.ts +2 -0
- package/dist/src/setup/scaffold/update/channels.js +3 -3
- package/dist/src/setup/slack-connect-lifecycle.d.ts +97 -0
- package/dist/src/setup/slack-connect-lifecycle.js +1 -0
- package/dist/src/setup/slack-connect.d.ts +51 -0
- package/dist/src/setup/slack-connect.js +1 -0
- package/dist/src/setup/slackbot.d.ts +60 -47
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/setup/state.d.ts +2 -1
- package/dist/src/setup/state.js +1 -1
- package/dist/src/setup/step.d.ts +4 -0
- package/dist/src/setup/validate-gateway-key.d.ts +30 -0
- package/dist/src/setup/validate-gateway-key.js +1 -0
- package/dist/src/setup/vercel-project.d.ts +19 -12
- package/dist/src/setup/vercel-project.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +26 -0
- package/dist/src/shared/model-endpoint-status.d.ts +27 -0
- package/dist/src/shared/model-endpoint-status.js +1 -0
- package/dist/src/shared/sandbox-backend.d.ts +8 -2
- package/dist/src/shared/sandbox-definition.d.ts +4 -3
- package/dist/src/shared/sandbox-network-policy.d.ts +4 -2
- package/dist/src/shared/sandbox-session.d.ts +3 -2
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/{dist/docs/public → docs}/getting-started.mdx +14 -4
- package/{dist/docs/public → docs}/guides/deployment.md +3 -3
- package/{dist/docs/public → docs}/guides/dev-tui.md +2 -2
- package/{dist/docs/public → docs}/reference/cli.md +2 -1
- package/{dist/docs/public → docs}/sandbox.mdx +39 -15
- package/package.json +11 -1
- package/dist/src/compiled/just-bash/LICENSE +0 -201
- package/dist/src/compiled/just-bash/index.d.ts +0 -139
- package/dist/src/compiled/just-bash/index.js +0 -2200
- package/dist/src/compiled/just-bash/network/types.d.ts +0 -155
- package/dist/src/public/sandbox/backends/local.d.ts +0 -16
- package/dist/src/public/sandbox/backends/local.js +0 -1
- package/dist/src/public/sandbox/local-sandbox.d.ts +0 -7
- /package/dist/src/public/sandbox/{local-sandbox.js → docker-sandbox.js} +0 -0
- /package/{dist/docs/public → docs}/README.md +0 -0
- /package/{dist/docs/public → docs}/agent-config.md +0 -0
- /package/{dist/docs/public → docs}/channels/custom.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/discord.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/eve.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/github.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/linear.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/meta.json +0 -0
- /package/{dist/docs/public → docs}/channels/overview.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/slack.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/teams.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/telegram.mdx +0 -0
- /package/{dist/docs/public → docs}/channels/twilio.mdx +0 -0
- /package/{dist/docs/public → docs}/concepts/context-control.md +0 -0
- /package/{dist/docs/public → docs}/concepts/default-harness.md +0 -0
- /package/{dist/docs/public → docs}/concepts/execution-model-and-durability.md +0 -0
- /package/{dist/docs/public → docs}/concepts/meta.json +0 -0
- /package/{dist/docs/public → docs}/concepts/security-model.md +0 -0
- /package/{dist/docs/public → docs}/concepts/sessions-runs-and-streaming.md +0 -0
- /package/{dist/docs/public → docs}/connections.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/assertions.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/cases.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/judge.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/meta.json +0 -0
- /package/{dist/docs/public → docs}/evals/overview.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/reporters.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/running.mdx +0 -0
- /package/{dist/docs/public → docs}/evals/targets.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/auth-and-route-protection.md +0 -0
- /package/{dist/docs/public → docs}/guides/client/continuations.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/client/messages.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/client/meta.json +0 -0
- /package/{dist/docs/public → docs}/guides/client/output-schema.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/client/overview.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/client/streaming.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/dynamic-capabilities.md +0 -0
- /package/{dist/docs/public → docs}/guides/dynamic-workflows.md +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/meta.json +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/nextjs.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/nuxt.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/overview.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/sveltekit.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/use-eve-agent-svelte.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/frontend/use-eve-agent-vue.mdx +0 -0
- /package/{dist/docs/public → docs}/guides/hooks.md +0 -0
- /package/{dist/docs/public → docs}/guides/instrumentation.md +0 -0
- /package/{dist/docs/public → docs}/guides/meta.json +0 -0
- /package/{dist/docs/public → docs}/guides/remote-agents.md +0 -0
- /package/{dist/docs/public → docs}/guides/session-context.md +0 -0
- /package/{dist/docs/public → docs}/guides/state.md +0 -0
- /package/{dist/docs/public → docs}/instructions.mdx +0 -0
- /package/{dist/docs/public → docs}/introduction.md +0 -0
- /package/{dist/docs/public → docs}/meta.json +0 -0
- /package/{dist/docs/public → docs}/reference/meta.json +0 -0
- /package/{dist/docs/public → docs}/reference/project-layout.md +0 -0
- /package/{dist/docs/public → docs}/reference/typescript-api.md +0 -0
- /package/{dist/docs/public → docs}/schedules.mdx +0 -0
- /package/{dist/docs/public → docs}/skills.mdx +0 -0
- /package/{dist/docs/public → docs}/subagents.mdx +0 -0
- /package/{dist/docs/public → docs}/tools.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/connect-a-warehouse.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/first-agent.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/guard-the-spend.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/how-it-runs.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/meta.json +0 -0
- /package/{dist/docs/public → docs}/tutorial/query-sample-data.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/remember-definitions.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/run-analysis.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/ship-it.mdx +0 -0
- /package/{dist/docs/public → docs}/tutorial/team-playbooks.mdx +0 -0
package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AgentInfoManifestData } from "#internal/nitro/routes/agent-info/load-agent-info-data.js";
|
|
2
2
|
import type { AgentInfoResponse } from "#internal/nitro/routes/agent-info/build-agent-info-response.js";
|
|
3
|
+
import { type GatewayCredentialPresence } from "#internal/resolve-model-endpoint-status.js";
|
|
3
4
|
export declare function buildAgentInfoResponseFromManifest(data: AgentInfoManifestData, input: {
|
|
4
5
|
readonly mode: AgentInfoResponse["mode"];
|
|
6
|
+
readonly gatewayCredentials: GatewayCredentialPresence;
|
|
5
7
|
}): AgentInfoResponse;
|
package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CODE_MODE_TOOL_NAME,WORKFLOW_TOOL_NAME}from"#shared/code-mode.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{getAllFrameworkToolNames,getFrameworkToolDefinitions}from"#runtime/framework-tools/index.js";import{createConnectionSearchResolver}from"#runtime/framework-tools/connection-search-dynamic.js";import{renderChannel,renderDynamicResolver,renderSchedule,renderSubagent,renderTool,toSource}from"#internal/nitro/routes/agent-info/build-agent-info-response.js";function buildAgentInfoResponseFromManifest(i,a){let o=i.manifest,s=o.channels.filter(e=>e.kind===`channel`),c=o.channels.filter(e=>e.kind===`disabled`).map(e=>e.name),l=new Set(o.tools.map(e=>e.name)),u=new Set(o.disabledFrameworkTools),d=getAllFrameworkToolNames(),f=getAllFrameworkChannelNames(),p=getFrameworkToolDefinitions({hasConnections:o.connections.length>0}),m=getFrameworkChannelDefinitions(),h=p.filter(e=>!l.has(e.name)&&!u.has(e.name)),g=o.tools.map(e=>({...toSource(e),description:e.description,hasAuth:!1,hasCompactionHook:!1,hasExecute:!0,hasModelOutputProjection:!1,hasOutputSchema:e.outputSchema!==void 0&&e.outputSchema!==null,inputSchema:e.inputSchema,name:e.name,origin:`authored`,outputSchema:e.outputSchema??null,replacesFrameworkTool:d.has(e.name),requiresApproval:!1})),_=new Set(s.map(e=>e.name)),v=new Set(c),y=m.filter(e=>!_.has(e.name)&&!v.has(e.name)),b=s.map(e=>({...toSource(e),adapterKind:e.adapterKind,method:e.method,name:e.name,origin:`authored`,urlPath:e.urlPath}));return{agent:{agentRoot:o.agentRoot,appRoot:o.appRoot,configSource:o.config.source?toSource(o.config.source):void 0,description:o.config.description,model:{contextWindowTokens:o.config.model.contextWindowTokens,id:o.config.model.id,providerOptions:o.config.model.providerOptions,source:o.config.model.source?toSource(o.config.model.source):void 0},name:o.config.name,outputSchema:o.config.outputSchema},capabilities:{devRoutes:a.mode===`development`},channels:{authored:b,available:[...y.map(e=>renderChannel(e,{origin:`framework`})),...b],disabledFramework:c,framework:m.filter(e=>f.has(e.name)).map(e=>{let t=_.has(e.name),n=v.has(e.name),r=n?`disabled`:t?`replaced`:`active`;return{...renderChannel(e,{origin:`framework`}),disabledByAuthor:n,replacedByAuthoredChannel:t,status:r}})},connections:o.connections.map(e=>({...toSource(e),connectionName:e.connectionName,description:e.description,hasApproval:!1,hasAuthorization:e.vercelConnect!==void 0,hasHeaders:!1,protocol:e.protocol,url:e.url})),diagnostics:{discoveryErrors:o.diagnosticsSummary.errors,discoveryWarnings:o.diagnosticsSummary.warnings},hooks:o.hooks.map(e=>({...toSource(e),eventNames:[],slug:e.slug})),instructions:{dynamic:o.dynamicInstructions.map(e=>renderDynamicResolver(e,{origin:`authored`})),static:o.instructions===void 0?null:{...toSource(o.instructions),markdown:o.instructions.markdown,name:o.instructions.name}},kind:`eve-agent-info`,mode:a.mode,sandbox:o.sandbox===null?null:{...toSource(o.sandbox),description:o.sandbox.description,hasBootstrap:!1,hasOnSession:!1,revalidationKey:o.sandbox.revalidationKey,sourceHash:o.sandbox.sourceHash},schedules:i.schedules.map(renderSchedule),skills:{static:o.skills.map(e=>({...toSource(e),description:e.description,license:e.license,markdown:e.markdown,metadata:e.metadata,name:e.name})),dynamic:o.dynamicSkills.map(e=>renderDynamicResolver(e,{origin:`authored`}))},subagents:{local:o.subagents.map(renderSubagent),total:o.subagents.length},tools:{available:[...h.map(e=>renderTool(e,{origin:`framework`,replacesFrameworkTool:!1})),...g],authored:g,disabledFramework:[...o.disabledFrameworkTools],dynamic:[...o.connections.length>0?[renderDynamicResolver(createConnectionSearchResolver(),{origin:`framework`})]:[],...o.dynamicTools.map(e=>renderDynamicResolver(e,{origin:`authored`}))],framework:p.map(e=>{let t=l.has(e.name),n=u.has(e.name),r=n?`disabled`:t?`replaced`:`active`;return{...renderTool(e,{origin:`framework`,replacesFrameworkTool:!1}),disabledByAuthor:n,replacedByAuthoredTool:t,status:r}}),reserved:[CODE_MODE_TOOL_NAME,WORKFLOW_TOOL_NAME,LOAD_SKILL_TOOL_NAME]},version:1,workflow:{enabled:o.workflowEnabled,toolName:WORKFLOW_TOOL_NAME},workspace:{resourceRoot:o.workspaceResourceRoot,rootEntries:[...o.workspaceResourceRoot.rootEntries]}}}export{buildAgentInfoResponseFromManifest};
|
|
1
|
+
import{CODE_MODE_TOOL_NAME,WORKFLOW_TOOL_NAME}from"#shared/code-mode.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{getAllFrameworkToolNames,getFrameworkToolDefinitions}from"#runtime/framework-tools/index.js";import{createConnectionSearchResolver}from"#runtime/framework-tools/connection-search-dynamic.js";import{renderChannel,renderDynamicResolver,renderSchedule,renderSubagent,renderTool,toSource}from"#internal/nitro/routes/agent-info/build-agent-info-response.js";import{resolveModelEndpointStatus}from"#internal/resolve-model-endpoint-status.js";function buildAgentInfoResponseFromManifest(i,a){let o=i.manifest,s=o.channels.filter(e=>e.kind===`channel`),c=o.channels.filter(e=>e.kind===`disabled`).map(e=>e.name),l=new Set(o.tools.map(e=>e.name)),u=new Set(o.disabledFrameworkTools),d=getAllFrameworkToolNames(),f=getAllFrameworkChannelNames(),p=getFrameworkToolDefinitions({hasConnections:o.connections.length>0}),m=getFrameworkChannelDefinitions(),h=p.filter(e=>!l.has(e.name)&&!u.has(e.name)),g=o.tools.map(e=>({...toSource(e),description:e.description,hasAuth:!1,hasCompactionHook:!1,hasExecute:!0,hasModelOutputProjection:!1,hasOutputSchema:e.outputSchema!==void 0&&e.outputSchema!==null,inputSchema:e.inputSchema,name:e.name,origin:`authored`,outputSchema:e.outputSchema??null,replacesFrameworkTool:d.has(e.name),requiresApproval:!1})),_=new Set(s.map(e=>e.name)),v=new Set(c),y=m.filter(e=>!_.has(e.name)&&!v.has(e.name)),b=s.map(e=>({...toSource(e),adapterKind:e.adapterKind,method:e.method,name:e.name,origin:`authored`,urlPath:e.urlPath}));return{agent:{agentRoot:o.agentRoot,appRoot:o.appRoot,configSource:o.config.source?toSource(o.config.source):void 0,description:o.config.description,model:{contextWindowTokens:o.config.model.contextWindowTokens,id:o.config.model.id,providerOptions:o.config.model.providerOptions,source:o.config.model.source?toSource(o.config.model.source):void 0,routing:o.config.model.routing,endpoint:resolveModelEndpointStatus(o.config.model.routing,a.gatewayCredentials)},name:o.config.name,outputSchema:o.config.outputSchema},capabilities:{devRoutes:a.mode===`development`},channels:{authored:b,available:[...y.map(e=>renderChannel(e,{origin:`framework`})),...b],disabledFramework:c,framework:m.filter(e=>f.has(e.name)).map(e=>{let t=_.has(e.name),n=v.has(e.name),r=n?`disabled`:t?`replaced`:`active`;return{...renderChannel(e,{origin:`framework`}),disabledByAuthor:n,replacedByAuthoredChannel:t,status:r}})},connections:o.connections.map(e=>({...toSource(e),connectionName:e.connectionName,description:e.description,hasApproval:!1,hasAuthorization:e.vercelConnect!==void 0,hasHeaders:!1,protocol:e.protocol,url:e.url})),diagnostics:{discoveryErrors:o.diagnosticsSummary.errors,discoveryWarnings:o.diagnosticsSummary.warnings},hooks:o.hooks.map(e=>({...toSource(e),eventNames:[],slug:e.slug})),instructions:{dynamic:o.dynamicInstructions.map(e=>renderDynamicResolver(e,{origin:`authored`})),static:o.instructions===void 0?null:{...toSource(o.instructions),markdown:o.instructions.markdown,name:o.instructions.name}},kind:`eve-agent-info`,mode:a.mode,sandbox:o.sandbox===null?null:{...toSource(o.sandbox),description:o.sandbox.description,hasBootstrap:!1,hasOnSession:!1,revalidationKey:o.sandbox.revalidationKey,sourceHash:o.sandbox.sourceHash},schedules:i.schedules.map(renderSchedule),skills:{static:o.skills.map(e=>({...toSource(e),description:e.description,license:e.license,markdown:e.markdown,metadata:e.metadata,name:e.name})),dynamic:o.dynamicSkills.map(e=>renderDynamicResolver(e,{origin:`authored`}))},subagents:{local:o.subagents.map(renderSubagent),total:o.subagents.length},tools:{available:[...h.map(e=>renderTool(e,{origin:`framework`,replacesFrameworkTool:!1})),...g],authored:g,disabledFramework:[...o.disabledFrameworkTools],dynamic:[...o.connections.length>0?[renderDynamicResolver(createConnectionSearchResolver(),{origin:`framework`})]:[],...o.dynamicTools.map(e=>renderDynamicResolver(e,{origin:`authored`}))],framework:p.map(e=>{let t=l.has(e.name),n=u.has(e.name),r=n?`disabled`:t?`replaced`:`active`;return{...renderTool(e,{origin:`framework`,replacesFrameworkTool:!1}),disabledByAuthor:n,replacedByAuthoredTool:t,status:r}}),reserved:[CODE_MODE_TOOL_NAME,WORKFLOW_TOOL_NAME,LOAD_SKILL_TOOL_NAME]},version:1,workflow:{enabled:o.workflowEnabled,toolName:WORKFLOW_TOOL_NAME},workspace:{resourceRoot:o.workspaceResourceRoot,rootEntries:[...o.workspaceResourceRoot.rootEntries]}}}export{buildAgentInfoResponseFromManifest};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AgentInfoData, CompiledSubagentNode, ResolvedSchedule } from "#internal/nitro/routes/agent-info/load-agent-info-data.js";
|
|
2
2
|
import type { ResolvedChannelDefinition, ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
|
+
import type { ModelRouting } from "#shared/agent-definition.js";
|
|
4
|
+
import type { ModelEndpointStatus } from "#shared/model-endpoint-status.js";
|
|
3
5
|
export interface AgentInfoSource {
|
|
4
6
|
readonly exportName?: string;
|
|
5
7
|
readonly logicalPath: string;
|
|
@@ -129,6 +131,8 @@ export interface AgentInfoResponse {
|
|
|
129
131
|
readonly id: string;
|
|
130
132
|
readonly providerOptions?: unknown;
|
|
131
133
|
readonly source?: AgentInfoSource;
|
|
134
|
+
readonly routing?: ModelRouting;
|
|
135
|
+
readonly endpoint?: ModelEndpointStatus;
|
|
132
136
|
};
|
|
133
137
|
readonly name: string;
|
|
134
138
|
readonly outputSchema?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildAgentInfoResponseFromManifest}from"#internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js";import{loadAgentInfoManifestData,resolveAgentInfoCompiledArtifactsSource}from"#internal/nitro/routes/agent-info/load-agent-info-data.js";import{localDev,routeAuth,vercelOidc}from"#public/channels/auth.js";async function createAgentInfoPayload(r){return buildAgentInfoResponseFromManifest(await loadAgentInfoManifestData({compiledArtifactsSource:resolveAgentInfoCompiledArtifactsSource(r)}),{mode:r.mode??`development
|
|
1
|
+
import{buildAgentInfoResponseFromManifest}from"#internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js";import{loadAgentInfoManifestData,resolveAgentInfoCompiledArtifactsSource}from"#internal/nitro/routes/agent-info/load-agent-info-data.js";import{localDev,routeAuth,vercelOidc}from"#public/channels/auth.js";async function createAgentInfoPayload(r){return buildAgentInfoResponseFromManifest(await loadAgentInfoManifestData({compiledArtifactsSource:resolveAgentInfoCompiledArtifactsSource(r)}),{mode:r.mode??`development`,gatewayCredentials:{apiKey:hasEnvValue(process.env.AI_GATEWAY_API_KEY),oidc:hasEnvValue(process.env.VERCEL_OIDC_TOKEN)}})}function hasEnvValue(e){return e!==void 0&&e.trim()!==``}async function handleAgentInfoRequest(e,t){let n=await routeAuth(t,[localDev(),vercelOidc()]);return n instanceof Response?n:new Response(JSON.stringify(await createAgentInfoPayload(e)),{headers:{"cache-control":`no-store`,"content-type":`application/json; charset=utf-8`}})}export{handleAgentInfoRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createBundledRuntimeCompiledArtifactsSource,createDiskRuntimeCompiledArtifactsSource}from"#runtime/compiled-artifacts-source.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{readDevelopmentRuntimeArtifactsSnapshotRoot}from"#internal/nitro/dev-runtime-artifacts.js";function resolveNitroCompiledArtifactsSource(e){let{appRoot:t,dev:n}=e;if(n&&t!==void 0){if(e.moduleMapLoaderPath===void 0)throw Error(`Eve Nitro development routes require "moduleMapLoaderPath" in the artifacts config.`);return createDiskRuntimeCompiledArtifactsSource(readDevelopmentRuntimeArtifactsSnapshotRoot(e.devRuntimeArtifactsPointerPath)??t,{moduleMapLoaderPath:e.moduleMapLoaderPath})}if(readBundledCompiledArtifacts()!==null)return createBundledRuntimeCompiledArtifactsSource();if(t!==void 0)return createDiskRuntimeCompiledArtifactsSource(t);throw Error(`Eve Nitro route requires bundled artifacts or an Eve Nitro runtime configuration app root.`)}export{resolveNitroCompiledArtifactsSource};
|
|
1
|
+
import{createBundledRuntimeCompiledArtifactsSource,createDiskRuntimeCompiledArtifactsSource}from"#runtime/compiled-artifacts-source.js";import{readBundledCompiledArtifacts}from"#runtime/loaders/bundled-artifacts.js";import{readDevelopmentRuntimeArtifactsSnapshotRoot}from"#internal/nitro/dev-runtime-artifacts.js";function resolveNitroCompiledArtifactsSource(e){let{appRoot:t,dev:n}=e;if(n&&t!==void 0){if(e.moduleMapLoaderPath===void 0)throw Error(`Eve Nitro development routes require "moduleMapLoaderPath" in the artifacts config.`);return createDiskRuntimeCompiledArtifactsSource(readDevelopmentRuntimeArtifactsSnapshotRoot(e.devRuntimeArtifactsPointerPath)??t,{moduleMapLoaderPath:e.moduleMapLoaderPath,sandboxAppRoot:t})}if(readBundledCompiledArtifacts()!==null)return createBundledRuntimeCompiledArtifactsSource();if(t!==void 0)return createDiskRuntimeCompiledArtifactsSource(t);throw Error(`Eve Nitro route requires bundled artifacts or an Eve Nitro runtime configuration app root.`)}export{resolveNitroCompiledArtifactsSource};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ModelRouting } from "#shared/agent-definition.js";
|
|
2
|
+
import type { ModelEndpointStatus } from "#shared/model-endpoint-status.js";
|
|
3
|
+
/**
|
|
4
|
+
* Presence of the two gateway credentials, read from wherever the caller can
|
|
5
|
+
* observe them: the running server's `process.env` (runtime-authoritative) or
|
|
6
|
+
* an app's `.env` files (dev/setup-time). Only meaningful for gateway routing.
|
|
7
|
+
*/
|
|
8
|
+
export interface GatewayCredentialPresence {
|
|
9
|
+
/** `AI_GATEWAY_API_KEY` is set. */
|
|
10
|
+
readonly apiKey: boolean;
|
|
11
|
+
/** A Vercel OIDC token is available (`VERCEL_OIDC_TOKEN` or a linked project). */
|
|
12
|
+
readonly oidc: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Composes the build-time {@link ModelRouting} with runtime credential presence
|
|
16
|
+
* into the consumer-facing {@link ModelEndpointStatus}.
|
|
17
|
+
*
|
|
18
|
+
* Credentials matter only for gateway routing; an external endpoint makes no
|
|
19
|
+
* connectedness claim. `api-key` outranks `oidc` to match the AI SDK gateway
|
|
20
|
+
* provider, which uses `AI_GATEWAY_API_KEY` when present and otherwise the OIDC
|
|
21
|
+
* token.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveModelEndpointStatus(routing: ModelRouting, credentials: GatewayCredentialPresence): ModelEndpointStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function resolveModelEndpointStatus(e,t){return e.kind===`external`?{kind:`external`,provider:e.provider}:t.apiKey?{kind:`gateway`,connected:!0,credential:`api-key`}:t.oidc?{kind:`gateway`,connected:!0,credential:`oidc`}:{kind:`gateway`,connected:!1}}export{resolveModelEndpointStatus};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{builtinModules}from"node:module";import{resolveWorkflowModulePath}from"#internal/application/package.js";import{dirname,join,relative,resolve}from"node:path";import{existsSync}from"node:fs";import{mkdir,readFile,readdir,rename,writeFile}from"node:fs/promises";import{EVE_WORKFLOW_QUEUE_NAMESPACE}from"#internal/workflow/queue-namespace.js";import{buildWithNitroRolldown,getSingleRolldownChunk}from"#internal/bundler/nitro-rolldown.js";import{applyWorkflowTransform,getImportPath}from"#internal/workflow-bundle/workflow-builders.js";const WORKFLOW_VIRTUAL_ENTRY_ID=`\0eve-workflow-entry`,PSEUDO_PACKAGES=new Set([`server-only`,`client-only`,`next/dist/compiled/server-only`,`next/dist/compiled/client-only`]),NODE_BUILTIN_MODULES=new Set([...builtinModules,...builtinModules.map(e=>`node:${e}`)]),WORKFLOW_INPUT_EXTENSIONS=new Set([`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`]),IGNORED_INPUT_DIRECTORIES=new Set([`node_modules`,`.git`,`.next`,`.nuxt`,`.output`,`.vercel`,`.workflow-data`,`.workflow-vitest`,`.well-known`,`.svelte-kit`,`.turbo`,`.cache`,`.yarn`,`.pnpm-store`]);async function collectWorkflowInputFiles(e){let t=[];async function visit(e){let n;try{n=await readdir(e,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}for(let i of n){if(i.isDirectory()){IGNORED_INPUT_DIRECTORIES.has(i.name)||await visit(join(e,i.name));continue}if(!i.isFile())continue;let n=i.name.match(/\.[^.]+$/)?.[0];n!==void 0&&WORKFLOW_INPUT_EXTENSIONS.has(n)&&t.push(join(e,i.name))}}return await visit(e),t}function createWorkflowImport(e,t){let{importPath:n,isPackage:r}=getImportPath(e,t);return r?`import ${JSON.stringify(n)};`:`import ${JSON.stringify(toRelativeImportSpecifier(t,e))};`}function createWorkflowVirtualEntryPlugin(e){return{name:`eve-workflow-virtual-entry`,resolveId(e){if(e===`\0eve-workflow-entry`)return{id:e}},load(t){if(t===`\0eve-workflow-entry`)return{code:e,moduleSideEffects:!0,moduleType:`js`}}}}function createWorkflowPseudoPackagePlugin(){return{name:`eve-workflow-pseudo-packages`,resolveId(e){if(PSEUDO_PACKAGES.has(e))return{id:`\0eve-workflow-pseudo-package:${e}`}},load(e){if(e.startsWith(`\0eve-workflow-pseudo-package:`))return{code:``,moduleType:`js`}}}}function createWorkflowRuntimeAliasPlugin(){return{name:`eve-workflow-runtime-aliases`,resolveId(e){if(!(e!==`workflow`&&!e.startsWith(`workflow/`)))return resolveWorkflowModulePath(e)}}}function createEvePackageImportsPlugin(e,t={}){return{name:`eve-package-imports`,resolveId(n){let i=n.match(/^#compiled\/(.+)$/)?.[1];if(i!==void 0)return t.workflowCondition===!0&&i===`@workflow/core/index.js`?resolveFirstExistingPath([join(e,`src`,`internal`,`workflow-bundle`,`workflow-core-shim.ts`),join(e,`dist`,`src`,`internal`,`workflow-bundle`,`workflow-core-shim.js`)]):resolveFirstExistingPath([join(e,`.generated`,`compiled`,i),join(e,`dist`,`src`,`compiled`,i)]);let a=n.match(/^#(.+)\.js$/)?.[1];if(a!==void 0)return resolveFirstExistingPath([`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`].flatMap(t=>[join(e,`src`,`${a}${t}`),join(e,`dist`,`src`,`${a}${t}`)]))}}}function createWorkflowTransformPlugin(e){let t=new Set(e.sideEffectFiles?.map(e=>e.replaceAll(`\\`,`/`))??[]);return{name:`eve-workflow-transform`,async load(n){if(!isJavaScriptLikePath(n))return;let r=await readFile(n,`utf8`),i=await applyWorkflowTransform(createManifestRelativeFilepath(e.workingDir,n),r.replace(/require\(\s*(['"])server-only\1\s*\)/g,`void 0`).replace(/require\(\s*(['"])client-only\1\s*\)/g,`void 0`),e.mode??`workflow`,n,e.projectRoot);return mergeWorkflowManifest(e.manifest,i.workflowManifest),{code:i.code,map:null,moduleSideEffects:t.has(n.replaceAll(`\\`,`/`))||void 0}}}}async function bundleWorkflowStepRegistrations(e){let t=[...e.discoveredEntries.discoveredSteps].sort(),n=new Set(t),r=[...e.discoveredEntries.discoveredSerdeFiles].sort().filter(e=>!n.has(e)),i={},a=[createWorkflowImport(e.builtinsPath,e.workingDir),...t.map(t=>createWorkflowImport(t,e.workingDir)),...r.map(t=>createWorkflowImport(t,e.workingDir)),`export const __steps_registered = true;`].join(`
|
|
2
|
-
`),o=getSingleRolldownChunk(await buildWithNitroRolldown({cwd:e.workingDir,input:WORKFLOW_VIRTUAL_ENTRY_ID,platform:`node`,plugins:[createWorkflowVirtualEntryPlugin(a),createWorkflowPseudoPackagePlugin(),createWorkflowRuntimeAliasPlugin(),createEvePackageImportsPlugin(e.workingDir),createWorkflowTransformPlugin({manifest:i,mode:`step`,projectRoot:e.projectRoot,sideEffectFiles:[...t,...r],workingDir:e.workingDir})],resolve:{conditionNames:[`eve-source`,`node`,`import`,`default`],extensions:[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`],mainFields:[`module`,`main`]},tsconfig:e.tsconfigPath??!1,write:!1,output:{codeSplitting:!1,comments:!1,format:`esm`,sourcemap:`inline`}}),`step registrations bundle for "${e.outfile}"`);await writeWorkflowBundleAtomically(e.outfile,o.code)}function createWorkflowNodeBuiltinGuardPlugin(){return{name:`eve-workflow-node-builtins`,resolveId(e,t){let n=e.startsWith(`node:`)?e.slice(5):e;if(!NODE_BUILTIN_MODULES.has(e)&&!NODE_BUILTIN_MODULES.has(n))return;let r=t?` (imported by "${t}")`:``;throw Error(`Workflow bundle cannot import Node.js builtin "${e}"${r}. Move Node.js APIs behind a "use step" function, or keep the importing module out of the workflow driver body (only reachable through a "use step").`)}}}async function bundleFinalWorkflowOutput(e){let t=`// biome-ignore-all lint: generated file
|
|
1
|
+
import{builtinModules}from"node:module";import{resolveWorkflowModulePath}from"#internal/application/package.js";import{dirname,join,relative,resolve}from"node:path";import{existsSync}from"node:fs";import{mkdir,readFile,readdir,rename,writeFile}from"node:fs/promises";import{EVE_WORKFLOW_QUEUE_NAMESPACE}from"#internal/workflow/queue-namespace.js";import{buildWithNitroRolldown,getSingleRolldownChunk}from"#internal/bundler/nitro-rolldown.js";import{WORKFLOW_STEP_EXTERNAL_PACKAGES}from"#internal/workflow-bundle/vercel-workflow-output.js";import{applyWorkflowTransform,getImportPath}from"#internal/workflow-bundle/workflow-builders.js";const WORKFLOW_VIRTUAL_ENTRY_ID=`\0eve-workflow-entry`,PSEUDO_PACKAGES=new Set([`server-only`,`client-only`,`next/dist/compiled/server-only`,`next/dist/compiled/client-only`]),NODE_BUILTIN_MODULES=new Set([...builtinModules,...builtinModules.map(e=>`node:${e}`)]),WORKFLOW_INPUT_EXTENSIONS=new Set([`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`]),IGNORED_INPUT_DIRECTORIES=new Set([`node_modules`,`.git`,`.next`,`.nuxt`,`.output`,`.vercel`,`.workflow-data`,`.workflow-vitest`,`.well-known`,`.svelte-kit`,`.turbo`,`.cache`,`.yarn`,`.pnpm-store`]);async function collectWorkflowInputFiles(e){let t=[];async function visit(e){let n;try{n=await readdir(e,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}for(let i of n){if(i.isDirectory()){IGNORED_INPUT_DIRECTORIES.has(i.name)||await visit(join(e,i.name));continue}if(!i.isFile())continue;let n=i.name.match(/\.[^.]+$/)?.[0];n!==void 0&&WORKFLOW_INPUT_EXTENSIONS.has(n)&&t.push(join(e,i.name))}}return await visit(e),t}function createWorkflowImport(e,t){let{importPath:n,isPackage:r}=getImportPath(e,t);return r?`import ${JSON.stringify(n)};`:`import ${JSON.stringify(toRelativeImportSpecifier(t,e))};`}function createWorkflowVirtualEntryPlugin(e){return{name:`eve-workflow-virtual-entry`,resolveId(e){if(e===`\0eve-workflow-entry`)return{id:e}},load(t){if(t===`\0eve-workflow-entry`)return{code:e,moduleSideEffects:!0,moduleType:`js`}}}}function createWorkflowPseudoPackagePlugin(){return{name:`eve-workflow-pseudo-packages`,resolveId(e){if(PSEUDO_PACKAGES.has(e))return{id:`\0eve-workflow-pseudo-package:${e}`}},load(e){if(e.startsWith(`\0eve-workflow-pseudo-package:`))return{code:``,moduleType:`js`}}}}function createWorkflowRuntimeAliasPlugin(){return{name:`eve-workflow-runtime-aliases`,resolveId(e){if(!(e!==`workflow`&&!e.startsWith(`workflow/`)))return resolveWorkflowModulePath(e)}}}function createEvePackageImportsPlugin(e,t={}){return{name:`eve-package-imports`,resolveId(n){let i=n.match(/^#compiled\/(.+)$/)?.[1];if(i!==void 0)return t.workflowCondition===!0&&i===`@workflow/core/index.js`?resolveFirstExistingPath([join(e,`src`,`internal`,`workflow-bundle`,`workflow-core-shim.ts`),join(e,`dist`,`src`,`internal`,`workflow-bundle`,`workflow-core-shim.js`)]):resolveFirstExistingPath([join(e,`.generated`,`compiled`,i),join(e,`dist`,`src`,`compiled`,i)]);let a=n.match(/^#(.+)\.js$/)?.[1];if(a!==void 0)return resolveFirstExistingPath([`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`].flatMap(t=>[join(e,`src`,`${a}${t}`),join(e,`dist`,`src`,`${a}${t}`)]))}}}function createWorkflowTransformPlugin(e){let t=new Set(e.sideEffectFiles?.map(e=>e.replaceAll(`\\`,`/`))??[]);return{name:`eve-workflow-transform`,async load(n){if(!isJavaScriptLikePath(n))return;let r=await readFile(n,`utf8`),i=await applyWorkflowTransform(createManifestRelativeFilepath(e.workingDir,n),r.replace(/require\(\s*(['"])server-only\1\s*\)/g,`void 0`).replace(/require\(\s*(['"])client-only\1\s*\)/g,`void 0`),e.mode??`workflow`,n,e.projectRoot);return mergeWorkflowManifest(e.manifest,i.workflowManifest),{code:i.code,map:null,moduleSideEffects:t.has(n.replaceAll(`\\`,`/`))||void 0}}}}async function bundleWorkflowStepRegistrations(e){let t=[...e.discoveredEntries.discoveredSteps].sort(),n=new Set(t),r=[...e.discoveredEntries.discoveredSerdeFiles].sort().filter(e=>!n.has(e)),i={},a=[createWorkflowImport(e.builtinsPath,e.workingDir),...t.map(t=>createWorkflowImport(t,e.workingDir)),...r.map(t=>createWorkflowImport(t,e.workingDir)),`export const __steps_registered = true;`].join(`
|
|
2
|
+
`),o=getSingleRolldownChunk(await buildWithNitroRolldown({cwd:e.workingDir,input:WORKFLOW_VIRTUAL_ENTRY_ID,external:isWorkflowStepExternalPackage,platform:`node`,plugins:[createWorkflowVirtualEntryPlugin(a),createWorkflowPseudoPackagePlugin(),createWorkflowRuntimeAliasPlugin(),createEvePackageImportsPlugin(e.workingDir),createWorkflowTransformPlugin({manifest:i,mode:`step`,projectRoot:e.projectRoot,sideEffectFiles:[...t,...r],workingDir:e.workingDir})],resolve:{conditionNames:[`eve-source`,`node`,`import`,`default`],extensions:[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`],mainFields:[`module`,`main`]},tsconfig:e.tsconfigPath??!1,write:!1,output:{codeSplitting:!1,comments:!1,format:`esm`,sourcemap:`inline`}}),`step registrations bundle for "${e.outfile}"`);await writeWorkflowBundleAtomically(e.outfile,o.code)}function isWorkflowStepExternalPackage(e){return WORKFLOW_STEP_EXTERNAL_PACKAGES.some(t=>e===t||e.startsWith(`${t}/`))}function createWorkflowNodeBuiltinGuardPlugin(){return{name:`eve-workflow-node-builtins`,resolveId(e,t){let n=e.startsWith(`node:`)?e.slice(5):e;if(!NODE_BUILTIN_MODULES.has(e)&&!NODE_BUILTIN_MODULES.has(n))return;let r=t?` (imported by "${t}")`:``;throw Error(`Workflow bundle cannot import Node.js builtin "${e}"${r}. Move Node.js APIs behind a "use step" function, or keep the importing module out of the workflow driver body (only reachable through a "use step").`)}}}async function bundleFinalWorkflowOutput(e){let t=`// biome-ignore-all lint: generated file
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
import { workflowEntrypoint } from 'workflow/runtime';
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const WORKFLOW_STEP_EXTERNAL_PACKAGES: readonly ["@mongodb-js/zstd", "node-liblzma"];
|
|
1
|
+
export declare const WORKFLOW_STEP_EXTERNAL_PACKAGES: readonly ["@mongodb-js/zstd", "just-bash", "microsandbox", "node-liblzma"];
|
|
2
2
|
/**
|
|
3
3
|
* Packages that must stay external during the initial workflow builder
|
|
4
4
|
* pass so `node:*` transitive dependencies do not fail the workflow VM check.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{basename,dirname,extname,join,relative}from"node:path";import{cp,mkdir,readFile,readdir,realpath,rename,rm,symlink,writeFile}from"node:fs/promises";import{EVE_WORKFLOW_QUEUE_NAMESPACE,WORKFLOW_QUEUE_NAMESPACE_ENV}from"#internal/workflow/queue-namespace.js";import{buildWithNitroRolldown,getSingleRolldownChunk}from"#internal/bundler/nitro-rolldown.js";import{EVE_SHARED_SERVER_FUNCTION_PATH,applyEveServiceRoutePrefixWrapper,isEveVercelFunctionPath,normalizeEveVercelRoutes}from"#internal/workflow-bundle/eve-service-route-output.js";const WORKFLOW_STEP_EXTERNAL_PACKAGES=[`@mongodb-js/zstd`,`node-liblzma`],WORKFLOW_BUILDER_DEFERRED_PACKAGES=[`@chat-adapter/slack`,`chat`];function createWorkflowFunctionEnvironment(e){let t={};return isRecord(e)&&Object.assign(t,e),t.NODE_OPTIONS=`--experimental-require-module`,t[WORKFLOW_QUEUE_NAMESPACE_ENV]=EVE_WORKFLOW_QUEUE_NAMESPACE,t}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function prepareVercelFunctionDirectory(e){await rm(e,{force:!0,recursive:!0}),await mkdir(e,{recursive:!0})}async function resolveNitroFunctionDirectory(e){try{return await realpath(e.sourcePath)}catch{return await realpath(e.fallbackPath)}}async function copyNitroFunctionDirectory(e){let t=await resolveNitroFunctionDirectory({fallbackPath:e.fallbackPath,sourcePath:e.sourcePath});await prepareVercelFunctionDirectory(e.targetPath),await cp(t,e.targetPath,{dereference:!0,recursive:!0})}async function normalizeEveVercelFunctionOutput(e,t={}){let n=join(e,`functions`),i=await prepareSharedEveServerFunction(n);i!==null&&(t.servicePrefix!==void 0&&await applyEveServiceRoutePrefixWrapper(i,t.servicePrefix),await repointEveFunctionSymlinksInDirectory(n,i)),await pruneNonEveFunctionEntries(n,n),await pruneNonEveVercelRoutes(e,t.servicePrefix)}async function prepareSharedEveServerFunction(e){let n=join(e,`__server.func`),i=join(e,EVE_SHARED_SERVER_FUNCTION_PATH),s;try{s=await realpath(n)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return null;throw e}let c=`${i}.eve-staging`;return await mkdir(dirname(i),{recursive:!0}),await rm(c,{force:!0,recursive:!0}),await cp(s,c,{dereference:!0,recursive:!0}),await rm(i,{force:!0,recursive:!0}),await rename(c,i),i}async function repointEveFunctionSymlinksInDirectory(e,t,n=e){let a;try{a=await readdir(e,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}await Promise.all(a.map(async a=>{let o=join(e,a.name),s=normalizeVercelOutputPath(relative(n,o));if(a.isSymbolicLink()){a.name.endsWith(`.func`)&&isEveVercelFunctionPath(s)&&await repointFunctionSymlink(o,t);return}a.isDirectory()&&!a.name.endsWith(`.func`)&&await repointEveFunctionSymlinksInDirectory(o,t,n)}))}async function repointFunctionSymlink(e,n){await rm(e,{force:!0,recursive:!0}),await symlink(normalizeVercelOutputPath(relative(dirname(e),n)),e,`dir`)}async function pruneNonEveFunctionEntries(e,t){let n;try{n=await readdir(t,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}await Promise.all(n.map(async n=>{let a=join(t,n.name),o=normalizeVercelOutputPath(relative(e,a));if(n.name.endsWith(`.func`)){isEveVercelFunctionPath(o)||await rm(a,{force:!0,recursive:!0});return}n.isDirectory()&&await pruneNonEveFunctionEntries(e,a)}))}async function pruneNonEveVercelRoutes(e,t){let n=join(e,`config.json`),i;try{i=JSON.parse(await readFile(n,`utf8`))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}!isRecord(i)||!Array.isArray(i.routes)||(i.routes=normalizeEveVercelRoutes(i.routes,t),await writeFile(n,`${JSON.stringify(i,null,2)}\n`))}function normalizeVercelOutputPath(e){return e.replaceAll(`\\`,`/`)}async function emitBundledWorkflowFunctionDirectory(e){await prepareVercelFunctionDirectory(e.targetPath);let n=await emitBundledWorkflowPluginModules({build:buildWithNitroRolldown,pluginPaths:e.pluginPaths??[],targetPath:e.targetPath}),i=join(dirname(e.bundlePath),`__eve_workflow_function_entry.js`),a=getSingleRolldownChunk(await buildWithNitroRolldown({cwd:dirname(e.bundlePath),input:i,platform:`node`,plugins:[createVirtualModulePlugin({id:i,moduleType:`js`,source:createWorkflowFunctionEntrypointSource({bundlePath:e.bundlePath,pluginModulePaths:n})})],write:!1,output:{codeSplitting:!1,comments:!1,format:`cjs`,sourcemap:!1}}),`Vercel workflow function for "${e.bundlePath}"`);await Promise.all([writeFile(join(e.targetPath,`index.js`),a.code),writeFile(join(e.targetPath,`package.json`),`${JSON.stringify({type:`commonjs`},null,2)}\n`),writeFile(join(e.targetPath,`.vc-config.json`),`${JSON.stringify({environment:createWorkflowFunctionEnvironment(),handler:`index.js`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2)}\n`)])}async function emitBundledWorkflowPluginModules(e){return await Promise.all(e.pluginPaths.map(async(t,n)=>{let i=getSingleRolldownChunk(await e.build({input:t,platform:`node`,write:!1,output:{codeSplitting:!1,comments:!1,format:`esm`,sourcemap:!1}}),`workflow plugin for "${t}"`),a=`__eve_workflow_plugin_${n}.mjs`;return await writeFile(join(e.targetPath,a),i.code),`./${a}`}))}function createVirtualModulePlugin(e){return{name:`eve-virtual-module`,resolveId(t){return t===e.id?e.id:void 0},load(t){return t===e.id?{code:e.source,moduleType:e.moduleType}:void 0}}}function toRelativeImportPath(e){let t=relative(e.fromDirectoryPath,e.toFilePath).replaceAll(`\\`,`/`);return t.startsWith(`.`)?t:`./${t}`}function normalizeImportSpecifierPath(e){return e.replaceAll(`\\`,`/`)}function createWorkflowFunctionEntrypointSource(t){let n=t.pluginModulePaths.map(e=>normalizeImportSpecifierPath(e)),r=n.length>0;return[`const { POST } = require(${JSON.stringify(`./${basename(t.bundlePath)}`)});`,...r?[`const workflowPluginModulePaths = ${JSON.stringify(n)};`,``,`let workflowPluginPromise;`,``,`async function loadWorkflowPlugins() {`,` if (workflowPluginPromise == null) {`,` workflowPluginPromise = (async () => {`,` for (const pluginPath of workflowPluginModulePaths) {`,` await import(pluginPath);`,` }`,` })();`,` }`,` return await workflowPluginPromise;`,`}`]:[],``,`const DEFAULT_WORKFLOW_REQUEST_ORIGIN = "https://workflow.invalid";`,``,`function getHeader(headers, name) {`,` if (headers === null || headers === undefined) {`,` return undefined;`,` }`,` if (typeof headers.get === "function") {`,` const value = headers.get(name);`,` return typeof value === "string" && value.length > 0 ? value : undefined;`,` }`,` if (typeof headers !== "object") {`,` return undefined;`,` }`,` const record = headers;`,` const lowerName = name.toLowerCase();`,` for (const [key, value] of Object.entries(record)) {`,` if (key.toLowerCase() !== lowerName || value === undefined) {`,` continue;`,` }`,` if (Array.isArray(value)) {`,` return value.find((item) => typeof item === "string" && item.length > 0);`,` }`,` return typeof value === "string" && value.length > 0 ? value : undefined;`,` }`,` return undefined;`,`}`,``,`function createHeaders(headers) {`,` const normalized = new Headers();`,` if (headers === null || headers === undefined) {`,` return normalized;`,` }`,` if (headers instanceof Headers) {`,` return headers;`,` }`,` if (typeof headers.forEach === "function" && typeof headers.entries === "function") {`,` for (const [key, value] of headers.entries()) {`,` normalized.append(key, value);`,` }`,` return normalized;`,` }`,` for (const [key, value] of Object.entries(headers)) {`,` if (value === undefined) {`,` continue;`,` }`,` if (Array.isArray(value)) {`,` for (const item of value) {`,` normalized.append(key, String(item));`,` }`,` continue;`,` }`,` normalized.set(key, String(value));`,` }`,` return normalized;`,`}`,``,`function toAbsoluteWorkflowUrl(request) {`,` const url = typeof request?.url === "string" ? request.url : "/";`,` if (/^https?:\\/\\//.test(url)) {`,` return url;`,` }`,` const host = getHeader(request?.headers, "x-forwarded-host") ?? getHeader(request?.headers, "host");`,` const protocolHeader = getHeader(request?.headers, "x-forwarded-proto");`,` const protocol = protocolHeader === "http" || protocolHeader === "https" ? protocolHeader : "https";`,` const origin = typeof host === "string" && host.length > 0 ? protocol + "://" + host : DEFAULT_WORKFLOW_REQUEST_ORIGIN;`,` return new URL(url, origin).toString();`,`}`,``,`function normalizeWorkflowRequest(request) {`,` if (request instanceof Request) {`,` if (/^https?:\\/\\//.test(request.url)) {`,` return request;`,` }`,` return new Request(toAbsoluteWorkflowUrl(request), request);`,` }`,` const method = typeof request?.method === "string" ? request.method : "GET";`,` const headers = createHeaders(request?.headers);`,` const init = {`,` headers,`,` method,`,` };`,` if (method !== "GET" && method !== "HEAD") {`,` const body = request?.body ?? (request !== null && typeof request === "object" && typeof request.pipe === "function" ? request : undefined);`,` if (body !== undefined) {`,` init.body = body;`,` init.duplex = "half";`,` }`,` }`,` return new Request(toAbsoluteWorkflowUrl(request), init);`,`}`,``,`module.exports = async function handleWorkflowFunctionRequest(requestContext) {`,` const request =`,` requestContext !== null && typeof requestContext === "object" && "req" in requestContext`,` ? requestContext.req`,` : requestContext;`,...r?[` await loadWorkflowPlugins();`]:[],` return await POST(normalizeWorkflowRequest(request));`,`};`,``].join(`
|
|
1
|
+
import{basename,dirname,extname,join,relative}from"node:path";import{cp,mkdir,readFile,readdir,realpath,rename,rm,symlink,writeFile}from"node:fs/promises";import{EVE_WORKFLOW_QUEUE_NAMESPACE,WORKFLOW_QUEUE_NAMESPACE_ENV}from"#internal/workflow/queue-namespace.js";import{buildWithNitroRolldown,getSingleRolldownChunk}from"#internal/bundler/nitro-rolldown.js";import{EVE_SHARED_SERVER_FUNCTION_PATH,applyEveServiceRoutePrefixWrapper,isEveVercelFunctionPath,normalizeEveVercelRoutes}from"#internal/workflow-bundle/eve-service-route-output.js";const WORKFLOW_STEP_EXTERNAL_PACKAGES=[`@mongodb-js/zstd`,`just-bash`,`microsandbox`,`node-liblzma`],WORKFLOW_BUILDER_DEFERRED_PACKAGES=[`@chat-adapter/slack`,`chat`];function createWorkflowFunctionEnvironment(e){let t={};return isRecord(e)&&Object.assign(t,e),t.NODE_OPTIONS=`--experimental-require-module`,t[WORKFLOW_QUEUE_NAMESPACE_ENV]=EVE_WORKFLOW_QUEUE_NAMESPACE,t}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function prepareVercelFunctionDirectory(e){await rm(e,{force:!0,recursive:!0}),await mkdir(e,{recursive:!0})}async function resolveNitroFunctionDirectory(e){try{return await realpath(e.sourcePath)}catch{return await realpath(e.fallbackPath)}}async function copyNitroFunctionDirectory(e){let t=await resolveNitroFunctionDirectory({fallbackPath:e.fallbackPath,sourcePath:e.sourcePath});await prepareVercelFunctionDirectory(e.targetPath),await cp(t,e.targetPath,{dereference:!0,recursive:!0})}async function normalizeEveVercelFunctionOutput(e,t={}){let n=join(e,`functions`),i=await prepareSharedEveServerFunction(n);i!==null&&(t.servicePrefix!==void 0&&await applyEveServiceRoutePrefixWrapper(i,t.servicePrefix),await repointEveFunctionSymlinksInDirectory(n,i)),await pruneNonEveFunctionEntries(n,n),await pruneNonEveVercelRoutes(e,t.servicePrefix)}async function prepareSharedEveServerFunction(e){let n=join(e,`__server.func`),i=join(e,EVE_SHARED_SERVER_FUNCTION_PATH),s;try{s=await realpath(n)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return null;throw e}let c=`${i}.eve-staging`;return await mkdir(dirname(i),{recursive:!0}),await rm(c,{force:!0,recursive:!0}),await cp(s,c,{dereference:!0,recursive:!0}),await rm(i,{force:!0,recursive:!0}),await rename(c,i),i}async function repointEveFunctionSymlinksInDirectory(e,t,n=e){let a;try{a=await readdir(e,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}await Promise.all(a.map(async a=>{let o=join(e,a.name),s=normalizeVercelOutputPath(relative(n,o));if(a.isSymbolicLink()){a.name.endsWith(`.func`)&&isEveVercelFunctionPath(s)&&await repointFunctionSymlink(o,t);return}a.isDirectory()&&!a.name.endsWith(`.func`)&&await repointEveFunctionSymlinksInDirectory(o,t,n)}))}async function repointFunctionSymlink(e,n){await rm(e,{force:!0,recursive:!0}),await symlink(normalizeVercelOutputPath(relative(dirname(e),n)),e,`dir`)}async function pruneNonEveFunctionEntries(e,t){let n;try{n=await readdir(t,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}await Promise.all(n.map(async n=>{let a=join(t,n.name),o=normalizeVercelOutputPath(relative(e,a));if(n.name.endsWith(`.func`)){isEveVercelFunctionPath(o)||await rm(a,{force:!0,recursive:!0});return}n.isDirectory()&&await pruneNonEveFunctionEntries(e,a)}))}async function pruneNonEveVercelRoutes(e,t){let n=join(e,`config.json`),i;try{i=JSON.parse(await readFile(n,`utf8`))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}!isRecord(i)||!Array.isArray(i.routes)||(i.routes=normalizeEveVercelRoutes(i.routes,t),await writeFile(n,`${JSON.stringify(i,null,2)}\n`))}function normalizeVercelOutputPath(e){return e.replaceAll(`\\`,`/`)}async function emitBundledWorkflowFunctionDirectory(e){await prepareVercelFunctionDirectory(e.targetPath);let n=await emitBundledWorkflowPluginModules({build:buildWithNitroRolldown,pluginPaths:e.pluginPaths??[],targetPath:e.targetPath}),i=join(dirname(e.bundlePath),`__eve_workflow_function_entry.js`),a=getSingleRolldownChunk(await buildWithNitroRolldown({cwd:dirname(e.bundlePath),input:i,platform:`node`,plugins:[createVirtualModulePlugin({id:i,moduleType:`js`,source:createWorkflowFunctionEntrypointSource({bundlePath:e.bundlePath,pluginModulePaths:n})})],write:!1,output:{codeSplitting:!1,comments:!1,format:`cjs`,sourcemap:!1}}),`Vercel workflow function for "${e.bundlePath}"`);await Promise.all([writeFile(join(e.targetPath,`index.js`),a.code),writeFile(join(e.targetPath,`package.json`),`${JSON.stringify({type:`commonjs`},null,2)}\n`),writeFile(join(e.targetPath,`.vc-config.json`),`${JSON.stringify({environment:createWorkflowFunctionEnvironment(),handler:`index.js`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2)}\n`)])}async function emitBundledWorkflowPluginModules(e){return await Promise.all(e.pluginPaths.map(async(t,n)=>{let i=getSingleRolldownChunk(await e.build({input:t,platform:`node`,write:!1,output:{codeSplitting:!1,comments:!1,format:`esm`,sourcemap:!1}}),`workflow plugin for "${t}"`),a=`__eve_workflow_plugin_${n}.mjs`;return await writeFile(join(e.targetPath,a),i.code),`./${a}`}))}function createVirtualModulePlugin(e){return{name:`eve-virtual-module`,resolveId(t){return t===e.id?e.id:void 0},load(t){return t===e.id?{code:e.source,moduleType:e.moduleType}:void 0}}}function toRelativeImportPath(e){let t=relative(e.fromDirectoryPath,e.toFilePath).replaceAll(`\\`,`/`);return t.startsWith(`.`)?t:`./${t}`}function normalizeImportSpecifierPath(e){return e.replaceAll(`\\`,`/`)}function createWorkflowFunctionEntrypointSource(t){let n=t.pluginModulePaths.map(e=>normalizeImportSpecifierPath(e)),r=n.length>0;return[`const { POST } = require(${JSON.stringify(`./${basename(t.bundlePath)}`)});`,...r?[`const workflowPluginModulePaths = ${JSON.stringify(n)};`,``,`let workflowPluginPromise;`,``,`async function loadWorkflowPlugins() {`,` if (workflowPluginPromise == null) {`,` workflowPluginPromise = (async () => {`,` for (const pluginPath of workflowPluginModulePaths) {`,` await import(pluginPath);`,` }`,` })();`,` }`,` return await workflowPluginPromise;`,`}`]:[],``,`const DEFAULT_WORKFLOW_REQUEST_ORIGIN = "https://workflow.invalid";`,``,`function getHeader(headers, name) {`,` if (headers === null || headers === undefined) {`,` return undefined;`,` }`,` if (typeof headers.get === "function") {`,` const value = headers.get(name);`,` return typeof value === "string" && value.length > 0 ? value : undefined;`,` }`,` if (typeof headers !== "object") {`,` return undefined;`,` }`,` const record = headers;`,` const lowerName = name.toLowerCase();`,` for (const [key, value] of Object.entries(record)) {`,` if (key.toLowerCase() !== lowerName || value === undefined) {`,` continue;`,` }`,` if (Array.isArray(value)) {`,` return value.find((item) => typeof item === "string" && item.length > 0);`,` }`,` return typeof value === "string" && value.length > 0 ? value : undefined;`,` }`,` return undefined;`,`}`,``,`function createHeaders(headers) {`,` const normalized = new Headers();`,` if (headers === null || headers === undefined) {`,` return normalized;`,` }`,` if (headers instanceof Headers) {`,` return headers;`,` }`,` if (typeof headers.forEach === "function" && typeof headers.entries === "function") {`,` for (const [key, value] of headers.entries()) {`,` normalized.append(key, value);`,` }`,` return normalized;`,` }`,` for (const [key, value] of Object.entries(headers)) {`,` if (value === undefined) {`,` continue;`,` }`,` if (Array.isArray(value)) {`,` for (const item of value) {`,` normalized.append(key, String(item));`,` }`,` continue;`,` }`,` normalized.set(key, String(value));`,` }`,` return normalized;`,`}`,``,`function toAbsoluteWorkflowUrl(request) {`,` const url = typeof request?.url === "string" ? request.url : "/";`,` if (/^https?:\\/\\//.test(url)) {`,` return url;`,` }`,` const host = getHeader(request?.headers, "x-forwarded-host") ?? getHeader(request?.headers, "host");`,` const protocolHeader = getHeader(request?.headers, "x-forwarded-proto");`,` const protocol = protocolHeader === "http" || protocolHeader === "https" ? protocolHeader : "https";`,` const origin = typeof host === "string" && host.length > 0 ? protocol + "://" + host : DEFAULT_WORKFLOW_REQUEST_ORIGIN;`,` return new URL(url, origin).toString();`,`}`,``,`function normalizeWorkflowRequest(request) {`,` if (request instanceof Request) {`,` if (/^https?:\\/\\//.test(request.url)) {`,` return request;`,` }`,` return new Request(toAbsoluteWorkflowUrl(request), request);`,` }`,` const method = typeof request?.method === "string" ? request.method : "GET";`,` const headers = createHeaders(request?.headers);`,` const init = {`,` headers,`,` method,`,` };`,` if (method !== "GET" && method !== "HEAD") {`,` const body = request?.body ?? (request !== null && typeof request === "object" && typeof request.pipe === "function" ? request : undefined);`,` if (body !== undefined) {`,` init.body = body;`,` init.duplex = "half";`,` }`,` }`,` return new Request(toAbsoluteWorkflowUrl(request), init);`,`}`,``,`module.exports = async function handleWorkflowFunctionRequest(requestContext) {`,` const request =`,` requestContext !== null && typeof requestContext === "object" && "req" in requestContext`,` ? requestContext.req`,` : requestContext;`,...r?[` await loadWorkflowPlugins();`]:[],` return await POST(normalizeWorkflowRequest(request));`,`};`,``].join(`
|
|
2
2
|
`)}function createRoutedNitroEntrypoint(e){return[`import nitroHandler from ${JSON.stringify(e.delegateImportPath)};`,``,`function invokeNitroHandler(request, context) {`,` if (typeof nitroHandler === "function") {`,` return nitroHandler(request, context);`,` }`,``,` if (nitroHandler !== null && typeof nitroHandler === "object" && "fetch" in nitroHandler) {`,` const fetch = nitroHandler.fetch;`,` if (typeof fetch === "function") {`,` return fetch.call(nitroHandler, request, context);`,` }`,` }`,``,` throw new TypeError("Expected Nitro handler to export a function or an object with fetch(request, context).");`,`}`,``,`const workflowRoutePath = ${JSON.stringify(e.workflowRoutePath)};`,``,`function rewriteRequestToWorkflowRoute(request) {`,` const sourceUrl = new URL(request.url);`,` const routedUrl = new URL(workflowRoutePath, sourceUrl);`,` routedUrl.search = sourceUrl.search;`,` return new Request(routedUrl, request);`,`}`,``,`export default {`,` fetch(request, context) {`,` return invokeNitroHandler(rewriteRequestToWorkflowRoute(request), context);`,` },`,`};`,``].join(`
|
|
3
3
|
`)}async function readVercelHandlerPath(e){try{let t=JSON.parse(await readFile(join(e,`.vc-config.json`),`utf8`));if(typeof t.handler==`string`&&t.handler.length>0)return t.handler}catch{}return`index.mjs`}async function retargetNitroFunctionDirectoryToWorkflowRoute(e){let i=await readVercelHandlerPath(e.functionDirectoryPath),a=join(e.functionDirectoryPath,i),o=dirname(a),s=extname(i),c=join(o,`__eve_nitro_handler__${s.length>0?s:`.mjs`}`),l=toRelativeImportPath({fromDirectoryPath:o,toFilePath:c});await rename(a,c),await writeFile(a,createRoutedNitroEntrypoint({delegateImportPath:l,workflowRoutePath:e.workflowRoutePath}))}export{WORKFLOW_BUILDER_DEFERRED_PACKAGES,WORKFLOW_STEP_EXTERNAL_PACKAGES,copyNitroFunctionDirectory,createWorkflowFunctionEnvironment,emitBundledWorkflowFunctionDirectory,normalizeEveVercelFunctionOutput,prepareVercelFunctionDirectory,retargetNitroFunctionDirectoryToWorkflowRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var SandboxTemplateNotProvisionedError=class SandboxTemplateNotProvisionedError extends Error{backendName;templateKey;constructor(e){super(`Sandbox template "${e.templateKey}" is not provisioned for backend "${e.backendName}". Run \`eve build\` or invoke \`prewarmAppSandboxes()\` before serving traffic.`),this.name=`SandboxTemplateNotProvisionedError`,this.backendName=e.backendName,this.templateKey=e.templateKey}static is(e){return e instanceof SandboxTemplateNotProvisionedError}};export{SandboxTemplateNotProvisionedError};
|
|
1
|
+
var SandboxTemplateNotProvisionedError=class SandboxTemplateNotProvisionedError extends Error{backendName;templateKey;constructor(e){super(`Sandbox template "${e.templateKey}" is not provisioned for backend "${e.backendName}". Run \`eve build\` or invoke \`prewarmAppSandboxes()\` before serving traffic.`),this.name=`SandboxTemplateNotProvisionedError`,this.backendName=e.backendName,this.templateKey=e.templateKey}static is(e){return e instanceof SandboxTemplateNotProvisionedError||typeof e==`object`&&!!e&&e.name===`SandboxTemplateNotProvisionedError`&&typeof e.backendName==`string`&&typeof e.templateKey==`string`}};export{SandboxTemplateNotProvisionedError};
|
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DockerSandboxCreateOptions } from "#public/sandbox/docker-sandbox.js";
|
|
3
|
+
import type { JustBashSandboxCreateOptions } from "#public/sandbox/just-bash-sandbox.js";
|
|
4
|
+
import type { MicrosandboxCreateOptions } from "#public/sandbox/microsandbox-sandbox.js";
|
|
3
5
|
import type { VercelSandboxCreateOptions } from "#public/sandbox/vercel-sandbox.js";
|
|
4
6
|
/**
|
|
5
7
|
* Input to {@link defaultBackend}: a separate options bag per inner
|
|
6
|
-
* backend. The framework picks one
|
|
7
|
-
* and passes it
|
|
8
|
+
* backend. The framework picks one backend at runtime based on
|
|
9
|
+
* availability and passes it the matching bag; the others are ignored.
|
|
8
10
|
*/
|
|
9
11
|
export interface DefaultBackendOptions {
|
|
10
|
-
readonly
|
|
12
|
+
readonly docker?: DockerSandboxCreateOptions;
|
|
13
|
+
readonly justBash?: JustBashSandboxCreateOptions;
|
|
14
|
+
readonly microsandbox?: MicrosandboxCreateOptions;
|
|
11
15
|
readonly vercel?: VercelSandboxCreateOptions;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
18
|
+
* Availability probes behind {@link defaultBackend}'s selection chain.
|
|
19
|
+
* Injectable so selection logic is testable without touching the host.
|
|
20
|
+
*/
|
|
21
|
+
export interface DefaultBackendProbes {
|
|
22
|
+
readonly isDeployedOnVercel: () => boolean;
|
|
23
|
+
readonly isDockerAvailable: () => boolean;
|
|
24
|
+
readonly isMicrosandboxSupported: () => boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Constructs an availability-aware sandbox backend. On first use it
|
|
28
|
+
* picks the best backend the host supports, in priority order:
|
|
17
29
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
30
|
+
* 1. **Vercel Sandbox** when deploying on Vercel (`process.env.VERCEL`
|
|
31
|
+
* is set) — local container/VM runtimes cannot run there.
|
|
32
|
+
* 2. **Docker** when a Docker daemon is reachable.
|
|
33
|
+
* 3. **microsandbox** when the host supports it (macOS on Apple
|
|
34
|
+
* Silicon, or glibc Linux with KVM); `eve dev` auto-installs the
|
|
35
|
+
* package into the project.
|
|
36
|
+
* 4. **just-bash** as the dependency-free fallback; `eve dev`
|
|
37
|
+
* auto-installs the package into the project.
|
|
38
|
+
*
|
|
39
|
+
* The selection is cached for the process lifetime. To pin a backend
|
|
40
|
+
* unconditionally, configure its factory directly (`dockerBackend()`,
|
|
41
|
+
* `microsandboxBackend()`, `justBashBackend()`,
|
|
42
|
+
* `vercelSandboxBackend()`).
|
|
21
43
|
*/
|
|
22
44
|
export declare function defaultBackend(opts?: DefaultBackendOptions): SandboxBackend;
|
|
45
|
+
/**
|
|
46
|
+
* The selection chain behind {@link defaultBackend}. Internal —
|
|
47
|
+
* exported for tests, which inject probes.
|
|
48
|
+
*/
|
|
49
|
+
export declare function selectDefaultSandboxBackend(opts: DefaultBackendOptions | undefined, probes: DefaultBackendProbes): SandboxBackend;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lazyBackend}from"#execution/sandbox/lazy-backend.js";import{
|
|
1
|
+
import{lazyBackend}from"#execution/sandbox/lazy-backend.js";import{isDockerDaemonAvailableSync,isMicrosandboxPlatformSupported}from"#execution/sandbox/bindings/local.js";import{dockerBackend}from"#public/sandbox/backends/docker.js";import{justBashBackend}from"#public/sandbox/backends/just-bash.js";import{microsandboxBackend}from"#public/sandbox/backends/microsandbox.js";import{vercelSandboxBackend}from"#public/sandbox/backends/vercel.js";const PRODUCTION_PROBES={isDeployedOnVercel:()=>!!process.env.VERCEL,isDockerAvailable:()=>isDockerDaemonAvailableSync(),isMicrosandboxSupported:()=>isMicrosandboxPlatformSupported()};function defaultBackend(t){return lazyBackend(()=>selectDefaultSandboxBackend(t,PRODUCTION_PROBES))}function selectDefaultSandboxBackend(e,t){return t.isDeployedOnVercel()?vercelSandboxBackend(e?.vercel):t.isDockerAvailable()?dockerBackend(e?.docker):t.isMicrosandboxSupported()?microsandboxBackend(e?.microsandbox):justBashBackend(e?.justBash)}export{defaultBackend,selectDefaultSandboxBackend};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
|
+
import type { DockerSandboxCreateOptions } from "#public/sandbox/docker-sandbox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Constructs the Docker sandbox backend: the workspace runs inside a
|
|
5
|
+
* real Linux container driven through the Docker CLI, using the
|
|
6
|
+
* official Ubuntu 26.04 image by default.
|
|
7
|
+
*
|
|
8
|
+
* Requires a running Docker-compatible daemon reachable through a
|
|
9
|
+
* `docker` CLI (Docker Desktop, OrbStack, Colima, Podman via its
|
|
10
|
+
* docker-compatible CLI, …; override the binary with `EVE_DOCKER_PATH`).
|
|
11
|
+
* Configuring this backend pins it unconditionally — when you want
|
|
12
|
+
* fallback behavior, use `defaultBackend()` instead.
|
|
13
|
+
*/
|
|
14
|
+
export declare function dockerBackend(opts?: DockerSandboxCreateOptions): SandboxBackend;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createDockerSandboxBackend}from"#execution/sandbox/bindings/local.js";function dockerBackend(e){return createDockerSandboxBackend({createOptions:e})}export{dockerBackend};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
|
+
import type { JustBashSandboxCreateOptions } from "#public/sandbox/just-bash-sandbox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Constructs the just-bash sandbox backend: a pure-JS bash interpreter
|
|
5
|
+
* over a virtual filesystem stored under `.eve/sandbox-cache/`. It
|
|
6
|
+
* needs no daemon or VM, but commands run in a simulated shell — no
|
|
7
|
+
* real binaries (`git`, `node`, package managers) and no network
|
|
8
|
+
* isolation.
|
|
9
|
+
*
|
|
10
|
+
* The `just-bash` package is not bundled with Eve. When it is missing,
|
|
11
|
+
* `eve dev` installs it into the application automatically (disable
|
|
12
|
+
* with `autoInstall: false`); production processes fail with an
|
|
13
|
+
* actionable install error instead. Configuring this backend pins it
|
|
14
|
+
* unconditionally — when you want fallback behavior, use
|
|
15
|
+
* `defaultBackend()` instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function justBashBackend(opts?: JustBashSandboxCreateOptions): SandboxBackend;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createJustBashSandboxBackend}from"#execution/sandbox/bindings/local.js";function justBashBackend(e){return createJustBashSandboxBackend({createOptions:e})}export{justBashBackend};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
|
+
import type { MicrosandboxBootstrapUseOptions, MicrosandboxCreateOptions, MicrosandboxSessionUseOptions } from "#public/sandbox/microsandbox-sandbox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Constructs the microsandbox sandbox backend: lightweight local VMs
|
|
5
|
+
* via [microsandbox](https://www.npmjs.com/package/microsandbox) with
|
|
6
|
+
* snapshot-backed templates and a firewall capable of domain-level
|
|
7
|
+
* network policies and credential brokering.
|
|
8
|
+
*
|
|
9
|
+
* Supported hosts: macOS on Apple Silicon, or Linux (glibc) with KVM
|
|
10
|
+
* enabled. The `microsandbox` package is not bundled with Eve. When it
|
|
11
|
+
* (or its VM runtime) is missing, `eve dev` installs both
|
|
12
|
+
* automatically (disable with `setup: { autoInstall: false }`);
|
|
13
|
+
* production processes fail with actionable errors instead.
|
|
14
|
+
* Configuring this backend pins it unconditionally — when you want
|
|
15
|
+
* fallback behavior, use `defaultBackend()` instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare function microsandboxBackend(opts?: MicrosandboxCreateOptions): SandboxBackend<MicrosandboxBootstrapUseOptions, MicrosandboxSessionUseOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createMicrosandboxSandboxBackend}from"#execution/sandbox/bindings/local.js";function microsandboxBackend(e){return createMicrosandboxSandboxBackend({createOptions:e})}export{microsandboxBackend};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
2
|
import type { VercelSandboxBootstrapUseOptions, VercelSandboxCreateOptions, VercelSandboxSessionUseOptions } from "#public/sandbox/vercel-sandbox.js";
|
|
3
3
|
/**
|
|
4
|
-
* Constructs the
|
|
4
|
+
* Constructs the [Vercel Sandbox](https://vercel.com/docs/sandbox)
|
|
5
|
+
* backend. Configuring this backend pins it unconditionally —
|
|
6
|
+
* including for local development, where it creates real hosted
|
|
7
|
+
* sandboxes (requires Vercel credentials).
|
|
5
8
|
*
|
|
6
9
|
* The optional `opts` parameter is forwarded to the Vercel SDK's
|
|
7
10
|
* `Sandbox.create(...)` for every fresh sandbox the framework creates
|
|
@@ -21,4 +24,4 @@ import type { VercelSandboxBootstrapUseOptions, VercelSandboxCreateOptions, Verc
|
|
|
21
24
|
* SDK's `update` under the hood, overriding any overlapping field
|
|
22
25
|
* from `opts`.
|
|
23
26
|
*/
|
|
24
|
-
export declare function
|
|
27
|
+
export declare function vercelSandboxBackend(opts?: VercelSandboxCreateOptions): SandboxBackend<VercelSandboxBootstrapUseOptions, VercelSandboxSessionUseOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createVercelSandboxBackend}from"#execution/sandbox/bindings/vercel.js";function
|
|
1
|
+
import{createVercelSandboxBackend}from"#execution/sandbox/bindings/vercel.js";function vercelSandboxBackend(e){return createVercelSandboxBackend({createOptions:e})}export{vercelSandboxBackend};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image pull behavior for the Docker sandbox backend.
|
|
3
|
+
*
|
|
4
|
+
* - `"if-not-present"` (default): pull the base image only when it is
|
|
5
|
+
* missing from the local image store.
|
|
6
|
+
* - `"always"`: pull before every template build so the image floats to
|
|
7
|
+
* the registry's latest digest.
|
|
8
|
+
* - `"never"`: never pull; fail when the image is missing locally.
|
|
9
|
+
*/
|
|
10
|
+
export type DockerSandboxPullPolicy = "if-not-present" | "always" | "never";
|
|
11
|
+
/**
|
|
12
|
+
* Initial network policy for sandboxes created by the Docker backend.
|
|
13
|
+
* Docker supports coarse-grained egress control only: `"allow-all"`
|
|
14
|
+
* attaches the container to the default bridge network, `"deny-all"`
|
|
15
|
+
* runs it with networking disabled. Domain-level policies and
|
|
16
|
+
* credential brokering require `vercelSandboxBackend()`.
|
|
17
|
+
*/
|
|
18
|
+
export type DockerSandboxNetworkPolicy = "allow-all" | "deny-all";
|
|
19
|
+
/**
|
|
20
|
+
* Options accepted by `dockerBackend(opts)`.
|
|
21
|
+
*/
|
|
22
|
+
export interface DockerSandboxCreateOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Base container image for templates and sessions. Defaults to
|
|
25
|
+
* `ubuntu:26.04` — the official Ubuntu 26.04 image. Framework setup
|
|
26
|
+
* installs Node 24 and baseline tools. Custom images must provide
|
|
27
|
+
* Bash, Node 24, and npm, or a package manager and setup network
|
|
28
|
+
* access that can install them.
|
|
29
|
+
*/
|
|
30
|
+
readonly image?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Environment variables baked into every container the backend
|
|
33
|
+
* creates (template builds and sessions).
|
|
34
|
+
*/
|
|
35
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
36
|
+
/**
|
|
37
|
+
* Base image pull behavior. Defaults to `"if-not-present"`.
|
|
38
|
+
*/
|
|
39
|
+
readonly pullPolicy?: DockerSandboxPullPolicy;
|
|
40
|
+
/**
|
|
41
|
+
* Initial network policy for created containers. Defaults to
|
|
42
|
+
* `"allow-all"`.
|
|
43
|
+
*/
|
|
44
|
+
readonly networkPolicy?: DockerSandboxNetworkPolicy;
|
|
45
|
+
}
|
|
@@ -6,8 +6,12 @@ export { defineSandbox, type SandboxBootstrapContext, type SandboxBootstrapUseFn
|
|
|
6
6
|
export type { SandboxBackend, SandboxBackendCreateInput, SandboxBackendHandle, SandboxBackendPrewarmInput, SandboxBackendRuntimeContext, SandboxBackendSessionState, SandboxSeedFile, } from "#public/definitions/sandbox-backend.js";
|
|
7
7
|
export type { SandboxNetworkPolicy } from "#shared/sandbox-network-policy.js";
|
|
8
8
|
export { SandboxTemplateNotProvisionedError } from "#public/definitions/sandbox-backend.js";
|
|
9
|
-
export { defaultBackend } from "#public/sandbox/backends/default.js";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
9
|
+
export { defaultBackend, type DefaultBackendOptions } from "#public/sandbox/backends/default.js";
|
|
10
|
+
export { dockerBackend } from "#public/sandbox/backends/docker.js";
|
|
11
|
+
export { justBashBackend } from "#public/sandbox/backends/just-bash.js";
|
|
12
|
+
export { microsandboxBackend } from "#public/sandbox/backends/microsandbox.js";
|
|
13
|
+
export { vercelSandboxBackend } from "#public/sandbox/backends/vercel.js";
|
|
14
|
+
export type { DockerSandboxCreateOptions, DockerSandboxNetworkPolicy, DockerSandboxPullPolicy, } from "#public/sandbox/docker-sandbox.js";
|
|
15
|
+
export type { JustBashSandboxCreateOptions } from "#public/sandbox/just-bash-sandbox.js";
|
|
16
|
+
export type { MicrosandboxBootstrapUseOptions, MicrosandboxCreateOptions, MicrosandboxSessionUseOptions, } from "#public/sandbox/microsandbox-sandbox.js";
|
|
13
17
|
export type { VercelSandboxBootstrapUseOptions, VercelSandboxCreateOptions, VercelSandboxSessionUseOptions, } from "#public/sandbox/vercel-sandbox.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SandboxTemplateNotProvisionedError}from"#public/definitions/sandbox-backend.js";import{
|
|
1
|
+
import{SandboxTemplateNotProvisionedError}from"#public/definitions/sandbox-backend.js";import{dockerBackend}from"#public/sandbox/backends/docker.js";import{justBashBackend}from"#public/sandbox/backends/just-bash.js";import{microsandboxBackend}from"#public/sandbox/backends/microsandbox.js";import{vercelSandboxBackend}from"#public/sandbox/backends/vercel.js";import{defineSandbox}from"#public/definitions/sandbox.js";import{defaultBackend}from"#public/sandbox/backends/default.js";export{SandboxTemplateNotProvisionedError,defaultBackend,defineSandbox,dockerBackend,justBashBackend,microsandboxBackend,vercelSandboxBackend};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options accepted by `justBashBackend(opts)`.
|
|
3
|
+
*
|
|
4
|
+
* The just-bash backend runs the workspace under the pure-JS `just-bash`
|
|
5
|
+
* interpreter with a virtual filesystem — no daemon or VM required, but
|
|
6
|
+
* no real binaries either. The `just-bash` package is not bundled with
|
|
7
|
+
* Eve; it is loaded lazily from the application install.
|
|
8
|
+
*/
|
|
9
|
+
export interface JustBashSandboxCreateOptions {
|
|
10
|
+
/**
|
|
11
|
+
* When the `just-bash` package is missing from the application,
|
|
12
|
+
* install it automatically with the project's package manager. Only
|
|
13
|
+
* runs during `eve dev`; production processes always fail with an
|
|
14
|
+
* actionable install error instead. Defaults to `true`.
|
|
15
|
+
*/
|
|
16
|
+
readonly autoInstall?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { SandboxNetworkPolicy } from "#shared/sandbox-network-policy.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options accepted by `microsandboxBackend(opts)`.
|
|
4
|
+
*
|
|
5
|
+
* The microsandbox backend runs sandboxes in lightweight local VMs via
|
|
6
|
+
* [microsandbox](https://www.npmjs.com/package/microsandbox). Options
|
|
7
|
+
* are Eve-owned rather than a raw passthrough so the public surface can
|
|
8
|
+
* stay stable while the underlying runtime evolves. Supported hosts:
|
|
9
|
+
* macOS on Apple Silicon, or Linux (glibc) with KVM enabled.
|
|
10
|
+
*/
|
|
11
|
+
export interface MicrosandboxCreateOptions {
|
|
12
|
+
/**
|
|
13
|
+
* OCI image used as the base runtime. Eve prepares this image with
|
|
14
|
+
* the framework workspace, Node 24, pnpm, git, ripgrep, sudo, and
|
|
15
|
+
* other baseline tools before authored bootstrap code runs. Custom
|
|
16
|
+
* images must provide Bash and either Node 24/npm or a package
|
|
17
|
+
* manager capable of installing them.
|
|
18
|
+
*
|
|
19
|
+
* @default "ubuntu:26.04"
|
|
20
|
+
*/
|
|
21
|
+
readonly image?: string;
|
|
22
|
+
/** Number of virtual CPUs assigned to each sandbox. @default 1 */
|
|
23
|
+
readonly cpus?: number;
|
|
24
|
+
/** Memory assigned to each sandbox in MiB. @default 1024 */
|
|
25
|
+
readonly memoryMiB?: number;
|
|
26
|
+
/** Environment variables applied to every sandbox command. */
|
|
27
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
28
|
+
/** OCI image pull policy. @default "if-missing" */
|
|
29
|
+
readonly pullPolicy?: "always" | "if-missing" | "never";
|
|
30
|
+
/**
|
|
31
|
+
* Installation behavior for the microsandbox npm package and its VM
|
|
32
|
+
* runtime. By default Eve installs both automatically when missing —
|
|
33
|
+
* the npm package with the project's package manager (during
|
|
34
|
+
* `eve dev` only), the runtime via microsandbox's own installer.
|
|
35
|
+
*/
|
|
36
|
+
readonly setup?: {
|
|
37
|
+
readonly autoInstall?: boolean;
|
|
38
|
+
readonly skipVerify?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** Initial network policy applied to sandboxes after framework setup. */
|
|
41
|
+
readonly networkPolicy?: SandboxNetworkPolicy;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Options accepted by the microsandbox backend's `bootstrap({ use })` hook.
|
|
45
|
+
*/
|
|
46
|
+
export interface MicrosandboxBootstrapUseOptions {
|
|
47
|
+
readonly networkPolicy?: SandboxNetworkPolicy;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Options accepted by the microsandbox backend's `onSession({ use })` hook.
|
|
51
|
+
*/
|
|
52
|
+
export interface MicrosandboxSessionUseOptions {
|
|
53
|
+
readonly networkPolicy?: SandboxNetworkPolicy;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Sandbox as SdkSandbox, SandboxUpdateParams } from "#compiled/@vercel/sandbox/index.js";
|
|
2
2
|
/**
|
|
3
|
-
* Options accepted by `
|
|
3
|
+
* Options accepted by `vercelSandboxBackend(opts)`. Forwarded directly to the
|
|
4
4
|
* Vercel SDK's `Sandbox.create(...)` for every fresh sandbox the
|
|
5
5
|
* framework creates (template at prewarm time, session at first-time
|
|
6
6
|
* session-create). Skipped on resume (`Sandbox.get`) since no create
|
|
@@ -23,6 +23,12 @@ export interface RuntimeDiskCompiledArtifactsSource {
|
|
|
23
23
|
* emitted by the build.
|
|
24
24
|
*/
|
|
25
25
|
readonly moduleMapLoaderPath?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Stable application root used for local sandbox template/session caches.
|
|
28
|
+
* In development, `appRoot` can point at an immutable runtime snapshot
|
|
29
|
+
* while sandbox state should remain scoped to the authored application.
|
|
30
|
+
*/
|
|
31
|
+
readonly sandboxAppRoot?: string;
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* Creates the bundled compiled-artifact source.
|
|
@@ -33,11 +39,16 @@ export declare function createBundledRuntimeCompiledArtifactsSource(): RuntimeBu
|
|
|
33
39
|
*/
|
|
34
40
|
export declare function createDiskRuntimeCompiledArtifactsSource(appRoot: string, options?: {
|
|
35
41
|
readonly moduleMapLoaderPath?: string;
|
|
42
|
+
readonly sandboxAppRoot?: string;
|
|
36
43
|
}): RuntimeDiskCompiledArtifactsSource;
|
|
37
44
|
/**
|
|
38
45
|
* Returns the disk-backed app root when one exists for the artifact source.
|
|
39
46
|
*/
|
|
40
47
|
export declare function getRuntimeCompiledArtifactsAppRoot(source: RuntimeCompiledArtifactsSource): string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the stable application root to use for local sandbox cache scope.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getRuntimeCompiledArtifactsSandboxAppRoot(source: RuntimeCompiledArtifactsSource): string | undefined;
|
|
41
52
|
/**
|
|
42
53
|
* Returns the stable cache key for one runtime artifact source.
|
|
43
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function createBundledRuntimeCompiledArtifactsSource(){return{kind:`bundled`}}function createDiskRuntimeCompiledArtifactsSource(e,t={}){return t.moduleMapLoaderPath
|
|
1
|
+
function createBundledRuntimeCompiledArtifactsSource(){return{kind:`bundled`}}function createDiskRuntimeCompiledArtifactsSource(e,t={}){return t.moduleMapLoaderPath!==void 0||t.sandboxAppRoot!==void 0?{appRoot:e,kind:`disk`,moduleMapLoaderPath:t.moduleMapLoaderPath,sandboxAppRoot:t.sandboxAppRoot}:{appRoot:e,kind:`disk`}}function getRuntimeCompiledArtifactsAppRoot(e){return e.kind===`disk`?e.appRoot:void 0}function getRuntimeCompiledArtifactsSandboxAppRoot(e){return e.kind===`disk`?e.sandboxAppRoot??e.appRoot:void 0}function getRuntimeCompiledArtifactsCacheKey(e){return e.kind===`disk`?e.moduleMapLoaderPath===void 0?`disk:${e.appRoot}`:`disk:${e.appRoot}:authored-source:${e.moduleMapLoaderPath}`:`bundled`}export{createBundledRuntimeCompiledArtifactsSource,createDiskRuntimeCompiledArtifactsSource,getRuntimeCompiledArtifactsAppRoot,getRuntimeCompiledArtifactsCacheKey,getRuntimeCompiledArtifactsSandboxAppRoot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{lazyBackend}from"#execution/sandbox/lazy-backend.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{defaultBackend}from"#public/sandbox/backends/default.js";async function resolveSandboxDefinition(n,i,a){try{let t=expectObjectRecord(await loadResolvedModuleExport({definition:n,kindLabel:`sandbox`,moduleMap:i,nodeId:a}),`Expected the sandbox export "${n.exportName??`default`}" from "${n.logicalPath}" to return an object.`);return{backend:resolveBackend(t.backend,n.logicalPath),bootstrap:t.bootstrap,description:n.description,exportName:n.exportName,logicalPath:n.logicalPath,onSession:t.onSession,revalidationKey:n.revalidationKey,sourceHash:n.sourceHash,sourceId:n.sourceId,sourceKind:`module`}}catch(e){throw e instanceof ResolveAgentError?e:new ResolveAgentError(`Failed to attach the sandbox lifecycle handlers from "${n.logicalPath}": ${toErrorMessage(e)}`,{logicalPath:n.logicalPath,sourceId:n.sourceId})}}function resolveBackend(e,t){if(e===void 0)return defaultBackend();if(typeof e==`function`)return lazyBackend(e);if(typeof e!=`object`||!e)throw new ResolveAgentError(`Sandbox "${t}" exposed a non-object "backend" field. Use
|
|
1
|
+
import{expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{lazyBackend}from"#execution/sandbox/lazy-backend.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{defaultBackend}from"#public/sandbox/backends/default.js";async function resolveSandboxDefinition(n,i,a){try{let t=expectObjectRecord(await loadResolvedModuleExport({definition:n,kindLabel:`sandbox`,moduleMap:i,nodeId:a}),`Expected the sandbox export "${n.exportName??`default`}" from "${n.logicalPath}" to return an object.`);return{backend:resolveBackend(t.backend,n.logicalPath),bootstrap:t.bootstrap,description:n.description,exportName:n.exportName,logicalPath:n.logicalPath,onSession:t.onSession,revalidationKey:n.revalidationKey,sourceHash:n.sourceHash,sourceId:n.sourceId,sourceKind:`module`}}catch(e){throw e instanceof ResolveAgentError?e:new ResolveAgentError(`Failed to attach the sandbox lifecycle handlers from "${n.logicalPath}": ${toErrorMessage(e)}`,{logicalPath:n.logicalPath,sourceId:n.sourceId})}}function resolveBackend(e,t){if(e===void 0)return defaultBackend();if(typeof e==`function`)return lazyBackend(e);if(typeof e!=`object`||!e)throw new ResolveAgentError(`Sandbox "${t}" exposed a non-object "backend" field. Use dockerBackend(), vercelSandboxBackend(), another factory that returns a SandboxBackend value, or a zero-arg callback returning one.`,{logicalPath:t});let r=e;if(typeof r.name!=`string`||r.name.length===0)throw new ResolveAgentError(`Sandbox "${t}" backend is missing a non-empty string "name" identifier.`,{logicalPath:t});if(typeof r.create!=`function`)throw new ResolveAgentError(`Sandbox "${t}" backend is missing a "create" function.`,{logicalPath:t});return r}export{resolveSandboxDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{realpath}from"node:fs/promises";import{createHash}from"node:crypto";import{
|
|
1
|
+
import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{realpath}from"node:fs/promises";import{createHash}from"node:crypto";import{getRuntimeCompiledArtifactsCacheKey,getRuntimeCompiledArtifactsSandboxAppRoot}from"#runtime/compiled-artifacts-source.js";import{loadCompileMetadata}from"#runtime/loaders/compile-metadata.js";async function createRuntimeSandboxKeys(e){return{sessionKey:await createRuntimeSandboxSessionKey(e),templateKey:await createRuntimeSandboxTemplateKey(e)}}async function createRuntimeSandboxTemplateKey(e){if(e.templatePlan.kind===`none`)return null;let t=await loadCompileMetadataForKeys(e.compiledArtifactsSource),n=await resolveRuntimeSandboxScope({backendName:e.backendName,compiledArtifactsSource:e.compiledArtifactsSource,scopeKind:e.templatePlan.kind===`source-graph`?`deployment`:`stable`}),r=resolveRuntimeSandboxVersionHash({compiledArtifactsSource:e.compiledArtifactsSource,metadata:t,nodeId:e.nodeId,sourceId:e.sourceId,templatePlan:e.templatePlan}),i=createStableHash(`${resolvePackageVersionForTemplateKey(t)}:6:${r}`).slice(0,20);return sanitizeRuntimeSandboxKey(`eve-sbx-tpl-${e.backendName}-${n}-${i}`)}function resolvePackageVersionForTemplateKey(t){return t?.generator.version??resolveInstalledPackageInfo().version}async function loadCompileMetadataForKeys(e){try{return await loadCompileMetadata({compiledArtifactsSource:e})}catch{return null}}async function createRuntimeSandboxSessionKey(e){let t=await resolveRuntimeSandboxScope({backendName:e.backendName,compiledArtifactsSource:e.compiledArtifactsSource,scopeKind:`deployment`}),n=sanitizeRuntimeSandboxKey(e.nodeId);return sanitizeRuntimeSandboxKey(`eve-sbx-ses-${e.backendName}-${t}-${e.sessionId}-${n}`)}async function resolveRuntimeSandboxScope(e){if(e.backendName===`vercel`){if(e.scopeKind===`stable`){let e=resolveVercelProjectScope();if(e!==void 0)return createStableHash(e).slice(0,16)}let t=process.env.VERCEL_DEPLOYMENT_ID?.trim();if(t!==void 0&&t.length>0)return createStableHash(t).slice(0,16)}let n=getRuntimeCompiledArtifactsSandboxAppRoot(e.compiledArtifactsSource);return n===void 0?createStableHash(getRuntimeCompiledArtifactsCacheKey(e.compiledArtifactsSource)).slice(0,16):createStableHash(await realpath(n)).slice(0,16)}function resolveRuntimeSandboxVersionHash(e){if(e.templatePlan.kind===`bootstrap`){let t=e.templatePlan.contentHash??resolveSourceGraphHash(e.metadata,e.compiledArtifactsSource);return createStableHash(`bootstrap:${e.templatePlan.revalidationKey??``}:${e.templatePlan.sourceHash}:${t}:${e.nodeId}:${e.sourceId}`)}return e.templatePlan.kind===`workspace-content`?createStableHash(`workspace-content:${e.templatePlan.contentHash??resolveSourceGraphHash(e.metadata,e.compiledArtifactsSource)}:${e.nodeId}:${e.sourceId}`):createStableHash(`source-graph:${resolveSourceGraphHash(e.metadata,e.compiledArtifactsSource)}:${e.nodeId}:${e.sourceId}`)}function resolveSourceGraphHash(e,t){return e?.discovery.sourceGraphHash??getRuntimeCompiledArtifactsCacheKey(t)}function resolveVercelProjectScope(){let e=process.env.VERCEL_PROJECT_ID?.trim();if(!(e===void 0||e.length===0))return`vercel-project:${e}`}function createStableHash(e){return createHash(`sha256`).update(e).digest(`hex`)}function sanitizeRuntimeSandboxKey(e){return e.replaceAll(/[^a-zA-Z0-9._-]+/g,`-`).slice(0,120)}export{createRuntimeSandboxKeys,createRuntimeSandboxTemplateKey};
|
|
@@ -53,8 +53,8 @@ export declare function createRuntimeSandboxRegistry(input: {
|
|
|
53
53
|
*
|
|
54
54
|
* The `backend` is resolved through {@link defaultBackend} on each
|
|
55
55
|
* call so the framework default picks up the same environment-aware
|
|
56
|
-
* fallback as authored sandboxes that omit `backend` (`
|
|
57
|
-
* on hosted Vercel,
|
|
56
|
+
* fallback as authored sandboxes that omit `backend` (`vercelSandboxBackend()`
|
|
57
|
+
* on hosted Vercel, then Docker, microsandbox, or just-bash by availability). Implemented as
|
|
58
58
|
* a factory rather than a constant so the environment is read at
|
|
59
59
|
* graph-resolution time rather than at module-load time.
|
|
60
60
|
*/
|