eve 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/README.md +11 -11
- package/bin/eve.d.ts +1 -1
- package/bin/eve.js +6 -6
- package/dist/src/channel/routes.d.ts +4 -4
- package/dist/src/channel/types.d.ts +2 -2
- package/dist/src/channel/websocket-upgrade-server.d.ts +3 -3
- package/dist/src/chunks/{use-eve-agent-CdETo3qQ.js → use-eve-agent-D9ZhQhyV.js} +2 -2
- package/dist/src/chunks/{use-eve-agent-ClyM-_UT.js → use-eve-agent-DFI0POM9.js} +2 -2
- package/dist/src/cli/banner.d.ts +1 -1
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/channel-add-conflicts.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/commands/init-agent-instructions.md +1 -1
- package/dist/src/cli/commands/init-git.js +1 -1
- package/dist/src/cli/commands/init.d.ts +1 -1
- package/dist/src/cli/commands/link.js +1 -1
- package/dist/src/cli/commands/preconditions.d.ts +2 -2
- package/dist/src/cli/commands/preconditions.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-issues.d.ts +2 -0
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
- package/dist/src/cli/dev/tui/theme.d.ts +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +1 -1
- package/dist/src/cli/dev/url.d.ts +1 -1
- package/dist/src/cli/run.d.ts +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/ui/output.d.ts +1 -1
- package/dist/src/client/client-error.d.ts +1 -1
- package/dist/src/client/client.d.ts +3 -3
- package/dist/src/client/eve-agent-store.d.ts +1 -1
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/message-reducer-types.d.ts +3 -3
- package/dist/src/client/message-reducer.d.ts +3 -3
- package/dist/src/client/output-schema.d.ts +1 -1
- package/dist/src/client/reducer.d.ts +5 -5
- package/dist/src/client/session.d.ts +1 -1
- package/dist/src/client/types.d.ts +1 -1
- package/dist/src/client/url.d.ts +2 -2
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@vercel/detect-agent/index.d.ts +1 -1
- package/dist/src/compiler/channel-instrumentation-types.js +1 -1
- package/dist/src/compiler/model-catalog.d.ts +1 -1
- package/dist/src/compiler/module-map.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-channel.js +1 -1
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/compiler/normalize-schedule.js +1 -1
- package/dist/src/compiler/normalize-skill.js +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/container.d.ts +4 -4
- package/dist/src/context/container.js +1 -1
- package/dist/src/discover/diagnostics.d.ts +1 -1
- package/dist/src/discover/project.d.ts +2 -2
- package/dist/src/discover/project.js +1 -1
- package/dist/src/evals/cli/eval-client.d.ts +1 -1
- package/dist/src/evals/define-eval.d.ts +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +1 -1
- package/dist/src/evals/runner/execute-task.d.ts +1 -1
- package/dist/src/evals/types.d.ts +6 -6
- package/dist/src/execution/durable-session-migrations/chain.js +1 -1
- package/dist/src/execution/sandbox/bash-tool.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-options.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/development-prewarm.js +1 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/session-callback-step.d.ts +1 -1
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/code-mode-lifecycle.d.ts +1 -1
- package/dist/src/harness/emission.d.ts +1 -1
- package/dist/src/harness/runtime-actions.d.ts +1 -1
- package/dist/src/internal/application/cache-metadata.d.ts +2 -2
- package/dist/src/internal/application/compiled-artifacts.js +2 -2
- package/dist/src/internal/application/package.d.ts +7 -7
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-bundle.js +1 -1
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/instrumentation.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-application.d.ts +1 -1
- package/dist/src/internal/nitro/host/channel-routes.d.ts +3 -3
- package/dist/src/internal/nitro/host/configure-nitro-routes.d.ts +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -1
- package/dist/src/internal/nitro/host/cron-handler-route.d.ts +3 -3
- package/dist/src/internal/nitro/host/nitro-bundler-config.d.ts +1 -1
- package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.d.ts +2 -2
- package/dist/src/internal/nitro/host/schedule-task-routes.d.ts +2 -2
- package/dist/src/internal/nitro/host/start-development-server.d.ts +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.d.ts +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +2 -2
- package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -1
- package/dist/src/internal/nitro/routes/health.d.ts +1 -1
- package/dist/src/internal/nitro/routes/info.d.ts +1 -1
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.d.ts +1 -1
- package/dist/src/internal/package-name.d.ts +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +6 -6
- package/dist/src/internal/workflow/builtins.d.ts +3 -3
- package/dist/src/internal/workflow-bundle/nitro-step-entry.js +1 -1
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +7 -7
- package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +4 -4
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/message.d.ts +2 -2
- package/dist/src/protocol/routes.d.ts +3 -3
- package/dist/src/public/agents/auth.d.ts +1 -1
- package/dist/src/public/channels/auth.d.ts +1 -1
- package/dist/src/public/channels/discord/api.d.ts +2 -2
- package/dist/src/public/channels/discord/discordChannel.d.ts +2 -2
- package/dist/src/public/channels/discord/hitl.d.ts +4 -4
- package/dist/src/public/channels/discord/verify.d.ts +1 -1
- package/dist/src/public/channels/eve.d.ts +5 -5
- package/dist/src/public/channels/github/api.d.ts +1 -1
- package/dist/src/public/channels/github/defaults.d.ts +1 -1
- package/dist/src/public/channels/github/inbound.d.ts +1 -1
- package/dist/src/public/channels/index.d.ts +2 -2
- package/dist/src/public/channels/linear/auth.d.ts +1 -1
- package/dist/src/public/channels/linear/hitl.d.ts +4 -4
- package/dist/src/public/channels/linear/inbound.d.ts +1 -1
- package/dist/src/public/channels/linear/verify.d.ts +1 -1
- package/dist/src/public/channels/slack/constants.d.ts +1 -1
- package/dist/src/public/channels/teams/api.d.ts +4 -4
- package/dist/src/public/channels/teams/hitl.d.ts +4 -4
- package/dist/src/public/channels/teams/limits.d.ts +3 -3
- package/dist/src/public/channels/teams/verify.d.ts +2 -2
- package/dist/src/public/channels/telegram/api.d.ts +1 -1
- package/dist/src/public/channels/telegram/hitl.d.ts +3 -3
- package/dist/src/public/channels/telegram/verify.d.ts +1 -1
- package/dist/src/public/channels/twilio/api.d.ts +1 -1
- package/dist/src/public/context/index.d.ts +1 -1
- package/dist/src/public/definitions/defineChannel.d.ts +2 -2
- package/dist/src/public/definitions/hook.d.ts +1 -1
- package/dist/src/public/definitions/remote-agent.d.ts +5 -5
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/definitions/source.d.ts +2 -2
- package/dist/src/public/definitions/state.d.ts +2 -2
- package/dist/src/public/definitions/state.js +1 -1
- package/dist/src/public/instrumentation/index.d.ts +3 -3
- package/dist/src/public/next/index.d.ts +12 -12
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/nuxt/dev-server.d.ts +2 -2
- package/dist/src/public/nuxt/dev-server.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +10 -10
- package/dist/src/public/nuxt/routing.d.ts +6 -6
- package/dist/src/public/nuxt/routing.js +1 -1
- package/dist/src/public/nuxt/vercel-json.d.ts +2 -2
- package/dist/src/public/sandbox/backends/just-bash.d.ts +1 -1
- package/dist/src/public/sandbox/backends/microsandbox.d.ts +1 -1
- package/dist/src/public/sandbox/backends/vercel.d.ts +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +3 -3
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +2 -2
- package/dist/src/public/sveltekit/dev-server.d.ts +2 -2
- package/dist/src/public/sveltekit/dev-server.js +1 -1
- package/dist/src/public/sveltekit/index.d.ts +11 -11
- package/dist/src/public/sveltekit/routing.d.ts +5 -5
- package/dist/src/public/sveltekit/routing.js +1 -1
- package/dist/src/public/sveltekit/vercel-json.d.ts +2 -2
- package/dist/src/public/tool-result-narrowing.js +1 -1
- package/dist/src/public/types/json.d.ts +1 -1
- package/dist/src/react/use-eve-agent.d.ts +8 -8
- package/dist/src/runtime/agent/bootstrap-model.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +1 -1
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/attributes/emit.d.ts +2 -2
- package/dist/src/runtime/connections/callback-route.d.ts +1 -1
- package/dist/src/runtime/connections/principal.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +1 -1
- package/dist/src/runtime/connections/types.d.ts +4 -4
- package/dist/src/runtime/framework-tools/final-output.d.ts +1 -1
- package/dist/src/runtime/governance/auth/http-basic.d.ts +1 -1
- package/dist/src/runtime/governance/auth/token-claims.d.ts +1 -1
- package/dist/src/runtime/governance/auth/types.d.ts +1 -1
- package/dist/src/runtime/loaders/artifact-paths.d.ts +1 -1
- package/dist/src/runtime/loaders/compile-metadata.js +1 -1
- package/dist/src/runtime/loaders/manifest.js +1 -1
- package/dist/src/runtime/loaders/module-map.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-channel.js +1 -1
- package/dist/src/runtime/schedules/register.js +1 -1
- package/dist/src/runtime/sessions/auth.d.ts +1 -1
- package/dist/src/runtime/sessions/runtime-session.d.ts +1 -1
- package/dist/src/runtime/types.d.ts +1 -1
- package/dist/src/runtime/workspace/types.d.ts +1 -1
- package/dist/src/services/dev-client/request-headers.d.ts +2 -2
- package/dist/src/services/dev-client/vercel-auth-error.d.ts +1 -1
- package/dist/src/services/inspect-application.d.ts +1 -1
- package/dist/src/setup/boxes/add-channels.d.ts +1 -1
- package/dist/src/setup/boxes/add-channels.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/resolve-target.d.ts +2 -2
- package/dist/src/setup/boxes/scaffold.d.ts +4 -4
- package/dist/src/setup/boxes/scaffold.js +1 -1
- package/dist/src/setup/channel-add-conflicts.js +1 -1
- package/dist/src/setup/cli/rail-log.d.ts +1 -1
- package/dist/src/setup/flows/model.d.ts +3 -5
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/node-engine.d.ts +5 -5
- package/dist/src/setup/node-engine.js +1 -1
- package/dist/src/setup/onboarding.d.ts +2 -2
- package/dist/src/setup/primitives/open-url.d.ts +1 -1
- package/dist/src/setup/primitives/pm/pnpm.js +1 -1
- package/dist/src/setup/primitives/pm/run.d.ts +1 -1
- package/dist/src/setup/primitives/pm/types.d.ts +1 -1
- package/dist/src/setup/scaffold/connections/catalog.d.ts +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.d.ts +2 -2
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.d.ts +5 -5
- package/dist/src/setup/scaffold/create/project.js +3 -3
- package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
- package/dist/src/setup/scaffold/create/web-template.js +2 -2
- package/dist/src/setup/scaffold/update/package-json.d.ts +1 -1
- package/dist/src/setup/slack-connect-lifecycle.d.ts +2 -2
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slackbot.d.ts +1 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/setup/validate-gateway-key.d.ts +1 -1
- package/dist/src/setup/vercel-project.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +15 -15
- package/dist/src/shared/code-mode.d.ts +3 -3
- package/dist/src/shared/json-schema.d.ts +1 -1
- package/dist/src/shared/model-endpoint-status.d.ts +2 -2
- package/dist/src/shared/sandbox-backend.d.ts +4 -4
- package/dist/src/shared/sandbox-definition.d.ts +3 -3
- package/dist/src/shared/sandbox-network-policy.d.ts +1 -1
- package/dist/src/shared/sandbox-session.d.ts +2 -2
- package/dist/src/shared/skill-package.d.ts +1 -1
- package/dist/src/shared/skill-package.js +1 -1
- package/dist/src/shared/tool-definition.d.ts +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +7 -7
- 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.d.ts +7 -7
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +10 -10
- package/docs/agent-config.md +2 -2
- package/docs/channels/custom.mdx +5 -5
- package/docs/channels/discord.mdx +3 -3
- package/docs/channels/eve.mdx +7 -7
- package/docs/channels/linear.mdx +6 -6
- package/docs/channels/overview.mdx +11 -11
- package/docs/channels/slack.mdx +4 -4
- package/docs/channels/teams.mdx +2 -2
- package/docs/channels/telegram.mdx +3 -3
- package/docs/channels/twilio.mdx +1 -1
- package/docs/concepts/context-control.md +5 -5
- package/docs/concepts/default-harness.md +2 -2
- package/docs/concepts/execution-model-and-durability.md +9 -9
- package/docs/concepts/security-model.md +9 -9
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/connections.mdx +11 -11
- package/docs/evals/judge.mdx +2 -2
- package/docs/evals/overview.mdx +2 -2
- package/docs/evals/reporters.mdx +2 -2
- package/docs/getting-started.mdx +10 -10
- package/docs/guides/auth-and-route-protection.md +6 -6
- package/docs/guides/client/continuations.mdx +3 -3
- package/docs/guides/client/output-schema.mdx +1 -1
- package/docs/guides/client/overview.mdx +5 -5
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/deployment.md +7 -7
- package/docs/guides/dev-tui.md +2 -2
- package/docs/guides/frontend/nextjs.mdx +13 -13
- package/docs/guides/frontend/nuxt.mdx +7 -7
- package/docs/guides/frontend/overview.mdx +12 -12
- package/docs/guides/frontend/sveltekit.mdx +7 -7
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +6 -6
- package/docs/guides/frontend/use-eve-agent-vue.mdx +6 -6
- package/docs/guides/hooks.md +2 -2
- package/docs/guides/instrumentation.md +12 -12
- package/docs/guides/remote-agents.md +4 -4
- package/docs/guides/session-context.md +4 -4
- package/docs/guides/state.md +1 -1
- package/docs/instructions.mdx +4 -4
- package/docs/introduction.mdx +12 -12
- package/docs/reference/cli.md +5 -5
- package/docs/reference/project-layout.md +4 -4
- package/docs/responsible-use.md +3 -3
- package/docs/sandbox.mdx +8 -8
- package/docs/schedules.mdx +1 -1
- package/docs/skills.mdx +4 -4
- package/docs/subagents.mdx +3 -3
- package/docs/tools/human-in-the-loop.md +10 -10
- package/docs/tools/overview.mdx +10 -10
- package/docs/tutorial/connect-a-warehouse.mdx +3 -3
- package/docs/tutorial/first-agent.mdx +2 -2
- package/docs/tutorial/how-it-runs.mdx +2 -2
- package/docs/tutorial/query-sample-data.mdx +1 -1
- package/docs/tutorial/ship-it.mdx +4 -4
- package/package.json +1 -1
|
@@ -4,13 +4,13 @@ import { type AuthFn } from "#public/channels/auth.js";
|
|
|
4
4
|
import { type UploadPolicyInput } from "#public/channels/upload-policy.js";
|
|
5
5
|
import { type Channel, type ChannelEvents, type ChannelSessionOps } from "#public/definitions/defineChannel.js";
|
|
6
6
|
/**
|
|
7
|
-
* Event-handler channel context exposed by `eveChannel({ events })`. The default
|
|
7
|
+
* Event-handler channel context exposed by `eveChannel({ events })`. The default eve HTTP channel
|
|
8
8
|
* has no platform-specific state, so handlers receive session continuation operations plus the `SessionContext` third arg from {@link ChannelEvents}.
|
|
9
9
|
*/
|
|
10
10
|
export type EveEventContext = ChannelSessionOps;
|
|
11
11
|
/** Runtime stream-event handlers supported by `eveChannel({ events })`. */
|
|
12
12
|
export type EveChannelEvents = ChannelEvents<EveEventContext>;
|
|
13
|
-
/** Low-level
|
|
13
|
+
/** Low-level eve HTTP handle exposed to `eveChannel({ onMessage })`. */
|
|
14
14
|
export interface EveHandle {
|
|
15
15
|
/** Route-auth result for the request; `onMessage` chooses session auth by returning `{ auth }`. */
|
|
16
16
|
readonly caller: SessionAuthContext | null;
|
|
@@ -54,12 +54,12 @@ export interface EveChannelInput {
|
|
|
54
54
|
*/
|
|
55
55
|
readonly uploadPolicy?: UploadPolicyInput;
|
|
56
56
|
/**
|
|
57
|
-
* Pre-dispatch hook for inbound
|
|
57
|
+
* Pre-dispatch hook for inbound eve HTTP messages. Runs after route auth and body
|
|
58
58
|
* parsing, before runtime dispatch.
|
|
59
59
|
*/
|
|
60
60
|
readonly onMessage?: (ctx: EveMessageContext, message: string | UserContent) => EveMessageResultOrPromise;
|
|
61
61
|
/**
|
|
62
|
-
* Runtime stream-event handlers for the default
|
|
62
|
+
* Runtime stream-event handlers for the default eve HTTP channel. Handlers receive
|
|
63
63
|
* the event data, {@link EveEventContext}, and `SessionContext` (the same shape as custom channels).
|
|
64
64
|
*/
|
|
65
65
|
readonly events?: EveChannelEvents;
|
|
@@ -72,7 +72,7 @@ export interface EveChannelInput {
|
|
|
72
72
|
export interface EveChannel extends Channel {
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* Builds the default
|
|
75
|
+
* Builds the default eve HTTP channel: a {@link defineChannel} instance serving the
|
|
76
76
|
* built-in `/eve/v1` routes (POST creates a session, POST delivers a follow-up, GET
|
|
77
77
|
* streams a session's NDJSON event feed). Every route runs {@link EveChannelInput.auth}
|
|
78
78
|
* via {@link routeAuth} before dispatching. Default-export the result as your
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Minimal GitHub REST/GraphQL wrapper used by the GitHub channel.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* eve exposes channel-owned helper types and functions instead of leaking a
|
|
5
5
|
* third-party SDK through public channel APIs.
|
|
6
6
|
*/
|
|
7
7
|
import { type GitHubAuthApiOptions, type GitHubChannelCredentials } from "#public/channels/github/auth.js";
|
|
@@ -4,7 +4,7 @@ import type { GitHubChannelCredentials } from "#public/channels/github/auth.js";
|
|
|
4
4
|
import { type GitHubComment } from "#public/channels/github/inbound.js";
|
|
5
5
|
import type { GitHubChannelEvents, GitHubInboundContext, GitHubInboundResult, GitHubProgressConfig } from "#public/channels/github/githubChannel.js";
|
|
6
6
|
/**
|
|
7
|
-
* Projects a GitHub webhook actor into an
|
|
7
|
+
* Projects a GitHub webhook actor into an eve {@link SessionAuthContext}. Sets `principalId` to
|
|
8
8
|
* `github:<sender.id>`, `principalType` to `"service"` for bot senders and `"user"` otherwise, and
|
|
9
9
|
* copies conversation and repository metadata into `attributes`. Reuse it when composing a custom
|
|
10
10
|
* `onComment` hook.
|
|
@@ -162,7 +162,7 @@ export declare function extractGitHubCommentTrigger(input: {
|
|
|
162
162
|
readonly body: string;
|
|
163
163
|
readonly botName?: string;
|
|
164
164
|
}): GitHubCommentTrigger | null;
|
|
165
|
-
/** Parses GitHub webhook headers and body into an
|
|
165
|
+
/** Parses GitHub webhook headers and body into an eve-owned event shape. */
|
|
166
166
|
export declare function parseGitHubWebhookEvent(input: {
|
|
167
167
|
readonly body: string;
|
|
168
168
|
readonly contentType?: string;
|
|
@@ -9,7 +9,7 @@ export type InstrumentationChannelMetadata = Readonly<Record<string, unknown>>;
|
|
|
9
9
|
* Channel metadata projections keyed by channel kind.
|
|
10
10
|
*
|
|
11
11
|
* Built-in channel packages ship declaration-merged entries (e.g. Slack
|
|
12
|
-
* ships `"channel:slack"`). The
|
|
12
|
+
* ships `"channel:slack"`). The eve compiler generates entries for
|
|
13
13
|
* authored channels at build time.
|
|
14
14
|
*/
|
|
15
15
|
export interface ChannelMetadataMap {
|
|
@@ -34,7 +34,7 @@ export type InstrumentationChannelKind = keyof ChannelMetadataMap;
|
|
|
34
34
|
/**
|
|
35
35
|
* Channel values keyed by path-derived channel kind.
|
|
36
36
|
*
|
|
37
|
-
* Entries are generated by the
|
|
37
|
+
* Entries are generated by the eve compiler for authored channels.
|
|
38
38
|
* Built-in channel entries are declared inline above.
|
|
39
39
|
* Used by {@link isChannel} to resolve a channel value to its kind string.
|
|
40
40
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Linear channel credential resolvers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* eve keeps Linear access tokens out of model-visible context. Channel helpers
|
|
5
5
|
* resolve them only when verifying inbound webhooks or calling Linear's
|
|
6
6
|
* GraphQL API to emit Agent Activities.
|
|
7
7
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { LinearAgentActivityRecord } from "#public/channels/linear/api.js";
|
|
2
2
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
3
|
-
/** Hidden marker embedded in
|
|
3
|
+
/** Hidden marker embedded in eve-created Linear elicitation bodies. */
|
|
4
4
|
export declare const LINEAR_HITL_MARKER_PREFIX = "<!-- eve-input:";
|
|
5
5
|
export declare const LINEAR_HITL_MARKER_SUFFIX = " -->";
|
|
6
|
-
/** Renders
|
|
6
|
+
/** Renders eve input requests as one Linear elicitation body. */
|
|
7
7
|
export declare function renderLinearInputRequests(requests: readonly InputRequest[]): string;
|
|
8
|
-
/** Resolves a Linear user prompt against the latest
|
|
8
|
+
/** Resolves a Linear user prompt against the latest eve-created elicitation marker. */
|
|
9
9
|
export declare function resolveLinearPromptInputResponses(input: {
|
|
10
10
|
readonly activities: readonly LinearAgentActivityRecord[];
|
|
11
11
|
readonly body: string;
|
|
12
12
|
}): readonly InputResponse[];
|
|
13
|
-
/** Strips
|
|
13
|
+
/** Strips eve's hidden HITL marker from a body before user-facing assertions/logging. */
|
|
14
14
|
export declare function stripLinearHitlMarker(body: string): string;
|
|
@@ -84,5 +84,5 @@ export declare function parseLinearWebhookEvent(input: {
|
|
|
84
84
|
}): LinearInboundEvent | null;
|
|
85
85
|
/** Builds the user-facing message for a Linear Agent Session event. */
|
|
86
86
|
export declare function messageFromLinearAgentSessionEvent(event: LinearAgentSessionEvent): UserContent;
|
|
87
|
-
/** Formats Linear issue/session context as an
|
|
87
|
+
/** Formats Linear issue/session context as an eve context block. */
|
|
88
88
|
export declare function formatLinearContextBlock(event: LinearAgentSessionEvent): string;
|
|
@@ -2,7 +2,7 @@ import { type LinearWebhookSecret } from "#public/channels/linear/auth.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Caller-supplied inbound webhook verifier. Use it as an alternative to
|
|
4
4
|
* Linear's HMAC secret, for example when a trusted proxy authenticates the
|
|
5
|
-
* request before it reaches
|
|
5
|
+
* request before it reaches eve.
|
|
6
6
|
*
|
|
7
7
|
* - Throw / reject / return falsy: request rejected.
|
|
8
8
|
* - Return a string: request accepted and that string replaces the raw body.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Default route that `slackChannel({})` mounts on. The scaffold's slack
|
|
3
3
|
* setup (`vercel connect attach --trigger-path ...`) must point at this
|
|
4
|
-
* exact path or Connect-forwarded Slack events 404 against the
|
|
4
|
+
* exact path or Connect-forwarded Slack events 404 against the eve
|
|
5
5
|
* framework router.
|
|
6
6
|
*/
|
|
7
7
|
export declare const SLACK_CHANNEL_DEFAULT_ROUTE = "/eve/v1/slack";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The native Teams channel talks directly to the Bot Framework Activity
|
|
5
5
|
* protocol instead of exposing BotBuilder or Teams SDK objects through
|
|
6
|
-
*
|
|
6
|
+
* eve public APIs.
|
|
7
7
|
*/
|
|
8
8
|
import { type JsonObject } from "#shared/json.js";
|
|
9
9
|
/** Microsoft application id, materialized directly or from an async secret provider. */
|
|
@@ -35,7 +35,7 @@ export interface TeamsApiOptions {
|
|
|
35
35
|
readonly fetch?: TeamsFetch;
|
|
36
36
|
/**
|
|
37
37
|
* Microsoft OAuth host for the client-credentials token flow. Defaults to
|
|
38
|
-
* `https://login.microsoftonline.com`.
|
|
38
|
+
* `https://login.microsoftonline.com`. eve ignores it when
|
|
39
39
|
* `credentials.tokenProvider` is set.
|
|
40
40
|
*/
|
|
41
41
|
readonly loginBaseUrl?: string;
|
|
@@ -66,14 +66,14 @@ export interface TeamsMention {
|
|
|
66
66
|
readonly text: string;
|
|
67
67
|
readonly type: "mention";
|
|
68
68
|
}
|
|
69
|
-
/** Bot Framework/Teams attachment shape supported by
|
|
69
|
+
/** Bot Framework/Teams attachment shape supported by eve-owned APIs. */
|
|
70
70
|
export interface TeamsAttachment {
|
|
71
71
|
readonly content?: JsonObject;
|
|
72
72
|
readonly contentType: string;
|
|
73
73
|
readonly contentUrl?: string;
|
|
74
74
|
readonly name?: string;
|
|
75
75
|
}
|
|
76
|
-
/** JSON body supported by Teams message endpoints used by
|
|
76
|
+
/** JSON body supported by Teams message endpoints used by eve. */
|
|
77
77
|
export interface TeamsMessageBody {
|
|
78
78
|
readonly attachments?: readonly TeamsAttachment[];
|
|
79
79
|
readonly channelData?: JsonObject;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Teams Adaptive Card rendering and decode helpers for
|
|
2
|
+
* Teams Adaptive Card rendering and decode helpers for eve HITL prompts.
|
|
3
3
|
*/
|
|
4
4
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
5
5
|
import type { TeamsActivity } from "#public/channels/teams/inbound.js";
|
|
6
6
|
import type { TeamsAttachment, TeamsMessageBody } from "#public/channels/teams/api.js";
|
|
7
7
|
/** Adaptive Card attachment content type used by Teams. */
|
|
8
8
|
export declare const TEAMS_ADAPTIVE_CARD_CONTENT_TYPE = "application/vnd.microsoft.card.adaptive";
|
|
9
|
-
/** Hidden data property used by
|
|
9
|
+
/** Hidden data property used by eve HITL Adaptive Card actions. */
|
|
10
10
|
export declare const TEAMS_HITL_DATA_KEY = "eve_input";
|
|
11
11
|
/** ChoiceSet input id used for select-style HITL requests. */
|
|
12
12
|
export declare const TEAMS_HITL_CHOICE_INPUT_ID = "eve_option";
|
|
@@ -29,10 +29,10 @@ export declare function renderAnsweredInputRequestMessage(input: {
|
|
|
29
29
|
readonly label?: string;
|
|
30
30
|
readonly prompt: string;
|
|
31
31
|
}): TeamsMessageBody;
|
|
32
|
-
/** Returns true when a Teams activity carries an
|
|
32
|
+
/** Returns true when a Teams activity carries an eve HITL submit payload. */
|
|
33
33
|
export declare function isTeamsInputResponseActivity(activity: TeamsActivity): boolean;
|
|
34
34
|
/**
|
|
35
|
-
* Decodes the
|
|
35
|
+
* Decodes the eve HITL submit payload from a Teams activity. Returns a single
|
|
36
36
|
* `InputResponse` (option selection, freeform text, or a bare requestId
|
|
37
37
|
* acknowledgement), or an empty array when the activity has no recognizable
|
|
38
38
|
* HITL payload or requestId.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** Maximum Teams Adaptive Card text block length used by
|
|
1
|
+
/** Maximum Teams Adaptive Card text block length used by eve renderers. */
|
|
2
2
|
export declare const TEAMS_ADAPTIVE_CARD_TEXT_MAX_LENGTH = 4000;
|
|
3
|
-
/** Maximum Teams Adaptive Card button title length used by
|
|
3
|
+
/** Maximum Teams Adaptive Card button title length used by eve renderers. */
|
|
4
4
|
export declare const TEAMS_ADAPTIVE_CARD_ACTION_TITLE_MAX_LENGTH = 80;
|
|
5
|
-
/** Maximum Teams Adaptive Card choice title length used by
|
|
5
|
+
/** Maximum Teams Adaptive Card choice title length used by eve renderers. */
|
|
6
6
|
export declare const TEAMS_ADAPTIVE_CARD_CHOICE_TITLE_MAX_LENGTH = 100;
|
|
7
7
|
/** Maximum number of direct Adaptive Card actions rendered for one request. */
|
|
8
8
|
export declare const TEAMS_ADAPTIVE_CARD_ACTION_LIMIT = 6;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Microsoft Teams inbound Bot Framework request verification.
|
|
3
3
|
*
|
|
4
|
-
* Teams sends bot activities through the Bot Connector service.
|
|
4
|
+
* Teams sends bot activities through the Bot Connector service. eve verifies
|
|
5
5
|
* the bearer JWT against Bot Connector OpenID keys and the bot's Microsoft
|
|
6
6
|
* app id before dispatching any activity to the runtime.
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ import { type TeamsAppId, type TeamsFetch } from "#public/channels/teams/api.js"
|
|
|
10
10
|
/**
|
|
11
11
|
* Caller-supplied inbound webhook verifier. Replaces Bot Connector JWT
|
|
12
12
|
* verification when a trusted integration authenticates forwarded requests
|
|
13
|
-
* before they reach
|
|
13
|
+
* before they reach eve.
|
|
14
14
|
*
|
|
15
15
|
* Return a falsy value to reject the request (verification throws), a string
|
|
16
16
|
* to accept and use that string as the verified body, or any other truthy
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minimal Telegram Bot API wrapper for the Telegram channel.
|
|
3
3
|
*
|
|
4
4
|
* The channel talks directly to Telegram's JSON HTTP API instead of
|
|
5
|
-
* exposing a third-party SDK through
|
|
5
|
+
* exposing a third-party SDK through eve public surfaces.
|
|
6
6
|
*/
|
|
7
7
|
import { type JsonObject } from "#shared/json.js";
|
|
8
8
|
/** Telegram bot token, materialized directly or from an async secret provider. */
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Telegram HITL inline keyboard rendering and compact callback decode helpers.
|
|
3
3
|
*
|
|
4
4
|
* Telegram limits `InlineKeyboardButton.callback_data` to 64 bytes, so
|
|
5
|
-
*
|
|
5
|
+
* eve stores compact callback ids in durable channel state and remaps
|
|
6
6
|
* them back to full input responses inside the channel deliver hook.
|
|
7
7
|
*/
|
|
8
8
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
9
|
-
/** Prefix used in Telegram callback_data values generated by
|
|
9
|
+
/** Prefix used in Telegram callback_data values generated by eve. */
|
|
10
10
|
export declare const TELEGRAM_HITL_CALLBACK_PREFIX = "eve:";
|
|
11
11
|
/** Synthetic request id prefix sent through `send()` for callback queries. */
|
|
12
12
|
export declare const TELEGRAM_CALLBACK_RESPONSE_PREFIX = "telegram_callback:";
|
|
@@ -55,5 +55,5 @@ export declare function telegramReplyInputResponse(input: {
|
|
|
55
55
|
}): InputResponse;
|
|
56
56
|
/** True when an input response needs Telegram-specific durable-state remapping. */
|
|
57
57
|
export declare function isTelegramSyntheticResponse(response: InputResponse): boolean;
|
|
58
|
-
/** Remaps compact Telegram callback/reply ids into real
|
|
58
|
+
/** Remaps compact Telegram callback/reply ids into real eve input responses. */
|
|
59
59
|
export declare function resolveTelegramInputResponses(state: TelegramHitlState, responses: readonly InputResponse[]): InputResponse[];
|
|
@@ -11,7 +11,7 @@ export type TelegramWebhookSecretToken = string | (() => string | Promise<string
|
|
|
11
11
|
/**
|
|
12
12
|
* Caller-supplied inbound webhook verifier. Use it instead of
|
|
13
13
|
* Telegram's secret-token header when an integration authenticates
|
|
14
|
-
* forwarded webhooks before they reach
|
|
14
|
+
* forwarded webhooks before they reach eve.
|
|
15
15
|
*
|
|
16
16
|
* The return value selects how the channel handles the request: return a
|
|
17
17
|
* falsy value to reject the request, a string to accept it and use that
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Requests use Twilio's normal `application/x-www-form-urlencoded`
|
|
5
5
|
* body encoding and HTTP Basic auth. No Twilio SDK dependency is
|
|
6
|
-
* required or exposed through
|
|
6
|
+
* required or exposed through eve public APIs.
|
|
7
7
|
*/
|
|
8
8
|
import { type TwilioAuthToken } from "#public/channels/twilio/verify.js";
|
|
9
9
|
/**
|
|
@@ -75,7 +75,7 @@ export interface ChannelDefinition<TState = undefined, TCtx = void, TReceiveTarg
|
|
|
75
75
|
/**
|
|
76
76
|
* Builds the per-step channel context handed to `events` and `deliver`.
|
|
77
77
|
* Receives the live {@link SessionHandle}, so a factory can close over it to
|
|
78
|
-
* register late-bound callbacks.
|
|
78
|
+
* register late-bound callbacks. eve writes state mutations made inside the
|
|
79
79
|
* returned context back through `adapter.state`.
|
|
80
80
|
*
|
|
81
81
|
* Return the channel-owned context (thread handles, API clients, etc.). The
|
|
@@ -100,7 +100,7 @@ export interface ChannelDefinition<TState = undefined, TCtx = void, TReceiveTarg
|
|
|
100
100
|
* Channel-owned metadata exposed to instrumentation callbacks. This is the
|
|
101
101
|
* channel's public observability surface, not a dump of durable adapter state,
|
|
102
102
|
* so keep it small. Return an object of JSON primitives, arrays, and plain
|
|
103
|
-
* objects:
|
|
103
|
+
* objects: eve omits `undefined` properties and drops projections containing
|
|
104
104
|
* values such as `Date` or `Map`.
|
|
105
105
|
*/
|
|
106
106
|
readonly metadata?: (state: NonNullable<TState>) => TMetadata;
|
|
@@ -42,7 +42,7 @@ export type StreamEventHooks = {
|
|
|
42
42
|
* Public hook definition authored in `agent/hooks/*.ts`.
|
|
43
43
|
*
|
|
44
44
|
* Hook files declare stream-event subscribers (under `events:`) that
|
|
45
|
-
* fire after
|
|
45
|
+
* fire after eve has accepted and durably recorded each event.
|
|
46
46
|
* Handlers are observe-only: they cannot inject model context. To
|
|
47
47
|
* contribute runtime model messages, use `defineDynamic` +
|
|
48
48
|
* `defineInstructions` in `agent/instructions/`.
|
|
@@ -3,7 +3,7 @@ import type { HeadersValue } from "#client/types.js";
|
|
|
3
3
|
import type { OutboundAuthFn } from "#public/agents/auth.js";
|
|
4
4
|
import type { JsonObject } from "#shared/json.js";
|
|
5
5
|
/**
|
|
6
|
-
* Public definition for a remote
|
|
6
|
+
* Public definition for a remote eve agent. The compiler lowers it to a
|
|
7
7
|
* subagent tool.
|
|
8
8
|
*/
|
|
9
9
|
export interface RemoteAgentDefinition {
|
|
@@ -22,17 +22,17 @@ export interface RemoteAgentDefinition {
|
|
|
22
22
|
*/
|
|
23
23
|
readonly outputSchema?: StandardJSONSchemaV1<unknown, unknown> | JsonObject;
|
|
24
24
|
/**
|
|
25
|
-
* Route
|
|
25
|
+
* Route eve appends to `url` for the create-session request. Defaults to the
|
|
26
26
|
* framework create-session route (`/eve/v1/session`).
|
|
27
27
|
*/
|
|
28
28
|
readonly path: string;
|
|
29
29
|
/**
|
|
30
|
-
* Base URL of the remote
|
|
30
|
+
* Base URL of the remote eve deployment to call.
|
|
31
31
|
*/
|
|
32
32
|
readonly url: string;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Authored input that {@link defineRemoteAgent} accepts.
|
|
35
|
+
* Authored input that {@link defineRemoteAgent} accepts. eve derives identity
|
|
36
36
|
* from the file path under `agent/subagents/`; authored definitions do not
|
|
37
37
|
* carry a `name` field.
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ export type RemoteAgentDefinitionInput = Omit<RemoteAgentDefinition, "kind" | "p
|
|
|
40
40
|
readonly path?: string;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
|
-
* Defines a remote
|
|
43
|
+
* Defines a remote eve agent that the parent can call as a subagent tool. The
|
|
44
44
|
* compiler lowers it at compile time from the file path under `agent/subagents/`.
|
|
45
45
|
*
|
|
46
46
|
* Stamps `kind: "remote"` and, when `path` is omitted, defaults it to the
|
|
@@ -5,7 +5,7 @@ export type { SandboxBootstrapUseFn, SandboxRevalidationKeyFn, SandboxSessionUse
|
|
|
5
5
|
/**
|
|
6
6
|
* The shape passed to {@link defineSandbox}: a discriminated union over
|
|
7
7
|
* whether a `bootstrap` hook is present. `backend` is optional here (it is
|
|
8
|
-
* required on the shared base): when omitted,
|
|
8
|
+
* required on the shared base): when omitted, eve substitutes
|
|
9
9
|
* `defaultBackend()` at runtime. `BO`/`SO` type the options for the
|
|
10
10
|
* bootstrap-use and session-use functions respectively.
|
|
11
11
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Supported runtime contract for one module-authored
|
|
2
|
+
* Supported runtime contract for one module-authored eve definition.
|
|
3
3
|
*
|
|
4
4
|
* Module-backed authored sources may export the public definition directly or
|
|
5
5
|
* export a zero-argument factory that returns the definition synchronously or
|
|
6
|
-
* asynchronously when
|
|
6
|
+
* asynchronously when eve loads the module in Node.js at runtime.
|
|
7
7
|
*/
|
|
8
8
|
export type ModuleDefinitionExport<TDefinition> = TDefinition | (() => TDefinition | Promise<TDefinition>);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Typed handle returned by {@link defineState}. Reads and updates a
|
|
3
3
|
* named context slot.
|
|
4
4
|
*
|
|
5
|
-
* All operations require an active
|
|
5
|
+
* All operations require an active eve context (ALS scope) and throw
|
|
6
6
|
* when called outside one.
|
|
7
7
|
*/
|
|
8
8
|
export interface StateHandle<T> {
|
|
@@ -18,7 +18,7 @@ export interface StateHandle<T> {
|
|
|
18
18
|
* The name must not start with the reserved `"eve."` prefix (reserved
|
|
19
19
|
* for framework context keys); doing so throws.
|
|
20
20
|
*
|
|
21
|
-
* All operations require an active
|
|
21
|
+
* All operations require an active eve context. Calling `get()` or
|
|
22
22
|
* `update()` outside of tools, hooks, or other framework-managed code
|
|
23
23
|
* throws.
|
|
24
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";const RESERVED_STATE_NAME_PREFIX=`eve.`;function defineState(n,r){if(n.startsWith(RESERVED_STATE_NAME_PREFIX))throw Error(`defineState() name "${n}" uses the reserved "${RESERVED_STATE_NAME_PREFIX}" prefix, which
|
|
1
|
+
import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";const RESERVED_STATE_NAME_PREFIX=`eve.`;function defineState(n,r){if(n.startsWith(RESERVED_STATE_NAME_PREFIX))throw Error(`defineState() name "${n}" uses the reserved "${RESERVED_STATE_NAME_PREFIX}" prefix, which eve reserves for its own framework context keys (e.g. "eve.channel", "eve.bundle"). Colliding with one silently corrupts context serialization. Use your own namespace, e.g. "my-agent.${n.slice(4)}".`);let i=new ContextKey(n);return{get(){return loadContext().ensure(i,r)},update(e){let t=loadContext(),n=t.ensure(i,r);t.set(i,e(n))}}}export{defineState};
|
|
@@ -67,7 +67,7 @@ export interface InstrumentationModelInput {
|
|
|
67
67
|
readonly messages: readonly ModelMessage[];
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Input passed to `events["step.started"]`.
|
|
70
|
+
* Input passed to `events["step.started"]`. eve runs the callback after
|
|
71
71
|
* building the final model input for this attempt and before constructing
|
|
72
72
|
* the AI SDK model call.
|
|
73
73
|
*/
|
|
@@ -79,7 +79,7 @@ export interface InstrumentationStepStartedEventInput {
|
|
|
79
79
|
readonly turn: InstrumentationTurn;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Result of a `step.started` callback.
|
|
82
|
+
* Result of a `step.started` callback. eve merges `runtimeContext` into the
|
|
83
83
|
* AI SDK telemetry span; child spans inherit the values. Keys beginning with
|
|
84
84
|
* `eve.` and non-JSON-serializable values are dropped. Return `undefined` to
|
|
85
85
|
* contribute no context.
|
|
@@ -136,7 +136,7 @@ export interface InstrumentationDefinition {
|
|
|
136
136
|
readonly setup?: (context: InstrumentationSetupContext) => void;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Export the result as the default export of `agent/instrumentation.ts`.
|
|
139
|
+
* Export the result as the default export of `agent/instrumentation.ts`. eve
|
|
140
140
|
* reads these settings at server startup and applies them to every AI SDK
|
|
141
141
|
* model call. The `setup` callback runs later with the resolved agent name,
|
|
142
142
|
* not during `defineInstrumentation` itself.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
/**
|
|
3
|
-
* Default private route namespace for hosting
|
|
3
|
+
* Default private route namespace for hosting eve as a separate experimental
|
|
4
4
|
* Vercel service behind the Next.js app. {@link WithEveOptions.servicePrefix}
|
|
5
5
|
* defaults to this value.
|
|
6
6
|
*/
|
|
@@ -46,41 +46,41 @@ export type EveNextConfigInput<TConfig extends EveNextConfig = EveNextConfig> =
|
|
|
46
46
|
*/
|
|
47
47
|
export interface WithEveOptions {
|
|
48
48
|
/**
|
|
49
|
-
* Maximum time in milliseconds to wait for the
|
|
49
|
+
* Maximum time in milliseconds to wait for the eve development server to
|
|
50
50
|
* start, including waiting for another Next.js process to start it. Defaults
|
|
51
51
|
* to 180000 (three minutes).
|
|
52
52
|
*/
|
|
53
53
|
readonly devServerTimeoutMs?: number;
|
|
54
54
|
/**
|
|
55
|
-
* Path to the
|
|
55
|
+
* Path to the eve application root, relative to `process.cwd()` unless
|
|
56
56
|
* absolute. Defaults to the Next.js app root.
|
|
57
57
|
*/
|
|
58
58
|
readonly eveRoot?: string;
|
|
59
59
|
/**
|
|
60
|
-
* Build command for the generated
|
|
61
|
-
* Use this when the
|
|
60
|
+
* Build command for the generated eve Vercel service. Defaults to `eve build`.
|
|
61
|
+
* Use this when the eve service needs project-specific prework before the
|
|
62
62
|
* framework build, without changing the Next.js service build command.
|
|
63
63
|
*/
|
|
64
64
|
readonly eveBuildCommand?: string;
|
|
65
65
|
/**
|
|
66
|
-
* Private Vercel service prefix for the
|
|
66
|
+
* Private Vercel service prefix for the eve deployment. Defaults to
|
|
67
67
|
* {@link EVE_NEXT_SERVICE_PREFIX} (`/_eve_internal/eve`). `withEve` normalizes
|
|
68
68
|
* the prefix (adds a leading slash, strips trailing slashes) and rejects a
|
|
69
|
-
* prefix that resolves to the root route. The prefix must match the
|
|
69
|
+
* prefix that resolves to the root route. The prefix must match the eve
|
|
70
70
|
* service's mount in Vercel Build Output config.
|
|
71
71
|
*/
|
|
72
72
|
readonly servicePrefix?: string;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* Wraps a Next.js config so same-origin
|
|
75
|
+
* Wraps a Next.js config so same-origin eve endpoints proxy to a separate eve
|
|
76
76
|
* service.
|
|
77
77
|
*
|
|
78
|
-
* In development, starts `eve dev --no-ui --port 0` for the
|
|
79
|
-
* rewrites
|
|
80
|
-
* rewrites to the resolved private
|
|
78
|
+
* In development, starts `eve dev --no-ui --port 0` for the eve app and
|
|
79
|
+
* rewrites eve protocol endpoints to that local URL. In Vercel production,
|
|
80
|
+
* rewrites to the resolved private eve service prefix.
|
|
81
81
|
* Outside Vercel production, serves an existing `.output/server/index.mjs` build
|
|
82
82
|
* on a stable local port when present; otherwise set `EVE_NEXT_PRODUCTION_ORIGIN`
|
|
83
|
-
* to the origin serving the
|
|
83
|
+
* to the origin serving the eve service namespace.
|
|
84
84
|
*/
|
|
85
85
|
export declare function withEve<TConfig extends EveNextConfig>(configOrFunction: EveNextConfigInput<TConfig>, options?: WithEveOptions): EveNextConfigFunction<TConfig>;
|
|
86
86
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveEveDestinationPrefix}from"./server.js";import{ensureEveVercelOutputConfig}from"./vercel-output-config.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{isAbsolute,resolve}from"node:path";const EVE_NEXT_SERVICE_PREFIX=`/_eve_internal/eve`,EVE_NEXT_PRODUCTION_PORT_ENV=`EVE_NEXT_PRODUCTION_PORT`,EVE_PROXY_REWRITE_SOURCES=[`${EVE_ROUTE_PREFIX}/:path+`];function resolveApplicationRoot(e){return e===void 0||e.length===0?process.cwd():isAbsolute(e)?e:resolve(process.cwd(),e)}function resolveDevServerTimeout(e){if(e!==void 0){if(!Number.isFinite(e)||e<=0)throw Error(`
|
|
1
|
+
import{resolveEveDestinationPrefix}from"./server.js";import{ensureEveVercelOutputConfig}from"./vercel-output-config.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{isAbsolute,resolve}from"node:path";const EVE_NEXT_SERVICE_PREFIX=`/_eve_internal/eve`,EVE_NEXT_PRODUCTION_PORT_ENV=`EVE_NEXT_PRODUCTION_PORT`,EVE_PROXY_REWRITE_SOURCES=[`${EVE_ROUTE_PREFIX}/:path+`];function resolveApplicationRoot(e){return e===void 0||e.length===0?process.cwd():isAbsolute(e)?e:resolve(process.cwd(),e)}function resolveDevServerTimeout(e){if(e!==void 0){if(!Number.isFinite(e)||e<=0)throw Error(`eve Next.js development server timeout must be a positive number.`);return e}}function normalizeRoutePrefix(e){let t=(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``);if(t.length===0)throw Error(`eve Next.js service prefix cannot resolve to the root route.`);return t}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e.trim()).origin}function readLocalProductionPort(){let e=process.env[EVE_NEXT_PRODUCTION_PORT_ENV];if(e===void 0||e.trim().length===0)return 4274;let t=Number.parseInt(e,10);if(String(t)!==e.trim()||t<1||t>65535)throw Error(`${EVE_NEXT_PRODUCTION_PORT_ENV} must be an integer between 1 and 65535.`);return t}function resolveProductionDestination(e){if(process.env.VERCEL)return{destinationPrefix:e};let t=process.env.EVE_NEXT_PRODUCTION_ORIGIN;if(t!==void 0&&t.trim().length>0)return{destinationPrefix:joinRoutePrefix(normalizeOrigin(t),e)};let n=`http://127.0.0.1:${String(readLocalProductionPort())}`;return{destinationPrefix:n,localServerOrigin:n}}function createEveRewriteRules(e){return EVE_PROXY_REWRITE_SOURCES.map(t=>({destination:joinRoutePrefix(e,t),source:t}))}async function resolveExistingRewrites(e){return await e?.()}function mergeRewriteRules(e,t){return e===void 0?{beforeFiles:t}:isRewriteSections(e)?{...e,beforeFiles:[...t,...e.beforeFiles??[]]}:{afterFiles:e,beforeFiles:t}}function isRewriteSections(e){return!Array.isArray(e)}async function resolveNextConfig(e,t,n){return typeof e==`function`?await e(t,n):e}function withEve(n,r={}){let i=process.cwd(),a=resolveApplicationRoot(r.eveRoot),o=resolveDevServerTimeout(r.devServerTimeoutMs),s=normalizeRoutePrefix(r.servicePrefix??`/_eve_internal/eve`);return async function(c,l){let u=await resolveNextConfig(n,c,l),d=u.rewrites,f=resolveProductionDestination((await ensureEveVercelOutputConfig({appRoot:a,eveBuildCommand:r.eveBuildCommand??`eve build`,nextRoot:i,servicePrefix:s})).servicePrefix);return{...u,async rewrites(){let[t,n]=await Promise.all([resolveExistingRewrites(d),resolveEveDestinationPrefix({appRoot:a,devServerTimeoutMs:o,phase:c,productionDestinationPrefix:f.destinationPrefix,productionServerOrigin:f.localServerOrigin})]);return mergeRewriteRules(t,createEveRewriteRules(n))}}}}export{EVE_NEXT_SERVICE_PREFIX,withEve};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";import{existsSync}from"node:fs";import{join}from"node:path";import{spawn}from"node:child_process";import{mkdir,open,readFile,rm,stat,writeFile}from"node:fs/promises";const EVE_BASE_URL_ENV=`EVE_BASE_URL`,DEFAULT_SERVER_READY_TIMEOUT_MS=18e4,SERVER_URL_CANDIDATE_PATTERN=/https?:\/\/[^\s"'<>]+/g,globalStateSymbol=Symbol.for(`eve.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e).origin}function readEveBaseUrlEnvironment(){let e=process.env[EVE_BASE_URL_ENV];if(!(e===void 0||e.trim().length===0))return normalizeOrigin(e)}function isNodeErrorWithCode(e,t){return e instanceof Error&&`code`in e&&e.code===t}function delay(e){return new Promise(t=>setTimeout(t,e))}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveEveCacheDirectory(e){return join(e,`.eve`)}function resolveEveDevServerRegistryPath(e){return join(resolveEveCacheDirectory(e),`next-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`next-dev-server.lock`)}function normalizeDevServerRegistry(e){if(isRecord(e)&&!(typeof e.appRoot!=`string`||typeof e.origin!=`string`||typeof e.updatedAt!=`string`)&&!(e.pid!==null&&typeof e.pid!=`number`))try{return{appRoot:e.appRoot,origin:normalizeOrigin(e.origin),pid:e.pid,updatedAt:e.updatedAt}}catch{return}}async function isEveServerHealthy(t){let n=new AbortController,r=setTimeout(()=>{n.abort()},1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:n.signal})).ok}catch{return!1}finally{clearTimeout(r)}}async function readUsableEveDevServerRegistry(e){try{let t=normalizeDevServerRegistry(JSON.parse(await readFile(resolveEveDevServerRegistryPath(e),`utf8`)));return t===void 0||t.appRoot!==e||!await isEveServerHealthy(t.origin)?void 0:(process.env[EVE_BASE_URL_ENV]=t.origin,t.origin)}catch(e){if(isNodeErrorWithCode(e,`ENOENT`))return;throw e}}async function writeEveDevServerRegistry(e,t){await mkdir(resolveEveCacheDirectory(e),{recursive:!0}),await writeFile(resolveEveDevServerRegistryPath(e),`${JSON.stringify({appRoot:e,origin:t.origin,pid:t.process?.pid??null,updatedAt:new Date().toISOString()},null,2)}\n`)}async function removeStaleEveDevServerLock(e){try{let t=await stat(e);Date.now()-t.mtimeMs>3e4&&await rm(e,{force:!0})}catch(e){if(!isNodeErrorWithCode(e,`ENOENT`))throw e}}async function acquireEveDevServerLock(e,t){let n=resolveEveCacheDirectory(e),r=resolveEveDevServerLockPath(e),i=Date.now()+t;for(await mkdir(n,{recursive:!0});;)try{let e=await open(r,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(r,{force:!0})}}catch(n){if(!isNodeErrorWithCode(n,`EEXIST`))throw n;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(r),Date.now()>i)throw Error(`Timed out after ${t}ms waiting for another Next.js process to start
|
|
1
|
+
import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";import{existsSync}from"node:fs";import{join}from"node:path";import{spawn}from"node:child_process";import{mkdir,open,readFile,rm,stat,writeFile}from"node:fs/promises";const EVE_BASE_URL_ENV=`EVE_BASE_URL`,DEFAULT_SERVER_READY_TIMEOUT_MS=18e4,SERVER_URL_CANDIDATE_PATTERN=/https?:\/\/[^\s"'<>]+/g,globalStateSymbol=Symbol.for(`eve.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function joinRoutePrefix(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}function normalizeOrigin(e){return new URL(e).origin}function readEveBaseUrlEnvironment(){let e=process.env[EVE_BASE_URL_ENV];if(!(e===void 0||e.trim().length===0))return normalizeOrigin(e)}function isNodeErrorWithCode(e,t){return e instanceof Error&&`code`in e&&e.code===t}function delay(e){return new Promise(t=>setTimeout(t,e))}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function resolveEveCacheDirectory(e){return join(e,`.eve`)}function resolveEveDevServerRegistryPath(e){return join(resolveEveCacheDirectory(e),`next-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`next-dev-server.lock`)}function normalizeDevServerRegistry(e){if(isRecord(e)&&!(typeof e.appRoot!=`string`||typeof e.origin!=`string`||typeof e.updatedAt!=`string`)&&!(e.pid!==null&&typeof e.pid!=`number`))try{return{appRoot:e.appRoot,origin:normalizeOrigin(e.origin),pid:e.pid,updatedAt:e.updatedAt}}catch{return}}async function isEveServerHealthy(t){let n=new AbortController,r=setTimeout(()=>{n.abort()},1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:n.signal})).ok}catch{return!1}finally{clearTimeout(r)}}async function readUsableEveDevServerRegistry(e){try{let t=normalizeDevServerRegistry(JSON.parse(await readFile(resolveEveDevServerRegistryPath(e),`utf8`)));return t===void 0||t.appRoot!==e||!await isEveServerHealthy(t.origin)?void 0:(process.env[EVE_BASE_URL_ENV]=t.origin,t.origin)}catch(e){if(isNodeErrorWithCode(e,`ENOENT`))return;throw e}}async function writeEveDevServerRegistry(e,t){await mkdir(resolveEveCacheDirectory(e),{recursive:!0}),await writeFile(resolveEveDevServerRegistryPath(e),`${JSON.stringify({appRoot:e,origin:t.origin,pid:t.process?.pid??null,updatedAt:new Date().toISOString()},null,2)}\n`)}async function removeStaleEveDevServerLock(e){try{let t=await stat(e);Date.now()-t.mtimeMs>3e4&&await rm(e,{force:!0})}catch(e){if(!isNodeErrorWithCode(e,`ENOENT`))throw e}}async function acquireEveDevServerLock(e,t){let n=resolveEveCacheDirectory(e),r=resolveEveDevServerLockPath(e),i=Date.now()+t;for(await mkdir(n,{recursive:!0});;)try{let e=await open(r,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(r,{force:!0})}}catch(n){if(!isNodeErrorWithCode(n,`EEXIST`))throw n;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(r),Date.now()>i)throw Error(`Timed out after ${t}ms waiting for another Next.js process to start eve.`);await delay(100)}}function createEveBinaryPath(){return join(resolvePackageRoot(),`bin`,`eve.js`)}function isLoopbackHostname(e){return e===`localhost`||e===`::1`||e===`[::1]`||/^127(?:\.\d{1,3}){3}$/.test(e)}function parseLocalServerOrigin(e){let t=URL.parse(e);if(!(t===null||t.protocol!==`http:`&&t.protocol!==`https:`||!isLoopbackHostname(t.hostname)||t.port.length===0))return t.origin}function findLocalServerOrigin(e){for(let t of e.matchAll(SERVER_URL_CANDIDATE_PATTERN)){let e=t[0],n=parseLocalServerOrigin(e);if(n!==void 0)return n}}function startServerProcess(e){return new Promise((t,n)=>{let r=spawn(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env},stdio:[`ignore`,`pipe`,`pipe`]}),a=setTimeout(()=>{r.kill(),n(Error(`Timed out after ${e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS}ms waiting for eve to print its server URL.`))},e.timeoutMs??DEFAULT_SERVER_READY_TIMEOUT_MS),cleanup=()=>{clearTimeout(a),r.off(`error`,handleError),r.off(`exit`,handleEarlyExit)},handleError=e=>{cleanup(),n(e)},handleEarlyExit=(e,t)=>{cleanup(),n(Error(`eve server process exited before printing its server URL (code ${String(e)}, signal ${String(t)}).`))},handleOutput=e=>{let n=findLocalServerOrigin(e.toString(`utf8`));n!==void 0&&(cleanup(),t({origin:n,process:r}))};r.once(`error`,handleError),r.once(`exit`,handleEarlyExit),r.stdout.on(`data`,e=>{process.stdout.write(e),handleOutput(e)}),r.stderr.on(`data`,e=>{process.stderr.write(e),handleOutput(e)})})}function installProcessShutdown(e){let t=e.process;if(t===void 0)return e;let close=()=>{t.killed||t.kill()};return process.once(`beforeExit`,close),process.once(`exit`,close),e}function startEveDevServer(e,t){return startServerProcess({args:[createEveBinaryPath(),`dev`,`--no-ui`,`--port`,`0`],command:process.execPath,cwd:e,timeoutMs:t}).then(e=>(process.env[EVE_BASE_URL_ENV]=e.origin,installProcessShutdown(e)))}function startEveProductionServer(e){let t=new URL(e.origin),i=t.port,a=join(e.appRoot,`.output`,`server`,`index.mjs`);if(existsSync(a))return startServerProcess({args:[a],command:process.execPath,cwd:e.appRoot,env:{HOST:t.hostname,NITRO_HOST:t.hostname,NITRO_PORT:i,PORT:i}}).then(installProcessShutdown)}async function resolveSharedEveDevServer(e,t){let n=await readUsableEveDevServerRegistry(e);if(n!==void 0)return{origin:n};let r=await acquireEveDevServerLock(e,t);try{let n=await readUsableEveDevServerRegistry(e);if(n!==void 0)return{origin:n};let r=await startEveDevServer(e,t);return await writeEveDevServerRegistry(e,r),r}finally{await r()}}async function resolveEveDestinationPrefix(e){let t=getGlobalState();if(process.env.NODE_ENV===`production`){if(e.phase===`phase-production-build`)return e.productionDestinationPrefix;let n=`production:${e.appRoot}`,r=t.servers.get(n);return r===void 0&&(r=process.env.VERCEL||e.productionServerOrigin===void 0?void 0:startEveProductionServer({appRoot:e.appRoot,origin:e.productionServerOrigin}),r!==void 0&&(r=r.catch(e=>{throw t.servers.delete(n),e}),t.servers.set(n,r))),r===void 0?e.productionDestinationPrefix:(await r).origin}let n=readEveBaseUrlEnvironment();if(n!==void 0)return n;if(process.env.NODE_ENV!==`development`)return e.productionDestinationPrefix;let r=`dev:${e.appRoot}`,i=t.servers.get(r);return i===void 0&&(i=resolveSharedEveDevServer(e.appRoot,e.devServerTimeoutMs??18e4).catch(e=>{throw t.servers.delete(r),e}),t.servers.set(r,i)),(await i).origin}export{resolveEveDestinationPrefix};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname,join,relative}from"node:path";import{mkdir,readFile,writeFile}from"node:fs/promises";import{findClosestLinkedVercelDirectory,findClosestVercelOutputDirectory}from"#shared/vercel-output-directory.js";const VERCEL_JSON_FILE_NAME=`vercel.json`,VERCEL_OUTPUT_CONFIG_FILE_NAME=`.vercel/output/config.json`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hasServices(e){return e!==void 0&&Object.keys(e).length>0}function resolveRelativeEntrypoint(e,t){let r=relative(e,t);return r.length===0?`.`:r.replaceAll(`\\`,`/`)}async function resolveVercelOutputConfigLocation(n){let r=await findClosestLinkedVercelDirectory(n),i=r===void 0?n:dirname(r),a=await findClosestVercelOutputDirectory(n);return a===void 0?r===void 0?{canWriteGeneratedOutput:!1,outputConfigPath:join(n,VERCEL_OUTPUT_CONFIG_FILE_NAME),projectRoot:i}:{canWriteGeneratedOutput:!0,outputConfigPath:join(r,`output`,`config.json`),projectRoot:i}:{canWriteGeneratedOutput:!0,outputConfigPath:join(a,`config.json`),projectRoot:i}}function normalizeVercelServicesConfig(e,t){if(!isRecord(e))throw Error(`${t} must contain a JSON object.`);let n=e.experimentalServices;if(n!==void 0&&!isRecord(n))throw Error(`${t} experimentalServices must be a JSON object.`);return e}async function readVercelServicesConfig(e,t){try{return normalizeVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),t)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findServiceByFramework(e,t){return Object.values(e).find(e=>e.framework===t)}function resolveServicePrefix(e){if(e!==void 0){if(typeof e.routePrefix==`string`&&e.routePrefix.trim().length>0)return e.routePrefix.trim();if(typeof e.mount==`string`&&e.mount.trim().length>0)return e.mount.trim();if(isRecord(e.mount)&&typeof e.mount.path==`string`&&e.mount.path.trim().length>0)return e.mount.path.trim()}}function resolveConfiguredServicePrefix(e){return resolveServicePrefix(findServiceByFramework(e.services,`eve`))??e.servicePrefix}function assertRootServicesAreComplete(e){let t=findServiceByFramework(e.services,`eve`),n=findServiceByFramework(e.services,`nextjs`);if(t!==void 0&&n!==void 0)return resolveServicePrefix(t)??e.servicePrefix;throw Error(`${VERCEL_JSON_FILE_NAME} already defines experimentalServices, so withEve cannot add generated services through ${VERCEL_OUTPUT_CONFIG_FILE_NAME}. Add both the Next.js and
|
|
1
|
+
import{dirname,join,relative}from"node:path";import{mkdir,readFile,writeFile}from"node:fs/promises";import{findClosestLinkedVercelDirectory,findClosestVercelOutputDirectory}from"#shared/vercel-output-directory.js";const VERCEL_JSON_FILE_NAME=`vercel.json`,VERCEL_OUTPUT_CONFIG_FILE_NAME=`.vercel/output/config.json`;function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hasServices(e){return e!==void 0&&Object.keys(e).length>0}function resolveRelativeEntrypoint(e,t){let r=relative(e,t);return r.length===0?`.`:r.replaceAll(`\\`,`/`)}async function resolveVercelOutputConfigLocation(n){let r=await findClosestLinkedVercelDirectory(n),i=r===void 0?n:dirname(r),a=await findClosestVercelOutputDirectory(n);return a===void 0?r===void 0?{canWriteGeneratedOutput:!1,outputConfigPath:join(n,VERCEL_OUTPUT_CONFIG_FILE_NAME),projectRoot:i}:{canWriteGeneratedOutput:!0,outputConfigPath:join(r,`output`,`config.json`),projectRoot:i}:{canWriteGeneratedOutput:!0,outputConfigPath:join(a,`config.json`),projectRoot:i}}function normalizeVercelServicesConfig(e,t){if(!isRecord(e))throw Error(`${t} must contain a JSON object.`);let n=e.experimentalServices;if(n!==void 0&&!isRecord(n))throw Error(`${t} experimentalServices must be a JSON object.`);return e}async function readVercelServicesConfig(e,t){try{return normalizeVercelServicesConfig(JSON.parse(await readFile(e,`utf8`)),t)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}}function findServiceByFramework(e,t){return Object.values(e).find(e=>e.framework===t)}function resolveServicePrefix(e){if(e!==void 0){if(typeof e.routePrefix==`string`&&e.routePrefix.trim().length>0)return e.routePrefix.trim();if(typeof e.mount==`string`&&e.mount.trim().length>0)return e.mount.trim();if(isRecord(e.mount)&&typeof e.mount.path==`string`&&e.mount.path.trim().length>0)return e.mount.path.trim()}}function resolveConfiguredServicePrefix(e){return resolveServicePrefix(findServiceByFramework(e.services,`eve`))??e.servicePrefix}function assertRootServicesAreComplete(e){let t=findServiceByFramework(e.services,`eve`),n=findServiceByFramework(e.services,`nextjs`);if(t!==void 0&&n!==void 0)return resolveServicePrefix(t)??e.servicePrefix;throw Error(`${VERCEL_JSON_FILE_NAME} already defines experimentalServices, so withEve cannot add generated services through ${VERCEL_OUTPUT_CONFIG_FILE_NAME}. Add both the Next.js and eve services to ${VERCEL_JSON_FILE_NAME}, or remove experimentalServices from ${VERCEL_JSON_FILE_NAME}.`)}async function ensureEveVercelOutputConfig(n){let{canWriteGeneratedOutput:i,outputConfigPath:o,projectRoot:s}=await resolveVercelOutputConfigLocation(n.nextRoot),c=(await readVercelServicesConfig(join(s,VERCEL_JSON_FILE_NAME),VERCEL_JSON_FILE_NAME)).experimentalServices;if(hasServices(c))return{servicePrefix:assertRootServicesAreComplete({services:c,servicePrefix:n.servicePrefix})};let l=await readVercelServicesConfig(o,VERCEL_OUTPUT_CONFIG_FILE_NAME),u=resolveRelativeEntrypoint(n.nextRoot,n.appRoot),d=l.experimentalServices??{},f=findServiceByFramework(d,`eve`),p=findServiceByFramework(d,`nextjs`),m=resolveConfiguredServicePrefix({services:d,servicePrefix:n.servicePrefix});if(!i)return{servicePrefix:m};let h={...d};p===void 0&&(h.web={entrypoint:`.`,framework:`nextjs`,mount:`/`,type:`web`}),f===void 0&&(h.eve={buildCommand:n.eveBuildCommand,entrypoint:u,framework:`eve`,mount:m,type:`web`});let g={...l,version:3,experimentalServices:h};return JSON.stringify(l)!==JSON.stringify(g)&&(await mkdir(dirname(o),{recursive:!0}),await writeFile(o,`${JSON.stringify(g,null,2)}\n`)),{servicePrefix:m}}export{ensureEveVercelOutputConfig};
|
|
@@ -17,8 +17,8 @@ export interface EveDevServerRegistry {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function normalizeDevServerRegistry(value: unknown): EveDevServerRegistry | undefined;
|
|
19
19
|
/**
|
|
20
|
-
* Resolve a shared
|
|
20
|
+
* Resolve a shared eve dev server for {@link appRoot}, reusing a healthy
|
|
21
21
|
* registered server when one exists and otherwise spawning a new one behind a
|
|
22
|
-
* cross-process lock so concurrent Nuxt processes don't each boot
|
|
22
|
+
* cross-process lock so concurrent Nuxt processes don't each boot eve.
|
|
23
23
|
*/
|
|
24
24
|
export declare function resolveSharedEveDevServer(appRoot: string): Promise<EveProcessHandle>;
|