The Open Framework for Building Agents
fix: align withEve Vercel routes (#3436)
OwenKephart9f301b648c94
diff --git a/.changeset/align-with-eve-vercel-routes.md b/.changeset/align-with-eve-vercel-routes.mdnew file mode 100644index 000000000..68756a1db--- /dev/null+++ b/.changeset/align-with-eve-vercel-routes.md@@ -0,0 +1,5 @@+---+"eve": minor+---++Named workspace agent routes now use `/eve/<name>/v1/*` across `eve/next`, `eve/vercel`, and agent-only workspace builds. Update existing named-agent URLs to the new route; root single-agent routes remain at `/eve/v1/*`, and `eve/vercel` can now compose them.diff --git a/docs/guides/deployment/vercel.mdx b/docs/guides/deployment/vercel.mdxindex c26cdda13..43f5bd547 100644--- a/docs/guides/deployment/vercel.mdx+++ b/docs/guides/deployment/vercel.mdx@@ -82,13 +82,11 @@ export default await withEve({});```-Vercel evaluates `vercel.ts` before resolving the service graph. `withEve` discovers direct workspace members, adds their services and transport routes, and returns a plain Vercel configuration. Vercel then builds `web` and each eve agent separately. The frontend does not need a build script that builds the agents.+Vercel evaluates `vercel.ts` before resolving the service graph. `withEve` adds the root agent, or every direct workspace member, as an independently built service and returns a plain Vercel configuration. Named workspace agents mount at `/eve/<name>/v1/*`; a root agent mounts at `/eve/v1/*`. Vercel then builds the frontend and each eve agent separately. The frontend does not need `withEve` in its framework configuration or a build script that builds the agents.The Web Chat installer does not support agent workspaces. Create the frontend using the [React chat example](../frontend/overview#basic-chat-react), and configure authentication for every exposed agent. To self-host the same source layout, replace Vercel composition with your own [process and proxy configuration](./self-hosting#run-workspace-members).-Workspace agents use `/<name>/eve/v1/*` routes. A same-origin React client calls support with `useEveAgent({ host: "/support" })`; the hook's `agent: "support"` shorthand targets the different `/eve/agents/support` mount used by frontend framework integrations.--Run Vercel CLI 59.16.0 or newer with `vercel dev --local` to start the complete service graph locally. Each hostless agent is available at `http://localhost:3000/<agent>/`, and default `defineWorkspaceAgent` transports can call peers without deployment credentials. Run `eve dev` instead when you only need one agent and the eve terminal UI.+Run Vercel CLI 59.16.0 or newer with `vercel dev --local` to start the complete service graph locally. Named agents use the same `/eve/<name>/v1/*` routes in development, and default `defineWorkspaceAgent` transports can call peers without deployment credentials. Run `eve dev` instead when you only need one agent and the eve terminal UI.Generated transport routes are inserted before a filesystem handler or, when no filesystem handler exists, before authored routes. `withEve` throws instead of overwriting an authored service key or exact transport route that belongs to a generated agent. Remove the authored route, and remove or rename the authored service; `withEve` adds both automatically. Names in the array form of `services` must also be unique. Other service names, routes, bindings, and Cron Jobs remain authored in `vercel.ts`.@@ -116,7 +114,7 @@ export default await withEve({A Vercel project can use only one configuration source, so remove `vercel.json` when adopting `vercel.ts`. Keep `eve` in the root package dependencies so Vercel can import `eve/vercel` while evaluating the configuration. `withEve` discovers the workspace containing its evaluation directory, including Vercel's temporary `.vercel` configuration directory. Pass `{ root: "/absolute/workspace/path" }` as the second argument only when you need to select a specific workspace root.-An authored eve service routed at `/eve/v1` already uses the protocol path; callbacks remain at `/eve/v1/callback/*`. A named mount such as `/support` adds that mount before the protocol path, giving `/support/eve/v1/callback/*`.+An authored eve service routed at `/eve/v1` already uses the protocol path; callbacks remain at `/eve/v1/callback/*`. A named mount such as `/eve/support` adds that mount before the protocol path, giving `/eve/support/v1/callback/*`.### Deploy the project@@ -150,11 +148,11 @@ curl https://your_agent.vercel.app/eve/v1/healtheve dev https://your_agent.vercel.app```-For a workspace agent, include its public mount: `/support` with `eve/vercel` or an agent-only workspace, or `/eve/agents/support` with `eve/next`. For example:+For a workspace agent, include its public `/eve/<name>` mount. For example:```bash-curl https://your_agent.vercel.app/support/eve/v1/health-eve dev https://your_agent.vercel.app/support+curl https://your_agent.vercel.app/eve/support/v1/health+eve dev https://your_agent.vercel.app/eve/support```Set `VERCEL_AUTOMATION_BYPASS_SECRET` locally before connecting if the deployment uses Deployment Protection.diff --git a/docs/guides/frontend/nextjs.mdx b/docs/guides/frontend/nextjs.mdxindex 36b9e2cde..5f53d45fc 100644--- a/docs/guides/frontend/nextjs.mdx+++ b/docs/guides/frontend/nextjs.mdx@@ -38,7 +38,7 @@ const nextConfig: NextConfig = {};export default withEve(nextConfig);```-By default `withEve(nextConfig)` looks for an `agent/` folder inside your Next.js project root and mounts its API at `/eve/v1/*`. When the project root is an eve workspace with `agents/<name>/` members, it discovers every member and mounts each at `/eve/agents/<name>/eve/v1/*` instead. You do not need an explicit `agents` map for this layout.+By default `withEve(nextConfig)` looks for an `agent/` folder inside your Next.js project root and mounts its API at `/eve/v1/*`. When the project root is an eve workspace with `agents/<name>/` members, it discovers every member and mounts each at `/eve/<name>/v1/*` instead. You do not need an explicit `agents` map for this layout.If one agent lives somewhere else, point at it with `eveRoot`:@@ -65,21 +65,28 @@ export default withEve(nextConfig, {});```+Named agents mount under `/eve/<name>/v1/*`. Call the matching agent from React with `agent`:++```tsx+const support = useEveAgent({ agent: "support" });+const billing = useEveAgent({ agent: "billing" });+```+Use either `eveRoot` or `agents`, not both. `eveRoot` remains the shorthand for a single unnamed agent mounted at `/eve/v1/*`.-Generated agent services build with `EVE_PUBLIC_ROUTE_PREFIX` set to the agent's public mount (for example `/eve/agents/support`) so framework-minted callback URLs — OAuth connection callbacks and remote-subagent session callbacks — resolve to the public per-agent path. If you configure eve services manually in `vercel.json` instead, export that variable in each named agent's build command.+Generated agent services build with `EVE_PUBLIC_ROUTE_PREFIX` set to the agent's public mount (for example `/eve/support`) so framework-minted callback URLs — OAuth connection callbacks and remote-subagent session callbacks — resolve to the public per-agent path. If you configure eve services manually in `vercel.json` instead, export that variable in each named agent's build command.### `withEve` optionsAll fields are optional.-| Option | Type | Default | Purpose |-| -------------------- | --------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `eveRoot` | `string` | Next.js app root | Path to one unnamed eve app root, relative to `process.cwd()` unless absolute. Do not combine with `agents`. |-| `agents` | `Record<string, ...>` | inferred for a workspace | Named eve agents to mount under `/eve/agents/<name>/eve/v1/*`. `withEve()` discovers project-level `agents/<name>/` members when neither `agents` nor `eveRoot` is set; otherwise each value is a root string or `{ root, buildCommand?, servicePrefix? }`. |-| `eveBuildCommand` | `string` | generated | Build command for generated eve Vercel services. In multi-agent mode this is the default for agents without their own `buildCommand`. |-| `servicePrefix` | `string` | `"/_eve_internal/eve"` | Private route namespace for legacy manual Vercel service configs and non-Vercel production proxying. Named agents derive unique defaults from this prefix. |-| `devServerTimeoutMs` | `number` | `180000` | Maximum time to wait for each eve development server to become available. |+| Option | Type | Default | Purpose |+| -------------------- | --------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `eveRoot` | `string` | Next.js app root | Path to one unnamed eve app root, relative to `process.cwd()` unless absolute. Do not combine with `agents`. |+| `agents` | `Record<string, ...>` | inferred for a workspace | Named eve agents to mount under `/eve/<name>/v1/*`. `withEve()` discovers project-level `agents/<name>/` members when neither `agents` nor `eveRoot` is set; otherwise each value is a root string or `{ root, buildCommand?, servicePrefix? }`. |+| `eveBuildCommand` | `string` | generated | Build command for generated eve Vercel services. In multi-agent mode this is the default for agents without their own `buildCommand`. |+| `servicePrefix` | `string` | `"/_eve_internal/eve"` | Private route namespace for legacy manual Vercel service configs and non-Vercel production proxying. Named agents derive unique defaults from this prefix. |+| `devServerTimeoutMs` | `number` | `180000` | Maximum time to wait for each eve development server to become available. |For slow cold starts, increase the development timeout:diff --git a/docs/schedules.mdx b/docs/schedules.mdxindex be93c080d..3912172c9 100644--- a/docs/schedules.mdx+++ b/docs/schedules.mdx@@ -107,7 +107,7 @@ The route is dev-only. Production builds never mount it, and it needs no auth si## On Vercel-Hosted Vercel builds turn every `defineSchedule(...)` into a Vercel Cron Job, with each `cron` written as an entry in `.vercel/output/config.json`. This also applies when [`withEve`](./guides/frontend/nextjs) embeds one or more agents in a Next.js deployment: Vercel assembles each generated eve service's schedules into the project Build Output config while preserving existing project cron entries. Named agents use their public `/eve/agents/<name>` route prefix automatically.+Hosted Vercel builds turn every `defineSchedule(...)` into a Vercel Cron Job, with each `cron` written as an entry in `.vercel/output/config.json`. This also applies when [`withEve`](./guides/frontend/nextjs) embeds one or more agents in a Next.js deployment: Vercel assembles each generated eve service's schedules into the project Build Output config while preserving existing project cron entries. Named agents use their public `/eve/<name>` route prefix automatically.When running `vercel build` locally, use Vercel CLI 56.4.0 or later so generated-service cron entries are included in the project output.diff --git a/docs/subagents/index.mdx b/docs/subagents/index.mdxindex 64c2c260a..93e9e4f57 100644--- a/docs/subagents/index.mdx+++ b/docs/subagents/index.mdx@@ -79,7 +79,7 @@ export default defineWorkspaceAgent({});```-The helper uses the peer's root `defineAgent({ description })` value as the model-visible tool description. Pass `description` to override it for this caller. When `transport` is omitted, eve selects the built-in transport for the Vercel runtime environment. Local `vercel dev` routes workspace calls without deployment credentials; Vercel deployments route calls through the current deployment and authenticate with the caller's Vercel OIDC token. A workspace hosted through `withEve()` in a Next.js app uses its `/eve/agents/<name>` mount; a hostless workspace uses `/<name>`. Outside those environments, provide an explicit transport with `url` and optional `auth` or `headers`:+The helper uses the peer's root `defineAgent({ description })` value as the model-visible tool description. Pass `description` to override it for this caller. When `transport` is omitted, eve selects the built-in transport for the Vercel runtime environment. Local `vercel dev` routes workspace calls without deployment credentials; Vercel deployments route calls through the current deployment and authenticate with the caller's Vercel OIDC token. Named peers use their `/eve/<name>` mount. Outside those environments, provide an explicit transport with `url` and optional `auth` or `headers`:```ts title="agents/foreman/agent/subagents/research.ts"import { defineWorkspaceAgent } from "eve";diff --git a/packages/eve/src/channel/activity-sink.test.ts b/packages/eve/src/channel/activity-sink.test.tsindex 7b062d166..297ea1203 100644--- a/packages/eve/src/channel/activity-sink.test.ts+++ b/packages/eve/src/channel/activity-sink.test.ts@@ -13,6 +13,14 @@ describe("parseActivitySink", () => {expect(parseActivitySink(sink)).toEqual(sink);});+ it("accepts a compact named-agent activity capability URL", () => {+ const sink = {+ url: `https://agent.example.com/eve/support/v1/activity/${token}`,+ version: 1 as const,+ };+ expect(parseActivitySink(sink)).toEqual(sink);+ });+it("rejects missing opaque tokens and reserved sink hosts", () => {expect(() =>parseActivitySink({ url: "https://agent.example.com/eve/v1/activity/short", version: 1 }),diff --git a/packages/eve/src/channel/activity-sink.ts b/packages/eve/src/channel/activity-sink.tsindex f3d21c04c..1acdf3023 100644--- a/packages/eve/src/channel/activity-sink.ts+++ b/packages/eve/src/channel/activity-sink.ts@@ -2,6 +2,7 @@ import { z } from "#compiled/zod/index.js";import type { ActivitySinkV1 } from "#channel/types.js";import { EVE_ACTIVITY_ROUTE_PATTERN } from "#protocol/routes.js";+import { normalizePublicEveRoutePath } from "#shared/eve-route-path.js";import { isReservedIpAddress } from "#shared/network-address.js";const schema = z.object({ url: z.string().min(1), version: z.literal(1) }).strict();@@ -17,8 +18,10 @@ export function parseActivitySink(value: unknown): ActivitySinkV1 | undefined {throw new Error("Activity sink url must be absolute.");}const routePrefix = EVE_ACTIVITY_ROUTE_PATTERN.slice(0, -":token".length);- const token = url.pathname.slice(url.pathname.lastIndexOf(routePrefix) + routePrefix.length);- if (url.pathname.lastIndexOf(routePrefix) < 0 || token.length < 32) {+ const pathname = normalizePublicEveRoutePath(url.pathname);+ const routeIndex = pathname.lastIndexOf(routePrefix);+ const token = pathname.slice(routeIndex + routePrefix.length);+ if (routeIndex < 0 || token.length < 32) {throw new Error("Activity sink url must contain an opaque activity token.");}if (isReservedIpAddress(url.hostname)) {diff --git a/packages/eve/src/channel/session-callback.test.ts b/packages/eve/src/channel/session-callback.test.tsindex e08f98d6f..bc49d9e0a 100644--- a/packages/eve/src/channel/session-callback.test.ts+++ b/packages/eve/src/channel/session-callback.test.ts@@ -21,7 +21,7 @@ describe("parseSessionCallback callback-URL token extraction", () => {it("accepts a callback URL mounted behind a public route prefix", () => {expect(parseSessionCallback(- createCallback("https://agent.example.com/eve/agents/support/eve/v1/callback/tok123"),+ createCallback("https://agent.example.com/eve/support/v1/callback/tok123"),),).toMatchObject({ ok: true });});@@ -38,7 +38,7 @@ describe("parseSessionCallback callback-URL token extraction", () => {expect(parseSessionCallback(createCallback(- "https://agent.example.com/eve/agents/support/eve/v1/callback/eve%3Aparent-token",+ "https://agent.example.com/eve/support/v1/callback/eve%3Aparent-token","eve:parent-token",),),@@ -47,9 +47,7 @@ describe("parseSessionCallback callback-URL token extraction", () => {it("rejects a URL without the callback route", () => {expect(- parseSessionCallback(- createCallback("https://agent.example.com/eve/agents/support/eve/v1/session"),- ),+ parseSessionCallback(createCallback("https://agent.example.com/eve/support/v1/session")),).toMatchObject({message: expect.stringContaining("Callback url token must match callback token"),ok: false,@@ -59,7 +57,7 @@ describe("parseSessionCallback callback-URL token extraction", () => {it("rejects a URL whose token segment does not match the token field", () => {expect(parseSessionCallback(- createCallback("https://agent.example.com/eve/agents/support/eve/v1/callback/other-token"),+ createCallback("https://agent.example.com/eve/support/v1/callback/other-token"),),).toMatchObject({ ok: false });});diff --git a/packages/eve/src/channel/session-callback.ts b/packages/eve/src/channel/session-callback.tsindex 868f234a2..ed7160bbc 100644--- a/packages/eve/src/channel/session-callback.ts+++ b/packages/eve/src/channel/session-callback.ts@@ -2,6 +2,7 @@ import { z } from "#compiled/zod/index.js";import type { SessionCallback } from "#channel/types.js";import { createEveCallbackRoutePath } from "#protocol/routes.js";+import { normalizePublicEveRoutePath } from "#shared/eve-route-path.js";import { isReservedIpAddress } from "#shared/network-address.js";export type SessionCallbackParseResult =@@ -72,16 +73,17 @@ export function parseSessionCallback(value: unknown): SessionCallbackParseResultfunction readCallbackUrlToken(url: URL): string | null {// The callback route may be mounted behind a public route prefix (e.g.- // `/eve/agents/<name>/eve/v1/callback/<token>`), so locate the route+ // `/eve/<name>/v1/callback/<token>`), so locate the route// suffix instead of anchoring at the path start. `tokenPrefix` begins// with `/`, so a match is always segment-aligned.const tokenPrefix = createEveCallbackRoutePath("");- const prefixIndex = url.pathname.lastIndexOf(tokenPrefix);+ const pathname = normalizePublicEveRoutePath(url.pathname);+ const prefixIndex = pathname.lastIndexOf(tokenPrefix);if (prefixIndex === -1) {return null;}- const encodedToken = url.pathname.slice(prefixIndex + tokenPrefix.length);+ const encodedToken = pathname.slice(prefixIndex + tokenPrefix.length);if (encodedToken.length === 0 || encodedToken.includes("/")) {return null;}diff --git a/packages/eve/src/client/agent-host.test.ts b/packages/eve/src/client/agent-host.test.tsindex afcfa489b..a74f3aa8f 100644--- a/packages/eve/src/client/agent-host.test.ts+++ b/packages/eve/src/client/agent-host.test.ts@@ -12,7 +12,7 @@ describe("resolveEveAgentHost", () => {});it("maps a named agent to the same-origin named route prefix", () => {- expect(resolveEveAgentHost({ agent: "support" })).toBe("/eve/agents/support");+ expect(resolveEveAgentHost({ agent: "support" })).toBe("/eve/support");});it("rejects host and agent together", () => {diff --git a/packages/eve/src/client/agent-host.ts b/packages/eve/src/client/agent-host.tsindex 7cc6d6f99..db64e72f3 100644--- a/packages/eve/src/client/agent-host.ts+++ b/packages/eve/src/client/agent-host.ts@@ -1,5 +1,5 @@const AGENT_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;-const EVE_NAMED_AGENT_ROUTE_PREFIX = "/eve/agents";+const EVE_NAMED_AGENT_ROUTE_PREFIX = "/eve";export function resolveEveAgentHost(input: {readonly agent?: string;diff --git a/packages/eve/src/client/url.test.ts b/packages/eve/src/client/url.test.tsindex 8bc2d60c4..22e574237 100644--- a/packages/eve/src/client/url.test.ts+++ b/packages/eve/src/client/url.test.ts@@ -15,6 +15,12 @@ describe("createClientUrl", () => {);});+ it("maps internal routes onto an absolute compact named-agent mount", () => {+ expect(createClientUrl("https://app.example.com/eve/support", "/eve/v1/session")).toBe(+ "https://app.example.com/eve/support/v1/session",+ );+ });+it("preserves host query parameters on agent routes", () => {expect(createClientUrl(@@ -38,6 +44,10 @@ describe("createClientUrl", () => {expect(createClientUrl("/api", "/eve/v1/session")).toBe("/api/eve/v1/session");});+ it("maps internal routes onto a same-origin compact named-agent mount", () => {+ expect(createClientUrl("/eve/support", "/eve/v1/session")).toBe("/eve/support/v1/session");+ });+it("adds query parameters without forcing an absolute URL", () => {expect(createClientUrl("/api", "/eve/v1/session/123/stream", { startIndex: "4" })).toBe("/api/eve/v1/session/123/stream?startIndex=4",diff --git a/packages/eve/src/client/url.ts b/packages/eve/src/client/url.tsindex e3b36a8e9..a974f6781 100644--- a/packages/eve/src/client/url.ts+++ b/packages/eve/src/client/url.ts@@ -1,3 +1,5 @@+import { joinEveRoutePath } from "#shared/eve-route-path.js";+/*** Builds a fetchable URL from a caller-provided host and an eve route path.*@@ -23,7 +25,7 @@ export function createClientUrl(if (isAbsoluteUrl(host)) {const url = new URL(host);const basePath = trimTrailingSlash(url.pathname);- url.pathname = `${basePath}${normalizedRoute}`;+ url.pathname = joinEveRoutePath(basePath, normalizedRoute);mergeEmbeddedQuery(url.searchParams, embeddedQuery);mergeSearchParams(url.searchParams, searchParams);url.hash = "";@@ -34,7 +36,7 @@ export function createClientUrl(const basePath = trimTrailingSlash(url.pathname);mergeEmbeddedQuery(url.searchParams, embeddedQuery);mergeSearchParams(url.searchParams, searchParams);- return `${basePath}${normalizedRoute}${formatSearch(url.searchParams)}`;+ return `${joinEveRoutePath(basePath, normalizedRoute)}${formatSearch(url.searchParams)}`;}function mergeEmbeddedQuery(target: URLSearchParams, embeddedQuery: string): void {diff --git a/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts b/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.tsindex d09d27d7c..bb53262b2 100644--- a/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts+++ b/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts@@ -22,6 +22,7 @@ import {createEveConnectionCallbackRoutePath,} from "#protocol/routes.js";import { ensureEveVercelOutputConfig } from "#public/next/vercel-output-config.js";+import { joinEveRoutePath } from "#shared/eve-route-path.js";import type { HarnessSession } from "#harness/types.js";/**@@ -49,12 +50,12 @@ import type { HarnessSession } from "#harness/types.js";const DEPLOYMENT_AGENTS = [{name: "support",- publicRoutePrefix: "/eve/agents/support",+ publicRoutePrefix: "/eve/support",serviceName: "eve-support",},{name: "billing",- publicRoutePrefix: "/eve/agents/billing",+ publicRoutePrefix: "/eve/billing",serviceName: "eve-billing",},] as const;@@ -320,7 +321,10 @@ describe("multi-agent callback routing", () => {expect(remoteSessionId).toBe("remote-session-1");expect(callback.url).toBe(- `${deploymentOrigin}${agent.publicRoutePrefix}${createEveCallbackRoutePath(callbackToken)}`,+ `${deploymentOrigin}${joinEveRoutePath(+ agent.publicRoutePrefix,+ createEveCallbackRoutePath(callbackToken),+ )}`,);// Remote-side create-session validation (public/channels/eve.ts):@@ -364,10 +368,9 @@ describe("multi-agent callback routing", () => {const hookUrl = contextStorage.run(ctx, () => getHookUrl("linear", attemptId));expect(hookUrl).toBe(- `${deploymentOrigin}${agent.publicRoutePrefix}${createEveConnectionCallbackRoutePath(- "linear",- attemptId,- authHookToken(sessionId),+ `${deploymentOrigin}${joinEveRoutePath(+ agent.publicRoutePrefix,+ createEveConnectionCallbackRoutePath("linear", attemptId, authHookToken(sessionId)),)}`,);diff --git a/packages/eve/src/execution/workflow-callback-url.test.ts b/packages/eve/src/execution/workflow-callback-url.test.tsindex 2d5529922..6a53fc7ce 100644--- a/packages/eve/src/execution/workflow-callback-url.test.ts+++ b/packages/eve/src/execution/workflow-callback-url.test.ts@@ -82,20 +82,20 @@ describe("resolveWorkflowCallbackBaseUrl", () => {it("appends the configured public route prefix to the resolved base", () => {vi.stubEnv("VERCEL_ENV", "");vi.stubEnv("WORKFLOW_LOCAL_BASE_URL", "");- vi.stubEnv("EVE_PUBLIC_ROUTE_PREFIX", "/eve/agents/support");+ vi.stubEnv("EVE_PUBLIC_ROUTE_PREFIX", "/eve/support");expect(resolveWorkflowCallbackBaseUrl("https://deployment.example.com/")).toBe(- "https://deployment.example.com/eve/agents/support",+ "https://deployment.example.com/eve/support",);});it("appends the public route prefix to the stable Vercel production URL", () => {vi.stubEnv("VERCEL_ENV", "production");vi.stubEnv("VERCEL_PROJECT_PRODUCTION_URL", "agent.example.com");- vi.stubEnv("EVE_PUBLIC_ROUTE_PREFIX", "eve/agents/support/");+ vi.stubEnv("EVE_PUBLIC_ROUTE_PREFIX", "eve/support/");expect(resolveWorkflowCallbackBaseUrl("https://deployment.example.com")).toBe(- "https://agent.example.com/eve/agents/support",+ "https://agent.example.com/eve/support",);});@@ -116,10 +116,10 @@ describe("createWorkflowCallbackUrl", () => {it("preserves a public route prefix carried by the base URL", () => {expect(createWorkflowCallbackUrl(- "https://agent.example.com/eve/agents/support",+ "https://agent.example.com/eve/support","/eve/v1/callback/eve%3Aparent-token",),- ).toBe("https://agent.example.com/eve/agents/support/eve/v1/callback/eve%3Aparent-token");+ ).toBe("https://agent.example.com/eve/support/v1/callback/eve%3Aparent-token");});it("preserves the prefix when adding the Vercel bypass query param", () => {@@ -127,11 +127,11 @@ describe("createWorkflowCallbackUrl", () => {expect(createWorkflowCallbackUrl(- "https://agent.example.com/eve/agents/support",+ "https://agent.example.com/eve/support","/eve/v1/connections/linear/callback/tok123?code=abc",),).toBe(- "https://agent.example.com/eve/agents/support/eve/v1/connections/linear/callback/tok123?code=abc&x-vercel-protection-bypass=secret",+ "https://agent.example.com/eve/support/v1/connections/linear/callback/tok123?code=abc&x-vercel-protection-bypass=secret",);});});diff --git a/packages/eve/src/execution/workflow-callback-url.ts b/packages/eve/src/execution/workflow-callback-url.tsindex 54e847491..fa8317cc8 100644--- a/packages/eve/src/execution/workflow-callback-url.ts+++ b/packages/eve/src/execution/workflow-callback-url.ts@@ -1,3 +1,4 @@+import { joinEveRoutePath } from "#shared/eve-route-path.js";import {EVE_PUBLIC_ROUTE_PREFIX_ENV,normalizePublicRoutePrefix,@@ -61,7 +62,10 @@ export function resolveWorkflowCallbackBaseUrl(metadataUrl: string): string {* `new URL(path, base)` would drop for absolute paths.*/export function createWorkflowCallbackUrl(baseUrl: string, callbackPath: string): string {- const url = new URL(`${baseUrl.replace(/\/$/, "")}${callbackPath}`);+ const callback = new URL(callbackPath, "http://eve.local");+ const url = new URL(baseUrl);+ url.pathname = joinEveRoutePath(url.pathname, callback.pathname);+ url.search = callback.search;// https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automationconst bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();@@ -77,7 +81,10 @@ export function createWorkflowCallbackUrl(baseUrl: string, callbackPath: string)* protection bypass secret to an authored external origin.*/export function createRemoteTaskInputCallbackUrl(baseUrl: string, callbackPath: string): string {- const url = new URL(`${baseUrl.replace(/\/$/, "")}${callbackPath}`);+ const callback = new URL(callbackPath, "http://eve.local");+ const url = new URL(baseUrl);+ url.pathname = joinEveRoutePath(url.pathname, callback.pathname);+ url.search = callback.search;const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();const isCurrentVercelHost = VERCEL_CALLBACK_HOST_ENVS.some((name) => process.env[name]?.trim().toLowerCase() === url.hostname.toLowerCase(),diff --git a/packages/eve/src/internal/nitro/host/build-application.scenario.test.ts b/packages/eve/src/internal/nitro/host/build-application.scenario.test.tsindex 463c4f825..cdb509bb3 100644--- a/packages/eve/src/internal/nitro/host/build-application.scenario.test.ts+++ b/packages/eve/src/internal/nitro/host/build-application.scenario.test.ts@@ -632,7 +632,7 @@ describe("buildApplication", () => {framework: "eve",name: "eve-support",root: ".",- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",},],},@@ -691,7 +691,7 @@ describe("buildApplication", () => {"eve-support": {framework: "eve",root: "agents/support",- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",},},version: 3,diff --git a/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.integration.test.ts b/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.integration.test.tsindex ee4f84669..188b23648 100644--- a/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.integration.test.ts+++ b/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.integration.test.ts@@ -46,7 +46,7 @@ describe("normalizeVercelServiceCrons", () => {{ path: "/eve/v1/cron/current", schedule: "*/15 * * * *" },{ path: "/eve/v1/cron/current", schedule: "*/15 * * * *" },{- path: "/eve/agents/support/eve/v1/cron/keep",+ path: "/eve/support/v1/cron/keep",schedule: "*/5 * * * *",},],@@ -55,11 +55,11 @@ describe("normalizeVercelServiceCrons", () => {});await normalizeVercelServiceCrons({- publicRoutePrefix: "/eve/agents/billing/",+ publicRoutePrefix: "/eve/billing/",serviceOutputDirectory: outputDirectory,});await normalizeVercelServiceCrons({- publicRoutePrefix: "/eve/agents/billing/",+ publicRoutePrefix: "/eve/billing/",serviceOutputDirectory: outputDirectory,});@@ -67,11 +67,11 @@ describe("normalizeVercelServiceCrons", () => {crons: [{ path: "/api/service-cleanup", schedule: "0 0 * * *" },{- path: "/eve/agents/billing/eve/v1/cron/current",+ path: "/eve/billing/v1/cron/current",schedule: "*/15 * * * *",},{- path: "/eve/agents/support/eve/v1/cron/keep",+ path: "/eve/support/v1/cron/keep",schedule: "*/5 * * * *",},],@@ -109,7 +109,7 @@ describe("normalizeVercelServiceCrons", () => {const before = await readFile(configPath, "utf8");await normalizeVercelServiceCrons({- publicRoutePrefix: "/eve/agents/billing",+ publicRoutePrefix: "/eve/billing",serviceOutputDirectory: outputDirectory,});diff --git a/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.ts b/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.tsindex 78e94bb94..532bad4a8 100644--- a/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.ts+++ b/packages/eve/src/internal/nitro/host/normalize-vercel-service-crons.ts@@ -3,6 +3,7 @@ import { join } from "node:path";import { EVE_ROUTE_PREFIX } from "#protocol/routes.js";import { atomicWriteFile } from "#shared/atomic-write-file.js";+import { joinEveRoutePath } from "#shared/eve-route-path.js";import { normalizePublicRoutePrefix } from "#shared/public-route-prefix.js";const VERCEL_OUTPUT_CONFIG_FILE_NAME = "config.json";@@ -66,7 +67,7 @@ function normalizeCronPath(return {...cron,- path: `${publicRoutePrefix}${cron.path}`,+ path: joinEveRoutePath(publicRoutePrefix, cron.path),};}diff --git a/packages/eve/src/internal/nitro/host/vercel-build-output-config.test.ts b/packages/eve/src/internal/nitro/host/vercel-build-output-config.test.tsindex 67add0ac1..769a1fb34 100644--- a/packages/eve/src/internal/nitro/host/vercel-build-output-config.test.ts+++ b/packages/eve/src/internal/nitro/host/vercel-build-output-config.test.ts@@ -62,12 +62,12 @@ describe("createEveVercelOptions", () => {const options = createEveVercelOptions({agentName: "test-agent",enabled: true,- publicRoutePrefix: "eve/agents/support/",+ publicRoutePrefix: "eve/support/",});expect(options?.functionRules[EVE_WORKFLOW_FLOW_ROUTE_PATH].environment).toEqual({WORKFLOW_PRECONDITION_GUARD: "1",- EVE_PUBLIC_ROUTE_PREFIX: "/eve/agents/support",+ EVE_PUBLIC_ROUTE_PREFIX: "/eve/support",});});diff --git a/packages/eve/src/internal/vercel/build-agent-workspace.integration.test.ts b/packages/eve/src/internal/vercel/build-agent-workspace.integration.test.tsindex fcb12d472..5ea2a4b69 100644--- a/packages/eve/src/internal/vercel/build-agent-workspace.integration.test.ts+++ b/packages/eve/src/internal/vercel/build-agent-workspace.integration.test.ts@@ -50,12 +50,12 @@ describe("buildAgentWorkspace", () => {agents: [{name: "research",- routePrefix: "/research",+ routePrefix: "/eve/research",summaryPath: "agents/research/.eve/agent-summary.json",},{name: "support",- routePrefix: "/support",+ routePrefix: "/eve/support",summaryPath: "agents/support/.eve/agent-summary.json",},],@@ -66,19 +66,19 @@ describe("buildAgentWorkspace", () => {expect(config.routes).toEqual([{destination: { service: "eve-research", type: "service" },- src: "^/research/eve/v1/(.*)$",+ src: "^/eve/research/v1/(.*)$",},{destination: { service: "eve-research", type: "service" },- src: "^/research/?$",+ src: "^/eve/research/?$",},{destination: { service: "eve-support", type: "service" },- src: "^/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",},{destination: { service: "eve-support", type: "service" },- src: "^/support/?$",+ src: "^/eve/support/?$",},{ handle: "filesystem" },]);@@ -91,20 +91,20 @@ describe("buildAgentWorkspace", () => {expect(config.services["eve-support"]).toEqual({buildCommand:- "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' build",+ "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' build",devCommand:- "cd '../../../agents/support' && export EVE_PUBLIC_ROUTE_PREFIX='/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' dev --no-ui",+ "cd '../../../agents/support' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' dev --no-ui",framework: "eve",outputDirectory: ".vercel/output",root: ".eve/vercel-services/eve-support",- routePrefix: "/support",+ routePrefix: "/eve/support",routes: [{- src: "^/support/?$",+ src: "^/eve/support/?$",transforms: [{ args: "/", op: "set", type: "request.path" }],},{- src: "^/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",transforms: [{ args: "/eve/v1/$1", op: "set", type: "request.path" }],},],@@ -124,7 +124,7 @@ describe("buildAgentWorkspace", () => {expect(supportServiceName).toMatch(/^eve-support-[a-z]+$/);expect(config.routes).toContainEqual({destination: { service: supportServiceName, type: "service" },- src: "^/support2/eve/v1/(.*)$",+ src: "^/eve/support2/v1/(.*)$",});});diff --git a/packages/eve/src/internal/vercel/build-agent-workspace.ts b/packages/eve/src/internal/vercel/build-agent-workspace.tsindex b217910b0..499a415e3 100644--- a/packages/eve/src/internal/vercel/build-agent-workspace.ts+++ b/packages/eve/src/internal/vercel/build-agent-workspace.ts@@ -21,7 +21,7 @@ function createMultiAgentSummary(workspace: AgentWorkspace): VercelEveMultiAgentreturn {agents: workspace.members.map((member) => ({name: member.name,- routePrefix: `/${member.name}`,+ routePrefix: `/eve/${member.name}`,summaryPath: relative(workspace.root,join(member.appRoot, VERCEL_EVE_AGENT_SUMMARY_OUTPUT_PATH),@@ -56,7 +56,7 @@ export async function buildAgentWorkspace(workspace: AgentWorkspace): Promise<sttoVercelRelativePath(member.appRoot, resolveEveBinaryPath(member.appRoot)),)} dev --no-ui`,name: member.name,- publicRoutePrefix: `/${member.name}`,+ publicRoutePrefix: `/eve/${member.name}`,workspaceMember: true,},target: {diff --git a/packages/eve/src/internal/vercel/eve-service-contribution.ts b/packages/eve/src/internal/vercel/eve-service-contribution.tsindex 90d7e8c6e..4bd6f7b33 100644--- a/packages/eve/src/internal/vercel/eve-service-contribution.ts+++ b/packages/eve/src/internal/vercel/eve-service-contribution.ts@@ -7,6 +7,7 @@ import {EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY_ENV,} from "#internal/application/build-output-environment.js";import { EVE_ROUTE_PREFIX } from "#protocol/routes.js";+import { joinEveRoutePath } from "#shared/eve-route-path.js";import {EVE_PUBLIC_ROUTE_PREFIX_ENV,normalizePublicRoutePrefix,@@ -74,7 +75,7 @@ function escapeVercelRouteLiteral(value: string): string {export function createEveServiceRouteSrc(publicRoutePrefix: string): string {if (publicRoutePrefix.length === 0) return `^${EVE_ROUTE_PREFIX}/(.*)$`;const prefix = publicRoutePrefix.startsWith("/") ? publicRoutePrefix : `/${publicRoutePrefix}`;- return `^${escapeVercelRouteLiteral(prefix)}${EVE_ROUTE_PREFIX}/(.*)$`;+ return `^${escapeVercelRouteLiteral(joinEveRoutePath(prefix, EVE_ROUTE_PREFIX))}/(.*)$`;}export function createEveRequestPathRoute(routeSrc: string): VercelRouteConfig {diff --git a/packages/eve/src/public/channels/eve.test.ts b/packages/eve/src/public/channels/eve.test.tsindex 654374c3b..d16e397f5 100644--- a/packages/eve/src/public/channels/eve.test.ts+++ b/packages/eve/src/public/channels/eve.test.ts@@ -1089,7 +1089,7 @@ describe("eveChannel — create session (text)", () => {callId: "call-1",subagentName: "research",token: "tok123",- url: "https://caller.example.com/eve/agents/support/eve/v1/callback/tok123",+ url: "https://caller.example.com/eve/support/v1/callback/tok123",},message: "hi",mode: "task",diff --git a/packages/eve/src/public/definitions/workspace-agent.test.ts b/packages/eve/src/public/definitions/workspace-agent.test.tsindex b595b1fd1..5ebfa4c77 100644--- a/packages/eve/src/public/definitions/workspace-agent.test.ts+++ b/packages/eve/src/public/definitions/workspace-agent.test.ts@@ -14,7 +14,7 @@ afterEach(() => {});describe("defineWorkspaceAgent", () => {- it("selects Vercel transport in a Vercel environment", async () => {+ it("selects the named workspace route in a Vercel environment", async () => {vi.stubEnv("VERCEL", "1");vi.stubEnv("VERCEL_ENV", "preview");vi.stubEnv("VERCEL_URL", "preview.example.com");@@ -22,7 +22,7 @@ describe("defineWorkspaceAgent", () => {expect(subagent).toMatchObject({ description: "", kind: "remote", path: "/eve/v1/session" });expect(await (subagent.url as () => Promise<string>)()).toBe(- "https://preview.example.com/research",+ "https://preview.example.com/eve/research",);await expect(subagent.auth?.()).resolves.toEqual({headers: {@@ -45,8 +45,8 @@ describe("defineWorkspaceAgent", () => {it.each([{- callerRoutePrefix: "/eve/agents/support",- expected: "http://localhost:3000/eve/agents/research",+ callerRoutePrefix: "/eve/support",+ expected: "http://localhost:3000/eve/research",environment: "development",host: "localhost:3000",},diff --git a/packages/eve/src/public/definitions/workspace-agent.ts b/packages/eve/src/public/definitions/workspace-agent.tsindex d37b8f850..bdf4ddae3 100644--- a/packages/eve/src/public/definitions/workspace-agent.ts+++ b/packages/eve/src/public/definitions/workspace-agent.ts@@ -60,7 +60,9 @@ function isBrandedWorkspaceSubagent(value: unknown): value is BrandedWorkspaceSufunction workspaceAgentRoutePrefix(name: string): string {const callerRoutePrefix = normalizePublicRoutePrefix(process.env.EVE_PUBLIC_ROUTE_PREFIX);- const namespace = callerRoutePrefix?.slice(0, callerRoutePrefix.lastIndexOf("/")) ?? "";+ const namespace =+ callerRoutePrefix?.slice(0, callerRoutePrefix.lastIndexOf("/")) ??+ (process.env.VERCEL_ENV === "development" ? "" : "/eve");return `${namespace}/${name}`;}diff --git a/packages/eve/src/public/next/index.integration.test.ts b/packages/eve/src/public/next/index.integration.test.tsindex a3151b9bc..0dcccf2c6 100644--- a/packages/eve/src/public/next/index.integration.test.ts+++ b/packages/eve/src/public/next/index.integration.test.ts@@ -310,29 +310,29 @@ describe("withEve Vercel config", () => {routes: expect.arrayContaining([expect.objectContaining({destination: { service: "eve-research", type: "service" },- src: "^/eve/agents/research/eve/v1/(.*)$",+ src: "^/eve/research/v1/(.*)$",}),expect.objectContaining({destination: { service: "eve-support", type: "service" },- src: "^/eve/agents/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",}),expect.objectContaining({destination: { service: "eve-research", type: "service" },- src: "^/eve/agents/research/?$",+ src: "^/eve/research/?$",}),expect.objectContaining({destination: { service: "eve-support", type: "service" },- src: "^/eve/agents/support/?$",+ src: "^/eve/support/?$",}),]),services: expect.objectContaining({"eve-research": expect.objectContaining({buildCommand: expect.stringContaining("EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1"),- routePrefix: "/eve/agents/research",+ routePrefix: "/eve/research",}),"eve-support": expect.objectContaining({buildCommand: expect.stringContaining("EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1"),- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",}),}),});@@ -400,25 +400,25 @@ describe("withEve Vercel config", () => {service: "eve-billing",type: "service",},- src: "^/eve/agents/billing/eve/v1/(.*)$",+ src: "^/eve/billing/v1/(.*)$",},{destination: {service: "eve-support",type: "service",},- src: "^/eve/agents/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",},],services: {"eve-billing": {buildCommand:- "cd '../../../agents/billing' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-billing/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/agents/billing' && pnpm build:billing-agent",+ "cd '../../../agents/billing' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-billing/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/billing' && pnpm build:billing-agent",framework: "eve",outputDirectory: ".vercel/output",routes: [{- src: "^/eve/agents/billing/eve/v1/(.*)$",+ src: "^/eve/billing/v1/(.*)$",transforms: [{args: "/eve/v1/$1",@@ -429,16 +429,16 @@ describe("withEve Vercel config", () => {},],root: ".eve/vercel-services/eve-billing",- routePrefix: "/eve/agents/billing",+ routePrefix: "/eve/billing",},"eve-support": {buildCommand:- "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/agents/support' && node 'node_modules/eve/bin/eve.js' build",+ "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/support' && node 'node_modules/eve/bin/eve.js' build",framework: "eve",outputDirectory: ".vercel/output",routes: [{- src: "^/eve/agents/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",transforms: [{args: "/eve/v1/$1",@@ -449,7 +449,7 @@ describe("withEve Vercel config", () => {},],root: ".eve/vercel-services/eve-support",- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",},},version: 3,@@ -474,7 +474,7 @@ describe("withEve Vercel config", () => {service: "eve-billing",type: "service",},- src: "^/eve/agents/billing/eve/v1/(.*)$",+ src: "^/eve/billing/v1/(.*)$",},{ handle: "filesystem" },],@@ -485,7 +485,7 @@ describe("withEve Vercel config", () => {framework: "eve",name: "eve-support",root: "agents/support",- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",schema: "experimentalServicesV2",},],@@ -519,26 +519,26 @@ describe("withEve Vercel config", () => {service: "eve-billing",type: "service",},- src: "^/eve/agents/billing/eve/v1/(.*)$",+ src: "^/eve/billing/v1/(.*)$",},{destination: {service: "eve-support",type: "service",},- src: "^/eve/agents/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",},{ handle: "filesystem" },],services: {"eve-billing": {buildCommand:- "cd '../../../agents/billing' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-billing/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/agents/billing' && node 'node_modules/eve/bin/eve.js' build",+ "cd '../../../agents/billing' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-billing/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/billing' && node 'node_modules/eve/bin/eve.js' build",framework: "eve",outputDirectory: ".vercel/output",routes: [{- src: "^/eve/agents/billing/eve/v1/(.*)$",+ src: "^/eve/billing/v1/(.*)$",transforms: [{args: "/eve/v1/$1",@@ -549,7 +549,7 @@ describe("withEve Vercel config", () => {},],root: ".eve/vercel-services/eve-billing",- routePrefix: "/eve/agents/billing",+ routePrefix: "/eve/billing",},"eve-support": {buildCommand: "eve build:support",@@ -557,7 +557,7 @@ describe("withEve Vercel config", () => {framework: "eve",routes: [{- src: "^/eve/agents/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",transforms: [{args: "/eve/v1/$1",@@ -568,7 +568,7 @@ describe("withEve Vercel config", () => {},],root: "agents/support",- routePrefix: "/eve/agents/support",+ routePrefix: "/eve/support",schema: "experimentalServicesV2",},},diff --git a/packages/eve/src/public/next/index.test.ts b/packages/eve/src/public/next/index.test.tsindex 4ce4ea433..4a5b6244e 100644--- a/packages/eve/src/public/next/index.test.ts+++ b/packages/eve/src/public/next/index.test.ts@@ -336,11 +336,11 @@ describe("withEve", () => {expect.arrayContaining([{destination: `https://agent.example.com${EVE_NEXT_SERVICE_PREFIX}/support/eve/v1/:path+`,- source: "/eve/agents/support/eve/v1/:path+",+ source: "/eve/support/v1/:path+",},{destination: "https://agent.example.com/_eve_internal/billing/eve/v1/:path+",- source: "/eve/agents/billing/eve/v1/:path+",+ source: "/eve/billing/v1/:path+",},]),);@@ -350,14 +350,14 @@ describe("withEve", () => {appRoot: expect.stringContaining("/agents/billing"),buildCommand: "pnpm build:billing-agent",name: "billing",- publicRoutePrefix: "/eve/agents/billing",+ publicRoutePrefix: "/eve/billing",servicePrefix: "/_eve_internal/billing",},{appRoot: expect.stringContaining("/agents/support"),buildCommand: "node 'node_modules/eve/bin/eve.js' build",name: "support",- publicRoutePrefix: "/eve/agents/support",+ publicRoutePrefix: "/eve/support",servicePrefix: `${EVE_NEXT_SERVICE_PREFIX}/support`,},],@@ -385,11 +385,11 @@ describe("withEve", () => {expect.arrayContaining([{destination: "http://127.0.0.1:4274/eve/v1/:path+",- source: "/eve/agents/billing/eve/v1/:path+",+ source: "/eve/billing/v1/:path+",},{destination: "http://127.0.0.1:4275/eve/v1/:path+",- source: "/eve/agents/support/eve/v1/:path+",+ source: "/eve/support/v1/:path+",},]),);@@ -405,7 +405,7 @@ describe("withEve", () => {await expect(config.rewrites?.()).resolves.toEqual(expect.objectContaining({beforeFiles: expect.arrayContaining([- expect.objectContaining({ source: "/eve/agents/support2/eve/v1/:path+" }),+ expect.objectContaining({ source: "/eve/support2/v1/:path+" }),]),}),);diff --git a/packages/eve/src/public/next/index.ts b/packages/eve/src/public/next/index.tsindex 651609256..64acc2574 100644--- a/packages/eve/src/public/next/index.ts+++ b/packages/eve/src/public/next/index.ts@@ -6,6 +6,7 @@ import { assertValidPublicAgentName } from "#internal/agent-name.js";import { findEveProjectContext } from "#internal/project-context.js";import { quoteVercelShellArgument, toVercelRelativePath } from "#internal/vercel/build-command.js";import { EVE_ROUTE_PREFIX } from "#protocol/routes.js";+import { joinEveRoutePath } from "#shared/eve-route-path.js";import { resolveEveBinaryPath } from "#shared/resolve-eve-binary.js";import { resolveEveDestinationPrefix } from "./server.js";import { ensureEveVercelOutputConfig } from "./vercel-output-config.js";@@ -19,7 +20,7 @@ export const EVE_NEXT_SERVICE_PREFIX = "/_eve_internal/eve";const EVE_NEXT_PRODUCTION_ORIGIN_ENV = "EVE_NEXT_PRODUCTION_ORIGIN";const EVE_NEXT_PRODUCTION_PORT_ENV = "EVE_NEXT_PRODUCTION_PORT";const DEFAULT_EVE_NEXT_PRODUCTION_PORT = 4274;-const EVE_NAMED_AGENT_ROUTE_PREFIX = "/eve/agents";+const EVE_NAMED_AGENT_ROUTE_PREFIX = "/eve";type ArrayElement<T> = T extends readonly (infer TElement)[] ? TElement : never;type NextRewrites = Awaited<ReturnType<NonNullable<NextConfig["rewrites"]>>>;@@ -115,7 +116,7 @@ export interface WithEveOptions {*/readonly eveRoot?: string;/**- * Named eve agents to mount under `/eve/agents/<name>/eve/v1/*`.+ * Named eve agents to mount under `/eve/<name>/v1/*`.** Use this when one Next.js app needs to talk to multiple eve agents outside* a project-level `agents/` workspace. When unset, withEve discovers that@@ -196,7 +197,7 @@ function createNamedAgentServicePrefix(basePrefix: string, name: string): string}function createAgentRewriteSource(publicRoutePrefix: string): string {- return joinRoutePrefix(publicRoutePrefix, `${EVE_ROUTE_PREFIX}/:path+`);+ return joinEveRoutePath(publicRoutePrefix, `${EVE_ROUTE_PREFIX}/:path+`);}function normalizeOrigin(origin: string): string {diff --git a/packages/eve/src/public/vercel/index.integration.test.ts b/packages/eve/src/public/vercel/index.integration.test.tsindex 27bb98f5e..c0a260eaf 100644--- a/packages/eve/src/public/vercel/index.integration.test.ts+++ b/packages/eve/src/public/vercel/index.integration.test.ts@@ -43,32 +43,38 @@ describe("withEve", () => {{ destination: { service: "web", type: "service" }, src: "^/api/(.*)$" },{destination: { service: "eve-research", type: "service" },- src: "^/research/eve/v1/(.*)$",+ src: "^/eve/research/v1/(.*)$",+ },+ {+ destination: { service: "eve-research", type: "service" },+ src: "^/eve/research/?$",+ },+ {+ destination: { service: "eve-support", type: "service" },+ src: "^/eve/support/v1/(.*)$",},- { destination: { service: "eve-research", type: "service" }, src: "^/research/?$" },{destination: { service: "eve-support", type: "service" },- src: "^/support/eve/v1/(.*)$",+ src: "^/eve/support/?$",},- { destination: { service: "eve-support", type: "service" }, src: "^/support/?$" },{ handle: "filesystem" },]);expect(config.services.web).toEqual({ framework: "nextjs", root: "apps/web" });expect(config.services["eve-support"]).toEqual({buildCommand:- "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' build",+ "cd '../../../agents/support' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='../../.eve/vercel-services/eve-support/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='../../.vercel/output' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' build",devCommand:- "cd '../../../agents/support' && export EVE_PUBLIC_ROUTE_PREFIX='/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' dev --no-ui",+ "cd '../../../agents/support' && export EVE_PUBLIC_ROUTE_PREFIX='/eve/support' && export EVE_INTERNAL_AGENT_WORKSPACE_MEMBER=1 && node 'node_modules/eve/bin/eve.js' dev --no-ui",framework: "eve",outputDirectory: ".vercel/output",root: ".eve/vercel-services/eve-support",routes: [{- src: "^/support/?$",+ src: "^/eve/support/?$",transforms: [{ args: "/", op: "set", type: "request.path" }],},{- src: "^/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",transforms: [{ args: "/eve/v1/$1", op: "set", type: "request.path" }],},],@@ -109,7 +115,17 @@ describe("withEve", () => {await expect(withEve({ services: { "eve-support": { framework: "nextjs" } } }, { root }),).rejects.toThrow(- 'Vercel service key "eve-support" conflicts with the service generated for eve workspace agent "support". Remove or rename the authored service; withEve owns this key.',+ 'Vercel service key "eve-support" conflicts with the service generated for eve agent "support". Remove or rename the authored service; withEve owns this key.',+ );+ });++ it("rejects authored eve services when composing a standalone agent", async () => {+ const root = await mkdtemp(join(tmpdir(), "eve-vercel-config-standalone-conflict-"));+ await writeFile(join(root, "package.json"), JSON.stringify({ dependencies: { eve: "*" } }));+ await mkdir(join(root, "agent"), { recursive: true });++ await expect(withEve({ services: { legacy: { framework: "eve" } } }, { root })).rejects.toThrow(+ 'Vercel service key "eve" conflicts with the service generated for eve agent "the default agent". Remove or rename the authored service; withEve owns this key.',);});@@ -117,9 +133,17 @@ describe("withEve", () => {const root = await createWorkspace();await expect(- withEve({ routes: [{ src: "^/support/eve/v1/(.*)$" }] }, { root }),+ withEve({ routes: [{ src: "^/eve/support/v1/(.*)$" }] }, { root }),).rejects.toThrow(- 'Vercel route "^/support/eve/v1/(.*)$" conflicts with the transport route generated for eve workspace agent "support". Remove the authored route; withEve adds it automatically.',+ 'Vercel route "^/eve/support/v1/(.*)$" conflicts with the route generated for eve agent "support". Remove the authored route; withEve adds it automatically.',+ );+ });++ it("rejects authored routes owned by generated agent home pages", async () => {+ const root = await createWorkspace();++ await expect(withEve({ routes: [{ src: "^/eve/support/?$" }] }, { root })).rejects.toThrow(+ 'Vercel route "^/eve/support/?$" conflicts with the route generated for eve agent "support". Remove the authored route; withEve adds it automatically.',);});@@ -157,11 +181,29 @@ describe("withEve", () => {);});- it("requires an eve workspace root", async () => {+ it("composes a standalone agent at the unprefixed protocol route", async () => {const root = await mkdtemp(join(tmpdir(), "eve-vercel-config-standalone-"));await writeFile(join(root, "package.json"), JSON.stringify({ dependencies: { eve: "*" } }));await mkdir(join(root, "agent"), { recursive: true });- await expect(withEve({}, { root })).rejects.toThrow(/workspace root/);+ const config = await withEve({}, { root });++ expect(config.routes).toEqual([+ { destination: { service: "eve", type: "service" }, src: "^/eve/v1/(.*)$" },+ ]);+ expect(config.services.eve).toEqual({+ buildCommand:+ "cd '../../..' && export EVE_INTERNAL_BUILD_OUTPUT_DIRECTORY='.eve/vercel-services/eve/.vercel/output' && export EVE_INTERNAL_HOST_BUILD_OUTPUT_DIRECTORY='.vercel/output' && node 'node_modules/eve/bin/eve.js' build",+ devCommand: "cd '../../..' && node 'node_modules/eve/bin/eve.js' dev --no-ui",+ framework: "eve",+ outputDirectory: ".vercel/output",+ root: ".eve/vercel-services/eve",+ routes: [+ {+ src: "^/eve/v1/(.*)$",+ transforms: [{ args: "/eve/v1/$1", op: "set", type: "request.path" }],+ },+ ],+ });});});diff --git a/packages/eve/src/public/vercel/index.ts b/packages/eve/src/public/vercel/index.tsindex a3cce15d7..fd841b59c 100644--- a/packages/eve/src/public/vercel/index.ts+++ b/packages/eve/src/public/vercel/index.ts@@ -5,6 +5,7 @@ import { resolveEveProjectContext } from "#internal/project-context.js";import { assembleEveVercelServices } from "#internal/vercel/assemble-eve-services.js";import { quoteVercelShellArgument, toVercelRelativePath } from "#internal/vercel/build-command.js";import {+ createEveHomeRouteSrc,createEveServiceName,createEveServiceRouteSrc,} from "#internal/vercel/eve-service-contribution.js";@@ -57,7 +58,10 @@ function toInternalConfig(config: EveVercelConfig): VercelServicesConfig {return config as VercelServicesConfig;}-function assertComposableConfig(config: EveVercelConfig, agentNames: readonly string[]): void {+function assertComposableConfig(+ config: EveVercelConfig,+ agentNames: readonly (string | undefined)[],+): void {if (config.experimentalServices !== undefined || config.experimentalServicesV2 !== undefined) {throw new Error("withEve cannot compose experimentalServices or experimentalServicesV2. Remove the obsolete field and define authored services under services.",@@ -67,24 +71,34 @@ function assertComposableConfig(config: EveVercelConfig, agentNames: readonly stconst internalConfig = toInternalConfig(config);const services = createServiceConfigRecord(internalConfig.services);for (const name of agentNames) {+ const agentLabel = JSON.stringify(name ?? "the default agent");const serviceName = createEveServiceName(name);- if (Object.hasOwn(services, serviceName)) {+ if (+ Object.hasOwn(services, serviceName) ||+ (name === undefined && Object.values(services).some((service) => service.framework === "eve"))+ ) {throw new Error(- `Vercel service key ${JSON.stringify(serviceName)} conflicts with the service generated for eve workspace agent ${JSON.stringify(name)}. Remove or rename the authored service; withEve owns this key.`,+ `Vercel service key ${JSON.stringify(serviceName)} conflicts with the service generated for eve agent ${agentLabel}. Remove or rename the authored service; withEve owns this key.`,);}- const routeSrc = createEveServiceRouteSrc(`/${name}`);- if (config.routes?.some((route) => route.src === routeSrc)) {- throw new Error(- `Vercel route ${JSON.stringify(routeSrc)} conflicts with the transport route generated for eve workspace agent ${JSON.stringify(name)}. Remove the authored route; withEve adds it automatically.`,- );+ const publicRoutePrefix = name === undefined ? "" : `/eve/${name}`;+ const routeSources = [+ createEveServiceRouteSrc(publicRoutePrefix),+ createEveHomeRouteSrc(publicRoutePrefix),+ ].filter((routeSrc): routeSrc is string => routeSrc !== undefined);+ for (const routeSrc of routeSources) {+ if (config.routes?.some((route) => route.src === routeSrc)) {+ throw new Error(+ `Vercel route ${JSON.stringify(routeSrc)} conflicts with the route generated for eve agent ${agentLabel}. Remove the authored route; withEve adds it automatically.`,+ );+ }}}}/**- * Add a hostless eve workspace's generated agent services and transport routes to `vercel.ts`.+ * Add an eve project's generated agent services and transport routes to `vercel.ts`.** The returned object is a plain Vercel configuration. Vercel resolves it before independently* building the authored services and each generated eve agent service.@@ -101,39 +115,54 @@ export async function withEve<TConfig extends EveVercelConfig>(const requestedRoot = resolve(options.root ?? process.cwd());const context = await resolveEveProjectContext(requestedRoot);if (- context.kind !== "workspace" ||- (options.root !== undefined && context.workspace.root !== requestedRoot)+ context.kind === "workspace-member" ||+ (options.root !== undefined && context.environmentRoot !== requestedRoot)) {- throw new Error(`withEve must run at an eve workspace root; received ${requestedRoot}.`);+ throw new Error(`withEve must run at an eve project root; received ${requestedRoot}.`);}-- const { workspace } = context;- const root = workspace.root;- if (workspace.members.length === 0) {+ const root = context.environmentRoot;++ const agents =+ context.kind === "standalone"+ ? [+ {+ appRoot: context.appRoot,+ name: undefined,+ publicRoutePrefix: "",+ workspaceMember: false,+ },+ ]+ : context.workspace.members.map((member) => ({+ appRoot: member.appRoot,+ name: member.name,+ publicRoutePrefix: `/eve/${member.name}`,+ workspaceMember: true,+ }));+ if (agents.length === 0) {throw new Error(`withEve found no workspace agents under ${join(root, "agents")}. Add an agent or remove withEve from vercel.ts.`,);}- const agentNames = workspace.members.map((member) => member.name);+ const agentNames = agents.map((agent) => agent.name);const generatedServiceNames = new Set(agentNames.map(createEveServiceName));assertComposableConfig(config, agentNames);const outputDirectory = join(root, ".vercel", "output");const internalConfig = toInternalConfig(config);const assembled = assembleEveVercelServices({- agents: workspace.members.map((member) => ({+ agents: agents.map((agent) => ({agent: {- appRoot: member.appRoot,+ appRoot: agent.appRoot,buildCommand: `node ${quoteVercelShellArgument(- toVercelRelativePath(member.appRoot, resolveEveBinaryPath(member.appRoot)),+ toVercelRelativePath(agent.appRoot, resolveEveBinaryPath(agent.appRoot)),)} build`,devCommand: `node ${quoteVercelShellArgument(- toVercelRelativePath(member.appRoot, resolveEveBinaryPath(member.appRoot)),+ toVercelRelativePath(agent.appRoot, resolveEveBinaryPath(agent.appRoot)),)} dev --no-ui`,- name: member.name,- publicRoutePrefix: `/${member.name}`,- workspaceMember: true,+ name: agent.name,+ publicRoutePrefix: agent.publicRoutePrefix,+ workspaceMember: agent.workspaceMember,},target: {hostOutputDirectory: outputDirectory,diff --git a/packages/eve/src/react/use-eve-agent.test.ts b/packages/eve/src/react/use-eve-agent.test.tsindex 12fe1fc6c..30e1ef2c1 100644--- a/packages/eve/src/react/use-eve-agent.test.ts+++ b/packages/eve/src/react/use-eve-agent.test.ts@@ -435,9 +435,9 @@ describe("useEveAgent", () => {await sendPromise;});- expect(fetchMock.mock.calls[0]?.[0]).toBe("/eve/agents/support/eve/v1/session");+ expect(fetchMock.mock.calls[0]?.[0]).toBe("/eve/support/v1/session");expect(fetchMock.mock.calls[1]?.[0]).toBe(- "/eve/agents/support/eve/v1/session/session_1/stream?streamControlVersion=1",+ "/eve/support/v1/session/session_1/stream?streamControlVersion=1",);});diff --git a/packages/eve/src/react/use-eve-agent.ts b/packages/eve/src/react/use-eve-agent.tsindex 00481c992..accc7e07e 100644--- a/packages/eve/src/react/use-eve-agent.ts+++ b/packages/eve/src/react/use-eve-agent.ts@@ -80,7 +80,7 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>* Named agent mounted by a framework integration such as `withEve({ agents })`.** `agent: "support"` targets same-origin routes under- * `/eve/agents/support/eve/v1/...`. Do not combine with `host`.+ * `/eve/support/v1/...`. Do not combine with `host`.*/readonly agent?: string;readonly auth?: ClientAuth;diff --git a/packages/eve/src/shared/eve-route-path.test.ts b/packages/eve/src/shared/eve-route-path.test.tsnew file mode 100644index 000000000..27d9092aa--- /dev/null+++ b/packages/eve/src/shared/eve-route-path.test.ts@@ -0,0 +1,32 @@+import { describe, expect, it } from "vitest";++import { joinEveRoutePath, normalizePublicEveRoutePath } from "#shared/eve-route-path.js";++describe("joinEveRoutePath", () => {+ it("maps an internal route onto a compact named-agent mount", () => {+ expect(joinEveRoutePath("/eve/support", "/eve/v1/session")).toBe("/eve/support/v1/session");+ });++ it("appends an internal route to ordinary mounts unchanged", () => {+ expect(joinEveRoutePath("/api/support", "/eve/v1/session")).toBe("/api/support/eve/v1/session");+ });++ it("does not duplicate the protocol base", () => {+ expect(joinEveRoutePath("/eve/support/v1", "/eve/v1/session")).toBe("/eve/support/v1/session");+ });+});++describe("normalizePublicEveRoutePath", () => {+ it("maps a compact named-agent route to its internal route", () => {+ expect(normalizePublicEveRoutePath("/eve/support/v1/callback/token")).toBe(+ "/eve/v1/callback/token",+ );+ });++ it("preserves ordinary and internal routes", () => {+ expect(normalizePublicEveRoutePath("/api/support/v1/callback/token")).toBe(+ "/api/support/v1/callback/token",+ );+ expect(normalizePublicEveRoutePath("/eve/v1/callback/token")).toBe("/eve/v1/callback/token");+ });+});diff --git a/packages/eve/src/shared/eve-route-path.ts b/packages/eve/src/shared/eve-route-path.tsnew file mode 100644index 000000000..a79694548--- /dev/null+++ b/packages/eve/src/shared/eve-route-path.ts@@ -0,0 +1,29 @@+import { EVE_ROUTE_PREFIX } from "#protocol/routes.js";++const EVE_NAMED_AGENT_MOUNT_PATTERN = /^\/eve\/[a-z0-9][a-z0-9_-]*$/;+const EVE_NAMED_AGENT_PROTOCOL_PATTERN = /^\/eve\/[a-z0-9][a-z0-9_-]*\/v1$/;++/** Joins an internal eve route to a public target, including compact named-agent mounts. */+export function joinEveRoutePath(basePath: string, routePath: string): string {+ const base = trimTrailingSlash(basePath);+ const route = routePath.startsWith("/") ? routePath : `/${routePath}`;+ if (route === EVE_ROUTE_PREFIX || route.startsWith(`${EVE_ROUTE_PREFIX}/`)) {+ if (EVE_NAMED_AGENT_MOUNT_PATTERN.test(base)) {+ return `${base}${route.slice("/eve".length)}`;+ }+ if (EVE_NAMED_AGENT_PROTOCOL_PATTERN.test(base)) {+ return `${base}${route.slice(EVE_ROUTE_PREFIX.length)}`;+ }+ }+ return `${base}${route}`;+}++/** Maps a compact named-agent route back to the internal eve protocol namespace. */+export function normalizePublicEveRoutePath(path: string): string {+ return path.replace(/^\/eve\/[a-z0-9][a-z0-9_-]*\/v1(?=\/|$)/, EVE_ROUTE_PREFIX);+}++function trimTrailingSlash(value: string): string {+ if (value === "/") return "";+ return value.endsWith("/") ? value.slice(0, -1) : value;+}diff --git a/packages/eve/src/shared/public-route-prefix.test.ts b/packages/eve/src/shared/public-route-prefix.test.tsindex e35d6ace6..882055fef 100644--- a/packages/eve/src/shared/public-route-prefix.test.ts+++ b/packages/eve/src/shared/public-route-prefix.test.ts@@ -12,15 +12,15 @@ describe("normalizePublicRoutePrefix", () => {});it("adds the leading slash", () => {- expect(normalizePublicRoutePrefix("eve/agents/support")).toBe("/eve/agents/support");+ expect(normalizePublicRoutePrefix("eve/support")).toBe("/eve/support");});it("strips trailing slashes", () => {- expect(normalizePublicRoutePrefix("/eve/agents/support/")).toBe("/eve/agents/support");- expect(normalizePublicRoutePrefix("/eve/agents/support//")).toBe("/eve/agents/support");+ expect(normalizePublicRoutePrefix("/eve/support/")).toBe("/eve/support");+ expect(normalizePublicRoutePrefix("/eve/support//")).toBe("/eve/support");});it("keeps an already-normalized prefix unchanged", () => {- expect(normalizePublicRoutePrefix("/eve/agents/support")).toBe("/eve/agents/support");+ expect(normalizePublicRoutePrefix("/eve/support")).toBe("/eve/support");});});diff --git a/packages/eve/src/shared/public-route-prefix.ts b/packages/eve/src/shared/public-route-prefix.tsindex 683226939..5597fc5bc 100644--- a/packages/eve/src/shared/public-route-prefix.ts+++ b/packages/eve/src/shared/public-route-prefix.ts@@ -3,7 +3,7 @@* `/eve/v1/*` transport surface is mounted under on its callback origin.** Multi-agent host integrations mount each named agent under- * `/eve/agents/<name>/eve/v1/*` and strip that prefix before requests reach+ * `/eve/<name>/v1/*` and strip that prefix before requests reach* the eve service, so a running agent cannot recover its own public mount* from an inbound request. The integration exports this variable in the* generated service build command, the eve CLI resolves it once into thediff --git a/packages/eve/src/subagents/remote-dispatch.test.ts b/packages/eve/src/subagents/remote-dispatch.test.tsindex 060044494..8d9dad179 100644--- a/packages/eve/src/subagents/remote-dispatch.test.ts+++ b/packages/eve/src/subagents/remote-dispatch.test.ts@@ -468,7 +468,7 @@ describe("startRemoteAgentSession", () => {callbackBaseUrl: "https://caller.example.com",remote: {...createRemoteAgent(),- url: "https://remote.example.com/eve/agents/researcher",+ url: "https://remote.example.com/eve/researcher",},session: {agent: { modelReference: { id: "mock/test" }, system: "", tools: [] },@@ -480,7 +480,7 @@ describe("startRemoteAgentSession", () => {});expect(fetchMock).toHaveBeenCalledWith(- "https://remote.example.com/eve/agents/researcher/eve/v1/session",+ "https://remote.example.com/eve/researcher/v1/session",expect.objectContaining({ method: "POST" }),);});@@ -1189,14 +1189,14 @@ describe("cancelRemoteAgentTurn", () => {cancelRemoteAgentTurn({remote: {...createRemoteAgent(),- url: "https://remote.example.com/eve/agents/researcher/",+ url: "https://remote.example.com/eve/researcher/",},sessionId: "remote/session id",}),).resolves.toEqual({ sessionId: "remote/session id", status: "accepted" });expect(fetchMock).toHaveBeenCalledWith(- "https://remote.example.com/eve/agents/researcher/eve/v1/session/remote%2Fsession%20id/cancel",+ "https://remote.example.com/eve/researcher/v1/session/remote%2Fsession%20id/cancel",expect.objectContaining({ method: "POST" }),);});@@ -1265,7 +1265,7 @@ describe("resetRemoteAgentSession", () => {resetRemoteAgentSession({remote: {...createRemoteAgent(),- url: "https://remote.example.com/eve/agents/researcher/",+ url: "https://remote.example.com/eve/researcher/",},sessionId: "remote/session id",}),@@ -1275,7 +1275,7 @@ describe("resetRemoteAgentSession", () => {status: "reset",});expect(fetchMock).toHaveBeenCalledWith(- "https://remote.example.com/eve/agents/researcher/eve/v1/session/remote%2Fsession%20id/reset",+ "https://remote.example.com/eve/researcher/v1/session/remote%2Fsession%20id/reset",{body: JSON.stringify({ reason: "Parent session ended" }),headers: {diff --git a/packages/eve/src/subagents/remote-route-url.test.ts b/packages/eve/src/subagents/remote-route-url.test.tsindex dd3e48f31..f1ece0084 100644--- a/packages/eve/src/subagents/remote-route-url.test.ts+++ b/packages/eve/src/subagents/remote-route-url.test.ts@@ -6,9 +6,9 @@ describe("createRemoteAgentRouteUrl", () => {it("preserves a mounted remote agent base path", () => {expect(createRemoteAgentRouteUrl(- "https://remote.example/eve/agents/researcher",+ "https://remote.example/eve/researcher","/eve/v1/task-input/capability",),- ).toBe("https://remote.example/eve/agents/researcher/eve/v1/task-input/capability");+ ).toBe("https://remote.example/eve/researcher/v1/task-input/capability");});});diff --git a/packages/eve/src/subagents/remote-route-url.ts b/packages/eve/src/subagents/remote-route-url.tsindex 73c864fbb..e0ed0e4a5 100644--- a/packages/eve/src/subagents/remote-route-url.ts+++ b/packages/eve/src/subagents/remote-route-url.ts@@ -1,8 +1,11 @@+import { joinEveRoutePath } from "#shared/eve-route-path.js";+/** Joins an eve route to a remote agent base URL without dropping its path prefix. */export function createRemoteAgentRouteUrl(baseUrl: string, routePath: string): string {- return new URL(routePath.replace(/^\/+/, ""), `${trimTrailingSlash(baseUrl)}/`).toString();-}--function trimTrailingSlash(value: string): string {- return value.endsWith("/") ? value.slice(0, -1) : value;+ const route = new URL(routePath, "http://eve.local");+ const url = new URL(baseUrl);+ url.pathname = joinEveRoutePath(url.pathname, route.pathname);+ url.search = route.search;+ url.hash = route.hash;+ return url.toString();}diff --git a/packages/eve/src/svelte/use-eve-agent.ts b/packages/eve/src/svelte/use-eve-agent.tsindex f7abc8f3a..437290e34 100644--- a/packages/eve/src/svelte/use-eve-agent.ts+++ b/packages/eve/src/svelte/use-eve-agent.ts@@ -92,7 +92,7 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>* Named agent mounted by a framework integration such as `withEve({ agents })`.** `agent: "support"` targets same-origin routes under- * `/eve/agents/support/eve/v1/...`. Do not combine with `host`.+ * `/eve/support/v1/...`. Do not combine with `host`.*/readonly agent?: string;/**diff --git a/packages/eve/src/vue/use-eve-agent.ts b/packages/eve/src/vue/use-eve-agent.tsindex 97fd1bfbb..8ef130961 100644--- a/packages/eve/src/vue/use-eve-agent.ts+++ b/packages/eve/src/vue/use-eve-agent.ts@@ -94,7 +94,7 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>* Named agent mounted by a framework integration such as `withEve({ agents })`.** `agent: "support"` targets same-origin routes under- * `/eve/agents/support/eve/v1/...`. Do not combine with `host`.+ * `/eve/support/v1/...`. Do not combine with `host`.*/readonly agent?: string;/** Authentication configuration; a function value is resolved per request. */diff --git a/packages/eve/test/scenarios/framework-next-build.scenario.test.ts b/packages/eve/test/scenarios/framework-next-build.scenario.test.tsindex 7aa8252da..31dbc9b80 100644--- a/packages/eve/test/scenarios/framework-next-build.scenario.test.ts+++ b/packages/eve/test/scenarios/framework-next-build.scenario.test.ts@@ -189,11 +189,11 @@ describe("framework-next build", () => {expect.arrayContaining([{ path: "/api/user-cleanup", schedule: "0 0 * * *" },{- path: expect.stringMatching(/^\/eve\/agents\/billing\/eve\/v1\/cron\/[A-Za-z0-9_-]+$/),+ path: expect.stringMatching(/^\/eve\/billing\/v1\/cron\/[A-Za-z0-9_-]+$/),schedule: "*/10 * * * *",},{- path: expect.stringMatching(/^\/eve\/agents\/support\/eve\/v1\/cron\/[A-Za-z0-9_-]+$/),+ path: expect.stringMatching(/^\/eve\/support\/v1\/cron\/[A-Za-z0-9_-]+$/),schedule: "*/5 * * * *",},]),diff --git a/packages/eve/test/scenarios/hostless-agent-workspace.scenario.test.ts b/packages/eve/test/scenarios/hostless-agent-workspace.scenario.test.tsindex 4abcbd479..42efeaa7d 100644--- a/packages/eve/test/scenarios/hostless-agent-workspace.scenario.test.ts+++ b/packages/eve/test/scenarios/hostless-agent-workspace.scenario.test.ts@@ -48,11 +48,11 @@ describe("hostless agent workspace", () => {expect.arrayContaining([expect.objectContaining({destination: { service: "eve-support", type: "service" },- src: "^/support/eve/v1/(.*)$",+ src: "^/eve/support/v1/(.*)$",}),expect.objectContaining({destination: { service: "eve-research", type: "service" },- src: "^/research/eve/v1/(.*)$",+ src: "^/eve/research/v1/(.*)$",}),]),);