decklight 0.8.0 → 0.9.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/PLATFORM.md +666 -0
- package/README.md +224 -150
- package/SPEC.md +732 -886
- package/cli/agent-review.mjs +245 -0
- package/cli/agents.mjs +25 -5
- package/cli/associate.mjs +12 -12
- package/cli/audit.mjs +42 -10
- package/cli/banner.mjs +41 -17
- package/cli/bundle-audio.mjs +183 -0
- package/cli/bundle.mjs +383 -31
- package/cli/cast.mjs +7 -7
- package/cli/check.mjs +961 -0
- package/cli/clone-deck.mjs +179 -0
- package/cli/commands.mjs +345 -0
- package/cli/comments.mjs +64 -18
- package/cli/commit-flow.mjs +44 -19
- package/cli/commit-message.mjs +51 -74
- package/cli/commit-split.mjs +601 -0
- package/cli/deck-refs.mjs +59 -0
- package/cli/deck-routes.mjs +67 -0
- package/cli/deckfile.mjs +3 -5
- package/cli/decklight.mjs +68 -289
- package/cli/design-system-deps.mjs +209 -0
- package/cli/design-system-edit.mjs +194 -0
- package/cli/design-system-refs.mjs +409 -0
- package/cli/design-system.mjs +429 -0
- package/cli/doctor.mjs +115 -0
- package/cli/edit-git.mjs +353 -0
- package/cli/edit-handover.mjs +445 -0
- package/cli/edit-look.mjs +388 -0
- package/cli/edit-slides.mjs +683 -0
- package/cli/edit.mjs +2126 -842
- package/cli/enhance.mjs +483 -0
- package/cli/extension.mjs +10 -10
- package/cli/font-refs.mjs +273 -0
- package/cli/font.mjs +246 -0
- package/cli/git-tree.mjs +1 -1
- package/cli/git.mjs +65 -11
- package/cli/import.mjs +56 -10
- package/cli/init.mjs +400 -234
- package/cli/library.mjs +127 -0
- package/cli/loader.mjs +3 -1
- package/cli/marketplace.mjs +215 -21
- package/cli/narrate.mjs +176 -0
- package/cli/open-browser.mjs +63 -0
- package/cli/open.mjs +943 -0
- package/cli/pdf.mjs +41 -13
- package/cli/pkg.mjs +44 -2
- package/cli/plugin.mjs +43 -41
- package/cli/port-conflict.mjs +53 -23
- package/cli/pptx-export.mjs +71 -26
- package/cli/publish.mjs +8 -4
- package/cli/qr.mjs +1 -1
- package/cli/record.mjs +14 -12
- package/cli/remote.mjs +11 -11
- package/cli/restore.mjs +11 -4
- package/cli/review-ref.mjs +125 -0
- package/cli/review-remote.mjs +92 -48
- package/cli/review-routes.mjs +254 -0
- package/cli/review-store.mjs +47 -7
- package/cli/review-submit.mjs +47 -57
- package/cli/runtime-link.mjs +560 -0
- package/cli/serve.mjs +235 -44
- package/cli/setup.mjs +112 -0
- package/cli/sign.mjs +1 -1
- package/cli/skill-content.mjs +190 -33
- package/cli/skills.mjs +107 -24
- package/cli/start.mjs +110 -0
- package/cli/supervise.mjs +6 -6
- package/cli/theme-refs.mjs +515 -0
- package/cli/theme.mjs +181 -137
- package/cli/trust.mjs +83 -0
- package/cli/units.mjs +39 -42
- package/cli/update-check.mjs +1 -5
- package/cli/upgrade.mjs +194 -28
- package/cli/upstream.mjs +4 -3
- package/cli/util.mjs +4 -4
- package/cli/wizard.mjs +6 -6
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +1126 -49
- package/dist/decklight.js +212 -115
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +141 -0
- package/docs/architecture.svg +17 -17
- package/package.json +4 -2
- package/themes/README.md +9 -8
- package/themes/reveal-solarized.css +10 -0
- package/tools/args.mjs +20 -0
- package/tools/atomic-write.mjs +48 -0
- package/tools/brand-palette.mjs +717 -0
- package/tools/bridge.mjs +1 -1
- package/tools/build-groups.mjs +42 -0
- package/tools/color.mjs +48 -0
- package/tools/deck-html.mjs +396 -11
- package/tools/design-system-format.mjs +753 -0
- package/tools/elevenlabs-tts.mjs +110 -17
- package/tools/exec.mjs +35 -2
- package/tools/extension-check.mjs +31 -7
- package/tools/font-format.mjs +190 -0
- package/tools/font-stacks.mjs +24 -0
- package/tools/gemini-tts.mjs +3 -0
- package/tools/lipsync-config.mjs +103 -0
- package/tools/lipsync-engines.mjs +205 -2
- package/tools/lipsync-server.mjs +264 -41
- package/tools/lipsync.mjs +37 -18
- package/tools/local-voice.mjs +32 -42
- package/tools/narration-manifest.mjs +196 -0
- package/tools/narration-synth.mjs +416 -0
- package/tools/pptx.mjs +776 -19
- package/tools/publish-targets.mjs +1 -1
- package/tools/publish-voices.mjs +3 -3
- package/tools/recording-impact.mjs +7 -3
- package/tools/render-theme.mjs +33 -0
- package/tools/review-anchor.mjs +28 -12
- package/tools/semver.mjs +40 -0
- package/tools/sentences.mjs +180 -0
- package/tools/shot.mjs +14 -7
- package/tools/site-voices.mjs +232 -0
- package/tools/template-theme.mjs +1 -1
- package/tools/test-impact.mjs +19 -10
- package/tools/theme-check.mjs +30 -3
- package/tools/tts-cache.mjs +4 -3
- package/tools/tts-engines.mjs +38 -20
- package/tools/tts-setup.mjs +7 -7
- package/tools/video-options.mjs +34 -0
- package/tools/video.mjs +461 -48
- package/tools/voiceover-server.mjs +185 -104
- package/tools/voiceover.mjs +119 -261
- package/tools/zip.mjs +1 -1
- package/cli/dev.mjs +0 -623
- package/cli/present.mjs +0 -853
- package/cli/review.mjs +0 -361
- package/tools/publish-site-voices.mjs +0 -75
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Gilles Philippart
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
// The showcase's voice tracks for decklight.io: kept as ONE release asset on
|
|
6
|
+
// this repository, not as files in it, and re-voiced only where the notes
|
|
7
|
+
// changed.
|
|
8
|
+
//
|
|
9
|
+
// node tools/site-voices.mjs pull the asset → site/voices/ (the baseline)
|
|
10
|
+
// node tools/site-voices.mjs refresh voice every slide whose notes moved, per voice
|
|
11
|
+
// node tools/site-voices.mjs check every clip matches its notes, or say which do not
|
|
12
|
+
// node tools/site-voices.mjs push site/voices/ → the asset, when anything changed
|
|
13
|
+
//
|
|
14
|
+
// The site deploy runs these in that order (.github/workflows/publish-site.yml).
|
|
15
|
+
// `site/voices.json` names the release, the asset, the engine and the voices
|
|
16
|
+
// (and a style prompt, for an engine that takes one; ElevenLabs reads the
|
|
17
|
+
// tags in the notes instead); the audio itself never enters git history: a
|
|
18
|
+
// deploy pulls the last asset, tools/voiceover.mjs re-synthesizes only the
|
|
19
|
+
// slides whose manifest hash no longer matches the deck (and the shared clip
|
|
20
|
+
// cache under ~/.cache/decklight/tts, restored between runs, makes a slide
|
|
21
|
+
// that merely moved a cache hit), and the asset is uploaded back only if a
|
|
22
|
+
// byte changed. Only the configured voices travel: a voice taken out of the
|
|
23
|
+
// config is pruned on the next pull and absent from the next push.
|
|
24
|
+
// `check` is the gate: a deploy that cannot bring every clip in line with its
|
|
25
|
+
// notes fails here, before Pages, instead of publishing a deck that narrates
|
|
26
|
+
// one slide over another (what the site did for weeks, #803).
|
|
27
|
+
//
|
|
28
|
+
// The release's tag points at the repository's ROOT commit, never at main's
|
|
29
|
+
// tip: `git describe --tags` (the version string) would otherwise find it
|
|
30
|
+
// nearest. Both describe calls also match `v*` only, so this stays true even
|
|
31
|
+
// if the tag moves.
|
|
32
|
+
|
|
33
|
+
import { createHash } from 'node:crypto';
|
|
34
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
35
|
+
import { tmpdir } from 'node:os';
|
|
36
|
+
import { basename, join, resolve } from 'node:path';
|
|
37
|
+
import { fileURLToPath } from 'node:url';
|
|
38
|
+
import { spawnSync } from 'node:child_process';
|
|
39
|
+
import { argReader, isMain } from './args.mjs';
|
|
40
|
+
import { run, NETWORK_MS } from './exec.mjs';
|
|
41
|
+
import { slideTexts, staleSlides } from './narration-manifest.mjs';
|
|
42
|
+
|
|
43
|
+
const VOICEOVER = fileURLToPath(new URL('./voiceover.mjs', import.meta.url));
|
|
44
|
+
const PULLED = '.pulled'; // the digest of what `pull` extracted; `push` skips an upload that would change nothing
|
|
45
|
+
|
|
46
|
+
export const USAGE = `usage: node tools/site-voices.mjs <pull | refresh | check | push> [--deck demo/showcase.html]
|
|
47
|
+
[--config site/voices.json] [--dir site/voices]
|
|
48
|
+
|
|
49
|
+
pull download the voices release asset and extract it into --dir
|
|
50
|
+
refresh re-voice, per voice, the slides whose notes changed (tools/voiceover.mjs does
|
|
51
|
+
the work, with the engine's own credential: $ELEVENLABS_API_KEY for elevenlabs,
|
|
52
|
+
GOOGLE_CLOUD_PROJECT and gcloud application-default credentials for gemini)
|
|
53
|
+
check exit 1 naming every slide whose clip is stale or missing, per voice
|
|
54
|
+
push pack --dir into the asset and upload it, when it differs from what was pulled
|
|
55
|
+
|
|
56
|
+
pull and push need gh on PATH, authenticated for this repository`;
|
|
57
|
+
|
|
58
|
+
/** `site/voices.json`: the release, the asset, the engine and the voices; `style` only for an engine that takes one. */
|
|
59
|
+
export function loadConfig(file = 'site/voices.json') {
|
|
60
|
+
const cfg = JSON.parse(readFileSync(file, 'utf8'));
|
|
61
|
+
for (const key of ['release', 'asset', 'engine', 'voices']) {
|
|
62
|
+
if (!cfg[key]) throw new Error(`${file}: no "${key}"`);
|
|
63
|
+
}
|
|
64
|
+
if (!Array.isArray(cfg.voices) || !cfg.voices.length) throw new Error(`${file}: "voices" is empty`);
|
|
65
|
+
return cfg;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The folder names the config's voices live in: what travels, and what `pull` keeps. */
|
|
69
|
+
export const configuredDirs = (cfg) => cfg.voices.map((v) => basename(v.dir));
|
|
70
|
+
|
|
71
|
+
/** A voice's folder under the root: `voices/algenib` in the config is `<root>/algenib` on disk. */
|
|
72
|
+
export const voiceDir = (root, voice) => join(root, basename(voice.dir));
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The argv that voices one track: tools/voiceover.mjs, which is incremental
|
|
76
|
+
* by manifest hash and shares the clip cache with every other producer of a
|
|
77
|
+
* track. Engine and voice (and the style, where the config has one) are
|
|
78
|
+
* given every time, so a track that does not exist yet is made in the same
|
|
79
|
+
* voice the others speak in.
|
|
80
|
+
*/
|
|
81
|
+
export function refreshArgv(deck, cfg, voice, outDir) {
|
|
82
|
+
return [VOICEOVER, deck, '--engine', cfg.engine, '--voice', voice.voice,
|
|
83
|
+
...(cfg.style ? ['--style', cfg.style] : []), '-o', outDir];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* What travels in the asset: audio, manifests and the per-slide scripts of
|
|
88
|
+
* the voices in `dirs` (every folder, when none are named); never temp files
|
|
89
|
+
* or the digest.
|
|
90
|
+
*/
|
|
91
|
+
export function packList(root, dirs = null) {
|
|
92
|
+
if (!existsSync(root)) return [];
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const dir of readdirSync(root).sort()) {
|
|
95
|
+
const abs = join(root, dir);
|
|
96
|
+
if (!statSync(abs).isDirectory() || (dirs && !dirs.includes(dir))) continue;
|
|
97
|
+
for (const f of readdirSync(abs).sort()) {
|
|
98
|
+
if (!/\.(m4a|mp3|wav|json|txt)$/.test(f) || f.includes('.tmp.')) continue;
|
|
99
|
+
out.push(`${dir}/${f}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** One hash over every packed file's path and bytes: equal digests, nothing to upload. */
|
|
106
|
+
export function contentDigest(root, dirs = null) {
|
|
107
|
+
const h = createHash('sha256');
|
|
108
|
+
for (const rel of packList(root, dirs)) {
|
|
109
|
+
h.update(rel).update('\0').update(readFileSync(join(root, rel))).update('\0');
|
|
110
|
+
}
|
|
111
|
+
return h.digest('hex');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Per voice: the slides whose clip no longer matches the deck's notes
|
|
116
|
+
* (`stale`), the slides with notes that have no clip (`missing`), and whether
|
|
117
|
+
* the track exists at all (`absent`). Pure over the deck's HTML and the
|
|
118
|
+
* manifests, so a test can hand it both.
|
|
119
|
+
*/
|
|
120
|
+
export function checkTracks(html, root, cfg) {
|
|
121
|
+
const texts = slideTexts(html);
|
|
122
|
+
const withNotes = texts.map((t, i) => (t ? i + 1 : 0)).filter(Boolean);
|
|
123
|
+
return cfg.voices.map((voice) => {
|
|
124
|
+
const file = join(voiceDir(root, voice), 'manifest.json');
|
|
125
|
+
if (!existsSync(file)) return { voice: voice.voice, absent: true, stale: [], missing: withNotes };
|
|
126
|
+
const manifest = JSON.parse(readFileSync(file, 'utf8'));
|
|
127
|
+
const { stale } = staleSlides(manifest, texts);
|
|
128
|
+
const missing = withNotes.filter((n) => !manifest.slides?.[n - 1] && !stale.includes(n));
|
|
129
|
+
return { voice: voice.voice, absent: false, stale, missing };
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const gh = (args, opts = {}) => run('gh', args, { encoding: 'utf8', timeout: NETWORK_MS, why: 'gh is waiting on the network or a login: run gh auth status', ...opts });
|
|
134
|
+
|
|
135
|
+
function pull({ cfg, root }) {
|
|
136
|
+
const tmp = mkdtempSync(join(tmpdir(), 'decklight-site-voices-'));
|
|
137
|
+
const tar = join(tmp, cfg.asset);
|
|
138
|
+
try {
|
|
139
|
+
gh(['release', 'download', cfg.release, '--pattern', cfg.asset, '--output', tar, '--clobber'], { stdio: ['ignore', 'pipe', 'inherit'] });
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.error(`site-voices: no ${cfg.asset} on release ${cfg.release}: a machine that has the tracks runs \`push\` first`);
|
|
142
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
mkdirSync(root, { recursive: true });
|
|
146
|
+
run('tar', ['-xzf', tar, '-C', root], { stdio: 'inherit' });
|
|
147
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
148
|
+
// a voice no longer in the config is not kept around: it would be deployed
|
|
149
|
+
const keep = configuredDirs(cfg);
|
|
150
|
+
for (const dir of readdirSync(root)) {
|
|
151
|
+
if (statSync(join(root, dir)).isDirectory() && !keep.includes(dir)) {
|
|
152
|
+
rmSync(join(root, dir), { recursive: true, force: true });
|
|
153
|
+
console.log(`pruned ${dir}/: not in site/voices.json`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const digest = contentDigest(root, keep);
|
|
157
|
+
writeFileSync(join(root, PULLED), digest);
|
|
158
|
+
console.log(`pulled ${cfg.asset} → ${root} (${packList(root, keep).length} files, ${digest.slice(0, 12)})`);
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function refresh({ cfg, root, deck }) {
|
|
163
|
+
for (const voice of cfg.voices) {
|
|
164
|
+
const out = voiceDir(root, voice);
|
|
165
|
+
console.log(`\n== ${voice.voice} → ${out}`);
|
|
166
|
+
const r = spawnSync(process.execPath, refreshArgv(deck, cfg, voice, out), { stdio: 'inherit' });
|
|
167
|
+
if (r.status !== 0) {
|
|
168
|
+
console.error(`site-voices: voicing ${voice.voice} failed (exit ${r.status ?? r.signal})`);
|
|
169
|
+
return r.status ?? 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function check({ cfg, root, deck }) {
|
|
176
|
+
const html = readFileSync(deck, 'utf8');
|
|
177
|
+
let bad = 0;
|
|
178
|
+
for (const r of checkTracks(html, root, cfg)) {
|
|
179
|
+
if (r.absent) { bad++; console.error(`${r.voice}: no track at all (${r.missing.length} slides with notes)`); continue; }
|
|
180
|
+
if (!r.stale.length && !r.missing.length) { console.log(`${r.voice}: every clip matches its notes`); continue; }
|
|
181
|
+
bad++;
|
|
182
|
+
const parts = [];
|
|
183
|
+
if (r.stale.length) parts.push(`stale: ${r.stale.join(', ')}`);
|
|
184
|
+
if (r.missing.length) parts.push(`missing: ${r.missing.join(', ')}`);
|
|
185
|
+
console.error(`${r.voice}: ${parts.join(' · ')}`);
|
|
186
|
+
}
|
|
187
|
+
if (bad) console.error(`\nsite-voices: ${bad} track(s) do not match ${deck}: run \`refresh\` with the ${cfg.engine} credential in the environment, then \`push\``);
|
|
188
|
+
return bad ? 1 : 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The repository's first commit: a tag there is never the nearest one `git describe` sees. */
|
|
192
|
+
function rootCommit() {
|
|
193
|
+
return run('git', ['rev-list', '--max-parents=0', 'HEAD'], { encoding: 'utf8' }).trim().split('\n').pop();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function push({ cfg, root }) {
|
|
197
|
+
const keep = configuredDirs(cfg);
|
|
198
|
+
const files = packList(root, keep);
|
|
199
|
+
if (!files.length) { console.error(`site-voices: nothing under ${root} for ${keep.join(', ')} to push`); return 1; }
|
|
200
|
+
const digest = contentDigest(root, keep);
|
|
201
|
+
const pulled = existsSync(join(root, PULLED)) ? readFileSync(join(root, PULLED), 'utf8').trim() : null;
|
|
202
|
+
if (pulled === digest) { console.log(`site-voices: ${root} is what was pulled (${digest.slice(0, 12)}), nothing to upload`); return 0; }
|
|
203
|
+
const tmp = mkdtempSync(join(tmpdir(), 'decklight-site-voices-'));
|
|
204
|
+
const tar = join(tmp, cfg.asset);
|
|
205
|
+
run('tar', ['-czf', tar, '-C', root, ...files], { stdio: 'inherit' });
|
|
206
|
+
let exists = true;
|
|
207
|
+
try { gh(['release', 'view', cfg.release], { stdio: ['ignore', 'pipe', 'ignore'] }); } catch { exists = false; }
|
|
208
|
+
if (!exists) {
|
|
209
|
+
gh(['release', 'create', cfg.release, '--prerelease', '--target', rootCommit(),
|
|
210
|
+
'--title', 'Site voices (deploy asset, not a release of decklight)',
|
|
211
|
+
'--notes', `The showcase deck's narration for decklight.io, as one ${cfg.asset}. The site deploy pulls it, re-voices the slides whose notes changed, and pushes it back (tools/site-voices.mjs). Not a version of decklight: the versions are the v* tags.`],
|
|
212
|
+
{ stdio: 'inherit' });
|
|
213
|
+
}
|
|
214
|
+
gh(['release', 'upload', cfg.release, tar, '--clobber'], { stdio: 'inherit' });
|
|
215
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
216
|
+
writeFileSync(join(root, PULLED), digest);
|
|
217
|
+
console.log(`pushed ${files.length} files as ${cfg.asset} on release ${cfg.release} (${digest.slice(0, 12)})`);
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export async function siteVoicesMain(argv = process.argv.slice(2)) {
|
|
222
|
+
const cmd = argv.find((a) => !a.startsWith('-'));
|
|
223
|
+
if (!cmd || argv.includes('--help') || argv.includes('-h')) { console.log(USAGE); return cmd ? 0 : 1; }
|
|
224
|
+
const { opt } = argReader(argv);
|
|
225
|
+
const cfg = loadConfig(opt('--config', 'site/voices.json'));
|
|
226
|
+
const ctx = { cfg, root: resolve(opt('--dir', cfg.dir ?? 'site/voices')), deck: opt('--deck', cfg.deck ?? 'demo/showcase.html') };
|
|
227
|
+
const commands = { pull, refresh, check, push };
|
|
228
|
+
if (!commands[cmd]) { console.error(`site-voices: "${cmd}" is not a command\n\n${USAGE}`); return 2; }
|
|
229
|
+
return commands[cmd](ctx);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (isMain(import.meta.url)) process.exitCode = await siteVoicesMain();
|
package/tools/template-theme.mjs
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* tools/theme-check.mjs clears — a link colour that reads on the slide
|
|
20
20
|
* background, six diagram fills a label can be read on, a code palette that
|
|
21
21
|
* is legible on the block. The result is validated by the same function
|
|
22
|
-
* `decklight theme
|
|
22
|
+
* `decklight theme gate` runs, and if it cannot be made to pass, that is
|
|
23
23
|
* reported rather than shipped.
|
|
24
24
|
*/
|
|
25
25
|
|
package/tools/test-impact.mjs
CHANGED
|
@@ -42,15 +42,17 @@ const repo = path.resolve(here, '..');
|
|
|
42
42
|
|
|
43
43
|
/** narration-render's five concerns, as verify runs them (see test/verify.mjs). */
|
|
44
44
|
const NARRATION = ['narration-render:live', 'narration-render:picker', 'narration-render:recorded', 'narration-render:segments', 'narration-render:record'];
|
|
45
|
+
/** engine-render's concerns, likewise (see test/verify.mjs). */
|
|
46
|
+
const ENGINE = ['engine-render:themes', 'engine-render:palette', 'engine-render:narration', 'engine-render:navigation', 'engine-render:handover', 'engine-render:sources', 'engine-render:authoring', 'engine-render:builds'];
|
|
45
47
|
|
|
46
48
|
/** Every harness `verify` knows, in its running order. */
|
|
47
49
|
export const ALL = [
|
|
48
50
|
'render', 'player-render',
|
|
49
51
|
'narration-render:live', 'narration-render:picker', 'narration-render:recorded', 'narration-render:segments', 'narration-render:record',
|
|
50
52
|
'record-render', 'review-render',
|
|
51
|
-
'character-render', 'engine-render', 'pin-render', 'overflow-render', 'split-render',
|
|
53
|
+
'character-render', 'engine-render:themes', 'engine-render:palette', 'engine-render:narration', 'engine-render:navigation', 'engine-render:handover', 'engine-render:sources', 'engine-render:authoring', 'engine-render:builds', 'pin-render', 'overflow-render', 'split-render',
|
|
52
54
|
'strict-render', 'shot-render', 'plugin-render', 'extension-check-render',
|
|
53
|
-
'deckfile-render', 'pdf-render', 'import-render', 'contrast', 'palette-rules',
|
|
55
|
+
'deckfile-render', 'pdf-render', 'pptx-render', 'import-render', 'theme-config-render', 'contrast', 'palette-rules',
|
|
54
56
|
];
|
|
55
57
|
|
|
56
58
|
/**
|
|
@@ -87,11 +89,11 @@ const RULES = [
|
|
|
87
89
|
[/^src\/core\/character-art\.js$/, ['character-render'], 'the head it draws'],
|
|
88
90
|
[/^src\/core\/review\.js$/, ['review-render'], 'the review overlay and its anchor resolver'],
|
|
89
91
|
[/^src\/core\/overflow\.js$/, ['overflow-render', 'pin-render'], 'the overflow guardrail and the pinned-title case'],
|
|
90
|
-
[/^src\/core\/annotate\.js$/, [
|
|
91
|
-
[/^src\/core\/themes\.js$/, ['render', 'contrast'], 'theme picking, and the contrast gate behind it'],
|
|
92
|
-
[/^src\/core\/(editmode|history)\.js$/,
|
|
93
|
-
[/^src\/core\/hud\.js$/,
|
|
94
|
-
[/^src\/core\/finder\.js$/, [
|
|
92
|
+
[/^src\/core\/annotate\.js$/, [...ENGINE, 'render'], 'ink rides the engine scale'],
|
|
93
|
+
[/^src\/core\/themes\.js$/, ['render', 'contrast', 'theme-config-render'], 'theme picking, the theme a deck opens on, and the contrast gate behind it'],
|
|
94
|
+
[/^src\/core\/(editmode|history|templates|authoring|colorpicker)\.js$/, ENGINE, 'the author surfaces the engine harness drives'],
|
|
95
|
+
[/^src\/core\/hud\.js$/, ENGINE, 'clock and progress live on the engine'],
|
|
96
|
+
[/^src\/core\/finder\.js$/, [...ENGINE, 'review-render'], 'slide titles: the finder names them, review anchors by them'],
|
|
95
97
|
[/^src\/terminal\//, ['player-render'], 'the cast player'],
|
|
96
98
|
[/^src\/code\//, ['render'], 'code blocks render in the smoke deck'],
|
|
97
99
|
[/^src\/core\//, BROWSER, 'an unmapped core module — assume every harness'],
|
|
@@ -103,7 +105,9 @@ const RULES = [
|
|
|
103
105
|
[/^cli\/import\.mjs$/, ['import-render'], 'deck import'],
|
|
104
106
|
[/^cli\/deckfile\.mjs$/, ['deckfile-render'], 'the .decklight container'],
|
|
105
107
|
[/^cli\/pdf\.mjs$/, ['pdf-render'], 'PDF export'],
|
|
106
|
-
[/^cli\/
|
|
108
|
+
[/^cli\/pptx-export\.mjs$/, ['pptx-render'], 'PowerPoint export'],
|
|
109
|
+
[/^tools\/pptx-write\.mjs$/, ['pptx-render'], 'the file the PowerPoint export writes'],
|
|
110
|
+
[/^cli\/(edit|shot)\.mjs$/, ['shot-render'], 'the deck server, and the screenshot containment it asserts'],
|
|
107
111
|
[/^cli\/(comments|review-anchor|review-store|review-remote|review-submit)\.mjs$/, ['review-render'],
|
|
108
112
|
'the CLI half of review — the harness cross-checks the browser against it'],
|
|
109
113
|
[/^cli\/(units|marketplace|loader|pin)\.mjs$/, ['pin-render', 'extension-check-render'],
|
|
@@ -111,6 +115,7 @@ const RULES = [
|
|
|
111
115
|
[/^tools\/extension-check\.mjs$/, ['extension-check-render'], 'the admission gate itself'],
|
|
112
116
|
[/^tools\/(theme-check|color)\.mjs$/, LINT, 'the theme lints'],
|
|
113
117
|
[/^tools\/chrome\.mjs$/, ALL, 'every harness starts a browser through it'],
|
|
118
|
+
[/^tools\/render-theme\.mjs$/, ['pdf-render', 'pptx-render', 'shot-render'], 'the theme a render is told to open on'],
|
|
114
119
|
[/^tools\/review-anchor\.mjs$/, ['review-render'], 'the anchor resolver both halves share'],
|
|
115
120
|
[/^tools\/(tts-engines|local-voice|voiceover-server|lipsync)\.mjs$/, [...NARRATION, 'record-render'],
|
|
116
121
|
'the voice bridge narration talks to'],
|
|
@@ -217,10 +222,14 @@ const selected = ALL.filter((h) => picked.has(h));
|
|
|
217
222
|
// Measured on a laptop; a rough shape so the report can say what it saves.
|
|
218
223
|
const COST = {
|
|
219
224
|
'narration-render:live': 25, 'narration-render:picker': 12, 'narration-render:recorded': 12,
|
|
220
|
-
'narration-render:segments': 12, 'narration-render:record': 40, 'extension-check-render': 23,
|
|
225
|
+
'narration-render:segments': 12, 'narration-render:record': 40, 'extension-check-render': 23, render: 20,
|
|
226
|
+
// engine-render's seven, roughly a second a mode plus a browser start
|
|
227
|
+
'engine-render:themes': 6, 'engine-render:palette': 5, 'engine-render:narration': 4,
|
|
228
|
+
'engine-render:navigation': 4, 'engine-render:handover': 4,
|
|
229
|
+
'engine-render:sources': 3, 'engine-render:authoring': 3, 'engine-render:builds': 3,
|
|
221
230
|
'pdf-render': 10, 'split-render': 9, 'review-render': 8, 'pin-render': 7, 'record-render': 7,
|
|
222
231
|
'strict-render': 6, 'overflow-render': 6, 'plugin-render': 6, 'deckfile-render': 4,
|
|
223
|
-
'shot-render': 4, 'player-render': 3, 'character-render': 2, 'import-render': 2,
|
|
232
|
+
'shot-render': 4, 'pptx-render': 6, 'player-render': 3, 'character-render': 2, 'import-render': 2, 'theme-config-render': 3,
|
|
224
233
|
contrast: 1, 'palette-rules': 1,
|
|
225
234
|
};
|
|
226
235
|
const cost = (list) => list.reduce((n, h) => n + (COST[h] ?? 10), 0);
|
package/tools/theme-check.mjs
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
// gates their theme would be judged by.
|
|
12
12
|
//
|
|
13
13
|
// So the rules live here, under tools/, which ships. test/contrast.mjs is now
|
|
14
|
-
// a loop over this, and `decklight theme
|
|
14
|
+
// a loop over this, and `decklight theme gate` is the same loop over one file.
|
|
15
15
|
//
|
|
16
16
|
// There is no version number in a theme, deliberately. Compatibility with a
|
|
17
17
|
// runtime IS passing that runtime's check — and when the contract grows a
|
|
18
18
|
// token, the report names exactly what an older theme is missing.
|
|
19
19
|
|
|
20
|
-
import { colorsIn, contrast, parseTheme } from './color.mjs';
|
|
20
|
+
import { colorsIn, contrast, parseTheme, nestedTone, toOklab } from './color.mjs';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Every token a theme must declare (SPEC THEMING). Presence is checked separately
|
|
@@ -120,14 +120,41 @@ export function validateTheme(css) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// Fill on fill (SVG_DIAGRAMS, #541): a box nested in a panel is painted the
|
|
124
|
+
// panel's nested tone — `--d-fill-N-in`, the theme's own or the runtime's
|
|
125
|
+
// default mix toward the ink — and it has to be a step the eye reads AND
|
|
126
|
+
// still carry the ink. A theme can pass every ink gate while its nested
|
|
127
|
+
// boxes vanish into their panels; this is the gate for that.
|
|
128
|
+
const ink = colorsIn(tokens['d-text'] ?? '')[0];
|
|
129
|
+
for (let i = 1; i <= 6; i++) {
|
|
130
|
+
const fill = colorsIn(tokens[`d-fill-${i}`] ?? '')[0];
|
|
131
|
+
if (!ink || !fill) continue; // missing or unparseable: already reported above
|
|
132
|
+
const own = tokens[`d-fill-${i}-in`];
|
|
133
|
+
const tone = own ? colorsIn(own)[0] : nestedTone(fill, ink);
|
|
134
|
+
if (!tone) { failures.push({ fg: `d-fill-${i}-in`, bg: `d-fill-${i}`, min: NESTED_MIN_DL, ratio: null }); errors.push(`--d-fill-${i}-in: unparseable color`); continue; }
|
|
135
|
+
const dL = Math.abs(toOklab(tone)[0] - toOklab(fill)[0]);
|
|
136
|
+
if (dL < NESTED_MIN_DL) {
|
|
137
|
+
failures.push({ fg: `d-fill-${i}-in`, bg: `d-fill-${i}`, min: NESTED_MIN_DL, ratio: dL });
|
|
138
|
+
errors.push(`--d-fill-${i}-in on --d-fill-${i}: ΔL ${dL.toFixed(3)} < ${NESTED_MIN_DL} — a box nested in this panel would vanish into it`);
|
|
139
|
+
}
|
|
140
|
+
const r = contrast(ink, tone);
|
|
141
|
+
if (r < 3.0) {
|
|
142
|
+
failures.push({ fg: 'd-text', bg: `d-fill-${i}-in`, min: 3.0, ratio: r });
|
|
143
|
+
errors.push(`--d-text on --d-fill-${i}-in${own ? '' : ' (derived)'}: ${r.toFixed(2)} < 3`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
123
147
|
return { ok: errors.length === 0, tokens, exceptions, missing, failures, errors, empty: false };
|
|
124
148
|
}
|
|
125
149
|
|
|
150
|
+
/** The least OKLab lightness step between a panel and the tone of a box nested in it. */
|
|
151
|
+
export const NESTED_MIN_DL = 0.06;
|
|
152
|
+
|
|
126
153
|
/** A theme name from a path or URL: the basename, minus .css. */
|
|
127
154
|
export function themeNameFrom(source) {
|
|
128
155
|
// Both separators, because `source` is either a URL (always `/`) or a local
|
|
129
156
|
// path (`\` on Windows). Splitting on `/` alone made the whole path the
|
|
130
|
-
// name there — `decklight theme
|
|
157
|
+
// name there — `decklight theme gate C:\themes\aurora.css` reported
|
|
131
158
|
// `✔ C:\themes\aurora`, and `theme add` would then have tried to install
|
|
132
159
|
// under a name validThemeName refuses, from a file that was perfectly fine.
|
|
133
160
|
const last = String(source ?? '').split(/[?#]/)[0].split(/[/\\]/).filter(Boolean).pop() ?? '';
|
package/tools/tts-cache.mjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* a new name, and yesterday's clip is unreachable rather than wrong.
|
|
16
16
|
*
|
|
17
17
|
* What that buys is the thing the memory cache never could: the live bridge
|
|
18
|
-
* and `decklight
|
|
18
|
+
* and `decklight narrate` are SEPARATE PROCESSES, so a deck previewed
|
|
19
19
|
* sentence by sentence in the browser and then batch-recorded paid ElevenLabs
|
|
20
20
|
* twice for identical text. They now meet here, because the key is derived
|
|
21
21
|
* from what was said and how — not from who is asking.
|
|
@@ -75,8 +75,9 @@ export const CACHE_EXTS = ['.wav', '.mp3'];
|
|
|
75
75
|
* first 8 KB binary, and this file would silently become undiffable.
|
|
76
76
|
*/
|
|
77
77
|
export function cacheKey({ engine, model, format, voice, style, text } = {}) {
|
|
78
|
+
const fields = [engine, model, format, voice, style, text];
|
|
78
79
|
return createHash('sha256')
|
|
79
|
-
.update(
|
|
80
|
+
.update(fields.map((f) => f ?? '').join('\u0000'))
|
|
80
81
|
.digest('hex');
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -85,7 +86,7 @@ export function cacheKey({ engine, model, format, voice, style, text } = {}) {
|
|
|
85
86
|
*
|
|
86
87
|
* `cacheKey` above takes loose fields, which is what makes it testable; this
|
|
87
88
|
* takes the engine object and derives them, which is what makes the live
|
|
88
|
-
* bridge and `decklight
|
|
89
|
+
* bridge and `decklight narrate` agree. They used to assemble the fields
|
|
89
90
|
* separately, and separately is how a cache that spans two processes quietly
|
|
90
91
|
* stops hitting: one of them starts sending a field the other does not, every
|
|
91
92
|
* lookup misses, and nothing fails — you just pay twice again.
|
package/tools/tts-engines.mjs
CHANGED
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
// elevenlabs — the one whose roster is YOUR account's, cloned voices included.
|
|
27
27
|
// Needs $ELEVENLABS_API_KEY (never saved to disk). Metered in
|
|
28
28
|
// characters against a plan allowance we cannot see, so it reports
|
|
29
|
-
// characters and no dollar estimate. Style
|
|
30
|
-
//
|
|
31
|
-
// channel
|
|
32
|
-
// `stylable` here
|
|
29
|
+
// characters and no dollar estimate. Style reaches only the tag
|
|
30
|
+
// models — eleven_v4 (the default), eleven_v4_turbo, eleven_v3 —
|
|
31
|
+
// whose delivery channel is bracketed audio tags read as direction,
|
|
32
|
+
// not words; so `stylable` and `audioTags` here depend on the model
|
|
33
|
+
// chosen, not just the engine.
|
|
33
34
|
//
|
|
34
35
|
// Cost is always an ESTIMATE from published list prices. Chirp's estimate is
|
|
35
36
|
// the list price *ignoring* the free tier — we cannot see your monthly usage,
|
|
@@ -47,13 +48,13 @@ import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
|
47
48
|
import { homedir, tmpdir } from 'node:os';
|
|
48
49
|
import { delimiter, join } from 'node:path';
|
|
49
50
|
import { createSynth as createGemini, GEMINI_VOICES, gcloudToken, validProjectId, authHeaders } from './gemini-tts.mjs';
|
|
50
|
-
import { run, PROBE_MS } from './exec.mjs';
|
|
51
|
+
import { run, PROBE_MS, NETWORK_MS } from './exec.mjs';
|
|
51
52
|
import {
|
|
52
53
|
createSynth as createElevenLabs, apiKey as elevenLabsKey, KEY_ENV as ELEVENLABS_KEY_ENV,
|
|
53
|
-
DEFAULT_MODEL as ELEVENLABS_MODEL, V3_MODEL as ELEVENLABS_V3_MODEL,
|
|
54
|
+
DEFAULT_MODEL as ELEVENLABS_MODEL, V3_MODEL as ELEVENLABS_V3_MODEL, readsAudioTags,
|
|
54
55
|
} from './elevenlabs-tts.mjs';
|
|
55
56
|
import {
|
|
56
|
-
detectLocalVoice, sayArgs, sapiArgs, winrtArgs, TIER_LABEL, withoutSupersededPlain,
|
|
57
|
+
detectLocalVoice, sayArgs, sapiArgs, winrtArgs, TIER_LABEL, withoutSupersededPlain, baseName,
|
|
57
58
|
} from './local-voice.mjs';
|
|
58
59
|
|
|
59
60
|
export const ENGINES = ['gemini', 'chirp', 'piper', 'elevenlabs', 'say', 'sapi'];
|
|
@@ -131,6 +132,7 @@ function createChirp({ project, lang = 'en-US' }) {
|
|
|
131
132
|
const res = await fetch('https://texttospeech.googleapis.com/v1/text:synthesize', {
|
|
132
133
|
method: 'POST',
|
|
133
134
|
headers: authHeaders(token, project),
|
|
135
|
+
signal: AbortSignal.timeout(NETWORK_MS),
|
|
134
136
|
body: JSON.stringify({
|
|
135
137
|
input: { text },
|
|
136
138
|
voice: { languageCode: lang, name: chirpVoice(voice, lang) },
|
|
@@ -343,7 +345,7 @@ function createPiper({ voice = PIPER_DEFAULT_VOICE, dataDir }) {
|
|
|
343
345
|
* seconds — so this is not a budget, it is a tripwire. The failure it exists
|
|
344
346
|
* for: macOS's speech server (speechsynthesisd) can deadlock under concurrent
|
|
345
347
|
* `say` calls, and the child then sits forever with no CPU and no output.
|
|
346
|
-
* Unbounded, that hung `decklight
|
|
348
|
+
* Unbounded, that hung `decklight narrate` indefinitely with no message,
|
|
347
349
|
* and hung the unit suite for eight minutes before anyone looked.
|
|
348
350
|
*/
|
|
349
351
|
export const NATIVE_TIMEOUT_MS = 60_000;
|
|
@@ -359,6 +361,11 @@ function createNative({
|
|
|
359
361
|
// The roster this machine actually has, for the guard below. Held as names
|
|
360
362
|
// because that is what the player sends and what `say -v` takes.
|
|
361
363
|
const known = new Set(voices.map((v) => v?.name ?? v).filter(Boolean));
|
|
364
|
+
// …and the names under their suffixes, which `say -v` answers to as well:
|
|
365
|
+
// macOS 27 lists `Samantha (English (US))`, and `say -v Samantha` still
|
|
366
|
+
// speaks her. A deck that saved `Samantha`, and a track recorded as her, must
|
|
367
|
+
// not stop working because the listing grew a suffix.
|
|
368
|
+
const knownBase = new Set(kind === 'say' ? [...known].map(baseName).filter(Boolean) : []);
|
|
362
369
|
/**
|
|
363
370
|
* `(text, { voice })` — the SECOND argument is the voice for THIS sentence,
|
|
364
371
|
* and it is the whole contract every other engine here implements.
|
|
@@ -375,7 +382,7 @@ function createNative({
|
|
|
375
382
|
// stale saved voice, or a roster from another engine all sound like
|
|
376
383
|
// success while giving you somebody else's voice. (PowerShell's
|
|
377
384
|
// SelectVoice already throws on an unknown name; this makes the two agree.)
|
|
378
|
-
if (kind === 'say' && known.size && pick && !known.has(pick)) {
|
|
385
|
+
if (kind === 'say' && known.size && pick && !known.has(pick) && !knownBase.has(pick)) {
|
|
379
386
|
throw new Error(`no ${kind} voice named ${JSON.stringify(pick)} on this machine`
|
|
380
387
|
+ ` — this bridge speaks ${known.size} others (GET /voices)`);
|
|
381
388
|
}
|
|
@@ -421,7 +428,11 @@ function createNative({
|
|
|
421
428
|
};
|
|
422
429
|
}
|
|
423
430
|
|
|
424
|
-
export function createEngine({
|
|
431
|
+
export function createEngine(opts = {}) {
|
|
432
|
+
return buildEngine(opts);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function buildEngine({
|
|
425
436
|
engine = 'gemini', project, model, location, voice, dataDir, lang, format, stability, env = process.env,
|
|
426
437
|
// Injected like every other probe in this file, so a native engine can be
|
|
427
438
|
// built — and its voice handling asserted — on a machine that is not the one
|
|
@@ -433,7 +444,7 @@ export function createEngine({
|
|
|
433
444
|
} = {}) {
|
|
434
445
|
if (!ENGINES.includes(engine)) {
|
|
435
446
|
throw new Error(`unknown engine '${engine}' — use ${ENGINES.join(', ')},`
|
|
436
|
-
+ ` or install one: decklight
|
|
447
|
+
+ ` or install one: decklight library add engine ${engine}`);
|
|
437
448
|
}
|
|
438
449
|
|
|
439
450
|
// `cost` is the human-facing price note — the bridge's startup line and the
|
|
@@ -504,15 +515,19 @@ export function createEngine({
|
|
|
504
515
|
if (engine === 'elevenlabs') {
|
|
505
516
|
const m = model ?? ELEVENLABS_MODEL;
|
|
506
517
|
const isV3 = m === ELEVENLABS_V3_MODEL;
|
|
507
|
-
const
|
|
518
|
+
const tagged = readsAudioTags(m);
|
|
519
|
+
const { listVoices, synth, searchLibrary, addLibraryVoice } = createElevenLabs({
|
|
508
520
|
key: elevenLabsKey(env), model: m, format: format ?? 'pcm', stability,
|
|
509
521
|
});
|
|
510
522
|
return {
|
|
511
523
|
name: 'elevenlabs', model: m, needsProject: false,
|
|
512
|
-
// v3
|
|
513
|
-
// would read a tag's brackets aloud as words, so the tone step
|
|
524
|
+
// v3 and v4 read audio tags as direction — every other ElevenLabs model
|
|
525
|
+
// would read a tag's brackets aloud as words, so the tone step and a
|
|
526
|
+
// deck's own tags ([whispers], [laughs]) are for those models only,
|
|
514
527
|
// decided here from the model rather than the picker guessing by name.
|
|
515
|
-
|
|
528
|
+
// `audioTags` is what tells the rest of decklight to keep a deck's tags
|
|
529
|
+
// in the text; every other engine has them taken out, never spoken.
|
|
530
|
+
stylable: tagged, audioTags: tagged,
|
|
516
531
|
cost: 'metered in characters against your plan',
|
|
517
532
|
// Stated once, at startup, where the presenter is still choosing —
|
|
518
533
|
// v3 trades latency and consistency for expressiveness, and ElevenLabs'
|
|
@@ -526,6 +541,9 @@ export function createEngine({
|
|
|
526
541
|
// the real roster arrives from the account; until it does the picker has
|
|
527
542
|
// nothing truthful to show, which is better than thirty names it cannot say
|
|
528
543
|
voices: [], listVoices,
|
|
544
|
+
// the voice library: other people's voices, by language (the account's
|
|
545
|
+
// own are mostly English, and a translated deck wants a native one)
|
|
546
|
+
searchLibrary, addLibraryVoice,
|
|
529
547
|
synth,
|
|
530
548
|
};
|
|
531
549
|
}
|
|
@@ -570,10 +588,10 @@ export function binOnPath(bin, env = process.env) {
|
|
|
570
588
|
* typed. Readiness is a question about the MACHINE (a binary, a model file, a
|
|
571
589
|
* key, a project), and it has to be asked before anything is constructed.
|
|
572
590
|
*
|
|
573
|
-
* WHY IT LIVES HERE. Two callers now ask it: `decklight
|
|
591
|
+
* WHY IT LIVES HERE. Two callers now ask it: `decklight <deck>`, deciding
|
|
574
592
|
* whether to start the bridge at all, and the bridge itself, listing what the
|
|
575
593
|
* deck may switch to (SPEC `NARRATION`). They must not disagree — a picker
|
|
576
|
-
* offering an engine that `
|
|
594
|
+
* offering an engine that `open` would have refused is a picker that lies.
|
|
577
595
|
* So the DECISION is shared and only the presentation differs: `reason` is a
|
|
578
596
|
* code the caller phrases for its own audience.
|
|
579
597
|
*
|
|
@@ -620,7 +638,7 @@ export function engineStatus(name, {
|
|
|
620
638
|
* A blocker in two short sentences: what is missing, and what fixes it.
|
|
621
639
|
*
|
|
622
640
|
* These are the PICKER's words — one line each, because they are drawn under a
|
|
623
|
-
* greyed row in a deck. `decklight
|
|
641
|
+
* greyed row in a deck. `decklight <deck>` phrases the same codes at length
|
|
624
642
|
* (it has a terminal, and it is the place a presenter is still setting up).
|
|
625
643
|
* Both read the same `reason`, so they can be worded for their audience
|
|
626
644
|
* without being able to disagree about the facts.
|
|
@@ -643,11 +661,11 @@ export function engineBlocker(status, { env = process.env } = {}) {
|
|
|
643
661
|
{ hasBin: (b) => binOnPath(b, env) })),
|
|
644
662
|
};
|
|
645
663
|
case 'no-key':
|
|
646
|
-
return { why: `needs $${ELEVENLABS_KEY_ENV}`, fix: 'export it, then restart decklight
|
|
664
|
+
return { why: `needs $${ELEVENLABS_KEY_ENV}`, fix: 'export it, then restart decklight' };
|
|
647
665
|
case 'no-project':
|
|
648
666
|
return {
|
|
649
667
|
why: 'needs a Google Cloud project',
|
|
650
|
-
fix: 'export GOOGLE_CLOUD_PROJECT=<id>, then restart decklight
|
|
668
|
+
fix: 'export GOOGLE_CLOUD_PROJECT=<id>, then restart decklight',
|
|
651
669
|
};
|
|
652
670
|
case 'bad-project':
|
|
653
671
|
// Named rather than generic: this one is nearly always a copy-paste that
|
package/tools/tts-setup.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// First-run TTS setup (SPEC PRESENTING): the guided questions that turn "gemini needs
|
|
5
5
|
// a GCP project" from a dead end into a working voice. Both entry points share
|
|
6
6
|
// it — `decklight tts` runs it where it used to exit with that error (and on
|
|
7
|
-
// `--setup`), `decklight
|
|
7
|
+
// `--setup`), `decklight <deck>` offers it where it would otherwise skip the
|
|
8
8
|
// voice bridge.
|
|
9
9
|
//
|
|
10
10
|
// The questions ARE the engines' error strings turned around: everything the
|
|
@@ -152,7 +152,7 @@ export async function runSetupWizard({
|
|
|
152
152
|
log(' piper is not installed. the install is one command:');
|
|
153
153
|
log(' uv tool install piper-tts');
|
|
154
154
|
if (!yes(await ask(' run it now? [y/N] '), false)) {
|
|
155
|
-
log(' install piper, then run: decklight
|
|
155
|
+
log(' install piper, then run: decklight setup voice');
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
158
|
if (!runCmd('uv', ['tool', 'install', 'piper-tts'])) {
|
|
@@ -177,7 +177,7 @@ export async function runSetupWizard({
|
|
|
177
177
|
log(` ${piperDownloadLine(dl)}`);
|
|
178
178
|
if (!dl) return null;
|
|
179
179
|
if (!yes(await ask(' run it now? [y/N] '), false)) {
|
|
180
|
-
log(' fetch the model, then run: decklight
|
|
180
|
+
log(' fetch the model, then run: decklight setup voice');
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
183
|
mkdirSync(models, { recursive: true });
|
|
@@ -197,7 +197,7 @@ export async function runSetupWizard({
|
|
|
197
197
|
log(' then export it (your shell profile is the right home for it — decklight');
|
|
198
198
|
log(' deliberately never writes it to its config file):');
|
|
199
199
|
log(` export ${ELEVENLABS_KEY_ENV}=...`);
|
|
200
|
-
log(' then run: decklight
|
|
200
|
+
log(' then run: decklight setup voice');
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
203
|
// Which voice is a question the account answers, not the user: the roster
|
|
@@ -220,7 +220,7 @@ export async function runSetupWizard({
|
|
|
220
220
|
// detect and name the way in — never drive a browser auth flow
|
|
221
221
|
log(' no application-default credentials — mint them with:');
|
|
222
222
|
log(' gcloud auth application-default login');
|
|
223
|
-
log(' then run: decklight
|
|
223
|
+
log(' then run: decklight setup voice');
|
|
224
224
|
return null;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -240,12 +240,12 @@ export async function runSetupWizard({
|
|
|
240
240
|
} catch (e) {
|
|
241
241
|
engine?.synth.close?.();
|
|
242
242
|
log(` test synthesis failed: ${e.message ?? e}`);
|
|
243
|
-
log(' nothing saved — fix that, then run: decklight
|
|
243
|
+
log(' nothing saved — fix that, then run: decklight setup voice');
|
|
244
244
|
return null;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// 4. only a config that has spoken gets saved
|
|
248
248
|
const file = saveTtsConfig(config, env);
|
|
249
|
-
log(` saved to ${file} — decklight
|
|
249
|
+
log(` saved to ${file} — decklight <deck> reads it from now on`);
|
|
250
250
|
return { config, engine };
|
|
251
251
|
}
|