@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/IMPRESSUM.md +18 -4
  3. package/LICENSE-TERMS.md +46 -13
  4. package/README.md +5 -3
  5. package/addons/slidevideo/global-top.vue +1 -1
  6. package/addons/slidevideo/playback-entries.ts +1 -1
  7. package/addons/slidevideo/preview.ts +2 -2
  8. package/dist/adapters/browser-runtime.d.ts +3 -0
  9. package/dist/adapters/elevenlabs.d.ts +1 -0
  10. package/dist/adapters/elevenlabs.js +8 -4
  11. package/dist/adapters/powerpoint.d.ts +1 -1
  12. package/dist/adapters/powerpoint.js +10 -11
  13. package/dist/adapters/slidev-inspection.js +2 -4
  14. package/dist/adapters/slidev-server.js +136 -15
  15. package/dist/adapters/slidev.d.ts +9 -0
  16. package/dist/adapters/slidev.js +347 -62
  17. package/dist/annotations.d.ts +1 -1
  18. package/dist/annotations.js +3 -3
  19. package/dist/assembly.d.ts +44 -38
  20. package/dist/assembly.js +60 -21
  21. package/dist/calibration.js +5 -4
  22. package/dist/cli.js +88 -31
  23. package/dist/compositor.d.ts +30 -3
  24. package/dist/compositor.js +196 -30
  25. package/dist/contracts.d.ts +6 -6
  26. package/dist/executables.d.ts +2 -0
  27. package/dist/executables.js +27 -8
  28. package/dist/media.d.ts +7 -1
  29. package/dist/media.js +23 -4
  30. package/dist/pipeline.d.ts +1 -1
  31. package/dist/pipeline.js +107 -42
  32. package/dist/preview/server.js +4 -4
  33. package/dist/run.d.ts +1 -1
  34. package/dist/run.js +8 -3
  35. package/dist/setup-install.d.ts +1 -0
  36. package/dist/setup-install.js +8 -1
  37. package/dist/setup.d.ts +26 -8
  38. package/dist/setup.js +168 -76
  39. package/dist/speech.js +10 -6
  40. package/dist/storyboard.js +3 -6
  41. package/dist/timing.js +2 -2
  42. package/dist/update-check-worker.d.ts +1 -0
  43. package/dist/update-check-worker.js +28 -0
  44. package/dist/update-check.d.ts +4 -0
  45. package/dist/update-check.js +79 -0
  46. package/package.json +7 -3
  47. package/schemas/schedule.v1.json +389 -1
  48. package/schemas/storyboard.v1.json +342 -1
  49. package/skills/slidevideo/SKILL.md +2 -2
  50. package/skills/slidevideo/references/production.md +7 -6
  51. package/skills/slidevideo/references/storyboard.md +9 -8
  52. package/schemas/schedule.v2.json +0 -496
  53. package/schemas/storyboard.v2.json +0 -802
package/dist/assembly.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { join, dirname } from 'node:path';
2
2
  import { lstat, mkdir, mkdtemp, link, rm, copyFile } from 'node:fs/promises';
3
- import { execute, probe, decode, saveJson } from './media.js';
3
+ import { execute, hashFile, probe, decode, saveJson } from './media.js';
4
4
  import { requireCondition } from './errors.js';
5
5
  import { configuredLicense } from './executables.js';
6
6
  import { annotationApplications, verifyAnnotations } from './annotations.js';
@@ -32,6 +32,7 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
32
32
  }
33
33
  let temporaryDirectory;
34
34
  try {
35
+ await options.onOutputReserved?.();
35
36
  temporaryDirectory = await mkdtemp(`${output}.partial-`);
36
37
  const temporary = join(temporaryDirectory, 'video.mp4');
37
38
  const args = ['-v', 'error', '-xerror', '-y'];
@@ -46,26 +47,60 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
46
47
  const pictureLeadHold = Math.max(0, -originDelta);
47
48
  const duration = (schedule.duration_ms + audioOrigin) / 1000;
48
49
  const baseFilter = `trim=start=${trim_start_ms / 1000}:end=${trim_end_ms / 1000},setpts=PTS-STARTPTS,tpad=start_mode=clone:start_duration=${pictureLeadHold / 1000},fps=${story.output.fps},tpad=stop_mode=clone:stop_duration=${duration},trim=duration=${duration},format=yuv420p`;
50
+ const frameCount = Math.ceil(duration * story.output.fps - 1e-9);
49
51
  const annotations = annotationApplications(story, schedule, visual, audioOrigin);
50
52
  const renderer = annotations.length || schedule.overlays?.length || !licensed ? await import('./compositor.js') : undefined;
51
53
  const layers = await renderer?.frameLayers(story.output, schedule, licensed, options.inputHashes) ?? [];
52
- const streamCompositor = annotations.length > 0 || layers.some(layer => layer.opacityAt !== undefined);
53
- let input = 1;
54
- if (streamCompositor) {
55
- args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${story.output.width}x${story.output.height}`, '-framerate', String(story.output.fps), '-i', 'pipe:0');
56
- filters.push('[0:v]format=yuv420p[v]');
54
+ const { canvasLayers, staticTopLayers } = renderer ? renderer.splitFrameLayers(layers) : { canvasLayers: [], staticTopLayers: [] };
55
+ const plan = renderer ? renderer.planCompositor(frameCount, story.output.fps, audioOrigin, annotations, canvasLayers) : { kind: 'none' };
56
+ let layerImage;
57
+ if (staticTopLayers.length) {
58
+ layerImage = join(temporaryDirectory, 'overlays.png');
59
+ await renderer.writeStaticFrameLayers(layerImage, story.output, staticTopLayers);
57
60
  }
58
- else {
59
- args.push('-i', visual.file);
60
- if (layers.length) {
61
- const layerImage = join(temporaryDirectory, 'overlays.png');
62
- await renderer.writeStaticFrameLayers(layerImage, story.output, layers);
63
- args.push('-i', layerImage);
64
- filters.push(`[0:v]${baseFilter}[base]`, '[base][1:v]overlay=eof_action=repeat[v]');
65
- input++;
61
+ let input = 1;
62
+ switch (plan.kind) {
63
+ case 'none':
64
+ args.push('-i', visual.file);
65
+ if (layerImage) {
66
+ args.push('-i', layerImage);
67
+ filters.push(`[0:v]${baseFilter}[base]`, '[base][1:v]overlay=eof_action=repeat,format=yuv420p[v]');
68
+ input = 2;
69
+ }
70
+ else {
71
+ filters.push(`[0:v]${baseFilter}[v]`);
72
+ input = 1;
73
+ }
74
+ break;
75
+ case 'sparse':
76
+ args.push('-i', visual.file);
77
+ args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${story.output.width}x${story.output.height}`, '-framerate', String(story.output.fps), '-i', 'pipe:0');
78
+ if (layerImage) {
79
+ args.push('-i', layerImage);
80
+ filters.push(`[0:v]${baseFilter}[base]`, `[1:v]setpts='${plan.ptsExpr}'[comp_in]`, `[base][comp_in]overlay=eof_action=pass:enable='${plan.betweenExpr}'[comp]`, '[comp][2:v]overlay=eof_action=repeat,format=yuv420p[v]');
81
+ input = 3;
82
+ }
83
+ else {
84
+ filters.push(`[0:v]${baseFilter}[base]`, `[1:v]setpts='${plan.ptsExpr}'[comp_in]`, `[base][comp_in]overlay=eof_action=pass:enable='${plan.betweenExpr}',format=yuv420p[v]`);
85
+ input = 2;
86
+ }
87
+ break;
88
+ case 'full':
89
+ args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${story.output.width}x${story.output.height}`, '-framerate', String(story.output.fps), '-i', 'pipe:0');
90
+ if (layerImage) {
91
+ args.push('-i', layerImage);
92
+ filters.push('[0:v]format=yuv420p[base]', '[base][1:v]overlay=eof_action=repeat,format=yuv420p[v]');
93
+ input = 2;
94
+ }
95
+ else {
96
+ filters.push('[0:v]format=yuv420p[v]');
97
+ input = 1;
98
+ }
99
+ break;
100
+ default: {
101
+ const _exhaustive = plan;
102
+ throw new Error(`Unhandled compositor plan: ${String(_exhaustive)}`);
66
103
  }
67
- else
68
- filters.push(`[0:v]${baseFilter}[v]`);
69
104
  }
70
105
  if (annotations.length)
71
106
  await saveJson(join(directory, 'annotations-applied.json'), { version: 1, annotations });
@@ -96,19 +131,23 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
96
131
  args.push('-map', '[a]', '-c:a', 'aac', '-b:a', '192k', '-ar', '48000');
97
132
  args.push('-c:v', 'libx264', '-preset', 'fast', '-crf', '18', '-t', String(duration), '-movflags', '+faststart');
98
133
  let compositor;
99
- if (streamCompositor) {
100
- compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary], story.output, annotations, layers, Math.ceil(duration * story.output.fps - 1e-9), audioOrigin);
134
+ if (plan.kind !== 'none') {
135
+ compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary], story.output, annotations, plan, frameCount, audioOrigin);
101
136
  }
102
- else
137
+ else {
103
138
  await execute('ffmpeg', [...args, temporary]);
139
+ if (annotations.length)
140
+ compositor = { renderer: 'canvas-skia', version: '1.1.1', frames: frameCount, composited_frames: 0, mode: 'none' };
141
+ }
104
142
  if (options.verify_timing)
105
143
  await decode(temporary);
106
144
  const properties = await probe(temporary);
107
145
  requireCondition(properties.width === story.output.width && properties.height === story.output.height && properties.has_audio === (tracks.length > 0) && Math.abs(properties.duration_ms - duration * 1000) <= 100, 'OUTPUT_MEDIA', 'Final media properties do not match the schedule', 7);
146
+ const outputSha256 = await hashFile(temporary);
108
147
  let annotationEvidence;
109
148
  if (annotations.length && options.verify_timing) {
110
149
  try {
111
- annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations, story, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, story.output.fps, audioOrigin));
150
+ annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations, story, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, story.output.fps, audioOrigin), outputSha256);
112
151
  }
113
152
  catch (error) {
114
153
  await copyFile(temporary, join(directory, 'failed-composite.mp4'));
@@ -124,7 +163,7 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
124
163
  }
125
164
  const report = { version: 1, output, properties, watermark: !licensed, ...(schedule.overlays?.length ? { image_overlays: schedule.overlays } : {}), decode: options.verify_timing ? 'passed' : 'not_evaluated', timing_status: visual.timing.status, ...(annotations.length ? { compositor, base_capture_timing: visual.timing.status, applied_annotations: annotations, final_composite: annotationEvidence ?? { status: 'not_evaluated', gaps: ['Final annotation frames were not verified. The user reviews the video.'] } } : {}), output_origin_delta_ms: originDelta, audio_origin_ms: audioOrigin, picture_lead_hold_ms: pictureLeadHold, final_hold: 'clone last content frame to scheduled end', trim_start_ms, trim_end_ms, mapping, transformations, editorial_review: 'user' };
126
165
  await saveJson(join(directory, 'report.json'), report);
127
- return report;
166
+ return { report, outputSha256 };
128
167
  }
129
168
  finally {
130
169
  try {
@@ -1,6 +1,6 @@
1
1
  import { join } from 'node:path';
2
2
  import { spawn } from 'node:child_process';
3
- import { execute, executionScope, saveJson } from './media.js';
3
+ import { execute, executionSignal, hasStageDeadline, saveJson } from './media.js';
4
4
  import { executable } from './executables.js';
5
5
  import { ProductionError } from './errors.js';
6
6
  const analysisWidth = 640;
@@ -18,7 +18,8 @@ async function* decodedFrames(file, range) {
18
18
  if (range)
19
19
  args.push('-frames:v', String(range.last - range.first + 1));
20
20
  args.push('-f', 'rawvideo', '-');
21
- const child = spawn(executable('ffmpeg'), args, { stdio: ['ignore', 'pipe', 'pipe'], signal: executionScope.getStore(), killSignal: 'SIGKILL', windowsHide: true });
21
+ const signal = executionSignal();
22
+ const child = spawn(executable('ffmpeg'), args, { stdio: ['ignore', 'pipe', 'pipe'], signal, killSignal: 'SIGKILL', windowsHide: true });
22
23
  let error = '';
23
24
  child.stderr.on('data', data => { error = (error + data.toString()).slice(-4000); });
24
25
  const completion = new Promise((resolve, reject) => {
@@ -26,7 +27,7 @@ async function* decodedFrames(file, range) {
26
27
  child.once('close', code => code === 0 ? resolve() : reject(new ProductionError('SUBPROCESS', `ffmpeg exited ${code}: ${error}`, 3)));
27
28
  });
28
29
  void completion.catch(() => { });
29
- const timer = setTimeout(() => child.kill('SIGKILL'), 120000);
30
+ const timer = hasStageDeadline() ? undefined : setTimeout(() => child.kill('SIGKILL'), 120000);
30
31
  const frame = Buffer.alloc(bytes);
31
32
  let filled = 0;
32
33
  let index = range?.first ?? 0;
@@ -332,7 +333,7 @@ export async function calibrate(file, markers, references, duration, directory)
332
333
  await checkpoint();
333
334
  }
334
335
  }
335
- executionScope.getStore()?.throwIfAborted();
336
+ executionSignal()?.throwIfAborted();
336
337
  report.status = failed || pending.size ? 'failed' : 'accepted';
337
338
  await checkpoint();
338
339
  return report;
package/dist/cli.js CHANGED
@@ -7,10 +7,11 @@ import { produce } from './pipeline.js';
7
7
  import { resolve, join } from 'node:path';
8
8
  import { json } from './media.js';
9
9
  import { ProductionError, requireCondition } from './errors.js';
10
- import { packagePath } from './installation.js';
11
- import { withExecutables } from './executables.js';
10
+ import { packagePath, userConfigFile } from './installation.js';
11
+ import { configuredLicense, withExecutables } from './executables.js';
12
12
  import { setup } from './setup.js';
13
13
  import { setupLicense } from './setup-license.js';
14
+ import { notifyUpdate } from './update-check.js';
14
15
  const commands = ['inspect', 'validate', 'play', 'tts', 'resolve', 'record', 'assemble', 'build'];
15
16
  const documents = new Map([
16
17
  ['license', 'LICENSE-TERMS.md'],
@@ -19,30 +20,59 @@ const documents = new Map([
19
20
  ['skill storyboard', 'skills/slidevideo/references/storyboard.md'],
20
21
  ['skill production', 'skills/slidevideo/references/production.md'],
21
22
  ]);
22
- const setupHelp = `slidevideo setup [--presentation slidev|powerpoint] [--provider edge-tts|elevenlabs]
23
+ const setupHelp = `slidevideo setup [options]
24
+ Check this installation and configure tools and speech providers.
23
25
 
24
- --voice-id <id> Voice ID for the storyboard. Required for ElevenLabs readiness.
25
- --install Install supported missing tools.
26
- --manual Check tools and print manual instructions without installing.
27
- --browser/--python/--ffmpeg/--ffprobe <path> Check and save a custom executable.
28
- --json Print the readiness report as JSON. Pass the workflow choices as options.
29
- --license Manage activation in a terminal without checking dependencies.
26
+ --manual Show status and next steps without prompts or installation.
27
+ --install Install supported missing tools.
28
+ --license Manage license activation.
29
+ --json Print detailed status as JSON.
30
30
 
31
- Run without options in a terminal to choose the workflow interactively.
32
- Setup exits 3 if the selected workflow is missing required dependencies.
31
+ Custom tool paths:
32
+ --browser <path> --python <path> --ffmpeg <path> --ffprobe <path>
33
+
34
+ Exit codes: 0 ready, 3 missing prerequisites.
33
35
  `;
36
+ function setupChecklist(report, licensed) {
37
+ const labels = {
38
+ ffmpeg: 'FFmpeg', ffprobe: 'ffprobe', browser: 'Chromium', python: 'Python environment',
39
+ 'elevenlabs-key': 'API key',
40
+ powershell: 'Windows PowerShell 5.1', powerpoint: 'desktop PowerPoint', desktop: 'unlocked desktop',
41
+ 'ffmpeg-gdigrab': 'FFmpeg gdigrab input', platform: 'supported platform',
42
+ };
43
+ const lines = report.shared_checks.map(check => ` [${check.ready ? '✓' : 'X'}] ${labels[check.name] ?? check.name}`);
44
+ const group = (name, readiness, deferred = false) => {
45
+ if (!readiness)
46
+ return;
47
+ if (readiness.status === 'unavailable')
48
+ lines.push(` [-] ${name}: ${readiness.checks[0].detail}`);
49
+ else {
50
+ const missing = readiness.checks.filter(check => !check.ready).map(check => labels[check.name] ?? check.name);
51
+ lines.push(` [${readiness.status === 'ready' ? '✓' : 'X'}] ${name}${missing.length ? `: needs ${missing.join(', ')}` : ''}${deferred ? ', setup deferred' : ''}`);
52
+ }
53
+ };
54
+ group('Slidev / Chromium', report.presentations.slidev);
55
+ group('Native PowerPoint', report.presentations.powerpoint);
56
+ group('Edge TTS', report.providers['edge-tts'], report.providers['edge-tts']?.deferred);
57
+ group('ElevenLabs', report.providers.elevenlabs, report.providers.elevenlabs?.deferred);
58
+ lines.push(` [${licensed ? '✓' : 'X'}] License ${licensed ? 'active' : 'not active'}`);
59
+ return lines.join('\n');
60
+ }
34
61
  let command = process.argv[2] ?? 'help';
35
62
  const jsonMode = process.argv.includes('--json');
36
63
  let previewReady = false;
64
+ let runDirectory;
37
65
  try {
38
66
  const { values, positionals } = parseArgs({ options: {
39
- storyboard: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, export: { type: 'string' }, 'timeout-ms': { type: 'string' },
67
+ storyboard: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, export: { type: 'string' }, 'timeout-minutes': { type: 'string' },
40
68
  browser: { type: 'string' }, python: { type: 'string' }, ffmpeg: { type: 'string' }, ffprobe: { type: 'string' },
41
69
  presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, install: { type: 'boolean' }, manual: { type: 'boolean' },
42
70
  license: { type: 'boolean' },
43
71
  json: { type: 'boolean' }, quiet: { type: 'boolean' }, resume: { type: 'boolean' }, 'verify-timing': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' },
44
72
  }, allowPositionals: true });
73
+ runDirectory = values.run;
45
74
  command = positionals[0] ?? 'help';
75
+ notifyUpdate(Boolean(values.json), Boolean(values.quiet));
46
76
  if (values.version) {
47
77
  const { version } = JSON.parse(await readFile(packagePath('package.json'), 'utf8'));
48
78
  console.log(values.json ? JSON.stringify({ version: 1, package_version: version }) : version);
@@ -58,13 +88,13 @@ try {
58
88
  --resume Reuse intact build stages with matching inputs and mode.
59
89
  --verify-timing Opt in to decoded timing proof for build or record; assemble checks the recorded mode.
60
90
  --export <file> Optional resolved schedule export.
61
- --timeout-ms <ms> Bounded stage timeout, default 180000.
91
+ --timeout-minutes <min> Stage timeout override in minutes; defaults scale with project duration.
62
92
  --browser/--python/--ffmpeg/--ffprobe <path> Override a tool for this command.
63
93
  --json One JSON result on stdout (play reports its URL at readiness).
64
94
  --quiet Suppress progress on stderr.
65
95
  --version Package version.
66
96
 
67
- setup checks and configures the dependencies for your presentation format and speech provider.
97
+ setup prepares shared tools and speech providers, and detects Slidev and native PowerPoint support.
68
98
  Normal production leaves timing unevaluated and the video for user review.
69
99
  inspect lists existing annotation targets without recording.
70
100
  validate checks inputs without recording.
@@ -89,23 +119,46 @@ impressum displays the provider's contact details.
89
119
  await withExecutables({}, setupLicense);
90
120
  }
91
121
  else if (command === 'setup') {
92
- requireCondition(positionals.length === 1 && !['storyboard', 'port', 'run', 'cache-dir', 'output', 'export', 'timeout-ms', 'resume', 'verify-timing'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
93
- const report = await withExecutables(values, () => setup(values));
122
+ requireCondition(positionals.length === 1 && !['storyboard', 'port', 'run', 'cache-dir', 'output', 'export', 'timeout-minutes', 'resume', 'verify-timing'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
123
+ let initialChecklist;
124
+ const report = await withExecutables(values, () => setup(values, current => {
125
+ initialChecklist = setupChecklist(current, configuredLicense());
126
+ console.error(`Current setup\n${initialChecklist}`);
127
+ console.error(`Config: ${userConfigFile()}\n`);
128
+ }));
94
129
  if (values.json)
95
130
  console.log(JSON.stringify(report));
96
131
  else {
97
- if (report.browser_requirement)
98
- console.log(report.browser_requirement);
99
- for (const browser of report.browsers)
100
- console.log(`${browser.name} at ${browser.path}`);
101
- for (const check of report.checks)
102
- console.log(`${check.ready ? 'Ready' : 'Required'} ${check.name}: ${check.detail}`);
132
+ const checklist = setupChecklist(report, configuredLicense());
133
+ if (initialChecklist !== checklist) {
134
+ console.log(`Setup status\n${checklist}`);
135
+ if (initialChecklist === undefined) {
136
+ console.log(`Config: ${report.config_file}`);
137
+ }
138
+ }
139
+ const missing = (name) => report.checks.some(check => check.name === name && !check.ready);
140
+ const next = [];
141
+ if (missing('ffmpeg') || missing('ffprobe'))
142
+ next.push(process.platform === 'darwin'
143
+ ? 'FFmpeg: install with brew install ffmpeg (or run setup --install), or pass --ffmpeg and --ffprobe with their paths.'
144
+ : 'Install FFmpeg with libx264 and ffprobe, or pass --ffmpeg and --ffprobe with their paths.');
145
+ if (missing('browser'))
146
+ next.push('Chromium: run setup --presentation slidev --install, or pass --browser <path>.');
147
+ if (missing('python') && !report.providers['edge-tts']?.deferred)
148
+ next.push('Edge TTS: run setup --provider edge-tts --install, or pass --python <venv-python>.');
149
+ if (missing('elevenlabs-key') && !report.providers.elevenlabs?.deferred)
150
+ next.push('ElevenLabs: run setup --provider elevenlabs to save your API key for all projects.');
151
+ for (const check of report.presentations.powerpoint?.checks ?? []) {
152
+ if (!check.ready && check.name !== 'platform')
153
+ next.push(check.detail);
154
+ }
155
+ if (next.length)
156
+ console.log(`\nNext steps\n${next.map(step => ` ${step}`).join('\n')}`);
103
157
  for (const error of report.installation_errors)
104
158
  console.log(error);
105
159
  if (Object.keys(report.saved_paths).length)
106
160
  console.log(`Saved executable paths to ${report.config_file}`);
107
- console.log(`Storyboard voice settings\nvoice:\n provider: ${report.voice.provider}\n voice: ${JSON.stringify(report.voice.voice)}`);
108
- console.log(report.status === 'ready' ? 'The selected workflow is ready.' : 'The selected workflow needs the dependencies listed above.');
161
+ console.log(report.status === 'ready' ? '\nSetup ready.' : '\nSetup incomplete.');
109
162
  }
110
163
  if (report.status !== 'ready')
111
164
  process.exitCode = 3;
@@ -113,8 +166,13 @@ impressum displays the provider's contact details.
113
166
  else {
114
167
  requireCondition(commands.includes(command) && positionals.length === 1, 'COMMAND', 'Run slidevideo --help for available commands');
115
168
  requireCondition(!['presentation', 'provider', 'voice-id', 'install', 'manual', 'license'].some(key => key in values), 'OPTION', 'Presentation, provider, voice ID, install and license options require setup');
116
- const timeout = Number(values['timeout-ms'] ?? 180000);
117
- requireCondition(Number.isInteger(timeout) && timeout >= 1000 && timeout <= 3600000, 'TIMEOUT', '--timeout-ms must be between 1000 and 3600000');
169
+ let timeout;
170
+ if (values['timeout-minutes'] !== undefined) {
171
+ const raw = values['timeout-minutes'].trim();
172
+ const minutes = Number(raw);
173
+ requireCondition(/^(?:\d+(?:\.\d+)?|\.\d+)$/.test(raw) && Number.isFinite(minutes) && minutes > 0 && minutes <= 180, 'TIMEOUT', '--timeout-minutes must be a positive number up to 180');
174
+ timeout = Math.ceil(minutes * 60_000);
175
+ }
118
176
  requireCondition(!values.output || ['assemble', 'build'].includes(command), 'OPTION', '--output requires assemble or build');
119
177
  requireCondition(!values.resume || command === 'build', 'OPTION', '--resume requires build');
120
178
  requireCondition(!values['cache-dir'] || ['tts', 'build', 'play'].includes(command), 'OPTION', '--cache-dir requires play, tts or build');
@@ -124,7 +182,7 @@ impressum displays the provider's contact details.
124
182
  await withExecutables(values, async () => {
125
183
  if (command === 'play') {
126
184
  requireCondition(values.storyboard, 'STORYBOARD_REQUIRED', 'play requires --storyboard');
127
- requireCondition(values.run === undefined && values['timeout-ms'] === undefined, 'OPTION', 'play takes --storyboard, --cache-dir and --port; Ctrl+C stops the server');
185
+ requireCondition(values.run === undefined && values['timeout-minutes'] === undefined, 'OPTION', 'play takes --storyboard, --cache-dir and --port; Ctrl+C stops the server');
128
186
  const port = Number(values.port ?? 0);
129
187
  requireCondition(values.port === undefined || /^\d+$/.test(values.port) && Number.isInteger(port) && port <= 65535, 'PREVIEW_PORT', '--port must be between 0 and 65535');
130
188
  await servePreview(values.storyboard, values['cache-dir'], port, (url, approximate) => {
@@ -163,14 +221,13 @@ impressum displays the provider's contact details.
163
221
  catch (error) {
164
222
  const failure = error instanceof ProductionError ? error : new ProductionError('INTERNAL', error instanceof Error ? error.message : String(error), error instanceof TypeError ? 2 : 1);
165
223
  let run;
166
- const runIndex = process.argv.indexOf('--run');
167
- if (runIndex >= 0 && process.argv[runIndex + 1]) {
224
+ if (runDirectory) {
168
225
  try {
169
- run = await json(join(resolve(process.argv[runIndex + 1]), 'manifest.json'));
226
+ run = await json(join(resolve(runDirectory), 'manifest.json'));
170
227
  }
171
228
  catch { }
172
229
  }
173
- const result = { version: 1, command, status: 'failed', run_id: run?.run_id, completed_stages: Object.entries(run?.stages ?? {}).filter(([, stage]) => stage?.status === 'completed').map(([name]) => name), artifacts: run ? { manifest: join(resolve(process.argv[runIndex + 1]), 'manifest.json') } : {}, timing_status: 'not_accepted', warnings: [], errors: [{ stage: command, code: failure.code, message: failure.message, ...failure.context }] };
230
+ const result = { version: 1, command, status: 'failed', run_id: run?.run_id, completed_stages: Object.entries(run?.stages ?? {}).filter(([, stage]) => stage?.status === 'completed').map(([name]) => name), artifacts: run ? { manifest: join(resolve(runDirectory), 'manifest.json') } : {}, timing_status: 'not_accepted', warnings: [], errors: [{ stage: command, code: failure.code, message: failure.message, ...failure.context }] };
174
231
  const diagnostic = jsonMode ? JSON.stringify(result) : `${failure.code}: ${failure.message}`;
175
232
  if (previewReady)
176
233
  console.error(diagnostic);
@@ -1,18 +1,45 @@
1
1
  import { type Canvas, type Image } from '@napi-rs/canvas';
2
2
  import type { Rectangle, Schedule, Storyboard } from './contracts.js';
3
3
  import type { AppliedAnnotation } from './annotations.js';
4
- type FrameLayer = {
4
+ export type FrameLayer = {
5
5
  image: Image | Canvas;
6
6
  rectangle: Rectangle;
7
7
  opacityAt?: (time: number) => number;
8
8
  opacity: number;
9
9
  };
10
+ export type ActiveInterval = {
11
+ start: number;
12
+ end: number;
13
+ };
14
+ export type CompositorPlan = {
15
+ kind: 'none';
16
+ } | {
17
+ kind: 'sparse';
18
+ intervals: ActiveInterval[];
19
+ selectedFrames: number;
20
+ activeFrames: number;
21
+ betweenExpr: string;
22
+ ptsExpr: string;
23
+ canvasLayers: FrameLayer[];
24
+ } | {
25
+ kind: 'full';
26
+ activeFrames: number;
27
+ canvasLayers: FrameLayer[];
28
+ };
10
29
  export declare function frameLayers(output: Storyboard['output'], schedule: Schedule, licensed: boolean, hashes?: Record<string, string>): Promise<FrameLayer[]>;
11
30
  export declare function writeStaticFrameLayers(file: string, output: Storyboard['output'], layers: FrameLayer[]): Promise<void>;
12
31
  export declare function visibleFrameLayerBounds(layers: FrameLayer[], frame: number, fps: number, audioOrigin: number): Rectangle[];
13
- export declare function compositeFrames(source: string, baseFilter: string, encoderArgs: string[], output: Storyboard['output'], applications: AppliedAnnotation[], layers: FrameLayer[], frameCount: number, audioOrigin: number): Promise<{
32
+ export declare function splitFrameLayers(layers: FrameLayer[]): {
33
+ canvasLayers: FrameLayer[];
34
+ staticTopLayers: FrameLayer[];
35
+ };
36
+ export declare function planCompositor(frameCount: number, fps: number, audioOrigin: number, applications: AppliedAnnotation[], canvasLayers: FrameLayer[]): CompositorPlan;
37
+ export declare function compositeFrames(source: string, baseFilter: string, encoderArgs: string[], output: Storyboard['output'], applications: AppliedAnnotation[], plan: Exclude<CompositorPlan, {
38
+ kind: 'none';
39
+ }>, frameCount: number, audioOrigin: number): Promise<{
14
40
  renderer: string;
15
41
  version: string;
16
42
  frames: number;
43
+ composited_frames: number;
44
+ mode: "sparse" | "full";
17
45
  }>;
18
- export {};