@sundownreel/mcp 0.0.0-stage → 0.1.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 (171) hide show
  1. package/README.md +65 -2
  2. package/brand.json +29 -0
  3. package/chunks/chunk-ONI7QK5B.mjs +63 -0
  4. package/chunks/chunk-YUE6XWVB.mjs +2 -0
  5. package/dsl/index.mjs +2 -0
  6. package/dsl/semantic.mjs +5 -0
  7. package/dsl/types.ts +240 -0
  8. package/engine/fonts/ArchivoBlack.ttf +0 -0
  9. package/engine/fonts/Caveat-Bold.ttf +0 -0
  10. package/engine-geo/data-manifest.json +460 -0
  11. package/engine-remotion/public/music/README.md +6 -0
  12. package/engine-remotion/public/music/bed-curious.mp3 +0 -0
  13. package/engine-remotion/public/music/bed-explainer.mp3 +0 -0
  14. package/engine-remotion/public/music/bed-reflective.mp3 +0 -0
  15. package/engine-remotion/public/music/bed-tense.mp3 +0 -0
  16. package/engine-remotion/public/music/bed-upbeat.mp3 +0 -0
  17. package/engine-remotion/public/music/music-index.json +52 -0
  18. package/engine-remotion/public/sfx/README.md +6 -0
  19. package/engine-remotion/public/sfx/alarm-buzz.mp3 +0 -0
  20. package/engine-remotion/public/sfx/beep-happy.mp3 +0 -0
  21. package/engine-remotion/public/sfx/boing-small.mp3 +0 -0
  22. package/engine-remotion/public/sfx/cash-register.mp3 +0 -0
  23. package/engine-remotion/public/sfx/chart-draw.mp3 +0 -0
  24. package/engine-remotion/public/sfx/click-key.mp3 +0 -0
  25. package/engine-remotion/public/sfx/click-sharp.mp3 +0 -0
  26. package/engine-remotion/public/sfx/click-switch.mp3 +0 -0
  27. package/engine-remotion/public/sfx/cloth-swish.mp3 +0 -0
  28. package/engine-remotion/public/sfx/counter-tick.mp3 +0 -0
  29. package/engine-remotion/public/sfx/ding.mp3 +0 -0
  30. package/engine-remotion/public/sfx/error-beep.mp3 +0 -0
  31. package/engine-remotion/public/sfx/glass-ping.mp3 +0 -0
  32. package/engine-remotion/public/sfx/glass-tick.mp3 +0 -0
  33. package/engine-remotion/public/sfx/impact-light.mp3 +0 -0
  34. package/engine-remotion/public/sfx/impact-punch.mp3 +0 -0
  35. package/engine-remotion/public/sfx/impact-soft.mp3 +0 -0
  36. package/engine-remotion/public/sfx/impact-thud.mp3 +0 -0
  37. package/engine-remotion/public/sfx/impact-tin.mp3 +0 -0
  38. package/engine-remotion/public/sfx/impact-wood.mp3 +0 -0
  39. package/engine-remotion/public/sfx/office-ambience-1.mp3 +0 -0
  40. package/engine-remotion/public/sfx/paper-feed.mp3 +0 -0
  41. package/engine-remotion/public/sfx/paper-rustle.mp3 +0 -0
  42. package/engine-remotion/public/sfx/paper-slide.mp3 +0 -0
  43. package/engine-remotion/public/sfx/paper-tear.mp3 +0 -0
  44. package/engine-remotion/public/sfx/pencil-scratch.mp3 +0 -0
  45. package/engine-remotion/public/sfx/pop-drop.mp3 +0 -0
  46. package/engine-remotion/public/sfx/pop-pluck.mp3 +0 -0
  47. package/engine-remotion/public/sfx/pop.mp3 +0 -0
  48. package/engine-remotion/public/sfx/printer-chatter.mp3 +0 -0
  49. package/engine-remotion/public/sfx/receipt-tick.mp3 +0 -0
  50. package/engine-remotion/public/sfx/room-tone.mp3 +0 -0
  51. package/engine-remotion/public/sfx/sfx-index.json +322 -0
  52. package/engine-remotion/public/sfx/slide-whoosh.mp3 +0 -0
  53. package/engine-remotion/public/sfx/stamp-thud.mp3 +0 -0
  54. package/engine-remotion/public/sfx/stinger-8bit.mp3 +0 -0
  55. package/engine-remotion/public/sfx/stinger-hit.mp3 +0 -0
  56. package/engine-remotion/public/sfx/stinger-pizzi.mp3 +0 -0
  57. package/engine-remotion/public/sfx/stinger-sax.mp3 +0 -0
  58. package/engine-remotion/public/sfx/stinger-steel.mp3 +0 -0
  59. package/engine-remotion/public/sfx/sweat-drop.mp3 +0 -0
  60. package/engine-remotion/public/sfx/swipe.mp3 +0 -0
  61. package/engine-remotion/public/sfx/tick-crisp.mp3 +0 -0
  62. package/engine-remotion/public/sfx/tick-soft.mp3 +0 -0
  63. package/engine-remotion/public/sfx/type-click.mp3 +0 -0
  64. package/engine-remotion/public/sfx/typewriter-soft.mp3 +0 -0
  65. package/engine-remotion/public/sfx/ui-confirm.mp3 +0 -0
  66. package/engine-remotion/public/sfx/wheel-roll.mp3 +0 -0
  67. package/engine-remotion/public/sfx/whoosh-rise.mp3 +0 -0
  68. package/engine-remotion/public/sfx/whoosh-ui-rise.mp3 +0 -0
  69. package/engine-remotion/public/sfx/whoosh.mp3 +0 -0
  70. package/library/music/bed.wav +0 -0
  71. package/library/sfx/thud.wav +0 -0
  72. package/library/sfx/tick.wav +0 -0
  73. package/library/sfx/whoosh.wav +0 -0
  74. package/package.json +38 -4
  75. package/pipeline/scripts/master_audio.sh +12 -0
  76. package/prompts/engine-engineer.md +26 -0
  77. package/prompts/fact-checker.md +22 -0
  78. package/prompts/idea-scout.md +21 -0
  79. package/prompts/library-artist.md +15 -0
  80. package/prompts/qa.md +20 -0
  81. package/prompts/researcher.md +22 -0
  82. package/prompts/shot-dsl-writer.md +63 -0
  83. package/prompts/style-shot-writer.md +46 -0
  84. package/registry/styles.mjs +89 -0
  85. package/render/fonts/Anton-Regular.ttf +0 -0
  86. package/render/fonts/ArchivoBlack.ttf +0 -0
  87. package/render/fonts/Caveat-Bold.ttf +0 -0
  88. package/render/fonts/Caveat.ttf +0 -0
  89. package/render/fonts/Cinzel-Black.ttf +0 -0
  90. package/render/fonts/Cinzel-SemiBold.ttf +0 -0
  91. package/render/fonts/CormorantGaramond-MediumItalic.ttf +0 -0
  92. package/render/fonts/CourierPrime-Regular.ttf +0 -0
  93. package/render/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  94. package/render/fonts/IBMPlexSerif-SemiBold.ttf +0 -0
  95. package/render/fonts/Kalam-Bold.ttf +0 -0
  96. package/render/fonts/KaushanScript-Regular.ttf +0 -0
  97. package/render/fonts/LibreBaskerville-Bold.ttf +0 -0
  98. package/render/fonts/LibreBaskerville-Italic.ttf +0 -0
  99. package/render/fonts/PlayfairDisplay-Bold.ttf +0 -0
  100. package/render/fonts/PlayfairDisplay-Regular.ttf +0 -0
  101. package/render/fonts/README.md +15 -0
  102. package/render/fonts/ZillaSlab-Bold-Lining.ttf +0 -0
  103. package/render/fonts/licenses/Anton-OFL.txt +93 -0
  104. package/render/fonts/licenses/ArchivoBlack-OFL.txt +93 -0
  105. package/render/fonts/licenses/Caveat-OFL.txt +93 -0
  106. package/render/fonts/licenses/Cinzel-OFL.txt +93 -0
  107. package/render/fonts/licenses/CormorantGaramond-OFL.txt +93 -0
  108. package/render/fonts/licenses/CourierPrime-OFL.txt +93 -0
  109. package/render/fonts/licenses/IBMPlexMono-OFL.txt +93 -0
  110. package/render/fonts/licenses/IBMPlexSerif-OFL.txt +93 -0
  111. package/render/fonts/licenses/Kalam-OFL.txt +93 -0
  112. package/render/fonts/licenses/KaushanScript-OFL.txt +95 -0
  113. package/render/fonts/licenses/LibreBaskerville-OFL.txt +93 -0
  114. package/render/fonts/licenses/PlayfairDisplay-OFL.txt +93 -0
  115. package/render/fonts/licenses/ZillaSlab-OFL.txt +93 -0
  116. package/render/render.mjs +59539 -0
  117. package/render3d/data/footprints/README.md +27 -0
  118. package/render3d/data/footprints/test-district.geojson +1 -0
  119. package/render3d/fonts/ArchivoBlack.ttf +0 -0
  120. package/render3d/fonts/IBMPlexMono-400.ttf +0 -0
  121. package/render3d/fonts/IBMPlexMono-600.ttf +0 -0
  122. package/render3d/fonts/Inter-400.ttf +0 -0
  123. package/render3d/fonts/Inter-600.ttf +0 -0
  124. package/render3d/fonts/Inter-800.ttf +0 -0
  125. package/render3d/fonts/licenses/ArchivoBlack-OFL.txt +93 -0
  126. package/render3d/fonts/licenses/BlockfolkCaps-OFL.txt +96 -0
  127. package/render3d/fonts/licenses/IBMPlexMono-OFL.txt +93 -0
  128. package/render3d/fonts/licenses/Inter-OFL.txt +93 -0
  129. package/render3d/render.mjs +41191 -0
  130. package/render3d/runtime.js +4532 -0
  131. package/rendergeo/fonts/Anton-Regular.ttf +0 -0
  132. package/rendergeo/fonts/ArchivoBlack.ttf +0 -0
  133. package/rendergeo/fonts/BarlowCondensed-Bold.ttf +0 -0
  134. package/rendergeo/fonts/BarlowCondensed-SemiBold.ttf +0 -0
  135. package/rendergeo/fonts/Caveat-Bold.ttf +0 -0
  136. package/rendergeo/fonts/Caveat.ttf +0 -0
  137. package/rendergeo/fonts/Cinzel-Black.ttf +0 -0
  138. package/rendergeo/fonts/Cinzel-SemiBold.ttf +0 -0
  139. package/rendergeo/fonts/CormorantGaramond-Medium.ttf +0 -0
  140. package/rendergeo/fonts/CormorantGaramond-MediumItalic.ttf +0 -0
  141. package/rendergeo/fonts/CormorantGaramond-SemiBold.ttf +0 -0
  142. package/rendergeo/fonts/CourierPrime-Regular.ttf +0 -0
  143. package/rendergeo/fonts/IBMPlexMono-Medium.ttf +0 -0
  144. package/rendergeo/fonts/IBMPlexMono-Regular.ttf +0 -0
  145. package/rendergeo/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  146. package/rendergeo/fonts/IBMPlexSansCondensed-Medium.ttf +0 -0
  147. package/rendergeo/fonts/IBMPlexSansCondensed-SemiBold.ttf +0 -0
  148. package/rendergeo/fonts/IBMPlexSerif-SemiBold.ttf +0 -0
  149. package/rendergeo/fonts/Kalam-Bold.ttf +0 -0
  150. package/rendergeo/fonts/KaushanScript-Regular.ttf +0 -0
  151. package/rendergeo/fonts/LibreBaskerville-Bold.ttf +0 -0
  152. package/rendergeo/fonts/LibreBaskerville-Italic.ttf +0 -0
  153. package/rendergeo/fonts/OldStandard-Bold.ttf +0 -0
  154. package/rendergeo/fonts/OldStandard-Italic.ttf +0 -0
  155. package/rendergeo/fonts/OldStandard-Regular.ttf +0 -0
  156. package/rendergeo/fonts/PlayfairDisplay-Bold.ttf +0 -0
  157. package/rendergeo/fonts/PlayfairDisplay-Regular.ttf +0 -0
  158. package/rendergeo/fonts/ZillaSlab-Bold-Lining.ttf +0 -0
  159. package/rendergeo/render-geo.mjs +45063 -0
  160. package/server.js +293 -0
  161. package/studio-cli/bin/sundownreel-gate.mjs +205 -0
  162. package/studio-cli/src/gate.mjs +704 -0
  163. package/styles/README.md +32 -0
  164. package/styles/broadsheet/STYLE.md +5 -0
  165. package/styles/broadsheet/style.json +11 -0
  166. package/styles/cartoon/STYLE.md +37 -0
  167. package/styles/cartoon/style.json +12 -0
  168. package/styles/chalkline/STYLE.md +30 -0
  169. package/styles/chalkline/style.json +11 -0
  170. package/thumbnails/dist/make.mjs +62995 -0
  171. package/vendor/gsap.min.js +11 -0
@@ -0,0 +1,2 @@
1
+ import {createRequire as __sdrCreateRequire} from 'node:module'; const require = __sdrCreateRequire(import.meta.url);
2
+ import{a as q,c as E,d as R,g as T,h as O,i as L,j as W,n as P,o as V}from"./chunk-ONI7QK5B.mjs";var t=q(V(),1);var w=t.z.enum(["linear","inOut","out","in","back"]),G=t.z.enum(["neutral","happy","worried","shock","smug","angry","sad","laugh","sly"]),e=t.z.number().finite(),u=e.min(0),X=t.z.object({t:u,ease:w.optional(),x:e.optional(),y:e.optional(),z:e.optional(),zoom:e.min(.3).max(6).optional(),focus:e.optional(),dof:e.min(0).max(30).optional()}).strict(),Z=t.z.object({t:u,ease:w.optional(),lean:e.optional(),head:e.optional(),armL:e.optional(),armR:e.optional(),elbowL:e.optional(),elbowR:e.optional(),bob:e.optional()}).strict(),H=t.z.union([t.z.object({x:e,z:e}).strict(),t.z.object({mark:t.z.string()}).strict()]),J=t.z.union([t.z.object({x:e,y:e.optional(),z:e}).strict(),t.z.object({mark:t.z.string()}).strict()]),D=t.z.object({kind:t.z.enum(E),t0:u.optional(),t1:u.optional(),amp:e.min(.3).max(2).optional(),seed:e.optional()}).strict().refine(o=>o.t0===void 0||o.t1===void 0||o.t1>o.t0,"cycle t1 must be after t0"),Q=t.z.object({actor:t.z.string().regex(/^[a-z][a-z0-9-]*$/),size:t.z.enum(["wide","ms","mcu","cu"]),side:t.z.union([t.z.literal(-1),t.z.literal(0),t.z.literal(1)]).optional(),dof:e.min(0).max(30).optional(),push:e.min(.5).max(2).optional()}).strict(),tt=o=>o.trim().split(/\s+/).filter(Boolean).length,ot=t.z.object({id:t.z.string().regex(/^[a-z][a-z0-9-]*$/),cast:t.z.string().regex(/^(denise|ceo|investor|unclesam|bolt|extra:[a-z0-9-]+)$/),at:H,facing:t.z.union([t.z.literal(1),t.z.literal(-1),t.z.literal(0)]).optional(),scale:e.min(.2).max(4).optional(),pose:t.z.string().optional(),poseTo:t.z.array(t.z.object({t:u,pose:t.z.string(),dur:e.min(.05).max(2).optional(),ease:w.optional(),anticipate:t.z.boolean().optional(),settle:t.z.boolean().optional()}).strict()).optional(),poseKeys:t.z.array(Z).optional(),slide:t.z.array(t.z.object({t:u,ease:w.optional(),dx:e,dz:e.optional()}).strict()).optional(),hop:t.z.array(t.z.object({t:u,height:e.min(0).max(200).optional()}).strict()).optional(),expr:t.z.array(t.z.object({t:u,v:G}).strict()).optional(),speaks:t.z.union([t.z.literal("none"),t.z.object({fromAbs:u,toAbs:u}).strict()]).optional(),bubble:t.z.object({t0:u,t1:u,text:t.z.string().min(1).max(40),scale:e.optional(),dx:e.optional(),dy:e.optional()}).strict().refine(o=>tt(o.text)<=6,"bubble \u2264 6 words (master \xA73.8)").refine(o=>o.t1>o.t0,"bubble t1 must be after t0").optional(),hold:t.z.object({prop:t.z.string(),hand:t.z.enum(["L","R"]),text:t.z.string().optional(),factId:t.z.string().optional()}).strict().optional(),led:t.z.string().max(12).optional(),ledFactId:t.z.string().optional(),mood:t.z.string().optional(),accessory:t.z.array(t.z.string()).optional(),cycle:t.z.union([D,t.z.array(D).min(1)]).optional(),blinkSeed:e.optional()}).strict(),et=t.z.object({id:t.z.string(),ref:t.z.string(),at:J,scale:e.min(.05).max(20).optional(),text:t.z.string().optional(),factId:t.z.string().optional(),factIds:t.z.array(t.z.string()).min(1).optional(),pop:t.z.object({t:u,dur:e.min(.05).max(1).optional()}).strict().optional(),path:t.z.object({d:t.z.string(),t0:u,t1:u,ease:w.optional(),orient:t.z.boolean().optional()}).strict().optional(),keys:t.z.array(t.z.object({t:u,ease:w.optional(),dx:e.optional(),dy:e.optional(),rot:e.optional(),scale:e.optional()}).strict()).optional(),noBlur:t.z.boolean().optional()}).strict(),nt=t.z.object({ref:t.z.string(),count:t.z.number().int().min(1).max(400),seed:e,area:t.z.object({x:e,z:e,w:e.min(0),d:e.min(0)}).strict(),enter:t.z.object({dx:e.optional(),dy:e.optional(),dur:e.min(.05),stagger:e.min(0),t0:u}).strict().optional(),loop:t.z.enum(["walk","bob","fall","none"]).optional(),text:t.z.string().optional(),factId:t.z.string().optional(),scale:e.optional()}).strict(),at=t.z.object({kind:t.z.enum(["line","bar","bigNumber","counter","pie","barRace"]),data:t.z.unknown(),factIds:t.z.array(t.z.string()).min(1,"every chart needs factIds (R14)"),where:t.z.union([t.z.literal("fullframe"),t.z.object({screen:t.z.string()}).strict()]),t0:u.optional(),title:t.z.string().optional(),derivedFrom:t.z.array(t.z.string()).min(1).optional()}).strict(),M=t.z.string().regex(/^[a-z][a-z0-9:-]*$/,"lowercase id"),_=t.z.string().regex(L,"style id: lowercase kebab, 2-32 chars"),it=t.z.object({kind:t.z.enum(W),head:t.z.string().min(1).max(60).optional(),sub:t.z.string().min(1).max(90).optional(),items:t.z.array(t.z.string().min(1).max(48)).min(1).max(6).optional(),who:t.z.array(M).max(4).optional(),where:M.optional(),icons:t.z.array(M).max(8).optional(),number:t.z.object({value:e,from:e.optional(),prefix:t.z.string().max(4).optional(),suffix:t.z.string().max(16).optional(),dp:t.z.number().int().min(0).max(4).optional(),label:t.z.string().max(48).optional(),render:t.z.enum(["digits","words","counter"]).optional()}).strict().optional(),factIds:t.z.array(t.z.string()).min(1).optional(),mood:t.z.enum(P).optional(),accent:t.z.string().max(30).optional()}).strict().superRefine((o,m)=>{let n=d=>m.addIssue({code:"custom",message:d});o.number&&!o.factIds?.length&&n("beat.number needs beat.factIds (R14)"),["list","rule","timeline","compare"].includes(o.kind)&&!o.items?.length&&n(`beat kind "${o.kind}" needs items`),o.kind==="number"&&!o.number&&n('beat kind "number" needs number'),o.accent&&o.head&&!o.head.toLowerCase().includes(o.accent.toLowerCase())&&n(`beat.accent "${o.accent}" is not a word of head`)}),rt=t.z.object({kind:t.z.string().regex(/^[a-z][a-zA-Z0-9-]*$/).optional(),factIds:t.z.array(t.z.string()).min(1).optional()}).catchall(t.z.unknown()),st=t.z.enum(R),k=t.z.union([u,t.z.object({word:t.z.number().int().min(0),offset:e.optional()}).strict(),t.z.object({pause:t.z.number().int().min(0)}).strict()]),I=t.z.union([t.z.object({x:e,y:e}).strict(),t.z.object({actor:t.z.string()}).strict(),t.z.object({prop:t.z.string()}).strict(),t.z.object({lonlat:t.z.tuple([e.min(-180).max(180),e.min(-90).max(90)]),pin:t.z.enum(["screen","map"]).optional()}).strict()]),lt=t.z.enum(["tl","tr","bl","br","tc","bc"]),S=t.z.array(t.z.string()).min(1),ct=t.z.discriminatedUnion("kind",[t.z.object({kind:t.z.literal("counter"),from:e.optional(),to:e,t0:k,t1:k,factIds:S,at:I.optional(),prefix:t.z.string().max(4).optional(),suffix:t.z.string().max(16).optional(),dp:t.z.number().int().min(0).max(4).optional()}).strict(),t.z.object({kind:t.z.literal("chip"),text:t.z.string().min(1).max(40),at:lt.optional(),t0:k.optional(),factIds:S.optional()}).strict(),t.z.object({kind:t.z.literal("callout"),text:t.z.string().min(1).max(48),sub:t.z.string().max(60).optional(),anchor:I,t0:k.optional(),factIds:S.optional()}).strict(),t.z.object({kind:t.z.literal("stamp"),text:t.z.string().min(1).max(24),at:I.optional(),t0:k,factIds:S.optional()}).strict(),t.z.object({kind:t.z.literal("source"),text:t.z.string().min(1).max(120),factIds:S.optional()}).strict(),t.z.object({kind:t.z.literal("lowerThird"),name:t.z.string().min(1).max(40),place:t.z.string().max(40).optional(),date:t.z.string().max(30).optional(),factIds:S.optional()}).strict(),t.z.object({kind:t.z.literal("highlight"),style:t.z.enum(["ring","arrow","dotted","pop","focus"]),target:I,t0:k}).strict(),t.z.object({kind:t.z.literal("mapInsert"),region:t.z.string().min(1),t0:k.optional()}).strict()]),pt=t.z.object({move:t.z.enum(["hold","push","pull","drift","truck","tilt","crane","orbit","dolly","flight","dive","reveal"]),speed:t.z.union([t.z.enum(["slow","med","fast"]),e.min(0).max(100)]).optional(),ease:t.z.enum(["linear","inOut","out","punch"]).optional(),target:I.optional()}).strict(),mt=t.z.object({kind:t.z.enum(T),t0:k.optional(),amp:e.min(0).max(3).optional()}).strict(),dt=t.z.object({ref:t.z.string().regex(/^plate\/[a-z][a-z0-9-]*\/[a-z0-9-]+@\d+$/,"plate ref: plate/<style>/<name>@<version> (library asset)")}).strict(),ut=t.z.object({aspect:t.z.enum(["16:9","9:16"]),width:t.z.union([t.z.literal(1920),t.z.literal(1080)]),height:t.z.union([t.z.literal(1080),t.z.literal(1920)]),fps:t.z.union([t.z.literal(24),t.z.literal(30)])}).strict().refine(o=>o.aspect==="16:9"?o.width===1920&&o.height===1080:o.width===1080&&o.height===1920,"format width/height must match the aspect (16:9 = 1920\xD71080, 9:16 = 1080\xD71920)"),ft=t.z.object({mode:t.z.enum(["sentence","chunk","word","quoteOnly","none"]),maxWords:t.z.number().int().min(1).max(12).optional(),posY:e.min(0).max(1).optional(),leadFrames:t.z.number().int().min(-15).max(15).optional()}).strict(),K=t.z.union([t.z.literal(12),t.z.literal(15),t.z.literal(30)]),N=t.z.union([t.z.literal(12),t.z.literal(15)]),ht=t.z.object({kind:t.z.literal("map"),id:t.z.string().min(1),style:t.z.string().min(1),duration:e.positive(),projection:t.z.enum(["mercator","equirectangular","orthographic","naturalEarth"]).optional(),hypothetical:t.z.boolean().optional(),factIds:t.z.array(t.z.string()).optional(),camera:t.z.array(t.z.object({t:u,ease:w.optional(),center:t.z.tuple([e,e]).optional(),zoom:e.optional(),fit:t.z.unknown().optional()}).loose()).min(1),layers:t.z.array(t.z.object({type:t.z.enum(["base","relief","imagery","territories","arrows","routes","markers","labels","front","measure","callout","choropleth","blob","ribbon","legend","scalebar","coords","caption","clouds","attribution"])}).loose()).optional()}).loose(),bt=t.z.object({id:t.z.string().regex(/^S\d{3}[a-z]?$/),startAbs:u,dur:e.min(.15).max(30),vo:t.z.string().optional(),anchorWord:t.z.string().optional(),kind:t.z.enum(["world","card","gfx","title","beat"]),set:t.z.object({ref:t.z.string(),opts:t.z.record(t.z.string(),t.z.unknown()).optional(),factIds:t.z.array(t.z.string()).min(1).optional()}).strict().optional(),camera:t.z.object({preset:t.z.string().optional(),frame:Q.optional(),keys:t.z.array(X).optional(),shake:t.z.array(t.z.object({t:u,dur:e.optional(),amp:e.optional()}).strict()).optional(),move:pt.optional()}).strict().optional(),actors:t.z.array(ot).optional(),props:t.z.array(et).optional(),clones:t.z.array(nt).optional(),chart:at.optional(),card:t.z.object({text:t.z.string().min(1).max(90),cps:e.min(10).max(30).optional(),size:e.optional(),factIds:t.z.array(t.z.string()).optional()}).strict().optional(),title:t.z.object({text:t.z.string().max(60),sub:t.z.string().max(80).optional(),factIds:t.z.array(t.z.string()).min(1).optional()}).strict().optional(),grade:t.z.enum(["none","golden","night","cold","alarm","up","down"]).optional(),transitionOut:st.optional(),sfx:t.z.array(t.z.object({id:t.z.string(),at:u,vol:e.min(0).max(2).optional()}).strict()).optional(),musicCue:t.z.string().optional(),note:t.z.string().optional(),style:_.optional(),beat:it.optional(),look:rt.optional(),overlays:t.z.array(ct).max(12).optional(),fx:t.z.array(mt).max(6).optional(),drawRate:K.optional(),stepFps:N.optional(),plate:dt.optional()}).strict().superRefine((o,m)=>{let n=i=>m.addIssue({code:"custom",message:i});if(o.kind==="world"&&!o.set&&n("world shot needs set"),o.kind==="card"&&!o.card&&n("card shot needs card"),o.kind==="gfx"&&!o.chart&&n("gfx shot needs chart"),o.kind==="title"&&!o.title&&n("title shot needs title"),o.kind==="beat"&&!o.beat&&n("beat shot needs beat"),o.look&&o.look.map!==void 0){let i=ht.safeParse(o.look.map);if(!i.success)for(let l of i.error.issues)n(`look.map.${l.path.join(".")}: ${l.message}`)}o.kind==="gfx"&&o.chart&&o.chart.where!=="fullframe"&&n('gfx shot chart must be where:"fullframe" (use a world shot for in-world screens)'),o.kind==="card"&&o.card&&o.card.text.length/(o.card.cps??17)>o.dur-.4&&n(`card text needs ${(o.card.text.length/(o.card.cps??17)+.4).toFixed(2)} s at ${o.card.cps??17} cps (dur ${o.dur})`);let d=new Set;for(let i of o.actors??[])d.has(i.id)&&n(`duplicate actor id ${i.id}`),d.add(i.id);o.camera?.frame&&!d.has(o.camera.frame.actor)&&n(`camera.frame.actor "${o.camera.frame.actor}" is not an actor in this shot (actors: ${[...d].join(", ")||"none"})`),o.camera?.frame&&o.kind!=="world"&&n("camera.frame needs a world shot");let p=o.dur+1e-6,r=(i,l)=>{l>p&&n(`${i} at t=${l} is after the shot ends (${o.dur})`)};for(let i of o.actors??[])i.expr?.forEach(l=>r(`${i.id}.expr`,l.t)),i.poseTo?.forEach(l=>r(`${i.id}.poseTo`,l.t)),i.bubble&&r(`${i.id}.bubble.t0`,i.bubble.t0),(Array.isArray(i.cycle)?i.cycle:i.cycle?[i.cycle]:[]).forEach(l=>{l.t0!==void 0&&r(`${i.id}.cycle ${l.kind}.t0`,l.t0)});o.sfx?.forEach(i=>r(`sfx ${i.id}`,i.at));for(let i of o.overlays??[])for(let l of["t0","t1"]){let y=i[l];typeof y=="number"&&r(`overlays ${i.kind}.${l}`,y)}for(let i of o.fx??[])typeof i.t0=="number"&&r(`fx ${i.kind}.t0`,i.t0)}),yt=t.z.object({dslVersion:t.z.literal(1),videoId:t.z.string().min(1),fps:t.z.union([t.z.literal(30),t.z.literal(24)]),width:t.z.union([t.z.literal(1920),t.z.literal(1080)]),height:t.z.union([t.z.literal(1080),t.z.literal(1920)]),format:ut.optional(),captions:ft.optional(),drawRate:K.optional(),stepFps:N.optional(),vo:t.z.object({file:t.z.string(),words:t.z.string()}).strict().optional(),libraryVersion:t.z.string(),hypothetical:t.z.boolean().optional(),style:_.optional(),shots:t.z.array(bt).min(1)}).strict().superRefine((o,m)=>{let n=o.format??{aspect:"16:9",width:1920,height:1080,fps:30};(o.fps!==n.fps||o.width!==n.width||o.height!==n.height)&&m.addIssue({code:"custom",path:["format"],message:`fps/width/height (${o.fps}, ${o.width}\xD7${o.height}) must match format (${n.fps}, ${n.width}\xD7${n.height}); without format they are 30, 1920\xD71080`});let d=new Set;o.shots.forEach((p,r)=>{d.has(p.id)&&m.addIssue({code:"custom",path:["shots",r,"id"],message:`duplicate shot id ${p.id}`}),d.add(p.id)}),Math.abs(o.shots[0].startAbs)>1/o.fps+1e-6&&m.addIssue({code:"custom",path:["shots",0,"startAbs"],message:`first shot must start at 0 (got ${o.shots[0].startAbs})`});for(let p=1;p<o.shots.length;p++){let r=o.shots[p-1],i=o.shots[p];Math.abs(r.startAbs+r.dur-i.startAbs)>1/o.fps+1e-6&&m.addIssue({code:"custom",path:["shots",p,"startAbs"],message:`starts at ${i.startAbs}, previous ends at ${(r.startAbs+r.dur).toFixed(3)}`})}});var B=o=>{let m=Math.sin(o*12.9898+78.233)*43758.5453;return m-Math.floor(m)};function St(o,m={},n={},d={}){let p=o.style??O,r=o.fps,i=[],l=[],y=[],$=new Set,j=s=>{let c=m[s];return c||$.add(s),c?c.file:null},v=0;for(let s of o.shots){let c=v,Y=Math.round((s.startAbs+s.dur)*r),x=Math.max(1,Y-c);v=c+x;let A=s.style??p,C=s.stepFps??o.stepFps,F=s.drawRate??o.drawRate;i.push({...s,from:c,len:x,style:A,...C?{stepFps:C}:{},...F?{drawRate:F}:{}});let z=(a,h,f,b)=>l.push({id:a,file:j(a),frame:Math.max(0,h),vol:f,auto:b,shot:s.id});for(let a of s.sfx??[])z(a.id,c+Math.round(a.at*r),a.vol??1,!1);let g=(a,h,f=.8)=>{l.some(b=>Math.abs(b.frame-h)<=3)||z(a,h,f,!0)};s.transitionOut==="whip"&&g("whoosh",c+x-3),s.transitionOut==="flash"&&g("impact-soft",c+x),s.transitionOut==="zoomThrough"&&g("whoosh-rise",c+x-6),s.transitionOut==="wipe"&&g("swipe",c+x-4);for(let a of s.actors??[]){for(let h of a.poseTo??[])g("cloth-swish",c+Math.round(h.t*r),.5);for(let h of a.hop??[])g("boing-small",c+Math.round(h.t*r));a.slide?.length&&g(a.cast==="bolt"?"wheel-roll":"slide-whoosh",c+Math.round(a.slide[0].t*r)),a.bubble&&g("pop",c+Math.round(a.bubble.t0*r),.5)}for(let a of s.props??[])a.pop&&g(a.ref.startsWith("stamp")?"stamp-thud":"pop",c+Math.round(a.pop.t*r));for(let a of s.clones??[])a.enter&&g(a.ref.includes("bolt")?"wheel-roll":"whoosh",c+Math.round(a.enter.t0*r),.6);if(s.chart?.kind==="counter"){let a=s.chart.data,h=c+Math.round((s.chart.t0??0)*r),f=Math.round((a?.dur??.9)*r);for(let b=0;b<f;b+=2)h+b<c+x&&l.push({id:"counter-tick",file:j("counter-tick"),frame:h+b,vol:.25,auto:!0,shot:s.id})}if(s.kind==="card"&&s.card){let a=s.card.cps??17,h=.15;for(let f=0;f<s.card.text.length;f+=2+Math.floor(B(c+f)*2)){if(s.card.text[f]===" ")continue;let b=c+Math.round((h+f/a)*r);b<c+x&&l.push({id:"type-click",file:j("type-click"),frame:b,vol:.35*(.8+B(b)*.4),auto:!0,shot:s.id})}}if(s.kind==="beat"&&s.beat?.number){let a=c+Math.round(.2*r),h=Math.round(.9*r);for(let f=0;f<h;f+=2)a+f<c+x&&l.push({id:"counter-tick",file:j("counter-tick"),frame:a+f,vol:.25,auto:!0,shot:s.id})}for(let a of s.overlays??[])if(a.kind==="stamp"&&typeof a.t0=="number"&&g("stamp-thud",c+Math.round(a.t0*r),.7),a.kind==="counter"&&typeof a.t0=="number"&&typeof a.t1=="number"){let h=c+Math.round(a.t0*r),f=Math.min(c+x,c+Math.round(a.t1*r));for(let b=h;b<f;b+=2)l.push({id:"counter-tick",file:j("counter-tick"),frame:b,vol:.25,auto:!0,shot:s.id})}for(let a of d.autoSfx?.(s,A)??[])g(a.id,c+Math.round(a.at*r),a.vol??.8);if(s.musicCue){let a=n[s.musicCue];y.push({id:s.musicCue,file:a?.file??null,from:c,vol:a?.vol??.18})}}return l.sort((s,c)=>s.frame-c.frame),{videoId:o.videoId,fps:r,style:p,...o.format?{format:o.format}:{},...o.captions?{captions:o.captions}:{},shots:i,sfx:l,music:y,totalFrames:v,missingSfx:[...$].sort()}}function jt(o){let m=o.shots.map(l=>l.len/o.fps),n=o.shots.filter(l=>l.len/o.fps>=.5).map(l=>l.len/o.fps).sort((l,y)=>l-y),d=n.reduce((l,y)=>l+y,0)/Math.max(1,n.length),p=n.length?n[Math.floor(n.length/2)]:0,r=o.totalFrames/o.fps/60,i=o.shots.filter(l=>l.transitionOut&&l.transitionOut!=="cut").length;return{shots:m.length,seconds:+(o.totalFrames/o.fps).toFixed(2),contentMean:+d.toFixed(2),contentMedian:+p.toFixed(2),segmentsPerMin:+(m.length/Math.max(r,1e-9)).toFixed(1),transitionShare:+(i/Math.max(1,m.length)).toFixed(3),sfxOnsetsPerSec:+(o.sfx.length/Math.max(1e-9,o.totalFrames/o.fps)).toFixed(2)}}function gt(o,m,n){if(typeof o=="number")return m.startAbs+o;if("word"in o){let p=n[o.word];return p?p.start+(o.offset??0):null}let d=-1;for(let p=1;p<n.length;p++)if(n[p].start-n[p-1].end>=.25&&++d===o.pause)return n[p-1].end;return null}var U=(o,m,n)=>{if(o===void 0)return 0;let d=gt(o,m,n);return d===null?0:Math.max(0,Math.min(m.dur,d-m.startAbs))};function vt(o,m){return{...o,shots:o.shots.map(n=>!n.overlays&&!n.fx?n:{...n,overlays:n.overlays?.map(d=>{let p={...d};for(let r of["t0","t1"])p[r]!==void 0&&(p[r]=U(p[r],n,m));return p}),fx:n.fx?.map(d=>d.t0===void 0?d:{...d,t0:U(d.t0,n,m)})})}}export{Q as a,ot as b,et as c,nt as d,at as e,_ as f,it as g,rt as h,k as i,I as j,ct as k,pt as l,mt as m,dt as n,ut as o,ft as p,ht as q,bt as r,yt as s,St as t,jt as u,gt as v,U as w,vt as x};
package/dsl/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import {createRequire as __sdrCreateRequire} from 'node:module'; const require = __sdrCreateRequire(import.meta.url);
2
+ import{a as n,b as o,c as p,d as q,e as r,f as s,g as t,h as u,i as v,j as w,k as x,l as y,m as z,n as A,o as B,p as C,q as D,r as E,s as F,t as G,u as H,v as da,w as ea,x as fa}from"../chunks/chunk-YUE6XWVB.mjs";import{A as T,B as U,C as V,D as W,E as X,F as Y,G as Z,H as _,I as $,J as aa,K as ba,L as ca,b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,p as I,q as J,r as K,s as L,t as M,u as N,v as O,w as P,x as Q,y as R,z as S}from"../chunks/chunk-ONI7QK5B.mjs";export{o as ActorSchema,w as AnchorSchema,l as BEAT_ICONS,i as BEAT_KINDS,m as BEAT_MOODS,k as BEAT_WHERE,j as BEAT_WHO,M as BarData,N as BarRaceData,t as BeatSchema,J as BigNumberData,P as CHART_DATA,b as CYCLE_KINDS,n as CameraFrameSchema,y as CameraMoveSchema,C as CaptionTrackSchema,I as ChartColor,r as ChartSchema,q as CloneSchema,K as CounterData,g as DEFAULT_STYLE,a as DSL_VERSION,F as EpisodeSchema,T as FRAME_SIZES,U as FRAME_SIZE_NAMES,f as FX_KINDS,B as FormatSchema,z as FxSchema,D as GeoMapLookSchema,L as LineData,u as LookSchema,x as OverlaySchema,O as PieData,A as PlateSchema,p as PropSchema,h as STYLE_ID_RE,E as ShotSchema,s as StyleIdSchema,c as TRANSITIONS,d as TRANSITION_FALLBACK,e as TRANSITION_FRAMES,v as WhenSchema,Q as chartDataIssues,G as compile,R as decimalsOf,_ as factNumbers,S as fmtNum,W as frameCamera,Y as framePushKeys,V as frameSide,ba as hasDrawnNumber,$ as isLicensed,Z as numberTokens,X as projectPoint,fa as resolveWhen,aa as stripOrdinals,H as timingStats,ca as untracedTokens,da as whenAbs,ea as whenLocal};
@@ -0,0 +1,5 @@
1
+ import {createRequire as __sdrCreateRequire} from 'node:module'; const require = __sdrCreateRequire(import.meta.url);
2
+ import{D as G,E as B,H as X,I as L,K as S,L as J,h as D,k as P,l as W,m as H,y as C,z as T}from"../chunks/chunk-ONI7QK5B.mjs";var U=/\d/,V=c=>/^geo:[a-z][a-z0-9:_-]*$/.test(c),st=new Set(["kind","factIds","plate","ref","id","style","projection","type","ease","place","country","color","colour","fill","stroke","palette","mapSeed","seed"]),rt=/^(#[0-9a-fA-F]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\)|\{\{[^}]+\}\})$/,ot=40,it=c=>/^(_|lab)/i.test(c);function at(c,u){let m=(c.status??"").trim().toLowerCase();return m==="verified"||m==="computed"?null:m==="scenario"?u?null:`factId ${c.id} has status "scenario": hypothetical numbers may go on screen only when the episode sets "hypothetical": true`:m?`factId ${c.id} has status "${c.status}": only verified/computed (or scenario in hypothetical episodes) facts may go on screen`:`factId ${c.id} has no status: only verified/computed (or scenario in hypothetical episodes) facts may go on screen`}var F=(c,u,m,i=u,a=!1)=>{let g=m.dp??C(i);return{what:c,v:u,dp:g,fmt:T(u,{...m,dp:g}),...a?{headline:a}:{}}};function ct(c,u,m={}){let i=u??{},a={shown:[],plotted:[],labels:[],ticks:!1,bounds:[]},g=(r,$)=>{typeof $=="string"&&$&&a.labels.push({what:r,text:$})},n=m.ticks!==!1;if(c==="bigNumber")a.shown.push(F("value",i.value,i,i.value,!0)),g("label",i.label);else if(c==="counter")a.shown.push(F("value",i.value,i,i.value,!0)),i.from!==void 0&&i.from!==0&&a.shown.push(F("from",i.from,{...i,dp:i.dp??C(i.value)},i.from,!0)),g("label",i.label);else if(c==="line"){(i.series??[]).forEach((r,$)=>{r.points.forEach((j,I)=>{let v=I===r.points.length-1&&i.endValue!==!1;(v?a.shown:a.plotted).push(F(`series[${$}].points[${I}]`,j,i,j,v))}),g(`series[${$}].label`,r.label)}),(i.xLabels??[]).forEach((r,$)=>g(`xLabels[${$}]`,r)),a.ticks=n&&i.yTicks!==0;for(let r of["yMin","yMax"])i[r]!==void 0&&a.bounds.push(r)}else if(c==="bar")(i.bars??[]).forEach((r,$)=>{(i.showValues!==!1?a.shown:a.plotted).push(F(`bars[${$}].value`,r.value,i)),g(`bars[${$}].label`,r.label)}),a.ticks=n,i.yMax!==void 0&&a.bounds.push("yMax");else if(c==="pie"){let r={...i,suffix:i.suffix??"%"};(i.slices??[]).forEach(($,j)=>{(i.showValues!==!1?a.shown:a.plotted).push(F(`slices[${j}].value`,$.value,r)),g(`slices[${j}].label`,$.label)})}else if(c==="barRace"){let r=i.frames??[],$=r[r.length-1]?.values??{};r.forEach((j,I)=>{g(`frames[${I}].label`,j.label);for(let[v,O]of Object.entries(j.values))a.shown.push(F(`frames[${I}].values.${v}`,O,i,$[v]??O))});for(let j of new Set(r.flatMap(I=>Object.keys(I.values))))g(`name "${j}"`,j)}return a}var K=c=>c.includes("wide")?"wide":c[0];function $t(c,u){let m=c.shots.map(i=>{if(i.kind!=="world"||!i.set)return i;let a=u.sets[i.set.ref];if(!a)return i;let g=i.camera?.preset??K(a.cameras);return{...i,camera:{...i.camera,preset:g},actors:i.actors?.map(n=>{let r="mark"in n.at?a.marks[n.at.mark]:void 0,$="mark"in n.at&&r?{x:r.x,z:r.z,mark:n.at.mark}:n.at;return{...n,at:$,facing:n.facing??r?.facing??1,speaks:n.speaks??"none"}}),props:i.props?.map(n=>{if(!("mark"in n.at))return n;let r=a.marks[n.at.mark];return r?{...n,at:{x:r.x,z:r.z,mark:n.at.mark}}:n})}});return{...c,shots:m}}function Z(c,u,m){let i="mark"in c.at?u?.marks[c.at.mark]:c.at;if(!i)return null;let a=[...c.slide??[]].sort((r,$)=>r.t-$.t),g=0,n=0;if(a.length){if(m<=a[0].t)g=a[0].dx,n=a[0].dz??0;else if(m>=a[a.length-1].t)g=a[a.length-1].dx,n=a[a.length-1].dz??0;else for(let r=0;r<a.length-1;r++)if(m>=a[r].t&&m<=a[r+1].t){let $=(m-a[r].t)/Math.max(1e-6,a[r+1].t-a[r].t);g=a[r].dx+(a[r+1].dx-a[r].dx)*$,n=(a[r].dz??0)+((a[r+1].dz??0)-(a[r].dz??0))*$}}return{x:i.x+g,z:i.z+n,facing:c.facing??("mark"in c.at?u?.marks[c.at.mark]?.facing:void 0)??1}}function ft(c,u){let m=c.camera?.frame,i=c.set?u.sets[c.set.ref]:void 0,a=m&&c.actors?.find($=>$.id===m.actor);if(!m||!i||!a)return null;let g=Z(a,i,0);if(!g)return null;let n=c.camera?.preset??K(i.cameras),r=(u.castHeights?.[a.cast]??500)*(a.scale??1);return G(m,{x:g.x,z:g.z,height:r,facing:g.facing},{base:{zoom:i.cameraZoom?.[n]??1}})}function dt(c,u,m,i){let a=c.set?u.sets[c.set.ref]:void 0,g=c.camera.frame,n=380;(c.actors??[]).forEach((r,$)=>{let j=(u.castHeights?.[r.cast]??500)*(r.scale??1);if(r.id===g.actor)for(let I of[0,...(r.slide??[]).map(v=>v.t),c.dur]){let v=Z(r,a,I);if(!v)continue;let{sx:O}=B(v.x,n-j*.8,v.z,m);if(O<0||O>1920){i(c.id,"camera.frame",`framed actor ${r.id} is out of frame at t=${+I.toFixed(2)} (head x ${Math.round(O)} px)`);break}}if(r.bubble){let I=Z(r,a,r.bubble.t0);if(!I)return;let v=r.scale??1,{sx:O,sy:E}=B(I.x+(r.bubble.dx??0),n+(r.bubble.dy??-560*v),I.z-1,m);(O<0||O>1920||E<0||E>1080)&&i(c.id,`actors[${$}].bubble`,`bubble anchor is off-screen under camera.frame (${Math.round(O)}, ${Math.round(E)} px): set bubble.dx/dy`)}})}function pt(c,u,m,i,a={}){let g=[],n=(t,l,s)=>g.push({shot:t,path:l,msg:s,level:"error"}),r=(t,l,s)=>g.push({shot:t,path:l,msg:s,level:"warn"}),$=u.nearClip??ot,j=c.hypothetical===!0;m||(a.noFacts?it(c.videoId)||n("EPISODE","facts",`--no-facts is only allowed for internal test episodes (videoId starting with "_" or "lab"), not "${c.videoId}"`):n("EPISODE","facts","no facts file found (03-research/facts.checked.csv or facts.csv): every on-screen number must be checked, pass --facts <path> (--no-facts is for internal test episodes only)"));let I=new Map((m??[]).map(t=>[t.id,t])),v=new Set(u.casts),O=new Set(u.poses),E=(t,l,s)=>{if(!m||V(s))return;let h=I.get(s);if(!h){n(t,l,`factId ${s} not in facts.csv`);return}let b=at(h,j);return b&&n(t,l,b),h},A=t=>t.flatMap(l=>{let s=I.get(l);return s?X(s):[]}),z=(t,l,s,h)=>{if(!m||!s||!h.length||h.some(V))return;let b=J(s,A(h));b.length&&n(t,l,`number${b.length>1?"s":""} ${b.map(x=>x.raw).join(", ")} in "${s}" ${b.length>1?"are":"is"} not the value/on_screen of any cited fact (${h.join(", ")}) (R14)`)},N=(t,l,s,h,b=s)=>{b&&S(b)&&!h.length&&n(t,l,`on-screen text "${s}" contains a number but has no factId (R14)`);for(let x of h){let k=E(t,l,x),e=k?.on_screen?.trim();k&&s&&e&&!s.includes(e)&&n(t,l,`text "${s}" does not contain fact ${x} on_screen string "${e}"`)}z(t,l,b,h)},q=(t,l,s,h)=>{let b=!!s.derivedFrom?.length;for(let d of s.derivedFrom??[]){let o=E(t,`${l}.derivedFrom`,d);s.factIds.includes(d)||n(t,`${l}.derivedFrom`,`derivedFrom ${d} must also be listed in factIds`),o&&(o.status??"").trim().toLowerCase()!=="computed"&&n(t,`${l}.derivedFrom`,`derivedFrom ${d} has status "${o.status??""}": a derived dataset must be a computed fact`)}if(s.title&&(S(s.title)&&!s.factIds.length&&n(t,`${l}.title`,`chart title "${s.title}" contains a number but has no factIds (R14)`),z(t,`${l}.title`,s.title,s.factIds)),!m||u.chartDataIssues(s.kind,s.data).length)return;let x=A(s.factIds),k=ct(s.kind,s.data,{ticks:h}),e=[...k.shown,...k.plotted].filter(d=>!L(d.v,d.dp,x)&&!(b&&!d.headline));if(e.length&&n(t,`${l}.data`,`${s.kind}: ${e.slice(0,6).map(d=>`${d.fmt} (${d.what})`).join(", ")}${e.length>6?` and ${e.length-6} more`:""} ${e.length>1?"are":"is"} not the value/on_screen of any cited fact (${s.factIds.join(", ")}). Every number a chart shows or plots must equal a cited fact number${e.some(d=>d.headline)?"":", or declare derivedFrom (computed facts)"} (R14)`),!b)for(let d of k.labels){let o=J(d.text,x);o.length&&n(t,`${l}.data`,`${s.kind} ${d.what} "${d.text}": ${o.map(f=>f.raw).join(", ")} not the value/on_screen of any cited fact (R14)`)}k.ticks&&k.bounds.length&&!b&&n(t,`${l}.data`,`${s.kind}: explicit ${k.bounds.join("/")} with visible axis ticks puts unsourced tick numbers on screen: drop ${k.bounds.join("/")}${s.kind==="line"?", set yTicks: 0":""} or declare derivedFrom (R14)`)},Y=(t,l,s)=>{let h=l.factIds??[],b=[];for(let[x,k]of Object.entries(l.opts??{})){let e=!s?.textOpts||s.textOpts.includes(x)||(s.opts??[]).includes(x),d=!s?.textOpts||s.textOpts.includes(x),o=typeof k=="string"||typeof k=="number"?String(k):k==null||typeof k=="boolean"?"":JSON.stringify(k);if(!e){U.test(o)?n(t,`set.opts.${x}`,`unknown opt "${x}" for ${l.ref} has a number (${JSON.stringify(k)}): the validator can't tell whether it is drawn, so it is rejected (R14). Text opts: ${(s?.textOpts??[]).join(", ")||"none"}`):r(t,`set.opts.${x}`,`unknown opt "${x}" for ${l.ref} (reads: ${(s?.opts??[]).join(", ")||"none"})`);continue}d&&o&&b.push({key:x,text:o})}for(let{key:x,text:k}of b)S(k)&&!h.length&&n(t,`set.opts.${x}`,`set text "${k}" contains a number but has no set.factIds (R14)`),z(t,`set.opts.${x}`,k,h);for(let x of h){let k=E(t,"set.factIds",x),e=k?.on_screen?.trim();k&&e&&!b.some(d=>d.text.includes(e))&&n(t,"set.factIds",`no text opt (${b.map(d=>d.key).join(", ")||"none"}) contains fact ${x} on_screen "${e}"`)}},Q=(t,l)=>{let s=t.match(/^screen:(.*)$/);if(!s||!s[1].split(",").map(b=>b.trim()).includes("chart"))return null;let h=l.trim();if(h.startsWith("{"))try{return{json:JSON.parse(h)}}catch{return{drawn:l}}return{drawn:h.split(`
3
+ `).filter(b=>!/^\s*(turn|dur)\s*:/i.test(b)).join(`
4
+ `)}},R=(...t)=>[...new Set(t.flatMap(l=>l===void 0?[]:Array.isArray(l)?l:[l]))],_=u.styles?new Set(u.styles):null;_&&c.style&&!_.has(c.style)&&n("EPISODE","style",`unknown style "${c.style}" (known: ${[..._].join(", ")})`);let tt=new Set(P),et=new Set(W),nt=new Set(H),M=(t,l,s=[])=>{if(typeof t=="string")rt.test(t)||s.push({path:l,text:t});else if(Array.isArray(t))t.forEach((h,b)=>M(h,`${l}[${b}]`,s));else if(t&&typeof t=="object")for(let[h,b]of Object.entries(t))st.has(h)||M(b,`${l}.${h}`,s);return s};for(let t of c.shots){let l=t.style??c.style??D;if(_&&t.style&&!_.has(t.style)&&n(t.id,"style",`unknown style "${t.style}" (known: ${[..._].join(", ")})`),l!==D&&t.kind!=="beat"&&!t.beat&&r(t.id,"beat",`style "${l}" draws shots from beat: this ${t.kind} shot has none, so the style falls back to its vo/title text`),t.beat){let e=t.beat,d=e.factIds??[];for(let f of d)E(t.id,"beat.factIds",f);let o=[["head",e.head],["sub",e.sub],["number.label",e.number?.label],...(e.items??[]).map((f,p)=>[`items[${p}]`,f])];for(let[f,p]of o)p&&S(p)&&!d.length&&n(t.id,`beat.${f}`,`beat ${f} "${p}" contains a number but has no beat.factIds (R14)`),z(t.id,`beat.${f}`,p,d);for(let f of["prefix","suffix"]){let p=e.number?.[f];p&&U.test(p)&&n(t.id,`beat.number.${f}`,`beat number ${f} "${p}" must not contain digits`)}if(e.number&&m&&d.length){let f=A(d),p=e.number.dp??C(e.number.value);for(let[y,w]of[["value",e.number.value],["from",e.number.from]])w===void 0||y==="from"&&w===0||L(w,p,f)||n(t.id,`beat.number.${y}`,`${T(w,{dp:p})} is not the value/on_screen of any cited fact (${d.join(", ")}) (R14)`)}for(let f of e.who??[])tt.has(f)||r(t.id,"beat.who",`unknown archetype "${f}" (styles draw a generic figure; known: ${P.join(", ")})`);e.where&&!et.has(e.where)&&!e.where.startsWith("map:")&&r(t.id,"beat.where",`unknown place "${e.where}" (known: ${W.join(", ")}, map:<region>)`);for(let f of e.icons??[])nt.has(f)||r(t.id,"beat.icons",`unknown icon "${f}" (known: ${H.join(", ")})`)}if(t.look){let e=R(t.look.factIds,t.beat?.factIds);for(let d of t.look.factIds??[])E(t.id,"look.factIds",d);for(let{path:d,text:o}of M(t.look,"look"))S(o)&&!e.length&&n(t.id,d,`look text "${o}" contains a number but has no look.factIds / beat.factIds (R14: every look string counts as on-screen text)`),z(t.id,d,o,e)}(t.overlays??[]).forEach((e,d)=>{let o=`overlays[${d}]`,f=e.factIds??[];for(let y of f)E(t.id,`${o}.factIds`,y);if(e.kind==="counter"){if(m&&!f.some(V)){let y=A(f),w=e.dp??C(e.to);L(e.to,w,y)||n(t.id,`${o}.to`,`counter ends on ${T(e.to,{dp:w})}, not the value/on_screen of any cited fact (${f.join(", ")}) (R14: the final frame must be exact)`),e.from!==void 0&&e.from!==0&&!L(e.from,w,y)&&n(t.id,`${o}.from`,`counter starts on ${T(e.from,{dp:w})}, not a cited fact number (R14)`)}typeof e.t0=="number"&&typeof e.t1=="number"&&(e.t1<=e.t0?n(t.id,`${o}.t1`,"counter t1 must be after t0"):e.t1-e.t0>1.2+1e-6&&n(t.id,`${o}.t1`,`counter rolls ${(e.t1-e.t0).toFixed(2)} s: rolls are \u2264 1.2 s (QA counter rule)`));for(let y of["prefix","suffix"])e[y]&&U.test(e[y])&&n(t.id,`${o}.${y}`,`counter ${y} must not contain digits`);return}let p=e.kind==="callout"?[["text",e.text],["sub",e.sub]]:e.kind==="lowerThird"?[["name",e.name],["place",e.place],["date",e.date]]:e.kind==="chip"||e.kind==="stamp"||e.kind==="source"?[["text",e.text]]:[];for(let[y,w]of p)w&&S(w)&&!f.length&&n(t.id,`${o}.${y}`,`overlay ${e.kind} ${y} "${w}" contains a number but has no factIds (R14)`),z(t.id,`${o}.${y}`,w,f)}),t.plate&&!u.refExists(t.plate.ref)&&n(t.id,"plate.ref",`unknown library plate ${t.plate.ref}: plates are one-time, Jacob-approved library art logged in library/ORIGINS.md (every style must render without one)`);let s=t.set?u.sets[t.set.ref]:void 0;t.set&&!s&&n(t.id,"set.ref",`unknown set ${t.set.ref} (known: ${Object.keys(u.sets).join(", ")})`),t.set&&Y(t.id,t.set,s);let h=t.camera?.preset;s&&h&&!s.cameras.includes(h)&&!(h.startsWith("reverse")&&s.hasReverse)&&n(t.id,"camera.preset",`set ${t.set.ref} has no preset "${h}" (has: ${s.cameras.join(", ")})`);let b=s?s.cameraZ[h??K(s.cameras)]??s.cameraZ[s.cameras[0]]??0:0,x=s?ft(t,u):null;x&&(b=x.z,dt(t,u,x,r));let k=[];if((t.actors??[]).forEach((e,d)=>{let o=`actors[${d}]`;v.has(e.cast)||n(t.id,`${o}.cast`,`unknown cast "${e.cast}" (known: ${[...v].join(", ")})`),"mark"in e.at&&s&&!s.marks[e.at.mark]&&n(t.id,`${o}.at`,`set ${t.set.ref} has no mark "${e.at.mark}" (has: ${Object.keys(s.marks).join(", ")})`);for(let p of[e.pose,...(e.poseTo??[]).map(y=>y.pose)])p&&!O.has(p)&&n(t.id,`${o}.pose`,`unknown pose "${p}"`);e.led?N(t.id,`${o}.led`,e.led,R(e.ledFactId)):e.ledFactId&&E(t.id,`${o}.ledFactId`,e.ledFactId),e.bubble&&N(t.id,`${o}.bubble`,e.bubble.text,[]),e.hold&&(u.refExists(e.hold.prop)||n(t.id,`${o}.hold`,`unknown hand prop ${e.hold.prop}`),e.hold.text?N(t.id,`${o}.hold.text`,e.hold.text,R(e.hold.factId)):e.hold.factId&&E(t.id,`${o}.hold.factId`,e.hold.factId)),e.speaks&&e.speaks!=="none"&&e.speaks.toAbs<=e.speaks.fromAbs&&n(t.id,`${o}.speaks`,"toAbs must be after fromAbs");let f="mark"in e.at?s?.marks[e.at.mark]??null:e.at;if(f){f.z-b<$&&n(t.id,`${o}.at`,`actor is inside/behind the camera (z ${f.z} vs camera z ${b})`);for(let p of k)Math.abs(p.x-f.x)<150&&Math.abs(p.z-f.z)<60&&!e.slide?.length&&r(t.id,`${o}.at`,`actor ${e.id} overlaps ${p.id} (|\u0394x| < 150 at the same z)`);k.push({id:e.id,x:f.x,z:f.z})}}),(t.props??[]).forEach((e,d)=>{let o=`props[${d}]`;u.refExists(e.ref)||n(t.id,`${o}.ref`,`unknown library ref ${e.ref}`),"mark"in e.at&&s&&!s.marks[e.at.mark]&&n(t.id,`${o}.at`,`set ${t.set.ref} has no mark "${e.at.mark}"`),!("mark"in e.at)&&e.at.z-b<$&&n(t.id,`${o}.at`,`camera inside prop (z - cam.z < ${$})`);let f=R(e.factId,e.factIds),p=e.text?Q(e.ref,e.text):null;if(p?.json){let y=p.json;S(e.text)&&!f.length&&n(t.id,`${o}.text`,"chart text contains numbers but has no factId (R14)");for(let w of f)E(t.id,`${o}.factIds`,w);for(let w of u.chartDataIssues(y.kind,y.data))n(t.id,`${o}.text`,`${y.kind}: ${w}`);f.length&&q(t.id,`${o}.text`,{kind:y.kind,data:y.data,title:y.title,factIds:f},!1)}else N(t.id,`${o}.text`,e.text,f,p?.drawn??e.text)}),(t.clones??[]).forEach((e,d)=>{u.refExists(e.ref)||n(t.id,`clones[${d}].ref`,`unknown library ref ${e.ref}`),e.ref.startsWith("cast/")&&!v.has(e.ref.slice(5).replace(/@\d+$/,""))&&n(t.id,`clones[${d}].ref`,`unknown cast ${e.ref}`),N(t.id,`clones[${d}].text`,e.text,R(e.factId))}),t.chart){for(let e of t.chart.factIds)E(t.id,"chart.factIds",e);typeof t.chart.where=="object"&&s&&!s.screens.includes(t.chart.where.screen)&&n(t.id,"chart.where",`set ${t.set.ref} has no screen "${t.chart.where.screen}"`);for(let e of u.chartDataIssues(t.chart.kind,t.chart.data))n(t.id,"chart.data",`${t.chart.kind}: ${e}`);q(t.id,"chart",t.chart,!0)}if(t.card){let e=t.card.factIds??[];S(t.card.text)&&!e.length&&n(t.id,"card.text",`card "${t.card.text}" contains a number but has no factIds (R14)`);for(let d of e){let o=E(t.id,"card.factIds",d),f=o?.on_screen?.trim();o&&f&&!t.card.text.includes(f)&&n(t.id,"card.text",`card text does not contain fact ${d} on_screen "${f}"`)}z(t.id,"card.text",t.card.text,e)}if(t.title){let e=t.title.factIds??[],d=`${t.title.text}
5
+ ${t.title.sub??""}`;for(let[o,f]of[["text",t.title.text],["sub",t.title.sub]])f&&S(f)&&!e.length&&n(t.id,`title.${o}`,`title ${o} "${f}" contains a number but has no title.factIds (R14)`),z(t.id,`title.${o}`,f,e);for(let o of e){let f=E(t.id,"title.factIds",o),p=f?.on_screen?.trim();f&&p&&!d.includes(p)&&n(t.id,"title.factIds",`title text/sub do not contain fact ${o} on_screen "${p}"`)}}if(i)for(let e of t.sfx??[])i.has(e.id)||r(t.id,"sfx",`sfx id "${e.id}" not in the licensed sfx index`);t.kind==="world"&&t.dur>6&&((t.camera?.keys?.length??0)+(t.actors??[]).reduce((d,o)=>d+(o.poseTo?.length??0)+(o.slide?.length??0)+(o.expr?.length??0),0)||r(t.id,"dur","> 6 s on one camera with no move or pose change"))}return g}export{ct as chartNumbers,at as factStatusProblem,V as isGeodataFact,it as isInternalEpisode,$t as resolve,pt as semanticCheck,ft as shotFrameCamera};
package/dsl/types.ts ADDED
@@ -0,0 +1,240 @@
1
+ // Shot DSL v1 — the contract between the SHOT-DSL WRITER agent and the engine (update U3.3.1).
2
+ // Times are SECONDS, shot-local unless the field name ends in `Abs` (episode time). World units = px at
3
+ // distance 1000. Bump DSL_VERSION on any breaking change. schema.ts is the runtime source of truth.
4
+ export const DSL_VERSION = 1;
5
+
6
+ export type Ease = 'linear' | 'inOut' | 'out' | 'in' | 'back';
7
+ export type Key<T> = {t: number; ease?: Ease} & T;
8
+
9
+ export type Cam = {x: number; y: number; z: number; zoom: number; focus: number; dof: number};
10
+
11
+ export type Expr = 'neutral' | 'happy' | 'worried' | 'shock' | 'smug' | 'angry' | 'sad' | 'laugh' | 'sly';
12
+ export type Mouth = 'closed' | 'small' | 'open' | 'wide' | 'o' | 'fv' | 'mbp';
13
+ export type Pose = {lean: number; head: number; armL: number; armR: number; elbowL?: number; elbowR?: number; bob: number};
14
+
15
+ export type At = {x: number; z: number} | {mark: string};
16
+ export type AtProp = {x: number; y?: number; z: number} | {mark: string};
17
+
18
+ export type ActorSpec = {
19
+ id: string; // unique within the shot, stable across shots ("denise")
20
+ cast: string; // 'denise' | 'ceo' | 'investor' | 'unclesam' | 'bolt' | `extra:${preset}`
21
+ at: At;
22
+ facing?: 1 | -1 | 0; // 1 = 3/4 toward screen right; 0 = frontal
23
+ scale?: number; // 1 = standard height (500 px at z=1000)
24
+ pose?: string; // starting named pose
25
+ /** Rigid pose tweens. `anticipate`: a small counter-move over the 4 frames before `t` (opposite to the move,
26
+ * ~18 %, ≤ 10° per joint). `settle`: the tween overshoots ~12 % (≤ 8°), holds that 1 frame, then settles in
27
+ * 2 frames (default ease becomes 'out' instead of 'back'). Still rotation-only tweens at the pivots. */
28
+ poseTo?: {t: number; pose: string; dur?: number; ease?: Ease; anticipate?: boolean; settle?: boolean}[];
29
+ poseKeys?: Key<Partial<Pose>>[];
30
+ slide?: Key<{dx: number; dz?: number}>[];
31
+ hop?: {t: number; height?: number}[];
32
+ expr?: {t: number; v: Expr}[];
33
+ speaks?: {fromAbs: number; toAbs: number} | 'none';
34
+ bubble?: {t0: number; t1: number; text: string; scale?: number; dx?: number; dy?: number};
35
+ hold?: {prop: string; hand: 'L' | 'R'; text?: string; factId?: string};
36
+ led?: string; // bolt only: chest display text
37
+ ledFactId?: string;
38
+ mood?: string; // bolt only: visor drawing ('happy' | 'alarm' | 'dollar' | 'heart' | 'loading')
39
+ accessory?: string[];
40
+ /** One cycle or several (applied in order, each inside its own t0..t1). See CYCLE_KINDS. */
41
+ cycle?: CycleSpec | CycleSpec[];
42
+ blinkSeed?: number;
43
+ };
44
+
45
+ /** Acting cycles: pure functions of (shot time, seed) layered on the pose. Rotation at pivots + instant drawing
46
+ * swaps only, held on twos. walk · wave · idle (breathing bob + head tilt; default for extra:*) ·
47
+ * laugh (lean-back bounces, shoulder shake, laugh face, wide mouth flaps on a "ha" rhythm) ·
48
+ * talk (beat gestures on the actor's own word starts from words.json, alternating hands, small nods; a seeded
49
+ * rhythm when the actor has no words — mouths still move only on own words) · typing (hands bob over a desk) ·
50
+ * nod · shake (head "no") · panic (hands-up jitter) · celebrate (fist pumps + hops). */
51
+ export const CYCLE_KINDS = ['walk', 'wave', 'idle', 'laugh', 'talk', 'typing', 'nod', 'shake', 'panic', 'celebrate'] as const;
52
+ export type CycleKind = typeof CYCLE_KINDS[number];
53
+ /** amp scales the motion (default 1, 0.3–2). seed varies the rhythm (default: the actor's blinkSeed / id hash). */
54
+ export type CycleSpec = {kind: CycleKind; t0?: number; t1?: number; amp?: number; seed?: number};
55
+
56
+ /** Camera framing helper: aim at an actor at a standard shot size instead of hand-computing keys.
57
+ * wide = full figure with room · ms = hips up · mcu = chest up · cu = head and collar. `side` puts the actor on
58
+ * the left third (-1), centre (0) or right third (1); default = lead room (opposite to the actor's facing) for
59
+ * ms/mcu/cu, centre for wide. `dof` overrides the size's default depth of field. `push` = zoom factor reached
60
+ * at the shot's end (1.05 = a 5 % push-in, linear). Explicit camera.keys still override per field. */
61
+ export type FrameSize = 'wide' | 'ms' | 'mcu' | 'cu';
62
+ export type CameraFrame = {actor: string; size: FrameSize; side?: -1 | 0 | 1; dof?: number; push?: number};
63
+
64
+ export type PropSpec = {
65
+ id: string; ref: string; // "prop/desk@1", "sign:text", "stamp:approved"
66
+ at: AtProp;
67
+ scale?: number;
68
+ text?: string;
69
+ factId?: string;
70
+ factIds?: string[]; // multi-number props (ticker, receipt, scoreboard): every id's on_screen must appear in text
71
+ pop?: {t: number; dur?: number};
72
+ path?: {d: string; t0: number; t1: number; ease?: Ease; orient?: boolean};
73
+ keys?: Key<{dx?: number; dy?: number; rot?: number; scale?: number}>[];
74
+ noBlur?: boolean;
75
+ };
76
+
77
+ export type CloneSpec = {
78
+ ref: string; // ONE library asset, e.g. "cast/bolt" or "prop/coin@1"
79
+ count: number; seed: number;
80
+ area: {x: number; z: number; w: number; d: number};
81
+ enter?: {dx?: number; dy?: number; dur: number; stagger: number; t0: number};
82
+ loop?: 'walk' | 'bob' | 'fall' | 'none';
83
+ text?: string;
84
+ factId?: string;
85
+ scale?: number;
86
+ };
87
+
88
+ export type ChartSpec = {
89
+ kind: 'line' | 'bar' | 'bigNumber' | 'counter' | 'pie' | 'barRace';
90
+ data: unknown;
91
+ factIds: string[];
92
+ where: 'fullframe' | {screen: string};
93
+ t0?: number;
94
+ /** On-screen title: its numbers must be value/on_screen numbers of the chart's factIds (R14). */
95
+ title?: string;
96
+ /** The chart plots a computed dataset described by these facts (status `computed`, also listed in factIds):
97
+ * its plotted points, bar/pie/barRace values, category labels and axis ticks need not each equal a fact
98
+ * number. bigNumber/counter values and line end values must still match a cited fact. */
99
+ derivedFrom?: string[];
100
+ };
101
+
102
+ /** Cuts. Frame counts are the measured defaults (docs/styles/SHARED-GRAMMAR.md §4.5). Renderers without a native
103
+ * drawing map the newer kinds onto the closest classic one (TRANSITION_FALLBACK). */
104
+ export const TRANSITIONS = ['cut', 'whip', 'flash', 'zoomThrough', 'dip', 'wipe',
105
+ 'dissolve', 'flashIn', 'whipV', 'blurWhip', 'pageLift', 'pushBlur', 'paperSlide', 'tearReveal', 'inkBloom', 'vhsGlitch', 'panelWipe', 'iris', 'burst'] as const;
106
+ export type Transition = typeof TRANSITIONS[number];
107
+ /** Classic kind a renderer may draw instead of a newer one ('dissolve' is drawn natively by EpisodeFrame). */
108
+ export const TRANSITION_FALLBACK: Record<Transition, 'cut' | 'whip' | 'flash' | 'zoomThrough' | 'dip' | 'wipe' | 'dissolve'> = {
109
+ cut: 'cut', whip: 'whip', flash: 'flash', zoomThrough: 'zoomThrough', dip: 'dip', wipe: 'wipe', dissolve: 'dissolve',
110
+ flashIn: 'flash', whipV: 'whip', blurWhip: 'whip', pageLift: 'wipe', pushBlur: 'zoomThrough', paperSlide: 'wipe', tearReveal: 'wipe',
111
+ inkBloom: 'dip', vhsGlitch: 'flash', panelWipe: 'wipe', iris: 'dip', burst: 'flash',
112
+ };
113
+ /** Default length in frames of each transition's overlap/effect (dissolve: 30, its short variant 13). */
114
+ export const TRANSITION_FRAMES: Partial<Record<Transition, number>> = {dissolve: 30, flashIn: 3, whipV: 16, blurWhip: 7, pageLift: 17, pushBlur: 9,
115
+ paperSlide: 4, tearReveal: 12, inkBloom: 16, vhsGlitch: 4, panelWipe: 20, iris: 6, burst: 2};
116
+
117
+ /** Episode format (SHARED-GRAMMAR §4.1). Default 16:9 1920×1080 @ 30. */
118
+ export type Format = {aspect: '16:9' | '9:16'; width: 1920 | 1080; height: 1080 | 1920; fps: 24 | 30};
119
+ /** Episode caption track from words.json (§4.2); styles skin it. */
120
+ export type CaptionTrack = {mode: 'sentence' | 'chunk' | 'word' | 'quoteOnly' | 'none'; maxWords?: number; posY?: number; leadFrames?: number};
121
+ /** Word-keyed timing (§4.3): seconds, or a words.json index (+offset s), or the n-th pause ≥ 0.25 s. Accepted by
122
+ * overlays and fx today; resolveWhen() turns it into shot-local seconds. */
123
+ export type When = number | {word: number; offset?: number} | {pause: number};
124
+ export type Anchor = {x: number; y: number} | {actor: string} | {prop: string} | {lonlat: [number, number]; pin?: 'screen' | 'map'};
125
+ export type Corner = 'tl' | 'tr' | 'bl' | 'br' | 'tc' | 'bc';
126
+ /** Shared overlays (§4.4) drawn above the shot by EpisodeFrame (styles may skin them). Numbers need factIds (R14). */
127
+ export type Overlay =
128
+ | {kind: 'counter'; from?: number; to: number; t0: When; t1: When; factIds: string[]; at?: Anchor; prefix?: string; suffix?: string; dp?: number}
129
+ | {kind: 'chip'; text: string; at?: Corner; t0?: When; factIds?: string[]}
130
+ | {kind: 'callout'; text: string; sub?: string; anchor: Anchor; t0?: When; factIds?: string[]}
131
+ | {kind: 'stamp'; text: string; at?: Anchor; t0: When; factIds?: string[]}
132
+ | {kind: 'source'; text: string; factIds?: string[]}
133
+ | {kind: 'lowerThird'; name: string; place?: string; date?: string; factIds?: string[]}
134
+ | {kind: 'highlight'; style: 'ring' | 'arrow' | 'dotted' | 'pop' | 'focus'; target: Anchor; t0: When}
135
+ | {kind: 'mapInsert'; region: string; t0?: When};
136
+ /** Camera intent (§4.6); each renderer maps it to its own rig. Explicit camera.keys still win. */
137
+ export type CameraMove = {move: 'hold' | 'push' | 'pull' | 'drift' | 'truck' | 'tilt' | 'crane' | 'orbit' | 'dolly' | 'flight' | 'dive' | 'reveal';
138
+ speed?: 'slow' | 'med' | 'fast' | number; ease?: 'linear' | 'inOut' | 'out' | 'punch'; target?: Anchor};
139
+ /** Particle / light effects (§4.7), seeded from the shot id. */
140
+ export type Fx = {kind: 'snow' | 'embers' | 'dust' | 'fog' | 'flicker' | 'impact' | 'godRays' | 'glow' | 'shake'; t0?: When; amp?: number};
141
+ export const FX_KINDS = ['snow', 'embers', 'dust', 'fog', 'flicker', 'impact', 'godRays', 'glow', 'shake'] as const;
142
+ export type Grade = 'none' | 'golden' | 'night' | 'cold' | 'alarm' | 'up' | 'down';
143
+
144
+ export type Shot = {
145
+ id: string; // "S001" — stable; never renumber after Gate 3 (append S014a)
146
+ startAbs: number;
147
+ dur: number;
148
+ vo?: string;
149
+ anchorWord?: string;
150
+ /** 'beat' = a style-neutral shot drawn entirely by the shot's STYLE from `beat` (+ optional `look`). */
151
+ kind: 'world' | 'card' | 'gfx' | 'title' | 'beat';
152
+ /** `opts` that draw text (sign, tvText, nameplate, …: LibraryIndex sets[ref].textOpts) follow the prop-text
153
+ * rule: a number needs `factIds`, and every number must be a value/on_screen number of a cited fact (R14). */
154
+ set?: {ref: string; opts?: Record<string, unknown>; factIds?: string[]};
155
+ camera?: {preset?: string; frame?: CameraFrame; keys?: Key<Partial<Cam>>[]; shake?: {t: number; dur?: number; amp?: number}[]; move?: CameraMove};
156
+ actors?: ActorSpec[];
157
+ props?: PropSpec[];
158
+ clones?: CloneSpec[];
159
+ chart?: ChartSpec;
160
+ card?: {text: string; cps?: number; size?: number; factIds?: string[]};
161
+ title?: {text: string; sub?: string; factIds?: string[]};
162
+ grade?: Grade;
163
+ transitionOut?: Transition;
164
+ sfx?: {id: string; at: number; vol?: number}[];
165
+ musicCue?: string;
166
+ note?: string;
167
+ /** Per-shot style override (a style registry id, see @reelforge/styles). Default: the episode's `style`. */
168
+ style?: StyleId;
169
+ /** What the shot SAYS, independent of how a style draws it ("one script, many styles"). Required for
170
+ * kind 'beat'; optional elsewhere (any style other than the shot's own may re-render the shot from it). */
171
+ beat?: Beat;
172
+ /** Style-specific extension payload, validated by the style's shot schema (@reelforge/styles). Every string
173
+ * in it is treated as on-screen text for R14 (numbers need beat.factIds / look.factIds). */
174
+ look?: Look;
175
+ /** Shared overlays drawn above the shot (counter, chip, callout, stamp, source, lowerThird, highlight, mapInsert). */
176
+ overlays?: Overlay[];
177
+ /** Particle / light effects above the shot. */
178
+ fx?: Fx[];
179
+ /** Animation cadence for this shot (overrides the episode's): drawRate = texture/boil rate; stepFps = whole-frame
180
+ * step (stop-motion holds: 12 fps holds every 2–3 frames at 30 fps). */
181
+ drawRate?: 12 | 15 | 30;
182
+ stepFps?: 12 | 15;
183
+ /** LIBRARY plate only: one-time, Jacob-approved art logged in library/ORIGINS.md (ref "plate/<style>/<name>@<v>").
184
+ * Every style must render without it; it is never generated per shot (R13). */
185
+ plate?: {ref: string};
186
+ };
187
+
188
+ /** Style registry id (lowercase kebab). 'cutout' = the paper-cutout 2.5D cartoon (the original engine). */
189
+ export type StyleId = string;
190
+ export const DEFAULT_STYLE: StyleId = 'cutout';
191
+ export const STYLE_ID_RE = /^[a-z][a-z0-9-]{1,31}$/;
192
+
193
+ /** Style-neutral shot intents. Every style must draw every kind (a style may map several to one layout). */
194
+ export const BEAT_KINDS = ['hook', 'establish', 'character', 'number', 'compare', 'list', 'rule', 'map', 'timeline', 'reveal', 'quote', 'outro'] as const;
195
+ export type BeatKind = typeof BEAT_KINDS[number];
196
+ /** Shared vocabulary. Styles draw these in their own way; unknown ids fall back to a generic figure / place / icon. */
197
+ export const BEAT_WHO = ['narrator', 'kid', 'leader', 'rival', 'worker', 'merchant', 'crowd', 'detective', 'stranger', 'family'] as const;
198
+ export const BEAT_WHERE = ['city', 'street', 'desk', 'office', 'village', 'countryside', 'sea', 'sky', 'bank', 'home', 'night-road', 'map'] as const;
199
+ export const BEAT_ICONS = ['coin', 'house', 'clock', 'ship', 'car', 'bread', 'phone', 'factory', 'bank', 'key', 'eye', 'door', 'moon', 'sun',
200
+ 'tree', 'crown', 'scale', 'chart-up', 'chart-down', 'warning', 'skull', 'check', 'cross', 'person', 'letter', 'globe'] as const;
201
+ export const BEAT_MOODS = ['neutral', 'tense', 'warm', 'dark', 'triumph', 'funny'] as const;
202
+ export type BeatMood = typeof BEAT_MOODS[number];
203
+
204
+ export type Beat = {
205
+ kind: BeatKind;
206
+ head?: string; // the big on-screen line (≤ 60 chars)
207
+ sub?: string; // secondary line (≤ 90 chars)
208
+ items?: string[]; // list / rule / timeline / compare entries (≤ 6, each ≤ 48 chars)
209
+ who?: string[]; // BEAT_WHO archetypes (never real people)
210
+ where?: string; // BEAT_WHERE place archetype
211
+ icons?: string[]; // BEAT_ICONS
212
+ /** A headline number (counter / big number). value (and from) must equal a cited fact number (R14). */
213
+ number?: {value: number; from?: number; prefix?: string; suffix?: string; dp?: number; label?: string; render?: 'digits' | 'words' | 'counter'};
214
+ factIds?: string[]; // facts for every number in head/sub/items/number
215
+ mood?: BeatMood;
216
+ accent?: string; // a word of `head` the style may accent (colour, underline, stamp)
217
+ };
218
+
219
+ /** Style extension: `kind` picks one of the style's own layouts (its kinds menu); the rest is style-defined. */
220
+ export type Look = {kind?: string; factIds?: string[]; [k: string]: unknown};
221
+
222
+ export type Episode = {
223
+ /** fps/width/height mirror `format` (default 30 / 1920 / 1080). */
224
+ dslVersion: 1; videoId: string; fps: 24 | 30; width: 1920 | 1080; height: 1080 | 1920;
225
+ format?: Format;
226
+ captions?: CaptionTrack;
227
+ drawRate?: 12 | 15 | 30;
228
+ stepFps?: 12 | 15;
229
+ vo?: {file: string; words: string};
230
+ libraryVersion: string;
231
+ /** Episode is a "What If" scenario: facts with status `scenario` (hypothetical numbers approved at Gate 2,
232
+ * e.g. "$1/HR") may go on screen. Without this flag only verified/computed facts may. */
233
+ hypothetical?: boolean;
234
+ /** The render style for every shot (a style registry id). Default 'cutout'. Shots may override with `style`. */
235
+ style?: StyleId;
236
+ shots: Shot[];
237
+ };
238
+
239
+ /** Validated shots carry resolved marks (`at` becomes {x,z,mark?}) and defaults filled in. */
240
+ export type ResolvedAt = {x: number; z: number; y?: number; mark?: string};
Binary file
Binary file