Commit History
-
chore(lint): add ESLint, fix mechanical violations, remove dead code
DONG-WEI-YANG +1: Claude Sonnet 5No lint tooling existed in this project at all. Added ESLint 9 flat config (eslint.config.js) with typescript-eslint, eslint-plugin-react, and only the two classic eslint-plugin-react-hooks rules (rules-of-hooks, exhaustive-deps) rather than its full v7 "recommended" preset — that preset bundles the entire React Compiler rule set (set-state-in-effect, immutability, purity, etc.) as errors, which flags common existing patterns (e.g. syncing a tRPC query's error into local state via useEffect) that are safe today since this codebase doesn't use the Compiler. Adopting those is a deliberate future decision, not a side effect of adding lint tooling. `npm run lint` / `lint:fix` added. Ran eslint --fix for the mechanically-safe violations (useless escapes, useless try/catch, prefer-const, unused eslint-disable directives), then fixed the rest by hand: - target="_blank" without rel="noreferrer" on 3 external links (Home.tsx, Privacy.tsx x2) — real reverse-tabnabbing risk in older browsers.…01fbb71
-
fix(ai): log deviceAI runBuiltIn/runWasm failures instead of failing silently
DONG-WEI-YANG +1: Claude Sonnet 5Both catch blocks returned null with zero console output on failure. Falling back to the server is correct behavior; being silent about why is not -- this exact silent-catch shape (fail, return null, no log) is what let the offline-AI feature stay completely broken in production for months with no signal anywhere. Adds console.warn in both, verified with a test asserting the warning actually fires on a wllama init failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>130817c
-
refactor(ui): extract shouldOfferOfflineAI() helper, DRY the modal guard
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Replaces 4 inline copies (3 in AiFillButton, 1 in SmartTranscript) of the enabled/declined check with a single helper in deviceAI.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>dbfa411 -
feat(device-ai): replace runWasm stub with wllama integration
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)runWasm now talks to wllamaProvider (T1-T4): lazy-loads wllama, gated on localStorage `deviceAI.enabled` flag, builds task-specific 繁體中文 system prompts, returns null on any failure so the caller falls back to the server. buildMessagesForTask covers all 4 task types (correct / summarize / soap_classify / improve_suggest). The `correct` task — STT error correction — is the highest-value offline path. 6 new integration tests in tests/deviceAI.test.ts verify routing, opt-in gating, init-failure fallback, and abort handling. 249 -> 255. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>7ed6dd5
-
feat(device-ai): enable wasm path for all 4 task types
DONG-WEI-YANG64be83b
-
test: add scenario, fuzz, adversarial tests (119 total) + fix canHandle crash
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Three test dimensions (James Whittaker Tourist Methodology): - scenario.test.ts: real-world usage (STT correction, 3-gen genogram, device AI) - fuzz.test.ts: random/abnormal inputs (empty, long, special chars, XSS) - adversarial.test.ts: tourist zones (commercial, historical, rundown, tourist) Fix: canHandle() crashed on unknown task type (null guard added) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>2770a9b -
feat: add DeviceAI service with BuiltInAI/WASM routing and full test coverage
DONG-WEI-YANG +1: Claude Sonnet 4.6Implements the client-side device AI acceleration layer (Task 3). detectCapabilities() probes window.ai (Chrome Prompt API) and WebAssembly, caches results, and routes soap_classify/summarize/correct/improve_suggest to the best available on-device provider or returns null for server fallback. WASM provider is a stub pending onnxruntime-web integration (Task 8+). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c90c825