Commit Graph
598 Commits
Author SHA1 Message Date
Richard Pinedo 4e6da5ef04 feat(stage-*): port artistry & chatbox enhancements (#1636)
Co-authored-by-agent: Unknown <unknown@example.com>
2026-04-24 23:25:04 +08:00
Neko Ayaka 3cc9c87b0f fix(stage-tamagotchi): stage widget tool was broken 2026-04-24 04:12:26 +08:00
Neko Ayaka a3249ccd68 feat(stage-tamagotchi,stage-ui,ui): input should not flink, added retry for errored item, adjusted button 2026-04-23 01:09:46 +08:00
22b0d27001 fix(stage-tamagotchi): hide chat input scrollbar when content fits (#1687)
---------

Co-authored-by: octo-patch <octo-patch@github.com>
Co-authored-by: ximi-helper <ximi-helper@octo-patch.com>
2026-04-22 14:00:12 +08:00
Neko Ayaka 8603d8cd7a fix(stage-tamagotchi): fix test 2026-04-22 13:52:40 +08:00
Neko Ayaka 509c00d9a5 feat(plugin-sdk,stage-tamagotchi): rework of plugin structure, integrated kits api, now plugin manifest is plugin.airi.json 2026-04-22 13:52:11 +08:00
Neko Ayaka 5bbf9559a4 refactor(stage-ui,stage-tamagotchi): have plugin-tools, mcp-tools to register directly to llm.ts 2026-04-22 03:34:40 +08:00
Neko Ayaka a406ffb67c feat(stage-tamagotchi): widget now supports customizable ui from plugin/extension 2026-04-21 02:23:34 +08:00
Neko Ayaka 033e76c2f1 feat(stage-tamagotchi): built-in local loopback http server 2026-04-20 20:39:12 +08:00
Neko Ayaka d2d5493136 fix(stage-tamagotchi): concurrent apply and auto-heal will have conflicts 2026-04-18 19:26:22 +08:00
Neko Ayaka 1258c246d5 chore: updated 2026-04-16 23:21:45 +08:00
autofix-ci[bot] 25aec906dc [autofix.ci] apply automated fixes 2026-04-16 22:58:10 +08:00
Nekoandgemini-code-assist[bot] 9b4ef8862b Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-04-16 22:58:10 +08:00
Jensen Huang c14e9547d9 feat(stage-tamagotchi): improve updater cleanup lane and admin diagnostics 2026-04-16 22:58:10 +08:00
Jensen Huang 1a11409b1e fix(stage-tamagotchi): use electron cache path for updater cleanup 2026-04-16 22:58:09 +08:00
Jensen Huang 026168044e fix(stage-tamagotchi): updater regressions, downgrade warnings, and cross-platform cache cleanup
- Fixed architecture-sensitive updater tests (26/26 passing)
- Added downgrade-warning UI via semver comparison
- Restored Windows custom log path and implemented cross-platform cache cleanup
- Made updater diagnostics always-on (no gating)
2026-04-16 22:55:54 +08:00
Neko Ayaka 499617e436 fix(stage-tamagotchi): chat sync broken for cross window 2026-04-16 16:58:31 +08:00
akrlin e75b6618b3 fix(stage-ui,i18n) fix a bug when change language (#1666) 2026-04-15 14:47:26 +08:00
Makito 4f28b40b9f fix(stage-tamagotchi): correctly use devtools window params 2026-04-15 02:17:10 +09:00
Makito a620c2395b feat(stage-tamagotchi,i18n,stage-pages): localize IO Tracer title and update route metadata 2026-04-15 02:17:10 +09:00
Makito b0b48840ec feat(stage-tamagotchi,stage-pages): initialize IO trace viewer 2026-04-15 02:17:10 +09:00
Makito 3d35d492ba feat(stage-tamagotchi): support detached devtools window with params 2026-04-14 02:21:10 +09:00
Makito 1744ceaa06 fix(stage-tamagotchi): open devtools for beat sync in detach mode 2026-04-14 00:57:38 +09:00
147d077aa7 feat(inference): unify and optimize WebGPU inference pipeline (#1622)
## Problem

The WebGPU inference pipeline had several structural issues:

1. **No unified protocol** — Kokoro TTS, Whisper ASR, and Background
Removal workers each used their own ad-hoc message formats. Adding a new
model meant reinventing worker communication from scratch.
2. **Infrastructure existed but was disconnected** —
`GPUResourceCoordinator`, `LoadQueue`, `InferenceWorkerManager`, and
`protocol.ts` were all implemented but had zero consumers. The adapters
duplicated the same lifecycle/timeout/mutex patterns independently.
3. **Performance gaps** — Kokoro only offered fp32 on WebGPU (no fp16),
Whisper warm-up compiled shaders for 187.5s of dummy audio, audio
transfer went through unnecessary WAV blob encode/decode, and
`listVoices` reloaded the model every time.
4. **Silent failures** — Whisper worker's `generate()` had no try-catch;
errors were swallowed and the main thread waited until timeout.
5. **No graceful degradation** — Whisper and Background Removal workers
hardcoded `device: 'webgpu'` with no WASM fallback.
6. **No observability** — Only Kokoro had performance tracing. No
adapter reported status to `useInferenceStatus`. No cache management UI
existed.
7. **Dead code accumulation** — Old `KokoroWorkerManager` (232 lines),
legacy Whisper message types, and scattered duplicate constants.

## Changes

### Phase 0 — Critical Performance & Bugs
- Add `fp16-webgpu` dtype for Kokoro TTS (~2x inference speed on
supported GPUs)
- Fix Whisper warm-up tensor from `[1, 128, 3000]` → `[1, 128, 1]`
(minimal shader compilation)
- Fix Whisper worker silent error bug (add try-catch to `generate()` and
`load()`)

### Phase 1 — Data Transfer & Caching
- Switch Kokoro audio to Float32Array transferable (skip WAV blob encode
in worker, lightweight WAV encode on main thread)
- Cache `listVoices` results (skip redundant model reload when adapter
state is `ready`)
- Normalize progress reporting to 0-100 across all adapters,
differentiate `warmup` phase

### Phase 2 — Protocol Unification & Infrastructure
- Migrate all 3 workers + 3 adapters to unified `protocol.ts` message
types (`load-model`, `run-inference`, `model-ready`, `inference-result`,
`progress`, `error`)
- Wire `GPUResourceCoordinator` into all adapters (VRAM allocation
tracking, LRU ordering, memory pressure events)
- Wire `LoadQueue` into all adapters (priority-based sequential model
loading: TTS=10 > ASR=5 > BG_REMOVAL=1)
- Add `coordinator.ts` global singleton for GPU coordinator + load queue
- Add WebGPU detection + WASM fallback in Whisper and Background Removal
workers

### Phase 3 — Error Recovery & Observability
- Add restart logic with exponential backoff to Whisper adapter
(matching Kokoro's existing pattern)
- Integrate `classifyError()` (OOM / DEVICE_LOST / TIMEOUT
classification) in Whisper adapter
- Extend `defaultPerfTracer` to Whisper `transcribe()` and Background
Removal `processImage()`
- Wire `useInferenceStatus` into all 3 adapters (downloading → ready →
terminated lifecycle)

### Phase 4 — Tests
- Add unit tests for `AsyncMutex` (4 tests), `LoadQueue` (4 tests),
`GPUResourceCoordinator` (7 tests) — all 15 passing

### Phase 5 — Cleanup & Features
- Delete old `KokoroWorkerManager` (232 lines, zero consumers)
- Delete orphaned `libs/workers/types.ts` (old Whisper message types)
- Clean up `workers/kokoro/types.ts` (remove legacy message types, keep
domain types)
- Create centralized `constants.ts` (MODEL_IDS, MODEL_NAMES, TIMEOUTS,
MAX_RESTARTS)
- Remove hardcoded WebGPU check from background-removal devtools pages
(worker auto-detects)
- Add `useModelPreload` composable for generic idle-time preloading
- Add `useInferencePreload` composable that reads provider config and
preloads configured local models
- Wire preloading into both `stage-web` and `stage-tamagotchi` App.vue
(Kokoro TTS preloads 3s after init)
- Add `ModelCacheManager.vue` settings component (cache size display,
per-model status, clear cache)
- Document GPU Device isolation architecture in protocol.ts

## After This PR

- All inference workers speak the same protocol → adding a new model
adapter is straightforward
- GPU memory is tracked across all models with automatic pressure
warnings at 80%/95% of VRAM budget
- Models load sequentially via priority queue → no bandwidth/VRAM
contention
- Workers auto-detect WebGPU and fall back to WASM → works on browsers
without WebGPU
- Kokoro TTS preloads during idle time → "instant" first use for
configured users
- All adapters auto-restart on worker crashes (max 3 attempts,
exponential backoff)
- 15 unit tests cover core infrastructure (mutex, queue, coordinator)
- Zero dead code remains in the inference pipeline

## Test Plan

- [x] `pnpm exec vitest run packages/stage-ui/src/libs/inference/` — 15
tests pass
- [x] `pnpm -F @proj-airi/stage-ui exec tsc --noEmit` — no TypeScript
errors
- [x] `pnpm lint:fix` — no lint errors in changed files
- [ ] Manual: verify Kokoro TTS works with fp16-webgpu on a supported
browser
- [ ] Manual: verify Whisper ASR loads and transcribes correctly
- [ ] Manual: verify Background Removal works in devtools page
- [ ] Manual: verify preloading triggers in console (`[Preload] Loading
kokoro-...`)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-13 23:19:27 +08:00
yiduoyide 7309fcd358 fix(stage-tamagotchi): fix window title (#1639) 2026-04-13 14:31:30 +08:00
Neko Ayaka b77a1af2c8 chore(stage-tamagotchi): improve widget calling devtools 2026-04-11 05:21:46 +08:00
Neko Ayaka fb3f54699b chore(18n): unified to use sign in / sign out 2026-04-10 16:25:11 +08:00
Neko Ayaka abc0cb0bc7 refactor(ui-server-auth,server): use better design of signin page 2026-04-10 16:25:11 +08:00
Neko Ayaka 3962139b93 chore(stage-tamagotchi,ui): improved about page 2026-04-10 13:54:22 +08:00
Makito 686c059364 perf(stage-tamagotchi): resize once and then animate the window move
---------

Co-authored-by-agent: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 05:04:50 +09:00
Makito 2a1c47eab7 feat(stage-tamagotchi): better transforming strategy for main-stage window 2026-04-10 05:02:34 +09:00
Makito b11f251dd0 feat(stage-tamagotchi): move main-stage window to avoid overlap with onboarding window 2026-04-10 04:44:50 +09:00
Neko Ayaka 628fe28969 refactor(stage-tamagotchi): improved about, better structure 2026-04-10 03:40:11 +08:00
Neko Ayaka 1be6defb08 chore(ci): updated tsconfig.json 2026-04-09 17:22:13 +08:00
Neko Ayaka b95d84fba7 perf(stage-tamagotchi): better fallback, matrix smoking test 2026-04-08 04:16:13 +08:00
Neko Ayaka c2dba69a8b fix(stage-tamagotchi): autoUpdater fix with channels 2026-04-08 03:32:07 +08:00
Neko Ayaka 160176b33a fix(stage-*): qr should have dark mode adapted, connection component moved 2026-04-08 01:06:40 +08:00
LemonNeko 0cd095b323 feat(stage-pocket): scan qr code to connect to tamagotchi 2026-04-07 19:04:59 +08:00
Neko Ayaka d989e2c8b7 fix(stage-tamagotchi): incorrect auto updater 2026-04-07 18:12:06 +08:00
NJX 0ddc2e12f2 feat(stage-tamagotchi): added weather API + tool for widget calling (#1588)
---------

Co-authored-by-agent: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by-agent: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-07 16:53:16 +08:00
Richard Pinedo 99be852fe4 feat(stage-tamagotchi,stage-ui,server-sdk,server-runtime): zero-trust websocket authentication (#1582) 2026-04-07 04:05:35 +08:00
Neko Ayaka 5452c72351 fix(stage-tamagotchi): intercept close and treat as hide by default
Close #1585
2026-04-07 02:05:43 +08:00
LemonNeko 7690dc08c9 feat(stage-pocket-ios): websocket bridge 2026-04-06 23:39:54 +08:00
Neko Ayaka aa9b6fec5f fix(stage-tamagotchi): more onboarding fix 2026-04-06 21:49:37 +08:00
LemonNeko 883ec945d2 feat(stage-pocket): WebSocket status indicator + shared i18n (#1586) 2026-04-06 19:54:21 +08:00
Lulu bb9a602767 fix(stage-*): onboarding model selection footer overlap and list height (#1583)
---------

Co-authored-by-agent: Cursor
2026-04-06 17:09:04 +08:00
Lulu 97b3cb9d34 fix(stage-tamagotchi): add drag region to onboarding layout (#1584)
Co-authored-by-agent: Cursor
2026-04-06 17:07:39 +08:00
jensenhuangfan babdb0e6e7 fix(stage-tamagotchi): harden cross-platform auto-updater flow, diagnostics, logs, and cache cleanup (#1566) 2026-04-06 01:48:02 +08:00
Neko Ayaka 476ef2018f style: many typescript v6 pending errors 2026-04-05 02:07:09 +08:00
LemonNeko 1fccad5fc7 fix(stage-tamagotchi): rollback when wss enable failed, show errors 2026-04-03 18:28:07 +08:00