Commit Graph
3593 Commits
Author SHA1 Message Date
Neko Ayaka 0294dad6ef feat(plugin-sdk): kits api, binding api, and better comments 2026-04-21 16:46:04 +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 60456c7567 fix(ui): SelectTab size issue 2026-04-18 19:27:02 +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 2ab21879dd chore(deps): bump dependencies 2026-04-18 19:18:17 +08:00
Luluandautofix-ci[bot] a40cbd67cf fix(stage-layouts): mount LoginDrawer in settings layout on mobile (#1675)
---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by-agent: Cursor <unknown@example.com>
2026-04-18 18:26:19 +08:00
github-actions[bot]andCrowdin Bot 2a444245ae chore(i18n): update translations (#1678)
This PR contains updated translations from Crowdin. Created from [GitHub
Actions](https://github.com/moeru-ai/airi/blob/main/.github/workflows/crowdin-cron-sync.yml).

You can review the source of translations
[here](https://crowdin.com/project/proj-airi)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2026-04-18 18:20:48 +08:00
Neko Ayaka 70495439ad refactor(core-agent,stage-ui): move spark-notify agent to core-agent 2026-04-17 16:18:42 +08:00
github-actions[bot]andCrowdin Bot 8d6905481b chore(i18n): update translations (#1672)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2026-04-17 15:09:06 +08:00
github-actions[bot] 7bc43bd986 chore: update README release artifacts to v0.9.0 2026-04-16 19:04:54 +00:00
RainbowBird bef1598179 fix(stage-ui): refresh token concurrency 2026-04-17 02:59:14 +08:00
RainbowBird 8967bbe211 feat(server): add TTS support with per-character billing 2026-04-17 02:59:14 +08:00
RainbowBird 57533044f7 feat(server): add gateway and model configuration to environment variables 2026-04-17 02:59:14 +08:00
RainbowBird a11727020a feat(server/billing): implement debt ledger for TTS service using FluxMeter 2026-04-17 02:59:14 +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
autofix-ci[bot] c4a2e88a58 [autofix.ci] apply automated fixes 2026-04-16 22:58:06 +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
github-actions[bot] e10b3376d4 chore(nix): update pnpmDeps hash 2026-04-16 08:15:40 +00:00
NJX 5187572c42 fix(stage-ui/inference): correctness and resilience fixes for browser-side inference infra (#1663)
## Summary

Addresses **Phase 1** of the inference infrastructure roadmap (#1661).
Six correctness and resilience issues fixed across adapters, workers,
and the unified protocol layer.

**Scope:** `packages/stage-ui/src/libs/inference/`,
`packages/stage-ui/src/libs/workers/`, `packages/stage-ui/src/workers/`

---

## Problems & Motivation

### 1. Kokoro Singleton cannot recover from terminal state

`getKokoroAdapter()` creates a singleton that is never reset. Once the
adapter reaches `terminated` or `error` (restarts exhausted), the
singleton is permanently dead -- users must refresh the page.

**Root cause:** `globalAdapter` is only re-created when `null`, never
checks the state of the existing instance. `scheduleRestart()` silently
returns when retries are exhausted, leaving state stuck at `'error'`
instead of transitioning to `'terminated'`.

**Fix:**
- `getKokoroAdapter()` now detects `terminated` / `error` states and
re-creates the adapter automatically
- `scheduleRestart()` in both Kokoro and Whisper adapters transitions to
`'terminated'` when max restarts are exhausted, making the dead state
detectable

### 2. `voices!` non-null assertion after nullable assignment

`kokoro.ts:275` assigns `voices = (response.metadata?.voices as Voices)
?? null` (can be null), but L288 returns `voices!` -- if the worker
returns unexpected metadata, callers receive `null` but the type system
promises `Voices`, causing downstream crashes.

**Fix:** Replaced with explicit null check + throw, routing into the
existing error recovery path.

### 3. Whisper Worker silently drops concurrent requests

The worker's `runInference()` has `if (processing) return` which
silently drops the request. The adapter's `waitForMessage()` never
receives a response, causing the Promise to hang for 120 seconds until
timeout.

**Root cause:** The bare boolean is safe in a single-threaded worker --
the real bug is the silent `return` with no error response.

**Fix:** Replaced with `sendError(requestId, ...)` so the adapter
receives an immediate rejection.

### 4. Whisper adapter leaks event listeners on worker restart

`ensureWorker()` attaches anonymous `message` and `error` listeners each
time a new Worker is created. `destroyWorker()` only calls
`worker.terminate()` without removing listeners. On restart paths
(`scheduleRestart -> ensureWorker`), old Worker listener closures may
prevent GC.

**Impact:** Whisper is most critical (2 listeners + restart logic).
Kokoro and Background Removal have the same pattern but lower risk.

**Fix:** All 3 adapters now store listener references and call
`removeEventListener` before `terminate()`. Whisper's
`terminateAdapter()` routes through `destroyWorker()` instead of direct
`worker.terminate()`.

### 5. Error classification is incomplete

`classifyError()` only matches 3 string patterns (OOM, DEVICE_LOST,
TIMEOUT). `LOAD_FAILED` and `INFERENCE_FAILED` are defined in the
`InferenceErrorCode` type but never produced. All workers hardcode
`recoverable: false`.

**Fix:**
- `classifyError(error, phase?)` gains a `phase` parameter: specific
patterns (OOM etc.) take priority, unmatched errors fall through to
`LOAD_FAILED` / `INFERENCE_FAILED` based on phase
- New `isRecoverable(code)` helper: TIMEOUT and DEVICE_LOST are
recoverable
- All 3 workers' `sendError()` updated to pass phase and use dynamic
recoverability

### 6. No dtype/device fallback chain

Kokoro Worker attempts model loading once with the requested dtype;
failure is terminal. Whisper Worker hardcodes `encoder_model: 'fp16'`
which crashes on devices that don't support it.

**Fix:**
- **Kokoro Worker:** New `DTYPE_FALLBACK` and `DEVICE_FALLBACK` maps.
Tries `fp16 -> fp32 -> q8 -> q4` on the same device, then `webgpu ->
wasm` device fallback. Reports `actualDtype` and `actualDevice` in
`ModelReadyResponse.metadata`
- **Whisper Worker:** Wraps fp16 encoder load in try-catch; falls back
to fp32

---

## State after changes

| Component | Before | After |
|-----------|--------|-------|
| Kokoro singleton | Returns dead instance forever after terminal error
| Auto-detects and re-creates |
| `voices` return | `voices!` can return null, lying to type system |
Explicit throw, enters error recovery path |
| Whisper Worker concurrency | Silent drop, Promise hangs 120s |
Immediate error response |
| Event listeners | Anonymous, never cleaned up | Stored references,
removeEventListener on destroy |
| Error classification | 4/6 codes reachable, recoverable hardcoded
false | 6/6 codes reachable, dynamic recoverability |
| dtype loading | Single attempt, failure is terminal | Progressive
fallback chain, reports actual config used |

---

## Files changed

| File | Changes |
|------|---------|
| `libs/inference/protocol.ts` | `classifyError` phase param, new
`isRecoverable` helper |
| `libs/inference/protocol.test.ts` | **New** -- 14 tests for
classification and recoverability |
| `libs/workers/worker.ts` | Silent drop fix, sendError phase, fp16
fallback |
| `workers/kokoro/worker.ts` | sendError phase, dtype/device fallback
chain |
| `workers/background-removal/worker.ts` | sendError phase |
| `libs/inference/adapters/whisper.ts` | Listener cleanup,
terminateAdapter uses destroyWorker, scheduleRestart terminal state |
| `libs/inference/adapters/kokoro.ts` | Singleton recovery, voices
assertion fix, listener cleanup, scheduleRestart terminal state |
| `libs/inference/adapters/kokoro.test.ts` | **New** -- 5 tests for
singleton and state transitions |
| `libs/inference/adapters/background-removal.ts` | Listener cleanup,
extracted destroyWorker |

## Test plan

- [x] `pnpm exec vitest run packages/stage-ui/src/libs/inference/` --
30/30 tests pass (protocol, kokoro adapter, GPU coordinator, load queue)
- [x] `pnpm -F @proj-airi/stage-ui typecheck` -- clean
- [x] `npx eslint` on all 9 changed files -- clean
- [x] Pre-commit hooks pass

Co-authored-by-agent: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 16:11:05 +08:00
Nashchenncandautofix-ci[bot] bf41655dbb feat(core-agent): extract pure runtime logic from stage-ui into core-agent (#1524)
Depends on #1487 

## Summary

- Introduce `packages/core-agent` — a new pure-runtime package that
extracts zero-Vue/Pinia algorithmic logic from `@proj-airi/stage-ui`,
following a "compatible facade + core sinking" strategy
- Migrate shared chat types, LLM streaming types, chat hook registry,
session message merge logic, context registry algorithm, and LLM service
utilities into `core-agent`
- `stage-ui` files are preserved as re-exports / thin wrappers — all
external imports, store IDs, and public APIs remain unchanged

## Motivation

`stage-ui` currently mixes pure agent runtime logic (algorithms, type
definitions, stateless utilities) with Vue/Pinia state management and
browser-specific adapters. This coupling makes it hard to:
- Test agent logic in isolation
- Reuse agent algorithms outside of Vue contexts (e.g., server-side,
CLI, other frameworks)
- Reason about the boundary between "what the agent does" vs "how the UI
manages state"

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by-agent: Unknown <unknown@example.com>
2026-04-16 16:09:22 +08:00
Octopus 11ac511dd9 feat(stage-ui,i18n): add MiniMax Speech TTS provider (#1594)
## Summary

- Add `minimax-speech` TTS provider using MiniMax's T2A v2 API
- Implement streaming SSE response with hex-encoded audio decoding (no
external dependency required)
- Include a curated static voice list (English and Mandarin voices)
- Add `speech-2.8-hd` (default) and `speech-2.8-turbo` model entries
- Support configurable base URL defaulting to `https://api.minimax.io`
- Add i18n translations for all 9 supported locales

Closes #1274

## Implementation Details

The provider uses a custom `fetch` interceptor within the
`SpeechProvider` interface to:
1. Parse the incoming OpenAI-style request (`input`, `voice`, `model`)
2. Call MiniMax's `/v1/t2a_v2` SSE streaming endpoint
3. Decode hex-encoded audio chunks from SSE events (skipping the summary
chunk with `status=2`)
4. Return a concatenated `audio/mpeg` response

## API Reference

- TTS: https://platform.minimax.io/docs/api-reference/speech-t2a-http
2026-04-16 16:07:30 +08:00
github-actions[bot]andCrowdin Bot b867980087 chore(i18n): update translations (#1669)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2026-04-16 15:59:40 +08:00
Makito 25f5684feb fix(stage-tamagotchi): suppress "conflicting files found for route" warnings 2026-04-16 01:35:15 +09:00
Makito 186a70fbc7 fix(stage-pages): replace with vueuse utilities 2026-04-16 01:35:14 +09:00
Neko Ayaka 3c7eed999f chore(AGENTS.md): updated 2026-04-15 23:46:14 +08:00
RainbowBird b9ba5a6bf5 chore: prune deps 2026-04-15 17:36:59 +08:00
github-actions[bot] eeb1717fe1 chore(nix): update assets hash 2026-04-15 07:15:50 +00:00
DrHuangMHT 9d5c9e9332 chore(deps): remove deprecated unplugin-vue-router (#1664) 2026-04-15 15:02:10 +08:00
github-actions[bot] f9b32f55f5 chore(nix): update pnpmDeps hash 2026-04-15 06:57:46 +00:00
github-actions[bot] d57865dee6 chore(nix): update assets hash 2026-04-15 06:51:58 +00:00
akrlin e75b6618b3 fix(stage-ui,i18n) fix a bug when change language (#1666) 2026-04-15 14:47:26 +08:00
Neko Ayaka b9f88ef84f style: lint 2026-04-15 14:44:59 +08:00
Neko Ayaka f286464e03 chore(deps): bump dependencies 2026-04-15 14:44:59 +08:00
github-actions[bot]andCrowdin Bot fff6560e2d chore(i18n): update translations (#1665)
This PR contains updated translations from Crowdin. Created from [GitHub
Actions](https://github.com/moeru-ai/airi/blob/main/.github/workflows/crowdin-cron-sync.yml).

You can review the source of translations
[here](https://crowdin.com/project/proj-airi)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2026-04-15 11:15:08 +08:00
Neko Ayaka 753182d2c5 chore(AGENTS.md): updated 2026-04-15 05:09:10 +08:00
Neko Ayaka f7a9a7bf76 refactor(vishot-*,scenarios-*): better structure, better api, and markup components 2026-04-15 04:51:00 +08:00
Neko Ayaka 6d68cfbd92 refactor(stage-web,ui-server-auth): better ui of auth 2026-04-15 04:32:19 +08:00
Neko Ayaka 936c65f3fa chore(.agent): added agent-browser skill 2026-04-15 04:32:18 +08:00
Makito bcd89786a0 fix(stage-pages,stage-shared,stage-ui): auto fit IO tracer 2026-04-15 02:56:04 +09: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 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