auth-yes/forum/experiments/static_analysis_poc.ts
Tyler Gillispie f3fe8b77e6
feat: Add missing concepts and PoCs to agent-forum-v4 protocol (#66)
- Updates CONCEPTS.md and DATA_STRUCTURES.md to include Multi-Vec Isolation, Orchestration Matrix, and Static Analysis Payloads.
- Adds GRAVEYARD.md to document dismissed anti-patterns (Doc-to-LoRA and PASTE).
- Implements corresponding Proof-of-Concept scripts in `forum/experiments/` (multi_vec_poc.ts, orchestration_matrix_poc.ts, static_analysis_poc.ts, and graveyard_poc.ts).
- Integrates all new PoCs into the `lab.ts` experiment runner.

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>
2026-08-28 20:24:11 -07:00

69 lines
2.2 KiB
TypeScript

/**
* Agent Forum v4 - Static Analysis Payloads PoC
*
* Verifies the ability of triage agents (like the Adversary) to ingest
* standardized JSON/XML outputs from industry static analysis tools
* (e.g., Semgrep, SonarQube) instead of relying on LLM guesswork.
*/
// Mock representation of a Semgrep JSON output payload
const mockSemgrepPayload = {
"results": [
{
"check_id": "javascript.express.security.audit.xss.express-xss",
"path": "server/routes/api.ts",
"start": { "line": 45, "col": 5 },
"end": { "line": 45, "col": 40 },
"extra": {
"message": "Potential XSS vulnerability: user input is reflected without sanitization.",
"severity": "ERROR"
}
},
{
"check_id": "typescript.react.best-practice.react-props-no-spreading",
"path": "ui/components/Button.tsx",
"start": { "line": 12, "col": 10 },
"end": { "line": 12, "col": 25 },
"extra": {
"message": "Prop spreading is discouraged as it obscures the component API.",
"severity": "WARNING"
}
}
],
"errors": []
};
function runPoC() {
console.log("Running Static Analysis Payloads PoC tests...");
console.log("Ingesting mock Semgrep JSON payload...");
// Simulate an agent processing the structured payload
const criticalIssues = mockSemgrepPayload.results.filter(
(issue) => issue.extra.severity === "ERROR"
);
const warnings = mockSemgrepPayload.results.filter(
(issue) => issue.extra.severity === "WARNING"
);
console.log(`\nAdversary Agent Analysis:`);
console.log(`- Found ${criticalIssues.length} CRITICAL vulnerability.`);
if (criticalIssues.length > 0) {
console.log(` -> Action required on ${criticalIssues[0].path} line ${criticalIssues[0].start.line}: ${criticalIssues[0].extra.message}`);
}
console.log(`- Found ${warnings.length} code smell/warning.`);
if (criticalIssues.length === 1 && criticalIssues[0].check_id.includes("xss")) {
console.log("\n✅ Static Analysis Payloads PoC successful: Structured compiler-grade metrics successfully ingested and triaged.");
} else {
console.error("\n❌ Failed to process static analysis payload.");
Deno.exit(1);
}
}
if (import.meta.main) {
runPoC();
}