eve 0.6.0-beta.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +266 -0
- package/README.md +9 -6
- package/dist/docs/public/README.md +1 -1
- package/dist/docs/public/advanced/auth-and-route-protection.md +3 -1
- package/dist/docs/public/advanced/default-harness.md +2 -2
- package/dist/docs/public/advanced/dev-tui.md +9 -11
- package/dist/docs/public/advanced/instrumentation.md +1 -1
- package/dist/docs/public/advanced/meta.json +0 -1
- package/dist/docs/public/advanced/security-model.md +1 -1
- package/dist/docs/public/advanced/session-context.md +1 -1
- package/dist/docs/public/agent-config.md +1 -1
- package/dist/docs/public/channels/eve.mdx +1 -1
- package/dist/docs/public/channels/slack.mdx +14 -2
- package/dist/docs/public/connections.mdx +3 -1
- package/dist/docs/public/evals/assertions.mdx +108 -0
- package/dist/docs/public/evals/cases.mdx +143 -0
- package/dist/docs/public/evals/judge.mdx +94 -0
- package/dist/docs/public/evals/meta.json +4 -0
- package/dist/docs/public/evals/overview.mdx +118 -0
- package/dist/docs/public/evals/reporters.mdx +62 -0
- package/dist/docs/public/evals/running.mdx +63 -0
- package/dist/docs/public/evals/targets.mdx +54 -0
- package/dist/docs/public/frontend/nextjs.mdx +13 -4
- package/dist/docs/public/frontend/nuxt.mdx +4 -4
- package/dist/docs/public/frontend/sveltekit.mdx +2 -2
- package/dist/docs/public/getting-started.mdx +25 -13
- package/dist/docs/public/meta.json +1 -0
- package/dist/docs/public/reference/cli.md +34 -18
- package/dist/docs/public/reference/typescript-api.md +6 -2
- package/dist/docs/public/tools.mdx +0 -4
- package/dist/docs/public/tutorial/connect-a-warehouse.mdx +1 -1
- package/dist/docs/public/tutorial/first-agent.mdx +5 -2
- package/dist/src/chunks/{use-eve-agent-DCZbkLG7.js → use-eve-agent-DErQj5hs.js} +125 -37
- package/dist/src/chunks/{use-eve-agent-DoheC4_o.js → use-eve-agent-DoR8C4i6.js} +125 -37
- package/dist/src/cli/banner.d.ts +7 -0
- package/dist/src/cli/banner.js +1 -0
- package/dist/src/cli/commands/channel-add-conflicts.d.ts +1 -1
- package/dist/src/cli/commands/channels.d.ts +9 -6
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/deploy.d.ts +21 -0
- package/dist/src/cli/commands/deploy.js +1 -0
- package/dist/src/cli/commands/init-git.d.ts +15 -0
- package/dist/src/cli/commands/init-git.js +1 -0
- package/dist/src/cli/commands/init.d.ts +29 -0
- package/dist/src/cli/commands/init.js +1 -0
- package/dist/src/cli/commands/link.d.ts +21 -0
- package/dist/src/cli/commands/link.js +1 -0
- package/dist/src/cli/commands/preconditions.d.ts +7 -0
- package/dist/src/cli/commands/preconditions.js +1 -0
- package/dist/src/cli/commands/register-project-commands.d.ts +12 -0
- package/dist/src/cli/commands/register-project-commands.js +1 -0
- package/dist/src/cli/dev/tui/agent-header.d.ts +15 -9
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +1 -1
- package/dist/src/cli/dev/tui/blocks.js +3 -2
- package/dist/src/cli/dev/tui/command-typeahead.d.ts +47 -0
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -0
- package/dist/src/cli/dev/tui/dev-rebuild-status.d.ts +21 -0
- package/dist/src/cli/dev/tui/dev-rebuild-status.js +1 -0
- package/dist/src/cli/dev/tui/errors.d.ts +18 -0
- package/dist/src/cli/dev/tui/errors.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +14 -0
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -0
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +54 -0
- package/dist/src/cli/dev/tui/prompt-commands.js +2 -0
- package/dist/src/cli/dev/tui/runner.d.ts +62 -5
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +48 -0
- package/dist/src/cli/dev/tui/setup-commands.js +2 -0
- package/dist/src/cli/dev/tui/setup-flow.d.ts +35 -0
- package/dist/src/cli/dev/tui/setup-issues.d.ts +40 -0
- package/dist/src/cli/dev/tui/setup-issues.js +1 -0
- package/dist/src/cli/dev/tui/setup-panel.d.ts +103 -0
- package/dist/src/cli/dev/tui/setup-panel.js +1 -0
- package/dist/src/cli/dev/tui/status-line.d.ts +25 -0
- package/dist/src/cli/dev/tui/status-line.js +1 -0
- package/dist/src/cli/dev/tui/stream-format.d.ts +16 -1
- package/dist/src/cli/dev/tui/stream-format.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +32 -3
- package/dist/src/cli/dev/tui/terminal-renderer.js +5 -2
- package/dist/src/cli/dev/tui/test/index.d.ts +3 -1
- package/dist/src/cli/dev/tui/test/index.js +1 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +1 -0
- package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +10 -0
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.d.ts +20 -0
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -0
- package/dist/src/cli/dev/tui/tui.d.ts +6 -8
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/types.d.ts +4 -3
- package/dist/src/cli/dev/tui/vercel-status.d.ts +47 -0
- package/dist/src/cli/dev/tui/vercel-status.js +1 -0
- package/dist/src/cli/run.d.ts +9 -18
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/client.d.ts +8 -0
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/file-parts.d.ts +18 -0
- package/dist/src/client/file-parts.js +1 -0
- package/dist/src/client/index.d.ts +3 -2
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/message-response.js +1 -1
- package/dist/src/client/open-stream.d.ts +6 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-utils.d.ts +5 -0
- package/dist/src/client/session-utils.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +9 -2
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +56 -31
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/google/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.d.ts +16 -9
- package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/otel/index.js +2 -2
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +4 -2
- package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +18 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +3 -1
- package/dist/src/compiled/@workflow/core/runtime.js +28 -28
- package/dist/src/compiled/@workflow/core/serialization.d.ts +41 -0
- package/dist/src/compiled/@workflow/core/util.d.ts +0 -5
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/index.d.ts +2 -2
- package/dist/src/compiled/@workflow/world/queue.d.ts +28 -2
- package/dist/src/compiled/_chunks/workflow/{dist-gEXVSMPU.js → dist-CkMRLaRV.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/functions-DuPjIvMH.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-CEAS3opc.js +12 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Cup6vPoA.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{symbols-BWCAoPHE.js → symbols-BUTtwS7j.js} +1 -1
- package/dist/src/compiled/just-bash/index.d.ts +4 -4
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/manifest.d.ts +8 -8
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-channel.d.ts +2 -1
- package/dist/src/compiler/normalize-channel.js +1 -1
- package/dist/src/compiler/normalize-connection.d.ts +2 -1
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-helpers.d.ts +5 -0
- package/dist/src/compiler/normalize-helpers.js +1 -1
- package/dist/src/compiler/normalize-instructions.d.ts +3 -2
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +2 -2
- package/dist/src/compiler/normalize-sandbox.d.ts +2 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/compiler/normalize-schedule.d.ts +2 -1
- package/dist/src/compiler/normalize-schedule.js +1 -1
- package/dist/src/compiler/normalize-skill.d.ts +2 -1
- package/dist/src/compiler/normalize-skill.js +1 -1
- package/dist/src/compiler/normalize-subagent.d.ts +4 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/compiler/normalize-tool.d.ts +2 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/context/node.d.ts +1 -1
- package/dist/src/evals/assertions/collector.d.ts +43 -0
- package/dist/src/evals/assertions/collector.js +1 -0
- package/dist/src/evals/assertions/run.d.ts +72 -0
- package/dist/src/evals/assertions/run.js +2 -0
- package/dist/src/evals/autoevals-client.js +2 -0
- package/dist/src/evals/cli/eval-client.d.ts +22 -0
- package/dist/src/evals/cli/eval-client.js +1 -0
- package/dist/src/evals/cli/eval.d.ts +8 -5
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/context.d.ts +19 -0
- package/dist/src/evals/context.js +1 -0
- package/dist/src/evals/define-eval-config.d.ts +16 -0
- package/dist/src/evals/define-eval-config.js +1 -0
- package/dist/src/evals/define-eval.d.ts +20 -0
- package/dist/src/evals/define-eval.js +1 -0
- package/dist/src/evals/expect/index.d.ts +25 -0
- package/dist/src/evals/expect/index.js +1 -0
- package/dist/src/evals/index.d.ts +6 -2
- package/dist/src/evals/index.js +1 -1
- package/dist/src/evals/judge.d.ts +20 -0
- package/dist/src/evals/judge.js +1 -0
- package/dist/src/evals/{checks/match.d.ts → match.d.ts} +17 -18
- package/dist/src/evals/match.js +1 -0
- package/dist/src/evals/reporters/index.d.ts +1 -0
- package/dist/src/evals/reporters/index.js +1 -1
- package/dist/src/evals/requirements.d.ts +3 -0
- package/dist/src/evals/requirements.js +1 -0
- package/dist/src/evals/runner/artifacts.d.ts +7 -6
- package/dist/src/evals/runner/artifacts.js +3 -3
- package/dist/src/evals/runner/discover.d.ts +31 -10
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +25 -0
- package/dist/src/evals/runner/execute-eval.js +1 -0
- package/dist/src/evals/runner/execute-task.d.ts +31 -0
- package/dist/src/evals/runner/execute-task.js +1 -0
- package/dist/src/evals/runner/reporters/braintrust.d.ts +7 -5
- package/dist/src/evals/runner/reporters/braintrust.js +2 -2
- package/dist/src/evals/runner/reporters/console.d.ts +4 -4
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/reporters/junit.d.ts +10 -0
- package/dist/src/evals/runner/reporters/junit.js +4 -0
- package/dist/src/evals/runner/reporters/types.d.ts +14 -8
- package/dist/src/evals/runner/run-evals.d.ts +38 -0
- package/dist/src/evals/runner/run-evals.js +1 -0
- package/dist/src/evals/runner/verdict.d.ts +10 -15
- package/dist/src/evals/runner/verdict.js +1 -1
- package/dist/src/evals/session.d.ts +52 -0
- package/dist/src/evals/session.js +1 -0
- package/dist/src/evals/target.d.ts +23 -0
- package/dist/src/evals/target.js +1 -0
- package/dist/src/evals/types.d.ts +294 -219
- package/dist/src/execution/compaction.d.ts +14 -0
- package/dist/src/execution/compaction.js +1 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/sandbox/bash-tool.d.ts +6 -6
- package/dist/src/execution/sandbox/bash-tool.js +1 -1
- package/dist/src/execution/sandbox/bindings/local.js +1 -1
- package/dist/src/execution/sandbox/glob-tool.js +3 -3
- package/dist/src/execution/sandbox/grep-tool.js +3 -3
- package/dist/src/execution/sandbox/read-file-tool.js +1 -1
- package/dist/src/execution/subagent-adapter.js +1 -1
- package/dist/src/execution/tool-auth.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +2 -2
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/action-result-helpers.js +1 -1
- package/dist/src/harness/authorization.d.ts +26 -0
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/code-mode-lifecycle.js +1 -1
- package/dist/src/harness/emission.d.ts +12 -5
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/model-call-error.d.ts +35 -6
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +10 -4
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/tools.d.ts +4 -6
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +4 -0
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +4 -15
- package/dist/src/internal/application/cache-metadata.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +4 -1
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
- 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-watcher-log.d.ts +37 -0
- package/dist/src/internal/nitro/host/dev-watcher-log.js +1 -0
- package/dist/src/internal/nitro/host/ports.d.ts +8 -0
- package/dist/src/internal/nitro/host/ports.js +1 -0
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/server-external-packages.d.ts +1 -1
- package/dist/src/internal/nitro/host/server-external-packages.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.d.ts +5 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +31 -2
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.d.ts +13 -0
- package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -1
- package/dist/src/internal/nitro/routes/info.d.ts +2 -2
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/workflow/queue-namespace.d.ts +5 -0
- package/dist/src/internal/workflow/queue-namespace.js +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +2 -2
- package/dist/src/internal/workflow-bundle/builder.js +3 -5
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/node_modules/.pnpm/@clack_core@1.3.1/node_modules/@clack/core/dist/index.js +4 -4
- package/dist/src/protocol/message.d.ts +15 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/public/channels/slack/api.d.ts +8 -0
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/connections.d.ts +26 -18
- package/dist/src/public/channels/slack/connections.js +1 -1
- package/dist/src/public/channels/slack/defaults.d.ts +5 -2
- package/dist/src/public/channels/slack/defaults.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +65 -5
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/defaults.js +1 -1
- package/dist/src/public/connections/errors.d.ts +8 -0
- package/dist/src/public/definitions/tool.d.ts +0 -33
- package/dist/src/public/next/index.d.ts +7 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/server.d.ts +1 -0
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/nuxt/dev-server.js +1 -1
- package/dist/src/public/sveltekit/dev-server.js +1 -1
- package/dist/src/public/sveltekit/index.d.ts +1 -1
- package/dist/src/public/tools/defaults.d.ts +2 -4
- package/dist/src/public/tools/defaults.js +1 -1
- package/dist/src/public/tools/define-bash-tool.d.ts +3 -3
- package/dist/src/public/tools/define-bash-tool.js +1 -1
- package/dist/src/public/tools/define-read-file-tool.d.ts +0 -6
- package/dist/src/public/tools/define-read-file-tool.js +1 -1
- package/dist/src/public/tools/index.d.ts +2 -2
- package/dist/src/public/tools/index.js +1 -1
- package/dist/src/public/tools/internal.js +1 -1
- package/dist/src/runtime/actions/types.d.ts +11 -11
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/agent/mock-model-fixtures.js +3 -2
- package/dist/src/runtime/agent/mock-model-skill-selection.js +3 -4
- package/dist/src/runtime/connections/callback-route.js +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +21 -5
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/connections/types.d.ts +33 -0
- package/dist/src/runtime/connections/validate-authorization.js +1 -1
- package/dist/src/runtime/framework-tools/bash.d.ts +3 -3
- package/dist/src/runtime/framework-tools/bash.js +1 -1
- package/dist/src/runtime/framework-tools/connection-search-dynamic.d.ts +1 -1
- package/dist/src/runtime/framework-tools/connection-search-dynamic.js +1 -1
- package/dist/src/runtime/framework-tools/file-state.d.ts +3 -3
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/read-file.js +2 -2
- package/dist/src/runtime/framework-tools/todo.d.ts +7 -0
- package/dist/src/runtime/framework-tools/todo.js +2 -2
- package/dist/src/runtime/governance/auth/http-basic.js +1 -1
- package/dist/src/runtime/input/types.d.ts +1 -1
- package/dist/src/runtime/resolve-tool.d.ts +2 -2
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/sandbox/keys.js +1 -1
- package/dist/src/runtime/session-callback-route.js +1 -1
- package/dist/src/runtime/types.d.ts +1 -7
- package/dist/src/services/dev-client/client-options.d.ts +8 -0
- package/dist/src/services/dev-client/client-options.js +1 -0
- package/dist/src/services/dev-client/runtime-artifacts.d.ts +13 -0
- package/dist/src/services/dev-client/runtime-artifacts.js +1 -0
- package/dist/src/services/dev-client.d.ts +13 -46
- package/dist/src/services/dev-client.js +1 -1
- package/dist/src/setup/ask.d.ts +205 -0
- package/dist/src/setup/ask.js +1 -0
- package/dist/src/setup/boxes/add-channels.d.ts +100 -16
- package/dist/src/setup/boxes/add-channels.js +2 -1
- package/dist/src/setup/boxes/add-connections.d.ts +13 -23
- package/dist/src/setup/boxes/add-connections.js +1 -1
- package/dist/src/setup/boxes/apply-ai-gateway-credential.d.ts +2 -2
- package/dist/src/setup/boxes/apply-ai-gateway-credential.js +1 -1
- package/dist/src/setup/boxes/deploy-project.d.ts +46 -14
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/detect-ai-gateway.d.ts +10 -3
- package/dist/src/setup/boxes/detect-ai-gateway.js +1 -1
- package/dist/src/setup/boxes/link-project.d.ts +3 -3
- package/dist/src/setup/boxes/link-project.js +1 -1
- package/dist/src/setup/boxes/one-shot-next-steps.d.ts +18 -0
- package/dist/src/setup/boxes/one-shot-next-steps.js +2 -0
- package/dist/src/setup/boxes/preflight.d.ts +14 -6
- package/dist/src/setup/boxes/preflight.js +1 -1
- package/dist/src/setup/boxes/resolve-provisioning.d.ts +36 -8
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/boxes/resolve-target.d.ts +25 -8
- package/dist/src/setup/boxes/resolve-target.js +1 -1
- package/dist/src/setup/boxes/scaffold.d.ts +12 -6
- package/dist/src/setup/boxes/scaffold.js +1 -1
- package/dist/src/setup/boxes/select-channels.d.ts +38 -9
- package/dist/src/setup/boxes/select-channels.js +1 -1
- package/dist/src/setup/boxes/select-chat.d.ts +15 -11
- package/dist/src/setup/boxes/select-chat.js +1 -1
- package/dist/src/setup/boxes/select-connections.d.ts +30 -0
- package/dist/src/setup/boxes/select-connections.js +1 -0
- package/dist/src/setup/boxes/select-model.d.ts +18 -14
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/boxes/select-setup-mode.d.ts +32 -0
- package/dist/src/setup/boxes/select-setup-mode.js +1 -0
- package/dist/src/setup/channel-add-conflicts.d.ts +28 -0
- package/dist/src/setup/channel-add-conflicts.js +1 -0
- package/dist/src/setup/cli/channel-setup-prompter.d.ts +23 -0
- package/dist/src/setup/cli/channel-setup-prompter.js +1 -0
- package/dist/src/setup/cli/connection-add-prompter.d.ts +8 -0
- package/dist/src/setup/cli/connection-add-prompter.js +1 -0
- package/dist/src/setup/{scaffold/cli → cli}/index.d.ts +4 -3
- package/dist/src/setup/cli/index.js +1 -0
- package/dist/src/setup/{scaffold/cli → cli}/prompt-ui.d.ts +39 -15
- package/dist/src/setup/cli/prompt-ui.js +5 -0
- package/dist/src/setup/{scaffold/cli → cli}/rail-log.d.ts +2 -0
- package/dist/src/setup/{scaffold/cli → cli}/rail-log.js +2 -2
- package/dist/src/setup/{scaffold/cli → cli}/select-component.d.ts +18 -3
- package/dist/src/setup/cli/select-component.js +1 -0
- package/dist/src/setup/cli/select-option-codec.d.ts +12 -0
- package/dist/src/setup/cli/select-option-codec.js +1 -0
- package/dist/src/setup/{scaffold/cli → cli}/select-state.d.ts +13 -1
- package/dist/src/setup/cli/select-state.js +1 -0
- package/dist/src/setup/cli/whimsy.d.ts +16 -0
- package/dist/src/setup/cli/whimsy.js +1 -0
- package/dist/src/setup/{scaffold/steps/setup-connection.d.ts → connection-connector.d.ts} +3 -2
- package/dist/src/setup/connection-connector.js +1 -0
- package/dist/src/setup/flows/channels.d.ts +43 -0
- package/dist/src/setup/flows/channels.js +1 -0
- package/dist/src/setup/flows/deploy.d.ts +40 -0
- package/dist/src/setup/flows/deploy.js +1 -0
- package/dist/src/setup/flows/in-project.d.ts +16 -0
- package/dist/src/setup/flows/in-project.js +1 -0
- package/dist/src/setup/flows/link.d.ts +43 -0
- package/dist/src/setup/flows/link.js +1 -0
- package/dist/src/setup/flows/model.d.ts +112 -0
- package/dist/src/setup/flows/model.js +1 -0
- package/dist/src/setup/flows/vercel.d.ts +31 -0
- package/dist/src/setup/flows/vercel.js +2 -0
- package/dist/src/setup/gateway-models.js +1 -1
- package/dist/src/setup/headless.d.ts +1 -1
- package/dist/src/setup/index.d.ts +10 -4
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/onboarding.d.ts +7 -4
- package/dist/src/setup/onboarding.js +1 -1
- package/dist/src/setup/package-manager.d.ts +27 -0
- package/dist/src/setup/package-manager.js +1 -0
- package/dist/src/setup/primitives/index.d.ts +3 -0
- package/dist/src/setup/primitives/index.js +1 -0
- package/dist/src/setup/primitives/pm/bun.d.ts +10 -0
- package/dist/src/setup/primitives/pm/bun.js +1 -0
- package/dist/src/setup/primitives/pm/index.d.ts +11 -0
- package/dist/src/setup/primitives/pm/index.js +1 -0
- package/dist/src/setup/primitives/pm/npm.d.ts +10 -0
- package/dist/src/setup/primitives/pm/npm.js +1 -0
- package/dist/src/setup/primitives/pm/pnpm.d.ts +27 -0
- package/dist/src/setup/primitives/pm/pnpm.js +8 -0
- package/dist/src/setup/primitives/pm/run.d.ts +23 -0
- package/dist/src/setup/primitives/pm/run.js +1 -0
- package/dist/src/setup/primitives/pm/shared.d.ts +8 -0
- package/dist/src/setup/primitives/pm/shared.js +1 -0
- package/dist/src/setup/primitives/pm/types.d.ts +37 -0
- package/dist/src/setup/primitives/pm/types.js +1 -0
- package/dist/src/setup/primitives/pm/yarn.d.ts +10 -0
- package/dist/src/setup/primitives/pm/yarn.js +1 -0
- package/dist/src/setup/primitives/run-pnpm.d.ts +1 -0
- package/dist/src/setup/primitives/run-pnpm.js +1 -0
- package/dist/src/setup/{scaffold/primitives → primitives}/run-vercel.d.ts +7 -0
- package/dist/src/setup/primitives/run-vercel.js +1 -0
- package/dist/src/setup/project-name.d.ts +4 -0
- package/dist/src/setup/project-name.js +1 -0
- package/dist/src/setup/project-resolution.d.ts +54 -0
- package/dist/src/setup/project-resolution.js +1 -0
- package/dist/src/setup/prompter.d.ts +52 -4
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/quit-guard.d.ts +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 +5 -4
- package/dist/src/setup/runner.js +1 -1
- package/dist/src/setup/scaffold/channels-catalog.d.ts +3 -3
- package/dist/src/setup/scaffold/channels-catalog.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.d.ts +26 -0
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -0
- package/dist/src/setup/scaffold/create/project.d.ts +54 -0
- package/dist/src/setup/scaffold/create/project.js +80 -0
- package/dist/src/setup/scaffold/index.d.ts +4 -4
- package/dist/src/setup/scaffold/index.js +1 -1
- package/dist/src/setup/scaffold/{channels.d.ts → update/channels.d.ts} +11 -0
- package/dist/src/setup/scaffold/update/channels.js +7 -0
- package/dist/src/setup/scaffold/{connections.d.ts → update/connections.d.ts} +1 -1
- package/dist/src/setup/scaffold/update/connections.js +21 -0
- package/dist/src/setup/scaffold/version-tokens.d.ts +11 -0
- package/dist/src/setup/scaffold/version-tokens.js +1 -0
- package/dist/src/setup/{scaffold/steps/setup-slackbot.d.ts → slackbot.d.ts} +24 -20
- package/dist/src/setup/slackbot.js +1 -0
- package/dist/src/setup/state.d.ts +62 -15
- package/dist/src/setup/state.js +1 -1
- package/dist/src/setup/step.d.ts +9 -18
- package/dist/src/setup/vercel-project.d.ts +15 -8
- package/dist/src/setup/vercel-project.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +5 -3
- package/dist/src/shared/default-agent-model.d.ts +5 -0
- package/dist/src/shared/default-agent-model.js +1 -0
- package/dist/src/source-change/apply-model-name.d.ts +25 -0
- package/dist/src/source-change/apply-model-name.js +2 -0
- package/dist/src/source-change/static-source-change.d.ts +36 -0
- package/dist/src/source-change/static-source-change.js +1 -0
- 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/package.json +22 -42
- package/dist/docs/evals-v2-plan.md +0 -939
- package/dist/docs/public/advanced/evals.md +0 -158
- package/dist/src/cli/commands/setup.d.ts +0 -55
- package/dist/src/cli/commands/setup.js +0 -1
- package/dist/src/cli/dev/repl/input-requests.d.ts +0 -38
- package/dist/src/cli/dev/repl/input-requests.js +0 -1
- package/dist/src/cli/dev/repl/input.d.ts +0 -19
- package/dist/src/cli/dev/repl/input.js +0 -1
- package/dist/src/cli/dev/repl/repl.d.ts +0 -62
- package/dist/src/cli/dev/repl/repl.js +0 -2
- package/dist/src/cli/dev/repl/terminal.d.ts +0 -21
- package/dist/src/cli/dev/repl/terminal.js +0 -5
- package/dist/src/compiled/_chunks/workflow/resume-hook-0Zk0zSvq.js +0 -12
- package/dist/src/compiled/_chunks/workflow/sleep-DXZr2BgM.js +0 -1
- package/dist/src/evals/checks/checks.d.ts +0 -66
- package/dist/src/evals/checks/checks.js +0 -2
- package/dist/src/evals/checks/index.d.ts +0 -21
- package/dist/src/evals/checks/index.js +0 -1
- package/dist/src/evals/checks/match.js +0 -1
- package/dist/src/evals/define-eval-suite.d.ts +0 -18
- package/dist/src/evals/define-eval-suite.js +0 -1
- package/dist/src/evals/runner/execute-case.d.ts +0 -23
- package/dist/src/evals/runner/execute-case.js +0 -1
- package/dist/src/evals/runner/execute-suite.d.ts +0 -24
- package/dist/src/evals/runner/execute-suite.js +0 -1
- package/dist/src/evals/scorers/autoevals-client.js +0 -2
- package/dist/src/evals/scorers/autoevals.d.ts +0 -58
- package/dist/src/evals/scorers/autoevals.js +0 -1
- package/dist/src/evals/scorers/json.d.ts +0 -10
- package/dist/src/evals/scorers/json.js +0 -1
- package/dist/src/evals/scorers/model-marker.d.ts +0 -12
- package/dist/src/evals/scorers/model-marker.js +0 -1
- package/dist/src/evals/scorers/run.d.ts +0 -24
- package/dist/src/evals/scorers/run.js +0 -1
- package/dist/src/evals/scorers/sql.d.ts +0 -9
- package/dist/src/evals/scorers/sql.js +0 -1
- package/dist/src/evals/scorers/text.d.ts +0 -18
- package/dist/src/evals/scorers/text.js +0 -1
- package/dist/src/evals/scores/index.d.ts +0 -72
- package/dist/src/evals/scores/index.js +0 -1
- package/dist/src/execution/tool-compaction.d.ts +0 -9
- package/dist/src/execution/tool-compaction.js +0 -1
- package/dist/src/services/dev-client/stream.d.ts +0 -5
- package/dist/src/services/dev-client/stream.js +0 -1
- package/dist/src/services/dev-client/url.d.ts +0 -11
- package/dist/src/services/dev-client/url.js +0 -1
- package/dist/src/setup/channel-setup-prompter.d.ts +0 -8
- package/dist/src/setup/channel-setup-prompter.js +0 -1
- package/dist/src/setup/scaffold/channels.js +0 -7
- package/dist/src/setup/scaffold/cli/channel-add-prompter.d.ts +0 -12
- package/dist/src/setup/scaffold/cli/channel-add-prompter.js +0 -1
- package/dist/src/setup/scaffold/cli/channel-setup-prompter.d.ts +0 -56
- package/dist/src/setup/scaffold/cli/connection-add-prompter.d.ts +0 -44
- package/dist/src/setup/scaffold/cli/connection-add-prompter.js +0 -1
- package/dist/src/setup/scaffold/cli/index.js +0 -1
- package/dist/src/setup/scaffold/cli/prompt-ui.js +0 -5
- package/dist/src/setup/scaffold/cli/select-component.js +0 -1
- package/dist/src/setup/scaffold/cli/select-state.js +0 -1
- package/dist/src/setup/scaffold/connections.js +0 -21
- package/dist/src/setup/scaffold/pnpm-workspace.d.ts +0 -3
- package/dist/src/setup/scaffold/pnpm-workspace.js +0 -11
- package/dist/src/setup/scaffold/primitives/detect-deployment.d.ts +0 -13
- package/dist/src/setup/scaffold/primitives/detect-deployment.js +0 -1
- package/dist/src/setup/scaffold/primitives/index.d.ts +0 -3
- package/dist/src/setup/scaffold/primitives/index.js +0 -1
- package/dist/src/setup/scaffold/primitives/pnpm-invocation.d.ts +0 -12
- package/dist/src/setup/scaffold/primitives/pnpm-invocation.js +0 -1
- package/dist/src/setup/scaffold/primitives/run-pnpm.d.ts +0 -17
- package/dist/src/setup/scaffold/primitives/run-pnpm.js +0 -1
- package/dist/src/setup/scaffold/primitives/run-vercel.js +0 -1
- package/dist/src/setup/scaffold/project.d.ts +0 -21
- package/dist/src/setup/scaffold/project.js +0 -80
- package/dist/src/setup/scaffold/steps/deploy-to-vercel.d.ts +0 -17
- package/dist/src/setup/scaffold/steps/deploy-to-vercel.js +0 -1
- package/dist/src/setup/scaffold/steps/index.d.ts +0 -4
- package/dist/src/setup/scaffold/steps/index.js +0 -1
- package/dist/src/setup/scaffold/steps/project-resolution.d.ts +0 -19
- package/dist/src/setup/scaffold/steps/project-resolution.js +0 -1
- package/dist/src/setup/scaffold/steps/run-add-connection.d.ts +0 -40
- package/dist/src/setup/scaffold/steps/run-add-connection.js +0 -1
- package/dist/src/setup/scaffold/steps/run-add-to-agent.d.ts +0 -81
- package/dist/src/setup/scaffold/steps/run-add-to-agent.js +0 -2
- package/dist/src/setup/scaffold/steps/setup-connection.js +0 -1
- package/dist/src/setup/scaffold/steps/setup-slackbot.js +0 -1
- /package/dist/src/{setup/scaffold/cli/channel-setup-prompter.js → cli/dev/tui/setup-flow.js} +0 -0
- /package/dist/src/evals/{scorers/autoevals-client.d.ts → autoevals-client.d.ts} +0 -0
- /package/dist/src/setup/{scaffold/cli → cli}/command-output.d.ts +0 -0
- /package/dist/src/setup/{scaffold/cli → cli}/command-output.js +0 -0
- /package/dist/src/setup/{scaffold/human-action.d.ts → human-action.d.ts} +0 -0
- /package/dist/src/setup/{scaffold/human-action.js → human-action.js} +0 -0
- /package/dist/src/setup/{scaffold/primitives → primitives}/process-output.d.ts +0 -0
- /package/dist/src/setup/{scaffold/primitives → primitives}/process-output.js +0 -0
- /package/dist/src/setup/scaffold/{web-template.d.ts → create/web-template.d.ts} +0 -0
- /package/dist/src/setup/scaffold/{web-template.js → create/web-template.js} +0 -0
- /package/dist/src/setup/scaffold/{module-files.d.ts → update/module-files.d.ts} +0 -0
- /package/dist/src/setup/scaffold/{module-files.js → update/module-files.js} +0 -0
- /package/dist/src/setup/scaffold/{package-json.d.ts → update/package-json.d.ts} +0 -0
- /package/dist/src/setup/scaffold/{package-json.js → update/package-json.js} +0 -0
- /package/dist/src/setup/scaffold/{primitives → update}/update-connection-connector.d.ts +0 -0
- /package/dist/src/setup/scaffold/{primitives → update}/update-connection-connector.js +0 -0
- /package/dist/src/setup/scaffold/{primitives → update}/update-slack-channel.d.ts +0 -0
- /package/dist/src/setup/scaffold/{primitives → update}/update-slack-channel.js +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{getPackageManagerStrategy}from"../../primitives/pm/index.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_EVE_PACKAGE_VERSION=`0.7.0`,DEFAULT_AI_PACKAGE_VERSION=`7.0.0-canary.171`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`;function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.evePackageVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TSGO_VERSION__`,t.tsgoPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.typesNodePackageVersion)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
|
+
|
|
3
|
+
export default defineAgent({
|
|
4
|
+
model: "__EVE_INIT_MODEL__",
|
|
5
|
+
});
|
|
6
|
+
`;function packageJsonTemplate(e){return`{
|
|
7
|
+
"name": "__EVE_INIT_APP_NAME__",
|
|
8
|
+
"version": "0.0.0",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"imports": {
|
|
11
|
+
"#*": "./agent/*",
|
|
12
|
+
"#evals/*": "./evals/*"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "eve build",
|
|
16
|
+
"dev": "eve dev",
|
|
17
|
+
"start": "eve start",
|
|
18
|
+
"typecheck": "tsgo"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"ai": "__EVE_INIT_AI_SDK_VERSION__",
|
|
22
|
+
"eve": "__EVE_INIT_PACKAGE_VERSION__",
|
|
23
|
+
"zod": "__EVE_INIT_ZOD_VERSION__"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
${e?` "@types/node": "__EVE_INIT_TYPES_NODE_VERSION__",
|
|
27
|
+
"@typescript/native-preview": "__EVE_INIT_TSGO_VERSION__"`:` "@typescript/native-preview": "__EVE_INIT_TSGO_VERSION__"`}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`}const AGENT_INSTRUCTIONS_TEMPLATE=`# Identity
|
|
31
|
+
|
|
32
|
+
You are a helpful assistant.
|
|
33
|
+
`,SHARED_TEMPLATE_FILES={"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE,"tsconfig.json":`{
|
|
34
|
+
"compilerOptions": {
|
|
35
|
+
"target": "ES2022",
|
|
36
|
+
"module": "NodeNext",
|
|
37
|
+
"moduleResolution": "NodeNext",
|
|
38
|
+
"strict": true,
|
|
39
|
+
"esModuleInterop": true,
|
|
40
|
+
"skipLibCheck": true,
|
|
41
|
+
"noEmit": true
|
|
42
|
+
},
|
|
43
|
+
"include": ["agent/**/*.ts", "evals/**/*.ts", ".eve/**/*.d.ts"]
|
|
44
|
+
}
|
|
45
|
+
`,".gitignore":`node_modules
|
|
46
|
+
.env*
|
|
47
|
+
.eve
|
|
48
|
+
.vercel
|
|
49
|
+
.workflow-data
|
|
50
|
+
.next
|
|
51
|
+
.output
|
|
52
|
+
.nitro
|
|
53
|
+
dist
|
|
54
|
+
.DS_Store
|
|
55
|
+
*.tsbuildinfo
|
|
56
|
+
`,".vercelignore":`node_modules
|
|
57
|
+
.eve
|
|
58
|
+
.next
|
|
59
|
+
.output
|
|
60
|
+
.nitro
|
|
61
|
+
dist
|
|
62
|
+
`,"AGENTS.md":`# Eve Agent App
|
|
63
|
+
|
|
64
|
+
This project uses the Eve framework. Before writing code, always read the relevant guide in \`node_modules/eve/dist/docs/public/\`.
|
|
65
|
+
`,"CLAUDE.md":`@AGENTS.md
|
|
66
|
+
`};function templateFiles(t,n){return{"agent/agent.ts":t?`import { defineAgent } from "eve";
|
|
67
|
+
|
|
68
|
+
export default defineAgent({
|
|
69
|
+
model: "__EVE_INIT_MODEL__",
|
|
70
|
+
modelOptions: {
|
|
71
|
+
providerOptions: {
|
|
72
|
+
gateway: {
|
|
73
|
+
byok: {
|
|
74
|
+
"__EVE_INIT_BYOK_PROVIDER__": [{ apiKey: process.env.__EVE_INIT_BYOK_ENV_VAR__! }],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
`:BASE_AGENT_TEMPLATE,...SHARED_TEMPLATE_FILES,"package.json":packageJsonTemplate(t),...getPackageManagerStrategy(n).scaffoldFiles}}async function assertCanCreateInPlace(e,n){if(!await pathExists(e))return;let r=(await readdir(e)).filter(e=>!ALLOWED_CREATE_IN_PLACE_ENTRIES.has(e));if(r.length>0&&!n){let e=r.slice(0,5).join(`, `),t=r.length>5?`, and ${r.length-5} more`:``;throw Error(`Cannot create project in current directory because it is not empty. Found: ${e}${t}. Use an empty directory.`)}}async function scaffoldBaseProject(e){let i=resolve(e.targetDirectory??process.cwd(),e.projectName),a=e.projectName===`.`,s=e.overwriteExisting??!1,u=e.byokProvider??!1,d=e.packageManager??`pnpm`;if(a)await assertCanCreateInPlace(i,s);else if(await pathExists(i))throw Error(`Cannot create project because "${i}" already exists.`);let f=e.typesNodePackageVersion??`25.9.1`,p={appName:basename(i),model:e.model,evePackageVersion:resolveVersionToken(`evePackageVersion`,e.evePackageVersion??`0.7.0`),aiPackageVersion:resolveVersionToken(`aiPackageVersion`,e.aiPackageVersion??`7.0.0-canary.171`),zodPackageVersion:resolveVersionToken(`zodPackageVersion`,e.zodPackageVersion??`4.4.3`),tsgoPackageVersion:resolveVersionToken(`tsgoPackageVersion`,e.tsgoPackageVersion??`7.0.0-dev.20260523.1`),typesNodePackageVersion:u?resolveVersionToken(`typesNodePackageVersion`,f):f};await mkdir(i,{recursive:!0});for(let[r,o]of Object.entries(templateFiles(u,d))){let c=`${i}/${r}`,l=await pathExists(c);await writeTextFile(c,renderTemplate(o,p),{force:a&&s}),l&&await e.onOverwriteFile?.(c)}return i}async function isEveProject(e){for(let t of SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS)try{return await stat(join(e,`agent`,`agent${t}`)),!0}catch{}return!1}export{CURRENT_DIRECTORY_PROJECT_NAME,DEFAULT_AI_PACKAGE_VERSION,DEFAULT_EVE_PACKAGE_VERSION,DEFAULT_ZOD_PACKAGE_VERSION,agentTemplateFiles,byokProviderEnvVar,formatEveDependencySpecifier,isEveProject,modelProviderSlug,scaffoldBaseProject};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CURRENT_DIRECTORY_PROJECT_NAME, isEveProject, scaffoldBaseProject, type ScaffoldBaseProjectOptions, } from "./project.js";
|
|
2
|
-
export { DEFAULT_SLACK_CONNECTOR_SLUG, SLACK_CHANNEL_DEFAULT_ROUTE, deriveSlackConnectorSlug, ensureChannel, listAuthoredChannels, normalizeSlackConnectorSlug, type ChannelKind, type ChannelMutationResult, type EnsureChannelOptions, type SlackConnectorSlug, type WebPackageVersions, } from "./channels.js";
|
|
1
|
+
export { byokProviderEnvVar, CURRENT_DIRECTORY_PROJECT_NAME, isEveProject, scaffoldBaseProject, type ScaffoldBaseProjectOptions, } from "./create/project.js";
|
|
2
|
+
export { DEFAULT_SLACK_CONNECTOR_SLUG, SLACK_CHANNEL_DEFAULT_ROUTE, deriveSlackConnectorSlug, ensureChannel, isNextJsProject, listAuthoredChannels, normalizeSlackConnectorSlug, type ChannelKind, type ChannelMutationResult, type EnsureChannelOptions, type SlackConnectorSlug, type WebPackageVersions, } from "./update/channels.js";
|
|
3
3
|
export { SCAFFOLDABLE_CHANNELS, type ScaffoldableChannel } from "./channels-catalog.js";
|
|
4
|
-
export { ensureConnection, listAuthoredConnections, type ConnectionInput, type ConnectionMutationAction, type ConnectionMutationResult, type EnsureConnectionOptions, } from "./connections.js";
|
|
4
|
+
export { ensureConnection, listAuthoredConnections, type ConnectionInput, type ConnectionMutationAction, type ConnectionMutationResult, type EnsureConnectionOptions, } from "./update/connections.js";
|
|
5
5
|
export { catalogSlugs, CONNECTION_CATALOG, CUSTOM_CONNECTION_SLUG, effectiveProtocols, endpointForProtocol, getCatalogEntry, isValidConnectionSlug, SUPPORTED_PROTOCOLS, type ConnectionAuthSpec, type ConnectionCatalogEntry, type ConnectionProtocol, type CustomConnectionInput, type EnvHeader, type McpEndpoint, type OpenApiEndpoint, } from "./connections/catalog.js";
|
|
6
6
|
export { WriteFileExistsError } from "./files.js";
|
|
7
|
-
export { HumanActionRequiredError, type HumanAction } from "
|
|
7
|
+
export { HumanActionRequiredError, type HumanAction } from "../human-action.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCAFFOLDABLE_CHANNELS}from"./channels-catalog.js";import{WriteFileExistsError}from"./files.js";import{CURRENT_DIRECTORY_PROJECT_NAME,isEveProject,scaffoldBaseProject}from"./project.js";import{DEFAULT_SLACK_CONNECTOR_SLUG,SLACK_CHANNEL_DEFAULT_ROUTE,deriveSlackConnectorSlug,ensureChannel,listAuthoredChannels,normalizeSlackConnectorSlug}from"./channels.js";import{
|
|
1
|
+
import{HumanActionRequiredError}from"../human-action.js";import{SCAFFOLDABLE_CHANNELS}from"./channels-catalog.js";import{CONNECTION_CATALOG,CUSTOM_CONNECTION_SLUG,SUPPORTED_PROTOCOLS,catalogSlugs,effectiveProtocols,endpointForProtocol,getCatalogEntry,isValidConnectionSlug}from"./connections/catalog.js";import{WriteFileExistsError}from"./files.js";import{CURRENT_DIRECTORY_PROJECT_NAME,byokProviderEnvVar,isEveProject,scaffoldBaseProject}from"./create/project.js";import{DEFAULT_SLACK_CONNECTOR_SLUG,SLACK_CHANNEL_DEFAULT_ROUTE,deriveSlackConnectorSlug,ensureChannel,isNextJsProject,listAuthoredChannels,normalizeSlackConnectorSlug}from"./update/channels.js";import{ensureConnection,listAuthoredConnections}from"./update/connections.js";export{CONNECTION_CATALOG,CURRENT_DIRECTORY_PROJECT_NAME,CUSTOM_CONNECTION_SLUG,DEFAULT_SLACK_CONNECTOR_SLUG,HumanActionRequiredError,SCAFFOLDABLE_CHANNELS,SLACK_CHANNEL_DEFAULT_ROUTE,SUPPORTED_PROTOCOLS,WriteFileExistsError,byokProviderEnvVar,catalogSlugs,deriveSlackConnectorSlug,effectiveProtocols,endpointForProtocol,ensureChannel,ensureConnection,getCatalogEntry,isEveProject,isNextJsProject,isValidConnectionSlug,listAuthoredChannels,listAuthoredConnections,normalizeSlackConnectorSlug,scaffoldBaseProject};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PackageManagerKind } from "../../package-manager.js";
|
|
1
2
|
export declare const SLACK_CHANNEL_DEFAULT_ROUTE = "/eve/v1/slack";
|
|
2
3
|
export declare const DEFAULT_SLACK_CONNECTOR_SLUG = "my-agent";
|
|
3
4
|
declare const slackConnectorSlugBrand: unique symbol;
|
|
@@ -50,11 +51,21 @@ interface WebChannelSkippedResult {
|
|
|
50
51
|
packageJsonUpdated: [];
|
|
51
52
|
}
|
|
52
53
|
type WebChannelMutationResult = WebChannelWrittenResult | WebChannelSkippedResult;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the project already carries a Next.js app: `package.json` declares a
|
|
56
|
+
* `next` dependency in any dependency field. This is the exact predicate the
|
|
57
|
+
* web scaffold skips on (`skipReason: "nextjs-project"`), so pickers can mark
|
|
58
|
+
* Web Chat as already present precisely when scaffolding would be a no-op.
|
|
59
|
+
* A missing `package.json` reads as "no app".
|
|
60
|
+
*/
|
|
61
|
+
export declare function isNextJsProject(projectRoot: string): Promise<boolean>;
|
|
53
62
|
export declare function normalizeSlackConnectorSlug(input: string): SlackConnectorSlug;
|
|
54
63
|
export declare function deriveSlackConnectorSlug(projectRoot: string, projectNameHint?: string): Promise<SlackConnectorSlug>;
|
|
55
64
|
export interface EnsureChannelOptions {
|
|
56
65
|
projectRoot: string;
|
|
57
66
|
kind: ChannelKind;
|
|
67
|
+
/** Manager that owns generated project configuration. Defaults to pnpm. */
|
|
68
|
+
packageManager?: PackageManagerKind;
|
|
58
69
|
force?: boolean;
|
|
59
70
|
slackConnectorSlug?: SlackConnectorSlug;
|
|
60
71
|
connectPackageVersion?: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{getPackageManagerStrategy}from"../../primitives/pm/index.js";import{pathExists,writeTextFile}from"../files.js";import{patchPackageJson}from"./package-json.js";import{resolveVersionToken}from"../version-tokens.js";import{getSupportedModuleBaseName,matchesSupportedModuleBaseName}from"./module-files.js";import{WEB_APP_TEMPLATE_FILES,WEB_APP_TEMPLATE_PACKAGE_JSON}from"../create/web-template.js";import"../create/project.js";import{basename,join,resolve}from"node:path";import{readFile,readdir,writeFile}from"node:fs/promises";const SLACK_CHANNEL_DEFAULT_ROUTE=`/eve/v1/slack`,DEFAULT_SLACK_CONNECTOR_SLUG=`my-agent`,PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],WEB_NEXT_CONFIG_PATH=`next.config.ts`,WEB_VERCEL_JSON_PATH=`vercel.json`,WEB_VERCEL_JSON_SCHEMA=`https://openapi.vercel.sh/vercel.json`,WEB_COMPETING_NEXT_CONFIG_PATHS=[`next.config.js`,`next.config.mjs`,WEB_NEXT_CONFIG_PATH,`next.config.mts`].filter(e=>e!==WEB_NEXT_CONFIG_PATH),WEB_DEFAULT_VERCEL_SERVICES={web:{entrypoint:`.`,framework:`nextjs`,routePrefix:`/`},eve:{buildCommand:`eve build`,entrypoint:`.`,framework:`eve`,routePrefix:`/_eve_internal/eve`}};function toSlackConnectorSlug(e){return e}function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function readDependencyVersion(e,t){let n=JSON.parse(await readFile(e,`utf8`));if(!isJsonObject(n)||!isJsonObject(n.dependencies))return;let r=n.dependencies[t];return typeof r==`string`?r:void 0}function packageJsonHasDependency(e,t){for(let n of PACKAGE_DEPENDENCY_FIELDS){let r=e[n];if(isJsonObject(r)&&typeof r[t]==`string`)return!0}return!1}async function hasPackageDependency(e,n){if(!await pathExists(e))return!1;let r=JSON.parse(await readFile(e,`utf8`));return isJsonObject(r)&&packageJsonHasDependency(r,n)}async function isNextJsProject(e){return hasPackageDependency(join(e,`package.json`),`next`)}async function ensurePackageDependency(e,n,i){return!await pathExists(e)||await readDependencyVersion(e,n)===i?[]:(await patchPackageJson(e,{dependencies:{[n]:i}}),[{path:e,dependencies:[n],devDependencies:[],scripts:[]}])}function resolveWebPackageVersions(e){return{evePackageVersion:e?.evePackageVersion??`0.7.0`,aiPackageVersion:e?.aiPackageVersion??`7.0.0-canary.171`,nextPackageVersion:e?.nextPackageVersion??`16.2.6`,reactPackageVersion:e?.reactPackageVersion??`19.2.6`,reactDomPackageVersion:e?.reactDomPackageVersion??`19.2.6`,streamdownPackageVersion:e?.streamdownPackageVersion??`2.5.0`,zodPackageVersion:e?.zodPackageVersion??`4.4.3`,tsgoPackageVersion:e?.tsgoPackageVersion??`7.0.0-dev.20260523.1`,typesNodePackageVersion:e?.typesNodePackageVersion??`25.9.1`,typesReactPackageVersion:e?.typesReactPackageVersion??`19.2.15`,typesReactDomPackageVersion:e?.typesReactDomPackageVersion??`19.2.3`}}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}async function patchWebPackageJson(e,n){if(!await pathExists(e))return[];let a={...WEB_APP_TEMPLATE_PACKAGE_JSON.dependencies,ai:resolveVersionToken(`aiPackageVersion`,n.aiPackageVersion),eve:formatEveDependencySpecifier(resolveVersionToken(`evePackageVersion`,n.evePackageVersion)),next:resolveVersionToken(`nextPackageVersion`,n.nextPackageVersion),react:resolveVersionToken(`reactPackageVersion`,n.reactPackageVersion),"react-dom":resolveVersionToken(`reactDomPackageVersion`,n.reactDomPackageVersion),streamdown:resolveVersionToken(`streamdownPackageVersion`,n.streamdownPackageVersion),zod:resolveVersionToken(`zodPackageVersion`,n.zodPackageVersion)},o={...WEB_APP_TEMPLATE_PACKAGE_JSON.devDependencies,"@types/node":resolveVersionToken(`typesNodePackageVersion`,n.typesNodePackageVersion),"@types/react":resolveVersionToken(`typesReactPackageVersion`,n.typesReactPackageVersion),"@types/react-dom":resolveVersionToken(`typesReactDomPackageVersion`,n.typesReactDomPackageVersion),"@typescript/native-preview":resolveVersionToken(`tsgoPackageVersion`,n.tsgoPackageVersion)},s=WEB_APP_TEMPLATE_PACKAGE_JSON.scripts;return await patchPackageJson(e,{dependencies:a,devDependencies:o,scripts:s}),[{path:e,dependencies:Object.keys(a),devDependencies:Object.keys(o),scripts:Object.keys(s)}]}function normalizeSlackConnectorSlug(e){return toSlackConnectorSlug((e.trim().replace(/^@/,``).split(`/`).at(-1)??``).toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^[^a-z0-9]+/,``).replace(/[^a-z0-9]+$/,``).slice(0,100).replace(/[^a-z0-9]+$/,``)||`my-agent`)}async function deriveSlackConnectorSlug(e,t){if(t!==void 0&&t.length>0&&t!==`.`)return normalizeSlackConnectorSlug(t);try{let t=await readFile(join(e,`package.json`),`utf8`),n=JSON.parse(t);if(typeof n.name==`string`&&n.name.length>0)return normalizeSlackConnectorSlug(n.name)}catch{}return normalizeSlackConnectorSlug(basename(resolve(e))||`my-agent`)}function buildSlackTemplate(e){return`import { connectSlackCredentials } from "@vercel/connect/eve";
|
|
2
|
+
import { slackChannel } from "eve/channels/slack";
|
|
3
|
+
|
|
4
|
+
export default slackChannel({
|
|
5
|
+
credentials: connectSlackCredentials("slack/${e}"),
|
|
6
|
+
});
|
|
7
|
+
`}function renderWebAppTemplate(e,t,n){let r=n?``:`, { configureVercelOutput: false }`;return e.replaceAll(`__EVE_INIT_APP_NAME__`,t).replaceAll(`__EVE_INIT_WITH_EVE_OPTIONS__`,r)}function withWebVercelServices(e){let t=JSON.parse(e);if(!isJsonObject(t))throw Error(`${WEB_VERCEL_JSON_PATH} must contain a JSON object.`);let n=t.experimentalServices;if(n!==void 0&&!isJsonObject(n))throw Error(`${WEB_VERCEL_JSON_PATH} experimentalServices must contain a JSON object.`);let r={...t,$schema:typeof t.$schema==`string`?t.$schema:WEB_VERCEL_JSON_SCHEMA,experimentalServices:{...n,web:n?.web??WEB_DEFAULT_VERCEL_SERVICES.web,eve:n?.eve??WEB_DEFAULT_VERCEL_SERVICES.eve}};return JSON.stringify(t)===JSON.stringify(r)?e:`${JSON.stringify(r,null,2)}\n`}async function ensureWebVercelServices(e){if(!await pathExists(e))return await writeTextFile(e,`${JSON.stringify({$schema:WEB_VERCEL_JSON_SCHEMA,experimentalServices:WEB_DEFAULT_VERCEL_SERVICES},null,2)}\n`,{force:!0}),`written`;let r=await readFile(e,`utf8`),i=withWebVercelServices(r);return i===r?`skipped`:(await writeFile(e,i,`utf8`),`written`)}async function findCompetingNextConfigFiles(e){let n=[];for(let r of WEB_COMPETING_NEXT_CONFIG_PATHS){let i=join(e,r);await pathExists(i)&&n.push(i)}return n}async function ensureChannel(e){switch(e.kind){case`slack`:return ensureSlackChannel({...e,kind:`slack`});case`web`:return ensureWebChannel({...e,kind:`web`})}}async function ensureWebChannel(r){let i=join(r.projectRoot,`package.json`),a=await pathExists(join(r.projectRoot,`app/page.tsx`));if(!r.force&&await isNextJsProject(r.projectRoot))return{kind:`web`,action:`skipped`,skipReason:`nextjs-project`,filesWritten:[],filesSkipped:[i],packageJsonUpdated:[]};let o=await patchWebPackageJson(i,resolveWebPackageVersions(r.webPackageVersions)),c=[],u=[],d=[],f=[],p=basename(resolve(r.projectRoot)),m=r.configureVercelServices??!0;if(m){let e=join(r.projectRoot,WEB_VERCEL_JSON_PATH);await ensureWebVercelServices(e)===`written`?c.push(e):f.push(e)}let h=await getPackageManagerStrategy(r.packageManager??`pnpm`).applyProjectConfiguration(r.projectRoot);c.push(...h.filesWritten),f.push(...h.filesSkipped);for(let[e,i]of Object.entries(WEB_APP_TEMPLATE_FILES)){let a=join(r.projectRoot,e);if(e===`agent/channels/eve.ts`&&!r.force&&await pathExists(a)){f.push(a);continue}let o=await pathExists(a);await writeTextFile(a,renderWebAppTemplate(i,p,m),{force:!0}),c.push(a),o&&u.push(a)}d.push(...await findCompetingNextConfigFiles(r.projectRoot));let g={kind:`web`,action:a?`overwritten`:`created`,filesWritten:c,filesSkipped:f,packageJsonUpdated:o};return u.length>0&&(g.filesOverwritten=u),d.length>0&&(g.competingNextConfigFiles=d),g}async function ensureSlackChannel(e){let r=join(e.projectRoot,`agent/channels/slack.ts`),a=await pathExists(r);if(!e.force&&a)return{kind:`slack`,action:`skipped`,filesWritten:[],filesSkipped:[r],packageJsonUpdated:[]};let o=resolveVersionToken(`connectPackageVersion`,e.connectPackageVersion??`0.2.2`),s=await ensurePackageDependency(join(e.projectRoot,`package.json`),`@vercel/connect`,o),c=e.slackConnectorSlug??await deriveSlackConnectorSlug(e.projectRoot);await writeTextFile(r,buildSlackTemplate(c),{force:e.force});let l={kind:`slack`,action:a?`overwritten`:`created`,filesWritten:[r],filesSkipped:[],packageJsonUpdated:s,slackConnectorSlug:c};return a&&(l.filesOverwritten=[r]),l}async function listAuthoredChannels(e){let t=join(e,`agent/channels`),n;try{n=await readdir(t,{withFileTypes:!0})}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n){if(e.isFile()){let t=getSupportedModuleBaseName(e.name);t!==null&&r.push(t);continue}if(e.isDirectory())try{(await readdir(join(t,e.name))).some(e=>matchesSupportedModuleBaseName(e,`connection`))&&r.push(e.name)}catch{}}return r.sort()}export{DEFAULT_SLACK_CONNECTOR_SLUG,SLACK_CHANNEL_DEFAULT_ROUTE,deriveSlackConnectorSlug,ensureChannel,isNextJsProject,listAuthoredChannels,normalizeSlackConnectorSlug};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ConnectionCatalogEntry, type ConnectionProtocol, type CustomConnectionInput } from "
|
|
1
|
+
import { type ConnectionCatalogEntry, type ConnectionProtocol, type CustomConnectionInput } from "../connections/catalog.js";
|
|
2
2
|
import type { PackageJsonMutation } from "./channels.js";
|
|
3
3
|
export type ConnectionMutationAction = "created" | "overwritten" | "skipped";
|
|
4
4
|
export interface ConnectionMutationResult {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{endpointForProtocol}from"../connections/catalog.js";import{pathExists,writeTextFile}from"../files.js";import{patchPackageJson}from"./package-json.js";import{resolveVersionToken}from"../version-tokens.js";import{getSupportedModuleBaseName,matchesSupportedModuleBaseName}from"./module-files.js";import{join}from"node:path";import{readFile,readdir,writeFile}from"node:fs/promises";const CONNECT_PACKAGE_NAME=`@vercel/connect`,USER_AUTHORED_CONNECTION_DIR=`agent/connections`;function resolveAuth(e){return e.auth??{kind:`none`}}function envKeysForAuth(e){switch(e.kind){case`bearer-env`:return[e.envVar];case`header`:return e.headers.map(e=>e.envVar);case`connect`:case`none`:return[]}}function authBlock(e){switch(e.kind){case`connect`:return` auth: connect("${e.connector}"),\n`;case`bearer-env`:return` auth: { getToken: async () => ({ token: process.env.${e.envVar}! }) },\n`;case`header`:return` headers: () => ({\n${e.headers.map(e=>` "${e.header}": process.env.${e.envVar}!,`).join(`
|
|
2
|
+
`)}\n }),\n`;case`none`:return``}}function renderMcpTemplate(e,t,n){return`${n.kind===`connect`?`import { connect } from "@vercel/connect/eve";
|
|
3
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
4
|
+
`:`import { defineMcpClientConnection } from "eve/connections";
|
|
5
|
+
`}
|
|
6
|
+
export default defineMcpClientConnection({
|
|
7
|
+
url: "${e.url}",
|
|
8
|
+
description: "${t}",
|
|
9
|
+
${authBlock(n)}});
|
|
10
|
+
`}function renderOpenApiTemplate(e,t,n){let r=n.kind===`connect`?`import { connect } from "@vercel/connect/eve";
|
|
11
|
+
import { defineOpenAPIConnection } from "eve/connections";
|
|
12
|
+
`:`import { defineOpenAPIConnection } from "eve/connections";
|
|
13
|
+
`,i=e.baseUrl?` baseUrl: "${e.baseUrl}",\n`:``;return`${r}
|
|
14
|
+
export default defineOpenAPIConnection({
|
|
15
|
+
spec: "${e.spec}",
|
|
16
|
+
${i} description: "${t}",
|
|
17
|
+
${authBlock(n)}});
|
|
18
|
+
`}function renderTemplate(e,t,n,r){return e===`mcp`?renderMcpTemplate(t,n,r):renderOpenApiTemplate(t,n,r)}function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function ensureConnectDependency(e,n){if(!await pathExists(e))return[];let i=JSON.parse(await readFile(e,`utf8`));return(isJsonObject(i)&&isJsonObject(i.dependencies)?i.dependencies[CONNECT_PACKAGE_NAME]:void 0)===n?[]:(await patchPackageJson(e,{dependencies:{[CONNECT_PACKAGE_NAME]:n}}),[{path:e,dependencies:[CONNECT_PACKAGE_NAME],devDependencies:[],scripts:[]}])}function envKeyPresent(e,t){return RegExp(`^\\s*(?:export\\s+)?${t}\\s*=`,`m`).test(e)}async function seedEnvPlaceholders(e,n){if(n.length===0)return[];let r=``;await pathExists(e)&&(r=await readFile(e,`utf8`));let i=n.filter(e=>!envKeyPresent(r,e));if(i.length===0)return[];let a=`${r.length>0&&!r.endsWith(`
|
|
19
|
+
`)?`
|
|
20
|
+
`:``}${i.map(e=>`${e}=`).join(`
|
|
21
|
+
`)}\n`;return await writeFile(e,r+a,`utf8`),i}async function ensureConnection(r){let a=r.slug??r.entry.slug,o=resolveAuth(r.entry),s=endpointForProtocol(r.entry,r.protocol);if(s===null)throw Error(`Connection "${a}" is missing a ${r.protocol===`mcp`?`mcp.url`:`openapi.spec`} endpoint for protocol "${r.protocol}".`);let c=join(r.projectRoot,USER_AUTHORED_CONNECTION_DIR,`${a}.ts`),l=envKeysForAuth(o),u=await pathExists(c);if(!r.force&&u)return{slug:a,protocol:r.protocol,action:`skipped`,filePath:c,filesWritten:[],filesSkipped:[c],packageJsonUpdated:[],envKeysAdded:[],envKeysRequired:l};let d=[];if(o.kind===`connect`){let e=resolveVersionToken(`connectPackageVersion`,r.connectPackageVersion??`0.2.2`);d.push(...await ensureConnectDependency(join(r.projectRoot,`package.json`),e))}await writeTextFile(c,renderTemplate(r.protocol,s,r.entry.description,o),{force:!0});let f=await seedEnvPlaceholders(join(r.projectRoot,`.env.local`),l),p={slug:a,protocol:r.protocol,action:u?`overwritten`:`created`,filePath:c,filesWritten:[c],filesSkipped:[],packageJsonUpdated:d,envKeysAdded:f,envKeysRequired:l};return u&&(p.filesOverwritten=[c]),p}async function listAuthoredConnections(e){let t=join(e,USER_AUTHORED_CONNECTION_DIR),n;try{n=await readdir(t,{withFileTypes:!0})}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n){if(e.isFile()){let t=getSupportedModuleBaseName(e.name);t!==null&&r.push(t);continue}if(e.isDirectory())try{(await readdir(join(t,e.name))).some(e=>matchesSupportedModuleBaseName(e,`connection`))&&r.push(e.name)}catch{}}return r.sort()}export{ensureConnection,listAuthoredConnections};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a scaffold version value, resolving a build-stamp token at the point
|
|
3
|
+
* of need when the running code is unstamped. The published package is stamped
|
|
4
|
+
* by the build (`scripts/stamp-version-tokens.mjs`), so the fallback only ever
|
|
5
|
+
* fires in a dev tree — tsgo watch emits and tests running from `src` — where
|
|
6
|
+
* the live workspace catalog *is* the truth the stamp would have captured.
|
|
7
|
+
* Outside a dev tree an unstamped token still throws, because writing the
|
|
8
|
+
* literal token into a scaffolded package.json would break the generated
|
|
9
|
+
* project.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveVersionToken(field: string, value: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dirname,join}from"node:path";import{existsSync,readFileSync,realpathSync}from"node:fs";import{fileURLToPath}from"node:url";function versionToken(e){return`__${e}_VERSION__`}const TOKEN_SOURCES={[versionToken(`EVE_PACKAGE`)]:{kind:`eve-version`},[versionToken(`AI_SDK`)]:{kind:`catalog`,packageName:`ai`},[versionToken(`VERCEL_CONNECT`)]:{kind:`catalog`,packageName:`@vercel/connect`},[versionToken(`NEXT`)]:{kind:`catalog`,packageName:`next`},[versionToken(`REACT`)]:{kind:`catalog`,packageName:`react`},[versionToken(`REACT_DOM`)]:{kind:`catalog`,packageName:`react-dom`},[versionToken(`STREAMDOWN`)]:{kind:`catalog`,packageName:`streamdown`},[versionToken(`ZOD`)]:{kind:`catalog`,packageName:`zod`},[versionToken(`TSGO`)]:{kind:`catalog`,packageName:`@typescript/native-preview`},[versionToken(`TYPES_NODE`)]:{kind:`catalog`,packageName:`@types/node`},[versionToken(`TYPES_REACT`)]:{kind:`catalog`,packageName:`@types/react`},[versionToken(`TYPES_REACT_DOM`)]:{kind:`catalog`,packageName:`@types/react-dom`}},resolvedTokens=new Map;function findEvePackageRoot(){let o=dirname(realpathSync(fileURLToPath(import.meta.url)));for(;;){let i=join(o,`package.json`);if(existsSync(i)&&JSON.parse(readFileSync(i,`utf8`)).name===`eve`)return o;let a=dirname(o);if(a===o)return;o=a}}function findWorkspaceManifest(r){let i=r;for(;;){let r=join(i,`pnpm-workspace.yaml`);if(existsSync(r))return r;let a=dirname(i);if(a===i)return;i=a}}function readCatalogVersion(e,t){let n=readFileSync(e,`utf8`).split(/\r?\n/),i=!1;for(let e of n){if(/^catalog:\s*$/.test(e)){i=!0;continue}if(!i)continue;if(/^\S/.test(e))break;let n=e.match(/^\s+(?:"([^"]+)"|([\w@/.-]+)):\s*"([^"]+)"/);if(n&&(n[1]??n[2])===t)return n[3]}}function resolveTokenFromDevTree(e){let i=TOKEN_SOURCES[e];if(i!==void 0)try{let e=findEvePackageRoot();if(e===void 0||!existsSync(join(e,`scripts/stamp-version-tokens.mjs`)))return;if(i.kind===`eve-version`){let n=JSON.parse(readFileSync(join(e,`package.json`),`utf8`));return typeof n.version==`string`?n.version:void 0}let a=findWorkspaceManifest(e);return a===void 0?void 0:readCatalogVersion(a,i.packageName)}catch{return}}function resolveVersionToken(e,t){if(!t.startsWith(`__`))return t;let n=resolvedTokens.get(t);if(n!==void 0)return n;let r=resolveTokenFromDevTree(t);if(r===void 0)throw Error(`Scaffold received unstamped version token (${e}=${t}). Build eve before using its dist entrypoint.`);return resolvedTokens.set(t,r),r}export{resolveVersionToken};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type ChannelSetupLog } from "#setup/cli/index.js";
|
|
2
|
+
import { captureVercel, runVercel, runVercelCaptureStdout } from "#setup/primitives/run-vercel.js";
|
|
3
|
+
/** Injected for tests; defaults to the real Vercel CLI subprocess primitives. */
|
|
4
|
+
export interface SlackbotProvisionDeps {
|
|
5
|
+
captureVercel: typeof captureVercel;
|
|
6
|
+
runVercel: typeof runVercel;
|
|
7
|
+
runVercelCaptureStdout: typeof runVercelCaptureStdout;
|
|
8
8
|
}
|
|
9
9
|
/** Outcome of the Connect create-and-attach sequence for a Slackbot. */
|
|
10
|
-
export type
|
|
11
|
-
kind: "skipped";
|
|
12
|
-
created: false;
|
|
13
|
-
attached: false;
|
|
14
|
-
} | {
|
|
10
|
+
export type ProvisionSlackbotResult = {
|
|
15
11
|
kind: "create-failed";
|
|
16
12
|
created: false;
|
|
17
13
|
attached: false;
|
|
@@ -32,17 +28,17 @@ export type SetupSlackbotResult = {
|
|
|
32
28
|
workspaceUrl?: string;
|
|
33
29
|
workspaceName?: string;
|
|
34
30
|
};
|
|
31
|
+
/** Identifiers returned by Vercel Connect for a Slack connector. */
|
|
32
|
+
export interface SlackConnectorRef {
|
|
33
|
+
uid: string;
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
35
36
|
/**
|
|
36
37
|
* Reads the connector identifiers from `vercel connect create … -F json`
|
|
37
38
|
* stdout, the authoritative source for the just-created connector's UID.
|
|
38
39
|
* Returns `undefined` when stdout is empty or not the expected JSON.
|
|
39
40
|
*/
|
|
40
41
|
export declare function parseCreatedSlackConnector(stdout: string): SlackConnectorRef | undefined;
|
|
41
|
-
/** Identifiers returned by Vercel Connect for a Slack connector. */
|
|
42
|
-
export interface SlackConnectorRef {
|
|
43
|
-
uid: string;
|
|
44
|
-
id: string;
|
|
45
|
-
}
|
|
46
42
|
/**
|
|
47
43
|
* Finds the expected connector, or the newest Slack connector already attached to this project.
|
|
48
44
|
*/
|
|
@@ -54,10 +50,18 @@ export declare function parseInstallation(body: unknown): {
|
|
|
54
50
|
} | undefined;
|
|
55
51
|
/**
|
|
56
52
|
* Creates a Slack Connect client, replaces its default trigger destination with the Eve route,
|
|
57
|
-
* and resolves workspace details when Connect reports them.
|
|
53
|
+
* and resolves workspace details when Connect reports them. Promptless: progress streams
|
|
54
|
+
* through the rail-styled `log`, and the result union carries every failure mode for the
|
|
55
|
+
* caller to act on.
|
|
56
|
+
*
|
|
57
|
+
* Known quirk, preserved deliberately: a `connector-unresolved` result reports
|
|
58
|
+
* `created: true`, but callers discard that fact (nothing is recorded), so a rerun
|
|
59
|
+
* creates a second connector instead of adopting the unresolved one.
|
|
58
60
|
*/
|
|
59
|
-
export declare function
|
|
61
|
+
export declare function provisionSlackbot(log: ChannelSetupLog, projectRoot: string,
|
|
62
|
+
/** Connector short-name passed to `vercel connect create slack --name`. */
|
|
63
|
+
slug: string, deps?: SlackbotProvisionDeps): Promise<ProvisionSlackbotResult>;
|
|
60
64
|
/**
|
|
61
65
|
* Patches a connector UID chosen by Connect before the caller deploys the channel definition.
|
|
62
66
|
*/
|
|
63
|
-
export declare function reconcileSlackUid(
|
|
67
|
+
export declare function reconcileSlackUid(log: ChannelSetupLog, projectRoot: string, slackbot: ProvisionSlackbotResult, expectedUid: string): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join}from"node:path";import{SLACK_CHANNEL_DEFAULT_ROUTE}from"#setup/scaffold/index.js";import{readFile}from"node:fs/promises";import{createPromptCommandOutput}from"#setup/cli/index.js";import{captureVercel,runVercel,runVercelCaptureStdout}from"#setup/primitives/run-vercel.js";import{updateSlackChannelConnectorUid}from"#setup/scaffold/update/update-slack-channel.js";const defaultDeps={captureVercel,runVercel,runVercelCaptureStdout},LOOKUP_TIMEOUT_MS=6e4,ATTACH_TIMEOUT_MS=2*6e4;function parseCreatedSlackConnector(e){let t=e.trim();if(!t)return;let n;try{n=JSON.parse(t)}catch{return}if(typeof n!=`object`||!n)return;let{uid:r,id:i}=n;if(!(typeof r!=`string`||typeof i!=`string`))return{uid:r,id:i}}async function readProjectId(t){try{let r=await readFile(join(t,`.vercel`,`project.json`),`utf8`),i=JSON.parse(r);return typeof i.projectId==`string`?i.projectId:void 0}catch{return}}function pickSlackConnector(e,t,n){if(typeof e!=`object`||!e)return;let r=e,i=r.connectors??r.clients;if(!Array.isArray(i))return;let a;for(let e of i){if(e.type!==`slack`||typeof e.uid!=`string`||typeof e.id!=`string`)continue;let r={uid:e.uid,id:e.id};if(n!==void 0&&r.uid===n)return r;let i=typeof e.createdAt==`number`?e.createdAt:0;t!==void 0&&Array.isArray(e.projects)&&e.projects.some(e=>typeof e==`object`&&!!e&&e.id===t)&&(!a||i>a.createdAt)&&(a={ref:r,createdAt:i})}return a?.ref}function parseInstallation(e){if(typeof e!=`object`||!e)return;let t=e.installations;if(!Array.isArray(t)||t.length===0)return;let n=t[0];if(typeof n.tenantUrl==`string`)return{workspaceUrl:n.tenantUrl,workspaceName:typeof n.tenantName==`string`?n.tenantName:void 0}}async function findSlackConnector(e,t,n,r,i){let a=await e.captureVercel([`connect`,`list`,`-F`,`json`,`--all-projects`],{cwd:t,onOutput:i,timeoutMs:LOOKUP_TIMEOUT_MS});if(a.ok)try{return pickSlackConnector(JSON.parse(a.stdout),n,r)}catch{return}}async function fetchInstallationInfo(e,t,n,r){let i=await e.captureVercel([`api`,`/v1/connex/clients/${n}/installations`],{cwd:t,onOutput:r,timeoutMs:LOOKUP_TIMEOUT_MS});if(i.ok)try{return parseInstallation(JSON.parse(i.stdout))}catch{return}}async function withPhase(e,t,n){let r=e.spinner?.(t);r||e.message(t);try{return await n()}finally{r?.stop()}}async function provisionSlackbot(e,n,i,a=defaultDeps){let o=createPromptCommandOutput(e),s=await readProjectId(n),c=`slack/${i}`,l=await withPhase(e,`Creating a Slackbot through Vercel Connect...`,()=>a.runVercelCaptureStdout([`connect`,`create`,`slack`,`--triggers`,`--name`,i,`-F`,`json`],{cwd:n,onOutput:o,timeoutMs:6e5}));if(!l.ok)return{kind:`create-failed`,created:!1,attached:!1};e.success(`Slackbot created via Vercel Connect.`);let u=parseCreatedSlackConnector(l.stdout);if(u||=await withPhase(e,`Locating the Slack connector...`,()=>findSlackConnector(a,n,s,c,o)),!u)return e.warning("Could not locate the Slack connector. Run `vercel connect list --all-projects` to find its UID."),{kind:`connector-unresolved`,created:!0,attached:!1};let d=u;if(e.info(`Slack connector: ${d.uid}`),!await withPhase(e,`Configuring Slack event delivery for this agent...`,async()=>(await a.runVercel([`connect`,`detach`,d.uid,`--yes`],{cwd:n,onOutput:o,timeoutMs:ATTACH_TIMEOUT_MS}),a.runVercel([`connect`,`attach`,d.uid,`--triggers`,`--trigger-path`,SLACK_CHANNEL_DEFAULT_ROUTE,`--yes`],{cwd:n,onOutput:o,timeoutMs:ATTACH_TIMEOUT_MS}))))return e.warning(`Could not register this project as a trigger destination. Run \`vercel connect attach ${d.uid} --triggers --trigger-path ${SLACK_CHANNEL_DEFAULT_ROUTE} --yes\` to enable event delivery.`),{kind:`attach-failed`,created:!0,attached:!1,connectorUid:d.uid};let f=await withPhase(e,`Reading Slack workspace details...`,()=>fetchInstallationInfo(a,n,d.id,o));return f?{kind:`attached`,created:!0,attached:!0,connectorUid:d.uid,workspaceUrl:f.workspaceUrl,workspaceName:f.workspaceName}:{kind:`attached`,created:!0,attached:!0,connectorUid:d.uid}}async function reconcileSlackUid(t,n,r,i){if(r.kind!==`attached`||r.connectorUid===i)return!0;t.info(`Connect assigned UID ${r.connectorUid} (expected ${i}). Updating agent/channels/slack.ts before deployment...`);let{patched:a}=await updateSlackChannelConnectorUid(join(n,`agent/channels/slack.ts`),r.connectorUid);return a?!0:(t.warning(`Could not patch agent/channels/slack.ts automatically. Update \`connectSlackCredentials("...")\` to \`"${r.connectorUid}"\` and run \`vercel deploy --prod\`.`),!1)}export{parseCreatedSlackConnector,parseInstallation,pickSlackConnector,provisionSlackbot,reconcileSlackUid};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChannelKind } from "#setup/scaffold/index.js";
|
|
2
|
-
import { type
|
|
1
|
+
import type { ChannelKind, ConnectionInput, ConnectionProtocol } from "#setup/scaffold/index.js";
|
|
2
|
+
import { type ProjectResolution } from "./project-resolution.js";
|
|
3
3
|
export { CURRENT_DIRECTORY_PROJECT_NAME } from "#setup/scaffold/index.js";
|
|
4
4
|
export type { ChannelKind };
|
|
5
5
|
/** Where the user wants to chat with the agent after scaffolding finishes. */
|
|
@@ -97,22 +97,55 @@ export type ResolvedAiGateway = {
|
|
|
97
97
|
/**
|
|
98
98
|
* How the scaffolded agent reaches a model. `"gateway"` routes through the
|
|
99
99
|
* Vercel AI Gateway (OIDC, or a pasted gateway key). `"self"` scaffolds an
|
|
100
|
-
* inline provider `byok` block reading `process.env`,
|
|
101
|
-
*
|
|
100
|
+
* inline provider `byok` block reading `process.env`, derived from the model
|
|
101
|
+
* picked earlier in the interview. Decided by the resolve-provisioning box.
|
|
102
102
|
*/
|
|
103
103
|
export type WiringMode = "gateway" | "self";
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
105
|
+
* How much of the onboarding flow runs. `"complete"` is the full interview and
|
|
106
|
+
* provisioning sequence; `"one-shot"` scaffolds the base template with the
|
|
107
|
+
* default model and skips everything after the scaffold (provisioning, model,
|
|
108
|
+
* channels, linking, credentials, connections, deploy, chat). Decided by the
|
|
109
|
+
* select-setup-mode box right after the target is resolved.
|
|
109
110
|
*/
|
|
110
|
-
export
|
|
111
|
+
export type SetupMode = "complete" | "one-shot";
|
|
112
|
+
/**
|
|
113
|
+
* One fully-specified connection to scaffold. The select-connections box
|
|
114
|
+
* resolves everything a prompt could decide (slug, protocol, the entry
|
|
115
|
+
* definition, and how the connector gets provisioned) during the interview,
|
|
116
|
+
* so the add-connections box runs effects without prompting.
|
|
117
|
+
*/
|
|
118
|
+
export interface ConnectionPlan {
|
|
119
|
+
slug: string;
|
|
120
|
+
protocol: ConnectionProtocol;
|
|
121
|
+
entry: ConnectionInput;
|
|
122
|
+
provision: {
|
|
123
|
+
kind: "connect";
|
|
124
|
+
service: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: "connect-manual";
|
|
127
|
+
} | {
|
|
128
|
+
kind: "command-hint";
|
|
129
|
+
service: string;
|
|
130
|
+
} | {
|
|
131
|
+
kind: "none";
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The in-memory state threaded through every setup box. Greenfield onboarding
|
|
136
|
+
* populates every field, while in-project setup starts from the detected
|
|
137
|
+
* on-disk facts and leaves the onboarding-only plans at their defaults.
|
|
138
|
+
*/
|
|
139
|
+
export interface SetupState {
|
|
111
140
|
agentName: string;
|
|
141
|
+
/** Decided by the select-setup-mode box; gates every post-scaffold box. */
|
|
142
|
+
setupMode: SetupMode;
|
|
112
143
|
modelId: string;
|
|
113
144
|
modelWiring: WiringMode;
|
|
114
145
|
/** Channels chosen in the interview phase; scaffolded later by the channels box. */
|
|
115
146
|
channelSelection: ChannelKind[];
|
|
147
|
+
/** Connections planned in the interview phase; scaffolded later by the connections box. */
|
|
148
|
+
connectionSelection: ConnectionPlan[];
|
|
116
149
|
/** Decided once by the resolve-provisioning box; executed later by the link box. */
|
|
117
150
|
vercelProject: ResolvedVercelProject;
|
|
118
151
|
/** Decided once by the resolve-provisioning box; executed by the AI Gateway credential box. */
|
|
@@ -120,16 +153,30 @@ export interface SetupState extends AddToAgentState {
|
|
|
120
153
|
projectPath: ResolvedProjectPath;
|
|
121
154
|
aiGatewayCredentials: ResolvedAiGatewayCredentials;
|
|
122
155
|
chat: ChatPreference | null;
|
|
156
|
+
/** Channels scaffolded so far in this run. */
|
|
157
|
+
channels: ChannelKind[];
|
|
158
|
+
webScaffolded: boolean;
|
|
159
|
+
slackScaffolded: boolean;
|
|
160
|
+
deploymentDependenciesInstalled: boolean;
|
|
161
|
+
/** The linked Vercel project facts, from the link box or the on-disk `.vercel` link. */
|
|
162
|
+
project: ProjectResolution;
|
|
163
|
+
deploymentPending: boolean;
|
|
164
|
+
slackbotCreated: boolean;
|
|
165
|
+
slackbotAttached: boolean;
|
|
166
|
+
slackConnectorUid: string | undefined;
|
|
167
|
+
slackWorkspaceUrl: string | undefined;
|
|
168
|
+
slackWorkspaceName: string | undefined;
|
|
123
169
|
}
|
|
124
170
|
export declare function createDefaultSetupState(): SetupState;
|
|
125
171
|
/**
|
|
126
172
|
* Whether this run has a Vercel project available, planned or already linked.
|
|
127
|
-
* During onboarding the resolve-provisioning box records the plan
|
|
128
|
-
*
|
|
129
|
-
* gating. During in-project setup there is no
|
|
130
|
-
* link resolves `state.project`, so the second
|
|
131
|
-
* create flow `state.project` stays unresolved
|
|
132
|
-
* second disjunct only fires when a real link
|
|
173
|
+
* During onboarding the resolve-provisioning box records the plan at the end
|
|
174
|
+
* of the interview (after channels and connections), so the first disjunct
|
|
175
|
+
* drives the post-scaffold deploy gating. During in-project setup there is no
|
|
176
|
+
* plan, but the detected on-disk link resolves `state.project`, so the second
|
|
177
|
+
* disjunct fires instead. In the create flow `state.project` stays unresolved
|
|
178
|
+
* until the link box runs, so the second disjunct only fires when a real link
|
|
179
|
+
* exists.
|
|
133
180
|
*/
|
|
134
181
|
export declare function hasVercelProject(state: Pick<SetupState, "vercelProject" | "project">): boolean;
|
|
135
182
|
export declare function requireProjectPath(state: Pick<SetupState, "projectPath">): string;
|
package/dist/src/setup/state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isProjectResolved}from"./project-resolution.js";import{CURRENT_DIRECTORY_PROJECT_NAME}from"#setup/scaffold/index.js";function createDefaultSetupState(){return{channels:[],webScaffolded:!1,slackScaffolded:!1,deploymentDependenciesInstalled:!1,project:{kind:`unresolved`},deploymentPending:!1,slackbotCreated:!1,slackbotAttached:!1,slackConnectorUid:void 0,slackWorkspaceUrl:void 0,slackWorkspaceName:void 0,agentName:``,setupMode:`complete`,modelId:``,modelWiring:`gateway`,channelSelection:[],connectionSelection:[],vercelProject:{kind:`none`},aiGateway:{kind:`inherit`},projectPath:{kind:`unresolved`,inPlace:!1},aiGatewayCredentials:{kind:`unresolved`},chat:null}}function hasVercelProject(t){return t.vercelProject.kind!==`none`||isProjectResolved(t.project)}function requireProjectPath(e){if(e.projectPath.kind===`resolved`)return e.projectPath.path;throw Error(`Project path has not been resolved.`)}function snapshotSetupState(e){return Object.freeze({...e,aiGatewayCredentials:Object.freeze({...e.aiGatewayCredentials}),aiGateway:Object.freeze({...e.aiGateway}),channelSelection:Object.freeze([...e.channelSelection]),connectionSelection:Object.freeze([...e.connectionSelection]),channels:Object.freeze([...e.channels]),project:Object.freeze({...e.project}),projectPath:Object.freeze({...e.projectPath}),vercelProject:Object.freeze({...e.vercelProject})})}export{CURRENT_DIRECTORY_PROJECT_NAME,createDefaultSetupState,hasVercelProject,requireProjectPath,snapshotSetupState};
|
package/dist/src/setup/step.d.ts
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
export interface OutputSink {
|
|
3
3
|
write(line: string): void;
|
|
4
4
|
}
|
|
5
|
-
/** Result of the interactive gather face: an input to perform, or a user cancel. */
|
|
6
|
-
export type InteractiveOutcome<Input> = {
|
|
7
|
-
kind: "done";
|
|
8
|
-
input: Input;
|
|
9
|
-
} | {
|
|
10
|
-
kind: "cancelled";
|
|
11
|
-
};
|
|
12
5
|
/**
|
|
13
6
|
* Thrown by the interactive prompter when the user cancels (Ctrl-C, or the
|
|
14
7
|
* two-stage Escape quit). The runner converts it into a cancelled run, so a
|
|
@@ -18,11 +11,13 @@ export declare class WizardCancelledError extends Error {
|
|
|
18
11
|
constructor();
|
|
19
12
|
}
|
|
20
13
|
/**
|
|
21
|
-
* A unit of
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
14
|
+
* A unit of work reusable by programmatic setup and channel-management flows.
|
|
15
|
+
* Every box has ONE gather for every mode: it asks its questions through an
|
|
16
|
+
* injected `Asker`, whose composed stack (interactive base, headless base,
|
|
17
|
+
* answer/policy decorators) decides how each question resolves; a user cancel
|
|
18
|
+
* propagates as {@link WizardCancelledError} for the runner to fold. `perform`
|
|
19
|
+
* owns the side effects once and `apply` records the result once, so
|
|
20
|
+
* interactive and headless execution cannot drift.
|
|
26
21
|
*
|
|
27
22
|
* `Input` is what a user/preset chooses; `Payload` is what `perform` actually
|
|
28
23
|
* did (which may differ from what was requested, e.g. a skipped channel).
|
|
@@ -33,14 +28,10 @@ export interface SetupBox<State, Input, Payload> {
|
|
|
33
28
|
shouldRun?(state: Readonly<State>): boolean;
|
|
34
29
|
/** One-line status for a menu-driven runner (unused by the linear wizard). */
|
|
35
30
|
summary?(state: Readonly<State>): string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
31
|
+
/** Mode-agnostic face: resolve the input, asking through the box's asker. */
|
|
32
|
+
gather(ctx: {
|
|
38
33
|
state: Readonly<State>;
|
|
39
34
|
initial?: Input;
|
|
40
|
-
}): Promise<InteractiveOutcome<Input>>;
|
|
41
|
-
/** Non-interactive face: derive the input from the box's options and state. */
|
|
42
|
-
gatherHeadless(ctx: {
|
|
43
|
-
state: Readonly<State>;
|
|
44
35
|
}): Promise<Input>;
|
|
45
36
|
/** The only side-effecting step. Must be idempotent: detect current files,
|
|
46
37
|
* link state, and connectors before mutating, so a rerun converges. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createPromptCommandOutput } from "#setup/
|
|
2
|
-
import { type VercelCaptureFailure } from "#setup/
|
|
3
|
-
import { type ProjectResolution } from "#setup/scaffold/steps/index.js";
|
|
1
|
+
import { createPromptCommandOutput } from "#setup/cli/index.js";
|
|
2
|
+
import { type VercelCaptureFailure } from "#setup/primitives/index.js";
|
|
4
3
|
import { z } from "zod";
|
|
4
|
+
import type { ProjectResolution } from "./project-resolution.js";
|
|
5
5
|
import type { Prompter } from "./prompter.js";
|
|
6
6
|
import type { ResolvedVercelProjectSpec } from "./state.js";
|
|
7
7
|
declare const VercelTeamListEntrySchema: z.ZodObject<{
|
|
@@ -21,6 +21,12 @@ declare const VercelProjectReferenceSchema: z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strip>;
|
|
22
22
|
type VercelProjectReference = z.infer<typeof VercelProjectReferenceSchema>;
|
|
23
23
|
export declare function unresolvedProject(): ProjectResolution;
|
|
24
|
+
/**
|
|
25
|
+
* Runs a network reach behind a section-like spinner so the user sees the CLI
|
|
26
|
+
* is working, not hung. The spinner clears whether the work resolves or throws,
|
|
27
|
+
* and degrades to nothing when the prompter has no spinner (headless/test).
|
|
28
|
+
*/
|
|
29
|
+
export declare function withNetworkSpinner<T>(prompter: Prompter, message: string, task: () => Promise<T>): Promise<T>;
|
|
24
30
|
/** Resolves the linked project id from a resolution, if any. */
|
|
25
31
|
export declare function projectIdFromResolution(project: ProjectResolution): string | undefined;
|
|
26
32
|
/** Lists the Vercel scopes available to the current CLI user. */
|
|
@@ -43,6 +49,12 @@ export declare function requireVercelLogin(failure?: VercelCaptureFailure): neve
|
|
|
43
49
|
* API error) is surfaced verbatim rather than mislabeled as a login problem.
|
|
44
50
|
*/
|
|
45
51
|
export declare function requireAuth(projectRoot: string, prompter?: Prompter): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Non-throwing auth probe: whether the Vercel CLI has a logged-in user. Used
|
|
54
|
+
* where authentication changes a decision (e.g. adopting an existing link)
|
|
55
|
+
* rather than being a precondition to enforce.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isVercelAuthenticated(projectRoot: string): Promise<boolean>;
|
|
46
58
|
/**
|
|
47
59
|
* Resolves a passed team slug, or the current scope when unset, to a concrete
|
|
48
60
|
* slug so every provisioning command can pass an explicit `--scope`.
|
|
@@ -81,11 +93,6 @@ export interface ArgsPickedProject {
|
|
|
81
93
|
export declare function pickProject(prompter: Prompter, projectRoot: string, team: string): Promise<ArgsPickedProject>;
|
|
82
94
|
/** Returns a project name for a new Vercel project, prompting when the default exists. */
|
|
83
95
|
export declare function pickNewProjectName(prompter: Prompter, projectRoot: string, team: string, defaultProjectName: string): Promise<string>;
|
|
84
|
-
/**
|
|
85
|
-
* Side-effect-free fact gathering after a link: reads `.vercel/project.json`
|
|
86
|
-
* to resolve the project. The on-disk link is the single source of truth.
|
|
87
|
-
*/
|
|
88
|
-
export declare function detectProjectResolution(projectRoot: string): Promise<ProjectResolution>;
|
|
89
96
|
/**
|
|
90
97
|
* Ensures the concrete project exists (creating it for a `new` plan) and links
|
|
91
98
|
* this directory to it. Pure executor: it acts on a fully-resolved spec and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{boolean,object,record,string,unknown}from"../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js";import"../node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js";import{
|
|
1
|
+
import{boolean,object,record,string,unknown}from"../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js";import"../node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js";import{captureVercel,runVercel}from"#setup/primitives/index.js";import{HumanActionRequiredError}from"#setup/human-action.js";import{whimsyFor}from"#setup/cli/index.js";const JsonObjectSchema=record(string(),unknown()),VercelTeamListEntrySchema=object({name:string(),slug:string(),current:boolean()}),VercelProjectListEntrySchema=object({name:string(),id:string()}),VercelProjectReferenceSchema=object({id:string(),name:string()}),VercelApiErrorSchema=object({error:object({code:string().optional(),message:string().optional()}).optional()});function unresolvedProject(){return{kind:`unresolved`}}async function withNetworkSpinner(e,t,n){let r=e.log.spinner?.(t);try{return await n()}finally{r?.stop()}}function projectIdFromResolution(e){return e.kind===`unresolved`?void 0:e.projectId}function parseJson(e,t){try{return JSON.parse(e)}catch{throw Error(`Could not parse ${t} JSON from Vercel CLI output.`)}}function parseVercelJsonList(e,t,n){let r=parseJson(e,t),i=JsonObjectSchema.safeParse(r);if(!i.success)throw Error(`Could not read ${t} from Vercel CLI JSON output.`);let a=i.data[t];if(!Array.isArray(a))throw Error(`Vercel CLI JSON output did not include ${t}.`);let o=[];for(let e of a){let t=n.safeParse(e);t.success&&o.push(t.data)}return o}function parseTeamList(e){return e===void 0?[]:parseVercelJsonList(e,`teams`,VercelTeamListEntrySchema)}async function listTeams(e){let t=await captureVercel([`teams`,`ls`,`--format`,`json`],{cwd:e});if(!t.ok)throw Error(`Could not list Vercel teams. ${t.failure.message}`);return parseTeamList(t.stdout)}function parseProjectList(e){return e===void 0?[]:parseVercelJsonList(e,`projects`,VercelProjectListEntrySchema)}async function listProjects(e,t){let n=await captureVercel([`project`,`ls`,`--format`,`json`,`--scope`,t],{cwd:e});if(!n.ok)throw Error(`Could not list Vercel projects in ${t}. ${n.failure.message}`);return parseProjectList(n.stdout)}function isNotFoundApiFailure(e){if(e.code===404)return!0;let t=VercelApiErrorSchema.safeParse(safeParseJson(e.stdout)),n=t.success?t.data.error:void 0,r=`${n?.code??``} ${n?.message??``} ${e.stderr}`.toLowerCase();return r.includes(`not_found`)||r.includes(`not found`)||r.includes(`404`)}function isConflictApiFailure(e){let t=VercelApiErrorSchema.safeParse(safeParseJson(e.stdout)),n=t.success?t.data.error:void 0,r=`${n?.code??``} ${n?.message??``} ${e.stdout} ${e.stderr}`.toLowerCase();return r.includes(`409`)||r.includes(`conflict`)||r.includes(`already exists`)}function safeParseJson(e){try{return JSON.parse(e)}catch{return}}function parseProjectReference(e,t){let n=VercelProjectReferenceSchema.safeParse(parseJson(e,t));if(!n.success)throw Error(`Could not read Vercel project identity from ${t}.`);return n.data}async function resolveProjectByNameOrId(e,t,n){let r=await captureVercel([`api`,`/v9/projects/${encodeURIComponent(n)}`,`--scope`,t,`--raw`],{cwd:e});if(r.ok)return parseProjectReference(r.stdout,`project ${n}`);if(isNotFoundApiFailure(r.failure))return null;throw Error(`Could not resolve project "${n}" in ${t}. ${r.failure.message}`)}async function createProject(e,t,n,r){let i=await captureVercel([`api`,`/v10/projects`,`--scope`,t,`--method`,`POST`,`--raw-field`,`name=${n}`,`--raw`],{cwd:e,onOutput:r});if(i.ok)return parseProjectReference(i.stdout,`created project ${n}`);throw isConflictApiFailure(i.failure)?Error(projectNameCollisionMessage(n,t)):Error(`Could not create Vercel project "${n}" in ${t}. ${i.failure.message}`)}function projectNameCollisionMessage(e,t){return`Vercel project "${e}" already exists in ${t}. Pass --project ${e} to link it, or choose a different project name.`}async function assertNewProjectNameAvailable(e,t,n){if(await resolveProjectByNameOrId(e,t,n)!==null)throw Error(projectNameCollisionMessage(n,t))}function requireVercelLogin(e){let t=`Provisioning a Vercel project requires you to be logged in to Vercel.`,n=e?.stderr.trim();throw new HumanActionRequiredError({kind:`vercel-login`,command:`vercel login`,reason:e?`${t} The Vercel CLI check did not succeed: ${e.message}${n?` ${n}`:``}`:t})}async function requireAuth(e,t){let check=async()=>{let t=await captureVercel([`whoami`],{cwd:e});t.ok||requireVercelLogin(t.failure)};if(t===void 0){await check();return}await withNetworkSpinner(t,whimsyFor(`auth`),check)}async function isVercelAuthenticated(e){return(await captureVercel([`whoami`],{cwd:e})).ok}async function whoamiScope(e){let t=await captureVercel([`whoami`],{cwd:e});return t.ok||requireVercelLogin(t.failure),t.stdout.trim()}async function resolveTeam(e,t){return t===void 0?(await listTeams(e)).find(e=>e.current)?.slug??await whoamiScope(e):t}async function validateTeam(e,t,n){if(n===void 0)return;let r=await listTeams(t);if(r.length>0&&!r.some(e=>e.slug===n))throw Error(`Team "${n}" was not found in \`vercel teams ls\`. Pass a valid team slug or omit --team.`)}async function pickTeam(e,t,n){if(n!==void 0)return await validateTeam(e,t,n),resolveTeam(t,n);let r=await withNetworkSpinner(e,whimsyFor(`teams`),()=>listTeams(t));return r.length<=1?r.find(e=>e.current)?.slug??await whoamiScope(t):e.select({message:`Select your team`,search:!0,placeholder:`type to filter teams`,options:r.map(e=>({value:e.slug,label:e.current?`${e.name} (current)`:e.name})),initialValue:r.find(e=>e.current)?.slug})}async function pickProject(e,t,n){let r=await withNetworkSpinner(e,whimsyFor(`projects`,n),()=>listProjects(t,n));return r.length===0?{project:await e.text({message:`No projects found in ${n}. Enter a project name to create`,validate:e=>e.trim().length===0?`Project name cannot be empty.`:void 0}),exists:!1}:{project:await e.select({message:`Project to link`,search:!0,placeholder:`type to filter projects`,options:r.map(e=>({value:e.name,label:e.name}))}),exists:!0}}async function pickNewProjectName(e,t,n,r){let i=await withNetworkSpinner(e,whimsyFor(`project-name`,n),()=>resolveProjectByNameOrId(t,n,r.trim())),a=r.trim();for(;i!==null;)e.note(`Vercel project "${a}" already exists in ${n}. Choose a different project name.`,`Project name unavailable`),a=(await e.text({message:`New Vercel project name`,defaultValue:`${a}-2`,validate:e=>{if(e.trim().length===0)return`Project name cannot be empty.`}})).trim(),i=await resolveProjectByNameOrId(t,n,a);return a}async function linkProject(e,t,n,r){let i=[`--scope`,n.team],a;if(n.kind===`new`)a=await withNetworkSpinner(e,`Creating Vercel project "${n.project}" in ${n.team}...`,async()=>(await assertNewProjectNameAvailable(t,n.team,n.project),createProject(t,n.team,n.project,r)));else{let e=await resolveProjectByNameOrId(t,n.team,n.project);if(e===null)throw Error(`Vercel project "${n.project}" was not found in ${n.team}.`);a=e}return withNetworkSpinner(e,`Linking this directory to Vercel project "${a.name}"...`,()=>runVercel([`link`,`--project`,a.id,...i,`--yes`],{cwd:t,onOutput:r}))}export{assertNewProjectNameAvailable,isVercelAuthenticated,linkProject,listProjects,listTeams,pickNewProjectName,pickProject,pickTeam,projectIdFromResolution,requireAuth,requireVercelLogin,resolveProjectByNameOrId,resolveTeam,unresolvedProject,validateTeam,withNetworkSpinner};
|
|
@@ -85,13 +85,15 @@ export interface AgentExperimentalDefinition {
|
|
|
85
85
|
/**
|
|
86
86
|
* Advanced hosted-build controls authored in `agent.ts`.
|
|
87
87
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* These affect packaging and bundling only. They do not affect the runtime
|
|
89
|
+
* prompt or authored execution APIs.
|
|
90
90
|
*/
|
|
91
91
|
export interface AgentBuildDefinition {
|
|
92
92
|
/**
|
|
93
93
|
* Additional imported package names that Eve should keep external and trace
|
|
94
|
-
* into hosted build output.
|
|
94
|
+
* into hosted build output. Eve also keeps matching imports external while
|
|
95
|
+
* compiling authored TypeScript modules such as tools, channels, and
|
|
96
|
+
* schedules.
|
|
95
97
|
*
|
|
96
98
|
* Prefer this when a package is sensitive to bundling and should ship via
|
|
97
99
|
* `server/node_modules` in hosted output.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const DEFAULT_AGENT_MODEL_ID=`anthropic/claude-sonnet-4.6`;export{DEFAULT_AGENT_MODEL_ID};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcome of a source-to-source edit attempt. Pure data. On success it carries
|
|
3
|
+
* the rewritten source, so the caller owns the filesystem write.
|
|
4
|
+
*/
|
|
5
|
+
export type SourceEdit = {
|
|
6
|
+
readonly kind: "applied";
|
|
7
|
+
readonly from: string;
|
|
8
|
+
readonly to: string;
|
|
9
|
+
readonly nextSource: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "bail";
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
readonly line: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Rewrites the `model` string literal passed to `defineAgent({ ... })` in
|
|
17
|
+
* `sourceText`, returning the edited source.
|
|
18
|
+
*
|
|
19
|
+
* Pure transform: parses with oxc, finds the literal's byte span, and splices
|
|
20
|
+
* only those bytes, so comments, formatting, and quote style everywhere else
|
|
21
|
+
* are preserved by construction. Bails (no edit) when `model` is absent or
|
|
22
|
+
* isn't a plain string literal. An env reference, a template, an inlined SDK
|
|
23
|
+
* model object, or a spread all opt out into the manual path instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare function applyModelNameToSource(sourceText: string, modelName: string): SourceEdit;
|