mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Initial design scaffold for PyQuest
Fige le brief original et les décisions actées jusqu'ici : choix du moteur Python navigateur (Pyodide), schéma d'architecture, arborescence cible, format de niveau (JSON Schema), parcours pédagogique et stratégie anti-abandon. CLAUDE.md et CONTEXT.md permettent de reprendre la conception sur un autre poste sans perdre le contexte. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# Schéma d'architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph MainThread["Thread principal (UI)"]
|
||||
UI[NotebookView<br/>CellManager / CellView]
|
||||
LE[LessonEngine<br/>charge manifest.json + level.yaml]
|
||||
VE[ValidationEngine<br/>interprète tests déclaratifs]
|
||||
PS[ProgressStore<br/>XP, badges, streaks]
|
||||
AE[AudioEngine<br/>Web Audio API]
|
||||
VO[VoiceEngine<br/>speechSynthesis]
|
||||
PWC[PyodideWorkerClient<br/>protocole postMessage]
|
||||
end
|
||||
|
||||
subgraph Worker["Web Worker — Moteur Python"]
|
||||
PY[Pyodide / CPython WASM<br/>stdout/stderr redirigés]
|
||||
IB[Interrupt buffer<br/>SharedArrayBuffer]
|
||||
end
|
||||
|
||||
subgraph Storage["Stockage local"]
|
||||
IDB[(IndexedDB<br/>progression, réglages)]
|
||||
end
|
||||
|
||||
subgraph SW["Service Worker"]
|
||||
CACHE[(Cache API<br/>app shell + Pyodide vendorisé<br/>+ fichiers de niveaux)]
|
||||
end
|
||||
|
||||
subgraph Backend["Backend optionnel (Django, même VPS)"]
|
||||
API[API REST<br/>sync multi-appareils]
|
||||
DB[(PostgreSQL/SQLite)]
|
||||
end
|
||||
|
||||
UI -->|clic Exécuter| PWC
|
||||
PWC -->|postMessage: run_code, interrupt| PY
|
||||
PY <-->|contrôle d'exécution| IB
|
||||
PY -->|postMessage: stdout, result, error| PWC
|
||||
PWC --> VE
|
||||
VE -->|résultat du test| UI
|
||||
VE -->|XP/badge gagné| PS
|
||||
PS <-->|lecture/écriture| IDB
|
||||
PS -.->|son/voix de récompense| AE
|
||||
PS -.-> VO
|
||||
LE -->|fetch levels/*.yaml| UI
|
||||
UI -->|requêtes réseau statiques| SW
|
||||
SW -->|réponses mises en cache| UI
|
||||
PS -.->|si connecté, sync optionnelle| API
|
||||
API <--> DB
|
||||
|
||||
classDef optional stroke-dasharray: 5 5
|
||||
class Backend,API,DB optional
|
||||
```
|
||||
|
||||
## Points notables
|
||||
|
||||
- **`PyodideWorkerClient` ↔ Worker** est la seule frontière qui parle à Python : aucun code
|
||||
utilisateur ne s'exécute jamais sur le thread principal (isolation + UI jamais bloquée).
|
||||
- **`ValidationEngine`** vit côté thread principal, pas dans le worker : il reçoit stdout/valeurs
|
||||
de variables déjà extraites par Pyodide et les compare aux `tests` déclarés dans le niveau — ça
|
||||
garde le moteur de validation agnostique du contenu (plug-in sans toucher au code).
|
||||
- Le **Backend Django** est en pointillé dans le diagramme d'origine (optionnel), mais est
|
||||
maintenant confirmé comme faisant partie du périmètre du projet — branché uniquement sur
|
||||
`ProgressStore`, jamais une dépendance du parcours d'apprentissage.
|
||||
Reference in New Issue
Block a user