Initial commit: Learning Lab Express

Includes fixes found while reviewing the app:
- Results: open each result by a type+agent+id key, so a video and a
  material draft with the same id no longer open each other's popup
- AuthGate: clear the query cache during render, before pages build their
  queries, and remount pages on organization switch (pages no longer stay
  on skeletons for up to a minute after sign-in or refresh)
- Instruction: keep only failed rules after a partial approve, so retrying
  does not create the successful schedules twice; drop the monthly note
  once count or frequency is edited
- Parser/schedules: never schedule a count below one
- Audio: ignore the end event of a cancelled utterance when changing speed
- Downloads: revoke the object URL later so Safari/Firefox can read it
- Results: refetch SCORM content when any part's revision changes; show a
  failed video as failed instead of "still rendering"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Iqbal
2026-10-23 10:42:12 +07:00
commit f219b26f71
41 changed files with 8172 additions and 0 deletions

27
prototype/README.md Normal file
View File

@@ -0,0 +1,27 @@
# Learning Lab Express
UI fase development (`index.html`, satu file, tanpa dependensi) dengan desain yang sama dengan `mockup.html` (CSS dipakai apa adanya) tetapi isi/alurnya memakai data engine yang terhubung ke engine **learning-lab** (FastAPI, `/api/v1`).
```bash
# 1. jalankan engine di ../learning-lab (docker compose up) → http://localhost:8000
# 2. jalankan Express
node server.mjs # http://localhost:3000 ; ENGINE_URL / PORT dapat diubah
```
`server.mjs` menyajikan file statis dan mem-proxy `/api/*` ke engine (tanpa CORS).
`engine.js` adalah client engine.
| Alur | Engine |
|---|---|
| Login / logout / refresh token | `/auth/login`, `/auth/refresh`, `/auth/logout` |
| Upload materi → Brain | `/upload/`, `/upload/list`, `DELETE /upload/{id}` |
| Knowledge base (Brain) | `/upload/{id}/knowledge/build` (memakai kredit workspace) |
| Login Clerk (akun organisasi) | `clerk-js` dari instance Clerk milik engine (key dibaca dari `../learning-lab/backend/.env`, atau `CLERK_PUBLISHABLE_KEY`) |
| Riset konten | agen "Learning Lab Express" di `/organizations/current/agents` → `runs` → `source-drafts` |
| Jadwal riset | `PATCH agents/{id}` `run_schedule` (harian/mingguan; bulanan & hari kerja dijalankan harian) |
| Generate Text | `/compose/sets` + `/compose/sets/{id}/generate/summary` |
Agents API hanya berjalan dalam konteks organisasi, jadi riset dan jadwal memerlukan tombol **Masuk dengan Clerk** dengan akun yang menjadi owner organisasi. Dengan login email/password biasa, riset tetap simulasi.
Agen dibuat otomatis (budget 50 kredit/run, 1000/bulan; ubah di `Engine.ensureAgent`).
Belum ada: video, audio, dan SCORM. Hanya format yang didukung engine yang bisa diunggah.