decklight 0.9.0 → 0.11.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/NOTICE +2 -0
- package/PLATFORM.md +61 -3
- package/README.md +58 -28
- package/SPEC.md +1326 -85
- package/cli/agent-review.mjs +5 -4
- package/cli/agents.mjs +148 -18
- package/cli/bundle-audio.mjs +10 -3
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +125 -7
- package/cli/cast.mjs +86 -19
- package/cli/check-fixes.mjs +194 -0
- package/cli/check-watch.mjs +151 -0
- package/cli/check.mjs +491 -75
- package/cli/code-editor.mjs +287 -0
- package/cli/commands.mjs +13 -2
- package/cli/commit-flow.mjs +7 -3
- package/cli/commit-message.mjs +35 -8
- package/cli/commit-split.mjs +125 -25
- package/cli/deck-refs.mjs +8 -3
- package/cli/decklight.mjs +11 -1
- package/cli/design-system-edit.mjs +37 -1
- package/cli/design-system-refs.mjs +263 -6
- package/cli/design-system.mjs +82 -14
- package/cli/edit-address.mjs +184 -0
- package/cli/edit-git.mjs +23 -6
- package/cli/edit-handover.mjs +257 -40
- package/cli/edit-look.mjs +293 -6
- package/cli/edit-open.mjs +143 -0
- package/cli/edit-slides.mjs +1043 -67
- package/cli/edit-translate.mjs +243 -0
- package/cli/edit.mjs +3680 -319
- package/cli/editor-support.mjs +286 -0
- package/cli/enhance.mjs +157 -27
- package/cli/find-replace.mjs +142 -0
- package/cli/fix-review.mjs +368 -0
- package/cli/git.mjs +13 -0
- package/cli/init.mjs +101 -22
- package/cli/keep-awake.mjs +68 -0
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +250 -13
- package/cli/migrate-writing.mjs +214 -0
- package/cli/narrate.mjs +121 -5
- package/cli/open.mjs +53 -15
- package/cli/outside-edit.mjs +257 -0
- package/cli/paste.mjs +92 -0
- package/cli/pdf.mjs +88 -10
- package/cli/pptx-export.mjs +10 -5
- package/cli/publish.mjs +24 -3
- package/cli/record.mjs +86 -15
- package/cli/remote.mjs +32 -6
- package/cli/rewrite.mjs +265 -0
- package/cli/runtime-link.mjs +218 -17
- package/cli/serve.mjs +9 -6
- package/cli/setup.mjs +2 -2
- package/cli/skill-content.mjs +251 -10
- package/cli/skills/slide-writing.md +333 -0
- package/cli/skills/voiceover.md +423 -0
- package/cli/skills.mjs +282 -15
- package/cli/starter-full.mjs +353 -0
- package/cli/supervise.mjs +14 -0
- package/cli/theme-refs.mjs +14 -2
- package/cli/theme.mjs +3 -2
- package/cli/translate-core.mjs +466 -0
- package/cli/translate-files.mjs +149 -0
- package/cli/translate.mjs +458 -0
- package/cli/units.mjs +75 -7
- package/cli/util.mjs +25 -0
- package/cli/vocabulary-docs.mjs +138 -0
- package/dist/decklight.css +2506 -113
- package/dist/decklight.js +385 -175
- package/dist/decklight.js.map +4 -4
- package/docs/GLOSSARY.md +9 -2
- package/docs/WRITING_RESEARCH.md +327 -0
- package/package.json +5 -3
- package/themes/coastal.css +3 -0
- package/themes/metropolis.css +2 -0
- package/themes/reveal-blood.css +3 -0
- package/themes/reveal-league.css +2 -0
- package/themes/reveal-moon.css +2 -0
- package/themes/reveal-serif.css +1 -0
- package/themes/reveal-sky.css +1 -0
- package/themes/reveal-solarized.css +4 -0
- package/tools/brand-palette.mjs +6 -1
- package/tools/build-groups.mjs +28 -8
- package/tools/cdp.mjs +176 -0
- package/tools/chart-spec.mjs +242 -0
- package/tools/click-match.mjs +70 -0
- package/tools/code-options.mjs +174 -0
- package/tools/conversation.mjs +49 -0
- package/tools/deck-family.mjs +101 -0
- package/tools/deck-html.mjs +212 -15
- package/tools/design-system-format.mjs +40 -1
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/diagram-shapes.mjs +221 -0
- package/tools/elevenlabs-tts.mjs +62 -53
- package/tools/exec.mjs +10 -2
- package/tools/face-clip.mjs +96 -0
- package/tools/face-layout.mjs +94 -0
- package/tools/gemini-tts.mjs +1 -1
- package/tools/invisible-in-print.mjs +27 -0
- package/tools/lipsync-auto.mjs +197 -0
- package/tools/lipsync-config.mjs +16 -0
- package/tools/lipsync-engines.mjs +22 -4
- package/tools/lipsync-server.mjs +8 -5
- package/tools/lipsync.mjs +122 -30
- package/tools/local-voice.mjs +1 -1
- package/tools/mouth-file.mjs +26 -0
- package/tools/mouth.mjs +320 -0
- package/tools/narration-manifest.mjs +100 -6
- package/tools/narration-synth.mjs +96 -76
- package/tools/recording-impact.mjs +16 -1
- package/tools/sentences.mjs +7 -1
- package/tools/site-clip.mjs +114 -0
- package/tools/starters.mjs +402 -0
- package/tools/steps.mjs +118 -0
- package/tools/take-check.mjs +146 -0
- package/tools/template-theme.mjs +3 -1
- package/tools/test-impact.mjs +36 -12
- package/tools/theme-check.mjs +196 -1
- package/tools/tone-cue.mjs +108 -0
- package/tools/tts-cache.mjs +9 -3
- package/tools/tts-engines.mjs +100 -11
- package/tools/video-cache.mjs +93 -0
- package/tools/video-live.mjs +349 -0
- package/tools/video-options.mjs +11 -0
- package/tools/video.mjs +825 -117
- package/tools/viseme-fit.mjs +27 -0
- package/tools/viseme-match.mjs +77 -0
- package/tools/vocabulary.mjs +397 -0
- package/tools/voice-renumber.mjs +605 -0
- package/tools/voiceover-server.mjs +42 -11
- package/tools/voiceover.mjs +48 -20
- package/dist/build-info.json +0 -1
package/cli/narrate.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* decklight narrate — put the deck's narration into a folder beside it.
|
|
6
6
|
*
|
|
7
7
|
* decklight narrate <deck.html> [--engine E] [--voice V] [--format F] [--slides a-b] [--dir NAME]
|
|
8
|
-
* decklight narrate <deck.html> --mic [--slides a-b] [--dir NAME] [--port N] [--no-open]
|
|
8
|
+
* decklight narrate <deck.html> --mic [--slides a-b] [--dir NAME] [--port N] [--remote] [--no-open]
|
|
9
9
|
* decklight narrate <deck.html> --face [--video] [--dir NAME]
|
|
10
10
|
*
|
|
11
11
|
* One command for the two ways a deck gets a recorded voice: an engine reads
|
|
@@ -32,6 +32,8 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
|
32
32
|
import { dirname, join, relative, resolve, isAbsolute } from 'node:path';
|
|
33
33
|
import { fileURLToPath } from 'node:url';
|
|
34
34
|
import { firstPositional, isMain } from '../tools/args.mjs';
|
|
35
|
+
import { deckLang } from '../tools/deck-html.mjs';
|
|
36
|
+
import { deckFamily, ownsTrack, readManifest, defaultTrackDir } from '../tools/deck-family.mjs';
|
|
35
37
|
import { runMain, wrongRecorder } from './util.mjs';
|
|
36
38
|
import { configuredTrackDirs } from './edit.mjs';
|
|
37
39
|
|
|
@@ -39,7 +41,7 @@ const VOICEOVER = fileURLToPath(new URL('../tools/voiceover.mjs', import.meta.ur
|
|
|
39
41
|
const LIPSYNC = fileURLToPath(new URL('../tools/lipsync.mjs', import.meta.url));
|
|
40
42
|
// the flags either side takes a value for, so the deck is found past them
|
|
41
43
|
const VALUE_FLAGS = new Set(['-o', '--dir', '--engine', '--voice', '--style', '--data-dir', '--project',
|
|
42
|
-
'--format', '--slides', '--port', '--model', '--lang', '--location', '--tts-format', '--tts-stability',
|
|
44
|
+
'--format', '--slides', '--beats', '--countdown', '--takes', '--port', '--model', '--lang', '--location', '--tts-format', '--tts-stability',
|
|
43
45
|
'--rhubarb', '--portrait', '--python', '--wav2lip-dir', '--wav2lip-ckpt', '--sadtalker-dir',
|
|
44
46
|
'--veo-project', '--veo-location', '--veo-model', '--veo-seconds', '--veo-prompt', '--veo-face-y']);
|
|
45
47
|
|
|
@@ -53,18 +55,26 @@ export const USAGE = `usage: decklight narrate <deck.html> [--mic] [--slides a-b
|
|
|
53
55
|
--voice V the engine's voice name
|
|
54
56
|
--format F m4a (a new track's default) · wav · mp3
|
|
55
57
|
--reuse-text, --keep-wav, --no-cache (decklight narrate <deck> --help --engine)
|
|
58
|
+
a deck with a 2D character gets the lip-sync of what was voiced too (--no-face: not)
|
|
56
59
|
EXAMPLE: decklight narrate talk.html --engine chirp --voice Achernar
|
|
57
60
|
|
|
58
61
|
you read the notes, into the microphone
|
|
59
62
|
--mic serves the deck on http://127.0.0.1 (a microphone needs it) and
|
|
60
63
|
opens it with the recorder up; → ends a beat and reveals the
|
|
61
64
|
next build, so your voice paces the deck as it will be presented
|
|
65
|
+
--beats k-l with --slides N: only these beats of slide N; the others are kept
|
|
66
|
+
--takes slide|beat one take per slide (→ cuts a beat and keeps going), or per beat
|
|
67
|
+
--countdown N seconds of count-in before each take, 0 for none
|
|
68
|
+
--remote the phone remote too: its next ends a beat, its retake redoes one,
|
|
69
|
+
so no keystroke gets into the take
|
|
70
|
+
--camera film your face too, beat by beat; the deck and decklight video show it
|
|
62
71
|
--port N, --no-open
|
|
63
72
|
EXAMPLE: decklight narrate talk.html --mic
|
|
64
73
|
|
|
65
74
|
either way, an engine or the microphone
|
|
66
75
|
--slides a-b only these slides; every other slide's files are left alone
|
|
67
|
-
--dir NAME the folder, relative to the deck
|
|
76
|
+
--dir NAME the folder, relative to the deck
|
|
77
|
+
[an engine: its narration.files, else voiceover · --mic: voices/me]
|
|
68
78
|
|
|
69
79
|
the character mouths what is already there (--face)
|
|
70
80
|
--face lip-sync for every slide and [click] beat in the folder, which the
|
|
@@ -75,6 +85,19 @@ export const USAGE = `usage: decklight narrate <deck.html> [--mic] [--slides a-b
|
|
|
75
85
|
--dir NAME only this folder [every one the deck's narration.files names]
|
|
76
86
|
EXAMPLE: decklight narrate talk.html --face
|
|
77
87
|
|
|
88
|
+
is the narration still the notes? (--check)
|
|
89
|
+
--check every track beside the deck, slide by slide: in step, the words
|
|
90
|
+
changed, or (your own voice) only the [click] split moved, which
|
|
91
|
+
a recording cannot follow; each with the command that fixes it.
|
|
92
|
+
An engine's clips far longer or shorter than their text runs are
|
|
93
|
+
listed as worth a listen. Exits 1 when something is out of step
|
|
94
|
+
--dir NAME only this folder
|
|
95
|
+
--realign a track whose recordings are only in the wrong place (slides
|
|
96
|
+
inserted, moved or deleted outside decklight's own slide ops) is
|
|
97
|
+
moved back onto the slides they were read from; nothing is
|
|
98
|
+
deleted, and a rename onto a file outside the plan stops it
|
|
99
|
+
EXAMPLE: decklight narrate talk.html --check
|
|
100
|
+
|
|
78
101
|
the deck plays the folder back with
|
|
79
102
|
narration: { files: '<dir>', segments: true } (wav: ext: 'wav')
|
|
80
103
|
`;
|
|
@@ -118,7 +141,7 @@ export function faceFolders(deckPath, html, dirArg) {
|
|
|
118
141
|
const deckDir = dirname(resolve(deckPath));
|
|
119
142
|
if (dirArg) return [resolve(deckDir, dirArg)];
|
|
120
143
|
const named = configuredTrackDirs(html).filter((d) => !/^[a-z][a-z0-9+.-]*:/i.test(d));
|
|
121
|
-
const dirs = (named.length ? named : [
|
|
144
|
+
const dirs = (named.length ? named : [defaultTrackDir(resolve(deckPath))]).map((d) => resolve(deckDir, d));
|
|
122
145
|
return [...new Set(dirs)].filter(hasAudio);
|
|
123
146
|
}
|
|
124
147
|
|
|
@@ -144,13 +167,99 @@ function faceMain(plan, argv) {
|
|
|
144
167
|
// --face and --dir NAME are this command's, not the tool's
|
|
145
168
|
const deckAt = argv.indexOf(plan.deck);
|
|
146
169
|
const rest = argv.filter((a, i) => i !== deckAt && a !== '--face' && (dirAt === -1 || (i !== dirAt && i !== dirAt + 1)));
|
|
170
|
+
// the deck's language picks the recogniser, unless --lang already did
|
|
171
|
+
const lang = deckLang(html);
|
|
172
|
+
const langArgs = lang && !rest.includes('--lang') ? ['--lang', lang] : [];
|
|
147
173
|
for (const dir of folders) {
|
|
148
|
-
const r = spawnSync(process.execPath, [LIPSYNC, dir, ...rest], { stdio: 'inherit' });
|
|
174
|
+
const r = spawnSync(process.execPath, [LIPSYNC, dir, ...rest, ...langArgs], { stdio: 'inherit' });
|
|
149
175
|
if (r.status !== 0) return r.status ?? 1;
|
|
150
176
|
}
|
|
151
177
|
return 0;
|
|
152
178
|
}
|
|
153
179
|
|
|
180
|
+
/**
|
|
181
|
+
* The track folders beside a deck that carry a manifest: the same two levels
|
|
182
|
+
* the edit server's track list walks (`voices/<voice>`), relative to the deck.
|
|
183
|
+
* With `deckPath`, only that deck's: a track in the language of another file
|
|
184
|
+
* of its family (`voices-fr/…` beside `talk.html`) is that file's to check.
|
|
185
|
+
*/
|
|
186
|
+
export function manifestTracks(deckDir, deckPath = null) {
|
|
187
|
+
const family = deckPath ? deckFamily(deckPath) : null;
|
|
188
|
+
const own = (rel) => !family || ownsTrack(family, rel, readManifest(join(deckDir, rel)));
|
|
189
|
+
const out = [];
|
|
190
|
+
const look = (rel) => {
|
|
191
|
+
let entries;
|
|
192
|
+
try { entries = readdirSync(join(deckDir, rel), { withFileTypes: true }); } catch { return []; }
|
|
193
|
+
if (entries.some((e) => e.isFile() && e.name === 'manifest.json') && own(rel)) out.push(rel);
|
|
194
|
+
return entries.filter((e) => e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules');
|
|
195
|
+
};
|
|
196
|
+
for (const e of look('.')) {
|
|
197
|
+
for (const k of look(e.name)) look(`${e.name}/${k.name}`);
|
|
198
|
+
}
|
|
199
|
+
return out.filter((d) => d !== '.');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* `--check` (#850): each track against the deck's notes, said per slide, with
|
|
204
|
+
* the re-record line. A track recorded by hand before a manifest existed has
|
|
205
|
+
* nothing to compare and is named as unchecked rather than passed.
|
|
206
|
+
*/
|
|
207
|
+
async function checkMain(plan, argv) {
|
|
208
|
+
if (!plan.deck || !existsSync(plan.deck)) { console.error(`decklight narrate: ${plan.deck ? `no deck at ${plan.deck}` : 'name the deck'}`); return 1; }
|
|
209
|
+
const { trackDrift, rerecordLine } = await import('../tools/narration-manifest.mjs');
|
|
210
|
+
const { realignMoves, planFolder, applyPlans, trackScripts } = await import('../tools/voice-renumber.mjs');
|
|
211
|
+
const { auditTrack } = await import('../tools/take-check.mjs');
|
|
212
|
+
const realign = argv.includes('--realign');
|
|
213
|
+
const html = readFileSync(plan.deck, 'utf8');
|
|
214
|
+
const deckDir = dirname(resolve(plan.deck));
|
|
215
|
+
const dirAt = argv.indexOf('--dir');
|
|
216
|
+
const dirs = dirAt === -1 ? manifestTracks(deckDir, resolve(plan.deck)) : [argv[dirAt + 1]];
|
|
217
|
+
let out = 0;
|
|
218
|
+
if (!dirs.length) { console.log('no narration track with a manifest beside this deck — nothing to check'); return 0; }
|
|
219
|
+
for (const dir of dirs) {
|
|
220
|
+
let m = null;
|
|
221
|
+
try { m = JSON.parse(readFileSync(join(deckDir, dir, 'manifest.json'), 'utf8')); } catch { /* reported below */ }
|
|
222
|
+
if (!Array.isArray(m?.slides)) { console.log(`${dir}/ no manifest: recorded before decklight kept one, not checked`); continue; }
|
|
223
|
+
const mine = m.recorder === 'mic';
|
|
224
|
+
const who = mine ? 'your voice' : [m.voice, m.engine].filter(Boolean).join(' · ') || 'recorded';
|
|
225
|
+
let { drift, unknown } = trackDrift(m, html);
|
|
226
|
+
// only in the wrong place (#916): said, and with --realign, moved
|
|
227
|
+
const { moves, said } = realignMoves(m, html, { scripts: trackScripts(join(deckDir, dir)) });
|
|
228
|
+
if (moves.length && realign) {
|
|
229
|
+
const plan = planFolder(deckDir, { dir, pairs: moves });
|
|
230
|
+
if (plan.conflicts.length) { console.log(`${dir}/ ${said}, but ${plan.conflicts[0]} — nothing was moved`); out = 1; continue; }
|
|
231
|
+
try { applyPlans(deckDir, [plan]); } catch (e) { console.log(`${dir}/ ${said}, but the move failed (${e.message}) — the folder is as it was`); out = 1; continue; }
|
|
232
|
+
console.log(`${dir}/ ${said}: moved back onto their slides`);
|
|
233
|
+
m = JSON.parse(readFileSync(join(deckDir, dir, 'manifest.json'), 'utf8'));
|
|
234
|
+
({ drift, unknown } = trackDrift(m, html));
|
|
235
|
+
} else if (moves.length) {
|
|
236
|
+
console.log(`${dir}/ ${said} — move them: decklight narrate ${plan.deck} --realign --dir ${dir}`);
|
|
237
|
+
}
|
|
238
|
+
const note = unknown ? ` (${unknown} slide${unknown === 1 ? '' : 's'} recorded before the script was kept: not checked)` : '';
|
|
239
|
+
// an engine's takes whose length does not fit their text (#1005): a
|
|
240
|
+
// repeated or dropped phrase, worth a listen; said, not failed on
|
|
241
|
+
const odd = mine ? [] : auditTrack(join(deckDir, dir), m.engine);
|
|
242
|
+
const listen = () => {
|
|
243
|
+
if (!odd.length) return;
|
|
244
|
+
console.log(` ${odd.length} clip${odd.length === 1 ? '' : 's'} not the length ${odd.length === 1 ? 'its' : 'their'} text runs, worth a listen:`);
|
|
245
|
+
for (const t of odd) console.log(` ${t.file}: ${t.seconds.toFixed(2)} s against ~${t.expected.toFixed(2)} s`);
|
|
246
|
+
};
|
|
247
|
+
if (!drift.length) { console.log(`${dir}/ ${who}: in step with the notes${note}`); listen(); continue; }
|
|
248
|
+
out = 1;
|
|
249
|
+
// your own voice is re-recorded, an engine's track re-voiced (#919)
|
|
250
|
+
console.log(`${dir}/ ${who}: ${drift.length} slide${drift.length === 1 ? '' : 's'} to ${mine ? 're-record' : 're-voice'}${note}`);
|
|
251
|
+
for (const d of drift) {
|
|
252
|
+
console.log(d.why === 'clicks'
|
|
253
|
+
? ` slide ${d.slide}: the [click] split moved${d.was !== d.now ? ` (${d.was} beats → ${d.now})` : ''}, the words did not`
|
|
254
|
+
+ (mine ? ' — a recorded beat is cut where you pressed →, so the marker alone cannot move a build' : '')
|
|
255
|
+
: ` slide ${d.slide}: the notes changed since it was recorded`);
|
|
256
|
+
console.log(` ${rerecordLine(plan.deck, dir, [d.slide], { mine })}`);
|
|
257
|
+
}
|
|
258
|
+
listen();
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
|
|
154
263
|
export async function narrateMain(argv = []) {
|
|
155
264
|
const wantsHelp = argv.includes('--help') || argv.includes('-h');
|
|
156
265
|
if (!argv.length || (wantsHelp && !argv.includes('--engine') && !argv.includes('--mic'))) {
|
|
@@ -158,10 +267,17 @@ export async function narrateMain(argv = []) {
|
|
|
158
267
|
return argv.length ? 0 : 1;
|
|
159
268
|
}
|
|
160
269
|
const plan = narratePlan(argv);
|
|
270
|
+
if (argv.includes('--check') || argv.includes('--realign')) return checkMain(plan, argv);
|
|
161
271
|
if (argv.includes('--face')) return faceMain(plan, argv);
|
|
162
272
|
// a terminal script is `cast`'s, whichever way it was meant to be narrated
|
|
163
273
|
const mixedUp = wrongRecorder('narrate', plan.deck);
|
|
164
274
|
if (mixedUp) { console.error(mixedUp); return 2; } // the code record and cast give it
|
|
275
|
+
// an engine re-voices a slide from its notes in seconds; --beats exists
|
|
276
|
+
// because reading a slide aloud again is what costs
|
|
277
|
+
if (!plan.mic && argv.includes('--beats')) {
|
|
278
|
+
console.error('decklight narrate: --beats re-records beats of your own voice; it goes with --mic');
|
|
279
|
+
return 2;
|
|
280
|
+
}
|
|
165
281
|
if (plan.mic) {
|
|
166
282
|
const { recordMain } = await import('./record.mjs');
|
|
167
283
|
return recordMain(plan.args);
|
package/cli/open.mjs
CHANGED
|
@@ -31,10 +31,11 @@ import { onPath, detectAgents, AGENTS } from './agents.mjs';
|
|
|
31
31
|
import { validProjectId } from '../tools/gemini-tts.mjs';
|
|
32
32
|
import {
|
|
33
33
|
ENGINES as TTS_ENGINES, PIPER_DEFAULT_VOICE, piperModelDir, engineStatus,
|
|
34
|
-
piperDownloadCmd, piperDownloadLine,
|
|
34
|
+
piperDownloadCmd, piperDownloadLine, voiceLang,
|
|
35
35
|
} from '../tools/tts-engines.mjs';
|
|
36
36
|
import { KEY_ENV as ELEVENLABS_KEY_ENV } from '../tools/elevenlabs-tts.mjs';
|
|
37
37
|
import { loadTtsConfig } from '../tools/tts-setup.mjs';
|
|
38
|
+
import { deckLang } from '../tools/deck-html.mjs';
|
|
38
39
|
import { detectLocalVoice } from '../tools/local-voice.mjs';
|
|
39
40
|
import { relative } from 'node:path';
|
|
40
41
|
import { argReader, firstPositional, isMain } from '../tools/args.mjs';
|
|
@@ -70,6 +71,9 @@ const USAGE = `usage: decklight <deck.html | git url> [--no-trust | --trust] [--
|
|
|
70
71
|
--git / --no-git keep the deck in git (snapshots, K commits) / never touch git
|
|
71
72
|
(no repository and no flag: decklight asks whether to create one)
|
|
72
73
|
--agent <name> preferred AI agent for A (default: first detected)
|
|
74
|
+
--agent-model <id> the model that agent runs on, this run only (default: the
|
|
75
|
+
one remembered from A's card, else the agent's own). Also
|
|
76
|
+
DECKLIGHT_AGENT_MODEL; --agent-ask-model for its quick questions
|
|
73
77
|
--no-plugins play without your presenter plugins (decklight library add plugin)
|
|
74
78
|
--remote also listen on the LAN for the phone remote
|
|
75
79
|
--no-tts don't start the voice bridge
|
|
@@ -118,11 +122,14 @@ const USAGE_ALL = `usage: decklight <deck.html | git url> [--no-trust] [--port 8
|
|
|
118
122
|
--commit-messages an agent writes EVERY commit subject instead of the generic
|
|
119
123
|
"autosave" — reads each commit's diff and amends the subject
|
|
120
124
|
afterwards — and K drafts one as it opens. Without it, K's
|
|
121
|
-
"write
|
|
125
|
+
"write it for me" asks only when you press it
|
|
122
126
|
--no-commit-messages no agent-written subjects at all this session. Either
|
|
123
127
|
way the deck's changes go to the agent installed on this
|
|
124
128
|
machine, which may pass them to its provider
|
|
125
129
|
--agent <name> preferred AI agent for A (default: first detected)
|
|
130
|
+
--agent-model <id> the model that agent runs on, this run only (default: the
|
|
131
|
+
one remembered from A's card, else the agent's own). Also
|
|
132
|
+
DECKLIGHT_AGENT_MODEL; --agent-ask-model for its quick questions
|
|
126
133
|
|
|
127
134
|
--no-trust the same server in no-trust mode: the deck is served from
|
|
128
135
|
its own directory under a Content-Security-Policy header,
|
|
@@ -155,7 +162,7 @@ const USAGE_ALL = `usage: decklight <deck.html | git url> [--no-trust] [--port 8
|
|
|
155
162
|
|
|
156
163
|
// flags that take a value (so the deck argument can be found past them)
|
|
157
164
|
const VALUE_FLAGS = new Set([
|
|
158
|
-
'--port', '--tts-port', '--lipsync-port', '--tts-engine', '--commit-every', '--agent', '--git-mode',
|
|
165
|
+
'--port', '--tts-port', '--lipsync-port', '--tts-engine', '--commit-every', '--agent', '--agent-model', '--agent-ask-model', '--git-mode',
|
|
159
166
|
'--branch', '--into', '--host',
|
|
160
167
|
]);
|
|
161
168
|
|
|
@@ -207,11 +214,22 @@ export function movedFlagLines(args = []) {
|
|
|
207
214
|
* the bridges go through the dispatcher, the edit server (no longer a
|
|
208
215
|
* command there) runs its own module.
|
|
209
216
|
*/
|
|
217
|
+
/** The `<html lang>` of the deck `args` names, or null: a URL, or a file not there yet, has none to read. */
|
|
218
|
+
function langOfDeck(args) {
|
|
219
|
+
try { return deckLang(readFileSync(firstPositional(args, VALUE_FLAGS), 'utf8')); } catch { return null; }
|
|
220
|
+
}
|
|
221
|
+
|
|
210
222
|
export function planServices({
|
|
211
223
|
args = [], env = process.env, hasBin = onPath, saved = null, lipsync = null,
|
|
212
224
|
detect = detectLocalVoice, exists = existsSync,
|
|
225
|
+
// the deck's `<html lang>`, read by the caller: this function touches no file
|
|
226
|
+
deckLanguage = null,
|
|
213
227
|
} = {}) {
|
|
214
228
|
const { opt } = argReader(args);
|
|
229
|
+
// the language the voice is asked for: the deck's own when it is not in
|
|
230
|
+
// English, else the one saved by `setup voice --lang` (PRESENTING_VOICE)
|
|
231
|
+
const lang = voiceLang({ deck: deckLanguage, saved: saved?.lang });
|
|
232
|
+
const langFromDeck = lang !== undefined && lang !== saved?.lang;
|
|
215
233
|
const has = (flag) => args.includes(flag);
|
|
216
234
|
const pass = (flag) => (opt(flag) !== undefined ? [flag, opt(flag)] : []);
|
|
217
235
|
|
|
@@ -229,7 +247,7 @@ export function planServices({
|
|
|
229
247
|
entry: EDIT,
|
|
230
248
|
args: [deck, '--port', editPort,
|
|
231
249
|
...(has('--git') ? ['--git'] : []), ...(has('--no-git') ? ['--no-git'] : []),
|
|
232
|
-
...pass('--commit-every'), ...pass('--agent'), ...pass('--git-mode'),
|
|
250
|
+
...pass('--commit-every'), ...pass('--agent'), ...pass('--agent-model'), ...pass('--agent-ask-model'), ...pass('--git-mode'),
|
|
233
251
|
// the deck reaches both bridges on the edit server's own origin (#520):
|
|
234
252
|
// `/tts` and `/lipsync/*` are proxied to the ports the bridges below take
|
|
235
253
|
...pass('--tts-port'), ...pass('--lipsync-port'),
|
|
@@ -257,7 +275,7 @@ export function planServices({
|
|
|
257
275
|
// --tts-engine, a saved engine, or a project all win over this: flags decide,
|
|
258
276
|
// detection only fills a vacuum.
|
|
259
277
|
const chosen = opt('--tts-engine', saved?.engine);
|
|
260
|
-
const native = chosen || project ? null : detect({ lang
|
|
278
|
+
const native = chosen || project ? null : detect({ lang });
|
|
261
279
|
// Only a NATIVE voice is claimed automatically. It is the one engine that
|
|
262
280
|
// needs no setup at all — no install, no download, no credential — so using
|
|
263
281
|
// it silently costs the presenter nothing. piper is deliberately NOT picked
|
|
@@ -273,6 +291,8 @@ export function planServices({
|
|
|
273
291
|
// picked for its system voice would try to reach Vertex AI instead
|
|
274
292
|
...(has('--tts-engine') || saved?.engine || ttsEngine !== 'gemini' ? ['--engine', ttsEngine] : []),
|
|
275
293
|
...(cloudVoice ? ['--project', project] : []),
|
|
294
|
+
// the deck's language is the one setting the saved config cannot hold
|
|
295
|
+
...(langFromDeck ? ['--lang', lang] : []),
|
|
276
296
|
// every other setting the bridge reads from the saved config itself
|
|
277
297
|
];
|
|
278
298
|
// The SAME readiness check the bridge runs when the deck asks what it may
|
|
@@ -283,7 +303,7 @@ export function planServices({
|
|
|
283
303
|
const ttsVoice = saved?.voice ?? PIPER_DEFAULT_VOICE;
|
|
284
304
|
const ttsData = saved?.dataDir ?? piperModelDir(env);
|
|
285
305
|
const status = engineStatus(ttsEngine, {
|
|
286
|
-
env, project, voice: ttsVoice, dataDir: ttsData, lang
|
|
306
|
+
env, project, voice: ttsVoice, dataDir: ttsData, lang,
|
|
287
307
|
// every probe threaded through, `detect` included: these are the injection
|
|
288
308
|
// points that let planServices be tested on any machine, and a readiness
|
|
289
309
|
// check reaching for the REAL PATH or the REAL synthesizer would decide a
|
|
@@ -353,7 +373,7 @@ export function planServices({
|
|
|
353
373
|
entry: CLI,
|
|
354
374
|
// every setting comes from lipsync.json; Veo, the one that spends
|
|
355
375
|
// money, only when `setup face --veo` asked for it there
|
|
356
|
-
args: ['lipsync', '--port', lipPort],
|
|
376
|
+
args: ['lipsync', '--port', lipPort, ...(deckLanguage ? ['--lang', deckLanguage] : [])],
|
|
357
377
|
url: `http://127.0.0.1:${lipPort}`,
|
|
358
378
|
});
|
|
359
379
|
}
|
|
@@ -411,7 +431,7 @@ export async function openMain(args) {
|
|
|
411
431
|
return 1;
|
|
412
432
|
}
|
|
413
433
|
|
|
414
|
-
let plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig() });
|
|
434
|
+
let plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig(), deckLanguage: langOfDeck(args) });
|
|
415
435
|
let deck = plan.deck;
|
|
416
436
|
if (!deck) {
|
|
417
437
|
console.error('decklight needs a deck: decklight <deck.html>\n');
|
|
@@ -440,7 +460,7 @@ export async function openMain(args) {
|
|
|
440
460
|
// no-trust mode never commits the deck; the clone's git is what H reads
|
|
441
461
|
if (!noTrust && !args.includes('--no-git') && !args.includes('--git')) args.push('--git');
|
|
442
462
|
deck = local;
|
|
443
|
-
plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig() });
|
|
463
|
+
plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig(), deckLanguage: langOfDeck(args) });
|
|
444
464
|
}
|
|
445
465
|
// no-trust mode names a missing deck itself, the same way for a file, a
|
|
446
466
|
// container and a --check
|
|
@@ -531,7 +551,7 @@ export async function openMain(args) {
|
|
|
531
551
|
// could only offer what was on. Init says so in a line; --git-mode
|
|
532
552
|
// timer is the way to the plain cadence.
|
|
533
553
|
rl.close();
|
|
534
|
-
plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig() });
|
|
554
|
+
plan = planServices({ args, saved: loadTtsConfig(), lipsync: loadLipsyncConfig(), deckLanguage: langOfDeck(args) });
|
|
535
555
|
} else {
|
|
536
556
|
console.log(' git: no repository here — pass --git to create one and keep every version of the deck');
|
|
537
557
|
}
|
|
@@ -616,6 +636,9 @@ export async function openMain(args) {
|
|
|
616
636
|
// window worth having — so the banner waits on NAMES, not on a clock.
|
|
617
637
|
waiting: new Set(run.map((svc) => svc.tag)),
|
|
618
638
|
};
|
|
639
|
+
// which child reports the deck's URL, and whether it has yet (see settle)
|
|
640
|
+
const urlTag = editSvc?.tag ?? null;
|
|
641
|
+
let urlReported = false;
|
|
619
642
|
if (portRow) banner.rows.set('port', portRow);
|
|
620
643
|
for (const r of movedRows) banner.rows.set(r.key, { text: r.text, mark: 'warn' });
|
|
621
644
|
|
|
@@ -634,8 +657,18 @@ export async function openMain(args) {
|
|
|
634
657
|
else banner.held.push(line);
|
|
635
658
|
}
|
|
636
659
|
|
|
637
|
-
function flushBanner() {
|
|
660
|
+
function flushBanner({ force = false } = {}) {
|
|
638
661
|
if (banner.done) return;
|
|
662
|
+
// Not before the deck server has said where it listens, the cap included:
|
|
663
|
+
// the url `open` planned is not one that answers yet — and with --port 0
|
|
664
|
+
// it never is. A slow git setup ahead of the listen (seconds on Windows
|
|
665
|
+
// CI) used to put http://127.0.0.1:0/ on the banner. Its exit forces it.
|
|
666
|
+
if (!force && urlTag && !urlReported) {
|
|
667
|
+
clearTimeout(banner.timer);
|
|
668
|
+
banner.timer = setTimeout(flushBanner, 250);
|
|
669
|
+
banner.timer.unref?.();
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
639
672
|
banner.done = true;
|
|
640
673
|
clearTimeout(banner.timer);
|
|
641
674
|
// Held output goes FIRST, and the banner closes. Everything in here is a
|
|
@@ -663,7 +696,12 @@ export async function openMain(args) {
|
|
|
663
696
|
* short grace after that for the genuinely late — the review check fires
|
|
664
697
|
* detached, after the deck server is already listening.
|
|
665
698
|
*/
|
|
666
|
-
function settle(tag) {
|
|
699
|
+
function settle(tag, { exited = false } = {}) {
|
|
700
|
+
// The deck server owes the URL, the one line the banner exists for. A row
|
|
701
|
+
// it reports first (`git`, set up before it listens) does not settle it:
|
|
702
|
+
// on a slow machine the grace timer then printed the PLANNED url — :0 for
|
|
703
|
+
// --port 0 — before the real one arrived (windows CI, clone-deck test).
|
|
704
|
+
if (tag === urlTag && !urlReported && !exited) return;
|
|
667
705
|
banner.waiting.delete(tag);
|
|
668
706
|
const delay = nextFlushDelay({
|
|
669
707
|
waiting: banner.waiting.size,
|
|
@@ -678,7 +716,7 @@ export async function openMain(args) {
|
|
|
678
716
|
}
|
|
679
717
|
|
|
680
718
|
function collect(tag, fact) {
|
|
681
|
-
if (fact.url) banner.url = fact.url;
|
|
719
|
+
if (fact.url) { banner.url = fact.url; if (tag === urlTag) urlReported = true; }
|
|
682
720
|
if (fact.keys) banner.keys = fact.keys;
|
|
683
721
|
if (!fact.key || !fact.text) { if (fact.url) settle(tag); return; }
|
|
684
722
|
if (banner.done) {
|
|
@@ -749,7 +787,7 @@ export async function openMain(args) {
|
|
|
749
787
|
if (svc.name === 'edit') {
|
|
750
788
|
// the deck server is the one service `open` cannot run without
|
|
751
789
|
say(`${paint(svc.tag)} exited (${code}) — stopping decklight`);
|
|
752
|
-
flushBanner();
|
|
790
|
+
flushBanner({ force: true });
|
|
753
791
|
shutdown(code ?? 1);
|
|
754
792
|
} else {
|
|
755
793
|
// A bridge that stood aside because its port already has one exits 0
|
|
@@ -761,7 +799,7 @@ export async function openMain(args) {
|
|
|
761
799
|
if (banner.done) process.stderr.write(`${bannerRow({ key: svc.tag, ...row }, { color: tty })}\n`);
|
|
762
800
|
else banner.rows.set(svc.tag, row);
|
|
763
801
|
}
|
|
764
|
-
settle(svc.tag); // settle() does the delete and the "is anyone left" itself
|
|
802
|
+
settle(svc.tag, { exited: true }); // settle() does the delete and the "is anyone left" itself
|
|
765
803
|
}
|
|
766
804
|
});
|
|
767
805
|
}
|