W4: graph store + emission + home graph view

This commit is contained in:
Amos
2026-08-22 10:30:00 +03:00
parent 9a99b01159
commit 8728573253
8 changed files with 1297 additions and 11 deletions
+9
View File
@@ -2,6 +2,7 @@ import { createAgentUIStreamResponse, type UIMessage } from "ai";
import { createTeacherAgent, type TeacherAgent } from "../agent/teacher-agent.ts";
import { createTeacherTools } from "../agent/tools.ts";
import { spawnPendingJobs } from "../agent/subagents/runner.ts";
import { emitChat } from "../core/graph.ts";
import { getChat, saveMessages } from "../store/chats.ts";
/**
@@ -47,6 +48,14 @@ export async function handleChatRequest(req: Request, agent?: TeacherAgent): Pro
} catch (err) {
console.error(`[chat ${chatId}] job spawn failed:`, err);
}
// W4: fold this chat into the knowledge-graph ledgers (tree nodes /
// edges, quiz outcomes, taught events) — synchronous but tiny
// (append-only JSONL), and errors never touch the response.
try {
emitChat(chatId);
} catch (err) {
console.error(`[chat ${chatId}] graph emission failed:`, err);
}
},
});
}