The Open Framework for Building Agents
fix(eve): stop copying app source into dev generations (#2262)
Chad Hietala822dbff57d0b
diff --git a/.changeset/sparse-dev-runtime-generations.md b/.changeset/sparse-dev-runtime-generations.mdnew file mode 100644index 000000000..07d2a5239--- /dev/null+++ b/.changeset/sparse-dev-runtime-generations.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Dev runtime generations now retain the compiled authored module graph instead of recursively copying the app and workspace source trees. Local rebuilds keep immutable runtime behavior while using substantially less disk space.diff --git a/docs/reference/cli.md b/docs/reference/cli.mdindex 115e2c611..979beafc2 100644--- a/docs/reference/cli.md+++ b/docs/reference/cli.md@@ -257,7 +257,7 @@ Local callback-based connection authorization requires a persistent server. RunLocal dev records the last ready URL per resolved app root in `.eve/dev-server-state.v1.json`. A second interactive `eve dev` reconnects only when that URL is loopback and healthy; each terminal UI creates a fresh client session while sharing the server process. A stale or malformed record is replaced when eve starts a new server. Passing `--host`, `--port`, or a `PORT` environment value skips reconnection and reports a healthy recorded server instead.-Local dev keeps immutable runtime source snapshots under `.eve/dev-runtime/snapshots/` so in-flight turns hold a consistent code revision while new turns pick up rebuilds. The terminal REPL keeps its logical session across successful rebuilds, so the next turn continues the conversation on the latest generation; `/new` terminally retires that session before clearing the transcript, and the next prompt starts a fresh session with a new session-scoped sandbox on first sandbox use. After a generation is superseded, `eve dev` retains it for at least 30 minutes and also retains the five most recently superseded generations, regardless of the configured Workflow World. The active generation is never pruned. Old runtime snapshots and local sandbox templates are pruned in the background. For manual cleanup, stop `eve dev` before deleting `.eve/dev-runtime/snapshots/` or `.eve/sandbox-cache/local/templates/`. A turn that remains unfinished beyond the automatic retention window can no longer resume after its generation is pruned.+Local dev keeps immutable runtime generations under `.eve/dev-runtime/snapshots/` so in-flight turns hold a consistent code revision while new turns pick up rebuilds. Each generation contains the compiled authored module graph and runtime resources rather than a recursive copy of the app or workspace. The terminal REPL keeps its logical session across successful rebuilds, so the next turn continues the conversation on the latest generation; `/new` terminally retires that session before clearing the transcript, and the next prompt starts a fresh session with a new session-scoped sandbox on first sandbox use. After a generation is superseded, `eve dev` retains it for at least 30 minutes and also retains the five most recently superseded generations, regardless of the configured Workflow World. The active generation is never pruned. Old runtime snapshots and local sandbox templates are pruned in the background. For manual cleanup, stop `eve dev` before deleting `.eve/dev-runtime/snapshots/` or `.eve/sandbox-cache/local/templates/`. A turn that remains unfinished beyond the automatic retention window can no longer resume after its generation is pruned.When no authored `agent/instrumentation.ts` exists, local dev also records traces under `.eve/traces/`, and bounds that store by age, size, and a keep-newest floor. Configure it with `EVE_TRACES*` in `.env.local`; see [`eve traces`](#retention) for the rules and defaults.diff --git a/packages/eve/src/internal/materialized-authored-modules.ts b/packages/eve/src/internal/materialized-authored-modules.tsindex 6967733cf..8d3cb53ff 100644--- a/packages/eve/src/internal/materialized-authored-modules.ts+++ b/packages/eve/src/internal/materialized-authored-modules.ts@@ -30,7 +30,50 @@ export interface MaterializedAuthoredModuleIndex {readonly version: 3;}-export async function materializeAuthoredModules(input: {+type PreparedMaterializedInstrumentation =+ | { readonly kind: "file"; readonly moduleCode: string }+ | {+ readonly kind: "directory";+ readonly moduleCodeBySlot: Readonly<Record<string, string>>;+ };++export interface PreparedMaterializedAuthoredModules {+ readonly instrumentation?: PreparedMaterializedInstrumentation;+ readonly moduleMapCode: string;+}++export async function prepareMaterializedAuthoredModules(input: {+ readonly manifest: CompiledAgentManifest;+ readonly moduleMapPath: string;+}): Promise<PreparedMaterializedAuthoredModules> {+ const moduleMapCode = await bundleAuthoredModuleMapForGeneration(input);+ const layout = resolveInstrumentationLayout({+ agentRoot: input.manifest.agentRoot,+ providersEnabled: input.manifest.config.experimental?.instrumentationProviders ?? false,+ });+ const externalDependencies = input.manifest.config.build?.externalDependencies ?? [];+ const bundleInstrumentationModule = async (sourcePath: string): Promise<string> =>+ await bundleAuthoredModuleForGeneration(sourcePath, { externalDependencies });+ let instrumentation: PreparedMaterializedInstrumentation | undefined;++ if (layout?.kind === "file") {+ instrumentation = {+ kind: "file",+ moduleCode: await bundleInstrumentationModule(layout.modulePath),+ };+ } else if (layout?.kind === "directory") {+ const moduleCodeBySlot: Record<string, string> = {};+ for (const [slot, sourcePath] of Object.entries(layout.modulePathsBySlot)) {+ moduleCodeBySlot[slot] = await bundleInstrumentationModule(sourcePath);+ }+ instrumentation = { kind: "directory", moduleCodeBySlot };+ }++ return instrumentation === undefined ? { moduleMapCode } : { instrumentation, moduleMapCode };+}++export async function writeMaterializedAuthoredModules(input: {+ readonly prepared: PreparedMaterializedAuthoredModules;readonly runtimeAppRoot: string;}): Promise<MaterializedAuthoredModuleIndex> {const compileRoot = join(input.runtimeAppRoot, ".eve", "compile");@@ -48,30 +91,20 @@ export async function materializeAuthoredModules(input: {}),).update("\0");- const moduleMapCode = await bundleAuthoredModuleMapForGeneration({- manifest,- moduleMapPath: join(compileRoot, "module-map.mjs"),- });const moduleMapFileName = createMaterializedModuleFileName(ROOT_COMPILED_AGENT_NODE_ID,"module-map",- moduleMapCode,+ input.prepared.moduleMapCode,);const moduleMapPath = join(MATERIALIZED_MODULES_DIRECTORY, moduleMapFileName);- await writeFile(join(modulesRoot, moduleMapFileName), moduleMapCode);- fingerprint.update("module-map\0").update(moduleMapCode).update("\0");+ await writeFile(join(modulesRoot, moduleMapFileName), input.prepared.moduleMapCode);+ fingerprint.update("module-map\0").update(input.prepared.moduleMapCode).update("\0");- const layout = resolveInstrumentationLayout({- agentRoot: manifest.agentRoot,- providersEnabled: manifest.config.experimental?.instrumentationProviders ?? false,- });- const externalDependencies = manifest.config.build?.externalDependencies ?? [];const materializeInstrumentationModule = async (sourceId: string,- sourcePath: string,+ code: string,): Promise<string> => {- const code = await bundleAuthoredModuleForGeneration(sourcePath, { externalDependencies });const fileName = createMaterializedModuleFileName(ROOT_COMPILED_AGENT_NODE_ID,`instrumentation:${sourceId}`,@@ -85,15 +118,18 @@ export async function materializeAuthoredModules(input: {let instrumentation: MaterializedInstrumentation | undefined;- if (layout?.kind === "file") {+ if (input.prepared.instrumentation?.kind === "file") {instrumentation = {kind: "file",- modulePath: await materializeInstrumentationModule("file", layout.modulePath),+ modulePath: await materializeInstrumentationModule(+ "file",+ input.prepared.instrumentation.moduleCode,+ ),};- } else if (layout?.kind === "directory") {+ } else if (input.prepared.instrumentation?.kind === "directory") {const modulePathsBySlot: Record<string, string> = {};- for (const [slot, sourcePath] of Object.entries(layout.modulePathsBySlot)) {- modulePathsBySlot[slot] = await materializeInstrumentationModule(slot, sourcePath);+ for (const [slot, code] of Object.entries(input.prepared.instrumentation.moduleCodeBySlot)) {+ modulePathsBySlot[slot] = await materializeInstrumentationModule(slot, code);}instrumentation = { kind: "directory", modulePathsBySlot };}diff --git a/packages/eve/src/internal/nitro/dev-generation-artifacts.scenario.test.ts b/packages/eve/src/internal/nitro/dev-generation-artifacts.scenario.test.tsindex f1add13b6..352b3c456 100644--- a/packages/eve/src/internal/nitro/dev-generation-artifacts.scenario.test.ts+++ b/packages/eve/src/internal/nitro/dev-generation-artifacts.scenario.test.ts@@ -437,6 +437,7 @@ describe("development generation artifacts", () => {expect(relative(canonicalSnapshotRoot, resolvedExternalPath)).toMatch(/^\.\.(?:[\\/]|$)/u);expect(existsSync(join(resolvedExternalPath, "binding.node"))).toBe(true);+ expect(existsSync(join(snapshot.runtimeAppRoot, "agent"))).toBe(false);await rm(join(app.appRoot, "node_modules", "fixture-bundled"), {force: true,diff --git a/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts b/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.tsindex 4f7054da1..6b38bea02 100644--- a/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts+++ b/packages/eve/src/internal/nitro/dev-runtime-artifacts.integration.test.ts@@ -16,7 +16,6 @@ import { describe, expect, it } from "vitest";import type { CompileAgentResult } from "#compiler/compile-agent.js";import { createCompiledAgentManifest, ROOT_COMPILED_AGENT_NODE_ID } from "#compiler/manifest.js";import { createCompiledModuleMapSource } from "#compiler/module-map.js";-import { loadAuthoredModuleNamespace } from "#internal/authored-module-loader.js";import { useTemporaryDirectories } from "#internal/testing/use-temporary-app-roots.js";import { createDiskRuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";import { getCompiledRuntimeAgentBundle } from "#runtime/sessions/compiled-agent-cache.js";@@ -32,11 +31,26 @@ import {readDevelopmentRuntimeArtifactsRevision,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot,+ type DevelopmentRuntimeArtifactsSnapshot,} from "#internal/nitro/dev-runtime-artifacts.js";import { resolveNitroCompiledArtifactsSource } from "#internal/nitro/routes/runtime-artifacts.js";const createScratchDirectory = useTemporaryDirectories();+async function markSnapshotMaterialized(+ snapshot: DevelopmentRuntimeArtifactsSnapshot,+): Promise<DevelopmentRuntimeArtifactsSnapshot> {+ const compileRoot = join(snapshot.runtimeAppRoot, ".eve", "compile");+ const moduleMap = "authored-modules/test-module-map.mjs";+ await mkdir(join(compileRoot, "authored-modules"), { recursive: true });+ await writeFile(join(compileRoot, moduleMap), "export const moduleMap = { nodes: {} };\n");+ await writeFile(+ join(compileRoot, "authored-modules.json"),+ `${JSON.stringify({ fingerprint: "test", moduleMap, version: 3 })}\n`,+ );+ return snapshot;+}+async function createNextStyleImportSnapshotFixture(): Promise<{ readonly appRoot: string }> {const appRoot = await createScratchDirectory("eve-dev-runtime-next-imports-");const agentRoot = join(appRoot, "agent");@@ -127,7 +141,8 @@ async function createNextStyleImportSnapshotFixture(): Promise<{ readonly appRoo);await publishDevelopmentGeneration({- paths: { compileDirectoryPath },+ manifest,+ paths: { compileDirectoryPath, moduleMapPath },project: { appRoot },} as CompileAgentResult);@@ -165,7 +180,10 @@ describe("development runtime artifact snapshots", () => {JSON.parse(await readFile(join(snapshot.snapshotRoot, "generation.json"), "utf8")),).toEqual({ runtimeAppRoot: snapshot.runtimeAppRoot });- await activateDevelopmentRuntimeArtifactsSnapshot({ appRoot, snapshot });+ await activateDevelopmentRuntimeArtifactsSnapshot({+ appRoot,+ snapshot: await markSnapshotMaterialized(snapshot),+ });expect(readDevelopmentRuntimeArtifactsRevision(appRoot)).toEqual({revision: snapshot.runtimeAppRoot,@@ -189,11 +207,14 @@ describe("development runtime artifact snapshots", () => {} as CompileAgentResult;const first = await stageDevelopmentRuntimeArtifactsSnapshot(compileResult);const second = await stageDevelopmentRuntimeArtifactsSnapshot(compileResult);- await activateDevelopmentRuntimeArtifactsSnapshot({ appRoot, snapshot: first });+ await activateDevelopmentRuntimeArtifactsSnapshot({+ appRoot,+ snapshot: await markSnapshotMaterialized(first),+ });const activation = await activateDevelopmentRuntimeArtifactsSnapshotTransaction({appRoot,- snapshot: second,+ snapshot: await markSnapshotMaterialized(second),});expect(readDevelopmentRuntimeArtifactsRevision(appRoot).revision).toBe(second.runtimeAppRoot);await activation.rollback();@@ -218,9 +239,7 @@ describe("development runtime artifact snapshots", () => {project: { appRoot },} as CompileAgentResult);- await expect(readFile(join(snapshot.runtimeAppRoot, "instructions.md"), "utf8")).resolves.toBe(- "You are a precise assistant.\n",- );+ expect(existsSync(join(snapshot.runtimeAppRoot, "instructions.md"))).toBe(false);await expect(readFile(join(snapshot.runtimeAppRoot, "package.json"), "utf8").then((source) => JSON.parse(source) as Record<string, unknown>,@@ -231,7 +250,7 @@ describe("development runtime artifact snapshots", () => {});});- it("excludes generated output and dependency directories from source snapshots", async () => {+ it("copies package metadata without retaining the app source tree", async () => {const appRoot = await createScratchDirectory("eve-dev-runtime-generated-output-");const agentRoot = join(appRoot, "agent");const compileDirectoryPath = join(appRoot, ".eve", "compile");@@ -267,7 +286,10 @@ describe("development runtime artifact snapshots", () => {project: { appRoot },} as CompileAgentResult);- expect(existsSync(join(snapshot.runtimeAppRoot, "agent", "agent.ts"))).toBe(true);+ await expect(readFile(join(snapshot.runtimeAppRoot, "package.json"), "utf8")).resolves.toBe(+ '{"type":"module"}\n',+ );+ expect(existsSync(join(snapshot.runtimeAppRoot, "agent"))).toBe(false);expect(existsSync(join(snapshot.runtimeAppRoot, ".devtools"))).toBe(false);expect(existsSync(join(snapshot.runtimeAppRoot, "node_modules"))).toBe(false);expect(existsSync(join(snapshot.runtimeAppRoot, ".env"))).toBe(false);@@ -420,45 +442,6 @@ describe("development runtime artifact snapshots", () => {expect(acceptableMountLocations.some((location) => existsSync(location))).toBe(true);});- it("stops copying at nested git repository boundaries", async () => {- const appRoot = await createScratchDirectory("eve-dev-runtime-nested-git-");- const agentRoot = join(appRoot, "agent");- const compileDirectoryPath = join(appRoot, ".eve", "compile");- const worktreeRoot = join(appRoot, ".claude", "worktrees", "review");- const nestedRepositoryRoot = join(appRoot, "vendor", "nested-repository");- const regularDirectoryRoot = join(appRoot, "vendor", "regular-directory");-- await mkdir(agentRoot, { recursive: true });- await mkdir(worktreeRoot, { recursive: true });- await mkdir(join(nestedRepositoryRoot, ".git"), { recursive: true });- await mkdir(regularDirectoryRoot, { recursive: true });- await mkdir(compileDirectoryPath, { recursive: true });- await writeFile(join(appRoot, "package.json"), '{"type":"module"}\n');- await writeFile(join(agentRoot, "agent.ts"), "export const answer = 42;\n");- await writeFile(join(appRoot, ".claude", "notes.md"), "keep this file\n");- await writeFile(join(worktreeRoot, ".git"), "gitdir: ../../../../.git/worktrees/review\n");- await writeFile(join(worktreeRoot, "duplicate.ts"), "export const duplicate = true;\n");- await writeFile(join(nestedRepositoryRoot, "duplicate.ts"), "export const duplicate = true;\n");- await writeFile(join(regularDirectoryRoot, "source.ts"), "export const copied = true;\n");- await writeFile(- join(compileDirectoryPath, "compiled-agent-manifest.json"),- `${JSON.stringify({ agentRoot, appRoot }, null, 2)}\n`,- );-- const snapshot = await stageDevelopmentRuntimeArtifactsSnapshot({- paths: { compileDirectoryPath },- project: { appRoot },- } as CompileAgentResult);-- expect(existsSync(join(snapshot.runtimeAppRoot, "agent", "agent.ts"))).toBe(true);- expect(existsSync(join(snapshot.runtimeAppRoot, ".claude", "notes.md"))).toBe(true);- expect(existsSync(join(snapshot.runtimeAppRoot, ".claude", "worktrees", "review"))).toBe(false);- expect(existsSync(join(snapshot.runtimeAppRoot, "vendor", "nested-repository"))).toBe(false);- expect(- existsSync(join(snapshot.runtimeAppRoot, "vendor", "regular-directory", "source.ts")),- ).toBe(true);- });-it("prunes stale snapshots while preserving the active and recent snapshots", async () => {const appRoot = await createScratchDirectory("eve-dev-runtime-artifacts-prune-");const snapshotsRoot = join(appRoot, ".eve", "dev-runtime", "snapshots");@@ -485,12 +468,12 @@ describe("development runtime artifact snapshots", () => {await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: {+ snapshot: await markSnapshotMaterialized({runtimeAppRoot: join(activeSnapshotRoot, "source", "app"),snapshotRoot: activeSnapshotRoot,snapshotSourceRoot: join(activeSnapshotRoot, "source"),sourceRoot: appRoot,- },+ }),});await utimes(activeSnapshotRoot, oldActiveTime, oldActiveTime);@@ -524,12 +507,12 @@ describe("development runtime artifact snapshots", () => {});await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: createSnapshot(firstSnapshotRoot),+ snapshot: await markSnapshotMaterialized(createSnapshot(firstSnapshotRoot)),});const beforeRetirement = Date.now();await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: createSnapshot(nextSnapshotRoot),+ snapshot: await markSnapshotMaterialized(createSnapshot(nextSnapshotRoot)),});const afterRetirement = Date.now();@@ -572,12 +555,12 @@ describe("development runtime artifact snapshots", () => {}await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: {+ snapshot: await markSnapshotMaterialized({runtimeAppRoot: join(activeSnapshotRoot, "source"),snapshotRoot: activeSnapshotRoot,snapshotSourceRoot: join(activeSnapshotRoot, "source"),sourceRoot: appRoot,- },+ }),});await pruneDevelopmentRuntimeArtifactsSnapshots({@@ -608,12 +591,12 @@ describe("development runtime artifact snapshots", () => {}await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: {+ snapshot: await markSnapshotMaterialized({runtimeAppRoot: join(activeSnapshotRoot, "source", "app"),snapshotRoot: activeSnapshotRoot,snapshotSourceRoot: join(activeSnapshotRoot, "source"),sourceRoot: appRoot,- },+ }),});await pruneDevelopmentRuntimeArtifactsSnapshots({appRoot,@@ -653,12 +636,12 @@ describe("development runtime artifact snapshots", () => {);await activateDevelopmentRuntimeArtifactsSnapshot({appRoot,- snapshot: {+ snapshot: await markSnapshotMaterialized({runtimeAppRoot: join(activeSnapshotRoot, "source"),snapshotRoot: activeSnapshotRoot,snapshotSourceRoot: join(activeSnapshotRoot, "source"),sourceRoot: appRoot,- },+ }),});const runsDirectory = join(resolveLocalWorkflowWorldDataDirectory(appRoot), "default", "runs");await mkdir(runsDirectory, { recursive: true });@@ -702,7 +685,7 @@ describe("development runtime artifact snapshots", () => {await expect(readdir(join(appRoot, ".eve", "dev-runtime", "snapshots"))).resolves.toEqual([]);});- it("freezes authored source and rewrites runtime manifest roots for new sessions", async () => {+ it("rewrites runtime manifest roots without retaining authored source", async () => {const appRoot = await createScratchDirectory("eve-dev-runtime-artifacts-");const agentRoot = join(appRoot, "agent");const compileDirectoryPath = join(appRoot, ".eve", "compile");@@ -737,7 +720,13 @@ describe("development runtime artifact snapshots", () => {paths: { compileDirectoryPath },project: { appRoot },} as CompileAgentResult);- await activateDevelopmentRuntimeArtifactsSnapshot({ appRoot, snapshot });+ await expect(+ activateDevelopmentRuntimeArtifactsSnapshot({ appRoot, snapshot }),+ ).rejects.toThrow("before its authored modules are materialized");+ await activateDevelopmentRuntimeArtifactsSnapshot({+ appRoot,+ snapshot: await markSnapshotMaterialized(snapshot),+ });await writeFile(toolPath, "export const temperature = 73;\n");@@ -768,9 +757,9 @@ describe("development runtime artifact snapshots", () => {appRoot: snapshot.runtimeAppRoot,kind: "disk",});- await expect(- readFile(join(snapshot.runtimeAppRoot, "agent", "tools", "get_weather.ts"), "utf8"),- ).resolves.toBe("export const temperature = 72;\n");+ expect(existsSync(join(snapshot.runtimeAppRoot, "agent", "tools", "get_weather.ts"))).toBe(+ false,+ );await expect(readFile(join(snapshot.runtimeAppRoot, ".eve", "compile", "compiled-agent-manifest.json"),@@ -838,7 +827,7 @@ describe("development runtime artifact snapshots", () => {expect(readDevelopmentRuntimeArtifactsSnapshotRoot(pointerPath)).toBe(runtimeAppRoot);});- it("preserves workspace-relative tsconfig extends in runtime snapshots", async () => {+ it("uses workspace tsconfig topology without retaining it in runtime snapshots", async () => {const workspaceRoot = await createScratchDirectory("eve-dev-runtime-workspace-");const appRoot = join(workspaceRoot, "agents", "d0");const agentRoot = join(appRoot, "agent");@@ -869,16 +858,9 @@ describe("development runtime artifact snapshots", () => {} as CompileAgentResult);expect(snapshot.runtimeAppRoot).toBe(join(snapshot.snapshotSourceRoot, "agents", "d0"));- await expect(- readFile(join(snapshot.snapshotSourceRoot, "tsconfig.base.json"), "utf8"),- ).resolves.toContain('"module"');+ expect(existsSync(join(snapshot.snapshotSourceRoot, "tsconfig.base.json"))).toBe(false);+ expect(existsSync(join(snapshot.runtimeAppRoot, "tsconfig.json"))).toBe(false);expect(existsSync(join(snapshot.snapshotSourceRoot, "agents", "unused"))).toBe(false);-- const moduleNamespace = await loadAuthoredModuleNamespace(- join(snapshot.runtimeAppRoot, "agent", "agent.ts"),- );-- expect(moduleNamespace.answer).toBe(42);});it("mounts local workspace packages resolved through app node_modules symlinks in place", async () => {@@ -960,14 +942,10 @@ describe("development runtime artifact snapshots", () => {);await expect(realpath(snapshotMountPath)).resolves.toBe(await realpath(packageRoot));- const moduleNamespace = await loadAuthoredModuleNamespace(- join(snapshot.runtimeAppRoot, "agent", "agent.ts"),- );-- expect(moduleNamespace.result).toBe("live");+ expect(existsSync(join(snapshot.runtimeAppRoot, "agent"))).toBe(false);});- it("freezes workspace packages that host extension mount roots", async () => {+ it("mounts workspace extension packages without retaining their source trees", async () => {const workspaceRoot = await createScratchDirectory("eve-dev-runtime-extension-package-");const appRoot = join(workspaceRoot, "apps", "agent-app");const agentRoot = join(appRoot, "agent");@@ -1034,30 +1012,12 @@ describe("development runtime artifact snapshots", () => {'export default { execute: () => "live" };\n',);- // Extension mount roots host runtime-hydrated authored source, so the- // package stays a real copy and the mount links into the snapshot.- expect(existsSync(join(snapshot.snapshotSourceRoot, "packages", "acme-extension"))).toBe(true);- await expect(- readFile(- join(- snapshot.snapshotSourceRoot,- "packages",- "acme-extension",- "extension",- "tools",- "read_label.mjs",- ),- "utf8",- ),- ).resolves.toContain("original");+ expect(existsSync(join(snapshot.snapshotSourceRoot, "packages", "acme-extension"))).toBe(false);const snapshotMountPath = join(snapshot.runtimeAppRoot, "node_modules", "@acme", "extension");- const canonicalSnapshotSourceRoot = await realpath(snapshot.snapshotSourceRoot);- await expect(realpath(snapshotMountPath)).resolves.toBe(- join(canonicalSnapshotSourceRoot, "packages", "acme-extension"),- );+ await expect(realpath(snapshotMountPath)).resolves.toBe(await realpath(packageRoot));});- it("mounts dependencies of workspace packages nested inside the app root", async () => {+ it("mounts workspace packages nested inside the app root without copying them", async () => {const appRoot = await createScratchDirectory("eve-dev-runtime-nested-workspace-");const agentRoot = join(appRoot, "agent");const packageRoot = join(appRoot, "packages", "nested");@@ -1070,8 +1030,6 @@ describe("development runtime artifact snapshots", () => {await mkdir(installedPackageRoot, { recursive: true });await mkdir(join(appRoot, "node_modules", "@repo"), { recursive: true });await mkdir(compileDirectoryPath, { recursive: true });- // The app root is also the workspace root, so workspace packages live- // inside the copied app tree.await writeFile(join(appRoot, "pnpm-workspace.yaml"), "packages:\n - packages/*\n");await writeFile(join(appRoot, "package.json"),@@ -1120,29 +1078,10 @@ describe("development runtime artifact snapshots", () => {project: { appRoot },} as CompileAgentResult);- // A copied workspace package keeps the dependency mounts its snapshot- // copy resolves through.expect(existsSync(join(snapshot.snapshotSourceRoot, "packages", "nested", "dist", "index.js")),- ).toBe(true);- const nestedDependencyMount = join(- snapshot.snapshotSourceRoot,- "packages",- "nested",- "node_modules",- "external-value",- );- await expect(- lstat(nestedDependencyMount).then((stats) => stats.isSymbolicLink()),- ).resolves.toBe(true);- await expect(realpath(nestedDependencyMount)).resolves.toBe(- await realpath(installedPackageRoot),- );-- const moduleNamespace = await loadAuthoredModuleNamespace(- join(snapshot.snapshotSourceRoot, "packages", "nested", "dist", "index.js"),- );-- expect(moduleNamespace.message).toBe("nested");+ ).toBe(false);+ const snapshotMountPath = join(snapshot.runtimeAppRoot, "node_modules", "@repo", "nested");+ await expect(realpath(snapshotMountPath)).resolves.toBe(await realpath(packageRoot));});});diff --git a/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts b/packages/eve/src/internal/nitro/dev-runtime-artifacts.tsindex 899cb184a..96b932cd6 100644--- a/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts+++ b/packages/eve/src/internal/nitro/dev-runtime-artifacts.ts@@ -5,6 +5,7 @@ import { dirname, join, relative, resolve, sep } from "node:path";import type { CompileAgentResult } from "#compiler/compile-agent.js";import type { CompiledAgentManifest } from "#compiler/manifest.js";+import { readMaterializedAuthoredModuleIndex } from "#internal/materialized-authored-modules.js";import { copyDevelopmentSourceSnapshot } from "#internal/nitro/dev-runtime-source-snapshot-copy.js";import {createDevelopmentSourceSnapshotPlan,@@ -153,6 +154,18 @@ export async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(inpreadonly appRoot: string;readonly snapshot: DevelopmentRuntimeArtifactsSnapshot;}): Promise<DevelopmentRuntimeArtifactsActivation> {+ const materializedIndex = await readMaterializedAuthoredModuleIndex(+ input.snapshot.runtimeAppRoot,+ );+ if (+ materializedIndex === undefined ||+ !existsSync(join(input.snapshot.runtimeAppRoot, ".eve", "compile", materializedIndex.moduleMap))+ ) {+ throw new Error(+ `Cannot activate development runtime generation "${input.snapshot.snapshotRoot}" before its authored modules are materialized.`,+ );+ }+const markerPath = join(input.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,diff --git a/packages/eve/src/internal/nitro/dev-runtime-source-snapshot-copy.ts b/packages/eve/src/internal/nitro/dev-runtime-source-snapshot-copy.tsindex 24575e77a..884ef5a4f 100644--- a/packages/eve/src/internal/nitro/dev-runtime-source-snapshot-copy.ts+++ b/packages/eve/src/internal/nitro/dev-runtime-source-snapshot-copy.ts@@ -1,35 +1,13 @@import { constants as fsConstants, existsSync } from "node:fs";-import { cp, lstat, mkdir, readFile, readdir, symlink, writeFile } from "node:fs/promises";-import { dirname, join, relative, resolve, sep } from "node:path";+import { cp, mkdir, symlink, writeFile } from "node:fs/promises";+import { dirname, join } from "node:path";-import {- extractTsConfigExtendsSpecifiers,- isTsConfigFilePath,- parseTsConfigObject,- readTextFileIfExists,- resolveFirstExistingTsConfigExtendsTarget,- resolveTsConfigExtendsTargetPaths,-} from "#internal/application/tsconfig-dependencies.js";import {DevelopmentRuntimeSourceSnapshotError,type DevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath,} from "#internal/nitro/dev-runtime-source-snapshot.js";-const SNAPSHOT_SKIP_NAMES = new Set([- ".devtools",- ".generated",- ".eve",- ".git",- ".next",- ".output",- ".turbo",- ".vercel",- ".workflow-data",- ".workflow-vitest",- "node_modules",-]);-const SNAPSHOT_APP_ROOT_SKIP_NAMES = new Set(["build", "dist"]);const SNAPSHOT_COPY_MODE = fsConstants.COPYFILE_FICLONE;export async function copyDevelopmentSourceSnapshot(@@ -37,276 +15,32 @@ export async function copyDevelopmentSourceSnapshot(): Promise<void> {await mkdir(plan.snapshotSourceRoot, { recursive: true });- for (const sourceRoot of plan.copyRoots) {- await copySnapshotPath({- plan,- sourcePath: sourceRoot,- targetPath: toSnapshotPathForPlan(plan, sourceRoot),- });- }-for (const sourcePath of plan.copyFiles) {if (!existsSync(sourcePath)) {continue;}- await copySnapshotPath({- plan,- sourcePath,- targetPath: toSnapshotPathForPlan(plan, sourcePath),- });+ const targetPath = toSnapshotPathForPlan(plan, sourcePath);+ try {+ await mkdir(dirname(targetPath), { recursive: true });+ await cp(sourcePath, targetPath, { mode: SNAPSHOT_COPY_MODE, recursive: true });+ } catch (error) {+ throw new DevelopmentRuntimeSourceSnapshotError(+ `Failed to copy development runtime source snapshot path "${sourcePath}" to "${targetPath}": ${formatErrorMessage(error)}`,+ );+ }}- await rewriteSnapshotTsConfigAbsoluteExtends(plan);await createSnapshotDependencyMounts(plan);await ensureRuntimePackageJson(plan);- await validateDevelopmentSourceSnapshot(plan);-}--async function copySnapshotPath(input: {- readonly plan: DevelopmentSourceSnapshotPlan;- readonly sourcePath: string;- readonly targetPath: string;-}): Promise<void> {- try {- const stats = await lstat(input.sourcePath);-- if (stats.isDirectory()) {- await copySnapshotDirectory(input);- return;- }-- await mkdir(dirname(input.targetPath), { recursive: true });- await cp(input.sourcePath, input.targetPath, {- mode: SNAPSHOT_COPY_MODE,- recursive: true,- });- } catch (error) {- throw new DevelopmentRuntimeSourceSnapshotError(- `Failed to copy development runtime source snapshot path "${input.sourcePath}" to "${input.targetPath}": ${formatErrorMessage(error)}`,- );- }-}--async function copySnapshotDirectory(input: {- readonly plan: DevelopmentSourceSnapshotPlan;- readonly sourcePath: string;- readonly targetPath: string;-}): Promise<void> {- await mkdir(input.targetPath, { recursive: true });-- for (const entry of await readdir(input.sourcePath, { withFileTypes: true })) {- const sourcePath = join(input.sourcePath, entry.name);-- if (shouldSkipSnapshotSource(input.plan, sourcePath)) {- continue;- }-- await cp(sourcePath, join(input.targetPath, entry.name), {- filter: (source) => !shouldSkipSnapshotSource(input.plan, source),- mode: SNAPSHOT_COPY_MODE,- recursive: true,- });- }-}--function shouldSkipSnapshotSource(- plan: DevelopmentSourceSnapshotPlan,- sourcePath: string,-): boolean {- const relativePath = relative(plan.sourceRoot, sourcePath);- if (relativePath.length === 0) {- return false;- }-- if (- relativePath- .split(/[\\/]/)- .some((part) => SNAPSHOT_SKIP_NAMES.has(part) || part.startsWith(".env"))- ) {- return true;- }-- if (existsSync(join(sourcePath, ".git"))) {- return true;- }-- return isDirectAppRootSkipPath({- appRoot: plan.appRoot,- sourcePath,- });-}--function isDirectAppRootSkipPath(input: {- readonly appRoot: string;- readonly sourcePath: string;-}): boolean {- if (!isPathInsideOrEqual(input.sourcePath, input.appRoot)) {- return false;- }-- const relativePath = relative(input.appRoot, input.sourcePath);- if (relativePath.length === 0) {- return false;- }-- const firstPart = relativePath.split(/[\\/]/)[0];- return firstPart !== undefined && SNAPSHOT_APP_ROOT_SKIP_NAMES.has(firstPart);-}--async function rewriteSnapshotTsConfigAbsoluteExtends(- plan: DevelopmentSourceSnapshotPlan,-): Promise<void> {- for (const configPath of plan.tsconfigPaths) {- const source = await readTextFileIfExists(configPath);-- if (source === undefined) {- continue;- }-- const rewritten = rewriteTsConfigAbsoluteExtends({- configPath,- snapshotConfigPath: toSnapshotPathForPlan(plan, configPath),- snapshotSourceRoot: plan.snapshotSourceRoot,- source,- sourceRoot: plan.sourceRoot,- });-- if (rewritten === undefined) {- continue;- }-- await writeFile(toSnapshotPathForPlan(plan, configPath), rewritten);- }-}--function rewriteTsConfigAbsoluteExtends(input: {- readonly configPath: string;- readonly snapshotConfigPath: string;- readonly snapshotSourceRoot: string;- readonly source: string;- readonly sourceRoot: string;-}): string | undefined {- const parsedConfig = parseTsConfigObject(input.source);-- if (parsedConfig === undefined) {- return undefined;- }-- const rewrittenExtends = rewriteTsConfigExtendsValue({- configPath: input.configPath,- snapshotConfigPath: input.snapshotConfigPath,- snapshotSourceRoot: input.snapshotSourceRoot,- sourceRoot: input.sourceRoot,- value: parsedConfig.extends,- });-- if (rewrittenExtends.changed !== true) {- return undefined;- }-- return `${JSON.stringify(- {- ...parsedConfig,- extends: rewrittenExtends.value,- },- null,- 2,- )}\n`;-}--function rewriteTsConfigExtendsValue(input: {- readonly configPath: string;- readonly snapshotConfigPath: string;- readonly snapshotSourceRoot: string;- readonly sourceRoot: string;- readonly value: unknown;-}): { readonly changed: boolean; readonly value: unknown } {- if (typeof input.value === "string") {- const rewritten = rewriteTsConfigExtendsSpecifier({- configPath: input.configPath,- snapshotConfigPath: input.snapshotConfigPath,- snapshotSourceRoot: input.snapshotSourceRoot,- sourceRoot: input.sourceRoot,- value: input.value,- });-- return rewritten === undefined- ? { changed: false, value: input.value }- : { changed: true, value: rewritten };- }-- if (!Array.isArray(input.value)) {- return { changed: false, value: input.value };- }-- let changed = false;- const rewrittenValues = input.value.map((value) => {- if (typeof value !== "string") {- return value;- }-- const rewritten = rewriteTsConfigExtendsSpecifier({- configPath: input.configPath,- snapshotConfigPath: input.snapshotConfigPath,- snapshotSourceRoot: input.snapshotSourceRoot,- sourceRoot: input.sourceRoot,- value,- });-- if (rewritten === undefined) {- return value;- }-- changed = true;- return rewritten;- });-- return {- changed,- value: rewrittenValues,- };-}--function rewriteTsConfigExtendsSpecifier(input: {- readonly configPath: string;- readonly snapshotConfigPath: string;- readonly snapshotSourceRoot: string;- readonly sourceRoot: string;- readonly value: string;-}): string | undefined {- if (!isTsConfigFilePath(input.value) || !isAbsoluteFilePath(input.value)) {- return undefined;- }-- const targetPath = resolveFirstExistingTsConfigExtendsTarget({- configPath: input.configPath,- extendsSpecifier: input.value,- });-- if (targetPath === undefined || !isPathInsideOrEqual(targetPath, input.sourceRoot)) {- return undefined;- }-- return toDevelopmentSourceSnapshotPath({- snapshotSourceRoot: input.snapshotSourceRoot,- sourcePath: targetPath,- sourceRoot: input.sourceRoot,- });}async function createSnapshotDependencyMounts(plan: DevelopmentSourceSnapshotPlan): Promise<void> {for (const dependencyMount of plan.dependencyMounts) {const snapshotMountPath = toSnapshotPathForPlan(plan, dependencyMount.mountPath);- const sourcePath = dependencyMount.copied- ? toSnapshotPathForPlan(plan, dependencyMount.sourcePath)- : dependencyMount.sourcePath;- const mountTarget = dependencyMount.copied- ? relative(dirname(snapshotMountPath), sourcePath) || "."- : sourcePath;await mkdir(dirname(snapshotMountPath), { recursive: true });- await symlink(mountTarget, snapshotMountPath, "junction");+ await symlink(dependencyMount.sourcePath, snapshotMountPath, "junction");}}@@ -331,54 +65,6 @@ async function ensureRuntimePackageJson(plan: DevelopmentSourceSnapshotPlan): Pr);}-async function validateDevelopmentSourceSnapshot(- plan: DevelopmentSourceSnapshotPlan,-): Promise<void> {- const runtimePackageJsonPath = join(plan.runtimeAppRoot, "package.json");-- if (!existsSync(runtimePackageJsonPath)) {- throw new DevelopmentRuntimeSourceSnapshotError(- `Development runtime source snapshot is missing the runtime app package.json at "${runtimePackageJsonPath}".`,- );- }-- for (const configPath of plan.tsconfigPaths) {- const snapshotConfigPath = toSnapshotPathForPlan(plan, configPath);-- if (!existsSync(snapshotConfigPath)) {- throw new DevelopmentRuntimeSourceSnapshotError(- `Development runtime source snapshot is missing tsconfig dependency "${snapshotConfigPath}".`,- );- }-- await validateSnapshotTsConfigExtends(snapshotConfigPath);- }-}--async function validateSnapshotTsConfigExtends(configPath: string): Promise<void> {- const source = await readFile(configPath, "utf8");- const extendsSpecifiers = extractTsConfigExtendsSpecifiers(source);-- for (const extendsSpecifier of extendsSpecifiers) {- if (!isTsConfigFilePath(extendsSpecifier)) {- continue;- }-- const candidates = resolveTsConfigExtendsTargetPaths({- configPath,- extendsSpecifier,- });-- if (candidates.some((candidate) => existsSync(candidate))) {- continue;- }-- throw new DevelopmentRuntimeSourceSnapshotError(- `Development runtime source snapshot cannot resolve tsconfig extends "${extendsSpecifier}" from "${configPath}".`,- );- }-}-function toSnapshotPathForPlan(plan: DevelopmentSourceSnapshotPlan, sourcePath: string): string {return toDevelopmentSourceSnapshotPath({snapshotSourceRoot: plan.snapshotSourceRoot,@@ -387,19 +73,6 @@ function toSnapshotPathForPlan(plan: DevelopmentSourceSnapshotPlan, sourcePath:});}-function isPathInsideOrEqual(path: string, directory: string): boolean {- const resolvedPath = resolve(path);- const resolvedDirectory = resolve(directory);-- return (- resolvedPath === resolvedDirectory || resolvedPath.startsWith(`${resolvedDirectory}${sep}`)- );-}--function isAbsoluteFilePath(path: string): boolean {- return path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path);-}-function formatErrorMessage(error: unknown): string {return error instanceof Error ? error.message : String(error);}diff --git a/packages/eve/src/internal/nitro/dev-runtime-source-snapshot.ts b/packages/eve/src/internal/nitro/dev-runtime-source-snapshot.tsindex 7ae3944c9..76e3e215e 100644--- a/packages/eve/src/internal/nitro/dev-runtime-source-snapshot.ts+++ b/packages/eve/src/internal/nitro/dev-runtime-source-snapshot.ts@@ -45,7 +45,6 @@ export class DevelopmentRuntimeSourceSnapshotError extends Error {export interface DevelopmentSourceSnapshotPlan {readonly appRoot: string;readonly copyFiles: readonly string[];- readonly copyRoots: readonly string[];readonly dependencyMounts: readonly DevelopmentSourceSnapshotDependencyMount[];readonly runtimeAppRoot: string;readonly snapshotRoot: string;@@ -56,12 +55,6 @@ export interface DevelopmentSourceSnapshotPlan {}export interface DevelopmentSourceSnapshotDependencyMount {- /**- * Whether the mount target is copied into the snapshot. Copied mounts link- * to the in-snapshot copy; all other mounts link to the real source path so- * installed and workspace dependency code resolves in place.- */- readonly copied: boolean;readonly mountPath: string;readonly sourceKind: "installed" | "workspace";readonly sourcePath: string;@@ -69,12 +62,8 @@ export interface DevelopmentSourceSnapshotDependencyMount {interface SnapshotPlanState {readonly appRoot: string;- readonly authoredLocalRoots: Set<string>;readonly copyFiles: Set<string>;- readonly dependencyMountsByPath: Map<- string,- Omit<DevelopmentSourceSnapshotDependencyMount, "copied">- >;+ readonly dependencyMountsByPath: Map<string, DevelopmentSourceSnapshotDependencyMount>;readonly localRootsToProcess: string[];readonly processedLocalRoots: Set<string>;readonly snapshotRoot: string;@@ -86,10 +75,9 @@ interface SnapshotPlanState {export async function createDevelopmentSourceSnapshotPlan(input: {readonly appRoot: string;/**- * Workspace roots that host runtime-hydrated authored source (extension- * mount roots from the compiled manifest). They are copied into the- * snapshot like the app root; every other workspace dependency package is- * mounted in place instead of copied.+ * Workspace roots that host extension-authored source. Their dependency and+ * tsconfig topology participates in watch and mount discovery before the+ * authored module graph is materialized.*/readonly authoredSourceRoots?: readonly string[];readonly snapshotRoot: string;@@ -100,7 +88,6 @@ export async function createDevelopmentSourceSnapshotPlan(input: {const snapshotSourceRoot = join(snapshotRoot, DEV_RUNTIME_SOURCE_DIRECTORY);const state: SnapshotPlanState = {appRoot,- authoredLocalRoots: new Set([appRoot]),copyFiles: new Set(),dependencyMountsByPath: new Map(),localRootsToProcess: [appRoot],@@ -111,7 +98,10 @@ export async function createDevelopmentSourceSnapshotPlan(input: {tsconfigPaths: new Set(),};- addWorkspaceMetadataFiles(state);+ const appPackageJsonPath = join(appRoot, "package.json");+ if (existsSync(appPackageJsonPath)) {+ state.copyFiles.add(appPackageJsonPath);+ }await addAuthoredSourceRoots(state, input.authoredSourceRoots ?? []);while (state.localRootsToProcess.length > 0) {@@ -136,31 +126,20 @@ export async function createDevelopmentSourceSnapshotPlan(input: {await addDependencyMountsForRoot(state, resolvedLocalRoot);}- // Discovery walks every reachable root so the dependency-mount topology and- // tsconfig collection match a full copy; only the directory copies are- // narrowed to roots that host runtime-hydrated authored source.- const copyRoots = normalizeCopyRoots(- [...state.processedLocalRoots].filter((root) => state.authoredLocalRoots.has(root)),- );const copyFiles = [...state.copyFiles].filter((path) => isPathInsideOrEqual(path, sourceRoot)).sort((left, right) => left.localeCompare(right));const tsconfigPaths = [...state.tsconfigPaths].filter((path) => isPathInsideOrEqual(path, sourceRoot)).sort((left, right) => left.localeCompare(right));- const dependencyMounts = [...state.dependencyMountsByPath.values()]- .map((mount) => ({- ...mount,- copied:- mount.sourceKind === "workspace" &&- [...state.authoredLocalRoots].some((root) => isPathInsideOrEqual(mount.sourcePath, root)),- }))- .sort((left, right) => left.mountPath.localeCompare(right.mountPath));+ const dependencyMounts = [...state.dependencyMountsByPath.values()].sort((left, right) =>+ left.mountPath.localeCompare(right.mountPath),+ );const watchPaths = createWatchPaths({appRoot,copyFiles,- copyRoots,dependencyMounts,+ localRoots: [...state.processedLocalRoots],sourceRoot,tsconfigPaths,});@@ -168,7 +147,6 @@ export async function createDevelopmentSourceSnapshotPlan(input: {return {appRoot,copyFiles,- copyRoots,dependencyMounts,runtimeAppRoot: toSnapshotPath({ sourcePath: appRoot, sourceRoot, snapshotSourceRoot }),snapshotRoot,@@ -223,16 +201,6 @@ export function resolveDevelopmentSourceRoot(appRoot: string): string {}}-function addWorkspaceMetadataFiles(state: SnapshotPlanState): void {- for (const fileName of WORKSPACE_METADATA_FILE_NAMES) {- const path = join(state.sourceRoot, fileName);-- if (existsSync(path)) {- state.copyFiles.add(path);- }- }-}-async function addAuthoredSourceRoots(state: SnapshotPlanState,authoredSourceRoots: readonly string[],@@ -247,7 +215,6 @@ async function addAuthoredSourceRoots(const localRoot =(await resolveNearestPackageRoot(resolvedRoot, state.sourceRoot)) ?? resolvedRoot;- state.authoredLocalRoots.add(localRoot);enqueueLocalRoot(state, localRoot);}}@@ -264,15 +231,11 @@ async function addTsConfigDependenciesForRoot(}state.tsconfigPaths.add(tsconfigPath);- state.copyFiles.add(tsconfigPath);for (const localRoot of await resolveLocalTsConfigPathTargetRoots({configPath: tsconfigPath,sourceRoot: state.sourceRoot,})) {- // Path-alias targets host authored source that runtime hydration can- // read back from the snapshot, so they stay copies.- state.authoredLocalRoots.add(localRoot);enqueueLocalRoot(state, localRoot);}}@@ -418,9 +381,8 @@ async function addDependencyMount(state: SnapshotPlanState, mountPath: string):* Workspace dependency packages are mounted in place rather than copied: the* dev runtime resolves their contents through the real tree, the same way* installed dependencies already resolve (vercel/eve#652). Their dependency- * closure is still discovered — packages nested inside a copied root keep- * their mounts — but only roots that host runtime-hydrated authored source- * (the app, extension mounts, tsconfig path-alias targets) stay copies.+ * closure is still discovered so externalized dependencies resolve from the+ * same installation topology as the authored source bundle.*/async function addWorkspaceDependencyMount(input: {readonly mountPath: string;@@ -513,29 +475,11 @@ async function readPackageDependencyNames(packageRoot: string): Promise<string[]return [...dependencyNames].sort((left, right) => left.localeCompare(right));}-function normalizeCopyRoots(copyRoots: readonly string[]): string[] {- const sortedRoots = [...new Set(copyRoots.map((path) => resolve(path)))].sort((left, right) => {- const lengthDifference = left.length - right.length;- return lengthDifference === 0 ? left.localeCompare(right) : lengthDifference;- });- const normalizedRoots: string[] = [];-- for (const root of sortedRoots) {- if (normalizedRoots.some((existingRoot) => isPathInsideOrEqual(root, existingRoot))) {- continue;- }-- normalizedRoots.push(root);- }-- return normalizedRoots.sort((left, right) => left.localeCompare(right));-}-function createWatchPaths(input: {readonly appRoot: string;readonly copyFiles: readonly string[];- readonly copyRoots: readonly string[];readonly dependencyMounts: readonly DevelopmentSourceSnapshotDependencyMount[];+ readonly localRoots: readonly string[];readonly sourceRoot: string;readonly tsconfigPaths: readonly string[];}): string[] {@@ -545,9 +489,9 @@ function createWatchPaths(input: {...input.tsconfigPaths,]);- for (const copyRoot of input.copyRoots) {- if (copyRoot !== input.appRoot) {- watchPaths.add(copyRoot);+ for (const localRoot of input.localRoots) {+ if (localRoot !== input.appRoot) {+ watchPaths.add(localRoot);}}diff --git a/packages/eve/src/internal/nitro/development-generation.ts b/packages/eve/src/internal/nitro/development-generation.tsindex b3eb97966..a465d5155 100644--- a/packages/eve/src/internal/nitro/development-generation.ts+++ b/packages/eve/src/internal/nitro/development-generation.ts@@ -1,7 +1,10 @@import { rm } from "node:fs/promises";import type { CompileAgentResult } from "#compiler/compile-agent.js";-import { materializeAuthoredModules } from "#internal/materialized-authored-modules.js";+import {+ prepareMaterializedAuthoredModules,+ writeMaterializedAuthoredModules,+} from "#internal/materialized-authored-modules.js";import {activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,@@ -24,10 +27,15 @@ const developmentGenerationPruneStates = new Map<string, DevelopmentGenerationPrexport async function stageDevelopmentGeneration(compileResult: CompileAgentResult,): Promise<DevelopmentGeneration> {+ const prepared = await prepareMaterializedAuthoredModules({+ manifest: compileResult.manifest,+ moduleMapPath: compileResult.paths.moduleMapPath,+ });const snapshot = await stageDevelopmentRuntimeArtifactsSnapshot(compileResult);try {- const materialized = await materializeAuthoredModules({+ const materialized = await writeMaterializedAuthoredModules({+ prepared,runtimeAppRoot: snapshot.runtimeAppRoot,});