Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): reject workspace Web Chat installs (#3059)

OwenKephart468f1b21ba88
diff --git a/.changeset/reject-workspace-web-chat.md b/.changeset/reject-workspace-web-chat.md
new file mode 100644
index 000000000..874d63562
--- /dev/null
+++ b/.changeset/reject-workspace-web-chat.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Reject `eve add channel/web` before it writes files when the selected agent belongs to a top-level `agents/` workspace. The error directs users to configure a root Next.js app with `withEve({ agents })` instead.
diff --git a/docs/install-integrations.mdx b/docs/install-integrations.mdx
index 7946582ef..9e5eb69b7 100644
--- a/docs/install-integrations.mdx
+++ b/docs/install-integrations.mdx
@@ -19,6 +19,8 @@ eve add memory/file
If an item is not found, `eve add` searches the available catalogs and prints close matches without installing anything.
+Web Chat installs a project-level Next.js application and cannot currently be added to a top-level `agents/` workspace. For that topology, create a root Next.js application and configure [`withEve({ agents })`](./guides/frontend/nextjs) instead. eve rejects `eve add channel/web` before writing files when the selected agent belongs to such a workspace.
+
If you do not know an item name yet, run `eve add` without an argument. Its help output shows how to search the registry with `eve registry search <query>`.
Extensions may create a mount under `agent/extensions/`. Connections write their initial definition under `agent/connections/` and install `@vercel/connect` when required. Instrumentation providers write `agent/instrumentation.ts`; because an agent has one instrumentation file, compose multiple exporters there by hand. Configure generated files and required environment variables before running your agent.
diff --git a/packages/eve/src/cli/commands/registry-project.ts b/packages/eve/src/cli/commands/registry-project.ts
index fb867b462..dba1c0434 100644
--- a/packages/eve/src/cli/commands/registry-project.ts
+++ b/packages/eve/src/cli/commands/registry-project.ts
@@ -85,6 +85,13 @@ function parseRegistryMapping(argument: string): { namespace: string; url: strin
return { namespace, url };
}
+export async function assertCanInstallWebChat(appRoot: string): Promise<void> {
+ if ((await resolveEveProjectContext(appRoot)).kind === "standalone") return;
+ throw new Error(
+ "Web Chat installs a project-level Next.js application and cannot currently be added to a top-level agents/ workspace. Configure a root Next.js app with withEve({ agents }) instead.",
+ );
+}
+
/** Reads registry namespace mappings from package.json. */
export async function readRegistryConfig(appRoot: string): Promise<RegistryConfig> {
return (await readRegistryPackage(appRoot)).config;
diff --git a/packages/eve/src/cli/commands/registry.test.ts b/packages/eve/src/cli/commands/registry.test.ts
index 466c0d40a..746089be4 100644
--- a/packages/eve/src/cli/commands/registry.test.ts
+++ b/packages/eve/src/cli/commands/registry.test.ts
@@ -447,6 +447,29 @@ describe("registry commands", () => {
expect(process.exitCode).toBe(2);
});
+ it("rejects Web Chat before it can write into an agent workspace member", async () => {
+ const logger = createLogger();
+ const appRoot = "/project/agents/support";
+ resolveEveProjectContext.mockResolvedValueOnce({
+ environmentRoot: "/project",
+ kind: "workspace-member",
+ member: { appRoot, name: "support" },
+ workspace: {
+ root: "/project",
+ members: [{ appRoot, name: "support" }],
+ },
+ });
+
+ await runAddCommand(logger, appRoot, "channel/web", {});
+
+ expect(logger.errors).toEqual([
+ "Web Chat installs a project-level Next.js application and cannot currently be added to a top-level agents/ workspace. Configure a root Next.js app with withEve({ agents }) instead.",
+ ]);
+ expect(getRegistryItems).not.toHaveBeenCalled();
+ expect(addRegistryItems).not.toHaveBeenCalled();
+ expect(process.exitCode).toBe(1);
+ });
+
it("surfaces required deployment in non-interactive completion", async () => {
const logger = createLogger();
const runSetupCommand = vi.fn(async () => ({
diff --git a/packages/eve/src/cli/commands/registry.ts b/packages/eve/src/cli/commands/registry.ts
index 09fbc383b..96162d1cd 100644
--- a/packages/eve/src/cli/commands/registry.ts
+++ b/packages/eve/src/cli/commands/registry.ts
@@ -40,6 +40,7 @@ import type { runRegistrySetupCommand } from "./registry-setup-command.js";
import { serializeHeadlessSetupEvent } from "./setup-headless.js";
import {
addRegistryMappings,
+ assertCanInstallWebChat,
prepareWebRegistryProject,
readRegistryConfig,
} from "./registry-project.js";
@@ -149,12 +150,10 @@ const CATALOG_PAGE_SIZE = 100;
const DEFAULT_SEARCH_LIMIT = 10;
const ADD_SUGGESTION_LIMIT = 5;
-function isRegistryAddress(value: string): boolean {
- return value.startsWith("@") || /^https?:\/\//.test(value);
-}
-
function itemAddress(item: string): string {
- return isRegistryAddress(item) ? item : `${OFFICIAL_REGISTRY}/${item}.json`;
+ return item.startsWith("@") || /^https?:\/\//.test(item)
+ ? item
+ : `${OFFICIAL_REGISTRY}/${item}.json`;
}
/** Installs an official registry item without running its declared setup command. */
@@ -203,7 +202,7 @@ function configuredRegistrySources(config: RegistryConfig): string[] {
}
function validateRegistrySource(source: string | undefined): void {
- if (source !== undefined && !isRegistryAddress(source)) {
+ if (source !== undefined && !source.startsWith("@") && !/^https?:\/\//.test(source)) {
throw new Error(`Registry sources must be a namespace or URL: ${source}`);
}
}
@@ -462,8 +461,9 @@ export async function runAddCommand(
dependencies: AddCommandDependencies = defaultAddCommandDependencies,
): Promise<RegistrySetupCompletion | false | undefined> {
return runRegistryAction(logger, appRoot, async () => {
- const config = await readEveRegistryConfig(appRoot);
const address = itemAddress(item);
+ if (address === itemAddress("channel/web")) await assertCanInstallWebChat(appRoot);
+ const config = await readEveRegistryConfig(appRoot);
if (options.skipInstall === true) {
if (options.overwrite === true) {
throw new Error("--overwrite cannot be used with --skip-install.");