Phase 05: Code runner: Monaco + execute + stream replay
Issue #6 · open
Part of #1.
What this phase delivers
The Monaco-based interactive code area for runMode: "playground" lessons: Run / Reset, output rendering, optional streamed replay. Compiler errors render verbatim — no friendly wrapping.
Scope
src/components/CodeRunner.tsx:@monaco-editor/reactwith Go language registered.- Run button (Cmd/Ctrl+Enter) →
POST /api/compile(form-encoded,version=2,withVet=true). - Reset button restores
lesson.starterCode. - Output pane: monospace, dark background, stdout + stderr in exact strings from upstream.
ErrorsandVetErrorsrendered verbatim, in red, monospace. - Replay: when
lesson.streamReplay === true, renderEventshonoringDelay(nanoseconds → ms). Otherwise dump instantly. - "Skip animation" button visible only during a replay.
- Editor change events fire (consumed by Phase 07).
Acceptance criteria
- [ ] Cmd/Ctrl+Enter runs the snippet; output appears.
- [ ] A program with a compile error renders the raw error string verbatim, in red, monospace, file/line preserved.
- [ ] A
streamReplaylesson withtime.Sleepvisibly delays output; "Skip animation" cuts to final state. - [ ] A non-
streamReplaylesson dumps output immediately. - [ ] Reset restores starter code and clears output.
Dependencies
Requires: #3, #5. Unblocks: #12–#19.
Out of scope
- Persistence (Phase 07). Terminal pane (Phase 06).
Decision references
D1.2, D2.6, D2.7, D2.8, D11.3.
Estimate: 6–8h.