v3: AI SDK pivot — pi removed, Next.js 16 + AI SDK 7 + AI Elements teacher app

The teaching agent no longer runs on pi. Stack:
- ToolLoopAgent (ai@7) + OpenRouter (OPENROUTER_API_KEY), model via LH_MODEL,
  default anthropic/claude-sonnet-4.5 with reasoning tokens
- quiz/ask_user_question = client-side tools (no server execute): the call
  lands as a typed tool part in input-available state; the card grades via
  src/core/question-core.ts; addToolOutput sends the verdict; the teacher's
  reaction continues the same assistant message
- resume-mid-quiz is free: the pending tool part persists in the transcript
- persistence: one JSON per chat (data/chats/), full UIMessage transcripts,
  saved onFinish (also on abort)
- UI: AI Elements (owned copy-paste components, pruned to the five in use)
  + button-based QuizCard/AnsweredCard (ask answers never graded)
- pi fully removed: TUI, extensions, Fastify+WS server, bridge, custom
  protocol all deleted (recoverable from git history)
- tests: question-core units carry over; chat-flow integration drives
  handleChatRequest with MockLanguageModelV4 (48 tests, zero tokens);
  render smoke tests guard the cards (renderToStaticMarkup)

Carried over unchanged: teacher system prompt, question-core, schema/
ledger/derive/extract pipeline, data model.
This commit is contained in:
Amos
2026-08-22 02:18:27 +03:00
parent e127a9bfbd
commit a72c902d30
81 changed files with 9643 additions and 10860 deletions
+42 -31
View File
@@ -1,47 +1,58 @@
{
"name": "learning-harness",
"version": "0.1.0",
"description": "A standalone learning harness built on the pi agent SDK: teacher agent, session artifacts, and a derived knowledge graph of what the learner knows.",
"version": "0.2.0",
"description": "A standalone learning harness: a teacher agent (AI SDK) with quiz/ask interactions, session artifacts, and a derived knowledge graph of what the learner knows.",
"type": "module",
"private": true,
"scripts": {
"teach": "tsx src/cli.ts teach",
"doctor": "tsx src/cli.ts doctor",
"doctor:web": "tsx src/cli.ts doctor --web",
"test": "tsx --test tests/*.test.ts",
"test:unit": "tsx --test tests/question-core.test.ts tests/bridge.test.ts",
"e2e:live": "tsx scripts/e2e.ts",
"serve": "tsx src/server/index.ts",
"web": "vite",
"dev": "concurrently -n server,web -c blue,green \"npm:serve\" \"npm:web\"",
"build": "vite build",
"start": "npm run build && npm run serve",
"dev": "next dev",
"build": "next build",
"start": "next start",
"ingest": "tsx src/cli.ts ingest",
"graph": "tsx src/cli.ts graph",
"what-next": "tsx src/cli.ts what-next",
"typecheck": "tsc --noEmit && tsc --noEmit -p web/tsconfig.json"
"test": "tsx --test tests/*.test.ts tests/*.test.tsx",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@earendil-works/pi-coding-agent": "0.84.2",
"@fastify/static": "^8.0.0",
"@fastify/websocket": "^11.0.0",
"fastify": "^5.0.0",
"katex": "^0.16.11",
"mermaid": "^11.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0"
"@ai-sdk/react": "^4.0.79",
"@openrouter/ai-sdk-provider": "^3.0.0",
"@radix-ui/react-use-controllable-state": "^1.2.6",
"@rive-app/react-webgl2": "^4.32.1",
"@streamdown/cjk": "^1.0.3",
"@streamdown/code": "^1.1.1",
"@streamdown/math": "^1.0.2",
"@streamdown/mermaid": "^1.0.2",
"@xyflow/react": "^12.11.3",
"ai": "^7.0.76",
"ansi-to-react": "^6.2.6",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"embla-carousel-react": "^8.6.0",
"lucide-react": "^1.33.0",
"media-chrome": "^4.19.2",
"motion": "^13.1.1",
"nanoid": "^6.0.1",
"next": "^16.3.2",
"next-themes": "^0.4.6",
"radix-ui": "^1.6.7",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-jsx-parser": "^2.4.1",
"streamdown": "^2.5.0",
"tailwind-merge": "^3.6.0",
"tokenlens": "^1.3.1",
"use-stick-to-bottom": "^1.1.6",
"zod": "^4.4.3"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.3.3",
"@types/node": "^24.0.0",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"concurrently": "^9.0.0",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"tailwindcss": "^4.3.3",
"tsx": "^4.19.0",
"typescript": "^5.6.0",
"vite": "^6.0.0"
"typescript": "^5.6.0"
}
}