auth-yes/archive/.forum/poc-g2/orchestration_matrix_poc.ts

57 lines
1.8 KiB
TypeScript

import { assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
import { parse as yamlParse } from "jsr:@std/yaml";
/**
* Proof of Concept: Orchestration Matrix (Gen 2)
*
* Verifies routing by actually loading the orchestration matrix definition
* from a structured YAML file, proving real-world configuration flexibility.
*/
const yamlDefinition = `
roles:
Gatekeeper:
inputs: ["Ontologies", "YAML DAGs"]
outputs: ["Verification checklists"]
directive: "Bridge human requirements with technical reality."
Historian:
inputs: ["sqlite-vec", "Git Notes"]
outputs: ["Contextual injection"]
directive: "Prevent regression and historical repetition."
Adversary:
inputs: ["SCIP graphs", "CFGs", "Mutation", "OTel Traces"]
outputs: ["Edge-case tests", "mutations", "bottlenecks"]
directive: "Expose security flaws, enforce test coverage, and identify execution bottlenecks."
`;
if (import.meta.main) {
console.log("Running Orchestration Matrix PoC (Gen 2) tests...\n");
try {
const config = yamlParse(yamlDefinition) as any;
const matrix = config.roles;
const requestedTask = "Generate tests for a new database query method.";
console.log(`Task: "${requestedTask}"`);
let selectedAgent = null;
for (const [role, definition] of Object.entries(matrix)) {
const def = definition as any;
if (def.outputs.some((out: string) => out.includes("tests"))) {
selectedAgent = role;
break;
}
}
assertEquals(selectedAgent, "Adversary");
console.log(
`✅ Correctly routed to: ${selectedAgent} via real YAML parsed configuration.`,
);
console.log("✅ Orchestration Matrix PoC (Gen 2) successful.");
} catch (err) {
console.error(`❌ Orchestration Matrix PoC (Gen 2) failed:`, err);
Deno.exit(1);
}
}