decklight 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/SPEC.md +23 -15
- package/cli/associate.mjs +2 -2
- package/cli/bundle.mjs +1 -1
- package/cli/decklight.mjs +9 -1
- package/cli/edit.mjs +54 -1
- package/cli/import.mjs +41 -11
- package/cli/pdf.mjs +59 -14
- package/cli/pptx-export.mjs +107 -0
- package/cli/present.mjs +8 -4
- package/cli/publish.mjs +10 -2
- package/cli/record.mjs +3 -3
- package/cli/skill-content.mjs +1 -0
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +10 -0
- package/dist/decklight.js +135 -84
- package/dist/decklight.js.map +4 -4
- package/docs/architecture.svg +3 -3
- package/package.json +2 -1
- package/tools/bridge.mjs +25 -2
- package/tools/deck-html.mjs +9 -0
- package/tools/elevenlabs-tts.mjs +2 -2
- package/tools/exec.mjs +54 -0
- package/tools/gemini-tts.mjs +4 -4
- package/tools/lipsync-server.mjs +6 -0
- package/tools/lipsync.mjs +6 -6
- package/tools/local-voice.mjs +73 -3
- package/tools/pptx-write.mjs +151 -0
- package/tools/pptx.mjs +82 -2
- package/tools/publish-site-voices.mjs +2 -2
- package/tools/publish-targets.mjs +39 -2
- package/tools/publish-voices.mjs +2 -2
- package/tools/template-theme.mjs +154 -0
- package/tools/test-impact.mjs +15 -8
- package/tools/tts-cache.mjs +191 -0
- package/tools/tts-engines.mjs +62 -7
- package/tools/tts-setup.mjs +3 -2
- package/tools/video.mjs +6 -3
- package/tools/voiceover-server.mjs +40 -54
- package/tools/voiceover.mjs +95 -16
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ But the real reason this project exists is the second half: I wanted a codebase
|
|
|
25
25
|
- **46 built-in themes** — every one passes WCAG contrast gates and codified palette rules; generate your own with a keystroke.
|
|
26
26
|
- **Truthful terminals** — real PTY recordings replayed truthfully, never a video.
|
|
27
27
|
- **Live narration** — text-to-speech presents the deck by itself, in sync, captions included.
|
|
28
|
+
- **Coming from PowerPoint** — `import` brings the deck across (charts as data, hidden slides still hidden, the template's own palette as a theme), and `pdf` / `pptx` hand a file back to whoever still asks for one.
|
|
28
29
|
- **Everything is text** — no binary formats, so decks diff cleanly in git and agents can read, review, and edit every byte.
|
|
29
30
|
- **Safe to receive** — `decklight present` plays a deck you did not author read-only under a CSP, prints what the file will execute, and strips what it cannot account for. `publish` signs; a `.decklight` container is verified before it renders.
|
|
30
31
|
- **Extensible without shipping code to the audience** — themes, templates, engines, importers and presenter chrome install from git-repo marketplaces anyone can host; build-time transforms run on your machine during `bundle`, so nothing executable travels with the deck.
|
|
@@ -97,6 +98,8 @@ The whole loop is agent-friendly and stays in one file end to end:
|
|
|
97
98
|
| **Math** | `data-math` renders `$$…$$` / `\(…\)` LaTeX to native MathML via bundled Temml — no webfonts, no build step | [SPEC CODE_AND_MATH](SPEC.md#code_and_math--code--math) |
|
|
98
99
|
| **Terminals** | `decklight cast` captures real PTY output; replayed by typing then streaming, never a video | [SPEC TERMINAL_RECORDINGS](SPEC.md#terminal_recordings--terminal-recordings) |
|
|
99
100
|
| **Presenting** | speaker view, rehearse cue cards, overview, command palette, slide finder — all on `file://` | [SPEC PRESENTING](SPEC.md#presenting--presenting--output) |
|
|
101
|
+
| **Hidden slides** | `data-hidden` keeps a slide in the file and out of the talk — it keeps its number, `?all` presents it anyway | [SPEC DECK_ANATOMY](SPEC.md#deck_anatomy--deck-anatomy) |
|
|
102
|
+
| **Rehearsal timings** | the speaker view records how long each slide actually took and writes it onto the deck; the next run paces against it | [SPEC PRESENTING](SPEC.md#presenting--presenting--output) |
|
|
100
103
|
| **Narration** | TTS reads your notes in sync with builds — or **your own voice**, recorded beat by beat and pacing them the same way; the voice is the clock, captions + auto-advance | [SPEC PRESENTING](SPEC.md#presenting--presenting--output) |
|
|
101
104
|
| **Review** | reviewers comment on slides and submit the review as a branch; git carries it, a comment finds its slide again after the deck moves, and the author is told a review is waiting | [SPEC REVIEW](SPEC.md#review--reviewer-comments) |
|
|
102
105
|
| **Integrity** | read-only `present` under a real CSP header, an ingredients label of what a deck executes, Sigstore signing, the `.decklight` container | [SPEC PRESENTING](SPEC.md#presenting--presenting--output) |
|
|
@@ -111,7 +114,7 @@ The whole loop is agent-friendly and stays in one file end to end:
|
|
|
111
114
|
| `decklight skills [agent…]` | install the authoring skill for Claude, Codex, OpenCode or IBM Bob (detected, named, or `--all`; `--global` for every project; `--pack` zips it for upload) |
|
|
112
115
|
| `decklight author deck.html` | **the whole authoring loop in one command** — live reload + every bridge this machine can run |
|
|
113
116
|
| `decklight present deck.html` | **play a deck you did not author** — read-only over localhost under a CSP header, with an ingredients label and `--strict`; a deck in a clone can see its upstream and (with `--upstream-pull`) offer to fast-forward |
|
|
114
|
-
| `decklight import talk.pptx` | bring a PowerPoint, Keynote or Google Slides deck across (`.key` needs macOS; a Slides URL must be link-shared) |
|
|
117
|
+
| `decklight import talk.pptx` | bring a PowerPoint, Keynote or Google Slides deck across — bullets, tables, images, **charts as data** and notes; `--theme template` derives the deck's theme from the file's own palette and fonts (`.key` needs macOS; a Slides URL must be link-shared) |
|
|
115
118
|
| `decklight cast script.term.yaml` | record a **terminal** cast in a real PTY (`refresh` re-runs them, `export` flattens to asciicast v2) |
|
|
116
119
|
| `decklight record deck.html` | record the narration in **your own voice** — the deck reads you its notes one ⟨CLICK⟩ at a time, and `→` ends a beat *and* reveals the next build, so your voice paces the deck (`cast` records a terminal, `record` records you) |
|
|
117
120
|
| `decklight review deck.html` | **leave comments on somebody's deck**, anchored to slides — a comment survives the slide moving, and says so when its slide changed or is gone |
|
|
@@ -121,8 +124,9 @@ The whole loop is agent-friendly and stays in one file end to end:
|
|
|
121
124
|
| `decklight restore deck.html` | list the commits that touched a deck, and put it back to any of them |
|
|
122
125
|
| `decklight upgrade deck.html` | bring a self-contained deck's inlined runtime + themes up to the installed version |
|
|
123
126
|
| `decklight bundle deck.html [--all]` | flatten to a self-contained single-file HTML (`--sign` attests it, `--deck` wraps it as `.decklight`) |
|
|
124
|
-
| `decklight publish deck.html` | bundle and push to GitHub Pages — signed by default; Netlify and Vercel install as targets |
|
|
125
|
-
| `decklight pdf deck.html` | one slide per page, at its own size, in its theme — no print dialog |
|
|
127
|
+
| `decklight publish deck.html` | bundle and push to GitHub Pages — signed by default; Netlify and Vercel install as targets, and `--target folder` writes the site into a directory for any host that serves files |
|
|
128
|
+
| `decklight pdf deck.html` | one slide per page, at its own size, in its theme — no print dialog (`--notes` is the presenter's copy, `--handout` three a page with ruled lines) |
|
|
129
|
+
| `decklight pptx deck.html` | a PowerPoint file for whoever still asks for one — every slide a picture, the notes real notes; lossy on purpose |
|
|
126
130
|
| `decklight voiceover deck.html` | batch-synthesize the narration into a folder with a live engine (piper/chirp/gemini/elevenlabs) — the headless counterpart of the deck's `V → Record this deck…` |
|
|
127
131
|
| `decklight video deck.html` | render to one narrated mp4 — ⟨CLICK⟩ segments narrate the builds (`--voiceover` synthesizes the narration first) |
|
|
128
132
|
| `decklight theme check\|add` | validate a theme against the token contract, or install one into a deck |
|
package/SPEC.md
CHANGED
|
@@ -61,6 +61,8 @@ being moved, and it says what it points at.
|
|
|
61
61
|
- **Subtitle**: the `<p>` immediately following a slide's leading `h1`/`h2` is auto-marked `.subtitle` and gets one canonical look (muted, 0.72em). Opt out per slide with `data-subtitle="none"` on the section; an author-placed `class="subtitle"` is respected as-is. Don't bake subtitle text into diagram SVGs — author it as this `<p>` so it themes and scales with the deck.
|
|
62
62
|
- **Background media**: `data-background-image="hero.jpg"` on a section renders the image full-bleed behind the slide's content — `data-background-size="cover|contain"` (default cover), `data-background-position` (default center). `data-background-dim="0.5"` lays a canvas-colored (`--bg`) overlay between the media and the content so text stays readable over arbitrary photos. `data-background-video="clip.mp4"` plays a muted looping `playsinline` clip while the slide is active — play/pause is driven from the engine's slide event, so a deactivated slide's video is *paused*, not merely hidden; `data-background-poster="poster.jpg"` is its stand-in still (required for print, PRESENTING). The engine injects the layer as an idempotent `.slide-bg` first child on `sync()` — absolutely positioned below the content, so backgrounds never count against the overflow guardrail (PRESENTING) and transitions/auto-animate carry them for free. `class="full-bleed"` on an `<img>` gives a *content* image the same cover-the-slide treatment (absolute inset-0, object-fit cover, under the in-flow text); images inside split layouts (PRESENTING) are capped (object-fit contain, max-height) so a tall photo can't blow the slide. `decklight bundle` inlines `data-background-image`/`data-background-poster` as data: URIs like `<img src>`; background videos stay external with a CLI notice (PRESENTING).
|
|
63
63
|
|
|
64
|
+
**Hidden slides** (`HIDDEN_SLIDES`): `<section data-hidden>` is a slide the audience does not see. It **keeps its number** — as in PowerPoint — so everything that numbers slides file-side (comments, review anchors, history) stays in step; presenting steps over it, a deep link onto it lands on the nearest shown neighbour in the direction of travel, the overview shows it dimmed and badged so an author can find it, and `pdf`, `video` and `voiceover` produce nothing for it. `?all` presents hidden slides too — never the default, because hidden is hidden from the audience and the default is the audience. The command palette carries both halves: **Hidden slides show / skip** flips `?all` (the row exists only when the deck has something hidden), and in author mode **Hide this slide / Unhide this slide** writes `data-hidden` onto the current section through the author server (`POST /edit/hidden`, one undo entry, the same door as a layout pick) and steps off it. `decklight import` keeps a PowerPoint hidden slide as one rather than dropping it.
|
|
65
|
+
|
|
64
66
|
### SLIDE_DENSITY — How much goes on a slide
|
|
65
67
|
|
|
66
68
|
The overflow guardrail (PRESENTING) is the **late** failure. It fires once content is
|
|
@@ -512,15 +514,16 @@ Authorship is **structural, not detected**: the server spawns the agent itself a
|
|
|
512
514
|
- **Inline-theme mode** (bundled single-file decks): when `<style data-theme="name">` blocks exist, they replace the link — `applyTheme` toggles which block applies (via `media="not all"`; the HTML `disabled` attribute on `<style>` is non-functional per spec, and the engine normalizes either form at init). The picker lists the embedded names (config `themes` narrows), `?theme=` works, and everything else is unchanged.
|
|
513
515
|
- **Theme generator**: `⌃T` generates a brand-new contract-complete theme (THEMING note) and applies it instantly — press again to re-roll. The roll lives as a `<style data-theme data-generated>` block appended last in `<head>` (wins the cascade over the link/inline base); cycling `<`/`>` or picking another theme deactivates it but keeps it in the theme list under its autoname (`gen-<word>-<hex4>`) until the next roll replaces it. The picker's first row is **“✨ Generate new…”**: selecting it rolls a candidate and previews it live like any other theme (`⌃T` re-rolls while selected; `Enter` applies). Previews for generated and saved-custom themes carry their tokens in the URL — `?gen=<base64url {name, tokens}>` — which the engine applies statelessly at init (works on `file://` and inside bundles). The preview deck loads **once per picker session**; subsequent selections are postMessage'd into the embedded instance (`{__decklightPreview: {theme|gen}}`, parent-origin-guarded) and applied in place — no document reload per candidate, which matters in bundles where each reload would re-parse the whole payload. `⌃⇧T` **saves** the applied generated theme: prompts for a name (sanitized `[a-z0-9-]{1,40}`, `custom-` prefixed on collision with a shipped name), persists `{name → tokens}` into `localStorage['decklight-custom-themes']`, and downloads `<name>.css` (a normal theme file). Saved customs appear in the theme list and picker (tagged “custom”), survive reload, and apply via the same inline-style mechanism — but localStorage is per-origin/per-browser: **the downloaded .css is the portable artifact** (drop it into `themes/` and commit). Unsaved generated autonames are never persisted as the deck's theme choice.
|
|
514
516
|
- **Brand logo**: `init({ logo: { onLight, onDark, src?, height?, position? } })` renders a mark as chrome on every slide (default `bottom-left`; also `top-left|top-right|bottom-right`; default height 30px). `onLight`/`onDark` are the variants for light/dark canvases: the engine reads the applied theme's real background luminance (first gradient stop for gradient canvases), sets `data-canvas="dark|light"` on the root, and the matching variant shows — following theme cycling, the picker, and generated themes ( `src` alone shows always). Refs resolve as `'#id'` (clones an inline element — bundle- and `file://`-safe, the `data-cast-inline` idiom), `'<svg…'` raw markup, or an `<img>` URL. In `?print`, every slide gets its own copy. **Hero variant**: `data-logo` on a section prepends a larger in-flow copy of the mark above the slide's content (default 96 design px; `data-logo="128"` overrides) — module openers and cover slides. Hero slides hide the corner chrome (and skip the print copy), the mark doesn't count as pinnable content, and the same on-light/on-dark variant switching applies.
|
|
515
|
-
- **Narration**: `⎵` plays and pauses the voice; `V` opens the panel — track, live voice, engine, tone, character, recording, captions, speed (persisted per deck). Two sources. **Recorded**: pre-rendered per-slide audio (`<dir>/slide-NN.m4a`, 1-based like `state.slide`), synced to slide changes; the deck configures `narration: { files: '<dir>' }` or `[{ label, dir }, …]` for several takes. **A recorded track can pace the builds, not just the slides.** `tools/voiceover.mjs` already writes one file per `⟨CLICK⟩` segment (`<dir>/slide-NN-KK.m4a`, KK 1-based over the segments that produced audio — empty segments produce none, so the file number is not the step number) and lists them as `slides[i].segments`; a track carrying them reveals build step k when segment k ends, which is the build-synced pacing the live voice has, from a recording. On a **directory** track it is opt-in — `narration: { files: '<dir>', segments: true }`, off again with `segments: false` — because the runtime cannot see the folder and must not guess. A **manifest** track needs no flag, the manifest being the list of what exists; except on a *signed* one, where a segment counts only if it carries a `url` of its own. `publish-voices.mjs` writes those urls — every beat is uploaded and signed alongside its slide — and the rule stands anyway, because a manifest published before it did lists beats whose bytes never left the author's disk, and a signature is the only thing that tells the two apart. Whether a track paces itself is settled **once**, when narration starts, from what the track declares — never by probing for a file, which neither `file://` nor a CORS-less bucket can answer. A slide recorded whole inside such a track still plays as one file and then advances; a surplus `⟨CLICK⟩` beyond the slide's builds is chained onto the last step exactly as the live voice chains it. A missing FIRST segment falls back to the whole-slide file; one missing mid-slide has nothing to fall back to, so the deck stops and names it — the voice is the clock. The character keeps up: `tools/lipsync.mjs` cuts a sidecar per beat too (`slide-NN-KK.visemes.json`, from that beat's own `slide-NN-KK.txt` as the dialog hint), the synthesized recorder writes them beside its beat WAVs, and `decklight bundle` inlines them under the same stem. A beat with no sidecar animates from amplitude rather than replaying the slide's timeline — which would start at zero against every beat and be confidently wrong. The talking-head *video* stays per slide: a clip is minutes of GPU time and the element mirrors the audio's transport rather than seeking a timeline, so cutting it per beat would cost a great deal to fix a smaller error. **Both recorders write those beats.** the panel's `Record this deck…` stitches them from the live voice's own sentence cache alongside the whole-slide file it always wrote — so a synthesized track gains build-pacing for free, with no second pass — and **the panel's `Record this deck…` records them in your own voice**, for which `decklight record <deck.html>` is the door: a browser will not open a microphone for a `file://` page (getUserMedia needs a secure context, and `http://127.0.0.1` is one), so the command serves the deck and opens it at `?record` — your-voice recorder on a `file://` deck says exactly that instead of failing silently. The deck is the teleprompter: it shows one ⟨CLICK⟩ beat at a time at the build that beat plays over, and `→` ends the take *and* reveals the next build — one gesture, so the timing you record is the timing you will present. `⌫` retakes the beat just read, `Esc` stops (every slide already finished is already written). Capture is WebAudio → 16-bit PCM → `stitchWav`, at 24 kHz mono like every engine's output — not MediaRecorder, whose webm/opus nothing else here reads, and not an AudioWorklet, whose module would have to come from a `blob:` URL that `decklight present`'s `script-src 'self' 'unsafe-inline'` forbids. Each slide is written twice by EITHER recorder: one `slide-NN-KK.wav` per beat, and the whole-slide `slide-NN.wav`, so `lipsync.mjs`, `video.mjs` and a deck that never opts in all keep working — the layout on disk says nothing about which recorder made it. A beat file carries neither the segment-sized silence that separates beats (it belongs between them, not at the head of one) nor the slide's trailing `data-narration-pause` — and neither does the **whole-slide file**, nor the viseme timeline beside it: `advanceFrom` honours every pause at play time for recorded and live tracks alike, so baking one into a file as well would hold twice (which the whole-slide file quietly did until the pause gained a non-zero default and the double showed). A slide the tool would not have segmented (fewer than two beats with words in them) is one take and no segment files, the same threshold `tools/voiceover.mjs` gives up at; a slide with builds but no ⟨CLICK⟩ is recorded whole and says so on the card, because that is an authoring gap and the moment you are reading its notes aloud is the moment to learn about it. Files are written through the author server (`POST /edit/record`, which is told a folder and a beat number and builds the name itself), and fall back to the browser's download folder when there is none — **saying which of the three reasons** applies, because where the files went is not something a presenter can act on and why they went there is. Whether a server exists is **awaited, never sampled**: the probe answers asynchronously and a recorder that read it early sent whole takes to the download folder because the answer had not arrived yet, not because there was no server. A deck opened with `?record` that finds no server is the loud case — that parameter means one was started, so something else is holding the port for another deck — and it says so on the intro card, before the first beat rather than after the last. **A TRACK IS A FOLDER**, and the recorders name it after the voice: a deck carries as many tracks as you have voices — several cloned ones, the system voice, two takes of your own — and `N` is the switcher, so a single `voiceover` default meant recording a second voice erased the first with nothing said. The folder is chosen by four rules in order: `--dir`/`?dir=` (asked for out loud); a folder whose `manifest.json` names this same engine and voice (a re-record **refreshes** its take rather than accumulating `-2`, `-3`); the deck's own single configured folder (a deck that names one place has decided); else `voices/<voice>`, suffixed past anything already there. `GET /edit/tracks` is how the deck finds out what exists — it cannot see the filesystem, which is why `segments: true` is opt-in at all — and the proposal is shown on the card as an **editable field** before recording starts, because a proposal that cannot be corrected is a decision made somewhere else. The done card then **offers to point the deck at what it just wrote** — `POST /edit/narration` **adds** the track to `narration.files` (updating in place when that folder is already listed, never duplicating a row) through the same `applyEdit` door every other edit uses; the one-string form becomes a one-element list carrying the same `ext`/`segments`, which is the shape `narrationTracks()` normalises it to anyway, so `Z` takes it back and live-reload shows it. A button rather than automatic: editing someone's deck the moment a recording ends is the wrong default even with undo behind it, and the offer is absent exactly where it could not work (no author server → the card prints the line, as before). The call site is located by the same classifier `audit` and `upgrade` use, and its argument walked with strings skipped, because `{ title: 'Acme (Inc)' }` is a deck that did nothing wrong. A deck that builds its config elsewhere (`const cfg = {…}; Decklight.init(cfg)`) has no literal to edit: that is **refused with the reason**, never guessed at. `decklight record --slides a-b` re-records a range and leaves every other slide's files alone — recording starts at slide 1 and cannot skip, so without it a fluffed beat on slide 30 costs 29 slides of reading. A `dir` may be an absolute URL, so a **public** bucket has always served a track with no extra machinery (`dir: 'https://storage.googleapis.com/…/algenib'` — media elements load cross-origin without asking). **Manifest tracks** exist for the case a `dir` cannot express: `[{ label, manifest: 'voices/algenib/manifest.signed.json' }, …]` fetches a small JSON list once when narration starts and plays each slide's URL **verbatim**, because a presigned URL carries its signature in the query string and a query string can never be a directory prefix. The manifest is the file `tools/voiceover.mjs` already writes (`{engine, voice, style, slides: [{file, hash}]}`), extended with an optional per-slide `url` and a top-level `expires` (ISO 8601); a slide with no `url` resolves its `file` next to the manifest, so an unsigned `manifest.json` in a public bucket is a track for free, and a `null` slide (no notes, no file) is silence rather than a failure. `tools/publish-voices.mjs <dir> --bucket gs://… [--sign 7d]` uploads the files whose hash moved (the last `manifest.signed.json` is the record of what is already up there; `--all` overrides), signs every one through `gcloud storage sign-url` — never our own key handling — and writes `manifest.signed.json` to deploy beside the deck while the megabytes stay in the bucket. It refuses a `--sign` longer than **7 days**, the V4 signing scheme's own ceiling, and names the public-bucket alternative for audio that must outlive a week. Signatures expiring is one more way for the voice to be unplayable, so it behaves like all the others: the expiry is checked before the first clip, narration turns off, auto-advance stops, and the message names the track, the date, and the literal re-sign command (the manifest records the `source`, `bucket` and `signDuration` it was made with, so it is a line to re-run and not a shape to fill in). A signed file that fails to load is treated the same way — a media element cannot report an HTTP status, so a 403 for a lapsed signature is indistinguishable from any other failure, and naming the only cause worth naming beats staying silent. `N` shows a manifest track with a ☁ and the time left. `decklight bundle` **inlines the manifest** under its own path (`data-decklight-voices`), like the viseme sidecars, because `fetch` is dead on `file://`; the audio stays in the bucket, which is the whole point. One honest caveat: the character overlay's `amplitude` fallback reads the audio through WebAudio, and cross-origin media taints that unless the bucket sends CORS headers — viseme sidecars are same-origin JSON and are unaffected. **Live voice**: the player synthesizes each slide's notes on the fly through the local bridge (`decklight tts`, default `http://127.0.0.1:8787/tts`, override via `narration.liveUrl`). The bridge speaks with one engine at a time — six built in (`--engine`, tools/tts-engines.mjs), plus any installed one — and the deck can change which: **gemini** (gemini-2.5-{pro,flash}-tts on Vertex AI — a delivery style always reaches it; no free tier, and a fresh project's per-minute quota 429s under the lookahead's bursts), **chirp** (Chirp 3: HD on the Cloud Text-to-Speech API — the same 30 star-named voices, ~1s a sentence, 1M characters a month free, no style channel), **piper** (a local neural model — offline, unlimited, free, no credentials; one voice per installed model, and the process is held RESIDENT because piper reloads its ~120 MB model on every start), or **elevenlabs** (your own ElevenLabs account's voices — the ones you *cloned* included, which is the reason it exists). The first three know their roster up front; ElevenLabs cannot, because the interesting voices are yours, so it fetches the account's list once and `/ping` and `/voices` await it — **your** voices first (cloned, then professional, then premade), each tagged with where it came from, and the picker's default is the first of them. The player sends a voice NAME; a `voice_id` pasted from the dashboard resolves too. Its key is read from `$ELEVENLABS_API_KEY` and is **never written to `tts.json`** — decklight remembers the choice and leaves the secret to your environment. Style reaches it only through `--tts-model eleven_v3` (`stylable` follows the model chosen, not just the engine): v3 reads a short bracketed **audio tag** ahead of the sentence as performance direction — never the Gemini-shaped prose instruction, and never sent to any other ElevenLabs model, where the brackets would just be read aloud as words instead of shaping them. An optional `--tts-stability creative|natural|robust` (v3 only; refused up front on any other model rather than silently doing nothing) trades how hard v3 follows the tag against how much it drifts, and is left alone entirely — no `voice_settings` sent at all — when unasked. Both the tag and the sentence it directs are billed as the characters actually sent, and it is metered in characters against a plan rate decklight cannot see, so the bridge reports characters rather than inventing a dollar figure. Audio is `pcm_24000` wrapped as WAV like every other engine; `--tts-format mp3` is the escape hatch for plans without PCM output and costs you the panel's `Record this deck…` offline recording and the lip-sync bridge, both of which read WAV — so it is opt-in, never a silent downgrade. `GET /ping` reports `{engine, model, voices, stylable}` and the picker offers exactly those voices, skipping the tone step when the engine cannot be told how to speak — a roster the bridge cannot pronounce would be a silent lie. **Which engine is itself a choice the deck can make**: `GET /engines` lists every engine with its price note and, for the ones this machine cannot use, what is missing; `POST /engine {engine}` swaps the live one. The picker hangs off the voices view (`N` → live voice → *engine*), because the engine decides the whole roster and that is the screen where you notice the names are not the ones you wanted. **The readiness check is shared with `decklight author`** (`engineStatus`, tools/tts-engines.mjs) and only its phrasing differs — a picker offering an engine `author` would have refused to start is a picker that lies — and it is asked BEFORE the engine is built, because gemini and chirp construct perfectly well against an unchecked project and fail on the first sentence, which mid-talk is a keypress into silence. A swap re-runs the same stale-voice rule a first probe does, and the response cache is keyed by engine name, so switching back replays instantly rather than re-billing. **An engine that cannot be used is shown, dimmed, with the terminal command that fixes it** — hiding it would answer "where did ElevenLabs go?" with silence — and every fix is something you do in a terminal: the deck lists what is missing and never collects it, because a key or a project id typed into a web page (even one on loopback) is a different thing from one exported in a shell, and a deck under `--remote` is reachable from a phone. **The choice is not persisted.** `tts.json` is what the CLI and the wizard write and what the next `decklight author` starts with; an experiment two minutes before a talk must not quietly become tomorrow's default. The bridge keeps it until restarted, so it survives a reload. The bridge is probed when live narration **starts**, not only when the picker opens, and a saved voice the live bridge does not have is treated as **stale rather than chosen**: it came from a different engine (the star roster is the default, and an ElevenLabs key knows none of those names), so the bridge's first voice takes over, is persisted, and the swap is announced — a voice changing on its own must never be silent. **The voice already on the machine**: with no engine chosen, none saved, and no cloud project, `decklight author` asks the operating system what it can speak with before defaulting to an engine that would only be skipped. **macOS** is read through `say -v '?'` — the roster mixes twenty years of engines, so voices are ranked and shown by **quality category**: *best* (a **Personal Voice** the user recorded, and **Siri** voices — recognisable on current macOS only by their sample sentence, the name markers having disappeared from the listing), *good* (Premium/Neural, then Enhanced), *average* (plain built-ins, and the **robots** — Albert, Zarvox, Bad News and the rest of the novelty/formant roster, pinned there by name and listed last, because they sort alphabetically first and once narrated decks by default). The categories render as labelled shelves in the picker, and only the deck's language gets them: the **novelty tail** (robots and the 2022 persona family — Eddy, Flo, Grandma, Grandpa, Reed, Rocko, Sandy, Shelley) and **every other-language voice** each fold to a single expandable row (`‣ novelty voices (26)` · `‣ other languages (140)`), expanded per picker-open and never persisted — a real Mac answers ~184 names, and ~165 of them were the reason "which voice is good here" was unanswerable. When no best-tier voice is installed, the BEST shelf holds an actionable row — *⬇ Get Siri voices — free download* — whose commit asks the bridge's `POST /voices/install` to open the macOS voice-download pane: darwin-only, loopback-only, and the argv is a **frozen constant** (`open x-apple.systempreferences:…`) that no byte of any request reaches; the download itself stays a human clicking through, which is the point of the pane. This is the ONE exec a deck may trigger, and it opens a Settings pane and nothing else. A Mac whose best voice speaks Italian must still not narrate an English deck with it. A Siri voice hiding behind a **duplicate display name** (how current macOS lists them) is dropped rather than offered — `say -v` addresses by name, so that row would play a different voice than it names. A machine with **no best-tier voice** is told, on the caveat channel every engine already has (the bridge's startup line, the deck's toast): Siri voices are a free download away, with the Settings path and the `open "x-apple.systempreferences:…"` command that gets there — suggested, never run, because only a person can click through a voice download. **Windows** is read through PowerShell — the **WinRT** stack first (`Windows.Media.SpeechSynthesis`, projected from Windows PowerShell 5.1), because that is where the **natural** voices live (Aria, Jenny, Guy — the neural ones Narrator and Edge use, and the closest thing Windows has to Siri); `System.Speech`, the 2006 API that sees only David, Zira and Mark, is the fallback for a PowerShell that cannot project. Synthesis goes through whichever stack listed the voice, and a name the machine does not have throws rather than falling back to the default voice. A machine with no natural voice installed is told where they are — Settings → Accessibility → Narrator → *Add natural voices* — on the same caveat channel and with the same picker row as macOS's Siri hint (`start ms-settings:easeofaccess-narrator`, a frozen argv, is the one exec that row may trigger there). Both become real bridge engines (`--tts-engine say|sapi`), synthesizing 24 kHz PCM in a WAV like every other engine, `stylable: false` so the picker skips the tone step. **Android** is detected and refused with the reason: Termux reports `android` and runs Node, but Android's TextToSpeech is an in-process Java API with no command line behind it, so there is nothing for a bridge to call — the honest path there is a recorded track, which needs no bridge. A native voice is the ONLY engine claimed automatically, because it is the only one that needs no setup at all; **piper is never auto-selected even when it is on PATH**, since it needs a toolchain and a ~120 MB model and that choice belongs to the first-run wizard, which saves it. Any `--tts-engine`, `--project`, `GOOGLE_CLOUD_PROJECT` or saved config wins outright and detection is never consulted. When a machine has nothing, the skip line says what THIS machine lacks and names piper; and if **Ollama** is answering on 127.0.0.1:11434 (a ~300 ms probe, raced against a timeout so a hung socket cannot stall startup) it adds that Ollama serves LLMs and has no speech endpoint — the single most common thing a local-AI user expects to cover this. **A missing piper voice is caught before the bridge starts, not by it**: piper installed and chosen but with no model on disk used to bring the bridge up looking healthy and fail on the first sentence — a keypress into silence, for a file that was never there. `decklight author` now checks, names the model, its directory and its size, and on a **TTY** offers to fetch it; accepting re-plans so the bridge joins the session, declining or a non-TTY run keeps the skip line. **Nothing is ever downloaded silently.** The command it runs is chosen for the machine (`tools/tts-engines.mjs`): a python that can already import piper gets `python -m piper.download_voices`, and otherwise `uvx --from piper-tts` runs it inside the isolated venv `uv tool install piper-tts` creates — the plain form cannot work there, which is why it used to fail with `ModuleNotFoundError` on a machine that had just followed decklight's own install instruction. **First-run setup**: the first time the bridge cannot start — a bare `decklight tts`, or `decklight author` about to skip the voice because nothing is configured — decklight asks a few plain questions on the terminal (TTY only) instead of exiting with the engine's error: the engine, with the free/offline/cloud trade-offs stated and the default following what the machine already has (an `$ELEVENLABS_API_KEY` outranks everything — nobody exports one by accident; else piper on `PATH`, else a project visible in the environment or gcloud config), then only that engine's prerequisites — a GCP project id (prefilled, validated with the same rule the flags enforce) plus a credentials probe for the cloud engines; for piper the install and voice-model download commands, run only on an explicit yes; for elevenlabs nothing at all when the key is exported (the roster answers "which voice", so it is not asked) and otherwise where to make a key and why setup will not save it for you. Setup proves the choice with one real synthesis of the picker's preview sentence, reporting duration and the engine's cost note, and only a config that has spoken is saved — to `~/.config/decklight/tts.json` (`$XDG_CONFIG_HOME` honored), which both `decklight tts` and `decklight author` read from then on; precedence is flags > environment > saved config > built-in default. `decklight tts --setup` re-runs the questions, deleting the file resets to first-run, and non-TTY invocations never prompt — exit codes and messages stay as they were. **The voice is the clock**: auto-advance is driven by narration finishing, so when the voice CANNOT be played — a quota 429, an unreachable bridge, a browser that blocked autoplay, a recorded track with no file for this slide — the deck **stops advancing** rather than walking the talk past slides nobody has heard, and says why in a message (`I`) naming the cause and the way out (`--tts-engine chirp` for a 429, `decklight tts` for a dead bridge, one click for blocked audio). Narration switches itself off; `V` retries — the picker drills tracks → voice (30 prebuilt Gemini/Chirp names, one piper model, an OS voice, or the ElevenLabs account's own roster) → tone, on any engine `/ping` reports as `stylable` (six presets or a custom typed instruction — a prompt prefix for gemini, a short bracketed audio tag for ElevenLabs `eleven_v3`). Every voice row carries a ▶ **preview** that speaks an editable test sentence (default "Hey, this is Decklight", input at the top of the voices view, ↺ restores the default) through the bridge in that voice; tone rows preview the drafted voice in that delivery style, and the custom-tone input has a ▶ to audition a typed instruction before committing it. After a preview plays, the rest of its roster prefetches sequentially in the background (all voices neutrally, or all tones for the drafted voice). Two preview caches: the default sentence's cache is permanent once built; the custom sentence's cache holds exactly one sentence and is swapped (old audio freed) when the text changes. **Build-synced auto-advance**: the ⟨CLICK⟩ markers that segment the notes for the speaker view segment the audio too — segment k is synthesized as its own clip and narrates build step k (0 = arrival); when a clip ends the deck reveals the next build, and after the last segment it moves to the next slide, so a deck with well-segmented notes presents itself beat by beat. **More segments than builds** — the commonest case being a slide with no `data-build` at all, which has exactly one step — used to drop every surplus segment: never synthesized, never spoken, never mentioned, while the speaker view went on displaying it, so the presenter read a cue the deck would never say. The surplus now rides on the **last** step. There is nothing left to reveal, so the marker becomes a beat rather than a build trigger — the same call `tools/video.mjs` makes for a count that does not line up, and the same one the panel's `Record this deck…` stitching and the viseme sidecars make, each giving a folded segment a segment-sized silence rather than a sentence-sized one so a recorded take breathes where the live one does. The counts disagreeing is still nearly always an authoring slip, so it is named once per slide in the message log (`I`) and the debug log — never toasted, because it is a note about the deck rather than something to act on mid-sentence. The opposite mismatch needs no rule: fewer segments than builds already advances after a short beat, losing nothing. A segment with no words advances after a short beat; a slide with no notes is skipped; manual navigation mid-clip wins over the pending advance and re-syncs the voice to the new step. **Between sentences the voice breathes 0.25s by default** — the pause a reader takes at a full stop, which a chain of separately synthesized clips otherwise lacks — overridable for the deck (`narration: { sentencePause: 0.5 }`) and per slide (`data-narration-sentence-pause="0"`, where an explicit zero is zero); a typo falls through to the next tier, never to silence. the panel's `Record this deck…` stitches the same breath between sentences, so a recorded take paces a slide exactly as the live voice did. **Every pause resolves the same three tiers** — the slide's attribute, else the deck's `narration: { sentencePause, beatPause, slidePause }`, else the built-in default (0.25s between sentences, **0.5s between builds, 1s before the slide turns**) — opt-*out* rather than opt-in, because a deck that talks straight through its own punctuation is the behaviour nobody asks for on purpose; so a deck can breathe uniformly from one line of config and a single slide can still say otherwise, down to `"0"`; an unparseable value at either tier falls through, never to silence. **`data-narration-beat-pause="0.5"`** is the same breath **between builds**: each bullet lands, holds that many seconds, and only then does the voice reveal the next — honored at play time for live and recorded tracks alike, never baked into a recording, and malformed values read as no pause, exactly like its end-of-slide sibling. **`data-narration="hold"`** on a section marks it interactive (quiz, exercise, live demo): narration plays whatever notes it has and builds still sync, but the deck never auto-advances *off* it — the presenter moves on manually and narration resumes on the next slide. The spoken unit is a **sentence**: each ⟨CLICK⟩ segment splits into sentences, every sentence is its own TTS call and cache entry (slide, segment, sentence, voice, style), playback chains them and advances only after the segment's last one — so first audio arrives after one short synthesis, never a whole paragraph. While narration is on, a **lookahead buffer** keeps the next 10 sentences synthesized in the background (a few parallel low-priority workers, window re-derived from the current position, results landing in the same cache); an unreachable bridge toasts once and pauses the buffer until the next event. the panel's `Record this deck…` records per-slide `slide-NN.wav` files **stitched from this same sentence cache** (short silences joining sentences and builds) — already-heard clips cost nothing, only unheard sentences synthesize. **They are written next to the deck, not downloaded**: in author mode each stitched slide is POSTed to the server that already owns the deck file (`/edit/record`), which writes it — and the character's `slide-NN.visemes.json` sidecar — into the deck's own `narration.files` folder, or `voiceover/` when the deck names none. That is the only place `narration.files` can point at and the only place `decklight bundle` looks, so the recording is finished where the next command reads it; the browser's download folder is neither, and is now the FALLBACK for the cases nothing may write to disk — a `file://` deck, or one served read-only by `decklight present`. The player names the folder and never the file: `/edit/record` builds `slide-NN.wav` itself and refuses a folder that resolves outside the served root, so the write surface a recording opens is one directory of one deck. The card that ends the recording says which of the two happened and, on disk, the exact `narration: { files, ext: 'wav' }` line that plays the set back. **`P` pauses/resumes** narration — audio freezes mid-sentence and resumes exactly there, and auto-advance holds while paused. Captions (`C`) follow the voice **sentence by sentence** during live narration (segment-level when narration is off). With nothing configured, `V` opens the picker instead of failing. **The deck announces its own voice**: when a recorded track is configured, a small pill fades in bottom-center about a second after load — *🔊 this deck has a voice-over — `V` plays it* — and clicking it starts narration (the click is itself the user gesture, so the audio is never the blocked-autoplay case). It fades out on its own after ~12s and is written to the message log (`I`) rather than toasted, since the pill is already on screen saying it. It never appears in `?print`, in embedded previews (the theme picker and slide finder boot real decks in iframes), under `?voiceover` (which starts on the first gesture anyway), while captions (`C`) hold that same corner, or once narration has been started on this deck — remembered per deck path like every other narration preference. Without it the only proactive surface was the touch sound button, which CSS shows on `pointer: coarse` alone, so a viewer on a laptop could only learn the deck talks from a key nobody had mentioned. Files are generated by **`decklight voiceover <deck.html>`** (the dispatcher spawns `tools/voiceover.mjs`, which arg-parses at load and so cannot be imported — the same way `video --voiceover` runs it) — the headless counterpart of the deck's the panel's `Record this deck…`: notes → optional local-LLM rewrite → `--engine piper` (local neural TTS; `--voice` = piper model name) or `--engine gemini` (gemini-2.5-pro-tts on Vertex AI; `--voice` = prebuilt voice name). The built-in speech-synthesis voices were removed — not good enough. `?voiceover` starts narration on the first user gesture. `instance.toggleNarration()` programmatically.
|
|
517
|
+
- **Narration**: `⎵` plays and pauses the voice; `V` opens the panel — **off**, track, live voice, engine, tone, character, recording, captions, speed (persisted per deck). **Narration is OFF until somebody picks**, however much audio the deck ships: a deck is opened to be read far more often than to be played, and defaulting to the first track made "chosen" indistinguishable from "shipped" — the distinction every other decision here needs. `⎵` belongs to the voice only once a track is CHOSEN (in the panel, or restored from a previous visit, both deliberate) or the voice is already running or parked; a deck that merely carries a track keeps `⎵` for advancing, so a presenter talking over their own slides cannot start the narration by pressing it. The panel's first row is `🔇 Off`, current when nothing is chosen, and picking it stops the voice and hands `⎵` back. The choice is written as `off` rather than left implied, so a later change to what "no choice" means cannot start a deck talking that somebody switched off. Two entry points are themselves the choosing and select a track rather than refusing: `?voiceover`, where the url is the request, and the touch sound button, where a speaker icon has one meaning and the phone tapping it has no `V` key to be redirected to; neither persists, being a request for this visit rather than every future one. Two sources. **Recorded**: pre-rendered per-slide audio (`<dir>/slide-NN.m4a`, 1-based like `state.slide`), synced to slide changes; the deck configures `narration: { files: '<dir>' }` or `[{ label, dir }, …]` for several takes. **A recorded track can pace the builds, not just the slides.** `tools/voiceover.mjs` already writes one file per `⟨CLICK⟩` segment (`<dir>/slide-NN-KK.m4a`, KK 1-based over the segments that produced audio — empty segments produce none, so the file number is not the step number) and lists them as `slides[i].segments`; a track carrying them reveals build step k when segment k ends, which is the build-synced pacing the live voice has, from a recording. On a **directory** track it is opt-in — `narration: { files: '<dir>', segments: true }`, off again with `segments: false` — because the runtime cannot see the folder and must not guess. A **manifest** track needs no flag, the manifest being the list of what exists; except on a *signed* one, where a segment counts only if it carries a `url` of its own. `publish-voices.mjs` writes those urls — every beat is uploaded and signed alongside its slide — and the rule stands anyway, because a manifest published before it did lists beats whose bytes never left the author's disk, and a signature is the only thing that tells the two apart. Whether a track paces itself is settled **once**, when narration starts, from what the track declares — never by probing for a file, which neither `file://` nor a CORS-less bucket can answer. A slide recorded whole inside such a track still plays as one file and then advances; a surplus `⟨CLICK⟩` beyond the slide's builds is chained onto the last step exactly as the live voice chains it. A missing FIRST segment falls back to the whole-slide file; one missing mid-slide has nothing to fall back to, so the deck stops and names it — the voice is the clock. The character keeps up: `tools/lipsync.mjs` cuts a sidecar per beat too (`slide-NN-KK.visemes.json`, from that beat's own `slide-NN-KK.txt` as the dialog hint), the synthesized recorder writes them beside its beat WAVs, and `decklight bundle` inlines them under the same stem. A beat with no sidecar animates from amplitude rather than replaying the slide's timeline — which would start at zero against every beat and be confidently wrong. The talking-head *video* stays per slide: a clip is minutes of GPU time and the element mirrors the audio's transport rather than seeking a timeline, so cutting it per beat would cost a great deal to fix a smaller error. **Both recorders write those beats.** the panel's `Record this deck…` stitches them from the live voice's own sentence cache alongside the whole-slide file it always wrote — so a synthesized track gains build-pacing for free, with no second pass — and **the panel's `Record this deck…` records them in your own voice**, for which `decklight record <deck.html>` is the door: a browser will not open a microphone for a `file://` page (getUserMedia needs a secure context, and `http://127.0.0.1` is one), so the command serves the deck and opens it at `?record` — your-voice recorder on a `file://` deck says exactly that instead of failing silently. The deck is the teleprompter: it shows one ⟨CLICK⟩ beat at a time at the build that beat plays over, and `→` ends the take *and* reveals the next build — one gesture, so the timing you record is the timing you will present. `⌫` retakes the beat just read, `Esc` stops (every slide already finished is already written). Capture is WebAudio → 16-bit PCM → `stitchWav`, at 24 kHz mono like every engine's output — not MediaRecorder, whose webm/opus nothing else here reads, and not an AudioWorklet, whose module would have to come from a `blob:` URL that `decklight present`'s `script-src 'self' 'unsafe-inline'` forbids. Each slide is written twice by EITHER recorder: one `slide-NN-KK.wav` per beat, and the whole-slide `slide-NN.wav`, so `lipsync.mjs`, `video.mjs` and a deck that never opts in all keep working — the layout on disk says nothing about which recorder made it. A beat file carries neither the segment-sized silence that separates beats (it belongs between them, not at the head of one) nor the slide's trailing `data-narration-pause` — and neither does the **whole-slide file**, nor the viseme timeline beside it: `advanceFrom` honours every pause at play time for recorded and live tracks alike, so baking one into a file as well would hold twice (which the whole-slide file quietly did until the pause gained a non-zero default and the double showed). A slide the tool would not have segmented (fewer than two beats with words in them) is one take and no segment files, the same threshold `tools/voiceover.mjs` gives up at; a slide with builds but no ⟨CLICK⟩ is recorded whole and says so on the card, because that is an authoring gap and the moment you are reading its notes aloud is the moment to learn about it. Files are written through the author server (`POST /edit/record`, which is told a folder and a beat number and builds the name itself), and fall back to the browser's download folder when there is none — **saying which of the three reasons** applies, because where the files went is not something a presenter can act on and why they went there is. Whether a server exists is **awaited, never sampled**: the probe answers asynchronously and a recorder that read it early sent whole takes to the download folder because the answer had not arrived yet, not because there was no server. A deck opened with `?record` that finds no server is the loud case — that parameter means one was started, so something else is holding the port for another deck — and it says so on the intro card, before the first beat rather than after the last. **A TRACK IS A FOLDER**, and the recorders name it after the voice: a deck carries as many tracks as you have voices — several cloned ones, the system voice, two takes of your own — and `N` is the switcher, so a single `voiceover` default meant recording a second voice erased the first with nothing said. The folder is chosen by four rules in order: `--dir`/`?dir=` (asked for out loud); a folder whose `manifest.json` names this same engine and voice (a re-record **refreshes** its take rather than accumulating `-2`, `-3`); the deck's own single configured folder (a deck that names one place has decided); else `voices/<voice>`, suffixed past anything already there. `GET /edit/tracks` is how the deck finds out what exists — it cannot see the filesystem, which is why `segments: true` is opt-in at all — and the proposal is shown on the card as an **editable field** before recording starts, because a proposal that cannot be corrected is a decision made somewhere else. The done card then **offers to point the deck at what it just wrote** — `POST /edit/narration` **adds** the track to `narration.files` (updating in place when that folder is already listed, never duplicating a row) through the same `applyEdit` door every other edit uses; the one-string form becomes a one-element list carrying the same `ext`/`segments`, which is the shape `narrationTracks()` normalises it to anyway, so `Z` takes it back and live-reload shows it. A button rather than automatic: editing someone's deck the moment a recording ends is the wrong default even with undo behind it, and the offer is absent exactly where it could not work (no author server → the card prints the line, as before). The call site is located by the same classifier `audit` and `upgrade` use, and its argument walked with strings skipped, because `{ title: 'Acme (Inc)' }` is a deck that did nothing wrong. A deck that builds its config elsewhere (`const cfg = {…}; Decklight.init(cfg)`) has no literal to edit: that is **refused with the reason**, never guessed at. `decklight record --slides a-b` re-records a range and leaves every other slide's files alone — recording starts at slide 1 and cannot skip, so without it a fluffed beat on slide 30 costs 29 slides of reading. A `dir` may be an absolute URL, so a **public** bucket has always served a track with no extra machinery (`dir: 'https://storage.googleapis.com/…/algenib'` — media elements load cross-origin without asking). **Manifest tracks** exist for the case a `dir` cannot express: `[{ label, manifest: 'voices/algenib/manifest.signed.json' }, …]` fetches a small JSON list once when narration starts and plays each slide's URL **verbatim**, because a presigned URL carries its signature in the query string and a query string can never be a directory prefix. The manifest is the file `tools/voiceover.mjs` already writes (`{engine, voice, style, slides: [{file, hash}]}`), extended with an optional per-slide `url` and a top-level `expires` (ISO 8601); a slide with no `url` resolves its `file` next to the manifest, so an unsigned `manifest.json` in a public bucket is a track for free, and a `null` slide (no notes, no file) is silence rather than a failure. `tools/publish-voices.mjs <dir> --bucket gs://… [--sign 7d]` uploads the files whose hash moved (the last `manifest.signed.json` is the record of what is already up there; `--all` overrides), signs every one through `gcloud storage sign-url` — never our own key handling — and writes `manifest.signed.json` to deploy beside the deck while the megabytes stay in the bucket. It refuses a `--sign` longer than **7 days**, the V4 signing scheme's own ceiling, and names the public-bucket alternative for audio that must outlive a week. Signatures expiring is one more way for the voice to be unplayable, so it behaves like all the others: the expiry is checked before the first clip, narration turns off, auto-advance stops, and the message names the track, the date, and the literal re-sign command (the manifest records the `source`, `bucket` and `signDuration` it was made with, so it is a line to re-run and not a shape to fill in). A signed file that fails to load is treated the same way — a media element cannot report an HTTP status, so a 403 for a lapsed signature is indistinguishable from any other failure, and naming the only cause worth naming beats staying silent. `N` shows a manifest track with a ☁ and the time left. `decklight bundle` **inlines the manifest** under its own path (`data-decklight-voices`), like the viseme sidecars, because `fetch` is dead on `file://`; the audio stays in the bucket, which is the whole point. One honest caveat: the character overlay's `amplitude` fallback reads the audio through WebAudio, and cross-origin media taints that unless the bucket sends CORS headers — viseme sidecars are same-origin JSON and are unaffected. **Live voice**: the player synthesizes each slide's notes on the fly through the local bridge (`decklight tts`, default `http://127.0.0.1:8787/tts`, override via `narration.liveUrl`). The bridge speaks with one engine at a time — six built in (`--engine`, tools/tts-engines.mjs), plus any installed one — and the deck can change which: **gemini** (gemini-2.5-{pro,flash}-tts on Vertex AI — a delivery style always reaches it; no free tier, and a fresh project's per-minute quota 429s under the lookahead's bursts), **chirp** (Chirp 3: HD on the Cloud Text-to-Speech API — the same 30 star-named voices, ~1s a sentence, 1M characters a month free, no style channel), **piper** (a local neural model — offline, unlimited, free, no credentials; one voice per installed model, and the process is held RESIDENT because piper reloads its ~120 MB model on every start), or **elevenlabs** (your own ElevenLabs account's voices — the ones you *cloned* included, which is the reason it exists). The first three know their roster up front; ElevenLabs cannot, because the interesting voices are yours, so it fetches the account's list once and `/ping` and `/voices` await it — **your** voices first (cloned, then professional, then premade), each tagged with where it came from, and the picker's default is the first of them. The player sends a voice NAME; a `voice_id` pasted from the dashboard resolves too. Its key is read from `$ELEVENLABS_API_KEY` and is **never written to `tts.json`** — decklight remembers the choice and leaves the secret to your environment. Style reaches it only through `--tts-model eleven_v3` (`stylable` follows the model chosen, not just the engine): v3 reads a short bracketed **audio tag** ahead of the sentence as performance direction — never the Gemini-shaped prose instruction, and never sent to any other ElevenLabs model, where the brackets would just be read aloud as words instead of shaping them. An optional `--tts-stability creative|natural|robust` (v3 only; refused up front on any other model rather than silently doing nothing) trades how hard v3 follows the tag against how much it drifts, and is left alone entirely — no `voice_settings` sent at all — when unasked. Both the tag and the sentence it directs are billed as the characters actually sent, and it is metered in characters against a plan rate decklight cannot see, so the bridge reports characters rather than inventing a dollar figure. Audio is `pcm_24000` wrapped as WAV like every other engine; `--tts-format mp3` is the escape hatch for plans without PCM output and costs you the panel's `Record this deck…` offline recording and the lip-sync bridge, both of which read WAV — so it is opt-in, never a silent downgrade. `GET /ping` reports `{engine, model, voices, stylable}` and the picker offers exactly those voices, skipping the tone step when the engine cannot be told how to speak — a roster the bridge cannot pronounce would be a silent lie. **Which engine is itself a choice the deck can make**: `GET /engines` lists every engine with its price note and, for the ones this machine cannot use, what is missing; `POST /engine {engine}` swaps the live one. The picker hangs off the voices view (`N` → live voice → *engine*), because the engine decides the whole roster and that is the screen where you notice the names are not the ones you wanted. **The readiness check is shared with `decklight author`** (`engineStatus`, tools/tts-engines.mjs) and only its phrasing differs — a picker offering an engine `author` would have refused to start is a picker that lies — and it is asked BEFORE the engine is built, because gemini and chirp construct perfectly well against an unchecked project and fail on the first sentence, which mid-talk is a keypress into silence. A swap re-runs the same stale-voice rule a first probe does, and the response cache is keyed by engine name, so switching back replays instantly rather than re-billing. **Synthesis is cached on disk, for every engine including the paid ones** (`$XDG_CACHE_HOME/decklight/tts`, oldest dropped past 400 MB, `--no-cache` to opt out). The key is `(engine, model, format, voice, style, text)` and it is one function shared by the bridge and `decklight voiceover` (`clipKey`, tools/tts-cache.mjs), because those are separate processes and a deck previewed sentence by sentence in the browser and then batch-recorded was billed twice for identical words. The **model** is in the key, which is what makes caching a cloud engine safe rather than reckless: a server that changes its model underneath us produces a MISS, not a stale clip filed under today's name. **Style is in the key only when the engine can act on it** — every engine but gemini and ElevenLabs v3 ignores a delivery instruction, the deck usually sends none and the CLI defaults to a paragraph, so keying on a style nobody read would make identical audio hash two ways and miss every clip. `voiceover`'s manifest hash is that same key, shortened, so the folder-level skip and the content-level cache cannot disagree about whether a slide changed. **An engine that cannot be used is shown, dimmed, with the terminal command that fixes it** — hiding it would answer "where did ElevenLabs go?" with silence — and every fix is something you do in a terminal: the deck lists what is missing and never collects it, because a key or a project id typed into a web page (even one on loopback) is a different thing from one exported in a shell, and a deck under `--remote` is reachable from a phone. **The choice is not persisted.** `tts.json` is what the CLI and the wizard write and what the next `decklight author` starts with; an experiment two minutes before a talk must not quietly become tomorrow's default. The bridge keeps it until restarted, so it survives a reload. The bridge is probed when live narration **starts**, not only when the picker opens, and a saved voice the live bridge does not have is treated as **stale rather than chosen**: it came from a different engine (the star roster is the default, and an ElevenLabs key knows none of those names), so the bridge's first voice takes over, is persisted, and the swap is announced — a voice changing on its own must never be silent. **The voice already on the machine**: with no engine chosen, none saved, and no cloud project, `decklight author` asks the operating system what it can speak with before defaulting to an engine that would only be skipped. **macOS** is read through `say -v '?'` — the roster mixes twenty years of engines, so voices are ranked and shown by **quality category**: *best* (a **Personal Voice** the user recorded, and **Siri** voices — recognisable on current macOS only by their sample sentence, the name markers having disappeared from the listing), *good* (Premium/Neural, then Enhanced), *average* (plain built-ins, and the **robots** — Albert, Zarvox, Bad News and the rest of the novelty/formant roster, pinned there by name and listed last, because they sort alphabetically first and once narrated decks by default). The categories render as labelled shelves in the picker, and only the deck's language gets them: the **novelty tail** (robots and the 2022 persona family — Eddy, Flo, Grandma, Grandpa, Reed, Rocko, Sandy, Shelley) and **every other-language voice** each fold to a single expandable row (`‣ novelty voices (26)` · `‣ other languages (140)`), expanded per picker-open and never persisted — a real Mac answers ~184 names, and ~165 of them were the reason "which voice is good here" was unanswerable. When no best-tier voice is installed, the BEST shelf holds an actionable row — *⬇ Get Siri voices — free download* — whose commit asks the bridge's `POST /voices/install` to open the macOS voice-download pane: darwin-only, loopback-only, and the argv is a **frozen constant** (`open x-apple.systempreferences:…`) that no byte of any request reaches; the download itself stays a human clicking through, which is the point of the pane. This is the ONE exec a deck may trigger, and it opens a Settings pane and nothing else. A Mac whose best voice speaks Italian must still not narrate an English deck with it. A Siri voice hiding behind a **duplicate display name** (how current macOS lists them) is dropped rather than offered — `say -v` addresses by name, so that row would play a different voice than it names. A machine with **no best-tier voice** is told, on the caveat channel every engine already has (the bridge's startup line, the deck's toast): Siri voices are a free download away, with the Settings path and the `open "x-apple.systempreferences:…"` command that gets there — suggested, never run, because only a person can click through a voice download. **Windows** is read through PowerShell — the **WinRT** stack first (`Windows.Media.SpeechSynthesis`, projected from Windows PowerShell 5.1), because that is where the **natural** voices live (Aria, Jenny, Guy — the neural ones Narrator and Edge use, and the closest thing Windows has to Siri); `System.Speech`, the 2006 API that sees only David, Zira and Mark, is the fallback for a PowerShell that cannot project. Synthesis goes through whichever stack listed the voice, and a name the machine does not have throws rather than falling back to the default voice. A machine with no natural voice installed is told where they are — Settings → Accessibility → Narrator → *Add natural voices* — on the same caveat channel and with the same picker row as macOS's Siri hint (`start ms-settings:easeofaccess-narrator`, a frozen argv, is the one exec that row may trigger there). Both become real bridge engines (`--tts-engine say|sapi`), synthesizing 24 kHz PCM in a WAV like every other engine, `stylable: false` so the picker skips the tone step. **Android** is detected and refused with the reason: Termux reports `android` and runs Node, but Android's TextToSpeech is an in-process Java API with no command line behind it, so there is nothing for a bridge to call — the honest path there is a recorded track, which needs no bridge. A native voice is the ONLY engine claimed automatically, because it is the only one that needs no setup at all; **piper is never auto-selected even when it is on PATH**, since it needs a toolchain and a ~120 MB model and that choice belongs to the first-run wizard, which saves it. Any `--tts-engine`, `--project`, `GOOGLE_CLOUD_PROJECT` or saved config wins outright and detection is never consulted. When a machine has nothing, the skip line says what THIS machine lacks and names piper; and if **Ollama** is answering on 127.0.0.1:11434 (a ~300 ms probe, raced against a timeout so a hung socket cannot stall startup) it adds that Ollama serves LLMs and has no speech endpoint — the single most common thing a local-AI user expects to cover this. **A missing piper voice is caught before the bridge starts, not by it**: piper installed and chosen but with no model on disk used to bring the bridge up looking healthy and fail on the first sentence — a keypress into silence, for a file that was never there. `decklight author` now checks, names the model, its directory and its size, and on a **TTY** offers to fetch it; accepting re-plans so the bridge joins the session, declining or a non-TTY run keeps the skip line. **Nothing is ever downloaded silently.** The command it runs is chosen for the machine (`tools/tts-engines.mjs`): a python that can already import piper gets `python -m piper.download_voices`, and otherwise `uvx --from piper-tts` runs it inside the isolated venv `uv tool install piper-tts` creates — the plain form cannot work there, which is why it used to fail with `ModuleNotFoundError` on a machine that had just followed decklight's own install instruction. **First-run setup**: the first time the bridge cannot start — a bare `decklight tts`, or `decklight author` about to skip the voice because nothing is configured — decklight asks a few plain questions on the terminal (TTY only) instead of exiting with the engine's error: the engine, with the free/offline/cloud trade-offs stated and the default following what the machine already has (an `$ELEVENLABS_API_KEY` outranks everything — nobody exports one by accident; else piper on `PATH`, else a project visible in the environment or gcloud config), then only that engine's prerequisites — a GCP project id (prefilled, validated with the same rule the flags enforce) plus a credentials probe for the cloud engines; for piper the install and voice-model download commands, run only on an explicit yes; for elevenlabs nothing at all when the key is exported (the roster answers "which voice", so it is not asked) and otherwise where to make a key and why setup will not save it for you. Setup proves the choice with one real synthesis of the picker's preview sentence, reporting duration and the engine's cost note, and only a config that has spoken is saved — to `~/.config/decklight/tts.json` (`$XDG_CONFIG_HOME` honored), which both `decklight tts` and `decklight author` read from then on; precedence is flags > environment > saved config > built-in default. `decklight tts --setup` re-runs the questions, deleting the file resets to first-run, and non-TTY invocations never prompt — exit codes and messages stay as they were. **The voice is the clock**: auto-advance is driven by narration finishing, so when the voice CANNOT be played — a quota 429, an unreachable bridge, a browser that blocked autoplay, a recorded track with no file for this slide — the deck **stops advancing** rather than walking the talk past slides nobody has heard, and says why in a message (`I`) naming the cause and the way out (`--tts-engine chirp` for a 429, `decklight tts` for a dead bridge, one click for blocked audio). Narration switches itself off; `V` retries — the picker drills tracks → voice (30 prebuilt Gemini/Chirp names, one piper model, an OS voice, or the ElevenLabs account's own roster) → tone, on any engine `/ping` reports as `stylable` (six presets or a custom typed instruction — a prompt prefix for gemini, a short bracketed audio tag for ElevenLabs `eleven_v3`). Every voice row carries a ▶ **preview** that speaks an editable test sentence (default "Hey, this is Decklight", input at the top of the voices view, ↺ restores the default) through the bridge in that voice; tone rows preview the drafted voice in that delivery style, and the custom-tone input has a ▶ to audition a typed instruction before committing it. After a preview plays, the rest of its roster prefetches sequentially in the background (all voices neutrally, or all tones for the drafted voice). Two preview caches: the default sentence's cache is permanent once built; the custom sentence's cache holds exactly one sentence and is swapped (old audio freed) when the text changes. **Build-synced auto-advance**: the ⟨CLICK⟩ markers that segment the notes for the speaker view segment the audio too — segment k is synthesized as its own clip and narrates build step k (0 = arrival); when a clip ends the deck reveals the next build, and after the last segment it moves to the next slide, so a deck with well-segmented notes presents itself beat by beat. **More segments than builds** — the commonest case being a slide with no `data-build` at all, which has exactly one step — used to drop every surplus segment: never synthesized, never spoken, never mentioned, while the speaker view went on displaying it, so the presenter read a cue the deck would never say. The surplus now rides on the **last** step. There is nothing left to reveal, so the marker becomes a beat rather than a build trigger — the same call `tools/video.mjs` makes for a count that does not line up, and the same one the panel's `Record this deck…` stitching and the viseme sidecars make, each giving a folded segment a segment-sized silence rather than a sentence-sized one so a recorded take breathes where the live one does. The counts disagreeing is still nearly always an authoring slip, so it is named once per slide in the message log (`I`) and the debug log — never toasted, because it is a note about the deck rather than something to act on mid-sentence. The opposite mismatch needs no rule: fewer segments than builds already advances after a short beat, losing nothing. A segment with no words advances after a short beat; a slide with no notes is skipped; manual navigation mid-clip wins over the pending advance and re-syncs the voice to the new step. **Between sentences the voice breathes 0.25s by default** — the pause a reader takes at a full stop, which a chain of separately synthesized clips otherwise lacks — overridable for the deck (`narration: { sentencePause: 0.5 }`) and per slide (`data-narration-sentence-pause="0"`, where an explicit zero is zero); a typo falls through to the next tier, never to silence. the panel's `Record this deck…` stitches the same breath between sentences, so a recorded take paces a slide exactly as the live voice did. **Every pause resolves the same three tiers** — the slide's attribute, else the deck's `narration: { sentencePause, beatPause, slidePause }`, else the built-in default (0.25s between sentences, **0.5s between builds, 1s before the slide turns**) — opt-*out* rather than opt-in, because a deck that talks straight through its own punctuation is the behaviour nobody asks for on purpose; so a deck can breathe uniformly from one line of config and a single slide can still say otherwise, down to `"0"`; an unparseable value at either tier falls through, never to silence. **`data-narration-beat-pause="0.5"`** is the same breath **between builds**: each bullet lands, holds that many seconds, and only then does the voice reveal the next — honored at play time for live and recorded tracks alike, never baked into a recording, and malformed values read as no pause, exactly like its end-of-slide sibling. **`data-narration="hold"`** on a section marks it interactive (quiz, exercise, live demo): narration plays whatever notes it has and builds still sync, but the deck never auto-advances *off* it — the presenter moves on manually and narration resumes on the next slide. The spoken unit is a **sentence**: each ⟨CLICK⟩ segment splits into sentences, every sentence is its own TTS call and cache entry (slide, segment, sentence, voice, style), playback chains them and advances only after the segment's last one — so first audio arrives after one short synthesis, never a whole paragraph. While narration is on, a **lookahead buffer** keeps the next 10 sentences synthesized in the background (a few parallel low-priority workers, window re-derived from the current position, results landing in the same cache); an unreachable bridge toasts once and pauses the buffer until the next event. the panel's `Record this deck…` records per-slide `slide-NN.wav` files **stitched from this same sentence cache** (short silences joining sentences and builds) — already-heard clips cost nothing, only unheard sentences synthesize. **They are written next to the deck, not downloaded**: in author mode each stitched slide is POSTed to the server that already owns the deck file (`/edit/record`), which writes it — and the character's `slide-NN.visemes.json` sidecar — into the deck's own `narration.files` folder, or `voiceover/` when the deck names none. That is the only place `narration.files` can point at and the only place `decklight bundle` looks, so the recording is finished where the next command reads it; the browser's download folder is neither, and is now the FALLBACK for the cases nothing may write to disk — a `file://` deck, or one served read-only by `decklight present`. The player names the folder and never the file: `/edit/record` builds `slide-NN.wav` itself and refuses a folder that resolves outside the served root, so the write surface a recording opens is one directory of one deck. The card that ends the recording says which of the two happened and, on disk, the exact `narration: { files, ext: 'wav' }` line that plays the set back. **`P` pauses/resumes** narration — audio freezes mid-sentence and resumes exactly there, and auto-advance holds while paused. Captions (`C`) follow the voice **sentence by sentence** during live narration (segment-level when narration is off). With nothing configured, `V` opens the picker instead of failing. **The deck announces its own voice**: when a recorded track is configured, a small pill fades in bottom-center about a second after load — *🔊 this deck has a voice-over — `V` plays it* — and clicking it starts narration (the click is itself the user gesture, so the audio is never the blocked-autoplay case). It fades out on its own after ~12s and is written to the message log (`I`) rather than toasted, since the pill is already on screen saying it. It never appears in `?print`, in embedded previews (the theme picker and slide finder boot real decks in iframes), under `?voiceover` (which starts on the first gesture anyway), while captions (`C`) hold that same corner, or once narration has been started on this deck — remembered per deck path like every other narration preference. Without it the only proactive surface was the touch sound button, which CSS shows on `pointer: coarse` alone, so a viewer on a laptop could only learn the deck talks from a key nobody had mentioned. Files are generated by **`decklight voiceover <deck.html>`** (the dispatcher spawns `tools/voiceover.mjs`, which arg-parses at load and so cannot be imported — the same way `video --voiceover` runs it) — the headless counterpart of the deck's the panel's `Record this deck…`: notes → optional local-LLM rewrite → `--engine piper` (local neural TTS; `--voice` = piper model name) or `--engine gemini` (gemini-2.5-pro-tts on Vertex AI; `--voice` = prebuilt voice name). The built-in speech-synthesis voices were removed — not good enough. `?voiceover` starts narration on the first user gesture. `instance.toggleNarration()` programmatically.
|
|
516
518
|
- **Character** (`V` → Character…, or palette → Character…): an animated narrator in a stage corner whose lips sync to the narration — fully offline, no cloud service. Two render modes behind one overlay (`.decklight-character`, persisted per deck): **🎭 2D character** — a layered SVG bust (theme-aware clothing/backdrop, blink, idle sway) with one mouth group per Rhubarb shape (`A–H` + `X` rest); a 30 Hz loop maps `narrAudio.currentTime` onto a **viseme timeline** and shows the matching `[data-mouth]` group, so pause (`P`) and voice speed (`<`/`>`) sync for free. **🎥 Neural video** — a muted picture-in-picture `<video>` talking head (audio always comes from the narration element; muted video is immune to autoplay policy) generated by Wav2Lip or SadTalker on the presenter's own GPU, drift-corrected against the audio clock (±150 ms) and mirroring its play/pause/rate. Timelines and clips come from the **lipsync bridge** (`decklight lipsync`, default `http://127.0.0.1:8789`, override via `narration.character.bridgeUrl`; CORS-open, 127.0.0.1-only, disk-cached in `~/.cache/decklight/lipsync` keyed by audio+params hash): `GET /ping` reports which engines actually resolve (the picker greys out the rest), `POST /viseme?text=` (raw WAV body → timeline JSON v1: `{v, duration, cues: [{t, v}]}` — start-time cues, each shape holds until the next), `POST /video?engine=&portrait=` (raw WAV → muted faststart MP4; strictly serial GPU queue). In **live voice** mode the sentence is the unit here too: the lookahead buffer that keeps 10 sentences of audio warm hands each synthesized sentence's WAV to the bridge, so lip-sync data prefetches through the same window, workers, and promise-cache dedup as the voice — and playback NEVER waits on lip-sync (a late timeline lands mid-sentence; until then the **fallback** animates: `amplitude` (default) drives a coarse 4-shape mouth from a WebAudio analyser, `hide` shows the idle face). In **recorded** mode the overlay loads per-slide sidecars from the track's dir — `slide-NN.visemes.json` / `slide-NN.mp4`, generated by `tools/lipsync.mjs` (rhubarb + optional SadTalker/Wav2Lip batch, hash-incremental like voiceover.mjs) — preferring an inline `<script type="application/json" data-decklight-visemes="slide-NN">` block when present (`decklight bundle` inlines viseme JSONs; fetch is blocked on `file://`). the panel's `Record this deck…` exports `slide-NN.visemes.json` alongside each stitched WAV (same sentence cache, same silence gaps) so a recorded set is character-ready with zero extra synthesis. **Solo** (`N` → Character… → Solo, or palette → "Character solo"): the narrator takes the stage — the slide content, progress bar and slide number step aside (`visibility: hidden` on `.decklight-stage`, which the overlay is a sibling of) and the character centers, sized to the stage (`--character-solo-size`, default `min(74vh, 74vw)`). A talking-head slide with nothing else on it, without authoring one. Works with either render mode, persists per deck alongside `mode`, and is a *presentation* state, not a layout: the root's `decklight-solo` class is only ever set while the character is actually on screen, so turning the character off — or stopping the narration — can never leave a blank stage behind. Turning solo ON shows the character immediately (idling, blinking) rather than waiting for `V`. **Motion** (`decklight lipsync --veo`, SPEC PRESENTING): Wav2Lip repaints the lip region and leaves the rest of its source untouched — from a still photo that is a frozen stare with a moving mouth. With `--veo` the bridge animates each portrait ONCE through Veo image-to-video on Vertex AI (`veo-3.1-lite-generate-001` by default; 4/6/8s; `generateAudio: false` — the deck owns the voice, and it is the cheaper rate) and gives Wav2Lip that clip as its `--face`, so the head turns and blinks under the new mouth. The unit is the PORTRAIT, not the sentence: the player asks for video once per sentence through a 10-sentence lookahead, so a Veo call per sentence would be both unusably slow (~40s) and a runaway bill — instead each portrait's motion clip is bought on first use, deduped in flight, and cached on disk (keyed by portrait+model+seconds+prompt), so a deck of any length costs exactly one call per portrait, ever. Delete the cache entry to re-roll the performance. The clip is cropped square around the head (the overlay is a circle) and scaled to 640px (s3fd misses faces in a large frame). SadTalker is excluded — it generates its own head motion and wants a still. A refusal by Veo's person-generation filter surfaces as an error naming the cause, never an empty clip; a misconfigured `--veo` disables only itself and leaves visemes and still-portrait video working. It is the only part of the bridge that leaves the machine, so it is opt-in, and `decklight author` passes it straight through. Config (`narration.character`, all optional): `mode: 'off'|'viseme'|'video'` (picker overrides, persisted), `solo: boolean` (default false; picker overrides, persisted), `bridgeUrl`, `position: 'br'|'bl'|'tr'|'tl'`, `size` (design px, default 220), `svg` (custom art: inline markup, `'#id'` ref, or URL — contract: `[data-mouth="A"…"X"]` groups; optional `[data-eyelid]`/`[data-idle]` get the blink/sway), `sprites: {A: url, …}` (image frames instead), `engine`/`portrait` (video mode; Wav2Lip suits live — static pose, seamless per-sentence cuts; SadTalker suits batch clips), `fallback: 'amplitude'|'hide'`. Bundles: viseme JSONs inline (1–4 KB/slide); per-slide MP4s stay external with a CLI notice — video cannot inline sanely.
|
|
517
519
|
- **Command palette**: `/` opens a Claude-style palette — every command with its shortcut, type-to-filter, `Enter` runs, `Esc` clears then closes. Argument commands (Theme…, Font…, Narration voice…, Module…, Find slide…) drill into their pickers; contextual commands appear only when applicable (Save generated theme, Browse marketplace themes, the Configure ⟨engine⟩ wizard rows, Module). Inline arguments work: `goto 27` — or just typing `27` — surfaces a “Go to slide 27 / N” row (clamped to the deck), and selecting the bare “Go to slide…” command keeps the palette open with `goto ` prefilled. Text matching no command falls back to a “Search slides for …” row that opens the finder with the query prefilled.
|
|
518
520
|
- **Slide finder**: reached from the palette (`/` → Enter, or the search fallback) — a find-a-slide overlay with the picker's anatomy — a query bar and result list on the left, a live preview of the selected slide on the right. Typing filters as an AND over the query's words against each slide's text; slides whose **title** contains every word rank first, body-only matches follow, and every match is listed as `<slide number> · <title>` (slides without a heading fall back to their leading text). `↑/↓`/hover browse (the preview swaps live), `Enter`/click jumps to the slide, `Backspace` edits, `Esc` clears the query then closes. The preview reuses the picker's lazy embedded-deck mechanism — the iframe boots once (carrying the active theme, generated/custom included via `?gen=`), then selections postMessage `{__decklightPreview: {goto: [slide, step]}}` into it; no reload per candidate.
|
|
519
521
|
- **Playlist (multi-deck navigation)**: `Decklight.init({ playlist: { modules: [{title, href}…], index: n } })`. Advancing past the last build of the last slide navigates to the next module (`href#/1/0`); reversing before slide 1 goes to the previous module's end (`href#/999/999` — oversized hashes clamp to the last slide/step). The other modules appear as rows in the **slide finder** (`G`) — marked `▸ <title> — module`, previewed like any slide, and `Enter` loads that file; the slide-number chrome shows the module title and opens the finder on click. There is no separate module menu: "go somewhere" is one question with one answer. Works on `file://` with relative hrefs; embedded instances never chain.
|
|
520
522
|
- **History** (`H`, author mode; `R` is the same door). Every commit that touched this deck, newest first, with a live preview of each and a `⇑` on the ones that exist nowhere but this machine. Each row carries what that version **was** and what it **changed** — a slide count, and `+added` / `−removed` lines in the two colours every diff has used for forty years — because a hash and a subject cannot tell "tightened the wording" apart from "cut four slides", and that is exactly the distinction you are scanning for. The preview has its own transport (`⇤ ← → ⇥`, and the same keys), so a version is judged by walking it rather than by its first slide; the deck behind the overlay does not move. **The preview is what this overlay is for**, so the layout is built never to fight it: a wide panel, the preview on a 16:9 `aspect-ratio` because a deck is 1280×720 and a letterboxed sliver judges nothing, and a rail that is structurally incapable of squeezing it. That last part is the lesson from shipping it squeezed — a flex item's default `min-width: auto` forbids shrinking below its own min-content width, so a rail whose row put four things on one line, under a `nowrap` title bar, made `flex: 0 0 300px` a suggestion its content could veto, and the pane rendered 57px. The row is two lines now — subject, then a dimmer line of hash, badges and a compact age — the title bar wraps, and `min-width: 0` is on the column, so nothing in the rail wants to be wide and the preview's size stops being an accident of how somebody worded a commit message. `⏎` **asks** — it names the version, says the restore is written as a NEW commit and that nothing is rewritten — and `⏎` again does it. Restoring is recoverable, but recoverable is not the same as intended, and the whole premise of a history is that you opened it to look rather than to decide. Restoring used to be its own overlay with its own list and its own name for a commit; folding it in means there is one place a version is looked at and one place it is chosen, rather than two that had already begun to differ. It is the git-level sibling of `Z`/`⇧Z`: `Z` takes back a keystroke, this takes back a session. **In present mode `H` opens the deck update instead** (`PRESENT#UPSTREAM`): a presented deck has no edit server and so no history to preview, and the live question there is whether the author has pushed anything since you cloned it.
|
|
523
|
+
- **Rehearsal timings** (`REHEARSAL_TIMINGS`): the speaker view's `⏱ rehearse timings` records how long each slide takes as you present, and `⏹ stop & save timings` writes the result onto the sections as `data-timing="<seconds>"` through the author server (`POST /edit/timings`, one edit for every slide, one undo entry) — or, with no author server, keeps it in this browser. From then on the speaker view shows a pace line: this slide's elapsed against its planned time (red past five seconds over) and the talk's total against the plan. The deck's own `data-timing` always wins over a browser's memory, because the file is the source of truth. The palette's **Rehearse timings…** opens the speaker view if it is not already open and starts the clock in one step — a recorder that could only be found by opening a popup first was a recorder most presenters never found.
|
|
521
524
|
- **Speaker view**: `S` opens a popup (synced via BroadcastChannel): current + next slide thumbnails, notes (with `⟨CLICK⟩` markers highlighted as the matching build lands), elapsed timer, build step list (provider labels). **Rehearse mode**: pressing `S` again (in the deck or in the popup; the header badge also toggles) swaps the prose notes for the slide's `aside.rehearse` cue cards (DECK_ANATOMY) — rendered large and bold, one cue per segment, same said/now/next highlighting. Slides without rehearse notes fall back to the full prose. `S` in the deck only opens a new popup when none is connected; while one is open it toggles the mode. **Phone remote**: when the deck is being played by `decklight present --remote` (below), the speaker view also shows a QR of the controller URL — click it to enlarge for scanning across a lectern. It appears only when a remote is actually on, since without it there is no LAN URL to encode.
|
|
522
525
|
- **Phone remote** (`decklight present <deck.html> --remote`): the presenting server also listens on the LAN and serves `GET /remote` — a self-contained controller page with prev/next and a live "slide x/N" readout, no external asset of any kind (a phone is off-loopback, so anything it fetched from elsewhere would be a hole). A tap is relayed as a named `remote` event on the SSE stream the deck already holds, and the deck POSTs its position back, so the readout tracks the deck however it moved (phone, keyboard, or click). `POST /remote/pos` is the deck→phones direction and **accepts only loopback callers**: the deck is the one thing that knows the position, it reports from this machine, and a phone — or anyone who obtained the QR token — posting a fabricated `{i,n}` would desync the readout every other phone shows. `--remote` widens the **listener** and nothing else: off this machine **only** `/remote/*` answers, and only with the per-run random token the printed URL and its QR embed — the deck itself and every file beside it stay unreachable from the LAN either way. One exported classifier decides it, `allowRemote(req, token)`, and `PRESENT#REMOTE` is why it lives on this server: the remote used to sit on the **author** server, so a clicker meant running `/edit/notes`, `/edit/layout` and `/edit/agent` on the LAN during a talk you were not watching. The QR is generated server-side with no dependencies, and a deck that never uses a remote grows by zero bytes.
|
|
523
|
-
- **Print/PDF**: `?print` renders all slides sequentially, every build complete, terminal casts fully expanded, one slide per page (`@media print` CSS). No JS needed after layout. Background media (DECK_ANATOMY) prints as a still: no `<video>` element is ever created in print — the slide's `data-background-poster` renders as the background image instead. Two handout variants restructure the same fully-built render onto portrait pages (one `.print-page` per sheet): `?print=handout` groups slides three to a page, each scaled slide beside a column of ruled note-taking lines (page count = ⌈N/3⌉); `?print=notes` gives one page per slide with that slide's speaker notes rendered underneath — slides without notes keep their page with an empty notes block. **Page count equals slide count** (⌈N/3⌉ for handout): the page box has no margin, so the document has none either — the UA's default body margin would push the last slide's final pixels past the last page box and emit a blank final sheet. **`decklight pdf <deck.html>`** writes that render to a file without a print dialog: headless Chrome over the deck's own `?print`, one slide per 1280×720 page (960×540 pt), `-o` for the path, `--theme` to export in another theme (it rides `?theme=`), `--wait` for decks that need longer to settle. Slides the overflow guardrail flagged are named on stderr by slide number — the PDF is still written, because a clipped slide is worth knowing about, not worth refusing. No Chrome, or no file produced, exits non-zero rather than leaving a silent empty PDF.
|
|
526
|
+
- **Print/PDF**: `?print` renders all slides sequentially, every build complete, terminal casts fully expanded, one slide per page (`@media print` CSS). No JS needed after layout. Background media (DECK_ANATOMY) prints as a still: no `<video>` element is ever created in print — the slide's `data-background-poster` renders as the background image instead. Two handout variants restructure the same fully-built render onto portrait pages (one `.print-page` per sheet): `?print=handout` groups slides three to a page, each scaled slide beside a column of ruled note-taking lines (page count = ⌈N/3⌉); `?print=notes` gives one page per slide with that slide's speaker notes rendered underneath — slides without notes keep their page with an empty notes block. Both are palette rows too (**Print with notes**, **Print handout**), beside the plain print view, so a presenter reaches them without knowing the query string. **Page count equals slide count** (⌈N/3⌉ for handout): the page box has no margin, so the document has none either — the UA's default body margin would push the last slide's final pixels past the last page box and emit a blank final sheet. **`decklight pdf <deck.html>`** writes that render to a file without a print dialog: headless Chrome over the deck's own `?print`, one slide per 1280×720 page (960×540 pt), `-o` for the path, `--theme` to export in another theme (it rides `?theme=`), `--wait` for decks that need longer to settle. Slides the overflow guardrail flagged are named on stderr by slide number — the PDF is still written, because a clipped slide is worth knowing about, not worth refusing. No Chrome, or no file produced, exits non-zero rather than leaving a silent empty PDF.
|
|
524
527
|
- **Video export**: `decklight video deck.html -o deck.mp4` (tools/video.mjs) renders the deck to one narrated mp4 — a full-resolution still per FRAME (each a one-shot headless Chrome against `#/<n>/<step>`, the shot.mjs mechanism), muxed with the audio into a single file. A **narrated** slide is one still, fully built, held for the duration of its audio plus a 0.4s tail — plus the slide's hold: the built-in 1s, or whatever `data-narration-pause="2"` asks for instead — so the mp4 breathes where the live deck does. (`video.mjs` reads sections, not the boot call, so the deck-wide `narration.slidePause` tier is not seen there; the attribute is.) (That attribute is the narrated counterpart of `data-video-hold`, which paces a *silent* slide: a slide with no narration has no narration to pause after.) A **silent** slide BUILDS as it goes: one still per build step, then the finished slide. How far each slide builds is asked of the deck itself in one extra load — the grouping is the runtime's (`src/core/builds.js`), and a second counter written in Node would be a copy that drifts; a deck that does not answer falls back to one fully-built still per slide, and every slide's final frame is captured at the oversized `#/<n>/999` regardless, so a miscount can shorten a build-up but can never lose the finished slide. Both render tools (video and `tools/shot.mjs`) capture the deck **served over `http://127.0.0.1` under the `PRESENT` CSP** — the same loopback core `present` uses (`serveForRender`) — never over `file://` with `--allow-file-access-from-files`: that flag lets an unvetted deck's own JavaScript read any local file it can name and exfiltrate it, and these tools run on decks nobody has audited (a repro deck off an issue, or one screenshot before it is presented). As with `present`, the served root is the current directory and the deck must sit inside it, so its relative assets resolve as URLs and a read cannot escape the served tree. Narration resolves `--narration <dir>` → `<deckdir>/voiceover/manifest.json` (the artifact tools/voiceover.mjs writes) → a fully silent deck; slides without narration hold `--hold` seconds (default 5, per-slide override `data-video-hold="8"` on the section) over a silent audio segment (anullsrc), so the concatenated audio track stays continuous. **Every frame of a silent slide holds that long, builds included**, so a build lands at the pace the rest of the deck moves at and a deck gets longer the more it builds; `--build-hold <s>` paces the build-up frames alone, for builds quicker (or slower) than the slides around them. Splitting the hold across a slide's frames instead — fixing the deck's length — reads far too fast: the more a slide has to say, the less time each beat of it gets, which is backwards. Flags: `-o/--out`, `--narration`, `--size 1280x720`, `--fps 30`, `--hold`, `--build-hold`, `--theme <name>`, `--slides a-b`, `--voiceover` (runs the voiceover batch first). Needs ffmpeg + ffprobe — missing tools are a hard, friendly error naming what to install (the voiceover encoder-detection policy). Honest MVP limits: frames are stills, so the **character overlay appears but frozen** and terminals render fully expanded rather than typing (animated capture needs a CDP screencast — a named Node ≥22 follow-up), and a build **cuts rather than animating** (the frame is a still of each step, not a capture of the transition between them). A **narrated** slide builds too where its notes say so: `⟨CLICK⟩` segments the speaker notes, `tools/voiceover.mjs` synthesises one audio file per segment (same characters, so the same cost — the per-slide `slide-NN.m4a` is *concatenated* from them, and every existing consumer of it is untouched), and segment k narrates build step k for that segment's ffprobe'd duration. This is the recorded mirror of a rule that already ships: `src/core/narration.js` speaks live narration the same way, and captions, rehearse mode and the notes editor share the segmentation. A marker count that does not match the build count **warns naming the slide and renders the old way** — a wrong sync baked into an mp4 is worse than no sync — and a manifest written before this renders exactly as it did.
|
|
525
528
|
- **Overflow guardrail**: content that exceeds the slide flex-shrinks into a scroll box and reads as clipped. The engine warns (`console.warn`) and marks the section with a `data-overflow` attribute — on each slide activation, and for the whole deck in `?print`. The mark is **live, not latched**: layout is not final when a slide activates (a webfont resolves, an image decodes, a chart or terminal mounts), so the active slide is watched and the check re-runs whenever its content changes size or shape. It never waits on a frame — headless renders run out of frames once the page goes idle, and an unmeasured slide is indistinguishable from a clean one. The warning fires on the way in only, so one clipped slide is one line, not one per re-check — so authoring agents can assert `[data-overflow]` is absent in their headless verification (`decklight pdf` does this for a whole deck in one pass and names the offending slides). Overflow always goes **down**, never up: a slide centers its content with `safe center`, so content taller than the slide falls back to top alignment instead of overflowing symmetrically. Plain centering would push half the excess out of the top of the box, through the padding a pinned title reserves for itself, and render the first content element on top of the title.
|
|
526
529
|
- **Pinned titles**: `pinTitles: true | false | <px>` keeps slide titles at one vertical position instead of drifting with content height. **On by default** (`true`); `pinTitles: false` restores the drift-with-content centering deck-wide. `true` pins at **99px** from the stage top (design coordinates — the natural title position of the course's "The Single-Agent Limit" diagram slide, the chosen reference); a number pins at that Y. The leading `h1`/`h2` of each **pinnable** section is absolutely positioned at the pin Y; the section reserves `pin Y + measured title height + 18px` of top padding so the remaining content centers below. Pinnable = has a leading `h1`/`h2` AND content beyond it (`ul, ol, svg, pre, table, .terminal, img, .columns` outside the notes) — title cards and quote/statement slides stay centered. Per-slide: `data-pin` forces a pin (even when the config is off), `data-pin="none"` opts out, `data-pin="<px>"` overrides the Y. Titles are re-measured on `sync()` and when webfonts finish loading; print uses the same layout. A detected **subtitle** (DECK_ANATOMY) joins the pinned header block — absolutely positioned directly beneath the title (6px gap) and included in the reserved padding, so content centers below title + subtitle.
|
|
@@ -1380,13 +1383,16 @@ decklight/
|
|
|
1380
1383
|
src/math/ LaTeX math on data-math slides (Temml → MathML Core)
|
|
1381
1384
|
src/code/ highlight bundling + line stepping provider
|
|
1382
1385
|
src/terminal/ ansi.mjs (parser), player.mjs (provider + modes)
|
|
1383
|
-
cli/ decklight.mjs (dispatcher: init/skills/
|
|
1384
|
-
publish/marketplace/plugin/template/importer/transform/engine/extension/voice/agent/
|
|
1385
|
-
video/author/present/associate/report-bug; `dev` is a
|
|
1386
|
-
|
|
1387
|
-
|
|
1386
|
+
cli/ decklight.mjs (dispatcher: init/skills/cast/refresh/export/bundle/restore/history/upgrade/pdf/pptx/
|
|
1387
|
+
import/theme/publish/marketplace/plugin/template/importer/transform/engine/extension/voice/agent/
|
|
1388
|
+
tts/lipsync/video/author/record/voiceover/review/comments/present/associate/report-bug; `dev` is a
|
|
1389
|
+
hidden alias for `author`; `edit` (folded into `author`) and `rec` (renamed `cast`) are gone —
|
|
1390
|
+
an unknown command, printing the roster) + pkg.mjs (the package root and the one
|
|
1391
|
+
runtime-inlining transform) and util.mjs (CommandError + runMain: every command fails
|
|
1392
|
+
one way), init.mjs, cast.mjs, bundle.mjs, upgrade.mjs, restore.mjs,
|
|
1388
1393
|
theme.mjs (validate + install a theme, THEMING), import.mjs (PowerPoint/Keynote/Google Slides →
|
|
1389
|
-
deck, JS_API),
|
|
1394
|
+
deck, JS_API), pdf.mjs (the print variants, PRESENTING) + pptx-export.mjs (deck → PowerPoint,
|
|
1395
|
+
NON_GOALS), publish.mjs, marketplace.mjs (register catalogs, MARKETPLACE_REGISTRY), units.mjs
|
|
1390
1396
|
(templates/skills/importers/voices/engines/agents), plugin.mjs (presenter chrome, PRESENT#PLUGINS),
|
|
1391
1397
|
loader.mjs + extension.mjs (build-time transforms and their admission gate), wizard.mjs (the
|
|
1392
1398
|
credential wizard, ENGINES#WIZARD), sign.mjs + deckfile.mjs + associate.mjs (signing, the
|
|
@@ -1394,28 +1400,30 @@ decklight/
|
|
|
1394
1400
|
core), present.mjs, edit.mjs, dev.mjs, remote.mjs, agents.mjs (AI-agent roster), git.mjs (the
|
|
1395
1401
|
autocommit decision table), update-check.mjs (the "a newer decklight exists" notice), qr.mjs,
|
|
1396
1402
|
port-conflict.mjs, supervise.mjs, skill-content.mjs (the agent skill's shipped text)
|
|
1397
|
-
tools/ theme-check.mjs (the THEMING token contract + WCAG gates, as a function) + color.mjs (contrast math), local-voice.mjs (what this OS can say: macOS say / Windows SAPI, PRESENTING), zip.mjs (read an Office archive) + ooxml.mjs (a small XML reader) + pptx.mjs (PowerPoint → sections, JS_API), voiceover.mjs (batch TTS) + voiceover-server.mjs (tts bridge), publish-voices.mjs (track → bucket + signed manifest, PRESENTING), publish-targets.mjs (Netlify/Vercel deploy adapters, PRESENTING), tts-engines.mjs (gemini/chirp/piper/elevenlabs/say/sapi) + gemini-tts.mjs, elevenlabs-tts.mjs, lipsync.mjs (batch visemes/video) + lipsync-server.mjs (lipsync bridge), visemes.mjs (timeline v1), video.mjs (deck → narrated mp4, PRESENTING)
|
|
1403
|
+
tools/ theme-check.mjs (the THEMING token contract + WCAG gates, as a function) + color.mjs (contrast math), local-voice.mjs (what this OS can say: macOS say / Windows SAPI, PRESENTING), zip.mjs (read an Office archive) + ooxml.mjs (a small XML reader) + pptx.mjs (PowerPoint → sections, JS_API) + template-theme.mjs (a .pptx theme part → a gated theme, DECK_IMPORT) + pptx-write.mjs (the other direction: slides as pictures, notes as notes), voiceover.mjs (batch TTS) + voiceover-server.mjs (tts bridge), publish-voices.mjs (track → bucket + signed manifest, PRESENTING), publish-targets.mjs (Netlify/Vercel deploy adapters, PRESENTING), exec.mjs (one bounded subprocess: every hang names itself), tts-cache.mjs (a sentence is synthesized once — the on-disk cache every engine shares), tts-engines.mjs (gemini/chirp/piper/elevenlabs/say/sapi) + gemini-tts.mjs, elevenlabs-tts.mjs, lipsync.mjs (batch visemes/video) + lipsync-server.mjs (lipsync bridge), visemes.mjs (timeline v1), video.mjs (deck → narrated mp4, PRESENTING)
|
|
1398
1404
|
themes/ 46 × <name>.css (the graded + reveal-compat sets; the homage packs moved to the
|
|
1399
1405
|
marketplace, THEME_DISTRIBUTION) + packs.json + gallery.html
|
|
1400
1406
|
dist/ decklight.js (IIFE, global Decklight), decklight.css
|
|
1401
1407
|
demo/ smoke.html (the render harnesses' deck — every feature, including deliberate regression
|
|
1402
1408
|
fixtures) + intro.html, features.html, pitch.html, showcase.html + assets/
|
|
1403
1409
|
test/ node:test units (ansi, builds, math, cast format, the CLI, the marketplace, the pieces lifted out
|
|
1404
|
-
of engine.js), found by run.mjs rather than a shell glob +
|
|
1405
|
-
player, narration
|
|
1406
|
-
|
|
1407
|
-
tools/theme-check.mjs, and the house palette bar) + the two manual end-to-end scripts neither
|
|
1410
|
+
of engine.js), found by run.mjs rather than a shell glob + 21 headless-Chrome harnesses (render,
|
|
1411
|
+
player, narration × 5 — live/picker/recorded/segments/record, record, review, character, engine,
|
|
1412
|
+
pin, overflow, split, strict, shot, plugin, extension-check, deckfile, pdf, import) +
|
|
1413
|
+
contrast.mjs and palette-rules.mjs (every shipped theme through tools/theme-check.mjs, and the house palette bar) + the two manual end-to-end scripts neither
|
|
1408
1414
|
blessed suite runs: soak.mjs (pack, install, walk the journey — the release gate) with its
|
|
1409
1415
|
soak-platform.mjs, and video-e2e.mjs (a real ffmpeg render)
|
|
1410
1416
|
```
|
|
1411
1417
|
|
|
1412
1418
|
- Build: `npm run build` = esbuild bundle (`src/index.js` → `dist/decklight.js`, minified + sourcemap) + CSS copy. Node ≥ 20. Runtime has **zero** runtime dependencies (highlight.js + temml are bundled at build time; Temml's stylesheet is appended to `decklight.css` with its optional woff2 `@font-face` stripped); `node-pty`, `js-yaml` are CLI-only deps.
|
|
1413
|
-
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all
|
|
1419
|
+
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all 23 harnesses** — the 21 headless-Chrome ones against `demo/smoke.html` and the decks each covers, plus the two theme graders — reporting every harness rather than stopping at the first failure. A feature is verified against a real render, not only unit-tested.
|
|
1414
1420
|
- Release gate: **`npm run soak`** packs this repo, installs the tarball into an empty project whose path contains a space, and drives the INSTALLED `decklight` through one user journey — create, import, marketplace, author, present, bundle, transform, pdf, publish, validate, open, record, film — plus a cross-version `upgrade` of a deck scaffolded by a decklight that actually shipped. Manual, in neither blessed suite (it runs a real `npm install`, and skipping inside them would let "green" mean "not actually run"); anything it cannot do here — no Chrome, no network, no ffmpeg, no toolchain — skips **by name**, so a green run with skips is never mistaken for a complete one.
|
|
1415
1421
|
|
|
1416
1422
|
## NON_GOALS — Non-goals (v1)
|
|
1417
1423
|
|
|
1418
|
-
Vertical slide nesting · full terminal emulation (vim/htop) · multiplex/follow-along · **in-deck runtime extensions** · PPTX
|
|
1424
|
+
Vertical slide nesting · full terminal emulation (vim/htop) · multiplex/follow-along · **in-deck runtime extensions** · PPTX round-trip · mobile authoring.
|
|
1425
|
+
|
|
1426
|
+
**On PPTX.** Export exists (`decklight pptx`, PRESENTING) and is lossy by design: every slide is a picture at its own size with its builds complete, and the speaker notes are real notes. What stays a non-goal is the *round-trip* — a `.pptx` whose text boxes, builds and charts survive as editable objects. A decklight deck is HTML, builds, casts and a live voice, none of which has a PowerPoint shape; the export is for the people around a decklight user who still ask for the file, not for editing it there.
|
|
1419
1427
|
|
|
1420
1428
|
**On that third-from-last one.** "No plugin system" was the v1 non-goal, and 0.3.0 shipped marketplaces — so the line is narrowed rather than deleted, because what it was protecting is still protected. A deck travels, so code inlined into it runs in front of an audience that installed nothing and consented to nothing (MARKETPLACE.md `WHY`). Everything a marketplace distributes therefore runs somewhere else: a build-time transform runs in Node during `bundle` and returns HTML (`EXTENSIONS_TRANSFORMS`), a presenter plugin runs on the presenter's own machine in a sandboxed frame and may not touch slide content (PRESENT#PLUGINS), an engine or import adapter runs at author time, and a theme or template is data. The runtime still has no plugin API, no `<script>` a catalog can put in a deck, and no execution surface for a recipient to be surprised by — providers + events remain the only extension inside the deck.
|
|
1421
1429
|
|
package/cli/associate.mjs
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
import { writeFileSync, mkdirSync, rmSync, existsSync, chmodSync } from 'node:fs';
|
|
35
|
-
import { execFileSync } from 'node:child_process';
|
|
36
35
|
import { homedir, platform } from 'node:os';
|
|
37
36
|
import path from 'node:path';
|
|
38
37
|
import { fileURLToPath } from 'node:url';
|
|
39
38
|
import { isMain } from '../tools/args.mjs';
|
|
40
39
|
import { DECK_EXT } from './deckfile.mjs';
|
|
40
|
+
import { run, PROBE_MS } from '../tools/exec.mjs';
|
|
41
41
|
|
|
42
42
|
export const MIME_TYPE = 'application/vnd.decklight';
|
|
43
43
|
export const UTI = 'io.decklight.deck';
|
|
@@ -208,7 +208,7 @@ const windowsUninstall = () => [
|
|
|
208
208
|
|
|
209
209
|
/** Refresh a desktop database if the tool is there; never fail over its absence. */
|
|
210
210
|
function refresh(argv) {
|
|
211
|
-
try {
|
|
211
|
+
try { run(argv[0], argv.slice(1), { stdio: 'ignore', timeout: PROBE_MS }); return true; }
|
|
212
212
|
catch { return false; }
|
|
213
213
|
}
|
|
214
214
|
|
package/cli/bundle.mjs
CHANGED
|
@@ -433,7 +433,7 @@ html = html.replace(
|
|
|
433
433
|
// ---------------------------------------------- narration lip-sync sidecars
|
|
434
434
|
|
|
435
435
|
// slide-NN.visemes.json next to a narration track (tools/lipsync.mjs, or the
|
|
436
|
-
//
|
|
436
|
+
// the recorder's export) inlines as a data-decklight-visemes block — fetch() is blocked
|
|
437
437
|
// on file:// and a bundle should not depend on a sidecar folder. Per-slide
|
|
438
438
|
// MP4s stay external: video cannot inline sanely (a deck's worth is
|
|
439
439
|
// 50–150 MB), same posture as playlist links.
|
package/cli/decklight.mjs
CHANGED
|
@@ -66,6 +66,9 @@ Commands:
|
|
|
66
66
|
EXAMPLE: decklight upgrade deck.html --dry-run (see what would change; drop the flag to apply)
|
|
67
67
|
pdf render the deck to a PDF — one slide per page, at its own size, in its theme
|
|
68
68
|
EXAMPLE: decklight pdf deck.html (writes deck.pdf; --theme exports in another)
|
|
69
|
+
EXAMPLE: decklight pdf deck.html --handout (three a page, ruled; --notes is your copy)
|
|
70
|
+
pptx write a PowerPoint file — every slide as a picture, its notes as notes (lossy on purpose)
|
|
71
|
+
EXAMPLE: decklight pptx deck.html (for the people around you who still ask for the file)
|
|
69
72
|
import convert an existing PowerPoint, Keynote or Google Slides deck into a decklight deck
|
|
70
73
|
EXAMPLE: decklight import "Q3 Review.pptx" (also .key on macOS, or a Slides URL)
|
|
71
74
|
theme validate a theme file against the token contract, or install one into a deck
|
|
@@ -113,7 +116,7 @@ Commands:
|
|
|
113
116
|
(this records YOU — decklight cast records a terminal)
|
|
114
117
|
EXAMPLE: decklight record talk.html (serves it: a microphone needs 127.0.0.1)
|
|
115
118
|
voiceover batch-synthesize the deck's narration into a folder with a live engine
|
|
116
|
-
(piper/chirp/gemini/elevenlabs) — the headless counterpart of the deck's
|
|
119
|
+
(piper/chirp/gemini/elevenlabs) — the headless counterpart of the deck's V → Record this deck…
|
|
117
120
|
EXAMPLE: decklight voiceover talk.html -o voices/chirp --engine chirp --voice Achernar
|
|
118
121
|
review leave comments on somebody's deck, anchored to slides and carried by git
|
|
119
122
|
(writes <deck>.review.jsonl beside it; never touches the deck itself)
|
|
@@ -260,6 +263,11 @@ switch (cmd) {
|
|
|
260
263
|
process.exitCode = await pdfMain(rest);
|
|
261
264
|
break;
|
|
262
265
|
}
|
|
266
|
+
case 'pptx': {
|
|
267
|
+
const { pptxMain } = await import('./pptx-export.mjs');
|
|
268
|
+
process.exitCode = await pptxMain(rest);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
263
271
|
case 'import': {
|
|
264
272
|
const { importMain } = await import('./import.mjs');
|
|
265
273
|
process.exitCode = await importMain(rest);
|
package/cli/edit.mjs
CHANGED
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
// GET /edit/ping → { ok, deck, undo, redo, git, agents, agentBusy, wizards }
|
|
21
21
|
// GET /edit/events → SSE; `reload` on deck change, `agent` job status
|
|
22
22
|
// POST /edit/notes → { slide, text } rewrite that slide's notes
|
|
23
|
+
// POST /edit/timings → { timings: [{ slide, seconds }] } rehearsed times onto the sections
|
|
23
24
|
// POST /edit/layout → { slide, layout } write data-layout to the file
|
|
25
|
+
// POST /edit/hidden → { slide, hidden } data-hidden on or off (HIDDEN_SLIDES)
|
|
24
26
|
// GET /edit/element/source → ?slide=&index= an element's outerHTML, fresh from the file
|
|
25
27
|
// POST /edit/element/remove → { slide, index } delete that element
|
|
26
28
|
// POST /edit/element/content → { slide, index, html } replace its outerHTML
|
|
@@ -143,6 +145,40 @@ export function setSlideLayout(html, slide, name) {
|
|
|
143
145
|
return parts.join('');
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Write a rehearsed time onto a slide: `data-timing="42"` (seconds, whole).
|
|
150
|
+
* `null` or 0 removes it. The attribute is the deck's memory of a rehearsal
|
|
151
|
+
* (PRESENTING REHEARSAL_TIMINGS) and travels with the file, so the next
|
|
152
|
+
* speaker view can show planned against actual.
|
|
153
|
+
*/
|
|
154
|
+
export function setSlideTiming(html, slide, seconds) {
|
|
155
|
+
const { parts, idx } = locateSlide(html, slide);
|
|
156
|
+
const seg = parts[idx];
|
|
157
|
+
const gt = seg.indexOf('>');
|
|
158
|
+
if (gt < 0) throw new Error(`slide ${slide}: malformed <section> tag`);
|
|
159
|
+
let head = seg.slice(0, gt).replace(/\s+data-timing=("[^"]*"|'[^']*')/, '');
|
|
160
|
+
const n = Math.round(Number(seconds));
|
|
161
|
+
if (Number.isFinite(n) && n > 0) head += ` data-timing="${n}"`;
|
|
162
|
+
parts[idx] = head + seg.slice(gt);
|
|
163
|
+
return parts.join('');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Hide a slide from the talk, or show it again: `data-hidden` on the section
|
|
168
|
+
* (DECK_ANATOMY HIDDEN_SLIDES). The slide keeps its number and its place in
|
|
169
|
+
* the file — only the audience loses it. Same door as layout and timings.
|
|
170
|
+
*/
|
|
171
|
+
export function setSlideHidden(html, slide, hidden) {
|
|
172
|
+
const { parts, idx } = locateSlide(html, slide);
|
|
173
|
+
const seg = parts[idx];
|
|
174
|
+
const gt = seg.indexOf('>');
|
|
175
|
+
if (gt < 0) throw new Error(`slide ${slide}: malformed <section> tag`);
|
|
176
|
+
let head = seg.slice(0, gt).replace(/\s+data-hidden(?:=("[^"]*"|'[^']*'))?(?=[\s>\/]|$)/, '');
|
|
177
|
+
if (hidden) head += ' data-hidden';
|
|
178
|
+
parts[idx] = head + seg.slice(gt);
|
|
179
|
+
return parts.join('');
|
|
180
|
+
}
|
|
181
|
+
|
|
146
182
|
/** Look up element `index` (raw child position) on slide `slide`, or throw. */
|
|
147
183
|
function locateElement(html, slide, index) {
|
|
148
184
|
const { parts, idx } = locateSlide(html, slide);
|
|
@@ -1240,7 +1276,7 @@ export async function editMain(args, { onListen = null } = {}) {
|
|
|
1240
1276
|
console.log(` ${dir} → ${JSON.stringify(history.counts())}`);
|
|
1241
1277
|
return json(200, { ok: true, ...history.counts() });
|
|
1242
1278
|
}
|
|
1243
|
-
// ──
|
|
1279
|
+
// ── the recorder's offline recordings — V → Record this deck… (PRESENTING) ───────────────────────────────
|
|
1244
1280
|
// The player used to hand every stitched slide to the browser's DOWNLOAD
|
|
1245
1281
|
// path, which is why a deck's voice arrived as thirty slide-NN.wav in
|
|
1246
1282
|
// whatever folder the OS calls Downloads — never the deck's, and on
|
|
@@ -1733,6 +1769,16 @@ export async function editMain(args, { onListen = null } = {}) {
|
|
|
1733
1769
|
console.log(` notes saved: slide ${slide} (${text.length} chars)`);
|
|
1734
1770
|
return json(200, { ok: true, ...history.counts() });
|
|
1735
1771
|
}
|
|
1772
|
+
if (req.method === 'POST' && url.pathname === '/edit/timings') {
|
|
1773
|
+
// every slide's rehearsed time in ONE edit — one undo entry, one commit
|
|
1774
|
+
const { timings } = JSON.parse(body);
|
|
1775
|
+
if (!Array.isArray(timings) || !timings.every((t) => Number.isInteger(t?.slide) && t.slide >= 1 && Number.isFinite(t?.seconds))) throw new Error('bad payload');
|
|
1776
|
+
let next = readDeck();
|
|
1777
|
+
for (const t of timings) next = setSlideTiming(next, t.slide, t.seconds);
|
|
1778
|
+
const changed = applyEdit(next);
|
|
1779
|
+
if (changed) console.log(` rehearsal timings saved: ${timings.length} slides`);
|
|
1780
|
+
return json(200, { ok: true, changed, ...history.counts() });
|
|
1781
|
+
}
|
|
1736
1782
|
if (req.method === 'POST' && url.pathname === '/edit/layout') {
|
|
1737
1783
|
const { slide, layout } = JSON.parse(body);
|
|
1738
1784
|
if (!Number.isInteger(slide) || slide < 1 || typeof layout !== 'string') throw new Error('bad payload');
|
|
@@ -1740,6 +1786,13 @@ export async function editMain(args, { onListen = null } = {}) {
|
|
|
1740
1786
|
if (changed) console.log(` layout saved: slide ${slide} → ${layout}`);
|
|
1741
1787
|
return json(200, { ok: true, changed, ...history.counts() });
|
|
1742
1788
|
}
|
|
1789
|
+
if (req.method === 'POST' && url.pathname === '/edit/hidden') {
|
|
1790
|
+
const { slide, hidden } = JSON.parse(body);
|
|
1791
|
+
if (!Number.isInteger(slide) || slide < 1 || typeof hidden !== 'boolean') throw new Error('bad payload');
|
|
1792
|
+
const changed = applyEdit(setSlideHidden(readDeck(), slide, hidden));
|
|
1793
|
+
if (changed) console.log(` slide ${slide} ${hidden ? 'hidden' : 'shown again'}`);
|
|
1794
|
+
return json(200, { ok: true, changed, ...history.counts() });
|
|
1795
|
+
}
|
|
1743
1796
|
// ── element edit mode (E, right-click a slide element) — #112 ─────
|
|
1744
1797
|
// Same door as layout/notes: a pure (html, slide, index, …) → html
|
|
1745
1798
|
// transform, through applyEdit, onto the ONE undo/redo stack.
|