feat: implement Story 3.2 — AI diagram generation from natural language

Add complete AI-powered diagram generation pipeline: natural language input
→ type inference → graph patch generation → validated canvas render with
ELK.js layout animation. Includes adversarial code review fixes for
diagramType enum validation, duplicate ID detection, tool part history
preservation, PATCH error handling, and graphData structural validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-28 13:34:46 +00:00
parent 26215d9060
commit 6dcb4dcd6f
13 changed files with 1577 additions and 44 deletions

View File

@@ -139,6 +139,15 @@ export function useAutoLayout() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [layoutDirection, edgeRouting]);
// Re-layout on explicit request (e.g., AI-generated graph patch)
const layoutRequestId = useGraphStore((s) => s.layoutRequestId);
useEffect(() => {
if (layoutRequestId > 0 && nodeCount > 0) {
runLayout();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [layoutRequestId]);
// Cleanup worker on unmount
useEffect(() => {
return () => {