Commit Graph
71 Commits
Author SHA1 Message Date
Neko Ayaka 98f40d7d0b style: lint 2026-08-26 19:49:58 +08:00
Neko Ayaka 6a24582696 chore(deps): bump dependencies 2026-08-26 19:01:04 +08:00
Neko Ayaka d2b837fa01 fix(stage-ui,stage-tamagotchi,stage-web): infinite write config causing forever loading 2026-08-19 01:07:30 +08:00
Neko Ayaka addfec1981 refactor(testing-audio,stage-ui): added pinia-plugin-tracing, directly assert from history of pinia 2026-08-14 03:22:32 +08:00
Neko ac0192e5b6 fix(stage-tamagotchi): sync hearing text with chat input (#2264) 2026-08-12 05:00:57 +08:00
Neko 82b82c644f fix(stage-tamagotchi): replace streaming caption corrections (#2263) 2026-08-12 02:57:03 +08:00
Neko Ayaka 07d5baf410 fix(stage-ui,stage-tamagotchi): should not flash messages, stream correctly, and sync tool call renderer 2026-08-10 14:32:42 +08:00
Neko Ayaka 66d7ef207e refactor(stage-web,stage-pages,stage-ui): better structure for asr & vad 2026-08-09 18:22:29 +08:00
Neko Ayaka 16f7dfaf4d chore(deps): updated 2026-08-09 01:46:13 +08:00
Neko Ayaka 83ea2afbd7 refactor(*): generalize events 2026-08-09 01:34:48 +08:00
Neko Ayaka 93af669d14 fix(stage-pocket): guard for beatsync 2026-08-04 04:22:58 +08:00
Ryanba 563a738c88 fix(ui): safelist settings entry icons (#2050) 2026-07-13 11:34:20 +08:00
Doji 8b98a2c138 feat(stage-tamagotchi):add spotlight (#1959) 2026-06-12 02:53:35 +08:00
Lulu aa5223ad73 feat(stage): hide BYOK providers for Steam builds via VITE_DISABLE_CUSTOM_PROVIDERS (#1908) 2026-06-10 16:36:31 +08:00
Lulu 0647f5b37a feat(stage): hide flux purchase UI for Steam builds via VITE_DISABLE_FLUX_PURCHASE (#1912) 2026-06-08 13:51:10 +08:00
RainbowBird 9382a12137 chore: cleanup and lint fix 2026-06-07 20:31:22 +08:00
RainbowBird 7841df28f8 build(deps): migrate workspace dependencies to catalogs
Move direct external dependency versions into pnpm catalogs and update workspace packages to reference catalog entries.

Signed-off-by: RainbowBird <git@luoling.moe>

Commit-Message-Assisted-by: Codex
2026-06-03 17:12:13 +08:00
Lilia_Chenandautofix-ci[bot] ecf234c246 feat(stage-tamagotchi-godot): camera control (#1855)
## Summary

This PR adds the first usable camera and view-state loop for the
experimental Godot stage.

The main design direction is that Godot owns the stage view state, while
Electron and the settings page act as lifecycle/transport/control
surfaces. The settings UI can now edit Godot camera state, and camera
changes from the Godot window can flow back to the UI.

## What Changed

- Added the shared Godot view-state contract for camera pose, avatar
bounds, snapshots, patches, and errors.
- Added Electron main bridge APIs for Godot status, scene input, view
snapshots, and view patches.
- Added Godot-side camera runtime:
  - initial camera bootstrap from loaded avatar bounds
  - avatar facing normalisation
  - orbit, pan, wheel movement, and WASD-style camera movement
  - idle persistence for camera position, yaw, pitch, and FOV
- Added settings-page Godot camera controls with coalesced updates,
restart-safe session handling, and stale request protection.
- Kept scene input simple: Electron does not cache the selected model
for replay. Each Godot start receives the current model selection from
the renderer.

## File Guide

Shared contracts:

- `packages/stage-shared/src/godot-stage/view-state.ts` defines the
Godot view-state contract and schema validation.
- `packages/stage-shared/src/godot-stage/index.ts` exports the Godot
shared contract surface.
- `packages/stage-shared/package.json` exposes the new shared entry.

Electron / renderer bridge:

- `apps/stage-tamagotchi/src/shared/eventa/index.ts` adds the Eventa
contracts for Godot status, scene input, view snapshot, patch, and error
events.
- `apps/stage-tamagotchi/src/main/services/airi/godot-stage/index.ts`
owns the Godot sidecar lifecycle, local WebSocket bridge, scene input
forwarding, and view-state forwarding.

Settings page:

- `apps/stage-tamagotchi/src/renderer/pages/settings/models/index.vue`
wires the settings page to Godot status, scene input, snapshots, and
patches.
-
`apps/stage-tamagotchi/src/renderer/pages/settings/models/godot-view-patch-queue.ts`
coalesces high-frequency camera edits before sending them to Godot.
-
`apps/stage-tamagotchi/src/renderer/pages/settings/models/godot-view-session.ts`
tracks renderer-local Godot session epochs so stale async results are
ignored.

Shared settings UI:

-
`packages/stage-ui/src/components/scenarios/settings/model-settings/godot.vue`
renders the Godot camera controls.
-
`packages/stage-ui/src/components/scenarios/settings/model-settings/panel.vue`
routes the model settings panel between Live2D, VRM, and Godot settings.
-
`packages/stage-ui/src/components/scenarios/settings/model-settings/runtime.ts`
resolves model-settings runtime display state and Godot camera control
range.
- `packages/stage-ui/src/components/data-pane/property-number.vue`
updates number control behavior so config changes such as min/max/range
are reflected correctly.

Godot runtime:

- `engines/stage-tamagotchi-godot/scripts/StageRoot.cs` wires scene
loading, view runtime, and transport together.
- `engines/stage-tamagotchi-godot/scripts/scene/StageSceneController.cs`
loads VRM avatars and normalizes avatar facing direction.
- `engines/stage-tamagotchi-godot/scripts/view/StageViewRuntime.cs` owns
Godot view-state updates, snapshots, patch application, and idle
persistence.
-
`engines/stage-tamagotchi-godot/scripts/view/StageCameraPoseController.cs`
computes avatar bounds, bootstraps the camera, applies camera pose, and
handles camera movement math.
-
`engines/stage-tamagotchi-godot/scripts/view/StageCameraInputController.cs`
maps mouse and keyboard input into camera operations.
- `engines/stage-tamagotchi-godot/scripts/view/StageViewStateRules.cs`
centralizes view-state defaults and validation rules.
- `engines/stage-tamagotchi-godot/scripts/view/StageViewStateStore.cs`
persists and loads Godot camera view state.
- `engines/stage-tamagotchi-godot/scripts/transport/StageViewJson.cs`
parses and serializes view-state transport payloads.
-
`engines/stage-tamagotchi-godot/scripts/transport/StageViewPayloads.cs`
defines the C# payload records used by the transport layer.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-21 03:32:59 +08:00
Neko Ayaka 018ad05fd7 fix(stage-ui): useVersionedLocalStorage did not return the patched value back 2026-05-21 02:53:56 +08:00
Makito f86d86c04c feat(stage-tamagotchi,stage-shared): listen keyup for global shortcut with uiohook 2026-05-20 03:07:54 +09:00
Neko Ayaka f33d485b82 feat(stage-ui): io tracer for CALL tokens 2026-05-18 01:23:14 +08:00
Makitoandautofix-ci[bot] d02a76f944 feat(stage-tamagotchi,stage-shared): wire up global shortcut service and devtools (#1811)
1. Introduce the global shortcut service
1. Add more concrete failure reasons for shortcut registration attempts
1. Add a devtool page to test (un) registering and triggering shortcuts

--- 

<img width="1174" height="921" alt="Screenshot 2026-05-10 at 19 33 45"
src="https://github.com/user-attachments/assets/10712013-fd49-4285-bdc9-4e6955d9c3a7"
/>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-10 20:38:47 +09:00
RainbowBird 40284514d4 fix(stage-*): isDev constant 2026-05-04 20:04:24 +08:00
RainbowBirdandLiet Blue 172e4ce59c feat(auth): email login & profile (#1745)
Co-authored-by: Liet Blue <127093491+lietblue@users.noreply.github.com>
2026-04-28 00:07:38 +08:00
Makito 3566e8b4a8 feat(stage-tamagotchi,stage-shared): essentials for global shortcut 2026-04-25 21:30:10 +09:00
NJXandCopilot d85709f900 feat(stage-ui): webgpu detect improved (#1681)
---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-24 23:33:09 +08:00
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 c7cf0c6a47 fix(stage-pages,stage-shared,stage-ui): rollback 3f82942 falsy fix 2026-04-22 14:14:02 +08:00
Iro 3f829421d3 fix(server-runtime): enforce auth & routing safety, fix lifecycle leaks (#1686) 2026-04-22 14:03:16 +08:00
Neko Ayaka 2ab21879dd chore(deps): bump dependencies 2026-04-18 19:18:17 +08:00
Neko Ayaka b9f88ef84f style: lint 2026-04-15 14:44:59 +08:00
Makito bcd89786a0 fix(stage-pages,stage-shared,stage-ui): auto fit IO tracer 2026-04-15 02:56:04 +09:00
Makito dbe85583bf feat(stage-pages,stage-shared,stage-ui): better OTel identifiers 2026-04-15 02:17:09 +09:00
Makito 7d544d03a1 feat(stage-shared,stage-ui): add store and integrations for IO tracer 2026-04-15 02:17:09 +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
Makito dd9cc0942b feat(stage-shared): add types for IO tracing 2026-04-11 18:25:19 +09:00
LemonNeko 0cd095b323 feat(stage-pocket): scan qr code to connect to tamagotchi 2026-04-07 19:04:59 +08:00
RainbowBird f1fe161bc0 feat(auth): OIDC (#1531) 2026-04-02 04:24:04 +08:00
LemonNeko e2b00e7d28 fix(stage-tamagotchi): persistence for settings of beat sync 2026-03-28 23:51:54 +08:00
Neko Ayaka 7d8302ebdd refactor(stage-ui,i18n): default to use force blink (our version) 2026-03-28 16:04:28 +08:00
Neko Ayaka 4b2bd40f73 refactor(stage-shared): now useVersionedLocalStorageManualReset 2026-03-28 15:56:21 +08:00
RainbowBird b0576d3b89 chore(deps): move eventa to catalog 2026-03-26 21:45:01 +08:00
Makito 87f43c7aa6 feat(stage-pocket,stage-web,stage-shared): add isEnvTruthy for safer env var checks 2026-03-05 03:03:57 +07:00
Neko Ayaka 92d87833be chore(deps): bump dependencies 2026-02-26 18:33:52 +08:00
leafyy 19d635d12a feat:(stage-ui) Modify settings card (#1027) 2026-02-09 15:10:18 +08:00
Neko Ayaka d051a07da9 chore(deps): bump dependencies 2026-01-21 05:42:01 +08:00
Neko Ayaka c0d69ca910 fix(stage-ui,stage-pages): yes re-implemented useLocalStorageManualReset as refManualReset will not propagate 2026-01-17 15:59:00 +08:00
Neko Ayaka e38366d37b fix(deps): sync vue to catalog: 2026-01-17 15:57:54 +08:00
Makito 4cda1828ec feat(electron-screen-capture): introduce new screen capture utilities (#937) 2026-01-12 02:30:19 +08:00
9005b9f430 feat(stage-*): performance overlay & markdown stress test (#838)
---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Neko <neko@ayaka.moe>
2026-01-06 03:04:35 +08:00