This commit implements the missing Proof of Concepts (PoCs) required by the `agent-forum-v4` architecture blueprint as identified in `CONCEPTS.md`.
Updates include:
- `execution_flywheel_poc.ts`: Implemented mock version (Gen 1) using in-memory state and physical version (Gen 2) utilizing actual file I/O tracking to prove state management bounds.
- `tool_sandbox_poc.ts`: Implemented mock version (Gen 1) yielding simulated telemetry and physical version (Gen 2) utilizing real production-grade tool invocations (Semgrep via CLI and Tree-sitter via WASM module).
- `git_hooks_poc.ts`: Implemented mock version (Gen 1) intercepting simulated events and physical version (Gen 2) configuring a physical Git temp directory executing native `.git/hooks/pre-commit` hooks.
- `BOUNDARIES.md`: Documented explicit technical boundaries in both `poc-g1` and `poc-g2` to enforce strict isolation vs production file-system operation.
- Fixed Deno Linting constraints across `poc-g2/` scripts.
- `CONCEPTS.md`: Status flags updated to ✅.
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>
73 lines
1.8 KiB
TypeScript
73 lines
1.8 KiB
TypeScript
import {
|
|
assert,
|
|
assertEquals,
|
|
} from "https://deno.land/std@0.224.0/testing/asserts.ts";
|
|
|
|
/**
|
|
* Proof of Concept: Ontology Traceability (Gen 2)
|
|
*
|
|
* Demonstrates extracting JSON-LD semantic requirements from a real markdown file
|
|
* and validating that code implementation connects back to the business ontology.
|
|
*/
|
|
|
|
async function extractJsonLD(filePath: string): Promise<any[]> {
|
|
const content = await Deno.readTextFile(filePath);
|
|
const regex = /```json-ld\n([\s\S]*?)\n```/g;
|
|
const blocks = [];
|
|
let match;
|
|
while ((match = regex.exec(content)) !== null) {
|
|
try {
|
|
blocks.push(JSON.parse(match[1]));
|
|
} catch (_e) {
|
|
// ignore invalid json
|
|
}
|
|
}
|
|
return blocks;
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
console.log("Running Ontology Traceability PoC (Gen 2) tests...");
|
|
|
|
try {
|
|
const tempFile = await Deno.makeTempFile({ suffix: ".md" });
|
|
await Deno.writeTextFile(
|
|
tempFile,
|
|
`
|
|
# System Requirements
|
|
|
|
This document tracks requirements.
|
|
|
|
\`\`\`json-ld
|
|
{
|
|
"@context": "https://schema.org/",
|
|
"@type": "Requirement",
|
|
"identifier": "REQ-AUTH-01",
|
|
"name": "User Passkey Login",
|
|
"implementedBy": ["file:///src/auth/login.ts"]
|
|
}
|
|
\`\`\`
|
|
`,
|
|
);
|
|
|
|
const ontology = await extractJsonLD(tempFile);
|
|
await Deno.remove(tempFile);
|
|
|
|
assertEquals(ontology.length, 1);
|
|
|
|
const req = ontology[0];
|
|
assertEquals(req.identifier, "REQ-AUTH-01");
|
|
assertEquals(req["@type"], "Requirement");
|
|
|
|
// Simulate Gatekeeper verifying traceability
|
|
const isTraceable = req.implementedBy && req.implementedBy.length > 0;
|
|
assert(isTraceable, "Requirement must be linked to an implementation");
|
|
|
|
console.log(
|
|
"✅ Ontology Traceability PoC (Gen 2) successful: JSON-LD parsed from real markdown.",
|
|
);
|
|
} catch (err) {
|
|
console.error("❌ Ontology Traceability PoC (Gen 2) failed:", err);
|
|
Deno.exit(1);
|
|
}
|
|
}
|