The Open Framework for Building Agents
test(eve): move compile-only scenarios to integration (#3847)
Andrew Barbac6f5fb54754e
diff --git a/packages/eve/test/scenarios/mounted-extension-directory-override.scenario.test.ts b/packages/eve/src/compiler/mounted-extension.integration.test.tssimilarity index 56%rename from packages/eve/test/scenarios/mounted-extension-directory-override.scenario.test.tsrename to packages/eve/src/compiler/mounted-extension.integration.test.tsindex c6f4a64ac..400389d5c 100644--- a/packages/eve/test/scenarios/mounted-extension-directory-override.scenario.test.ts+++ b/packages/eve/src/compiler/mounted-extension.integration.test.ts@@ -1,18 +1,145 @@import { describe, expect, it } from "vitest";-import { compileAgent } from "../../src/compiler/compile-agent.js";-import { createDiskRuntimeCompiledArtifactsSource } from "../../src/runtime/compiled-artifacts-source.js";-import { loadCompiledManifest } from "../../src/runtime/loaders/manifest.js";-import { loadCompiledModuleMapFromAuthoredSource } from "../../src/internal/authored-module-map-loader.js";-import { resolveRuntimeAgentGraph } from "../../src/runtime/resolve-agent-graph.js";-import { useScenarioApp } from "../../src/internal/testing/scenario-app.js";--const scenarioApp = useScenarioApp();-const compatibilityManifest = JSON.stringify({- kind: "eve-extension",- formatVersion: 1,- builtWithEve: "0.0.0-test",- requires: { extension: 1, tool: 1, dynamicTool: 1, config: 1 },+import { compileAgent } from "#compiler/compile-agent.js";+import { loadCompiledModuleMapFromAuthoredSource } from "#internal/authored-module-map-loader.js";+import { useTemporaryAppRoots } from "#internal/testing/use-temporary-app-roots.js";+import { createDiskRuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";+import { loadCompiledManifest } from "#runtime/loaders/manifest.js";+import { resolveRuntimeAgentGraph } from "#runtime/resolve-agent-graph.js";++const createAppRoot = useTemporaryAppRoots();++function compatibilityManifest(requires: Readonly<Record<string, number>>): string {+ return JSON.stringify({+ kind: "eve-extension",+ formatVersion: 1,+ builtWithEve: "0.0.0-test",+ requires,+ });+}++/**+ * Compiles the app and hydrates the module map from authored source, the+ * `eve eval` / `eve dev` path.+ */+async function compileRuntimeGraph(appRoot: string) {+ await compileAgent({ startPath: appRoot });+ const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(appRoot);+ const [manifest, moduleMap] = await Promise.all([+ loadCompiledManifest({ compiledArtifactsSource }),+ loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),+ ]);+ return { graph: await resolveRuntimeAgentGraph({ manifest, moduleMap }), manifest, moduleMap };+}++/**+ * Runs the `eve eval` / `eve dev` path: the module map is hydrated from authored+ * source, so the extension-scope plugin must bind config across separately-bundled+ * mount and tool modules. Deterministic guard for the config-binding regression.+ */+describe("mounted extension via authored-source loader", () => {+ it("binds mounted config so a composed tool reads it", async () => {+ const app = await createAppRoot("eve-mounted-extension-authored-source-", {+ files: {+ "agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',+ "agent/instructions.md": "You are a precise assistant.\n",+ "agent/extensions/crm.mjs": [+ 'import crm from "@acme/crm";',+ 'export default crm({ apiKey: "sk-authored" });',+ "",+ ].join("\n"),+ "node_modules/@acme/crm/package.json": `${JSON.stringify({+ name: "@acme/crm",+ type: "module",+ eve: { extension: { source: "source", dist: "extension" } },+ exports: { ".": "./extension/extension.mjs" },+ })}\n`,+ "node_modules/@acme/crm/extension/_manifest.json": compatibilityManifest({+ extension: 1,+ tool: 1,+ config: 1,+ }),+ "node_modules/@acme/crm/extension/extension.mjs": [+ 'import { defineExtension } from "eve/extension";',+ // Minimal pass-through Standard Schema — this scenario tests binding, not validation.+ "const config = { '~standard': { version: 1, vendor: 'scenario', validate: (value) => ({ value }) } };",+ "export default defineExtension({ config });",+ "",+ ].join("\n"),+ "node_modules/@acme/crm/extension/tools/crm_echo.mjs": [+ 'import { defineTool } from "eve/tools";',+ 'import extension from "../extension.mjs";',+ "export default defineTool({",+ ' description: "Echo the configured API key.",',+ " inputSchema: { type: 'object', properties: {}, additionalProperties: false },",+ " async execute() {",+ " return { apiKey: extension.config.apiKey };",+ " },",+ "});",+ "",+ ].join("\n"),+ },+ });++ const { graph } = await compileRuntimeGraph(app.appRoot);++ const tool = graph.root.agent.tools.find((entry) => entry.name === "crm__crm_echo");+ expect(tool).toBeDefined();+ await expect(tool?.execute?.({}, { messages: [], toolCallId: "call_1" })).resolves.toEqual({+ apiKey: "sk-authored",+ });+ });+});++/**+ * A no-config extension (`defineExtension()`, no schema) mounted with a bare+ * re-export — no factory call. Proves config is optional end to end through the+ * dev/eval loader.+ */+describe("mounted extension without config", () => {+ it("composes and runs a no-config extension mounted via re-export", async () => {+ const app = await createAppRoot("eve-mounted-extension-no-config-", {+ 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: 1,+ }),+ "node_modules/@acme/widget/extension/extension.mjs": [+ 'import { defineExtension } from "eve/extension";',+ "export default defineExtension();",+ "",+ ].join("\n"),+ "node_modules/@acme/widget/extension/tools/widget_ping.mjs": [+ 'import { defineTool } from "eve/tools";',+ "export default defineTool({",+ ' description: "Return a fixed widget token.",',+ " inputSchema: { type: 'object', properties: {}, additionalProperties: false },",+ " async execute() {",+ ' return { token: "widget-ok" };',+ " },",+ "});",+ "",+ ].join("\n"),+ },+ });++ const { graph } = await compileRuntimeGraph(app.appRoot);++ const tool = graph.root.agent.tools.find((entry) => entry.name === "widget__widget_ping");+ expect(tool).toBeDefined();+ await expect(tool?.execute?.({}, { messages: [], toolCallId: "call_1" })).resolves.toEqual({+ token: "widget-ok",+ });+ });});/**@@ -23,9 +150,7 @@ const compatibilityManifest = JSON.stringify({*/describe("mounted extension via directory form with override", () => {it("binds base config and lets a co-located override shadow or disable a tool", async () => {- const app = await scenarioApp({- name: "mounted-extension-directory-override",- installDependencies: true,+ const app = await createAppRoot("eve-mounted-extension-directory-override-", {files: {"agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',"agent/instructions.md": "You are a precise assistant.\n",@@ -64,7 +189,12 @@ describe("mounted extension via directory form with override", () => {eve: { extension: { source: "source", dist: "extension" } },exports: { ".": "./extension/extension.mjs" },})}\n`,- "node_modules/@acme/crm/extension/_manifest.json": compatibilityManifest,+ "node_modules/@acme/crm/extension/_manifest.json": compatibilityManifest({+ extension: 1,+ tool: 1,+ dynamicTool: 1,+ config: 1,+ }),"node_modules/@acme/crm/extension/extension.mjs": ['import { defineExtension } from "eve/extension";',"const config = { '~standard': { version: 1, vendor: 'scenario', validate: (value) => ({ value }) } };",@@ -124,14 +254,7 @@ describe("mounted extension via directory form with override", () => {},});- await compileAgent({ startPath: app.appRoot });-- const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(app.appRoot);- const [manifest, moduleMap] = await Promise.all([- loadCompiledManifest({ compiledArtifactsSource }),- loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),- ]);- const graph = await resolveRuntimeAgentGraph({ manifest, moduleMap });+ const { graph } = await compileRuntimeGraph(app.appRoot);const echo = graph.root.agent.tools.find((entry) => entry.name === "crm__crm_echo");expect(echo).toBeDefined();@@ -155,9 +278,7 @@ describe("mounted extension via directory form with override", () => {});it("replaces extension local and remote subagents with remote overrides", async () => {- const app = await scenarioApp({- name: "mounted-extension-subagent-override-repro",- installDependencies: true,+ const app = await createAppRoot("eve-mounted-extension-subagent-override-repro-", {files: {"agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',"agent/instructions.md": "You are a precise assistant.\n",@@ -188,11 +309,9 @@ describe("mounted extension via directory form with override", () => {eve: { extension: { source: "source", dist: "extension" } },exports: { ".": "./extension/extension.mjs" },})}\n`,- "node_modules/@acme/crm/extension/_manifest.json": JSON.stringify({- kind: "eve-extension",- formatVersion: 1,- builtWithEve: "0.0.0-test",- requires: { extension: 1, subagent: 6 },+ "node_modules/@acme/crm/extension/_manifest.json": compatibilityManifest({+ extension: 1,+ subagent: 6,}),"node_modules/@acme/crm/extension/extension.mjs": ['import { defineExtension } from "eve/extension";',diff --git a/packages/eve/src/compiler/normalize-sandbox.scenario.test.ts b/packages/eve/src/compiler/normalize-sandbox.integration.test.tssimilarity index 84%rename from packages/eve/src/compiler/normalize-sandbox.scenario.test.tsrename to packages/eve/src/compiler/normalize-sandbox.integration.test.tsindex 33fd6878c..f1212f850 100644--- a/packages/eve/src/compiler/normalize-sandbox.scenario.test.ts+++ b/packages/eve/src/compiler/normalize-sandbox.integration.test.ts@@ -2,11 +2,11 @@ import { join } from "node:path";import { describe, expect, it } from "vitest";import { compileAgentManifest } from "#compiler/normalize-manifest.js";import { discoverAgent } from "#discover/discover-agent.js";-import { useScenarioApp } from "#internal/testing/scenario-app.js";+import { useTemporaryAppRoots } from "#internal/testing/use-temporary-app-roots.js";describe("sandbox compilation", () => {- const scenarioApp = useScenarioApp();+ const createAppRoot = useTemporaryAppRoots();it("compiles an exported environment and selector", async () => {- const app = await scenarioApp({+ const app = await createAppRoot("eve-sandbox-environment-", {files: {"agent/sandbox.ts": ['import { DefaultSandbox, defineSandbox } from "eve/sandbox";',@@ -14,8 +14,6 @@ describe("sandbox compilation", () => {"export default defineSandbox(() => environment.open());",].join("\n"),},- installDependencies: true,- name: "sandbox-environment",});const discovered = await discoverAgent({agentRoot: join(app.appRoot, "agent"),@@ -28,7 +26,7 @@ describe("sandbox compilation", () => {});});it("compiles managed child resources for runtime rejection", async () => {- const app = await scenarioApp({+ const app = await createAppRoot("eve-inherited-sandbox-child-resources-", {files: {"agent/subagents/foo/agent.ts":"export default { description: 'foo', model: 'openai/gpt-5.4' };",@@ -37,8 +35,6 @@ describe("sandbox compilation", () => {'import { defineParentSandbox } from "eve/sandbox"; export default defineParentSandbox();',"agent/subagents/foo/sandbox/workspace/bar.txt": "child seed\n",},- installDependencies: true,- name: "inherited-sandbox-child-resources",});const discovered = await discoverAgent({agentRoot: join(app.appRoot, "agent"),diff --git a/packages/eve/src/compiler/workspace-agent.scenario.test.ts b/packages/eve/src/compiler/workspace-agent.integration.test.tssimilarity index 51%rename from packages/eve/src/compiler/workspace-agent.scenario.test.tsrename to packages/eve/src/compiler/workspace-agent.integration.test.tsindex 7568092cb..3c8c6bd37 100644--- a/packages/eve/src/compiler/workspace-agent.scenario.test.ts+++ b/packages/eve/src/compiler/workspace-agent.integration.test.ts@@ -1,9 +1,10 @@+import { rmdir } from "node:fs/promises";import { join } from "node:path";import { describe, expect, it } from "vitest";import { compileAgent } from "#compiler/compile-agent.js";-import { useScenarioApp } from "#internal/testing/scenario-app.js";+import { useTemporaryAppRoots } from "#internal/testing/use-temporary-app-roots.js";const rootConfig ="export default { model: 'openai/gpt-5.5', modelContextWindowTokens: 200000 };\n";@@ -12,6 +13,8 @@ const peerConfig =function workspaceFiles(subagent: string) {return {+ // Workspace detection requires the root manifest to declare eve.+ "package.json": `${JSON.stringify({ dependencies: { eve: "*" }, name: "workspace", type: "module" })}\n`,"agents/research/agent/agent.ts": peerConfig,"agents/support/agent/agent.ts": rootConfig,"agents/support/agent/instructions.md": "Support users.\n",@@ -20,20 +23,24 @@ function workspaceFiles(subagent: string) {}describe("Vercel workspace subagent compilation", () => {- const scenarioApp = useScenarioApp();+ const createAppRoot = useTemporaryAppRoots();++ async function createWorkspace(prefix: string, subagent: string) {+ const app = await createAppRoot(prefix, { files: workspaceFiles(subagent) });+ // A root agent/ directory would make the workspace root an agent root.+ await rmdir(app.agentRoot);+ return app;+ }it("uses the addressed peer's description by default", async () => {- const app = await scenarioApp({- installDependencies: true,- name: "workspace-subagent-description",- files: workspaceFiles(- [- 'import { defineWorkspaceAgent } from "eve";',- 'export default defineWorkspaceAgent({ name: "research" });',- "",- ].join("\n"),- ),- });+ const app = await createWorkspace(+ "eve-workspace-subagent-description-",+ [+ 'import { defineWorkspaceAgent } from "eve";',+ 'export default defineWorkspaceAgent({ name: "research" });',+ "",+ ].join("\n"),+ );const result = await compileAgent({ startPath: join(app.appRoot, "agents", "support") });expect(result.manifest.remoteAgents).toEqual([@@ -42,20 +49,17 @@ describe("Vercel workspace subagent compilation", () => {});it("uses an authored description override", async () => {- const app = await scenarioApp({- installDependencies: true,- name: "workspace-subagent-description-override",- files: workspaceFiles(- [- 'import { defineWorkspaceAgent } from "eve";',- "export default defineWorkspaceAgent({",- ' description: "Research urgent support escalations.",',- ' name: "research",',- "});",- "",- ].join("\n"),- ),- });+ const app = await createWorkspace(+ "eve-workspace-subagent-description-override-",+ [+ 'import { defineWorkspaceAgent } from "eve";',+ "export default defineWorkspaceAgent({",+ ' description: "Research urgent support escalations.",',+ ' name: "research",',+ "});",+ "",+ ].join("\n"),+ );const result = await compileAgent({ startPath: join(app.appRoot, "agents", "support") });expect(result.manifest.remoteAgents).toEqual([@@ -67,20 +71,17 @@ describe("Vercel workspace subagent compilation", () => {});it("rejects an unknown peer even with a description override", async () => {- const app = await scenarioApp({- installDependencies: true,- name: "workspace-subagent-unknown-peer",- files: workspaceFiles(- [- 'import { defineWorkspaceAgent } from "eve";',- "export default defineWorkspaceAgent({",- ' description: "Research urgent support escalations.",',- ' name: "missing",',- "});",- "",- ].join("\n"),- ),- });+ const app = await createWorkspace(+ "eve-workspace-subagent-unknown-peer-",+ [+ 'import { defineWorkspaceAgent } from "eve";',+ "export default defineWorkspaceAgent({",+ ' description: "Research urgent support escalations.",',+ ' name: "missing",',+ "});",+ "",+ ].join("\n"),+ );await expect(compileAgent({ startPath: join(app.appRoot, "agents", "support") }),diff --git a/packages/eve/src/internal/authored-module-loader.scenario.test.ts b/packages/eve/src/internal/authored-module-loader.integration.test.tssimilarity index 93%rename from packages/eve/src/internal/authored-module-loader.scenario.test.tsrename to packages/eve/src/internal/authored-module-loader.integration.test.tsindex b045db820..dfd11883d 100644--- a/packages/eve/src/internal/authored-module-loader.scenario.test.ts+++ b/packages/eve/src/internal/authored-module-loader.integration.test.ts@@ -11,31 +11,17 @@ import {bundleAuthoredModuleMapForGeneration,loadAuthoredModuleNamespace,} from "#internal/authored-module-loader.js";-import { useScenarioApp } from "#internal/testing/scenario-app.js";+import { useTemporaryAppRoots } from "#internal/testing/use-temporary-app-roots.js";describe("loadAuthoredModuleNamespace", () => {- const scenarioApp = useScenarioApp();+ const createAppRoot = useTemporaryAppRoots();- it.each(["agent", "ask"])(- "rejects the removed eve/workflow %s import at build time",- async (helper) => {- const app = await scenarioApp({- files: {- "agent/agent.ts": 'export default { model: "openai/gpt-5.4" };',- "agent/tools/probe.ts": `import { defineTool } from "eve/tools";-import { ${helper} } from "eve/workflow";-export default defineTool({ description: "Probe", inputSchema: { type: "object" }, async execute(input, ctx) { return ${helper}(ctx, input); } });`,- },- installDependencies: true,- name: "removed-workflow-helper",- });- const discovered = await discoverAgent({- agentRoot: join(app.appRoot, "agent"),- appRoot: app.appRoot,- });- await expect(compileAgentManifest(discovered.manifest)).rejects.toThrow(/eve\/workflow/);- },- );+ function createApp(input: {+ readonly files: Readonly<Record<string, string>>;+ readonly name: string;+ }) {+ return createAppRoot(`eve-${input.name}-`, { files: input.files });+ }it.each(["defineTool", "bare object"])("rejects %s workflow executors during compilation",@@ -44,12 +30,11 @@ export default defineTool({ description: "Probe", inputSchema: { type: "object""use workflow";return 1;} }`;- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };',"agent/tools/probe.ts": `import { defineTool } from "eve/tools";\nexport default ${kind === "defineTool" ? `defineTool(${definition})` : definition};`,},- installDependencies: true,name: "legacy-workflow-tool",});const discovered = await discoverAgent({@@ -63,7 +48,7 @@ export default defineTool({ description: "Probe", inputSchema: { type: "object");it("rejects a named workflow channel handler during compilation", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',"agent/channels/probe.ts": `import { defineChannel, POST } from "eve/channels";@@ -73,7 +58,6 @@ async function handler() {return new Response("Done");}`,},- installDependencies: true,name: "invalid-workflow-channel",});const discovered = await discoverAgent({@@ -86,52 +70,35 @@ async function handler() {});it.each([- ["missing", "async execute() { return 1; }", "", "requires a compiled workflow executor"],- ["generator", "async *execute() { yield 1; }", "", "requires a compiled workflow executor"],- ["expression body", "execute: async () => 1", "", "requires a compiled workflow executor"],- ["synchronous", "execute() { return 1; }", "", "requires a compiled workflow executor"],- [- "misplaced",- 'async execute() { void 0; "use workflow"; return 1; }',- "",- "requires a compiled workflow executor",- ],- [- "local reference",- "execute: run",- "async function run() { return 1; }",- "requires a compiled workflow executor",- ],+ ["missing", "async execute() { return 1; }", ""],+ ["generator", "async *execute() { yield 1; }", ""],+ ["expression body", "execute: async () => 1", ""],+ ["synchronous", "execute() { return 1; }", ""],+ ["local reference", "execute: run", "async function run() { return 1; }"],["unrelated workflow","async execute() { return 1; }",'async function other() { "use workflow"; return 1; }',- "requires a compiled workflow executor",- ],- [- "nested only",- 'async execute() { async function inner() { "use workflow"; return 1; } return inner(); }',- "",- 'marks the nested function "inner"',],])("rejects a workflow tool with a %s executor directive during compilation",- async (_kind, execute, helper, error) => {- const app = await scenarioApp({+ async (_kind, execute, helper) => {+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };',"agent/tools/probe.ts": `import { defineWorkflowTool } from "eve/tools";export default defineWorkflowTool({ description: "Probe", inputSchema: {}, ${execute} });${helper}`,},- installDependencies: true,name: "missing-workflow-directive",});const discovered = await discoverAgent({agentRoot: join(app.appRoot, "agent"),appRoot: app.appRoot,});- await expect(compileAgentManifest(discovered.manifest)).rejects.toThrow(error);+ await expect(compileAgentManifest(discovered.manifest)).rejects.toThrow(+ "requires a compiled workflow executor",+ );},);@@ -139,7 +106,7 @@ ${helper}`,['import { defineWorkflowTool as durable } from "eve/tools";', "durable"],['import * as tools from "eve/tools";', "tools.defineWorkflowTool"],])("validates a workflow tool through its compiled definition: %s", async (binding, definer) => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };',"agent/tools/probe.ts": `${binding}@@ -147,7 +114,6 @@ import { run } from "../lib/run";export default ${definer}({ description: "Probe", inputSchema: {}, execute: run });`,"agent/lib/run.ts": 'export async function run() { "use workflow"; return 1; }',},- installDependencies: true,name: "compiled-workflow-reference",});const discovered = await discoverAgent({@@ -162,7 +128,7 @@ export default ${definer}({ description: "Probe", inputSchema: {}, execute: run});it("compiles a workflow tool that calls agent through an imported helper", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',"agent/tools/probe.ts": `import { defineWorkflowTool } from "eve/tools";@@ -173,7 +139,6 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "} });`,"agent/lib/delegate.ts": `export async function delegate(ctx, input) { return ctx.agent("researcher", input); }`,},- installDependencies: true,name: "valid-workflow-helper",});const discovered = await discoverAgent({@@ -199,7 +164,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "])("rejects an imported workflow handler while compiling %s",async (path, kind, binding, definition) => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',[`agent/${path}`]: `${binding}\nimport { handler } from "../lib/handler";\nexport default ${definition};\n`,@@ -208,7 +173,6 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "return undefined;}`,},- installDependencies: true,name: "imported-workflow-handler",});const discovered = await discoverAgent({@@ -222,7 +186,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: ");it("stamps dynamic callbacks while building the generation module map", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',"agent/tools/dynamic.ts": [@@ -242,7 +206,6 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: """,].join("\n"),},- installDependencies: true,name: "generation-dynamic-callback",});const discovered = await discoverAgent({@@ -261,7 +224,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("preserves cached channel identity for relative channel imports", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/support.ts": ['export default { marker: "source-channel-instance" };',@@ -282,14 +245,17 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "const previousCache = globals[cacheKey];try {- const supportChannelPath = await realpath(- join(app.appRoot, "agent", "channels", "support.ts"),- );- cache.set(supportChannelPath, { marker: "cached-channel-instance" });+ // Native realpath resolves symlinks (macOS /var) and Windows 8.3 short+ // names (RUNNER~1); loading from the same canonical root keeps the+ // bundler's resolved channel path equal to the cache key.+ const appRoot = await realpath(app.appRoot);+ cache.set(join(appRoot, "agent", "channels", "support.ts"), {+ marker: "cached-channel-instance",+ });globals[cacheKey] = cache;const moduleNamespace = await loadAuthoredModuleNamespace(- join(app.appRoot, "agent", "tools", "use_support_channel.ts"),+ join(appRoot, "agent", "tools", "use_support_channel.ts"),);expect(moduleNamespace.result).toBe("cached-channel-instance");@@ -303,7 +269,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("explains when an installed package contains Node-incompatible extensionless ESM", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/eve.ts": ['import { matchRoute } from "compiler-oriented-sdk/server";',@@ -350,7 +316,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("does not infer a compiler requirement when package output is simply missing", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/use_sdk.ts": 'import "incomplete-sdk";\nexport const result = true;\n',"node_modules/incomplete-sdk/index.js": 'import "./generated";\n',@@ -386,7 +352,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("preserves an authored module initialization failure as the evaluation cause", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/throws.ts": 'throw new Error("authored initialization failed");\n',},@@ -410,7 +376,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("resolves extensionless relative imports with dotted TypeScript basenames", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/use_schema.ts": ['import { schemaValue } from "./mock-registry.schemas";',@@ -434,7 +400,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("resolves extensionless relative directory imports to index modules", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/use_helpers.ts": ['import { helperValue } from "./helpers";',@@ -457,7 +423,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("resolves extensionless CommonJS requires with dotted JavaScript basenames", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { readDottedValue } from "@repo/enrichment/dotted";',@@ -538,7 +504,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("bundles symlinked workspace packages that export TypeScript source", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { searchLinkedInProfile } from "@repo/enrichment/exa-linkedin";',@@ -629,7 +595,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "// source already declared one of those identifiers at the top level// the bundled `.mjs` failed to load with// `SyntaxError: Identifier '__dirname' has already been declared`.- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/already-declared/webhook.ts": ['import { createRequire } from "node:module";',@@ -663,7 +629,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("uses a symlinked workspace package's tsconfig paths when bundling its source", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { searchLinkedInProfile } from "@repo/enrichment/exa-linkedin";',@@ -790,7 +756,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("keeps configured dependencies external when they are imported from workspace packages", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { readExternalValue } from "@repo/enrichment/external-value";',@@ -870,7 +836,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("bundles unconfigured dependencies imported from workspace packages", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { readExternalValue } from "@repo/enrichment/external-value";',@@ -993,7 +959,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "}it("inlines store-sibling dependencies of modules reached through literal symlink paths", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/use_echo.ts": ['import { result } from "../../node_modules/gadget-extension/extension/tools/echo.ts";',@@ -1021,7 +987,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("prefers a package's store sibling over a consumer copy of the same dependency", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/use_echo.ts": ['import { result } from "../../node_modules/gadget-extension/extension/tools/echo.ts";',@@ -1049,7 +1015,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("resolves store siblings for generation bundles entered at node_modules paths", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/instructions.md": "Store-sibling entry scenario.\n",},@@ -1072,7 +1038,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("keeps configured dependency subpaths importable after externalizing them", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { readExternalValue } from "@repo/enrichment/external-value";',@@ -1144,7 +1110,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("resolves configured dependency subpaths from the importing package", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/contact-sales/webhook.ts": ['import { readExternalValue } from "@repo/enrichment/external-value";',@@ -1215,7 +1181,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("applies agent build externals while compiling authored modules", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": ["export default {",@@ -1313,7 +1279,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("inherits root build externals while compiling subagent authored modules", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/agent.ts": ["export default {",@@ -1423,7 +1389,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("loads authored modules that use asset imports", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/assets/logo.bin": "logo-bytes","agent/assets/logo.png": "png-bytes",@@ -1468,7 +1434,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("rejects asset imports outside the authored package", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/tools/outside_asset.ts": "export default {};\n",},@@ -1504,7 +1470,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "// the same process kept failing with the no-exports fallback error// ("Cannot find module .../node_modules/@scope/pkg/sub") until restart.// Failing at bundle time instead keeps the process recoverable.- const app = await scenarioApp({+ const app = await createApp({files: {"agent/channels/api/late-install/webhook.ts": ['import { value } from "@scope/late-dep/sub";',@@ -1549,7 +1515,7 @@ export default defineWorkflowTool({ description: "Probe", inputSchema: { type: "});it("adds actionable hints when authored bundling hits native module imports", async () => {- const app = await scenarioApp({+ const app = await createApp({files: {"agent/native.node": "not really native","agent/tools/use_native.ts": [diff --git a/packages/eve/src/internal/testing/scenario-app.scenario.test.ts b/packages/eve/src/internal/testing/scenario-app.scenario.test.tsdeleted file mode 100644index 1e54e946d..000000000--- a/packages/eve/src/internal/testing/scenario-app.scenario.test.ts+++ /dev/null@@ -1,82 +0,0 @@-import { readFile, stat } from "node:fs/promises";-import { join } from "node:path";--import { describe, expect, it } from "vitest";--import { useScenarioApp } from "#internal/testing/scenario-app.js";--describe("materializeScenarioApp", () => {- const scenarioApp = useScenarioApp();-- it("writes declared files under the generated app root", async () => {- const app = await scenarioApp({- files: {- "agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',- "agent/instructions.md": "System prompt.\n",- },- name: "minimal-app",- });-- const agentSource = await readFile(join(app.appRoot, "agent/agent.ts"), "utf8");- const systemSource = await readFile(join(app.appRoot, "agent/instructions.md"), "utf8");-- expect(agentSource).toContain('model: "openai/gpt-5.4"');- expect(systemSource).toBe("System prompt.\n");- });-- it("writes a package.json wiring the packed eve tarball", async () => {- const app = await scenarioApp({- files: {},- name: "manifest-only-app",- });-- const manifestSource = await readFile(join(app.appRoot, "package.json"), "utf8");- const manifest = JSON.parse(manifestSource) as {- dependencies: Record<string, string>;- name: string;- type: string;- };-- expect(manifest.name).toBe("manifest-only-app");- expect(manifest.type).toBe("module");- expect(manifest.dependencies["eve"]).toMatch(/^file:\.\/eve-.*\.tgz$/);- });-- it("creates declared empty directories", async () => {- const app = await scenarioApp({- directories: ["agent/tools", "agent/skills"],- files: {- "agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',- },- name: "empty-directories-app",- });-- const toolsStat = await stat(join(app.appRoot, "agent/tools"));- const skillsStat = await stat(join(app.appRoot, "agent/skills"));-- expect(toolsStat.isDirectory()).toBe(true);- expect(skillsStat.isDirectory()).toBe(true);- });-- it("installs dependencies into node_modules when requested", async () => {- const app = await scenarioApp({- dependencies: {- zod: "^4.3.6",- },- files: {- "agent/agent.ts": 'export default { model: "openai/gpt-5.4" };\n',- },- installDependencies: true,- name: "install-deps-app",- });-- const eveManifestPath = join(app.appRoot, "node_modules", "eve", "package.json");- const zodManifestPath = join(app.appRoot, "node_modules", "zod", "package.json");-- const eveManifestStat = await stat(eveManifestPath);- const zodManifestStat = await stat(zodManifestPath);-- expect(eveManifestStat.isFile()).toBe(true);- expect(zodManifestStat.isFile()).toBe(true);- }, 60_000);-});diff --git a/packages/eve/src/internal/testing/scenario-app.ts b/packages/eve/src/internal/testing/scenario-app.tsindex 4758a5bf5..7dd0e299b 100644--- a/packages/eve/src/internal/testing/scenario-app.ts+++ b/packages/eve/src/internal/testing/scenario-app.ts@@ -49,11 +49,6 @@ export interface ScenarioAppDescriptor {* separators. Parent directories are created automatically.*/readonly files: Readonly<Record<string, string>>;- /**- * Directories to create without any files. Parents of paths in {@link files}- * are inferred automatically; list explicit empty directories here.- */- readonly directories?: readonly string[];/*** Additional dependencies installed alongside `eve`. Keys are* package names, values are npm version specifiers or `file:` specifiers.@@ -63,10 +58,6 @@ export interface ScenarioAppDescriptor {* installed version by default unless a descriptor overrides `ai`.*/readonly dependencies?: Readonly<Record<string, string>>;- /**- * Optional `package.json#type` value. Defaults to `"module"`.- */- readonly packageType?: "module" | "commonjs";/*** When `true`, the materialized app has a populated `node_modules/` tree* containing the `eve` tarball and the requested dependencies.@@ -121,10 +112,6 @@ export async function materializeScenarioApp(appRoot,descriptor,});- await writeDescriptorDirectories({- appRoot,- descriptor,- });await writeDescriptorFiles({appRoot,descriptor,@@ -200,7 +187,7 @@ async function writePackageManifest(input: {},name: input.descriptor.name,private: true,- type: input.descriptor.packageType ?? "module",+ type: "module",};await writeFile(@@ -247,21 +234,6 @@ export async function resolveScenarioPackageVersion(packageName: string): Promis}}-async function writeDescriptorDirectories(input: {- readonly appRoot: string;- readonly descriptor: ScenarioAppDescriptor;-}): Promise<void> {- const directories = input.descriptor.directories ?? [];-- await Promise.all(- directories.map(async (relativePath) => {- await mkdir(join(input.appRoot, relativePath), {- recursive: true,- });- }),- );-}-async function writeDescriptorFiles(input: {readonly appRoot: string;readonly descriptor: ScenarioAppDescriptor;diff --git a/packages/eve/src/internal/workflow-bundle/authored-workflow-directives.test.ts b/packages/eve/src/internal/workflow-bundle/authored-workflow-directives.test.tsindex 23b724870..73c61a98d 100644--- a/packages/eve/src/internal/workflow-bundle/authored-workflow-directives.test.ts+++ b/packages/eve/src/internal/workflow-bundle/authored-workflow-directives.test.ts@@ -135,6 +135,24 @@ return inner();});});+ it("rejects the removed eve/workflow import", async () => {+ const source = `import { defineTool } from "eve/tools";+import { agent } from "eve/workflow";+export default defineTool({ async execute(input, ctx) { return agent(ctx, input); } });`;+ await expect(prepareAuthoredWorkflowDirectives({ filePath: FILE, source })).rejects.toThrow(+ /"eve\/workflow" has been removed/u,+ );+ });++ it("ignores a workflow directive that is not the executor's first statement", async () => {+ const source = toolModule(' async execute() { void 0; "use workflow"; return 1; },');+ await expect(prepareAuthoredWorkflowDirectives({ filePath: FILE, source })).resolves.toEqual({+ hasDirectives: true,+ hasWorkflowDirective: false,+ source,+ });+ });+it("rejects a module-level directive", async () => {await expect(prepareAuthoredWorkflowDirectives({diff --git a/packages/eve/test/helpers/vercel-deployment-fixture.ts b/packages/eve/test/helpers/vercel-deployment-fixture.tsindex 448d5bc42..b93bd048a 100644--- a/packages/eve/test/helpers/vercel-deployment-fixture.ts+++ b/packages/eve/test/helpers/vercel-deployment-fixture.ts@@ -105,12 +105,6 @@ async function writeDescriptorAppFiles(input: {readonly appRoot: string;readonly descriptor: ScenarioAppDescriptor;}): Promise<void> {- for (const directory of input.descriptor.directories ?? []) {- await mkdir(join(input.appRoot, directory), {- recursive: true,- });- }-for (const [relativePath, contents] of Object.entries(input.descriptor.files)) {const destinationPath = join(input.appRoot, relativePath);await mkdir(dirname(destinationPath), {@@ -132,7 +126,7 @@ async function writeDescriptorPackageManifest(input: {},name: input.descriptor.name,private: true,- type: input.descriptor.packageType ?? "module",+ type: "module",};await writeFile(diff --git a/packages/eve/test/scenarios/compile-agent.scenario.test.ts b/packages/eve/test/scenarios/compile-agent.scenario.test.tsindex f5e38ee67..818ab6cd2 100644--- a/packages/eve/test/scenarios/compile-agent.scenario.test.ts+++ b/packages/eve/test/scenarios/compile-agent.scenario.test.ts@@ -668,59 +668,6 @@ describe("compileAgent", () => {});});- it("composes a mounted extension's tools into the consuming agent", async () => {- const app = await scenarioApp({- name: "mounted-extension",- installDependencies: true,- files: {- "agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',- "agent/instructions.md": "You are a precise assistant.\n",- "agent/extensions/crm.ts": 'export { default } from "@acme/crm";\n',- "node_modules/@acme/crm/package.json": `${JSON.stringify({- name: "@acme/crm",- type: "module",- eve: { extension: { source: "source", dist: "extension" } },- exports: { ".": "./extension/index.mjs" },- })}\n`,- "node_modules/@acme/crm/extension/_manifest.json": JSON.stringify({- kind: "eve-extension",- formatVersion: 1,- builtWithEve: "0.0.0-test",- requires: { extension: 1, tool: 1, instructions: 1 },- }),- "node_modules/@acme/crm/extension/index.mjs": "export default {};\n",- "node_modules/@acme/crm/extension/instructions/policy.mjs":- 'export default { markdown: "Prefer the CRM over guessing." };\n',- "node_modules/@acme/crm/extension/tools/crm_search.mjs": [- 'import { defineTool } from "eve/tools";',- "",- "export default defineTool({",- ' description: "Search the CRM.",',- ' inputSchema: { type: "object", properties: {}, additionalProperties: false },',- " async execute() {",- " return { ok: true };",- " },",- "});",- "",- ].join("\n"),- },- });-- const result = await compileAgent({ startPath: app.appRoot });-- expect(result.manifest.tools.map((tool) => tool.name)).toContain("crm__crm_search");- const composed = result.manifest.tools.find((tool) => tool.name === "crm__crm_search");- expect(composed?.sourceId).toBe("ext:crm:tools/crm_search.mjs");- expect(composed?.description).toBe("Search the CRM.");- expect(result.manifest.instructions.map((entry) => entry.content).join("\n")).toContain(- "Prefer the CRM over guessing.",- );-- const moduleMapText = await readFile(result.paths.moduleMapPath, "utf8");- expect(moduleMapText).toContain("@acme/crm/extension/tools/crm_search.mjs");- expect(moduleMapText).toContain('"ext:crm:tools/crm_search.mjs"');- });-it("compiles extension-variant authored modules from a fixture app", async () => {const app = await scenarioApp(EXTENSION_AGENT_DESCRIPTOR);diff --git a/packages/eve/test/scenarios/eve-init.scenario.test.ts b/packages/eve/test/scenarios/eve-init.scenario.test.tsindex 6b905597c..72f8027e7 100644--- a/packages/eve/test/scenarios/eve-init.scenario.test.ts+++ b/packages/eve/test/scenarios/eve-init.scenario.test.ts@@ -24,9 +24,6 @@ const PNPM_INIT_INSTALL_ARGUMENTS = ["--yes","--config.minimum-release-age=0",] as const;-const PNPM_FALLBACK_INSTALL_ARGUMENTS = PNPM_INIT_INSTALL_ARGUMENTS.filter(- (argument) => argument !== "--yes",-);const createScratchDirectory = useTemporaryDirectories();@@ -75,10 +72,7 @@ function withoutCodingAgentMarkers(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {return scrubbed;}-async function createFakePnpmEnvironment(- scratch: string,- options: { rejectAutoApprove?: boolean } = {},-): Promise<{+async function createFakePnpmEnvironment(scratch: string): Promise<{env: NodeJS.ProcessEnv;readCalls(): Promise<PackageManagerCall[]>;}> {@@ -94,15 +88,6 @@ async function createFakePnpmEnvironment(" process.env.EVE_INIT_PNPM_LOG,"," `${JSON.stringify({ args, cwd: process.cwd() })}\\n`,",");",- ...(options.rejectAutoApprove === true- ? [- 'if (args.includes("--yes")) {',- " console.error(\"ERROR Unknown option: 'yes'\");",- ' console.error("For help, run: pnpm help install");',- " process.exit(1);",- "}",- ]- : []),'if (args.includes("install")) {',' writeFileSync(join(process.cwd(), "pnpm-lock.yaml"), "lockfileVersion: 9.0\\n");',"}",@@ -136,56 +121,6 @@ async function createFakePnpmEnvironment(};}-async function createFakeNpmEnvironment(scratch: string): Promise<{- env: NodeJS.ProcessEnv;- readCalls(): Promise<PackageManagerCall[]>;-}> {- const fakeNpmPath = join(scratch, "fake-npm.cjs");- const logPath = join(scratch, "npm-calls.jsonl");- await writeFile(- fakeNpmPath,- [- 'const { appendFileSync, writeFileSync } = require("node:fs");',- 'const { join } = require("node:path");',- "const args = process.argv.slice(2);",- "appendFileSync(",- " process.env.EVE_INIT_NPM_LOG,",- " `${JSON.stringify({ args, cwd: process.cwd() })}\\n`,",- ");",- 'if (args.includes("install")) {',- ' writeFileSync(join(process.cwd(), "package-lock.json"), "{}\\n");',- "}",- ].join("\n"),- );-- const { PNPM_HOME: _pnpmHome, ...baseEnv } = process.env;- const env = {- ...withoutCodingAgentMarkers(baseEnv),- EVE_INIT_NPM_LOG: logPath,- GIT_CONFIG_COUNT: "1",- GIT_CONFIG_KEY_0: "commit.gpgsign",- GIT_CONFIG_VALUE_0: "false",- GIT_AUTHOR_EMAIL: "[email protected]",- GIT_AUTHOR_NAME: "eve Init",- GIT_COMMITTER_EMAIL: "[email protected]",- GIT_COMMITTER_NAME: "eve Init",- npm_config_user_agent: "npm/11.0.0 node/v24.0.0 darwin arm64",- npm_execpath: fakeNpmPath,- };-- return {- env,- async readCalls() {- const content = await readFile(logPath, "utf8");- return content- .trim()- .split("\n")- .filter(Boolean)- .map((line) => JSON.parse(line) as PackageManagerCall);- },- };-}-describe("eve init smoke", () => {it("installs and runs a standalone pnpm scaffold under an inherited release-age policy", async () => {const scratch = await createScratchDirectory("eve-init-release-age-");@@ -325,137 +260,6 @@ describe("eve init smoke", () => {).resolves.toMatchObject({ stdout: "" });});- it("retries without auto-approval when pnpm rejects the option", async () => {- const scratch = await createScratchDirectory("eve-init-pnpm-fallback-");- const fakePnpm = await createFakePnpmEnvironment(scratch, { rejectAutoApprove: true });-- const result = await runEveBin(scratch, ["init", "fallback-agent"], fakePnpm.env);-- expect(result.exitCode, result.stderr).toBe(0);- expect(result.stderr).not.toContain("Unknown option");- const projectDir = await realpath(join(scratch, "fallback-agent"));- expect(await fakePnpm.readCalls()).toEqual([- {- args: ["--dir", projectDir, ...PNPM_INIT_INSTALL_ARGUMENTS],- cwd: projectDir,- },- {- args: ["--dir", projectDir, ...PNPM_FALLBACK_INSTALL_ARGUMENTS],- cwd: projectDir,- },- ]);- });-- it("adds Web Chat without Vercel configuration", async () => {- const scratch = await createScratchDirectory("eve-init-web-");- const fakePnpm = await createFakePnpmEnvironment(scratch);-- const result = await runEveBin(- scratch,- ["init", "web-agent", "--channel-web-nextjs"],- fakePnpm.env,- );-- expect(result.exitCode, result.stderr).toBe(0);- const projectDir = join(scratch, "web-agent");- await expect(pathExists(join(projectDir, "app/page.tsx"))).resolves.toBe(true);- await expect(pathExists(join(projectDir, "vercel.json"))).resolves.toBe(false);- expect(await readFile(join(projectDir, "next.config.ts"), "utf8")).toContain(- "export default withEve(nextConfig);",- );- const [installCall, ...remainingCalls] = await fakePnpm.readCalls();- expect(installCall?.args.slice(-PNPM_INIT_INSTALL_ARGUMENTS.length)).toEqual(- PNPM_INIT_INSTALL_ARGUMENTS,- );- expect(remainingCalls).toEqual([]);- });-- it("adds Web Chat through npm without writing pnpm configuration", async () => {- const scratch = await createScratchDirectory("eve-init-web-npm-");- const fakeNpm = await createFakeNpmEnvironment(scratch);-- const result = await runEveBin(- scratch,- ["init", "web-agent", "--channel-web-nextjs"],- fakeNpm.env,- );-- expect(result.exitCode, result.stderr).toBe(0);- const projectDir = join(scratch, "web-agent");- const canonicalProjectDir = await realpath(projectDir);- await expect(pathExists(join(projectDir, "app/page.tsx"))).resolves.toBe(true);- await expect(pathExists(join(projectDir, "pnpm-workspace.yaml"))).resolves.toBe(false);- await expect(pathExists(join(projectDir, "package-lock.json"))).resolves.toBe(true);- expect(await fakeNpm.readCalls()).toEqual([- {- args: ["install", "--yes", "--min-release-age=0"],- cwd: canonicalProjectDir,- },- ]);- });-- it("adds an agent to an existing pnpm project targeted as a directory", async () => {- const scratch = await createScratchDirectory("eve-init-dir-");- const fakePnpm = await createFakePnpmEnvironment(scratch);- await writeFile(- join(scratch, "package.json"),- `${JSON.stringify(- {- name: "host-app",- dependencies: { zod: "^3.25.0" },- engines: { node: ">=24" },- },- null,- 2,- )}\n`,- );- await writeFile(join(scratch, "pnpm-lock.yaml"), "lockfileVersion: 9.0\n");-- const result = await runEveBin(scratch, ["init", "."], fakePnpm.env);-- expect(result.exitCode, result.stderr).toBe(0);- expect(result.stdout).toContain("Added an eve agent to ");- const agentSource = await readFile(join(scratch, "agent/agent.ts"), "utf8");- expect(agentSource).toContain(DEFAULT_AGENT_MODEL_ID);- await expect(pathExists(join(scratch, "agent/instructions.md"))).resolves.toBe(true);- expect(JSON.parse(await readFile(join(scratch, "package.json"), "utf8"))).toMatchObject({- dependencies: { zod: "^3.25.0" },- engines: { node: "24.x" },- });- expect(result.stdout).toContain('Overrode package.json engines.node from ">=24" to "24.x"');- await expect(readFile(join(scratch, "pnpm-workspace.yaml"), "utf8")).resolves.toContain(- "minimumReleaseAgeStrict: true",- );- const calls = await fakePnpm.readCalls();- expect(calls[0]?.args.slice(-PNPM_INIT_INSTALL_ARGUMENTS.length)).toEqual(- PNPM_INIT_INSTALL_ARGUMENTS,- );- expect(calls).toHaveLength(1);- });-- it("scaffolds the current directory for a coding agent that omits the target", async () => {- const scratch = await createScratchDirectory("eve-init-agent-bare-");- const fakePnpmRoot = await createScratchDirectory("eve-init-agent-bare-pnpm-");- const fakePnpm = await createFakePnpmEnvironment(fakePnpmRoot);-- const result = await runEveBin(scratch, ["init"], { ...fakePnpm.env, AI_AGENT: "claude" });-- expect(result.exitCode, result.stderr).toBe(0);- const canonicalProjectDir = await realpath(scratch);- expect(await readFile(join(scratch, "agent/agent.ts"), "utf8")).toContain(- DEFAULT_AGENT_MODEL_ID,- );- await expect(pathExists(join(scratch, ".git"))).resolves.toBe(true);- expect(await fakePnpm.readCalls()).toEqual([- {- args: ["--dir", canonicalProjectDir, ...PNPM_INIT_INSTALL_ARGUMENTS],- cwd: canonicalProjectDir,- },- ]);- expect(result.stdout).toContain("Created an eve agent in ");- expect(result.stdout).toContain("eve dev --no-ui");- });-it("warns and continues when a coding agent passes the compatibility yes flag", async () => {const scratch = await createScratchDirectory("eve-init-agent-fumble-");const fakePnpmRoot = await createScratchDirectory("eve-init-agent-fumble-pnpm-");@@ -472,56 +276,6 @@ describe("eve init smoke", () => {await expect(pathExists(join(scratch, "fumble-agent", "agent/agent.ts"))).resolves.toBe(true);});- it("scaffolds the current empty directory when the target is omitted", async () => {- const scratch = await createScratchDirectory("eve-init-human-bare-");- const fakePnpmRoot = await createScratchDirectory("eve-init-human-bare-pnpm-");- const fakePnpm = await createFakePnpmEnvironment(fakePnpmRoot);-- const result = await runEveBin(scratch, ["init"], fakePnpm.env);-- expect(result.exitCode, result.stderr).toBe(0);- const canonicalProjectDir = await realpath(scratch);- expect(await readFile(join(scratch, "agent/agent.ts"), "utf8")).toContain(- DEFAULT_AGENT_MODEL_ID,- );- await expect(pathExists(join(scratch, ".git"))).resolves.toBe(true);- expect(await fakePnpm.readCalls()).toEqual([- {- args: ["--dir", canonicalProjectDir, ...PNPM_INIT_INSTALL_ARGUMENTS],- cwd: canonicalProjectDir,- },- ]);- });-- it("scaffolds for a coding agent but prints the dev command instead of starting the TUI", async () => {- const scratch = await createScratchDirectory("eve-init-agent-named-");- const fakePnpm = await createFakePnpmEnvironment(scratch);-- const result = await runEveBin(scratch, ["init", "smoke-agent"], {- ...fakePnpm.env,- AI_AGENT: "claude",- });-- expect(result.exitCode, result.stderr).toBe(0);- const projectDir = join(scratch, "smoke-agent");- const canonicalProjectDir = await realpath(projectDir);- expect(await readFile(join(projectDir, "agent/agent.ts"), "utf8")).toContain(- DEFAULT_AGENT_MODEL_ID,- );- await expect(pathExists(join(projectDir, ".git"))).resolves.toBe(true);- // Install runs through the real binary, but the dev server is handed off as- // text rather than spawned: the only package-manager call is the install- // itself. The handoff supplies a headless command the coding agent can run- // later in a controllable background process.- expect(await fakePnpm.readCalls()).toEqual([- {- args: ["--dir", canonicalProjectDir, ...PNPM_INIT_INSTALL_ARGUMENTS],- cwd: canonicalProjectDir,- },- ]);- expect(result.stdout).toContain("eve dev --no-ui");- });-it("rejects path-like names without writing outside the current directory", async () => {const scratch = await createScratchDirectory("eve-init-invalid-name-");const escapedName = `${basename(scratch)}-escaped`;diff --git a/packages/eve/test/scenarios/mounted-extension-authored-source.scenario.test.ts b/packages/eve/test/scenarios/mounted-extension-authored-source.scenario.test.tsdeleted file mode 100644index fd19da2dc..000000000--- a/packages/eve/test/scenarios/mounted-extension-authored-source.scenario.test.ts+++ /dev/null@@ -1,80 +0,0 @@-import { describe, expect, it } from "vitest";--import { compileAgent } from "../../src/compiler/compile-agent.js";-import { createDiskRuntimeCompiledArtifactsSource } from "../../src/runtime/compiled-artifacts-source.js";-import { loadCompiledManifest } from "../../src/runtime/loaders/manifest.js";-import { loadCompiledModuleMapFromAuthoredSource } from "../../src/internal/authored-module-map-loader.js";-import { resolveRuntimeAgentGraph } from "../../src/runtime/resolve-agent-graph.js";-import { useScenarioApp } from "../../src/internal/testing/scenario-app.js";--const scenarioApp = useScenarioApp();-const compatibilityManifest = JSON.stringify({- kind: "eve-extension",- formatVersion: 1,- builtWithEve: "0.0.0-test",- requires: { extension: 1, tool: 1, config: 1 },-});--/**- * Runs the `eve eval` / `eve dev` path: the module map is hydrated from authored- * source, so the extension-scope plugin must bind config across separately-bundled- * mount and tool modules. Deterministic guard for the config-binding regression.- */-describe("mounted extension via authored-source loader", () => {- it("binds mounted config so a composed tool reads it", async () => {- const app = await scenarioApp({- name: "mounted-extension-authored-source",- installDependencies: true,- files: {- "agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',- "agent/instructions.md": "You are a precise assistant.\n",- "agent/extensions/crm.mjs": [- 'import crm from "@acme/crm";',- 'export default crm({ apiKey: "sk-authored" });',- "",- ].join("\n"),- "node_modules/@acme/crm/package.json": `${JSON.stringify({- name: "@acme/crm",- type: "module",- eve: { extension: { source: "source", dist: "extension" } },- exports: { ".": "./extension/extension.mjs" },- })}\n`,- "node_modules/@acme/crm/extension/_manifest.json": compatibilityManifest,- "node_modules/@acme/crm/extension/extension.mjs": [- 'import { defineExtension } from "eve/extension";',- // Minimal pass-through Standard Schema — this scenario tests binding, not validation.- "const config = { '~standard': { version: 1, vendor: 'scenario', validate: (value) => ({ value }) } };",- "export default defineExtension({ config });",- "",- ].join("\n"),- "node_modules/@acme/crm/extension/tools/crm_echo.mjs": [- 'import { defineTool } from "eve/tools";',- 'import extension from "../extension.mjs";',- "export default defineTool({",- ' description: "Echo the configured API key.",',- " inputSchema: { type: 'object', properties: {}, additionalProperties: false },",- " async execute() {",- " return { apiKey: extension.config.apiKey };",- " },",- "});",- "",- ].join("\n"),- },- });-- await compileAgent({ startPath: app.appRoot });-- const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(app.appRoot);- const [manifest, moduleMap] = await Promise.all([- loadCompiledManifest({ compiledArtifactsSource }),- loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),- ]);- const graph = await resolveRuntimeAgentGraph({ manifest, moduleMap });-- const tool = graph.root.agent.tools.find((entry) => entry.name === "crm__crm_echo");- expect(tool).toBeDefined();- await expect(tool?.execute?.({}, { messages: [], toolCallId: "call_1" })).resolves.toEqual({- apiKey: "sk-authored",- });- });-});diff --git a/packages/eve/test/scenarios/mounted-extension-installed.scenario.test.ts b/packages/eve/test/scenarios/mounted-extension-installed.scenario.test.tsindex cabb4fc63..e9f7a00de 100644--- a/packages/eve/test/scenarios/mounted-extension-installed.scenario.test.ts+++ b/packages/eve/test/scenarios/mounted-extension-installed.scenario.test.ts@@ -1,33 +1,42 @@-import { mkdir, mkdtemp, readdir, readFile, rm, symlink, writeFile } from "node:fs/promises";+import { mkdir, readdir, readFile, symlink, writeFile } from "node:fs/promises";import { createRequire } from "node:module";-import { tmpdir } from "node:os";import { dirname, join, relative } from "node:path";-import { afterEach, describe, expect, it } from "vitest";+import { describe, expect, it } from "vitest";import { compileAgent } from "../../src/compiler/compile-agent.js";import { EXTENSION_CAPABILITY_VERSIONS } from "../../src/compiler/extension-compatibility.js";+import { loadCompiledModuleMapFromAuthoredSource } from "../../src/internal/authored-module-map-loader.js";import {buildExtensionPackage,tryReadExtensionBuildConfig,} from "../../src/internal/nitro/host/build-extension.js";-import { loadCompiledModuleMapFromAuthoredSource } from "../../src/internal/authored-module-map-loader.js";-import { useScenarioApp } from "../../src/internal/testing/scenario-app.js";+import {+ useTemporaryAppRoots,+ useTemporaryDirectories,+} from "../../src/internal/testing/use-temporary-app-roots.js";import { createDiskRuntimeCompiledArtifactsSource } from "../../src/runtime/compiled-artifacts-source.js";import { loadCompiledManifest } from "../../src/runtime/loaders/manifest.js";import { resolveRuntimeAgentGraph } from "../../src/runtime/resolve-agent-graph.js";import { loadResolvedModuleExport } from "../../src/runtime/resolve-helpers.js";-const scenarioApp = useScenarioApp();-const tempRoots: string[] = [];+// Scenario tier: building the extension package spawns tsc for declarations.+const createAppRoot = useTemporaryAppRoots();+const createScratchDirectory = useTemporaryDirectories();-afterEach(async () => {- await Promise.all(- tempRoots- .splice(0)- .map((root) => rm(root, { force: true, maxRetries: 5, recursive: true, retryDelay: 200 })),- );-});+/**+ * Compiles the app and hydrates the module map from authored source, the+ * `eve eval` / `eve dev` path.+ */+async function compileRuntimeGraph(appRoot: string) {+ await compileAgent({ startPath: appRoot });+ const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(appRoot);+ const [manifest, moduleMap] = await Promise.all([+ loadCompiledManifest({ compiledArtifactsSource }),+ loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),+ ]);+ return { graph: await resolveRuntimeAgentGraph({ manifest, moduleMap }), manifest, moduleMap };+}const PACKAGE_NAME = "@acme/installed-crm";const EXT_TREE: Readonly<Record<string, string>> = {@@ -189,8 +198,7 @@ const EXT_TREE: Readonly<Record<string, string>> = {* and normalize the emitted agent-shaped distribution.*/async function buildInstalledExtensionFiles(): Promise<Record<string, string>> {- const extRoot = await mkdtemp(join(tmpdir(), "eve-ext-src-"));- tempRoots.push(extRoot);+ const extRoot = await createScratchDirectory("eve-ext-src-");await writeFile(join(extRoot, "package.json"),`${JSON.stringify(@@ -257,9 +265,7 @@ describe("mounted extension installed under node_modules", () => {subagent: EXTENSION_CAPABILITY_VERSIONS.subagent,},});- const app = await scenarioApp({- name: "mounted-extension-installed",- installDependencies: true,+ const app = await createAppRoot("eve-mounted-extension-installed-", {files: {"agent/agent.mjs": 'export default { model: "openai/gpt-5.4" };\n',"agent/instructions.md": "You are a precise assistant.\n",@@ -284,14 +290,7 @@ describe("mounted extension installed under node_modules", () => {},});- await compileAgent({ startPath: app.appRoot });-- const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(app.appRoot);- const [manifest, moduleMap] = await Promise.all([- loadCompiledManifest({ compiledArtifactsSource }),- loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),- ]);- const graph = await resolveRuntimeAgentGraph({ manifest, moduleMap });+ const { graph, manifest, moduleMap } = await compileRuntimeGraph(app.appRoot);const echo = graph.root.agent.tools.find((entry) => entry.name === "crm__echo");expect(echo).toBeDefined();diff --git a/packages/eve/test/scenarios/mounted-extension-no-config.scenario.test.ts b/packages/eve/test/scenarios/mounted-extension-no-config.scenario.test.tsdeleted file mode 100644index 7b690fba9..000000000--- a/packages/eve/test/scenarios/mounted-extension-no-config.scenario.test.ts+++ /dev/null@@ -1,73 +0,0 @@-import { describe, expect, it } from "vitest";--import { compileAgent } from "../../src/compiler/compile-agent.js";-import { createDiskRuntimeCompiledArtifactsSource } from "../../src/runtime/compiled-artifacts-source.js";-import { loadCompiledManifest } from "../../src/runtime/loaders/manifest.js";-import { loadCompiledModuleMapFromAuthoredSource } from "../../src/internal/authored-module-map-loader.js";-import { resolveRuntimeAgentGraph } from "../../src/runtime/resolve-agent-graph.js";-import { useScenarioApp } from "../../src/internal/testing/scenario-app.js";--const scenarioApp = useScenarioApp();-const compatibilityManifest = JSON.stringify({- kind: "eve-extension",- formatVersion: 1,- builtWithEve: "0.0.0-test",- requires: { extension: 1, tool: 1 },-});--/**- * A no-config extension (`defineExtension()`, no schema) mounted with a bare- * re-export — no factory call. Proves config is optional end to end through the- * dev/eval loader.- */-describe("mounted extension without config", () => {- it("composes and runs a no-config extension mounted via re-export", async () => {- const app = await scenarioApp({- name: "mounted-extension-no-config",- installDependencies: true,- 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,- "node_modules/@acme/widget/extension/extension.mjs": [- 'import { defineExtension } from "eve/extension";',- "export default defineExtension();",- "",- ].join("\n"),- "node_modules/@acme/widget/extension/tools/widget_ping.mjs": [- 'import { defineTool } from "eve/tools";',- "export default defineTool({",- ' description: "Return a fixed widget token.",',- " inputSchema: { type: 'object', properties: {}, additionalProperties: false },",- " async execute() {",- ' return { token: "widget-ok" };',- " },",- "});",- "",- ].join("\n"),- },- });-- await compileAgent({ startPath: app.appRoot });-- const compiledArtifactsSource = createDiskRuntimeCompiledArtifactsSource(app.appRoot);- const [manifest, moduleMap] = await Promise.all([- loadCompiledManifest({ compiledArtifactsSource }),- loadCompiledModuleMapFromAuthoredSource({ compiledArtifactsSource }),- ]);- const graph = await resolveRuntimeAgentGraph({ manifest, moduleMap });-- const tool = graph.root.agent.tools.find((entry) => entry.name === "widget__widget_ping");- expect(tool).toBeDefined();- await expect(tool?.execute?.({}, { messages: [], toolCallId: "call_1" })).resolves.toEqual({- token: "widget-ok",- });- });-});diff --git a/packages/eve/test/scenarios/steering.scenario.test.ts b/packages/eve/test/scenarios/steering.scenario.test.tsindex d6ce97cc3..24f3df89a 100644--- a/packages/eve/test/scenarios/steering.scenario.test.ts+++ b/packages/eve/test/scenarios/steering.scenario.test.ts@@ -7,15 +7,13 @@ import { startEveDev } from "./dev-server-harness.js";const scenarioApp = useScenarioApp();describe("durable generation steering", () => {- it.each([undefined, "1"])(- "does not repeat a model step when background children wake the owner (lease %s)",- async (leaseSeconds) => {- const app = await scenarioApp({- name: "steering-background-wakes",- installDependencies: true,- files: {- "agent/instructions.md": "Delegate the five work items.\n",- "agent/agent.ts": `import { defineAgent } from "eve";+ it("does not repeat a model step when background children wake the owner mid-lease", async () => {+ const app = await scenarioApp({+ name: "steering-background-wakes",+ installDependencies: true,+ files: {+ "agent/instructions.md": "Delegate the five work items.\n",+ "agent/agent.ts": `import { defineAgent } from "eve";import { mockModel } from "eve/evals";export default defineAgent({model: mockModel(async ({ toolResults }) => {@@ -27,8 +25,8 @@ export default defineAgent({}),modelContextWindowTokens: 32000,});`,- "agent/subagents/worker/instructions.md": "Complete the work item.\n",- "agent/subagents/worker/agent.ts": `import { defineAgent } from "eve";+ "agent/subagents/worker/instructions.md": "Complete the work item.\n",+ "agent/subagents/worker/agent.ts": `import { defineAgent } from "eve";import { mockModel } from "eve/evals";export default defineAgent({description: "Complete a work item in the background.",@@ -38,39 +36,33 @@ export default defineAgent({}),modelContextWindowTokens: 32000,});`,- },- });- const server = await startEveDev(app.appRoot, {- env: {- EVE_MOCK_AUTHORED_MODELS: "",- NODE_ENV: "production",- WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS: leaseSeconds,- },- });- try {- const client = new Client({ host: server.url });- const { response } = await client.sessions.create({ message: "Start five work items." });- const result = await response.result();- const events = result.events;- const steps = events- .filter((event) => event.type === "step.started")- .map((event) => `${event.data.turnId}:${event.data.stepIndex}`);- expect(steps).toHaveLength(2);- expect(new Set(steps).size).toBe(steps.length);- expect(events.filter((event) => event.type === "turn.completed")).toHaveLength(1);- // A one-second lease expires mid-step, so the backstop must meet the- // single-flight guard. The default lease still logs this in some CI- // runs for a reason not yet identified, so there the step and turn- // counts above are the guarantee.- if (leaseSeconds !== undefined) {- expect(server.stderr()).toContain("Step execution already in flight in this process");- }- } finally {- await server.stop();- }- },- 360_000,- );+ },+ });+ const server = await startEveDev(app.appRoot, {+ env: {+ EVE_MOCK_AUTHORED_MODELS: "",+ NODE_ENV: "production",+ // A one-second lease expires mid-step, so the ownership backstop+ // races the background wakes into the single-flight guard.+ WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS: "1",+ },+ });+ try {+ const client = new Client({ host: server.url });+ const { response } = await client.sessions.create({ message: "Start five work items." });+ const result = await response.result();+ const events = result.events;+ const steps = events+ .filter((event) => event.type === "step.started")+ .map((event) => `${event.data.turnId}:${event.data.stepIndex}`);+ expect(steps).toHaveLength(2);+ expect(new Set(steps).size).toBe(steps.length);+ expect(events.filter((event) => event.type === "turn.completed")).toHaveLength(1);+ expect(server.stderr()).toContain("Step execution already in flight in this process");+ } finally {+ await server.stop();+ }+ }, 360_000);it("interrupts a pending request through the public session API and keeps one turn", async () => {const app = await scenarioApp({name: "generation-steering",