Wave 0: shared contracts + extension points

- src/core/contracts.ts: plan tree / graph / ledger / job protocol / artifact
  registry types — the single source of truth for all workstreams
- tools: per-request factory createTeacherTools({chatId}) composing
  questionTools + planTools (stub) + jobTools (stub); quiz gains nodeId
- prompt composition: system-prompt.md + sorted src/agent/prompts/*.md
- ChatRecord.tree + saveTree; pending gate scoped to quiz/ask (+findPendingJobCall)
- chat.tsx: artifact renderer extension point + ChatActionsContext.syncFromServer
This commit is contained in:
Amos
2026-08-22 09:06:24 +03:00
parent c338f468f8
commit c55bae0de6
11 changed files with 429 additions and 23 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { createAgentUIStreamResponse, type UIMessage } from "ai";
import { createTeacherAgent, type TeacherAgent } from "../agent/teacher-agent.ts";
import { createTeacherTools } from "../agent/tools.ts";
import { getChat, saveMessages } from "../store/chats.ts";
/**
@@ -27,7 +28,7 @@ export async function handleChatRequest(req: Request, agent?: TeacherAgent): Pro
}
return createAgentUIStreamResponse({
agent: agent ?? createTeacherAgent(),
agent: agent ?? createTeacherAgent(undefined, createTeacherTools({ chatId })),
uiMessages: body.messages as UIMessage[],
onFinish: ({ messages, isAborted }) => {
// Persist even when aborted: the partial transcript (including any