@nodaro/shared 3.24.0 → 3.26.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.
Files changed (50) hide show
  1. package/dist/index.cjs +1086 -257
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +531 -97
  4. package/dist/index.d.ts +531 -97
  5. package/dist/index.js +1034 -258
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/condition-variables.test.ts +12 -0
  9. package/src/__tests__/content-recipe-ideas.test.ts +9 -4
  10. package/src/__tests__/credit-identifiers.test.ts +31 -6
  11. package/src/__tests__/dialogue-capabilities.test.ts +3 -2
  12. package/src/__tests__/edit-plan-minute-ids.test.ts +82 -0
  13. package/src/__tests__/image-model-roles.test.ts +57 -0
  14. package/src/__tests__/image-ref-limit.test.ts +1 -0
  15. package/src/__tests__/json-kinds.test.ts +179 -0
  16. package/src/__tests__/llm-models.test.ts +136 -37
  17. package/src/__tests__/lone-media-url.test.ts +78 -0
  18. package/src/__tests__/presentation-utils.test.ts +1 -0
  19. package/src/__tests__/preview-gate.test.ts +2 -2
  20. package/src/__tests__/pricing-default-duration.test.ts +56 -15
  21. package/src/__tests__/private-host.test.ts +24 -0
  22. package/src/__tests__/prompt-length-limits.test.ts +2 -0
  23. package/src/__tests__/render-nodes.test.ts +22 -3
  24. package/src/__tests__/tts-capabilities.test.ts +61 -1
  25. package/src/__tests__/video-link-input.test.ts +148 -0
  26. package/src/__tests__/video-link-needs.test.ts +67 -0
  27. package/src/__tests__/video-request-normalize.test.ts +18 -3
  28. package/src/condition-variables.ts +3 -1
  29. package/src/content-recipe-ideas.ts +5 -2
  30. package/src/credit-identifiers.ts +48 -37
  31. package/src/edit-plan-contract.ts +67 -1
  32. package/src/fan-out-rows.ts +2 -2
  33. package/src/image-model-roles.ts +62 -0
  34. package/src/index.ts +59 -1
  35. package/src/json-kinds.ts +188 -0
  36. package/src/llm-models.ts +348 -23
  37. package/src/lone-media-url.ts +57 -0
  38. package/src/model-catalog.ts +160 -13
  39. package/src/model-constants.ts +79 -43
  40. package/src/node-default-mappings.ts +4 -0
  41. package/src/pipeline-types.ts +13 -2
  42. package/src/presentation-utils.ts +8 -1
  43. package/src/private-host.ts +91 -0
  44. package/src/producer-types.ts +3 -0
  45. package/src/render-nodes.ts +12 -1
  46. package/src/scene-node-types.ts +17 -5
  47. package/src/settings-input.ts +2 -1
  48. package/src/social-post-readers.ts +37 -0
  49. package/src/video-link.ts +238 -0
  50. package/src/voices.ts +16 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodaro/shared",
3
- "version": "3.24.0",
3
+ "version": "3.26.0",
4
4
  "description": "Shared types, model catalog, wire contracts, and structural vocabularies for the Nodaro platform and SDK.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -87,6 +87,18 @@ describe("buildConditionVariables", () => {
87
87
  expect(map.has("Missing")).toBe(false)
88
88
  })
89
89
 
90
+ it("trims the surrounding whitespace of a variable — a model's answer ends with a newline", () => {
91
+ // A Generate Text answer ("<id>\n") wired to Variables must still EQUAL the
92
+ // field it is compared with; the newline is the model's, not the value's.
93
+ const answer = node("a", "llm-chat", "Pick", { text: " 11111111-1111-4111-8111-111111111111\n" })
94
+ const blank = node("b", "llm-chat", "Blank", { text: " \n " })
95
+ const filter = node("f", "filter-list", "Filter")
96
+ const edges: E[] = [edge("a", "f", "variables", "text"), edge("b", "f", "variables", "text")]
97
+ const map = buildConditionVariables("f", edges, [answer, blank, filter], extract)
98
+ expect(map.get("Pick")).toBe("11111111-1111-4111-8111-111111111111")
99
+ expect(map.has("Blank")).toBe(false)
100
+ })
101
+
90
102
  it("ignores edges targeting other nodes", () => {
91
103
  const tp = node("a", "text-prompt", "Ref", { text: "x" })
92
104
  const other = node("o", "filter-list", "Other")
@@ -34,8 +34,11 @@ describe("content recipe / ideas pricing", () => {
34
34
  expect(contentIdeasCreditId(6, "claude-sonnet-4.6")).toBe("content-ideas:10")
35
35
  expect(contentIdeasCreditId(10)).toBe("content-ideas:10:economy")
36
36
  expect(contentIdeasCreditId(10, "claude-opus-5")).toBe("content-ideas:10:premium")
37
- // an xhigh/max effort bumps one tier, as for every LLM node
38
- expect(contentIdeasCreditId(3, "claude-sonnet-4.6", "max")).toBe("content-ideas:premium")
37
+ // an xhigh/max effort bumps one tier, as for every LLM node — and on a
38
+ // Claude model any effort also runs direct (+1 rung, decided 2026-10-08):
39
+ // sonnet-4.6 tops out at `max`, so standard → premium → premium-direct.
40
+ expect(contentIdeasCreditId(3, "claude-sonnet-4.6", "max")).toBe("content-ideas:premium-direct")
41
+ expect(contentIdeasCreditId(3, "gpt-5.6-terra", "max")).toBe("content-ideas:premium")
39
42
  })
40
43
 
41
44
  it("count: numbers only, clamped to 1..10", () => {
@@ -49,8 +52,10 @@ describe("content recipe / ideas pricing", () => {
49
52
  it("every id a run can bill is listed", () => {
50
53
  const reachable = new Set<string>()
51
54
  for (const model of [undefined, "claude-sonnet-4.6", "claude-opus-5"]) {
52
- reachable.add(contentRecipeCreditId(model))
53
- for (const count of [1, 5, 6, 10]) reachable.add(contentIdeasCreditId(count, model))
55
+ for (const effort of [undefined, "high"]) {
56
+ reachable.add(contentRecipeCreditId(model, effort))
57
+ for (const count of [1, 5, 6, 10]) reachable.add(contentIdeasCreditId(count, model, effort))
58
+ }
54
59
  }
55
60
  expect([...reachable].sort()).toEqual([...CONTENT_RECIPE_IDEAS_CREDIT_IDS].sort())
56
61
  })
@@ -105,6 +105,27 @@ describe("buildCreditModelIdentifier", () => {
105
105
  })
106
106
  })
107
107
 
108
+ // --- nano-banana-2-1 ---
109
+ describe("nano-banana-2-1", () => {
110
+ it("2K and 4K return composite identifiers; 1K is the bare id", () => {
111
+ expect(buildCreditModelIdentifier("nano-banana-2-1", undefined, "2K")).toBe("nano-banana-2-1:2K")
112
+ expect(buildCreditModelIdentifier("nano-banana-2-1", undefined, "4K")).toBe("nano-banana-2-1:4K")
113
+ expect(buildCreditModelIdentifier("nano-banana-2-1", undefined, "1K")).toBe("nano-banana-2-1")
114
+ })
115
+ })
116
+
117
+ // --- seedream-5-flash ---
118
+ describe("seedream-5-flash", () => {
119
+ it("is flat-priced: every size and a stray quality bill the bare id", () => {
120
+ for (const provider of ["seedream-5-flash", "seedream-5-flash-i2i"]) {
121
+ for (const resolution of [undefined, "1K", "2K"]) {
122
+ expect(buildCreditModelIdentifier(provider, undefined, resolution)).toBe(provider)
123
+ expect(buildCreditModelIdentifier(provider, "high", resolution)).toBe(provider)
124
+ }
125
+ }
126
+ })
127
+ })
128
+
108
129
  // --- topaz-image-upscale ---
109
130
  describe("topaz-image-upscale", () => {
110
131
  it('targetResolution="4K" returns composite identifier', () => {
@@ -509,16 +530,20 @@ describe("buildVideoCreditModelIdentifier", () => {
509
530
  expect(buildVideoCreditModelIdentifier("seedance", 8)).toBe("seedance:8s")
510
531
  })
511
532
 
512
- it("6s falls into 8s tier", () => {
513
- expect(buildVideoCreditModelIdentifier("seedance", 6)).toBe("seedance:8s")
533
+ it("6s is charged as the 4s the runner renders (nearest offered length, a tie goes shorter)", () => {
534
+ expect(buildVideoCreditModelIdentifier("seedance", 6)).toBe("seedance:4s")
514
535
  })
515
536
 
516
537
  it("12s -> :12s", () => {
517
538
  expect(buildVideoCreditModelIdentifier("seedance", 12)).toBe("seedance:12s")
518
539
  })
519
540
 
520
- it("10s falls into 12s tier", () => {
521
- expect(buildVideoCreditModelIdentifier("seedance", 10)).toBe("seedance:12s")
541
+ it("10s is charged as the 8s the runner renders (nearest offered length)", () => {
542
+ expect(buildVideoCreditModelIdentifier("seedance", 10)).toBe("seedance:8s")
543
+ })
544
+
545
+ it("11s is charged as the 12s the runner renders", () => {
546
+ expect(buildVideoCreditModelIdentifier("seedance", 11)).toBe("seedance:12s")
522
547
  })
523
548
 
524
549
  it("exceeding max clamps to 12s", () => {
@@ -560,8 +585,8 @@ describe("buildVideoCreditModelIdentifier", () => {
560
585
  expect(buildVideoCreditModelIdentifier("grok-i2v", 6)).toBe("grok-i2v:6s")
561
586
  })
562
587
 
563
- it("grok-i2v 15s", () => {
564
- expect(buildVideoCreditModelIdentifier("grok-i2v", 15)).toBe("grok-i2v:15s")
588
+ it("grok-i2v 15s is charged as the 10s clip it renders (it offers 6s and 10s only)", () => {
589
+ expect(buildVideoCreditModelIdentifier("grok-i2v", 15)).toBe("grok-i2v:10s")
565
590
  })
566
591
  })
567
592
 
@@ -119,8 +119,9 @@ describe("elevenlabs-dialogue-v4 — added beside v3 dialogue", () => {
119
119
  expect(c.levers).toEqual(["stability", "similarity"])
120
120
  expect(c.stabilitySteps).toBeUndefined()
121
121
  expect(c.languageCode).toBe(true)
122
- // The live-probe number (parity with v3 dialogue until the probe says otherwise); never above 5,000 here.
123
- expect(c.maxChars).toBe(5000)
122
+ // The live-probe number: a 10,000-character v4 dialogue voiced whole in 130 s (measured 2026-10-06).
123
+ expect(c.maxChars).toBe(10000)
124
+ expect(getDialogueCapabilities("elevenlabs-dialogue").maxChars).toBe(5000) // v3 dialogue did not move
124
125
  expect(c.languages).toEqual(getDialogueCapabilities("elevenlabs-dialogue").languages)
125
126
  })
126
127
 
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Edit Plan per started minute (decided 2026-10-07): the id a run reserves is
3
+ * `edit-plan:<mode>:<tier>:<N>m`, N = the started minutes of the source, priced
4
+ * flat + rate × N from one rate row and one flat row per mode × tier. The step
5
+ * ids (15/30/60/90/120/180) keep the same shape, so one parser reads both.
6
+ */
7
+ import { describe, it, expect } from "vitest"
8
+ import {
9
+ EDIT_PLAN_MAX_MINUTES,
10
+ buildEditPlanCreditId,
11
+ editPlanFlatCreditId,
12
+ editPlanMinutesBaseCredits,
13
+ editPlanRateCreditId,
14
+ editPlanReserveCreditId,
15
+ editPlanStartedMinutes,
16
+ parseEditPlanMinutesCreditId,
17
+ } from "../edit-plan-contract.js"
18
+
19
+ describe("started minutes", () => {
20
+ it.each([
21
+ [1, 1],
22
+ [60, 1],
23
+ [61, 2],
24
+ [44 * 60 + 1, 45],
25
+ [180 * 60, 180],
26
+ [500 * 60, EDIT_PLAN_MAX_MINUTES],
27
+ [0, 1],
28
+ ])("%s s → %s", (sec, minutes) => {
29
+ expect(editPlanStartedMinutes(sec)).toBe(minutes)
30
+ })
31
+
32
+ it("an unknown length is the maximum", () => {
33
+ expect(editPlanStartedMinutes(undefined)).toBe(180)
34
+ expect(editPlanStartedMinutes(Number.NaN)).toBe(180)
35
+ })
36
+ })
37
+
38
+ describe("the reserve id", () => {
39
+ it("per started minute when the plugin charges that way", () => {
40
+ expect(editPlanReserveCreditId("tighten", "standard", 44 * 60 + 1, true)).toBe("edit-plan:tighten:standard:45m")
41
+ })
42
+
43
+ it("the step otherwise, exactly as before", () => {
44
+ expect(editPlanReserveCreditId("tighten", "standard", 44 * 60 + 1, false)).toBe(buildEditPlanCreditId("tighten", "standard", 44 * 60 + 1))
45
+ expect(editPlanReserveCreditId("tighten", "standard", 44 * 60 + 1, false)).toBe("edit-plan:tighten:standard:60m")
46
+ })
47
+
48
+ it("an unknown length reserves the 180-minute maximum either way", () => {
49
+ expect(editPlanReserveCreditId("clips", "premium", undefined, true)).toBe("edit-plan:clips:premium:180m")
50
+ expect(editPlanReserveCreditId("clips", "premium", undefined, false)).toBe("edit-plan:clips:premium:180m")
51
+ })
52
+ })
53
+
54
+ describe("the price rows", () => {
55
+ it("one rate row and one flat row per mode × tier, neither a minutes id", () => {
56
+ expect(editPlanRateCreditId("trailer", "economy")).toBe("edit-plan:trailer:economy:per-minute")
57
+ expect(editPlanFlatCreditId("trailer", "economy")).toBe("edit-plan:trailer:economy:flat")
58
+ expect(parseEditPlanMinutesCreditId(editPlanRateCreditId("trailer", "economy"))).toBeUndefined()
59
+ expect(parseEditPlanMinutesCreditId(editPlanFlatCreditId("trailer", "economy"))).toBeUndefined()
60
+ })
61
+
62
+ it("flat + rate × N, rounded up, at least 1", () => {
63
+ expect(editPlanMinutesBaseCredits(20, 4, 45)).toBe(200)
64
+ expect(editPlanMinutesBaseCredits(0, 2, 1)).toBe(2)
65
+ expect(editPlanMinutesBaseCredits(0, 0, 1)).toBe(1)
66
+ expect(editPlanMinutesBaseCredits(0, 0.5, 3)).toBe(2)
67
+ })
68
+ })
69
+
70
+ describe("parsing a minutes id", () => {
71
+ it("reads a started-minute id and a step id alike", () => {
72
+ expect(parseEditPlanMinutesCreditId("edit-plan:tighten:standard:45m")).toEqual({ mode: "tighten", tier: "standard", minutes: 45 })
73
+ expect(parseEditPlanMinutesCreditId("edit-plan:trailer:premium:180m")).toEqual({ mode: "trailer", tier: "premium", minutes: 180 })
74
+ })
75
+
76
+ it.each(["edit-plan", "edit-plan:tighten:standard:0m", "edit-plan:tighten:standard:181m", "edit-plan:cut:standard:5m", "edit-plan:tighten:gold:5m", "apply-edl"])(
77
+ "refuses %s",
78
+ (id) => {
79
+ expect(parseEditPlanMinutesCreditId(id)).toBeUndefined()
80
+ },
81
+ )
82
+ })
@@ -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
@@ -0,0 +1,179 @@
1
+ import { describe, it, expect } from "vitest"
2
+ // Through the package index: the shared handle typing both canvas validators
3
+ // and the server's edge normalization read (decided 2026-10-07).
4
+ import {
5
+ RENDER_NODE_TYPES,
6
+ jsonInputKind,
7
+ jsonKindMismatch,
8
+ jsonKindMismatchMessage,
9
+ jsonOutputKind,
10
+ declaredJsonOutput,
11
+ declaredJsonOutputRows,
12
+ type RenderNodeDescriptor,
13
+ } from "../index.js"
14
+
15
+ describe("jsonOutputKind — what a json output carries", () => {
16
+ it("Edit Plan's edl and Camera Switch's edl are EDLs; Camera Switch's transcript is a Transcript", () => {
17
+ expect(jsonOutputKind("edit-plan", "edl")).toBe("edl")
18
+ expect(jsonOutputKind("camera-switch", "edl")).toBe("edl")
19
+ expect(jsonOutputKind("camera-switch", "transcript")).toBe("transcript")
20
+ })
21
+
22
+ it("a Transcribe's json is a Transcript (decided 2026-10-08), its text is not a kind", () => {
23
+ expect(jsonOutputKind("transcribe", "json")).toBe("transcript")
24
+ expect(jsonOutputKind("transcribe", undefined)).toBe("transcript")
25
+ expect(jsonOutputKind("transcribe", "text")).toBeUndefined()
26
+ })
27
+
28
+ it("reads a render's json pip from the render registry (jsonKind), never a node-name list", () => {
29
+ expect(jsonOutputKind("apply-edl", "json")).toBe("transcript")
30
+ // a render registered later with an EDL-emitting json (Speaker View)
31
+ const speakerLike = { ...RENDER_NODE_TYPES["apply-edl"]!, jsonKind: "edl" } as RenderNodeDescriptor
32
+ expect(jsonOutputKind("speaker-view", "json", { "speaker-view": speakerLike })).toBe("edl")
33
+ expect(jsonOutputKind("speaker-view", undefined, { "speaker-view": speakerLike })).toBe("edl")
34
+ })
35
+
36
+ it("every registered render's json pip answers its own jsonKind", () => {
37
+ for (const [type, d] of Object.entries(RENDER_NODE_TYPES)) {
38
+ expect(jsonOutputKind(type, "json")).toBe(d.jsonKind)
39
+ }
40
+ })
41
+
42
+ it("an edge with no sourceHandle reads the node's primary pip", () => {
43
+ expect(jsonOutputKind("edit-plan", undefined)).toBe("edl")
44
+ expect(jsonOutputKind("camera-switch", null)).toBe("edl")
45
+ expect(jsonOutputKind("apply-edl", undefined)).toBe("transcript")
46
+ })
47
+
48
+ it("is undefined for anything it does not know", () => {
49
+ expect(jsonOutputKind("transcribe", "text")).toBeUndefined()
50
+ expect(jsonOutputKind("edit-plan", "nope")).toBeUndefined()
51
+ expect(jsonOutputKind("constructor", "json")).toBeUndefined()
52
+ expect(jsonOutputKind(undefined, "json")).toBeUndefined()
53
+ })
54
+ })
55
+
56
+ describe("jsonInputKind — what a json input expects", () => {
57
+ it("a `transcript` input expects a Transcript, an `edl` input an EDL", () => {
58
+ expect(jsonInputKind("add-captions", "transcript")).toBe("transcript")
59
+ expect(jsonInputKind("apply-edl", "transcript")).toBe("transcript")
60
+ expect(jsonInputKind("camera-switch", "transcript")).toBe("transcript")
61
+ expect(jsonInputKind("edit-plan", "transcript")).toBe("transcript")
62
+ expect(jsonInputKind("apply-edl", "edl")).toBe("edl")
63
+ })
64
+
65
+ it("is undefined for every other input", () => {
66
+ expect(jsonInputKind("add-captions", "in")).toBeUndefined()
67
+ expect(jsonInputKind("add-captions", "captionPlan")).toBeUndefined()
68
+ expect(jsonInputKind("edit-plan", "silence")).toBeUndefined()
69
+ expect(jsonInputKind("add-captions", undefined)).toBeUndefined()
70
+ })
71
+ })
72
+
73
+ describe("jsonKindMismatch — an EDL is not a transcript", () => {
74
+ it("blocks every EDL output into a Transcript input", () => {
75
+ for (const [src, srcHandle] of [["edit-plan", "edl"], ["camera-switch", "edl"]] as const) {
76
+ for (const [tgt, tgtHandle] of [["add-captions", "transcript"], ["apply-edl", "transcript"], ["camera-switch", "transcript"], ["edit-plan", "transcript"]] as const) {
77
+ expect(jsonKindMismatch(src, srcHandle, tgt, tgtHandle), `${src}.${srcHandle} -> ${tgt}.${tgtHandle}`).toEqual({ output: "edl", input: "transcript" })
78
+ }
79
+ }
80
+ })
81
+
82
+ it("still lets a Transcript into a Transcript input, and an EDL into an EDL input", () => {
83
+ expect(jsonKindMismatch("camera-switch", "transcript", "add-captions", "transcript")).toBeNull()
84
+ expect(jsonKindMismatch("apply-edl", "json", "add-captions", "transcript")).toBeNull()
85
+ expect(jsonKindMismatch("edit-plan", "edl", "apply-edl", "edl")).toBeNull()
86
+ expect(jsonKindMismatch("camera-switch", "edl", "camera-switch", "edl")).toBeNull()
87
+ })
88
+
89
+ it("judges only what it can tell: an unknown source, a bare source handle, or another input is left alone", () => {
90
+ expect(jsonKindMismatch("web-scrape", "json", "add-captions", "transcript")).toBeNull()
91
+ expect(jsonKindMismatch("web-scrape", "json", "apply-edl", "edl")).toBeNull()
92
+ expect(jsonKindMismatch("transcribe", "text", "apply-edl", "edl")).toBeNull()
93
+ expect(jsonKindMismatch("transcribe", "json", "apply-edl", "sources")).toBeNull()
94
+ expect(jsonKindMismatch("edit-plan", "edl", "add-captions", "captionPlan")).toBeNull()
95
+ expect(jsonKindMismatch("edit-plan", "edl", "add-captions", "in")).toBeNull()
96
+ expect(jsonKindMismatch("edit-plan", "edl", "add-captions", undefined)).toBeNull()
97
+ })
98
+
99
+ it("blocks every Transcript output into an EDL input (decided 2026-10-08), from the same table", () => {
100
+ for (const [src, srcHandle] of [["transcribe", "json"], ["camera-switch", "transcript"], ["apply-edl", "json"]] as const) {
101
+ for (const [tgt, tgtHandle] of [["apply-edl", "edl"], ["camera-switch", "edl"]] as const) {
102
+ expect(jsonKindMismatch(src, srcHandle, tgt, tgtHandle), `${src}.${srcHandle} -> ${tgt}.${tgtHandle}`).toEqual({ output: "transcript", input: "edl" })
103
+ }
104
+ }
105
+ })
106
+
107
+ it("a Transcript-emitting render's json is blocked from an EDL input too (registry-driven)", () => {
108
+ const d = { ...RENDER_NODE_TYPES["apply-edl"]!, jsonKind: "transcript" } as RenderNodeDescriptor
109
+ expect(jsonKindMismatch("r", "json", "apply-edl", "edl", { r: d })).toEqual({ output: "transcript", input: "edl" })
110
+ })
111
+
112
+ it("an EDL-emitting render's json is blocked from a Transcript input too", () => {
113
+ const speakerLike = { ...RENDER_NODE_TYPES["apply-edl"]!, jsonKind: "edl" } as RenderNodeDescriptor
114
+ expect(jsonKindMismatch("speaker-view", "json", "add-captions", "transcript", { "speaker-view": speakerLike })).toEqual({ output: "edl", input: "transcript" })
115
+ })
116
+
117
+ it("says what to do instead, naming both nodes", () => {
118
+ const m = jsonKindMismatch("edit-plan", "edl", "add-captions", "transcript")!
119
+ const msg = jsonKindMismatchMessage(m, { sourceLabel: "Edit Plan", targetLabel: "Add Captions" })
120
+ expect(msg).toContain("Edit Plan")
121
+ expect(msg).toContain("Add Captions")
122
+ expect(msg).toMatch(/edit list|EDL/)
123
+ expect(msg).toMatch(/not a transcript/i)
124
+ expect(msg).toMatch(/Transcribe/)
125
+ })
126
+
127
+ it("the reverse direction says so: a transcript is not an edit list, and points at an EDL source", () => {
128
+ const m = jsonKindMismatch("transcribe", "json", "apply-edl", "edl")!
129
+ const msg = jsonKindMismatchMessage(m, { sourceLabel: "Transcribe", targetLabel: "Apply EDL" })
130
+ expect(msg).toContain("Transcribe")
131
+ expect(msg).toContain("Apply EDL")
132
+ expect(msg).toMatch(/outputs a transcript/i)
133
+ expect(msg).toMatch(/not an edit list/i)
134
+ expect(msg).toMatch(/EDL input/)
135
+ expect(msg).toMatch(/Edit Plan/)
136
+ expect(msg).not.toMatch(/not a transcript/i)
137
+ })
138
+ })
139
+
140
+ describe("declaredJsonOutput — every JSON pip is classified (decided 2026-10-08)", () => {
141
+ it("a Text to Dialogue's json is a Transcript, so the EDL block covers it; its default read is the audio", () => {
142
+ expect(declaredJsonOutput("text-to-dialogue", "json")).toBe("transcript")
143
+ expect(jsonOutputKind("text-to-dialogue", "json")).toBe("transcript")
144
+ expect(declaredJsonOutput("text-to-dialogue", undefined)).toBeUndefined()
145
+ expect(declaredJsonOutput("text-to-dialogue", "audio")).toBeUndefined()
146
+ expect(jsonKindMismatch("text-to-dialogue", "json", "apply-edl", "edl")).toEqual({ output: "transcript", input: "edl" })
147
+ expect(jsonKindMismatch("text-to-dialogue", "json", "add-captions", "transcript")).toBeNull()
148
+ })
149
+
150
+ it("`other` is a recorded classification, not a kind: it blocks nothing", () => {
151
+ expect(declaredJsonOutput("web-scrape", "json")).toBe("other")
152
+ expect(declaredJsonOutput("forced-alignment", "data")).toBe("other")
153
+ expect(declaredJsonOutput("describe-to-picker", "picker-json")).toBe("other")
154
+ expect(jsonOutputKind("web-scrape", "json")).toBeUndefined()
155
+ expect(jsonKindMismatch("video-analysis", "json", "add-captions", "transcript")).toBeNull()
156
+ expect(jsonKindMismatch("silence-detect", "json", "apply-edl", "edl")).toBeNull()
157
+ })
158
+
159
+ it("answers a render's json from the registry and nothing else on a render", () => {
160
+ expect(declaredJsonOutput("speaker-view", "json")).toBe("edl")
161
+ expect(declaredJsonOutput("speaker-view", "video")).toBeUndefined()
162
+ })
163
+
164
+ it("is undefined for anything undeclared, and never reads inherited keys", () => {
165
+ expect(declaredJsonOutput("generate-image", "json")).toBeUndefined()
166
+ expect(declaredJsonOutput("constructor", "json")).toBeUndefined()
167
+ expect(declaredJsonOutput("web-scrape", "constructor")).toBeUndefined()
168
+ expect(declaredJsonOutput(undefined, "json")).toBeUndefined()
169
+ })
170
+
171
+ it("lists its rows, each declaring one of the three classifications", () => {
172
+ const rows = declaredJsonOutputRows()
173
+ expect(rows.length).toBeGreaterThan(0)
174
+ for (const [type, pip, kind] of rows) {
175
+ expect(["transcript", "edl", "other"], `${type}.${pip}`).toContain(kind)
176
+ expect(declaredJsonOutput(type, pip)).toBe(kind)
177
+ }
178
+ })
179
+ })