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: "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.", }, { name: "Protocol Buffers PoC", file: "protobuf_poc.ts", description: "Verifies high-performance binary serialization concepts for agent state.", }, { name: "Git Merkle DAG Diffing PoC", file: "merkle_diff_poc.ts", description: "Verifies O(1) diffing using native Git tree hashes without opening files.", }, { name: "Embedded Vector DB PoC", file: "vector_db_poc.ts", description: "Verifies fuzzy semantic match using cosine similarity (mocking sqlite-vec/TurboQuant).", }, { name: "Dependency Graphing PoC", file: "dependency_graph_poc.ts", description: "Verifies calculating code blast radius using adjacency matrices.", }, { name: "Telemetry Parsing PoC", file: "telemetry_poc.ts", description: "Verifies Analyst and Adversary agents' ability to ingest structured JSON telemetry.", }, { name: "Declarative Frontmatter PoC", file: "frontmatter_poc.ts", description: "Verifies extraction of UUIDv7 from Markdown YAML frontmatter.", }, { name: "The Constitution PoC", file: "constitution_poc.ts", description: "Verifies programmatic restriction of agent actions based on AGENTS.md rules.", }, { name: "CFG Security Proving PoC", file: "cfg_poc.ts", description: "Verifies Adversary agent tracing simulated CFG for unsanitized inputs.", }, { name: "Mutation Testing PoC", file: "mutation_poc.ts", description: "Verifies quality engineering constraints via mutation data.", }, { name: "Orphan Branch (Meta-State) PoC", file: "orphan_branch_poc.ts", description: "Verifies storing state data in isolated Git objects/branches.", }, { name: "Multi-Vec Isolation PoC", file: "multi_vec_poc.ts", description: "Verifies prevention of semantic bleed using isolated vector DBs.", }, { name: "Static Analysis Payloads PoC", file: "static_analysis_poc.ts", description: "Verifies ingestion of compiler-grade static analysis JSON outputs.", }, { name: "Orchestration Matrix PoC", file: "orchestration_matrix_poc.ts", description: "Verifies programmatic routing of tasks to specific agent roles based on I/O bounds.", }, { name: "Architectural Graveyard Anti-PoC", file: "graveyard_poc.ts", description: "Proves why Doc-to-LoRA and PASTE violate Git-Native and BMC constraints.", }, ]; 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); }