@slidevideo/cli 0.1.1 → 0.2.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/CHANGELOG.md +42 -0
- package/IMPRESSUM.md +18 -4
- package/LICENSE-TERMS.md +46 -13
- package/README.md +5 -3
- package/addons/slidevideo/global-top.vue +1 -1
- package/addons/slidevideo/playback-entries.ts +1 -1
- package/addons/slidevideo/preview.ts +2 -2
- package/dist/adapters/browser-runtime.d.ts +3 -0
- package/dist/adapters/elevenlabs.d.ts +1 -0
- package/dist/adapters/elevenlabs.js +8 -4
- package/dist/adapters/powerpoint.d.ts +1 -1
- package/dist/adapters/powerpoint.js +10 -11
- package/dist/adapters/slidev-inspection.js +2 -4
- package/dist/adapters/slidev-server.js +136 -15
- package/dist/adapters/slidev.d.ts +9 -0
- package/dist/adapters/slidev.js +347 -62
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +3 -3
- package/dist/assembly.d.ts +44 -38
- package/dist/assembly.js +60 -21
- package/dist/calibration.js +5 -4
- package/dist/cli.js +88 -31
- package/dist/compositor.d.ts +30 -3
- package/dist/compositor.js +196 -30
- package/dist/contracts.d.ts +6 -6
- package/dist/executables.d.ts +2 -0
- package/dist/executables.js +27 -8
- package/dist/media.d.ts +7 -1
- package/dist/media.js +23 -4
- package/dist/pipeline.d.ts +1 -1
- package/dist/pipeline.js +107 -42
- package/dist/preview/server.js +4 -4
- package/dist/run.d.ts +1 -1
- package/dist/run.js +8 -3
- package/dist/setup-install.d.ts +1 -0
- package/dist/setup-install.js +8 -1
- package/dist/setup.d.ts +26 -8
- package/dist/setup.js +168 -76
- package/dist/speech.js +10 -6
- package/dist/storyboard.js +3 -6
- package/dist/timing.js +2 -2
- package/dist/update-check-worker.d.ts +1 -0
- package/dist/update-check-worker.js +28 -0
- package/dist/update-check.d.ts +4 -0
- package/dist/update-check.js +79 -0
- package/package.json +7 -3
- package/schemas/schedule.v1.json +389 -1
- package/schemas/storyboard.v1.json +342 -1
- package/skills/slidevideo/SKILL.md +2 -2
- package/skills/slidevideo/references/production.md +7 -6
- package/skills/slidevideo/references/storyboard.md +9 -8
- package/schemas/schedule.v2.json +0 -496
- package/schemas/storyboard.v2.json +0 -802
package/dist/pipeline.js
CHANGED
|
@@ -5,10 +5,41 @@ import { presentationAdapter, ttsAdapters } from './adapters/registry.js';
|
|
|
5
5
|
import { generateSpeech } from './speech.js';
|
|
6
6
|
import { resolveTiming } from './timing.js';
|
|
7
7
|
import { Run, filesIn } from './run.js';
|
|
8
|
-
import { json, saveJson, execute, executionScope
|
|
8
|
+
import { json, saveJson, execute, executionScope } from './media.js';
|
|
9
9
|
import { assemble } from './assembly.js';
|
|
10
10
|
import { configuredLicense } from './executables.js';
|
|
11
11
|
import { requireCondition, ProductionError } from './errors.js';
|
|
12
|
+
const baseStageTimeoutMs = 180_000;
|
|
13
|
+
function defaultStageTimeoutMs(stage, story, options) {
|
|
14
|
+
if (stage === 'tts')
|
|
15
|
+
return Math.max(baseStageTimeoutMs, 60_000 + story.narration.length * 90_000);
|
|
16
|
+
if (stage === 'resolve')
|
|
17
|
+
return baseStageTimeoutMs;
|
|
18
|
+
const duration = options.schedule?.duration_ms ?? 0;
|
|
19
|
+
if (stage === 'record') {
|
|
20
|
+
return options.verifyTiming
|
|
21
|
+
? Math.ceil(duration * 2) + 240_000
|
|
22
|
+
: Math.ceil(duration * 1.25) + baseStageTimeoutMs;
|
|
23
|
+
}
|
|
24
|
+
const pixelScale = Math.max(1, (story.output.width * story.output.height) / (1920 * 1080));
|
|
25
|
+
const hasEffects = (options.schedule?.annotations.length ?? 0) > 0
|
|
26
|
+
|| (options.schedule?.overlays?.length ?? 0) > 0
|
|
27
|
+
|| !options.licensed;
|
|
28
|
+
return Math.ceil(duration * pixelScale * (options.verifyTiming || hasEffects ? 2 : 1)) + baseStageTimeoutMs;
|
|
29
|
+
}
|
|
30
|
+
function stageTimeoutError(stage, deadline, plannedDurationMs) {
|
|
31
|
+
const minutes = Number((deadline / 60_000).toFixed(2));
|
|
32
|
+
const detail = plannedDurationMs !== undefined
|
|
33
|
+
? `${stage} exceeded its ${minutes} min timeout (${deadline} ms) for ${plannedDurationMs} ms planned playback`
|
|
34
|
+
: `${stage} exceeded its ${minutes} min timeout (${deadline} ms)`;
|
|
35
|
+
const context = {
|
|
36
|
+
stage,
|
|
37
|
+
timeout_ms: deadline,
|
|
38
|
+
timeout_minutes: minutes,
|
|
39
|
+
...(plannedDurationMs !== undefined ? { planned_duration_ms: plannedDurationMs } : {}),
|
|
40
|
+
};
|
|
41
|
+
return new ProductionError('STAGE_TIMEOUT', detail, stage === 'tts' ? 4 : stage === 'record' ? 5 : 7, context);
|
|
42
|
+
}
|
|
12
43
|
export async function produce(options) {
|
|
13
44
|
let run;
|
|
14
45
|
let lock;
|
|
@@ -35,7 +66,7 @@ export async function produce(options) {
|
|
|
35
66
|
const overlays = story.overlays ?? [];
|
|
36
67
|
const adapter = presentationAdapter(story.deck);
|
|
37
68
|
const inspection = await adapter.inspect(story.deck);
|
|
38
|
-
adapter.validate(story, inspection);
|
|
69
|
+
await adapter.validate(story, inspection);
|
|
39
70
|
for (const segment of story.narration) {
|
|
40
71
|
const voice = segment.voice ?? story.voice;
|
|
41
72
|
requireCondition(voice, 'VOICE_REQUIRED', `Narration ${segment.id} needs a voice`);
|
|
@@ -43,7 +74,7 @@ export async function produce(options) {
|
|
|
43
74
|
requireCondition(tts, 'TTS_ADAPTER', `Unsupported TTS provider ${voice.provider}`, 3);
|
|
44
75
|
tts.validate(voice);
|
|
45
76
|
}
|
|
46
|
-
const result = { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings: story.cues.length || story.annotations
|
|
77
|
+
const result = { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings: story.cues.length || story.annotations.length ||
|
|
47
78
|
overlays.some(overlay => overlay.visible?.some(interval => typeof interval.start !== 'number' || typeof interval.end !== 'number')) ? ['Phrase cues require paired speech alignment at resolution.'] : [], completed_stages: [], run_id: undefined, timing_status: 'not_evaluated' };
|
|
48
79
|
if (story.cues.some(cue => cue.action.type === 'slide'))
|
|
49
80
|
result.warnings.push('Phrase-driven navigation requires reveal target checks after resolution.');
|
|
@@ -117,12 +148,37 @@ export async function produce(options) {
|
|
|
117
148
|
const schedulePath = join(directory, 'timing/schedule.json');
|
|
118
149
|
const visualPath = join(directory, 'recording/visual.json');
|
|
119
150
|
const reportPath = join(directory, 'assembly/report.json');
|
|
151
|
+
const resolveSchedule = async () => {
|
|
152
|
+
const schedule = await resolveTiming(story, await json(speechPath));
|
|
153
|
+
await adapter.validate(story, inspection, schedule);
|
|
154
|
+
return schedule;
|
|
155
|
+
};
|
|
120
156
|
const selected = options.command === 'build' ? ['tts', 'resolve', 'record', 'assemble'] : [options.command];
|
|
121
157
|
const licensed = selected.includes('assemble') && (run.manifest.assembly_licensed ??
|
|
122
158
|
(run.manifest.stages.assemble?.status === 'completed' || configuredLicense()));
|
|
159
|
+
const runBounded = async (targetStage, deadline, plannedDurationMs, work) => {
|
|
160
|
+
let timedOut = false;
|
|
161
|
+
const timer = setTimeout(() => { timedOut = true; controller.abort(); void activeAdapter?.cleanup().catch(() => { }); }, deadline);
|
|
162
|
+
try {
|
|
163
|
+
try {
|
|
164
|
+
await executionScope.run({ signal: controller.signal, bounded: true }, work);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (timedOut)
|
|
168
|
+
throw stageTimeoutError(targetStage, deadline, plannedDurationMs);
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
if (timedOut)
|
|
172
|
+
throw stageTimeoutError(targetStage, deadline, plannedDurationMs);
|
|
173
|
+
controller.signal.throwIfAborted();
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
123
179
|
for (const stage of selected) {
|
|
124
180
|
const reused = run.manifest.stages[stage]?.status === 'completed';
|
|
125
|
-
const labels = {
|
|
181
|
+
const labels = { tts: 'Speech generation', resolve: 'Timing resolution', record: 'Presentation preparation', assemble: 'Assembly and encoding' };
|
|
126
182
|
options.progress?.(reused ? `Verifying saved ${stage}` : labels[stage]);
|
|
127
183
|
if (interrupted)
|
|
128
184
|
throw new ProductionError('INTERRUPTED', 'Production interrupted', 130);
|
|
@@ -145,31 +201,40 @@ export async function produce(options) {
|
|
|
145
201
|
}
|
|
146
202
|
requireCondition(existing.length === 0, 'RECORD_RETRY_NEW_RUN', 'Recording evidence already exists. Start a new run to preserve this attempt.');
|
|
147
203
|
}
|
|
204
|
+
let schedule;
|
|
205
|
+
if (stage === 'record' && !reused) {
|
|
206
|
+
const resolveDeadline = options.timeout_ms ?? defaultStageTimeoutMs('resolve', story, { verifyTiming: production.verify_timing, licensed });
|
|
207
|
+
if (run.manifest.stages.resolve?.status === 'completed') {
|
|
208
|
+
await runBounded('resolve', resolveDeadline, undefined, async () => {
|
|
209
|
+
const resolved = await resolveSchedule();
|
|
210
|
+
await run.verify('resolve');
|
|
211
|
+
requireCondition(JSON.stringify(resolved) === JSON.stringify(await json(schedulePath)), 'SCHEDULE_MISMATCH', 'Resolved schedule changed');
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
await run.stage('resolve', [schedulePath], () => runBounded('resolve', resolveDeadline, undefined, async () => {
|
|
216
|
+
await saveJson(schedulePath, await resolveSchedule());
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
schedule = await json(schedulePath);
|
|
220
|
+
}
|
|
221
|
+
else if (stage === 'assemble' && !reused) {
|
|
222
|
+
schedule = await json(schedulePath);
|
|
223
|
+
}
|
|
148
224
|
const artifacts = [];
|
|
225
|
+
const prehashed = {};
|
|
149
226
|
const operation = async () => {
|
|
150
227
|
if (stage === 'tts') {
|
|
151
228
|
const speech = await generateSpeech(story, join(directory, 'speech'), ttsAdapters, options.cache, options.progress);
|
|
152
229
|
artifacts.push(speechPath, ...speech.assets.map(asset => asset.audio));
|
|
153
230
|
}
|
|
154
231
|
if (stage === 'resolve') {
|
|
155
|
-
|
|
156
|
-
adapter.validate(story, inspection, schedule);
|
|
157
|
-
await saveJson(schedulePath, schedule);
|
|
232
|
+
await saveJson(schedulePath, await resolveSchedule());
|
|
158
233
|
artifacts.push(schedulePath);
|
|
159
234
|
}
|
|
160
235
|
if (stage === 'record') {
|
|
161
|
-
const schedule = await resolveTiming(story, await json(speechPath));
|
|
162
|
-
if (run.manifest.stages.resolve?.status === 'completed') {
|
|
163
|
-
await run.verify('resolve');
|
|
164
|
-
requireCondition(JSON.stringify(schedule) === JSON.stringify(await json(schedulePath)), 'SCHEDULE_MISMATCH', 'Resolved schedule changed');
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
await saveJson(schedulePath, schedule);
|
|
168
|
-
run.manifest.stages.resolve = { status: 'completed', artifacts: { [schedulePath]: await hashFile(schedulePath) } };
|
|
169
|
-
await run.save();
|
|
170
|
-
}
|
|
171
|
-
adapter.validate(story, inspection, schedule);
|
|
172
236
|
activeAdapter = adapter;
|
|
237
|
+
let recordError;
|
|
173
238
|
try {
|
|
174
239
|
await adapter.prepare(story, schedule, join(directory, 'recording'), production);
|
|
175
240
|
const visual = await adapter.execute(options.progress);
|
|
@@ -178,9 +243,21 @@ export async function produce(options) {
|
|
|
178
243
|
artifacts.push(visual.file, ...visual.timing.checks.map(check => check.evidence));
|
|
179
244
|
Object.assign(run.manifest.versions, visual.provenance.dependencies, { [`presentation:${visual.provenance.adapter}`]: visual.provenance.version });
|
|
180
245
|
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
recordError = error;
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
181
250
|
finally {
|
|
182
|
-
|
|
183
|
-
|
|
251
|
+
try {
|
|
252
|
+
await adapter.cleanup();
|
|
253
|
+
}
|
|
254
|
+
catch (cleanupError) {
|
|
255
|
+
if (!recordError && !interrupted && !controller.signal.aborted)
|
|
256
|
+
throw cleanupError;
|
|
257
|
+
}
|
|
258
|
+
finally {
|
|
259
|
+
activeAdapter = undefined;
|
|
260
|
+
}
|
|
184
261
|
}
|
|
185
262
|
artifacts.push(...await filesIn(join(directory, 'recording')));
|
|
186
263
|
run.manifest.versions.ffmpeg = (await execute('ffmpeg', ['-version'])).toString().split('\n')[0];
|
|
@@ -188,13 +265,16 @@ export async function produce(options) {
|
|
|
188
265
|
if (stage === 'assemble') {
|
|
189
266
|
const output = resolve(options.output ?? run.manifest.output ?? join(directory, 'final.mp4'));
|
|
190
267
|
requireCondition(!run.manifest.output || run.manifest.output === output, 'OUTPUT_MISMATCH', 'Run is bound to a different output path');
|
|
191
|
-
run.manifest.output = output;
|
|
192
|
-
run.manifest.assembly_licensed = licensed;
|
|
193
|
-
await run.save();
|
|
194
268
|
try {
|
|
195
|
-
await assemble(story,
|
|
269
|
+
const { outputSha256 } = await assemble(story, schedule, await json(speechPath), await json(visualPath), join(directory, 'assembly'), output, {
|
|
196
270
|
...production, licensed, inputHashes: run.manifest.inputs,
|
|
271
|
+
onOutputReserved: async () => {
|
|
272
|
+
run.manifest.output = output;
|
|
273
|
+
run.manifest.assembly_licensed = licensed;
|
|
274
|
+
await run.save();
|
|
275
|
+
},
|
|
197
276
|
});
|
|
277
|
+
prehashed[output] = outputSha256;
|
|
198
278
|
}
|
|
199
279
|
catch (error) {
|
|
200
280
|
if (error instanceof ProductionError && error.exitCode === 3)
|
|
@@ -204,24 +284,9 @@ export async function produce(options) {
|
|
|
204
284
|
artifacts.push(output, reportPath, ...await filesIn(join(directory, 'assembly')));
|
|
205
285
|
}
|
|
206
286
|
};
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
await run.stage(stage, artifacts, async () => {
|
|
211
|
-
try {
|
|
212
|
-
await executionScope.run(controller.signal, operation);
|
|
213
|
-
}
|
|
214
|
-
catch (error) {
|
|
215
|
-
if (timedOut)
|
|
216
|
-
throw new ProductionError('STAGE_TIMEOUT', `${stage} exceeded ${options.timeout_ms} ms`, stage === 'tts' ? 4 : stage === 'record' ? 5 : 7);
|
|
217
|
-
throw error;
|
|
218
|
-
}
|
|
219
|
-
controller.signal.throwIfAborted();
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
finally {
|
|
223
|
-
clearTimeout(timer);
|
|
224
|
-
}
|
|
287
|
+
const deadline = options.timeout_ms ?? defaultStageTimeoutMs(stage, story, { schedule, verifyTiming: production.verify_timing, licensed });
|
|
288
|
+
const plannedDurationMs = schedule?.duration_ms;
|
|
289
|
+
await run.stage(stage, artifacts, () => runBounded(stage, deadline, plannedDurationMs, operation), prehashed);
|
|
225
290
|
options.progress?.(`${reused ? 'Reused' : 'Completed'} ${stage}`);
|
|
226
291
|
}
|
|
227
292
|
if (options.export) {
|
package/dist/preview/server.js
CHANGED
|
@@ -57,15 +57,15 @@ export async function servePreview(storyboard, cache, port, ready) {
|
|
|
57
57
|
process.once('SIGINT', stop);
|
|
58
58
|
process.once('SIGTERM', stop);
|
|
59
59
|
try {
|
|
60
|
-
await executionScope.run(controller.signal, async () => {
|
|
60
|
+
await executionScope.run({ signal: controller.signal, bounded: false }, async () => {
|
|
61
61
|
const story = await loadStoryboard(resolve(storyboard));
|
|
62
62
|
requireCondition(!story.overlays?.length, 'PREVIEW_CAPABILITY', 'Image overlays require an exported video. Use slidevideo build to review them.', 3);
|
|
63
63
|
adapter = presentationAdapter(story.deck);
|
|
64
64
|
requireCondition(adapter.startPreview, 'PREVIEW_CAPABILITY', `Adapter ${adapter.id} does not support preview`, 3);
|
|
65
65
|
const inspection = await adapter.inspect(story.deck);
|
|
66
|
-
adapter.validate(story, inspection);
|
|
66
|
+
await adapter.validate(story, inspection);
|
|
67
67
|
const { schedule, approximate } = await resolvePreviewTiming(story, ttsAdapters, cache);
|
|
68
|
-
adapter.validate(story, inspection, schedule);
|
|
68
|
+
await adapter.validate(story, inspection, schedule);
|
|
69
69
|
controller.signal.throwIfAborted();
|
|
70
70
|
await new Promise((resolve, reject) => {
|
|
71
71
|
server.once('error', reject);
|
|
@@ -80,7 +80,7 @@ export async function servePreview(storyboard, cache, port, ready) {
|
|
|
80
80
|
controller.signal.throwIfAborted();
|
|
81
81
|
config = { deck: basename(story.deck), width: story.output.width, height: story.output.height,
|
|
82
82
|
duration: schedule.duration_ms, approximate,
|
|
83
|
-
stage: 'url' in session ? { url: session.url } : { annotations: schedule.annotations
|
|
83
|
+
stage: 'url' in session ? { url: session.url } : { annotations: schedule.annotations } };
|
|
84
84
|
ready(origin, approximate);
|
|
85
85
|
await new Promise(resolve => controller.signal.addEventListener('abort', () => resolve(), { once: true }));
|
|
86
86
|
});
|
package/dist/run.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class Run {
|
|
|
6
6
|
static open(directory: string, storyboard: string, inputs: Record<string, string>, input_hash: string): Promise<Run>;
|
|
7
7
|
verify(stage: Stage): Promise<void>;
|
|
8
8
|
exportSchedule(destination: string, schedule: Schedule): Promise<void>;
|
|
9
|
-
stage(name: Stage, files: string[], operation: () => Promise<void>): Promise<void>;
|
|
9
|
+
stage(name: Stage, files: string[], operation: () => Promise<void>, prehashed?: Record<string, string>): Promise<void>;
|
|
10
10
|
save(): Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
export declare function filesIn(directory: string): Promise<string[]>;
|
package/dist/run.js
CHANGED
|
@@ -3,6 +3,7 @@ import { join, resolve } from 'node:path';
|
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { hashFile, json, saveJson } from './media.js';
|
|
5
5
|
import { requireCondition, ProductionError } from './errors.js';
|
|
6
|
+
import { packagePath } from './installation.js';
|
|
6
7
|
export class Run {
|
|
7
8
|
directory;
|
|
8
9
|
manifest;
|
|
@@ -19,7 +20,10 @@ export class Run {
|
|
|
19
20
|
catch (error) {
|
|
20
21
|
if (error.code !== 'ENOENT')
|
|
21
22
|
throw new ProductionError('RUN_MANIFEST', `Cannot read run manifest in ${directory}`);
|
|
22
|
-
|
|
23
|
+
const entries = await readdir(directory);
|
|
24
|
+
requireCondition(entries.every(entry => entry === '.lock'), 'NEW_RUN_REQUIRED', 'Run has no manifest and is not empty. Start with a new or empty run directory.');
|
|
25
|
+
const { version } = await json(packagePath('package.json'));
|
|
26
|
+
manifest = { version: 1, run_id: randomUUID(), created_at: new Date().toISOString(), storyboard, inputs, input_hash, versions: { node: process.version, slidevideo: version }, stages: {} };
|
|
23
27
|
await saveJson(join(directory, 'inputs/storyboard.json'), { source: storyboard, content: await readFile(storyboard, 'utf8'), inputs });
|
|
24
28
|
await saveJson(join(directory, 'manifest.json'), manifest);
|
|
25
29
|
}
|
|
@@ -70,7 +74,7 @@ export class Run {
|
|
|
70
74
|
}
|
|
71
75
|
await saveJson(resolve(destination), schedule);
|
|
72
76
|
}
|
|
73
|
-
async stage(name, files, operation) {
|
|
77
|
+
async stage(name, files, operation, prehashed = {}) {
|
|
74
78
|
if (this.manifest.stages[name]?.status === 'completed') {
|
|
75
79
|
await this.verify(name);
|
|
76
80
|
return;
|
|
@@ -79,9 +83,10 @@ export class Run {
|
|
|
79
83
|
await this.save();
|
|
80
84
|
try {
|
|
81
85
|
await operation();
|
|
86
|
+
const known = new Map(Object.entries(prehashed).map(([file, sha256]) => [resolve(file), sha256]));
|
|
82
87
|
const artifacts = {};
|
|
83
88
|
for (const file of new Set(files.map(file => resolve(file))))
|
|
84
|
-
artifacts[file] = await hashFile(file);
|
|
89
|
+
artifacts[file] = known.get(file) ?? await hashFile(file);
|
|
85
90
|
this.manifest.stages[name] = { status: 'completed', artifacts };
|
|
86
91
|
await this.save();
|
|
87
92
|
return;
|
package/dist/setup-install.d.ts
CHANGED
package/dist/setup-install.js
CHANGED
|
@@ -7,6 +7,8 @@ import { environmentPython, managedBrowserDirectory, packagePath, userDataDirect
|
|
|
7
7
|
import { execute } from './media.js';
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
9
9
|
const windows = process.platform === 'win32';
|
|
10
|
+
const macos = process.platform === 'darwin';
|
|
11
|
+
const macosExtraDirectories = macos ? ['/opt/homebrew/bin', '/usr/local/bin'] : [];
|
|
10
12
|
const edgeLock = packagePath('tools', 'edge-tts', 'requirements.lock');
|
|
11
13
|
export function runInstaller(command, args, env = process.env) {
|
|
12
14
|
return new Promise((resolve, reject) => {
|
|
@@ -34,6 +36,11 @@ export function ffmpegInstaller() {
|
|
|
34
36
|
if (winget)
|
|
35
37
|
return { command: winget, args: ['install', '--id', 'Gyan.FFmpeg', '--exact', '--accept-package-agreements', '--accept-source-agreements'] };
|
|
36
38
|
}
|
|
39
|
+
if (macos) {
|
|
40
|
+
const brew = findOnPath('brew', macosExtraDirectories);
|
|
41
|
+
if (brew)
|
|
42
|
+
return { command: brew, args: ['install', 'ffmpeg'], env: { ...process.env, HOMEBREW_NO_ASK: '1' } };
|
|
43
|
+
}
|
|
37
44
|
if (process.platform === 'linux') {
|
|
38
45
|
const apt = findOnPath('apt-get');
|
|
39
46
|
const pacman = findOnPath('pacman');
|
|
@@ -52,7 +59,7 @@ export async function installEdgeEnvironment() {
|
|
|
52
59
|
const directory = join(userDataDirectory(), 'edge-tts');
|
|
53
60
|
const lock = `${directory}.lock`;
|
|
54
61
|
const python = environmentPython(directory);
|
|
55
|
-
const uv = findOnPath('uv');
|
|
62
|
+
const uv = findOnPath('uv', macosExtraDirectories);
|
|
56
63
|
const candidate = toolCandidate('python');
|
|
57
64
|
const base = candidate?.path;
|
|
58
65
|
await mkdir(userDataDirectory(), { recursive: true });
|
package/dist/setup.d.ts
CHANGED
|
@@ -8,22 +8,40 @@ type SetupOptions = ToolPaths & {
|
|
|
8
8
|
json?: boolean;
|
|
9
9
|
quiet?: boolean;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type Presentation = 'slidev' | 'powerpoint';
|
|
12
|
+
type Provider = 'edge-tts' | 'elevenlabs';
|
|
13
|
+
type Check = {
|
|
14
|
+
name: string;
|
|
15
|
+
ready: boolean;
|
|
16
|
+
detail: string;
|
|
17
|
+
};
|
|
18
|
+
type Readiness = {
|
|
19
|
+
status: 'ready' | 'missing_dependencies' | 'unavailable';
|
|
20
|
+
checks: Check[];
|
|
21
|
+
};
|
|
22
|
+
type ProviderReadiness = Readiness & {
|
|
23
|
+
deferred?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type SetupReadiness = {
|
|
26
|
+
shared_checks: Check[];
|
|
27
|
+
presentations: Partial<Record<Presentation, Readiness>>;
|
|
28
|
+
providers: Partial<Record<Provider, ProviderReadiness>>;
|
|
29
|
+
};
|
|
30
|
+
export declare function setup(options: SetupOptions, beforePrompts?: (report: SetupReadiness) => void): Promise<{
|
|
12
31
|
version: number;
|
|
13
32
|
command: string;
|
|
14
33
|
status: "ready" | "missing_dependencies";
|
|
15
|
-
presentation: string;
|
|
34
|
+
presentation: string | undefined;
|
|
16
35
|
voice: {
|
|
17
36
|
provider: string;
|
|
18
37
|
voice: string;
|
|
19
|
-
};
|
|
38
|
+
} | undefined;
|
|
39
|
+
shared_checks: Check[];
|
|
40
|
+
presentations: Partial<Record<Presentation, Readiness>>;
|
|
41
|
+
providers: Partial<Record<Provider, ProviderReadiness>>;
|
|
20
42
|
config_file: string;
|
|
21
43
|
saved_paths: Partial<Record<"python" | "browser" | "ffmpeg" | "ffprobe", string>>;
|
|
22
|
-
checks:
|
|
23
|
-
name: string;
|
|
24
|
-
ready: boolean;
|
|
25
|
-
detail: string;
|
|
26
|
-
}[];
|
|
44
|
+
checks: Check[];
|
|
27
45
|
browsers: {
|
|
28
46
|
path: string;
|
|
29
47
|
name: "Chromium" | "Google Chrome" | "Microsoft Edge" | "Custom browser";
|