The Open Framework for Building Agents
fix(eve): report unresolved extension mounts instead of an unused binding (#4037)
roboeve[bot]0e6bc96efb5c
diff --git a/.changeset/unresolved-extension-mount-diagnostic.md b/.changeset/unresolved-extension-mount-diagnostic.mdnew file mode 100644index 000000000..b74dbef9a--- /dev/null+++ b/.changeset/unresolved-extension-mount-diagnostic.md@@ -0,0 +1,5 @@+---+"eve": patch+---++`eve build` now reports why an extension mount failed to resolve, for example an extension that requires an unsupported tool contract or a package that isn't installed. Before, the build stopped with `Selected module binding "extensions/<name>.ts" has no compile or runtime usage.` and hid the cause.diff --git a/packages/eve/src/compiler/mounted-extension.integration.test.ts b/packages/eve/src/compiler/mounted-extension.integration.test.tsindex c049b126d..673a277d6 100644--- a/packages/eve/src/compiler/mounted-extension.integration.test.ts+++ b/packages/eve/src/compiler/mounted-extension.integration.test.ts@@ -4,6 +4,7 @@ import { join } from "node:path";import { describe, expect, it } from "vitest";import { compileAgent } from "#compiler/compile-agent.js";+import { EXTENSION_CAPABILITY_VERSIONS } from "#compiler/extension-compatibility.js";import { ContextContainer, contextStorage } from "#context/container.js";import { deserializeContext, serializeContext } from "#context/serialize.js";import { ROOT_COMPILED_AGENT_NODE_ID } from "#compiler/manifest.js";@@ -552,6 +553,39 @@ describe("mounted extension without config", () => {});});+describe("mounted extension with an unsupported capability contract", () => {+ it("fails compilation with the capability diagnostic", async () => {+ // One past the current epoch is unsupported by construction.+ const unsupportedToolVersion = EXTENSION_CAPABILITY_VERSIONS.tool + 1;+ const app = await createAppRoot("eve-mounted-extension-incompatible-", {+ files: {+ "agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',+ "agent/instructions.md": "You are a precise assistant.\n",+ "agent/extensions/widget.mjs": 'export { default } from "@acme/widget";\n',+ "node_modules/@acme/widget/package.json": `${JSON.stringify({+ name: "@acme/widget",+ type: "module",+ eve: { extension: { source: "source", dist: "extension" } },+ exports: { ".": "./extension/extension.mjs" },+ })}\n`,+ "node_modules/@acme/widget/extension/_manifest.json": compatibilityManifest({+ extension: 1,+ tool: unsupportedToolVersion,+ }),+ "node_modules/@acme/widget/extension/extension.mjs": [+ 'import { defineExtension } from "eve/extension";',+ "export default defineExtension();",+ "",+ ].join("\n"),+ },+ });++ await expect(compileAgent({ startPath: app.appRoot })).rejects.toThrow(+ `Extension "@acme/widget" requires tool contract v${unsupportedToolVersion}`,+ );+ });+});+/*** The directory mount form with a co-located override slot. The extension's own* tools compose and bind config, while a consumer override of the same namediff --git a/packages/eve/src/compiler/project-sources.ts b/packages/eve/src/compiler/project-sources.tsindex 7211daa4f..860d8bc50 100644--- a/packages/eve/src/compiler/project-sources.ts+++ b/packages/eve/src/compiler/project-sources.ts@@ -347,7 +347,12 @@ function projectManifest(input: {canonicalSourceSlot(logicalPath) === "agent" ? undefined : "agent.ts",);}+ const resolvedNamespaces = new Set(+ input.manifest.resolvedExtensions.map((mount) => mount.namespace),+ );for (const source of input.manifest.extensions) {+ // An unresolved mount already failed discovery; binding its declaration would mask that error.+ if (!resolvedNamespaces.has(mountRefNamespace(source.logicalPath))) continue;pushModule(source, undefined, input.declarationMountIds?.get(source.sourceId));}for (const source of input.manifest.channels) pushModule(source);