@beff/aula-cli 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/src/{aula-voice-tts-HPJAJO2Q.js → aula-voice-tts-H2OQFQ5J.js} +1 -1
- package/dist/src/aula.js +2 -2
- package/dist/src/{chunk-KCGXC2RV.js → chunk-4FWDTPLR.js} +1 -1
- package/dist/src/{chunk-XCPBFMEA.js → chunk-D5N3QDDF.js} +1 -1
- package/dist/src/{chunk-Y56UHOZ2.js → chunk-F5RPEFZR.js} +2 -0
- package/dist/src/{chunk-5ABPFV55.js → chunk-G44UMBPW.js} +2 -2
- package/dist/src/{chunk-5TUGYMFH.js → chunk-S6IM5XXK.js} +3 -3
- package/dist/src/{chunk-5XVICDLW.js → chunk-THZNJBUF.js} +133 -18
- package/dist/src/{chunk-4PZYWKO5.js → chunk-UBVMGS2E.js} +1 -1
- package/dist/src/{chunk-3RB5T3CC.js → chunk-UQOXT6QN.js} +109 -87
- package/dist/src/{chunk-DFXG2P7A.js → chunk-WV2UYZND.js} +12 -7
- package/dist/src/chunk-XIVHJMET.js +111 -0
- package/dist/src/cli.js +29 -93
- package/dist/src/{commands-BUM4AG3N.js → commands-PLST75CP.js} +11 -10
- package/dist/src/problems-EI4DOEZ4.js +17 -0
- package/dist/src/project-7EROVEUE.js +16 -0
- package/dist/src/run-NE5HOAXA.js +235 -0
- package/dist/src/{server-ALRN2C2W.js → server-KXIU66BB.js} +35 -23
- package/dist/src/{site-A2I4P4GX.js → site-HUWODSZ3.js} +21 -77
- package/dist/src/workspace-load-DOHFEZFR.js +16 -0
- package/dist/web/app/assets/{56cf58c4 → 62289de9}/aula-method.js +1 -1
- package/dist/web/app/assets/{56cf58c4 → 62289de9}/aula.js +1 -1
- package/dist/web/app/assets/62289de9/build-worker.js +2 -0
- package/dist/web/app/assets/{56cf58c4 → 62289de9}/index.js +2 -2
- package/dist/web/app/assets/{protocol-C3Pseh4g.js → protocol-kcdbhuRm.js} +4 -4
- package/dist/web/app/assets/{src-DTLT9Lbm.js → src-DWqZcp-P.js} +1 -1
- package/dist/web/app/assets/{tex-mathjax-8QilZX4j.js → tex-mathjax-eWNptbJg.js} +1 -1
- package/dist/web/app/index.html +3 -3
- package/dist/web/site/assets/{82624cbe → 82618540}/aula-method.js +1 -1
- package/dist/web/site/assets/{82624cbe → 82618540}/aula.js +1 -1
- package/dist/web/site/assets/82618540/build-worker.js +2 -0
- package/dist/web/site/assets/{82624cbe → 82618540}/index.js +2 -2
- package/dist/web/site/assets/{protocol-BOv1ch3F.js → protocol-XMWr-E-D.js} +4 -4
- package/dist/web/site/assets/{src-DpS3WA7l.js → src-DfPcHwz-.js} +1 -1
- package/dist/web/site/assets/{tex-mathjax-CVHS5J80.js → tex-mathjax-DrZV_cwB.js} +1 -1
- package/dist/web/site/index.html +3 -3
- package/package.json +1 -1
- package/dist/src/chunk-JWBPHDVP.js +0 -104
- package/dist/src/problems-2IXR6RUV.js +0 -18
- package/dist/src/project-36YBXKCD.js +0 -16
- package/dist/src/run-YLF62D3C.js +0 -173
- package/dist/web/app/assets/56cf58c4/build-worker.js +0 -2
- package/dist/web/site/assets/82624cbe/build-worker.js +0 -2
package/README.md
CHANGED
|
@@ -4,7 +4,12 @@ The `aula` command of [aula](https://github.com/lucasavila00/aula): it runs chap
|
|
|
4
4
|
|
|
5
5
|
It needs Node 24. Narration (aula-voice) needs only Node. `aula export` needs ffmpeg. Refer to [CLI](https://github.com/lucasavila00/aula/blob/main/docs/agents/cli.md) for the commands and [Getting started](https://github.com/lucasavila00/aula/blob/main/docs/agents/getting-started.md) for the setup.
|
|
6
6
|
|
|
7
|
-
The package has no model file.
|
|
7
|
+
The package has no model file.
|
|
8
|
+
The first command that narrates or times a video downloads the narrator's model of aula-voice's release [v0.2.4](https://github.com/lucasavila00/aula-voice/releases/tag/v0.2.4) (about 21 MB).
|
|
9
|
+
Those commands are `check`, `script`, `timeline`, `preview`, `export` and `aula web`.
|
|
10
|
+
The CLI checks the SHA-256 of each file, makes the engine's weight file from them, and checks its SHA-256 too.
|
|
11
|
+
`aula web` narrates in the browser and serves that file to its page.
|
|
12
|
+
The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.2.4/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
|
|
8
13
|
|
|
9
14
|
## Licenses
|
|
10
15
|
|
package/dist/src/aula.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
manim_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D5N3QDDF.js";
|
|
4
4
|
import {
|
|
5
5
|
defineChapter,
|
|
6
6
|
defineProject,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
pronounce,
|
|
11
11
|
say,
|
|
12
12
|
show
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-F5RPEFZR.js";
|
|
14
14
|
import "./chunk-VX7UVLQW.js";
|
|
15
15
|
import "./chunk-CZ7CSFO4.js";
|
|
16
16
|
export {
|
|
@@ -66560,6 +66560,7 @@ function defineProject(fields) {
|
|
|
66560
66560
|
[PROJECT]: true,
|
|
66561
66561
|
storyboard: "",
|
|
66562
66562
|
lexicon: {},
|
|
66563
|
+
draft: false,
|
|
66563
66564
|
...fields,
|
|
66564
66565
|
title: title.text,
|
|
66565
66566
|
titleParts: title.parts,
|
|
@@ -73850,6 +73851,7 @@ export {
|
|
|
73850
73851
|
theme,
|
|
73851
73852
|
lexiconEntries,
|
|
73852
73853
|
FPS,
|
|
73854
|
+
TITLE,
|
|
73853
73855
|
chapterNames,
|
|
73854
73856
|
v8Frames,
|
|
73855
73857
|
definedAt,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
error,
|
|
5
5
|
projectName,
|
|
6
6
|
wrongArgument
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WV2UYZND.js";
|
|
8
8
|
import {
|
|
9
9
|
definedAt,
|
|
10
10
|
importUserModule,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
loadEngine,
|
|
14
14
|
loadTex,
|
|
15
15
|
v8Frames
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-F5RPEFZR.js";
|
|
17
17
|
|
|
18
18
|
// ../aula-project/src/node.ts
|
|
19
19
|
import { existsSync } from "node:fs";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderDiagnostic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4FWDTPLR.js";
|
|
4
4
|
import {
|
|
5
5
|
withSource
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G44UMBPW.js";
|
|
7
7
|
import {
|
|
8
8
|
loadEngine
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F5RPEFZR.js";
|
|
10
10
|
|
|
11
11
|
// src/problems.ts
|
|
12
12
|
async function printDiagnostics(capabilities, root, diagnostics, print = (text) => capabilities.log.out(text)) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-JWBPHDVP.js";
|
|
4
|
-
import {
|
|
2
|
+
chapterNarration,
|
|
5
3
|
check,
|
|
6
4
|
moveFrames,
|
|
7
5
|
narrationScript,
|
|
@@ -10,7 +8,7 @@ import {
|
|
|
10
8
|
timeline,
|
|
11
9
|
unclearWords,
|
|
12
10
|
words
|
|
13
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4FWDTPLR.js";
|
|
14
12
|
import {
|
|
15
13
|
LIST_MODULE,
|
|
16
14
|
Problems,
|
|
@@ -18,12 +16,13 @@ import {
|
|
|
18
16
|
isError,
|
|
19
17
|
linkBundle,
|
|
20
18
|
wrongArgument
|
|
21
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WV2UYZND.js";
|
|
22
20
|
import {
|
|
23
21
|
manim_exports
|
|
24
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-D5N3QDDF.js";
|
|
25
23
|
import {
|
|
26
24
|
FPS,
|
|
25
|
+
TITLE,
|
|
27
26
|
chapterNames,
|
|
28
27
|
checkChapter,
|
|
29
28
|
checkLexicon,
|
|
@@ -35,13 +34,118 @@ import {
|
|
|
35
34
|
loadEngine,
|
|
36
35
|
readChapter,
|
|
37
36
|
renderChapter
|
|
38
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-F5RPEFZR.js";
|
|
38
|
+
|
|
39
|
+
// ../aula-narration/src/script.ts
|
|
40
|
+
var starts = (words2) => Float64Array.from(words2, (w) => w.start);
|
|
41
|
+
function joinChapter(cues, speeches) {
|
|
42
|
+
let rate = 0;
|
|
43
|
+
for (const [i, speech] of speeches.entries()) {
|
|
44
|
+
if (!speech.samples.length || speech.samples.some((s) => !Number.isFinite(s))) {
|
|
45
|
+
const text = cues[i]?.text.slice(0, 60) ?? "";
|
|
46
|
+
throw new Error(`the narrator returned empty or invalid audio for ${JSON.stringify(text)}`);
|
|
47
|
+
}
|
|
48
|
+
if (rate !== 0 && speech.sampleRate !== rate) throw new Error("the narrator changed its sample rate");
|
|
49
|
+
rate = speech.sampleRate;
|
|
50
|
+
}
|
|
51
|
+
const spoken = speeches.map((s) => ({ samples: s.samples.length, starts: starts(s.words) }));
|
|
52
|
+
const narration = chapterNarration(cues, spoken, rate);
|
|
53
|
+
const samples = new Float32Array(narration.endFrame);
|
|
54
|
+
for (const [i, speech] of speeches.entries()) samples.set(speech.samples, narration.cues[i]?.speechStartFrame ?? 0);
|
|
55
|
+
return { samples, narration };
|
|
56
|
+
}
|
|
57
|
+
function withWaits(samples, waits) {
|
|
58
|
+
if (waits.length === 0) return samples;
|
|
59
|
+
const out = new Float32Array(samples.length + waits.reduce((sum, w) => sum + w.samples, 0));
|
|
60
|
+
let from = 0;
|
|
61
|
+
let to = 0;
|
|
62
|
+
for (const wait of waits.toSorted((a, b) => a.sample - b.sample)) {
|
|
63
|
+
const at = Math.min(wait.sample, samples.length);
|
|
64
|
+
out.set(samples.subarray(from, at), to);
|
|
65
|
+
to += at - from + wait.samples;
|
|
66
|
+
from = at;
|
|
67
|
+
}
|
|
68
|
+
out.set(samples.subarray(from), to);
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
function timeChapter(cues, timings) {
|
|
72
|
+
const rate = timings[0]?.sampleRate ?? 0;
|
|
73
|
+
if (timings.some((t) => t.sampleRate !== rate)) throw new Error("the narrator changed its sample rate");
|
|
74
|
+
const spoken = timings.map(
|
|
75
|
+
(t) => t.words ? { samples: t.samples, starts: starts(t.words) } : { samples: t.samples }
|
|
76
|
+
);
|
|
77
|
+
return chapterNarration(cues, spoken, rate);
|
|
78
|
+
}
|
|
79
|
+
async function narrateScript(speak, chapters, speaking) {
|
|
80
|
+
const count = chapters.reduce((sum, c) => sum + c.length, 0);
|
|
81
|
+
let spoken = 0;
|
|
82
|
+
const narrated = [];
|
|
83
|
+
for (const cues of chapters) {
|
|
84
|
+
const speeches = [];
|
|
85
|
+
for (const cue of cues) {
|
|
86
|
+
spoken += 1;
|
|
87
|
+
speaking(spoken, count, cue);
|
|
88
|
+
speeches.push(await speak(cue.words));
|
|
89
|
+
}
|
|
90
|
+
narrated.push(joinChapter(cues, speeches));
|
|
91
|
+
}
|
|
92
|
+
if (!narrated.some((c) => c.narration.sampleRate > 0)) throw new Error("the script has no cues");
|
|
93
|
+
return narrated;
|
|
94
|
+
}
|
|
95
|
+
function scriptAudio(chapters, waits) {
|
|
96
|
+
const sounds = chapters.map((c, i) => withWaits(c.samples, waits[i] ?? []));
|
|
97
|
+
const samples = new Float32Array(sounds.reduce((sum, s) => sum + s.length, 0));
|
|
98
|
+
let at = 0;
|
|
99
|
+
for (const sound of sounds) {
|
|
100
|
+
samples.set(sound, at);
|
|
101
|
+
at += sound.length;
|
|
102
|
+
}
|
|
103
|
+
const sampleRate = chapters.find((c) => c.narration.sampleRate > 0)?.narration.sampleRate ?? 0;
|
|
104
|
+
return { samples, sampleRate };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ../aula-narration/src/wav.ts
|
|
108
|
+
function wav(samples, rate) {
|
|
109
|
+
const bytes = new Uint8Array(44 + samples.length * 2);
|
|
110
|
+
const view = new DataView(bytes.buffer);
|
|
111
|
+
const text = (at, value) => {
|
|
112
|
+
for (let i = 0; i < value.length; i++) view.setUint8(at + i, value.charCodeAt(i));
|
|
113
|
+
};
|
|
114
|
+
text(0, "RIFF");
|
|
115
|
+
view.setUint32(4, 36 + samples.length * 2, true);
|
|
116
|
+
text(8, "WAVE");
|
|
117
|
+
text(12, "fmt ");
|
|
118
|
+
view.setUint32(16, 16, true);
|
|
119
|
+
view.setUint16(20, 1, true);
|
|
120
|
+
view.setUint16(22, 1, true);
|
|
121
|
+
view.setUint32(24, rate, true);
|
|
122
|
+
view.setUint32(28, rate * 2, true);
|
|
123
|
+
view.setUint16(32, 2, true);
|
|
124
|
+
view.setUint16(34, 16, true);
|
|
125
|
+
text(36, "data");
|
|
126
|
+
view.setUint32(40, samples.length * 2, true);
|
|
127
|
+
samples.forEach((sample, i) => {
|
|
128
|
+
view.setInt16(44 + i * 2, Math.round(Math.min(1, Math.max(-1, sample)) * 32767), true);
|
|
129
|
+
});
|
|
130
|
+
return bytes;
|
|
131
|
+
}
|
|
39
132
|
|
|
40
133
|
// ../aula-project/src/chapters.ts
|
|
134
|
+
function rejectTitleChapter(name) {
|
|
135
|
+
if (name !== TITLE) return;
|
|
136
|
+
throw wrongArgument(
|
|
137
|
+
"title is not a chapter: give a chapter id such as 01-double-the-side",
|
|
138
|
+
"omit <chapter> to check or preview the whole project, including the title card"
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function chapterHintNames(names) {
|
|
142
|
+
return names.filter((name) => name !== TITLE).join(", ");
|
|
143
|
+
}
|
|
41
144
|
function chapterIndex(names, name) {
|
|
145
|
+
rejectTitleChapter(name);
|
|
42
146
|
const at = names.indexOf(name);
|
|
43
147
|
if (at >= 0) return at;
|
|
44
|
-
throw wrongArgument(`No chapter '${name}': use one of [${names
|
|
148
|
+
throw wrongArgument(`No chapter '${name}': use one of [${chapterHintNames(names)}]`);
|
|
45
149
|
}
|
|
46
150
|
function chapterText(project, host, index) {
|
|
47
151
|
const result = readChapter(project, index, { host });
|
|
@@ -51,8 +155,8 @@ function chapterText(project, host, index) {
|
|
|
51
155
|
function paragraphCue(text, name, line) {
|
|
52
156
|
const p = paragraphAt(text, line);
|
|
53
157
|
if (p !== void 0) return p + 1;
|
|
54
|
-
const
|
|
55
|
-
const list =
|
|
158
|
+
const starts2 = text.paragraphs.flatMap((q) => q.place ? [String(q.place.line)] : []);
|
|
159
|
+
const list = starts2.length > 1 ? `${starts2.slice(0, -1).join(", ")} and ${starts2.at(-1) ?? ""}` : starts2.join("");
|
|
56
160
|
throw wrongArgument(`line ${String(line)} of ${name} is in no paragraph; the paragraphs start at lines ${list}`);
|
|
57
161
|
}
|
|
58
162
|
function openMoves(text) {
|
|
@@ -158,14 +262,14 @@ function exportCheck(project, host) {
|
|
|
158
262
|
return { ...checked, findings: [...checked.findings, ...open], errors: checked.errors + open.length };
|
|
159
263
|
}
|
|
160
264
|
function clipPlan(narrations, fps) {
|
|
161
|
-
const
|
|
162
|
-
for (const narration of narrations)
|
|
163
|
-
const firsts =
|
|
265
|
+
const starts2 = [0];
|
|
266
|
+
for (const narration of narrations) starts2.push((starts2.at(-1) ?? 0) + narration.endFrame / narration.sampleRate);
|
|
267
|
+
const firsts = starts2.map((seconds) => Math.round(seconds * fps));
|
|
164
268
|
const clips = narrations.map((_, index) => {
|
|
165
269
|
const first = firsts[index] ?? 0;
|
|
166
|
-
return { from: first / fps - (
|
|
270
|
+
return { from: first / fps - (starts2[index] ?? 0), frames: (firsts[index + 1] ?? first) - first };
|
|
167
271
|
});
|
|
168
|
-
return { clips, seconds:
|
|
272
|
+
return { clips, seconds: starts2.at(-1) ?? 0 };
|
|
169
273
|
}
|
|
170
274
|
function overlayPlan(narrations, embeds) {
|
|
171
275
|
let offset = 0;
|
|
@@ -259,7 +363,6 @@ function previewTargets(project, given) {
|
|
|
259
363
|
return given.map((target) => {
|
|
260
364
|
const m = /^(.*):([0-9]+)$/.exec(target);
|
|
261
365
|
const index = chapterIndex(names, m?.[1] ?? target);
|
|
262
|
-
if (index === 0 && m !== null) throw wrongArgument("the title card has no lines: give a chapter name with :<line>");
|
|
263
366
|
return { index, name: names[index] ?? target, line: m?.[2] === void 0 ? null : Number(m[2]) };
|
|
264
367
|
});
|
|
265
368
|
}
|
|
@@ -364,7 +467,6 @@ function timedChapter(index, name, text, narration) {
|
|
|
364
467
|
async function loadTimed(project, host, narrator, only) {
|
|
365
468
|
const names = chapterNames(project);
|
|
366
469
|
const indexes = only.length === 0 ? project.chapters.map((_, i) => i + 1) : only.map((name) => chapterIndex(names, name));
|
|
367
|
-
if (indexes.includes(0)) throw wrongArgument("the title card has no timeline: give a chapter name");
|
|
368
470
|
const loaded = /* @__PURE__ */ new Map();
|
|
369
471
|
for (const index of indexes) loaded.set(index, chapterText(project, host, index));
|
|
370
472
|
const all = project.chapters.map((_, i) => {
|
|
@@ -486,6 +588,13 @@ async function loadBuiltProjects(bundled, host, modules, player, engineLoaded) {
|
|
|
486
588
|
return { _tag: "Right", right: out };
|
|
487
589
|
}
|
|
488
590
|
var folderOfModule = (module) => module.slice(0, Math.max(0, module.lastIndexOf("/")));
|
|
591
|
+
function listedProjects(projects, options = {}) {
|
|
592
|
+
if (options.includeDrafts) return [...projects];
|
|
593
|
+
return projects.filter((project) => !project.draft);
|
|
594
|
+
}
|
|
595
|
+
function draftSkipMessage(folder) {
|
|
596
|
+
return `skipping ${folder} because it is a draft (pass --include-drafts to check it)`;
|
|
597
|
+
}
|
|
489
598
|
function localProject(name, folder, section, definition, host) {
|
|
490
599
|
const count = definition.chapters.length + 1;
|
|
491
600
|
return {
|
|
@@ -493,6 +602,7 @@ function localProject(name, folder, section, definition, host) {
|
|
|
493
602
|
folder,
|
|
494
603
|
...section === void 0 ? {} : { section },
|
|
495
604
|
title: definition.title,
|
|
605
|
+
draft: definition.draft,
|
|
496
606
|
chapters: count,
|
|
497
607
|
titles: [definition.title, ...definition.chapters.map((c) => c.heading)],
|
|
498
608
|
script: () => {
|
|
@@ -527,6 +637,9 @@ function localProject(name, folder, section, definition, host) {
|
|
|
527
637
|
}
|
|
528
638
|
|
|
529
639
|
export {
|
|
640
|
+
narrateScript,
|
|
641
|
+
scriptAudio,
|
|
642
|
+
wav,
|
|
530
643
|
clock,
|
|
531
644
|
narrationAt,
|
|
532
645
|
checkProject,
|
|
@@ -547,5 +660,7 @@ export {
|
|
|
547
660
|
timelineView,
|
|
548
661
|
scriptView,
|
|
549
662
|
workspaceHost,
|
|
550
|
-
loadBuiltProjects
|
|
663
|
+
loadBuiltProjects,
|
|
664
|
+
listedProjects,
|
|
665
|
+
draftSkipMessage
|
|
551
666
|
};
|