airi/packages/stage-ui
RainbowBird 9a182e0b68
Some checks are pending
Cloudflare Workers (server-dev) / Deploy - stage-web (server-dev) (push) Waiting to run
feat(server,stage-ui): bidirectional streaming TTS + audio path refactor
Why:
- Add a real bidirectional streaming TTS path: raw LLM tokens are
  forwarded to the upstream model (Volcengine v3 via the unspeech ws
  bridge) without client-side segmentation, so the model owns sentence
  splitting and audio chunks play as they arrive.
- Move audio endpoints out of /api/v1/openai/. `/audio/voices`,
  `/audio/models`, `/audio/voices/streaming` are not real OpenAI public
  APIs, and the streaming TTS surface has nothing to do with OpenAI —
  keeping them under /openai/ mislabelled the contract.
- Introduce `capabilities.speech.transport` on ProviderDefinition so
  future streaming providers (ElevenLabs / Cartesia / OpenAI Realtime)
  opt in without touching Stage.vue or the session factory.
- Unify Stage.vue's TTS path through a single StageTtsSession so the
  chat-orchestrator hooks no longer branch on provider id.

What:
- apps/server: new ws proxy /api/v1/audio/speech/ws bridges client ↔
  unspeech with auth, pre-flight flux check, billing from upstream
  session.finished.usage, OTel spans.
- apps/server: audio routes moved from /api/v1/openai/audio/* to
  /api/v1/audio/* (hard cutover; 404 sentinel tests added).
- apps/server: new /api/v1/audio/voices/streaming proxy reads voices
  from unspeech /api/voices?provider=volcengine.
- apps/server: new STREAMING_TTS_UPSTREAM configKV entry +
  scripts/seed-streaming-tts.ts.
- stage-ui: new libs/speech/streaming-pipeline.ts opens one ws per LLM
  intent (appendText / finish / cancel + onSentence / onError / onDone).
- stage-ui: new libs/speech/tts-session.ts — StageTtsSession interface
  with segmenter and streaming adapters; factory dispatches by
  capabilities.speech.transport instead of hard-coded provider id.
- stage-ui: providerOfficialSpeechStreaming with capabilities.speech =
  { transport: 'bidirectional-ws' }; settings page with model/voice
  picker + ws-based preview.
- stage-ui: Stage.vue chat hooks collapsed to a single currentSession;
  hot-swap watcher cancels mid-session on provider/voice/model change;
  unmount cancels and drains playback.

Tests:
- 9 streaming-pipeline tests (happy path / buffered / error / cancel /
  truncation)
- 11 tts-session tests (factory branch coverage + adapter contracts)
- 4 audio-speech-ws route tests (forwarding / billing / pre-flight /
  config-missing)
- 3 legacy-path 404 sentinels in v1 route tests
- Verification doc updated to reflect automated coverage.
2026-05-17 01:35:40 +08:00
..
public docs(stage-ui): updated logo 2026-03-12 05:09:32 +08:00
src feat(server,stage-ui): bidirectional streaming TTS + audio path refactor 2026-05-17 01:35:40 +08:00
stories fix(stage-ui,ui): histoire wasn't configured correctly 2026-04-22 16:57:35 +08:00
.env feat(stage-*): experimental realtime transcription powered by Aliyun NLS 2025-11-02 04:20:27 +08:00
env.d.ts feat(stage-ui): integrate histoire storyboard (#70) 2025-03-12 10:32:05 +08:00
histoire.config.ts fix(stage-ui): configure Histoire to exclude node_modules from vendor chunking 2026-04-25 16:46:08 +08:00
package.json feat(server): stream tts provider 2026-05-16 17:29:40 +08:00
README.md chore: lint & lock 2026-03-06 16:49:31 +08:00
tsconfig.json chore(ci): fix typecheck on navigator.gpu (#1700) 2026-04-21 20:27:17 +08:00
uno.config.ts feat: Refactor Font Configuration for Consistency and Correctness (#409) 2025-08-25 11:44:10 +08:00
vite.config.ts refactor(stage-web,stage-ui): replace warpdrive plugin with unplugin-basemove (#1818) 2026-05-13 12:03:30 +08:00
vitest.config.ts test: migrate more test into browser mode, fix all existing tests 2026-05-07 18:48:39 +08:00

Stage UI

Shared core for stage

Histoire (UI storyboard)

https://histoire.dev/

pnpm -F @proj-airi/stage-ui run story:dev

Project structure

  1. If a story is bound to a specific component, it can be placed beside the component in the src folder. e.g., MyComponent.story.vue
  2. If a story is not bound to a specific component, then it should be placed in the stories folder. e.g., MyStory.story.vue