Commit Graph
26 Commits
Author SHA1 Message Date
debpalash eaa28c9b37 Redact the normalized CLI key and keep a WebVTT cue that follows the header directly
Review fixes for #4558 and #4554.
2026-11-30 20:08:51 +05:30
felixpy 42b3d615fb fix(cli): drop a leading UTF-8 BOM from API keys
A BOM from stdin was saved with the key. Loading that key, or an
environment key with the same prefix, put U+FEFF in Authorization and
http.client could not encode the header as latin-1.
2026-11-30 02:25:32 +00:00
swaxanddebpalash a9c0b550ea feat(dub): accept externally separated stems for prepared jobs (#4499)
* feat(dub): allow administrators to attach externally separated stems

* docs(changelog): record external dub stem support

* fix(dub): attached stems supersede a running transcript and never serve the ingest cache

---------

Co-authored-by: debpalash <4178343+debpalash@users.noreply.github.com>
2026-11-27 00:58:03 -08:00
davidsiguenzaanddebpalash 70a9ed0f86 feat(dub): plan reusable speech and fit narration to fixed subtitle windows (#4220)
* feat(dub): plan reusable speech and fit narration to fixed subtitle windows

* fix(dub): cover current upstream behavior and cache fallbacks

* fix(dub): preserve stream receipts and synchronize generated contracts

* test(dub): retain distinct inputs across dictionary snapshots

* docs(changelog): record pull request #4220

* fix(dub): make overflow rescue opt-in

auto_fit_overflow now defaults to false, so Concise and Smart Fit keep
the blocking timing error unless the caller opts in. Default-path tests
restore main's Smart Fit expectation and prove no compression runs. The
tail-probe in the rescue tests now samples before main's 25 ms trim fade
(#4229).

* fix(dub): mark checkpointed speech once on the watermark pool

The private checkpoints marked fresh takes synchronously inside the
synthesis thread, bypassing main's single-worker watermark pool and its
fail-open drain handling. Fresh takes are now marked once at the persist
point with mark_synthetic_async and checkpointed afterwards, with the
model proof still taken right after synthesis. Checkpoint and journal
reuse is not marked again; only audio RVC replaced is re-marked, and RVC
output is never kept as a checkpoint.

* fix(dub): release superseded speech auditions

Each render wrote a new .speech-previews directory whose links kept every
superseded take alive, so re-rendering a job grew its disk use without
bound. A new render now keeps the four most recent renders' auditions
(including any still running) and removes older ones; planning never
prunes.

* fix(dub): bound private speech checkpoints per job

Checkpoints kept every take ever rendered, so each edited line left its
previous audio behind and long, re-rendered jobs grew on disk without
limit. A render now evicts the oldest takes beyond 1 GiB per job, the
same bound as the interrupted-render journal; planning never prunes.

* fix(dub): keep SRT-only window fitting opt-in and never skip a rescue fit

SRT-only projects were always forced into fixed-window compression,
which is overflow rescue under another name; they now keep their
requested strategy and blocking timing error unless auto_fit_overflow is
opted in. The narration strategy keeps its fixed windows.

Concise rescue clamped its window to the source duration and next onset,
so a job without a recorded duration, or a next cue starting with this
one, produced an empty slot and mixed the overlong take unfitted over the
following speech. The window now always keeps at least the cue itself.

* fix(dub): verify planned checkpoints off the event loop

The read-only plan hashed and decoded every saved take on the event loop,
stalling the backend while a long project was inspected.

* fix(dub): save speech auditions off the event loop

Where hard links are unavailable (exFAT, network shares) each audition
copied the whole take on the event loop while holding the jobs lock.

* fix(dub): validate the language of short cues spoken in fixed windows

Fixed-window timing speaks cues of 0.05 s or less, but the render-language
check still skipped them as silence, so an unsupported language reached
the engine unchecked.

* docs: sync service count and changelog fragment for #4220

* fix(dub): refuse only unplaceable fixed-window cues, naming each one

Media jobs no longer get the PR's new 422 for a spoken cue of 0.05 s or
less; generation behaves exactly as on main. The read-only plan still
names such cues so they can be fixed before a long render.

Narration and opted-in SRT-only rescue now validate their windows before
any synthesis with the same rules as the layout. Overlapping cues and
cues past the end of the source are refused with a 422 that names each
cue number (for example, subtitle 2 starts before subtitle 1 ends)
instead of failing late with a generic error.

* fix(dub): refuse a too-short spoken media cue before any synthesis

Main refuses such a cue only after the whole render (dub_speech_missing).
The same refusal now comes first as a 422 (dub_cue_too_short) naming each
cue number, its duration and the fix: lengthen it or merge it with a
neighbouring subtitle.

* fix(dub): prove request-derived dub paths stay inside the dub folder

The new plan and audition routes made the render's request ids
(job, segment, language, preview render/token) reach file paths through
checks static analysis could not follow:

- dub_seg_path's containment guard also accepted a path equal to the root,
  which its seg_*.wav name can never be; it is now the single
  realpath + startswith proof.
- The track path joined the raw job id onto DUB_DIR; it is now normalized
  and prefix-checked like every other artifact path.
- Speech-preview paths use the same normalized prefix check after their
  exact allowlists, instead of a helper whose input is itself a sink.
- The OOM retry log renders the request's step count through log_safe.

Behaviour is unchanged for valid ids; traversal attempts raise as before.

* fix(dub): report checkpoint file cleanup failures instead of ignoring them

Removing stale or temporary checkpoint files now tolerates a missing file
and logs any other failure at debug level, rather than swallowing every
OSError silently.

* fix(dub): rebuild render job ids and languages from an exact allowlist

The job id and track language still reached segment paths, and through
them ffmpeg's command line, as the request's own strings: the language's
regex check and the path containment proofs do not end that flow. The
generate, plan and audition entry points now rebuild both values
character by character from [A-Za-z0-9_-] (job id up to 64, language up
to 32, matching the existing checks) and reject anything else with 400,
so only known-safe strings continue.

* fix(dub): address review findings on planning, rescue and checkpoints

- Refuse rows whose ids share one speech file (equal, or equal once
  sanitized or case-folded) before synthesis, naming the cues.
- Judge too-short cues by the text they would speak: a line pronunciation
  rules remove entirely is intended silence, not a 422.
- With overflow rescue, never fit past a known source end, and refuse
  cues that start after it; fixed windows refuse cues with no playable
  time. An unknown source duration sizes the track from the cues instead
  of publishing an empty one.
- The plan reports a silent saved take as dub_speech_missing, as
  generation does.
- Keep a checkpoint only when its provenance mark state matches the
  identity it is stored under.
- Native prefetch no longer decodes checkpoint hits ahead of their row.
- Checkpoint pruning counts only takes it actually deleted.
- Preview paths resolve symlinks before the containment check; the
  preview route advertises WAV bytes in the API contract.
- Missing-reference warnings log the file name, not the home path.
- Narration drops -shortest only when a mapped track is narration.
- Tests resolve app modules at run time and snapshot job state deeply.

* test(dub): expect the missing-reference warning to name only the file

* fix(dub): guard reused takes against model changes, stop rescans, refuse sampleless windows

- a checkpoint hit triggers the same mixed-weights guard as journal recovery
- a saved or journaled first row ends the native-batch prefetch scan
- a fixed window shorter than a sample is refused; a zero rescue slot errors instead of reporting fits

---------

Co-authored-by: debpalash <4178343+debpalash@users.noreply.github.com>
2026-11-26 09:11:31 -08:00
Palash Debnath b4ff354ca2 fix: seven reported issues (MOSS-TTS-Nano, design recipes, Windows setup, startup logging, history size) (#4488)
* fix(moss): load MOSS-TTS-Nano whichever container transformers combines ignore patterns with (#4484)

The 5.9 version gate misjudged some transformers builds, leaving a set on the left of a list concatenation. Try the model's own lists first and retry with sets only on TypeError.

* fix(voices): keep Voice Design recipe on save and store Style text as typed (#4474)

* fix(setup): recover from uv's broken Python minor-version link on Windows (#4487)

* fix(setup): fail a stalled wheel prefetch and fall back to uv (#4476)

* fix(ui): use system fonts on the blank-window fallback page (#4478)

* fix(electron): log every silent early exit before userData exists (#4477)

* perf(history): clip long take scripts in the history list, fetch the full take on demand (#4483)

* test(routes): the single-take history read shares the list's access tier

* docs(changelog): fragments for the issue batch

* docs(changelog): reference the batch PR in its fragments

* docs(cosyvoice-gguf): Linux and Docker build steps, offline ONNX Runtime (#4485)

* docs(windows): keep the uv link entry in the troubleshooting list

* fix: Windows-safe startup log and uv link recovery, regenerate CLI contract

* fix(electron): check and write the startup log through one descriptor

* fix(electron): truncate an oversized startup log on Windows too

* fix(electron): keep the startup log in a per-user folder and open it without following links

* test(profiles): guard the 400-on-every-use class at render time, where it is enforced

* fix(history): keep list_history callable directly with its default limit

* fix: address review findings on the issue batch

- canary returns the recovered interpreter so the sync uses it (#4487)
- startup log redacts credentials and home paths; dialog names it only after a write (#4477)
- stalled size probes are aborted at their deadline (#4476)
- reuse of a clipped take reports a failed full-script load with Retry and yields to newer choices (#4483)
- edited design Style becomes the recipe so free-form engines receive it (#4474)
- CosyVoice GGUF docs: CMake 3.28, archive from the error, build step, Docker ORT libs (#4485)
2026-11-26 07:15:45 -08:00
Palash Debnath 81223b0443 feat(pronunciation): import and export W3C PLS lexicons (#4469)
* feat(pronunciation): import and export W3C PLS lexicons

Pronunciation dictionaries from ElevenLabs, Azure and Google speech are PLS
files. Import takes .pls/.xml (alias -> respelling, IPA and CMU ARPABET
phonemes -> their entry types; other alphabets are left out and counted),
and Export PLS writes the enabled entries. Lexicons with a DOCTYPE or
entity declarations are refused before parsing.

* docs(changelog): PLS lexicons (#4469)

* fix(pronunciation): parse PLS with defusedxml and keep replace safe (#4469)

- Parse untrusted lexicons with defusedxml (forbid_dtd) and refuse a DOCTYPE
  anywhere in the document, not just the first 4 KB.
- Apply prefer="true" across aliases and phonemes together, falling back to
  the first usable reading.
- Never offer to replace a dictionary with an import that has no usable
  entries.
- Split pronunciation settings: types, import reader and export move to
  pronunciation-io.ts; the entry row is its own component.
- Regenerate the CLI request contract for the export format query.

* fix(pronunciation): drop the unused Switch import

* fix(pronunciation): keep PLS round trips faithful

A rejected phoneme string gives way to the word's next reading, a deletion
override travels as an empty alias, and a dictionary with entries for several
languages is refused instead of being widened to every language on reimport.

* fix(pronunciation): keep respellings exact in PLS and refuse unrepresentable characters

* refactor(pronunciation): check XML characters by code point
2026-11-25 22:19:08 +05:30
debpalash 5e4e90b299 Merge #4385: fix(cli): keep carriage returns inside a single TSV row 2026-11-23 13:02:30 +05:30
ShuaixinHuang b02ea5dc0a fix(cli): keep carriage returns inside a single TSV row 2026-11-23 14:28:38 +08:00
ShuaixinHuang 0bfb454402 fix(cli): complete global options before subcommands 2026-11-23 14:25:01 +08:00
debpalash 377d0059ab Merge #4218: allow media preparation without background separation
# Conflicts:
#	backend/services/dub_pipeline.py
2026-11-23 04:10:04 +05:30
Palash Debnath c9189c0f69 perf: faster dub pipeline, transcription and job saves (#4323)
* perf(asr): cpu_threads on CPU and batched faster-whisper decode on CUDA with sequential fallback

* perf(dub): one-pass audio extraction and scene detection overlapped with Demucs on GPU hosts

* perf(dub): save the initial ingest job off the event loop, tombstone invariant intact

* perf(longform): skip fsync for per-span cache WAVs; torn files are re-rendered

* perf(dub): history list omits job_data (?full=1 restores it); holder scan runs in SQL

* perf(translate): load NLLB in fp16 on CUDA with float32 fallback

* docs(performance): NLLB fp16 and batched Faster-Whisper switches

* test(asr): accept cpu_threads kwarg in the load fake

* test(asr): expect cpu_threads in the HIP CPU-load assertions

* docs(changelog): perf batch fragment (#4323)

* fix(perf): address review findings, restore durable segment cache, regenerate CLI contract

* test(dub): use explicit checkpoints in the save-cancellation test

* fix(perf): opt-in batched ASR, NLLB model lock and clean reload, await scene task on cancel

* docs(performance): batched Whisper is opt-in; update changelog fragment

* fix(perf): unload NLLB off the event loop, CPU placement cleanup, state holder, deterministic tests

* test(translate): prove the NLLB unload waits off the event loop
2026-11-21 19:27:59 +05:30
davidsiguenza 65db839f64 chore(api): synchronize CLI and route inventories 2026-11-16 13:05:45 +01:00
debpalash 18e780d551 fix(cli): pass app switches given without a command to the app
The AppImage and .deb now start the voicestudio command, so the switches
Playwright launches Electron with (--inspect=0, --remote-debugging-port=0)
were a CLI usage error and v0.5.8-beta.4's Linux packaged smoke test could not
start the app. Any --switch the CLI does not define, with no command, now opens
the app with it, as Chromium flags given to the AppImage did before.

The packaged smoke test no longer dies on Playwright's stray launch rejections,
so its launch error now shows the process's stderr and exit code.
2026-11-11 00:52:43 +05:30
debpalash b8ca846739 Merge remote-tracking branch 'origin/main' into r-3963 2026-11-10 10:12:44 +05:30
debpalash bebf91ff44 fix: satisfy repo guard tests (CLI contract, structure doc count, encoder subprocess decoding) 2026-11-10 07:14:44 +05:30
debpalash 1b1237e85f chore(cli): regenerate the request contract for the provider opt-in field 2026-11-10 06:08:13 +05:30
debpalash 6e2111eb7e fix(train7): follow CLI background tasks and accept every needed licence
- dub upload, dub ingest and dub generate answer a task id at once; the
  CLI now follows /tasks/stream/{task_id} to the end, printing progress to
  stderr, exits non-zero with the backend's error on a failed or cancelled
  task, cancels the task on Ctrl+C, and dub generate --output saves the
  rendered track instead of the task id JSON.
- models install/license accept list and accept every licence the model's
  engine needs (license_dependencies, e.g. OmniVoice's Higgs tokenizer),
  refuse an incomplete list, and record each displayed fingerprint.
2026-11-09 21:12:11 +05:30
debpalash dae6520a30 fix(train7): bare voicestudio opens the selected profile
Addresses review: launch_desktop ignored VOICESTUDIO_USER_DATA, which
background launches already pass, so the foreground app opened the
default profile. Both paths now share the profile argument, and an
explicit --user-data-dir still wins.
2026-11-09 18:06:39 +05:30
debpalash fa4ccd6124 fix(train7): make CLI output and prompts behave the same on Windows
- Write stdout/stderr as UTF-8 with LF line endings on every OS, so pipes
  and files get identical bytes instead of CRLF on Windows.
- Windows reports the NUL device as a TTY; a terminal is now also required
  to be a real console, so --yes is demanded (as elsewhere) instead of
  prompting with nobody to answer, and progress/binary checks agree.
- Register PowerShell completion for voicestudio.exe and .cmd shims too;
  the completion test uses a .cmd launcher on Windows.
2026-11-09 17:35:03 +05:30
debpalash f8340436a6 fix(train7): omit optional CLI bodies and check current startup rules
- The contract exporter now resolves Optional[Model] bodies (anyOf with
  null) and records whether a body is required. `voicestudio dub
  transcript clean` without fields sends no body, so the backend cleans
  the saved transcript instead of rejecting `{}` with a 422.
- The wheel smoke imported a POLICY table the CLI no longer defines; it
  now checks the OFFLINE/OBSERVE startup rules, and a unit test runs that
  check against the source tree so it cannot rot again.
- CLI tests and contract reads use explicit UTF-8.
- Explain the CLI's intentionally empty except clauses (CodeQL).
2026-11-09 15:39:16 +05:30
debpalash 15d9b3e71d fix(train7): keep voicestudio-electron link; GUI-safe launcher args
- The .deb's maintainer scripts are electron-builder's own plus a block
  that links the pre-rename /usr/bin/voicestudio-electron to the new
  command (replacing only a missing or dangling link) and removes it only
  when it is still this package's link. Sandbox tests run both blocks.
- Absolute paths and URLs passed by the desktop launcher (Exec ... %U)
  now open the app instead of being parsed as a command.
2026-11-09 14:37:01 +05:30
debpalash 5cce5de3ad fix(train7): address #3828 review findings
- Repair a profile whose VoiceStudio marker lost its PATH lines and an
  empty fish conf.d file instead of reporting the command as available.
- Configure ~/.zshrc for Linux zsh users who have none yet.
- Log only the error code when first-launch terminal setup fails, so the
  log carries no home path.
- Keep bash completion working on macOS's bash 3.2, which joined the
  sliced word list into one argument.
- Authorize the CLI contract test's backend client as loopback, matching
  main's consumer gate.
- Credit the contributor in the changelog fragment; drop unused imports.
2026-11-09 14:28:31 +05:30
mostafa-ismail-2004 0d6e3e2cbe fix(cli): keep profiles separate and finish interrupted terminal setup
- A chosen profile (--user-data-dir / VOICESTUDIO_USER_DATA) is reached
  only through its own backend.json; the CLI no longer falls back to the
  default port, which may belong to another profile, for commands or stop.
- An empty --user-data-dir= is a usage error instead of consuming the
  next argument.
- First-launch terminal setup rewrites profiles until every one carries
  the PATH block, so a run that failed halfway is finished on the next
  launch, and Settings only reports the command ready when it is.

Refs #3829
2026-11-05 20:16:01 +02:00
mostafa-ismail-2004 da7beca5cd fix(cli): read backend.json from the profile chosen with --user-data-dir
A launcher-supplied --user-data-dir now reaches the app it starts, so the
CLI must look for that app's backend.json in the same folder; otherwise a
custom profile's backend is never found and the command times out.
2026-11-05 19:48:57 +02:00
mostafa-ismail-2004 ff1aa131f6 fix(cli): address review findings on the terminal command
- Background launches keep the launcher's switches, so Snap's
  --no-sandbox reaches Electron and the app can start confined.
- A crashed backend fails fast instead of waiting out the startup budget.
- The AUR launcher runs the renamed executable, and package-managed
  installs (VOICESTUDIO_DISABLE_UPDATER=1) are told to update through
  their package manager instead of opening a disabled updater.
- Windows: PATH is edited in the registry as stored (unexpanded entries,
  same value type); the warning never blocks a silent install; an
  update keeps the PATH entry in case it rolls back.
- Relative command links are resolved against their own folder, and
  bash users with ~/.bash_profile get the PATH entry there.
- Settings shows a translated, actionable message when PATH setup fails.
- Tests: the network guard also blocks connect_ex and sendto; the lock
  tests synchronize on events instead of sleeps and kill the holder to
  test a real crash; a Windows path assertion is separator-agnostic.
2026-11-05 19:40:27 +02:00
mostafa-ismail-2004 4708ae9a51 feat(cli): add the voicestudio terminal command
Add a terminal command that drives the desktop app's local backend.

- The desktop app owns the backend. When no backend answers, the CLI
  starts the installed app in the background (no window); it publishes
  its address in backend.json and quits after 10 idle minutes. Opening
  the app later shows a window in the same process, so a terminal
  session and the GUI never run two backends.
- The backend reports activity (requests, jobs, downloads, installs,
  calls) at /system/activity so idle shutdown never interrupts work, and
  holds a kernel lock on its data directory so a second backend fails
  fast with an actionable message.
- `voicestudio stop` stops a background app; commands that only report
  state never start it, and `status` exits 3 when it is not running.
- Output is readable tables and fields chosen from each result's shape;
  `--json` prints the raw data and piped output is tab-separated.
- Tab completion for bash, zsh, fish and PowerShell
  (`voicestudio completion <shell>`), without building the command tree.
- `voicestudio update` opens the app's updater; the CLI itself makes no
  network requests.
- Settings → General shows the terminal command and can add it to PATH
  on request; shell profiles are only edited with that consent.
2026-11-05 18:18:58 +02:00