This commit ports the remaining Gen 1 proof-of-concept experiments from `forum/poc-g1` into `forum/poc-g2` while substituting naive mocks with real, production-ready mechanisms. Key advancements include: - `code_intelligence_poc.ts` and `cfg_poc.ts`: Swapped regex matching for actual Javascript AST traversal using `acorn`. - `static_analysis_poc.ts`: Replaced mock payloads with real `deno lint --json` output executed via `Deno.Command`. - `vector_db_poc.ts` and `multi_vec_poc.ts`: Replaced basic JS arrays with actual `jsr:@db/sqlite` instances utilizing User-Defined Functions (UDFs) to perform native vector cosine similarity queries in memory or on disk. - `protobuf_poc.ts`: Implemented robust protobuf serialization/deserialization via `protobufjs`. - Semantic/Governance PoCs (`constitution_poc.ts`, `ontology_poc.ts`, `state_machine_poc.ts`, `orphan_branch_poc.ts`, etc): Replaced string-mock I/O with absolute filesystem reads, real YAML parsing using `jsr:@std/yaml`, and isolated `Deno.Command` Git sandboxes. - Updated `forum/poc-g2/lab.ts` to orchestrate and execute all 19 experiments, proving 100% test pass rate with Gen 2 tooling. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
181 lines
5.3 KiB
TypeScript
181 lines
5.3 KiB
TypeScript
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.",
|
|
},
|
|
{
|
|
name: "Code Intelligence PoC (Gen 2)",
|
|
file: "code_intelligence_poc.ts",
|
|
description: "Verifies true Semantic Code graph structure extraction using AST parsing via acorn.",
|
|
},
|
|
{
|
|
name: "CFG Security Proving PoC (Gen 2)",
|
|
file: "cfg_poc.ts",
|
|
description: "Verifies tracing taint to sinks via dynamic AST traversal.",
|
|
},
|
|
{
|
|
name: "Static Analysis Payloads PoC (Gen 2)",
|
|
file: "static_analysis_poc.ts",
|
|
description: "Verifies real CI/CD integration using Deno.Command to run deno lint and parse JSON output.",
|
|
},
|
|
{
|
|
name: "The Constitution PoC (Gen 2)",
|
|
file: "constitution_poc.ts",
|
|
description: "Verifies programmatic constraints parsing an actual markdown file.",
|
|
},
|
|
{
|
|
name: "Dependency Graphing PoC (Gen 2)",
|
|
file: "dependency_graph_poc.ts",
|
|
description: "Verifies calculating blast radius from a real Deno module dependency graph.",
|
|
},
|
|
{
|
|
name: "Ontology Traceability PoC (Gen 2)",
|
|
file: "ontology_poc.ts",
|
|
description: "Verifies JSON-LD semantic extraction from real markdown file I/O.",
|
|
},
|
|
{
|
|
name: "Orchestration Matrix PoC (Gen 2)",
|
|
file: "orchestration_matrix_poc.ts",
|
|
description: "Verifies programmatic routing via a real YAML matrix definition.",
|
|
},
|
|
{
|
|
name: "State Machine PoC (Gen 2)",
|
|
file: "state_machine_poc.ts",
|
|
description: "Verifies Bounded Model Checking rules loaded from filesystem.",
|
|
},
|
|
{
|
|
name: "Telemetry Parsing PoC (Gen 2)",
|
|
file: "telemetry_poc.ts",
|
|
description: "Verifies Analyst ingestion of real JSON telemetry payload files.",
|
|
},
|
|
{
|
|
name: "Orphan Branch (Meta-State) PoC (Gen 2)",
|
|
file: "orphan_branch_poc.ts",
|
|
description: "Verifies absolute isolation of state data in an actual orphan branch.",
|
|
},
|
|
{
|
|
name: "Mutation Testing PoC (Gen 2)",
|
|
file: "mutation_poc.ts",
|
|
description: "Verifies Adversary gate enforcement via structured mutation data files.",
|
|
},
|
|
{
|
|
name: "Embedded Vector DB PoC (Gen 2)",
|
|
file: "vector_db_poc.ts",
|
|
description: "Verifies fuzzy semantic retrieval using real SQLite UDFs for vector math.",
|
|
},
|
|
{
|
|
name: "Multi-Vec Isolation PoC (Gen 2)",
|
|
file: "multi_vec_poc.ts",
|
|
description: "Verifies cross-contamination prevention using physically isolated SQLite databases.",
|
|
},
|
|
{
|
|
name: "Protocol Buffers PoC (Gen 2)",
|
|
file: "protobuf_poc.ts",
|
|
description: "Verifies high-performance serialization using actual protobuf library.",
|
|
},
|
|
{
|
|
name: "Architectural Graveyard Anti-PoC (Gen 2)",
|
|
file: "graveyard_poc.ts",
|
|
description: "Mathematical proof of Local-First/Git-Native bounds violations.",
|
|
}
|
|
];
|
|
|
|
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);
|
|
}
|