Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit c6dcf6241cf35581696834ca058dfdfc40e2adfb
parent 0a4ea8288d3eeac8d50d96960c07012d52873720
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun, 11 Oct 2026 01:11:16 -0400

plans: release 25 — T1, as shipped: the TTS engine, the tts-file job and pnpm ops tts

The record (the contract Lane B codes against, the expressive tags, the
registry, the cache, settings.tts with `home` as the root of every engine,
`tts setup`, how T1b slots in), the commit table and the gates — the real
Kokoro synthesis through the route at RTF 0.48. Two [Unreleased] bullets in
editor/CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Meditor/CHANGELOG.md | 2++
Mplans/release-25.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +- **Narration in a local synthetic voice, as a job.** `pnpm ops tts` (`POST /api/ops/tts`) speaks a line — `{"text"}`, or `{"file"}` an absolute path to a UTF-8 text file, at most 20,000 characters — with a local text-to-speech engine and one of its stock voices, as a `tts-file` job on its own `tts` queue, one synthesis at a time. The default is Kokoro-82M with the voice `af_heart` (`settings.tts`: `engine`, `voice`, `speed`, `home`, `dir`; SETTINGS.md); `"engine": "espeak-ng"` needs no install. Years are read as they are said ("twenty twenty-four"); the expressive tags `<laugh>` `<chuckle>` `<sigh>` `<cough>` `<sniffle>` `<groan>` `<yawn>` `<gasp>` are dropped for an engine that cannot perform them, and any other `<…>` is refused, named, so a typo is never read aloud. The result — `{wav, seconds, engine, voice, cached, durationMs, waitedMs, sha, sampleRate, speed, disclosure}`, printed by `--wait` — names a 48 kHz mono WAV in the synthesis cache (`<repo>/.tts/cache` by default, never inside the corpus), or the `"out"` path it was copied to, with a sidecar beside it that marks it a synthetic voice; `disclosure` is the line a narrated export carries ("Narration: synthetic voice (Kokoro-82M · af_heart)"). The same words with the same voice and speed again are answered from the cache at once, with no engine run. There is no voice cloning and no reference audio: a voice is a name from the engine's list. Needs a restart of the editor. +- **`archilyzer tts setup` installs the voice.** It builds `~/.local/share/archilyzer/tts/kokoro` (`settings.tts.home`): a python venv with kokoro-onnx 0.6.1 (made with `uv` when it is installed) and the model's two files, downloaded once from the kokoro-onnx project's release and checked by size and sha256 before they are kept. `--from <dir>` takes files already downloaded instead; `--check` says what is missing and installs nothing. `archilyzer doctor` reports the configured engine and voice as installed or not. - **`pnpm ops site-config` sets a site's cited-only channels and publish policy.** `{"siteId", "citedChannels"?: [slug…], "publishAuto"?: "off" | "build" | "preview" | "production"}` (`POST /api/ops/site-config`) writes through the site form's own validation: a slug the pool holds is dropped, a deploying policy without a Pages project is refused, and a private site is clamped to `build`. An unknown site, channel or key is refused before anything is written. The answer is the saved values. - **"Saved." on /sites comes at once.** Saving the hub config or a site, deleting a site and migrating settings into a first site sometimes waited up to ~6 s for the page's refresh before saying anything, the button stuck on "Saving…". They now save without making the page refresh wait, show what was saved straight away, and then refresh the page. - **A channel taken off a site, or moved to its cited scope, is withdrawn at the edge.** The next build of the site replaces every `transcripts/`, `subs/`, `posts/` and `digests/` path its last build served for that channel with an empty file of the same shape, served no-store (the way withheld X posts already are), and keeps doing so while the channel stays out. The channel's cited moments and clips still publish. A site's deploy now reads its withdrawn paths back in its live check, as the hub's does. diff --git a/plans/release-25.md b/plans/release-25.md @@ -54,3 +54,76 @@ Two Opus implementers. Gates as release 23/24 (tsc per commit; the four builds; Voice cloning (ruled out); narration derived automatically from card text; narration under clips (the join graph — bigger, later if wanted); a cloud TTS. + +## Record + +### T1, as shipped — the TTS engine, the `tts-file` job and `pnpm ops tts` (`r25/tts-core`) + +Synthesis is an editor job, never by hand: `pnpm ops tts` (`POST /api/ops/tts`) enqueues a `tts-file` job that runs one +engine through one wrapper into a content-addressed cache, and `archilyzer tts setup` installs the engine. + +- **The contract (Lane B codes against it).** Body `{text | file, voice?, engine?, speed?, out?}` — exactly one of + `text` / `file` (an absolute path to UTF-8 text), at most 20,000 characters; `engine` `kokoro` | `espeak-ng`; + `voice` one of the engine's stock voices; `speed` in the engine's range (0.5–2); `out` an absolute `.wav` path + outside the corpus. Unknown keys are a 400; every refusal comes before a job. The job's log ends with ONE line + `@@tts-result {json}`: `{wav, seconds, engine, voice, cached, durationMs, waitedMs, sha, sampleRate, speed, + disclosure}` — `wav` an absolute path the editor wrote (`out` when given, else `<cache>/<sha>.wav`), `sampleRate` + 48000, `disclosure` "Narration: synthetic voice (<engine label> · <voice>)" plus the engine's attribution sentence + when it has one. `durationMs` is the engine's time (≈0 on a hit), `waitedMs` the wait on the `tts` queue. +- **Expressive tags.** `TTS_EXPRESSIVE_TAGS` (`common/lib/ttsText.ts`): `laugh chuckle sigh cough sniffle groan yawn + gasp`. Stripped, with no stray or doubled space and no doubled comma, for Kokoro and espeak-ng; any other `<…>` is a + 400 naming it (with "did you mean <laugh>?" for a case slip). Exported for umtool's validator. +- **The pre-pass** (`normalizeTtsText`, each engine's `normalize` hook): tags, then years 1900–2099 spoken ("twenty + twenty-four", "nineteen oh five", "two thousand five", decades "the nineteen nineties"; amounts, decimals, times, + slashed dates, percentages and longer numbers left alone), then whitespace collapsed — the cache key is on the + result, so a re-wrapped paragraph is a hit. +- **The registry** (`common/lib/ttsApps.ts`): id, label, model (in the key), licence, `attribution?`, `device`, + `runtime` (`process` | `server`), the stock voices, default voice, speed range, `normalize`, `setup`, and `build` + → the argv of `scripts/tts.mjs` (TTS_BIN), which runs the engine (`scripts/tts_kokoro.py` for Kokoro) and leaves a + 48 kHz mono 16-bit WAV, bare 44-byte header, atomically. Kokoro: its 28 English voices (`a*` en-us, `b*` en-gb), + `af_heart` default. A voice is a name from that list — never a path. +- **The cache**: sha256 of (`archilyzer-tts/1`, engine, model, voice, speed, spoken text) → `<dir>/<sha>.wav` + + `<sha>.json` (`synthetic: true`, the disclosure, engine, model, licence, voice, speed, seconds, the spoken text). A + hit at enqueue is a `done` job on queue `""` that runs no engine; a miss runs on queue `tts` (`TTS_QUEUE`) and checks + the cache again at its turn. +- **Settings**: `settings.tts` `{engine: "kokoro", voice: "af_heart", speed: 1, home: "", dir: ""}`. **`home` is the + ROOT of all engines** (`~/.local/share/archilyzer/tts` when blank), each engine in `<home>/<id>` — so Kokoro is at + `~/.local/share/archilyzer/tts/kokoro`, the plan's path, and Orpheus (T1b) gets its own dir beside it. `dir` blank = + `<repo>/.tts/cache` (gitignored `/.tts/`); a cache dir inside the corpus is refused. Paths: `ttsBin` (TTS_BIN), + `espeakNgBin` (ESPEAK_NG_BIN), `ttsHome`, `ttsCacheDir`. +- **`archilyzer tts setup [--engine] [--from <dir>] [--python <py>] [--check]`**: a venv (`uv venv --python 3.12` + when uv is on PATH), `kokoro-onnx==0.6.1`, the two model files from the `model-files-v1.0` release pinned by size and + sha256 — one stream each, no retries, `.part` then rename; `--from` hard-links (else copies) verified files; + `--check` imports the package and lists what is missing. Scratch under the install dir, never the OS temp dir. + `archilyzer doctor`'s `tts` row: installed is ok, not installed is a note (never a failure). +- **How T1b (Orpheus 3B) slots in**: a registry entry with `device: "gpu"`, `runtime: "server"`, `attribution: "Built + with Llama"`, `normalize` with `tags: "keep"` and a new numbers/ordinals option on `normalizeTtsText`, and a `setup` + of its own; in `runTtsSynthesis` (marked) a GPU engine waits for the transcription pool to be idle, and a server + engine takes a per-engine holder (llama-server started for the batch on the `tts` queue, stopped once the queue has + been idle) whose URL `build` receives as `server`; `scripts/tts.mjs` gains `--engine-kind orpheus`. + +| commit | what | +|---|---| +| `cebeaff9` | the registry, the pre-pass (tags, years, whitespace) and the wrapper + Kokoro helper | +| `c44946b1` | `settings.tts`, the TTS paths and env vars; SETTINGS.md, settings.json.example, ENVIRONMENT.md | +| `24ca5907` | `tts-file` on the `tts` queue, the cache and its sidecar, the install check | +| `7d37f6b2` | `POST /api/ops/tts`, `pnpm ops tts`, COMMANDS.md | +| `ee9c1cd8` | `archilyzer tts setup`, the doctor's `tts` row | + +#### Gates + +| gate | result | +|---|---| +| tsc (`pnpm -r … exec tsc --noEmit`) | clean at every commit | +| common unit | 3748 pass, 0 fail (new: ttsText 5, ttsApps 5, ttsSettings 3, ttsFile 8, tts-setup 5, doctor +1, settingsSchema/jobKinds updated) | +| editor unit | 260 pass (new: `api/ops/tts/route.test.ts` 4, one a real espeak-ng synthesis through the route) | +| test:scripts | 798: 795 pass, 3 skip (new: `tts.test.mjs` 4, `archilyzer-ops.test.mjs` +1) | +| one real synthesis through the job with espeak-ng | `ttsFile.test.ts`: engine run once, the same ask re-wrapped a cache hit with no engine run, `out` copied, a file at another speed a new synthesis | +| `docs env\|files\|cli --check`, `settings example --check` | clean | +| `archilyzer tts setup --from <bake-off models>` | real, into the default home: venv + kokoro-onnx 0.6.1 by uv, both files hard-linked and verified; `--check` 0; re-run idempotent | +| one real Kokoro synthesis through the route | the route handler in-process (an isolated temp corpus and cache, the real default home; under `pnpm heavy`): 466 characters (years, numbers, a `<laugh>`) → 30.65 s of 48 kHz audio in 14.85 s engine time, model load included — **RTF 0.48** (the bake-off's 0.46 without load); the sidecar spoke "nineteen ninety-nine" / "twenty twenty-four", the tag gone; the same ask again a cached done job, `durationMs` 0, no engine run | + +Not done here: the four `next build`s and `pnpm e2e:all` (the orchestrator's); no e2e spec was added (the route test +runs a real synthesis in-process). Found and left: a job's `done` settles when its log stream is ended, not flushed +(`runManagedFunction`), so a near-instant job (a cache hit) can settle before its log is on disk — `pnpm ops --wait` +polls over HTTP and does not see it; the unit tests poll for the marker.