The Open Framework for Building Agents
feat(eve): record logical extension mount identities (#3968)
prha0e0fa1b25323
diff --git a/.changeset/mount-identity-metadata.md b/.changeset/mount-identity-metadata.mdnew file mode 100644index 000000000..5d0bfa818--- /dev/null+++ b/.changeset/mount-identity-metadata.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Record canonical logical mount identities in compiled extension metadata and contribution ownership. Flat and directory mounts share an identity, while mounts in different subagents retain distinct paths; this does not yet change extension configuration or state isolation.diff --git a/packages/eve/src/cli/dev/tui/prompt-placeholder.test.ts b/packages/eve/src/cli/dev/tui/prompt-placeholder.test.tsindex 2a953a040..a86bc922b 100644--- a/packages/eve/src/cli/dev/tui/prompt-placeholder.test.ts+++ b/packages/eve/src/cli/dev/tui/prompt-placeholder.test.ts@@ -45,7 +45,12 @@ function scaffold(): AgentInfoResult {local: [{...info.agent.config,- owner: { kind: "extension", namespace: "self-modification", packageName: "eve" },+ owner: {+ kind: "extension",+ mountId: "extensions/self-modification",+ namespace: "self-modification",+ packageName: "eve",+ },name: "self-modification__agent",entryPath: "subagents/agent/agent.ts",rootPath: "/eve/self-modification",@@ -144,6 +149,7 @@ describe("initialPromptPlaceholder", () => {? {owner: {kind: "extension" as const,+ mountId: "extensions/orders",packageName: "@acme/orders",namespace: "orders",},diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex c82b22e0b..6c90c54da 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -1883,6 +1883,7 @@ describe("TerminalRenderer (inline scrollback)", () => {...info.agent.config,owner: {kind: "extension" as const,+ mountId: "extensions/self-modification",namespace: "self-modification",packageName: "eve",},diff --git a/packages/eve/src/client/agent-info-schema.ts b/packages/eve/src/client/agent-info-schema.tsindex 98b5407bf..a0a796dd7 100644--- a/packages/eve/src/client/agent-info-schema.ts+++ b/packages/eve/src/client/agent-info-schema.ts@@ -1,10 +1,16 @@import { z } from "#compiled/zod/index.js";+import { mountIdSchema } from "#shared/extension-mount.js";const owner = z.discriminatedUnion("kind", [z.object({ kind: z.literal("application") }).strict(),z.object({ feature: z.string(), kind: z.literal("framework") }).strict(),z- .object({ kind: z.literal("extension"), namespace: z.string(), packageName: z.string() })+ .object({+ kind: z.literal("extension"),+ mountId: mountIdSchema,+ namespace: z.string(),+ packageName: z.string(),+ }).strict(),]);diff --git a/packages/eve/src/client/client.test.ts b/packages/eve/src/client/client.test.tsindex 22163b1da..c7bedfa65 100644--- a/packages/eve/src/client/client.test.ts+++ b/packages/eve/src/client/client.test.ts@@ -244,6 +244,41 @@ describe("Client request policy", () => {expect(info.tools.static[0]).not.toHaveProperty("outputSchema");});+ it.each(["extensions/crm", ""])(+ "validates extension mount identity %j in agent info",+ async (mountId) => {+ const owner = {+ kind: "extension" as const,+ mountId,+ namespace: "crm",+ packageName: "@acme/crm",+ };+ const instructions = {+ content: "Review customer requests.",+ logicalPath: "instructions/crm.md",+ name: "crm",+ owner,+ role: "system",+ sourceId: "ext:crm:instructions.md",+ sourceKind: "markdown",+ };+ vi.spyOn(globalThis, "fetch").mockResolvedValue(+ Response.json({+ ...AGENT_INFO,+ instructions: { ...AGENT_INFO.instructions, static: [instructions] },+ }),+ );+ const client = new Client({ host: "https://eve.test" });++ if (mountId === "") {+ await expect(client.info()).rejects.toThrow(AgentInfoResponseError);+ } else {+ const info = await client.info();+ expect(info.instructions.static[0]?.owner).toEqual(owner);+ }+ },+ );+it("accepts the legacy optional instrumentation field in v4 agent info", async () => {const owner = { kind: "application" as const };vi.spyOn(globalThis, "fetch").mockResolvedValue(diff --git a/packages/eve/src/compiler/development-extensions.integration.test.ts b/packages/eve/src/compiler/development-extensions.integration.test.tsindex a197ad54b..aab8f35be 100644--- a/packages/eve/src/compiler/development-extensions.integration.test.ts+++ b/packages/eve/src/compiler/development-extensions.integration.test.ts@@ -35,10 +35,12 @@ describe("development extensions", () => {expect(compiled.extensionMounts).toMatchObject([{mountLogicalPath: "extensions/self-modification.ts",+ mountId: "extensions/self-modification",namespace: "self-modification",packageName: "eve",},]);+ expect(subagent.owner).toMatchObject({ mountId: "extensions/self-modification" });expect(subagent.agent.tools.map((tool) => tool.name)).toEqual(expect.arrayContaining(["edit_file", "search_models", "search_registry"]),);diff --git a/packages/eve/src/compiler/manifest.test.ts b/packages/eve/src/compiler/manifest.test.tsindex e77398b50..9ee7f0785 100644--- a/packages/eve/src/compiler/manifest.test.ts+++ b/packages/eve/src/compiler/manifest.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from "vitest";+import { compiledRemoteAgentNodeSchema } from "#compiler/remote-agent-node.js";import { compileFromMemory } from "#internal/testing/compile-from-memory.js";import {COMPILED_AGENT_MANIFEST_VERSION,@@ -42,6 +43,44 @@ describe("compiled agent manifest v50", () => {expect(parsed.config.tool).toBe(false);});+ it("rejects empty mount identities on remote subagents and their bindings", async () => {+ const { manifest } = await compileFromMemory({ model: "openai/gpt-5.4" });+ const owner = {+ kind: "extension" as const,+ mountId: "extensions/crm",+ namespace: "crm",+ packageName: "@acme/crm",+ };+ const binding = { ...manifest.bindings[manifest.config.source.sourceId]!, owner };+ const remote = {+ backing: { kind: "resource", sourcePath: "/virtual/subagents/reviewer.ts" },+ binding,+ description: "Reviews customer requests.",+ entryPath: "/virtual/subagents/reviewer.ts",+ logicalPath: "subagents/crm__reviewer.ts",+ name: "crm__reviewer",+ nodeId: "reviewer",+ owner,+ parentNodeId: "__root__",+ path: "/virtual/subagents/reviewer.ts",+ rootPath: "/virtual",+ sourceId: "reviewer",+ sourceKind: "module",+ url: "https://reviewer.example.com",+ };+ expect(compiledRemoteAgentNodeSchema.safeParse(remote).success).toBe(true);+ const invalidOwner = { ...owner, mountId: "" };+ expect(+ compiledRemoteAgentNodeSchema.safeParse({ ...remote, owner: invalidOwner }).success,+ ).toBe(false);+ expect(+ compiledRemoteAgentNodeSchema.safeParse({+ ...remote,+ binding: { ...binding, owner: invalidOwner },+ }).success,+ ).toBe(false);+ });+it("rejects a missing required binding", async () => {const { manifest } = await compileFromMemory({model: "openai/gpt-5.4",diff --git a/packages/eve/src/compiler/manifest.ts b/packages/eve/src/compiler/manifest.tsindex 419d20b43..5b053f939 100644--- a/packages/eve/src/compiler/manifest.ts+++ b/packages/eve/src/compiler/manifest.ts@@ -1,4 +1,5 @@import { z } from "#compiled/zod/index.js";+import { mountIdSchema } from "#shared/extension-mount.js";import {type DiscoverDiagnosticsSummary,@@ -57,7 +58,7 @@ export const ROOT_COMPILED_AGENT_NODE_ID = "__root__";/*** Current compiled manifest schema version.*/-export const COMPILED_AGENT_MANIFEST_VERSION = 52;+export const COMPILED_AGENT_MANIFEST_VERSION = 53;/*** Active compiled channel entry — backed by an authored `Channel` module.@@ -351,6 +352,7 @@ const agentSourceOwnerSchema: z.ZodType<AgentSourceOwner> = z.discriminatedUnionz.object({kind: z.literal("extension"),+ mountId: mountIdSchema,namespace: z.string().min(1),packageName: z.string().min(1),})@@ -937,6 +939,7 @@ const compiledExtensionMountSchema: z.ZodType<CompiledExtensionMount> = zexternalDependencies: z.array(z.string()).readonly(),namespace: z.string(),packageName: z.string(),+ mountId: mountIdSchema,packageNamespace: z.string(),sourceRoot: z.string(),mountSourceId: z.string(),@@ -1032,10 +1035,12 @@ export interface CompiledExtensionMount {/** Mount-derived namespace that prefixes the extension's tool/skill names. */readonly namespace: string;readonly packageName: string;+ /** Canonical path of this mount in the root agent tree. */+ readonly mountId: string;/**- * Package-derived namespace that scopes the extension's durable state keys and- * config binding. Distinct from {@link namespace}: state stays keyed to the- * package so a consumer renaming the mount file cannot orphan persisted state.+ * Package-derived namespace that scopes durable state keys and config binding.+ * Unlike the logical consumer path in {@link mountId}, this stays stable when+ * the mount file is renamed, so persisted state is not orphaned.*/readonly packageNamespace: string;/**diff --git a/packages/eve/src/compiler/module-map.test.ts b/packages/eve/src/compiler/module-map.test.tsindex 276a4aa70..2a3032cdd 100644--- a/packages/eve/src/compiler/module-map.test.ts+++ b/packages/eve/src/compiler/module-map.test.ts@@ -91,7 +91,12 @@ describe("compiled module maps", () => {sourcePath: "/extension/tool.ts",},logicalPath: "tools/renamed-mount__tool.ts",- owner: { kind: "extension", namespace: "renamed-mount", packageName: "@acme/crm" },+ owner: {+ kind: "extension",+ mountId: "extensions/renamed-mount",+ namespace: "renamed-mount",+ packageName: "@acme/crm",+ },usage: { compile: true, runtimeEntry: true },};for (const sourceId of applicationSourceIds) {diff --git a/packages/eve/src/compiler/mounted-extension.integration.test.ts b/packages/eve/src/compiler/mounted-extension.integration.test.tsindex bc79a6d3a..cb248015d 100644--- a/packages/eve/src/compiler/mounted-extension.integration.test.ts+++ b/packages/eve/src/compiler/mounted-extension.integration.test.ts@@ -367,6 +367,9 @@ describe("mounted extension subagent resources", () => {"agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',"agent/instructions.md": "You are a precise assistant.\n","agent/extensions/crm.mjs": 'export { default } from "@acme/crm";\n',+ "agent/subagents/research/agent.mjs":+ 'export default { model: "openai/gpt-5.4", description: "Research." };\n',+ "agent/subagents/research/extensions/crm.mjs": 'export { default } from "@acme/crm";\n',"node_modules/@acme/crm/package.json": `${JSON.stringify({name: "@acme/crm",type: "module",@@ -389,6 +392,11 @@ describe("mounted extension subagent resources", () => {"};","",].join("\n"),+ "node_modules/@acme/crm/extension/subagents/reviewer/tools/review.mjs": [+ 'import { defineTool } from "eve/tools";',+ 'export default defineTool({ description: "Review notes.", inputSchema: { type: "object" }, execute: async () => ({ ok: true }) });',+ "",+ ].join("\n"),},});@@ -397,7 +405,21 @@ describe("mounted extension subagent resources", () => {compiledArtifactsSource: createDiskRuntimeCompiledArtifactsSource(app.appRoot),});- const [subagent] = manifest.subagents;+ const rootReviewer = manifest.subagents.find(+ (entry) => entry.name === "crm__reviewer" && entry.parentNodeId === "__root__",+ );+ const research = manifest.subagents.find((entry) => entry.name === "research");+ const researchReviewer = manifest.subagents.find(+ (entry) => entry.parentNodeId === research?.nodeId && entry.name === "crm__reviewer",+ );+ expect(manifest.extensionMounts[0]?.mountId).toBe("extensions/crm");+ expect(research?.agent.extensionMounts[0]?.mountId).toBe("subagents/research/extensions/crm");+ expect(rootReviewer?.owner).toMatchObject({ mountId: "extensions/crm" });+ expect(researchReviewer?.owner).toMatchObject({ mountId: "subagents/research/extensions/crm" });+ expect(rootReviewer?.agent.bindings["tools/review.mjs"]?.owner).toMatchObject({+ mountId: "extensions/crm",+ });+ const subagent = rootReviewer;expect(subagent?.nodeId).toContain(":");const logicalPath = subagent?.agent.workspaceResourceRoot.logicalPath ?? "";const [resourcesDirectory, nodeDirectory, ...nested] = logicalPath.split("/");diff --git a/packages/eve/src/compiler/normalize-manifest-helpers.ts b/packages/eve/src/compiler/normalize-manifest-helpers.tsindex ff072a99f..e2e36b156 100644--- a/packages/eve/src/compiler/normalize-manifest-helpers.ts+++ b/packages/eve/src/compiler/normalize-manifest-helpers.ts@@ -12,6 +12,7 @@ import type { ModuleSourceRef } from "#shared/source-ref.js";import { normalizeSubagentConfig } from "#compiler/normalize-subagent.js";import {canonicalSourceSlot,+ extensionMountId,type AgentModuleCandidate,type AgentSourceOwner,type AgentSourceRegistry,@@ -167,6 +168,7 @@ export function createCompiledRemoteAgent(input: {export function compileExtensionMounts(manifest: AgentSourceManifest,composed: ComposedAgentModuleCandidates,+ nodePath: string,): CompiledExtensionMount[] {const selected = collectSelectedSourceIds(composed);return manifest.resolvedExtensions.flatMap((mount) => {@@ -181,6 +183,7 @@ export function compileExtensionMounts(mountSourceId: mountRef.sourceId,namespace: mount.namespace,packageName: mount.packageName,+ mountId: extensionMountId(nodePath, mount.namespace),packageNamespace: packageStateNamespace(mount.packageName),sourceRoot: mount.sourceRoot,},diff --git a/packages/eve/src/compiler/normalize-manifest-types.ts b/packages/eve/src/compiler/normalize-manifest-types.tsindex d1b7a462f..fd705e5ac 100644--- a/packages/eve/src/compiler/normalize-manifest-types.ts+++ b/packages/eve/src/compiler/normalize-manifest-types.ts@@ -22,6 +22,7 @@ export interface NodeCompileInput {readonly layer: AgentSourceLayer;readonly manifest: AgentSourceManifest;readonly nodeId: string;+ readonly nodePath: string;readonly owner: AgentSourceOwner;readonly parentNodeId?: string;}diff --git a/packages/eve/src/compiler/normalize-manifest.test.ts b/packages/eve/src/compiler/normalize-manifest.test.tsindex 2032becc2..6d912e0ce 100644--- a/packages/eve/src/compiler/normalize-manifest.test.ts+++ b/packages/eve/src/compiler/normalize-manifest.test.ts@@ -665,6 +665,14 @@ describe("compileAgentManifest source graph", () => {sourceRegistries: [sourceRegistry],});const mount = compiled.extensionMounts[0]!;+ expect(mount.mountId).toBe("extensions/crm");+ expect(compiledAgentManifestSchema.safeParse(compiled).success).toBe(true);+ expect(+ compiledAgentManifestSchema.safeParse({+ ...compiled,+ extensionMounts: [{ ...mount, mountId: "" }],+ }).success,+ ).toBe(false);expect(compiled.bindings[mount.mountSourceId]?.usage).toEqual({compile: false,diff --git a/packages/eve/src/compiler/normalize-manifest.ts b/packages/eve/src/compiler/normalize-manifest.tsindex b2099086d..0a1d25d16 100644--- a/packages/eve/src/compiler/normalize-manifest.ts+++ b/packages/eve/src/compiler/normalize-manifest.ts@@ -137,6 +137,7 @@ export async function compileAgentManifest(layer: "application",manifest: developmentExtensions.manifest,nodeId: ROOT_COMPILED_AGENT_NODE_ID,+ nodePath: "",owner: { kind: "application" },});@@ -228,6 +229,7 @@ class AgentGraphCompiler {layer: projected.candidate.layer,manifest: source.manifest,nodeId,+ nodePath: projected.nodePath,owner: projected.owner,parentNodeId: input.nodeId,};@@ -360,6 +362,7 @@ class AgentGraphCompiler {layer: input.layer,manifest: input.manifest,nodeId: input.nodeId,+ nodePath: input.nodePath,owner: input.owner,});const frameworkCandidates: AgentModuleCandidate[] = [];@@ -650,7 +653,7 @@ class AgentGraphCompiler {for (const channel of channelRoutes.effective) {state.evaluation.requireRuntimeEntry(channel.sourceId);}- const extensionMounts = compileExtensionMounts(input.manifest, state.composed);+ const extensionMounts = compileExtensionMounts(input.manifest, state.composed, input.nodePath);for (const mount of extensionMounts) {state.evaluation.requireRuntimeEntry(mount.mountSourceId);}diff --git a/packages/eve/src/compiler/project-sources.test.ts b/packages/eve/src/compiler/project-sources.test.tsindex 25836ffb0..9c74cd0ef 100644--- a/packages/eve/src/compiler/project-sources.test.ts+++ b/packages/eve/src/compiler/project-sources.test.ts@@ -4,7 +4,11 @@ import {projectAgentSources,qualifyExtensionContributionLogicalPath,} from "#compiler/project-sources.js";-import { createAgentSourceManifest, createModuleSourceRef } from "#discover/manifest.js";+import {+ createAgentSourceManifest,+ createLocalSubagentSourceRef,+ createModuleSourceRef,+} from "#discover/manifest.js";describe("qualifyExtensionContributionLogicalPath", () => {it.each([@@ -30,6 +34,83 @@ describe("qualifyExtensionContributionLogicalPath", () => {},);+ it("derives extension identity from the owning node and mount name", () => {+ for (const mountPath of ["extensions/crm.ts", "extensions/crm/extension.ts"]) {+ const reviewer = createLocalSubagentSourceRef({+ entryPath: "/extension/subagents/reviewer",+ logicalPath: "subagents/reviewer",+ manifest: createAgentSourceManifest({+ agentRoot: "/extension/subagents/reviewer",+ appRoot: "/package",+ }),+ rootPath: "/extension/subagents/reviewer",+ subagentId: "reviewer",+ });+ const extensionManifest = createAgentSourceManifest({+ agentRoot: "/extension",+ appRoot: "/package",+ subagents: [reviewer],+ tools: [createModuleSourceRef({ logicalPath: "tools/search.ts" })],+ });+ const manifest = createAgentSourceManifest({+ agentRoot: "/app/agent/subagents/research",+ appRoot: "/app",+ extensions: [createModuleSourceRef({ logicalPath: mountPath })],+ resolvedExtensions: [+ {+ namespace: "crm",+ specifier: "@acme/crm",+ packageName: "@acme/crm",+ packageRoot: "/package",+ sourceRoot: "/extension",+ manifest: extensionManifest,+ overrides: createAgentSourceManifest({+ agentRoot: "/app/agent/subagents/research/extensions/crm",+ appRoot: "/app",+ subagents: [+ {+ ...reviewer,+ entryPath: "/app/agent/subagents/research/extensions/crm/subagents/reviewer",+ rootPath: "/app/agent/subagents/research/extensions/crm/subagents/reviewer",+ },+ ],+ }),+ externalDependencies: [],+ },+ ],+ });+ const projected = projectAgentSources({+ externalDependencies: [],+ manifest,+ nodeId: "research",+ nodePath: "subagents/research",+ });+ expect(projected.candidates.find((entry) => entry.owner.kind === "extension")?.owner).toEqual(+ {+ kind: "extension",+ mountId: "subagents/research/extensions/crm",+ namespace: "crm",+ packageName: "@acme/crm",+ },+ );+ expect(projected.subagents.map(({ nodePath, owner }) => ({ nodePath, owner }))).toEqual([+ {+ nodePath: "subagents/research/extensions/crm/subagents/reviewer",+ owner: {+ kind: "extension",+ mountId: "subagents/research/extensions/crm",+ namespace: "crm",+ packageName: "@acme/crm",+ },+ },+ {+ nodePath: "subagents/research/extensions/crm/subagents/reviewer",+ owner: { kind: "application" },+ },+ ]);+ }+ });+it("applies the selected extension projector to canonical path overrides", () => {const extensionManifest = createAgentSourceManifest({agentRoot: "/extension",@@ -53,7 +134,7 @@ describe("qualifyExtensionContributionLogicalPath", () => {});expect(() =>- projectAgentSources({ externalDependencies: [], manifest, nodeId: "root" }),+ projectAgentSources({ externalDependencies: [], manifest, nodeId: "root", nodePath: "" }),).toThrow('Extension source slot "agent.ts" cannot be namespace-scoped.');});});diff --git a/packages/eve/src/compiler/project-sources.ts b/packages/eve/src/compiler/project-sources.tsindex 4a5c8c380..8569c9e6b 100644--- a/packages/eve/src/compiler/project-sources.ts+++ b/packages/eve/src/compiler/project-sources.ts@@ -1,4 +1,4 @@-import { join } from "node:path";+import { join, posix } from "node:path";import type {AgentSourceManifest,@@ -18,7 +18,7 @@ import type {AgentSourceLayer,AgentSourceOwner,} from "#compiler/source-graph.js";-import { canonicalSourceSlot } from "#compiler/source-graph.js";+import { canonicalSourceSlot, extensionMountId } from "#compiler/source-graph.js";export type ProjectedModuleSource =| {@@ -78,6 +78,7 @@ const MODULE_KIND_BY_SLOT_ROOT: Partial<export interface ProjectedSubagentSource {readonly candidate: AgentResourceCandidate;+ readonly nodePath: string;readonly extensionScope?: { readonly namespace: string; readonly sourceRoot: string };readonly owner: AgentSourceOwner;readonly source: LocalSubagentSourceRef;@@ -95,6 +96,7 @@ export function projectAgentSources(input: {readonly layer?: AgentSourceLayer;readonly manifest: AgentSourceManifest;readonly nodeId: string;+ readonly nodePath: string;readonly owner?: AgentSourceOwner;}): ProjectedAgentSources {const owner = input.owner ?? { kind: "application" as const };@@ -109,6 +111,7 @@ export function projectAgentSources(input: {layer: input.layer ?? "application",manifest: input.manifest,nodeId: input.nodeId,+ subagentsPath: posix.join(input.nodePath, "subagents"),owner,resources,subagents,@@ -117,9 +120,11 @@ export function projectAgentSources(input: {for (const mount of [...input.manifest.resolvedExtensions].sort((left, right) =>left.namespace.localeCompare(right.namespace),)) {+ const mountId = extensionMountId(input.nodePath, mount.namespace);const projection = createExtensionManifestSourceProjection(mount);const extensionOwner: AgentSourceOwner = {kind: "extension",+ mountId,namespace: mount.namespace,packageName: mount.packageName,};@@ -133,6 +138,7 @@ export function projectAgentSources(input: {layer: "extension-package",manifest: mount.manifest,nodeId: input.nodeId,+ subagentsPath: posix.join(mountId, "subagents"),owner: extensionOwner,resources,sourceIdPrefix: `ext:${mount.namespace}:`,@@ -146,6 +152,7 @@ export function projectAgentSources(input: {layer: "extension-override",manifest: mount.overrides,nodeId: input.nodeId,+ subagentsPath: posix.join(mountId, "subagents"),owner: { kind: "application" },resources,sourceIdPrefix: `ext-override:${mount.namespace}:`,@@ -249,6 +256,7 @@ function projectManifest(input: {readonly layer: AgentSourceLayer;readonly manifest: AgentSourceManifest;readonly nodeId: string;+ readonly subagentsPath: string;readonly owner: AgentSourceOwner;readonly resources: ProjectedResourceSource[];readonly sourceIdPrefix?: string;@@ -363,6 +371,7 @@ function projectManifest(input: {input.candidates.push(candidate);input.subagents.push({candidate,+ nodePath: posix.join(input.subagentsPath, source.subagentId),...(projection.extensionScope === undefined? {}: { extensionScope: projection.extensionScope }),diff --git a/packages/eve/src/compiler/remote-agent-node.ts b/packages/eve/src/compiler/remote-agent-node.tsindex eaac08278..c08123b07 100644--- a/packages/eve/src/compiler/remote-agent-node.ts+++ b/packages/eve/src/compiler/remote-agent-node.ts@@ -1,4 +1,5 @@import { z } from "#compiled/zod/index.js";+import { mountIdSchema } from "#shared/extension-mount.js";import type { Node } from "#shared/node.js";import type { ModuleSourceRef } from "#shared/source-ref.js";@@ -71,6 +72,7 @@ export const compiledRemoteAgentNodeSchema: z.ZodType<CompiledRemoteAgentNode> =z.object({kind: z.literal("extension"),+ mountId: mountIdSchema,namespace: z.string(),packageName: z.string(),})@@ -89,7 +91,12 @@ export const compiledRemoteAgentNodeSchema: z.ZodType<CompiledRemoteAgentNode> =z.object({ kind: z.literal("application") }).strict(),z.object({ feature: z.string(), kind: z.literal("framework") }).strict(),z- .object({ kind: z.literal("extension"), namespace: z.string(), packageName: z.string() })+ .object({+ kind: z.literal("extension"),+ mountId: mountIdSchema,+ namespace: z.string(),+ packageName: z.string(),+ }).strict(),]),parentNodeId: z.string(),diff --git a/packages/eve/src/compiler/source-graph.test.ts b/packages/eve/src/compiler/source-graph.test.tsindex 5260711b6..dc46fcc5e 100644--- a/packages/eve/src/compiler/source-graph.test.ts+++ b/packages/eve/src/compiler/source-graph.test.ts@@ -181,6 +181,7 @@ describe("derived programmatic sources", () => {const template = registry.templates.get(templateSource.id)!;const extensionOwner = {kind: "extension" as const,+ mountId: "extensions/github",namespace: "github",packageName: "@acme/github",};@@ -245,7 +246,12 @@ describe("derived programmatic sources", () => {const dependency = candidate({ applyTo: "root", source: dependencySource },"extension-package",- { kind: "extension", namespace: "example", packageName: "@acme/example" },+ {+ kind: "extension",+ mountId: "extensions/example",+ namespace: "example",+ packageName: "@acme/example",+ },);const replacement = candidate({ applyTo: "root", source: replacementSource }, "application");const derived = instantiateProgrammaticTemplate({diff --git a/packages/eve/src/compiler/source-graph.ts b/packages/eve/src/compiler/source-graph.tsindex 1e995f9f6..6ca76d1d6 100644--- a/packages/eve/src/compiler/source-graph.ts+++ b/packages/eve/src/compiler/source-graph.ts@@ -131,10 +131,15 @@ export type AgentSourceOwner =| { readonly feature: string; readonly kind: "framework" }| {readonly kind: "extension";+ readonly mountId: string;readonly namespace: string;readonly packageName: string;};+export function extensionMountId(nodePath: string, namespace: string): string {+ return posix.join(nodePath, "extensions", namespace);+}+export type AgentSourceLayer =| "framework-default"| "extension-package"diff --git a/packages/eve/src/discover/agent.integration.test.ts b/packages/eve/src/discover/agent.integration.test.tsindex c92f93cd0..28e394581 100644--- a/packages/eve/src/discover/agent.integration.test.ts+++ b/packages/eve/src/discover/agent.integration.test.ts@@ -849,6 +849,7 @@ describe("discoverAgent (memory)", () => {externalDependencies: [],manifest: result.manifest,nodeId: "root",+ nodePath: "",});const composed = composeAgentModuleCandidates(projected.candidates);@@ -858,12 +859,22 @@ describe("discoverAgent (memory)", () => {expect(composed.selected.get("instructions/crm")).toMatchObject({layer: "extension-package",logicalPath: "instructions/crm.md",- owner: { kind: "extension", namespace: "crm", packageName: "@acme/crm" },+ owner: {+ kind: "extension",+ mountId: "extensions/crm",+ namespace: "crm",+ packageName: "@acme/crm",+ },});expect(composed.selected.get("instructions/gizmo")).toMatchObject({layer: "extension-package",logicalPath: "instructions/gizmo.md",- owner: { kind: "extension", namespace: "gizmo", packageName: "@acme/gizmo" },+ owner: {+ kind: "extension",+ mountId: "extensions/gizmo",+ namespace: "gizmo",+ packageName: "@acme/gizmo",+ },});});@@ -1240,6 +1251,7 @@ describe("discoverAgent (memory)", () => {externalDependencies: [],manifest: result.manifest,nodeId: "root",+ nodePath: "",});const composed = composeAgentModuleCandidates(projected.candidates);expect(composed.selected.get("tools/crm__search")).toMatchObject({@@ -1421,6 +1433,7 @@ describe("discoverAgent (memory)", () => {externalDependencies: [],manifest: result.manifest,nodeId: "root",+ nodePath: "",}),).not.toThrow();});diff --git a/packages/eve/src/internal/nitro/host/create-application-nitro.scenario.test.ts b/packages/eve/src/internal/nitro/host/create-application-nitro.scenario.test.tsindex 82bde7663..5c8a779b9 100644--- a/packages/eve/src/internal/nitro/host/create-application-nitro.scenario.test.ts+++ b/packages/eve/src/internal/nitro/host/create-application-nitro.scenario.test.ts@@ -649,6 +649,7 @@ describe("application Nitro creation", () => {mountSourceId: "extensions/layout.ts",namespace: "layout",packageName: "layout-extension",+ mountId: "extensions/layout",packageNamespace: "layout-extension",sourceRoot,},diff --git a/packages/eve/src/internal/nitro/host/extension-capability-requirements.ts b/packages/eve/src/internal/nitro/host/extension-capability-requirements.tsindex 262c8c8af..6da91a253 100644--- a/packages/eve/src/internal/nitro/host/extension-capability-requirements.ts+++ b/packages/eve/src/internal/nitro/host/extension-capability-requirements.ts@@ -1,5 +1,7 @@import { join } from "node:path";+import { extensionMountId } from "#compiler/source-graph.js";+import {EXTENSION_CAPABILITY_VERSIONS,type ExtensionCapability,@@ -117,6 +119,7 @@ function createLoadOptions(} {const owner = {kind: "extension" as const,+ mountId: extensionMountId("", input.shortName),namespace: input.shortName,packageName: input.packageName,};diff --git a/packages/eve/src/shared/extension-mount.ts b/packages/eve/src/shared/extension-mount.tsnew file mode 100644index 000000000..19ee58084--- /dev/null+++ b/packages/eve/src/shared/extension-mount.ts@@ -0,0 +1,3 @@+import { z } from "#compiled/zod/index.js";++export const mountIdSchema = z.string().min(1);