@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.0
|
|
6
|
+
|
|
7
|
+
- Speed up video assembly with sparse marker highlights or overlays by restricting Canvas compositing to active frame intervals and dirty regions while compositing static top layers in FFmpeg.
|
|
8
|
+
|
|
9
|
+
- Stream Slidev recordings directly into the run directory instead of buffering full WebM captures in browser memory and `/tmp`, and remove the 30-second capture finalization cap.
|
|
10
|
+
|
|
11
|
+
- Support Slidev setup, preview, and video production on macOS, including Homebrew FFmpeg installation and macOS browser discovery.
|
|
12
|
+
|
|
13
|
+
- Stream file hashing and compute output digests before publication so captures and videos larger than 2 GiB do not crash or lock retries.
|
|
14
|
+
|
|
15
|
+
- Scale default stage timeouts to the resolved video duration, remove 120-second FFmpeg caps inside active stages, and replace `--timeout-ms` with `--timeout-minutes`.
|
|
16
|
+
|
|
17
|
+
- Preserve existing files when speech generation targets a nonempty directory without a run manifest.
|
|
18
|
+
|
|
19
|
+
- Storyboards now require `version: 1` and an `annotations` list; use `annotations: []` when no highlights are needed.
|
|
20
|
+
|
|
21
|
+
- Fix Slidev theme loading for presentations outside the installation folder.
|
|
22
|
+
|
|
23
|
+
- Recover from occupied output files without recording again.
|
|
24
|
+
|
|
25
|
+
- Fix validation of recording schedules and cached speech.
|
|
26
|
+
|
|
27
|
+
- Recognize Markdown decks with uppercase file extensions.
|
|
28
|
+
|
|
29
|
+
- Fix version and failure details in run reports.
|
|
30
|
+
|
|
31
|
+
- Configure Edge TTS and ElevenLabs in one setup session, with the option to configure either provider later.
|
|
32
|
+
|
|
33
|
+
- Save an ElevenLabs API key once for use across projects.
|
|
34
|
+
|
|
35
|
+
- Choose narration voices in the storyboard without voice prompts during installation.
|
|
36
|
+
|
|
37
|
+
- Fix setup readiness and license reporting for deferred providers and already active licenses.
|
|
38
|
+
|
|
39
|
+
## 0.1.2
|
|
40
|
+
|
|
41
|
+
- Remind users to retain their custom npm installation prefix when they run an update command.
|
|
42
|
+
|
|
43
|
+
- Recover background update checks after interrupted or failed attempt reservations.
|
|
44
|
+
|
|
45
|
+
- Notify interactive CLI users about newer npm versions with a daily background check, cached notices and an opt-out.
|
|
46
|
+
|
|
5
47
|
## 0.1.1
|
|
6
48
|
|
|
7
49
|
### Changes
|
package/IMPRESSUM.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Imprint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Information pursuant to Section 5 of the German Digital Services Act (DDG).
|
|
4
|
+
|
|
5
|
+
## Service provider
|
|
4
6
|
|
|
5
7
|
Christian Pietsch
|
|
6
8
|
|
|
@@ -8,6 +10,18 @@ Kirchenstr. 22A
|
|
|
8
10
|
|
|
9
11
|
22869 Schenefeld, Germany
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Contact
|
|
14
|
+
|
|
15
|
+
Email: [hello@slidevideo.io](mailto:hello@slidevideo.io)
|
|
16
|
+
|
|
17
|
+
Telephone: [+49 40 40196280](tel:+494040196280)
|
|
18
|
+
|
|
19
|
+
## Editorial responsibility
|
|
20
|
+
|
|
21
|
+
Person responsible for content pursuant to Section 18(2) of the German Interstate Media Treaty (MStV):
|
|
22
|
+
|
|
23
|
+
Christian Pietsch, Kirchenstr. 22A, 22869 Schenefeld, Germany
|
|
24
|
+
|
|
25
|
+
## Consumer dispute resolution
|
|
12
26
|
|
|
13
|
-
|
|
27
|
+
Notice pursuant to Section 36 of the German Consumer Dispute Resolution Act (VSBG): We are neither willing nor obliged to participate in dispute resolution proceedings before a consumer arbitration board.
|
package/LICENSE-TERMS.md
CHANGED
|
@@ -1,36 +1,59 @@
|
|
|
1
1
|
# SlideVideo license terms
|
|
2
2
|
|
|
3
|
-
Effective
|
|
3
|
+
Effective 22 November 2026.
|
|
4
4
|
|
|
5
5
|
## Who provides SlideVideo
|
|
6
6
|
|
|
7
7
|
Christian Pietsch, Kirchenstr. 22A, 22869 Schenefeld, Germany, provides SlideVideo. Contact us at [hello@slidevideo.io](mailto:hello@slidevideo.io) or [+49 40 40196280](tel:+494040196280).
|
|
8
8
|
|
|
9
|
-
We grant you permission to install and use the SlideVideo CLI under these terms. SlideVideo and its contributors retain
|
|
9
|
+
We grant you a non-exclusive, non-transferable permission to install and use the SlideVideo CLI under these terms. SlideVideo and its contributors retain all rights in the software. Third-party components are subject to their own licenses, and external speech providers are subject to their own service terms and fees.
|
|
10
|
+
|
|
11
|
+
You may not modify, patch, redistribute or wrap the SlideVideo software to remove, hide or bypass the export watermark or license checks, except to the extent mandatory statutory law (such as Sections 69d and 69e of the German Copyright Act) permits acts necessary for interoperability or error correction.
|
|
10
12
|
|
|
11
13
|
## Free use
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Individuals and organizations of any size may use SlideVideo at no charge to create, publish and share watermarked videos for personal, educational, internal company or own-brand purposes, and to share unpaid watermarked drafts for review, subject to the rights they hold in the content. Keep the `slidevideo.io` watermark clearly visible and unmodified when you use, edit or share those videos.
|
|
16
|
+
|
|
17
|
+
Free use does not permit selling, licensing or delivering finished videos to clients or third parties for compensation, or offering SlideVideo exports inside a hosted service, API or SaaS product for external users, even with the watermark visible. You need an active paid license covering your use to produce a version that omits, crops, covers, hides or removes the watermark, or to deliver paid client videos or hosted third-party exports.
|
|
14
18
|
|
|
15
19
|
## Watermark-Free License
|
|
16
20
|
|
|
17
|
-
Each person who independently creates or adapts a SlideVideo storyboard for watermark-free delivery is a producer and needs a license covering their work. This applies when a colleague runs the export on their behalf.
|
|
21
|
+
Each person who independently creates or adapts a SlideVideo storyboard for watermark-free delivery is a producer and needs a license covering their work. This requirement also applies when a colleague or coding agent runs the export on their behalf.
|
|
22
|
+
|
|
23
|
+
An active Watermark-Free License covers one named producer acting either as an individual, for a non-profit or public educational institution, or within a small organization of up to 10 people across affiliated entities (counting employees, founders and regular contractors).
|
|
24
|
+
|
|
25
|
+
The license covers watermark-free videos created solely for that producer's own projects or their qualifying small organization's own products, courses, channels, documentation, marketing and internal communication. Producers may monetize their own channels, courses and products (including ad revenue, course sales and sponsor mentions within their own content). That producer may install SlideVideo on their own devices and direct an interactive coding agent to perform individual exports. Colleagues inside the qualifying organization may supply slides or review drafts under the free terms.
|
|
26
|
+
|
|
27
|
+
The Watermark-Free License does not cover any of the following uses, each of which requires a Corporate & Agency License:
|
|
28
|
+
|
|
29
|
+
- Creating, adapting or exporting commissioned videos for clients, customers' brands or third-party channels for compensation, including agency, studio, consultancy, freelance or white-label deliverables
|
|
30
|
+
- Reselling, sublicensing or distributing produced videos as client deliverables
|
|
31
|
+
- Use by or on behalf of an organization with more than 10 people
|
|
32
|
+
- Offering or embedding SlideVideo exports in a hosted service, API or SaaS product for third parties
|
|
33
|
+
- Scheduled, event-triggered, shared-queue or automated batch workflows that create multiple finished videos
|
|
34
|
+
|
|
35
|
+
## Corporate & Agency License
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
A separate Corporate & Agency License is required in any of these cases:
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
- **Corporate teams.** Watermark-free exports for organizations with more than 10 people using SlideVideo for internal communication, training, documentation or marketing.
|
|
40
|
+
- **Agencies, freelancers and resellers.** Producing, customizing or delivering paid videos for clients, customers' brands or other third parties (beyond unpaid watermarked review drafts).
|
|
41
|
+
- **Platforms and hosted services.** Products, APIs or SaaS services that run SlideVideo to generate videos for external users or tenants, with or without a watermark.
|
|
42
|
+
- **Automated and batch workflows.** Watermark-free scheduled jobs, event-triggered pipelines, CI workflows or shared export queues that produce multiple finished videos, regardless of organization size.
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
Contact [hello@slidevideo.io](mailto:hello@slidevideo.io) to arrange a Corporate & Agency License. The written agreement specifies the covered organization, producer seats or export scope, permitted client or automation rights, pricing and invoicing terms.
|
|
24
45
|
|
|
25
46
|
## Individual billing, activation and cancellation
|
|
26
47
|
|
|
27
|
-
The individual subscription costs €4.99 per month, including applicable taxes. It continues indefinitely and we charge you monthly until the subscription ends. Before you order, checkout shows the total monthly price, billing interval and cancellation terms. We email your contract confirmation and license key.
|
|
48
|
+
The individual Watermark-Free License subscription costs €4.99 per month per producer, including applicable taxes. It continues indefinitely and we charge you monthly until the subscription ends. Before you order, checkout shows the total monthly price, billing interval and cancellation terms. We email your contract confirmation and license key.
|
|
28
49
|
|
|
29
|
-
Enter your key using `slidevideo setup --license` and keep it private. The CLI checks the key locally.
|
|
50
|
+
Enter your key using `slidevideo setup --license` and keep it private. The CLI checks the key locally. Your right to produce new watermark-free exports depends on timely payment for the current billing period and compliance with these terms. If your organization grows past 10 people or you begin producing client videos, contact us to transition to a Corporate & Agency License before producing new watermark-free exports.
|
|
51
|
+
|
|
52
|
+
We may suspend or terminate a license for cause and add its key to the CLI revocation list if the key is shared across multiple producers, published or leaked, used outside the permitted license tier, or left unpaid after a failed renewal notice or payment reversal.
|
|
30
53
|
|
|
31
54
|
You may cancel at any time by email or post using the contact details above. When we offer subscriptions for purchase online, use the cancellation link on the [SlideVideo website](https://slidevideo.io). We email your declaration, receipt time and intended end date. Ordinary cancellation takes effect at the end of the current billing period, or on a later date you request. If you request the earliest available date, the notice period is at most one month. You may end the contract sooner when the law gives you that right.
|
|
32
55
|
|
|
33
|
-
When your paid license ends, remove the activation using `slidevideo setup --license` and use the free tier for new exports. After ordinary cancellation, you may continue to use
|
|
56
|
+
When your paid license ends, remove the activation using `slidevideo setup --license` and use the free tier for new exports. After ordinary cancellation at the end of a paid billing period, you may continue to use and publish videos you lawfully produced within the scope of your license while it was active. If a contract is rescinded through withdrawal or payment chargeback, your right to use, publish or distribute watermark-free videos produced under that key ends and you must remove the activation.
|
|
34
57
|
|
|
35
58
|
## Right of withdrawal for consumers
|
|
36
59
|
|
|
@@ -38,7 +61,7 @@ If you buy the subscription as a consumer online, you may withdraw within 14 day
|
|
|
38
61
|
|
|
39
62
|
Send a clear statement that you wish to withdraw by email or post using the contact details above. You may use the form below. We email your declaration and receipt time. Send your declaration before the withdrawal period ends to meet the deadline.
|
|
40
63
|
|
|
41
|
-
We refund payments for the withdrawn subscription without undue delay and within 14 days of receiving your withdrawal. We use your original payment method unless you expressly agree to another one. We charge no fees for the refund.
|
|
64
|
+
We refund payments for the withdrawn subscription without undue delay and within 14 days of receiving your withdrawal. We use your original payment method unless you expressly agree to another one. We charge no fees for the refund. Upon withdrawal, we revoke the issued license key and you must stop using the key and any watermark-free videos exported under the withdrawn contract.
|
|
42
65
|
|
|
43
66
|
### Optional withdrawal form
|
|
44
67
|
|
|
@@ -51,8 +74,18 @@ I wish to withdraw from my SlideVideo Watermark-Free License subscription.
|
|
|
51
74
|
- Date of this notice
|
|
52
75
|
- Your signature, for paper submissions only
|
|
53
76
|
|
|
54
|
-
## Your content and
|
|
77
|
+
## Your content, warranty and liability
|
|
55
78
|
|
|
56
|
-
You keep the rights you hold in your slides, scripts, media and finished videos. Make sure you have permission to use the content you include and comply with the terms of any third-party media, fonts or speech services you choose.
|
|
79
|
+
You keep the rights you hold in your slides, scripts, media and finished videos. Make sure you have permission to use the content you include and comply with the terms of any third-party media, fonts or speech services you choose. You are responsible for reviewing finished videos before publishing or relying on them.
|
|
57
80
|
|
|
58
81
|
Consumers have statutory rights if we fail to supply the digital product or it is defective. You may ask us to fix a defect, and you may be entitled to a price reduction, termination or compensation when the legal conditions for those remedies apply. We provide and notify you of required updates, including security updates, for the period required by law. Your mandatory consumer protections apply throughout these terms.
|
|
82
|
+
|
|
83
|
+
We are liable without limitation for intent and gross negligence, for injury to life, body or health, for fraudulently concealed defects, under an expressly assumed guarantee and under the German Product Liability Act (Produkthaftungsgesetz).
|
|
84
|
+
|
|
85
|
+
In cases of slight negligence, we are liable only for breaches of an essential contractual obligation (a duty whose fulfillment enables proper performance of the contract and on whose observance you may regularly rely), and that liability is limited to the foreseeable damage typical for this type of contract. Any further liability for slight negligence is excluded. For free use, strict liability without fault for initial defects is also excluded to the extent permitted by law. These limitations apply equally in favor of our legal representatives, employees and agents.
|
|
86
|
+
|
|
87
|
+
## Governing law and jurisdiction
|
|
88
|
+
|
|
89
|
+
German law applies to these terms, excluding the UN Convention on Contracts for the International Sale of Goods (CISG). If you are a consumer habitually resident in another country, mandatory consumer protection provisions of your country of residence continue to apply.
|
|
90
|
+
|
|
91
|
+
If you act as a merchant (Kaufmann), a legal entity under public law, a special fund under public law, or a business customer without a general place of jurisdiction in Germany, the exclusive place of jurisdiction for all disputes arising from or in connection with these terms is Pinneberg, Germany. We also remain entitled to bring proceedings at your general place of jurisdiction.
|
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@ SlideVideo turns a slide deck into a narrated video. It reads a `slidevideo.yaml
|
|
|
5
5
|
Install Node.js 22.22.0 or later, then run:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install --global @slidevideo/cli
|
|
8
|
+
npm install --global @slidevideo/cli@latest
|
|
9
9
|
slidevideo setup
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Setup checks
|
|
12
|
+
Setup prepares shared tools, checks both speech providers, and detects Slidev and native PowerPoint support. You can leave either provider for later. ElevenLabs setup accepts hidden API key input and saves one key in your per-user config for all projects. Your storyboard selects the deck format, speech provider, and voice. In your project folder, put `slidevideo.yaml` next to your presentation. Run:
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
15
|
slidevideo validate --storyboard slidevideo.yaml
|
|
@@ -20,6 +20,8 @@ A completed build writes `runs/hello-001/final.mp4`. Use `slidevideo setup --lic
|
|
|
20
20
|
|
|
21
21
|
To draft or edit a storyboard, open your presentation folder in your coding agent and ask it to run `slidevideo skill`. The CLI includes the skill and its storyboard and recording references.
|
|
22
22
|
|
|
23
|
+
Interactive calls check npm in the background at most once every 24 hours and show cached update notices on later calls. Stable installations use `latest`; existing alpha installations use `alpha`. Notices include an exact-version upgrade command. If you installed with `--prefix`, add the same `--prefix` option to that command so npm updates the copy on your `PATH`. Set `SLIDEVIDEO_NO_UPDATE_CHECK=1` to disable checks and notices. CI, noninteractive calls, `--json` and `--quiet` skip both.
|
|
24
|
+
|
|
23
25
|
See the [user manual](https://slidevideo.io/guide.html) for host prerequisites and a first build, and the [changelog](CHANGELOG.md) for release notes. Run `slidevideo --help` for the installed command reference.
|
|
24
26
|
|
|
25
|
-
Run `slidevideo license` for the bundled license terms or `slidevideo impressum` for the provider's contact details. Both commands work offline. You can also read the [license terms](https://slidevideo.io/license.html) and [
|
|
27
|
+
Run `slidevideo license` for the bundled license terms or `slidevideo impressum` for the provider's contact details. Both commands work offline. You can also read the [license terms](https://slidevideo.io/license.html) and [Imprint](https://slidevideo.io/impressum.html) on the website.
|
|
@@ -140,7 +140,7 @@ async function play(verifyTiming = false) {
|
|
|
140
140
|
const start = performance.now()
|
|
141
141
|
for (const event of state.markers) { event.observed_ms -= start - origin; event.rendered_by_ms -= start - origin }
|
|
142
142
|
origin = start
|
|
143
|
-
if (schedule.annotations
|
|
143
|
+
if (schedule.annotations.length) geometry = geometryCollector(schedule.annotations, state.annotation_geometry, () => ({ slide: String(nav.currentSlideRoute.value.meta.slide.frontmatter.name ?? `slide-${nav.currentSlideNo.value}`), visit, click: nav.clicks.value, index: nav.currentSlideNo.value }), () => performance.now() - origin, message => { state.failure = message })
|
|
144
144
|
for (const entry of playbackEntries(schedule)) {
|
|
145
145
|
while (performance.now() - origin < entry.at) await wait(entry.at - (performance.now() - origin))
|
|
146
146
|
if (current !== generation) throw new Error('Playback reset')
|
|
@@ -7,7 +7,7 @@ type PlaybackEntry = { at: number; order: number } & (
|
|
|
7
7
|
|
|
8
8
|
export function playbackEntries(schedule: Schedule): PlaybackEntry[] {
|
|
9
9
|
const entries: PlaybackEntry[] = schedule.actions.map(item => ({ at: item.start_ms, order: 1, type: 'action', item }))
|
|
10
|
-
for (const annotation of schedule.annotations
|
|
10
|
+
for (const annotation of schedule.annotations) {
|
|
11
11
|
entries.push({ at: annotation.start_ms, order: 2, type: 'start', annotation }, { at: annotation.end_ms, order: 0, type: 'end', annotation })
|
|
12
12
|
}
|
|
13
13
|
return entries.sort((a, b) => a.at - b.at || a.order - b.order)
|
|
@@ -59,7 +59,7 @@ export function createPreview(
|
|
|
59
59
|
}
|
|
60
60
|
function paint() {
|
|
61
61
|
const output: PreviewLayer[] = []
|
|
62
|
-
for (const annotation of schedule.annotations
|
|
62
|
+
for (const annotation of schedule.annotations) {
|
|
63
63
|
if (!active.has(annotation.id)) continue
|
|
64
64
|
const record = geometry.find(item => item.id === annotation.id)
|
|
65
65
|
if (!record) throw new Error(`Annotation ${annotation.id}: preview geometry is unavailable`)
|
|
@@ -85,7 +85,7 @@ export function createPreview(
|
|
|
85
85
|
}
|
|
86
86
|
async function run(current: number) {
|
|
87
87
|
try {
|
|
88
|
-
collector = geometryCollector(schedule.annotations
|
|
88
|
+
collector = geometryCollector(schedule.annotations, geometry, position, elapsed, fail)
|
|
89
89
|
for (const entry of entries) {
|
|
90
90
|
if (!await waitUntil(entry.at, current)) return
|
|
91
91
|
if (entry.type === 'start') { collector!.start(entry.annotation); active.set(entry.annotation.id, entry.annotation); paint() }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Narration, SpeechAsset, TtsAdapter, Voice } from '../contracts.js';
|
|
2
|
+
export declare function elevenLabsApiKey(environment?: NodeJS.ProcessEnv): string | undefined;
|
|
2
3
|
export declare class ElevenLabsAdapter implements TtsAdapter {
|
|
3
4
|
id: string;
|
|
4
5
|
version: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { configuredElevenLabsKey } from '../executables.js';
|
|
2
3
|
import { requireCondition, ProductionError } from '../errors.js';
|
|
3
|
-
import { decode, hashFile, probe,
|
|
4
|
+
import { decode, hashFile, probe, executionSignal, audioDuration } from '../media.js';
|
|
5
|
+
export function elevenLabsApiKey(environment = process.env) {
|
|
6
|
+
return environment.ELEVENLABS_API_KEY ?? environment.ELEVENLABS_KEY ?? configuredElevenLabsKey();
|
|
7
|
+
}
|
|
4
8
|
export class ElevenLabsAdapter {
|
|
5
9
|
id = 'elevenlabs';
|
|
6
10
|
version = '1';
|
|
@@ -15,15 +19,15 @@ export class ElevenLabsAdapter {
|
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
async synthesize(segment, voice, destination) {
|
|
18
|
-
const key =
|
|
19
|
-
requireCondition(key, 'TTS_CREDENTIAL', '
|
|
22
|
+
const key = elevenLabsApiKey();
|
|
23
|
+
requireCondition(key, 'TTS_CREDENTIAL', 'Run slidevideo setup --provider elevenlabs to save an API key before generating speech', 4, { segment: segment.id });
|
|
20
24
|
const options = voice.options ?? {};
|
|
21
25
|
const { model_id = 'eleven_multilingual_v2', ...voice_settings } = options;
|
|
22
26
|
let response;
|
|
23
27
|
try {
|
|
24
28
|
response = await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voice.voice)}/with-timestamps?output_format=mp3_44100_128`, {
|
|
25
29
|
method: 'POST', headers: { 'xi-api-key': key, 'Content-Type': 'application/json' },
|
|
26
|
-
body: JSON.stringify({ text: segment.text, model_id, voice_settings }), signal: AbortSignal.any([AbortSignal.timeout(90000), ...
|
|
30
|
+
body: JSON.stringify({ text: segment.text, model_id, voice_settings }), signal: AbortSignal.any([AbortSignal.timeout(90000), ...executionSignal() ? [executionSignal()] : []]),
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
catch {
|
|
@@ -11,7 +11,7 @@ export declare class PowerPointAdapter implements PresentationAdapter {
|
|
|
11
11
|
private targets;
|
|
12
12
|
inspectTargets(_story: Storyboard): Promise<PresentationInspection['annotation_targets']>;
|
|
13
13
|
private slide;
|
|
14
|
-
validate(story: Storyboard, _inspection: PresentationInspection, schedule?: Schedule): void
|
|
14
|
+
validate(story: Storyboard, _inspection: PresentationInspection, schedule?: Schedule): Promise<void>;
|
|
15
15
|
private operations;
|
|
16
16
|
prepare(story: Storyboard, schedule: Schedule, directory: string, production?: ProductionOptions): Promise<void>;
|
|
17
17
|
startPreview(story: Storyboard, schedule: Schedule, directory: string): Promise<NativePreview>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import { readFileSync } from 'node:fs';
|
|
3
2
|
import { access, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
4
3
|
import { tmpdir } from 'node:os';
|
|
5
4
|
import { extname, join, resolve } from 'node:path';
|
|
6
5
|
import { fileURLToPath } from 'node:url';
|
|
7
6
|
import { nativePreview } from './powerpoint-preview.js';
|
|
8
7
|
import { calibrate, estimateOrigin } from '../calibration.js';
|
|
9
|
-
import {
|
|
8
|
+
import { executionSignal, hasStageDeadline, hashFile, json, probe, saveJson, videoFramePeriod } from '../media.js';
|
|
10
9
|
import { ProductionError, requireCondition } from '../errors.js';
|
|
11
10
|
import { packagePath } from '../installation.js';
|
|
12
11
|
import { executable } from '../executables.js';
|
|
@@ -167,9 +166,9 @@ class NativeSession {
|
|
|
167
166
|
}
|
|
168
167
|
}
|
|
169
168
|
async waitFor(name, timeout) {
|
|
170
|
-
const deadline = Date.now() + timeout;
|
|
169
|
+
const deadline = timeout === undefined ? Number.POSITIVE_INFINITY : Date.now() + timeout;
|
|
171
170
|
while (Date.now() < deadline) {
|
|
172
|
-
|
|
171
|
+
executionSignal()?.throwIfAborted();
|
|
173
172
|
try {
|
|
174
173
|
return await json(join(this.directory, name));
|
|
175
174
|
}
|
|
@@ -278,7 +277,7 @@ export class PowerPointAdapter {
|
|
|
278
277
|
requireCondition(slides.length === 1, 'SLIDE_REFERENCE', `Native slide ${id} is missing or ambiguous. Use a unique authored Slide.Name or slide-<SlideID>.`);
|
|
279
278
|
return slides[0];
|
|
280
279
|
}
|
|
281
|
-
validate(story, _inspection, schedule) {
|
|
280
|
+
async validate(story, _inspection, schedule) {
|
|
282
281
|
const deck = this.deck;
|
|
283
282
|
requireCondition(deck, 'POWERPOINT_INSPECTION', 'Inspect the native deck before validation', 3);
|
|
284
283
|
requireCondition(Math.abs(story.output.width / story.output.height - deck.width / deck.height) <= 2 / story.output.height, 'POWERPOINT_CAPABILITY', 'Native output aspect ratio must match the PowerPoint slide size. Adjust storyboard output dimensions or the deck page setup.', 3);
|
|
@@ -299,7 +298,7 @@ export class PowerPointAdapter {
|
|
|
299
298
|
requireCondition(candidates.length > 0, 'MEDIA_TARGET', `The native deck has no embedded video named ${declaration.id}`, 3);
|
|
300
299
|
let hash;
|
|
301
300
|
try {
|
|
302
|
-
hash =
|
|
301
|
+
hash = await hashFile(declaration.src);
|
|
303
302
|
}
|
|
304
303
|
catch {
|
|
305
304
|
throw new ProductionError('MISSING_MEDIA', `Cannot read media ${declaration.src}`);
|
|
@@ -315,11 +314,11 @@ export class PowerPointAdapter {
|
|
|
315
314
|
if (action.type === 'play')
|
|
316
315
|
requireCondition((action.trim_start_ms ?? 0) === 0 && action.trim_end_ms === undefined && (action.rate ?? 1) === 1, 'POWERPOINT_CAPABILITY', `Video action ${action.id} requires full-source playback at rate 1 without storyboard trims`, 3);
|
|
317
316
|
}
|
|
318
|
-
for (const annotation of story.annotations
|
|
317
|
+
for (const annotation of story.annotations)
|
|
319
318
|
requireCondition(annotation.target.type !== 'element', 'ANNOTATION_TARGET', `Annotation ${annotation.id} uses a Slidev selector. PowerPoint requires an existing shape ID or normalized region.`, 3);
|
|
320
319
|
if (schedule) {
|
|
321
320
|
this.operations(story, schedule);
|
|
322
|
-
for (const annotation of schedule.annotations
|
|
321
|
+
for (const annotation of schedule.annotations) {
|
|
323
322
|
const slide = this.slide(annotation.slide);
|
|
324
323
|
if (annotation.target.type === 'shape') {
|
|
325
324
|
const target = annotation.target;
|
|
@@ -407,18 +406,18 @@ export class PowerPointAdapter {
|
|
|
407
406
|
return source ? [{ ...clip, src: source.src }] : [];
|
|
408
407
|
});
|
|
409
408
|
const request = join(directory, 'request.json');
|
|
410
|
-
const annotations =
|
|
409
|
+
const annotations = schedule.annotations.map(annotation => ({ ...annotation, native_id: this.slide(annotation.slide).native_id }));
|
|
411
410
|
const capture = mode === 'record' ? { ffmpeg: executable('ffmpeg'), ffprobe: executable('ffprobe') } : {};
|
|
412
411
|
await saveJson(request, { version: 1, mode, directory, deck: story.deck, deck_sha256: this.deck.deck_sha256, parent_pid: process.pid, operations, annotations, media, output: story.output, duration_ms: schedule.duration_ms, verify_timing: verifyTiming, ...capture });
|
|
413
412
|
this.session = new NativeSession(directory, request);
|
|
414
|
-
await this.session.waitFor('prepared.json', 120000);
|
|
413
|
+
await this.session.waitFor('prepared.json', hasStageDeadline() ? undefined : 120000);
|
|
415
414
|
}
|
|
416
415
|
async execute(progress) {
|
|
417
416
|
requireCondition(this.session && this.prepared, 'POWERPOINT_SESSION', 'Prepare the native presentation before execution', 5);
|
|
418
417
|
const { story, schedule, directory, production } = this.prepared;
|
|
419
418
|
progress?.('Recording native PowerPoint presentation');
|
|
420
419
|
await writeFile(join(directory, 'start'), 'start\n');
|
|
421
|
-
const observed = parseEvidence(await this.session.waitFor('result.json', schedule.duration_ms + 90000), directory, production.verify_timing, schedule.annotations
|
|
420
|
+
const observed = parseEvidence(await this.session.waitFor('result.json', hasStageDeadline() ? undefined : schedule.duration_ms + 90000), directory, production.verify_timing, schedule.annotations, story.output);
|
|
422
421
|
const properties = await probe(observed.file);
|
|
423
422
|
requireCondition(properties.width === story.output.width && properties.height === story.output.height && !properties.has_audio, 'CAPTURE_DIMENSIONS', 'Native capture must contain the requested audience dimensions and no audio', 5);
|
|
424
423
|
progress?.(production.verify_timing ? 'Verifying captured timing' : 'Locating capture origin; per-cue timing verification skipped');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { access } from 'node:fs/promises';
|
|
2
2
|
import { fork } from 'node:child_process';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { dirname
|
|
4
|
+
import { dirname } from 'node:path';
|
|
5
5
|
import { slidevInputs } from './slidev-inputs.js';
|
|
6
6
|
import { requireCondition, ProductionError } from '../errors.js';
|
|
7
7
|
async function loadDeck(deck) {
|
|
@@ -28,7 +28,6 @@ async function loadDeck(deck) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export async function inspectSlidev(deck) {
|
|
31
|
-
requireCondition(extname(deck) === '.md', 'PRESENTATION_ADAPTER', `Unsupported presentation format ${extname(deck)}`, 3);
|
|
32
31
|
try {
|
|
33
32
|
await access(deck);
|
|
34
33
|
}
|
|
@@ -49,8 +48,7 @@ export function validateSlidev(story, inspection, schedule) {
|
|
|
49
48
|
for (const scene of story.scenes) {
|
|
50
49
|
requireCondition(inspection.slides.some(s => s.id === scene.slide), 'SLIDE_REFERENCE', `Scene ${scene.id} has unknown slide ${scene.slide}`);
|
|
51
50
|
}
|
|
52
|
-
for (const annotation of story.annotations
|
|
53
|
-
requireCondition(story.scenes.some(scene => scene.id === annotation.scene), 'ANNOTATION_SCENE', `Annotation ${annotation.id} has unknown scene ${annotation.scene}`);
|
|
51
|
+
for (const annotation of story.annotations) {
|
|
54
52
|
requireCondition(annotation.target.type !== 'shape', 'ANNOTATION_TARGET', `Annotation ${annotation.id} uses a PowerPoint shape target unsupported by Slidev`, 3, { annotation: annotation.id });
|
|
55
53
|
}
|
|
56
54
|
const actions = [...story.scenes.flatMap(s => s.actions), ...story.cues.map(c => ({ ...c.action, id: c.id }))];
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { createServer, resolveOptions, createDataUtils } from '@slidev/cli';
|
|
1
|
+
import { createServer, resolveOptions, createDataUtils, parser } from '@slidev/cli';
|
|
2
|
+
import { createWriteStream } from 'node:fs';
|
|
2
3
|
import { readFile, realpath } from 'node:fs/promises';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { dirname } from 'node:path';
|
|
3
6
|
import { packagePath } from '../installation.js';
|
|
4
|
-
const [entry, port,
|
|
5
|
-
const
|
|
7
|
+
const [entry, port, mode, modeFile] = process.argv.slice(2);
|
|
8
|
+
const parsed = await parser.parse(await readFile(entry, 'utf8'), entry);
|
|
9
|
+
const declaredTheme = parsed.slides[0]?.frontmatter.theme;
|
|
10
|
+
let theme;
|
|
11
|
+
if (declaredTheme !== null && (!declaredTheme || declaredTheme === 'default' || declaredTheme === '@slidev/theme-default')) {
|
|
12
|
+
const manifest = createRequire(import.meta.url).resolve('@slidev/theme-default/package.json', { paths: [dirname(entry), packagePath()] });
|
|
13
|
+
theme = dirname(manifest).replaceAll('\\', '/');
|
|
14
|
+
}
|
|
15
|
+
const options = await resolveOptions({ entry, theme, remote: '', base: '/' }, 'dev');
|
|
6
16
|
if (port === 'inspect') {
|
|
7
17
|
if (!process.send || !process.disconnect)
|
|
8
18
|
throw new Error('Inspection requires an IPC channel');
|
|
@@ -22,7 +32,36 @@ else {
|
|
|
22
32
|
options.roots = [...new Set([...options.themeRoots, ...options.addonRoots, options.userRoot])];
|
|
23
33
|
options.utils = await createDataUtils(options);
|
|
24
34
|
}
|
|
25
|
-
const
|
|
35
|
+
const previewConfig = mode === 'preview' && modeFile ? await readFile(modeFile, 'utf8') : undefined;
|
|
36
|
+
let capture;
|
|
37
|
+
if (mode === 'capture' && modeFile) {
|
|
38
|
+
const parsed = JSON.parse(await readFile(modeFile, 'utf8'));
|
|
39
|
+
if (!parsed || typeof parsed !== 'object' || !('file' in parsed) || typeof parsed.file !== 'string' || !('token' in parsed) || typeof parsed.token !== 'string') {
|
|
40
|
+
throw new Error('Invalid Slidev capture configuration');
|
|
41
|
+
}
|
|
42
|
+
capture = { file: parsed.file, token: parsed.token };
|
|
43
|
+
}
|
|
44
|
+
let captureStream;
|
|
45
|
+
let bytesWritten = 0;
|
|
46
|
+
let streamError;
|
|
47
|
+
const closeCaptureStream = () => new Promise((resolve, reject) => {
|
|
48
|
+
const active = captureStream;
|
|
49
|
+
captureStream = undefined;
|
|
50
|
+
if (!active) {
|
|
51
|
+
resolve();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (streamError) {
|
|
55
|
+
active.destroy();
|
|
56
|
+
reject(streamError);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const onClose = () => { active.off('error', onError); resolve(); };
|
|
60
|
+
const onError = (error) => { active.off('close', onClose); reject(error); };
|
|
61
|
+
active.once('close', onClose);
|
|
62
|
+
active.once('error', onError);
|
|
63
|
+
active.end();
|
|
64
|
+
});
|
|
26
65
|
const server = await createServer(options, {
|
|
27
66
|
server: {
|
|
28
67
|
host: '127.0.0.1', port: Number(port), strictPort: true,
|
|
@@ -30,18 +69,100 @@ else {
|
|
|
30
69
|
},
|
|
31
70
|
logLevel: 'warn',
|
|
32
71
|
base: '/',
|
|
33
|
-
plugins:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
72
|
+
plugins: [
|
|
73
|
+
...(previewConfig ? [{
|
|
74
|
+
name: 'slidevideo-preview',
|
|
75
|
+
configureServer(viteServer) {
|
|
76
|
+
viteServer.middlewares.use('/__slidevideo_preview', (_request, response) => {
|
|
77
|
+
response.setHeader('Content-Type', 'application/json');
|
|
78
|
+
response.setHeader('Cache-Control', 'no-store');
|
|
79
|
+
response.end(previewConfig);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
}] : []),
|
|
83
|
+
...(capture ? [{
|
|
84
|
+
name: 'slidevideo-capture',
|
|
85
|
+
configureServer(viteServer) {
|
|
86
|
+
viteServer.middlewares.use('/__slidevideo_capture', (request, response) => {
|
|
87
|
+
void (async () => {
|
|
88
|
+
if (request.method !== 'POST' || request.headers['x-slidevideo-token'] !== capture.token) {
|
|
89
|
+
response.writeHead(403, { 'Content-Type': 'text/plain' });
|
|
90
|
+
response.end('Forbidden');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const op = new URL(request.url ?? '', 'http://127.0.0.1').searchParams.get('op');
|
|
94
|
+
if (op === 'start') {
|
|
95
|
+
captureStream?.destroy();
|
|
96
|
+
bytesWritten = 0;
|
|
97
|
+
streamError = undefined;
|
|
98
|
+
const next = createWriteStream(capture.file, { flags: 'w', mode: 0o600 });
|
|
99
|
+
next.on('error', error => { streamError = error; });
|
|
100
|
+
await new Promise((resolve, reject) => {
|
|
101
|
+
next.once('open', () => resolve());
|
|
102
|
+
next.once('error', reject);
|
|
103
|
+
});
|
|
104
|
+
captureStream = next;
|
|
105
|
+
response.writeHead(204);
|
|
106
|
+
response.end();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (op === 'chunk') {
|
|
110
|
+
if (!captureStream)
|
|
111
|
+
throw new Error('Capture stream is not open');
|
|
112
|
+
if (streamError)
|
|
113
|
+
throw streamError;
|
|
114
|
+
for await (const chunk of request) {
|
|
115
|
+
if (streamError)
|
|
116
|
+
throw streamError;
|
|
117
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
118
|
+
bytesWritten += buffer.length;
|
|
119
|
+
if (!captureStream.write(buffer)) {
|
|
120
|
+
await new Promise((resolve, reject) => {
|
|
121
|
+
const active = captureStream;
|
|
122
|
+
if (!active) {
|
|
123
|
+
reject(new Error('Capture stream closed'));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const onDrain = () => { active.off('error', onError); resolve(); };
|
|
127
|
+
const onError = (error) => { active.off('drain', onDrain); reject(error); };
|
|
128
|
+
active.once('drain', onDrain);
|
|
129
|
+
active.once('error', onError);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (streamError)
|
|
134
|
+
throw streamError;
|
|
135
|
+
response.writeHead(204);
|
|
136
|
+
response.end();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (op === 'finish') {
|
|
140
|
+
await closeCaptureStream();
|
|
141
|
+
response.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
|
|
142
|
+
response.end(JSON.stringify({ bytes: bytesWritten }));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
response.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
146
|
+
response.end('Unsupported capture operation');
|
|
147
|
+
})().catch(error => {
|
|
148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
149
|
+
if (!response.headersSent) {
|
|
150
|
+
response.writeHead(500, { 'Content-Type': 'text/plain' });
|
|
151
|
+
response.end(message);
|
|
152
|
+
}
|
|
153
|
+
else
|
|
154
|
+
response.destroy();
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
}] : []),
|
|
159
|
+
],
|
|
43
160
|
});
|
|
44
|
-
const close = () => {
|
|
161
|
+
const close = () => {
|
|
162
|
+
captureStream?.destroy();
|
|
163
|
+
captureStream = undefined;
|
|
164
|
+
void server.close().finally(() => process.exit());
|
|
165
|
+
};
|
|
45
166
|
process.once('SIGINT', close);
|
|
46
167
|
process.once('SIGTERM', close);
|
|
47
168
|
await server.listen();
|
|
@@ -11,6 +11,11 @@ export declare class SlidevAdapter implements PresentationAdapter {
|
|
|
11
11
|
page?: Page;
|
|
12
12
|
server?: ChildProcess;
|
|
13
13
|
log: string;
|
|
14
|
+
private cleanupPromise?;
|
|
15
|
+
private closed;
|
|
16
|
+
private stagingDirectory?;
|
|
17
|
+
private rawCaptureFile?;
|
|
18
|
+
private captureToken?;
|
|
14
19
|
schedule: Schedule;
|
|
15
20
|
story: Storyboard;
|
|
16
21
|
directory: string;
|
|
@@ -18,13 +23,17 @@ export declare class SlidevAdapter implements PresentationAdapter {
|
|
|
18
23
|
production: ProductionOptions;
|
|
19
24
|
inspect: typeof inspectSlidev;
|
|
20
25
|
validate: typeof validateSlidev;
|
|
26
|
+
private stopServer;
|
|
21
27
|
private startServer;
|
|
22
28
|
startPreview(story: Storyboard, schedule: Schedule, directory: string, parentOrigin: string): Promise<{
|
|
23
29
|
url: string;
|
|
24
30
|
}>;
|
|
25
31
|
private start;
|
|
26
32
|
inspectTargets(story: Storyboard): Promise<PresentationInspection['annotation_targets']>;
|
|
33
|
+
private stopCapture;
|
|
27
34
|
prepare(story: Storyboard, schedule: Schedule, directory: string, production?: ProductionOptions): Promise<void>;
|
|
28
35
|
execute(progress?: ProgressReporter): Promise<VisualArtifact>;
|
|
29
36
|
cleanup(): Promise<void>;
|
|
37
|
+
private preserveRawCapture;
|
|
38
|
+
private cleanupOnce;
|
|
30
39
|
}
|