Two Clients, One Local-First Mandarin Curriculum#
In Phase 6 of SpeakOn, we brought the backend engines built in Phase 5 (Celio1878/speakon-services) to learners across both Web (Celio1878/aldeon.app, commit 51c4d5a on develop) and Mobile (Celio1878/speakon-mobile, commit 3ca90fa on develop)—with bilingual English / Brazilian Portuguese guidance, Simplified / Traditional switching, tone-colored Pinyin, and progressive Pinyin fade-out (full -> hover -> hanzi).
Both apps share identical deterministic stroke-matching math (strokeMatcher.ts) and state-machine transitions (pinyinFade.ts), plus seamless two-way handoffs: any CJK turn in Talk opens directly inside Dissect or Write, and any practiced phrase in Studio launches directly into a live voice turn (?practice=...).
Zero-Backend Web Studio Inside React Router 7 (aldeon/app)#
Staying faithful to Aldeon's strict client-only web boundary, all six new routes under /speakon/studio* (Hub, Foundations, Write, Read, Lab, and Review) talk exclusively to the user's configured local desktop orchestrator (http://127.0.0.1:8000):
- Bundle Budget Discipline: Adding interactive calligraphy can easily bloat landing chunks. Importing
hanzi-writer@3.7.3(MIT) dynamically inside client-only interaction handlers and routingcharDataLoaderstraight to/api/mandarin/chars/{char}kept the landing JS bundle at192.3 KB gz(strict budget220 KB) and CSS at44.7 KB gz(budget45 KB). - SSR & Check Suite: All 230 production SSR renders passed cleanly, Biome checked 592 files with zero warnings, and the Web unit suite expanded to 227 pass / 0 fail (
2,311assertions across 21 files).
Native Skia Calligraphy & expo-sqlite Airplane-Mode Learning (speakon/mobile)#
On mobile, learning cannot stall when cellular or Wi-Fi drops:
- 60fps Skia Tianzige Canvas (
SkiaHanziCanvas.tsx): Built on@shopify/react-native-skia(Canvas,Path,Skia) andPanResponder—locking parentScrollViewpan interference during active finger strokes viaonDrawStateChange—supportingguided,ghost, andblankstroke-order quizzes withexpo-hapticspulse feedback plus freehand DTW character lookup. - WAL Co-Residency Without Lock Contention: Initializing a single
createExpoSqliteDriver()connection shared cleanly betweenMobileOfflineCache(sync_meta, cached turns) andMandarinOfflineStore(localts-fsrscards, review logs, writing attempts, queued AI prompts, and cached AI results) eliminates dual-writer WAL contention. - Verified SHA-256 Offline Pack Installer (
mandarinPack.ts): Downloads starter (~2.7 MB) or full (~105 MB) SQLite packs viaFile.downloadFileAsync, verifies SHA-256 usingexpo-cryptobefore touching live storage, atomically replacesSQLite.defaultDatabaseDirectory/mandarin_pack.sqlite, and falls back to an embedded Apache-2.0 starter curriculum until synced. - Deterministic Offline
ts-fsrs@6.0.1Queue & Delta Sync: Ratings (Again/Hard/Good/Easy) reschedule cards immediately offline viats-fsrs(enable_fuzz: false), queue review logs, writing accuracy scores, and AI dissect/nuance/compose prompts cleanly, and flush idempotently overPOST /api/mandarin/syncwhen desktop connectivity returns.
Verification Highlights#
On Celio1878/speakon-mobile, strict tsc --noEmit reported 0 errors, Bun tests passed 14 / 14 (131 expectations across 5 suites, backed by real bun:sqlite), iOS and Android expo prebuild --no-install --clean exited cleanly, and Android Gradle built the full debug APK (754 actionable tasks, 189 MB app-debug.apk) with prebuilt native Skia binaries linked—all while keeping generated android/ and ios/ directories out of pure CNG Git history and scanning 0 secrets via gitleaks.
