[Phase 1] Generative Classroom vertical slice (live session UI)#55
Draft
ahmedfahim21 wants to merge 1 commit into
Draft
[Phase 1] Generative Classroom vertical slice (live session UI)#55ahmedfahim21 wants to merge 1 commit into
ahmedfahim21 wants to merge 1 commit into
Conversation
The first demo-able experience: enter a topic and land in a live tutoring session where every screen is agent-generated A2UI, rendered from a safe client-side widget catalog. Renderer (src/components/classroom): - SurfaceRenderer.tsx: hand-rolled A2UI v0.9 renderer (the pre-planned fallback to @a2ui/react's v0.9 preview) — a reducer over the four envelope types behind a stable interface. Surfaces are created on demand from append-mode updateComponents and every top-level component (one not referenced as a child) renders in arrival order, so streamed narration and present_ui surfaces compose into one session surface. - Widgets (Tailwind): Narration (streaming markdown), ExplanationCard, MultipleChoiceCheck (submit -> next turn), SessionRecap, Row/Column. - Markdown.tsx: small dependency-free markdown for Narration/cards. - Classroom.tsx: POSTs turns, reads the response body as SSE, feeds envelopes to the renderer, and sends the learner's choice back as the next turn. Auto-starts the first turn on a fresh session. API + pages: - POST /api/topics (+ GET) and POST /api/sessions (kind: learn), scoped to a hardcoded demo learner (src/lib/demo.ts) until auth lands (#47). - /topics: create a topic and jump straight into a session. - /session/[sessionId]: the classroom. On refresh it rebuilds the rendered surfaces from the transcript (src/lib/agent/replay.ts) so a reload restores the session view. - Landing page links into /topics. Builds on the #38 A2UI protocol + Bedrock loop. build and lint pass with no env vars set; renderer folding and transcript replay verified out of band. Closes #39 https://claude.ai/code/session_013riTGcbsp6VCBw7X7Yg3Tp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39 — the third unchecked task in the Learnify 2.0 tracker (#50). Builds on the #38 A2UI protocol + Bedrock loop (now on
mainvia #54).What this does
Enter a topic → land in a live tutoring session where every screen is agent-generated A2UI, rendered from a safe client-side widget catalog.
Renderer (
src/components/classroom/)SurfaceRenderer.tsx— the single boundary between A2UI and React: a reducer over the four envelope types (createSurface/updateComponents/updateDataModel/deleteSurface). This is the pre-planned hand-rolled fallback the issue allows in place of the@a2ui/reactv0.9 preview dependency, behind the same interface. Surfaces are created on demand from append-modeupdateComponents, and every top-level component (one not referenced as another's child) renders in arrival order — so streamed Narration andpresent_uisurfaces compose into one session surface.Markdown.tsx— small, dependency-free markdown for Narration/cards.Classroom.tsx— POSTs turn events, reads the fetch body as SSE, feeds envelopes to the renderer, and sends the learner's choice back as the next turn. Auto-starts the first turn on a fresh session.API + pages
POST /api/topics(+GET) andPOST /api/sessions(kind:learn), scoped to a hardcoded demo learner (src/lib/demo.ts) until auth lands ([Phase 5] Auth (Better Auth + GitHub OAuth), demo mode & cost guardrails #47)./topics— create a topic and jump straight into a session; lists existing topics./session/[sessionId]— the classroom. On refresh it rebuilds the rendered surfaces from the transcript (src/lib/agent/replay.ts: tutor prose → Narration, persistedpresent_uiinput → validated envelope), so a reload restores the session view./topics.Acceptance criteria
npm run buildandnpm run lintpass with no env vars setpresent_uiColumn with ExplanationCard + MCQ children) into one surface — 3+ widget types render progressively (verified out of band)Notes
/turnroute ([Phase 1] A2UI protocol layer + Bedrock streaming agent loop #38) consumes the next learner turn asmessagetext, so a widget interaction is serialized to the chosen option's label and graded by the tutor — no route changes needed.https://claude.ai/code/session_013riTGcbsp6VCBw7X7Yg3Tp
Generated by Claude Code