eve 0.11.1 → 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 +17 -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/code-mode.js +1 -1
- package/dist/src/harness/emission.d.ts +1 -1
- package/dist/src/harness/runtime-actions.d.ts +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/tools.d.ts +12 -0
- package/dist/src/harness/tools.js +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 +11 -11
- 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 +16 -16
- 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 +30 -30
- 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 +12 -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 +13 -13
- 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 +14 -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 +83 -0
- package/docs/tools/meta.json +4 -0
- package/docs/{tools.mdx → tools/overview.mdx} +14 -37
- 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
|
@@ -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>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{joinRoutePrefix,normalizeOrigin}from"./routing.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";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=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/;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),`nuxt-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`nuxt-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 r=new AbortController,i=setTimeout(()=>r.abort(),1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(i)}}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: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){let t=resolveEveCacheDirectory(e),n=resolveEveDevServerLockPath(e),r=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(n,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(n,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(n),Date.now()>r)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another Nuxt process to start
|
|
1
|
+
import{joinRoutePrefix,normalizeOrigin}from"./routing.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";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=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/;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),`nuxt-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`nuxt-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 r=new AbortController,i=setTimeout(()=>r.abort(),1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(i)}}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: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){let t=resolveEveCacheDirectory(e),n=resolveEveDevServerLockPath(e),r=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(n,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(n,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(n),Date.now()>r)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another Nuxt process to start eve.`);await delay(100)}}function createEveBinaryPath(){return join(resolvePackageRoot(),`bin`,`eve.js`)}function startServerProcess(e){return new Promise((n,r)=>{let i=spawn(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env},stdio:[`ignore`,`pipe`,`pipe`]}),a=setTimeout(()=>{i.kill(),r(Error(`Timed out after ${DEFAULT_SERVER_READY_TIMEOUT_MS}ms waiting for eve to print its server URL.`))},DEFAULT_SERVER_READY_TIMEOUT_MS),cleanup=()=>{clearTimeout(a),i.off(`error`,handleError),i.off(`exit`,handleEarlyExit)},handleError=e=>{cleanup(),r(e)},handleEarlyExit=(e,t)=>{cleanup(),r(Error(`eve server process exited before printing its server URL (code ${String(e)}, signal ${String(t)}).`))},o=!1,handleOutput=e=>{if(o)return;let r=LOCAL_SERVER_URL_PATTERN.exec(e.toString(`utf8`));r!==null&&(o=!0,cleanup(),n({origin:normalizeOrigin(r[0]),process:i}))};i.once(`error`,handleError),i.once(`exit`,handleEarlyExit),i.stdout.on(`data`,e=>{process.stdout.write(e),handleOutput(e)}),i.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=()=>{process.off(`beforeExit`,close),process.off(`exit`,close),t.killed||t.kill()};return process.once(`beforeExit`,close),process.once(`exit`,close),e}function startEveDevServer(e){return startServerProcess({args:[createEveBinaryPath(),`dev`,`--no-ui`,`--port`,`0`],command:process.execPath,cwd:e}).then(e=>(process.env[EVE_BASE_URL_ENV]=e.origin,installProcessShutdown(e)))}async function resolveSharedEveDevServer(e){let t=await readUsableEveDevServerRegistry(e);if(t!==void 0)return process.env[EVE_BASE_URL_ENV]=t,{origin:t};let n=await acquireEveDevServerLock(e);try{let t=await readUsableEveDevServerRegistry(e);if(t!==void 0)return process.env[EVE_BASE_URL_ENV]=t,{origin:t};let n=await startEveDevServer(e);return await writeEveDevServerRegistry(e,n),n}finally{await n()}}export{EVE_BASE_URL_ENV,normalizeDevServerRegistry,resolveSharedEveDevServer};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { EVE_NUXT_SERVICE_PREFIX } from "./routing.js";
|
|
2
2
|
export { EVE_NUXT_SERVICE_PREFIX };
|
|
3
3
|
/**
|
|
4
|
-
* Options for the
|
|
4
|
+
* Options for the eve Nuxt module.
|
|
5
5
|
*/
|
|
6
6
|
export interface EveNuxtModuleOptions {
|
|
7
7
|
/**
|
|
8
|
-
* Path to the
|
|
8
|
+
* Path to the eve application root, resolved relative to the Nuxt project
|
|
9
9
|
* root unless absolute. Defaults to the Nuxt project root. The dev server is
|
|
10
|
-
* spawned here and written as the
|
|
10
|
+
* spawned here and written as the eve service entrypoint in `vercel.json`
|
|
11
11
|
* (relative to the Nuxt root).
|
|
12
12
|
*/
|
|
13
13
|
eveRoot?: string;
|
|
14
14
|
/**
|
|
15
|
-
* Build command for the generated
|
|
15
|
+
* Build command for the generated eve Vercel service. Defaults to `"eve build"`.
|
|
16
16
|
*/
|
|
17
17
|
eveBuildCommand?: string;
|
|
18
18
|
/**
|
|
19
19
|
* Set to `false` to skip creating or updating `vercel.json`. By default the
|
|
20
20
|
* module ensures `vercel.json` contains `experimentalServices` for the Nuxt
|
|
21
|
-
* app and
|
|
21
|
+
* app and eve app.
|
|
22
22
|
*/
|
|
23
23
|
configureVercelJson?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Private Vercel service prefix
|
|
25
|
+
* Private Vercel service prefix eve transport is proxied to. Defaults to
|
|
26
26
|
* {@link EVE_NUXT_SERVICE_PREFIX}. When `configureVercelJson` is enabled, it
|
|
27
|
-
* is written as the
|
|
27
|
+
* is written as the eve service `routePrefix`, but an existing `routePrefix`
|
|
28
28
|
* in `vercel.json` takes precedence. Normalized to a leading-slash,
|
|
29
29
|
* no-trailing-slash route; cannot resolve to `/`.
|
|
30
30
|
*/
|
|
31
31
|
servicePrefix?: string;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Nuxt module that wires an
|
|
34
|
+
* Nuxt module that wires an eve agent into a Nuxt app. Register under `modules`
|
|
35
35
|
* (configured via the `eve` config key). It auto-imports the `useEveAgent()`
|
|
36
|
-
* composable, routes
|
|
36
|
+
* composable, routes eve transport requests (`/eve/v1/**`) to the eve service
|
|
37
37
|
* (a shared dev server spawned on demand in dev, a Vercel sibling service or a
|
|
38
38
|
* configured origin/port in production), and unless `configureVercelJson` is
|
|
39
|
-
* `false`, ensures `vercel.json` declares both the Nuxt and
|
|
39
|
+
* `false`, ensures `vercel.json` declares both the Nuxt and eve services.
|
|
40
40
|
* Requires Nuxt >= 4.0.0. Configure via {@link EveNuxtModuleOptions}.
|
|
41
41
|
*/
|
|
42
42
|
declare const _default: import("nuxt/schema").NuxtModule<EveNuxtModuleOptions, EveNuxtModuleOptions, false>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Private route namespace used when a Vercel deployment hosts
|
|
2
|
+
* Private route namespace used when a Vercel deployment hosts eve as a
|
|
3
3
|
* separate experimental service behind the Nuxt app.
|
|
4
4
|
*/
|
|
5
5
|
export declare const EVE_NUXT_SERVICE_PREFIX = "/_eve_internal/eve";
|
|
@@ -18,7 +18,7 @@ export declare function joinRoutePrefix(prefix: string, path: string): string;
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function normalizeOrigin(origin: string): string;
|
|
20
20
|
/**
|
|
21
|
-
* Resolve the local production port the module proxies to when an
|
|
21
|
+
* Resolve the local production port the module proxies to when an eve service
|
|
22
22
|
* runs alongside a non-Vercel Nuxt deployment. Defaults to
|
|
23
23
|
* {@link DEFAULT_EVE_NUXT_PRODUCTION_PORT}.
|
|
24
24
|
*/
|
|
@@ -31,14 +31,14 @@ export interface EveVercelRewriteRoute {
|
|
|
31
31
|
readonly dest: string;
|
|
32
32
|
/**
|
|
33
33
|
* Re-run route matching against the rewritten `dest`. Required so the
|
|
34
|
-
* rewritten
|
|
34
|
+
* rewritten eve service path is routed to the sibling eve service instead of
|
|
35
35
|
* being resolved inside the host service's own filesystem (which 404s).
|
|
36
36
|
*/
|
|
37
37
|
readonly check: true;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Build the edge-level Vercel rewrite that forwards
|
|
41
|
-
* (`/eve/v1/**`) to the
|
|
40
|
+
* Build the edge-level Vercel rewrite that forwards eve transport requests
|
|
41
|
+
* (`/eve/v1/**`) to the eve service prefix (`/_eve_internal/eve/eve/v1/**`).
|
|
42
42
|
*
|
|
43
43
|
* Mirrors the Next.js integration's `beforeFiles` rewrite. A Nitro runtime
|
|
44
44
|
* `proxy` route rule cannot reach a sibling Vercel service — the proxied
|
|
@@ -47,7 +47,7 @@ export interface EveVercelRewriteRoute {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function createEveVercelRewriteRoute(servicePrefix: string): EveVercelRewriteRoute;
|
|
49
49
|
/**
|
|
50
|
-
* Resolve the proxy destination for
|
|
50
|
+
* Resolve the proxy destination for eve routes in production.
|
|
51
51
|
*
|
|
52
52
|
* On Vercel the destination is the private service prefix. Off Vercel it is an
|
|
53
53
|
* explicit origin override (`EVE_NUXT_PRODUCTION_ORIGIN`) or a local port.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";const EVE_NUXT_SERVICE_PREFIX=`/_eve_internal/eve`,EVE_NUXT_PRODUCTION_PORT_ENV=`EVE_NUXT_PRODUCTION_PORT`;function normalizeRoutePrefix(e){let t=(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``);if(t.length===0)throw Error(`
|
|
1
|
+
import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";const EVE_NUXT_SERVICE_PREFIX=`/_eve_internal/eve`,EVE_NUXT_PRODUCTION_PORT_ENV=`EVE_NUXT_PRODUCTION_PORT`;function normalizeRoutePrefix(e){let t=(e.startsWith(`/`)?e:`/${e}`).replace(/\/+$/,``);if(t.length===0)throw Error(`eve Nuxt 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_NUXT_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_NUXT_PRODUCTION_PORT_ENV} must be an integer between 1 and 65535.`);return t}function createEveVercelRewriteRoute(t){let n=joinRoutePrefix(t,EVE_ROUTE_PREFIX);return{src:`^${EVE_ROUTE_PREFIX}/(.*)$`,dest:`${n}/$1`,check:!0}}function resolveProductionTarget(t){if(process.env.VERCEL)return joinRoutePrefix(t,EVE_ROUTE_PREFIX);let n=process.env.EVE_NUXT_PRODUCTION_ORIGIN;return n!==void 0&&n.trim().length>0?joinRoutePrefix(normalizeOrigin(n),EVE_ROUTE_PREFIX):joinRoutePrefix(`http://127.0.0.1:${String(readLocalProductionPort())}`,EVE_ROUTE_PREFIX)}export{EVE_NUXT_SERVICE_PREFIX,createEveVercelRewriteRoute,joinRoutePrefix,normalizeOrigin,normalizeRoutePrefix,readLocalProductionPort,resolveProductionTarget};
|
|
@@ -2,10 +2,10 @@ export interface EnsureVercelJsonResult {
|
|
|
2
2
|
readonly servicePrefix: string;
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
|
-
* Ensure `vercel.json` declares the Nuxt web service and the
|
|
5
|
+
* Ensure `vercel.json` declares the Nuxt web service and the eve agent
|
|
6
6
|
* service so a Vercel deployment ships both from one project.
|
|
7
7
|
*
|
|
8
|
-
* Existing services are preserved untouched; an already-configured
|
|
8
|
+
* Existing services are preserved untouched; an already-configured eve
|
|
9
9
|
* service's `routePrefix` wins over {@link input.servicePrefix}. The file is
|
|
10
10
|
* only rewritten when the resulting config differs from what is on disk.
|
|
11
11
|
*/
|
|
@@ -7,7 +7,7 @@ import type { JustBashSandboxCreateOptions } from "#public/sandbox/just-bash-san
|
|
|
7
7
|
* real binaries (`git`, `node`, package managers) and no network
|
|
8
8
|
* isolation.
|
|
9
9
|
*
|
|
10
|
-
* The `just-bash` package is not bundled with
|
|
10
|
+
* The `just-bash` package is not bundled with eve. When it is missing,
|
|
11
11
|
* `eve dev` installs it into the application automatically (disable
|
|
12
12
|
* with `autoInstall: false`); production processes fail with an
|
|
13
13
|
* actionable install error instead. Configuring this backend pins it
|
|
@@ -7,7 +7,7 @@ import type { MicrosandboxBootstrapUseOptions, MicrosandboxCreateOptions, Micros
|
|
|
7
7
|
* network policies and credential brokering.
|
|
8
8
|
*
|
|
9
9
|
* Supported hosts: macOS on Apple Silicon, or Linux (glibc) with KVM
|
|
10
|
-
* enabled. The `microsandbox` package is not bundled with
|
|
10
|
+
* enabled. The `microsandbox` package is not bundled with eve. When it
|
|
11
11
|
* (or its VM runtime) is missing, `eve dev` installs both
|
|
12
12
|
* automatically (disable with `setup: { autoInstall: false }`);
|
|
13
13
|
* production processes fail with actionable errors instead.
|
|
@@ -17,7 +17,7 @@ import type { VercelSandboxBootstrapUseOptions, VercelSandboxCreateOptions, Verc
|
|
|
17
17
|
* the author's snapshot, git revision, or tarball becomes the base
|
|
18
18
|
* layer of the template. Bootstrap, seed files, and framework setup
|
|
19
19
|
* still run on top, and every session derives from the resulting
|
|
20
|
-
*
|
|
20
|
+
* eve-owned snapshot. `source` is stripped from session creates so the
|
|
21
21
|
* framework's snapshot always wins.
|
|
22
22
|
*
|
|
23
23
|
* `bootstrap({ use })` applies its options to the template via
|
|
@@ -22,7 +22,7 @@ export type DockerSandboxNetworkPolicy = "allow-all" | "deny-all";
|
|
|
22
22
|
export interface DockerSandboxCreateOptions {
|
|
23
23
|
/**
|
|
24
24
|
* Base container image for templates and sessions. Defaults to
|
|
25
|
-
* `ghcr.io/vercel/eve:latest` —
|
|
25
|
+
* `ghcr.io/vercel/eve:latest` — eve's published sandbox runtime image.
|
|
26
26
|
* Framework setup creates `/workspace` and verifies Bash. Install any
|
|
27
27
|
* authored runtime tools in sandbox bootstrap or provide them through a
|
|
28
28
|
* custom image.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The just-bash backend runs the workspace under the pure-JS `just-bash`
|
|
5
5
|
* interpreter with a virtual filesystem — no daemon or VM required, but
|
|
6
6
|
* no real binaries either. The `just-bash` package is not bundled with
|
|
7
|
-
*
|
|
7
|
+
* eve; it is loaded lazily from the application install.
|
|
8
8
|
*/
|
|
9
9
|
export interface JustBashSandboxCreateOptions {
|
|
10
10
|
/**
|
|
@@ -4,13 +4,13 @@ import type { SandboxNetworkPolicy } from "#shared/sandbox-network-policy.js";
|
|
|
4
4
|
*
|
|
5
5
|
* The microsandbox backend runs sandboxes in lightweight local VMs via
|
|
6
6
|
* [microsandbox](https://www.npmjs.com/package/microsandbox). Options
|
|
7
|
-
* are
|
|
7
|
+
* are eve-owned rather than a raw passthrough so the public surface can
|
|
8
8
|
* stay stable while the underlying runtime evolves. Supported hosts:
|
|
9
9
|
* macOS on Apple Silicon, or Linux (glibc) with KVM enabled.
|
|
10
10
|
*/
|
|
11
11
|
export interface MicrosandboxCreateOptions {
|
|
12
12
|
/**
|
|
13
|
-
* OCI image used as the base runtime.
|
|
13
|
+
* OCI image used as the base runtime. eve prepares this image with
|
|
14
14
|
* Bash, the framework workspace, and the sandbox user before authored
|
|
15
15
|
* bootstrap code runs. Install authored runtime tools such as Node,
|
|
16
16
|
* Python, or ripgrep in sandbox bootstrap or provide them through a
|
|
@@ -29,7 +29,7 @@ export interface MicrosandboxCreateOptions {
|
|
|
29
29
|
readonly pullPolicy?: "always" | "if-missing" | "never";
|
|
30
30
|
/**
|
|
31
31
|
* Installation behavior for the microsandbox npm package and its VM
|
|
32
|
-
* runtime. By default
|
|
32
|
+
* runtime. By default eve installs both automatically when missing —
|
|
33
33
|
* the npm package with the project's package manager (during
|
|
34
34
|
* `eve dev` only), the runtime via microsandbox's own installer.
|
|
35
35
|
*/
|
|
@@ -6,7 +6,7 @@ import type { Sandbox as SdkSandbox, SandboxUpdateParams } from "#compiled/@verc
|
|
|
6
6
|
* Skipped on resume (`Sandbox.get`) since no create happens there.
|
|
7
7
|
*
|
|
8
8
|
* `networkPolicy` is deferred until after framework-owned base setup
|
|
9
|
-
* for fresh templates and template-less sessions, so
|
|
9
|
+
* for fresh templates and template-less sessions, so eve can install
|
|
10
10
|
* required packages before authored bootstrap code runs. Template-backed
|
|
11
11
|
* session creates receive it at creation time because the template
|
|
12
12
|
* already contains the prepared base runtime.
|
|
@@ -20,7 +20,7 @@ import type { Sandbox as SdkSandbox, SandboxUpdateParams } from "#compiled/@verc
|
|
|
20
20
|
* base layer for the template. Framework setup, bootstrap, and seed
|
|
21
21
|
* files all run on top, and the resulting
|
|
22
22
|
* framework-owned snapshot is what every later session derives from,
|
|
23
|
-
* so `source` is stripped from the session-create path.
|
|
23
|
+
* so `source` is stripped from the session-create path. eve does not
|
|
24
24
|
* detect external snapshot changes; to pick up a rebuilt external
|
|
25
25
|
* snapshot, force a template rebuild (e.g. by changing the sandbox
|
|
26
26
|
* definition so its template key changes).
|
|
@@ -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 SvelteKit processes don't each boot
|
|
22
|
+
* cross-process lock so concurrent SvelteKit processes don't each boot eve.
|
|
23
23
|
*/
|
|
24
24
|
export declare function resolveSharedEveDevServer(appRoot: string): Promise<EveProcessHandle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{joinRoutePrefix,normalizeOrigin}from"./routing.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";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=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/;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),`sveltekit-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`sveltekit-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 r=new AbortController,i=setTimeout(()=>r.abort(),1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(i)}}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: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){let t=resolveEveCacheDirectory(e),n=resolveEveDevServerLockPath(e),r=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(n,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(n,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(n),Date.now()>r)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another SvelteKit process to start
|
|
1
|
+
import{joinRoutePrefix,normalizeOrigin}from"./routing.js";import{EVE_ROUTE_PREFIX}from"#protocol/routes.js";import{resolvePackageRoot}from"#internal/application/package.js";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=3e4,DEV_SERVER_REGISTRY_TIMEOUT_MS=3e4,LOCAL_SERVER_URL_PATTERN=/https?:\/\/(?:\[[^\]\s]+\]|[^\s/:[\]]+)(?::\d+)?/;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),`sveltekit-dev-server.json`)}function resolveEveDevServerLockPath(e){return join(resolveEveCacheDirectory(e),`sveltekit-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 r=new AbortController,i=setTimeout(()=>r.abort(),1e3);try{return(await fetch(joinRoutePrefix(t,`${EVE_ROUTE_PREFIX}/health`),{signal:r.signal})).ok}catch{return!1}finally{clearTimeout(i)}}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: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){let t=resolveEveCacheDirectory(e),n=resolveEveDevServerLockPath(e),r=Date.now()+DEV_SERVER_REGISTRY_TIMEOUT_MS;for(await mkdir(t,{recursive:!0});;)try{let e=await open(n,`wx`);return await e.writeFile(`${String(process.pid)}\n`),await e.close(),async()=>{await rm(n,{force:!0})}}catch(t){if(!isNodeErrorWithCode(t,`EEXIST`))throw t;if(await readUsableEveDevServerRegistry(e)!==void 0)return async()=>{};if(await removeStaleEveDevServerLock(n),Date.now()>r)throw Error(`Timed out after ${DEV_SERVER_REGISTRY_TIMEOUT_MS}ms waiting for another SvelteKit process to start eve.`);await delay(100)}}function createEveBinaryPath(){return join(resolvePackageRoot(),`bin`,`eve.js`)}function startServerProcess(e){return new Promise((n,r)=>{let i=spawn(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env},stdio:[`ignore`,`pipe`,`pipe`]}),a=setTimeout(()=>{i.kill(),r(Error(`Timed out after ${DEFAULT_SERVER_READY_TIMEOUT_MS}ms waiting for eve to print its server URL.`))},DEFAULT_SERVER_READY_TIMEOUT_MS),cleanup=()=>{clearTimeout(a),i.off(`error`,handleError),i.off(`exit`,handleEarlyExit)},handleError=e=>{cleanup(),r(e)},handleEarlyExit=(e,t)=>{cleanup(),r(Error(`eve server process exited before printing its server URL (code ${String(e)}, signal ${String(t)}).`))},o=!1,handleOutput=e=>{if(o)return;let r=LOCAL_SERVER_URL_PATTERN.exec(e.toString(`utf8`));r!==null&&(o=!0,cleanup(),n({origin:normalizeOrigin(r[0]),process:i}))};i.once(`error`,handleError),i.once(`exit`,handleEarlyExit),i.stdout.on(`data`,e=>{process.stdout.write(e),handleOutput(e)}),i.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=()=>{process.off(`beforeExit`,close),process.off(`exit`,close),t.killed||t.kill()};return process.once(`beforeExit`,close),process.once(`exit`,close),e}function startEveDevServer(e){return startServerProcess({args:[createEveBinaryPath(),`dev`,`--no-ui`,`--port`,`0`],command:process.execPath,cwd:e}).then(e=>(process.env[EVE_BASE_URL_ENV]=e.origin,installProcessShutdown(e)))}async function resolveSharedEveDevServer(e){let t=await readUsableEveDevServerRegistry(e);if(t!==void 0)return process.env[EVE_BASE_URL_ENV]=t,{origin:t};let n=await acquireEveDevServerLock(e);try{let t=await readUsableEveDevServerRegistry(e);if(t!==void 0)return process.env[EVE_BASE_URL_ENV]=t,{origin:t};let n=await startEveDevServer(e);return await writeEveDevServerRegistry(e,n),n}finally{await n()}}export{EVE_BASE_URL_ENV,normalizeDevServerRegistry,resolveSharedEveDevServer};
|