Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: replace Kokoro with Piper and guide existing voice installs through setup (#7011)

[._.]/ Adam Eivyaeaa879517d5
diff --git a/client/src/components/pipeline/stages/AudioStage.jsx b/client/src/components/pipeline/stages/AudioStage.jsx
index 6c240d404e..99899a3f86 100644
--- a/client/src/components/pipeline/stages/AudioStage.jsx
+++ b/client/src/components/pipeline/stages/AudioStage.jsx
@@ -616,7 +616,7 @@ export default function AudioStage({ issue, onStageUpdate }) {
<h2 className="text-lg font-semibold text-white">{PIPELINE_STAGE_LABELS.audio}</h2>
<p className="text-xs text-gray-500 mt-0.5">
Voice-over per dialogue line. Picks each character's bound voice; falls back to project default.
- {' '}<span className="text-gray-600">Local OSS (Kokoro / Piper) always available.</span>
+ {' '}<span className="text-gray-600">Local Piper voices available after setup.</span>
</p>
</div>
<span className={`text-[10px] uppercase tracking-wider ${STATUS_COLOR[stage.status] || 'text-gray-500'}`}>
diff --git a/client/src/components/settings/MemoryManagement.jsx b/client/src/components/settings/MemoryManagement.jsx
index 411a60082b..1d21fef98b 100644
--- a/client/src/components/settings/MemoryManagement.jsx
+++ b/client/src/components/settings/MemoryManagement.jsx
@@ -358,7 +358,7 @@ export default function MemoryManagement({ onLoadedModelsChange } = {}) {
danger
/>
)}
- {ttsState.state !== 'lazy' && (
+ {!ttsState.retired && ttsState.state !== 'lazy' && (
<Row
icon={Volume2}
title="Kokoro TTS"
diff --git a/client/src/components/settings/VoiceTab.jsx b/client/src/components/settings/VoiceTab.jsx
index f8d3f4eb42..9e14c4f7f4 100644
--- a/client/src/components/settings/VoiceTab.jsx
+++ b/client/src/components/settings/VoiceTab.jsx
@@ -18,7 +18,6 @@ const SERVICE_LABELS = {
whisper: 'Whisper (STT)',
'web-speech': 'Web Speech API (STT)',
piper: 'Piper (TTS)',
- kokoro: 'Kokoro (TTS)',
llm: 'LLM provider',
};
@@ -27,12 +26,6 @@ const STT_ENGINES = [
{ value: 'web-speech', label: 'Web Speech API (browser-native, zero latency)' },
];
-const KOKORO_DTYPES = [
- { value: 'q8', label: 'q8 (recommended — ~80MB, fast)' },
- { value: 'q4', label: 'q4 (smallest)' },
- { value: 'fp16', label: 'fp16 (higher quality)' },
- { value: 'fp32', label: 'fp32 (best quality, slowest)' },
-];
const WHISPER_MODELS = [
@@ -282,7 +275,7 @@ export function VoiceTab() {
const facetime = cfg.facetime || {};
const faceTimeDirty = !facetime.targetHandle?.trim() || !facetime.targetName?.trim();
- const configuredEngine = cfg.tts.engine || 'kokoro';
+ const configuredEngine = cfg.tts.engine || 'piper';
const sttEngine = cfg.stt.engine || 'whisper';
const engineMeta = ttsEngines.find((item) => (
item.id === configuredEngine || item.aliases?.includes(configuredEngine)
@@ -530,18 +523,10 @@ export function VoiceTab() {
</div>
</FormField>
- {engine === 'kokoro' && (
- <FormField label="Kokoro precision" hint="Lower precision = smaller download + faster, slight quality cost.">
- <select
- value={cfg.tts.kokoro?.dtype || 'q8'}
- onChange={(e) => patch('tts.kokoro.dtype', e.target.value)}
- className={inputCls}
- >
- {KOKORO_DTYPES.map((opt) => (
- <option key={opt.value} value={opt.value}>{opt.label}</option>
- ))}
- </select>
- </FormField>
+ {cfg.tts.retiredEngine === 'kokoro' && (
+ <p role="status" className="text-sm text-port-warning">
+ Kokoro has been retired. Your voice settings now use Piper. Choose a voice, then use Save &amp; Reconcile to install Piper and its voice model. Existing Kokoro character profiles must be replaced with a Piper preset.
+ </p>
)}
<FormField label="Speech rate" hint="0.5 = slow, 1.0 = normal, 2.0 = fast">
diff --git a/client/src/components/settings/VoiceTab.test.jsx b/client/src/components/settings/VoiceTab.test.jsx
index 7c7f4be62e..3aeb47c0fa 100644
--- a/client/src/components/settings/VoiceTab.test.jsx
+++ b/client/src/components/settings/VoiceTab.test.jsx
@@ -83,6 +83,18 @@ describe('VoiceTab TTS engine registry', () => {
}));
});
+ it('explains the Kokoro upgrade and keeps Piper setup user-triggered', async () => {
+ voiceApi.getVoiceConfig.mockResolvedValue({
+ ...structuredClone(config), tts: { ...config.tts, engine: 'piper', retiredEngine: 'kokoro' },
+ });
+ render(<MemoryRouter><VoiceTab /></MemoryRouter>);
+ expect(await screen.findByText(/Kokoro has been retired/)).toHaveTextContent('Save & Reconcile');
+ expect(screen.getByRole('combobox', { name: 'TTS engine' })).toHaveValue('piper');
+ expect(voiceApi.updateVoiceConfig).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole('button', { name: 'Save & Reconcile' }));
+ await waitFor(() => expect(voiceApi.updateVoiceConfig).toHaveBeenCalled());
+ });
+
it('loads engine options and patches the registry configuration key for Qwen3 voices', async () => {
render(<MemoryRouter><VoiceTab /></MemoryRouter>);
diff --git a/client/src/components/universe/CharacterDetailEditor.jsx b/client/src/components/universe/CharacterDetailEditor.jsx
index 8a2d7e9a72..744b8c0cbe 100644
--- a/client/src/components/universe/CharacterDetailEditor.jsx
+++ b/client/src/components/universe/CharacterDetailEditor.jsx
@@ -962,7 +962,7 @@ function VoiceProfileSection({ universeId, entry, disabled }) {
) : null}
</div>
) : (
- <p className="text-[10px] text-gray-500">Promote the selected Kokoro or Piper preset to give this character a stable local voice.</p>
+ <p className="text-[10px] text-gray-500">Promote the selected Piper preset to give this character a stable local voice.</p>
)}
<div className="flex flex-wrap gap-1.5">
diff --git a/client/src/components/universe/CharacterDetailEditor.test.jsx b/client/src/components/universe/CharacterDetailEditor.test.jsx
index 2986a4c704..ebfcb1bb97 100644
--- a/client/src/components/universe/CharacterDetailEditor.test.jsx
+++ b/client/src/components/universe/CharacterDetailEditor.test.jsx
@@ -199,7 +199,7 @@ describe('CharacterDetailEditor — production package (#5378)', () => {
entry={{ ...ARIA, voiceId: 'kokoro:af_heart' }} universeId="uni-1" characters={[ARIA]} onPatch={() => {}}
/>);
fireEvent.click(screen.getByRole('tab', { name: 'Voice' }));
- expect(await screen.findByText(/Promote the selected Kokoro or Piper preset/i)).toBeInTheDocument();
+ expect(await screen.findByText(/Promote the selected Piper preset/i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /Promote selected preset/i }));
await waitFor(() => expect(promoteVoicePreset).toHaveBeenCalledWith({
universeId: 'uni-1', characterId: 'chr-aria', characterName: 'Aria', voiceId: 'kokoro:af_heart',
diff --git a/docs/DEPS.md b/docs/DEPS.md
index 591ce99fc9..afcb74bf72 100644
--- a/docs/DEPS.md
+++ b/docs/DEPS.md
@@ -32,7 +32,7 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
| `chokidar` | 1 | KEEP | server file watching | Mature cross-platform file-system watcher used by server services |
| `express` | 1 | KEEP | `server/index.js` + routes | Framework |
| `google-auth-library` | 1 | KEEP | Google OAuth | Pairs with `@googleapis/*` |
-| `kokoro-js` | 2 | KEEP | `server/services/voice/tts-kokoro.js` | Only pure-JS in-process TTS; replacement = Python subprocess + pooling |
+| `kokoro-js` | 2 | REMOVED | Former in-process TTS | Replaced by the in-tree Piper backend; existing settings migrate |
| `node-pty` | 1 | KEEP | shell/terminal services | Native PTY binding (N-API) |
| `pg` | 1 | KEEP | Postgres access | Official `pg` driver |
| `playwright-core` | 1 | KEEP | `server/services/fableLoom/falVideoAutomation.js` — fal.ai scene video automation | Drives the PortOS-managed browser over CDP (`chromium.connectOverCDP`). `-core` rather than the full `playwright` package deliberately: the browser is provisioned separately by `npm run setup:browser`, so the bundled browser download would be dead weight |
@@ -113,15 +113,13 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
- **Regression cover**: `client/src/pages/ApiExplorer.bundle.test.js` sums the Scalar-attributable `client/dist/assets` files and asserts they stay under a **4.0 MB** budget (~23% headroom over the measured 3.24 MB). It skips itself when `client/dist` is absent, so the plain unit-test job stays green; CI runs it as its own step right after `npm run build --prefix client`, against a fresh build rather than a stale `dist/`. A companion assertion pins non-vacuity — it fails if no `ScalarReference-*.js` chunk is found, so a Vite chunk-naming change cannot turn the budget into a 0-byte pass. This is the only test in the client suite that looks at build output; every other one runs against source, so a version bump that doubles the chunk is otherwise completely unobserved.
- **Re-audit trigger**: revisit if the budget test fails (re-measure and decide deliberately — do not reflexively raise the number), if Scalar drops the `agent` config toggle, or if a maintained framework-free OpenAPI renderer appears.
-### `kokoro-js` — KEEP (Tier 2)
+### `kokoro-js` — REMOVED 2026-09-11
+
+- **Decision**: retire the in-process backend in favor of the existing Piper CLI backend (#7011).
+- **Dependencies**: removed kokoro-js and its exclusive tar/protobufjs overrides. Sharp remains a direct dependency used by image processing.
+- **Upgrade**: migration 376 switches saved Kokoro settings to Piper, preserving the old settings and any customized Piper voice. Reads and saves also normalize restored legacy settings. Settings → Voice explains the change; choose a voice and use **Save & Reconcile** to install the binary/model. No models download during migration.
+- **Character profiles**: historical Kokoro profiles and audio remain intact. Synthesis reports an actionable retirement error; select/promote a Piper preset to replace the binding rather than silently changing a character's voice.
-- **Usage**: 1 dynamic import in `server/services/voice/tts-kokoro.js` (~80 LOC module). 3 call sites: `KokoroTTS.from_pretrained()`, `tts.generate(text, {voice, speed})`, `audio.toWav()`.
-- **Maintenance**: pinned at `1.2.1` (latest; published 2025-05-03). **Maintenance watch** — no publish since ~May 2025, so the package is effectively stale even at latest. This is not disqualifying today (small, pure-JS, no CVEs), but re-evaluate on the trigger below.
-- **Vulns**: None (npm audit clean).
-- **Replacement complexity**: Moderate (~50–80 LOC) but requires Python subprocess + JSON IPC + process pooling + lifecycle management. Operational overhead exceeds the supply-chain risk.
-- **Decision**: KEEP (on maintenance watch). The only pure-JS in-process TTS option; Web Speech API is cloud-dependent and Piper requires CLI install.
-- **Re-audit trigger**: the >12-months-stale trigger already fired and was actioned by this audit (bumped to latest, put on watch). Re-evaluate on any of: a CVE reported, the model-load path breaking against a newer Transformers.js, or the package still showing no upstream publish at the next dependency audit — then revisit and migrate (see escape hatch below).
-- **Piper escape hatch (if dropped later)**: Piper is **already implemented** as a peer backend — `server/services/voice/tts-piper.js` (`synthesizePiper(text, cfg, signal) → { wav, latencyMs }`, plus `listPiperVoices`), which `server/services/voice/tts.js` already dispatches to alongside `synthesizeKokoro`. Both backends share the same `(text, cfg, signal) → { wav, latencyMs }` contract, so dropping `kokoro-js` is a delete, not a rewrite: remove the `kokoro` branch (and the `tts-kokoro.js` module + its `kokoro-js` dependency) from the dispatcher in `tts.js` and let Piper be the default engine. The tradeoff Piper carries — and the reason it isn't the default today — is a native `piper` binary + ONNX voice download (vs. `kokoro-js`'s npm-only, in-process install).
### `eslint` (and the `keyv` / `flat-cache` / `file-entry-cache` chain) — REMOVED 2026-08-04
diff --git a/scripts/migrations/376-retire-kokoro-tts.js b/scripts/migrations/376-retire-kokoro-tts.js
new file mode 100644
index 0000000000..7ba305478d
--- /dev/null
+++ b/scripts/migrations/376-retire-kokoro-tts.js
@@ -0,0 +1,23 @@
+// Upgrade only the retired engine; keep custom Piper settings and legacy provenance.
+import { readFile } from 'node:fs/promises';
+import { join } from 'node:path';
+import { writeJsonAtomic } from './_lib.js';
+import { migrateRetiredTtsConfig } from '../../server/lib/voiceEngines.js';
+
+export default {
+ async up({ rootDir }) {
+ const path = join(rootDir, 'data', 'settings.json');
+ const raw = await readFile(path, 'utf8').catch(error => {
+ if (error.code === 'ENOENT') return null;
+ throw error;
+ });
+ if (raw === null) return;
+ const settings = JSON.parse(raw);
+ const tts = settings.voice?.tts;
+ const next = migrateRetiredTtsConfig(tts);
+ if (next === tts) return;
+ settings.voice.tts = next;
+ await writeJsonAtomic(path, settings);
+ console.log('🗣 Kokoro retired: open Settings → Voice and use Save & Reconcile to set up Piper.');
+ },
+};
diff --git a/scripts/migrations/376-retire-kokoro-tts.test.js b/scripts/migrations/376-retire-kokoro-tts.test.js
new file mode 100644
index 0000000000..880677c1f0
--- /dev/null
+++ b/scripts/migrations/376-retire-kokoro-tts.test.js
@@ -0,0 +1,44 @@
+import { afterEach, describe, expect, it } from 'vitest';
+import { mkdtemp, mkdir, readFile, writeFile, rm } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import migration from './376-retire-kokoro-tts.js';
+
+const roots = [];
+afterEach(async () => { await Promise.all(roots.splice(0).map(root => rm(root, { recursive: true, force: true }))); });
+
+describe('retire Kokoro settings migration', () => {
+ it('switches existing installs without losing customized voices, disabled state or unrelated settings; reruns are inert', async () => {
+ const rootDir = await mkdtemp(join(tmpdir(), 'kokoro-upgrade-'));
+ roots.push(rootDir);
+ await mkdir(join(rootDir, 'data'));
+ const path = join(rootDir, 'data/settings.json');
+ const settings = { theme: 'light', voice: { enabled: false, tts: {
+ engine: 'kokoro', rate: 1.4, kokoro: { voice: 'af_heart' },
+ piper: { voice: 'custom', voicePath: '~/custom.onnx', speakerId: 7 },
+ } } };
+ await writeFile(path, JSON.stringify(settings));
+ await migration.up({ rootDir });
+ const upgraded = JSON.parse(await readFile(path, 'utf8'));
+ expect(upgraded).toEqual({ ...settings, voice: { ...settings.voice, tts: {
+ ...settings.voice.tts, engine: 'piper', retiredEngine: 'kokoro',
+ } } });
+ const once = await readFile(path, 'utf8');
+ await migration.up({ rootDir });
+ expect(await readFile(path, 'utf8')).toBe(once);
+ });
+
+ it('leaves other engines untouched and fails on unreadable input so repair can retry', async () => {
+ const rootDir = await mkdtemp(join(tmpdir(), 'kokoro-upgrade-'));
+ roots.push(rootDir);
+ await migration.up({ rootDir });
+ await mkdir(join(rootDir, 'data'));
+ const path = join(rootDir, 'data/settings.json');
+ const raw = JSON.stringify({ voice: { tts: { engine: 'qwen3-tts' } } });
+ await writeFile(path, raw);
+ await migration.up({ rootDir });
+ expect(await readFile(path, 'utf8')).toBe(raw);
+ await writeFile(path, '{');
+ await expect(migration.up({ rootDir })).rejects.toThrow();
+ });
+});
diff --git a/scripts/setup-voice.ps1 b/scripts/setup-voice.ps1
index b90c4c8e7f..b691e224b8 100644
--- a/scripts/setup-voice.ps1
+++ b/scripts/setup-voice.ps1
@@ -5,7 +5,7 @@
# STT_ENGINE 'whisper' (default) | 'web-speech'
# MODEL_NAME Whisper GGUF to fetch (default: ggml-base.en.bin)
# VOICE_NAME Piper voice name (default: en_GB-jenny_dioco-medium)
-# TTS_ENGINE 'kokoro' (default) | 'piper'
+# TTS_ENGINE 'piper' (default) | 'qwen3-tts'
# INSTALL_COREML '1' — ignored on Windows (CoreML is Apple Silicon only)
$ErrorActionPreference = 'Stop'
@@ -17,7 +17,7 @@ $PIPER_DIR = Join-Path $VOICE_HOME 'piper'
$MODEL_NAME = if ($env:MODEL_NAME) { $env:MODEL_NAME } else { 'ggml-base.en.bin' }
$VOICE_NAME = if ($env:VOICE_NAME) { $env:VOICE_NAME } else { 'en_GB-jenny_dioco-medium' }
-$TTS_ENGINE = if ($env:TTS_ENGINE) { $env:TTS_ENGINE } else { 'kokoro' }
+$TTS_ENGINE = if ($env:TTS_ENGINE) { $env:TTS_ENGINE } else { 'piper' }
$STT_ENGINE = if ($env:STT_ENGINE) { $env:STT_ENGINE } else { 'whisper' }
New-Item -ItemType Directory -Force -Path $MODELS_DIR | Out-Null
@@ -116,5 +116,5 @@ if ($TTS_ENGINE -eq 'piper') {
Write-Host " piper: $(Join-Path $PIPER_DIR 'piper.exe')"
Write-Host " piper voice: $(Join-Path $VOICES_DIR "$VOICE_NAME.onnx")"
} else {
- Write-Host ' kokoro models: managed by transformers.js (~/.cache/huggingface/)'
+ Write-Host ' Qwen3 models: managed in Settings → Voice'
}
diff --git a/scripts/setup-voice.sh b/scripts/setup-voice.sh
index e1c050233d..d754d096d5 100755
--- a/scripts/setup-voice.sh
+++ b/scripts/setup-voice.sh
@@ -7,11 +7,10 @@
# skips whisper-cpp install + model download entirely
# MODEL_NAME Whisper GGUF to fetch (default: ggml-base.en.bin)
# VOICE_NAME Piper voice name (default: en_GB-jenny_dioco-medium) — only used when TTS_ENGINE=piper
-# TTS_ENGINE 'kokoro' (default) | 'piper'
+# TTS_ENGINE 'piper' (default) | 'qwen3-tts'
# INSTALL_COREML '1' to download CoreML encoder for Whisper on macOS (default: 0)
#
-# Models live under ~/.portos/voice/{models,voices}/. Kokoro models are managed
-# automatically by transformers.js under ~/.cache/huggingface/.
+# Models live under ~/.portos/voice/{models,voices}/.
set -euo pipefail
@@ -20,7 +19,7 @@ MODELS_DIR="${VOICE_HOME}/models"
VOICES_DIR="${VOICE_HOME}/voices"
MODEL_NAME="${MODEL_NAME:-ggml-base.en.bin}"
VOICE_NAME="${VOICE_NAME:-en_GB-jenny_dioco-medium}"
-TTS_ENGINE="${TTS_ENGINE:-kokoro}"
+TTS_ENGINE="${TTS_ENGINE:-piper}"
STT_ENGINE="${STT_ENGINE:-whisper}"
INSTALL_COREML="${INSTALL_COREML:-0}"
@@ -145,5 +144,5 @@ if [[ "$TTS_ENGINE" == "piper" ]]; then
echo " piper: ${PIPER_DIR}/piper"
echo " piper voice: ${VOICES_DIR}/${VOICE_NAME}.onnx"
else
- echo " kokoro models: managed by transformers.js (~/.cache/huggingface/)"
+ echo " Qwen3 models: managed in Settings → Voice"
fi
diff --git a/server/lib/README.md b/server/lib/README.md
index 6b058af272..c5efbe3ca5 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -636,6 +636,6 @@ pm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and
| `videoTimelineFades.js` | Browser-safe `fitFades()` proportionally fits a fade pair to its visible duration. Shared by timeline normalization/export and the editor preview/trim controls; legacy import paths re-export it. |
| `voiceEcho.js` | Pure voice-echo detection helpers — tokenization, trigram building, thresholds shared by server and client echo gates. |
-| `voiceEngines.js` | Shared TTS engine IDs, display metadata, supported-engine set, and persisted configuration keys. |
+| `voiceEngines.js` | Shared TTS engine IDs, display metadata, supported-engine set, persisted configuration keys, and retired TTS config migration. |
| `auditQuality.js` | Category discovery strategies, assessment prompt and strict schema, sentinel parsing, and freshness-aware app quality aggregation with deterministic latest-per-category selection across peers. |
diff --git a/server/lib/apiContractSchemas.js b/server/lib/apiContractSchemas.js
index 0fcbe24d90..06963852a2 100644
--- a/server/lib/apiContractSchemas.js
+++ b/server/lib/apiContractSchemas.js
@@ -15,7 +15,7 @@ export const voiceSynthesizeBodySchema = z.object({
engine: z.enum(TTS_ENGINE_IDS).optional(),
voice: z.string().max(128).optional(),
rate: z.number().min(0.25).max(4).optional()
- .describe('Speech rate. Validated 0.25-4 (Piper). Kokoro clamps to 0.5-2.0.'),
+ .describe('Speech rate. Validated 0.25-4 (Piper).'),
}).strict();
export const sdapiTxt2imgBodySchema = z.object({
diff --git a/server/lib/apiRegistry.js b/server/lib/apiRegistry.js
index f44f23e7a2..cc315c9591 100644
--- a/server/lib/apiRegistry.js
+++ b/server/lib/apiRegistry.js
@@ -31,13 +31,13 @@ export const API_REGISTRY = [
{
id: 'voice',
label: 'Voice / TTS',
- description: 'Text-to-speech synthesis and voice enumeration (Kokoro, Piper).',
+ description: 'Text-to-speech synthesis and voice enumeration (Piper, Qwen3-TTS).',
publicPrefixes: ['/api/voice/public/'],
publicBase: '/api/voice/public',
example: {
method: 'POST',
path: '/api/voice/public/synthesize',
- body: { text: 'Hello from PortOS', engine: 'kokoro' },
+ body: { text: 'Hello from PortOS', engine: 'piper' },
output: 'speech.wav',
},
settingsKey: 'voice',
diff --git a/server/lib/apiToolResource.test.js b/server/lib/apiToolResource.test.js
index c352624481..020ed90c83 100644
--- a/server/lib/apiToolResource.test.js
+++ b/server/lib/apiToolResource.test.js
@@ -52,7 +52,7 @@ describe('buildToolResource', () => {
it('flattens an object request body into the argument schema and keeps property descriptions', () => {
const input = byName('voice.synthesize').input_schema;
expect(input.required).toEqual(['text']);
- expect(input.properties.engine.enum).toEqual(['kokoro', 'piper', 'qwen3-tts']);
+ expect(input.properties.engine.enum).toEqual(['piper', 'qwen3-tts']);
// The description is what lets a model pick a valid rate — minimization must not strip it.
expect(input.properties.rate.description).toMatch(/Speech rate/);
expect(input.additionalProperties).toBe(false);
@@ -60,7 +60,7 @@ describe('buildToolResource', () => {
it('turns query parameters into input properties', () => {
const input = byName('voice.list-voices').input_schema;
- expect(input.properties.engine).toEqual({ type: 'string', enum: ['kokoro', 'piper', 'qwen3-tts'] });
+ expect(input.properties.engine).toEqual({ type: 'string', enum: ['piper', 'qwen3-tts'] });
expect(input.required).toBeUndefined(); // the engine param is optional
});
diff --git a/server/lib/voiceEngines.js b/server/lib/voiceEngines.js
index 381ce8debe..bc4650e31c 100644
--- a/server/lib/voiceEngines.js
+++ b/server/lib/voiceEngines.js
@@ -1,17 +1,6 @@
// Shared TTS engine metadata. The registry is returned by /api/voice/engines so
// clients can render and update engines without copying IDs or config keys.
export const TTS_ENGINE_REGISTRY = Object.freeze({
- kokoro: Object.freeze({
- configKey: 'kokoro',
- label: 'Kokoro',
- description: 'In-process, high quality',
- voiceHint: 'Grade letter = Kokoro author\'s quality rating. ❤️ 🔥 🎧 mark the best-sounding voices. Click ▶ to preview without saving.',
- capabilities: {
- preset: true, voiceDesign: false, instantClone: false, fineTune: false,
- streaming: false, instructionControl: false, emotionControl: false,
- seed: false, wordTimings: false, rate: true, pitch: false, formant: false,
- },
- }),
piper: Object.freeze({
configKey: 'piper',
label: 'Piper',
@@ -43,3 +32,8 @@ export const TTS_ENGINE_CONFIG_KEYS = Object.freeze(Object.fromEntries(
export const TTS_ENGINE_IDS = Object.freeze(Object.keys(TTS_ENGINE_REGISTRY));
export const VALID_ENGINES = new Set(TTS_ENGINE_IDS);
+
+// Keep retired settings readable when an older client saves or a backup is restored.
+export const migrateRetiredTtsConfig = (tts) => tts?.engine === 'kokoro'
+ ? { ...tts, engine: 'piper', retiredEngine: 'kokoro' }
+ : tts;
diff --git a/server/package-lock.json b/server/package-lock.json
index ad1bf7bdba..9b6b348ad0 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -15,7 +15,6 @@
"chokidar": "5.0.0",
"express": "5.2.1",
"google-auth-library": "11.0.2",
- "kokoro-js": "1.2.1",
"node-pty": "1.2.0-beta.15",
"pg": "8.23.0",
"playwright-core": "1.63.0",
@@ -149,27 +148,6 @@
"node": ">=12.0.0"
}
},
- "node_modules/@huggingface/jinja": {
- "version": "0.5.8",
- "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.8.tgz",
- "integrity": "sha512-ZdElB7DPS7QQS8ZnFc5RPPtkg+eN11z8AmIZWAyes6pSbwXqiFB/POVevvm01begdSX1ho9Gxln/F6qlQMsuaA==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@huggingface/transformers": {
- "version": "3.8.1",
- "resolved": "https://registry.npmjs.org/@huggingface/transformers/-/transformers-3.8.1.tgz",
- "integrity": "sha512-tsTk4zVjImqdqjS8/AOZg2yNLd1z9S5v+7oUPpXaasDRwEDhB+xnglK1k5cad26lL5/ZIaeREgWWy0bs9y9pPA==",
- "license": "Apache-2.0",
- "dependencies": {
- "@huggingface/jinja": "^0.5.3",
- "onnxruntime-node": "1.21.0",
- "onnxruntime-web": "1.22.0-dev.20250409-89f8206ba4",
- "sharp": "^0.34.1"
- }
- },
"node_modules/@img/colour": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
@@ -718,18 +696,6 @@
"url": "https://opencollective.com/libvips"
}
},
- "node_modules/@isaacs/fs-minipass": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
- "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
- "license": "ISC",
- "dependencies": {
- "minipass": "^7.0.4"
- },
- "engines": {
- "node": ">=18.0.0"
- }
- },
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
@@ -868,63 +834,6 @@
"debug": "^4.3.1"
}
},
- "node_modules/@protobufjs/aspromise": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
- "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/base64": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
- "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/codegen": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz",
- "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/eventemitter": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz",
- "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/fetch": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz",
- "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==",
- "license": "BSD-3-Clause",
- "dependencies": {
- "@protobufjs/aspromise": "^1.1.1"
- }
- },
- "node_modules/@protobufjs/float": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
- "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/path": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
- "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/pool": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
- "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
- "license": "BSD-3-Clause"
- },
- "node_modules/@protobufjs/utf8": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.2.tgz",
- "integrity": "sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==",
- "license": "BSD-3-Clause"
- },
"node_modules/@rolldown/binding-android-arm-eabi": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.7.tgz",
@@ -1594,13 +1503,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/boolean": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
- "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
- "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
- "license": "MIT"
- },
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
@@ -1695,15 +1597,6 @@
"url": "https://paulmillr.com/funding/"
}
},
- "node_modules/chownr": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/cli-tableau": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/cli-tableau/-/cli-tableau-2.0.1.tgz",
@@ -1857,40 +1750,6 @@
}
}
},
- "node_modules/define-data-property": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
- "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
- "license": "MIT",
- "dependencies": {
- "es-define-property": "^1.0.0",
- "es-errors": "^1.3.0",
- "gopd": "^1.0.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/define-properties": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
- "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
- "license": "MIT",
- "dependencies": {
- "define-data-property": "^1.0.1",
- "has-property-descriptors": "^1.0.0",
- "object-keys": "^1.1.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
"node_modules/degenerator": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz",
@@ -1923,12 +1782,6 @@
"node": ">=8"
}
},
- "node_modules/detect-node": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
- "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
- "license": "MIT"
- },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
@@ -2090,30 +1943,12 @@
"node": ">= 0.4"
}
},
- "node_modules/es6-error": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
- "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
- "license": "MIT"
- },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
- "node_modules/escape-string-regexp": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
- "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
- "license": "MIT",
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/escodegen": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
@@ -2339,12 +2174,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/flatbuffers": {
- "version": "25.9.23",
- "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-25.9.23.tgz",
- "integrity": "sha512-MI1qs7Lo4Syw0EOzUl0xjs2lsoeqFku44KpngfIduHBYvzm8h2+7K8YMQh1JtVVVrUvhLpNwqVi4DERegUJhPQ==",
- "license": "Apache-2.0"
- },
"node_modules/follow-redirects": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
@@ -2518,39 +2347,6 @@
"node": ">= 6"
}
},
- "node_modules/global-agent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",
- "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",
- "license": "BSD-3-Clause",
- "dependencies": {
- "boolean": "^3.0.1",
- "es6-error": "^4.1.1",
- "matcher": "^3.0.0",
- "roarr": "^2.15.3",
- "semver": "^7.3.2",
- "serialize-error": "^7.0.1"
- },
- "engines": {
- "node": ">=10.0"
- }
- },
- "node_modules/globalthis": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
- "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",
- "license": "MIT",
- "dependencies": {
- "define-properties": "^1.2.1",
- "gopd": "^1.0.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
"node_modules/google-auth-library": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-11.0.2.tgz",
@@ -2645,12 +2441,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/guid-typescript": {
- "version": "1.0.9",
- "resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz",
- "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==",
- "license": "ISC"
- },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -2660,18 +2450,6 @@
"node": ">=8"
}
},
- "node_modules/has-property-descriptors": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
- "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
- "license": "MIT",
- "dependencies": {
- "es-define-property": "^1.0.0"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
@@ -2917,16 +2695,6 @@
"safe-buffer": "^5.0.1"
}
},
- "node_modules/kokoro-js": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.2.1.tgz",
- "integrity": "sha512-oq0HZJWis3t8lERkMJh84WLU86dpYD0EuBPtqYnLlQzyFP1OkyBRDcweAqCfhNOpltyN9j/azp1H6uuC47gShw==",
- "license": "Apache-2.0",
- "dependencies": {
- "@huggingface/transformers": "^3.5.1",
- "phonemizer": "^1.2.1"
- }
- },
"node_modules/lightningcss": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
@@ -3218,12 +2986,6 @@
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"license": "MIT"
},
- "node_modules/long": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
- "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
- "license": "Apache-2.0"
- },
"node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
@@ -3255,18 +3017,6 @@
"source-map-js": "^1.2.1"
}
},
- "node_modules/matcher": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
- "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",
- "license": "MIT",
- "dependencies": {
- "escape-string-regexp": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -3322,27 +3072,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/minipass": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
- "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=16 || 14 >=14.17"
- }
- },
- "node_modules/minizlib": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
- "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
- "license": "MIT",
- "dependencies": {
- "minipass": "^7.1.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -3489,15 +3218,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/object-keys": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
- "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- }
- },
"node_modules/obug": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz",
@@ -3533,49 +3253,6 @@
"wrappy": "1"
}
},
- "node_modules/onnxruntime-common": {
- "version": "1.21.0",
- "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.21.0.tgz",
- "integrity": "sha512-Q632iLLrtCAVOTO65dh2+mNbQir/QNTVBG3h/QdZBpns7mZ0RYbLRBgGABPbpU9351AgYy7SJf1WaeVwMrBFPQ==",
- "license": "MIT"
- },
- "node_modules/onnxruntime-node": {
- "version": "1.21.0",
- "resolved": "https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-1.21.0.tgz",
- "integrity": "sha512-NeaCX6WW2L8cRCSqy3bInlo5ojjQqu2fD3D+9W5qb5irwxhEyWKXeH2vZ8W9r6VxaMPUan+4/7NDwZMtouZxEw==",
- "hasInstallScript": true,
- "license": "MIT",
- "os": [
- "win32",
- "darwin",
- "linux"
- ],
- "dependencies": {
- "global-agent": "^3.0.0",
- "onnxruntime-common": "1.21.0",
- "tar": "^7.0.1"
- }
- },
- "node_modules/onnxruntime-web": {
- "version": "1.22.0-dev.20250409-89f8206ba4",
- "resolved": "https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.22.0-dev.20250409-89f8206ba4.tgz",
- "integrity": "sha512-0uS76OPgH0hWCPrFKlL8kYVV7ckM7t/36HfbgoFw6Nd0CZVVbQC4PkrR8mBX8LtNUFZO25IQBqV2Hx2ho3FlbQ==",
- "license": "MIT",
- "dependencies": {
- "flatbuffers": "^25.1.24",
- "guid-typescript": "^1.0.9",
- "long": "^5.2.3",
- "onnxruntime-common": "1.22.0-dev.20250409-89f8206ba4",
- "platform": "^1.3.6",
- "protobufjs": "^7.2.4"
- }
- },
- "node_modules/onnxruntime-web/node_modules/onnxruntime-common": {
- "version": "1.22.0-dev.20250409-89f8206ba4",
- "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.22.0-dev.20250409-89f8206ba4.tgz",
- "integrity": "sha512-vDJMkfCfb0b1A836rgHj+ORuZf4B4+cc2bASQtpeoJLueuFc5DuYwjIZUBrSvx/fO5IrLjLz+oTrB3pcGlhovQ==",
- "license": "MIT"
- },
"node_modules/pac-proxy-agent": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz",
@@ -3732,12 +3409,6 @@
"split2": "^4.1.0"
}
},
- "node_modules/phonemizer": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/phonemizer/-/phonemizer-1.2.1.tgz",
- "integrity": "sha512-v0KJ4mi2T4Q7eJQ0W15Xd4G9k4kICSXE8bpDeJ8jisL4RyJhNWsweKTOi88QXFc4r4LZlz5jVL5lCHhkpdT71A==",
- "license": "Apache-2.0"
- },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -3771,12 +3442,6 @@
"node": ">=18"
}
},
- "node_modules/platform": {
- "version": "1.3.6",
- "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",
- "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==",
- "license": "MIT"
- },
"node_modules/playwright-core": {
"version": "1.63.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz",
@@ -3970,29 +3635,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/protobufjs": {
- "version": "7.6.5",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.5.tgz",
- "integrity": "sha512-/FPD0nUc9jH6rfFjji9IBqOz4pcSE3CsT1m7Ep6Mdb0LxSUMj8hgl6GomOvZzpNpAqqGaXA0P3VSrZLFzIhQrw==",
- "hasInstallScript": true,
- "license": "BSD-3-Clause",
- "dependencies": {
- "@protobufjs/aspromise": "^1.1.2",
- "@protobufjs/base64": "^1.1.2",
- "@protobufjs/codegen": "^2.0.5",
- "@protobufjs/eventemitter": "^1.1.1",
- "@protobufjs/fetch": "^1.1.1",
- "@protobufjs/float": "^1.0.2",
- "@protobufjs/path": "^1.1.2",
- "@protobufjs/pool": "^1.1.0",
- "@protobufjs/utf8": "^1.1.1",
- "@types/node": ">=13.7.0",
- "long": "^5.3.2"
- },
- "engines": {
- "node": ">=12.0.0"
- }
- },
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
@@ -4084,23 +3726,6 @@
"url": "https://paulmillr.com/funding/"
}
},
- "node_modules/roarr": {
- "version": "2.15.4",
- "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
- "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
- "license": "BSD-3-Clause",
- "dependencies": {
- "boolean": "^3.0.1",
- "detect-node": "^2.0.4",
- "globalthis": "^1.0.1",
- "json-stringify-safe": "^5.0.1",
- "semver-compare": "^1.0.0",
- "sprintf-js": "^1.1.2"
- },
- "engines": {
- "node": ">=8.0"
- }
- },
"node_modules/rolldown": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.7.tgz",
@@ -4210,12 +3835,6 @@
"node": ">=10"
}
},
- "node_modules/semver-compare": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
- "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",
- "license": "MIT"
- },
"node_modules/send": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
@@ -4242,21 +3861,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/serialize-error": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",
- "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",
- "license": "MIT",
- "dependencies": {
- "type-fest": "^0.13.1"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/serve-static": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
@@ -4585,12 +4189,6 @@
"node": ">= 10.x"
}
},
- "node_modules/sprintf-js": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
- "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
- "license": "BSD-3-Clause"
- },
"node_modules/stackback": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
@@ -4626,31 +4224,6 @@
"node": ">=8"
}
},
- "node_modules/tar": {
- "version": "7.5.22",
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.22.tgz",
- "integrity": "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "@isaacs/fs-minipass": "^4.0.0",
- "chownr": "^3.0.0",
- "minipass": "^7.1.2",
- "minizlib": "^3.1.0",
- "yallist": "^5.0.0"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/tar/node_modules/yallist": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
- "license": "BlueOak-1.0.0",
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/tinybench": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.1.4.tgz",
@@ -4752,18 +4325,6 @@
"json-stringify-safe": "^5.0.1"
}
},
- "node_modules/type-fest": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
- "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
- "license": "(MIT OR CC0-1.0)",
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/type-is": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
diff --git a/server/package.json b/server/package.json
index f4925672dc..001db3f0a4 100644
--- a/server/package.json
+++ b/server/package.json
@@ -28,7 +28,6 @@
"chokidar": "5.0.0",
"express": "5.2.1",
"google-auth-library": "11.0.2",
- "kokoro-js": "1.2.1",
"node-pty": "1.2.0-beta.15",
"pg": "8.23.0",
"playwright-core": "1.63.0",
@@ -51,13 +50,10 @@
"follow-redirects": "1.16.0",
"body-parser": "2.3.0",
"js-yaml": "4.3.1",
- "tar": "7.5.22",
"engine.io": "6.6.9",
"qs": "6.16.0",
"sharp": "0.35.4",
"socket.io-parser": "4.2.7",
- "protobufjs": "7.6.5",
- "@protobufjs/utf8": "1.1.2",
"ws": "8.21.3",
"ip-address": "10.7.0",
"postcss": "8.5.27",
diff --git a/server/routes/publicApiIntegration.test.js b/server/routes/publicApiIntegration.test.js
index f6b937b66f..b9611bbca0 100644
--- a/server/routes/publicApiIntegration.test.js
+++ b/server/routes/publicApiIntegration.test.js
@@ -24,14 +24,7 @@ vi.mock('../lib/fileUtils.js', async () => {
});
// Mock only the TTS engine backends so synthesize()/listVoices() don't load
-// Kokoro/Piper. The dispatcher (tts.js), config, and routes are all real.
-vi.mock('../services/voice/tts-kokoro.js', () => ({
- synthesizeKokoro: vi.fn(async () => ({ wav: Buffer.from('RIFFkokoro'), latencyMs: 5 })),
- listKokoroVoices: vi.fn(async () => [{ name: 'af_heart' }]),
- readyState: vi.fn(() => 'lazy'),
- unloadKokoro: vi.fn(() => ({ unloaded: false })),
- loadedModelKey: vi.fn(() => null),
-}));
+// Piper. The dispatcher (tts.js), config, and routes are all real.
vi.mock('../services/voice/tts-piper.js', () => ({
synthesizePiper: vi.fn(async () => ({ wav: Buffer.from('RIFFpiper'), latencyMs: 7 })),
listPiperVoices: vi.fn(async () => [{ name: 'en_GB-jenny_dioco-medium' }]),
@@ -80,23 +73,22 @@ describe('public voice API — end-to-end through authGate', () => {
expect(res.headers['content-type']).toMatch(/audio\/wav/);
});
- it('400 UNKNOWN_VOICE for an unknown Kokoro voice override', async () => {
- // synthesize() validates Kokoro voices against the catalog (symmetric with
- // Piper) so a bogus id returns the documented 400 instead of erroring in
- // the model. tts.js + kokoro-voices.js are real here; only the backend is mocked.
+ it('400 UNKNOWN_VOICE for an unknown Piper voice override', async () => {
+ // The real dispatcher validates against the Piper catalog before synthesis;
+ // only the backend is mocked.
const app = await buildApp();
const res = await request(app)
.post('/api/voice/public/synthesize')
- .send({ text: 'hi', engine: 'kokoro', voice: 'not_a_real_voice' });
+ .send({ text: 'hi', engine: 'piper', voice: 'not_a_real_voice' });
expect(res.status).toBe(400);
expect(res.body.code).toBe('UNKNOWN_VOICE');
});
- it('accepts a valid Kokoro voice override', async () => {
+ it('accepts a valid Piper voice override', async () => {
const app = await buildApp();
const res = await request(app)
.post('/api/voice/public/synthesize')
- .send({ text: 'hi', engine: 'kokoro', voice: 'af_heart' });
+ .send({ text: 'hi', engine: 'piper', voice: 'en_GB-jenny_dioco-medium' });
expect(res.status).toBe(200);
});
diff --git a/server/routes/voice.js b/server/routes/voice.js
index f7b3429b06..c0fb527d60 100644
--- a/server/routes/voice.js
+++ b/server/routes/voice.js
@@ -32,7 +32,6 @@ import {
cancelFineTuningJob,
promoteCheckpoint,
} from '../services/voice/fineTuning.js';
-import { readyState as kokoroReadyState, unloadKokoro, loadedModelKey as kokoroLoadedKey } from '../services/voice/tts-kokoro.js';
import { findPiperVoice } from '../services/voice/piper-voices.js';
import { speakProactive, HHMM_RE, MAX_PROACTIVE_TEXT_LEN } from '../services/voice/proactiveSpeech.js';
@@ -68,7 +67,8 @@ const voiceConfigPatchSchema = z.object({
vocabularyPrompt: z.string().max(4000).optional(),
}).partial().optional(),
tts: z.object({
- engine: z.enum(TTS_ENGINE_IDS).optional(),
+ engine: z.enum([...TTS_ENGINE_IDS, 'kokoro']).optional(),
+ retiredEngine: z.literal('kokoro').optional(),
rate: z.number().min(0.25).max(4).optional(),
kokoro: z.object({
modelId: z.string().max(128).optional(),
@@ -283,9 +283,12 @@ router.post('/profiles/preset', asyncHandler(async (req, res) => {
const body = validateRequest(promotePresetProfileSchema, req.body || {});
const cfg = await getVoiceConfig();
const preset = parsePresetVoiceId(body.voiceId);
- const modelRevision = preset?.engine === 'kokoro'
- ? `${cfg.tts.kokoro?.modelId || 'configured'}:${cfg.tts.kokoro?.dtype || 'configured'}`
- : (preset?.engine === 'qwen3-tts' ? DEFAULT_DESIGN_MODEL : `piper:${preset?.voice || ''}`);
+ if (preset?.engine === 'kokoro') {
+ throw new ServerError('Kokoro has been retired. Select a Piper preset to create a voice profile.', {
+ status: 409, code: 'VOICE_ENGINE_RETIRED',
+ });
+ }
+ const modelRevision = preset?.engine === 'qwen3-tts' ? DEFAULT_DESIGN_MODEL : `piper:${preset?.voice || ''}`;
const profile = await promotePresetProfile({
...body,
modelRevision,
@@ -438,15 +441,16 @@ router.post('/speak', asyncHandler(async (req, res) => {
router.get('/tts/status', asyncHandler(async (_req, res) => {
res.json({
kokoro: {
- state: kokoroReadyState(),
- loadedKey: kokoroLoadedKey(),
+ state: 'lazy',
+ retired: true,
+ loadedKey: null,
},
});
}));
// POST /api/voice/tts/unload
router.post('/tts/unload', asyncHandler(async (_req, res) => {
- res.json(unloadKokoro());
+ res.json({ unloaded: false, retired: true });
}));
const whisperActionSchema = z.object({
diff --git a/server/routes/voice.test.js b/server/routes/voice.test.js
index 75cf6e60b7..3c740ec428 100644
--- a/server/routes/voice.test.js
+++ b/server/routes/voice.test.js
@@ -52,13 +52,6 @@ vi.mock('../services/voice/fineTuning.js', () => ({
cancelFineTuningJob: vi.fn(),
promoteCheckpoint: vi.fn(),
}));
-// GET /api/voice/tts/status + POST /api/voice/tts/unload destructure these at
-// module load — mock them so the route resolves without spinning up Kokoro.
-vi.mock('../services/voice/tts-kokoro.js', () => ({
- readyState: vi.fn(() => 'lazy'),
- unloadKokoro: vi.fn(() => ({ unloaded: false })),
- loadedModelKey: vi.fn(() => null),
-}));
vi.mock('../services/voice/piper-voices.js', () => ({
findPiperVoice: vi.fn(),
}));
@@ -87,7 +80,6 @@ import * as fineTuning from '../services/voice/fineTuning.js';
import { ServerError } from '../lib/errorHandler.js';
import * as piperVoices from '../services/voice/piper-voices.js';
import * as proactiveSpeech from '../services/voice/proactiveSpeech.js';
-import * as kokoro from '../services/voice/tts-kokoro.js';
import * as facetimeBridge from '../services/voice/facetimeBridge.js';
import voiceRoutes from './voice.js';
import { errorEvents } from '../lib/errorHandler.js';
@@ -140,11 +132,11 @@ describe('Voice Routes', () => {
it('promotes a preset with the current local model and delivery provenance', async () => {
voiceProfiles.promotePresetProfile.mockResolvedValue({ id: 'voice-profile-1' });
const res = await request(buildApp()).post('/api/voice/profiles/preset').send({
- universeId: 'uni-1', characterId: 'char-1', voiceId: 'kokoro:af_heart',
+ universeId: 'uni-1', characterId: 'char-1', voiceId: 'piper:en_US-lessac-medium',
});
expect(res.status).toBe(201);
expect(voiceProfiles.promotePresetProfile).toHaveBeenCalledWith(expect.objectContaining({
- modelRevision: 'kokoro-test:q8', delivery: { rate: 1 },
+ modelRevision: 'piper:en_US-lessac-medium', delivery: { rate: 1 },
}));
expect(res.body).toEqual({ profile: { id: 'voice-profile-1' } });
});
@@ -553,22 +545,18 @@ describe('Voice Routes', () => {
});
describe('GET /api/voice/tts/status', () => {
- it('returns the Kokoro residency snapshot', async () => {
- kokoro.readyState.mockReturnValue('loaded');
- kokoro.loadedModelKey.mockReturnValue('kokoro-v1:af_heart');
+ it('returns an inert compatibility snapshot for retired Kokoro', async () => {
const res = await request(buildApp()).get('/api/voice/tts/status');
expect(res.status).toBe(200);
- expect(res.body).toEqual({ kokoro: { state: 'loaded', loadedKey: 'kokoro-v1:af_heart' } });
+ expect(res.body).toEqual({ kokoro: { state: 'lazy', loadedKey: null, retired: true } });
});
});
describe('POST /api/voice/tts/unload', () => {
- it('drops the cached Kokoro instance and echoes its result', async () => {
- kokoro.unloadKokoro.mockReturnValue({ unloaded: true });
+ it('keeps unload safe for cached clients', async () => {
const res = await request(buildApp()).post('/api/voice/tts/unload');
expect(res.status).toBe(200);
- expect(res.body).toEqual({ unloaded: true });
- expect(kokoro.unloadKokoro).toHaveBeenCalledTimes(1);
+ expect(res.body).toEqual({ unloaded: false, retired: true });
});
});
diff --git a/server/routes/voicePublic.test.js b/server/routes/voicePublic.test.js
index 23bf1801a7..9ea5ea3a71 100644
--- a/server/routes/voicePublic.test.js
+++ b/server/routes/voicePublic.test.js
@@ -29,18 +29,18 @@ describe('Public Voice API (/api/voice/public)', () => {
beforeEach(() => {
vi.clearAllMocks();
config.getVoiceConfig.mockResolvedValue({
- tts: { engine: 'kokoro', kokoro: { voice: 'af_heart' }, piper: { voice: 'en_GB-jenny_dioco-medium' } },
+ tts: { engine: 'piper', kokoro: { voice: 'af_heart' }, piper: { voice: 'en_GB-jenny_dioco-medium' } },
});
});
describe('POST /synthesize', () => {
it('synthesizes text and returns audio/wav with headers', async () => {
- tts.synthesize.mockResolvedValue({ wav: Buffer.from('RIFFfake'), latencyMs: 42, engine: 'kokoro' });
+ tts.synthesize.mockResolvedValue({ wav: Buffer.from('RIFFfake'), latencyMs: 42, engine: 'piper' });
const res = await request(buildApp()).post('/api/voice/public/synthesize').send({ text: 'hello' });
expect(res.status).toBe(200);
expect(res.headers['content-type']).toMatch(/audio\/wav/);
expect(res.headers['x-tts-latency-ms']).toBe('42');
- expect(res.headers['x-tts-engine']).toBe('kokoro');
+ expect(res.headers['x-tts-engine']).toBe('piper');
expect(tts.synthesize).toHaveBeenCalledWith('hello', expect.objectContaining({ engine: undefined }));
});
@@ -82,15 +82,15 @@ describe('Public Voice API (/api/voice/public)', () => {
describe('GET /voices', () => {
it('delegates to listVoices with the requested engine', async () => {
- tts.listVoices.mockResolvedValue({ engine: 'kokoro', voices: [{ id: 'af_heart' }] });
- const res = await request(buildApp()).get('/api/voice/public/voices?engine=kokoro');
+ tts.listVoices.mockResolvedValue({ engine: 'piper', voices: [{ id: 'af_heart' }] });
+ const res = await request(buildApp()).get('/api/voice/public/voices?engine=piper');
expect(res.status).toBe(200);
- expect(res.body.engine).toBe('kokoro');
- expect(tts.listVoices).toHaveBeenCalledWith('kokoro');
+ expect(res.body.engine).toBe('piper');
+ expect(tts.listVoices).toHaveBeenCalledWith('piper');
});
it('ignores an unknown engine query value', async () => {
- tts.listVoices.mockResolvedValue({ engine: 'kokoro', voices: [] });
+ tts.listVoices.mockResolvedValue({ engine: 'piper', voices: [] });
await request(buildApp()).get('/api/voice/public/voices?engine=bogus');
expect(tts.listVoices).toHaveBeenCalledWith(undefined);
});
@@ -108,8 +108,7 @@ describe('Public Voice API (/api/voice/public)', () => {
expect(res.body.engines).toEqual([...tts.VALID_ENGINES]);
expect(Object.keys(res.body.defaults)).toEqual([...tts.VALID_ENGINES]);
expect(res.body.defaults['qwen3-tts']).toBeNull();
- expect(res.body.active).toBe('kokoro');
- expect(res.body.defaults.kokoro).toBe('af_heart');
+ expect(res.body.active).toBe('piper');
expect(res.body.defaults.piper).toBe('en_GB-jenny_dioco-medium');
});
});
diff --git a/server/services/bootstrap.js b/server/services/bootstrap.js
index fe5851a02d..95e7b9f93a 100644
--- a/server/services/bootstrap.js
+++ b/server/services/bootstrap.js
@@ -548,7 +548,7 @@ const startBackgroundServices = ({ spawnerReady, io }) => {
}
}).catch(err => logBootstrapFailure('❌ Telegram settings read failed', err));
// Reconcile voice stack (start portos-whisper if voice.enabled)
- getVoiceConfig().then(reconcileVoice).catch(err => logBootstrapFailure('❌ Voice reconcile failed', err));
+ getVoiceConfig().then(cfg => reconcileVoice(cfg, { allowSetup: false })).catch(err => logBootstrapFailure('❌ Voice reconcile failed', err));
// Re-arm any voice timers that survived a restart (independent of voice.enabled —
// a pending reminder should still fire even if voice is currently off).
initVoiceTimers().catch(err => logBootstrapFailure('❌ Voice timer init failed', err));
diff --git a/server/services/pipeline/audio.js b/server/services/pipeline/audio.js
index 950fb85b0e..25dc544078 100644
--- a/server/services/pipeline/audio.js
+++ b/server/services/pipeline/audio.js
@@ -39,7 +39,7 @@ export function parseVoiceId(voiceId) {
const m = trimmed.match(VOICE_ID_RE);
if (!m) return { engine: null, voice: trimmed };
const engine = normalizeVoiceEngine(m[1].toLowerCase());
- if (!VALID_ENGINES.has(engine)) return { engine: null, voice: trimmed };
+ if (engine !== 'kokoro' && !VALID_ENGINES.has(engine)) return { engine: null, voice: trimmed };
return { engine, voice: m[2] };
}
diff --git a/server/services/voice/bootstrap.js b/server/services/voice/bootstrap.js
index 2cc2b98ceb..eae8019339 100644
--- a/server/services/voice/bootstrap.js
+++ b/server/services/voice/bootstrap.js
@@ -42,8 +42,8 @@ export const verifyModels = (cfg) => {
const voicePath = expandPath(cfg.tts.piper.voicePath);
out.ttsVoice = existsSync(voicePath) ? voicePath : null;
} else {
- // Kokoro models are managed by transformers.js cache — assume present.
- out.ttsVoice = `kokoro:${cfg.tts.kokoro?.modelId}`;
+ // Qwen3 runtime owns its model readiness.
+ out.ttsVoice = null;
}
if (cfg.stt.coreml) {
@@ -64,7 +64,7 @@ export const runSetupScript = async (cfg) => {
MODEL_NAME: modelName,
VOICE_NAME: voiceName,
STT_ENGINE: sttEngine,
- TTS_ENGINE: cfg.tts.engine || 'kokoro',
+ TTS_ENGINE: cfg.tts.engine || 'piper',
INSTALL_COREML: cfg.stt.coreml ? '1' : '0',
};
console.log(`🔧 voice: setup-voice (stt=${sttEngine}/${modelName}, tts=${cfg.tts.engine}, coreml=${env.INSTALL_COREML})`);
@@ -399,8 +399,17 @@ export const preloadModel = async (cfg) => {
* Reconcile PM2 state with desired voice.enabled. Called from
* PUT /api/voice/config and at server boot.
*/
-export const reconcile = async (cfg) => {
+export const reconcile = async (cfg, { allowSetup = true } = {}) => {
if (!cfg.enabled) return stopWhisper();
+ // A retired-engine upgrade must wait for the user's Save & Reconcile action.
+ // Do not turn a normal restart into a new binary/model download.
+ if (!allowSetup && cfg.tts?.retiredEngine === 'kokoro') {
+ const bins = await verifyBinaries(cfg);
+ const models = verifyModels(cfg);
+ if (bins.piperRequired && (!bins.piper || !models.ttsVoice)) {
+ return { setupRequired: 'piper' };
+ }
+ }
// Don't block reconcile on this — it can take minutes on first install.
// The user will see a clear log line and their first turn may fail with the
diff --git a/server/services/voice/bootstrap.retirement.test.js b/server/services/voice/bootstrap.retirement.test.js
new file mode 100644
index 0000000000..8bb6fef383
--- /dev/null
+++ b/server/services/voice/bootstrap.retirement.test.js
@@ -0,0 +1,21 @@
+import { expect, it, vi } from 'vitest';
+
+vi.mock('fs', () => ({ existsSync: vi.fn(() => false) }));
+vi.mock('../../lib/processEnv.js', () => ({ whichFirst: vi.fn(async () => null) }));
+vi.mock('../pm2.js', () => ({ execPm2: vi.fn(), getAppStatus: vi.fn() }));
+vi.mock('./llm.js', () => ({ isToolCapable: vi.fn(), isReasoningModel: vi.fn() }));
+vi.mock('../providers.js', () => ({ getProviderById: vi.fn() }));
+vi.mock('../../lib/childProcess.js', () => ({ execFile: vi.fn() }));
+vi.mock('../settings.js', () => ({ getSettings: vi.fn(), updateSettings: vi.fn() }));
+
+import { execFile } from '../../lib/childProcess.js';
+import { getProviderById } from '../providers.js';
+import { VOICE_DEFAULTS } from './config.js';
+import { reconcile } from './bootstrap.js';
+
+it('does not download or preload anything when an upgraded install boots before Piper setup', async () => {
+ const cfg = { ...VOICE_DEFAULTS, enabled: true, tts: { ...VOICE_DEFAULTS.tts, retiredEngine: 'kokoro' } };
+ await expect(reconcile(cfg, { allowSetup: false })).resolves.toEqual({ setupRequired: 'piper' });
+ expect(execFile).not.toHaveBeenCalled();
+ expect(getProviderById).not.toHaveBeenCalled();
+});
diff --git a/server/services/voice/config.js b/server/services/voice/config.js
index 7186f196b1..eb77fae3dd 100644
--- a/server/services/voice/config.js
+++ b/server/services/voice/config.js
@@ -7,6 +7,7 @@ import { join } from 'path';
import { getSettings, updateSettings } from '../settings.js';
import { deepMerge } from '../../lib/objects.js';
import { expandHome } from '../../lib/fileUtils.js';
+import { migrateRetiredTtsConfig } from '../../lib/voiceEngines.js';
import { PORTS } from '../../lib/ports.js';
const VOICE_HOME = join(homedir(), '.portos', 'voice');
@@ -62,13 +63,8 @@ export const VOICE_DEFAULTS = Object.freeze({
},
tts: {
- engine: 'kokoro', // 'kokoro' | 'piper' | 'qwen3-tts'
+ engine: 'piper', // 'piper' | 'qwen3-tts'
rate: 1.0,
- kokoro: {
- modelId: 'onnx-community/Kokoro-82M-v1.0-ONNX',
- dtype: 'q8', // 'fp32' | 'fp16' | 'q8' | 'q4' | 'q4f16'
- voice: 'af_heart',
- },
piper: {
voice: 'en_GB-jenny_dioco-medium',
voicePath: '~/.portos/voice/voices/en_GB-jenny_dioco-medium.onnx',
@@ -175,6 +171,7 @@ export const getVoiceConfig = async () => {
if (cachedConfig) return cachedConfig;
const settings = await getSettings();
cachedConfig = deepMerge(VOICE_DEFAULTS, settings.voice || {});
+ cachedConfig.tts = migrateRetiredTtsConfig(cachedConfig.tts);
return cachedConfig;
};
@@ -184,6 +181,7 @@ export const updateVoiceConfig = async (patch) => {
const settings = await getSettings();
const current = deepMerge(VOICE_DEFAULTS, settings.voice || {});
const next = deepMerge(current, patch || {});
+ next.tts = migrateRetiredTtsConfig(next.tts);
await updateSettings({ voice: next });
cachedConfig = next;
return next;
diff --git a/server/services/voice/config.test.js b/server/services/voice/config.test.js
index 56f59f3ea2..e9833121e6 100644
--- a/server/services/voice/config.test.js
+++ b/server/services/voice/config.test.js
@@ -1,5 +1,22 @@
-import { describe, expect, it } from 'vitest';
-import { VOICE_DEFAULTS } from './config.js';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+vi.mock('../settings.js', () => ({ getSettings: vi.fn(), updateSettings: vi.fn() }));
+import { getSettings, updateSettings } from '../settings.js';
+import { VOICE_DEFAULTS, getVoiceConfig, updateVoiceConfig, invalidateVoiceConfigCache } from './config.js';
+
+beforeEach(() => { vi.clearAllMocks(); invalidateVoiceConfigCache(); });
+
+it('upgrades restored legacy config on reads and old-client saves without losing settings', async () => {
+ const legacy = { enabled: true, tts: { engine: 'kokoro', rate: 1.3, kokoro: { voice: 'af_heart' } } };
+ getSettings.mockResolvedValue({ voice: legacy });
+ const cfg = await getVoiceConfig();
+ expect(cfg.tts).toMatchObject({ engine: 'piper', retiredEngine: 'kokoro', rate: 1.3, piper: VOICE_DEFAULTS.tts.piper });
+ expect(cfg.enabled).toBe(true);
+ expect(updateSettings).not.toHaveBeenCalled();
+ const saved = await updateVoiceConfig({ tts: { engine: 'kokoro' } });
+ expect(saved.tts.engine).toBe('piper');
+ expect(updateSettings).toHaveBeenCalledWith({ voice: saved });
+});
+
describe('voice configuration defaults', () => {
it('provides a usable Qwen3-TTS voice and model when the engine is selected', () => {
diff --git a/server/services/voice/health.js b/server/services/voice/health.js
index 151e96effd..9c92bce0d8 100644
--- a/server/services/voice/health.js
+++ b/server/services/voice/health.js
@@ -1,10 +1,8 @@
// Voice stack health checks — whisper.cpp + LLM provider + (when active) Piper.
-// Kokoro runs in-process; readiness is reported via the in-memory model flag.
import { existsSync } from 'fs';
import { join } from 'path';
import { getVoiceConfig, expandPath, voiceHome, PIPER_BIN_NAME } from './config.js';
-import { readyState as kokoroReadyState } from './tts-kokoro.js';
import { which } from './bootstrap.js';
import { resolveLlmEndpoint, authHeaders } from './llm.js';
import { fetchWithTimeout } from '../../lib/fetchWithTimeout.js';
@@ -38,12 +36,6 @@ export const checkAll = async (cfg) => {
// Settings re-probes the new endpoint instead of serving the stale badge.
const cacheKey = `${sttEngine}|${voice.tts.engine}|${voice.stt.endpoint}|${llmProvider}`;
if (cache && cache.key === cacheKey && Date.now() - cache.ts < CACHE_TTL_MS) {
- // Refresh kokoro readiness on every call — it's a cheap in-memory check
- // and flips from lazy → loading → loaded mid-cache-window after first synthesis.
- if (voice.tts.engine === 'kokoro') {
- const state = kokoroReadyState();
- cache.value.kokoro = { ok: state === 'loaded', state };
- }
return cache.value;
}
@@ -74,10 +66,6 @@ export const checkAll = async (cfg) => {
if (sttEngine === 'web-speech') {
out['web-speech'] = { ok: true, state: 'browser-native' };
}
- if (voice.tts.engine === 'kokoro') {
- const state = kokoroReadyState();
- out.kokoro = { ok: state === 'loaded', state };
- }
out.facetime = await checkFaceTimeSetup(voice);
cache = { key: cacheKey, ts: Date.now(), value: out };
diff --git a/server/services/voice/health.test.js b/server/services/voice/health.test.js
index ce7e29bbf1..5927415d5e 100644
--- a/server/services/voice/health.test.js
+++ b/server/services/voice/health.test.js
@@ -21,7 +21,6 @@ vi.mock('./config.js', () => ({
voiceHome: mocks.voiceHome,
PIPER_BIN_NAME: 'piper.exe',
}));
-vi.mock('./tts-kokoro.js', () => ({ readyState: mocks.readyState }));
vi.mock('./bootstrap.js', () => ({ which: mocks.which }));
vi.mock('./llm.js', () => ({ resolveLlmEndpoint: mocks.resolveLlmEndpoint, authHeaders: mocks.authHeaders }));
vi.mock('../../lib/fetchWithTimeout.js', () => ({ fetchWithTimeout: mocks.fetchWithTimeout }));
diff --git a/server/services/voice/kokoro-voices.js b/server/services/voice/kokoro-voices.js
deleted file mode 100644
index 6589e8a42f..0000000000
--- a/server/services/voice/kokoro-voices.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// Static Kokoro voice catalogue — mirrors the frozen `$` table inside
-// kokoro-js's bundled dist (kokoro-js@^1.2.x), which the package does not
-// export at the top level. We use this for `listVoices()` so the UI can
-// populate a picker without paying the 80MB model load.
-// Refresh from node_modules/kokoro-js/dist/kokoro.js when bumping the dep.
-
-export const KOKORO_VOICES = Object.freeze({
- af_heart: { gender: 'Female', language: 'en-US', traits: '❤️', grade: 'A' },
- af_alloy: { gender: 'Female', language: 'en-US', grade: 'C' },
- af_aoede: { gender: 'Female', language: 'en-US', grade: 'C+' },
- af_bella: { gender: 'Female', language: 'en-US', traits: '🔥', grade: 'A-' },
- af_jessica: { gender: 'Female', language: 'en-US', grade: 'D' },
- af_kore: { gender: 'Female', language: 'en-US', grade: 'C+' },
- af_nicole: { gender: 'Female', language: 'en-US', traits: '🎧', grade: 'B-' },
- af_nova: { gender: 'Female', language: 'en-US', grade: 'C' },
- af_river: { gender: 'Female', language: 'en-US', grade: 'D' },
- af_sarah: { gender: 'Female', language: 'en-US', grade: 'C+' },
- af_sky: { gender: 'Female', language: 'en-US', grade: 'C-' },
- am_adam: { gender: 'Male', language: 'en-US', grade: 'F+' },
- am_echo: { gender: 'Male', language: 'en-US', grade: 'D' },
- am_eric: { gender: 'Male', language: 'en-US', grade: 'D' },
- am_fenrir: { gender: 'Male', language: 'en-US', grade: 'C+' },
- am_liam: { gender: 'Male', language: 'en-US', grade: 'D' },
- am_michael: { gender: 'Male', language: 'en-US', grade: 'C+' },
- am_onyx: { gender: 'Male', language: 'en-US', grade: 'D' },
- am_puck: { gender: 'Male', language: 'en-US', grade: 'C+' },
- am_santa: { gender: 'Male', language: 'en-US', grade: 'D-' },
- bf_alice: { gender: 'Female', language: 'en-GB', grade: 'D' },
- bf_emma: { gender: 'Female', language: 'en-GB', grade: 'B-' },
- bf_isabella: { gender: 'Female', language: 'en-GB', grade: 'C' },
- bf_lily: { gender: 'Female', language: 'en-GB', grade: 'D' },
- bm_daniel: { gender: 'Male', language: 'en-GB', grade: 'D' },
- bm_fable: { gender: 'Male', language: 'en-GB', grade: 'C' },
- bm_george: { gender: 'Male', language: 'en-GB', grade: 'C' },
- bm_lewis: { gender: 'Male', language: 'en-GB', grade: 'D+' },
-});
-
-// True iff `id` is a known Kokoro voice. Mirrors `findPiperVoice` so the TTS
-// façade can reject an unknown Kokoro voice override (otherwise an invalid
-// `voice` would pass straight to the model and either error or synthesize the
-// wrong voice). `Object.hasOwn` avoids matching inherited props like `toString`.
-export const isKokoroVoice = (id) =>
- typeof id === 'string' && Object.hasOwn(KOKORO_VOICES, id);
diff --git a/server/services/voice/tts-kokoro.js b/server/services/voice/tts-kokoro.js
deleted file mode 100644
index 4395406eb5..0000000000
--- a/server/services/voice/tts-kokoro.js
+++ /dev/null
@@ -1,96 +0,0 @@
-// Kokoro TTS backend — in-process ONNX inference via kokoro-js + transformers.js.
-// Model loads lazily on first synthesis (~2–3s) and stays resident.
-
-import { KOKORO_VOICES } from './kokoro-voices.js';
-
-let modelPromise = null;
-let loadedKey = null;
-// `loaded` only flips once from_pretrained() resolves, so health reporting
-// can distinguish "loading" (2-3s cold start in progress) from "loaded".
-let loaded = false;
-
-const ensureModel = async ({ modelId, dtype }) => {
- const key = `${modelId}|${dtype}`;
- if (modelPromise && loadedKey === key) return modelPromise;
- loadedKey = key;
- loaded = false;
- let KokoroTTS;
- try {
- ({ KokoroTTS } = await import('kokoro-js'));
- } catch (err) {
- loadedKey = null;
- throw err;
- }
- console.log(`🗣 kokoro: loading ${modelId} (dtype=${dtype})`);
- const started = Date.now();
- // Capture the in-flight promise so the then/catch handlers only mutate
- // shared state when they're still the active load. Without this, a second
- // load (different modelId/dtype) could race the first to completion and
- // corrupt `loaded`/`modelPromise`.
- const current = KokoroTTS.from_pretrained(modelId, { dtype, device: 'cpu' })
- .then((tts) => {
- if (modelPromise === current && loadedKey === key) {
- loaded = true;
- console.log(`🗣 kokoro: ready in ${Date.now() - started}ms`);
- }
- return tts;
- })
- .catch((err) => {
- if (modelPromise === current && loadedKey === key) {
- modelPromise = null;
- loadedKey = null;
- loaded = false;
- }
- throw err;
- });
- modelPromise = current;
- return modelPromise;
-};
-
-/**
- * @param {string} text
- * @param {object} cfg — full voice.tts config
- * @param {AbortSignal} [signal]
- * @returns {Promise<{ wav: Buffer, latencyMs: number }>}
- */
-export const synthesizeKokoro = async (text, cfg, signal) => {
- if (signal?.aborted) throw new Error('aborted');
- const { modelId, dtype, voice } = cfg.kokoro;
- const tts = await ensureModel({ modelId, dtype });
- if (signal?.aborted) throw new Error('aborted');
-
- const started = Date.now();
- const speed = Math.max(0.5, Math.min(2.0, cfg.rate ?? 1.0));
- const audio = await tts.generate(text, { voice, speed });
- if (signal?.aborted) throw new Error('aborted');
-
- return { wav: Buffer.from(audio.toWav()), latencyMs: Date.now() - started };
-};
-
-export const listKokoroVoices = async () =>
- Object.entries(KOKORO_VOICES)
- .map(([name, meta]) => ({ name, ...meta }))
- .sort((a, b) => a.name.localeCompare(b.name));
-
-// 'lazy' = never touched; 'loading' = from_pretrained in flight; 'loaded' = usable.
-export const readyState = () => {
- if (!modelPromise) return 'lazy';
- return loaded ? 'loaded' : 'loading';
-};
-export const isReady = () => loaded;
-export const loadedModelKey = () => loadedKey;
-
-// Drop the cached TTS instance so its ONNX weights can be GC'd. Next
-// synthesizeKokoro() call will pay the ~2–3s cold-start tax. Idempotent —
-// safe to call when nothing is loaded.
-//
-// Surface the post-unload state so the API caller can tell the difference
-// between "was loaded, now released" and "wasn't loaded to begin with".
-export const unloadKokoro = () => {
- const wasLoaded = modelPromise !== null;
- modelPromise = null;
- loadedKey = null;
- loaded = false;
- if (wasLoaded) console.log('🧹 kokoro: unloaded (next synthesis will reload)');
- return { unloaded: wasLoaded };
-};
diff --git a/server/services/voice/tts-piper.js b/server/services/voice/tts-piper.js
index 098c09b9e2..ee6775a1db 100644
--- a/server/services/voice/tts-piper.js
+++ b/server/services/voice/tts-piper.js
@@ -19,7 +19,7 @@ export const synthesizePiper = (text, cfg, signal) => {
const voiceId = cfg.piper.voice;
const voicePath = expandPath(cfg.piper.voicePath || voicePathFor(voiceId));
if (!existsSync(voicePath)) {
- return Promise.reject(new Error(`piper voice missing: ${voicePath}`));
+ return Promise.reject(new Error(`Piper voice missing. Open Settings → Voice and use Save & Reconcile to install Piper and the selected voice.`));
}
const rate = Math.max(0.25, Math.min(4, cfg.rate ?? 1.0));
diff --git a/server/services/voice/tts.js b/server/services/voice/tts.js
index 0d97ad7ec1..55af7ffa78 100644
--- a/server/services/voice/tts.js
+++ b/server/services/voice/tts.js
@@ -1,12 +1,10 @@
-// TTS façade — dispatches on cfg.tts.engine ('kokoro' default | 'piper' | 'qwen3-tts').
+// TTS façade — dispatches on cfg.tts.engine ('piper' default | 'qwen3-tts').
import { join } from 'node:path';
import { getVoiceConfig, piperVoiceTildePath } from './config.js';
-import { synthesizeKokoro, listKokoroVoices } from './tts-kokoro.js';
import { synthesizePiper, listPiperVoices } from './tts-piper.js';
import { synthesizeQwen3, listQwen3Voices } from './tts-qwen3.js';
import { findPiperVoice } from './piper-voices.js';
-import { isKokoroVoice } from './kokoro-voices.js';
import { getProfileForSynthesis, profileArtifactDirectory } from './profiles.js';
import { whichFirst } from '../../lib/processEnv.js';
import { ServerError } from '../../lib/errorHandler.js';
@@ -44,16 +42,16 @@ export const listVoiceEngines = async () => {
};
// Normalize `engine` against the allowlist so an invalid value can't silently
-// produce Kokoro audio while the response reports `engine: 'elevenlabs'`.
+// produce Piper audio while the response reports `engine: 'elevenlabs'`.
const resolveEngine = (engine) => {
const norm = normalizeVoiceEngine(engine);
- return VALID_ENGINES.has(norm) ? norm : 'kokoro';
+ return VALID_ENGINES.has(norm) ? norm : 'piper';
};
const backend = (engine) => {
if (engine === 'piper') return { synth: synthesizePiper, list: listPiperVoices };
if (engine === 'qwen3-tts') return { synth: synthesizeQwen3, list: listQwen3Voices };
- return { synth: synthesizeKokoro, list: listKokoroVoices };
+ return { synth: synthesizePiper, list: listPiperVoices };
};
/**
@@ -62,7 +60,7 @@ const backend = (engine) => {
* @param {object} [opts]
* @param {AbortSignal} [opts.signal]
* @param {string} [opts.voice] transient voice override
- * @param {string} [opts.engine] transient engine override ('kokoro'|'piper'|'qwen3-tts')
+ * @param {string} [opts.engine] transient engine override ('piper'|'qwen3-tts')
* @param {number} [opts.rate] transient speech-rate override (0.25–4)
* @param {string} [opts.profileId] profile ID to synthesize against
* @param {string} [opts.route] 'studio' | 'interactive'
@@ -73,6 +71,11 @@ export const synthesize = async (text, opts = {}) => {
const profile = opts.profileId
? await getProfileForSynthesis(opts.profileId, opts.route || 'studio')
: null;
+ if (opts.engine === 'kokoro' || profile?.engine === 'kokoro') {
+ throw new ServerError('Kokoro has been retired. Open Settings → Voice, set up Piper, and select a new voice or promote a Piper profile.', {
+ status: 409, code: 'VOICE_ENGINE_RETIRED',
+ });
+ }
const profileVoice = profile?.voiceId?.split(':')[1] || null;
const engine = profile ? profile.engine : resolveEngine(opts.engine || cfg.tts.engine);
const { synth } = backend(engine);
@@ -117,15 +120,7 @@ export const synthesize = async (text, opts = {}) => {
const voice = profileVoice || opts.voice;
if (voice) {
- if (engine === 'kokoro') {
- if (!isKokoroVoice(voice)) {
- throw new ServerError(`unknown kokoro voice: ${voice}`, {
- status: 400,
- code: 'UNKNOWN_VOICE',
- });
- }
- ttsCfg = { ...ttsCfg, kokoro: { ...ttsCfg.kokoro, voice } };
- } else if (engine === 'piper') {
+ if (engine === 'piper') {
const catalog = findPiperVoice(voice);
if (!catalog) {
throw new ServerError(`unknown piper voice: ${voice}`, {
@@ -149,9 +144,7 @@ export const synthesize = async (text, opts = {}) => {
? await synth(text, synthOpts, opts.signal)
: await synth(text, ttsCfg, opts.signal);
- const modelRevision = engine === 'kokoro'
- ? `${ttsCfg.kokoro?.modelId || 'kokoro-v0_19'}:${ttsCfg.kokoro?.dtype || 'fp32'}`
- : (engine === 'piper' ? `piper:${ttsCfg.piper?.voice || 'default'}` : (profile?.modelRevision || result.modelRevision));
+ const modelRevision = engine === 'piper' ? `piper:${ttsCfg.piper?.voice || 'default'}` : (profile?.modelRevision || result.modelRevision);
return {
...result,
@@ -173,7 +166,7 @@ export const synthesize = async (text, opts = {}) => {
/**
* Enumerate voices available for the given engine (or the configured one).
- * @param {string} [engineOverride] 'kokoro' | 'piper' | 'qwen3-tts'
+ * @param {string} [engineOverride] 'piper' | 'qwen3-tts'
* @returns {Promise<{ engine: string, voices: Array }>}
*/
export const listVoices = async (engineOverride) => {
diff --git a/server/services/voice/tts.test.js b/server/services/voice/tts.test.js
index 2f687a7460..4afbda05d4 100644
--- a/server/services/voice/tts.test.js
+++ b/server/services/voice/tts.test.js
@@ -4,26 +4,24 @@ vi.mock('./config.js', () => ({
getVoiceConfig: vi.fn(),
piperVoiceTildePath: vi.fn((voice) => `~/.portos/voice/voices/${voice}.onnx`),
}));
-vi.mock('./tts-kokoro.js', () => ({ synthesizeKokoro: vi.fn(), listKokoroVoices: vi.fn() }));
vi.mock('./tts-piper.js', () => ({ synthesizePiper: vi.fn(), listPiperVoices: vi.fn() }));
vi.mock('./tts-qwen3.js', () => ({ synthesizeQwen3: vi.fn(), listQwen3Voices: vi.fn() }));
vi.mock('./piper-voices.js', () => ({ findPiperVoice: vi.fn() }));
-vi.mock('./kokoro-voices.js', () => ({ isKokoroVoice: vi.fn(() => true) }));
vi.mock('./profiles.js', () => ({ getProfileForSynthesis: vi.fn() }));
vi.mock('./bootstrap.js', () => ({ which: vi.fn() }));
vi.mock('../../lib/processEnv.js', () => ({ whichFirst: vi.fn().mockResolvedValue(null) }));
import { getVoiceConfig } from './config.js';
-import { synthesizeKokoro } from './tts-kokoro.js';
+import { synthesizePiper } from './tts-piper.js';
+import { findPiperVoice } from './piper-voices.js';
import { synthesizeQwen3 } from './tts-qwen3.js';
import { getProfileForSynthesis } from './profiles.js';
import { listVoiceEngines, normalizeVoiceEngine, synthesize } from './tts.js';
const CONFIG = {
tts: {
- engine: 'kokoro',
+ engine: 'piper',
rate: 1.7,
- kokoro: { modelId: 'configured-model', dtype: 'q8', voice: 'af_bella' },
piper: { voice: 'en_US-lessac-medium', voicePath: '~/.portos/voice/voices/en_US-lessac-medium.onnx' },
},
};
@@ -40,7 +38,6 @@ describe('voice engine normalization', () => {
const engines = await listVoiceEngines();
expect(engines).toEqual(expect.arrayContaining([
- expect.objectContaining({ id: 'kokoro', configKey: 'kokoro', label: 'Kokoro' }),
expect.objectContaining({ id: 'piper', configKey: 'piper', label: 'Piper' }),
expect.objectContaining({ id: 'qwen3-tts', configKey: 'qwen3', label: 'Qwen3-TTS' }),
]));
@@ -50,8 +47,9 @@ describe('voice engine normalization', () => {
describe('profile-aware TTS', () => {
beforeEach(() => {
vi.clearAllMocks();
+ findPiperVoice.mockReturnValue({});
getVoiceConfig.mockResolvedValue(CONFIG);
- synthesizeKokoro.mockResolvedValue({ wav: Buffer.from('wav'), latencyMs: 12 });
+ synthesizePiper.mockResolvedValue({ wav: Buffer.from('wav'), latencyMs: 12 });
});
it('dispatches the legacy Qwen3 engine alias and preset key to the Qwen3 adapter', async () => {
@@ -72,23 +70,39 @@ describe('profile-aware TTS', () => {
expect(result.engine).toBe('qwen3-tts');
});
+ it('refuses retired presets and profiles without silently replacing their voice', async () => {
+ await expect(synthesize('hello', { engine: 'kokoro', voice: 'af_heart' }))
+ .rejects.toMatchObject({ code: 'VOICE_ENGINE_RETIRED' });
+ getProfileForSynthesis.mockResolvedValue({ engine: 'kokoro', voiceId: 'kokoro:af_heart' });
+ await expect(synthesize('hello', { profileId: 'old-profile' }))
+ .rejects.toMatchObject({ code: 'VOICE_ENGINE_RETIRED' });
+ expect(synthesizePiper).not.toHaveBeenCalled();
+ });
+
+ it('uses Piper for the default engine', async () => {
+ getVoiceConfig.mockResolvedValue({ tts: { ...CONFIG.tts, engine: 'piper' } });
+ const result = await synthesize('hello');
+ expect(result.engine).toBe('piper');
+ expect(synthesizePiper).toHaveBeenCalled();
+ });
+
it('uses the approved profile voice and promoted delivery rate instead of later project defaults', async () => {
getProfileForSynthesis.mockResolvedValue({
- id: 'voice-profile-1', version: 3, engine: 'kokoro', voiceId: 'kokoro:af_heart',
+ id: 'voice-profile-1', version: 3, engine: 'piper', voiceId: 'piper:en_US-lessac-medium',
delivery: { rate: 0.85, pitchSemitones: null, formantSemitones: null },
mastering: { chain: ['preset-output:unprocessed'] },
});
const result = await synthesize('A stable character line.', { profileId: 'voice-profile-1', route: 'studio' });
- expect(synthesizeKokoro).toHaveBeenCalledWith('A stable character line.', expect.objectContaining({
+ expect(synthesizePiper).toHaveBeenCalledWith('A stable character line.', expect.objectContaining({
rate: 0.85,
- kokoro: expect.objectContaining({ voice: 'af_heart' }),
+ piper: expect.objectContaining({ voice: 'en_US-lessac-medium' }),
}), undefined);
expect(result).toMatchObject({
- engine: 'kokoro', profileId: 'voice-profile-1', profileRevision: 3,
+ engine: 'piper', profileId: 'voice-profile-1', profileRevision: 3,
provenance: {
- modelRevision: 'configured-model:q8',
+ modelRevision: 'piper:en_US-lessac-medium',
effectiveControls: { rate: 0.85 },
mastering: { chain: ['preset-output:unprocessed'] },
},
diff --git a/server/test/jsonWritebackExceptions.js b/server/test/jsonWritebackExceptions.js
index d60d6bb79f..34a0d0c05c 100644
--- a/server/test/jsonWritebackExceptions.js
+++ b/server/test/jsonWritebackExceptions.js
@@ -73,6 +73,10 @@ export const JSON_WRITEBACK_EXCEPTIONS = [
"key": "tools.js :: toolPath ( id )",
"reason": "No failed-read write-back: updateTool returns on null; registerTool is an explicit complete replacement."
},
+ {
+ "key": "timeCapsule.js :: snapshotFile",
+ "reason": "Immutable snapshots: createSnapshot writes a new UUID from freshly collected data; getSnapshot only displays existing snapshots and never writes its fallback back."
+ },
{
"key": "twinEnrichment.js :: CHRONOTYPE_OBSERVED_FILE",
"reason": "Authoritative rebuild: activity rows rebuild the complete chronotype histogram without retaining previous fields."