@beff/aula-cli 0.7.0 → 0.8.1

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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/src/aula-version-6SX7JIS4.js +55 -0
  3. package/dist/src/{chunk-STW7EAFL.js → chunk-CO6PVRRP.js} +3 -2
  4. package/dist/src/{chunk-UKSA5OFC.js → chunk-H3SCHOAT.js} +1 -1
  5. package/dist/src/{chunk-HLRTXRAC.js → chunk-L75GJLCT.js} +13 -2
  6. package/dist/src/{chunk-WY3AMP6M.js → chunk-OLAUZCE4.js} +1 -1
  7. package/dist/src/{chunk-PLBRKNMD.js → chunk-Q5GA52JZ.js} +62 -33
  8. package/dist/src/{chunk-JWAUET3S.js → chunk-S7DEFSFH.js} +13 -13
  9. package/dist/src/{chunk-RRS3SD7K.js → chunk-TYPWU6EF.js} +2 -1
  10. package/dist/src/cli.js +15 -8
  11. package/dist/src/{commands-NDTPHXGF.js → commands-C3ER3SKG.js} +8 -8
  12. package/dist/src/problems-ZPV2ADYA.js +14 -0
  13. package/dist/src/project-MCSMU7LQ.js +12 -0
  14. package/dist/src/{run-IBCNVZ4J.js → run-RSLSQESN.js} +8 -8
  15. package/dist/src/{server-QQ2V343V.js → server-X6EO4JBG.js} +7 -6
  16. package/dist/src/{site-XYQKQZLZ.js → site-BEDOC3S3.js} +6 -6
  17. package/dist/web/app/assets/{7ca1e7de → 109a9620}/aula-method.js +1 -1
  18. package/dist/web/app/assets/109a9620/aula.js +1 -0
  19. package/dist/web/app/assets/109a9620/build-worker.js +2 -0
  20. package/dist/web/app/assets/{7ca1e7de → 109a9620}/index.js +2 -2
  21. package/dist/web/app/assets/__vite-browser-external-LEfvJ-Ei.js +1 -0
  22. package/dist/web/app/assets/{aula-voice-worker-CjeRSu86.js → aula-voice-worker-D4icQuwz.js} +10 -10
  23. package/dist/web/app/assets/aula.core5-C0zBQXNI.wasm +0 -0
  24. package/dist/web/app/assets/gb_gold-Br-pqr5n.bin +0 -0
  25. package/dist/web/app/assets/gb_silver-_ZRPsAqW.bin +0 -0
  26. package/dist/web/app/assets/protocol-pL5IbzcH.js +15 -0
  27. package/dist/web/app/assets/spacy_en-Vf_EDoWV.bin +0 -0
  28. package/dist/web/app/assets/{src-uzFdGdZX.js → src-D0RJvTRf.js} +14 -14
  29. package/dist/web/app/assets/symbols-oRfUHzZX.bin +0 -0
  30. package/dist/web/app/assets/tagger-Ed1a2aQO.bin +0 -0
  31. package/dist/web/app/index.html +3 -3
  32. package/dist/web/site/assets/{8f69161f → 998041da}/aula-method.js +1 -1
  33. package/dist/web/site/assets/998041da/aula.js +1 -0
  34. package/dist/web/site/assets/998041da/build-worker.js +2 -0
  35. package/dist/web/site/assets/{8f69161f → 998041da}/index.js +2 -2
  36. package/dist/web/site/assets/__vite-browser-external-CKQepNrH.js +1 -0
  37. package/dist/web/site/assets/{aula-voice-worker-Sm-si1oe.js → aula-voice-worker-Bj0Mmsvl.js} +10 -10
  38. package/dist/web/site/assets/aula.core5-C0zBQXNI.wasm +0 -0
  39. package/dist/web/site/assets/gb_gold-Br-pqr5n.bin +0 -0
  40. package/dist/web/site/assets/gb_silver-_ZRPsAqW.bin +0 -0
  41. package/dist/web/site/assets/protocol-DBH1B1P4.js +15 -0
  42. package/dist/web/site/assets/spacy_en-Vf_EDoWV.bin +0 -0
  43. package/dist/web/site/assets/{src-DWVrqSqZ.js → src-Whxqf0pR.js} +14 -14
  44. package/dist/web/site/assets/symbols-oRfUHzZX.bin +0 -0
  45. package/dist/web/site/assets/tagger-Ed1a2aQO.bin +0 -0
  46. package/dist/web/site/index.html +3 -3
  47. package/package.json +2 -2
  48. package/dist/src/problems-CQXPY4G5.js +0 -14
  49. package/dist/src/project-ICPIW4MO.js +0 -12
  50. package/dist/web/app/assets/7ca1e7de/aula.js +0 -1
  51. package/dist/web/app/assets/7ca1e7de/build-worker.js +0 -2
  52. package/dist/web/app/assets/__vite-browser-external-CZjgZoe-.js +0 -1
  53. package/dist/web/app/assets/aula.core5-DVDCNzCV.wasm +0 -0
  54. package/dist/web/app/assets/protocol-CVAj9kTL.js +0 -15
  55. package/dist/web/site/assets/8f69161f/aula.js +0 -1
  56. package/dist/web/site/assets/8f69161f/build-worker.js +0 -2
  57. package/dist/web/site/assets/__vite-browser-external-lWmWnTMm.js +0 -1
  58. package/dist/web/site/assets/aula.core5-DVDCNzCV.wasm +0 -0
  59. package/dist/web/site/assets/protocol-47nVPHKy.js +0 -15
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.3](https://github.com/lucasavila00/aula-voice/releases/tag/v0.1.3) (`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.3/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.2.1](https://github.com/lucasavila00/aula-voice/releases/tag/v0.2.1) (`model.f16-text-fp32.safetensors` and `config.json`, approximately 21 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.2.1/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
 
@@ -0,0 +1,55 @@
1
+ import {
2
+ requireMatchingAulaVersion
3
+ } from "./chunk-L75GJLCT.js";
4
+ import "./chunk-S74JLCZK.js";
5
+ import "./chunk-Q5GA52JZ.js";
6
+ import {
7
+ Parsers,
8
+ wrongArgument
9
+ } from "./chunk-TYPWU6EF.js";
10
+
11
+ // src/aula-version.ts
12
+ import { createRequire } from "node:module";
13
+ import path from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+ var AULA = "@beff/aula";
16
+ function aulaVersionAt(capabilities, fromFile) {
17
+ const require2 = createRequire(fromFile);
18
+ const entry = require2.resolve(AULA);
19
+ let dir = path.dirname(entry);
20
+ for (; ; ) {
21
+ const file = path.join(dir, "package.json");
22
+ if (capabilities.fs.existsSync(file)) {
23
+ const parsed = Parsers.PackageJson.safeParse(JSON.parse(capabilities.fs.readFileSync(file, "utf8")));
24
+ if (parsed.success && parsed.data.name === AULA) {
25
+ const version = parsed.data.version;
26
+ if (typeof version === "string" && version !== "") return version;
27
+ throw wrongArgument(
28
+ `${file} has no version`,
29
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
30
+ );
31
+ }
32
+ }
33
+ const parent = path.dirname(dir);
34
+ if (parent === dir) break;
35
+ dir = parent;
36
+ }
37
+ throw wrongArgument(
38
+ `could not find ${AULA}'s package.json from ${entry}`,
39
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
40
+ );
41
+ }
42
+ function cliAulaVersion(capabilities) {
43
+ return aulaVersionAt(capabilities, fileURLToPath(import.meta.url));
44
+ }
45
+ function projectAulaVersion(capabilities, folder) {
46
+ return aulaVersionAt(capabilities, path.join(folder, "index.ts"));
47
+ }
48
+ function assertAulaVersion(capabilities, folder) {
49
+ requireMatchingAulaVersion(cliAulaVersion(capabilities), projectAulaVersion(capabilities, folder));
50
+ }
51
+ export {
52
+ assertAulaVersion,
53
+ cliAulaVersion,
54
+ projectAulaVersion
55
+ };
@@ -4,13 +4,13 @@ import {
4
4
  error,
5
5
  projectName,
6
6
  wrongArgument
7
- } from "./chunk-RRS3SD7K.js";
7
+ } from "./chunk-TYPWU6EF.js";
8
8
 
9
9
  // ../aula-project/src/node.ts
10
10
  import path from "node:path";
11
11
  import { pathToFileURL } from "node:url";
12
12
  import { isProjectDefinition } from "@beff/aula";
13
- import { definedAt, importUserModule, loadEngine, v8Frames } from "@beff/aula/run";
13
+ import { definedAt, importUserModule, initG2p, loadEngine, v8Frames } from "@beff/aula/run";
14
14
  var PROJECT_MODULE = "index.ts";
15
15
  var GLUE = [
16
16
  `${path.dirname(new URL(import.meta.resolve("@beff/aula")).pathname)}/`,
@@ -88,6 +88,7 @@ async function loadProject(capabilities, load, root, folder, only = [], glue = [
88
88
  );
89
89
  }
90
90
  await loadEngine();
91
+ await initG2p();
91
92
  const loaded = await importUserModule(() => load(pathToFileURL(file).href));
92
93
  if (loaded._tag === "Left") {
93
94
  throw stoppedByOtherChapter(capabilities, root, folder, file, only, glue, loaded.left) ?? loaded.left;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withSource
3
- } from "./chunk-STW7EAFL.js";
3
+ } from "./chunk-CO6PVRRP.js";
4
4
 
5
5
  // src/problems.ts
6
6
  import { loadEngine } from "@beff/aula/run";
@@ -8,7 +8,16 @@ import {
8
8
  isError,
9
9
  linkBundle,
10
10
  wrongArgument
11
- } from "./chunk-RRS3SD7K.js";
11
+ } from "./chunk-TYPWU6EF.js";
12
+
13
+ // ../aula-project/src/aula-version.ts
14
+ function requireMatchingAulaVersion(cli, project) {
15
+ if (cli === project) return;
16
+ throw wrongArgument(
17
+ `the CLI's @beff/aula is ${cli}, but the project has @beff/aula ${project}`,
18
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
19
+ );
20
+ }
12
21
 
13
22
  // ../aula-project/src/chapters.ts
14
23
  import { readChapter } from "@beff/aula";
@@ -351,7 +360,7 @@ Metaphor: ${text.metaphor}
351
360
 
352
361
  // ../aula-project/src/workspace.ts
353
362
  import * as Engine from "@beff/aula";
354
- import { diagnosticOf, importUserModule, loadEngine } from "@beff/aula/run";
363
+ import { diagnosticOf, importUserModule, initG2p, loadEngine } from "@beff/aula/run";
355
364
  import {
356
365
  narrationScript as narrationScript2
357
366
  } from "@beff/aula/text";
@@ -364,6 +373,7 @@ var workspaceHost = (frames, media) => ({
364
373
  var propertyOf = (value, key) => typeof value === "object" && value !== null ? Reflect.get(value, key) : void 0;
365
374
  async function loadBuiltProjects(bundled, host, modules, player, engineLoaded) {
366
375
  await loadEngine();
376
+ await initG2p();
367
377
  engineLoaded?.();
368
378
  const code = linkBundle(bundled.code, player);
369
379
  const loaded = await importUserModule(() => modules.load({ code, map: bundled.map }));
@@ -433,6 +443,7 @@ import { FPS as FPS4 } from "@beff/aula/run";
433
443
  import { estimateNarration } from "@beff/aula/text";
434
444
 
435
445
  export {
446
+ requireMatchingAulaVersion,
436
447
  scriptView,
437
448
  clock,
438
449
  narrationAt,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  host,
3
3
  loadProject
4
- } from "./chunk-STW7EAFL.js";
4
+ } from "./chunk-CO6PVRRP.js";
5
5
 
6
6
  // src/project.ts
7
7
  function exists(capabilities, file) {
@@ -21,15 +21,15 @@ function alignWords(source, spoken, read) {
21
21
  });
22
22
  const n = phones.length;
23
23
  const m = spoken.length;
24
- const width = m + 1;
25
- const cost = new Uint32Array((n + 1) * width);
26
- const at = (i2, j2) => cost[i2 * width + j2] ?? 0;
24
+ const width2 = m + 1;
25
+ const cost = new Uint32Array((n + 1) * width2);
26
+ const at = (i2, j2) => cost[i2 * width2 + j2] ?? 0;
27
27
  const differ = (i2, j2) => phones[i2 - 1] === spoken[j2 - 1]?.phoneme ? 0 : 1;
28
- for (let i2 = 0; i2 <= n; i2++) cost[i2 * width] = i2;
28
+ for (let i2 = 0; i2 <= n; i2++) cost[i2 * width2] = i2;
29
29
  for (let j2 = 0; j2 <= m; j2++) cost[j2] = j2;
30
30
  for (let i2 = 1; i2 <= n; i2++) {
31
31
  for (let j2 = 1; j2 <= m; j2++) {
32
- cost[i2 * width + j2] = Math.min(at(i2 - 1, j2 - 1) + differ(i2, j2), at(i2 - 1, j2) + 1, at(i2, j2 - 1) + 1);
32
+ cost[i2 * width2 + j2] = Math.min(at(i2 - 1, j2 - 1) + differ(i2, j2), at(i2 - 1, j2) + 1, at(i2, j2 - 1) + 1);
33
33
  }
34
34
  }
35
35
  const word = new Int32Array(m).fill(-1);
@@ -283,24 +283,24 @@ var KOKORO_VOCAB = /* @__PURE__ */ new Map([
283
283
  ]);
284
284
 
285
285
  // ../aula-narration/src/aula-voice.ts
286
- var AULA_VOICE_RELEASE = "v0.1.3";
286
+ var AULA_VOICE_RELEASE = "v0.2.1";
287
287
  var RELEASE_URL = `https://github.com/lucasavila00/aula-voice/releases/download/${AULA_VOICE_RELEASE}`;
288
288
  var AULA_VOICE_FILES = {
289
289
  model: {
290
- path: "model.safetensors",
291
- bytes: 33489768,
292
- sha256: "122b3602c825f3ae23e23d44239da3641d14fb83bedec230f8e23952836b9e20"
290
+ path: "model.f16-text-fp32.safetensors",
291
+ bytes: 21484448,
292
+ sha256: "caca7b00f547d3feea506ccd6c534a764d0da2574bd850dd741fa80dd968dc52"
293
293
  },
294
294
  config: {
295
295
  path: "config.json",
296
- bytes: 2346,
297
- sha256: "e71a54f3a27ca153fd2cea9470395889cbc86cd6d66476ffbcf3918087443c6d"
296
+ bytes: 2215,
297
+ sha256: "fa0a24abed935cf566d0efd17366af2bd98054b16caf9ccbcb8242e4991bacdc"
298
298
  }
299
299
  };
300
300
  var AULA_VOICE_WEIGHTS = {
301
301
  path: "aula-voice.avw",
302
- bytes: 33478208,
303
- sha256: "7a6039017a2783f7f3954a3531148e761b683807ebd3bb1436505f72379e81a1"
302
+ bytes: 21474688,
303
+ sha256: "98f886dafba9abfb98bbe1c1143ee026d08e579c7926c88501535c543f92212b"
304
304
  };
305
305
  var SERVER_WEIGHTS_PATH = `/models/${AULA_VOICE_WEIGHTS.path}`;
306
306
  var aulaVoiceUrl = (file) => `${RELEASE_URL}/${file.path}`;
@@ -309,7 +309,6 @@ var SAMPLE_RATE = 24e3;
309
309
  var HOP = 300;
310
310
  var MAX_TOKENS = 250;
311
311
  var LEAD = 16;
312
- var FIRST = 3;
313
312
  var TRAIL = 16;
314
313
  var SILENT = new Set(';:,.!?\u2014\u2026"()\u201C\u201D ');
315
314
  var PEAK = 0.99;
@@ -345,13 +344,12 @@ async function layout(parts, words, audio) {
345
344
  const edges = [0];
346
345
  for (let i = 0; i < spoken.durations.length; i++) edges.push((edges[i] ?? 0) + Number(spoken.durations[i]) * HOP);
347
346
  const head = Math.max((edges[1] ?? 0) - LEAD * HOP, 0);
348
- const first = Math.max((edges[1] ?? 0) - FIRST * HOP, head);
349
347
  const last = known.findLastIndex((phoneme) => !SILENT.has(phoneme));
350
- const end = edges.at(-2) ?? head;
351
- const tail = last < 0 ? end : Math.min(end, Math.max((edges[last + 1] ?? end) + TRAIL * HOP, head));
348
+ const end = edges.at(-1) ?? head;
349
+ const tail = last < 0 ? edges.at(-2) ?? head : Math.min(end, (edges[last + 2] ?? end) + TRAIL * HOP);
352
350
  known.forEach((phoneme, i) => {
353
- const start = Math.min(i === 0 ? first : edges[i] ?? head, tail) - head + offset;
354
- const stop = Math.min(edges[i + 1] ?? tail, tail) - head + offset;
351
+ const start = Math.min(edges[i + 1] ?? head, tail) - head + offset;
352
+ const stop = Math.min(edges[i + 2] ?? tail, tail) - head + offset;
355
353
  timings.push({ phoneme, start: start / SAMPLE_RATE, end: stop / SAMPLE_RATE });
356
354
  });
357
355
  const pause = index < batches.length - 1 ? Math.floor(pauseAfter(batch) * SAMPLE_RATE) : 0;
@@ -390,7 +388,16 @@ var FIXED = {
390
388
  predictor_channels: 128,
391
389
  head_channels: 256,
392
390
  head_inner: 768,
393
- head_kernel: 7
391
+ head_kernel: 7,
392
+ f0_min: 50,
393
+ f0_max: 600,
394
+ pitch_reference_hz: 200,
395
+ harmonic_limit: 0.2083
396
+ };
397
+ var HEAD = {
398
+ head: "convnext-src",
399
+ source_phase: "seeded",
400
+ source_aperiodic: true
394
401
  };
395
402
  function stack(prefix, layers) {
396
403
  const names = [];
@@ -429,7 +436,14 @@ function order(headBlocks) {
429
436
  head.push(`${p}.${part}.weight`, `${p}.${part}.bias`);
430
437
  head.push(`${p}.gamma`);
431
438
  }
432
- head.push("head.norm_out.weight", "head.norm_out.bias", "head.out.weight", "head.out.bias");
439
+ head.push(
440
+ "head.norm_out.weight",
441
+ "head.norm_out.bias",
442
+ "head.out.weight",
443
+ "head.out.bias",
444
+ "head.source_in.weight",
445
+ "head.source_in.bias"
446
+ );
433
447
  return [
434
448
  "tokens.weight",
435
449
  "voices.weight",
@@ -463,6 +477,9 @@ function field(value, key) {
463
477
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
464
478
  return Object.entries(value).find(([k]) => k === key)?.[1];
465
479
  }
480
+ function width(dtype) {
481
+ return dtype === "f32" ? 4 : 2;
482
+ }
466
483
  function readSafetensors(file) {
467
484
  if (file.length < 8) throw new Error("model.safetensors is truncated in its header length");
468
485
  const view = new DataView(file.buffer, file.byteOffset, file.byteLength);
@@ -478,38 +495,42 @@ function readSafetensors(file) {
478
495
  if (name === "__metadata__") continue;
479
496
  const shape = counts(field(entry, "shape"));
480
497
  const offsets = counts(field(entry, "data_offsets"));
481
- if (field(entry, "dtype") !== "F32") throw new Error(`the tensor "${name}" is not F32`);
498
+ const rawDtype = field(entry, "dtype");
499
+ const dtype = rawDtype === "F32" ? "f32" : rawDtype === "F16" ? "f16" : null;
500
+ if (!dtype) throw new Error(`the tensor "${name}" is not F32 or F16`);
482
501
  if (!shape || !offsets) throw new Error(`the tensor "${name}" has no shape or data offsets`);
483
502
  const [start = 0, end = 0] = offsets;
484
503
  const count = shape.reduce((a, b) => a * b, 1);
485
- if (offsets.length !== 2 || end - start !== count * 4 || end > data.length) {
504
+ const bytesPer = width(dtype);
505
+ if (offsets.length !== 2 || end - start !== count * bytesPer || end > data.length) {
486
506
  throw new Error(`the data offsets of "${name}" do not fit its shape or the file`);
487
507
  }
488
- tensors.set(name, { shape, bytes: data.subarray(start, end) });
508
+ tensors.set(name, { shape, dtype, bytes: data.subarray(start, end) });
489
509
  }
490
510
  return tensors;
491
511
  }
492
512
  function engineLayout(name, raw) {
493
- const { shape, bytes } = raw;
513
+ const { shape, dtype, bytes } = raw;
494
514
  const out = new Uint8Array(bytes.length);
515
+ const size = width(dtype);
495
516
  const move = (to, from) => {
496
- out.set(bytes.subarray(from * 4, from * 4 + 4), to * 4);
517
+ out.set(bytes.subarray(from * size, from * size + size), to * size);
497
518
  };
498
519
  const embedding = name.endsWith("tokens.weight") || name.endsWith("voices.weight");
499
520
  const [a = 0, b = 0, c = 0] = shape;
500
521
  if (shape.length === 3 && b === 1 && name.includes("depthwise")) {
501
522
  for (let ch = 0; ch < a; ch++) for (let k = 0; k < c; k++) move(k * a + ch, ch * c + k);
502
- return { shape: [c, a], bytes: out };
523
+ return { shape: [c, a], dtype, bytes: out };
503
524
  }
504
525
  if (shape.length === 3) {
505
526
  for (let o = 0; o < a; o++) {
506
527
  for (let i = 0; i < b; i++) for (let k = 0; k < c; k++) move((k * b + i) * a + o, (o * b + i) * c + k);
507
528
  }
508
- return { shape: [c, b, a], bytes: out };
529
+ return { shape: [c, b, a], dtype, bytes: out };
509
530
  }
510
531
  if (shape.length === 2 && !embedding) {
511
532
  for (let o = 0; o < a; o++) for (let i = 0; i < b; i++) move(i * a + o, o * b + i);
512
- return { shape: [b, a], bytes: out };
533
+ return { shape: [b, a], dtype, bytes: out };
513
534
  }
514
535
  return raw;
515
536
  }
@@ -526,6 +547,13 @@ function studentWeightFile(model, config) {
526
547
  );
527
548
  }
528
549
  }
550
+ for (const [key, value] of Object.entries(HEAD)) {
551
+ if (field(settings, key) !== value) {
552
+ throw new Error(
553
+ `config.json has ${key} ${JSON.stringify(field(settings, key))}; the engine needs ${JSON.stringify(value)}`
554
+ );
555
+ }
556
+ }
529
557
  const tensors = readSafetensors(model);
530
558
  const tokens = tensors.get("tokens.weight");
531
559
  const voices = tensors.get("voices.weight");
@@ -548,14 +576,14 @@ function studentWeightFile(model, config) {
548
576
  if (unused.length)
549
577
  throw new Error(`model.safetensors has tensors that the student does not use: ${unused.join(", ")}`);
550
578
  const laid = names.map((name) => {
551
- if (name === "vowel_tokens") return [name, { shape: [vocab], bytes: vowels }];
579
+ if (name === "vowel_tokens") return [name, { shape: [vocab], dtype: "f32", bytes: vowels }];
552
580
  const raw = tensors.get(name);
553
581
  if (!raw) throw new Error(`model.safetensors has no tensor "${name}"`);
554
582
  return [`model.${name}`, engineLayout(name, raw)];
555
583
  });
556
- const list = laid.map(([name, raw]) => `["${name}", [${raw.shape.join(", ")}]]`).join(", ");
584
+ const list = laid.map(([name, raw]) => `["${name}", [${raw.shape.join(", ")}], "${raw.dtype}"]`).join(", ");
557
585
  const header = new TextEncoder().encode(
558
- `{"kind": "student", "dtype": "f32", "config": {"vocab": ${String(vocab)}, "voices": ${String(voices.shape[0] ?? 0)}, "channels": ${String(channels)}, "head_blocks": ${String(headBlocks)}}, "tensors": [${list}]}`
586
+ `{"kind": "student", "config": {"vocab": ${String(vocab)}, "voices": ${String(voices.shape[0] ?? 0)}, "channels": ${String(channels)}, "head_blocks": ${String(headBlocks)}}, "tensors": [${list}]}`
559
587
  );
560
588
  const size = laid.reduce((total, [, raw]) => total + pad(raw.bytes.length), pad(8 + header.length));
561
589
  const file = new Uint8Array(size);
@@ -571,11 +599,12 @@ function studentWeightFile(model, config) {
571
599
  }
572
600
 
573
601
  // ../aula-narration/src/phonemize.ts
574
- import { loadEngine } from "@beff/aula/run";
602
+ import { loadEngine, initG2p } from "@beff/aula/run";
575
603
  import { phonemize } from "@beff/aula/text";
576
604
  function britishPhonemizer(vocab) {
577
605
  return async (text) => {
578
606
  await loadEngine();
607
+ await initG2p();
579
608
  return Array.from(phonemize(text)).filter((phoneme) => vocab.has(phoneme)).join("").trim();
580
609
  };
581
610
  }
@@ -1,3 +1,6 @@
1
+ import {
2
+ createNodeBundler
3
+ } from "./chunk-THQ5Y74K.js";
1
4
  import {
2
5
  VIDEO,
3
6
  assemble,
@@ -6,7 +9,14 @@ import {
6
9
  } from "./chunk-BLKXJGEO.js";
7
10
  import {
8
11
  printDiagnostics
9
- } from "./chunk-UKSA5OFC.js";
12
+ } from "./chunk-H3SCHOAT.js";
13
+ import {
14
+ host
15
+ } from "./chunk-OLAUZCE4.js";
16
+ import {
17
+ folderOf,
18
+ nameOf
19
+ } from "./chunk-CO6PVRRP.js";
10
20
  import {
11
21
  chapterIndexes,
12
22
  checkProject,
@@ -26,22 +36,12 @@ import {
26
36
  targetChapters,
27
37
  timelineView,
28
38
  wordNotes
29
- } from "./chunk-HLRTXRAC.js";
30
- import {
31
- createNodeBundler
32
- } from "./chunk-THQ5Y74K.js";
39
+ } from "./chunk-L75GJLCT.js";
33
40
  import {
34
41
  narrateScript,
35
42
  scriptAudio,
36
43
  wav
37
44
  } from "./chunk-S74JLCZK.js";
38
- import {
39
- host
40
- } from "./chunk-WY3AMP6M.js";
41
- import {
42
- folderOf,
43
- nameOf
44
- } from "./chunk-STW7EAFL.js";
45
45
  import {
46
46
  ObjectRuntype,
47
47
  OptionalFieldRuntype,
@@ -54,7 +54,7 @@ import {
54
54
  bundle,
55
55
  isError,
56
56
  wrongArgument
57
- } from "./chunk-RRS3SD7K.js";
57
+ } from "./chunk-TYPWU6EF.js";
58
58
 
59
59
  // src/commands.ts
60
60
  import path2 from "node:path";
@@ -981,12 +981,13 @@ var direct_hoist_1 = new AnyRuntype(void 0);
981
981
  var direct_hoist_2 = new TypeofRuntype(void 0, "string");
982
982
  var direct_hoist_3 = new ArrayRuntype(void 0, direct_hoist_2);
983
983
  var direct_hoist_4 = new ObjectRuntype({
984
- "description": "The part of a package.json that aula reads: how a package names its module and its\nworkspace packages."
984
+ "description": "The part of a package.json that aula reads: how a package names its module and its\nworkspace packages, and its version when the CLI compares it to the project's."
985
985
  }, {
986
986
  "exports": new OptionalFieldRuntype(direct_hoist_1),
987
987
  "main": new OptionalFieldRuntype(direct_hoist_2),
988
988
  "module": new OptionalFieldRuntype(direct_hoist_2),
989
989
  "name": new OptionalFieldRuntype(direct_hoist_2),
990
+ "version": new OptionalFieldRuntype(direct_hoist_2),
990
991
  "workspaces": new OptionalFieldRuntype(direct_hoist_3)
991
992
  }, []);
992
993
  Object.assign(namedRuntypes, {
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-PLBRKNMD.js";
17
+ } from "./chunk-Q5GA52JZ.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { spawn } from "node:child_process";
@@ -280,9 +280,9 @@ var base = Capabilities.create({
280
280
  },
281
281
  spawn
282
282
  });
283
- var { diagnosticsOf, printDiagnostics } = await import("./problems-CQXPY4G5.js");
284
- var { host, loadProject } = await import("./project-ICPIW4MO.js");
285
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-IBCNVZ4J.js");
283
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-ZPV2ADYA.js");
284
+ var { host, loadProject } = await import("./project-MCSMU7LQ.js");
285
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-RSLSQESN.js");
286
286
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
287
287
  var render = createRender(base, process.execPath);
288
288
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -305,7 +305,10 @@ async function main(argv) {
305
305
  }
306
306
  const args = parse(rest, optionsOf(command));
307
307
  if (command === "web") {
308
- const { serve } = await import("./server-QQ2V343V.js");
308
+ const { assertAulaVersion } = await import("./aula-version-6SX7JIS4.js");
309
+ const options2 = webOptions(cwd, args);
310
+ assertAulaVersion(capabilities, options2.root);
311
+ const { serve } = await import("./server-X6EO4JBG.js");
309
312
  const stop = new AbortController();
310
313
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
311
314
  const web = Capabilities.create({
@@ -317,21 +320,25 @@ async function main(argv) {
317
320
  return watcher;
318
321
  }
319
322
  });
320
- await serve(Capabilities.extend(capabilities, web), { ...webOptions(cwd, args), stop: stop.signal });
323
+ await serve(Capabilities.extend(capabilities, web), { ...options2, stop: stop.signal });
321
324
  return 0;
322
325
  }
323
326
  if (command === "site") {
324
- const { site } = await import("./site-XYQKQZLZ.js");
327
+ const { site } = await import("./site-BEDOC3S3.js");
325
328
  const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
326
329
  return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
327
330
  }
328
331
  if (command === "tokens") {
329
- const { tokens, tokensArgs } = await import("./commands-NDTPHXGF.js");
332
+ const { tokens, tokensArgs } = await import("./commands-C3ER3SKG.js");
330
333
  tokensArgs(args.positional);
331
334
  const tokensOf = createTokens();
332
335
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
333
336
  }
334
337
  const { folder, rest: after } = folderArgs(cwd, command, args);
338
+ if (command === "check") {
339
+ const { assertAulaVersion } = await import("./aula-version-6SX7JIS4.js");
340
+ assertAulaVersion(capabilities, folder);
341
+ }
335
342
  const only = command === "preview" ? after.slice(1) : command === "check" || command === "timeline" ? after : [];
336
343
  const project = await loadProject(capabilities, cwd, folder, only);
337
344
  return await run2(capabilities, cwd, command, project, after, args.flags) ? 0 : 1;
@@ -7,17 +7,17 @@ import {
7
7
  timeline,
8
8
  tokens,
9
9
  tokensArgs
10
- } from "./chunk-JWAUET3S.js";
10
+ } from "./chunk-S7DEFSFH.js";
11
+ import "./chunk-THQ5Y74K.js";
11
12
  import "./chunk-BLKXJGEO.js";
12
13
  import "./chunk-2XGNOG2U.js";
13
- import "./chunk-UKSA5OFC.js";
14
- import "./chunk-HLRTXRAC.js";
15
- import "./chunk-THQ5Y74K.js";
14
+ import "./chunk-H3SCHOAT.js";
15
+ import "./chunk-OLAUZCE4.js";
16
+ import "./chunk-CO6PVRRP.js";
17
+ import "./chunk-L75GJLCT.js";
16
18
  import "./chunk-S74JLCZK.js";
17
- import "./chunk-PLBRKNMD.js";
18
- import "./chunk-WY3AMP6M.js";
19
- import "./chunk-STW7EAFL.js";
20
- import "./chunk-RRS3SD7K.js";
19
+ import "./chunk-Q5GA52JZ.js";
20
+ import "./chunk-TYPWU6EF.js";
21
21
  export {
22
22
  bundle,
23
23
  check,
@@ -0,0 +1,14 @@
1
+ import {
2
+ printDiagnostics
3
+ } from "./chunk-H3SCHOAT.js";
4
+ import "./chunk-CO6PVRRP.js";
5
+ import "./chunk-L75GJLCT.js";
6
+ import "./chunk-S74JLCZK.js";
7
+ import "./chunk-Q5GA52JZ.js";
8
+ import {
9
+ diagnosticsOf
10
+ } from "./chunk-TYPWU6EF.js";
11
+ export {
12
+ diagnosticsOf,
13
+ printDiagnostics
14
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ exists,
3
+ host,
4
+ loadProject
5
+ } from "./chunk-OLAUZCE4.js";
6
+ import "./chunk-CO6PVRRP.js";
7
+ import "./chunk-TYPWU6EF.js";
8
+ export {
9
+ exists,
10
+ host,
11
+ loadProject
12
+ };
@@ -5,19 +5,19 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-JWAUET3S.js";
8
+ } from "./chunk-S7DEFSFH.js";
9
+ import "./chunk-THQ5Y74K.js";
9
10
  import "./chunk-BLKXJGEO.js";
10
11
  import "./chunk-2XGNOG2U.js";
11
- import "./chunk-UKSA5OFC.js";
12
- import "./chunk-HLRTXRAC.js";
13
- import "./chunk-THQ5Y74K.js";
12
+ import "./chunk-H3SCHOAT.js";
13
+ import "./chunk-OLAUZCE4.js";
14
+ import "./chunk-CO6PVRRP.js";
15
+ import "./chunk-L75GJLCT.js";
14
16
  import "./chunk-S74JLCZK.js";
15
- import "./chunk-PLBRKNMD.js";
16
- import "./chunk-WY3AMP6M.js";
17
- import "./chunk-STW7EAFL.js";
17
+ import "./chunk-Q5GA52JZ.js";
18
18
  import {
19
19
  wrongArgument
20
- } from "./chunk-RRS3SD7K.js";
20
+ } from "./chunk-TYPWU6EF.js";
21
21
 
22
22
  // src/run.ts
23
23
  import path from "node:path";
@@ -5,17 +5,17 @@ import {
5
5
  createNodeBundler,
6
6
  nodeTree
7
7
  } from "./chunk-THQ5Y74K.js";
8
+ import {
9
+ exists
10
+ } from "./chunk-OLAUZCE4.js";
11
+ import "./chunk-CO6PVRRP.js";
8
12
  import "./chunk-S74JLCZK.js";
9
13
  import {
10
14
  SERVER_WEIGHTS_PATH
11
- } from "./chunk-PLBRKNMD.js";
12
- import {
13
- exists
14
- } from "./chunk-WY3AMP6M.js";
15
- import "./chunk-STW7EAFL.js";
15
+ } from "./chunk-Q5GA52JZ.js";
16
16
  import {
17
17
  bundleWorkspace
18
- } from "./chunk-RRS3SD7K.js";
18
+ } from "./chunk-TYPWU6EF.js";
19
19
 
20
20
  // src/web/server.ts
21
21
  import { once } from "node:events";
@@ -30,6 +30,7 @@ var KINDS = /* @__PURE__ */ new Map([
30
30
  [".html", "text/html; charset=utf-8"],
31
31
  [".js", "text/javascript"],
32
32
  [".css", "text/css"],
33
+ [".bin", "application/octet-stream"],
33
34
  [".svg", "image/svg+xml"],
34
35
  [".wasm", "application/wasm"],
35
36
  [".json", "application/json"]
@@ -1,7 +1,3 @@
1
- import {
2
- loadBuiltProjects,
3
- workspaceHost
4
- } from "./chunk-HLRTXRAC.js";
5
1
  import {
6
2
  PACKAGE
7
3
  } from "./chunk-A5QHTZKT.js";
@@ -9,16 +5,20 @@ import {
9
5
  createNodeBundler,
10
6
  nodeTree
11
7
  } from "./chunk-THQ5Y74K.js";
8
+ import {
9
+ loadBuiltProjects,
10
+ workspaceHost
11
+ } from "./chunk-L75GJLCT.js";
12
12
  import "./chunk-S74JLCZK.js";
13
13
  import {
14
14
  AULA_VOICE_WEIGHTS
15
- } from "./chunk-PLBRKNMD.js";
15
+ } from "./chunk-Q5GA52JZ.js";
16
16
  import {
17
17
  Problems,
18
18
  bundleWorkspace,
19
19
  projectModules,
20
20
  wrongArgument
21
- } from "./chunk-RRS3SD7K.js";
21
+ } from "./chunk-TYPWU6EF.js";
22
22
 
23
23
  // src/site.ts
24
24
  import os from "node:os";
@@ -1 +1 @@
1
- import{m as e,y as t}from"../src-uzFdGdZX.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};
1
+ import{m as e,y as t}from"../src-D0RJvTRf.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};