@nodaro/shared 3.25.0 → 3.27.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/dist/index.cjs +778 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +427 -75
- package/dist/index.d.ts +427 -75
- package/dist/index.js +749 -170
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/auto-aspect-source.test.ts +372 -0
- package/src/__tests__/camera-switch-contract.test.ts +10 -0
- package/src/__tests__/collections.test.ts +10 -0
- package/src/__tests__/condition-variables.test.ts +12 -0
- package/src/__tests__/content-recipe-ideas.test.ts +9 -4
- package/src/__tests__/credit-identifiers.test.ts +12 -0
- package/src/__tests__/edl.test.ts +319 -4
- package/src/__tests__/image-model-roles.test.ts +57 -0
- package/src/__tests__/image-ref-limit.test.ts +1 -0
- package/src/__tests__/json-kinds.test.ts +11 -1
- package/src/__tests__/llm-models.test.ts +253 -42
- package/src/__tests__/lone-media-url.test.ts +78 -0
- package/src/__tests__/prompt-length-limits.test.ts +2 -0
- package/src/__tests__/render-nodes.test.ts +46 -1
- package/src/__tests__/transcribe-preflight.test.ts +5 -0
- package/src/camera-switch-contract.ts +9 -6
- package/src/collections.ts +72 -2
- package/src/condition-variables.ts +3 -1
- package/src/content-recipe-ideas.ts +5 -2
- package/src/credit-identifiers.ts +56 -13
- package/src/edl.ts +143 -23
- package/src/fan-out-rows.ts +1 -1
- package/src/i18n/camera-format.ko.ts +3 -3
- package/src/image-model-roles.ts +62 -0
- package/src/index.ts +42 -0
- package/src/json-kinds.ts +11 -6
- package/src/llm-models.ts +434 -24
- package/src/lone-media-url.ts +57 -0
- package/src/model-catalog.ts +145 -9
- package/src/model-constants.ts +13 -2
- package/src/node-default-mappings.ts +3 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +47 -4
- package/src/pipeline-types.ts +16 -3
- package/src/producer-types.ts +4 -0
- package/src/render-nodes.ts +58 -2
- package/src/settings-input.ts +2 -1
- package/src/transcribe-preflight.ts +11 -10
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
parseEditPlanMode,
|
|
26
26
|
} from "../edit-plan-contract.js"
|
|
27
27
|
import { editPlanSourceDurationSec } from "../video-duration.js"
|
|
28
|
+
import * as edlModule from "../edl.js"
|
|
29
|
+
import * as sharedIndex from "../index.js"
|
|
28
30
|
|
|
29
31
|
/** A minimal valid single-camera tighten EDL: two kept spans of the master. */
|
|
30
32
|
function tightenEdl(): Edl {
|
|
@@ -296,10 +298,230 @@ describe("normalizeTranscript", () => {
|
|
|
296
298
|
expect(t.words[0]).toEqual({ text: "hi", startMs: 2, endMs: 2 })
|
|
297
299
|
})
|
|
298
300
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
// The one transcript reader (decided 2026-10-08), the Cloud plugin's
|
|
302
|
+
// coerceTranscript reads by the same rule, so the app and the plugin read
|
|
303
|
+
// one transcript the same way. Round 2 (decided 2026-10-08): a zero-width
|
|
304
|
+
// word is a POINT and is kept, as before; only a broken word is dropped.
|
|
305
|
+
it("keeps a zero-width word as a point (also one that rounds to zero width)", () => {
|
|
306
|
+
const t = normalizeTranscript({
|
|
307
|
+
words: [
|
|
308
|
+
{ text: "point", startMs: 700, endMs: 700, speaker: "A" },
|
|
309
|
+
{ text: "rounds-to-point", startMs: 1.6, endMs: 2.4 },
|
|
310
|
+
{ text: "alias-point", start: 900, end: "900" },
|
|
311
|
+
],
|
|
312
|
+
})
|
|
313
|
+
expect(t.words).toEqual([
|
|
314
|
+
{ text: "rounds-to-point", startMs: 2, endMs: 2 },
|
|
315
|
+
{ text: "point", startMs: 700, endMs: 700, speaker: "A" },
|
|
316
|
+
{ text: "alias-point", startMs: 900, endMs: 900 },
|
|
317
|
+
])
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
it("drops only a broken word: no start or end, a non-finite or negative time, or an end before its start", () => {
|
|
321
|
+
const t = normalizeTranscript({
|
|
322
|
+
words: [
|
|
323
|
+
{ text: "inverted", startMs: 500, endMs: 100 },
|
|
324
|
+
{ text: "negative", startMs: -100, endMs: 200 },
|
|
325
|
+
{ text: "nan", startMs: Number.NaN, endMs: 200 },
|
|
326
|
+
{ text: "inf", startMs: 0, endMs: Number.POSITIVE_INFINITY },
|
|
327
|
+
{ text: "not-a-number", startMs: "soon", endMs: 300 },
|
|
328
|
+
{ text: "no-start", endMs: 300 },
|
|
329
|
+
{ text: "no-end", startMs: 300 },
|
|
330
|
+
{ text: "untimed" },
|
|
331
|
+
null,
|
|
332
|
+
"word",
|
|
333
|
+
{ text: "point", startMs: 800, endMs: 800 },
|
|
334
|
+
{ text: "kept", startMs: 900, endMs: 1_200 },
|
|
335
|
+
],
|
|
336
|
+
})
|
|
337
|
+
expect(t.words).toEqual([
|
|
338
|
+
{ text: "point", startMs: 800, endMs: 800 },
|
|
339
|
+
{ text: "kept", startMs: 900, endMs: 1_200 },
|
|
340
|
+
])
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
it("accepts start/end as aliases of startMs/endMs (and numeric strings), startMs/endMs winning when both are given", () => {
|
|
344
|
+
const t = normalizeTranscript({
|
|
345
|
+
words: [
|
|
346
|
+
{ text: "a", start: 100, end: 400, speaker: "A" },
|
|
347
|
+
{ text: "b", startMs: 500, start: 9_999, endMs: 800, end: 1 },
|
|
348
|
+
{ text: "c", start: "900", end: "1100.4" },
|
|
349
|
+
],
|
|
350
|
+
segments: [{ start: 100, end: 1_100, text: "a b c" }],
|
|
351
|
+
})
|
|
352
|
+
expect(t.words).toEqual([
|
|
353
|
+
{ text: "a", startMs: 100, endMs: 400, speaker: "A" },
|
|
354
|
+
{ text: "b", startMs: 500, endMs: 800 },
|
|
355
|
+
{ text: "c", startMs: 900, endMs: 1_100 },
|
|
356
|
+
])
|
|
357
|
+
expect(t.segments).toEqual([{ startMs: 100, endMs: 1_100, text: "a b c" }])
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
it("sorts words by start time (a stable sort: ties keep their order)", () => {
|
|
361
|
+
const t = normalizeTranscript({
|
|
362
|
+
words: [
|
|
363
|
+
{ text: "late", startMs: 2_000, endMs: 2_300 },
|
|
364
|
+
{ text: "early", startMs: 100, endMs: 300 },
|
|
365
|
+
{ text: "tie-1", startMs: 1_000, endMs: 1_100 },
|
|
366
|
+
{ text: "tie-2", startMs: 1_000, endMs: 1_200 },
|
|
367
|
+
],
|
|
368
|
+
})
|
|
369
|
+
expect(t.words.map((w) => w.text)).toEqual(["early", "tie-1", "tie-2", "late"])
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
it("reads a segment by the same rule: a point is kept, a broken one dropped", () => {
|
|
373
|
+
const t = normalizeTranscript({
|
|
374
|
+
words: [],
|
|
375
|
+
segments: [
|
|
376
|
+
{ startMs: 0, endMs: 0, text: "point" },
|
|
377
|
+
{ startMs: 400, endMs: 100, text: "inverted" },
|
|
378
|
+
{ startMs: -5, endMs: 100, text: "negative" },
|
|
379
|
+
{ endMs: 100, text: "no-start" },
|
|
380
|
+
{ startMs: 100, endMs: 900, text: "kept", speaker: "A" },
|
|
381
|
+
],
|
|
382
|
+
})
|
|
383
|
+
expect(t.segments).toEqual([
|
|
384
|
+
{ startMs: 0, endMs: 0, text: "point" },
|
|
385
|
+
{ startMs: 100, endMs: 900, text: "kept", speaker: "A" },
|
|
386
|
+
])
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
it("a point word the reader keeps survives the remap when its instant is kept", () => {
|
|
390
|
+
const edl: Edl = {
|
|
391
|
+
version: 1,
|
|
392
|
+
clock: "master",
|
|
393
|
+
sources: [{ id: "m", url: "https://x/m.mp4", kind: "video", role: "master-audio" }],
|
|
394
|
+
segments: [{ id: "s0", inMs: 0, outMs: 1_000, video: "m" }, { id: "s1", inMs: 2_000, outMs: 3_000, video: "m" }],
|
|
395
|
+
}
|
|
396
|
+
const t = normalizeTranscript({ words: [{ text: "[laugh]", start: 2_500, end: 2_500 }, { text: "[cut]", startMs: 1_500, endMs: 1_500 }] })
|
|
397
|
+
expect(remapTranscriptThroughEdl(edl, t).words).toEqual([{ text: "[laugh]", startMs: 1_500, endMs: 1_500 }])
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
// P3.5 round 2 (decided 2026-10-09): Camera Switch's renamed transcript
|
|
401
|
+
// carries its raw label → display name map, and the reader keeps it.
|
|
402
|
+
describe("speakerNames (the raw → display map a renamed transcript carries)", () => {
|
|
403
|
+
const words = [{ text: "hi", startMs: 0, endMs: 100, speaker: "Ana" }]
|
|
404
|
+
|
|
405
|
+
it("keeps the map", () => {
|
|
406
|
+
const t = normalizeTranscript({ words, speakerNames: { SPEAKER_00: "Ana", SPEAKER_01: "SPEAKER_01" } })
|
|
407
|
+
expect(t.speakerNames).toEqual({ SPEAKER_00: "Ana", SPEAKER_01: "SPEAKER_01" })
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
it("keeps only entries whose label and name are non-empty strings", () => {
|
|
411
|
+
const t = normalizeTranscript({ words, speakerNames: { SPEAKER_00: "Ana", "": "Nobody", SPEAKER_01: "", SPEAKER_02: 7, SPEAKER_03: null } })
|
|
412
|
+
expect(t.speakerNames).toEqual({ SPEAKER_00: "Ana" })
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
it("keeps a label spelled like an Object.prototype key as an own entry, as the plugin's reader does", () => {
|
|
416
|
+
const t = normalizeTranscript({ words, speakerNames: JSON.parse('{"__proto__":"Ana","S1":"Bo"}') })
|
|
417
|
+
expect(Object.keys(t.speakerNames ?? {})).toEqual(["__proto__", "S1"])
|
|
418
|
+
expect(Object.getOwnPropertyDescriptor(t.speakerNames, "__proto__")?.value).toBe("Ana")
|
|
419
|
+
expect(Object.getPrototypeOf(t.speakerNames)).toBe(Object.prototype)
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
it("leaves the field out when there is no map, an empty one, or not a map", () => {
|
|
423
|
+
for (const speakerNames of [undefined, null, {}, { SPEAKER_00: "" }, ["Ana"], "Ana", 3]) {
|
|
424
|
+
expect("speakerNames" in normalizeTranscript({ words, speakerNames })).toBe(false)
|
|
425
|
+
}
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
it("survives the remap onto the rendered output", () => {
|
|
429
|
+
const edl: Edl = {
|
|
430
|
+
version: 1,
|
|
431
|
+
clock: "master",
|
|
432
|
+
sources: [{ id: "m", url: "https://x/m.mp4", kind: "video", role: "master-audio" }],
|
|
433
|
+
segments: [{ id: "s0", inMs: 0, outMs: 1_000, video: "m" }],
|
|
434
|
+
}
|
|
435
|
+
const t = normalizeTranscript({ words, speakerNames: { SPEAKER_00: "Ana" } })
|
|
436
|
+
expect(remapTranscriptThroughEdl(edl, t).speakerNames).toEqual({ SPEAKER_00: "Ana" })
|
|
437
|
+
})
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
describe("remapTranscriptThroughEdl — a word across TOUCHING segments keeps its full length (decided 2026-10-08)", () => {
|
|
442
|
+
const master: Edl["sources"] = [{ id: "m", url: "https://x/m.mp4", kind: "video", role: "master-audio" }]
|
|
443
|
+
const at = (segments: Edl["segments"]): Edl => ({ version: 1, clock: "master", sources: master, segments })
|
|
444
|
+
const word = (startMs: number, endMs: number): Transcript => ({ version: 1, words: [{ text: "w", startMs, endMs }] })
|
|
445
|
+
const only = (edl: Edl, t: Transcript) => {
|
|
446
|
+
const out = remapTranscriptThroughEdl(edl, t).words
|
|
447
|
+
expect(out).toHaveLength(1)
|
|
448
|
+
return { startMs: out[0].startMs, endMs: out[0].endMs }
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
it("a split in continuous master time (seg[i].outMs === seg[i+1].inMs, contiguous on the output) does not clip the word", () => {
|
|
452
|
+
const edl = at([
|
|
453
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m" },
|
|
454
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m" },
|
|
455
|
+
])
|
|
456
|
+
expect(only(edl, word(4_800, 5_300))).toEqual({ startMs: 4_800, endMs: 5_300 })
|
|
457
|
+
})
|
|
458
|
+
|
|
459
|
+
it("the time-free switches (cut, pan, zoom) keep the output contiguous, so the word stays whole", () => {
|
|
460
|
+
for (const layoutTransition of [{ type: "cut" }, { type: "pan", durationMs: 500 }, { type: "zoom", durationMs: 300 }]) {
|
|
461
|
+
const edl = at([
|
|
462
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m", layout: { mode: "single" } },
|
|
463
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m", layout: { mode: "single", transition: layoutTransition } },
|
|
464
|
+
])
|
|
465
|
+
expect(only(edl, word(4_800, 5_300)), layoutTransition.type).toEqual({ startMs: 4_800, endMs: 5_300 })
|
|
466
|
+
}
|
|
467
|
+
const segCut = at([
|
|
468
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m" },
|
|
469
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m", transition: { type: "cut" } },
|
|
470
|
+
])
|
|
471
|
+
expect(only(segCut, word(4_800, 5_300))).toEqual({ startMs: 4_800, endMs: 5_300 })
|
|
472
|
+
})
|
|
473
|
+
|
|
474
|
+
it("an overlap INTO the next segment (crossfade, xfade:*) breaks output contiguity: the word is clipped to its first kept part, as before", () => {
|
|
475
|
+
const crossfade = at([
|
|
476
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m" },
|
|
477
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m", transition: { type: "crossfade", durationMs: 400 } },
|
|
478
|
+
])
|
|
479
|
+
expect(only(crossfade, word(4_800, 5_300))).toEqual({ startMs: 4_800, endMs: 5_000 })
|
|
480
|
+
const xfade = at([
|
|
481
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m", layout: { mode: "single" } },
|
|
482
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m", layout: { mode: "single", transition: { type: "xfade:wipe-left", durationMs: 400 } } },
|
|
483
|
+
])
|
|
484
|
+
expect(only(xfade, word(4_800, 5_300))).toEqual({ startMs: 4_800, endMs: 5_000 })
|
|
485
|
+
})
|
|
486
|
+
|
|
487
|
+
it("runs across a chain of touching segments", () => {
|
|
488
|
+
const edl = at([
|
|
489
|
+
{ id: "s0", inMs: 0, outMs: 1_000, video: "m" },
|
|
490
|
+
{ id: "s1", inMs: 1_000, outMs: 2_000, video: "m" },
|
|
491
|
+
{ id: "s2", inMs: 2_000, outMs: 3_000, video: "m" },
|
|
492
|
+
])
|
|
493
|
+
expect(only(edl, word(500, 2_500))).toEqual({ startMs: 500, endMs: 2_500 })
|
|
494
|
+
})
|
|
495
|
+
|
|
496
|
+
it("stops at a real cut: across a touching boundary, then clipped where the master clock jumps", () => {
|
|
497
|
+
const edl = at([
|
|
498
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m" },
|
|
499
|
+
{ id: "s1", inMs: 5_000, outMs: 6_000, video: "m" },
|
|
500
|
+
{ id: "s2", inMs: 8_000, outMs: 12_000, video: "m" },
|
|
501
|
+
])
|
|
502
|
+
expect(only(edl, word(4_800, 8_300))).toEqual({ startMs: 4_800, endMs: 6_000 })
|
|
503
|
+
})
|
|
504
|
+
|
|
505
|
+
it("touching means the NEXT segment in the list: a later segment that happens to resume the master clock does not extend the word", () => {
|
|
506
|
+
const edl = at([
|
|
507
|
+
{ id: "s0", inMs: 5_000, outMs: 8_000, video: "m" },
|
|
508
|
+
{ id: "s1", inMs: 0, outMs: 5_000, video: "m" },
|
|
509
|
+
])
|
|
510
|
+
// The first kept part is in s0 (output 0..3000): 5_000..5_200 → 0..200.
|
|
511
|
+
expect(only(edl, word(4_800, 5_200))).toEqual({ startMs: 0, endMs: 200 })
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
it("applies the source offset before testing the boundary", () => {
|
|
515
|
+
const edl: Edl = {
|
|
516
|
+
version: 1,
|
|
517
|
+
clock: "master",
|
|
518
|
+
sources: [...master, { id: "cam", url: "https://x/c.mp4", kind: "video", offsetMs: 1_000 }],
|
|
519
|
+
segments: [
|
|
520
|
+
{ id: "s0", inMs: 0, outMs: 5_000, video: "m" },
|
|
521
|
+
{ id: "s1", inMs: 5_000, outMs: 9_000, video: "m" },
|
|
522
|
+
],
|
|
523
|
+
}
|
|
524
|
+
expect(only(edl, { ...word(3_800, 4_300), sourceId: "cam" })).toEqual({ startMs: 4_800, endMs: 5_300 })
|
|
303
525
|
})
|
|
304
526
|
})
|
|
305
527
|
|
|
@@ -854,3 +1076,96 @@ describe("validateEdl — warnings (registry class; ok stays true)", () => {
|
|
|
854
1076
|
expect(r.warnings).toEqual([expect.stringMatching(/^clip\[1\]: segment\[1\] "s1": unknown layout mode "carousel"/)])
|
|
855
1077
|
})
|
|
856
1078
|
})
|
|
1079
|
+
|
|
1080
|
+
describe("slots[].follow — what a tracked slot followed (P3-8, decided 2026-10-06)", () => {
|
|
1081
|
+
/** Two cameras, one side-by-side segment whose first slot follows a track. */
|
|
1082
|
+
function followEdl(follow: unknown, slotSource = "camA"): Edl {
|
|
1083
|
+
return {
|
|
1084
|
+
version: 1,
|
|
1085
|
+
clock: "master",
|
|
1086
|
+
sources: [
|
|
1087
|
+
{ id: "mic", url: "m", kind: "audio", role: "master-audio" },
|
|
1088
|
+
{ id: "camA", url: "a", kind: "video" },
|
|
1089
|
+
{ id: "camB", url: "b", kind: "video" },
|
|
1090
|
+
],
|
|
1091
|
+
segments: [
|
|
1092
|
+
{
|
|
1093
|
+
id: "s0",
|
|
1094
|
+
inMs: 0,
|
|
1095
|
+
outMs: 1000,
|
|
1096
|
+
video: "camA",
|
|
1097
|
+
layout: {
|
|
1098
|
+
mode: "side-by-side",
|
|
1099
|
+
slots: [
|
|
1100
|
+
{ source: slotSource, speaker: "Host", region: { x: 0.1, y: 0, w: 0.4, h: 1 }, follow } as never,
|
|
1101
|
+
{ source: "camB", speaker: "Guest" },
|
|
1102
|
+
],
|
|
1103
|
+
},
|
|
1104
|
+
},
|
|
1105
|
+
],
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
it("accepts a follow on the slot's own video source", () => {
|
|
1110
|
+
const r = validateEdl(followEdl({ sourceId: "camA", trackId: "camA/t3", motion: "glide" }))
|
|
1111
|
+
expect(r.issues).toEqual([])
|
|
1112
|
+
expect(r.ok).toBe(true)
|
|
1113
|
+
})
|
|
1114
|
+
|
|
1115
|
+
it("accepts motion static", () => {
|
|
1116
|
+
expect(validateEdl(followEdl({ sourceId: "camA", trackId: "camA/t3", motion: "static" })).ok).toBe(true)
|
|
1117
|
+
})
|
|
1118
|
+
|
|
1119
|
+
it("refuses a follow naming a source other than the slot's — the crop is on the slot's frame", () => {
|
|
1120
|
+
const r = validateEdl(followEdl({ sourceId: "camB", trackId: "camB/t1", motion: "glide" }))
|
|
1121
|
+
expect(r.issues.join("\n")).toMatch(/follow\.sourceId "camB" is not the slot's source "camA"/)
|
|
1122
|
+
})
|
|
1123
|
+
|
|
1124
|
+
it("refuses an empty trackId and an unknown motion", () => {
|
|
1125
|
+
const r = validateEdl(followEdl({ sourceId: "camA", trackId: "", motion: "orbit" }))
|
|
1126
|
+
const text = r.issues.join("\n")
|
|
1127
|
+
expect(text).toMatch(/follow\.trackId is empty/)
|
|
1128
|
+
expect(text).toMatch(/follow\.motion "orbit" is not one of static, glide/)
|
|
1129
|
+
})
|
|
1130
|
+
|
|
1131
|
+
it("normalizeEdl carries a well-formed follow through, unchanged", () => {
|
|
1132
|
+
const follow = { sourceId: "camA", trackId: "camA/t3", motion: "glide" }
|
|
1133
|
+
const n = normalizeEdl(followEdl(follow))
|
|
1134
|
+
expect(n.segments[0].layout?.slots?.[0]).toEqual({ source: "camA", region: { x: 0.1, y: 0, w: 0.4, h: 1 }, speaker: "Host", follow })
|
|
1135
|
+
expect(n.segments[0].layout?.slots?.[1]).toEqual({ source: "camB", speaker: "Guest" })
|
|
1136
|
+
expect(validateEdl(n).ok).toBe(true)
|
|
1137
|
+
})
|
|
1138
|
+
|
|
1139
|
+
it("normalizeEdl drops only unknown keys inside follow", () => {
|
|
1140
|
+
const n = normalizeEdl(followEdl({ sourceId: "camA", trackId: "camA/t3", motion: "static", extra: 1 }))
|
|
1141
|
+
expect(n.segments[0].layout?.slots?.[0]?.follow).toEqual({ sourceId: "camA", trackId: "camA/t3", motion: "static" })
|
|
1142
|
+
})
|
|
1143
|
+
|
|
1144
|
+
it("normalizeEdl drops a malformed follow rather than guessing it — an unknown motion is never coerced", () => {
|
|
1145
|
+
for (const bad of [
|
|
1146
|
+
{ sourceId: "camA", trackId: "camA/t3", motion: "orbit" },
|
|
1147
|
+
{ sourceId: "camA", trackId: "camA/t3" },
|
|
1148
|
+
{ sourceId: "camA", motion: "glide" },
|
|
1149
|
+
{ trackId: "camA/t3", motion: "glide" },
|
|
1150
|
+
{ sourceId: "camA", trackId: "", motion: "glide" },
|
|
1151
|
+
{ sourceId: 3, trackId: "camA/t3", motion: "glide" },
|
|
1152
|
+
"camA/t3",
|
|
1153
|
+
null,
|
|
1154
|
+
]) {
|
|
1155
|
+
const slot = normalizeEdl(followEdl(bad)).segments[0].layout?.slots?.[0]
|
|
1156
|
+
expect(slot, JSON.stringify(bad)).toBeDefined()
|
|
1157
|
+
expect(slot && "follow" in slot, JSON.stringify(bad)).toBe(false)
|
|
1158
|
+
}
|
|
1159
|
+
})
|
|
1160
|
+
|
|
1161
|
+
it("adds types only — no runtime export (keeps the Apache grant minimal, decided 2026-10-09)", () => {
|
|
1162
|
+
const followExports = (m: object) => Object.keys(m).filter((k) => /FOLLOW/i.test(k))
|
|
1163
|
+
expect(followExports(edlModule)).toEqual([])
|
|
1164
|
+
expect(followExports(sharedIndex)).toEqual([])
|
|
1165
|
+
})
|
|
1166
|
+
|
|
1167
|
+
it("a slot without follow normalizes exactly as before (the field is additive)", () => {
|
|
1168
|
+
const n = normalizeEdl(followEdl(undefined))
|
|
1169
|
+
expect(n.segments[0].layout?.slots?.[0]).toEqual({ source: "camA", region: { x: 0.1, y: 0, w: 0.4, h: 1 }, speaker: "Host" })
|
|
1170
|
+
})
|
|
1171
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG } from "../model-catalog.js"
|
|
3
|
+
import {
|
|
4
|
+
IMAGE_MODEL_ROLE_DEFAULTS,
|
|
5
|
+
IMAGE_MODEL_RATIO_FALLBACKS,
|
|
6
|
+
defaultImageModel,
|
|
7
|
+
imageModelDrawsRatio,
|
|
8
|
+
} from "../image-model-roles.js"
|
|
9
|
+
|
|
10
|
+
describe("image model role defaults (decided 2026-10-08)", () => {
|
|
11
|
+
it("pins the decided models", () => {
|
|
12
|
+
expect(IMAGE_MODEL_ROLE_DEFAULTS).toEqual({
|
|
13
|
+
character: "gpt-image-2",
|
|
14
|
+
general: "gpt-image-2",
|
|
15
|
+
anchor: "gpt-image-2",
|
|
16
|
+
edit: "gpt-image-2-5-flare-i2i",
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it("names only catalog models", () => {
|
|
21
|
+
for (const id of [...Object.values(IMAGE_MODEL_ROLE_DEFAULTS), ...Object.values(IMAGE_MODEL_RATIO_FALLBACKS).flat()]) {
|
|
22
|
+
expect(MODEL_CATALOG[id], id).toBeDefined()
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it("never defaults to Nano Banana Pro except as the last ratio fallback", () => {
|
|
27
|
+
expect(Object.values(IMAGE_MODEL_ROLE_DEFAULTS)).not.toContain("nano-banana-pro")
|
|
28
|
+
for (const chain of Object.values(IMAGE_MODEL_RATIO_FALLBACKS)) expect(chain.at(-1)).toBe("nano-banana-pro")
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("keeps the role model for ratios it draws, and for no ratio", () => {
|
|
32
|
+
for (const r of [undefined, null, "", "auto", "1:1", "16:9", "9:16", "4:3", "3:4"]) {
|
|
33
|
+
expect(defaultImageModel("general", r)).toBe("gpt-image-2")
|
|
34
|
+
}
|
|
35
|
+
expect(defaultImageModel("edit", "16:9")).toBe("gpt-image-2-5-flare-i2i")
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("moves wide and in-between ratios to Sunburst, and 4:5 / 5:4 to Nano Banana Pro", () => {
|
|
39
|
+
for (const r of ["21:9", "3:2", "2:3", "27:16", "9:8"]) {
|
|
40
|
+
expect(defaultImageModel("character", r)).toBe("gpt-image-2-5-sunburst")
|
|
41
|
+
expect(defaultImageModel("anchor", r)).toBe("gpt-image-2-5-sunburst")
|
|
42
|
+
}
|
|
43
|
+
for (const r of ["4:5", "5:4"]) {
|
|
44
|
+
expect(defaultImageModel("general", r)).toBe("nano-banana-pro")
|
|
45
|
+
expect(defaultImageModel("edit", r)).toBe("nano-banana-pro")
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it("falls back to the role model when nothing draws the ratio", () => {
|
|
50
|
+
expect(defaultImageModel("general", "7:1")).toBe("gpt-image-2")
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it("reads ratios from the catalog", () => {
|
|
54
|
+
expect(imageModelDrawsRatio("gpt-image-2", "21:9")).toBe(false)
|
|
55
|
+
expect(imageModelDrawsRatio("gpt-image-2-5-sunburst", "21:9")).toBe(true)
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -17,6 +17,7 @@ describe("imageReferenceLimit", () => {
|
|
|
17
17
|
"gpt-image-2": 16, // → gpt-image-2-i2i
|
|
18
18
|
"seedream-5-lite": 16, // → seedream-5-lite-i2i
|
|
19
19
|
"seedream-5-pro": 16, // → seedream-5-pro-i2i
|
|
20
|
+
"seedream-5-flash": 10, // → seedream-5-flash-i2i (schema maxItems 10, not the family's 16)
|
|
20
21
|
"nano-banana-2": 4,
|
|
21
22
|
"nano-banana-2-lite": 10, // schema maxItems (image_urls)
|
|
22
23
|
flux: 4, // → flux-pro-i2i
|
|
@@ -156,9 +156,19 @@ describe("declaredJsonOutput — every JSON pip is classified (decided 2026-10-0
|
|
|
156
156
|
expect(jsonKindMismatch("silence-detect", "json", "apply-edl", "edl")).toBeNull()
|
|
157
157
|
})
|
|
158
158
|
|
|
159
|
-
it("answers a render's json from the registry and nothing else on a render", () => {
|
|
159
|
+
it("answers a render's json and transcript pips from the registry and nothing else on a render", () => {
|
|
160
160
|
expect(declaredJsonOutput("speaker-view", "json")).toBe("edl")
|
|
161
161
|
expect(declaredJsonOutput("speaker-view", "video")).toBeUndefined()
|
|
162
|
+
// Speaker View's second output (decided 2026-10-08): the remapped transcript
|
|
163
|
+
expect(declaredJsonOutput("speaker-view", "transcript")).toBe("transcript")
|
|
164
|
+
expect(declaredJsonOutput("apply-edl", "transcript")).toBeUndefined()
|
|
165
|
+
expect(declaredJsonOutput("apply-edl", "media")).toBeUndefined()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it("Speaker View's transcript feeds a Transcript input and is blocked from an EDL input; its json the reverse", () => {
|
|
169
|
+
expect(jsonKindMismatch("speaker-view", "transcript", "add-captions", "transcript")).toBeNull()
|
|
170
|
+
expect(jsonKindMismatch("speaker-view", "transcript", "apply-edl", "edl")).toEqual({ output: "transcript", input: "edl" })
|
|
171
|
+
expect(jsonKindMismatch("speaker-view", "json", "add-captions", "transcript")).toEqual({ output: "edl", input: "transcript" })
|
|
162
172
|
})
|
|
163
173
|
|
|
164
174
|
it("is undefined for anything undeclared, and never reads inherited keys", () => {
|