import { join, dirname, fromFileUrl } from "https://deno.land/std@0.224.0/path/mod.ts"; import { blue, green, red, yellow, bold } from "https://deno.land/std@0.224.0/fmt/colors.ts"; // Define the experiments to run const EXPERIMENTS = [ { name: "Git Storage PoC", file: "git_storage_poc.ts", description: "Verifies ability to read/write Git Notes and manipulate orphan branches." }, { name: "DAG Engine PoC", file: "dag_engine_poc.ts", description: "Verifies mathematical dependency resolution of YAML task graphs." }, { name: "Code Intelligence PoC", file: "code_intelligence_poc.ts", description: "Verifies structural code parsing (AST/Exports) instead of raw text reading." }, { name: "State Machine PoC", file: "state_machine_poc.ts", description: "Verifies Bounded Model Checking for pipeline governance." }, { name: "Ontology Traceability PoC", file: "ontology_poc.ts", description: "Verifies linking business requirements to code using JSON-LD graphs." } ]; 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], // Allow all permissions for experiments for now, restrict later if needed 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 ==="))); console.log("Running fundamental foundational proofs of concept...\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); }