Commit History
-
docs: record Edge + Firefox T11 smoke test results — both PASS
DONG-WEI-YANG +1: Claude Fable 5Extended the T11 offline-AI (wllama) smoke test to real Microsoft Edge 150 and real Firefox 151, driving each via Playwright's channel option (msedge) or native launch (firefox), against the same production build already verified on Chrome. Both browsers pass the full checklist: modal, live download progress 0%->100%, ready state, and correct Privacy-page cache-size display — no code changes were needed, confirming none of the 5 previously-fixed bugs were browser-engine-specific. Firefox's first two headed-mode runs were flaky (a download that silently stalled at 75%, and a click that timed out on a visible/stable button) — traced to desktop window-focus contention from running several other browser windows on the same machine during this session, not an app bug. Switching to headless mode resolved it reliably across two clean runs; documented in the smoke log so this isn't mistaken for a real Firefox issue later. Spec status updated: all three desktop engines (Chromium, Edge, Firefo…3a90b87 -
docs: record T11 smoke-test results — Desktop Chrome PASS, others pending
DONG-WEI-YANG +1: Claude Fable 5Automated Playwright/Chromium pass against a real production build, cloud-AI keys blanked to force the offline-AI fallback path. Found and fixed 5 bugs that made the feature completely non-functional (see 2258f1d and 03d636e); after fixing, verified end-to-end: modal, download progress, real WASM inference producing correct output, OPFS cache reuse on reload, and the Privacy page's cache-size display / clear-cache button. iOS Safari (standalone + iframe), Firefox, and Edge are NOT tested — no real devices/browsers available in this environment. Spec status updated to reflect Chrome-only confirmation; do not call this "production-ready" until a human runs the remaining checkpoints. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>e0ec65e
-
docs: implementation plan for two-RAG (genogram + ecomap)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)6 bite-sized tasks (T1, T2, T4, T5, T6, T7 — T3 removed during planning) implementing the design from 2026-05-13-rag-for-diagrams-design.md: - T1: source+category filter on ragSearch.search + searchBM25Only - T2: 18-chunk genogram coding guide seed + ragStore helpers (deleteByCategory, countDocuments) + db:seed:rag-genogram - T4: src/server/ai/ragContext.ts — getGenogramRagContext + getEcomapRagContext, both empty-string-on-failure - T5: wire RAG into 3 endpoints in routers/ai.ts + add "reference only" rule to 4 prompts in socialWorker.ts - T6: auto-seed at server startup if genogram chunks missing - T7: README update + final tsc/build/test verification Also amends the design spec inline: ecomap RAG filters by source='crawl' (not category='ecomap') because existing crawled docs are categorized per crawl-target (ltc_general / ltc_services / ltc_regulations / nursing_regulations / social_work_*), so no backfill needed. This eliminated the original T3 task. Plan + spe…2b7b2b7 -
docs: spec for two-RAG (genogram coding guide + ecomap resource KB)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Architecture for injecting two independent retrieval-augmented contexts into structureFromVoice / supplementGenogram / supplementEcomap: - Genogram RAG: hand-authored coding guide (18 chunks covering kinship decomposition, quality cues, health disambiguation, McGoldrick conventions), seeded into rag_social_worker.db with source='manual' category='genogram'. Single canonical KB — universal domain knowledge. - Ecomap RAG: data-driven combo of matchServiceCodes() keyword match (LTC 3.0 codes) + ragSearch on existing crawled care-resource docs filtered by category='ecomap', per-role. Plumbing: ragSearch.search gets an optional { category } filter (~3 LOC); new src/server/ai/ragContext.ts exposes getGenogramRagContext and getEcomapRagContext; auto-seed runs at server startup if the genogram chunks are missing (covers fresh deploys without manual `npm run db:seed:rag-genogram`). Both helpers degrade gracefully to empty string on any error — RAG unavailable falls back to current…5fda36c
-
docs(spec): mark #5 dependabot remediation as implemented
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>9eede27 -
docs: add dependabot remediation implementation plan (7 tasks)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)T0 spike (gate) + T1 migration + T2 wllamaProgress extraction + T3 shouldOfferOfflineAI helper + T4 concurrent test/comment fix + T5 apiStatus all-tiers + T6 final verification. Target 255 -> 257 tests, 0 critical vulns, no Vite chunk warning. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ded9cb8 -
docs: add dependabot remediation + follow-ups design spec (sub-project #5)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Eliminates the 4 critical dependabot vulns (protobufjs RCE chain) by migrating @xenova/transformers v2 → @huggingface/transformers v4, whose onnxruntime-web (1.26+) no longer pulls in the vulnerable onnx-proto. De-risked via a pre-flight spike (T0): install v4 throwaway + one-line pipeline()/model-ID verification before touching production code. Plan B (npm overrides on protobufjs) if the spike fails. Bundles 5 follow-ups from #1-#3 review findings: F1: extract wllamaProgress.ts → fixes Vite chunk warning (re-export keeps existing test imports unchanged) F2: shouldOfferOfflineAI() helper → DRYs 4 inline modal-guard copies F3: concurrent-getWllamaSession dedup test F4: fix stale buildRegistry comment F5: apiStatus reports cloud-llama / local-server tiers (was Gemini+HF-only; getRegistry().length as authoritative hasAny) Model IDs unchanged (Xenova/ models still work in v4 — correctness + perf de-risk). tinyNlp / ragEmbedder kept (real functionality). 7 tasks. T…75c51d1 -
docs(spec): mark #3 browser WASM wllama as implemented (smoke test pending)
DONG-WEI-YANGe51a012 -
docs: smoke-test checklist for offline AI cross-browser verification
DONG-WEI-YANG90583aa
-
docs: add browser WASM wllama implementation plan (sub-project #3)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)14 TDD tasks across 4 phases (~3-5 days): Phase A — Foundation (1 day, T1-T4): T1: install wllama, scaffold wllamaProvider.ts T2: TDD getWllamaSession lifecycle (4 tests) T3: TDD download progress + cache (4 tests) T4: TDD failure modes (4 tests) Phase B — deviceAI integration (0.5 day, T5-T6): T5: update TASK_PROVIDERS (4 tasks all wasm-enabled) T6: TDD runWasm wllama integration (6 tests) Phase C — UX (1.5-2 days, T7-T10): T7: EnableOfflineAIModal component T8: OfflineAIBanner component T9: Privacy.tsx offline AI settings section T10: wire failure-trigger from SmartTranscript / AiFillButton + App.tsx banner mount Phase D — Verification (0.5-1 day, T11-T14): T11: cross-browser manual smoke test (HUMAN-GATED — agent creates checklist, human partner runs through Chrome/Safari/Firefox/iframe) T12: automated final verification (build + 262+ tests + server smoke) T13: README documentation T14: mark spec implemented Target: 244 -> 262 tests, zero serv…9b49d24 -
docs: add browser WASM wllama design spec (sub-project #3)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Fills in the WASM stub at src/lib/deviceAI.ts:203 with wllama, enabling full LLM inference inside the user's browser via GGUF + WASM. Truly offline; ~1.8GB first-load cost; opt-in via modal-on-failure pattern. Default model: Qwen 2.5 3B Instruct Q4 (~1.8GB). User-overridable via Privacy settings + localStorage. Architecture: - New src/lib/wllamaProvider.ts (~150 lines): lifecycle + cache - Modify src/lib/deviceAI.ts: replace runWasm stub - 3 new UI components: EnableOfflineAIModal, OfflineAIBanner, Privacy section - Wire failure trigger from SmartTranscript / AiFillButton Zero server-side changes — pure client-side enhancement. 11 routers untouched. 244 -> 262+ tests via 18 new unit tests. UX: - Modal-on-failure (not onboarding) — user already has motivation when cloud AI just failed - Non-blocking banner shows download progress - 4G data warning baked into copy - sessionStorage records "declined this session" Risks identified: HF Spaces iframe + iOS Safari…22f6cb2 -
docs(spec): mark #2 local-server llama as implemented
DONG-WEI-YANGed8def2 -
docs: add local-server llama implementation plan (4 tasks, ~30 min)
DONG-WEI-YANG0e47d08 -
docs: add local-server llama design spec (sub-project #2)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Pivots from original "Node spawns subprocess" design to "external OpenAI-compat URL" — recognized after #1 ships that CloudLlamaProvider already handles any such endpoint, including llama-server, ollama, and vllm. Subprocess approach was ~300 lines + 80MB Docker bloat; this is ~12 lines reusing existing abstraction. Scope: - New env vars LLAMA_SERVER_URL/_MODEL/_API_KEY (all opt-in) - Registry registers in existing local-server tier (added in #0) - Updates README with llama.cpp + Ollama + remote setup recipes - 5 new tests; target 232 -> 237 green Architectural insight: "local" means "user-controlled URL", not "Docker bundled". User can point at localhost, LAN, Tailscale, or co-located server. HF Spaces production stays slim; zero overhead unless URL set. Sub-project #3 (browser WASM wllama) follows next for true device-local inference. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>618c23d -
docs(spec): mark #1 cloud llama provider as implemented
DONG-WEI-YANGf9766ce -
docs: add cloud llama provider implementation plan (sub-project #1)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)13 TDD tasks, ~12 new unit tests, target 226+ tests at completion. Task progression: T1: extract extractJson to utils.ts (DRY fix) T2: add 'cloud-llama' tier with JSDoc on Tier type T3: export callOpenAICompat for sibling providers T4: magic-number comments cleanup T5: TDD cooldown last-resort isNonRetryable bail T6: TDD CloudLlamaProvider basics (4 tests) T7: TDD CloudLlamaProvider circuit breaker (4 tests) T8: wire _clearCircuitBreaker cross-family T9: TDD Groq buildRegistry (3 tests) T10: TDD OpenRouter buildRegistry (2 tests) T11: TDD orchestrator integrates new tier (3 tests) T12: full verification (build + 226+ tests + smoke) T13: mark spec implemented Bundles all four #0 follow-ups (utils.ts DRY, Tier JSDoc, cooldown bail, magic-number comments) into the same PR train as the cloud-llama addition. Sequential strategy in cloud-llama tier means OpenRouter free DeepSeek is only called when Groq fails — preserves quota. Co-Authored-By: Claude Opus 4.7 (1…ea0ea6b -
docs: add cloud llama provider design spec (sub-project #1)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Adds Groq + OpenRouter as a new 'cloud-llama' tier between flagship (Gemini) and cloud-fallback (HF). Single generic CloudLlamaProvider class handles any OpenAI-compat endpoint; future DeepInfra/Fireworks additions are 1-line registry pushes. Tier ordering becomes: flagship → cloud-llama → cloud-fallback → local-server Sequential strategy within cloud-llama: Groq (fast LPU, free tier 30 req/min) tried first, OpenRouter (free DeepSeek-V3.1 model) as backup. This avoids burning OpenRouter quota when Groq is healthy. Bundled #0 follow-ups: - Extract extractJson() to src/server/ai/utils.ts (DRY fix) - JSDoc on Tier type explaining each tier's role - Cooldown last-resort loop also bails on isNonRetryable 4xx - Inline comments on magic numbers (60_000, 15_000, 120_000) Compatibility: zero edits to 11 router files; behaviour with no GROQ/OPENROUTER keys identical to #0; existing 214 tests stay green. Target: 226+ tests after ~12 new unit tests in TDD. Co-Authored-By: Claude Op…a336ca1 -
docs(spec): mark #0 LLM provider abstraction as implemented
DONG-WEI-YANG22341d1
-
docs: add llmProviders abstraction implementation plan (sub-project #0)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)14 TDD tasks, ~33 new unit tests, target 188+ green tests at completion. Each task is bite-sized (red-green-commit cycle): - T1: scaffold types/stubs - T2: mock provider helper - T3: isNonRetryable error classifier - T4-5: runStrategy sequential / race-batch - T6: callLlm orchestrator (tier walking + cooldown last resort) - T7: callOpenAICompat HTTP helper - T8: GeminiProvider class - T9: HFProvider with circuit breaker - T10: buildRegistry from env vars - T11: move chatAndReturn / chatAndParse (preserves real retry behaviour) - T12: hfInference.ts -> retain multimodal + re-export shim - T13: final verification (build + 188+ tests + live curl) - T14: mark spec implemented Public API signature preserved; routers/ai.ts requires zero edits; multimodal (audioAndParse/imageAndParse/audioTranscribe) stays in hfInference.ts unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>75babcc -
docs(spec): fix #0 spec — hfInference.ts has 5 exports, not 2
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)Discovered during plan-writing: routers/ai.ts:5 imports audioAndParse, imageAndParse, audioTranscribe in addition to chatAndReturn/chatAndParse. The original spec's '5-line shim' would have broken builds. Corrected scope: - Move only chatAndReturn + chatAndParse to llmProviders.ts - Retain audioAndParse / imageAndParse / audioTranscribe in hfInference.ts (Gemini-specific multimodal — wrong fit for LLMProvider.chat() interface) - Multimodal abstraction deferred to provisional sub-project #5 After refactor: hfInference.ts ~250 lines (down from 280), with the chat functions re-exported from llmProviders.ts for backwards compat. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>11ccd61 -
docs: add LLM provider abstraction design spec (sub-project #0)
DONG-WEI-YANG +1: Claude Opus 4.7 (1M context)First sub-project of the 5-phase llama.cpp integration roadmap. Extracts hfInference.ts orchestration into a registry-based provider abstraction so #1 (cloud llama), #2 (server-side llama-server), and #3 (browser WASM wllama) can plug in without if/else branching. Public API (chatAndReturn / chatAndParse) signatures are preserved; hfInference.ts becomes a 5-line backwards-compat shim. The 11 router files calling these APIs need zero edits. Tier-based strategy table replaces hard-coded URL comparisons: flagship (Gemini) -> sequential cloud-fallback (HF 8 models) -> race-batch (3) local-server (#2, future) -> sequential local-browser (#3 wllama) lives in client-side deviceAI.ts, not in this server-side abstraction. Out of scope: provider implementations for #1-#4, capability flags (YAGNI), file-per-provider split (defer to #1). Success: 176 -> 188+ tests green, hfInference.ts <= 10 lines, adding new provider type < 50 LOC and zero orchestrator edit…3c5e043
-
docs: genogram T-shaped layout implementation plan
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)5-task plan: buildFamilyUnits, layoutGenogram rewrite, drawFamilyConnections, caller updates, integration test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>c812d2c -
docs: genogram T-shaped layout design spec
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Fix tree-branch rendering to McGoldrick-Gerson standard: - FamilyUnit analysis → T-shaped routing (couple bar, descent line, sibship bar) - Smart auto-layout with couple/sibling/family spacing - Dynamic recalculation on drag Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>33f07dd
-
docs: implementation plan for on-device AI + vocabulary index
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)10-task plan covering vocabulary data, matching engine, DeviceAI service, SmartTranscript/AiFillButton integration, Vite config, and ONNX model bundling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>4c76191 -
docs: on-device AI + role vocabulary index design spec
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Adds design for client-side AI integration that works without API keys: - BuiltInAIProvider (Chrome/Edge/Opera Gemini Nano) + WasmProvider (all browsers) - Role-specific vocabulary index with phonetic fuzzy matching for STT correction - Enhanced voice recognition pipeline with 3-layer client-side processing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>0f73fbd
-
feat: voice wizard, quick record UI, abuse arrow, quick mode toggle
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Voice Step Wizard (/wizard): - 5-step guided genogram/ecomap construction via voice - Step 1: client info, Step 2: family members, Step 3: relationships - Step 4: external resources (ecomap), Step 5: preview + save - Each step: independent recording → AI extraction → editable cards - Embedded GenogramEditor/EcomapEditor preview in final step Quick Record (/quick): - Streamlined 3-step flow: choose role → voice record → AI fill → save - Designed for 3-minute record completion - Large role selection cards, full-width voice area Quick Mode Toggle (all 6 form pages): - "快速模式/完整模式" toggle button in page headers - Quick mode hides secondary form sections, keeps voice + key fields - Essential fields per role always visible Abuse Directed Arrow: - New quality type 'abuse' with zigzag + directional arrow - Arrow points from abuser (from_id) → victim (to_id) - AI prompt supports 虐待/施暴/家暴 Chinese mappings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>5c4cd74
-
docs: Phase 1 implementation plan — AI voice fill generalization
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)13 tasks covering shared utilities extraction, per-role prompt+schema, router generalization, frontend components, and page integrations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>09ce68e -
docs: Phase 1 design spec — AI voice fill generalization for all roles
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>e1abcd5
-
docs: AI voice-to-structured-data implementation plan
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)6 tasks: HF client, prompts, tRPC router, auto-layout, frontend integration, deploy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>0ccfd28 -
docs: AI voice-to-structured-data design spec
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Defines architecture for voice dictation → auto-fill forms + auto-generate genogram/ecomap using HF Inference API (Qwen2.5). Covers prompt design, JSON schema, error handling, and security considerations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>3cad674
-
docs: add full implementation plan (33 tasks, 5 parallel groups)
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Covers: core app, RAG knowledge bases, AI router, tiny NLP, auto-crawling, UI/UX, and cloud deployment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>c80aa10 -
docs: fix minor review findings (env var, backup, dedup)
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Remove stale ENCRYPTION_SALT env var (per-record salt is used) - Clarify backup retention mechanism and cleanup automation - Deduplicate rate limit reference in section 4.4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>58113e8 -
docs: fix critical crypto issues and add missing sections
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Fix AES-256-GCM: add HKDF key derivation, per-record salt, explicit IV - Increase key entropy from 54-bit to 120-bit (20 chars) - Use bcrypt instead of SHA-256 for key_hash lookup - Add missing JSON schemas: social_assessment, nursing_note - Clarify session bundling (one key per record session) - Fix metadata leakage in encrypted_files - Add API rate limiting, operational, browser compatibility sections - Add LTC 3.0 code seeding strategy - Fix consent_logs FK constraint (soft reference) - Remove is_destroyed column (hard delete only) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>ef1326d -
docs: add system design spec for 簡易個案管理助理
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)Zero-knowledge encrypted, keyless multi-role LTC record tool with genogram/ecomap, SOAP, voice-to-LTC3.0 code mapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>2df1464