@beff/aula-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/README.md CHANGED
@@ -4,7 +4,7 @@ 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. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.1.1](https://github.com/lucasavila00/aula-voice/releases/tag/v0.1.1) (`model.safetensors` and `config.json`, approximately 34 MB). The CLI checks the SHA-256 of each file, makes the engine's weight file (`aula-voice.avw`) from them, and checks its SHA-256 too. `aula web` narrates in the browser: it serves that file to its page from the same folder. The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.1.1/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
7
+ The package has no model file. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.1.2](https://github.com/lucasavila00/aula-voice/releases/tag/v0.1.2) (`model.safetensors` and `config.json`, approximately 34 MB). The CLI checks the SHA-256 of each file, makes the engine's weight file (`aula-voice.avw`) from them, and checks its SHA-256 too. `aula web` narrates in the browser: it serves that file to its page from the same folder. The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.1.2/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
8
8
 
9
9
  ## Licenses
10
10
 
@@ -51,7 +51,7 @@ async function narrateScript(speak, chapters, speaking) {
51
51
  for (const cue of cues) {
52
52
  spoken += 1;
53
53
  speaking(spoken, count, cue);
54
- speeches.push(await speak(cue.text, cue.speed));
54
+ speeches.push(await speak(cue.spoken, cue.speed));
55
55
  }
56
56
  narrated.push(joinChapter(cues, speeches));
57
57
  }
@@ -19,12 +19,12 @@ import {
19
19
  scriptView,
20
20
  targetChapters,
21
21
  timelineView
22
- } from "./chunk-IAQZ6DTC.js";
22
+ } from "./chunk-PSI7MMGP.js";
23
23
  import {
24
24
  narrateScript,
25
25
  scriptAudio,
26
26
  wav
27
- } from "./chunk-XUBCUJW5.js";
27
+ } from "./chunk-BMP6H3SZ.js";
28
28
  import {
29
29
  host
30
30
  } from "./chunk-46KT47TH.js";
@@ -951,7 +951,7 @@ async function preview(capabilities, root, project, folder, given) {
951
951
  await printChecked(capabilities, root, project, checked);
952
952
  if (checked.errors > 0) return false;
953
953
  const all = checked.texts;
954
- const n = await clock(capabilities.narrator, narrationScript(project.title, all));
954
+ const n = await clock(capabilities.narrator, narrationScript(project, all));
955
955
  const jobs = previewJobs(targets, all).map((job) => ({
956
956
  ...job,
957
957
  out: path2.join(folder, job.base),
@@ -1000,7 +1000,7 @@ async function exportVideo(capabilities, root, project, file) {
1000
1000
  await ffmpeg(capabilities, ["-version"]);
1001
1001
  return withWork(capabilities, async (work) => {
1002
1002
  const audio = path2.join(work, "narration.wav");
1003
- const cues = narrationScript(project.title, checked.texts);
1003
+ const cues = narrationScript(project, checked.texts);
1004
1004
  const narrated = await withHeavy(capabilities, () => narrate(capabilities, cues));
1005
1005
  const lotties = names.map((name) => path2.join(work, `${name}.json`));
1006
1006
  const drawn = [];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  timeChapter
3
- } from "./chunk-XUBCUJW5.js";
3
+ } from "./chunk-BMP6H3SZ.js";
4
4
  import {
5
5
  Problems,
6
6
  error,
@@ -61,14 +61,14 @@ function openCount(chapters, indexes) {
61
61
  }
62
62
 
63
63
  // ../aula-project/src/check.ts
64
- import { checkChapter, readChapter as readChapter2 } from "@beff/aula";
64
+ import { checkChapter, checkLexicon, readChapter as readChapter2 } from "@beff/aula";
65
65
  import { chapterNames } from "@beff/aula/run";
66
66
  import { check as rules } from "@beff/aula/text";
67
67
  async function clock(narrator, chapters) {
68
68
  const narrations = [];
69
69
  for (const cues of chapters) {
70
70
  const timings = [];
71
- for (const cue of cues) timings.push(await narrator.time(cue.text, cue.speed));
71
+ for (const cue of cues) timings.push(await narrator.time(cue.spoken, cue.speed));
72
72
  narrations.push(timeChapter(cues, timings));
73
73
  }
74
74
  return narrations;
@@ -100,7 +100,10 @@ function checkProject(project, host, only) {
100
100
  }
101
101
  }
102
102
  const byChapter = [...unloaded, ...[...own].toSorted(([a], [b]) => a - b)];
103
- const reported = byChapter.flatMap(([index, d]) => inScope(index) ? d : []);
103
+ const reported = [
104
+ ...checkLexicon(project, { host }),
105
+ ...byChapter.flatMap(([index, d]) => inScope(index) ? d : [])
106
+ ];
104
107
  const elsewhere = byChapter.flatMap(([index, d]) => inScope(index) ? [] : d);
105
108
  const errors = reported.filter(isError).length;
106
109
  const otherErrors = elsewhere.filter(isError).length;
@@ -223,7 +226,7 @@ async function timelineView(project, host, narrator, only) {
223
226
  const names = chapterNames3(project);
224
227
  const indexes = only.length === 0 ? project.chapters.map((_, i) => i + 1) : only.map((name) => chapterIndex(names, name));
225
228
  if (indexes.includes(0)) throw wrongArgument("the title card has no timeline: give a chapter name");
226
- const n = await clock(narrator, narrationScript(project.title, texts(project, host)));
229
+ const n = await clock(narrator, narrationScript(project, texts(project, host)));
227
230
  let out = header(project);
228
231
  for (const index of indexes) {
229
232
  const text = chapterText(project, host, index);
@@ -1,6 +1,7 @@
1
1
  // ../aula-narration/src/align.ts
2
+ var WORD = /(?:\[[^\][\s]*\]\(\/[^/]*\/\)|\S)+/g;
2
3
  function tokens(text) {
3
- return [...text.matchAll(/\S+/g)].map((match) => ({ text: match[0], char: match.index }));
4
+ return [...text.matchAll(WORD)].map((match) => ({ text: match[0], char: match.index }));
4
5
  }
5
6
  function roundHalfEven(value) {
6
7
  const floor = Math.floor(value);
@@ -282,24 +283,24 @@ var KOKORO_VOCAB = /* @__PURE__ */ new Map([
282
283
  ]);
283
284
 
284
285
  // ../aula-narration/src/aula-voice.ts
285
- var AULA_VOICE_RELEASE = "v0.1.1";
286
+ var AULA_VOICE_RELEASE = "v0.1.2";
286
287
  var RELEASE_URL = `https://github.com/lucasavila00/aula-voice/releases/download/${AULA_VOICE_RELEASE}`;
287
288
  var AULA_VOICE_FILES = {
288
289
  model: {
289
290
  path: "model.safetensors",
290
291
  bytes: 33489768,
291
- sha256: "a15b9b378ee1e7d24004a4f5ff6ab03459fadec71d0acdf02d0e04034edde44a"
292
+ sha256: "862806a3dfb10196f1bdfedf08ae43ed9b640b969398ac9d37f8670586c57c6a"
292
293
  },
293
294
  config: {
294
295
  path: "config.json",
295
296
  bytes: 2346,
296
- sha256: "e5ea44e7d8ef2fe114725162aa68a4e57f1525cf4c206f9ac2f2db70ed051909"
297
+ sha256: "f297213a0673974916d9c309260f01a8259d36b0d595d66ed57668cc6eea4da3"
297
298
  }
298
299
  };
299
300
  var AULA_VOICE_WEIGHTS = {
300
301
  path: "aula-voice.avw",
301
302
  bytes: 33478208,
302
- sha256: "b382770c55637371fd5f0eda9f7f5a9b39572c8715d24149bfbba4d8c64ac951"
303
+ sha256: "519b3e3cff634d6dd8edec9fe322da64cdf184f866bb0c101dc364d9874c8440"
303
304
  };
304
305
  var SERVER_WEIGHTS_PATH = `/models/${AULA_VOICE_WEIGHTS.path}`;
305
306
  var aulaVoiceUrl = (file) => `${RELEASE_URL}/${file.path}`;
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-YX73KJQ6.js";
17
+ } from "./chunk-SW5BNPAM.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { spawn } from "node:child_process";
@@ -271,9 +271,9 @@ var base = Capabilities.create({
271
271
  },
272
272
  spawn
273
273
  });
274
- var { diagnosticsOf, printDiagnostics } = await import("./problems-Y67BY7WB.js");
274
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-FFAR72WZ.js");
275
275
  var { host, loadProject } = await import("./project-NWT5MDQI.js");
276
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-CTVGU7EK.js");
276
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, webOptions } = await import("./run-DU2H6FZI.js");
277
277
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
278
278
  var render = createRender(base, process.execPath);
279
279
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -296,7 +296,7 @@ async function main(argv) {
296
296
  }
297
297
  const args = parse(rest, optionsOf(command));
298
298
  if (command === "web") {
299
- const { serve } = await import("./server-5OGXX6BF.js");
299
+ const { serve } = await import("./server-7AN6XCTF.js");
300
300
  const stop = new AbortController();
301
301
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
302
302
  const web = Capabilities.create({
@@ -312,7 +312,7 @@ async function main(argv) {
312
312
  return 0;
313
313
  }
314
314
  if (command === "tokens") {
315
- const { tokens, tokensArgs } = await import("./commands-M246OWYJ.js");
315
+ const { tokens, tokensArgs } = await import("./commands-CEBO6WWE.js");
316
316
  tokensArgs(args.positional);
317
317
  const tokensOf = createTokens();
318
318
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
@@ -7,12 +7,12 @@ import {
7
7
  timeline,
8
8
  tokens,
9
9
  tokensArgs
10
- } from "./chunk-QWNBVWUQ.js";
10
+ } from "./chunk-D2BDOCX7.js";
11
11
  import "./chunk-GFCJYE75.js";
12
12
  import "./chunk-2XGNOG2U.js";
13
- import "./chunk-IAQZ6DTC.js";
14
- import "./chunk-XUBCUJW5.js";
15
- import "./chunk-YX73KJQ6.js";
13
+ import "./chunk-PSI7MMGP.js";
14
+ import "./chunk-BMP6H3SZ.js";
15
+ import "./chunk-SW5BNPAM.js";
16
16
  import "./chunk-46KT47TH.js";
17
17
  import "./chunk-7KT36JRP.js";
18
18
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  printDiagnostics
3
- } from "./chunk-IAQZ6DTC.js";
4
- import "./chunk-XUBCUJW5.js";
5
- import "./chunk-YX73KJQ6.js";
3
+ } from "./chunk-PSI7MMGP.js";
4
+ import "./chunk-BMP6H3SZ.js";
5
+ import "./chunk-SW5BNPAM.js";
6
6
  import {
7
7
  diagnosticsOf
8
8
  } from "./chunk-7KT36JRP.js";
@@ -5,12 +5,12 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-QWNBVWUQ.js";
8
+ } from "./chunk-D2BDOCX7.js";
9
9
  import "./chunk-GFCJYE75.js";
10
10
  import "./chunk-2XGNOG2U.js";
11
- import "./chunk-IAQZ6DTC.js";
12
- import "./chunk-XUBCUJW5.js";
13
- import "./chunk-YX73KJQ6.js";
11
+ import "./chunk-PSI7MMGP.js";
12
+ import "./chunk-BMP6H3SZ.js";
13
+ import "./chunk-SW5BNPAM.js";
14
14
  import "./chunk-46KT47TH.js";
15
15
  import {
16
16
  wrongArgument
@@ -1,7 +1,7 @@
1
- import "./chunk-XUBCUJW5.js";
1
+ import "./chunk-BMP6H3SZ.js";
2
2
  import {
3
3
  SERVER_WEIGHTS_PATH
4
- } from "./chunk-YX73KJQ6.js";
4
+ } from "./chunk-SW5BNPAM.js";
5
5
  import {
6
6
  exists
7
7
  } from "./chunk-46KT47TH.js";
@@ -0,0 +1 @@
1
+ import{t as e}from"./aula-voice-worker-DNzLI-en.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();
@@ -1 +1 @@
1
- import{l as e,p as t}from"./src-CmWmmzpF.js";var n=8,r=.5,i=3,a=3,o=[`view`,`claim`,`forecast`,`estimate`,`proposed`,`external`,`schematic`,`not measured`,`expected`,`alleged`],s=1,c=e=>JSON.stringify(e);function l(e){return e.toLowerCase().match(/[a-z0-9$%]+/g)??[]}function u(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function d(e,t){let n=l(e),r=` ${l(t).join(` `)} `;for(let e=0;e+a<=n.length;e++)if(r.includes(` ${n.slice(e,e+a).join(` `)} `))return!0;return!1}function f(e){let t=e.toLowerCase();return o.some(e=>t.includes(e))||/(^|[^\p{L}\p{N}_])\p{Lu}[\p{L}\p{N}_.&-]*['’]s(?![\p{L}\p{N}_])/u.test(e)}function p(e,t){let n=Math.max(e.low[0]-t.high[0],t.low[0]-e.high[0],0),r=Math.max(e.low[1]-t.high[1],t.low[1]-e.high[1],0);return Math.hypot(n,r)<=s}function m(e,t,a){let o=[],s=(t,n=e.place)=>{o.push({message:t,...n===void 0?{}:{at:n}})};a.mechanism.trim()===``&&s(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`),a.sources.length===0&&s(`the paragraph has no sources (give its sources, or ["recap"])`);for(let e of a.sources)u(e)&&!t.exists(e)&&s(`${c(e)}: this path is not a file: correct the path or add the file`);let l=t.paragraphs.flatMap(e=>e.says.map(e=>e.text)).join(` `),m=new Map;for(let t of e.screen.instants)for(let e of t.texts)m.set(JSON.stringify([e.place,e.text]),e);for(let e of m.values())e.text.split(/\s+/).filter(Boolean).length>i&&s(`text on screen over ${String(i)} words: ${c(e.text)}; make it shorter`,e.place),d(e.text,l)&&s(`text on screen repeats the narration: ${c(e.text)}; use other words`,e.place);let h=new Map;for(let t of e.screen.instants){let e=new Set(t.texts.filter(e=>e.opacity>r).map(e=>e.id)).size,i=JSON.stringify(t.place);e>(h.get(i)?.count??n)&&h.set(i,{count:e,at:t.place})}for(let{count:e,at:t}of h.values())s(`${String(e)} labels on screen (about ${String(n)} at most): show fewer labels at one time, or split the picture`,t);let g=new Map,_=new Set;for(let t of e.screen.instants)for(let e of t.dashed)t.texts.some(t=>f(t.text)&&p(t,e))?_.add(e.id):g.set(e.id,e);for(let[e,t]of g)_.has(e)||s(`dashed shape with no attribution text near it: put a text that says whose view it is, such as "Smith's view", next to it`,t.place);return t.number===t.count&&e.index===t.paragraphs.length-1&&(a.sources.length!==1||a.sources[0]!==`recap`)&&s(`the video must end with a recap paragraph (sources: ["recap"])`),o}function h(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>m(e,n,{mechanism:r,sources:t})))}export{m as findings,h as paragraph};
1
+ import{d as e,g as t}from"./src-B22P60S6.js";var n=8,r=.5,i=3,a=3,o=[`view`,`claim`,`forecast`,`estimate`,`proposed`,`external`,`schematic`,`not measured`,`expected`,`alleged`],s=1,c=e=>JSON.stringify(e);function l(e){return e.toLowerCase().match(/[a-z0-9$%]+/g)??[]}function u(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function d(e,t){let n=l(e),r=` ${l(t).join(` `)} `;for(let e=0;e+a<=n.length;e++)if(r.includes(` ${n.slice(e,e+a).join(` `)} `))return!0;return!1}function f(e){let t=e.toLowerCase();return o.some(e=>t.includes(e))||/(^|[^\p{L}\p{N}_])\p{Lu}[\p{L}\p{N}_.&-]*['’]s(?![\p{L}\p{N}_])/u.test(e)}function p(e,t){let n=Math.max(e.low[0]-t.high[0],t.low[0]-e.high[0],0),r=Math.max(e.low[1]-t.high[1],t.low[1]-e.high[1],0);return Math.hypot(n,r)<=s}function m(e,t,a){let o=[],s=(t,n=e.place)=>{o.push({message:t,...n===void 0?{}:{at:n}})};a.mechanism.trim()===``&&s(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`),a.sources.length===0&&s(`the paragraph has no sources (give its sources, or ["recap"])`);for(let e of a.sources)u(e)&&!t.exists(e)&&s(`${c(e)}: this path is not a file: correct the path or add the file`);let l=t.paragraphs.flatMap(e=>e.says.map(e=>e.text)).join(` `),m=new Map;for(let t of e.screen.instants)for(let e of t.texts)m.set(JSON.stringify([e.place,e.text]),e);for(let e of m.values())e.text.split(/\s+/).filter(Boolean).length>i&&s(`text on screen over ${String(i)} words: ${c(e.text)}; make it shorter`,e.place),d(e.text,l)&&s(`text on screen repeats the narration: ${c(e.text)}; use other words`,e.place);let h=new Map;for(let t of e.screen.instants){let e=new Set(t.texts.filter(e=>e.opacity>r).map(e=>e.id)).size,i=JSON.stringify(t.place);e>(h.get(i)?.count??n)&&h.set(i,{count:e,at:t.place})}for(let{count:e,at:t}of h.values())s(`${String(e)} labels on screen (about ${String(n)} at most): show fewer labels at one time, or split the picture`,t);let g=new Map,_=new Set;for(let t of e.screen.instants)for(let e of t.dashed)t.texts.some(t=>f(t.text)&&p(t,e))?_.add(e.id):g.set(e.id,e);for(let[e,t]of g)_.has(e)||s(`dashed shape with no attribution text near it: put a text that says whose view it is, such as "Smith's view", next to it`,t.place);return t.number===t.count&&e.index===t.paragraphs.length-1&&(a.sources.length!==1||a.sources[0]!==`recap`)&&s(`the video must end with a recap paragraph (sources: ["recap"])`),o}function h(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>m(e,n,{mechanism:r,sources:t})))}export{m as findings,h as paragraph};