import { dirname, fromFileUrl, join, } from "https://deno.land/std@0.224.0/path/mod.ts"; import { blue, bold, green, red, yellow, } from "https://deno.land/std@0.224.0/fmt/colors.ts"; // Define the experiments to run const EXPERIMENTS = [ { name: "DAG Engine PoC (Gen 2)", file: "dag_engine_poc.ts", description: "Verifies dependency resolution parsing real YAML task graphs.", }, { name: "Git Storage PoC (Gen 2)", file: "git_storage_poc.ts", description: "Verifies ability to read/write Git Notes in an isolated environment.", }, { name: "Git Merkle DAG Diffing PoC (Gen 2)", file: "merkle_diff_poc.ts", description: "Verifies O(1) diffing using native Git tree hashes on an isolated history.", }, { name: "Declarative Frontmatter PoC (Gen 2)", file: "frontmatter_poc.ts", description: "Verifies extraction of UUIDv7 from Markdown using real YAML parsing.", }, ]; async function runExperiment( file: string, ): Promise<{ success: boolean; output: string }> { const currentDir = dirname(fromFileUrl(import.meta.url)); const filePath = join(currentDir, file); try { const command = new Deno.Command("deno", { args: ["run", "-A", filePath], stdout: "piped", stderr: "piped", }); const { code, stdout, stderr } = await command.output(); const decoder = new TextDecoder(); const outputString = decoder.decode(stdout) + decoder.decode(stderr); return { success: code === 0, output: outputString.trim(), }; } catch (error) { return { success: false, output: `Failed to execute ${file}: ${error}`, }; } } async function runLab() { console.log(bold(blue("=== Agent Forum v4 - Experimental Laboratory (Generation 2) ==="))); console.log("Running advanced foundational proofs of concept with real production tools...\n"); let passed = 0; let failed = 0; for (const exp of EXPERIMENTS) { console.log(bold(`[Running] ${exp.name}`)); console.log(`> ${exp.description}`); const { success, output } = await runExperiment(exp.file); if (success) { console.log(green("✅ PASS\n")); console.log(output); passed++; } else { console.log(red("❌ FAIL\n")); console.log(output); failed++; } console.log(yellow("--------------------------------------------------\n")); } console.log(bold(blue("=== Laboratory Results ==="))); console.log(`Total Experiments: ${EXPERIMENTS.length}`); console.log(green(`Passed: ${passed}`)); console.log(red(`Failed: ${failed}`)); if (failed > 0) { Deno.exit(1); } } if (import.meta.main) { runLab().catch(console.error); }