Sprint 6c — Frontend T2 Live UI + state machine + integration

feat(t2-live): state machine pure 9 states x 8 events (resolves FTD-09)
feat(t2-live): useT2LiveSession WS orchestrator + audio hooks + close codes
feat(t2-live): T2SujetsPage, T2PreparationPage (2min timer + notes + ideas),
  T2DialoguePage (3:30 dialogue + terminal screen with WAV download)
feat(t2-live): T2LiveContext provider for sujet sharing between pages
fix(TaskSelector): unlock EO_T2_LIVE card via hasAccess (resolves FTD-33)
chore: Tache type + labels + config extended with EO_T2_LIVE
test: 21 t2-machine tests — 259/259 green (+21)
This commit is contained in:
Hermann_Kitio 2026-04-26 20:28:35 +03:00
parent 7862f7c9f3
commit 1d95166611
17 changed files with 1229 additions and 33 deletions

View file

@ -29,6 +29,34 @@ Chaque entrée suit ce format :
---
## [Unreleased] — 2026-04-26 — Sprint 6c — Frontend T2 Live UI
### Added
- `t2-machine.ts` — state machine pure T2 Live : 9 états (`idle``preparing``connecting``ready``speaking``listening``processing``ended` / `error`), 8 events. 21 tests. Résout FTD-09.
- `useT2LiveSession.ts` — hook orchestrateur : WebSocket + state machine + hooks audio (capture/playback/recording). Parse format Gemini natif (`serverContent.modelTurn`) + messages applicatifs backend (`warning`/`report`/`error`). Close codes 1000/4001/4003/4004. Timer dialogue 210 s. Ping 30 s keep-alive.
- `T2LiveContext.tsx` — Provider léger pour partager le sujet sélectionné entre les pages T2.
- `T2SujetsPage.tsx` — grille de sélection des sujets T2 (`GET /sujets?mode=EO&tache=2`).
- `T2PreparationPage.tsx` — timer 2 min, consigne affichée, zone de notes locale, bouton « Suggestions d'idées » (DeepSeek, actif immédiatement), bouton « Je suis prêt », pré-warm micro via `getUserMedia`. Transition auto vers dialogue à 0:00.
- `T2DialoguePage.tsx` — timer 3:30, indicateur d'état IA, waveform, bouton « Terminer ». Écran terminal (state `ended`) : bouton « Télécharger l'audio » (WAV mono 24 kHz) + bouton « Voir le rapport » (→ `/rapport/:id`).
- 3 routes : `/simulation/eo/t2`, `/simulation/eo/t2/preparation`, `/simulation/eo/t2/dialogue` sous `T2LiveLayout`.
### Changed
- `TaskSelector.tsx` — carte EO T2 Live déverrouillée via `hasAccess(plan, 'oral_t2_live')` + prop `onT2LiveSelect`. Résout FTD-33.
- `SimulationEOPage.tsx` — branche `onT2LiveSelect` vers `/simulation/eo/t2`.
- `entities/production/``Tache` type, labels, `mapTacheToSujetParams`, config étendus avec `EO_T2_LIVE`.
- `features/historique/``TACHE_NUMBER` étendu.
### Notes
- Tests frontend : 238 → 259 verts (+21 — tous sur t2-machine).
- FTD-09 résolue (state machine testée).
- FTD-33 résolue (carte déverrouillée via hasAccess).
- `useT2LiveSession` non testé en unit (WebSocket non supporté jsdom) — validation manuelle prévue.
---
## [Unreleased] — 2026-04-26 — Sprint 6b — Frontend audio (T2 Live)
### Added