mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 13:26:10 +00:00
Add rea environment-export <manifest.json> --evidence <capture.json> <dir> [--package-tarball <path>] [--name <override>]: it reads and authenticates the manifest and capture pair once and writes an agent environment bundle folder (README with provenance and a rights note, envs/<name> with a Dockerfile that pins this exact rea version or installs a given tarball, the manifest and the Evidence as byte-identical copies, a Python verifier that checks replay through the MCP endpoint, and a smoke task) that the agentenv framework runs with agent-env run. Refuses a non-empty directory and a mismatched pair before writing. Adds the real-agentenv hosted lane, which packs the checkout, exports a bundle from the source-owned capture fixture and runs it on the runner's Docker with a pinned agentenv-framework, wired into the CI planner and its guard tests. Refs morluto/rea#4933 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
import { z } from "zod";
|
|
|
|
import {
|
|
bundleDockerfile,
|
|
registryPackageSource,
|
|
} from "../../../src/application/environment/environmentBundle.js";
|
|
import { PRODUCT_IDENTITY } from "../../../src/identity.js";
|
|
|
|
/**
|
|
* The exported Dockerfile installs the CLI that produced the bundle, so the
|
|
* pin must be the exact package version of this build, read from the package
|
|
* manifest rather than restated anywhere in source.
|
|
*/
|
|
describe("environment bundle package pin", () => {
|
|
it("pins the registry install to the package.json version", async () => {
|
|
const manifest = z
|
|
.object({ name: z.literal("rea-agents"), version: z.string().min(1) })
|
|
.parse(
|
|
JSON.parse(
|
|
await readFile(
|
|
new URL("../../../package.json", import.meta.url),
|
|
"utf8",
|
|
),
|
|
),
|
|
);
|
|
const dockerfile = bundleDockerfile(registryPackageSource());
|
|
const install = dockerfile
|
|
.split("\n")
|
|
.find((line) => line.startsWith("RUN npm install -g"));
|
|
expect(install).toBeDefined();
|
|
expect(install?.endsWith(` ${manifest.name}@${manifest.version}`)).toBe(
|
|
true,
|
|
);
|
|
expect(PRODUCT_IDENTITY.packageVersion).toBe(manifest.version);
|
|
expect(dockerfile).not.toMatch(/rea-agents@(?:latest|\^|~)/u);
|
|
});
|
|
});
|