The Open Framework for Building Agents
fix(eve): dev runtime - support package-less flat agents (#467)
Andrew Barbaafc7ded663cf
diff --git a/.changeset/flat-instructions-dev.md b/.changeset/flat-instructions-dev.mdnew file mode 100644index 000000000..fea5cc43f--- /dev/null+++ b/.changeset/flat-instructions-dev.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Allow `eve dev` to start from a package-less flat agent that only has `instructions.md`. Development runtime snapshots now generate private package metadata when the authored app has none.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 84a6e3f0d..87a776973 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@@ -155,6 +155,35 @@ describe("development runtime artifact snapshots", () => {});});+ it("stages package-less flat markdown agents with generated runtime package metadata", async () => {+ const appRoot = await createScratchDirectory("eve-dev-runtime-flat-package-less-");+ const compileDirectoryPath = join(appRoot, ".eve", "compile");++ await mkdir(compileDirectoryPath, { recursive: true });+ await writeFile(join(appRoot, "instructions.md"), "You are a precise assistant.\n");+ await writeFile(+ join(compileDirectoryPath, "compiled-agent-manifest.json"),+ `${JSON.stringify({ agentRoot: appRoot, appRoot }, null, 2)}\n`,+ );++ const snapshot = await stageDevelopmentRuntimeArtifactsSnapshot({+ paths: { compileDirectoryPath },+ project: { appRoot },+ } as CompileAgentResult);++ await expect(readFile(join(snapshot.runtimeAppRoot, "instructions.md"), "utf8")).resolves.toBe(+ "You are a precise assistant.\n",+ );+ await expect(+ readFile(join(snapshot.runtimeAppRoot, "package.json"), "utf8").then(+ (source) => JSON.parse(source) as Record<string, unknown>,+ ),+ ).resolves.toEqual({+ private: true,+ type: "module",+ });+ });+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");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 e5db9689e..b296c0f77 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@@ -53,6 +53,7 @@ export async function copyDevelopmentSourceSnapshot(await rewriteSnapshotTsConfigAbsoluteExtends(plan);await createSnapshotSymlinks(plan);+ await ensureRuntimePackageJson(plan);await validateDevelopmentSourceSnapshot(plan);}@@ -266,6 +267,27 @@ async function createSnapshotSymlinks(plan: DevelopmentSourceSnapshotPlan): Prom}}+async function ensureRuntimePackageJson(plan: DevelopmentSourceSnapshotPlan): Promise<void> {+ const runtimePackageJsonPath = join(plan.runtimeAppRoot, "package.json");++ if (existsSync(runtimePackageJsonPath)) {+ return;+ }++ await mkdir(plan.runtimeAppRoot, { recursive: true });+ await writeFile(+ runtimePackageJsonPath,+ `${JSON.stringify(+ {+ private: true,+ type: "module",+ },+ null,+ 2,+ )}\n`,+ );+}+async function validateDevelopmentSourceSnapshot(plan: DevelopmentSourceSnapshotPlan,): Promise<void> {