decklight 0.6.0 → 0.7.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 +16 -8
- package/SPEC.md +166 -10
- package/cli/agents.mjs +52 -2
- package/cli/banner.mjs +125 -0
- package/cli/bundle.mjs +14 -4
- package/cli/{rec.mjs → cast.mjs} +25 -8
- package/cli/comments.mjs +389 -0
- package/cli/commit-flow.mjs +157 -0
- package/cli/commit-message.mjs +125 -0
- package/cli/decklight.mjs +88 -25
- package/cli/dev.mjs +159 -13
- package/cli/edit.mjs +927 -39
- package/cli/git-tree.mjs +87 -0
- package/cli/git.mjs +22 -0
- package/cli/init.mjs +37 -5
- package/cli/port-conflict.mjs +187 -16
- package/cli/publish.mjs +15 -40
- package/cli/record.mjs +154 -0
- package/cli/review-remote.mjs +330 -0
- package/cli/review-store.mjs +107 -0
- package/cli/review-submit.mjs +292 -0
- package/cli/review.mjs +361 -0
- package/cli/serve.mjs +36 -1
- package/cli/skill-content.mjs +3 -1
- package/cli/units.mjs +2 -2
- package/cli/util.mjs +59 -0
- package/dist/build-info.json +1 -0
- package/dist/decklight.css +244 -1
- package/dist/decklight.js +102 -79
- package/dist/decklight.js.map +4 -4
- package/docs/architecture.svg +7 -0
- package/package.json +2 -1
- package/tools/args.mjs +20 -0
- package/tools/deck-html.mjs +50 -0
- package/tools/elevenlabs-tts.mjs +1 -1
- package/tools/lipsync-server.mjs +64 -2
- package/tools/lipsync.mjs +40 -24
- package/tools/local-voice.mjs +170 -16
- package/tools/publish-voices.mjs +78 -18
- package/tools/recording-impact.mjs +110 -0
- package/tools/review-anchor.mjs +180 -0
- package/tools/test-impact.mjs +259 -0
- package/tools/tts-engines.mjs +26 -4
- package/tools/tts-setup.mjs +1 -1
- package/tools/video.mjs +15 -3
- package/tools/voiceover-server.mjs +167 -7
- package/tools/voiceover.mjs +30 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Gilles Philippart
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `npm run test:impact` — which tests does THIS change actually need?
|
|
7
|
+
*
|
|
8
|
+
* The suites are not the same shape, and the honest answer differs per suite.
|
|
9
|
+
* Measured on a laptop (2026-08-27, 85 unit files / 19 harnesses):
|
|
10
|
+
*
|
|
11
|
+
* unit `npm test` ~48s wall — 319s of work, run in parallel by node
|
|
12
|
+
* render `npm run verify` ~200s wall — strictly serial, one browser at a time
|
|
13
|
+
*
|
|
14
|
+
* So this script does NOT try to pick unit tests. 38 of the 85 files finish
|
|
15
|
+
* under 0.3s and node already overlaps them 6.6×; selecting a subset would save
|
|
16
|
+
* seconds and risk missing the one file that mattered. The unit suite is cheap
|
|
17
|
+
* enough to always be right, and being right is what a test picker is for.
|
|
18
|
+
*
|
|
19
|
+
* The render harnesses are the opposite: serial, minutes long, and each one
|
|
20
|
+
* pinned to a subsystem you can name. `narration-render` alone is 65s — a third
|
|
21
|
+
* of the suite — and a change to `cli/pdf.mjs` has no business waiting for it.
|
|
22
|
+
* That is the decision worth automating, so that is the only one made here.
|
|
23
|
+
*
|
|
24
|
+
* THE FALLBACK IS THE WHOLE SUITE. A path this map does not recognise selects
|
|
25
|
+
* everything, loudly, and says why. A test picker that guesses "probably
|
|
26
|
+
* nothing" on an unfamiliar path is worse than no picker: it turns an unrun
|
|
27
|
+
* suite into a green line. Same rule as the ingredients label — unchecked is
|
|
28
|
+
* its own answer and never a pass.
|
|
29
|
+
*
|
|
30
|
+
* This is a DEVELOPER shortcut for the edit-run loop, not a CI gate. CI keeps
|
|
31
|
+
* running everything, because the map is a claim about the code and the map can
|
|
32
|
+
* be wrong; the full suite is what notices.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
36
|
+
import path from 'node:path';
|
|
37
|
+
import { fileURLToPath } from 'node:url';
|
|
38
|
+
import { isMain } from './args.mjs';
|
|
39
|
+
|
|
40
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const repo = path.resolve(here, '..');
|
|
42
|
+
|
|
43
|
+
/** Every harness `verify` knows, in its running order. */
|
|
44
|
+
export const ALL = [
|
|
45
|
+
'render', 'player-render', 'narration-render', 'record-render', 'review-render',
|
|
46
|
+
'character-render', 'engine-render', 'pin-render', 'overflow-render', 'split-render',
|
|
47
|
+
'strict-render', 'shot-render', 'plugin-render', 'extension-check-render',
|
|
48
|
+
'deckfile-render', 'pdf-render', 'import-render', 'contrast', 'palette-rules',
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The two lint harnesses read `themes/` and `tools/`, never the built runtime —
|
|
53
|
+
* so a change to `src/` does not implicate them, and a change to a theme does.
|
|
54
|
+
* Kept as a named set because "every harness except the ones that never open a
|
|
55
|
+
* browser" is the distinction the rules below keep needing.
|
|
56
|
+
*/
|
|
57
|
+
const LINT = ['contrast', 'palette-rules'];
|
|
58
|
+
const BROWSER = ALL.filter((h) => !LINT.includes(h));
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* changed path → the harnesses that could see it.
|
|
62
|
+
*
|
|
63
|
+
* Ordered, first match wins, so the broad "this is core" rules sit at the top.
|
|
64
|
+
* Every entry carries WHY, because the cost of this file being subtly wrong is
|
|
65
|
+
* a harness that stops running and nobody noticing for a month.
|
|
66
|
+
*/
|
|
67
|
+
const RULES = [
|
|
68
|
+
// ── everything the built bundle rests on ────────────────────────────────
|
|
69
|
+
// Each browser harness loads dist/decklight.js, so these reach all of them.
|
|
70
|
+
[/^src\/core\/engine\.js$/, BROWSER, 'the engine every harness boots'],
|
|
71
|
+
[/^src\/core\/overlay\.js$/, BROWSER, 'the overlay contract every dialog registers through'],
|
|
72
|
+
[/^src\/index\.js$/, BROWSER, 'the bundle entry'],
|
|
73
|
+
[/^src\/decklight\.css$/, BROWSER, 'one stylesheet, every rendered deck'],
|
|
74
|
+
[/^build\.mjs$/, ALL, 'the build that produces what the harnesses load'],
|
|
75
|
+
[/^test\/harness\.mjs$/, ALL, 'the shared dump/assert helper'],
|
|
76
|
+
[/^package\.json$/, ALL, 'scripts, deps and packed files'],
|
|
77
|
+
|
|
78
|
+
// ── subsystems, each with a harness that is about it ────────────────────
|
|
79
|
+
[/^src\/core\/narration\.js$/, ['narration-render', 'record-render', 'character-render'],
|
|
80
|
+
'narration drives playback, the recorder and the character overlay'],
|
|
81
|
+
[/^src\/core\/character\.js$/, ['character-render', 'narration-render'], 'the talking head'],
|
|
82
|
+
[/^src\/core\/character-art\.js$/, ['character-render'], 'the head it draws'],
|
|
83
|
+
[/^src\/core\/review\.js$/, ['review-render'], 'the review overlay and its anchor resolver'],
|
|
84
|
+
[/^src\/core\/overflow\.js$/, ['overflow-render', 'pin-render'], 'the overflow guardrail and the pinned-title case'],
|
|
85
|
+
[/^src\/core\/annotate\.js$/, ['engine-render', 'render'], 'ink rides the engine scale'],
|
|
86
|
+
[/^src\/core\/themes\.js$/, ['render', 'contrast'], 'theme picking, and the contrast gate behind it'],
|
|
87
|
+
[/^src\/core\/(editmode|history)\.js$/, ['engine-render'], 'the author surfaces the engine harness drives'],
|
|
88
|
+
[/^src\/core\/hud\.js$/, ['engine-render'], 'clock and progress live on the engine'],
|
|
89
|
+
[/^src\/core\/finder\.js$/, ['engine-render', 'review-render'], 'slide titles: the finder names them, review anchors by them'],
|
|
90
|
+
[/^src\/terminal\//, ['player-render'], 'the cast player'],
|
|
91
|
+
[/^src\/code\//, ['render'], 'code blocks render in the smoke deck'],
|
|
92
|
+
[/^src\/core\//, BROWSER, 'an unmapped core module — assume every harness'],
|
|
93
|
+
|
|
94
|
+
// ── the CLI and tools, each spawned by the harness that tests it ────────
|
|
95
|
+
[/^cli\/audit\.mjs$/, ['strict-render'], 'the ingredients label and --strict stripping'],
|
|
96
|
+
[/^cli\/bundle\.mjs$/, ['strict-render', 'render'], 'bundling, and the deck it produces'],
|
|
97
|
+
[/^cli\/plugin\.mjs$/, ['plugin-render'], 'presenter plugins'],
|
|
98
|
+
[/^cli\/import\.mjs$/, ['import-render'], 'deck import'],
|
|
99
|
+
[/^cli\/deckfile\.mjs$/, ['deckfile-render'], 'the .decklight container'],
|
|
100
|
+
[/^cli\/pdf\.mjs$/, ['pdf-render'], 'PDF export'],
|
|
101
|
+
[/^cli\/(present|shot)\.mjs$/, ['shot-render'], 'present, and the screenshot containment it asserts'],
|
|
102
|
+
[/^cli\/(comments|review-anchor|review-store|review-remote|review-submit)\.mjs$/, ['review-render'],
|
|
103
|
+
'the CLI half of review — the harness cross-checks the browser against it'],
|
|
104
|
+
[/^cli\/(units|marketplace|loader|pin)\.mjs$/, ['pin-render', 'extension-check-render'],
|
|
105
|
+
'unit pinning and the admission check'],
|
|
106
|
+
[/^tools\/extension-check\.mjs$/, ['extension-check-render'], 'the admission gate itself'],
|
|
107
|
+
[/^tools\/(theme-check|color)\.mjs$/, LINT, 'the theme lints'],
|
|
108
|
+
[/^tools\/chrome\.mjs$/, ALL, 'every harness starts a browser through it'],
|
|
109
|
+
[/^tools\/review-anchor\.mjs$/, ['review-render'], 'the anchor resolver both halves share'],
|
|
110
|
+
[/^tools\/(tts-engines|local-voice|voiceover-server|lipsync)\.mjs$/, ['narration-render', 'record-render'],
|
|
111
|
+
'the voice bridge narration talks to'],
|
|
112
|
+
[/^themes\//, ['render', ...LINT], 'a theme, and the gates that read every theme'],
|
|
113
|
+
[/^demo\//, ['render'], 'the smoke deck itself'],
|
|
114
|
+
|
|
115
|
+
// ── things no harness reads ────────────────────────────────────────────
|
|
116
|
+
// Named explicitly rather than left to the fallback, so "nothing" is a
|
|
117
|
+
// decision on the record and not an omission.
|
|
118
|
+
[/^(docs|\.github|\.claude)\//, [], 'not read by any harness'],
|
|
119
|
+
[/^(SPEC|README|CONTRIBUTING|CLAUDE|CHANGELOG)\.md$/, [], 'prose'],
|
|
120
|
+
[/^test\/.*\.test\.mjs$/, [], 'a unit test — the unit suite covers it'],
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
/** Which harnesses a single path implicates, and why. */
|
|
124
|
+
export function forPath(p) {
|
|
125
|
+
for (const [re, harnesses, why] of RULES) {
|
|
126
|
+
if (re.test(p)) return { harnesses, why };
|
|
127
|
+
}
|
|
128
|
+
// A harness fixture is about its own harness; `foo-render.mjs` / `foo.html`.
|
|
129
|
+
const m = /^test\/([a-z-]+?)(?:-render)?\.(?:mjs|html)$/.exec(p);
|
|
130
|
+
if (m) {
|
|
131
|
+
const hit = ALL.find((h) => h === m[1] || h === `${m[1]}-render`);
|
|
132
|
+
if (hit) return { harnesses: [hit], why: 'its own harness' };
|
|
133
|
+
}
|
|
134
|
+
return { harnesses: ALL, why: 'UNMAPPED — falling back to everything' };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** What changed: committed against the base, plus whatever is uncommitted. */
|
|
138
|
+
function changedFiles(base) {
|
|
139
|
+
const git = (...a) => {
|
|
140
|
+
try { return execFileSync('git', a, { cwd: repo, encoding: 'utf8' }); } catch { return ''; }
|
|
141
|
+
};
|
|
142
|
+
// A base that does not resolve makes `git diff` fail, and a swallowed failure
|
|
143
|
+
// here would report "nothing changed" — the one answer that must never be
|
|
144
|
+
// wrong. `origin/main` is missing in more checkouts than you would think: a
|
|
145
|
+
// clone whose remote is named something else, or one fetched shallow.
|
|
146
|
+
try {
|
|
147
|
+
execFileSync('git', ['rev-parse', '--verify', `${base}^{commit}`],
|
|
148
|
+
{ cwd: repo, stdio: 'ignore' });
|
|
149
|
+
} catch {
|
|
150
|
+
process.stdout.write(`test:impact: cannot resolve "${base}" — `
|
|
151
|
+
+ `pass --since <ref> with a ref this clone has (or fetch it).\n`);
|
|
152
|
+
process.exit(2);
|
|
153
|
+
}
|
|
154
|
+
const out = new Set();
|
|
155
|
+
// `...` is deliberate: the merge base, so a stale branch does not report
|
|
156
|
+
// every file main moved under it as something this change touched.
|
|
157
|
+
for (const l of git('diff', '--name-only', `${base}...HEAD`).split('\n')) if (l.trim()) out.add(l.trim());
|
|
158
|
+
for (const l of git('status', '--porcelain').split('\n')) {
|
|
159
|
+
const f = l.slice(3).trim();
|
|
160
|
+
if (f) out.add(f.includes(' -> ') ? f.split(' -> ')[1] : f);
|
|
161
|
+
}
|
|
162
|
+
return [...out];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── the command ───────────────────────────────────────────────────────────
|
|
166
|
+
// Guarded so the map above can be imported and asserted (test/test-impact.test.mjs)
|
|
167
|
+
// without this file running a suite as a side effect of being read.
|
|
168
|
+
if (!isMain(import.meta.url)) { /* imported for the map — the CLI below is inert */ } else {
|
|
169
|
+
const args = process.argv.slice(2);
|
|
170
|
+
const run = args.includes('--run');
|
|
171
|
+
const baseArg = args.indexOf('--since');
|
|
172
|
+
const base = baseArg !== -1 ? args[baseArg + 1] : 'origin/main';
|
|
173
|
+
// `i !== baseArg + 1` drops --since's VALUE, and only when --since is present:
|
|
174
|
+
// with no flag `baseArg` is -1 and the guard would silently eat argv[0], which
|
|
175
|
+
// is the first path somebody asked about.
|
|
176
|
+
const paths = args.filter((a, i) => !a.startsWith('--') && !(baseArg !== -1 && i === baseArg + 1));
|
|
177
|
+
|
|
178
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
179
|
+
process.stdout.write(`decklight test:impact — which tests this change needs
|
|
180
|
+
|
|
181
|
+
npm run test:impact what would run, against origin/main
|
|
182
|
+
npm run test:impact -- --run run it
|
|
183
|
+
npm run test:impact -- --since main compare against another ref
|
|
184
|
+
npm run test:impact -- src/core/review.js ask about explicit paths
|
|
185
|
+
|
|
186
|
+
The unit suite ALWAYS runs: it is ~48s and parallel, so picking a subset saves
|
|
187
|
+
little and can be wrong. Only the render harnesses (~200s, serial) are selected.
|
|
188
|
+
An unrecognised path selects every harness. CI always runs everything.
|
|
189
|
+
`);
|
|
190
|
+
process.exit(0);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const files = paths.length ? paths : changedFiles(base);
|
|
194
|
+
if (!files.length) {
|
|
195
|
+
process.stdout.write(`test:impact: nothing changed against ${base} — nothing to run\n`);
|
|
196
|
+
process.exit(0);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const picked = new Map(); // harness → the reasons it was picked
|
|
200
|
+
let unmapped = false;
|
|
201
|
+
for (const f of files) {
|
|
202
|
+
const { harnesses, why } = forPath(f);
|
|
203
|
+
if (why.startsWith('UNMAPPED')) unmapped = true;
|
|
204
|
+
for (const h of harnesses) {
|
|
205
|
+
if (!picked.has(h)) picked.set(h, new Set());
|
|
206
|
+
picked.get(h).add(`${f} — ${why}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const selected = ALL.filter((h) => picked.has(h));
|
|
210
|
+
|
|
211
|
+
// Measured on a laptop; a rough shape so the report can say what it saves.
|
|
212
|
+
const COST = {
|
|
213
|
+
'narration-render': 65, 'extension-check-render': 23, 'engine-render': 17, render: 20,
|
|
214
|
+
'pdf-render': 10, 'split-render': 9, 'review-render': 8, 'pin-render': 7, 'record-render': 7,
|
|
215
|
+
'strict-render': 6, 'overflow-render': 6, 'plugin-render': 6, 'deckfile-render': 4,
|
|
216
|
+
'shot-render': 4, 'player-render': 3, 'character-render': 2, 'import-render': 2,
|
|
217
|
+
contrast: 1, 'palette-rules': 1,
|
|
218
|
+
};
|
|
219
|
+
const cost = (list) => list.reduce((n, h) => n + (COST[h] ?? 10), 0);
|
|
220
|
+
|
|
221
|
+
process.stdout.write(`\n─── test:impact ${'─'.repeat(52)}\n`);
|
|
222
|
+
process.stdout.write(`${files.length} changed file${files.length === 1 ? '' : 's'} against ${base}\n\n`);
|
|
223
|
+
for (const f of files.slice(0, 20)) process.stdout.write(` ${f}\n`);
|
|
224
|
+
if (files.length > 20) process.stdout.write(` … and ${files.length - 20} more\n`);
|
|
225
|
+
|
|
226
|
+
process.stdout.write(`\nunit suite ALWAYS — npm test (~48s, parallel)\n`);
|
|
227
|
+
if (!selected.length) {
|
|
228
|
+
process.stdout.write(`render none — nothing changed that a harness reads\n`);
|
|
229
|
+
} else {
|
|
230
|
+
process.stdout.write(`render ${selected.length} of ${ALL.length} harnesses`
|
|
231
|
+
+ ` (~${cost(selected)}s of ~${cost(ALL)}s)\n`);
|
|
232
|
+
for (const h of selected) {
|
|
233
|
+
const [first] = [...picked.get(h)];
|
|
234
|
+
process.stdout.write(` ${h.padEnd(24)} ${first}\n`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (unmapped) {
|
|
238
|
+
process.stdout.write(`\n! an unmapped path selected everything. If that path has a harness that\n`
|
|
239
|
+
+ ` is really about it, add a rule to tools/test-impact.mjs.\n`);
|
|
240
|
+
}
|
|
241
|
+
if (!run) {
|
|
242
|
+
process.stdout.write(`\n(--run to run it; CI still runs everything)\n`);
|
|
243
|
+
process.exit(0);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
process.stdout.write(`\n─── npm test ${'─'.repeat(55)}\n`);
|
|
247
|
+
const unit = spawnSync('npm', ['test'], { cwd: repo, stdio: 'inherit', shell: process.platform === 'win32' });
|
|
248
|
+
let bad = unit.status !== 0;
|
|
249
|
+
if (selected.length) {
|
|
250
|
+
const verify = spawnSync('npm', ['run', 'verify'], {
|
|
251
|
+
cwd: repo,
|
|
252
|
+
stdio: 'inherit',
|
|
253
|
+
shell: process.platform === 'win32',
|
|
254
|
+
env: { ...process.env, VERIFY_ONLY: selected.join(',') },
|
|
255
|
+
});
|
|
256
|
+
bad = bad || verify.status !== 0;
|
|
257
|
+
}
|
|
258
|
+
process.exit(bad ? 1 : 0);
|
|
259
|
+
}
|
package/tools/tts-engines.mjs
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
createSynth as createElevenLabs, apiKey as elevenLabsKey, KEY_ENV as ELEVENLABS_KEY_ENV,
|
|
52
52
|
DEFAULT_MODEL as ELEVENLABS_MODEL, V3_MODEL as ELEVENLABS_V3_MODEL,
|
|
53
53
|
} from './elevenlabs-tts.mjs';
|
|
54
|
-
import { detectLocalVoice, sayArgs, sapiArgs } from './local-voice.mjs';
|
|
54
|
+
import { detectLocalVoice, sayArgs, sapiArgs, winrtArgs, TIER_LABEL } from './local-voice.mjs';
|
|
55
55
|
|
|
56
56
|
export const ENGINES = ['gemini', 'chirp', 'piper', 'elevenlabs', 'say', 'sapi'];
|
|
57
57
|
/** The two engines that are already on the machine — nothing to install. */
|
|
@@ -333,9 +333,12 @@ function createPiper({ voice = PIPER_DEFAULT_VOICE, dataDir }) {
|
|
|
333
333
|
* Neither takes a delivery instruction, so both are `stylable: false` and the
|
|
334
334
|
* picker skips the tone step, exactly as it does for piper and ElevenLabs.
|
|
335
335
|
*/
|
|
336
|
-
function createNative({ kind, voice, shell = 'powershell.exe', voices = [] }) {
|
|
336
|
+
function createNative({ kind, voice, shell = 'powershell.exe', voices = [], api = null }) {
|
|
337
337
|
const bin = kind === 'say' ? 'say' : shell;
|
|
338
|
-
|
|
338
|
+
// on Windows the API decides the voices: WinRT sees the natural ones,
|
|
339
|
+
// System.Speech only the 2006 roster — detectLocalVoice chose, and the
|
|
340
|
+
// synthesis must speak through the same stack that listed the voice
|
|
341
|
+
const build = kind === 'say' ? sayArgs : api === 'winrt' ? winrtArgs : sapiArgs;
|
|
339
342
|
// The roster this machine actually has, for the guard below. Held as names
|
|
340
343
|
// because that is what the player sends and what `say -v` takes.
|
|
341
344
|
const known = new Set(voices.map((v) => v?.name ?? v).filter(Boolean));
|
|
@@ -415,12 +418,31 @@ export function createEngine({
|
|
|
415
418
|
const detected = detect({ lang });
|
|
416
419
|
const pick = voice ?? detected.voices?.[0]?.name;
|
|
417
420
|
if (!pick) throw new Error(detected.why ?? `no ${engine} voices on this machine`);
|
|
421
|
+
// The deck's language decides which voices get quality shelves; the rest
|
|
422
|
+
// share ONE group at the tail — contiguous by construction, because
|
|
423
|
+
// parseSayVoices sorts language first. ~140 of a real Mac's rows are
|
|
424
|
+
// other languages, and shelving them by quality answered a question
|
|
425
|
+
// nobody browsing an English deck was asking.
|
|
426
|
+
const want = (lang ?? 'en').slice(0, 2).toLowerCase();
|
|
427
|
+
const groupOf = (v) => (!Number.isInteger(v.tier) ? undefined
|
|
428
|
+
: (v.locale || '').toLowerCase().startsWith(want) ? TIER_LABEL[v.tier]
|
|
429
|
+
: 'other languages');
|
|
418
430
|
return {
|
|
419
431
|
name: engine, model: pick, needsProject: false, stylable: false,
|
|
420
432
|
cost: 'free · offline · already on this machine',
|
|
421
|
-
|
|
433
|
+
// [name, flavor, group]: the quality category travels as a STRUCTURED
|
|
434
|
+
// third element (best · good · average) and the picker draws it as a
|
|
435
|
+
// labelled separator over each shelf — the roster mixes this year's
|
|
436
|
+
// neural voices with 1990s robots under names that reveal nothing. The
|
|
437
|
+
// flavor stays the locale alone; repeating the category on every row
|
|
438
|
+
// was the suffix wallpaper the separators replace.
|
|
439
|
+
voices: (detected.voices ?? []).map((v) => [v.name, v.locale || 'system', groupOf(v)]),
|
|
440
|
+
// "download a Siri voice" rides the same channel every engine caveat
|
|
441
|
+
// does: the bridge's startup line and the deck's toast on switching
|
|
442
|
+
...(detected.caveat ? { caveat: detected.caveat } : {}),
|
|
422
443
|
synth: createNative({
|
|
423
444
|
kind: engine, voice: pick, shell: detected.shell, voices: detected.voices ?? [],
|
|
445
|
+
api: detected.api ?? null,
|
|
424
446
|
}),
|
|
425
447
|
};
|
|
426
448
|
}
|
package/tools/tts-setup.mjs
CHANGED
|
@@ -29,7 +29,7 @@ import { gcloudToken, validProjectId } from './gemini-tts.mjs';
|
|
|
29
29
|
import { KEY_ENV as ELEVENLABS_KEY_ENV, apiKey as elevenLabsKey } from './elevenlabs-tts.mjs';
|
|
30
30
|
|
|
31
31
|
// The picker's preview default (SPEC PRESENTING) — the wizard's proof is the same
|
|
32
|
-
// audio the deck's
|
|
32
|
+
// audio the deck's V picker previews.
|
|
33
33
|
export const TEST_SENTENCE = 'Hey, this is Decklight';
|
|
34
34
|
|
|
35
35
|
/** The saved answers live at ~/.config/decklight/tts.json — $XDG_CONFIG_HOME honored. */
|
package/tools/video.mjs
CHANGED
|
@@ -109,19 +109,31 @@ export function extractHolds(html, defaultHold) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* The runtime's built-in hold before a slide turns (SLIDE_PAUSE_S in
|
|
113
|
+
* src/core/narration.js — not imported, because src/ does not ship in the
|
|
114
|
+
* package; test/video.test.mjs pins the two equal). An exported mp4 must
|
|
115
|
+
* breathe where the live deck does, and the live deck now breathes here by
|
|
116
|
+
* default.
|
|
117
|
+
*/
|
|
118
|
+
export const SLIDE_PAUSE_DEFAULT = 1;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Per-slide narration beat: data-narration-pause="2" on the section, else
|
|
122
|
+
* the built-in default above.
|
|
113
123
|
*
|
|
114
124
|
* The recorded mirror of the live rule (PRESENTING): src/core/narration.js
|
|
115
125
|
* holds that many seconds after a slide's last sentence before moving on, and
|
|
116
126
|
* an exported mp4 must breathe in the same places the deck does. Read off the
|
|
117
127
|
* raw open tag, like extractHolds, so the same attribute appearing in a
|
|
118
|
-
* slide's CONTENT cannot be mistaken for the slide's own.
|
|
128
|
+
* slide's CONTENT cannot be mistaken for the slide's own. (The deck-wide
|
|
129
|
+
* `narration.slidePause` config tier is not read here: it lives inside the
|
|
130
|
+
* boot call, and this reads sections, not scripts.)
|
|
119
131
|
*/
|
|
120
132
|
export function extractPauses(html) {
|
|
121
133
|
return sectionBodies(html).map((sec) => {
|
|
122
134
|
const tag = sec.slice(0, sec.indexOf('>'));
|
|
123
135
|
const m = tag.match(/data-narration-pause="([\d.]+)"/);
|
|
124
|
-
return m ? Number(m[1]) :
|
|
136
|
+
return m ? Number(m[1]) : SLIDE_PAUSE_DEFAULT;
|
|
125
137
|
});
|
|
126
138
|
}
|
|
127
139
|
|
|
@@ -36,13 +36,64 @@
|
|
|
36
36
|
// stepping back through slides replays instantly and costs nothing.
|
|
37
37
|
|
|
38
38
|
import { createServer } from 'node:http';
|
|
39
|
-
import { createHash } from 'node:crypto';
|
|
40
39
|
import { createInterface } from 'node:readline/promises';
|
|
40
|
+
import { canBind, resolvePortConflict } from '../cli/port-conflict.mjs';
|
|
41
|
+
import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync, unlinkSync } from 'node:fs';
|
|
42
|
+
import { homedir } from 'node:os';
|
|
43
|
+
import { join } from 'node:path';
|
|
44
|
+
import { execFile } from 'node:child_process';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The one exec a deck may trigger: open macOS's voice-download pane.
|
|
48
|
+
*
|
|
49
|
+
* The argv is a FROZEN CONSTANT — no byte of any request reaches it — and it
|
|
50
|
+
* opens a System Settings pane and nothing else; the download itself stays a
|
|
51
|
+
* human clicking through, which is the point of the pane. `exec` is injected
|
|
52
|
+
* so the test can assert the argv without a Settings window opening mid-suite.
|
|
53
|
+
*/
|
|
54
|
+
export const VOICE_SETTINGS_URI = 'x-apple.systempreferences:com.apple.preference.universalaccess';
|
|
55
|
+
/** …and Windows' Narrator page, where "Add natural voices" lives. */
|
|
56
|
+
export const WINDOWS_VOICE_SETTINGS_URI = 'ms-settings:easeofaccess-narrator';
|
|
57
|
+
export function openVoiceSettings(exec = execFile, platform = process.platform) {
|
|
58
|
+
if (platform === 'win32') {
|
|
59
|
+
// `start` is a cmd builtin; the empty "" is its title argument, so the
|
|
60
|
+
// URI is never mistaken for one. Every token is a constant.
|
|
61
|
+
exec('cmd', ['/c', 'start', '""', WINDOWS_VOICE_SETTINGS_URI], () => { /* fire and forget */ });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
exec('open', [VOICE_SETTINGS_URI], () => { /* fire and forget — Settings owns the rest */ });
|
|
65
|
+
}
|
|
66
|
+
import { createHash } from 'node:crypto';
|
|
41
67
|
import { resolveEngine, engineBlocker, engineMenu, engineStatus, ENGINES } from './tts-engines.mjs';
|
|
42
68
|
import { loadTtsConfig, runSetupWizard, ttsConfigPath } from './tts-setup.mjs';
|
|
43
69
|
import { argReader, isMain } from './args.mjs';
|
|
44
70
|
import { corsHeaders, readBody } from './bridge.mjs';
|
|
45
71
|
import { installedVoices } from '../cli/units.mjs';
|
|
72
|
+
import { readyLine } from '../cli/banner.mjs';
|
|
73
|
+
|
|
74
|
+
/** One line from the terminal, for the taken-port question. Closed straight after. */
|
|
75
|
+
async function askLine(prompt) {
|
|
76
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
77
|
+
// EOF ANSWERS THE SAFE WAY. `rl.question` never settles if the input closes
|
|
78
|
+
// first (a Ctrl-D, a terminal whose stdin is a spent pipe), and an unsettled
|
|
79
|
+
// promise here aborted the bridge through the top-level handler — reported to
|
|
80
|
+
// the user as "this one is a bug, please report it", over a question about a
|
|
81
|
+
// port. An empty answer is the declining answer everywhere it is read.
|
|
82
|
+
try {
|
|
83
|
+
return await new Promise((resolve) => {
|
|
84
|
+
// `line` is registered FIRST and readline emits it before `close`, so a
|
|
85
|
+
// key that was actually typed always beats the EOF that follows it. The
|
|
86
|
+
// two racing as promises did not: a piped `k\n` lost to the close and
|
|
87
|
+
// read as a decline, which is a terrible way to lose a keystroke.
|
|
88
|
+
let answered = false;
|
|
89
|
+
const done = (v) => { if (!answered) { answered = true; resolve(v); } };
|
|
90
|
+
rl.once('line', done);
|
|
91
|
+
rl.once('close', () => done(''));
|
|
92
|
+
rl.setPrompt(prompt);
|
|
93
|
+
rl.prompt();
|
|
94
|
+
});
|
|
95
|
+
} finally { rl.close(); }
|
|
96
|
+
}
|
|
46
97
|
|
|
47
98
|
export async function ttsMain(args) {
|
|
48
99
|
if (args.includes('--help')) {
|
|
@@ -167,6 +218,42 @@ export async function ttsMain(args) {
|
|
|
167
218
|
// engine's audio under another's voice — the cache survives the switch, and
|
|
168
219
|
// switching back replays instantly rather than re-billing.
|
|
169
220
|
const cache = new Map();
|
|
221
|
+
// The DISK half of the cache, for the engines whose synthesis is free and
|
|
222
|
+
// local (say, sapi, piper): a machine's own voice saying the same sentence
|
|
223
|
+
// is the same audio tomorrow, and a voice's identity — its name, which is
|
|
224
|
+
// exactly what `say -v` selects by — is stable per machine. Warming 184
|
|
225
|
+
// previews took ~6 minutes of background `say`; it should cost that once
|
|
226
|
+
// per machine, not once per bridge. Cloud engines stay memory-only: their
|
|
227
|
+
// output drifts with server models, and a stale clip that sounds unlike
|
|
228
|
+
// today's voice is worse than a re-bill of one preview sentence.
|
|
229
|
+
const DISK_CACHED = new Set(['say', 'sapi', 'piper']);
|
|
230
|
+
const cacheDir = join(process.env.XDG_CACHE_HOME || join(homedir(), '.cache'), 'decklight', 'tts');
|
|
231
|
+
const diskPath = (key) => join(cacheDir, `${key}.wav`);
|
|
232
|
+
const diskRead = (key) => {
|
|
233
|
+
if (!DISK_CACHED.has(engine.name)) return null;
|
|
234
|
+
try {
|
|
235
|
+
const wav = readFileSync(diskPath(key));
|
|
236
|
+
return { wav, usage: { chars: 0, cost: 0, note: 'cached on disk' } };
|
|
237
|
+
} catch { return null; }
|
|
238
|
+
};
|
|
239
|
+
const diskWrite = (key, wav) => {
|
|
240
|
+
if (!DISK_CACHED.has(engine.name)) return;
|
|
241
|
+
try { mkdirSync(cacheDir, { recursive: true }); writeFileSync(diskPath(key), wav); }
|
|
242
|
+
catch { /* a cache that cannot write is a cache, not a failure */ }
|
|
243
|
+
};
|
|
244
|
+
// Bounded at startup, oldest first: a per-sentence cache grows forever and
|
|
245
|
+
// a silent 10 GB in ~/.cache is not a cache, it is a leak with a euphemism.
|
|
246
|
+
try {
|
|
247
|
+
const entries = readdirSync(cacheDir)
|
|
248
|
+
.filter((f) => f.endsWith('.wav'))
|
|
249
|
+
.map((f) => ({ f, ...statSync(join(cacheDir, f)) }))
|
|
250
|
+
.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
251
|
+
let total = entries.reduce((sum, e) => sum + e.size, 0);
|
|
252
|
+
for (const e of entries) {
|
|
253
|
+
if (total <= 400 * 1024 * 1024) break;
|
|
254
|
+
try { unlinkSync(join(cacheDir, e.f)); total -= e.size; } catch { break; }
|
|
255
|
+
}
|
|
256
|
+
} catch { /* no cache dir yet */ }
|
|
170
257
|
|
|
171
258
|
// What the bridge could become, and what stands in the way. The options the
|
|
172
259
|
// deck's picker draws (SPEC `NARRATION`).
|
|
@@ -202,9 +289,31 @@ export async function ttsMain(args) {
|
|
|
202
289
|
engine: engine.name,
|
|
203
290
|
model: engine.model,
|
|
204
291
|
stylable: engine.stylable, // gemini alone can be told HOW to say it
|
|
292
|
+
// the engine's standing note — for `say` with no Siri voice this is
|
|
293
|
+
// the download hint, and the picker keys its install row off it
|
|
294
|
+
...(engine.caveat ? { caveat: engine.caveat } : {}),
|
|
205
295
|
voices, // piper speaks one voice, not the star roster
|
|
206
296
|
}));
|
|
207
297
|
}
|
|
298
|
+
// ── the one exec a deck may trigger: open the voice-download pane ──
|
|
299
|
+
// Darwin only, loopback only (like every route here), and the argv is a
|
|
300
|
+
// FROZEN CONSTANT — no byte of the request reaches it. It opens a System
|
|
301
|
+
// Settings pane and does nothing else; the download itself stays a human
|
|
302
|
+
// clicking, which is the whole point of the pane.
|
|
303
|
+
if (req.method === 'POST' && req.url === '/voices/install') {
|
|
304
|
+
if (process.platform !== 'darwin' && process.platform !== 'win32') { res.writeHead(404); return res.end(); }
|
|
305
|
+
try {
|
|
306
|
+
openVoiceSettings();
|
|
307
|
+
console.log(process.platform === 'win32'
|
|
308
|
+
? ' voices: opened Settings → Accessibility → Narrator (add natural voices, then restart me)'
|
|
309
|
+
: ' voices: opened System Settings → Accessibility (download a Siri voice, then restart me)');
|
|
310
|
+
res.writeHead(200, { ...CORS, 'content-type': 'application/json' });
|
|
311
|
+
return res.end(JSON.stringify({ ok: true }));
|
|
312
|
+
} catch (e) {
|
|
313
|
+
res.writeHead(500, { ...CORS, 'content-type': 'application/json' });
|
|
314
|
+
return res.end(JSON.stringify({ ok: false, error: String(e?.message ?? e) }));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
208
317
|
// ── which engine is speaking, and what else could (SPEC `NARRATION`) ──
|
|
209
318
|
if (req.method === 'GET' && req.url === '/engines') {
|
|
210
319
|
// Ready or not, every engine is listed. Hiding the ones this machine
|
|
@@ -285,11 +394,20 @@ export async function ttsMain(args) {
|
|
|
285
394
|
// it silently became undiffable and unreviewable.
|
|
286
395
|
const key = createHash('sha256')
|
|
287
396
|
.update([engine.name, voice, style, text].join('\u0000')).digest('hex');
|
|
288
|
-
|
|
397
|
+
let fresh = !cache.has(key);
|
|
398
|
+
if (fresh) {
|
|
399
|
+
const onDisk = diskRead(key);
|
|
400
|
+
if (onDisk) {
|
|
401
|
+
cache.set(key, onDisk);
|
|
402
|
+
fresh = false;
|
|
403
|
+
console.log(` ${engine.name} ${picked}: ${text.length} chars · cached on disk`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
289
406
|
if (fresh) {
|
|
290
407
|
process.stdout.write(` ${engine.name} ${picked}: ${text.length} chars … `);
|
|
291
408
|
const t0 = Date.now();
|
|
292
409
|
cache.set(key, await engine.synth(text, { voice, style }));
|
|
410
|
+
diskWrite(key, cache.get(key).wav);
|
|
293
411
|
const u = cache.get(key).usage;
|
|
294
412
|
// `cost` is OPTIONAL, and an installed engine is why (SPEC
|
|
295
413
|
// ENGINE_UNITS): the six built-ins all happen to report one, so
|
|
@@ -340,7 +458,41 @@ export async function ttsMain(args) {
|
|
|
340
458
|
res.end();
|
|
341
459
|
});
|
|
342
460
|
|
|
343
|
-
|
|
461
|
+
// A TAKEN PORT IS NOT A CRASH. Without this the bind threw EADDRINUSE as an
|
|
462
|
+
// unhandled 'error' event: a raw Node stack trace in the middle of author's
|
|
463
|
+
// startup output, which reads as decklight falling over when the truth is
|
|
464
|
+
// that something else has the port. The edit server has resolved conflicts
|
|
465
|
+
// for a long time (cli/port-conflict.mjs) — the bridges simply never called
|
|
466
|
+
// it, so they were the one place the deck could still look broken.
|
|
467
|
+
//
|
|
468
|
+
// On a TTY it names the occupant and offers a choice; anywhere else — and
|
|
469
|
+
// author spawns these with a piped stdin, so that is the usual case — it
|
|
470
|
+
// moves to the next free port and says so. The player finds the bridge by
|
|
471
|
+
// probing, so a moved port costs nothing.
|
|
472
|
+
// `canBind`, NOT `isPortOpen`: this file's own note says why, and getting it
|
|
473
|
+
// wrong the first time proved the point. `isPortOpen` CONNECTS, answering "is
|
|
474
|
+
// somebody there" — a listener that never accepts (backlog full, or a socket
|
|
475
|
+
// opened and ignored) refuses the connect and reads as free, and then the
|
|
476
|
+
// bind fails anyway. "May I have this port" is a different question and only
|
|
477
|
+
// a trial bind answers it.
|
|
478
|
+
//
|
|
479
|
+
// `--port 0` is "let the OS pick", which cannot conflict — resolving it would
|
|
480
|
+
// turn a deliberate 0 into port 1. Only a REAL port that is taken gets the
|
|
481
|
+
// question; everything else binds exactly as before.
|
|
482
|
+
const asked = port && !(await canBind(port))
|
|
483
|
+
? await resolvePortConflict(port, {
|
|
484
|
+
kind: 'bridge',
|
|
485
|
+
ask: process.stdin.isTTY && process.stdout.isTTY ? askLine : undefined,
|
|
486
|
+
log: console.log,
|
|
487
|
+
})
|
|
488
|
+
: port;
|
|
489
|
+
// null is "stand down" — either a bridge is already serving this port, or
|
|
490
|
+
// somebody else holds it and this one cannot move (the deck only ever calls
|
|
491
|
+
// the one number). Exiting is the honest outcome: author prints "carrying on
|
|
492
|
+
// without it" and the deck degrades where you can see it, instead of a
|
|
493
|
+
// bridge running somewhere nothing will ever knock.
|
|
494
|
+
if (asked === null) process.exit(0);
|
|
495
|
+
server.listen(asked, '127.0.0.1', () => {
|
|
344
496
|
// The BOUND port, not the requested one: `--port 0` legitimately means
|
|
345
497
|
// "pick a free one", and printing the 0 back made the one line telling a
|
|
346
498
|
// presenter where their bridge is into an unusable URL.
|
|
@@ -348,10 +500,18 @@ export async function ttsMain(args) {
|
|
|
348
500
|
// `cost` is optional (SPEC ENGINE_UNITS) — an installed engine that
|
|
349
501
|
// quotes no list price says nothing here rather than "(undefined)".
|
|
350
502
|
const price = engine.cost ? ` (${engine.cost})` : '';
|
|
351
|
-
|
|
352
|
-
//
|
|
353
|
-
//
|
|
354
|
-
if (
|
|
503
|
+
// Under author this is a banner ROW, not a line: author prints one block
|
|
504
|
+
// ending in the DECK's url, and a bridge url above it is the wrong thing
|
|
505
|
+
// to click. Standalone, the bridge is the whole program and says so.
|
|
506
|
+
if (process.env.DECKLIGHT_BANNER) {
|
|
507
|
+
console.log(readyLine({ key: 'voice', text: `${engine.name} · ${engine.model}${price} — on :${bound}` }));
|
|
508
|
+
if (engine.caveat) console.log(readyLine({ key: 'voice', text: engine.caveat }));
|
|
509
|
+
} else {
|
|
510
|
+
console.log(`decklight tts bridge on http://127.0.0.1:${bound} — ${engine.name} · ${engine.model}${price} — Ctrl-C stops`);
|
|
511
|
+
// Stated here, once, where the presenter is still choosing — not
|
|
512
|
+
// discovered mid-talk when the delivery already varied more than expected.
|
|
513
|
+
if (engine.caveat) console.log(` ${engine.caveat}`);
|
|
514
|
+
}
|
|
355
515
|
// piper loads a ~120 MB model on start; do it now, while the deck is still
|
|
356
516
|
// being opened, so the first sentence isn't a 13-second silence
|
|
357
517
|
if (engine.synth.warm) {
|
package/tools/voiceover.mjs
CHANGED
|
@@ -52,8 +52,33 @@ import { argReader } from './args.mjs';
|
|
|
52
52
|
import { sectionBodies, NOTES_ASIDE, cleanNotes, notesSegments } from './deck-html.mjs';
|
|
53
53
|
|
|
54
54
|
const args = process.argv.slice(2);
|
|
55
|
+
|
|
56
|
+
const HELP = `decklight voiceover — batch-synthesize a deck's narration into a folder
|
|
57
|
+
|
|
58
|
+
Usage:
|
|
59
|
+
decklight voiceover <deck.html> [-o <dir>] [--engine piper|chirp|gemini|elevenlabs]
|
|
60
|
+
[--voice <name>] [--no-llm] [--reuse-text] [--keep-wav]
|
|
61
|
+
|
|
62
|
+
The headless counterpart of the deck's \u21e7V: it reads each slide's speaker
|
|
63
|
+
notes and writes one slide-NN.m4a per slide (plus a file per \u27e8CLICK\u27e9 beat)
|
|
64
|
+
and a manifest.json into <dir>, so a deck can point at it with
|
|
65
|
+
narration: { files: [{ label, dir, segments: true }] }.
|
|
66
|
+
|
|
67
|
+
-o <dir> output folder (default: <deck>/voiceover)
|
|
68
|
+
--engine piper (local, free, default) · chirp · gemini · elevenlabs
|
|
69
|
+
--voice the engine's voice name (piper: a model name; elevenlabs: omit
|
|
70
|
+
for the first of YOUR voices)
|
|
71
|
+
--no-llm skip the local-LLM notes rewrite; voice the notes as written
|
|
72
|
+
--reuse-text re-voice the existing slide-NN.txt without re-rolling the text
|
|
73
|
+
— switch voices or engines without a new narration pass
|
|
74
|
+
--keep-wav keep the lossless WAVs (tools/lipsync.mjs consumes them)
|
|
75
|
+
|
|
76
|
+
Cloud engines need --project or $GOOGLE_CLOUD_PROJECT and application-default
|
|
77
|
+
credentials; elevenlabs needs $ELEVENLABS_API_KEY. Audio is a build artifact.`;
|
|
78
|
+
|
|
79
|
+
if (args.includes('--help') || args.includes('-h')) { console.log(HELP); process.exit(0); }
|
|
55
80
|
const deckPath = args.find((a) => !a.startsWith('-'));
|
|
56
|
-
if (!deckPath) { console.error('
|
|
81
|
+
if (!deckPath) { console.error('decklight voiceover: name the deck to voice\n\n' + HELP); process.exit(1); }
|
|
57
82
|
const { opt } = argReader(args);
|
|
58
83
|
const outDir = resolve(opt('-o', join(resolve(deckPath, '..'), 'voiceover')));
|
|
59
84
|
const engine = opt('--engine', 'piper');
|
|
@@ -201,6 +226,10 @@ for (let i = 0; i < slides.length; i++) {
|
|
|
201
226
|
const sM4a = join(outDir, `slide-${n}-${kk}.m4a`);
|
|
202
227
|
const out = await tts.synth(segs[k], { voice, style });
|
|
203
228
|
writeFileSync(sWav, out.wav);
|
|
229
|
+
// The beat's own words, beside its own audio — tools/lipsync.mjs hands
|
|
230
|
+
// this to Rhubarb as the dialog hint, and a hint for the whole slide
|
|
231
|
+
// would be worse than none against one beat of it.
|
|
232
|
+
writeFileSync(join(outDir, `slide-${n}-${kk}.txt`), segs[k]);
|
|
204
233
|
usage = { cost: usage.cost + (out.usage?.cost ?? 0) };
|
|
205
234
|
toAac(sWav, sM4a);
|
|
206
235
|
if (!keepWav) rmSync(sWav);
|